Skip to content
Snippets Groups Projects
  1. Jul 20, 2023
  2. May 24, 2023
  3. Mar 25, 2023
  4. Feb 27, 2023
  5. Nov 21, 2022
  6. Oct 17, 2022
  7. Aug 27, 2022
  8. Aug 03, 2022
    • Danilo Krummrich's avatar
      drm/gem: rename GEM CMA helpers to GEM DMA helpers · 4a83c26a
      Danilo Krummrich authored
      
      Rename "GEM CMA" helpers to "GEM DMA" helpers - considering the
      hierarchy of APIs (mm/cma -> dma -> gem dma) calling them "GEM
      DMA" seems to be more applicable.
      
      Besides that, commit e57924d4 ("drm/doc: Task to rename CMA helpers")
      requests to rename the CMA helpers and implies that people seem to be
      confused about the naming.
      
      In order to do this renaming the following script was used:
      
      ```
      	#!/bin/bash
      
      	DIRS="drivers/gpu include/drm Documentation/gpu"
      
      	REGEX_SYM_UPPER="[0-9A-Z_\-]"
      	REGEX_SYM_LOWER="[0-9a-z_\-]"
      
      	REGEX_GREP_UPPER="(${REGEX_SYM_UPPER}*)(GEM)_CMA_(${REGEX_SYM_UPPER}*)"
      	REGEX_GREP_LOWER="(${REGEX_SYM_LOWER}*)(gem)_cma_(${REGEX_SYM_LOWER}*)"
      
      	REGEX_SED_UPPER="s/${REGEX_GREP_UPPER}/\1\2_DMA_\3/g"
      	REGEX_SED_LOWER="s/${REGEX_GREP_LOWER}/\1\2_dma_\3/g"
      
      	# Find all upper case 'CMA' symbols and replace them with 'DMA'.
      	for ff in $(grep -REHl "${REGEX_GREP_UPPER}" $DIRS)
      	do
      	       sed -i -E "$REGEX_SED_UPPER" $ff
      	done
      
      	# Find all lower case 'cma' symbols and replace them with 'dma'.
      	for ff in $(grep -REHl "${REGEX_GREP_LOWER}" $DIRS)
      	do
      	       sed -i -E "$REGEX_SED_LOWER" $ff
      	done
      
      	# Replace all occurrences of 'CMA' / 'cma' in comments and
      	# documentation files with 'DMA' / 'dma'.
      	for ff in $(grep -RiHl " cma " $DIRS)
      	do
      		sed -i -E "s/ cma / dma /g" $ff
      		sed -i -E "s/ CMA / DMA /g" $ff
      	done
      
      	# Rename all 'cma_obj's to 'dma_obj'.
      	for ff in $(grep -RiHl "cma_obj" $DIRS)
      	do
      		sed -i -E "s/cma_obj/dma_obj/g" $ff
      	done
      ```
      
      Only a few more manual modifications were needed, e.g. reverting the
      following modifications in some DRM Kconfig files
      
          -       select CMA if HAVE_DMA_CONTIGUOUS
          +       select DMA if HAVE_DMA_CONTIGUOUS
      
      as well as manually picking the occurrences of 'CMA'/'cma' in comments and
      documentation which relate to "GEM CMA", but not "FB CMA".
      
      Also drivers/gpu/drm/Makefile was fixed up manually after renaming
      drm_gem_cma_helper.c to drm_gem_dma_helper.c.
      
      This patch is compile-time tested building a x86_64 kernel with
      `make allyesconfig && make drivers/gpu/drm`.
      
      Acked-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Acked-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Signed-off-by: default avatarDanilo Krummrich <dakr@redhat.com>
      Reviewed-by: Liviu Dudau <liviu.dudau@arm.com> #drivers/gpu/drm/arm
      Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220802000405.949236-4-dakr@redhat.com
      4a83c26a
  9. Jul 05, 2022
  10. Apr 04, 2022
  11. Feb 08, 2022
    • Lucas De Marchi's avatar
      dma-buf-map: Rename to iosys-map · 7938f421
      Lucas De Marchi authored
      
      Rename struct dma_buf_map to struct iosys_map and corresponding APIs.
      Over time dma-buf-map grew up to more functionality than the one used by
      dma-buf: in fact it's just a shim layer to abstract system memory, that
      can be accessed via regular load and store, from IO memory that needs to
      be acessed via arch helpers.
      
      The idea is to extend this API so it can fulfill other needs, internal
      to a single driver. Example: in the i915 driver it's desired to share
      the implementation for integrated graphics, which uses mostly system
      memory, with discrete graphics, which may need to access IO memory.
      
      The conversion was mostly done with the following semantic patch:
      
      	@r1@
      	@@
      	- struct dma_buf_map
      	+ struct iosys_map
      
      	@r2@
      	@@
      	(
      	- DMA_BUF_MAP_INIT_VADDR
      	+ IOSYS_MAP_INIT_VADDR
      	|
      	- dma_buf_map_set_vaddr
      	+ iosys_map_set_vaddr
      	|
      	- dma_buf_map_set_vaddr_iomem
      	+ iosys_map_set_vaddr_iomem
      	|
      	- dma_buf_map_is_equal
      	+ iosys_map_is_equal
      	|
      	- dma_buf_map_is_null
      	+ iosys_map_is_null
      	|
      	- dma_buf_map_is_set
      	+ iosys_map_is_set
      	|
      	- dma_buf_map_clear
      	+ iosys_map_clear
      	|
      	- dma_buf_map_memcpy_to
      	+ iosys_map_memcpy_to
      	|
      	- dma_buf_map_incr
      	+ iosys_map_incr
      	)
      
      	@@
      	@@
      	- #include <linux/dma-buf-map.h>
      	+ #include <linux/iosys-map.h>
      
      Then some files had their includes adjusted and some comments were
      update to remove mentions to dma-buf-map.
      
      Since this is not specific to dma-buf anymore, move the documentation to
      the "Bus-Independent Device Accesses" section.
      
      v2:
        - Squash patches
      
      v3:
        - Fix wrong removal of dma-buf.h from MAINTAINERS
        - Move documentation from dma-buf.rst to device-io.rst
      
      v4:
        - Change documentation title and level
      
      Signed-off-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
      Acked-by: default avatarChristian König <christian.koenig@amd.com>
      Acked-by: default avatarSumit Semwal <sumit.semwal@linaro.org>
      Acked-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220204170541.829227-1-lucas.demarchi@intel.com
      7938f421
  12. Jul 28, 2021
  13. Jan 05, 2021
  14. Nov 09, 2020
  15. Sep 25, 2020
  16. Jul 15, 2020
  17. May 20, 2020
    • Chris Wilson's avatar
      drm: Restore the NULL check for drm_gem_object_put() · 0e799e84
      Chris Wilson authored
      
      Some users want to pass NULL to drm_gem_object_put(), but those using
      __drm_gem_object_put() did not. Compromise, have both and let the
      compiler sort it out.
      
      drm_gem_fb_destroy() calls drm_gem_object_put() with NULL obj causing:
      [   11.584209] BUG: kernel NULL pointer dereference, address: 0000000000000000
      [   11.584213] #PF: supervisor write access in kernel mode
      [   11.584215] #PF: error_code(0x0002) - not-present page
      [   11.584216] PGD 0 P4D 0
      [   11.584220] Oops: 0002 [#1] SMP NOPTI
      [   11.584223] CPU: 7 PID: 1571 Comm: gnome-shell Tainted: G            E     5.7.0-rc1-1-default+ #27
      [   11.584225] Hardware name: Micro-Star International Co., Ltd. MS-7A31/X370 XPOWER GAMING TITANIUM (MS-7A31), BIOS 1.MR 12/03/2019
      [   11.584237] RIP: 0010:drm_gem_fb_destroy+0x28/0x70 [drm_kms_helper]
      <snip>
      [   11.584256] Call Trace:
      [   11.584279]  drm_mode_rmfb+0x189/0x1c0 [drm]
      [   11.584299]  ? drm_mode_rmfb+0x1c0/0x1c0 [drm]
      [   11.584314]  drm_ioctl_kernel+0xaa/0xf0 [drm]
      [   11.584329]  drm_ioctl+0x1ff/0x3b0 [drm]
      [   11.584347]  ? drm_mode_rmfb+0x1c0/0x1c0 [drm]
      [   11.584421]  amdgpu_drm_ioctl+0x49/0x80 [amdgpu]
      [   11.584427]  ksys_ioctl+0x87/0xc0
      [   11.584430]  __x64_sys_ioctl+0x16/0x20
      [   11.584434]  do_syscall_64+0x5f/0x240
      [   11.584438]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
      [   11.584440] RIP: 0033:0x7f0ef80f7227
      
      Reported-by: default avatarNirmoy Das <nirmoy.das@amd.com>
      Fixes: b5d25074 ("drm/gem: fold drm_gem_object_put_unlocked and __drm_gem_object_put()")
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Nirmoy Das <nirmoy.das@amd.com>
      Cc: Emil Velikov <emil.velikov@collabora.com>
      Cc: Christian König <christian.koenig@amd.com>.
      Acked-by: default avatarNirmoy Das <nirmoy.das@amd.com>
      Reviewed-by: default avatarEmil Velikov <emil.velikov@collabora.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20200520142347.29060-1-chris@chris-wilson.co.uk
      0e799e84
  18. May 19, 2020
  19. Dec 06, 2019
  20. Oct 29, 2019
  21. Oct 17, 2019
    • Gerd Hoffmann's avatar
      drm: add mmap() to drm_gem_object_funcs · c40069cb
      Gerd Hoffmann authored
      
      drm_gem_object_funcs->vm_ops alone can't handle everything which needs
      to be done for mmap(), tweaking vm_flags for example.  So add a new
      mmap() callback to drm_gem_object_funcs where this code can go to.
      
      Note that the vm_ops field is not used in case the mmap callback is
      present, it is expected that the callback sets vma->vm_ops instead.
      
      Also setting vm_flags and vm_page_prot is the job of the new callback.
      so drivers have more control over these flags.
      
      drm_gem_mmap_obj() will use the new callback for object specific mmap
      setup.  With this in place the need for driver-speific fops->mmap
      callbacks goes away, drm_gem_mmap can be hooked instead.
      
      drm_gem_prime_mmap() will use the new callback too to just mmap gem
      objects directly instead of jumping though loops to make
      drm_gem_object_lookup() and fops->mmap work.
      
      Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: http://patchwork.freedesktop.org/patch/msgid/20191016115203.20095-2-kraxel@redhat.com
      c40069cb
  22. Aug 13, 2019
  23. Aug 07, 2019
  24. Jul 03, 2019
  25. Jun 28, 2019
  26. Jun 21, 2019
    • Simona Vetter's avatar
      drm/prime: Update docs · 805dc614
      Simona Vetter authored
      
      Yes this is a bit a big patch, but since it's essentially a complete
      rewrite of all the prime docs I didn't see how to better split it up.
      
      Changes:
      - Consistently point to drm_gem_object_funcs as the preferred hooks,
        where applicable.
      
      - Document all the hooks in &drm_driver that lacked kerneldoc.
      
      - Completely new overview section, which now also includes the cleaned
        up lifetime/reference counting subchapter. I also mentioned the weak
        references in there due to the lookup caches.
      
      - Completely rewritten helper intro section, highlight the
        import/export related functionality.
      
      - Polish for all the functions and more cross references.
      
      I also sprinkled a bunch of todos all over.
      
      Most important: 0 code changes in here. The cleanup motivated by
      reading and improving all this will follow later on.
      
      v2: Actually update the prime helper docs. Plus add a few FIXMEs that
      I won't address right away in subsequent cleanup patches.
      
      v3:
      - Split out the function moving. This patch is now exclusively
        documentation changes.
      - Typos and nits (Sam).
      
      v4: Polish suggestions from Noralf.
      
      Acked-by: default avatarGerd Hoffmann <kraxel@redhat.com>
      Acked-by: default avatarEmil Velikov <emil.velikov@collabora.com>
      Acked-by: default avatarNoralf Trønnes <noralf@tronnes.org>
      Cc: Thomas Zimmermann <tzimmermann@suse.de>
      Cc: Gerd Hoffmann <kraxel@redhat.com>
      Cc: Noralf Trønnes <noralf@tronnes.org>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Cc: Eric Anholt <eric@anholt.net>
      Cc: Emil Velikov <emil.l.velikov@gmail.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190620124615.24434-1-daniel.vetter@ffwll.ch
      805dc614
  27. Jun 17, 2019
  28. Apr 16, 2019
  29. Apr 12, 2019
  30. Mar 14, 2019
  31. Feb 19, 2019
  32. Nov 24, 2018
  33. Nov 20, 2018
    • Noralf Trønnes's avatar
      drm/gem: Add drm_gem_object_funcs · b39b5394
      Noralf Trønnes authored
      
      This adds an optional function table on GEM objects.
      The main benefit is for drivers that support more than one type of
      memory (shmem,vram,cma) for their buffers depending on the hardware it
      runs on. With the callbacks attached to the GEM object itself, it is
      easier to have core helpers for the the various buffer types. The driver
      only has to make the decision about buffer type on GEM object creation
      and all other callbacks can be handled by the chosen helper.
      
      drm_driver->gem_prime_res_obj has not been added since there's a todo to
      put a reservation_object into drm_gem_object.
      
      v3: Add todo entry
      
      v2: Drop drm_gem_object_funcs->prime_mmap in favour of
      drm_gem_prime_mmap() (Daniel Vetter)
      
      v1:
      - drm_gem_object_funcs.map -> .prime_map let it only do PRIME mmap like
        the function it superseeds (Daniel Vetter)
      - Flip around the if ladders and make obj->funcs the first choice
        highlighting the fact that this the new default way of doing it
        (Daniel Vetter)
      
      Signed-off-by: default avatarNoralf Trønnes <noralf@tronnes.org>
      Acked-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Acked-by: default avatarChristian König <christian.koenig@amd.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20181110145647.17580-4-noralf@tronnes.org
      b39b5394
Loading