From f08bb293f6d9e99fd3205ea993d8a770bc16a0d5 Mon Sep 17 00:00:00 2001 From: Jason Macnak Date: Thu, 2 Jun 2022 12:42:02 -0700 Subject: [PATCH] virtgpu_virgl: invalidate with BO_USE_GPU_DATA_BUFFER ... as the host may write to the buffer in a compute shader. BUG=b:234513607 TEST=cts -m CtsNativeHardwareTestCases -t android.hardware.nativehardware.cts.AHardwareBufferNativeTests#Blob_BlobTest_GpuDataBufferCpuRead_BLOB Change-Id: Ied49e7861e9ae0cbc9e25ecfb7feec30cc733864 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3688450 Tested-by: Jason Macnak Commit-Queue: Jason Macnak Reviewed-by: Yiwei Zhang --- virtgpu_virgl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/virtgpu_virgl.c b/virtgpu_virgl.c index 163865b..4a8c713 100644 --- a/virtgpu_virgl.c +++ b/virtgpu_virgl.c @@ -805,7 +805,7 @@ static int virgl_bo_invalidate(struct bo *bo, struct mapping *mapping) // 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