Commit 5edbb560 authored by Gerd Hoffmann's avatar Gerd Hoffmann

drm/virtio: fix ring free check

If the virtio device supports indirect ring descriptors we need only one
ring entry for the whole command.  Take that into account when checking
whenever the virtqueue has enough free entries for our command.
Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
Reviewed-by: default avatarChia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200207064653.14403-1-kraxel@redhat.com
parent 96b5d1be
...@@ -47,6 +47,7 @@ static int virtio_gpu_features(struct seq_file *m, void *data) ...@@ -47,6 +47,7 @@ static int virtio_gpu_features(struct seq_file *m, void *data)
virtio_add_bool(m, "virgl", vgdev->has_virgl_3d); virtio_add_bool(m, "virgl", vgdev->has_virgl_3d);
virtio_add_bool(m, "edid", vgdev->has_edid); virtio_add_bool(m, "edid", vgdev->has_edid);
virtio_add_bool(m, "indirect", vgdev->has_indirect);
virtio_add_int(m, "cap sets", vgdev->num_capsets); virtio_add_int(m, "cap sets", vgdev->num_capsets);
virtio_add_int(m, "scanouts", vgdev->num_scanouts); virtio_add_int(m, "scanouts", vgdev->num_scanouts);
return 0; return 0;
......
...@@ -193,6 +193,7 @@ struct virtio_gpu_device { ...@@ -193,6 +193,7 @@ struct virtio_gpu_device {
bool has_virgl_3d; bool has_virgl_3d;
bool has_edid; bool has_edid;
bool has_indirect;
struct work_struct config_changed_work; struct work_struct config_changed_work;
......
...@@ -159,6 +159,9 @@ int virtio_gpu_init(struct drm_device *dev) ...@@ -159,6 +159,9 @@ int virtio_gpu_init(struct drm_device *dev)
if (virtio_has_feature(vgdev->vdev, VIRTIO_GPU_F_EDID)) { if (virtio_has_feature(vgdev->vdev, VIRTIO_GPU_F_EDID)) {
vgdev->has_edid = true; vgdev->has_edid = true;
} }
if (virtio_has_feature(vgdev->vdev, VIRTIO_RING_F_INDIRECT_DESC)) {
vgdev->has_indirect = true;
}
DRM_INFO("features: %cvirgl %cedid\n", DRM_INFO("features: %cvirgl %cedid\n",
vgdev->has_virgl_3d ? '+' : '-', vgdev->has_virgl_3d ? '+' : '-',
......
...@@ -330,6 +330,9 @@ static void virtio_gpu_queue_ctrl_sgs(struct virtio_gpu_device *vgdev, ...@@ -330,6 +330,9 @@ static void virtio_gpu_queue_ctrl_sgs(struct virtio_gpu_device *vgdev,
bool notify = false; bool notify = false;
int ret; int ret;
if (vgdev->has_indirect)
elemcnt = 1;
again: again:
spin_lock(&vgdev->ctrlq.qlock); spin_lock(&vgdev->ctrlq.qlock);
......
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