From: Greg Kroah-Hartman Date: Thu, 16 Jan 2020 19:37:53 +0000 (+0100) Subject: Revert "drm/virtio: switch virtio_gpu_wait_ioctl() to gem helper." X-Git-Tag: v5.4.13~80 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7f57b0b34e21921eda7d56c41a7c82050f7134c8;p=platform%2Fkernel%2Flinux-rpi.git Revert "drm/virtio: switch virtio_gpu_wait_ioctl() to gem helper." This reverts commit e6733ec8948475c4b62574e452135dc629294d75 which is commit 29cf12394c0565d7eb1685bf0c1b4749aa6a8b66 upstream. Alistair writes: After updating to 5.4.7 we noticed that virtio_gpu's wait ioctl stopped working correctly. It looks like 29cf12394c05 ("drm/virtio: switch virtio_gpu_wait_ioctl() to gem helper.") was picked up automatically, but it depends on 889165ad6190 ("drm/virtio: pass gem reservation object to ttm init") from earlier in Gerd's series in Linus's tree, which was not picked up. Cc: Gerd Hoffmann Cc: Daniel Vetter Cc: Chia-I Wu Cc: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c index a662394..0a88ef1 100644 --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c @@ -463,29 +463,25 @@ out: } static int virtio_gpu_wait_ioctl(struct drm_device *dev, void *data, - struct drm_file *file) + struct drm_file *file) { struct drm_virtgpu_3d_wait *args = data; - struct drm_gem_object *obj; - long timeout = 15 * HZ; + struct drm_gem_object *gobj = NULL; + struct virtio_gpu_object *qobj = NULL; int ret; + bool nowait = false; - obj = drm_gem_object_lookup(file, args->handle); - if (obj == NULL) + gobj = drm_gem_object_lookup(file, args->handle); + if (gobj == NULL) return -ENOENT; - if (args->flags & VIRTGPU_WAIT_NOWAIT) { - ret = dma_resv_test_signaled_rcu(obj->resv, true); - } else { - ret = dma_resv_wait_timeout_rcu(obj->resv, true, true, - timeout); - } - if (ret == 0) - ret = -EBUSY; - else if (ret > 0) - ret = 0; + qobj = gem_to_virtio_gpu_obj(gobj); - drm_gem_object_put_unlocked(obj); + if (args->flags & VIRTGPU_WAIT_NOWAIT) + nowait = true; + ret = virtio_gpu_object_wait(qobj, nowait); + + drm_gem_object_put_unlocked(gobj); return ret; }