Merge remote-tracking branch 'goog/mirror-aosp-master' into 'goog/tm-dev'

... to update Minigbm for Goldfish to pull in P010 support from
https://crrev.com/c/3579857

Bug: b/191084459
Test: cvd start --gpu_mode=gfxstream
Test: Camera2Video sample app
Test: cts -m CtsCameraTestCases
Change-Id: I1257909949c4831fbbc3064cea269c429da16748
(cherry picked from commit 722a08bb8ac941fb2a077b63673a805c5527c651)
Merged-In: I1257909949c4831fbbc3064cea269c429da16748
diff --git a/virtgpu_virgl.c b/virtgpu_virgl.c
index 9846313..8bcfc9d 100644
--- a/virtgpu_virgl.c
+++ b/virtgpu_virgl.c
@@ -92,6 +92,8 @@
 		return VIRGL_FORMAT_NV12;
 	case DRM_FORMAT_NV21:
 		return VIRGL_FORMAT_NV21;
+	case DRM_FORMAT_P010:
+		return VIRGL_FORMAT_P010;
 	case DRM_FORMAT_YVU420:
 	case DRM_FORMAT_YVU420_ANDROID:
 		return VIRGL_FORMAT_YV12;
@@ -634,8 +636,12 @@
 	/* Android CTS tests require this. */
 	virgl_add_combination(drv, DRM_FORMAT_RGB888, &LINEAR_METADATA, BO_USE_SW_MASK);
 	virgl_add_combination(drv, DRM_FORMAT_BGR888, &LINEAR_METADATA, BO_USE_SW_MASK);
-	virgl_add_combination(drv, DRM_FORMAT_P010, &LINEAR_METADATA, BO_USE_TEXTURE |
-			      BO_USE_SW_MASK | BO_USE_CAMERA_READ | BO_USE_CAMERA_WRITE);
+	/* Android Camera CTS tests requires this. Additionally, the scanout usage is needed for
+	 * Camera preview and is expected to be conditionally stripped by virgl_add_combination
+	 * when not natively supported and instead handled by HWComposer. */
+	virgl_add_combination(drv, DRM_FORMAT_P010, &LINEAR_METADATA,
+			      BO_USE_SCANOUT | BO_USE_TEXTURE | BO_USE_SW_MASK |
+				  BO_USE_CAMERA_READ | BO_USE_CAMERA_WRITE);
 	drv_modify_combination(drv, DRM_FORMAT_R8, &LINEAR_METADATA,
 			       BO_USE_CAMERA_READ | BO_USE_CAMERA_WRITE | BO_USE_HW_VIDEO_DECODER |
 				   BO_USE_HW_VIDEO_ENCODER | BO_USE_GPU_DATA_BUFFER);
@@ -800,7 +806,7 @@
 	// Invalidate is only necessary if the host writes to the buffer. The encoder and
 	// decoder flags don't differentiate between input and output buffers, but we can
 	// use the format to determine whether this buffer could be encoder/decoder output.
-	host_write_flags = BO_USE_RENDERING | BO_USE_CAMERA_WRITE;
+	host_write_flags = BO_USE_RENDERING | BO_USE_CAMERA_WRITE | BO_USE_GPU_DATA_BUFFER;
 	if (bo->meta.format == DRM_FORMAT_R8)
 		host_write_flags |= BO_USE_HW_VIDEO_ENCODER;
 	else