summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/virtio/virtgpu_gem.c
diff options
context:
space:
mode:
authorJani Nikula <jani.nikula@intel.com>2020-06-25 18:05:03 +0300
committerJani Nikula <jani.nikula@intel.com>2020-06-25 18:05:03 +0300
commit0f69403d2535ffc7200a8414cf3ca66a49b0d741 (patch)
tree3ce85dd08359ea872aa8fb9bd12072efdb80a787 /drivers/gpu/drm/virtio/virtgpu_gem.c
parent580fbdc5136822208f107500682e50a1cb232e94 (diff)
parent0a19b068acc47d05212f03e494381926dc0381e2 (diff)
Merge drm/drm-next into drm-intel-next-queued
Catch up with upstream, in particular to get c1e8d7c6a7a6 ("mmap locking API: convert mmap_sem comments"). Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Diffstat (limited to 'drivers/gpu/drm/virtio/virtgpu_gem.c')
-rw-r--r--drivers/gpu/drm/virtio/virtgpu_gem.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/gpu/drm/virtio/virtgpu_gem.c b/drivers/gpu/drm/virtio/virtgpu_gem.c
index 0d6152c99a27..24ffacac99e4 100644
--- a/drivers/gpu/drm/virtio/virtgpu_gem.c
+++ b/drivers/gpu/drm/virtio/virtgpu_gem.c
@@ -28,17 +28,20 @@
#include "virtgpu_drv.h"
-int virtio_gpu_gem_create(struct drm_file *file,
- struct drm_device *dev,
- struct virtio_gpu_object_params *params,
- struct drm_gem_object **obj_p,
- uint32_t *handle_p)
+static int virtio_gpu_gem_create(struct drm_file *file,
+ struct drm_device *dev,
+ struct virtio_gpu_object_params *params,
+ struct drm_gem_object **obj_p,
+ uint32_t *handle_p)
{
struct virtio_gpu_device *vgdev = dev->dev_private;
struct virtio_gpu_object *obj;
int ret;
u32 handle;
+ if (vgdev->has_virgl_3d)
+ virtio_gpu_create_context(dev, file);
+
ret = virtio_gpu_object_create(vgdev, params, &obj, NULL);
if (ret < 0)
return ret;
@@ -52,7 +55,7 @@ int virtio_gpu_gem_create(struct drm_file *file,
*obj_p = &obj->base.base;
/* drop reference from allocate - handle holds it now */
- drm_gem_object_put_unlocked(&obj->base.base);
+ drm_gem_object_put(&obj->base.base);
*handle_p = handle;
return 0;
@@ -102,7 +105,7 @@ int virtio_gpu_mode_dumb_mmap(struct drm_file *file_priv,
if (gobj == NULL)
return -ENOENT;
*offset_p = drm_vma_node_offset_addr(&gobj->vma_node);
- drm_gem_object_put_unlocked(gobj);
+ drm_gem_object_put(gobj);
return 0;
}
@@ -114,7 +117,7 @@ int virtio_gpu_gem_object_open(struct drm_gem_object *obj,
struct virtio_gpu_object_array *objs;
if (!vgdev->has_virgl_3d)
- return 0;
+ goto out_notify;
objs = virtio_gpu_array_alloc(1);
if (!objs)
@@ -123,6 +126,7 @@ int virtio_gpu_gem_object_open(struct drm_gem_object *obj,
virtio_gpu_cmd_context_attach_resource(vgdev, vfpriv->ctx_id,
objs);
+out_notify:
virtio_gpu_notify(vgdev);
return 0;
}
@@ -236,7 +240,7 @@ void virtio_gpu_array_put_free(struct virtio_gpu_object_array *objs)
u32 i;
for (i = 0; i < objs->nents; i++)
- drm_gem_object_put_unlocked(objs->objs[i]);
+ drm_gem_object_put(objs->objs[i]);
virtio_gpu_array_free(objs);
}