linux/drivers/gpu/drm/virtio
Gurchetan Singh 36549848ed drm/virtio: consider dma-fence context when signaling
This an incremental refactor towards multiple dma-fence contexts
in virtio-gpu.  Since all fences are still allocated using
&virtio_gpu_fence_driver.context, nothing should break and every
processed fence will be signaled.

The overall idea is every 3D context can allocate a number of
dma-fence contexts.  Each dma-fence context refers to it's own
timeline.

For example, consider the following case where virgl submits
commands to the GPU (fence ids 1, 3) and does a metadata query with
the CPU (fence id 5).  In a different process, gfxstream submits
commands to the GPU (fence ids 2, 4).

fence_id (&dma_fence.seqno)       | 1 2 3 4 5
----------------------------------|-----------
fence_ctx 0 (virgl gpu)           | 1   3
fence_ctx 1 (virgl metadata query)|         5
fence_ctx 2 (gfxstream gpu)       |   2   4

With multiple fence contexts, we can wait for the metadata query
to finish without waiting for the virgl gpu to finish.  virgl gpu
does not have to wait for gfxstream gpu.  The fence id still is the
monotonically increasing sequence number, but it's only revelant to
the specific dma-fence context.

To fully enable this feature, we'll need to:
  - have each 3d context allocate a number of fence contexts. Not
    too hard with explicit context initialization on the horizon.
  - have guest userspace specify fence context when performing
    ioctls.
  - tag each fence emitted to the host with the fence context
    information.  virtio_gpu_ctrl_hdr has padding + flags available,
    so that should be easy.

This change goes in the direction specified above, by:
  - looking up the virtgpu_fence given a fence_id
  - signalling all prior fences in a given context
  - signalling current fence

v2: fix grammar in comment
v3: add r-b tags

Reviewed-by: Anthoine Bourgeois <anthoine.bourgeois@gmail.com>
Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20201201021623.619-3-gurchetansingh@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2020-12-02 11:48:14 +01:00
..
Kconfig drm: virtio: fix kconfig dependency warning 2020-08-31 08:55:02 +02:00
Makefile drm/virtio: implement blob resources: implement vram object 2020-09-29 11:23:33 +02:00
virtgpu_debugfs.c drm/virtio: virtio_{blah} --> virtio_gpu_{blah} 2020-12-02 11:48:14 +01:00
virtgpu_display.c drm: Use state helper instead of CRTC state pointer 2020-11-10 12:41:06 +01:00
virtgpu_drv.c drm/<drivers>: Constify struct drm_driver 2020-11-06 10:31:26 +01:00
virtgpu_drv.h drm/virtio: consider dma-fence context when signaling 2020-12-02 11:48:14 +01:00
virtgpu_fence.c drm/virtio: consider dma-fence context when signaling 2020-12-02 11:48:14 +01:00
virtgpu_gem.c drm/virtio: Use struct_size() helper in kmalloc() 2020-08-17 13:08:43 +02:00
virtgpu_ioctl.c drm/virtio: suffix create blob call with _ioctl like any ioctl 2020-11-20 10:44:41 +01:00
virtgpu_kms.c drm/virtio: implement blob resources: implement vram object 2020-09-29 11:23:33 +02:00
virtgpu_object.c drm/shmem-helper: Use cached mappings by default 2020-11-24 09:10:21 +01:00
virtgpu_plane.c drm/virtio: implement blob resources: blob display integration 2020-09-29 11:23:42 +02:00
virtgpu_prime.c drm/virtio: Make virtgpu_dmabuf_ops with static keyword 2020-11-16 08:53:23 +01:00
virtgpu_trace_points.c
virtgpu_trace.h
virtgpu_vq.c drm/virtio: Fix a double free in virtio_gpu_cmd_map() 2020-11-06 08:50:30 +01:00
virtgpu_vram.c drm/virtio: implement blob resources: resource create blob ioctl 2020-09-29 11:23:51 +02:00