mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 23:03:57 -04:00
drm/virtio: add drm_driver.release callback.
Split virtio_gpu_deinit(), move the drm shutdown and release to
virtio_gpu_release(). Drop vqs_ready variable, instead use
drm_dev_{enter,exit,unplug} to avoid touching hardware after
device removal. Tidy up here and there.
v4: add changelog.
v3: use drm_dev_*().
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20200211135805.24436-1-kraxel@redhat.com
This commit is contained in:
@@ -330,7 +330,14 @@ static void virtio_gpu_queue_ctrl_sgs(struct virtio_gpu_device *vgdev,
|
||||
{
|
||||
struct virtqueue *vq = vgdev->ctrlq.vq;
|
||||
bool notify = false;
|
||||
int ret;
|
||||
int ret, idx;
|
||||
|
||||
if (!drm_dev_enter(vgdev->ddev, &idx)) {
|
||||
if (fence && vbuf->objs)
|
||||
virtio_gpu_array_unlock_resv(vbuf->objs);
|
||||
free_vbuf(vgdev, vbuf);
|
||||
return;
|
||||
}
|
||||
|
||||
if (vgdev->has_indirect)
|
||||
elemcnt = 1;
|
||||
@@ -338,14 +345,6 @@ static void virtio_gpu_queue_ctrl_sgs(struct virtio_gpu_device *vgdev,
|
||||
again:
|
||||
spin_lock(&vgdev->ctrlq.qlock);
|
||||
|
||||
if (!vgdev->vqs_ready) {
|
||||
spin_unlock(&vgdev->ctrlq.qlock);
|
||||
|
||||
if (fence && vbuf->objs)
|
||||
virtio_gpu_array_unlock_resv(vbuf->objs);
|
||||
return;
|
||||
}
|
||||
|
||||
if (vq->num_free < elemcnt) {
|
||||
spin_unlock(&vgdev->ctrlq.qlock);
|
||||
wait_event(vgdev->ctrlq.ack_queue, vq->num_free >= elemcnt);
|
||||
@@ -379,6 +378,7 @@ again:
|
||||
else
|
||||
virtqueue_notify(vq);
|
||||
}
|
||||
drm_dev_exit(idx);
|
||||
}
|
||||
|
||||
static void virtio_gpu_queue_fenced_ctrl_buffer(struct virtio_gpu_device *vgdev,
|
||||
@@ -460,12 +460,13 @@ static void virtio_gpu_queue_cursor(struct virtio_gpu_device *vgdev,
|
||||
{
|
||||
struct virtqueue *vq = vgdev->cursorq.vq;
|
||||
struct scatterlist *sgs[1], ccmd;
|
||||
int idx, ret, outcnt;
|
||||
bool notify;
|
||||
int ret;
|
||||
int outcnt;
|
||||
|
||||
if (!vgdev->vqs_ready)
|
||||
if (!drm_dev_enter(vgdev->ddev, &idx)) {
|
||||
free_vbuf(vgdev, vbuf);
|
||||
return;
|
||||
}
|
||||
|
||||
sg_init_one(&ccmd, vbuf->buf, vbuf->size);
|
||||
sgs[0] = &ccmd;
|
||||
@@ -490,6 +491,8 @@ retry:
|
||||
|
||||
if (notify)
|
||||
virtqueue_notify(vq);
|
||||
|
||||
drm_dev_exit(idx);
|
||||
}
|
||||
|
||||
/* just create gem objects for userspace and long lived objects,
|
||||
|
||||
Reference in New Issue
Block a user