summaryrefslogtreecommitdiff
path: root/gbm.c
diff options
context:
space:
mode:
authorKristian H. Kristensen <hoegsberg@chromium.org>2016-09-06 11:43:26 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-12-21 22:24:10 -0800
commitb1efbd8d169f6d72f69a0f381db9f6dc80e372bf (patch)
tree853a3bed51e29830af465eacdb2a264dc3425d55 /gbm.c
parent3fa6dff290d82b3d689e0700e17b52ed28ce2614 (diff)
rockchip: Add support for AFBC buffers
This adds support for allocating AFBC (ARM FrameBuffer Compression) buffers with minigbm for Rockchip SoCs. AFBC buffers are allocated through the new gbm_bo_create_with_modifiers() entry point. Callers are responsible for determining which modifiers are valid for the intended use case and pass in that list. gbm will then pick the optimal modifier and allocate a buffer with that layout. The chosen modifier can be queries through gbm_bo_get_format_modifier(). Callers of the new entry point are expected to forward the modifier when using the buffer with other APIs (EGL, KMS etc). The old gbm_bo_create() entry point continues to work as before and won't allocate AFBC buffers. BUG=chrome-os-partner:56407 TEST=drm-tests null_platform_test with AFBC support Change-Id: I1aa345b0d79c4545b7bfc17e9699ef6ad57c68e2 Reviewed-on: https://chromium-review.googlesource.com/386318 Commit-Ready: Kristian H. Kristensen <hoegsberg@chromium.org> Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Diffstat (limited to 'gbm.c')
-rw-r--r--gbm.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/gbm.c b/gbm.c
index 1a81e7e..6ad32ce 100644
--- a/gbm.c
+++ b/gbm.c
@@ -137,6 +137,32 @@ PUBLIC struct gbm_bo *gbm_bo_create(struct gbm_device *gbm, uint32_t width,
return bo;
}
+PUBLIC struct gbm_bo *gbm_bo_create_with_modifiers(struct gbm_device *gbm,
+ uint32_t width,
+ uint32_t height,
+ uint32_t format,
+ const uint64_t *modifiers,
+ uint32_t count)
+{
+ struct gbm_bo *bo;
+
+ bo = gbm_bo_new(gbm, format);
+
+ if (!bo)
+ return NULL;
+
+ bo->bo = drv_bo_create_with_modifiers(gbm->drv,
+ width, height, format,
+ modifiers, count);
+
+ if (!bo->bo) {
+ free(bo);
+ return NULL;
+ }
+
+ return bo;
+}
+
PUBLIC void gbm_bo_destroy(struct gbm_bo *bo)
{
if (bo->destroy_user_data) {