Skip to content

Commit eba57fb

Browse files
committed
drm/virtio: Wait for each dma-fence of in-fence array individually
Use dma-fence-unwrap API for waiting each dma-fence of the in-fence array individually. Sync file's in-fence array always has a non-matching fence context ID, which doesn't allow to skip waiting of fences with a matching context ID in a case of a merged sync file fence. Suggested-by: Rob Clark <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Tested-by: Pierre-Eric Pelloux-Prayer <[email protected]> Signed-off-by: Dmitry Osipenko <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent e4812ab commit eba57fb

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

drivers/gpu/drm/virtio/virtgpu_submit.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ struct virtio_gpu_submit {
3232
void *buf;
3333
};
3434

35-
static int virtio_gpu_dma_fence_wait(struct virtio_gpu_submit *submit,
36-
struct dma_fence *in_fence)
35+
static int virtio_gpu_do_fence_wait(struct virtio_gpu_submit *submit,
36+
struct dma_fence *in_fence)
3737
{
3838
u32 context = submit->fence_ctx + submit->ring_idx;
3939

@@ -43,6 +43,22 @@ static int virtio_gpu_dma_fence_wait(struct virtio_gpu_submit *submit,
4343
return dma_fence_wait(in_fence, true);
4444
}
4545

46+
static int virtio_gpu_dma_fence_wait(struct virtio_gpu_submit *submit,
47+
struct dma_fence *fence)
48+
{
49+
struct dma_fence_unwrap itr;
50+
struct dma_fence *f;
51+
int err;
52+
53+
dma_fence_unwrap_for_each(f, &itr, fence) {
54+
err = virtio_gpu_do_fence_wait(submit, f);
55+
if (err)
56+
return err;
57+
}
58+
59+
return 0;
60+
}
61+
4662
static int virtio_gpu_fence_event_create(struct drm_device *dev,
4763
struct drm_file *file,
4864
struct virtio_gpu_fence *fence,

0 commit comments

Comments
 (0)