minigbm: Add SCANOUT and PROTECTED for P010 buffers
BUG=b:153111783,b:155511259
TEST=P010 buffers scanout to overlay on TGL
Change-Id: Ib06508a38c8c86b40d3e6082a79051594252697d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2574672
Tested-by: J Kardatzke <jkardatzke@chromium.org>
Tested-by: Jeffrey Kardatzke <jkardatzke@google.com>
Commit-Queue: Jeffrey Kardatzke <jkardatzke@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
diff --git a/i915.c b/i915.c
index b45cbfe..377e1c7 100644
--- a/i915.c
+++ b/i915.c
@@ -103,7 +103,8 @@
scanout_and_render = BO_USE_RENDER_MASK | BO_USE_SCANOUT;
render = BO_USE_RENDER_MASK;
texture_only = BO_USE_TEXTURE_MASK;
- hw_protected = (i915->has_hw_protection) ? BO_USE_PROTECTED : 0;
+ // HW protected buffers also need to be scanned out.
+ hw_protected = i915->has_hw_protection ? (BO_USE_PROTECTED | BO_USE_SCANOUT) : 0;
uint64_t linear_mask =
BO_USE_RENDERSCRIPT | BO_USE_LINEAR | BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN;
@@ -159,16 +160,17 @@
unset_flags(scanout_and_render, BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY);
/* Support y-tiled NV12 and P010 for libva */
#ifdef I915_SCANOUT_Y_TILED
- drv_add_combination(drv, DRM_FORMAT_NV12, &metadata,
- BO_USE_TEXTURE | BO_USE_HW_VIDEO_DECODER | BO_USE_SCANOUT |
- hw_protected);
+ uint64_t nv12_usage =
+ BO_USE_TEXTURE | BO_USE_HW_VIDEO_DECODER | BO_USE_SCANOUT | hw_protected;
+ uint64_t p010_usage = BO_USE_TEXTURE | BO_USE_HW_VIDEO_DECODER | hw_protected;
#else
- drv_add_combination(drv, DRM_FORMAT_NV12, &metadata,
- BO_USE_TEXTURE | BO_USE_HW_VIDEO_DECODER);
+ uint64_t nv12_usage = BO_USE_TEXTURE | BO_USE_HW_VIDEO_DECODER;
+ uint64_t p010_usage = nv12_usage;
#endif
+ drv_add_combination(drv, DRM_FORMAT_NV12, &metadata, nv12_usage);
+ drv_add_combination(drv, DRM_FORMAT_P010, &metadata, p010_usage);
+
scanout_and_render = unset_flags(scanout_and_render, BO_USE_SCANOUT);
- drv_add_combination(drv, DRM_FORMAT_P010, &metadata,
- BO_USE_TEXTURE | BO_USE_HW_VIDEO_DECODER);
drv_add_combinations(drv, render_formats, ARRAY_SIZE(render_formats), &metadata, render);
drv_add_combinations(drv, scanout_render_formats, ARRAY_SIZE(scanout_render_formats),