drm/vram: use embedded gem object
authorGerd Hoffmann <kraxel@redhat.com>
Mon, 5 Aug 2019 14:01:04 +0000 (16:01 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 6 Aug 2019 06:21:53 +0000 (08:21 +0200)
Drop drm_gem_object from drm_gem_vram_object, use the
ttm_buffer_object.base instead.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: http://patchwork.freedesktop.org/patch/msgid/20190805140119.7337-3-kraxel@redhat.com
drivers/gpu/drm/ast/ast_main.c
drivers/gpu/drm/drm_gem_vram_helper.c
drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
drivers/gpu/drm/vboxvideo/vbox_main.c
include/drm/drm_gem_vram_helper.h

index 0a1bb9c05195d2d80ea3702fae0ab44a5deaedf6..dab77b2bc8acecc31bc077ec1e00b4085e52e339 100644 (file)
@@ -554,6 +554,6 @@ int ast_gem_create(struct drm_device *dev,
                        DRM_ERROR("failed to allocate GEM object\n");
                return ret;
        }
-       *obj = &gbo->gem;
+       *obj = &gbo->bo.base;
        return 0;
 }
index e0fbfb6570cfc99e024047d6cec6fc745db5a3ca..fc13920b3cb45ba3f73d57b5f9d1afd984d4401d 100644 (file)
@@ -26,7 +26,7 @@ static void drm_gem_vram_cleanup(struct drm_gem_vram_object *gbo)
         * TTM buffer object in 'bo' has already been cleaned
         * up; only release the GEM object.
         */
-       drm_gem_object_release(&gbo->gem);
+       drm_gem_object_release(&gbo->bo.base);
 }
 
 static void drm_gem_vram_destroy(struct drm_gem_vram_object *gbo)
@@ -82,10 +82,10 @@ static int drm_gem_vram_init(struct drm_device *dev,
        int ret;
        size_t acc_size;
 
-       if (!gbo->gem.funcs)
-               gbo->gem.funcs = &drm_gem_vram_object_funcs;
+       if (!gbo->bo.base.funcs)
+               gbo->bo.base.funcs = &drm_gem_vram_object_funcs;
 
-       ret = drm_gem_object_init(dev, &gbo->gem, size);
+       ret = drm_gem_object_init(dev, &gbo->bo.base, size);
        if (ret)
                return ret;
 
@@ -103,7 +103,7 @@ static int drm_gem_vram_init(struct drm_device *dev,
        return 0;
 
 err_drm_gem_object_release:
-       drm_gem_object_release(&gbo->gem);
+       drm_gem_object_release(&gbo->bo.base);
        return ret;
 }
 
@@ -383,11 +383,11 @@ int drm_gem_vram_fill_create_dumb(struct drm_file *file,
        if (IS_ERR(gbo))
                return PTR_ERR(gbo);
 
-       ret = drm_gem_handle_create(file, &gbo->gem, &handle);
+       ret = drm_gem_handle_create(file, &gbo->bo.base, &handle);
        if (ret)
                goto err_drm_gem_object_put_unlocked;
 
-       drm_gem_object_put_unlocked(&gbo->gem);
+       drm_gem_object_put_unlocked(&gbo->bo.base);
 
        args->pitch = pitch;
        args->size = size;
@@ -396,7 +396,7 @@ int drm_gem_vram_fill_create_dumb(struct drm_file *file,
        return 0;
 
 err_drm_gem_object_put_unlocked:
-       drm_gem_object_put_unlocked(&gbo->gem);
+       drm_gem_object_put_unlocked(&gbo->bo.base);
        return ret;
 }
 EXPORT_SYMBOL(drm_gem_vram_fill_create_dumb);
@@ -446,7 +446,7 @@ int drm_gem_vram_bo_driver_verify_access(struct ttm_buffer_object *bo,
 {
        struct drm_gem_vram_object *gbo = drm_gem_vram_of_bo(bo);
 
-       return drm_vma_node_verify_access(&gbo->gem.vma_node,
+       return drm_vma_node_verify_access(&gbo->bo.base.vma_node,
                                          filp->private_data);
 }
 EXPORT_SYMBOL(drm_gem_vram_bo_driver_verify_access);
index cfc2faabda145fe537b46e7706636876af78dc3a..9f6e473e629578f694c2fce5091ef78d6e459cc0 100644 (file)
@@ -66,7 +66,7 @@ int hibmc_gem_create(struct drm_device *dev, u32 size, bool iskernel,
                        DRM_ERROR("failed to allocate GEM object: %d\n", ret);
                return ret;
        }
-       *obj = &gbo->gem;
+       *obj = &gbo->bo.base;
        return 0;
 }
 
index 18693e2bf72a67f759e1171089a6b2dbbf3ddb3d..02fa8277ff1e56faf73245430916c424707eefe1 100644 (file)
@@ -292,7 +292,7 @@ int vbox_gem_create(struct vbox_private *vbox,
                return ret;
        }
 
-       *obj = &gbo->gem;
+       *obj = &gbo->bo.base;
 
        return 0;
 }
index b41d932eb53a452498374ccf1f7d651c8aaea1be..ac217d7684566b5afaf4d7846d99c1a5b72d5e9f 100644 (file)
@@ -36,7 +36,6 @@ struct vm_area_struct;
  * video memory becomes scarce.
  */
 struct drm_gem_vram_object {
-       struct drm_gem_object gem;
        struct ttm_buffer_object bo;
        struct ttm_bo_kmap_obj kmap;
 
@@ -68,7 +67,7 @@ static inline struct drm_gem_vram_object *drm_gem_vram_of_bo(
 static inline struct drm_gem_vram_object *drm_gem_vram_of_gem(
        struct drm_gem_object *gem)
 {
-       return container_of(gem, struct drm_gem_vram_object, gem);
+       return container_of(gem, struct drm_gem_vram_object, bo.base);
 }
 
 struct drm_gem_vram_object *drm_gem_vram_create(struct drm_device *dev,