diff options
author | Gurchetan Singh <gurchetansingh@google.com> | 2017-05-15 09:34:22 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-05-23 23:59:12 -0700 |
commit | 8ac0c9a9550bd1fa57e49613fae45df9001f74fc (patch) | |
tree | 6ca0f0ccdcddc6ddc2bdf31a7bcaf307005477ac /rockchip.c | |
parent | de558ae8a22cbd6c0b25691b56c6fd4884ec3ac5 (diff) |
minigbm: remove BO_USE_RENDERING from certain formats
We can't use GR88, R8, YV12, NV12, UYVY, YUYV buffers as render
targets, so let's remove the BO_USE_RENDERING flag from these
formats. However, we can sample from these formats (though this
feature still needs to be enabled in our drivers), so the
BO_USE_TEXTURE flag remains set.
Also, change our interpretation of the GRALLOC_USAGE_HW_COMPOSER
flag such that it implies BO_USE_SCANOUT | BO_USE_TEXTURE. This
is because the OpenGL fallback textures from the buffer if
can't be scanned-out, not renders to it.
BUG=none
TEST=run Youtube app on Kevin
Change-Id: I9ea8452279e110bc1a9579f162abe1c72192eb40
Reviewed-on: https://chromium-review.googlesource.com/506812
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Diffstat (limited to 'rockchip.c')
-rw-r--r-- | rockchip.c | 27 |
1 files changed, 19 insertions, 8 deletions
@@ -18,11 +18,12 @@ #include "helpers.h" #include "util.h" -static const uint32_t supported_formats[] = { DRM_FORMAT_ABGR8888, DRM_FORMAT_ARGB8888, - DRM_FORMAT_NV12, DRM_FORMAT_R8, - DRM_FORMAT_RGB565, DRM_FORMAT_XBGR8888, - DRM_FORMAT_XRGB8888, DRM_FORMAT_YVU420, - DRM_FORMAT_YVU420_ANDROID }; +static const uint32_t render_target_formats[] = { DRM_FORMAT_ABGR8888, DRM_FORMAT_ARGB8888, + DRM_FORMAT_RGB565, DRM_FORMAT_XBGR8888, + DRM_FORMAT_XRGB8888 }; + +static const uint32_t texture_source_formats[] = { DRM_FORMAT_R8, DRM_FORMAT_NV12, + DRM_FORMAT_YVU420, DRM_FORMAT_YVU420_ANDROID }; static int afbc_bo_from_format(struct bo *bo, uint32_t width, uint32_t height, uint32_t format) { @@ -71,7 +72,7 @@ static int afbc_bo_from_format(struct bo *bo, uint32_t width, uint32_t height, u static int rockchip_add_kms_item(struct driver *drv, const struct kms_item *item) { int ret; - uint32_t i; + uint32_t i, j; uint64_t flags; struct combination *combo; struct format_metadata metadata; @@ -85,6 +86,11 @@ static int rockchip_add_kms_item(struct driver *drv, const struct kms_item *item metadata.tiling = 0; metadata.priority = 2; + for (j = 0; j < ARRAY_SIZE(texture_source_formats); j++) { + if (item->format == texture_source_formats[j]) + flags &= ~BO_USE_RENDERING; + } + ret = drv_add_combination(drv, item[i].format, &metadata, flags); if (ret) return ret; @@ -108,8 +114,13 @@ static int rockchip_init(struct driver *drv) metadata.priority = 1; metadata.modifier = DRM_FORMAT_MOD_NONE; - ret = drv_add_combinations(drv, supported_formats, ARRAY_SIZE(supported_formats), &metadata, - BO_COMMON_USE_MASK); + ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), + &metadata, BO_USE_RENDER_MASK); + if (ret) + return ret; + + ret = drv_add_combinations(drv, texture_source_formats, ARRAY_SIZE(texture_source_formats), + &metadata, BO_USE_TEXTURE_MASK); if (ret) return ret; |