From b6d349dcf6b07ff191a9a963eee888d3099a8970 Mon Sep 17 00:00:00 2001 From: Sagar Kamble Date: Wed, 24 Nov 2021 21:01:01 +0530 Subject: [PATCH] gpu: nvgpu: init all buffer compbits state members User fence syncpt_id in the buffer compbits state was set to 0 on allocation through PREPARE_COMPRESSIBLE_READ ioctl or MARK_COMPRESSIBLE_WRITE ioctl. In case NVGPU_GPU_COMPBITS_GPU is requested through the ioctl PREPARE_COMPRESSIBLE_READ, CDE conversion command is not submitted and the output fence is cloned from the initial state fence (with syncpt_id=0). NvRmSyncWait on this fence from userspace lead to below error: 13e40000.host1x: nvhost_syncpt_wait_timeout: invalid syncpoint id 0 Initialize the buffer compbits state user fence syncpt_id to NVGPU_INVALID_SYNCPT_ID with nvgpu_user_sync_init() so that the userspace skips the NvRmSyncWait on that fence. While at it, initialize other uninitialized members, valid_compbits and zbc_color. Bug 3360675 Change-Id: Ie2a584546e1ed37841cbdc3472b598794f911e6f Signed-off-by: Sagar Kamble Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2631235 Reviewed-by: svcacv Reviewed-by: Konsta Holtta Reviewed-by: Deepak Nibade Reviewed-by: mobile promotions Tested-by: mobile promotions GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/os/linux/dmabuf_priv.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/nvgpu/os/linux/dmabuf_priv.c b/drivers/gpu/nvgpu/os/linux/dmabuf_priv.c index b3d7febe7..6474a2a75 100644 --- a/drivers/gpu/nvgpu/os/linux/dmabuf_priv.c +++ b/drivers/gpu/nvgpu/os/linux/dmabuf_priv.c @@ -305,6 +305,9 @@ int gk20a_dmabuf_get_state(struct dma_buf *dmabuf, struct gk20a *g, } s->offset = offset; + s->fence = nvgpu_user_fence_init(); + s->valid_compbits = 0; + s->zbc_color = 0; nvgpu_init_list_node(&s->list); nvgpu_mutex_init(&s->lock); nvgpu_list_add_tail(&s->list, &priv->states);