Commit 7e78781d authored by Gurchetan Singh's avatar Gurchetan Singh Committed by Gerd Hoffmann

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: b1079043 ("drm/virtgpu api: create context init feature")
Reported-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: default avatarGurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20211122232210.602-2-gurchetansingh@google.comSigned-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
parent e048834c
...@@ -138,7 +138,6 @@ struct virtio_gpu_fence_driver { ...@@ -138,7 +138,6 @@ struct virtio_gpu_fence_driver {
spinlock_t lock; spinlock_t lock;
}; };
#define VIRTGPU_EVENT_FENCE_SIGNALED_INTERNAL 0x10000000
struct virtio_gpu_fence_event { struct virtio_gpu_fence_event {
struct drm_pending_event base; struct drm_pending_event base;
struct drm_event event; struct drm_event event;
......
...@@ -54,7 +54,7 @@ static int virtio_gpu_fence_event_create(struct drm_device *dev, ...@@ -54,7 +54,7 @@ static int virtio_gpu_fence_event_create(struct drm_device *dev,
if (!e) if (!e)
return -ENOMEM; return -ENOMEM;
e->event.type = VIRTGPU_EVENT_FENCE_SIGNALED_INTERNAL; e->event.type = VIRTGPU_EVENT_FENCE_SIGNALED;
e->event.length = sizeof(e->event); e->event.length = sizeof(e->event);
ret = drm_event_reserve_init(dev, file, &e->base, &e->event); ret = drm_event_reserve_init(dev, file, &e->base, &e->event);
......
...@@ -196,6 +196,13 @@ struct drm_virtgpu_context_init { ...@@ -196,6 +196,13 @@ struct drm_virtgpu_context_init {
__u64 ctx_set_params; __u64 ctx_set_params;
}; };
/*
* Event code that's given when VIRTGPU_CONTEXT_PARAM_POLL_RINGS_MASK is in
* effect. The event size is sizeof(drm_event), since there is no additional
* payload.
*/
#define VIRTGPU_EVENT_FENCE_SIGNALED 0x90000000
#define DRM_IOCTL_VIRTGPU_MAP \ #define DRM_IOCTL_VIRTGPU_MAP \
DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_MAP, struct drm_virtgpu_map) DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_MAP, struct drm_virtgpu_map)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment