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 <natsu@google.com>
Commit-Queue: Jason Macnak <natsu@google.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
This commit is contained in:
Jason Macnak 2022-06-02 12:42:02 -07:00 committed by Chromeos LUCI
parent 26960909ad
commit f08bb293f6

View file

@ -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