drm: Generic dumb_map_offset for TTM-based drivers
Subsystems (5)
Thomas Zimmermann
maintainercover drm: Generic dumb_map_offset for TTM-based drivers
The implementation of drm_driver.dumb_map_offset is the same for several TTM-based drivers. Provide a common function in GEM-TTM helpers.
Thomas Zimmermann (4):
drm/gem-ttm-helper: Provide helper for struct
drm_driver.dumb_map_offset
drm/vram-helper: Use drm_gem_ttm_dumb_map_offset() drm/nouveau: Use drm_gem_ttm_dumb_map_offset() drm/qxl: Use drm_gem_ttm_dumb_map_offset()
drivers/gpu/drm/drm_gem_ttm_helper.c | 33 ++++++++++++++++ drivers/gpu/drm/drm_gem_vram_helper.c | 48 ----------------------- drivers/gpu/drm/nouveau/nouveau_display.c | 18 --------- drivers/gpu/drm/nouveau/nouveau_display.h | 2 - drivers/gpu/drm/nouveau/nouveau_drm.c | 3 +- drivers/gpu/drm/qxl/qxl_drv.c | 3 +- drivers/gpu/drm/qxl/qxl_drv.h | 3 -- drivers/gpu/drm/qxl/qxl_dumb.c | 17 -------- drivers/gpu/drm/qxl/qxl_ioctl.c | 4 +- drivers/gpu/drm/qxl/qxl_object.h | 5 --- include/drm/drm_gem_ttm_helper.h | 5 ++- include/drm/drm_gem_vram_helper.h | 7 +--- 12 files changed, 45 insertions(+), 103 deletions(-)
--
2.30.2
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
Thomas Zimmermann
maintainerPATCH 1/4 drm/gem-ttm-helper: Provide helper for struct drm_driver.dumb_map_offset
Provides an implementation of struct drm_driver.dumb_map_offset that can be used by TTM-based GEM drivers.
--- drivers/gpu/drm/drm_gem_ttm_helper.c | 33 ++++++++++++++++++++++++++++ include/drm/drm_gem_ttm_helper.h | 5 ++++- 2 files changed, 37 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_gem_ttm_helper.c +33 -0
@@ -114,5 +114,38 @@ int drm_gem_ttm_mmap(struct drm_gem_object *gem, }EXPORT_SYMBOL (drm_gem_ttm_mmap); +/** +* drm_gem_ttm_dumb_map_offset() - Implements struct &drm_driver.dumb_map_offset +* @file: DRM file pointer. +* @dev: DRM device. +* @handle: GEM handle +* @offset: Returns the mapping's memory offset on success +* +* Provides an implementation of struct &drm_driver.dumb_map_offset for +* TTM-based GEM drivers. TTM allocates the offset internally and +* drm_gem_ttm_dumb_map_offset() returns it for dumb-buffer implementations. +* +* See struct &drm_driver.dumb_map_offset. +* +* Returns: +* 0 on success, or a negative errno code otherwise. +*/ +int drm_gem_ttm_dumb_map_offset (struct drm_file *file,struct drm_device *dev, +uint32_t handle,uint64_t *offset) +{ +struct drm_gem_object *gem; + + gem =drm_gem_object_lookup (file, handle); +if (!gem) +return -ENOENT ; + + *offset =drm_vma_node_offset_addr (&gem->vma_node); + +drm_gem_object_put (gem); + +return 0 ; +} +EXPORT_SYMBOL (drm_gem_ttm_dumb_map_offset); +MODULE_DESCRIPTION ("DRM gem ttm helpers" );MODULE_LICENSE ("GPL" );
include/drm/drm_gem_ttm_helper.h +4 -1
@@ -5,8 +5,8 @@#include <linux/kernel.h> -#include <drm/drm_gem.h> #include <drm/drm_device.h> +#include <drm/drm_gem.h> #include <drm/ttm/ttm_bo_api.h> #include <drm/ttm/ttm_bo_driver.h>
@@ -24,4 +24,7 @@ void drm_gem_ttm_vunmap(struct drm_gem_object *gem,int drm_gem_ttm_mmap (struct drm_gem_object *gem,struct vm_area_struct *vma); +int drm_gem_ttm_dumb_map_offset (struct drm_file *file,struct drm_device *dev, +uint32_t handle,uint64_t *offset); +#endif
Signature · 6 lines
2.30.2 _______________________________________________ Nouveau mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/nouveau
Thomas Zimmermann
maintainerPATCH 3/4 drm/nouveau: Use drm_gem_ttm_dumb_map_offset()
In reply to Thomas ZimmermannNouveau now uses drm_gem_ttm_dumb_map_offset() to implement struct drm_driver.dumb_map_offset.
--- drivers/gpu/drm/nouveau/nouveau_display.c | 18 ------------------ drivers/gpu/drm/nouveau/nouveau_display.h | 2 -- drivers/gpu/drm/nouveau/nouveau_drm.c | 3 ++- 3 files changed, 2 insertions(+), 21 deletions(-)
drivers/gpu/drm/nouveau/nouveau_display.c +0 -18
@@ -838,21 +838,3 @@ nouveau_display_dumb_create(struct drm_file *file_priv, struct drm_device *dev,drm_gem_object_put (&bo->bo.base);return ret; } - -int -nouveau_display_dumb_map_offset (struct drm_file *file_priv, -struct drm_device *dev, -uint32_t handle,uint64_t *poffset) -{ -struct drm_gem_object *gem; - - 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.base.vma_node); -drm_gem_object_put (gem); -return 0 ; - } - -return -ENOENT ; -}
drivers/gpu/drm/nouveau/nouveau_display.h +0 -2
@@ -58,8 +58,6 @@ bool nouveau_display_scanoutpos(struct drm_crtc *crtc,int nouveau_display_dumb_create (struct drm_file *,struct drm_device *,struct drm_mode_create_dumb *args); -int nouveau_display_dumb_map_offset (struct drm_file *,struct drm_device *, -u32 handle,u64 *offset);void nouveau_hdmi_mode_set (struct drm_encoder *,struct drm_display_mode *);
drivers/gpu/drm/nouveau/nouveau_drm.c +2 -1
@@ -31,6 +31,7 @@#include <linux/mmu_notifier.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_gem_ttm_helper.h> #include <drm/drm_ioctl.h> #include <drm/drm_vblank.h>
@@ -1212,7 +1213,7 @@ driver_stub = { .gem_prime_import_sg_table = nouveau_gem_prime_import_sg_table, .dumb_create = nouveau_display_dumb_create, - .dumb_map_offset = nouveau_display_dumb_map_offset, + .dumb_map_offset = drm_gem_ttm_dumb_map_offset, .name = DRIVER_NAME, .desc = DRIVER_DESC,
Signature · 6 lines
2.30.2 _______________________________________________ Virtualization mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Thomas Zimmermann
maintainerPATCH 4/4 drm/qxl: Use drm_gem_ttm_dumb_map_offset()
In reply to Thomas ZimmermannQxl now uses drm_gem_ttm_dumb_map_offset() to implement struct drm_driver.dumb_map_offset.
--- drivers/gpu/drm/qxl/qxl_drv.c | 3 ++- drivers/gpu/drm/qxl/qxl_drv.h | 3 --- drivers/gpu/drm/qxl/qxl_dumb.c | 17 ----------------- drivers/gpu/drm/qxl/qxl_ioctl.c | 4 ++-- drivers/gpu/drm/qxl/qxl_object.h | 5 ----- 5 files changed, 4 insertions(+), 28 deletions(-)
drivers/gpu/drm/qxl/qxl_drv.c +2 -1
@@ -37,6 +37,7 @@#include <drm/drm_atomic_helper.h> #include <drm/drm_drv.h> #include <drm/drm_file.h> +#include <drm/drm_gem_ttm_helper.h> #include <drm/drm_modeset_helper.h> #include <drm/drm_prime.h> #include <drm/drm_probe_helper.h>
@@ -271,7 +272,7 @@ static struct drm_driver qxl_driver = { .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC, .dumb_create = qxl_mode_dumb_create, - .dumb_map_offset = qxl_mode_dumb_mmap, + .dumb_map_offset = drm_gem_ttm_dumb_map_offset,#if defined(CONFIG_DEBUG_FS ) .debugfs_init = qxl_debugfs_init,#endif
drivers/gpu/drm/qxl/qxl_drv.h +0 -3
@@ -330,9 +330,6 @@ void qxl_bo_force_delete(struct qxl_device *qdev);int qxl_mode_dumb_create (struct drm_file *file_priv,struct drm_device *dev,struct drm_mode_create_dumb *args); -int qxl_mode_dumb_mmap (struct drm_file *filp, -struct drm_device *dev, -uint32_t handle,uint64_t *offset_p);/* qxl ttm */ int qxl_ttm_init (struct qxl_device *qdev);
drivers/gpu/drm/qxl/qxl_dumb.c +0 -17
@@ -69,20 +69,3 @@ int qxl_mode_dumb_create(struct drm_file *file_priv, args->handle = handle;return 0 ; } - -int qxl_mode_dumb_mmap (struct drm_file *file_priv, -struct drm_device *dev, -uint32_t handle,uint64_t *offset_p) -{ -struct drm_gem_object *gobj; -struct qxl_bo *qobj; - -BUG_ON (!offset_p); - gobj =drm_gem_object_lookup (file_priv, handle); -if (gobj ==NULL ) -return -ENOENT ; - qobj =gem_to_qxl_bo (gobj); - *offset_p =qxl_bo_mmap_offset (qobj); -drm_gem_object_put (gobj); -return 0 ; -}
drivers/gpu/drm/qxl/qxl_ioctl.c +2 -2
@@ -67,8 +67,8 @@ static int qxl_map_ioctl(struct drm_device *dev, void *data,struct qxl_device *qdev =to_qxl (dev);struct drm_qxl_map *qxl_map = data; -return qxl_mode_dumb_mmap (file_priv, &qdev->ddev, qxl_map->handle, - &qxl_map->offset); +return drm_gem_ttm_dumb_map_offset (file_priv, &qdev->ddev, qxl_map->handle, + &qxl_map->offset); }struct qxl_reloc_info {
drivers/gpu/drm/qxl/qxl_object.h +0 -5
@@ -53,11 +53,6 @@ static inline unsigned long qxl_bo_size(struct qxl_bo *bo)return bo->tbo.base.size; } -static inline u64 qxl_bo_mmap_offset (struct qxl_bo *bo) -{ -return drm_vma_node_offset_addr (&bo->tbo.base.vma_node); -} - extern int qxl_bo_create(struct qxl_device *qdev, unsigned long size, bool kernel, bool pinned, u32 domain,
Signature · 6 lines
2.30.2 _______________________________________________ Virtualization mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Thomas Zimmermann
maintainerPATCH 2/4 drm/vram-helper: Use drm_gem_ttm_dumb_map_offset()
In reply to Thomas ZimmermannVRAM helpers now use drm_gem_ttm_dumb_map_offset() to implement struct drm_driver.dumb_map_offset.
--- drivers/gpu/drm/drm_gem_vram_helper.c | 48 --------------------------- include/drm/drm_gem_vram_helper.h | 7 ++-- 2 files changed, 2 insertions(+), 53 deletions(-)
drivers/gpu/drm/drm_gem_vram_helper.c +0 -48
@@ -245,22 +245,6 @@ void drm_gem_vram_put(struct drm_gem_vram_object *gbo) }EXPORT_SYMBOL (drm_gem_vram_put); -/** -* drm_gem_vram_mmap_offset() - Returns a GEM VRAM object's mmap offset -* @gbo: the GEM VRAM object -* -* See drm_vma_node_offset_addr() for more information. -* -* Returns: -* The buffer object's offset for userspace mappings on success, or -* 0 if no offset is allocated. -*/ -u64 drm_gem_vram_mmap_offset (struct drm_gem_vram_object *gbo) -{ -return drm_vma_node_offset_addr (&gbo->bo.base.vma_node); -} -EXPORT_SYMBOL (drm_gem_vram_mmap_offset); -static u64 drm_gem_vram_pg_offset (struct drm_gem_vram_object *gbo) {/* Keep TTM behavior for now, remove when drivers are audited */
@@ -638,38 +622,6 @@ int drm_gem_vram_driver_dumb_create(struct drm_file *file, }EXPORT_SYMBOL (drm_gem_vram_driver_dumb_create); -/** -* drm_gem_vram_driver_dumb_mmap_offset() - \ -Implements &struct drm_driver.dumb_mmap_offset -* @file: DRM file pointer. -* @dev: DRM device. -* @handle: GEM handle -* @offset: Returns the mapping's memory offset on success -* -* Returns: -* 0 on success, or -* a negative errno code otherwise. -*/ -int drm_gem_vram_driver_dumb_mmap_offset (struct drm_file *file, -struct drm_device *dev, -uint32_t handle,uint64_t *offset) -{ -struct drm_gem_object *gem; -struct drm_gem_vram_object *gbo; - - gem =drm_gem_object_lookup (file, handle); -if (!gem) -return -ENOENT ; - - gbo =drm_gem_vram_of_gem (gem); - *offset =drm_gem_vram_mmap_offset (gbo); - -drm_gem_object_put (gem); - -return 0 ; -} -EXPORT_SYMBOL (drm_gem_vram_driver_dumb_mmap_offset); -/* * Helpers for struct drm_plane_helper_funcs */
include/drm/drm_gem_vram_helper.h +2 -5
@@ -5,6 +5,7 @@#include <drm/drm_file.h> #include <drm/drm_gem.h> +#include <drm/drm_gem_ttm_helper.h> #include <drm/drm_ioctl.h> #include <drm/drm_modes.h> #include <drm/ttm/ttm_bo_api.h>
@@ -93,7 +94,6 @@ struct drm_gem_vram_object *drm_gem_vram_create(struct drm_device *dev,size_t size, unsigned long pg_align);void drm_gem_vram_put (struct drm_gem_vram_object *gbo); -u64 drm_gem_vram_mmap_offset (struct drm_gem_vram_object *gbo);s64 drm_gem_vram_offset (struct drm_gem_vram_object *gbo);int drm_gem_vram_pin (struct drm_gem_vram_object *gbo,unsigned long pl_flag);int drm_gem_vram_unpin (struct drm_gem_vram_object *gbo);
@@ -113,9 +113,6 @@ int drm_gem_vram_fill_create_dumb(struct drm_file *file,int drm_gem_vram_driver_dumb_create (struct drm_file *file,struct drm_device *dev,struct drm_mode_create_dumb *args); -int drm_gem_vram_driver_dumb_mmap_offset (struct drm_file *file, -struct drm_device *dev, -uint32_t handle,uint64_t *offset);/* * Helpers for struct drm_plane_helper_funcs
@@ -149,7 +146,7 @@ void drm_gem_vram_simple_display_pipe_cleanup_fb(#define DRM_GEM_VRAM_DRIVER \ .debugfs_init = drm_vram_mm_debugfs_init, \ .dumb_create = drm_gem_vram_driver_dumb_create, \ - .dumb_map_offset = drm_gem_vram_driver_dumb_mmap_offset, \ + .dumb_map_offset = drm_gem_ttm_dumb_map_offset, \ .gem_prime_mmap = drm_gem_prime_mmap/*
Signature · 6 lines
2.30.2 _______________________________________________ Virtualization mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/virtualization
kernel test robot
build botRe: [PATCH 2/4] drm/vram-helper: Use drm_gem_ttm_dumb_map_offset()
I love your patch! Yet something to improve:
Hi Thomas,
I love your patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v5.12-rc6 next-20210406]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Thomas-Zimmermann/drm-Generic-dumb_map_offset-for-TTM-based-drivers/20210406-163159 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 0a50438c84363bd37fe18fe432888ae9a074dcab config: arm64-allyesconfig (attached as .config) compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/80a1349080db0bb20f1e9a9909470c09d125daab
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Thomas-Zimmermann/drm-Generic-dumb_map_offset-for-TTM-based-drivers/20210406-163159 git checkout 80a1349080db0bb20f1e9a9909470c09d125daab
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm64
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
>> drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c:63:28: error: 'drm_gem_vram_driver_dumb_mmap_offset' undeclared here (not in a function); did you mean 'drm_gem_vram_driver_dumb_create'?
63 | .dumb_map_offset = drm_gem_vram_driver_dumb_mmap_offset,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| drm_gem_vram_driver_dumb_createvim +63 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
552a77bab3ff86 Tian Tao 2020-12-04 52
70a59dd82959f8 Daniel Vetter 2020-11-04 53 static const struct drm_driver hibmc_driver = {
5b38e7475e3dc5 Daniel Vetter 2019-01-29 54 .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
5e0df3a08f3d17 Rongrong Zou 2016-11-16 55 .fops = &hibmc_fops,
5e0df3a08f3d17 Rongrong Zou 2016-11-16 56 .name = "hibmc",
5e0df3a08f3d17 Rongrong Zou 2016-11-16 57 .date = "20160828",
5e0df3a08f3d17 Rongrong Zou 2016-11-16 58 .desc = "hibmc drm driver",
5e0df3a08f3d17 Rongrong Zou 2016-11-16 59 .major = 1,
5e0df3a08f3d17 Rongrong Zou 2016-11-16 60 .minor = 0,
de2318f69366cd Thomas Zimmermann 2019-12-03 61 .debugfs_init = drm_vram_mm_debugfs_init,
e4daebc77e7b34 Rongrong Zou 2016-11-16 62 .dumb_create = hibmc_dumb_create,
e2f572aa9cbb30 Thomas Zimmermann 2019-05-08 @63 .dumb_map_offset = drm_gem_vram_driver_dumb_mmap_offset,
80be7eed1d32fb Thomas Zimmermann 2019-07-02 64 .gem_prime_mmap = drm_gem_prime_mmap,
1d98b91611725e Rongrong Zou 2016-11-16 65 .irq_handler = hibmc_drm_interrupt,
5e0df3a08f3d17 Rongrong Zou 2016-11-16 66 };5e0df3a08f3d17 Rongrong Zou 2016-11-16 67
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Quoted 2 lines · Thomas Zimmermann
The implementation of drm_driver.dumb_map_offset is the same for several TTM-based drivers. Provide a common function in GEM-TTM helpers.
For the series:
Maxime
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 2 lines · Thomas Zimmermann
The implementation of drm_driver.dumb_map_offset is the same for several TTM-based drivers. Provide a common function in GEM-TTM helpers.
Out of curiosity, why does this not fit for radeon/amdgpu? -Daniel
Quoted 25 lines
Thomas Zimmermann (4):
drm/gem-ttm-helper: Provide helper for struct
drm_driver.dumb_map_offset
drm/vram-helper: Usedrm_gem_ttm_dumb_map_offset()drm/nouveau: Usedrm_gem_ttm_dumb_map_offset()drm/qxl: Usedrm_gem_ttm_dumb_map_offset()drivers/gpu/drm/drm_gem_ttm_helper.c | 33 ++++++++++++++++ drivers/gpu/drm/drm_gem_vram_helper.c | 48 ----------------------- drivers/gpu/drm/nouveau/nouveau_display.c | 18 --------- drivers/gpu/drm/nouveau/nouveau_display.h | 2 - drivers/gpu/drm/nouveau/nouveau_drm.c | 3 +- drivers/gpu/drm/qxl/qxl_drv.c | 3 +- drivers/gpu/drm/qxl/qxl_drv.h | 3 -- drivers/gpu/drm/qxl/qxl_dumb.c | 17 -------- drivers/gpu/drm/qxl/qxl_ioctl.c | 4 +- drivers/gpu/drm/qxl/qxl_object.h | 5 --- include/drm/drm_gem_ttm_helper.h | 5 ++- include/drm/drm_gem_vram_helper.h | 7 +--- 12 files changed, 45 insertions(+), 103 deletions(-)--
2.30.2
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Nouveau mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/nouveau
Thomas Zimmermann
maintainerHi
Am 08.04.21 um 13:16 schrieb Daniel Vetter:
Quoted 5 lines · Thomas Zimmermann
Quoted 2 lines
The implementation of drm_driver.dumb_map_offset is the same for several TTM-based drivers. Provide a common function in GEM-TTM helpers.
Out of curiosity, why does this not fit for radeon/amdgpu?
These drivers perform additional permission checks in their implementations.
But those checks are also part of the actual mmap code. I want to propose a patch to use the generic drm_gem_ttm_map_offset in amdgpu/radeon, and then rely on mmap to fail if necessary. It might result in a longer discussion, so that's for another patchset.
Best regards
Thomas
Quoted 28 lines
-Daniel
Quoted 25 lines
Thomas Zimmermann (4):
drm/gem-ttm-helper: Provide helper for struct
drm_driver.dumb_map_offset
drm/vram-helper: Usedrm_gem_ttm_dumb_map_offset()drm/nouveau: Usedrm_gem_ttm_dumb_map_offset()drm/qxl: Usedrm_gem_ttm_dumb_map_offset()drivers/gpu/drm/drm_gem_ttm_helper.c | 33 ++++++++++++++++ drivers/gpu/drm/drm_gem_vram_helper.c | 48 ----------------------- drivers/gpu/drm/nouveau/nouveau_display.c | 18 --------- drivers/gpu/drm/nouveau/nouveau_display.h | 2 - drivers/gpu/drm/nouveau/nouveau_drm.c | 3 +- drivers/gpu/drm/qxl/qxl_drv.c | 3 +- drivers/gpu/drm/qxl/qxl_drv.h | 3 -- drivers/gpu/drm/qxl/qxl_dumb.c | 17 -------- drivers/gpu/drm/qxl/qxl_ioctl.c | 4 +- drivers/gpu/drm/qxl/qxl_object.h | 5 --- include/drm/drm_gem_ttm_helper.h | 5 ++- include/drm/drm_gem_vram_helper.h | 7 +--- 12 files changed, 45 insertions(+), 103 deletions(-)--
2.30.2
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
Quoted 7 lines · Thomas Zimmermann
Hi
Am 08.04.21 um 13:16 schrieb Daniel Vetter:
Quoted 4 lines · Thomas Zimmermann
Quoted 2 lines
The implementation of drm_driver.dumb_map_offset is the same for several TTM-based drivers. Provide a common function in GEM-TTM helpers.
Quoted 8 lines
Quoted 1 line
Out of curiosity, why does this not fit for radeon/amdgpu?
These drivers perform additional permission checks in their implementations.
But those checks are also part of the actual mmap code. I want to propose a patch to use the generic
drm_gem_ttm_map_offsetin amdgpu/radeon, and then rely on mmap to fail if necessary. It might result in a longer discussion, so that's for another patchset.
Ah cool, makes sense.
-Daniel
Quoted 41 lines
Best regards
ThomasQuoted 28 lines
-Daniel
Quoted 25 lines
Thomas Zimmermann (4):
drm/gem-ttm-helper: Provide helper for struct
drm_driver.dumb_map_offset
drm/vram-helper: Usedrm_gem_ttm_dumb_map_offset()drm/nouveau: Usedrm_gem_ttm_dumb_map_offset()drm/qxl: Usedrm_gem_ttm_dumb_map_offset()drivers/gpu/drm/drm_gem_ttm_helper.c | 33 ++++++++++++++++ drivers/gpu/drm/drm_gem_vram_helper.c | 48 ----------------------- drivers/gpu/drm/nouveau/nouveau_display.c | 18 --------- drivers/gpu/drm/nouveau/nouveau_display.h | 2 - drivers/gpu/drm/nouveau/nouveau_drm.c | 3 +- drivers/gpu/drm/qxl/qxl_drv.c | 3 +- drivers/gpu/drm/qxl/qxl_drv.h | 3 -- drivers/gpu/drm/qxl/qxl_dumb.c | 17 -------- drivers/gpu/drm/qxl/qxl_ioctl.c | 4 +- drivers/gpu/drm/qxl/qxl_object.h | 5 --- include/drm/drm_gem_ttm_helper.h | 5 ++- include/drm/drm_gem_vram_helper.h | 7 +--- 12 files changed, 45 insertions(+), 103 deletions(-)--
2.30.2Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Nouveau mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/nouveau