drm/ttm: make ttm bo a gem bo subclass
Subsystems (15)
Gerd Hoffmann
maintainerv2 cover drm/ttm: make ttm bo a gem bo subclass
v2:
- build fixes.
- also drop ttm_buffer_object->resv
Gerd Hoffmann (18):
drm/ttm: add gem base object
drm/vram: use embedded gem object
drm/qxl: use embedded gem object
drm/radeon: use embedded gem object
drm/amdgpu: use embedded gem object
drm/nouveau: use embedded gem object
drm/ttm: use gem reservation object
drm/ttm: use gem vma_node
drm/vram: drop drm_gem_vram_driver_gem_prime_mmap drm/ttm: set both resv and base.resv pointers drm/ttm: switch ttm core from bo->resv to bo->base.resv drm/radeon: switch driver from bo->resv to bo->base.resv drm/vmwgfx: switch driver from bo->resv to bo->base.resv drm/amdgpu: switch driver from bo->resv to bo->base.resv drm/nouveau: switch driver from bo->resv to bo->base.resv drm/qxl: switch driver from bo->resv to bo->base.resv drm/virtio: switch driver from bo->resv to bo->base.resv drm/ttm: drop ttm_buffer_object->resv
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.h | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 3 +- drivers/gpu/drm/nouveau/nouveau_bo.h | 5 - drivers/gpu/drm/nouveau/nouveau_gem.h | 2 +- drivers/gpu/drm/qxl/qxl_drv.h | 6 +- drivers/gpu/drm/qxl/qxl_object.h | 6 +- drivers/gpu/drm/radeon/radeon.h | 3 +- drivers/gpu/drm/radeon/radeon_object.h | 2 +- drivers/gpu/drm/virtio/virtgpu_drv.h | 2 +- include/drm/drm_gem_vram_helper.h | 7 +- include/drm/ttm/ttm_bo_api.h | 25 +++- include/drm/ttm/ttm_bo_driver.h | 12 +- .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 6 +- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 6 +- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 6 +- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 14 +- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 28 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 8 +- drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 30 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c | 2 +- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +- drivers/gpu/drm/ast/ast_main.c | 2 +- drivers/gpu/drm/drm_gem_vram_helper.c | 36 ++--- drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c | 2 +- drivers/gpu/drm/mgag200/mgag200_main.c | 2 +- drivers/gpu/drm/nouveau/dispnv50/wndw.c | 2 +- drivers/gpu/drm/nouveau/nouveau_abi16.c | 4 +- drivers/gpu/drm/nouveau/nouveau_bo.c | 8 +- drivers/gpu/drm/nouveau/nouveau_display.c | 10 +- drivers/gpu/drm/nouveau/nouveau_fence.c | 2 +- drivers/gpu/drm/nouveau/nouveau_gem.c | 19 +-- drivers/gpu/drm/nouveau/nouveau_prime.c | 6 +- drivers/gpu/drm/qxl/qxl_cmd.c | 4 +- drivers/gpu/drm/qxl/qxl_debugfs.c | 4 +- drivers/gpu/drm/qxl/qxl_display.c | 8 +- drivers/gpu/drm/qxl/qxl_gem.c | 2 +- drivers/gpu/drm/qxl/qxl_object.c | 20 +-- drivers/gpu/drm/qxl/qxl_release.c | 8 +- drivers/gpu/drm/qxl/qxl_ttm.c | 4 +- drivers/gpu/drm/radeon/radeon_benchmark.c | 4 +- drivers/gpu/drm/radeon/radeon_cs.c | 4 +- drivers/gpu/drm/radeon/radeon_display.c | 6 +- drivers/gpu/drm/radeon/radeon_gem.c | 8 +- drivers/gpu/drm/radeon/radeon_mn.c | 2 +- drivers/gpu/drm/radeon/radeon_object.c | 22 +-- drivers/gpu/drm/radeon/radeon_prime.c | 4 +- drivers/gpu/drm/radeon/radeon_test.c | 8 +- drivers/gpu/drm/radeon/radeon_ttm.c | 4 +- drivers/gpu/drm/radeon/radeon_uvd.c | 2 +- drivers/gpu/drm/radeon/radeon_vm.c | 6 +- drivers/gpu/drm/ttm/ttm_bo.c | 136 +++++++++--------- drivers/gpu/drm/ttm/ttm_bo_util.c | 18 +-- drivers/gpu/drm/ttm/ttm_bo_vm.c | 15 +- drivers/gpu/drm/ttm/ttm_execbuf_util.c | 20 +-- drivers/gpu/drm/ttm/ttm_tt.c | 2 +- drivers/gpu/drm/vboxvideo/vbox_main.c | 2 +- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 4 +- drivers/gpu/drm/virtio/virtgpu_plane.c | 2 +- drivers/gpu/drm/virtio/virtgpu_prime.c | 3 - drivers/gpu/drm/vmwgfx/vmwgfx_blit.c | 4 +- drivers/gpu/drm/vmwgfx/vmwgfx_bo.c | 12 +- drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c | 4 +- drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 6 +- drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 4 +- 68 files changed, 311 insertions(+), 321 deletions(-)
Signature · 6 lines
2.18.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Gerd Hoffmann
maintainerPATCH v2 1/18 drm/ttm: add gem base object
Add drm_gem_object struct to ttm_buffer_object, so ttm objects are a gdm object superclass. Add a function to check whenever a given bo actually uses the embedded drm_gem_object, for the transition period.
--- include/drm/ttm/ttm_bo_api.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
include/drm/ttm/ttm_bo_api.h +18 -0
@@ -31,6 +31,7 @@#ifndef _TTM_BO_API_H_#define _TTM_BO_API_H_ +#include <drm/drm_gem.h> #include <drm/drm_hashtab.h> #include <drm/drm_vma_manager.h> #include <linux/kref.h>
@@ -127,6 +128,7 @@ struct ttm_tt;/** * struct ttm_buffer_object * +* @base: drm_gem_object superclass data. * @bdev: Pointer to the buffer object device structure. * @type: The bo type. * @destroy: Destruction function. If NULL, kfree is used.
@@ -169,6 +171,8 @@ struct ttm_tt;*/ struct ttm_buffer_object { +struct drm_gem_object base; +/** * Members constant at init. */
@@ -768,4 +772,18 @@ int ttm_bo_swapout(struct ttm_bo_global *glob, struct ttm_operation_ctx *ctx);void ttm_bo_swapout_all (struct ttm_bo_device *bdev);int ttm_bo_wait_unreserved (struct ttm_buffer_object *bo); + +/** +* ttm_bo_uses_embedded_gem_object - check if the given bo uses the +* embedded drm_gem_object. +* +* Helper for the transition period, once all drivers are switched to +* use the embedded drm_gem_object this can go away. +* +* @bo: The bo to check. +*/ +static inline bool ttm_bo_uses_embedded_gem_object (struct ttm_buffer_object *bo) +{ +return bo->base.dev !=NULL ; +}#endif
Signature · 1 line
2.18.1
Gerd Hoffmann
maintainerPATCH v2 2/18 drm/vram: use embedded gem object
In reply to Gerd HoffmannDrop drm_gem_object from drm_gem_vram_object, use the ttm_buffer_object.base instead.
--- include/drm/drm_gem_vram_helper.h | 3 +-- drivers/gpu/drm/ast/ast_main.c | 2 +- drivers/gpu/drm/drm_gem_vram_helper.c | 16 ++++++++-------- drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c | 2 +- drivers/gpu/drm/mgag200/mgag200_main.c | 2 +- drivers/gpu/drm/vboxvideo/vbox_main.c | 2 +- 6 files changed, 13 insertions(+), 14 deletions(-)
include/drm/drm_gem_vram_helper.h +1 -2
@@ -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,
drivers/gpu/drm/ast/ast_main.c +1 -1
@@ -609,6 +609,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 ; }
drivers/gpu/drm/drm_gem_vram_helper.c +8 -8
@@ -24,7 +24,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)
@@ -80,7 +80,7 @@ static int drm_gem_vram_init(struct drm_device *dev,int ret;size_t acc_size; - ret =drm_gem_object_init (dev, &gbo->gem, size); + ret =drm_gem_object_init (dev, &gbo->bo.base, size);if (ret)return ret;
@@ -98,7 +98,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; }
@@ -378,11 +378,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;
@@ -391,7 +391,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);
@@ -441,7 +441,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);
@@ -635,7 +635,7 @@ int drm_gem_vram_driver_gem_prime_mmap(struct drm_gem_object *gem, {struct drm_gem_vram_object *gbo =drm_gem_vram_of_gem (gem); - gbo->gem.vma_node.vm_node.start = gbo->bo.vma_node.vm_node.start; + gbo->bo.base.vma_node.vm_node.start = gbo->bo.vma_node.vm_node.start;return drm_gem_prime_mmap (gem, vma); }EXPORT_SYMBOL (drm_gem_vram_driver_gem_prime_mmap);
drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c +1 -1
@@ -65,7 +65,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 ; }
drivers/gpu/drm/mgag200/mgag200_main.c +1 -1
@@ -288,6 +288,6 @@ int mgag200_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 ; }
drivers/gpu/drm/vboxvideo/vbox_main.c +1 -1
@@ -292,7 +292,7 @@ int vbox_gem_create(struct vbox_private *vbox,return ret; } - *obj = &gbo->gem; + *obj = &gbo->bo.base;return 0 ; }
Signature · 1 line
2.18.1
Re: [PATCH v2 02/18] drm/vram: use embedded gem object
Hi
Am 21.06.19 um 13:57 schrieb Gerd Hoffmann:
Quoted 26 lines
Drop
drm_gem_objectfromdrm_gem_vram_object, use the ttm_buffer_object.base instead.Signed-off-by Gerd Hoffmann <[email protected]>--- include/drm/drm_gem_vram_helper.h | 3 +-- drivers/gpu/drm/ast/ast_main.c | 2 +- drivers/gpu/drm/drm_gem_vram_helper.c | 16 ++++++++-------- drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c | 2 +- drivers/gpu/drm/mgag200/mgag200_main.c | 2 +- drivers/gpu/drm/vboxvideo/vbox_main.c | 2 +- 6 files changed, 13 insertions(+), 14 deletions(-)include/drm/drm_gem_vram_helper.h +0
-1@@ -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;
include/drm/drm_gem_vram_helper.h static inline struct drm_gem_vram_object *drm_gem_vram_of_bo( · line 68
Quoted 2 lines
include/drm/drm_gem_vram_helper.h +0
-0@@ -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)
To avoid ambiguities, I used the form <destination type name>_of_<field name>() to name these cast functions. The canonical name here would now be drm_gem_vram_of_bo_base(). But that's just nitpicking. If you don't want to change the name (and all its callers), maybe leave a FIXME comment.
Best regards
Thomas
Quoted 129 lines
include/drm/drm_gem_vram_helper.h +1
-1{ - 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,drivers/gpu/drm/ast/ast_main.c +1
-1@@ -609,6 +609,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 ; }drivers/gpu/drm/drm_gem_vram_helper.c +8
-8@@ -24,7 +24,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)@@ -80,7 +80,7 @@ static int drm_gem_vram_init(struct drm_device *dev,int ret;size_t acc_size; - ret =drm_gem_object_init (dev, &gbo->gem, size); + ret =drm_gem_object_init (dev, &gbo->bo.base, size);if (ret)return ret;@@ -98,7 +98,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; }@@ -378,11 +378,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;@@ -391,7 +391,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);@@ -441,7 +441,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);@@ -635,7 +635,7 @@ int drm_gem_vram_driver_gem_prime_mmap(struct drm_gem_object *gem, {struct drm_gem_vram_object *gbo =drm_gem_vram_of_gem (gem); - gbo->gem.vma_node.vm_node.start = gbo->bo.vma_node.vm_node.start; + gbo->bo.base.vma_node.vm_node.start = gbo->bo.vma_node.vm_node.start;return drm_gem_prime_mmap (gem, vma); }EXPORT_SYMBOL (drm_gem_vram_driver_gem_prime_mmap);drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c +1
-1@@ -65,7 +65,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 ; }drivers/gpu/drm/mgag200/mgag200_main.c +1
-1@@ -288,6 +288,6 @@ int mgag200_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 ; }drivers/gpu/drm/vboxvideo/vbox_main.c +1
-1@@ -292,7 +292,7 @@ int vbox_gem_create(struct vbox_private *vbox,return ret; } - *obj = &gbo->gem; + *obj = &gbo->bo.base;return 0 ; }
Signature · 5 lines
Thomas Zimmermann Graphics Driver Developer SUSE Linux GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 21284 (AG Nürnberg)
Re: [PATCH v2 02/18] drm/vram: use embedded gem object
Quoted 29 lines · Thomas Zimmermann
Hi
Am 21.06.19 um 13:57 schrieb Gerd Hoffmann:
Quoted 25 lines
Drop
drm_gem_objectfromdrm_gem_vram_object, use the ttm_buffer_object.base instead.Signed-off-by Gerd Hoffmann <[email protected]>--- include/drm/drm_gem_vram_helper.h | 3 +-- drivers/gpu/drm/ast/ast_main.c | 2 +- drivers/gpu/drm/drm_gem_vram_helper.c | 16 ++++++++-------- drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c | 2 +- drivers/gpu/drm/mgag200/mgag200_main.c | 2 +- drivers/gpu/drm/vboxvideo/vbox_main.c | 2 +- 6 files changed, 13 insertions(+), 14 deletions(-)include/drm/drm_gem_vram_helper.h +0
-1@@ -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;
Quoted 8 lines
include/drm/drm_gem_vram_helper.h static inline struct drm_gem_vram_object *drm_gem_vram_of_bo( · line 68
Quoted 3 lines
include/drm/drm_gem_vram_helper.h +0
-0@@ -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)To avoid ambiguities, I used the form <destination type name>_of_<field name>() to name these cast functions. The canonical name here would now be
drm_gem_vram_of_bo_base(). But that's just nitpicking. If you don't want to change the name (and all its callers), maybe leave a FIXME comment.
Bikeshed: I think generally we call these <source_type>_to_<destination_type>, with the source type left out if you cast from the most generic version. E.g. this one here would just be
static inline struct drm_gem_vram_object *drm_gem_to_vram_bo(struct drm_gem_object *gem)
or something like that. I don't remember having seen the *_of_* pattern anywhere.
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Gerd Hoffmann
maintainerPATCH v2 3/18 drm/qxl: use embedded gem object
In reply to Gerd HoffmannDrop drm_gem_object from qxl_bo, use the
ttm_buffer_object.base instead.
--- drivers/gpu/drm/qxl/qxl_drv.h | 6 +++--- drivers/gpu/drm/qxl/qxl_object.h | 4 ++-- drivers/gpu/drm/qxl/qxl_cmd.c | 4 ++-- drivers/gpu/drm/qxl/qxl_debugfs.c | 2 +- drivers/gpu/drm/qxl/qxl_display.c | 8 ++++---- drivers/gpu/drm/qxl/qxl_gem.c | 2 +- drivers/gpu/drm/qxl/qxl_object.c | 20 ++++++++++---------- drivers/gpu/drm/qxl/qxl_release.c | 2 +- drivers/gpu/drm/qxl/qxl_ttm.c | 4 ++-- 9 files changed, 26 insertions(+), 26 deletions(-)
drivers/gpu/drm/qxl/qxl_drv.h +3 -3
@@ -72,12 +72,13 @@ extern int qxl_max_ioctls; QXL_INTERRUPT_CLIENT_MONITORS_CONFIG)struct qxl_bo { +struct ttm_buffer_object tbo; +/* Protected by gem.mutex */ struct list_head list;/* Protected by tbo.reserved */ struct ttm_place placements[3 ];struct ttm_placement placement; -struct ttm_buffer_object tbo;struct ttm_bo_kmap_obj kmap;unsigned int pin_count;void *kptr;
@@ -85,7 +86,6 @@ struct qxl_bo {int type;/* Constant after initialization */ -struct drm_gem_object gem_base; unsigned int is_primary:1; /* is this now a primary surface */ unsigned int is_dumb:1;struct qxl_bo *shadow;
@@ -94,7 +94,7 @@ struct qxl_bo {uint32_t surface_id;struct qxl_release *surf_create; }; -#define gem_to_qxl_bo (gobj) container_of((gobj), struct qxl_bo, gem_base) +#define gem_to_qxl_bo (gobj) container_of((gobj), struct qxl_bo, tbo.base)#define to_qxl_bo (tobj) container_of((tobj), struct qxl_bo, tbo)struct qxl_gem {
drivers/gpu/drm/qxl/qxl_object.h +2 -2
@@ -34,7 +34,7 @@ static inline int qxl_bo_reserve(struct qxl_bo *bo, bool no_wait) r =ttm_bo_reserve (&bo->tbo, true, no_wait,NULL );if (unlikely (r !=0 )) {if (r != -ERESTARTSYS ) { -struct drm_device *ddev = bo->gem_base.dev; +struct drm_device *ddev = bo->tbo.base.dev;dev_err (ddev->dev,"%p reserve failed\n" , bo); }
@@ -71,7 +71,7 @@ static inline int qxl_bo_wait(struct qxl_bo *bo, u32 *mem_type, r =ttm_bo_reserve (&bo->tbo, true, no_wait,NULL );if (unlikely (r !=0 )) {if (r != -ERESTARTSYS ) { -struct drm_device *ddev = bo->gem_base.dev; +struct drm_device *ddev = bo->tbo.base.dev;dev_err (ddev->dev,"%p reserve failed for wait\n" , bo);
drivers/gpu/drm/qxl/qxl_cmd.c +2 -2
@@ -375,7 +375,7 @@ void qxl_io_destroy_primary(struct qxl_device *qdev) {wait_for_io_cmd (qdev,0 ,QXL_IO_DESTROY_PRIMARY_ASYNC ); qdev->primary_bo->is_primary = false; -drm_gem_object_put_unlocked (&qdev->primary_bo->gem_base); +drm_gem_object_put_unlocked (&qdev->primary_bo->tbo.base); qdev->primary_bo =NULL ; }
@@ -402,7 +402,7 @@ void qxl_io_create_primary(struct qxl_device *qdev, struct qxl_bo *bo)wait_for_io_cmd (qdev,0 ,QXL_IO_CREATE_PRIMARY_ASYNC ); qdev->primary_bo = bo; qdev->primary_bo->is_primary = true; -drm_gem_object_get (&qdev->primary_bo->gem_base); +drm_gem_object_get (&qdev->primary_bo->tbo.base); }void qxl_io_memslot_add (struct qxl_device *qdev,uint8_t id)
drivers/gpu/drm/qxl/qxl_debugfs.c +1 -1
@@ -66,7 +66,7 @@ qxl_debugfs_buffers_info(struct seq_file *m, void *data)rcu_read_unlock ();seq_printf (m,"size %ld, pc %d, num releases %d\n" , - (unsigned long )bo->gem_base.size, + (unsigned long )bo->tbo.base.size, bo->pin_count, rel); }return 0 ;
drivers/gpu/drm/qxl/qxl_display.c +4 -4
@@ -794,7 +794,7 @@ static int qxl_plane_prepare_fb(struct drm_plane *plane, qdev->dumb_shadow_bo->surf.height != surf.height) {if (qdev->dumb_shadow_bo) {drm_gem_object_put_unlocked - (&qdev->dumb_shadow_bo->gem_base); + (&qdev->dumb_shadow_bo->tbo.base); qdev->dumb_shadow_bo =NULL ; } qxl_bo_create(qdev, surf.height * surf.stride,
@@ -804,10 +804,10 @@ static int qxl_plane_prepare_fb(struct drm_plane *plane,if (user_bo->shadow != qdev->dumb_shadow_bo) {if (user_bo->shadow) {drm_gem_object_put_unlocked - (&user_bo->shadow->gem_base); + (&user_bo->shadow->tbo.base); user_bo->shadow =NULL ; } -drm_gem_object_get (&qdev->dumb_shadow_bo->gem_base); +drm_gem_object_get (&qdev->dumb_shadow_bo->tbo.base); user_bo->shadow = qdev->dumb_shadow_bo; } }
@@ -838,7 +838,7 @@ static void qxl_plane_cleanup_fb(struct drm_plane *plane,qxl_bo_unpin (user_bo);if (old_state->fb != plane->state->fb && user_bo->shadow) { -drm_gem_object_put_unlocked (&user_bo->shadow->gem_base); +drm_gem_object_put_unlocked (&user_bo->shadow->tbo.base); user_bo->shadow =NULL ; } }
drivers/gpu/drm/qxl/qxl_gem.c +1 -1
@@ -64,7 +64,7 @@ int qxl_gem_object_create(struct qxl_device *qdev, int size, size, initial_domain, alignment, r);return r; } - *obj = &qbo->gem_base; + *obj = &qbo->tbo.base;mutex_lock (&qdev->gem.mutex);list_add_tail (&qbo->list, &qdev->gem.objects);
drivers/gpu/drm/qxl/qxl_object.c +10 -10
@@ -33,14 +33,14 @@ static void qxl_ttm_bo_destroy(struct ttm_buffer_object *tbo)struct qxl_device *qdev; bo =to_qxl_bo (tbo); - qdev = (struct qxl_device *)bo->gem_base.dev->dev_private; + qdev = (struct qxl_device *)bo->tbo.base.dev->dev_private;qxl_surface_evict (qdev, bo, false);WARN_ON_ONCE (bo->map_count >0 );mutex_lock (&qdev->gem.mutex);list_del_init (&bo->list);mutex_unlock (&qdev->gem.mutex); -drm_gem_object_release (&bo->gem_base); +drm_gem_object_release (&bo->tbo.base);kfree (bo); }
@@ -95,7 +95,7 @@ int qxl_bo_create(struct qxl_device *qdev,if (bo ==NULL )return -ENOMEM ; size =roundup (size,PAGE_SIZE ); - r =drm_gem_object_init (&qdev->ddev, &bo->gem_base, size); + r =drm_gem_object_init (&qdev->ddev, &bo->tbo.base, size);if (unlikely (r)) {kfree (bo);return r;
@@ -214,20 +214,20 @@ void qxl_bo_unref(struct qxl_bo **bo)if ((*bo) ==NULL )return ; -drm_gem_object_put_unlocked (&(*bo)->gem_base); +drm_gem_object_put_unlocked (&(*bo)->tbo.base); *bo =NULL ; }struct qxl_bo *qxl_bo_ref (struct qxl_bo *bo) { -drm_gem_object_get (&bo->gem_base); +drm_gem_object_get (&bo->tbo.base);return bo; }static int __qxl_bo_pin (struct qxl_bo *bo) {struct ttm_operation_ctx ctx = { false, false }; -struct drm_device *ddev = bo->gem_base.dev; +struct drm_device *ddev = bo->tbo.base.dev;int r;if (bo->pin_count) {
@@ -247,7 +247,7 @@ static int __qxl_bo_pin(struct qxl_bo *bo)static int __qxl_bo_unpin (struct qxl_bo *bo) {struct ttm_operation_ctx ctx = { false, false }; -struct drm_device *ddev = bo->gem_base.dev; +struct drm_device *ddev = bo->tbo.base.dev;int r, i;if (!bo->pin_count) {
@@ -310,13 +310,13 @@ void qxl_bo_force_delete(struct qxl_device *qdev)dev_err (qdev->ddev.dev,"Userspace still has active objects !\n" );list_for_each_entry_safe (bo, n, &qdev->gem.objects, list) {dev_err (qdev->ddev.dev,"%p %p %lu %lu force free\n" , - &bo->gem_base, bo, (unsigned long )bo->gem_base.size, - *((unsigned long *)&bo->gem_base.refcount)); + &bo->tbo.base, bo, (unsigned long )bo->tbo.base.size, + *((unsigned long *)&bo->tbo.base.refcount));mutex_lock (&qdev->gem.mutex);list_del_init (&bo->list);mutex_unlock (&qdev->gem.mutex);/* this should unref the ttm bo */ -drm_gem_object_put_unlocked (&bo->gem_base); +drm_gem_object_put_unlocked (&bo->tbo.base); } }
drivers/gpu/drm/qxl/qxl_release.c +1 -1
@@ -239,7 +239,7 @@ static int qxl_release_validate_bo(struct qxl_bo *bo)return ret;/* allocate a surface for reserved + validated buffers */ - ret =qxl_bo_check_id (bo->gem_base.dev->dev_private, bo); + ret =qxl_bo_check_id (bo->tbo.base.dev->dev_private, bo);if (ret)return ret;return 0 ;
drivers/gpu/drm/qxl/qxl_ttm.c +2 -2
@@ -153,7 +153,7 @@ static int qxl_verify_access(struct ttm_buffer_object *bo, struct file *filp) {struct qxl_bo *qbo =to_qxl_bo (bo); -return drm_vma_node_verify_access (&qbo->gem_base.vma_node, +return drm_vma_node_verify_access (&qbo->tbo.base.vma_node, filp->private_data); }
@@ -295,7 +295,7 @@ static void qxl_bo_move_notify(struct ttm_buffer_object *bo,if (!qxl_ttm_bo_is_qxl_bo (bo))return ; qbo =to_qxl_bo (bo); - qdev = qbo->gem_base.dev->dev_private; + qdev = qbo->tbo.base.dev->dev_private;if (bo->mem.mem_type ==TTM_PL_PRIV && qbo->surface_id)qxl_surface_evict (qdev, qbo, new_mem ? true : false);
Signature · 1 line
2.18.1
Gerd Hoffmann
maintainerPATCH v2 4/18 drm/radeon: use embedded gem object
In reply to Gerd HoffmannDrop drm_gem_object from radeon_bo, use the
ttm_buffer_object.base instead.
Build tested only.
--- drivers/gpu/drm/radeon/radeon.h | 3 +-- drivers/gpu/drm/radeon/radeon_cs.c | 2 +- drivers/gpu/drm/radeon/radeon_display.c | 4 ++-- drivers/gpu/drm/radeon/radeon_gem.c | 2 +- drivers/gpu/drm/radeon/radeon_object.c | 14 +++++++------- drivers/gpu/drm/radeon/radeon_prime.c | 2 +- drivers/gpu/drm/radeon/radeon_ttm.c | 2 +- 7 files changed, 14 insertions(+), 15 deletions(-)
drivers/gpu/drm/radeon/radeon.h +1 -2
@@ -505,7 +505,6 @@ struct radeon_bo {struct list_head va;/* Constant after initialization */ struct radeon_device *rdev; -struct drm_gem_object gem_base;struct ttm_bo_kmap_obj dma_buf_vmap;pid_t pid;
@@ -513,7 +512,7 @@ struct radeon_bo {struct radeon_mn *mn;struct list_head mn_list; }; -#define gem_to_radeon_bo (gobj) container_of((gobj), struct radeon_bo, gem_base) +#define gem_to_radeon_bo (gobj) container_of((gobj), struct radeon_bo, tbo.base)int radeon_gem_debugfs_init (struct radeon_device *rdev);
drivers/gpu/drm/radeon/radeon_cs.c +1 -1
@@ -443,7 +443,7 @@ static void radeon_cs_parser_fini(struct radeon_cs_parser *parser, int error, boif (bo ==NULL )continue ; -drm_gem_object_put_unlocked (&bo->gem_base); +drm_gem_object_put_unlocked (&bo->tbo.base); } }kfree (parser->track);
drivers/gpu/drm/radeon/radeon_display.c +2 -2
@@ -275,7 +275,7 @@ static void radeon_unpin_work_func(struct work_struct *__work) }else DRM_ERROR ("failed to reserve buffer after flip\n" ); -drm_gem_object_put_unlocked (&work->old_rbo->gem_base); +drm_gem_object_put_unlocked (&work->old_rbo->tbo.base);kfree (work); }
@@ -607,7 +607,7 @@ static int radeon_crtc_page_flip_target(struct drm_crtc *crtc,radeon_bo_unreserve (new_rbo); cleanup: -drm_gem_object_put_unlocked (&work->old_rbo->gem_base); +drm_gem_object_put_unlocked (&work->old_rbo->tbo.base);dma_fence_put (work->fence);kfree (work);return r;
drivers/gpu/drm/radeon/radeon_gem.c +1 -1
@@ -83,7 +83,7 @@ int radeon_gem_object_create(struct radeon_device *rdev, unsigned long size, }return r; } - *obj = &robj->gem_base; + *obj = &robj->tbo.base; robj->pid =task_pid_nr (current);mutex_lock (&rdev->gem.mutex);
drivers/gpu/drm/radeon/radeon_object.c +7 -7
@@ -85,9 +85,9 @@ static void radeon_ttm_bo_destroy(struct ttm_buffer_object *tbo)mutex_unlock (&bo->rdev->gem.mutex);radeon_bo_clear_surface_reg (bo);WARN_ON_ONCE (!list_empty (&bo->va)); -if (bo->gem_base.import_attach) -drm_prime_gem_destroy (&bo->gem_base, bo->tbo.sg); -drm_gem_object_release (&bo->gem_base); +if (bo->tbo.base.import_attach) +drm_prime_gem_destroy (&bo->tbo.base, bo->tbo.sg); +drm_gem_object_release (&bo->tbo.base);kfree (bo); }
@@ -209,7 +209,7 @@ int radeon_bo_create(struct radeon_device *rdev, bo =kzalloc (sizeof (struct radeon_bo ),GFP_KERNEL );if (bo ==NULL )return -ENOMEM ; -drm_gem_private_object_init (rdev->ddev, &bo->gem_base, size); +drm_gem_private_object_init (rdev->ddev, &bo->tbo.base, size); bo->rdev = rdev; bo->surface_reg =-1 ;INIT_LIST_HEAD (&bo->list);
@@ -442,13 +442,13 @@ void radeon_bo_force_delete(struct radeon_device *rdev)dev_err (rdev->dev,"Userspace still has active objects !\n" );list_for_each_entry_safe (bo, n, &rdev->gem.objects, list) {dev_err (rdev->dev,"%p %p %lu %lu force free\n" , - &bo->gem_base, bo, (unsigned long )bo->gem_base.size, - *((unsigned long *)&bo->gem_base.refcount)); + &bo->tbo.base, bo, (unsigned long )bo->tbo.base.size, + *((unsigned long *)&bo->tbo.base.refcount));mutex_lock (&bo->rdev->gem.mutex);list_del_init (&bo->list);mutex_unlock (&bo->rdev->gem.mutex);/* this should unref the ttm bo */ -drm_gem_object_put_unlocked (&bo->gem_base); +drm_gem_object_put_unlocked (&bo->tbo.base); } }
drivers/gpu/drm/radeon/radeon_prime.c +1 -1
@@ -80,7 +80,7 @@ struct drm_gem_object *radeon_gem_prime_import_sg_table(struct drm_device *dev,mutex_unlock (&rdev->gem.mutex); bo->prime_shared_count =1 ; -return &bo->gem_base; +return &bo->tbo.base; }int radeon_gem_prime_pin (struct drm_gem_object *obj)
drivers/gpu/drm/radeon/radeon_ttm.c +1 -1
@@ -184,7 +184,7 @@ static int radeon_verify_access(struct ttm_buffer_object *bo, struct file *filp)if (radeon_ttm_tt_has_userptr (bo->ttm))return -EPERM ; -return drm_vma_node_verify_access (&rbo->gem_base.vma_node, +return drm_vma_node_verify_access (&rbo->tbo.base.vma_node, filp->private_data); }
Signature · 6 lines
2.18.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Gerd Hoffmann
maintainerPATCH v2 5/18 drm/amdgpu: use embedded gem object
In reply to Gerd HoffmannDrop drm_gem_object from amdgpu_bo, use the
ttm_buffer_object.base instead.
Build tested only.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.h | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 1 - drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 8 ++++---- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 8 ++++---- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +- 6 files changed, 11 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.h +1 -1
@@ -31,7 +31,7 @@*/ #define AMDGPU_GEM_DOMAIN_MAX 0x3 -#define gem_to_amdgpu_bo (gobj) container_of((gobj), struct amdgpu_bo, gem_base) +#define gem_to_amdgpu_bo (gobj) container_of((gobj), struct amdgpu_bo, tbo.base)void amdgpu_gem_object_free (struct drm_gem_object *obj); int amdgpu_gem_object_open(struct drm_gem_object *obj,
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +0 -1
@@ -94,7 +94,6 @@ struct amdgpu_bo {/* per VM structure for page tables and with virtual addresses */ struct amdgpu_vm_bo_base *vm_bo;/* Constant after initialization */ -struct drm_gem_object gem_base;struct amdgpu_bo *parent;struct amdgpu_bo *shadow;
drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +1 -1
@@ -409,7 +409,7 @@ amdgpu_gem_prime_import_sg_table(struct drm_device *dev, bo->prime_shared_count =1 ;ww_mutex_unlock (&resv->lock); -return &bo->gem_base; +return &bo->tbo.base; error:ww_mutex_unlock (&resv->lock);
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +4 -4
@@ -85,7 +85,7 @@ int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size, }return r; } - *obj = &bo->gem_base; + *obj = &bo->tbo.base;return 0 ; }
@@ -690,7 +690,7 @@ int amdgpu_gem_op_ioctl(struct drm_device *dev, void *data,struct drm_amdgpu_gem_create_in info;void __user *out =u64_to_user_ptr (args->value); - info.bo_size = robj->gem_base.size; + info.bo_size = robj->tbo.base.size; info.alignment = robj->tbo.mem.page_alignment <<PAGE_SHIFT ; info.domains = robj->preferred_domains; info.domain_flags = robj->flags;
@@ -820,8 +820,8 @@ static int amdgpu_debugfs_gem_bo_info(int id, void *ptr, void *data)if (pin_count)seq_printf (m," pin count %d" , pin_count); - dma_buf =READ_ONCE (bo->gem_base.dma_buf); - attachment =READ_ONCE (bo->gem_base.import_attach); + dma_buf =READ_ONCE (bo->tbo.base.dma_buf); + attachment =READ_ONCE (bo->tbo.base.import_attach);if (attachment)seq_printf (m," imported from %p" , dma_buf);
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +4 -4
@@ -85,9 +85,9 @@ static void amdgpu_bo_destroy(struct ttm_buffer_object *tbo)amdgpu_bo_kunmap (bo); -if (bo->gem_base.import_attach) -drm_prime_gem_destroy (&bo->gem_base, bo->tbo.sg); -drm_gem_object_release (&bo->gem_base); +if (bo->tbo.base.import_attach) +drm_prime_gem_destroy (&bo->tbo.base, bo->tbo.sg); +drm_gem_object_release (&bo->tbo.base);/* in case amdgpu_device_recover_vram got NULL of bo->parent */ if (!list_empty (&bo->shadow_list)) {mutex_lock (&adev->shadow_list_lock);
@@ -454,7 +454,7 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev, bo =kzalloc (sizeof (struct amdgpu_bo ),GFP_KERNEL );if (bo ==NULL )return -ENOMEM ; -drm_gem_private_object_init (adev->ddev, &bo->gem_base, size); +drm_gem_private_object_init (adev->ddev, &bo->tbo.base, size);INIT_LIST_HEAD (&bo->shadow_list); bo->vm_bo =NULL ; bo->preferred_domains = bp->preferred_domain ? bp->preferred_domain :
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -1
@@ -227,7 +227,7 @@ static int amdgpu_verify_access(struct ttm_buffer_object *bo, struct file *filp)if (amdgpu_ttm_tt_get_usermm (bo->ttm))return -EPERM ; -return drm_vma_node_verify_access (&abo->gem_base.vma_node, +return drm_vma_node_verify_access (&abo->tbo.base.vma_node, filp->private_data); }
Signature · 6 lines
2.18.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Gerd Hoffmann
maintainerPATCH v2 6/18 drm/nouveau: use embedded gem object
In reply to Gerd HoffmannDrop drm_gem_object from nouveau_bo, use the
ttm_buffer_object.base instead.
Build tested only.
--- drivers/gpu/drm/nouveau/nouveau_bo.h | 5 ----- drivers/gpu/drm/nouveau/nouveau_gem.h | 2 +- drivers/gpu/drm/nouveau/nouveau_abi16.c | 4 ++-- drivers/gpu/drm/nouveau/nouveau_bo.c | 4 ++-- drivers/gpu/drm/nouveau/nouveau_display.c | 8 ++++---- drivers/gpu/drm/nouveau/nouveau_gem.c | 15 ++++++++------- drivers/gpu/drm/nouveau/nouveau_prime.c | 4 ++-- 7 files changed, 19 insertions(+), 23 deletions(-)
drivers/gpu/drm/nouveau/nouveau_bo.h +0 -5
@@ -35,11 +35,6 @@ struct nouveau_bo {struct nouveau_drm_tile *tile; -/* Only valid if allocated via nouveau_gem_new() and iff you hold a -* gem reference to it! For debugging, use gem.filp != NULL to test -* whether it is valid. */ -struct drm_gem_object gem; -/* protect by the ttm reservation lock */ int pin_refcnt;
drivers/gpu/drm/nouveau/nouveau_gem.h +1 -1
@@ -10,7 +10,7 @@static inline struct nouveau_bo *nouveau_gem_object (struct drm_gem_object *gem) { - return gem ? container_of(gem, struct nouveau_bo, gem) : NULL; + return gem ? container_of(gem, struct nouveau_bo, bo.base) : NULL; }/* nouveau_gem.c */
drivers/gpu/drm/nouveau/nouveau_abi16.c +2 -2
@@ -139,7 +139,7 @@ nouveau_abi16_chan_fini(struct nouveau_abi16 *abi16,if (chan->ntfy) {nouveau_vma_del (&chan->ntfy_vma);nouveau_bo_unpin (chan->ntfy); -drm_gem_object_put_unlocked (&chan->ntfy->gem); +drm_gem_object_put_unlocked (&chan->ntfy->bo.base); }if (chan->heap.block_size)
@@ -345,7 +345,7 @@ nouveau_abi16_ioctl_channel_alloc(ABI16_IOCTL_ARGS) goto done; } - ret =drm_gem_handle_create (file_priv, &chan->ntfy->gem, + ret =drm_gem_handle_create (file_priv, &chan->ntfy->bo.base, &init->notifier_handle);if (ret) goto done;
drivers/gpu/drm/nouveau/nouveau_bo.c +2 -2
@@ -136,7 +136,7 @@ nouveau_bo_del_ttm(struct ttm_buffer_object *bo)struct drm_device *dev = drm->dev;struct nouveau_bo *nvbo =nouveau_bo (bo); -if (unlikely (nvbo->gem.filp)) +if (unlikely (nvbo->bo.base.filp))DRM_ERROR ("bo %p still attached to GEM object\n" , bo);WARN_ON (nvbo->pin_refcnt >0 );nv10_bo_put_tile_region (dev, nvbo->tile,NULL );
@@ -1400,7 +1400,7 @@ nouveau_bo_verify_access(struct ttm_buffer_object *bo, struct file *filp) {struct nouveau_bo *nvbo =nouveau_bo (bo); -return drm_vma_node_verify_access (&nvbo->gem.vma_node, +return drm_vma_node_verify_access (&nvbo->bo.base.vma_node, filp->private_data); }
drivers/gpu/drm/nouveau/nouveau_display.c +4 -4
@@ -201,7 +201,7 @@ nouveau_user_framebuffer_destroy(struct drm_framebuffer *drm_fb)struct nouveau_framebuffer *fb =nouveau_framebuffer (drm_fb);if (fb->nvbo) -drm_gem_object_put_unlocked (&fb->nvbo->gem); +drm_gem_object_put_unlocked (&fb->nvbo->bo.base);drm_framebuffer_cleanup (drm_fb);kfree (fb);
@@ -214,7 +214,7 @@ nouveau_user_framebuffer_create_handle(struct drm_framebuffer *drm_fb, {struct nouveau_framebuffer *fb =nouveau_framebuffer (drm_fb); -return drm_gem_handle_create (file_priv, &fb->nvbo->gem, handle); +return drm_gem_handle_create (file_priv, &fb->nvbo->bo.base, handle); }static const struct drm_framebuffer_funcs nouveau_framebuffer_funcs = {
@@ -660,8 +660,8 @@ nouveau_display_dumb_create(struct drm_file *file_priv, struct drm_device *dev,if (ret)return ret; - ret =drm_gem_handle_create (file_priv, &bo->gem, &args->handle); -drm_gem_object_put_unlocked (&bo->gem); + ret =drm_gem_handle_create (file_priv, &bo->bo.base, &args->handle); +drm_gem_object_put_unlocked (&bo->bo.base);return ret; }
drivers/gpu/drm/nouveau/nouveau_gem.c +8 -7
@@ -205,13 +205,13 @@ nouveau_gem_new(struct nouveau_cli *cli, u64 size, int align, uint32_t domain,/* Initialize the embedded gem-object. We return a single gem-reference * to the caller, instead of a normal nouveau_bo ttm reference. */ - ret =drm_gem_object_init (drm->dev, &nvbo->gem, nvbo->bo.mem.size); + ret =drm_gem_object_init (drm->dev, &nvbo->bo.base, nvbo->bo.mem.size);if (ret) {nouveau_bo_ref (NULL , pnvbo);return -ENOMEM ; } - nvbo->bo.persistent_swap_storage = nvbo->gem.filp; + nvbo->bo.persistent_swap_storage = nvbo->bo.base.filp;return 0 ; }
@@ -268,15 +268,16 @@ nouveau_gem_ioctl_new(struct drm_device *dev, void *data,if (ret)return ret; - ret =drm_gem_handle_create (file_priv, &nvbo->gem, &req->info.handle); + ret =drm_gem_handle_create (file_priv, &nvbo->bo.base, + &req->info.handle);if (ret ==0 ) { - ret =nouveau_gem_info (file_priv, &nvbo->gem, &req->info); + ret =nouveau_gem_info (file_priv, &nvbo->bo.base, &req->info);if (ret)drm_gem_handle_delete (file_priv, req->info.handle); }/* drop reference from allocate - handle holds it now */ -drm_gem_object_put_unlocked (&nvbo->gem); +drm_gem_object_put_unlocked (&nvbo->bo.base);return ret; }
@@ -355,7 +356,7 @@ validate_fini_no_ticket(struct validate_op *op, struct nouveau_channel *chan,list_del (&nvbo->entry); nvbo->reserved_by =NULL ;ttm_bo_unreserve (&nvbo->bo); -drm_gem_object_put_unlocked (&nvbo->gem); +drm_gem_object_put_unlocked (&nvbo->bo.base); } }
@@ -493,7 +494,7 @@ validate_list(struct nouveau_channel *chan, struct nouveau_cli *cli,list_for_each_entry (nvbo, list, entry) {struct drm_nouveau_gem_pushbuf_bo *b = &pbbo[nvbo->pbbo_index]; - ret =nouveau_gem_set_domain (&nvbo->gem, b->read_domains, + ret =nouveau_gem_set_domain (&nvbo->bo.base, b->read_domains, b->write_domains, b->valid_domains);if (unlikely (ret)) {
drivers/gpu/drm/nouveau/nouveau_prime.c +2 -2
@@ -79,13 +79,13 @@ struct drm_gem_object *nouveau_gem_prime_import_sg_table(struct drm_device *dev,/* Initialize the embedded gem-object. We return a single gem-reference * to the caller, instead of a normal nouveau_bo ttm reference. */ - ret =drm_gem_object_init (dev, &nvbo->gem, nvbo->bo.mem.size); + ret =drm_gem_object_init (dev, &nvbo->bo.base, nvbo->bo.mem.size);if (ret) {nouveau_bo_ref (NULL , &nvbo);return ERR_PTR (-ENOMEM ); } -return &nvbo->gem; +return &nvbo->bo.base; }int nouveau_gem_prime_pin (struct drm_gem_object *obj)
Signature · 6 lines
2.18.1 _______________________________________________ Nouveau mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/nouveau
Gerd Hoffmann
maintainerPATCH v2 7/18 drm/ttm: use gem reservation object
In reply to Gerd HoffmannDrop ttm_resv from ttm_buffer_object, use the gem reservation object (base._resv) instead.
--- include/drm/ttm/ttm_bo_api.h | 1 - drivers/gpu/drm/ttm/ttm_bo.c | 40 ++++++++++++++++++------------- drivers/gpu/drm/ttm/ttm_bo_util.c | 2 +- 3 files changed, 25 insertions(+), 18 deletions(-)
include/drm/ttm/ttm_bo_api.h +0 -1
@@ -235,7 +235,6 @@ struct ttm_buffer_object {struct sg_table *sg;struct reservation_object *resv; -struct reservation_object ttm_resv;struct mutex wu_mutex; };
drivers/gpu/drm/ttm/ttm_bo.c +24 -16
@@ -160,7 +160,8 @@ static void ttm_bo_release_list(struct kref *list_kref)ttm_tt_destroy (bo->ttm);atomic_dec (&bo->bdev->glob->bo_count);dma_fence_put (bo->moving); -reservation_object_fini (&bo->ttm_resv); +if (!ttm_bo_uses_embedded_gem_object (bo)) +reservation_object_fini (&bo->base._resv);mutex_destroy (&bo->wu_mutex); bo->destroy (bo);ttm_mem_global_free (bdev->glob->mem_glob, acc_size);
@@ -438,14 +439,14 @@ static int ttm_bo_individualize_resv(struct ttm_buffer_object *bo) {int r; -if (bo->resv == &bo->ttm_resv) +if (bo->resv == &bo->base._resv)return 0 ; -BUG_ON (!reservation_object_trylock (&bo->ttm_resv)); +BUG_ON (!reservation_object_trylock (&bo->base._resv)); - r =reservation_object_copy_fences (&bo->ttm_resv, bo->resv); + r =reservation_object_copy_fences (&bo->base._resv, bo->resv);if (r) -reservation_object_unlock (&bo->ttm_resv); +reservation_object_unlock (&bo->base._resv);return r; }
@@ -456,8 +457,8 @@ static void ttm_bo_flush_all_fences(struct ttm_buffer_object *bo)struct dma_fence *fence;int i; - fobj =reservation_object_get_list (&bo->ttm_resv); - fence =reservation_object_get_excl (&bo->ttm_resv); + fobj =reservation_object_get_list (&bo->base._resv); + fence =reservation_object_get_excl (&bo->base._resv);if (fence && !fence->ops->signaled)dma_fence_enable_sw_signaling (fence);
@@ -490,11 +491,11 @@ static void ttm_bo_cleanup_refs_or_queue(struct ttm_buffer_object *bo)spin_lock (&glob->lru_lock); ret =reservation_object_trylock (bo->resv) ?0 : -EBUSY ;if (!ret) { -if (reservation_object_test_signaled_rcu (&bo->ttm_resv, true)) { +if (reservation_object_test_signaled_rcu (&bo->base._resv, true)) {ttm_bo_del_from_lru (bo);spin_unlock (&glob->lru_lock); -if (bo->resv != &bo->ttm_resv) -reservation_object_unlock (&bo->ttm_resv); +if (bo->resv != &bo->base._resv) +reservation_object_unlock (&bo->base._resv);ttm_bo_cleanup_memtype_use (bo);reservation_object_unlock (bo->resv);
@@ -515,8 +516,8 @@ static void ttm_bo_cleanup_refs_or_queue(struct ttm_buffer_object *bo)reservation_object_unlock (bo->resv); } -if (bo->resv != &bo->ttm_resv) -reservation_object_unlock (&bo->ttm_resv); +if (bo->resv != &bo->base._resv) +reservation_object_unlock (&bo->base._resv); error:kref_get (&bo->list_kref);
@@ -551,7 +552,7 @@ static int ttm_bo_cleanup_refs(struct ttm_buffer_object *bo,if (unlikely (list_empty (&bo->ddestroy))) resv = bo->resv;else - resv = &bo->ttm_resv; + resv = &bo->base._resv;if (reservation_object_test_signaled_rcu (resv, true)) ret =0 ;
@@ -631,7 +632,7 @@ static bool ttm_bo_delayed_delete(struct ttm_bo_device *bdev, bool remove_all)kref_get (&bo->list_kref);list_move_tail (&bo->ddestroy, &removed); -if (remove_all || bo->resv != &bo->ttm_resv) { +if (remove_all || bo->resv != &bo->base._resv) {spin_unlock (&glob->lru_lock);reservation_object_lock (bo->resv,NULL );
@@ -1332,9 +1333,16 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev, bo->resv = resv;reservation_object_assert_held (bo->resv); }else { - bo->resv = &bo->ttm_resv; + bo->resv = &bo->base._resv; + } +if (!ttm_bo_uses_embedded_gem_object (bo)) { +/* +* bo.gem is not initialized, so we have to setup the +* struct elements we want use regardless. Should go +* away once all users are switched over. +*/ +reservation_object_init (&bo->base._resv); } -reservation_object_init (&bo->ttm_resv);atomic_inc (&bo->bdev->glob->bo_count);drm_vma_node_reset (&bo->vma_node);
drivers/gpu/drm/ttm/ttm_bo_util.c +1 -1
@@ -517,7 +517,7 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,kref_init (&fbo->base.kref); fbo->base.destroy = &ttm_transfered_destroy; fbo->base.acc_size =0 ; - fbo->base.resv = &fbo->base.ttm_resv; + fbo->base.resv = &fbo->base.base._resv;reservation_object_init (fbo->base.resv); ret =reservation_object_trylock (fbo->base.resv);WARN_ON (!ret);
Signature · 1 line
2.18.1
Gerd Hoffmann
maintainerPATCH v2 8/18 drm/ttm: use gem vma_node
In reply to Gerd HoffmannDrop vma_node from ttm_buffer_object, use the gem struct (base.vma_node) instead.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 2 +- drivers/gpu/drm/qxl/qxl_object.h | 2 +- drivers/gpu/drm/radeon/radeon_object.h | 2 +- drivers/gpu/drm/virtio/virtgpu_drv.h | 2 +- include/drm/ttm/ttm_bo_api.h | 5 +---- drivers/gpu/drm/drm_gem_vram_helper.c | 5 +---- drivers/gpu/drm/nouveau/nouveau_display.c | 2 +- drivers/gpu/drm/nouveau/nouveau_gem.c | 2 +- drivers/gpu/drm/ttm/ttm_bo.c | 8 ++++---- drivers/gpu/drm/ttm/ttm_bo_util.c | 2 +- drivers/gpu/drm/ttm/ttm_bo_vm.c | 9 +++++---- drivers/gpu/drm/virtio/virtgpu_prime.c | 3 --- drivers/gpu/drm/vmwgfx/vmwgfx_bo.c | 4 ++-- drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 4 ++-- 14 files changed, 22 insertions(+), 30 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +1 -1
@@ -191,7 +191,7 @@ static inline unsigned amdgpu_bo_gpu_page_alignment(struct amdgpu_bo *bo)*/ static inline u64 amdgpu_bo_mmap_offset (struct amdgpu_bo *bo) { -return drm_vma_node_offset_addr (&bo->tbo.vma_node); +return drm_vma_node_offset_addr (&bo->tbo.base.vma_node); }/**
drivers/gpu/drm/qxl/qxl_object.h +1 -1
@@ -60,7 +60,7 @@ static inline unsigned long qxl_bo_size(struct qxl_bo *bo)static inline u64 qxl_bo_mmap_offset (struct qxl_bo *bo) { -return drm_vma_node_offset_addr (&bo->tbo.vma_node); +return drm_vma_node_offset_addr (&bo->tbo.base.vma_node); } static inline int qxl_bo_wait(struct qxl_bo *bo, u32 *mem_type,
drivers/gpu/drm/radeon/radeon_object.h +1 -1
@@ -116,7 +116,7 @@ static inline unsigned radeon_bo_gpu_page_alignment(struct radeon_bo *bo)*/ static inline u64 radeon_bo_mmap_offset (struct radeon_bo *bo) { -return drm_vma_node_offset_addr (&bo->tbo.vma_node); +return drm_vma_node_offset_addr (&bo->tbo.base.vma_node); } extern int radeon_bo_wait(struct radeon_bo *bo, u32 *mem_type,
drivers/gpu/drm/virtio/virtgpu_drv.h +1 -1
@@ -396,7 +396,7 @@ static inline void virtio_gpu_object_unref(struct virtio_gpu_object **bo)static inline u64 virtio_gpu_object_mmap_offset (struct virtio_gpu_object *bo) { -return drm_vma_node_offset_addr (&bo->tbo.vma_node); +return drm_vma_node_offset_addr (&bo->tbo.base.vma_node); } static inline int virtio_gpu_object_reserve(struct virtio_gpu_object *bo,
include/drm/ttm/ttm_bo_api.h +1 -4
@@ -152,7 +152,6 @@ struct ttm_tt;* @ddestroy: List head for the delayed destroy list. * @swap: List head for swap LRU list. * @moving: Fence set when BO is moving -* @vma_node: Address space manager node. * @offset: The current GPU offset, which can have different meanings * depending on the memory type. For SYSTEM type memory, it should be 0. * @cur_placement: Hint of current placement.
@@ -219,9 +218,7 @@ struct ttm_buffer_object {*/ struct dma_fence *moving; - -struct drm_vma_offset_node vma_node; - +/* base.vma_node */ unsigned priority;/**
drivers/gpu/drm/drm_gem_vram_helper.c +1 -4
@@ -163,7 +163,7 @@ EXPORT_SYMBOL(drm_gem_vram_put);*/ u64 drm_gem_vram_mmap_offset (struct drm_gem_vram_object *gbo) { -return drm_vma_node_offset_addr (&gbo->bo.vma_node); +return drm_vma_node_offset_addr (&gbo->bo.base.vma_node); }EXPORT_SYMBOL (drm_gem_vram_mmap_offset);
@@ -633,9 +633,6 @@ EXPORT_SYMBOL(drm_gem_vram_driver_gem_prime_vunmap);int drm_gem_vram_driver_gem_prime_mmap (struct drm_gem_object *gem,struct vm_area_struct *vma) { -struct drm_gem_vram_object *gbo =drm_gem_vram_of_gem (gem); - - gbo->bo.base.vma_node.vm_node.start = gbo->bo.vma_node.vm_node.start;return drm_gem_prime_mmap (gem, vma); }EXPORT_SYMBOL (drm_gem_vram_driver_gem_prime_mmap);
drivers/gpu/drm/nouveau/nouveau_display.c +1 -1
@@ -675,7 +675,7 @@ nouveau_display_dumb_map_offset(struct drm_file *file_priv, gem =drm_gem_object_lookup (file_priv, handle);if (gem) {struct nouveau_bo *bo =nouveau_gem_object (gem); - *poffset =drm_vma_node_offset_addr (&bo->bo.vma_node); + *poffset =drm_vma_node_offset_addr (&bo->bo.base.vma_node);drm_gem_object_put_unlocked (gem);return 0 ; }
drivers/gpu/drm/nouveau/nouveau_gem.c +1 -1
@@ -240,7 +240,7 @@ nouveau_gem_info(struct drm_file *file_priv, struct drm_gem_object *gem, } rep->size = nvbo->bo.mem.num_pages <<PAGE_SHIFT ; - rep->map_handle =drm_vma_node_offset_addr (&nvbo->bo.vma_node); + rep->map_handle =drm_vma_node_offset_addr (&nvbo->bo.base.vma_node); rep->tile_mode = nvbo->mode; rep->tile_flags = nvbo->contig ?0 :NOUVEAU_GEM_TILE_NONCONTIG ;if (cli->device.info.family >=NV_DEVICE_INFO_V0_FERMI )
drivers/gpu/drm/ttm/ttm_bo.c +4 -4
@@ -672,7 +672,7 @@ static void ttm_bo_release(struct kref *kref)struct ttm_bo_device *bdev = bo->bdev;struct ttm_mem_type_manager *man = &bdev->man[bo->mem.mem_type]; -drm_vma_offset_remove (&bdev->vma_manager, &bo->vma_node); +drm_vma_offset_remove (&bdev->vma_manager, &bo->base.vma_node);ttm_mem_io_lock (man, false);ttm_mem_io_free_vm (bo);ttm_mem_io_unlock (man);
@@ -1342,9 +1342,9 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev,* away once all users are switched over. */ reservation_object_init (&bo->base._resv); +drm_vma_node_reset (&bo->base.vma_node); }atomic_inc (&bo->bdev->glob->bo_count); -drm_vma_node_reset (&bo->vma_node);/* * For ttm_bo_type_device buffers, allocate
@@ -1352,7 +1352,7 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev,*/ if (bo->type == ttm_bo_type_device || bo->type == ttm_bo_type_sg) - ret =drm_vma_offset_add (&bdev->vma_manager, &bo->vma_node, + ret =drm_vma_offset_add (&bdev->vma_manager, &bo->base.vma_node, bo->mem.num_pages);/* passed reservation objects should already be locked,
@@ -1780,7 +1780,7 @@ void ttm_bo_unmap_virtual_locked(struct ttm_buffer_object *bo) {struct ttm_bo_device *bdev = bo->bdev; -drm_vma_node_unmap (&bo->vma_node, bdev->dev_mapping); +drm_vma_node_unmap (&bo->base.vma_node, bdev->dev_mapping);ttm_mem_io_free_vm (bo); }
drivers/gpu/drm/ttm/ttm_bo_util.c +1 -1
@@ -510,7 +510,7 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,INIT_LIST_HEAD (&fbo->base.io_reserve_lru);mutex_init (&fbo->base.wu_mutex); fbo->base.moving =NULL ; -drm_vma_node_reset (&fbo->base.vma_node); +drm_vma_node_reset (&fbo->base.base.vma_node);atomic_set (&fbo->base.cpu_writers,0 );kref_init (&fbo->base.list_kref);
drivers/gpu/drm/ttm/ttm_bo_vm.c +5 -4
@@ -211,9 +211,9 @@ static vm_fault_t ttm_bo_vm_fault(struct vm_fault *vmf) } page_offset = ((address - vma->vm_start) >>PAGE_SHIFT ) + - vma->vm_pgoff -drm_vma_node_start (&bo->vma_node); + vma->vm_pgoff -drm_vma_node_start (&bo->base.vma_node); page_last =vma_pages (vma) + vma->vm_pgoff - -drm_vma_node_start (&bo->vma_node); +drm_vma_node_start (&bo->base.vma_node);if (unlikely (page_offset >= bo->num_pages)) { ret =VM_FAULT_SIGBUS ;
@@ -267,7 +267,7 @@ static vm_fault_t ttm_bo_vm_fault(struct vm_fault *vmf) }else if (unlikely (!page)) {break ; } - page->index =drm_vma_node_start (&bo->vma_node) + + page->index =drm_vma_node_start (&bo->base.vma_node) + page_offset; pfn =page_to_pfn (page); }
@@ -413,7 +413,8 @@ static struct ttm_buffer_object *ttm_bo_vm_lookup(struct ttm_bo_device *bdev, node =drm_vma_offset_lookup_locked (&bdev->vma_manager, offset, pages);if (likely (node)) { - bo = container_of(node, struct ttm_buffer_object, vma_node); + bo = container_of(node, struct ttm_buffer_object, + base.vma_node); bo =ttm_bo_get_unless_zero (bo); }
drivers/gpu/drm/virtio/virtgpu_prime.c +0 -3
@@ -66,8 +66,5 @@ void virtgpu_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr)int virtgpu_gem_prime_mmap (struct drm_gem_object *obj,struct vm_area_struct *vma) { -struct virtio_gpu_object *bo =gem_to_virtio_gpu_obj (obj); - - bo->gem_base.vma_node.vm_node.start = bo->tbo.vma_node.vm_node.start;return drm_gem_prime_mmap (obj, vma); }
drivers/gpu/drm/vmwgfx/vmwgfx_bo.c +2 -2
@@ -835,7 +835,7 @@ int vmw_bo_alloc_ioctl(struct drm_device *dev, void *data, goto out_no_bo; rep->handle = handle; - rep->map_handle =drm_vma_node_offset_addr (&vbo->base.vma_node); + rep->map_handle =drm_vma_node_offset_addr (&vbo->base.base.vma_node); rep->cur_gmr_id = handle; rep->cur_gmr_offset =0 ;
@@ -1077,7 +1077,7 @@ int vmw_dumb_map_offset(struct drm_file *file_priv,if (ret !=0 )return -EINVAL ; - *offset =drm_vma_node_offset_addr (&out_buf->base.vma_node); + *offset =drm_vma_node_offset_addr (&out_buf->base.base.vma_node);vmw_bo_unreference (&out_buf);return 0 ; }
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c +2 -2
@@ -1669,7 +1669,7 @@ vmw_gb_surface_define_internal(struct drm_device *dev, rep->backup_size = res->backup_size;if (res->backup) { rep->buffer_map_handle = -drm_vma_node_offset_addr (&res->backup->base.vma_node); +drm_vma_node_offset_addr (&res->backup->base.base.vma_node); rep->buffer_size = res->backup->base.num_pages *PAGE_SIZE ; rep->buffer_handle = backup_handle; }else {
@@ -1745,7 +1745,7 @@ vmw_gb_surface_reference_internal(struct drm_device *dev, rep->crep.backup_size = srf->res.backup_size; rep->crep.buffer_handle = backup_handle; rep->crep.buffer_map_handle = -drm_vma_node_offset_addr (&srf->res.backup->base.vma_node); +drm_vma_node_offset_addr (&srf->res.backup->base.base.vma_node); rep->crep.buffer_size = srf->res.backup->base.num_pages *PAGE_SIZE ; rep->creq.version = drm_vmw_gb_surface_v1;
Signature · 1 line
2.18.1
Gerd Hoffmann
maintainerPATCH v2 9/18 drm/vram: drop drm_gem_vram_driver_gem_prime_mmap
In reply to Gerd HoffmannThe wrapper doesn't do anything any more, drop it.
--- include/drm/drm_gem_vram_helper.h | 4 +--- drivers/gpu/drm/drm_gem_vram_helper.c | 17 ----------------- 2 files changed, 1 insertion(+), 20 deletions(-)
include/drm/drm_gem_vram_helper.h +1 -3
@@ -137,8 +137,6 @@ void drm_gem_vram_driver_gem_prime_unpin(struct drm_gem_object *obj);void *drm_gem_vram_driver_gem_prime_vmap (struct drm_gem_object *obj);void drm_gem_vram_driver_gem_prime_vunmap (struct drm_gem_object *obj,void *vaddr); -int drm_gem_vram_driver_gem_prime_mmap (struct drm_gem_object *obj, -struct vm_area_struct *vma);#define DRM_GEM_VRAM_DRIVER_PRIME \ .gem_prime_export = drm_gem_prime_export, \
@@ -147,6 +145,6 @@ int drm_gem_vram_driver_gem_prime_mmap(struct drm_gem_object *obj, .gem_prime_unpin = drm_gem_vram_driver_gem_prime_unpin, \ .gem_prime_vmap = drm_gem_vram_driver_gem_prime_vmap, \ .gem_prime_vunmap = drm_gem_vram_driver_gem_prime_vunmap, \ - .gem_prime_mmap = drm_gem_vram_driver_gem_prime_mmap + .gem_prime_mmap = drm_gem_prime_mmap#endif
drivers/gpu/drm/drm_gem_vram_helper.c +0 -17
@@ -619,20 +619,3 @@ void drm_gem_vram_driver_gem_prime_vunmap(struct drm_gem_object *gem,drm_gem_vram_unpin (gbo); }EXPORT_SYMBOL (drm_gem_vram_driver_gem_prime_vunmap); - -/** -* drm_gem_vram_driver_gem_prime_mmap() - \ -Implements &struct drm_driver.gem_prime_mmap -* @gem: The GEM object to map -* @vma: The VMA describing the mapping -* -* Returns: -* 0 on success, or -* a negative errno code otherwise. -*/ -int drm_gem_vram_driver_gem_prime_mmap (struct drm_gem_object *gem, -struct vm_area_struct *vma) -{ -return drm_gem_prime_mmap (gem, vma); -} -EXPORT_SYMBOL (drm_gem_vram_driver_gem_prime_mmap);
Signature · 6 lines
2.18.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 09/18] drm/vram: drop drm_gem_vram_driver_gem_prime_mmap
Am 21.06.19 um 13:57 schrieb Gerd Hoffmann:
Quoted 55 lines
The wrapper doesn't do anything any more, drop it.
Signed-off-by Gerd Hoffmann <[email protected]>--- include/drm/drm_gem_vram_helper.h | 4 +--- drivers/gpu/drm/drm_gem_vram_helper.c | 17 ----------------- 2 files changed, 1 insertion(+), 20 deletions(-)include/drm/drm_gem_vram_helper.h +1
-3@@ -137,8 +137,6 @@ void drm_gem_vram_driver_gem_prime_unpin(struct drm_gem_object *obj);void *drm_gem_vram_driver_gem_prime_vmap (struct drm_gem_object *obj);void drm_gem_vram_driver_gem_prime_vunmap (struct drm_gem_object *obj,void *vaddr); -int drm_gem_vram_driver_gem_prime_mmap (struct drm_gem_object *obj, -struct vm_area_struct *vma);#define DRM_GEM_VRAM_DRIVER_PRIME \ .gem_prime_export = drm_gem_prime_export, \@@ -147,6 +145,6 @@ int drm_gem_vram_driver_gem_prime_mmap(struct drm_gem_object *obj, .gem_prime_unpin = drm_gem_vram_driver_gem_prime_unpin, \ .gem_prime_vmap = drm_gem_vram_driver_gem_prime_vmap, \ .gem_prime_vunmap = drm_gem_vram_driver_gem_prime_vunmap, \ - .gem_prime_mmap = drm_gem_vram_driver_gem_prime_mmap + .gem_prime_mmap = drm_gem_prime_mmap#endif drivers/gpu/drm/drm_gem_vram_helper.c +0
-17@@ -619,20 +619,3 @@ void drm_gem_vram_driver_gem_prime_vunmap(struct drm_gem_object *gem,drm_gem_vram_unpin (gbo); }EXPORT_SYMBOL (drm_gem_vram_driver_gem_prime_vunmap); - -/** -* drm_gem_vram_driver_gem_prime_mmap() - \ -Implements &struct drm_driver.gem_prime_mmap -* @gem: The GEM object to map -* @vma: The VMA describing the mapping -* -* Returns: -* 0 on success, or -* a negative errno code otherwise. -*/ -int drm_gem_vram_driver_gem_prime_mmap (struct drm_gem_object *gem, -struct vm_area_struct *vma) -{ -return drm_gem_prime_mmap (gem, vma); -} -EXPORT_SYMBOL (drm_gem_vram_driver_gem_prime_mmap);
Signature · 5 lines
Thomas Zimmermann Graphics Driver Developer SUSE Linux GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 21284 (AG Nürnberg)
Gerd Hoffmann
maintainerPATCH v2 10/18 drm/ttm: set both resv and base.resv pointers
In reply to Gerd HoffmannInitialize both ttm_buffer_object->resv and ttm_buffer_object->base.resv pointers. This allows to move users from the former to the latter. When all users are moved we can drop ttm_buffer_object->resv.
--- drivers/gpu/drm/ttm/ttm_bo.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/ttm/ttm_bo.c +2 -0
@@ -1331,9 +1331,11 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev, bo->sg = sg;if (resv) { bo->resv = resv; + bo->base.resv = resv;reservation_object_assert_held (bo->resv); }else { bo->resv = &bo->base._resv; + bo->base.resv = &bo->base._resv; }if (!ttm_bo_uses_embedded_gem_object (bo)) {/*
Signature · 1 line
2.18.1
Gerd Hoffmann
maintainerPATCH v2 11/18 drm/ttm: switch ttm core from bo->resv to bo->base.resv
In reply to Gerd Hoffmann--- include/drm/ttm/ttm_bo_driver.h | 12 ++-- drivers/gpu/drm/ttm/ttm_bo.c | 96 +++++++++++++------------- drivers/gpu/drm/ttm/ttm_bo_util.c | 16 ++--- drivers/gpu/drm/ttm/ttm_bo_vm.c | 6 +- drivers/gpu/drm/ttm/ttm_execbuf_util.c | 20 +++--- drivers/gpu/drm/ttm/ttm_tt.c | 2 +- 6 files changed, 76 insertions(+), 76 deletions(-)
include/drm/ttm/ttm_bo_driver.h +6 -6
@@ -654,14 +654,14 @@ static inline int __ttm_bo_reserve(struct ttm_buffer_object *bo,if (WARN_ON (ticket))return -EBUSY ; - success =reservation_object_trylock (bo->resv); + success =reservation_object_trylock (bo->base.resv);return success ?0 : -EBUSY ; }if (interruptible) - ret =reservation_object_lock_interruptible (bo->resv, ticket); + ret =reservation_object_lock_interruptible (bo->base.resv, ticket);else - ret =reservation_object_lock (bo->resv, ticket); + ret =reservation_object_lock (bo->base.resv, ticket);if (ret == -EINTR )return -ERESTARTSYS ;return ret;
@@ -745,10 +745,10 @@ static inline int ttm_bo_reserve_slowpath(struct ttm_buffer_object *bo,WARN_ON (!kref_read (&bo->kref));if (interruptible) - ret =ww_mutex_lock_slow_interruptible (&bo->resv->lock, + ret =ww_mutex_lock_slow_interruptible (&bo->base.resv->lock, ticket);else -ww_mutex_lock_slow (&bo->resv->lock, ticket); +ww_mutex_lock_slow (&bo->base.resv->lock, ticket);if (likely (ret ==0 ))ttm_bo_del_sub_from_lru (bo);
@@ -773,7 +773,7 @@ static inline void ttm_bo_unreserve(struct ttm_buffer_object *bo)else ttm_bo_move_to_lru_tail (bo,NULL );spin_unlock (&bo->bdev->glob->lru_lock); -reservation_object_unlock (bo->resv); +reservation_object_unlock (bo->base.resv); }/*
drivers/gpu/drm/ttm/ttm_bo.c +48 -48
324 lines not on this page · raw message
drivers/gpu/drm/ttm/ttm_bo_util.c +8 -8
@@ -517,9 +517,9 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,kref_init (&fbo->base.kref); fbo->base.destroy = &ttm_transfered_destroy; fbo->base.acc_size =0 ; - fbo->base.resv = &fbo->base.base._resv; -reservation_object_init (fbo->base.resv); - ret =reservation_object_trylock (fbo->base.resv); + fbo->base.base.resv = &fbo->base.base._resv; +reservation_object_init (fbo->base.base.resv); + ret =reservation_object_trylock (fbo->base.base.resv);WARN_ON (!ret); *new_obj = &fbo->base;
@@ -689,7 +689,7 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,int ret;struct ttm_buffer_object *ghost_obj; -reservation_object_add_excl_fence (bo->resv, fence); +reservation_object_add_excl_fence (bo->base.resv, fence);if (evict) { ret =ttm_bo_wait (bo, false, false);if (ret)
@@ -716,7 +716,7 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,if (ret)return ret; -reservation_object_add_excl_fence (ghost_obj->resv, fence); +reservation_object_add_excl_fence (ghost_obj->base.resv, fence);/** * If we're not moving to fixed memory, the TTM object
@@ -752,7 +752,7 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo,int ret; -reservation_object_add_excl_fence (bo->resv, fence); +reservation_object_add_excl_fence (bo->base.resv, fence);if (!evict) {struct ttm_buffer_object *ghost_obj;
@@ -772,7 +772,7 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo,if (ret)return ret; -reservation_object_add_excl_fence (ghost_obj->resv, fence); +reservation_object_add_excl_fence (ghost_obj->base.resv, fence);/** * If we're not moving to fixed memory, the TTM object
@@ -841,7 +841,7 @@ int ttm_bo_pipeline_gutting(struct ttm_buffer_object *bo)if (ret)return ret; - ret =reservation_object_copy_fences (ghost->resv, bo->resv); + ret =reservation_object_copy_fences (ghost->base.resv, bo->base.resv);/* Last resort, wait for the BO to be idle when we are OOM */ if (ret)ttm_bo_wait (bo, false, false);
drivers/gpu/drm/ttm/ttm_bo_vm.c +3 -3
@@ -71,7 +71,7 @@ static vm_fault_t ttm_bo_vm_fault_idle(struct ttm_buffer_object *bo,ttm_bo_get (bo);up_read (&vmf->vma->vm_mm->mmap_sem); (void )dma_fence_wait (bo->moving, true); -reservation_object_unlock (bo->resv); +reservation_object_unlock (bo->base.resv);ttm_bo_put (bo); goto out_unlock; }
@@ -131,7 +131,7 @@ static vm_fault_t ttm_bo_vm_fault(struct vm_fault *vmf)* for reserve, and if it fails, retry the fault after waiting * for the buffer to become unreserved. */ -if (unlikely (!reservation_object_trylock (bo->resv))) { +if (unlikely (!reservation_object_trylock (bo->base.resv))) {if (vmf->flags &FAULT_FLAG_ALLOW_RETRY ) {if (!(vmf->flags &FAULT_FLAG_RETRY_NOWAIT )) {ttm_bo_get (bo);
@@ -296,7 +296,7 @@ static vm_fault_t ttm_bo_vm_fault(struct vm_fault *vmf) out_io_unlock:ttm_mem_io_unlock (man); out_unlock: -reservation_object_unlock (bo->resv); +reservation_object_unlock (bo->base.resv);return ret; }
drivers/gpu/drm/ttm/ttm_execbuf_util.c +10 -10
@@ -39,7 +39,7 @@ static void ttm_eu_backoff_reservation_reverse(struct list_head *list,list_for_each_entry_continue_reverse (entry, list, head) {struct ttm_buffer_object *bo = entry->bo; -reservation_object_unlock (bo->resv); +reservation_object_unlock (bo->base.resv); } }
@@ -71,7 +71,7 @@ void ttm_eu_backoff_reservation(struct ww_acquire_ctx *ticket,if (list_empty (&bo->lru))ttm_bo_add_to_lru (bo); -reservation_object_unlock (bo->resv); +reservation_object_unlock (bo->base.resv); }spin_unlock (&glob->lru_lock);
@@ -114,7 +114,7 @@ int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket, ret =__ttm_bo_reserve (bo, intr, (ticket ==NULL ), ticket);if (!ret &&unlikely (atomic_read (&bo->cpu_writers) >0 )) { -reservation_object_unlock (bo->resv); +reservation_object_unlock (bo->base.resv); ret = -EBUSY ;
@@ -130,7 +130,7 @@ int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket,if (!entry->num_shared)continue ; - ret =reservation_object_reserve_shared (bo->resv, + ret =reservation_object_reserve_shared (bo->base.resv, entry->num_shared);if (!ret)continue ;
@@ -144,16 +144,16 @@ int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket,if (ret == -EDEADLK ) {if (intr) { - ret =ww_mutex_lock_slow_interruptible (&bo->resv->lock, + ret =ww_mutex_lock_slow_interruptible (&bo->base.resv->lock, ticket); }else { -ww_mutex_lock_slow (&bo->resv->lock, ticket); +ww_mutex_lock_slow (&bo->base.resv->lock, ticket); ret =0 ; } }if (!ret && entry->num_shared) - ret =reservation_object_reserve_shared (bo->resv, + ret =reservation_object_reserve_shared (bo->base.resv, entry->num_shared);if (unlikely (ret !=0 )) {
@@ -201,14 +201,14 @@ void ttm_eu_fence_buffer_objects(struct ww_acquire_ctx *ticket,list_for_each_entry (entry, list, head) { bo = entry->bo;if (entry->num_shared) -reservation_object_add_shared_fence (bo->resv, fence); +reservation_object_add_shared_fence (bo->base.resv, fence);else -reservation_object_add_excl_fence (bo->resv, fence); +reservation_object_add_excl_fence (bo->base.resv, fence);if (list_empty (&bo->lru))ttm_bo_add_to_lru (bo);else ttm_bo_move_to_lru_tail (bo,NULL ); -reservation_object_unlock (bo->resv); +reservation_object_unlock (bo->base.resv); }spin_unlock (&glob->lru_lock);if (ticket)
drivers/gpu/drm/ttm/ttm_tt.c +1 -1
@@ -48,7 +48,7 @@ int ttm_tt_create(struct ttm_buffer_object *bo, bool zero_alloc)struct ttm_bo_device *bdev = bo->bdev;uint32_t page_flags =0 ; -reservation_object_assert_held (bo->resv); +reservation_object_assert_held (bo->base.resv);if (bdev->need_dma32) page_flags |=TTM_PAGE_FLAG_DMA32 ;
Signature · 6 lines
2.18.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Gerd Hoffmann
maintainerPATCH v2 12/18 drm/radeon: switch driver from bo->resv to bo->base.resv
In reply to Gerd Hoffmann--- drivers/gpu/drm/radeon/radeon_benchmark.c | 4 ++-- drivers/gpu/drm/radeon/radeon_cs.c | 2 +- drivers/gpu/drm/radeon/radeon_display.c | 2 +- drivers/gpu/drm/radeon/radeon_gem.c | 6 +++--- drivers/gpu/drm/radeon/radeon_mn.c | 2 +- drivers/gpu/drm/radeon/radeon_object.c | 8 ++++---- drivers/gpu/drm/radeon/radeon_prime.c | 2 +- drivers/gpu/drm/radeon/radeon_test.c | 8 ++++---- drivers/gpu/drm/radeon/radeon_ttm.c | 2 +- drivers/gpu/drm/radeon/radeon_uvd.c | 2 +- drivers/gpu/drm/radeon/radeon_vm.c | 6 +++--- 11 files changed, 22 insertions(+), 22 deletions(-)
drivers/gpu/drm/radeon/radeon_benchmark.c +2 -2
@@ -122,7 +122,7 @@ static void radeon_benchmark_move(struct radeon_device *rdev, unsigned size,if (rdev->asic->copy.dma) { time =radeon_benchmark_do_move (rdev, size, saddr, daddr,RADEON_BENCHMARK_COPY_DMA , n, - dobj->tbo.resv); + dobj->tbo.base.resv);if (time <0 ) goto out_cleanup;if (time >0 )
@@ -133,7 +133,7 @@ static void radeon_benchmark_move(struct radeon_device *rdev, unsigned size,if (rdev->asic->copy.blit) { time =radeon_benchmark_do_move (rdev, size, saddr, daddr,RADEON_BENCHMARK_COPY_BLIT , n, - dobj->tbo.resv); + dobj->tbo.base.resv);if (time <0 ) goto out_cleanup;if (time >0 )
drivers/gpu/drm/radeon/radeon_cs.c +1 -1
@@ -257,7 +257,7 @@ static int radeon_cs_sync_rings(struct radeon_cs_parser *p)list_for_each_entry (reloc, &p->validated, tv.head) {struct reservation_object *resv; - resv = reloc->robj->tbo.resv; + resv = reloc->robj->tbo.base.resv; r =radeon_sync_resv (p->rdev, &p->ib.sync, resv, reloc->tv.num_shared);if (r)
drivers/gpu/drm/radeon/radeon_display.c +1 -1
@@ -533,7 +533,7 @@ static int radeon_crtc_page_flip_target(struct drm_crtc *crtc,DRM_ERROR ("failed to pin new rbo buffer before flip\n" ); goto cleanup; } - work->fence =dma_fence_get (reservation_object_get_excl (new_rbo->tbo.resv)); + work->fence =dma_fence_get (reservation_object_get_excl (new_rbo->tbo.base.resv));radeon_bo_get_tiling_flags (new_rbo, &tiling_flags,NULL );radeon_bo_unreserve (new_rbo);
drivers/gpu/drm/radeon/radeon_gem.c +3 -3
@@ -114,7 +114,7 @@ static int radeon_gem_set_domain(struct drm_gem_object *gobj, }if (domain ==RADEON_GEM_DOMAIN_CPU ) {/* Asking for cpu access wait for object idle */ - r =reservation_object_wait_timeout_rcu (robj->tbo.resv, true, true,30 *HZ ); + r =reservation_object_wait_timeout_rcu (robj->tbo.base.resv, true, true,30 *HZ );if (!r) r = -EBUSY ;
@@ -449,7 +449,7 @@ int radeon_gem_busy_ioctl(struct drm_device *dev, void *data, } robj =gem_to_radeon_bo (gobj); - r =reservation_object_test_signaled_rcu (robj->tbo.resv, true); + r =reservation_object_test_signaled_rcu (robj->tbo.base.resv, true);if (r ==0 ) r = -EBUSY ;else
@@ -478,7 +478,7 @@ int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data, } robj =gem_to_radeon_bo (gobj); - ret =reservation_object_wait_timeout_rcu (robj->tbo.resv, true, true,30 *HZ ); + ret =reservation_object_wait_timeout_rcu (robj->tbo.base.resv, true, true,30 *HZ );if (ret ==0 ) r = -EBUSY ;else if (ret <0 )
drivers/gpu/drm/radeon/radeon_mn.c +1 -1
@@ -163,7 +163,7 @@ static int radeon_mn_invalidate_range_start(struct mmu_notifier *mn,continue ; } - r =reservation_object_wait_timeout_rcu (bo->tbo.resv, + r =reservation_object_wait_timeout_rcu (bo->tbo.base.resv, true, false,MAX_SCHEDULE_TIMEOUT );if (r <=0 )DRM_ERROR ("(%ld) failed to wait for user bo\n" , r);
drivers/gpu/drm/radeon/radeon_object.c +4 -4
@@ -610,7 +610,7 @@ int radeon_bo_get_surface_reg(struct radeon_bo *bo)int steal;int i; -lockdep_assert_held (&bo->tbo.resv->lock.base); +lockdep_assert_held (&bo->tbo.base.resv->lock.base);if (!bo->tiling_flags)return 0 ;
@@ -736,7 +736,7 @@ void radeon_bo_get_tiling_flags(struct radeon_bo *bo,uint32_t *tiling_flags, uint32_t *pitch) { - lockdep_assert_held(&bo->tbo.resv->lock.base); + lockdep_assert_held(&bo->tbo.base.resv->lock.base);if (tiling_flags) *tiling_flags = bo->tiling_flags;
@@ -748,7 +748,7 @@ int radeon_bo_check_tiling(struct radeon_bo *bo, bool has_moved, bool force_drop) {if (!force_drop) -lockdep_assert_held (&bo->tbo.resv->lock.base); +lockdep_assert_held (&bo->tbo.base.resv->lock.base);if (!(bo->tiling_flags &RADEON_TILING_SURFACE ))return 0 ;
@@ -870,7 +870,7 @@ int radeon_bo_wait(struct radeon_bo *bo, u32 *mem_type, bool no_wait)void radeon_bo_fence (struct radeon_bo *bo,struct radeon_fence *fence,bool shared) { -struct reservation_object *resv = bo->tbo.resv; +struct reservation_object *resv = bo->tbo.base.resv;if (shared)reservation_object_add_shared_fence (resv, &fence->base);
drivers/gpu/drm/radeon/radeon_prime.c +1 -1
@@ -121,7 +121,7 @@ struct reservation_object *radeon_gem_prime_res_obj(struct drm_gem_object *obj) {struct radeon_bo *bo =gem_to_radeon_bo (obj); -return bo->tbo.resv; +return bo->tbo.base.resv; } struct dma_buf *radeon_gem_prime_export(struct drm_device *dev,
drivers/gpu/drm/radeon/radeon_test.c +4 -4
@@ -120,11 +120,11 @@ static void radeon_do_test_moves(struct radeon_device *rdev, int flag)if (ring ==R600_RING_TYPE_DMA_INDEX ) fence =radeon_copy_dma (rdev, gtt_addr, vram_addr, size /RADEON_GPU_PAGE_SIZE , - vram_obj->tbo.resv); + vram_obj->tbo.base.resv);else fence =radeon_copy_blit (rdev, gtt_addr, vram_addr, size /RADEON_GPU_PAGE_SIZE , - vram_obj->tbo.resv); + vram_obj->tbo.base.resv);if (IS_ERR (fence)) {DRM_ERROR ("Failed GTT->VRAM copy %d\n" , i); r =PTR_ERR (fence);
@@ -171,11 +171,11 @@ static void radeon_do_test_moves(struct radeon_device *rdev, int flag)if (ring ==R600_RING_TYPE_DMA_INDEX ) fence =radeon_copy_dma (rdev, vram_addr, gtt_addr, size /RADEON_GPU_PAGE_SIZE , - vram_obj->tbo.resv); + vram_obj->tbo.base.resv);else fence =radeon_copy_blit (rdev, vram_addr, gtt_addr, size /RADEON_GPU_PAGE_SIZE , - vram_obj->tbo.resv); + vram_obj->tbo.base.resv);if (IS_ERR (fence)) {DRM_ERROR ("Failed VRAM->GTT copy %d\n" , i); r =PTR_ERR (fence);
drivers/gpu/drm/radeon/radeon_ttm.c +1 -1
@@ -244,7 +244,7 @@ static int radeon_move_blit(struct ttm_buffer_object *bo,BUILD_BUG_ON ((PAGE_SIZE %RADEON_GPU_PAGE_SIZE ) !=0 ); num_pages = new_mem->num_pages * (PAGE_SIZE /RADEON_GPU_PAGE_SIZE ); - fence =radeon_copy (rdev, old_start, new_start, num_pages, bo->resv); + fence =radeon_copy (rdev, old_start, new_start, num_pages, bo->base.resv);if (IS_ERR (fence))return PTR_ERR (fence);
drivers/gpu/drm/radeon/radeon_uvd.c +1 -1
@@ -477,7 +477,7 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo,return -EINVAL ; } - f =reservation_object_get_excl (bo->tbo.resv); + f =reservation_object_get_excl (bo->tbo.base.resv);if (f) { r =radeon_fence_wait ((struct radeon_fence *)f, false);if (r) {
drivers/gpu/drm/radeon/radeon_vm.c +3 -3
@@ -702,7 +702,7 @@ int radeon_vm_update_page_directory(struct radeon_device *rdev,if (ib.length_dw !=0 ) {radeon_asic_vm_pad_ib (rdev, &ib); -radeon_sync_resv (rdev, &ib.sync, pd->tbo.resv, true); +radeon_sync_resv (rdev, &ib.sync, pd->tbo.base.resv, true);WARN_ON (ib.length_dw > ndw); r =radeon_ib_schedule (rdev, &ib,NULL , false);if (r) {
@@ -830,8 +830,8 @@ static int radeon_vm_update_ptes(struct radeon_device *rdev,uint64_t pte;int r; -radeon_sync_resv (rdev, &ib->sync, pt->tbo.resv, true); - r =reservation_object_reserve_shared (pt->tbo.resv,1 ); +radeon_sync_resv (rdev, &ib->sync, pt->tbo.base.resv, true); + r =reservation_object_reserve_shared (pt->tbo.base.resv,1 );if (r)return r;
Signature · 6 lines
2.18.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Gerd Hoffmann
maintainerPATCH v2 13/18 drm/vmwgfx: switch driver from bo->resv to bo->base.resv
In reply to Gerd Hoffmann--- drivers/gpu/drm/vmwgfx/vmwgfx_blit.c | 4 ++-- drivers/gpu/drm/vmwgfx/vmwgfx_bo.c | 8 ++++---- drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c | 4 ++-- drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_blit.c +2 -2
@@ -459,9 +459,9 @@ int vmw_bo_cpu_blit(struct ttm_buffer_object *dst,/* Buffer objects need to be either pinned or reserved: */ if (!(dst->mem.placement &TTM_PL_FLAG_NO_EVICT )) -lockdep_assert_held (&dst->resv->lock.base); +lockdep_assert_held (&dst->base.resv->lock.base);if (!(src->mem.placement &TTM_PL_FLAG_NO_EVICT )) -lockdep_assert_held (&src->resv->lock.base); +lockdep_assert_held (&src->base.resv->lock.base);if (dst->ttm->state == tt_unpopulated) { ret = dst->ttm->bdev->driver->ttm_tt_populate (dst->ttm, &ctx);
drivers/gpu/drm/vmwgfx/vmwgfx_bo.c +4 -4
@@ -342,7 +342,7 @@ void vmw_bo_pin_reserved(struct vmw_buffer_object *vbo, bool pin)uint32_t old_mem_type = bo->mem.mem_type;int ret; -lockdep_assert_held (&bo->resv->lock.base); +lockdep_assert_held (&bo->base.resv->lock.base);if (pin) {if (vbo->pin_count++ >0 )
@@ -690,7 +690,7 @@ static int vmw_user_bo_synccpu_grab(struct vmw_user_buffer_object *user_bo,long lret; lret =reservation_object_wait_timeout_rcu - (bo->resv, true, true, + (bo->base.resv, true, true, nonblock ?0 :MAX_SCHEDULE_TIMEOUT );if (!lret)return -EBUSY ;
@@ -1007,10 +1007,10 @@ void vmw_bo_fence_single(struct ttm_buffer_object *bo,if (fence ==NULL ) {vmw_execbuf_fence_commands (NULL , dev_priv, &fence,NULL ); -reservation_object_add_excl_fence (bo->resv, &fence->base); +reservation_object_add_excl_fence (bo->base.resv, &fence->base);dma_fence_put (&fence->base); }else -reservation_object_add_excl_fence (bo->resv, &fence->base); +reservation_object_add_excl_fence (bo->base.resv, &fence->base); }
drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c +2 -2
@@ -169,7 +169,7 @@ static int vmw_cotable_unscrub(struct vmw_resource *res) } *cmd;WARN_ON_ONCE (bo->mem.mem_type !=VMW_PL_MOB ); -lockdep_assert_held (&bo->resv->lock.base); +lockdep_assert_held (&bo->base.resv->lock.base); cmd =VMW_FIFO_RESERVE (dev_priv,sizeof (*cmd));if (!cmd)
@@ -311,7 +311,7 @@ static int vmw_cotable_unbind(struct vmw_resource *res,return 0 ;WARN_ON_ONCE (bo->mem.mem_type !=VMW_PL_MOB ); -lockdep_assert_held (&bo->resv->lock.base); +lockdep_assert_held (&bo->base.resv->lock.base);mutex_lock (&dev_priv->binding_mutex);if (!vcotbl->scrubbed)
drivers/gpu/drm/vmwgfx/vmwgfx_resource.c +3 -3
@@ -402,14 +402,14 @@ void vmw_resource_unreserve(struct vmw_resource *res,if (switch_backup && new_backup != res->backup) {if (res->backup) { -lockdep_assert_held (&res->backup->base.resv->lock.base); +lockdep_assert_held (&res->backup->base.base.resv->lock.base);list_del_init (&res->mob_head);vmw_bo_unreference (&res->backup); }if (new_backup) { res->backup =vmw_bo_reference (new_backup); -lockdep_assert_held (&new_backup->base.resv->lock.base); +lockdep_assert_held (&new_backup->base.base.resv->lock.base);list_add_tail (&res->mob_head, &new_backup->res_list); }else { res->backup =NULL ;
@@ -691,7 +691,7 @@ void vmw_resource_unbind_list(struct vmw_buffer_object *vbo) .num_shared = 0 }; -lockdep_assert_held (&vbo->base.resv->lock.base); +lockdep_assert_held (&vbo->base.base.resv->lock.base);list_for_each_entry_safe (res, next, &vbo->res_list, mob_head) {if (!res->func->unbind)continue ;
Signature · 6 lines
2.18.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Gerd Hoffmann
maintainerPATCH v2 14/18 drm/amdgpu: switch driver from bo->resv to bo->base.resv
In reply to Gerd Hoffmann--- .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 6 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 6 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 4 +-- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 6 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 20 ++++++------- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 6 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 4 +-- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 30 +++++++++---------- drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c | 2 +- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +- 13 files changed, 46 insertions(+), 46 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +3 -3
@@ -218,7 +218,7 @@ void amdgpu_amdkfd_unreserve_memory_limit(struct amdgpu_bo *bo)static int amdgpu_amdkfd_remove_eviction_fence (struct amdgpu_bo *bo,struct amdgpu_amdkfd_fence *ef) { -struct reservation_object *resv = bo->tbo.resv; +struct reservation_object *resv = bo->tbo.base.resv;struct reservation_object_list *old, *new;unsigned int i, j, k;
@@ -812,7 +812,7 @@ static int process_sync_pds_resv(struct amdkfd_process_info *process_info,struct amdgpu_bo *pd = peer_vm->root.base.bo; ret =amdgpu_sync_resv (NULL , - sync, pd->tbo.resv, + sync, pd->tbo.base.resv,AMDGPU_FENCE_OWNER_UNDEFINED , false);if (ret)return ret;
@@ -887,7 +887,7 @@ static int init_kfd_vm(struct amdgpu_vm *vm, void **process_info, AMDGPU_FENCE_OWNER_KFD, false);if (ret) goto wait_pd_fail; - ret =reservation_object_reserve_shared (vm->root.base.bo->tbo.resv,1 ); + ret =reservation_object_reserve_shared (vm->root.base.bo->tbo.base.resv,1 );if (ret) goto reserve_shared_fail; amdgpu_bo_fence(vm->root.base.bo,
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +3 -3
@@ -402,7 +402,7 @@ static int amdgpu_cs_bo_validate(struct amdgpu_cs_parser *p,struct ttm_operation_ctx ctx = { .interruptible = true, .no_wait_gpu = false, - .resv = bo->tbo.resv, + .resv = bo->tbo.base.resv, .flags =0 };uint32_t domain;
@@ -734,7 +734,7 @@ static int amdgpu_cs_sync_rings(struct amdgpu_cs_parser *p)list_for_each_entry (e, &p->validated, tv.head) {struct amdgpu_bo *bo =ttm_to_amdgpu_bo (e->tv.bo); -struct reservation_object *resv = bo->tbo.resv; +struct reservation_object *resv = bo->tbo.base.resv; r =amdgpu_sync_resv (p->adev, &p->job->sync, resv, p->filp,amdgpu_bo_explicit_sync (bo));
@@ -1732,7 +1732,7 @@ int amdgpu_cs_find_mapping(struct amdgpu_cs_parser *parser, *map = mapping;/* Double check that the BO is reserved by this CS */ -if (READ_ONCE ((*bo)->tbo.resv->lock.ctx) != &parser->ticket) +if (READ_ONCE ((*bo)->tbo.base.resv->lock.ctx) != &parser->ticket)return -EINVAL ;if (!((*bo)->flags &AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS )) {
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +1 -1
@@ -204,7 +204,7 @@ int amdgpu_display_crtc_page_flip_target(struct drm_crtc *crtc, goto unpin; } - r =reservation_object_get_fences_rcu (new_abo->tbo.resv, &work->excl, + r =reservation_object_get_fences_rcu (new_abo->tbo.base.resv, &work->excl, &work->shared_count, &work->shared);if (unlikely (r !=0 )) {
drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +2 -2
@@ -216,7 +216,7 @@ static int amdgpu_dma_buf_map_attach(struct dma_buf *dma_buf,* fences on the reservation object into a single exclusive * fence. */ - r =__reservation_object_make_exclusive (bo->tbo.resv); + r =__reservation_object_make_exclusive (bo->tbo.base.resv);if (r) goto error_unreserve; }
@@ -278,7 +278,7 @@ struct reservation_object *amdgpu_gem_prime_res_obj(struct drm_gem_object *obj) {struct amdgpu_bo *bo =gem_to_amdgpu_bo (obj); -return bo->tbo.resv; +return bo->tbo.base.resv; }/**
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +3 -3
@@ -134,7 +134,7 @@ int amdgpu_gem_object_open(struct drm_gem_object *obj,return -EPERM ;if (abo->flags &AMDGPU_GEM_CREATE_VM_ALWAYS_VALID && - abo->tbo.resv != vm->root.base.bo->tbo.resv) + abo->tbo.base.resv != vm->root.base.bo->tbo.base.resv)return -EPERM ; r =amdgpu_bo_reserve (abo, false);
@@ -252,7 +252,7 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data,if (r)return r; - resv = vm->root.base.bo->tbo.resv; + resv = vm->root.base.bo->tbo.base.resv; } r = amdgpu_gem_object_create(adev, size, args->in.alignment,
@@ -434,7 +434,7 @@ int amdgpu_gem_wait_idle_ioctl(struct drm_device *dev, void *data,return -ENOENT ; } robj =gem_to_amdgpu_bo (gobj); - ret =reservation_object_wait_timeout_rcu (robj->tbo.resv, true, true, + ret =reservation_object_wait_timeout_rcu (robj->tbo.base.resv, true, true, timeout);/* ret == 0 means not signaled,
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +1 -1
@@ -1084,7 +1084,7 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev,amdgpu_vm_fini (adev, &fpriv->vm);if (pasid) -amdgpu_pasid_free_delayed (pd->tbo.resv, pasid); +amdgpu_pasid_free_delayed (pd->tbo.base.resv, pasid);amdgpu_bo_unref (&pd);idr_for_each_entry (&fpriv->bo_list_handles, list, handle)
drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c +1 -1
@@ -216,7 +216,7 @@ static void amdgpu_mn_invalidate_node(struct amdgpu_mn_node *node,if (!amdgpu_ttm_tt_affect_userptr (bo->tbo.ttm, start, end))continue ; - r =reservation_object_wait_timeout_rcu (bo->tbo.resv, + r =reservation_object_wait_timeout_rcu (bo->tbo.base.resv, true, false,MAX_SCHEDULE_TIMEOUT );if (r <=0 )DRM_ERROR ("(%ld) failed to wait for user bo\n" , r);
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +10 -10
@@ -517,7 +517,7 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev, bo->tbo.mem.placement & TTM_PL_FLAG_VRAM) {struct dma_fence *fence; - r =amdgpu_fill_buffer (bo,0 , bo->tbo.resv, &fence); + r =amdgpu_fill_buffer (bo,0 , bo->tbo.base.resv, &fence);if (unlikely (r)) goto fail_unreserve;
@@ -540,7 +540,7 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev, fail_unreserve:if (!bp->resv) -ww_mutex_unlock (&bo->tbo.resv->lock); +ww_mutex_unlock (&bo->tbo.base.resv->lock);amdgpu_bo_unref (&bo);return r; }
@@ -561,7 +561,7 @@ static int amdgpu_bo_create_shadow(struct amdgpu_device *adev, bp.flags =AMDGPU_GEM_CREATE_CPU_GTT_USWC |AMDGPU_GEM_CREATE_SHADOW ; bp.type = ttm_bo_type_kernel; - bp.resv = bo->tbo.resv; + bp.resv = bo->tbo.base.resv; r =amdgpu_bo_do_create (adev, &bp, &bo->shadow);if (!r) {
@@ -602,13 +602,13 @@ int amdgpu_bo_create(struct amdgpu_device *adev,if ((flags &AMDGPU_GEM_CREATE_SHADOW ) && !(adev->flags &AMD_IS_APU )) {if (!bp->resv) -WARN_ON (reservation_object_lock ((*bo_ptr)->tbo.resv, +WARN_ON (reservation_object_lock ((*bo_ptr)->tbo.base.resv,NULL )); r =amdgpu_bo_create_shadow (adev, bp->size, *bo_ptr);if (!bp->resv) -reservation_object_unlock ((*bo_ptr)->tbo.resv); +reservation_object_unlock ((*bo_ptr)->tbo.base.resv);if (r)amdgpu_bo_unref (bo_ptr);
@@ -705,7 +705,7 @@ int amdgpu_bo_kmap(struct amdgpu_bo *bo, void **ptr)return 0 ; } - r =reservation_object_wait_timeout_rcu (bo->tbo.resv, false, false, + r =reservation_object_wait_timeout_rcu (bo->tbo.base.resv, false, false,MAX_SCHEDULE_TIMEOUT );if (r <0 )return r;
@@ -1082,7 +1082,7 @@ int amdgpu_bo_set_tiling_flags(struct amdgpu_bo *bo, u64 tiling_flags)*/ void amdgpu_bo_get_tiling_flags (struct amdgpu_bo *bo,u64 *tiling_flags) { -lockdep_assert_held (&bo->tbo.resv->lock.base); +lockdep_assert_held (&bo->tbo.base.resv->lock.base);if (tiling_flags) *tiling_flags = bo->tiling_flags;
@@ -1278,7 +1278,7 @@ int amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo)void amdgpu_bo_fence (struct amdgpu_bo *bo,struct dma_fence *fence,bool shared) { -struct reservation_object *resv = bo->tbo.resv; +struct reservation_object *resv = bo->tbo.base.resv;if (shared)reservation_object_add_shared_fence (resv, fence);
@@ -1303,7 +1303,7 @@ int amdgpu_bo_sync_wait(struct amdgpu_bo *bo, void *owner, bool intr)int r;amdgpu_sync_create (&sync); -amdgpu_sync_resv (adev, &sync, bo->tbo.resv, owner, false); +amdgpu_sync_resv (adev, &sync, bo->tbo.base.resv, owner, false); r =amdgpu_sync_wait (&sync, intr);amdgpu_sync_free (&sync);
@@ -1323,7 +1323,7 @@ int amdgpu_bo_sync_wait(struct amdgpu_bo *bo, void *owner, bool intr)u64 amdgpu_bo_gpu_offset (struct amdgpu_bo *bo) {WARN_ON_ONCE (bo->tbo.mem.mem_type ==TTM_PL_SYSTEM ); -WARN_ON_ONCE (!ww_mutex_is_locked (&bo->tbo.resv->lock) && +WARN_ON_ONCE (!ww_mutex_is_locked (&bo->tbo.base.resv->lock) && !bo->pin_count && bo->tbo.type != ttm_bo_type_kernel);WARN_ON_ONCE (bo->tbo.mem.start ==AMDGPU_BO_INVALID_OFFSET ); WARN_ON_ONCE(bo->tbo.mem.mem_type == TTM_PL_VRAM &&
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +3 -3
@@ -438,7 +438,7 @@ static int amdgpu_move_blit(struct ttm_buffer_object *bo, r =amdgpu_ttm_copy_mem_to_mem (adev, &src, &dst, new_mem->num_pages <<PAGE_SHIFT , - bo->resv, &fence); + bo->base.resv, &fence);if (r) goto error;
@@ -1450,14 +1450,14 @@ static bool amdgpu_ttm_bo_eviction_valuable(struct ttm_buffer_object *bo,* cleanly handle page faults. */ if (bo->type == ttm_bo_type_kernel && - !reservation_object_test_signaled_rcu (bo->resv, true)) + !reservation_object_test_signaled_rcu (bo->base.resv, true))return false;/* If bo is a KFD BO, check if the bo belongs to the current process. * If true, then return false as any KFD process needs all its BOs to * be resident to run successfully */ - flist =reservation_object_get_list (bo->resv); + flist =reservation_object_get_list (bo->base.resv);if (flist) {for (i =0 ; i < flist->shared_count; ++i) { f = rcu_dereference_protected(flist->shared[i],
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +2 -2
@@ -1073,7 +1073,7 @@ static int amdgpu_uvd_send_msg(struct amdgpu_ring *ring, struct amdgpu_bo *bo, ib->length_dw =16 ;if (direct) { - r =reservation_object_wait_timeout_rcu (bo->tbo.resv, + r =reservation_object_wait_timeout_rcu (bo->tbo.base.resv, true, false,msecs_to_jiffies (10 ));if (r ==0 )
@@ -1085,7 +1085,7 @@ static int amdgpu_uvd_send_msg(struct amdgpu_ring *ring, struct amdgpu_bo *bo,if (r) goto err_free; }else { - r =amdgpu_sync_resv (adev, &job->sync, bo->tbo.resv, + r =amdgpu_sync_resv (adev, &job->sync, bo->tbo.base.resv,AMDGPU_FENCE_OWNER_UNDEFINED , false);if (r) goto err_free;
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +15 -15
@@ -302,7 +302,7 @@ static void amdgpu_vm_bo_base_init(struct amdgpu_vm_bo_base *base, base->next = bo->vm_bo; bo->vm_bo = base; -if (bo->tbo.resv != vm->root.base.bo->tbo.resv) +if (bo->tbo.base.resv != vm->root.base.bo->tbo.base.resv)return ; vm->bulk_moveable = false;
@@ -583,7 +583,7 @@ void amdgpu_vm_del_from_lru_notify(struct ttm_buffer_object *bo)for (bo_base = abo->vm_bo; bo_base; bo_base = bo_base->next) {struct amdgpu_vm *vm = bo_base->vm; -if (abo->tbo.resv == vm->root.base.bo->tbo.resv) +if (abo->tbo.base.resv == vm->root.base.bo->tbo.base.resv) vm->bulk_moveable = false; }
@@ -834,7 +834,7 @@ static void amdgpu_vm_bo_param(struct amdgpu_device *adev, struct amdgpu_vm *vm, bp->flags |=AMDGPU_GEM_CREATE_SHADOW ; bp->type = ttm_bo_type_kernel;if (vm->root.base.bo) - bp->resv = vm->root.base.bo->tbo.resv; + bp->resv = vm->root.base.bo->tbo.base.resv; }/**
@@ -1692,7 +1692,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, ttm = container_of(bo->tbo.ttm, struct ttm_dma_tt, ttm); pages_addr = ttm->dma_address; } - exclusive =reservation_object_get_excl (bo->tbo.resv); + exclusive =reservation_object_get_excl (bo->tbo.base.resv); }if (bo) {
@@ -1702,7 +1702,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, flags =0x0 ; } -if (clear || (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv)) +if (clear || (bo && bo->tbo.base.resv == vm->root.base.bo->tbo.base.resv)) last_update = &vm->last_update;else last_update = &bo_va->last_pt_update;
@@ -1733,7 +1733,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,* the evicted list so that it gets validated again on the * next command submission. */ -if (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv) { +if (bo && bo->tbo.base.resv == vm->root.base.bo->tbo.base.resv) {uint32_t mem_type = bo->tbo.mem.mem_type;if (!(bo->preferred_domains &amdgpu_mem_type_to_domain (mem_type)))
@@ -1869,7 +1869,7 @@ static void amdgpu_vm_free_mapping(struct amdgpu_device *adev,*/ static void amdgpu_vm_prt_fini (struct amdgpu_device *adev,struct amdgpu_vm *vm) { -struct reservation_object *resv = vm->root.base.bo->tbo.resv; +struct reservation_object *resv = vm->root.base.bo->tbo.base.resv;struct dma_fence *excl, **shared;unsigned i, shared_count;int r;
@@ -1983,7 +1983,7 @@ int amdgpu_vm_handle_moved(struct amdgpu_device *adev,while (!list_empty (&vm->invalidated)) { bo_va = list_first_entry(&vm->invalidated, struct amdgpu_bo_va, base.vm_status); - resv = bo_va->base.bo->tbo.resv; + resv = bo_va->base.bo->tbo.base.resv;spin_unlock (&vm->invalidated_lock);/* Try to reserve the BO to avoid clearing its ptes */
@@ -2074,7 +2074,7 @@ static void amdgpu_vm_bo_insert_map(struct amdgpu_device *adev,if (mapping->flags &AMDGPU_PTE_PRT )amdgpu_vm_prt_get (adev); -if (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv && +if (bo && bo->tbo.base.resv == vm->root.base.bo->tbo.base.resv && !bo_va->base.moved) {list_move (&bo_va->base.vm_status, &vm->moved); }
@@ -2406,7 +2406,7 @@ void amdgpu_vm_bo_trace_cs(struct amdgpu_vm *vm, struct ww_acquire_ctx *ticket)struct amdgpu_bo *bo; bo = mapping->bo_va->base.bo; -if (READ_ONCE (bo->tbo.resv->lock.ctx) != ticket) +if (READ_ONCE (bo->tbo.base.resv->lock.ctx) != ticket)continue ; }
@@ -2433,7 +2433,7 @@ void amdgpu_vm_bo_rmv(struct amdgpu_device *adev,struct amdgpu_vm_bo_base **base;if (bo) { -if (bo->tbo.resv == vm->root.base.bo->tbo.resv) +if (bo->tbo.base.resv == vm->root.base.bo->tbo.base.resv) vm->bulk_moveable = false; for (base = &bo_va->base.bo->vm_bo; *base;
@@ -2497,7 +2497,7 @@ void amdgpu_vm_bo_invalidate(struct amdgpu_device *adev,for (bo_base = bo->vm_bo; bo_base; bo_base = bo_base->next) {struct amdgpu_vm *vm = bo_base->vm; -if (evicted && bo->tbo.resv == vm->root.base.bo->tbo.resv) { +if (evicted && bo->tbo.base.resv == vm->root.base.bo->tbo.base.resv) {amdgpu_vm_bo_evicted (bo_base);continue ; }
@@ -2508,7 +2508,7 @@ void amdgpu_vm_bo_invalidate(struct amdgpu_device *adev,if (bo->tbo.type == ttm_bo_type_kernel)amdgpu_vm_bo_relocated (bo_base); -else if (bo->tbo.resv == vm->root.base.bo->tbo.resv) +else if (bo->tbo.base.resv == vm->root.base.bo->tbo.base.resv)amdgpu_vm_bo_moved (bo_base);else amdgpu_vm_bo_invalidated (bo_base);
@@ -2638,7 +2638,7 @@ void amdgpu_vm_adjust_size(struct amdgpu_device *adev, uint32_t min_vm_size,*/ long amdgpu_vm_wait_idle (struct amdgpu_vm *vm,long timeout) { -return reservation_object_wait_timeout_rcu (vm->root.base.bo->tbo.resv, +return reservation_object_wait_timeout_rcu (vm->root.base.bo->tbo.base.resv, true, true, timeout); }
@@ -2713,7 +2713,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,if (r) goto error_free_root; - r =reservation_object_reserve_shared (root->tbo.resv,1 ); + r =reservation_object_reserve_shared (root->tbo.base.resv,1 );if (r) goto error_unreserve;
drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c +1 -1
@@ -72,7 +72,7 @@ static int amdgpu_vm_sdma_prepare(struct amdgpu_vm_update_params *p,if (r)return r; - r =amdgpu_sync_resv (p->adev, &p->job->sync, root->tbo.resv, + r =amdgpu_sync_resv (p->adev, &p->job->sync, root->tbo.base.resv, owner, false);if (r)return r;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -1
@@ -5510,7 +5510,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,* deadlock during GPU reset when this fence will not signal * but we hold reservation lock for the BO. */ - r =reservation_object_wait_timeout_rcu (abo->tbo.resv, true, + r =reservation_object_wait_timeout_rcu (abo->tbo.base.resv, true, false,msecs_to_jiffies (5000 ));if (unlikely (r <=0 ))
Signature · 1 line
2.18.1
Gerd Hoffmann
maintainerPATCH v2 15/18 drm/nouveau: switch driver from bo->resv to bo->base.resv
In reply to Gerd Hoffmann--- drivers/gpu/drm/nouveau/dispnv50/wndw.c | 2 +- drivers/gpu/drm/nouveau/nouveau_bo.c | 4 ++-- drivers/gpu/drm/nouveau/nouveau_fence.c | 2 +- drivers/gpu/drm/nouveau/nouveau_gem.c | 2 +- drivers/gpu/drm/nouveau/nouveau_prime.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/nouveau/dispnv50/wndw.c +1 -1
@@ -457,7 +457,7 @@ nv50_wndw_prepare_fb(struct drm_plane *plane, struct drm_plane_state *state) asyw->image.handle[0 ] = ctxdma->object.handle; } - asyw->state.fence =reservation_object_get_excl_rcu (fb->nvbo->bo.resv); + asyw->state.fence =reservation_object_get_excl_rcu (fb->nvbo->bo.base.resv); asyw->image.offset[0 ] = fb->nvbo->bo.offset;if (wndw->func->prepare) {
drivers/gpu/drm/nouveau/nouveau_bo.c +2 -2
@@ -1323,7 +1323,7 @@ nouveau_bo_vm_cleanup(struct ttm_buffer_object *bo, {struct nouveau_drm *drm =nouveau_bdev (bo->bdev);struct drm_device *dev = drm->dev; -struct dma_fence *fence =reservation_object_get_excl (bo->resv); +struct dma_fence *fence =reservation_object_get_excl (bo->base.resv);nv10_bo_put_tile_region (dev, *old_tile, fence); *old_tile = new_tile;
@@ -1654,7 +1654,7 @@ nouveau_ttm_tt_unpopulate(struct ttm_tt *ttm)void nouveau_bo_fence (struct nouveau_bo *nvbo,struct nouveau_fence *fence,bool exclusive) { -struct reservation_object *resv = nvbo->bo.resv; +struct reservation_object *resv = nvbo->bo.base.resv;if (exclusive)reservation_object_add_excl_fence (resv, &fence->base);
drivers/gpu/drm/nouveau/nouveau_fence.c +1 -1
@@ -335,7 +335,7 @@ nouveau_fence_sync(struct nouveau_bo *nvbo, struct nouveau_channel *chan, bool e {struct nouveau_fence_chan *fctx = chan->fence;struct dma_fence *fence; -struct reservation_object *resv = nvbo->bo.resv; +struct reservation_object *resv = nvbo->bo.base.resv;struct reservation_object_list *fobj;struct nouveau_fence *f;int ret =0 , i;
drivers/gpu/drm/nouveau/nouveau_gem.c +1 -1
@@ -887,7 +887,7 @@ nouveau_gem_ioctl_cpu_prep(struct drm_device *dev, void *data,return -ENOENT ; nvbo =nouveau_gem_object (gem); - lret =reservation_object_wait_timeout_rcu (nvbo->bo.resv, write, true, + lret =reservation_object_wait_timeout_rcu (nvbo->bo.base.resv, write, true, no_wait ?0 :30 *HZ );if (!lret) ret = -EBUSY ;
drivers/gpu/drm/nouveau/nouveau_prime.c +1 -1
@@ -112,5 +112,5 @@ struct reservation_object *nouveau_gem_prime_res_obj(struct drm_gem_object *obj) {struct nouveau_bo *nvbo =nouveau_gem_object (obj); -return nvbo->bo.resv; +return nvbo->bo.base.resv; }
Signature · 1 line
2.18.1
Gerd Hoffmann
maintainerPATCH v2 16/18 drm/qxl: switch driver from bo->resv to bo->base.resv
In reply to Gerd Hoffmann--- drivers/gpu/drm/qxl/qxl_debugfs.c | 2 +- drivers/gpu/drm/qxl/qxl_release.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/qxl/qxl_debugfs.c +1 -1
@@ -61,7 +61,7 @@ qxl_debugfs_buffers_info(struct seq_file *m, void *data)int rel;rcu_read_lock (); - fobj =rcu_dereference (bo->tbo.resv->fence); + fobj =rcu_dereference (bo->tbo.base.resv->fence); rel = fobj ? fobj->shared_count :0 ;rcu_read_unlock ();
drivers/gpu/drm/qxl/qxl_release.c +3 -3
@@ -234,7 +234,7 @@ static int qxl_release_validate_bo(struct qxl_bo *bo)return ret; } - ret =reservation_object_reserve_shared (bo->tbo.resv,1 ); + ret =reservation_object_reserve_shared (bo->tbo.base.resv,1 );if (ret)return ret;
@@ -454,9 +454,9 @@ void qxl_release_fence_buffer_objects(struct qxl_release *release)list_for_each_entry (entry, &release->bos, head) { bo = entry->bo; -reservation_object_add_shared_fence (bo->resv, &release->base); +reservation_object_add_shared_fence (bo->base.resv, &release->base);ttm_bo_add_to_lru (bo); -reservation_object_unlock (bo->resv); +reservation_object_unlock (bo->base.resv); }spin_unlock (&glob->lru_lock);ww_acquire_fini (&release->ticket);
Signature · 1 line
2.18.1
Gerd Hoffmann
maintainerPATCH v2 17/18 drm/virtio: switch driver from bo->resv to bo->base.resv
In reply to Gerd Hoffmann--- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 4 ++-- drivers/gpu/drm/virtio/virtgpu_plane.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/virtio/virtgpu_ioctl.c +2 -2
@@ -394,7 +394,7 @@ static int virtio_gpu_transfer_from_host_ioctl(struct drm_device *dev, (vgdev, qobj->hw_res_handle, vfpriv->ctx_id, offset, args->level, &box, fence); -reservation_object_add_excl_fence (qobj->tbo.resv, +reservation_object_add_excl_fence (qobj->tbo.base.resv, &fence->f);dma_fence_put (&fence->f);
@@ -448,7 +448,7 @@ static int virtio_gpu_transfer_to_host_ioctl(struct drm_device *dev, void *data, (vgdev, qobj, vfpriv ? vfpriv->ctx_id :0 , offset, args->level, &box, fence); -reservation_object_add_excl_fence (qobj->tbo.resv, +reservation_object_add_excl_fence (qobj->tbo.base.resv, &fence->f);dma_fence_put (&fence->f); }
drivers/gpu/drm/virtio/virtgpu_plane.c +1 -1
@@ -210,7 +210,7 @@ static void virtio_gpu_cursor_plane_update(struct drm_plane *plane, 0, 0, vgfb->fence); ret =virtio_gpu_object_reserve (bo, false);if (!ret) { -reservation_object_add_excl_fence (bo->tbo.resv, +reservation_object_add_excl_fence (bo->tbo.base.resv, &vgfb->fence->f);dma_fence_put (&vgfb->fence->f); vgfb->fence =NULL ;
Signature · 1 line
2.18.1
Gerd Hoffmann
maintainerPATCH v2 18/18 drm/ttm: drop ttm_buffer_object->resv
In reply to Gerd HoffmannAll users moved to ttm_buffer_object->base.resv
--- include/drm/ttm/ttm_bo_api.h | 1 - drivers/gpu/drm/ttm/ttm_bo.c | 2 -- 2 files changed, 3 deletions(-)
include/drm/ttm/ttm_bo_api.h +0 -1
@@ -231,7 +231,6 @@ struct ttm_buffer_object {struct sg_table *sg; -struct reservation_object *resv;struct mutex wu_mutex; };
drivers/gpu/drm/ttm/ttm_bo.c +0 -2
@@ -1330,11 +1330,9 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev, bo->acc_size = acc_size; bo->sg = sg;if (resv) { - bo->resv = resv; bo->base.resv = resv;reservation_object_assert_held (bo->base.resv); }else { - bo->resv = &bo->base._resv; bo->base.resv = &bo->base._resv; }if (!ttm_bo_uses_embedded_gem_object (bo)) {
Signature · 1 line
2.18.1
One little comment on patch #8:
Review
Quoted 1 line
(quoted diff) +1
-0+ /* base.vma_node */
Is that really useful? I would just drop it.
Apart from that Patches #1, #2, #4, #5, #7 - #12, #14, #15, #18 are Reviewed-by: Christian König <[email protected]>.
Patches #3, #6, #13, #16, #17 are Acked-by: Christian König <[email protected]>.
You should try to get an rb for the respective maintainer for patches #3 and #6.
When that's done I think we can merge it. Any preference for the tree where this goes upstream? If not I suggest to use drm-misc-next.
Thanks for the nice cleanup,
Christian.
Am 21.06.19 um 13:57 schrieb Gerd Hoffmann:
Quoted 85 lines
v2:
- build fixes.
- also dropttm_buffer_object->resvGerd Hoffmann (18):
drm/ttm: add gem base object
drm/vram: use embedded gem object
drm/qxl: use embedded gem object
drm/radeon: use embedded gem object
drm/amdgpu: use embedded gem object drm/nouveau: use embedded gem object
drm/ttm: use gem reservation object
drm/ttm: use gemvma_node
drm/vram: dropdrm_gem_vram_driver_gem_prime_mmapdrm/ttm: set both resv and base.resv pointers drm/ttm: switch ttm core frombo->resvtobo->base.resvdrm/radeon: switch driver frombo->resvtobo->base.resvdrm/vmwgfx: switch driver frombo->resvtobo->base.resvdrm/amdgpu: switch driver frombo->resvtobo->base.resvdrm/nouveau: switch driver frombo->resvtobo->base.resvdrm/qxl: switch driver frombo->resvtobo->base.resvdrm/virtio: switch driver frombo->resvtobo->base.resvdrm/ttm: dropttm_buffer_object->resvdrivers/gpu/drm/amd/amdgpu/amdgpu_gem.h | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 3 +- drivers/gpu/drm/nouveau/nouveau_bo.h | 5 - drivers/gpu/drm/nouveau/nouveau_gem.h | 2 +- drivers/gpu/drm/qxl/qxl_drv.h | 6 +- drivers/gpu/drm/qxl/qxl_object.h | 6 +- drivers/gpu/drm/radeon/radeon.h | 3 +- drivers/gpu/drm/radeon/radeon_object.h | 2 +- drivers/gpu/drm/virtio/virtgpu_drv.h | 2 +- include/drm/drm_gem_vram_helper.h | 7 +- include/drm/ttm/ttm_bo_api.h | 25 +++- include/drm/ttm/ttm_bo_driver.h | 12 +- .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 6 +- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 6 +- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 6 +- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 14 +- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 28 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 8 +- drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 30 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c | 2 +- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +- drivers/gpu/drm/ast/ast_main.c | 2 +- drivers/gpu/drm/drm_gem_vram_helper.c | 36 ++--- drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c | 2 +- drivers/gpu/drm/mgag200/mgag200_main.c | 2 +- drivers/gpu/drm/nouveau/dispnv50/wndw.c | 2 +- drivers/gpu/drm/nouveau/nouveau_abi16.c | 4 +- drivers/gpu/drm/nouveau/nouveau_bo.c | 8 +- drivers/gpu/drm/nouveau/nouveau_display.c | 10 +- drivers/gpu/drm/nouveau/nouveau_fence.c | 2 +- drivers/gpu/drm/nouveau/nouveau_gem.c | 19 +-- drivers/gpu/drm/nouveau/nouveau_prime.c | 6 +- drivers/gpu/drm/qxl/qxl_cmd.c | 4 +- drivers/gpu/drm/qxl/qxl_debugfs.c | 4 +- drivers/gpu/drm/qxl/qxl_display.c | 8 +- drivers/gpu/drm/qxl/qxl_gem.c | 2 +- drivers/gpu/drm/qxl/qxl_object.c | 20 +-- drivers/gpu/drm/qxl/qxl_release.c | 8 +- drivers/gpu/drm/qxl/qxl_ttm.c | 4 +- drivers/gpu/drm/radeon/radeon_benchmark.c | 4 +- drivers/gpu/drm/radeon/radeon_cs.c | 4 +- drivers/gpu/drm/radeon/radeon_display.c | 6 +- drivers/gpu/drm/radeon/radeon_gem.c | 8 +- drivers/gpu/drm/radeon/radeon_mn.c | 2 +- drivers/gpu/drm/radeon/radeon_object.c | 22 +-- drivers/gpu/drm/radeon/radeon_prime.c | 4 +- drivers/gpu/drm/radeon/radeon_test.c | 8 +- drivers/gpu/drm/radeon/radeon_ttm.c | 4 +- drivers/gpu/drm/radeon/radeon_uvd.c | 2 +- drivers/gpu/drm/radeon/radeon_vm.c | 6 +- drivers/gpu/drm/ttm/ttm_bo.c | 136 +++++++++--------- drivers/gpu/drm/ttm/ttm_bo_util.c | 18 +-- drivers/gpu/drm/ttm/ttm_bo_vm.c | 15 +- drivers/gpu/drm/ttm/ttm_execbuf_util.c | 20 +-- drivers/gpu/drm/ttm/ttm_tt.c | 2 +- drivers/gpu/drm/vboxvideo/vbox_main.c | 2 +- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 4 +-
Quoted 9 lines
drivers/gpu/drm/virtio/virtgpu_plane.c | 2 +- drivers/gpu/drm/virtio/virtgpu_prime.c | 3 - drivers/gpu/drm/vmwgfx/vmwgfx_blit.c | 4 +- drivers/gpu/drm/vmwgfx/vmwgfx_bo.c | 12 +- drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c | 4 +- drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 6 +- drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 4 +- 68 files changed, 311 insertions(+), 321 deletions(-)
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 7 lines · Christian König
One little comment on patch #8:
Review
Quoted 1 line
(quoted diff) +1
-0+ /* base.vma_node */Is that really useful? I would just drop it.
Apart from that Patches #1, #2, #4, #5, #7 - #12, #14, #15, #18 are
Reviewed-by Christian König <[email protected]>.
Quoted 8 lines
Patches #3, #6, #13, #16, #17 are Acked-by: Christian König <[email protected]>.
You should try to get an rb for the respective maintainer for patches #3 and #6.
When that's done I think we can merge it. Any preference for the tree where this goes upstream? If not I suggest to use drm-misc-next.
I think -misc would be good, since this will conflict with my pile of cleanups in dma-buf and especially simplifying where we find the resv_obj pointer. So need to figure out which one goes in first. -Daniel
Quoted 104 lines
Thanks for the nice cleanup,
Christian.Am 21.06.19 um 13:57 schrieb Gerd Hoffmann:
Quoted 85 lines
v2:
- build fixes.
- also dropttm_buffer_object->resvGerd Hoffmann (18):
drm/ttm: add gem base object
drm/vram: use embedded gem object
drm/qxl: use embedded gem object
drm/radeon: use embedded gem object
drm/amdgpu: use embedded gem object drm/nouveau: use embedded gem object
drm/ttm: use gem reservation object
drm/ttm: use gemvma_node
drm/vram: dropdrm_gem_vram_driver_gem_prime_mmapdrm/ttm: set both resv and base.resv pointers drm/ttm: switch ttm core frombo->resvtobo->base.resvdrm/radeon: switch driver frombo->resvtobo->base.resvdrm/vmwgfx: switch driver frombo->resvtobo->base.resvdrm/amdgpu: switch driver frombo->resvtobo->base.resvdrm/nouveau: switch driver frombo->resvtobo->base.resvdrm/qxl: switch driver frombo->resvtobo->base.resvdrm/virtio: switch driver frombo->resvtobo->base.resvdrm/ttm: dropttm_buffer_object->resvdrivers/gpu/drm/amd/amdgpu/amdgpu_gem.h | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 3 +- drivers/gpu/drm/nouveau/nouveau_bo.h | 5 - drivers/gpu/drm/nouveau/nouveau_gem.h | 2 +- drivers/gpu/drm/qxl/qxl_drv.h | 6 +- drivers/gpu/drm/qxl/qxl_object.h | 6 +- drivers/gpu/drm/radeon/radeon.h | 3 +- drivers/gpu/drm/radeon/radeon_object.h | 2 +- drivers/gpu/drm/virtio/virtgpu_drv.h | 2 +- include/drm/drm_gem_vram_helper.h | 7 +- include/drm/ttm/ttm_bo_api.h | 25 +++- include/drm/ttm/ttm_bo_driver.h | 12 +- .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 6 +- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 6 +- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 6 +- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 14 +- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 28 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 8 +- drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 30 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c | 2 +- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +- drivers/gpu/drm/ast/ast_main.c | 2 +- drivers/gpu/drm/drm_gem_vram_helper.c | 36 ++--- drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c | 2 +- drivers/gpu/drm/mgag200/mgag200_main.c | 2 +- drivers/gpu/drm/nouveau/dispnv50/wndw.c | 2 +- drivers/gpu/drm/nouveau/nouveau_abi16.c | 4 +- drivers/gpu/drm/nouveau/nouveau_bo.c | 8 +- drivers/gpu/drm/nouveau/nouveau_display.c | 10 +- drivers/gpu/drm/nouveau/nouveau_fence.c | 2 +- drivers/gpu/drm/nouveau/nouveau_gem.c | 19 +-- drivers/gpu/drm/nouveau/nouveau_prime.c | 6 +- drivers/gpu/drm/qxl/qxl_cmd.c | 4 +- drivers/gpu/drm/qxl/qxl_debugfs.c | 4 +- drivers/gpu/drm/qxl/qxl_display.c | 8 +- drivers/gpu/drm/qxl/qxl_gem.c | 2 +- drivers/gpu/drm/qxl/qxl_object.c | 20 +-- drivers/gpu/drm/qxl/qxl_release.c | 8 +- drivers/gpu/drm/qxl/qxl_ttm.c | 4 +- drivers/gpu/drm/radeon/radeon_benchmark.c | 4 +- drivers/gpu/drm/radeon/radeon_cs.c | 4 +- drivers/gpu/drm/radeon/radeon_display.c | 6 +- drivers/gpu/drm/radeon/radeon_gem.c | 8 +- drivers/gpu/drm/radeon/radeon_mn.c | 2 +- drivers/gpu/drm/radeon/radeon_object.c | 22 +-- drivers/gpu/drm/radeon/radeon_prime.c | 4 +- drivers/gpu/drm/radeon/radeon_test.c | 8 +- drivers/gpu/drm/radeon/radeon_ttm.c | 4 +- drivers/gpu/drm/radeon/radeon_uvd.c | 2 +- drivers/gpu/drm/radeon/radeon_vm.c | 6 +- drivers/gpu/drm/ttm/ttm_bo.c | 136 +++++++++--------- drivers/gpu/drm/ttm/ttm_bo_util.c | 18 +-- drivers/gpu/drm/ttm/ttm_bo_vm.c | 15 +- drivers/gpu/drm/ttm/ttm_execbuf_util.c | 20 +-- drivers/gpu/drm/ttm/ttm_tt.c | 2 +- drivers/gpu/drm/vboxvideo/vbox_main.c | 2 +- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 4 +-Quoted 9 lines
drivers/gpu/drm/virtio/virtgpu_plane.c | 2 +- drivers/gpu/drm/virtio/virtgpu_prime.c | 3 - drivers/gpu/drm/vmwgfx/vmwgfx_blit.c | 4 +- drivers/gpu/drm/vmwgfx/vmwgfx_bo.c | 12 +- drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c | 4 +- drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 6 +- drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 4 +- 68 files changed, 311 insertions(+), 321 deletions(-)_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
On 6/21/19 1:57 PM, Gerd Hoffmann wrote:
Aargh. Please don't do this. Multiple reasons:
1) I think It's bad to dump all buffer object functionality we can possibly think of in a single struct and force that on all (well at least most) users. It's better to isolate functionality in structs, have utility functions for those and let the drivers derive their buffer objects from whatever functionality they actually need.
2) vmwgfx is not using gem and we don't want to carry that extra payload in the buffer object.
3) TTM historically hasn't been using the various drm layers except for later when common helpers have been used, (like the vma manager and the cache utilities). It's desirable to keep that layer distinction. (which is really what I'm saying in 1.)
Now if more and more functionality that originated in TTM is moving into GEM we need to find a better way to do that without duplicating functionality. I suggest adding pointers in the TTM structs and defaulting those pointers to the member in the TTM struct. Optionally to to the member in the GEM struct. If we need to migrate those members out of the TTM struct, vmwgfx would have to provide them in its own buffer class.
NAK from the vmwgfx side.
Thanks,
Thoams
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 18 lines · Thomas Hellström (VMware)
On 6/21/19 1:57 PM, Gerd Hoffmann wrote:
Aargh. Please don't do this. Multiple reasons:
1) I think It's bad to dump all buffer object functionality we can possibly think of in a single struct and force that on all (well at least most) users. It's better to isolate functionality in structs, have utility functions for those and let the drivers derive their buffer objects from whatever functionality they actually need.
2) vmwgfx is not using gem and we don't want to carry that extra payload in the buffer object.
3) TTM historically hasn't been using the various drm layers except for later when common helpers have been used, (like the vma manager and the cache utilities). It's desirable to keep that layer distinction. (which is really what I'm saying in 1.)
Quoted 8 lines
Now if more and more functionality that originated in TTM is moving into GEM we need to find a better way to do that without duplicating functionality. I suggest adding pointers in the TTM structs and defaulting those pointers to the member in the TTM struct. Optionally to to the member in the GEM struct. If we need to migrate those members out of the TTM struct, vmwgfx would have to provide them in its own buffer class.
NAK from the vmwgfx side.
It's 59 DRIVER_GEM vs 1 which is not. I think the verdict is clear what the reasonable thing to do is here, and this will allow us to substantially improve code and concept sharing across drm drivers.
10 years ago it was indeed not clear whether everyone doing the same is a bright idea, but that's no more. If you want I guess you can keep a private copy of ttm in vmwgfx, but not sure that's really worth it long-term.
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi, Daniel,
Quoted 30 lines · Daniel Vetter
Quoted 17 lines · Thomas Hellström (VMware)
On 6/21/19 1:57 PM, Gerd Hoffmann wrote:
Aargh. Please don't do this. Multiple reasons:
1) I think It's bad to dump all buffer object functionality we can possibly think of in a single struct and force that on all (well at least most) users. It's better to isolate functionality in structs, have utility functions for those and let the drivers derive their buffer objects from whatever functionality they actually need.
2) vmwgfx is not using gem and we don't want to carry that extra payload in the buffer object.
3) TTM historically hasn't been using the various drm layers except for later when common helpers have been used, (like the vma manager and the cache utilities). It's desirable to keep that layer distinction. (which is really what I'm saying in 1.)Quoted 8 lines
Now if more and more functionality that originated in TTM is moving into GEM we need to find a better way to do that without duplicating functionality. I suggest adding pointers in the TTM structs and defaulting those pointers to the member in the TTM struct. Optionally to to the member in the GEM struct. If we need to migrate those members out of the TTM struct, vmwgfx would have to provide them in its own buffer class.
NAK from the vmwgfx side.
It's 59
DRIVER_GEMvs 1 which is not. I think the verdict is clear what the reasonable thing to do is here, and this will allow us to substantially improve code and concept sharing across drm drivers.
Quoted 5 lines
10 years ago it was indeed not clear whether everyone doing the same is a bright idea, but that's no more. If you want I guess you can keep a private copy of ttm in vmwgfx, but not sure that's really worth it long-term.
-Daniel
It's not a question about whether GEM or TTM, or even the number of drivers using one or the other. (GEM would actually be a good choice for the latter vmwgfx device versions). But this is going against all recent effort to make different parts of drm functionality recently self-contained.
Just stop and think for a while what would happen if someone would suggest doing the opposite: making a gem object a derived class of a TTM object, arguing that a lot of GEM drivers are using TTM as a backend. There would probably be a lot of people claiming "we don't want to unnecesarily carry that stuff". That's because that would also be a poor design.
What I'm suggesting is, build that improved code and concept sharing around
struct gem_ttm_object {
struct gem_object;
struct ttm_object;
};
And lets work toghether to eliminate what's duplicated.
The vmwgfx driver is doing what it does mostly because all buffer objects do not need to be user-space visible, and do not need to be mapped by user-space. And there are other types of objects that DO need to be user-space visible, and that do need to be shared by processes. Hence user-space visibility is something that should be abstracted and made available to those objects. Not lumped together with all other potential buffer object functionality.
/Thomas
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi Thomas,
Quoted 42 lines · Thomas Hellstrom
Quoted 30 lines · Daniel Vetter
Quoted 17 lines · Thomas Hellström (VMware)
On 6/21/19 1:57 PM, Gerd Hoffmann wrote:
Aargh. Please don't do this. Multiple reasons:
1) I think It's bad to dump all buffer object functionality we can possibly think of in a single struct and force that on all (well at least most) users. It's better to isolate functionality in structs, have utility functions for those and let the drivers derive their buffer objects from whatever functionality they actually need.
2) vmwgfx is not using gem and we don't want to carry that extra payload in the buffer object.
3) TTM historically hasn't been using the various drm layers except for later when common helpers have been used, (like the vma manager and the cache utilities). It's desirable to keep that layer distinction. (which is really what I'm saying in 1.)Quoted 8 lines
Now if more and more functionality that originated in TTM is moving into GEM we need to find a better way to do that without duplicating functionality. I suggest adding pointers in the TTM structs and defaulting those pointers to the member in the TTM struct. Optionally to to the member in the GEM struct. If we need to migrate those members out of the TTM struct, vmwgfx would have to provide them in its own buffer class.
NAK from the vmwgfx side.
It's 59
DRIVER_GEMvs 1 which is not. I think the verdict is clear what the reasonable thing to do is here, and this will allow us to substantially improve code and concept sharing across drm drivers.Quoted 5 lines
10 years ago it was indeed not clear whether everyone doing the same is a bright idea, but that's no more. If you want I guess you can keep a private copy of ttm in vmwgfx, but not sure that's really worth it long-term.
-DanielIt's not a question about whether GEM or TTM, or even the number of drivers using one or the other. (GEM would actually be a good choice for the latter vmwgfx device versions). But this is going against all recent effort to make different parts of drm functionality recently self-contained.
Quoted 6 lines
Just stop and think for a while what would happen if someone would suggest doing the opposite: making a gem object a derived class of a TTM object, arguing that a lot of GEM drivers are using TTM as a backend. There would probably be a lot of people claiming "we don't want to unnecesarily carry that stuff". That's because that would also be a poor design.
That case is a bit a different case. We have
- 5 ttm+gem drivers, recently refactored into vram helpers (but still ttm underneath)
- 5 ttm+gem drivers, using ttm directly
- 1 ttm driver, no gem
- 48 other gem drivers with no vram support
- 1 gem driver which will gain vram support shortly, with or without ttm still not clear
11:48 is not even close to 59:1 imo. And I think even if Thomas Zimmermann and others get really busy porting old discrete fbdev drivers to kms, that ratio won't change much since we're also gaining new soc drm drivers at a steady rate.
Also I wouldn't mind if we e.g. stuff a struct list_head lru; into drm_gem_buffer_object, that's probably useful for many cases (not the pure display drivers, but they tend to have so few bo it really wont matter even if we add a few kb of cruft).
Quoted 6 lines
What I'm suggesting is, build that improved code and concept sharing around
struct gem_ttm_object { struct gem_object; struct ttm_object; };
I guess technically this would work too. Bit more churn (maybe substantially more, I haven't looked tbh) to roll this out for all the ttm drivers using gem.
Quoted 1 line
And lets work toghether to eliminate what's duplicated.
How would you share the bo.resv pointer with the above design? With embedding ttm can use the gem one, and we drop a bunch of code (and for all the ttm+gem drivers, one pointer they don't need twice). With the side-by-side, which is the design all gem+ttm drivers used the past few years, we still need that duplication. Same for the vma node thing, which is also duplicated. And that's just the things Gerd did in this initial patch series. I think Christian König has some ideas around ttm_bo_(un)reserve, and I just sent out a patch series to streamline how we handle the reservation_object pointer for prime import/export.
Quoted 7 lines
The vmwgfx driver is doing what it does mostly because all buffer objects do not need to be user-space visible, and do not need to be mapped by user-space. And there are other types of objects that DO need to be user-space visible, and that do need to be shared by processes. Hence user-space visibility is something that should be abstracted and made available to those objects. Not lumped together with all other potential buffer object functionality.
I'd still go with pragmatic choice of "this here is typed & reviewed, and a bunch of people are enthusastistic about using this to drive further refactoring in this area". Whatever the reasons, but since a few months the ttm refactor train seems to have gained massive momentum.
So if you want to change the direction of this train, I think you need to get typing and show that your solution is at least as effective at faciliting all the things people want to do with code sharing across drm drivers.
Cheers, Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi, Daniel,
Quoted 58 lines · Daniel Vetter
Hi Thomas,
Quoted 40 lines · Thomas Hellstrom
Quoted 29 lines · Daniel Vetter
Quoted 16 lines · Thomas Hellström (VMware)
On 6/21/19 1:57 PM, Gerd Hoffmann wrote:
Aargh. Please don't do this. Multiple reasons:
1) I think It's bad to dump all buffer object functionality we can possibly think of in a single struct and force that on all (well at least most) users. It's better to isolate functionality in structs, have utility functions for those and let the drivers derive their buffer objects from whatever functionality they actually need.
2) vmwgfx is not using gem and we don't want to carry that extra payload in the buffer object.
3) TTM historically hasn't been using the various drm layers except for later when common helpers have been used, (like the vma manager and the cache utilities). It's desirable to keep that layer distinction. (which is really what I'm saying in 1.)Quoted 8 lines
Now if more and more functionality that originated in TTM is moving into GEM we need to find a better way to do that without duplicating functionality. I suggest adding pointers in the TTM structs and defaulting those pointers to the member in the TTM struct. Optionally to to the member in the GEM struct. If we need to migrate those members out of the TTM struct, vmwgfx would have to provide them in its own buffer class.
NAK from the vmwgfx side.
It's 59
DRIVER_GEMvs 1 which is not. I think the verdict is clear what the reasonable thing to do is here, and this will allow us to substantially improve code and concept sharing across drm drivers.Quoted 5 lines
10 years ago it was indeed not clear whether everyone doing the same is a bright idea, but that's no more. If you want I guess you can keep a private copy of ttm in vmwgfx, but not sure that's really worth it long-term.
-DanielIt's not a question about whether GEM or TTM, or even the number of drivers using one or the other. (GEM would actually be a good choice for the latter vmwgfx device versions). But this is going against all recent effort to make different parts of drm functionality recently self-contained.
Quoted 6 lines
Just stop and think for a while what would happen if someone would suggest doing the opposite: making a gem object a derived class of a TTM object, arguing that a lot of GEM drivers are using TTM as a backend. There would probably be a lot of people claiming "we don't want to unnecesarily carry that stuff". That's because that would also be a poor design.
That case is a bit a different case. We have
- 5 ttm+gem drivers, recently refactored into vram helpers (but still ttm underneath)
- 5 ttm+gem drivers, using ttm directly
- 1 ttm driver, no gem
- 48 other gem drivers with no vram support
- 1 gem driver which will gain vram support shortly, with or without ttm still not clear
Quoted 4 lines
11:48 is not even close to 59:1 imo. And I think even if Thomas Zimmermann and others get really busy porting old discrete fbdev drivers to kms, that ratio won't change much since we're also gaining new soc drm drivers at a steady rate.
Yeah, my point was not really suggesting that we do this, but rather that people would rightfully get upset because the struct contains unused stuff.
Also a trap we might end up with in the future is that with the design suggested in this patch series is that people start assuming that the embedded gem object is actually initialized and working, which could lead to pretty severe problems for vmwgfx...
Quoted 15 lines
Also I wouldn't mind if we e.g. stuff a struct
list_headlru; intodrm_gem_buffer_object, that's probably useful for many cases (not the pure display drivers, but they tend to have so few bo it really wont matter even if we add a few kb of cruft).Quoted 6 lines
What I'm suggesting is, build that improved code and concept sharing around
struct gem_ttm_object { struct gem_object; struct ttm_object; };I guess technically this would work too. Bit more churn (maybe substantially more, I haven't looked tbh) to roll this out for all the ttm drivers using gem.
Quoted 7 lines
Quoted 1 line
And lets work toghether to eliminate what's duplicated.
How would you share the bo.resv pointer with the above design? With embedding ttm can use the gem one, and we drop a bunch of code (and for all the ttm+gem drivers, one pointer they don't need twice). With the side-by-side, which is the design all gem+ttm drivers used the past few years, we still need that duplication. Same for the vma node thing, which is also duplicated.
To bemore precise I'd probably define a
struct drm_bo_common {
struct reservation_object r;
struct drm_vma_node v;
};
Embed it in a struct drm_gem_object (and in a struct vmwgfx_buffer_object) and then have a pointer to a struct drm_bo_common in the struct ttm_buffer_object. That's a single pointer overhead for everything we want to move.
As TTM-specific code disappears, so will the number of members in struct drm_bo_common. Meanwhile, we maintain a nice layering and no extra unused payload for any implementation.
Quoted 19 lines
And that's just the things Gerd did
in this initial patch series. I think Christian König has some ideas around ttm_bo_(un)reserve, and I just sent out a patch series to streamline how we handle thereservation_objectpointer for prime import/export.Quoted 7 lines
The vmwgfx driver is doing what it does mostly because all buffer objects do not need to be user-space visible, and do not need to be mapped by user-space. And there are other types of objects that DO need to be user-space visible, and that do need to be shared by processes. Hence user-space visibility is something that should be abstracted and made available to those objects. Not lumped together with all other potential buffer object functionality.
I'd still go with pragmatic choice of "this here is typed & reviewed, and a bunch of people are enthusastistic about using this to drive further refactoring in this area". Whatever the reasons, but since a few months the ttm refactor train seems to have gained massive momentum.
Quoted 4 lines
So if you want to change the direction of this train, I think you need to get typing and show that your solution is at least as effective at faciliting all the things people want to do with code sharing across drm drivers.
Well I don't think it needs to change direction. I just feel it got temporarily derailed. But if that's what it take I'll put something like the above together to see how it ends up. But I can't do it until August, though when I'm back, so I guess I have to check where the code is at then.
/Thomas
Quoted 2 lines
Cheers, Daniel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Gerd Hoffmann
maintainerHi,
Quoted 2 lines
Yeah, my point was not really suggesting that we do this, but rather that people would rightfully get upset because the struct contains unused stuff.
Well, struct drm_gem_object isn't that big, lets have a look:
320 bytes in total, of which are:
184 bytes the embedded vma_mode
64 bytes the embedded _resv struct
8 bytes the resv pointer.
64 bytes everything else.
So, after applying this series it's 64 bytes more per bo for vmwgfx, due to some unused fields being added.
And it's 256 bytes less per bo for all ttm+gem drivers, because they don't have vma_mode + resv struct + resv pointer twice any more.
And that is just the low-hanging fruit, there is room for more ttm_buffer_object elements being removed by using the drm_gem_object struct elements instead. num_pages, kref, maybe more.
Quoted 4 lines
Also a trap we might end up with in the future is that with the design suggested in this patch series is that people start assuming that the embedded gem object is actually initialized and working, which could lead to pretty severe problems for vmwgfx...
I guess I should reword patch #1 then, making clear that the ttm_bo_uses_embedded_gem_object() helper function is going to stay.
What is the reason for vmwgfx to not use gem btw?
Quoted 7 lines
Quoted 4 lines
for all the ttm+gem drivers, one pointer they don't need twice). With the side-by-side, which is the design all gem+ttm drivers used the past few years, we still need that duplication. Same for the vma node thing, which is also duplicated.
To bemore precise I'd probably define a
Quoted 8 lines
struct
drm_bo_common{
structreservation_objectr;
structdrm_vma_nodev;
};Embed it in a struct
drm_gem_object(and in a structvmwgfx_buffer_object) and then have a pointer to a structdrm_bo_commonin the structttm_buffer_object.
A pointer doesn't cut it.
Beside removing the duplication the other thing I want is to have a standard way of finding the ttm_buffer_object for a given drm_gem_object for all the ttm+gem drivers. With struct drm_gem_object being embedded the usual containter_of() will work.
That'll allow to create drm_gem_ttm_helper.c with helper functions for struct drm_gem_object_funcs. For starters some of the current vram helpers can become generic ttm helpers because they loose the dependency on struct drm_gem_vram_object for finding ttm_buffer_object.
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
The vmwgfx driver is doing what it does mostly because all buffer objects do not need to be user-space visible, and do not need to be mapped by user-space. And there are other types of objects that DO need to be user-space visible, and that do need to be shared by processes. Hence user-space visibility is something that should be abstracted and made available to those objects. Not lumped together with all other potential buffer object functionality.
Well, ttm_buffer_object has a vma_node embedded, so it already is "lumped together". This patch series only moves it around ...
cheers,
Gerd
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Am 24.06.19 um 08:32 schrieb Gerd Hoffmann:
Quoted 15 lines
Hi,Quoted 2 lines
Yeah, my point was not really suggesting that we do this, but rather that people would rightfully get upset because the struct contains unused stuff.
Well, struct
drm_gem_objectisn't that big, lets have a look:320 bytes in total, of which are:
184 bytes the embeddedvma_mode
64 bytes the embedded_resvstruct
8 bytes the resv pointer.
64 bytes everything else.So, after applying this series it's 64 bytes more per bo for vmwgfx, due to some unused fields being added.
Quoted 6 lines
And it's 256 bytes less per bo for all ttm+gem drivers, because they don't have
vma_mode+ resv struct + resv pointer twice any more.And that is just the low-hanging fruit, there is room for more
ttm_buffer_objectelements being removed by using thedrm_gem_objectstruct elements instead.num_pages, kref, maybe more.
Yeah, and that is exactly the reason why I'm strongly in favor of this approach.
GEM is our de-facto standard for buffer UAPI in DRM. AFAIK vmgfx is one of the few drivers not using it and as you wrote as well it might actually be a good idea to change that.
The only thing I can of hand see which is misplaced in the drm_gem_object structure is "struct file *filp;", cause that is specific to a backend implementation.
Regards,
Christian.
Quoted 43 lines
Quoted 5 lines
Also a trap we might end up with in the future is that with the design suggested in this patch series is that people start assuming that the embedded gem object is actually initialized and working, which could lead to pretty severe problems for vmwgfx...
I guess I should reword patch #1 then, making clear that the
ttm_bo_uses_embedded_gem_object()helper function is going to stay.What is the reason for vmwgfx to not use gem btw?
Quoted 6 lines
Quoted 4 lines
for all the ttm+gem drivers, one pointer they don't need twice). With the side-by-side, which is the design all gem+ttm drivers used the past few years, we still need that duplication. Same for the vma node thing, which is also duplicated.
To bemore precise I'd probably define a
Quoted 8 lines
struct
drm_bo_common{
structreservation_objectr;
structdrm_vma_nodev;
};Embed it in a struct
drm_gem_object(and in a structvmwgfx_buffer_object) and then have a pointer to a structdrm_bo_commonin the structttm_buffer_object.A pointer doesn't cut it.
Beside removing the duplication the other thing I want is to have a standard way of finding the
ttm_buffer_objectfor a givendrm_gem_objectfor all the ttm+gem drivers. With structdrm_gem_objectbeing embedded the usualcontainter_of()will work.That'll allow to create
drm_gem_ttm_helper.cwith helper functions for structdrm_gem_object_funcs. For starters some of the current vram helpers can become generic ttm helpers because they loose the dependency on structdrm_gem_vram_objectfor findingttm_buffer_object.Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
The vmwgfx driver is doing what it does mostly because all buffer objects do not need to be user-space visible, and do not need to be mapped by user-space. And there are other types of objects that DO need to be user-space visible, and that do need to be shared by processes. Hence user-space visibility is something that should be abstracted and made available to those objects. Not lumped together with all other potential buffer object functionality.
Quoted 6 lines
Well,
ttm_buffer_objecthas avma_nodeembedded, so it already is "lumped together". This patch series only moves it around ...cheers,
Gerd
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi Thomas,
Quoted 64 lines · Thomas Hellstrom
Quoted 58 lines · Daniel Vetter
Hi Thomas,
Quoted 40 lines · Thomas Hellstrom
Quoted 29 lines · Daniel Vetter
Quoted 16 lines · Thomas Hellström (VMware)
On 6/21/19 1:57 PM, Gerd Hoffmann wrote:
Aargh. Please don't do this. Multiple reasons:
1) I think It's bad to dump all buffer object functionality we can possibly think of in a single struct and force that on all (well at least most) users. It's better to isolate functionality in structs, have utility functions for those and let the drivers derive their buffer objects from whatever functionality they actually need.
2) vmwgfx is not using gem and we don't want to carry that extra payload in the buffer object.
3) TTM historically hasn't been using the various drm layers except for later when common helpers have been used, (like the vma manager and the cache utilities). It's desirable to keep that layer distinction. (which is really what I'm saying in 1.)Quoted 8 lines
Now if more and more functionality that originated in TTM is moving into GEM we need to find a better way to do that without duplicating functionality. I suggest adding pointers in the TTM structs and defaulting those pointers to the member in the TTM struct. Optionally to to the member in the GEM struct. If we need to migrate those members out of the TTM struct, vmwgfx would have to provide them in its own buffer class.
NAK from the vmwgfx side.
It's 59
DRIVER_GEMvs 1 which is not. I think the verdict is clear what the reasonable thing to do is here, and this will allow us to substantially improve code and concept sharing across drm drivers.Quoted 5 lines
10 years ago it was indeed not clear whether everyone doing the same is a bright idea, but that's no more. If you want I guess you can keep a private copy of ttm in vmwgfx, but not sure that's really worth it long-term.
-DanielIt's not a question about whether GEM or TTM, or even the number of drivers using one or the other. (GEM would actually be a good choice for the latter vmwgfx device versions). But this is going against all recent effort to make different parts of drm functionality recently self-contained.
Quoted 6 lines
Just stop and think for a while what would happen if someone would suggest doing the opposite: making a gem object a derived class of a TTM object, arguing that a lot of GEM drivers are using TTM as a backend. There would probably be a lot of people claiming "we don't want to unnecesarily carry that stuff". That's because that would also be a poor design.
That case is a bit a different case. We have
- 5 ttm+gem drivers, recently refactored into vram helpers (but still ttm underneath)
- 5 ttm+gem drivers, using ttm directly
- 1 ttm driver, no gem
- 48 other gem drivers with no vram support
- 1 gem driver which will gain vram support shortly, with or without ttm still not clearQuoted 4 lines
11:48 is not even close to 59:1 imo. And I think even if Thomas Zimmermann and others get really busy porting old discrete fbdev drivers to kms, that ratio won't change much since we're also gaining new soc drm drivers at a steady rate.
Quoted 7 lines
Yeah, my point was not really suggesting that we do this, but rather that people would rightfully get upset because the struct contains unused stuff.
Also a trap we might end up with in the future is that with the design suggested in this patch series is that people start assuming that the embedded gem object is actually initialized and working, which could lead to pretty severe problems for vmwgfx...
Yeah that's the biggest risk here. But that same risk exists no matter how we share code, people can also add new fields to the common_bo_struct you propose and then forget to intitialize it in one of the three use-cases:
- gem only
- ttm+gem
- ttm only
And vmwgfx is the most threatened here because it's the least common config. That's just part of the prize, and if it's really bad I think we could do some self-tests, to make sure basic ttm-only stuff keeps working as it should. Plus get the selftests integrated into default builds.
Quoted 63 lines
Quoted 15 lines
Also I wouldn't mind if we e.g. stuff a struct
list_headlru; intodrm_gem_buffer_object, that's probably useful for many cases (not the pure display drivers, but they tend to have so few bo it really wont matter even if we add a few kb of cruft).Quoted 6 lines
What I'm suggesting is, build that improved code and concept sharing around
struct gem_ttm_object { struct gem_object; struct ttm_object; };I guess technically this would work too. Bit more churn (maybe substantially more, I haven't looked tbh) to roll this out for all the ttm drivers using gem.
Quoted 7 lines
Quoted 1 line
And lets work toghether to eliminate what's duplicated.
How would you share the bo.resv pointer with the above design? With embedding ttm can use the gem one, and we drop a bunch of code (and for all the ttm+gem drivers, one pointer they don't need twice). With the side-by-side, which is the design all gem+ttm drivers used the past few years, we still need that duplication. Same for the vma node thing, which is also duplicated.
To bemore precise I'd probably define a
struct
drm_bo_common{
structreservation_objectr;
structdrm_vma_nodev;
};Embed it in a struct
drm_gem_object(and in a structvmwgfx_buffer_object) and then have a pointer to a structdrm_bo_commonin the structttm_buffer_object. That's a single pointer overhead for everything we want to move.As TTM-specific code disappears, so will the number of members in struct
drm_bo_common. Meanwhile, we maintain a nice layering and no extra unused payload for any implementation.Quoted 19 lines
And that's just the things Gerd did
in this initial patch series. I think Christian König has some ideas around ttm_bo_(un)reserve, and I just sent out a patch series to streamline how we handle thereservation_objectpointer for prime import/export.Quoted 7 lines
The vmwgfx driver is doing what it does mostly because all buffer objects do not need to be user-space visible, and do not need to be mapped by user-space. And there are other types of objects that DO need to be user-space visible, and that do need to be shared by processes. Hence user-space visibility is something that should be abstracted and made available to those objects. Not lumped together with all other potential buffer object functionality.
I'd still go with pragmatic choice of "this here is typed & reviewed, and a bunch of people are enthusastistic about using this to drive further refactoring in this area". Whatever the reasons, but since a few months the ttm refactor train seems to have gained massive momentum.
Quoted 4 lines
So if you want to change the direction of this train, I think you need to get typing and show that your solution is at least as effective at faciliting all the things people want to do with code sharing across drm drivers.
Quoted 4 lines
Well I don't think it needs to change direction. I just feel it got temporarily derailed. But if that's what it take I'll put something like the above together to see how it ends up. But I can't do it until August, though when I'm back, so I guess I have to check where the code is at then.
Yeah I think a wait&see is best here, we can course-correct later on still.
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 15 lines · Gerd Hoffmann
v2:
- build fixes.
- also dropttm_buffer_object->resvGerd Hoffmann (18):
drm/ttm: add gem base object
drm/vram: use embedded gem object drm/qxl: use embedded gem object drm/radeon: use embedded gem object drm/amdgpu: use embedded gem object drm/nouveau: use embedded gem object drm/ttm: use gem reservation object drm/ttm: use gemvma_node
drm/vram: dropdrm_gem_vram_driver_gem_prime_mmapdrm/ttm: set both resv and base.resv pointers
Quoted 8 lines
drm/ttm: switch ttm core from
bo->resvtobo->base.resvdrm/radeon: switch driver frombo->resvtobo->base.resvdrm/vmwgfx: switch driver frombo->resvtobo->base.resvdrm/amdgpu: switch driver frombo->resvtobo->base.resvdrm/nouveau: switch driver frombo->resvtobo->base.resvdrm/qxl: switch driver frombo->resvtobo->base.resvdrm/virtio: switch driver frombo->resvtobo->base.resvdrm/ttm: dropttm_buffer_object->resv
Imo get maybe another ttm+gem stakeholder to review this (Thomas for vram helpers or Ben for nouveau) and then this can land. I think Thomas Hellstrom tuned down his categorical "nak" to "we'll see where this goes, I might need to jump in and help course-correct".
btw I also resubmitted my prime resv_obj cleanup series:
https://patchwork.freedesktop.org/series/62735/
I think the only conflicts with your series here is that the setting of gem_bo.resv that I add in radeon/amdgpu/nouveau can be removed again when your stuff lands.
-Daniel
Quoted 78 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.h | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 3 +- drivers/gpu/drm/nouveau/nouveau_bo.h | 5 - drivers/gpu/drm/nouveau/nouveau_gem.h | 2 +- drivers/gpu/drm/qxl/qxl_drv.h | 6 +- drivers/gpu/drm/qxl/qxl_object.h | 6 +- drivers/gpu/drm/radeon/radeon.h | 3 +- drivers/gpu/drm/radeon/radeon_object.h | 2 +- drivers/gpu/drm/virtio/virtgpu_drv.h | 2 +- include/drm/drm_gem_vram_helper.h | 7 +- include/drm/ttm/ttm_bo_api.h | 25 +++- include/drm/ttm/ttm_bo_driver.h | 12 +- .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 6 +- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 6 +- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 6 +- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 14 +- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 28 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 8 +- drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 30 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c | 2 +- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +- drivers/gpu/drm/ast/ast_main.c | 2 +- drivers/gpu/drm/drm_gem_vram_helper.c | 36 ++--- drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c | 2 +- drivers/gpu/drm/mgag200/mgag200_main.c | 2 +- drivers/gpu/drm/nouveau/dispnv50/wndw.c | 2 +- drivers/gpu/drm/nouveau/nouveau_abi16.c | 4 +- drivers/gpu/drm/nouveau/nouveau_bo.c | 8 +- drivers/gpu/drm/nouveau/nouveau_display.c | 10 +- drivers/gpu/drm/nouveau/nouveau_fence.c | 2 +- drivers/gpu/drm/nouveau/nouveau_gem.c | 19 +-- drivers/gpu/drm/nouveau/nouveau_prime.c | 6 +- drivers/gpu/drm/qxl/qxl_cmd.c | 4 +- drivers/gpu/drm/qxl/qxl_debugfs.c | 4 +- drivers/gpu/drm/qxl/qxl_display.c | 8 +- drivers/gpu/drm/qxl/qxl_gem.c | 2 +- drivers/gpu/drm/qxl/qxl_object.c | 20 +-- drivers/gpu/drm/qxl/qxl_release.c | 8 +- drivers/gpu/drm/qxl/qxl_ttm.c | 4 +- drivers/gpu/drm/radeon/radeon_benchmark.c | 4 +- drivers/gpu/drm/radeon/radeon_cs.c | 4 +- drivers/gpu/drm/radeon/radeon_display.c | 6 +- drivers/gpu/drm/radeon/radeon_gem.c | 8 +- drivers/gpu/drm/radeon/radeon_mn.c | 2 +- drivers/gpu/drm/radeon/radeon_object.c | 22 +-- drivers/gpu/drm/radeon/radeon_prime.c | 4 +- drivers/gpu/drm/radeon/radeon_test.c | 8 +- drivers/gpu/drm/radeon/radeon_ttm.c | 4 +- drivers/gpu/drm/radeon/radeon_uvd.c | 2 +- drivers/gpu/drm/radeon/radeon_vm.c | 6 +- drivers/gpu/drm/ttm/ttm_bo.c | 136 +++++++++--------- drivers/gpu/drm/ttm/ttm_bo_util.c | 18 +-- drivers/gpu/drm/ttm/ttm_bo_vm.c | 15 +- drivers/gpu/drm/ttm/ttm_execbuf_util.c | 20 +-- drivers/gpu/drm/ttm/ttm_tt.c | 2 +- drivers/gpu/drm/vboxvideo/vbox_main.c | 2 +- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 4 +- drivers/gpu/drm/virtio/virtgpu_plane.c | 2 +- drivers/gpu/drm/virtio/virtgpu_prime.c | 3 - drivers/gpu/drm/vmwgfx/vmwgfx_blit.c | 4 +- drivers/gpu/drm/vmwgfx/vmwgfx_bo.c | 12 +- drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c | 4 +- drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 6 +- drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 4 +- 68 files changed, 311 insertions(+), 321 deletions(-)Signature · 6 lines
2.18.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Gerd Hoffmann
maintainerHi,
Quoted 4 lines
Imo get maybe another ttm+gem stakeholder to review this (Thomas for vram helpers or Ben for nouveau) and then this can land. I think Thomas Hellstrom tuned down his categorical "nak" to "we'll see where this goes, I might need to jump in and help course-correct".
Yep, seems he also is on summer vacation now ...
Quoted 3 lines
btw I also resubmitted my prime
resv_objcleanup series:
What is the merge plan for this? Looks like this is pretty much ready to go.
Quoted 3 lines
I think the only conflicts with your series here is that the setting of gem_bo.resv that I add in radeon/amdgpu/nouveau can be removed again when your stuff lands.
Yep, doesn't look too bad. I can rebase on top of your series, I plan to send v3 anyway, I have some smaller (comment) updates pending.
cheers,
Gerd
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 7 lines · Gerd Hoffmann
Hi,
Quoted 4 lines
Imo get maybe another ttm+gem stakeholder to review this (Thomas for vram helpers or Ben for nouveau) and then this can land. I think Thomas Hellstrom tuned down his categorical "nak" to "we'll see where this goes, I might need to jump in and help course-correct".
Quoted 8 lines
Yep, seems he also is on summer vacation now ...
Quoted 3 lines
btw I also resubmitted my prime
resv_objcleanup series:What is the merge plan for this? Looks like this is pretty much ready to go.
Needs an r-b from amd and maybe Ben, then I'll merge that I think.
Quoted 6 lines
Quoted 3 lines
I think the only conflicts with your series here is that the setting of gem_bo.resv that I add in radeon/amdgpu/nouveau can be removed again when your stuff lands.
Yep, doesn't look too bad. I can rebase on top of your series, I plan to send v3 anyway, I have some smaller (comment) updates pending.
It's just 3 lines we need to remove in the end (the ones that set gem_bo.resv), and those 3 lines are harmless I think. I think we can just merge whenever and then do the follow up once both series have landed. -Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel