Add GBM_BO_USE_HW_VIDEO_ENCODER use flag

Chrome needs to allocate a linear buffer that a hardware video encoder can read
and cpu can read and write. There is no use flag in gbm that specifies the
former. This CL introduces a new use flag for that.

BUG=b:138703716
TEST=None

Change-Id: Ied0321914a366294a47e4fc5c2a8f08ee0351bd8
Reviewed-on: https://chromium-review.googlesource.com/1728729
Tested-by: Hirokazu Honda <hiroh@chromium.org>
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
diff --git a/mediatek.c b/mediatek.c
index 8842850..fd0c126 100644
--- a/mediatek.c
+++ b/mediatek.c
@@ -53,6 +53,13 @@
 	drv_add_combinations(drv, texture_source_formats, ARRAY_SIZE(texture_source_formats),
 			     &LINEAR_METADATA, BO_USE_TEXTURE_MASK);
 
+	/*
+	 * Chrome uses DMA-buf mmap to write to YV12 buffers, which are then accessed by the
+	 * Video Encoder Accelerator (VEA). It could also support NV12 potentially in the future.
+	 */
+	drv_modify_combination(drv, DRM_FORMAT_YVU420, &LINEAR_METADATA, BO_USE_HW_VIDEO_ENCODER);
+	drv_modify_combination(drv, DRM_FORMAT_NV12, &LINEAR_METADATA, BO_USE_HW_VIDEO_ENCODER);
+
 	/* Android CTS tests require this. */
 	drv_add_combination(drv, DRM_FORMAT_BGR888, &LINEAR_METADATA, BO_USE_SW_MASK);