Skip to content

Commit 7e78781

Browse files
gurchetansinghkraxel
authored andcommitted
drm/virtgpu api: define a dummy fence signaled event
The current virtgpu implementation of poll(..) drops events when VIRTGPU_CONTEXT_PARAM_POLL_RINGS_MASK is enabled (otherwise it's like a normal DRM driver). This is because paravirtualized userspaces receives responses in a buffer of type BLOB_MEM_GUEST, not by read(..). To be in line with other DRM drivers and avoid specialized behavior, it is possible to define a dummy event for virtgpu. Paravirtualized userspace will now have to call read(..) on the DRM fd to receive the dummy event. Fixes: b107904 ("drm/virtgpu api: create context init feature") Reported-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/20211122232210.602-2-gurchetansingh@google.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
1 parent e048834 commit 7e78781

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

‎drivers/gpu/drm/virtio/virtgpu_drv.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ struct virtio_gpu_fence_driver {
138138
spinlock_t lock;
139139
};
140140

141-
#define VIRTGPU_EVENT_FENCE_SIGNALED_INTERNAL 0x10000000
142141
struct virtio_gpu_fence_event {
143142
struct drm_pending_event base;
144143
struct drm_event event;

‎drivers/gpu/drm/virtio/virtgpu_ioctl.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static int virtio_gpu_fence_event_create(struct drm_device *dev,
5454
if (!e)
5555
return -ENOMEM;
5656

57-
e->event.type = VIRTGPU_EVENT_FENCE_SIGNALED_INTERNAL;
57+
e->event.type = VIRTGPU_EVENT_FENCE_SIGNALED;
5858
e->event.length = sizeof(e->event);
5959

6060
ret = drm_event_reserve_init(dev, file, &e->base, &e->event);

‎include/uapi/drm/virtgpu_drm.h‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,13 @@ struct drm_virtgpu_context_init {
196196
__u64 ctx_set_params;
197197
};
198198

199+
/*
200+
* Event code that's given when VIRTGPU_CONTEXT_PARAM_POLL_RINGS_MASK is in
201+
* effect. The event size is sizeof(drm_event), since there is no additional
202+
* payload.
203+
*/
204+
#define VIRTGPU_EVENT_FENCE_SIGNALED 0x90000000
205+
199206
#define DRM_IOCTL_VIRTGPU_MAP \
200207
DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_MAP, struct drm_virtgpu_map)
201208

0 commit comments

Comments
 (0)