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

[PATCH 11/20] drm/pl111: 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 pl111. The only exception is gem_prime_mmap,
which is non-trivial to convert.

Signed-off-by: Thomas Zimmermann <tzimmermann@xxxxxxx>
---
 drivers/gpu/drm/pl111/pl111_drv.c | 28 ++++++++++++++++++++++++----
 1 file changed, 24 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/pl111/pl111_drv.c 
b/drivers/gpu/drm/pl111/pl111_drv.c
index 46b0d1c4a16c..00b605060336 100644
--- a/drivers/gpu/drm/pl111/pl111_drv.c
+++ b/drivers/gpu/drm/pl111/pl111_drv.c
@@ -211,6 +211,29 @@ pl111_gem_import_sg_table(struct drm_device *dev,
        return drm_gem_cma_prime_import_sg_table(dev, attach, sgt);
 }
 
+static const struct drm_gem_object_funcs pl111_gem_object_funcs = {
+       .free = drm_gem_cma_free_object,
+       .get_sg_table = drm_gem_cma_prime_get_sg_table,
+       .vmap = drm_gem_cma_prime_vmap,
+       .vm_ops = &drm_gem_cma_vm_ops,
+};
+
+static struct drm_gem_object *
+pl111_gem_create_object(struct drm_device *dev, size_t size)
+{
+       static struct drm_gem_cma_object *cma_obj;
+       struct drm_gem_object *obj;
+
+       cma_obj = kzalloc(sizeof(*cma_obj), GFP_KERNEL);
+       if (!cma_obj)
+               return NULL;
+
+       obj = &cma_obj->base;
+       obj->funcs = &pl111_gem_object_funcs;
+
+       return obj;
+}
+
 DEFINE_DRM_GEM_CMA_FOPS(drm_fops);
 
 static struct drm_driver pl111_drm_driver = {
@@ -224,15 +247,12 @@ static struct drm_driver pl111_drm_driver = {
        .major = 1,
        .minor = 0,
        .patchlevel = 0,
+       .gem_create_object = pl111_gem_create_object,
        .dumb_create = drm_gem_cma_dumb_create,
-       .gem_free_object_unlocked = drm_gem_cma_free_object,
-       .gem_vm_ops = &drm_gem_cma_vm_ops,
        .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
        .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
        .gem_prime_import_sg_table = pl111_gem_import_sg_table,
-       .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,
        .gem_prime_mmap = drm_gem_cma_prime_mmap,
-       .gem_prime_vmap = drm_gem_cma_prime_vmap,
 
 #if defined(CONFIG_DEBUG_FS)
        .debugfs_init = pl111_debugfs_init,
-- 
2.28.0




 


Rackspace

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