[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 16/21] drm/vgem: Introduce GEM object functions



GEM object functions deprecate several similar callback interfaces in
struct drm_driver. This patch replaces the per-driver callbacks with
per-instance callbacks in vgem. The only exception is gem_prime_mmap,
which is non-trivial to convert.

Signed-off-by: Thomas Zimmermann <tzimmermann@xxxxxxx>
---
 drivers/gpu/drm/vgem/vgem_drv.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c
index cb884c890065..fa54a6d1403d 100644
--- a/drivers/gpu/drm/vgem/vgem_drv.c
+++ b/drivers/gpu/drm/vgem/vgem_drv.c
@@ -50,6 +50,8 @@
 #define DRIVER_MAJOR   1
 #define DRIVER_MINOR   0
 
+static const struct drm_gem_object_funcs vgem_gem_object_funcs;
+
 static struct vgem_device {
        struct drm_device drm;
        struct platform_device *platform;
@@ -167,6 +169,8 @@ static struct drm_vgem_gem_object *__vgem_gem_create(struct 
drm_device *dev,
        if (!obj)
                return ERR_PTR(-ENOMEM);
 
+       obj->base.funcs = &vgem_gem_object_funcs;
+
        ret = drm_gem_object_init(dev, &obj->base, roundup(size, PAGE_SIZE));
        if (ret) {
                kfree(obj);
@@ -401,12 +405,20 @@ static int vgem_prime_mmap(struct drm_gem_object *obj,
        return 0;
 }
 
+static const struct drm_gem_object_funcs vgem_gem_object_funcs = {
+       .free = vgem_gem_free_object,
+       .pin = vgem_prime_pin,
+       .unpin = vgem_prime_unpin,
+       .get_sg_table = vgem_prime_get_sg_table,
+       .vmap = vgem_prime_vmap,
+       .vunmap = vgem_prime_vunmap,
+       .vm_ops = &vgem_gem_vm_ops,
+};
+
 static struct drm_driver vgem_driver = {
        .driver_features                = DRIVER_GEM | DRIVER_RENDER,
        .open                           = vgem_open,
        .postclose                      = vgem_postclose,
-       .gem_free_object_unlocked       = vgem_gem_free_object,
-       .gem_vm_ops                     = &vgem_gem_vm_ops,
        .ioctls                         = vgem_ioctls,
        .num_ioctls                     = ARRAY_SIZE(vgem_ioctls),
        .fops                           = &vgem_driver_fops,
@@ -415,13 +427,8 @@ static struct drm_driver vgem_driver = {
 
        .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
        .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
-       .gem_prime_pin = vgem_prime_pin,
-       .gem_prime_unpin = vgem_prime_unpin,
        .gem_prime_import = vgem_prime_import,
        .gem_prime_import_sg_table = vgem_prime_import_sg_table,
-       .gem_prime_get_sg_table = vgem_prime_get_sg_table,
-       .gem_prime_vmap = vgem_prime_vmap,
-       .gem_prime_vunmap = vgem_prime_vunmap,
        .gem_prime_mmap = vgem_prime_mmap,
 
        .name   = DRIVER_NAME,
-- 
2.28.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.