drm: Fareless gem_free_object
Subsystems (32)
cover drm: Fareless gem_free_object
Hi all,
Recently I had a look at the new dmabuf AMDGPU implementation.
Seemingly it was using the wrong drm_gem_object_put API. Namely the locked one, even though the driver is struct_mutex free.
Upon checking with the documentation, I've noticed it's a bit misleading so I've went ahead and:
- tweaked the drm_gem_object_put/struct_mutex references in the docs
- fixed up the AMDGPU caller
- removed the gem_free_object driver hook - \o/
- fold drm_gem_object_put_unlocked and __drm_gem_object_put
- drm_gem_object_put - add _locked suffix
- drm_gem_object_put_unlocked - remove _unlocked suffix
Although the rename patches are a handful, it does make sense to have a consistent and obviously named API.
Input and reviews are highly appreciated.
Emil
Emil Velikov (36):
drm: remove unused drm_gem.h include
drm/gem: use _unlocked reference in drm_gem_objects_lookup docs drm/todo: mention i915 in the struct_mutex section drm/doc: drop struct_mutex references
drm/doc: drop struct_mutex refernce for drm_gem_object_free drm/amdgpu: use the unlocked drm_gem_object_put drm/gma500: Use lockless gem BO free callback
drm: remove drm_driver::gem_free_object
drm/gem: fold drm_gem_object_put_unlocked and __drm_gem_object_put() drm/gem: add _locked suffix to drm_object_put
drm/gem: add drm_object_put helper
drm/amd: remove _unlocked suffix in drm_object_put_unlocked drm/arm: remove _unlocked suffix in drm_object_put_unlocked drm/armada: remove _unlocked suffix in drm_object_put_unlocked drm/etnaviv: remove _unlocked suffix in drm_object_put_unlocked drm/exynos: remove _unlocked suffix in drm_object_put_unlocked drm/gma500: remove _unlocked suffix in drm_object_put_unlocked drm/i915: remove _unlocked suffix in drm_object_put_unlocked drm/lima: remove _unlocked suffix in drm_object_put_unlocked drm/mediatek: remove _unlocked suffix in drm_object_put_unlocked drm/mgag200: remove _unlocked suffix in drm_object_put_unlocked drm/msm: remove _unlocked suffix in drm_object_put_unlocked drm/nouveau: remove _unlocked suffix in drm_object_put_unlocked drm/omapdrm: remove _unlocked suffix in drm_object_put_unlocked drm/panfrost: remove _unlocked suffix in drm_object_put_unlocked drm/qxl: remove _unlocked suffix in drm_object_put_unlocked drm/radeon: remove _unlocked suffix in drm_object_put_unlocked drm/rockchip: remove _unlocked suffix in drm_object_put_unlocked drm/tegra: remove _unlocked suffix in drm_object_put_unlocked drm/v3d: remove _unlocked suffix in drm_object_put_unlocked drm/vc4: remove _unlocked suffix in drm_object_put_unlocked drm/vgem: remove _unlocked suffix in drm_object_put_unlocked drm/virtio: remove _unlocked suffix in drm_object_put_unlocked drm/vkms: remove _unlocked suffix in drm_object_put_unlocked drm/xen: remove _unlocked suffix in drm_object_put_unlocked drm/gem: remove _unlocked suffix in drm_object_put_unlocked
Documentation/gpu/drm-mm.rst | 5 +- Documentation/gpu/todo.rst | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 20 +++--- drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 6 +- drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 6 +- drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 6 +- drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 6 +- .../arm/display/komeda/komeda_framebuffer.c | 6 +- drivers/gpu/drm/arm/malidp_drv.c | 4 +- drivers/gpu/drm/armada/armada_crtc.c | 8 +-- drivers/gpu/drm/armada/armada_fb.c | 4 +- drivers/gpu/drm/armada/armada_fbdev.c | 6 +- drivers/gpu/drm/armada/armada_gem.c | 10 +-- drivers/gpu/drm/drm_client.c | 2 +- drivers/gpu/drm/drm_gem.c | 70 +++++-------------- drivers/gpu/drm/drm_gem_cma_helper.c | 8 +-- drivers/gpu/drm/drm_gem_framebuffer_helper.c | 6 +- drivers/gpu/drm/drm_gem_shmem_helper.c | 4 +- drivers/gpu/drm/drm_gem_ttm_helper.c | 2 +- drivers/gpu/drm/drm_gem_vram_helper.c | 10 +-- drivers/gpu/drm/drm_prime.c | 6 +- drivers/gpu/drm/drm_vm.c | 1 - drivers/gpu/drm/etnaviv/etnaviv_drv.c | 8 +-- drivers/gpu/drm/etnaviv/etnaviv_gem.c | 6 +- drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c | 2 +- drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 2 +- drivers/gpu/drm/exynos/exynos_drm_gem.c | 4 +- drivers/gpu/drm/exynos/exynos_drm_gem.h | 2 +- drivers/gpu/drm/gma500/framebuffer.c | 2 +- drivers/gpu/drm/gma500/gem.c | 2 +- drivers/gpu/drm/gma500/gma_display.c | 6 +- drivers/gpu/drm/gma500/psb_drv.c | 2 +- drivers/gpu/drm/i915/gem/i915_gem_object.h | 2 +- drivers/gpu/drm/lima/lima_gem.c | 10 +-- drivers/gpu/drm/lima/lima_sched.c | 2 +- drivers/gpu/drm/mediatek/mtk_drm_gem.c | 2 +- drivers/gpu/drm/mgag200/mgag200_cursor.c | 8 +-- drivers/gpu/drm/msm/adreno/a5xx_debugfs.c | 4 +- drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 6 +- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 2 +- drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c | 4 +- drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c | 2 +- drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 2 +- drivers/gpu/drm/msm/dsi/dsi_host.c | 2 +- drivers/gpu/drm/msm/msm_drv.c | 8 +-- drivers/gpu/drm/msm/msm_fb.c | 4 +- drivers/gpu/drm/msm/msm_gem.c | 18 ++--- drivers/gpu/drm/msm/msm_gem_submit.c | 2 +- drivers/gpu/drm/msm/msm_gpu.c | 2 +- drivers/gpu/drm/nouveau/dispnv04/crtc.c | 2 +- drivers/gpu/drm/nouveau/nouveau_abi16.c | 2 +- drivers/gpu/drm/nouveau/nouveau_display.c | 8 +-- drivers/gpu/drm/nouveau/nouveau_gem.c | 14 ++-- drivers/gpu/drm/omapdrm/omap_drv.c | 2 +- drivers/gpu/drm/omapdrm/omap_fb.c | 2 +- drivers/gpu/drm/omapdrm/omap_fbdev.c | 2 +- drivers/gpu/drm/omapdrm/omap_gem.c | 4 +- drivers/gpu/drm/panfrost/panfrost_drv.c | 10 +-- drivers/gpu/drm/panfrost/panfrost_gem.c | 4 +- drivers/gpu/drm/panfrost/panfrost_job.c | 2 +- drivers/gpu/drm/panfrost/panfrost_mmu.c | 2 +- drivers/gpu/drm/panfrost/panfrost_perfcnt.c | 4 +- drivers/gpu/drm/qxl/qxl_cmd.c | 2 +- drivers/gpu/drm/qxl/qxl_display.c | 6 +- drivers/gpu/drm/qxl/qxl_dumb.c | 2 +- drivers/gpu/drm/qxl/qxl_gem.c | 2 +- drivers/gpu/drm/qxl/qxl_ioctl.c | 4 +- drivers/gpu/drm/qxl/qxl_object.c | 4 +- drivers/gpu/drm/radeon/radeon_cs.c | 2 +- drivers/gpu/drm/radeon/radeon_cursor.c | 6 +- drivers/gpu/drm/radeon/radeon_display.c | 8 +-- drivers/gpu/drm/radeon/radeon_fb.c | 4 +- drivers/gpu/drm/radeon/radeon_gem.c | 30 ++++---- drivers/gpu/drm/radeon/radeon_object.c | 2 +- drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 2 +- drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 2 +- drivers/gpu/drm/tegra/drm.c | 12 ++-- drivers/gpu/drm/tegra/fb.c | 6 +- drivers/gpu/drm/tegra/gem.c | 4 +- drivers/gpu/drm/v3d/v3d_bo.c | 6 +- drivers/gpu/drm/v3d/v3d_gem.c | 4 +- drivers/gpu/drm/v3d/v3d_irq.c | 2 +- drivers/gpu/drm/vc4/vc4_bo.c | 14 ++-- drivers/gpu/drm/vc4/vc4_gem.c | 14 ++-- drivers/gpu/drm/vc4/vc4_kms.c | 2 +- drivers/gpu/drm/vc4/vc4_v3d.c | 4 +- drivers/gpu/drm/vgem/vgem_drv.c | 6 +- drivers/gpu/drm/vgem/vgem_fence.c | 2 +- drivers/gpu/drm/virtio/virtgpu_display.c | 2 +- drivers/gpu/drm/virtio/virtgpu_gem.c | 6 +- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 6 +- drivers/gpu/drm/vkms/vkms_gem.c | 2 +- drivers/gpu/drm/xen/xen_drm_front.c | 4 +- include/drm/drm_drv.h | 8 --- include/drm/drm_gem.h | 28 +++----- 99 files changed, 269 insertions(+), 325 deletions(-)
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/36 drm: remove unused drm_gem.h include
From: Emil Velikov <[email protected]>
--- drivers/gpu/drm/drm_vm.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/drm_vm.c +0 -1
@@ -51,7 +51,6 @@#include <drm/drm_drv.h> #include <drm/drm_file.h> #include <drm/drm_framebuffer.h> -#include <drm/drm_gem.h> #include <drm/drm_print.h> #include "drm_internal.h"
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 01/36] drm: remove unused drm_gem.h include
Am 07.05.20 um 17:07 schrieb Emil Velikov:
Quoted 3 lines
From: Emil Velikov <[email protected]>
Signed-off-by Emil Velikov <[email protected]>
Quoted 17 lines
--- drivers/gpu/drm/drm_vm.c | 1 - 1 file changed, 1 deletion(-)drivers/gpu/drm/drm_vm.c +0
-1@@ -51,7 +51,6 @@#include <drm/drm_drv.h> #include <drm/drm_file.h> #include <drm/drm_framebuffer.h> -#include <drm/drm_gem.h> #include <drm/drm_print.h> #include "drm_internal.h"
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
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/36 drm/gem: use _unlocked reference in drm_gem_objects_lookup docs
In reply to Emil VelikovFrom: Emil Velikov <[email protected]>
Use the drm_gem_object_put_unlocked in the documentation for drm_gem_objects_lookup. The locked version of the helper should be used solely by people who know exactly what they are doing.
Should prevent issues like ones adddressed with the next patch.
--- drivers/gpu/drm/drm_gem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_gem.c +1 -1
@@ -690,7 +690,7 @@ static int objects_lookup(struct drm_file *filp, u32 *handle, int count,* Returns: * * @objs filled in with GEM object pointers. Returned GEM objects need to be -* released with drm_gem_object_put(). -ENOENT is returned on a lookup +* released with drm_gem_object_put_unlocked(). -ENOENT is returned on a lookup * failure. 0 is returned on success. * */
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 02/36] drm/gem: use _unlocked reference in drm_gem_objects_lookup docs
Hi Emil.
Quoted 18 lines · Emil Velikov
From: Emil Velikov <[email protected]>
Use the
drm_gem_object_put_unlockedin the documentation fordrm_gem_objects_lookup. The locked version of the helper should be used solely by people who know exactly what they are doing.Should prevent issues like ones adddressed with the next patch.
Signed-off-by Emil Velikov <[email protected]>--- drivers/gpu/drm/drm_gem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/drm_gem.c +0
-0
drivers/gpu/drm/drm_gem.c static int objects_lookup(struct drm_file *filp, u32 *handle, int count, · line 696
Quoted 8 lines
drivers/gpu/drm/drm_gem.c +1
-1@@ -690,7 +690,7 @@ static int objects_lookup(struct drm_file *filp, u32 *handle, int count,* Returns: * * @objs filled in with GEM object pointers. Returned GEM objects need to be -* released with drm_gem_object_put(). -ENOENT is returned on a lookup +* released with drm_gem_object_put_unlocked(). -ENOENT is returned on a lookup * failure. 0 is returned on success. * */
This change seems pointless as you go ahead and drop the _unlocked suffix a few patches later.
Sam
Quoted 7 lines
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/36 drm/todo: mention i915 in the struct_mutex section
In reply to Emil VelikovFrom: Emil Velikov <[email protected]>
---
i915 uses the _unlocked version of the grm_gem_object API. Yet makes an extensive use of the struct_mutex.
Did not check how exactly it all work though.
--- Documentation/gpu/todo.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/gpu/todo.rst +2 -2
@@ -157,8 +157,8 @@ private lock. The tricky part is the BO free functions, since those can't reliably take that lock any more. Instead state needs to be protected with suitable subordinate locks or some cleanup work pushed to a worker thread. For performance-critical drivers it might also be better to go with a more -fine-grained per-buffer object and per-context lockings scheme. Currently only the -``msm`` driver still use ``struct_mutex``. +fine-grained per-buffer object and per-context lockings scheme. Currently only +the ``msm`` and `i915` drivers use ``struct_mutex``. Contact: Daniel Vetter, respective driver maintainers
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 03/36] drm/todo: mention i915 in the struct_mutex section
Quoted 8 lines · Emil Velikov
From: Emil Velikov <[email protected]>
Signed-off-by Emil Velikov <[email protected]>---
i915 uses the_unlockedversion of thegrm_gem_objectAPI. Yet makes an extensive use of thestruct_mutex.Did not check how exactly it all work though.
Quoted 26 lines
--- Documentation/gpu/todo.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Documentation/gpu/todo.rst +2
-2@@ -157,8 +157,8 @@ private lock. The tricky part is the BO free functions, since those can't reliably take that lock any more. Instead state needs to be protected with suitable subordinate locks or some cleanup work pushed to a worker thread. For performance-critical drivers it might also be better to go with a more -fine-grained per-buffer object and per-context lockings scheme. Currently only the -``msm`` driver still use ``struct_mutex``. +fine-grained per-buffer object and per-context lockings scheme. Currently only +the ``msm`` and `i915` drivers use ``struct_mutex``. Contact: Daniel Vetter, respective driver maintainersSignature · 6 lines
2.25.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
RE: [PATCH 03/36] drm/todo: mention i915 in the struct_mutex section
In reply to Emil VelikovQuoted 8 lines
-----Original Message-----
From: dri-devel <[email protected]> On Behalf Of Emil Velikov
Sent: Thursday, May 7, 2020 11:08 AM
To: [email protected]
Cc: [email protected]
Subject: [PATCH 03/36] drm/todo: mention i915 in thestruct_mutexsection
Quoted 6 lines
From: Emil Velikov <[email protected]>
Signed-off-by Emil Velikov <[email protected]>---
i915 uses the_unlockedversion of thegrm_gem_objectAPI. Yet makes an extensive use of thestruct_mutex.
s/grm_/drm_/ ?
M
Quoted 25 lines
Did not check how exactly it all work though.
---Documentation/gpu/todo.rst| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)Documentation/gpu/todo.rst +0
-0@@ -157,8 +157,8 @@ private lock. The tricky part is the BO free functions,since those can't
reliably take that lock any more. Instead state needs to be protected with suitable subordinate locks or some cleanup work pushed to a worker thread. For
performance-critical drivers it might also be better to go with a more -fine-grained per-buffer object and per-context lockings scheme. Currently only the
-``msm`` driver still use ``struct_mutex``.
+fine-grained per-buffer object and per-context lockings scheme. Currently only
+the ``msm`` andi915drivers use ``struct_mutex``.Contact: Daniel Vetter, respective driver maintainers
Quoted 7 lines
--
2.25.1_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 4/36 drm/doc: drop struct_mutex references
In reply to Emil VelikovFrom: Emil Velikov <[email protected]>
There's little point in providing partial and ancient information about the struct_mutex. Some drivers are using it, new ones should not.
As-it this only provides for confusion.
--- Documentation/gpu/drm-mm.rst | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
Documentation/gpu/drm-mm.rst +2 -5
@@ -178,11 +178,8 @@ GEM Objects Lifetime -------------------- All GEM objects are reference-counted by the GEM core. References can be -acquired and release by calling drm_gem_object_get() and drm_gem_object_put() -respectively. The caller must hold the :c:type:`struct drm_device <drm_device>` -struct_mutex lock when calling drm_gem_object_get(). As a convenience, GEM -provides drm_gem_object_put_unlocked() functions that can be called without -holding the lock. +acquired and release by calling drm_gem_object_get() and drm_gem_object_put_unlocked() +respectively. When the last reference to a GEM object is released the GEM core calls the :c:type:`struct drm_driver <drm_driver>` gem_free_object_unlocked
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 04/36] drm/doc: drop struct_mutex references
Hi Emil.
Quoted 17 lines · Emil Velikov
From: Emil Velikov <[email protected]>
There's little point in providing partial and ancient information about the
struct_mutex. Some drivers are using it, new ones should not.As-it this only provides for confusion.
Signed-off-by Emil Velikov <[email protected]>--- Documentation/gpu/drm-mm.rst | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)Documentation/gpu/drm-mm.rst +0
-0
Documentation/gpu/drm-mm.rst GEM Objects Lifetime · line 182
Quoted 10 lines
Documentation/gpu/drm-mm.rst +2
-5@@ -178,11 +178,8 @@ GEM Objects Lifetime -------------------- All GEM objects are reference-counted by the GEM core. References can be -acquired and release by calling drm_gem_object_get() and drm_gem_object_put() -respectively. The caller must hold the :c:type:`struct drm_device <drm_device>` -struct_mutex lock when calling drm_gem_object_get(). As a convenience, GEM -provides drm_gem_object_put_unlocked() functions that can be called without -holding the lock. +acquired and release by calling drm_gem_object_get() and drm_gem_object_put_unlocked() +respectively.
Nice to get rid of struct_mutex lock stuff.
But no need to s/drm_gem_object_put/drm_gem_object_put_unlocked()/ as this will be renamed a bit later.
Sam
Quoted 10 lines
Documentation/gpu/drm-mm.rst +0
-0When the last reference to a GEM object is released the GEM core calls the :c:type:`struct drm_driver <drm_driver>` gem_free_object_unlockedSignature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 04/36] drm/doc: drop struct_mutex references
Hi Sam,
Quoted 23 lines · Sam Ravnborg
Hi Emil.
Quoted 19 lines · Emil Velikov
From: Emil Velikov <[email protected]>
There's little point in providing partial and ancient information about the
struct_mutex. Some drivers are using it, new ones should not.As-it this only provides for confusion.
Signed-off-by Emil Velikov <[email protected]>--- Documentation/gpu/drm-mm.rst | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)Documentation/gpu/drm-mm.rst +0
-0@@ -178,11 +178,8 @@ GEM Objects Lifetime --------------------
Quoted 13 lines
Documentation/gpu/drm-mm.rst GEM Objects Lifetime · line 182
Quoted 8 lines
Documentation/gpu/drm-mm.rst +2
-5All GEM objects are reference-counted by the GEM core. References can be -acquired and release by calling drm_gem_object_get() and drm_gem_object_put() -respectively. The caller must hold the :c:type:`struct drm_device <drm_device>` -struct_mutex lock when calling drm_gem_object_get(). As a convenience, GEM -provides drm_gem_object_put_unlocked() functions that can be called without -holding the lock. +acquired and release by calling drm_gem_object_get() and drm_gem_object_put_unlocked() +respectively.Nice to get rid of
struct_mutexlock stuff.
But no need to s/drm_gem_object_put/drm_gem_object_put_unlocked()/ as this will be renamed a bit later.
This patch fixes the documentation, for people looking it today.
While I would love to see the s/_unlocked//g part of the series land, it is rather invasive albeit mechanical.
So driver maintainers are in their right to request that we push it at a later point.
Thus it makes perfect sense to address the two things in separate patches.
-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sam Ravnborg
Acked-byRe: [PATCH 04/36] drm/doc: drop struct_mutex references
Hi Emil.
Quoted 39 lines · Emil Velikov
Hi Sam,
Quoted 23 lines · Sam Ravnborg
Hi Emil.
Quoted 19 lines · Emil Velikov
From: Emil Velikov <[email protected]>
There's little point in providing partial and ancient information about the
struct_mutex. Some drivers are using it, new ones should not.As-it this only provides for confusion.
Signed-off-by Emil Velikov <[email protected]>--- Documentation/gpu/drm-mm.rst | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)Documentation/gpu/drm-mm.rst +0
-0@@ -178,11 +178,8 @@ GEM Objects Lifetime --------------------Quoted 13 lines
Documentation/gpu/drm-mm.rst GEM Objects Lifetime · line 182
Quoted 8 lines
Documentation/gpu/drm-mm.rst +2
-5All GEM objects are reference-counted by the GEM core. References can be -acquired and release by calling drm_gem_object_get() and drm_gem_object_put() -respectively. The caller must hold the :c:type:`struct drm_device <drm_device>` -struct_mutex lock when calling drm_gem_object_get(). As a convenience, GEM -provides drm_gem_object_put_unlocked() functions that can be called without -holding the lock. +acquired and release by calling drm_gem_object_get() and drm_gem_object_put_unlocked() +respectively.Nice to get rid of
struct_mutexlock stuff.
But no need to s/drm_gem_object_put/drm_gem_object_put_unlocked()/ as this will be renamed a bit later.
Quoted 6 lines
This patch fixes the documentation, for people looking it today.
While I would love to see the s/_unlocked//g part of the series land, it is rather invasive albeit mechanical.
So driver maintainers are in their right to request that we push it at a later point.
Well, unless there is push-back within a week from one of the maintainers then we should apply the full series at drm-misc-next. Maybe wiht a gently ping in mid next week.
No reason to wait for individual maintaintes to pick it up driver-by-driver. This would make such nice refactoring as this far to hard to do especially due to the dependencies to the first patches.
But I see your rationale for keeping it like it is. So you can stick an
on the rest of the patches.
Sam
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 04/36] drm/doc: drop struct_mutex references
In reply to Emil VelikovQuoted 8 lines · Emil Velikov
From: Emil Velikov <[email protected]>
There's little point in providing partial and ancient information about the
struct_mutex. Some drivers are using it, new ones should not.As-it this only provides for confusion.
Signed-off-by Emil Velikov <[email protected]>
I think a doc patch to add a big warning for drm_device.struct_mutex would also be good. The current text is kinda unhelpful.
-Daniel
Quoted 29 lines
--- Documentation/gpu/drm-mm.rst | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)Documentation/gpu/drm-mm.rst +2
-5@@ -178,11 +178,8 @@ GEM Objects Lifetime -------------------- All GEM objects are reference-counted by the GEM core. References can be -acquired and release by calling drm_gem_object_get() and drm_gem_object_put() -respectively. The caller must hold the :c:type:`struct drm_device <drm_device>` -struct_mutex lock when calling drm_gem_object_get(). As a convenience, GEM -provides drm_gem_object_put_unlocked() functions that can be called without -holding the lock. +acquired and release by calling drm_gem_object_get() and drm_gem_object_put_unlocked() +respectively. When the last reference to a GEM object is released the GEM core calls the :c:type:`struct drm_driver <drm_driver>` gem_free_object_unlockedSignature · 6 lines
2.25.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
Re: [PATCH 04/36] drm/doc: drop struct_mutex references
Quoted 7 lines · Daniel Vetter
Quoted 5 lines · Emil Velikov
From: Emil Velikov <[email protected]>
There's little point in providing partial and ancient information about the
struct_mutex. Some drivers are using it, new ones should not.
Quoted 6 lines
Quoted 3 lines
As-it this only provides for confusion.
Signed-off-by Emil Velikov <[email protected]>I think a doc patch to add a big warning for drm_device.struct_mutex would also be good. The current text is kinda unhelpful.
Would something like this be enough?
include/drm/drm_device.h +3 -0
@@ -146,6 +146,9 @@ struct drm_device {* @struct_mutex: * * Lock for others (not &drm_minor.master and &drm_file.is_master) +* +* WARNING: +* Only drivers annotated with DRIVER_LEGACY should be using this. */ struct mutex struct_mutex;
-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Daniel Vetter
Reviewed-byRe: [PATCH 04/36] drm/doc: drop struct_mutex references
Quoted 22 lines · Emil Velikov
Quoted 7 lines · Daniel Vetter
Quoted 5 lines · Emil Velikov
From: Emil Velikov <[email protected]>
There's little point in providing partial and ancient information about the
struct_mutex. Some drivers are using it, new ones should not.Quoted 6 lines
Quoted 3 lines
As-it this only provides for confusion.
Signed-off-by Emil Velikov <[email protected]>I think a doc patch to add a big warning for drm_device.struct_mutex would also be good. The current text is kinda unhelpful.
Would something like this be enough?
include/drm/drm_device.h +0
-0
include/drm/drm_device.h struct drm_device { · line 151
Quoted 6 lines
include/drm/drm_device.h +3
-0@@ -146,6 +146,9 @@ struct drm_device {* @struct_mutex: * * Lock for others (not &drm_minor.master and &drm_file.is_master) +* +* WARNING: +* Only drivers annotated with DRIVER_LEGACY should be using this.
Assuming you wrap it in some suitable commit and all that. -Daniel
Quoted 4 lines
include/drm/drm_device.h +0
-1*/ struct mutex struct_mutex; -Emil
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
PATCH 5/36 drm/doc: drop struct_mutex refernce for drm_gem_object_free
In reply to Emil VelikovFrom: Emil Velikov <[email protected]>
The comment that struct_mutex must be held is misleading. It is only required when .gem_free_object() is used.
Since that one is going with the next patches, drop the reference.
--- drivers/gpu/drm/drm_gem.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/drm_gem.c +0 -1
@@ -965,7 +965,6 @@ EXPORT_SYMBOL(drm_gem_object_release);* @kref: kref of the object to free * * Called after the last reference to the object has been lost. -* Must be called holding &drm_device.struct_mutex. * * Frees the object */
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 05/36] drm/doc: drop struct_mutex refernce for drm_gem_object_free
Quoted 8 lines · Emil Velikov
From: Emil Velikov <[email protected]>
The comment that
struct_mutexmust be held is misleading. It is only required when .gem_free_object() is used.Since that one is going with the next patches, drop the reference.
Signed-off-by Emil Velikov <[email protected]>
Quoted 23 lines
--- drivers/gpu/drm/drm_gem.c | 1 - 1 file changed, 1 deletion(-)drivers/gpu/drm/drm_gem.c +0
-1@@ -965,7 +965,6 @@ EXPORT_SYMBOL(drm_gem_object_release);* @kref: kref of the object to free * * Called after the last reference to the object has been lost. -* Must be called holding &drm_device.struct_mutex. * * Frees the object */ Signature · 6 lines
2.25.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
PATCH 6/36 drm/amdgpu: use the unlocked drm_gem_object_put
In reply to Emil VelikovFrom: Emil Velikov <[email protected]>
The driver does not hold struct_mutex, thus using the locked version of the helper is incorrect.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +1 -1
@@ -587,7 +587,7 @@ struct drm_gem_object *amdgpu_gem_prime_import(struct drm_device *dev, attach =dma_buf_dynamic_attach (dma_buf, dev->dev, &amdgpu_dma_buf_attach_ops, obj);if (IS_ERR (attach)) { -drm_gem_object_put (obj); +drm_gem_object_put_unlocked (obj);return ERR_CAST (attach); }
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 06/36] drm/amdgpu: use the unlocked drm_gem_object_put
Hi Emil.
Quoted 19 lines · Emil Velikov
From: Emil Velikov <[email protected]>
The driver does not hold
struct_mutex, thus using the locked version of the helper is incorrect.Cc Alex Deucher <[email protected]>Cc Christian König <[email protected]>Fixes a39414716ca0 ("drm/amdgpu: add independent DMA-buf import v9"):Signed-off-by Emil Velikov <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c struct drm_gem_object *amdgpu_gem_prime_import(struct drm_device *dev, · line 592
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +1
-1@@ -587,7 +587,7 @@ struct drm_gem_object *amdgpu_gem_prime_import(struct drm_device *dev, attach =dma_buf_dynamic_attach (dma_buf, dev->dev, &amdgpu_dma_buf_attach_ops, obj);if (IS_ERR (attach)) { -drm_gem_object_put (obj); +drm_gem_object_put_unlocked (obj);return ERR_CAST (attach); }
Likewise previous patch.
Drop this as the patch is correct after the rename a few pathces later.
Sam
Quoted 8 lines
Signature · 7 lines
-- 2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Christian König
maintainerRe: [PATCH 06/36] drm/amdgpu: use the unlocked drm_gem_object_put
Am 07.05.20 um 20:03 schrieb Sam Ravnborg:
Quoted 17 lines
Hi Emil.
Quoted 14 lines · Emil Velikov
From: Emil Velikov <[email protected]>
The driver does not hold
struct_mutex, thus using the locked version of the helper is incorrect.Cc Alex Deucher <[email protected]>Cc Christian König <[email protected]>Fixes a39414716ca0 ("drm/amdgpu: add independent DMA-buf import v9"):Signed-off-by Emil Velikov <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c struct drm_gem_object *amdgpu_gem_prime_import(struct drm_device *dev, · line 592
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +1
-1@@ -587,7 +587,7 @@ struct drm_gem_object *amdgpu_gem_prime_import(struct drm_device *dev, attach =dma_buf_dynamic_attach (dma_buf, dev->dev, &amdgpu_dma_buf_attach_ops, obj);if (IS_ERR (attach)) { -drm_gem_object_put (obj); +drm_gem_object_put_unlocked (obj);return ERR_CAST (attach); }Likewise previous patch.
Drop this as the patch is correct after the rename a few pathces later.
Well this is a bug fix in the error path and should probably be back ported, so having a separate patch is certainly a good idea.
Christian.
Quoted 11 lines
Sam
Quoted 8 lines
Signature · 7 lines
-- 2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Fdri-devel&data=02%7C01%7Cchristian.koenig%40amd.com%7C41036bd7ab804d8bebdf08d7f2b0e938%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637244713989571165&sdata=d0LysMNmsc%2BSzSkYsZDmE43azU0nmAb%2B1tFHn%2BMNxDg%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 06/36] drm/amdgpu: use the unlocked drm_gem_object_put
Quoted 34 lines · Christian König
Am 07.05.20 um 20:03 schrieb Sam Ravnborg:
Quoted 17 lines
Hi Emil.
Quoted 14 lines · Emil Velikov
From: Emil Velikov <[email protected]>
The driver does not hold
struct_mutex, thus using the locked version of the helper is incorrect.Cc Alex Deucher <[email protected]>Cc Christian König <[email protected]>Fixes a39414716ca0 ("drm/amdgpu: add independent DMA-buf import v9"):Signed-off-by Emil Velikov <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 14 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c struct drm_gem_object *amdgpu_gem_prime_import(struct drm_device *dev, · line 592
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +1
-1@@ -587,7 +587,7 @@ struct drm_gem_object *amdgpu_gem_prime_import(struct drm_device *dev, attach =dma_buf_dynamic_attach (dma_buf, dev->dev, &amdgpu_dma_buf_attach_ops, obj);if (IS_ERR (attach)) { -drm_gem_object_put (obj); +drm_gem_object_put_unlocked (obj);return ERR_CAST (attach); }Likewise previous patch.
Drop this as the patch is correct after the rename a few pathces later.
Quoted 3 lines
Well this is a bug fix in the error path and should probably be back ported, so having a separate patch is certainly a good idea.
Precisely the goal here. The fixes tag should allow Greg and team to pick/port it where applicable.
-Emil
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 06/36] drm/amdgpu: use the unlocked drm_gem_object_put
Quoted 35 lines · Emil Velikov
Quoted 34 lines · Christian König
Am 07.05.20 um 20:03 schrieb Sam Ravnborg:
Quoted 31 lines
Hi Emil.
Quoted 19 lines · Emil Velikov
From: Emil Velikov <[email protected]>
The driver does not hold
struct_mutex, thus using the locked version of the helper is incorrect.Cc Alex Deucher <[email protected]>Cc Christian König <[email protected]>Fixes a39414716ca0 ("drm/amdgpu: add independent DMA-buf import v9"):Signed-off-by Emil Velikov <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +0
-0drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c struct drm_gem_object *amdgpu_gem_prime_import(struct drm_device *dev, · line 592
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +1
-1@@ -587,7 +587,7 @@ struct drm_gem_object *amdgpu_gem_prime_import(struct drm_device *dev, attach =dma_buf_dynamic_attach (dma_buf, dev->dev, &amdgpu_dma_buf_attach_ops, obj);if (IS_ERR (attach)) { -drm_gem_object_put (obj); +drm_gem_object_put_unlocked (obj);return ERR_CAST (attach); }Likewise previous patch.
Drop this as the patch is correct after the rename a few pathces later.
Quoted 5 lines
Quoted 3 lines
Well this is a bug fix in the error path and should probably be back ported, so having a separate patch is certainly a good idea.
Precisely the goal here. The fixes tag should allow Greg and team to pick/port it where applicable.
I got it now... Thanks for spelling it out for my dense mind.
Sam
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 06/36] drm/amdgpu: use the unlocked drm_gem_object_put
In reply to Emil VelikovAm 07.05.20 um 17:07 schrieb Emil Velikov:
Quoted 10 lines
From: Emil Velikov <[email protected]>
The driver does not hold
struct_mutex, thus using the locked version of the helper is incorrect.Cc Alex Deucher <[email protected]>Cc Christian König <[email protected]>Fixes a39414716ca0 ("drm/amdgpu: add independent DMA-buf import v9"):Signed-off-by Emil Velikov <[email protected]>
Quoted 9 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c struct drm_gem_object *amdgpu_gem_prime_import(struct drm_device *dev, · line 593
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +1
-1@@ -587,7 +587,7 @@ struct drm_gem_object *amdgpu_gem_prime_import(struct drm_device *dev, attach =dma_buf_dynamic_attach (dma_buf, dev->dev, &amdgpu_dma_buf_attach_ops, obj);if (IS_ERR (attach)) { -drm_gem_object_put (obj); +drm_gem_object_put_unlocked (obj);return ERR_CAST (attach); }
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 7/36 drm/gma500: Use lockless gem BO free callback
In reply to Emil VelikovFrom: Emil Velikov <[email protected]>
No dev->struct_mutex anywhere to be seen.
--- drivers/gpu/drm/gma500/psb_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/gma500/psb_drv.c +1 -1
@@ -507,7 +507,7 @@ static struct drm_driver driver = { .irq_uninstall = psb_irq_uninstall, .irq_handler = psb_irq_handler, - .gem_free_object = psb_gem_free_object, + .gem_free_object_unlocked = psb_gem_free_object, .gem_vm_ops = &psb_gem_vm_ops, .dumb_create = psb_gem_dumb_create,
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 07/36] drm/gma500: Use lockless gem BO free callback
Hi
Am 07.05.20 um 17:07 schrieb Emil Velikov:
Quoted 16 lines
From: Emil Velikov <[email protected]>
No
dev->struct_mutexanywhere to be seen.Cc Patrik Jakobsson <[email protected]>Cc Daniel Vetter <[email protected]>Signed-off-by Emil Velikov <[email protected]>--- drivers/gpu/drm/gma500/psb_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/gma500/psb_drv.c +0
-0
drivers/gpu/drm/gma500/psb_drv.c static struct drm_driver driver = { · line 510
Quoted 5 lines
drivers/gpu/drm/gma500/psb_drv.c +1
-1@@ -507,7 +507,7 @@ static struct drm_driver driver = { .irq_uninstall = psb_irq_uninstall, .irq_handler = psb_irq_handler, - .gem_free_object = psb_gem_free_object, + .gem_free_object_unlocked = psb_gem_free_object,
I'd also rename the function to psb_gem_free_object_unlocked(). In any case
Quoted 4 lines
drivers/gpu/drm/gma500/psb_drv.c +0
-0.gem_vm_ops = &psb_gem_vm_ops, .dumb_create = psb_gem_dumb_create,
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
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 8/36 drm: remove drm_driver::gem_free_object
In reply to Emil VelikovFrom: Emil Velikov <[email protected]>
No drivers set the callback, so remove it all together.
--- drivers/gpu/drm/drm_gem.c | 22 +++------------------- include/drm/drm_drv.h | 8 -------- include/drm/drm_gem.h | 5 +++-- 3 files changed, 6 insertions(+), 29 deletions(-)
drivers/gpu/drm/drm_gem.c +3 -19
@@ -975,15 +975,10 @@ drm_gem_object_free(struct kref *kref) container_of(kref, struct drm_gem_object, refcount);struct drm_device *dev = obj->dev; -if (obj->funcs) { +if (obj->funcs) obj->funcs->free (obj); - }else if (dev->driver->gem_free_object_unlocked) { +else if (dev->driver->gem_free_object_unlocked) dev->driver->gem_free_object_unlocked (obj); - }else if (dev->driver->gem_free_object) { -WARN_ON (!mutex_is_locked (&dev->struct_mutex)); - - dev->driver->gem_free_object (obj); - } }EXPORT_SYMBOL (drm_gem_object_free);
@@ -999,21 +994,10 @@ EXPORT_SYMBOL(drm_gem_object_free);void drm_gem_object_put_unlocked (struct drm_gem_object *obj) { -struct drm_device *dev; -if (!obj)return ; - dev = obj->dev; - -if (dev->driver->gem_free_object) { -might_lock (&dev->struct_mutex); -if (kref_put_mutex (&obj->refcount, drm_gem_object_free, - &dev->struct_mutex)) -mutex_unlock (&dev->struct_mutex); - }else { -kref_put (&obj->refcount, drm_gem_object_free); - } +kref_put (&obj->refcount, drm_gem_object_free); }EXPORT_SYMBOL (drm_gem_object_put_unlocked);
include/drm/drm_drv.h +0 -8
@@ -327,14 +327,6 @@ struct drm_driver {*/ void (*debugfs_init)(struct drm_minor *minor); -/** -* @gem_free_object: deconstructor for drm_gem_objects -* -* This is deprecated and should not be used by new drivers. Use -* &drm_gem_object_funcs.free instead. -*/ -void (*gem_free_object) (struct drm_gem_object *obj); -/** * @gem_free_object_unlocked: deconstructor for drm_gem_objects *
include/drm/drm_gem.h +3 -2
@@ -272,8 +272,9 @@ struct drm_gem_object {* attachment point for the device. This is invariant over the lifetime * of a gem object. * -* The &drm_driver.gem_free_object callback is responsible for cleaning -* up the dma_buf attachment and references acquired at import time. +* The &drm_driver.gem_free_object_unlocked callback is responsible for +* cleaning up the dma_buf attachment and references acquired at import +* time. * * Note that the drm gem/prime core does not depend upon drivers setting * this field any more. So for drivers where this doesn't make sense
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 08/36] drm: remove drm_driver::gem_free_object
Am 07.05.20 um 17:07 schrieb Emil Velikov:
Quoted 5 lines
From: Emil Velikov <[email protected]>
No drivers set the callback, so remove it all together.
Signed-off-by Emil Velikov <[email protected]>
Quoted 87 lines
--- drivers/gpu/drm/drm_gem.c | 22 +++------------------- include/drm/drm_drv.h | 8 -------- include/drm/drm_gem.h | 5 +++-- 3 files changed, 6 insertions(+), 29 deletions(-)drivers/gpu/drm/drm_gem.c +3
-19@@ -975,15 +975,10 @@ drm_gem_object_free(struct kref *kref) container_of(kref, struct drm_gem_object, refcount);struct drm_device *dev = obj->dev; -if (obj->funcs) { +if (obj->funcs) obj->funcs->free (obj); - }else if (dev->driver->gem_free_object_unlocked) { +else if (dev->driver->gem_free_object_unlocked) dev->driver->gem_free_object_unlocked (obj); - }else if (dev->driver->gem_free_object) { -WARN_ON (!mutex_is_locked (&dev->struct_mutex)); - - dev->driver->gem_free_object (obj); - } }EXPORT_SYMBOL (drm_gem_object_free);@@ -999,21 +994,10 @@ EXPORT_SYMBOL(drm_gem_object_free);void drm_gem_object_put_unlocked (struct drm_gem_object *obj) { -struct drm_device *dev; -if (!obj)return ; - dev = obj->dev; - -if (dev->driver->gem_free_object) { -might_lock (&dev->struct_mutex); -if (kref_put_mutex (&obj->refcount, drm_gem_object_free, - &dev->struct_mutex)) -mutex_unlock (&dev->struct_mutex); - }else { -kref_put (&obj->refcount, drm_gem_object_free); - } +kref_put (&obj->refcount, drm_gem_object_free); }EXPORT_SYMBOL (drm_gem_object_put_unlocked);include/drm/drm_drv.h +0
-8@@ -327,14 +327,6 @@ struct drm_driver {*/ void (*debugfs_init)(struct drm_minor *minor); -/** -* @gem_free_object: deconstructor for drm_gem_objects -* -* This is deprecated and should not be used by new drivers. Use -* &drm_gem_object_funcs.free instead. -*/ -void (*gem_free_object) (struct drm_gem_object *obj); -/** * @gem_free_object_unlocked: deconstructor for drm_gem_objects * include/drm/drm_gem.h +3
-2@@ -272,8 +272,9 @@ struct drm_gem_object {* attachment point for the device. This is invariant over the lifetime * of a gem object. * -* The &drm_driver.gem_free_object callback is responsible for cleaning -* up the dma_buf attachment and references acquired at import time. +* The &drm_driver.gem_free_object_unlocked callback is responsible for +* cleaning up the dma_buf attachment and references acquired at import +* time. * * Note that the drm gem/prime core does not depend upon drivers setting * this field any more. So for drivers where this doesn't make sense
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
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 9/36 drm/gem: fold drm_gem_object_put_unlocked and __drm_gem_object_put()
In reply to Emil VelikovFrom: Emil Velikov <[email protected]>
With earlier patch we removed the normal overhead so now we can lift the helper to the header, folding it __drm_object_put.
--- drivers/gpu/drm/drm_gem.c | 19 ------------------- drivers/gpu/drm/i915/gem/i915_gem_object.h | 2 +- include/drm/drm_gem.h | 17 ++++------------- 3 files changed, 5 insertions(+), 33 deletions(-)
drivers/gpu/drm/drm_gem.c +0 -19
@@ -982,25 +982,6 @@ drm_gem_object_free(struct kref *kref) }EXPORT_SYMBOL (drm_gem_object_free); -/** -* drm_gem_object_put_unlocked - drop a GEM buffer object reference -* @obj: GEM buffer object -* -* This releases a reference to @obj. Callers must not hold the -* &drm_device.struct_mutex lock when calling this function. -* -* See also __drm_gem_object_put(). -*/ -void -drm_gem_object_put_unlocked (struct drm_gem_object *obj) -{ -if (!obj) -return ; - -kref_put (&obj->refcount, drm_gem_object_free); -} -EXPORT_SYMBOL (drm_gem_object_put_unlocked); -/** * drm_gem_object_put - release a GEM buffer object reference * @obj: GEM buffer object
drivers/gpu/drm/i915/gem/i915_gem_object.h +1 -1
@@ -105,7 +105,7 @@ __attribute__((nonnull))static inline void i915_gem_object_put (struct drm_i915_gem_object *obj) { -__drm_gem_object_put (&obj->base); +drm_gem_object_put_unlocked (&obj->base); }#define assert_object_held (obj) dma_resv_assert_held((obj)->base.resv)
include/drm/drm_gem.h +4 -13
@@ -364,27 +364,18 @@ static inline void drm_gem_object_get(struct drm_gem_object *obj) }/** -* __drm_gem_object_put - raw function to release a GEM buffer object reference +* drm_gem_object_put_unlocked - drop a GEM buffer object reference * @obj: GEM buffer object * -* This function is meant to be used by drivers which are not encumbered with -* &drm_device.struct_mutex legacy locking and which are using the -* gem_free_object_unlocked callback. It avoids all the locking checks and -* locking overhead of drm_gem_object_put() and drm_gem_object_put_unlocked(). -* -* Drivers should never call this directly in their code. Instead they should -* wrap it up into a ``driver_gem_object_put(struct driver_gem_object *obj)`` -* wrapper function, and use that. Shared code should never call this, to -* avoid breaking drivers by accident which still depend upon -* &drm_device.struct_mutex locking. +* This releases a reference to @obj. Callers must not hold the +* &drm_device.struct_mutex lock when calling this function. */ static inline void -__drm_gem_object_put (struct drm_gem_object *obj) +drm_gem_object_put_unlocked (struct drm_gem_object *obj) {kref_put (&obj->refcount, drm_gem_object_free); } -void drm_gem_object_put_unlocked (struct drm_gem_object *obj);void drm_gem_object_put (struct drm_gem_object *obj); int drm_gem_handle_create(struct drm_file *file_priv,
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 09/36] drm/gem: fold drm_gem_object_put_unlocked and __drm_gem_object_put()
Quoted 69 lines · Emil Velikov
From: Emil Velikov <[email protected]>
With earlier patch we removed the normal overhead so now we can lift the helper to the header, folding it
__drm_object_put.Signed-off-by Emil Velikov <[email protected]>--- drivers/gpu/drm/drm_gem.c | 19 ------------------- drivers/gpu/drm/i915/gem/i915_gem_object.h | 2 +- include/drm/drm_gem.h | 17 ++++------------- 3 files changed, 5 insertions(+), 33 deletions(-)drivers/gpu/drm/drm_gem.c +0
-19@@ -982,25 +982,6 @@ drm_gem_object_free(struct kref *kref) }EXPORT_SYMBOL (drm_gem_object_free); -/** -* drm_gem_object_put_unlocked - drop a GEM buffer object reference -* @obj: GEM buffer object -* -* This releases a reference to @obj. Callers must not hold the -* &drm_device.struct_mutex lock when calling this function. -* -* See also __drm_gem_object_put(). -*/ -void -drm_gem_object_put_unlocked (struct drm_gem_object *obj) -{ -if (!obj) -return ; - -kref_put (&obj->refcount, drm_gem_object_free); -} -EXPORT_SYMBOL (drm_gem_object_put_unlocked); -/** * drm_gem_object_put - release a GEM buffer object reference * @obj: GEM buffer object drivers/gpu/drm/i915/gem/i915_gem_object.h +1
-1@@ -105,7 +105,7 @@ __attribute__((nonnull))static inline void i915_gem_object_put (struct drm_i915_gem_object *obj) { -__drm_gem_object_put (&obj->base); +drm_gem_object_put_unlocked (&obj->base); }#define assert_object_held (obj) dma_resv_assert_held((obj)->base.resv)include/drm/drm_gem.h +1
-3@@ -364,27 +364,18 @@ static inline void drm_gem_object_get(struct drm_gem_object *obj) }/** -* __drm_gem_object_put - raw function to release a GEM buffer object reference +* drm_gem_object_put_unlocked - drop a GEM buffer object reference * @obj: GEM buffer object * -* This function is meant to be used by drivers which are not encumbered with -* &drm_device.struct_mutex legacy locking and which are using the
include/drm/drm_gem.h static inline void drm_gem_object_get(struct drm_gem_object *obj) · line 371
Quoted 10 lines
include/drm/drm_gem.h +2
-8-* gem_free_object_unlocked callback. It avoids all the locking checks and -* locking overhead of drm_gem_object_put() and drm_gem_object_put_unlocked(). -* -* Drivers should never call this directly in their code. Instead they should -* wrap it up into a ``driver_gem_object_put(struct driver_gem_object *obj)`` -* wrapper function, and use that. Shared code should never call this, to -* avoid breaking drivers by accident which still depend upon -* &drm_device.struct_mutex locking. +* This releases a reference to @obj. Callers must not hold the +* &drm_device.struct_mutex lock when calling this function.
2nd sentence talking about struct_mutex isn't true anymore, since nothing in here calls mutex_lock(obj->dev->struct_mutex); With your cleanup here we officially don't care about struct_mutex in the drm core!
Aside from that lgtm, with that sentence removed:
Quoted 19 lines
include/drm/drm_gem.h +1
-2*/ static inline void -__drm_gem_object_put (struct drm_gem_object *obj) +drm_gem_object_put_unlocked (struct drm_gem_object *obj) {kref_put (&obj->refcount, drm_gem_object_free); } -void drm_gem_object_put_unlocked (struct drm_gem_object *obj);void drm_gem_object_put (struct drm_gem_object *obj); int drm_gem_handle_create(struct drm_file *file_priv,Signature · 6 lines
2.25.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
Re: [PATCH 09/36] drm/gem: fold drm_gem_object_put_unlocked and __drm_gem_object_put()
Quoted 86 lines · Daniel Vetter
Quoted 69 lines · Emil Velikov
From: Emil Velikov <[email protected]>
With earlier patch we removed the normal overhead so now we can lift the helper to the header, folding it
__drm_object_put.Signed-off-by Emil Velikov <[email protected]>--- drivers/gpu/drm/drm_gem.c | 19 ------------------- drivers/gpu/drm/i915/gem/i915_gem_object.h | 2 +- include/drm/drm_gem.h | 17 ++++------------- 3 files changed, 5 insertions(+), 33 deletions(-)drivers/gpu/drm/drm_gem.c +0
-19@@ -982,25 +982,6 @@ drm_gem_object_free(struct kref *kref) }EXPORT_SYMBOL (drm_gem_object_free); -/** -* drm_gem_object_put_unlocked - drop a GEM buffer object reference -* @obj: GEM buffer object -* -* This releases a reference to @obj. Callers must not hold the -* &drm_device.struct_mutex lock when calling this function. -* -* See also __drm_gem_object_put(). -*/ -void -drm_gem_object_put_unlocked (struct drm_gem_object *obj) -{ -if (!obj) -return ; - -kref_put (&obj->refcount, drm_gem_object_free); -} -EXPORT_SYMBOL (drm_gem_object_put_unlocked); -/** * drm_gem_object_put - release a GEM buffer object reference * @obj: GEM buffer object drivers/gpu/drm/i915/gem/i915_gem_object.h +1
-1@@ -105,7 +105,7 @@ __attribute__((nonnull))static inline void i915_gem_object_put (struct drm_i915_gem_object *obj) { -__drm_gem_object_put (&obj->base); +drm_gem_object_put_unlocked (&obj->base); }#define assert_object_held (obj) dma_resv_assert_held((obj)->base.resv)include/drm/drm_gem.h +1
-3@@ -364,27 +364,18 @@ static inline void drm_gem_object_get(struct drm_gem_object *obj) }/** -* __drm_gem_object_put - raw function to release a GEM buffer object reference +* drm_gem_object_put_unlocked - drop a GEM buffer object reference * @obj: GEM buffer object * -* This function is meant to be used by drivers which are not encumbered with -* &drm_device.struct_mutex legacy locking and which are using the include/drm/drm_gem.h static inline void drm_gem_object_get(struct drm_gem_object *obj) · line 371
Quoted 10 lines
include/drm/drm_gem.h +2
-8-* gem_free_object_unlocked callback. It avoids all the locking checks and -* locking overhead of drm_gem_object_put() and drm_gem_object_put_unlocked(). -* -* Drivers should never call this directly in their code. Instead they should -* wrap it up into a ``driver_gem_object_put(struct driver_gem_object *obj)`` -* wrapper function, and use that. Shared code should never call this, to -* avoid breaking drivers by accident which still depend upon -* &drm_device.struct_mutex locking. +* This releases a reference to @obj. Callers must not hold the +* &drm_device.struct_mutex lock when calling this function. 2nd sentence talking about
struct_mutexisn't true anymore, since nothing in here callsmutex_lock(obj->dev->struct_mutex); With your cleanup here we officially don't care aboutstruct_mutexin the drm core!
Quoted 2 lines
Aside from that lgtm, with that sentence removed:
Seems like I've forgot another reference in the documentation for "gem_free_object_unlocked"
Quoted 2 lines
Reviewed-by Daniel Vetter <[email protected]>
Thanks
Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 10/36 drm/gem: add _locked suffix to drm_object_put
In reply to Emil VelikovFrom: Emil Velikov <[email protected]>
Vast majority of DRM (core and drivers) are struct_mutex free.
As such we have only a handful of cases where the locked helper should be used. Make that stand out a little bit better.
Done via the following script:
__from=drm_gem_object_put
__to=drm_gem_object_put_locked
for __file in $(git grep --name-only --word-regexp $__from); do
sed -i "s/\<$__from\>/$__to/g" $__file;
done
--- drivers/gpu/drm/drm_gem.c | 6 +++--- drivers/gpu/drm/msm/adreno/a5xx_debugfs.c | 4 ++-- drivers/gpu/drm/msm/msm_drv.c | 2 +- drivers/gpu/drm/msm/msm_gem.c | 6 +++--- drivers/gpu/drm/msm/msm_gem_submit.c | 2 +- drivers/gpu/drm/msm/msm_gpu.c | 2 +- include/drm/drm_gem.h | 4 ++-- 7 files changed, 13 insertions(+), 13 deletions(-)
drivers/gpu/drm/drm_gem.c +3 -3
@@ -983,7 +983,7 @@ drm_gem_object_free(struct kref *kref)EXPORT_SYMBOL (drm_gem_object_free);/** -* drm_gem_object_put - release a GEM buffer object reference +* drm_gem_object_put_locked - release a GEM buffer object reference * @obj: GEM buffer object * * This releases a reference to @obj. Callers must hold the
@@ -994,7 +994,7 @@ EXPORT_SYMBOL(drm_gem_object_free);* drm_gem_object_put_unlocked() instead. */ void -drm_gem_object_put (struct drm_gem_object *obj) +drm_gem_object_put_locked (struct drm_gem_object *obj) {if (obj) {WARN_ON (!mutex_is_locked (&obj->dev->struct_mutex));
@@ -1002,7 +1002,7 @@ drm_gem_object_put(struct drm_gem_object *obj)kref_put (&obj->refcount, drm_gem_object_free); } } -EXPORT_SYMBOL (drm_gem_object_put); +EXPORT_SYMBOL (drm_gem_object_put_locked);/** * drm_gem_vm_open - vma->ops->open implementation for GEM
drivers/gpu/drm/msm/adreno/a5xx_debugfs.c +2 -2
@@ -124,13 +124,13 @@ reset_set(void *data, u64 val)if (a5xx_gpu->pm4_bo) {msm_gem_unpin_iova (a5xx_gpu->pm4_bo, gpu->aspace); -drm_gem_object_put (a5xx_gpu->pm4_bo); +drm_gem_object_put_locked (a5xx_gpu->pm4_bo); a5xx_gpu->pm4_bo =NULL ; }if (a5xx_gpu->pfp_bo) {msm_gem_unpin_iova (a5xx_gpu->pfp_bo, gpu->aspace); -drm_gem_object_put (a5xx_gpu->pfp_bo); +drm_gem_object_put_locked (a5xx_gpu->pfp_bo); a5xx_gpu->pfp_bo =NULL ; }
drivers/gpu/drm/msm/msm_drv.c +1 -1
@@ -932,7 +932,7 @@ static int msm_ioctl_gem_madvise(struct drm_device *dev, void *data, ret =0 ; } -drm_gem_object_put (obj); +drm_gem_object_put_locked (obj); unlock:mutex_unlock (&dev->struct_mutex);
drivers/gpu/drm/msm/msm_gem.c +3 -3
@@ -879,7 +879,7 @@ void msm_gem_describe_objects(struct list_head *list, struct seq_file *m) }#endif -/* don't call directly! Use drm_gem_object_put() and friends */ +/* don't call directly! Use drm_gem_object_put_locked() and friends */ void msm_gem_free_object (struct drm_gem_object *obj) {struct msm_gem_object *msm_obj =to_msm_bo (obj);
@@ -1183,7 +1183,7 @@ static void *_msm_gem_kernel_new(struct drm_device *dev, uint32_t size,return vaddr; err:if (locked) -drm_gem_object_put (obj); +drm_gem_object_put_locked (obj);else drm_gem_object_put_unlocked (obj);
@@ -1215,7 +1215,7 @@ void msm_gem_kernel_put(struct drm_gem_object *bo,msm_gem_unpin_iova (bo, aspace);if (locked) -drm_gem_object_put (bo); +drm_gem_object_put_locked (bo);else drm_gem_object_put_unlocked (bo); }
drivers/gpu/drm/msm/msm_gem_submit.c +1 -1
@@ -387,7 +387,7 @@ static void submit_cleanup(struct msm_gem_submit *submit)struct msm_gem_object *msm_obj = submit->bos[i].obj;submit_unlock_unpin_bo (submit, i, false);list_del_init (&msm_obj->submit_entry); -drm_gem_object_put (&msm_obj->base); +drm_gem_object_put_locked (&msm_obj->base); } }
drivers/gpu/drm/msm/msm_gpu.c +1 -1
@@ -694,7 +694,7 @@ static void retire_submit(struct msm_gpu *gpu, struct msm_ringbuffer *ring,/* move to inactive: */ msm_gem_move_to_inactive (&msm_obj->base);msm_gem_unpin_iova (&msm_obj->base, submit->aspace); -drm_gem_object_put (&msm_obj->base); +drm_gem_object_put_locked (&msm_obj->base); }pm_runtime_mark_last_busy (&gpu->pdev->dev);
include/drm/drm_gem.h +2 -2
@@ -187,7 +187,7 @@ struct drm_gem_object {* * Reference count of this object * -* Please use drm_gem_object_get() to acquire and drm_gem_object_put() +* Please use drm_gem_object_get() to acquire and drm_gem_object_put_locked() * or drm_gem_object_put_unlocked() to release a reference to a GEM * buffer object. */
@@ -376,7 +376,7 @@ drm_gem_object_put_unlocked(struct drm_gem_object *obj)kref_put (&obj->refcount, drm_gem_object_free); } -void drm_gem_object_put (struct drm_gem_object *obj); +void drm_gem_object_put_locked (struct drm_gem_object *obj); int drm_gem_handle_create(struct drm_file *file_priv, struct drm_gem_object *obj,
Signature · 1 line
2.25.1
Re: [PATCH 10/36] drm/gem: add _locked suffix to drm_object_put
Quoted 12 lines · Emil Velikov
From: Emil Velikov <[email protected]>
Vast majority of DRM (core and drivers) are
struct_mutexfree.As such we have only a handful of cases where the locked helper should be used. Make that stand out a little bit better.
Done via the following script:
__from=drm_gem_object_put
__to=drm_gem_object_put_locked
Quoted 8 lines
for
__filein $(git grep --name-only --word-regexp $__from); do
sed -i "s/\<$__from\>/$__to/g" $__file;
doneCc Rob Clark <[email protected]>Cc Sean Paul <[email protected]>Signed-off-by Emil Velikov <[email protected]>
Since
commit 48e7f18392c66f9b69ebac11c54f1a2e033ced54
Author: Kristian H. Kristensen <[email protected]> Date: Wed Mar 20 10:09:08 2019 -0700
drm/msm: Implement .gem_free_object_unlocked
msm doesn't need the struct_mutex in the bo_put anymore, the only reason we had to use the _locked version here is historical accidents I think.
I think you could convert these all to the _unlocked variant and then entirely drop the _locked version.
Once we have that we could move struct_mutex into each driver (at least for msm and i915) since it's purely internal, and then wrap it in an #ifdef CONFIG_DRM_LEGACY to gloriously sunset it all :-)
Cheers, Daniel
Quoted 160 lines
--- drivers/gpu/drm/drm_gem.c | 6 +++--- drivers/gpu/drm/msm/adreno/a5xx_debugfs.c | 4 ++-- drivers/gpu/drm/msm/msm_drv.c | 2 +- drivers/gpu/drm/msm/msm_gem.c | 6 +++--- drivers/gpu/drm/msm/msm_gem_submit.c | 2 +- drivers/gpu/drm/msm/msm_gpu.c | 2 +- include/drm/drm_gem.h | 4 ++-- 7 files changed, 13 insertions(+), 13 deletions(-)drivers/gpu/drm/drm_gem.c +3
-3@@ -983,7 +983,7 @@ drm_gem_object_free(struct kref *kref)EXPORT_SYMBOL (drm_gem_object_free);/** -* drm_gem_object_put - release a GEM buffer object reference +* drm_gem_object_put_locked - release a GEM buffer object reference * @obj: GEM buffer object * * This releases a reference to @obj. Callers must hold the @@ -994,7 +994,7 @@ EXPORT_SYMBOL(drm_gem_object_free);* drm_gem_object_put_unlocked() instead. */ void -drm_gem_object_put (struct drm_gem_object *obj) +drm_gem_object_put_locked (struct drm_gem_object *obj) {if (obj) {WARN_ON (!mutex_is_locked (&obj->dev->struct_mutex));@@ -1002,7 +1002,7 @@ drm_gem_object_put(struct drm_gem_object *obj)kref_put (&obj->refcount, drm_gem_object_free); } } -EXPORT_SYMBOL (drm_gem_object_put); +EXPORT_SYMBOL (drm_gem_object_put_locked);/** * drm_gem_vm_open - vma->ops->open implementation for GEM drivers/gpu/drm/msm/adreno/a5xx_debugfs.c +2
-2@@ -124,13 +124,13 @@ reset_set(void *data, u64 val)if (a5xx_gpu->pm4_bo) {msm_gem_unpin_iova (a5xx_gpu->pm4_bo, gpu->aspace); -drm_gem_object_put (a5xx_gpu->pm4_bo); +drm_gem_object_put_locked (a5xx_gpu->pm4_bo); a5xx_gpu->pm4_bo =NULL ; }if (a5xx_gpu->pfp_bo) {msm_gem_unpin_iova (a5xx_gpu->pfp_bo, gpu->aspace); -drm_gem_object_put (a5xx_gpu->pfp_bo); +drm_gem_object_put_locked (a5xx_gpu->pfp_bo); a5xx_gpu->pfp_bo =NULL ; }drivers/gpu/drm/msm/msm_drv.c +1
-1@@ -932,7 +932,7 @@ static int msm_ioctl_gem_madvise(struct drm_device *dev, void *data, ret =0 ; } -drm_gem_object_put (obj); +drm_gem_object_put_locked (obj); unlock:mutex_unlock (&dev->struct_mutex);drivers/gpu/drm/msm/msm_gem.c +3
-3@@ -879,7 +879,7 @@ void msm_gem_describe_objects(struct list_head *list, struct seq_file *m) }#endif -/* don't call directly! Use drm_gem_object_put() and friends */ +/* don't call directly! Use drm_gem_object_put_locked() and friends */ void msm_gem_free_object (struct drm_gem_object *obj) {struct msm_gem_object *msm_obj =to_msm_bo (obj);@@ -1183,7 +1183,7 @@ static void *_msm_gem_kernel_new(struct drm_device *dev, uint32_t size,return vaddr; err:if (locked) -drm_gem_object_put (obj); +drm_gem_object_put_locked (obj);else drm_gem_object_put_unlocked (obj);@@ -1215,7 +1215,7 @@ void msm_gem_kernel_put(struct drm_gem_object *bo,msm_gem_unpin_iova (bo, aspace);if (locked) -drm_gem_object_put (bo); +drm_gem_object_put_locked (bo);else drm_gem_object_put_unlocked (bo); }drivers/gpu/drm/msm/msm_gem_submit.c +1
-1@@ -387,7 +387,7 @@ static void submit_cleanup(struct msm_gem_submit *submit)struct msm_gem_object *msm_obj = submit->bos[i].obj;submit_unlock_unpin_bo (submit, i, false);list_del_init (&msm_obj->submit_entry); -drm_gem_object_put (&msm_obj->base); +drm_gem_object_put_locked (&msm_obj->base); } }drivers/gpu/drm/msm/msm_gpu.c +1
-1@@ -694,7 +694,7 @@ static void retire_submit(struct msm_gpu *gpu, struct msm_ringbuffer *ring,/* move to inactive: */ msm_gem_move_to_inactive (&msm_obj->base);msm_gem_unpin_iova (&msm_obj->base, submit->aspace); -drm_gem_object_put (&msm_obj->base); +drm_gem_object_put_locked (&msm_obj->base); }pm_runtime_mark_last_busy (&gpu->pdev->dev);include/drm/drm_gem.h +2
-2@@ -187,7 +187,7 @@ struct drm_gem_object {* * Reference count of this object * -* Please use drm_gem_object_get() to acquire and drm_gem_object_put() +* Please use drm_gem_object_get() to acquire and drm_gem_object_put_locked() * or drm_gem_object_put_unlocked() to release a reference to a GEM * buffer object. */ @@ -376,7 +376,7 @@ drm_gem_object_put_unlocked(struct drm_gem_object *obj)kref_put (&obj->refcount, drm_gem_object_free); } -void drm_gem_object_put (struct drm_gem_object *obj); +void drm_gem_object_put_locked (struct drm_gem_object *obj); int drm_gem_handle_create(struct drm_file *file_priv, struct drm_gem_object *obj,Signature · 6 lines
2.25.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
Re: [PATCH 10/36] drm/gem: add _locked suffix to drm_object_put
Quoted 29 lines · Daniel Vetter
Quoted 12 lines · Emil Velikov
From: Emil Velikov <[email protected]>
Vast majority of DRM (core and drivers) are
struct_mutexfree.As such we have only a handful of cases where the locked helper should be used. Make that stand out a little bit better.
Done via the following script:
__from=drm_gem_object_put
__to=drm_gem_object_put_lockedQuoted 8 lines
for
__filein $(git grep --name-only --word-regexp $__from); do
sed -i "s/\<$__from\>/$__to/g" $__file;
doneCc Rob Clark <[email protected]>Cc Sean Paul <[email protected]>Signed-off-by Emil Velikov <[email protected]>Since
commit
48e7f18392c66f9b69ebac11c54f1a2e033ced54Author: Kristian H. Kristensen <[email protected]> Date: Wed Mar 20 10:09:08 2019 -0700
Quoted 8 lines
drm/msm: Implement .gem_free_object_unlocked
msm doesn't need the
struct_mutexin thebo_putanymore, the only reason we had to use the_lockedversion here is historical accidents I think.I think you could convert these all to the
_unlockedvariant and then entirely drop the_lockedversion.
Did not check the msm driver closely, but it makes sense. Let's keep that as follow-up series?
We're already at 36 patches, plus mixing mostly mechanical and locking changes doesn't sound wise.
Quoted 4 lines
Once we have that we could move
struct_mutexinto each driver (at least for msm and i915) since it's purely internal, and then wrap it in an #ifdefCONFIG_DRM_LEGACYto gloriously sunset it all :-)
Indeed, we're nearly there.
-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 10/36] drm/gem: add _locked suffix to drm_object_put
Quoted 35 lines · Emil Velikov
Quoted 34 lines · Daniel Vetter
Quoted 12 lines · Emil Velikov
From: Emil Velikov <[email protected]>
Vast majority of DRM (core and drivers) are
struct_mutexfree.As such we have only a handful of cases where the locked helper should be used. Make that stand out a little bit better.
Done via the following script:
__from=drm_gem_object_put
__to=drm_gem_object_put_lockedQuoted 8 lines
for
__filein $(git grep --name-only --word-regexp $__from); do
sed -i "s/\<$__from\>/$__to/g" $__file;
doneCc Rob Clark <[email protected]>Cc Sean Paul <[email protected]>Signed-off-by Emil Velikov <[email protected]>Since
commit
48e7f18392c66f9b69ebac11c54f1a2e033ced54Author: Kristian H. Kristensen <[email protected]> Date: Wed Mar 20 10:09:08 2019 -0700drm/msm: Implement .gem_free_object_unlocked
msm doesn't need the
struct_mutexin thebo_putanymore, the only reason we had to use the_lockedversion here is historical accidents I think.
Quoted 7 lines
Quoted 3 lines
I think you could convert these all to the
_unlockedvariant and then entirely drop the_lockedversion.Did not check the msm driver closely, but it makes sense. Let's keep that as follow-up series?
We're already at 36 patches, plus mixing mostly mechanical and locking changes doesn't sound wise.
My idea was to simply throw this patch out, and replace it by an msm patch to switch over to the unlocked variant.
Well maybe then needs 2nd patch to throw the locked version out.
So feels a bit a detour to touch msm twice, which is why I suggested to do the more direct route. But if you feel strongly I guess we can go this way and then follow up with converting msm to unlocked and throwing the _locked variant out for good too.
-Daniel
Quoted 7 lines
Quoted 4 lines
Once we have that we could move
struct_mutexinto each driver (at least for msm and i915) since it's purely internal, and then wrap it in an #ifdefCONFIG_DRM_LEGACYto gloriously sunset it all :-)Indeed, we're nearly there.
-Emil
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
PATCH 11/36 drm/gem: add drm_object_put helper
In reply to Emil VelikovFrom: Emil Velikov <[email protected]>
Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.
Add helper, which will allow us to transition the drivers one by one, dropping the suffix.
--- include/drm/drm_gem.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
include/drm/drm_gem.h +4 -2
@@ -364,18 +364,20 @@ static inline void drm_gem_object_get(struct drm_gem_object *obj) }/** -* drm_gem_object_put_unlocked - drop a GEM buffer object reference +* drm_gem_object_put- drop a GEM buffer object reference * @obj: GEM buffer object * * This releases a reference to @obj. Callers must not hold the * &drm_device.struct_mutex lock when calling this function. */ static inline void -drm_gem_object_put_unlocked (struct drm_gem_object *obj) +drm_gem_object_put (struct drm_gem_object *obj) {kref_put (&obj->refcount, drm_gem_object_free); } +#define drm_gem_object_put_unlocked drm_gem_object_put +void drm_gem_object_put_locked (struct drm_gem_object *obj); int drm_gem_handle_create(struct drm_file *file_priv,
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Jani Nikula
maintainerRe: [PATCH 11/36] drm/gem: add drm_object_put helper
Quoted 19 lines · Emil Velikov
From: Emil Velikov <[email protected]>
Spelling out
_unlockedfor each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involvingstruct_mutex.Add helper, which will allow us to transition the drivers one by one, dropping the suffix.
Signed-off-by Emil Velikov <[email protected]>--- include/drm/drm_gem.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)include/drm/drm_gem.h +0
-0
include/drm/drm_gem.h static inline void drm_gem_object_get(struct drm_gem_object *obj) · line 367
Quoted 5 lines
include/drm/drm_gem.h +1
-1@@ -364,18 +364,20 @@ static inline void drm_gem_object_get(struct drm_gem_object *obj) }/** -* drm_gem_object_put_unlocked - drop a GEM buffer object reference +* drm_gem_object_put- drop a GEM buffer object reference
^
Missing space.
Quoted 17 lines
include/drm/drm_gem.h +3
-1* @obj: GEM buffer object * * This releases a reference to @obj. Callers must not hold the * &drm_device.struct_mutex lock when calling this function. */ static inline void -drm_gem_object_put_unlocked (struct drm_gem_object *obj) +drm_gem_object_put (struct drm_gem_object *obj) {kref_put (&obj->refcount, drm_gem_object_free); } +#define drm_gem_object_put_unlocked drm_gem_object_put +void drm_gem_object_put_locked (struct drm_gem_object *obj); int drm_gem_handle_create(struct drm_file *file_priv,
Signature · 5 lines
Jani Nikula, Intel Open Source Graphics Center _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 11/36] drm/gem: add drm_object_put helper
Quoted 23 lines · Jani Nikula
Quoted 21 lines · Emil Velikov
From: Emil Velikov <[email protected]>
Spelling out
_unlockedfor each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involvingstruct_mutex.Add helper, which will allow us to transition the drivers one by one, dropping the suffix.
Signed-off-by Emil Velikov <[email protected]>--- include/drm/drm_gem.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)include/drm/drm_gem.h +0
-0@@ -364,18 +364,20 @@ static inline void drm_gem_object_get(struct drm_gem_object *obj) }
Quoted 7 lines
include/drm/drm_gem.h static inline void drm_gem_object_get(struct drm_gem_object *obj) · line 367
Quoted 3 lines
include/drm/drm_gem.h +1
-1/** -* drm_gem_object_put_unlocked - drop a GEM buffer object reference +* drm_gem_object_put- drop a GEM buffer object reference ^Missing space.
Thanks fixed.
-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 12/36 drm/amd: remove _unlocked suffix in drm_object_put_unlocked
In reply to Emil VelikovFrom: Emil Velikov <[email protected]>
Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.
Just drop the suffix. It makes the API cleaner.
Done via the following script:
__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done
--- drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 20 ++++++++++---------- drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 6 +++--- drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 6 +++--- drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 6 +++--- drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 6 +++--- 10 files changed, 29 insertions(+), 29 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c +1 -1
@@ -102,7 +102,7 @@ int amdgpu_bo_list_create(struct amdgpu_device *adev, struct drm_file *filp, } bo =amdgpu_bo_ref (gem_to_amdgpu_bo (gobj)); -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj); usermm =amdgpu_ttm_tt_get_usermm (bo->tbo.ttm);if (usermm) {
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1 -1
@@ -57,7 +57,7 @@ static int amdgpu_cs_user_fence_chunk(struct amdgpu_cs_parser *p,/* One for TTM and one for the CS job */ p->uf_entry.tv.num_shared =2 ; -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj); size =amdgpu_bo_size (bo);if (size !=PAGE_SIZE || (data->offset +8 ) > size) {
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +2 -2
@@ -575,14 +575,14 @@ amdgpu_display_user_framebuffer_create(struct drm_device *dev, amdgpu_fb =kzalloc (sizeof (*amdgpu_fb),GFP_KERNEL );if (amdgpu_fb ==NULL ) { -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ERR_PTR (-ENOMEM ); } ret =amdgpu_display_framebuffer_init (dev, amdgpu_fb, mode_cmd, obj);if (ret) {kfree (amdgpu_fb); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ERR_PTR (ret); }
drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +1 -1
@@ -587,7 +587,7 @@ struct drm_gem_object *amdgpu_gem_prime_import(struct drm_device *dev, attach =dma_buf_dynamic_attach (dma_buf, dev->dev, &amdgpu_dma_buf_attach_ops, obj);if (IS_ERR (attach)) { -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ERR_CAST (attach); }
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +2 -2
@@ -114,7 +114,7 @@ static void amdgpufb_destroy_pinned_object(struct drm_gem_object *gobj)amdgpu_bo_unpin (abo);amdgpu_bo_unreserve (abo); } -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj); } static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev,
@@ -279,7 +279,7 @@ static int amdgpufb_create(struct drm_fb_helper *helper, }if (fb && ret) { -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);drm_framebuffer_unregister_private (fb);drm_framebuffer_cleanup (fb);kfree (fb);
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +10 -10
@@ -106,7 +106,7 @@ void amdgpu_gem_force_release(struct amdgpu_device *adev)spin_lock (&file->table_lock);idr_for_each_entry (&file->object_idr, gobj, handle) {WARN_ONCE (1 ,"And also active allocations!\n" ); -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj); }idr_destroy (&file->object_idr);spin_unlock (&file->table_lock);
@@ -272,7 +272,7 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data, r =drm_gem_handle_create (filp, gobj, &handle);/* drop reference from allocate - handle holds it now */ -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);if (r)return r;
@@ -356,7 +356,7 @@ int amdgpu_gem_userptr_ioctl(struct drm_device *dev, void *data,amdgpu_ttm_tt_get_user_pages_done (bo->tbo.ttm); release_object: -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);return r; }
@@ -375,11 +375,11 @@ int amdgpu_mode_dumb_mmap(struct drm_file *filp, robj =gem_to_amdgpu_bo (gobj);if (amdgpu_ttm_tt_get_usermm (robj->tbo.ttm) || (robj->flags &AMDGPU_GEM_CREATE_NO_CPU_ACCESS )) { -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);return -EPERM ; } *offset_p =amdgpu_bo_mmap_offset (robj); -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);return 0 ; }
@@ -449,7 +449,7 @@ int amdgpu_gem_wait_idle_ioctl(struct drm_device *dev, void *data, }else r = ret; -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);return r; }
@@ -492,7 +492,7 @@ int amdgpu_gem_metadata_ioctl(struct drm_device *dev, void *data, unreserve:amdgpu_bo_unreserve (robj); out: -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);return r; }
@@ -691,7 +691,7 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data,ttm_eu_backoff_reservation (&ticket, &list); error_unref: -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);return r; }
@@ -767,7 +767,7 @@ int amdgpu_gem_op_ioctl(struct drm_device *dev, void *data, } out: -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);return r; }
@@ -804,7 +804,7 @@ int amdgpu_mode_dumb_create(struct drm_file *file_priv, r =drm_gem_handle_create (file_priv, gobj, &handle);/* drop reference from allocate - handle holds it now */ -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);if (r) {return r; }
drivers/gpu/drm/amd/amdgpu/dce_v10_0.c +3 -3
@@ -2404,7 +2404,7 @@ static int dce_v10_0_crtc_cursor_set2(struct drm_crtc *crtc, aobj =gem_to_amdgpu_bo (obj); ret =amdgpu_bo_reserve (aobj, false);if (ret !=0 ) { -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; }
@@ -2412,7 +2412,7 @@ static int dce_v10_0_crtc_cursor_set2(struct drm_crtc *crtc,amdgpu_bo_unreserve (aobj);if (ret) {DRM_ERROR ("Failed to pin new cursor BO (%d)\n" , ret); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; } amdgpu_crtc->cursor_addr =amdgpu_bo_gpu_offset (aobj);
@@ -2447,7 +2447,7 @@ static int dce_v10_0_crtc_cursor_set2(struct drm_crtc *crtc,amdgpu_bo_unpin (aobj);amdgpu_bo_unreserve (aobj); } -drm_gem_object_put_unlocked (amdgpu_crtc->cursor_bo); +drm_gem_object_put (amdgpu_crtc->cursor_bo); } amdgpu_crtc->cursor_bo = obj;
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +3 -3
@@ -2483,7 +2483,7 @@ static int dce_v11_0_crtc_cursor_set2(struct drm_crtc *crtc, aobj =gem_to_amdgpu_bo (obj); ret =amdgpu_bo_reserve (aobj, false);if (ret !=0 ) { -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; }
@@ -2491,7 +2491,7 @@ static int dce_v11_0_crtc_cursor_set2(struct drm_crtc *crtc,amdgpu_bo_unreserve (aobj);if (ret) {DRM_ERROR ("Failed to pin new cursor BO (%d)\n" , ret); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; } amdgpu_crtc->cursor_addr =amdgpu_bo_gpu_offset (aobj);
@@ -2526,7 +2526,7 @@ static int dce_v11_0_crtc_cursor_set2(struct drm_crtc *crtc,amdgpu_bo_unpin (aobj);amdgpu_bo_unreserve (aobj); } -drm_gem_object_put_unlocked (amdgpu_crtc->cursor_bo); +drm_gem_object_put (amdgpu_crtc->cursor_bo); } amdgpu_crtc->cursor_bo = obj;
drivers/gpu/drm/amd/amdgpu/dce_v6_0.c +3 -3
@@ -2299,7 +2299,7 @@ static int dce_v6_0_crtc_cursor_set2(struct drm_crtc *crtc, aobj =gem_to_amdgpu_bo (obj); ret =amdgpu_bo_reserve (aobj, false);if (ret !=0 ) { -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; }
@@ -2307,7 +2307,7 @@ static int dce_v6_0_crtc_cursor_set2(struct drm_crtc *crtc,amdgpu_bo_unreserve (aobj);if (ret) {DRM_ERROR ("Failed to pin new cursor BO (%d)\n" , ret); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; } amdgpu_crtc->cursor_addr =amdgpu_bo_gpu_offset (aobj);
@@ -2342,7 +2342,7 @@ static int dce_v6_0_crtc_cursor_set2(struct drm_crtc *crtc,amdgpu_bo_unpin (aobj);amdgpu_bo_unreserve (aobj); } -drm_gem_object_put_unlocked (amdgpu_crtc->cursor_bo); +drm_gem_object_put (amdgpu_crtc->cursor_bo); } amdgpu_crtc->cursor_bo = obj;
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +3 -3
@@ -2305,7 +2305,7 @@ static int dce_v8_0_crtc_cursor_set2(struct drm_crtc *crtc, aobj =gem_to_amdgpu_bo (obj); ret =amdgpu_bo_reserve (aobj, false);if (ret !=0 ) { -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; }
@@ -2313,7 +2313,7 @@ static int dce_v8_0_crtc_cursor_set2(struct drm_crtc *crtc,amdgpu_bo_unreserve (aobj);if (ret) {DRM_ERROR ("Failed to pin new cursor BO (%d)\n" , ret); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; } amdgpu_crtc->cursor_addr =amdgpu_bo_gpu_offset (aobj);
@@ -2348,7 +2348,7 @@ static int dce_v8_0_crtc_cursor_set2(struct drm_crtc *crtc,amdgpu_bo_unpin (aobj);amdgpu_bo_unreserve (aobj); } -drm_gem_object_put_unlocked (amdgpu_crtc->cursor_bo); +drm_gem_object_put (amdgpu_crtc->cursor_bo); } amdgpu_crtc->cursor_bo = obj;
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Christian König
maintainerRe: [PATCH 12/36] drm/amd: remove _unlocked suffix in drm_object_put_unlocked
Am 07.05.20 um 17:07 schrieb Emil Velikov:
Quoted 7 lines
From: Emil Velikov <[email protected]>
Spelling out
_unlockedfor each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involvingstruct_mutex.Just drop the suffix. It makes the API cleaner.
In general sounds like a good idea to me, but I don't see the full patchset in my mailbox.
With the current code this change would probably trigger the "WARN_ON(!mutex_is_locked(&obj->dev->struct_mutex));" in drm_gem_object_put().
Christian.
Quoted 314 lines
Done via the following script:
__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for__filein $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
doneCc Alex Deucher <[email protected]>Cc "Christian König" <[email protected]>Cc "David (ChunMing) Zhou" <[email protected]>Signed-off-by Emil Velikov <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 20 ++++++++++---------- drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 6 +++--- drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 6 +++--- drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 6 +++--- drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 6 +++--- 10 files changed, 29 insertions(+), 29 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c +1
-1@@ -102,7 +102,7 @@ int amdgpu_bo_list_create(struct amdgpu_device *adev, struct drm_file *filp, } bo =amdgpu_bo_ref (gem_to_amdgpu_bo (gobj)); -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj); usermm =amdgpu_ttm_tt_get_usermm (bo->tbo.ttm);if (usermm) {drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1
-1@@ -57,7 +57,7 @@ static int amdgpu_cs_user_fence_chunk(struct amdgpu_cs_parser *p,/* One for TTM and one for the CS job */ p->uf_entry.tv.num_shared =2 ; -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj); size =amdgpu_bo_size (bo);if (size !=PAGE_SIZE || (data->offset +8 ) > size) {drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +2
-2@@ -575,14 +575,14 @@ amdgpu_display_user_framebuffer_create(struct drm_device *dev, amdgpu_fb =kzalloc (sizeof (*amdgpu_fb),GFP_KERNEL );if (amdgpu_fb ==NULL ) { -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ERR_PTR (-ENOMEM ); } ret =amdgpu_display_framebuffer_init (dev, amdgpu_fb, mode_cmd, obj);if (ret) {kfree (amdgpu_fb); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ERR_PTR (ret); }drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +1
-1@@ -587,7 +587,7 @@ struct drm_gem_object *amdgpu_gem_prime_import(struct drm_device *dev, attach =dma_buf_dynamic_attach (dma_buf, dev->dev, &amdgpu_dma_buf_attach_ops, obj);if (IS_ERR (attach)) { -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ERR_CAST (attach); }drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +2
-2@@ -114,7 +114,7 @@ static void amdgpufb_destroy_pinned_object(struct drm_gem_object *gobj)amdgpu_bo_unpin (abo);amdgpu_bo_unreserve (abo); } -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj); } static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev,@@ -279,7 +279,7 @@ static int amdgpufb_create(struct drm_fb_helper *helper, }if (fb && ret) { -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);drm_framebuffer_unregister_private (fb);drm_framebuffer_cleanup (fb);kfree (fb);drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +10
-10@@ -106,7 +106,7 @@ void amdgpu_gem_force_release(struct amdgpu_device *adev)spin_lock (&file->table_lock);idr_for_each_entry (&file->object_idr, gobj, handle) {WARN_ONCE (1 ,"And also active allocations!\n" ); -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj); }idr_destroy (&file->object_idr);spin_unlock (&file->table_lock);@@ -272,7 +272,7 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data, r =drm_gem_handle_create (filp, gobj, &handle);/* drop reference from allocate - handle holds it now */ -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);if (r)return r;@@ -356,7 +356,7 @@ int amdgpu_gem_userptr_ioctl(struct drm_device *dev, void *data,amdgpu_ttm_tt_get_user_pages_done (bo->tbo.ttm); release_object: -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);return r; }@@ -375,11 +375,11 @@ int amdgpu_mode_dumb_mmap(struct drm_file *filp, robj =gem_to_amdgpu_bo (gobj);if (amdgpu_ttm_tt_get_usermm (robj->tbo.ttm) || (robj->flags &AMDGPU_GEM_CREATE_NO_CPU_ACCESS )) { -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);return -EPERM ; } *offset_p =amdgpu_bo_mmap_offset (robj); -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);return 0 ; }@@ -449,7 +449,7 @@ int amdgpu_gem_wait_idle_ioctl(struct drm_device *dev, void *data, }else r = ret; -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);return r; }@@ -492,7 +492,7 @@ int amdgpu_gem_metadata_ioctl(struct drm_device *dev, void *data, unreserve:amdgpu_bo_unreserve (robj); out: -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);return r; }@@ -691,7 +691,7 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data,ttm_eu_backoff_reservation (&ticket, &list); error_unref: -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);return r; }@@ -767,7 +767,7 @@ int amdgpu_gem_op_ioctl(struct drm_device *dev, void *data, } out: -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);return r; }@@ -804,7 +804,7 @@ int amdgpu_mode_dumb_create(struct drm_file *file_priv, r =drm_gem_handle_create (file_priv, gobj, &handle);/* drop reference from allocate - handle holds it now */ -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);if (r) {return r; }drivers/gpu/drm/amd/amdgpu/dce_v10_0.c +3
-3@@ -2404,7 +2404,7 @@ static int dce_v10_0_crtc_cursor_set2(struct drm_crtc *crtc, aobj =gem_to_amdgpu_bo (obj); ret =amdgpu_bo_reserve (aobj, false);if (ret !=0 ) { -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; }@@ -2412,7 +2412,7 @@ static int dce_v10_0_crtc_cursor_set2(struct drm_crtc *crtc,amdgpu_bo_unreserve (aobj);if (ret) {DRM_ERROR ("Failed to pin new cursor BO (%d)\n" , ret); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; } amdgpu_crtc->cursor_addr =amdgpu_bo_gpu_offset (aobj);@@ -2447,7 +2447,7 @@ static int dce_v10_0_crtc_cursor_set2(struct drm_crtc *crtc,amdgpu_bo_unpin (aobj);amdgpu_bo_unreserve (aobj); } -drm_gem_object_put_unlocked (amdgpu_crtc->cursor_bo); +drm_gem_object_put (amdgpu_crtc->cursor_bo); } amdgpu_crtc->cursor_bo = obj;drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +3
-3@@ -2483,7 +2483,7 @@ static int dce_v11_0_crtc_cursor_set2(struct drm_crtc *crtc, aobj =gem_to_amdgpu_bo (obj); ret =amdgpu_bo_reserve (aobj, false);if (ret !=0 ) { -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; }@@ -2491,7 +2491,7 @@ static int dce_v11_0_crtc_cursor_set2(struct drm_crtc *crtc,amdgpu_bo_unreserve (aobj);if (ret) {DRM_ERROR ("Failed to pin new cursor BO (%d)\n" , ret); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; } amdgpu_crtc->cursor_addr =amdgpu_bo_gpu_offset (aobj);@@ -2526,7 +2526,7 @@ static int dce_v11_0_crtc_cursor_set2(struct drm_crtc *crtc,amdgpu_bo_unpin (aobj);amdgpu_bo_unreserve (aobj); } -drm_gem_object_put_unlocked (amdgpu_crtc->cursor_bo); +drm_gem_object_put (amdgpu_crtc->cursor_bo); } amdgpu_crtc->cursor_bo = obj;drivers/gpu/drm/amd/amdgpu/dce_v6_0.c +3
-3@@ -2299,7 +2299,7 @@ static int dce_v6_0_crtc_cursor_set2(struct drm_crtc *crtc, aobj =gem_to_amdgpu_bo (obj); ret =amdgpu_bo_reserve (aobj, false);if (ret !=0 ) { -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; }@@ -2307,7 +2307,7 @@ static int dce_v6_0_crtc_cursor_set2(struct drm_crtc *crtc,amdgpu_bo_unreserve (aobj);if (ret) {DRM_ERROR ("Failed to pin new cursor BO (%d)\n" , ret); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; } amdgpu_crtc->cursor_addr =amdgpu_bo_gpu_offset (aobj);@@ -2342,7 +2342,7 @@ static int dce_v6_0_crtc_cursor_set2(struct drm_crtc *crtc,amdgpu_bo_unpin (aobj);amdgpu_bo_unreserve (aobj); } -drm_gem_object_put_unlocked (amdgpu_crtc->cursor_bo); +drm_gem_object_put (amdgpu_crtc->cursor_bo); } amdgpu_crtc->cursor_bo = obj;drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +2
-2@@ -2305,7 +2305,7 @@ static int dce_v8_0_crtc_cursor_set2(struct drm_crtc *crtc, aobj =gem_to_amdgpu_bo (obj); ret =amdgpu_bo_reserve (aobj, false);if (ret !=0 ) { -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; }@@ -2313,7 +2313,7 @@ static int dce_v8_0_crtc_cursor_set2(struct drm_crtc *crtc,amdgpu_bo_unreserve (aobj);if (ret) {DRM_ERROR ("Failed to pin new cursor BO (%d)\n" , ret); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; } amdgpu_crtc->cursor_addr =amdgpu_bo_gpu_offset (aobj);
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c static int dce_v8_0_crtc_cursor_set2(struct drm_crtc *crtc, · line 2354
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +1
-1@@ -2348,7 +2348,7 @@ static int dce_v8_0_crtc_cursor_set2(struct drm_crtc *crtc,amdgpu_bo_unpin (aobj);amdgpu_bo_unreserve (aobj); } -drm_gem_object_put_unlocked (amdgpu_crtc->cursor_bo); +drm_gem_object_put (amdgpu_crtc->cursor_bo); } amdgpu_crtc->cursor_bo = obj;
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 12/36] drm/amd: remove _unlocked suffix in drm_object_put_unlocked
Hi Christian,
Quoted 4 lines · Christian König
Am 07.05.20 um 17:07 schrieb Emil Velikov:
Quoted 2 lines
From: Emil Velikov <[email protected]>
Quoted 9 lines
Quoted 5 lines
Spelling out
_unlockedfor each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involvingstruct_mutex.Just drop the suffix. It makes the API cleaner.
In general sounds like a good idea to me, but I don't see the full patchset in my mailbox.
The series is quite long, you can see it here
https://patchwork.freedesktop.org/series/77043/
Quoted 4 lines
With the current code this change would probably trigger the "WARN_ON(!mutex_is_locked(&obj->dev->struct_mutex));" in
drm_gem_object_put().
Earlier patch renames drm_gem_object_put, adding explicit "_locked" suffix to it.
If the series is applied atomically, then that issue will not happen. Doing so might cause trivial merge conflicts, for individual drivers. Nothing a simple build check won't highlight/catch.
Although if the AMD team has pending work which will seriously clash with this, could delay the "remove _unlocked suffix" part of the series.
-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 13/36 drm/arm: remove _unlocked suffix in drm_object_put_unlocked
In reply to Emil VelikovFrom: Emil Velikov <[email protected]>
Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.
Just drop the suffix. It makes the API cleaner.
Done via the following script:
__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done
--- drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c | 6 +++--- drivers/gpu/drm/arm/malidp_drv.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c +3 -3
@@ -19,7 +19,7 @@ static void komeda_fb_destroy(struct drm_framebuffer *fb)u32 i;for (i =0 ; i < fb->format->num_planes; i++) -drm_gem_object_put_unlocked (fb->obj[i]); +drm_gem_object_put (fb->obj[i]);drm_framebuffer_cleanup (fb);kfree (kfb);
@@ -103,7 +103,7 @@ komeda_fb_afbc_size_check(struct komeda_fb *kfb, struct drm_file *file,return 0 ; check_failed: -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return -EINVAL ; }
@@ -199,7 +199,7 @@ komeda_fb_create(struct drm_device *dev, struct drm_file *file, err_cleanup:for (i =0 ; i < kfb->base.format->num_planes; i++) -drm_gem_object_put_unlocked (kfb->base.obj[i]); +drm_gem_object_put (kfb->base.obj[i]);kfree (kfb);return ERR_PTR (ret);
drivers/gpu/drm/arm/malidp_drv.c +2 -2
@@ -349,11 +349,11 @@ malidp_verify_afbc_framebuffer_size(struct drm_device *dev,if (objs->size < afbc_size) {DRM_DEBUG_KMS ("buffer size (%zu) too small for AFBC buffer size = %u\n" , objs->size, afbc_size); -drm_gem_object_put_unlocked (objs); +drm_gem_object_put (objs);return false; } -drm_gem_object_put_unlocked (objs); +drm_gem_object_put (objs);return true; }
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 13/36] drm/arm: remove _unlocked suffix in drm_object_put_unlocked
Quoted 10 lines · Emil Velikov
From: Emil Velikov <[email protected]>
Spelling out
_unlockedfor each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involvingstruct_mutex.Just drop the suffix. It makes the API cleaner.
Done via the following script:
Quoted 7 lines
__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for__filein $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
doneCc Liviu Dudau <[email protected]>
Thanks for the cleanup!
Best regards,
Liviu
Quoted 60 lines
Cc Brian Starkey <[email protected]>Cc David Airlie <[email protected]>Signed-off-by Emil Velikov <[email protected]>--- drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c | 6 +++--- drivers/gpu/drm/arm/malidp_drv.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-)drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c +3
-3@@ -19,7 +19,7 @@ static void komeda_fb_destroy(struct drm_framebuffer *fb)u32 i;for (i =0 ; i < fb->format->num_planes; i++) -drm_gem_object_put_unlocked (fb->obj[i]); +drm_gem_object_put (fb->obj[i]);drm_framebuffer_cleanup (fb);kfree (kfb);@@ -103,7 +103,7 @@ komeda_fb_afbc_size_check(struct komeda_fb *kfb, struct drm_file *file,return 0 ; check_failed: -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return -EINVAL ; }@@ -199,7 +199,7 @@ komeda_fb_create(struct drm_device *dev, struct drm_file *file, err_cleanup:for (i =0 ; i < kfb->base.format->num_planes; i++) -drm_gem_object_put_unlocked (kfb->base.obj[i]); +drm_gem_object_put (kfb->base.obj[i]);kfree (kfb);return ERR_PTR (ret);drivers/gpu/drm/arm/malidp_drv.c +2
-2@@ -349,11 +349,11 @@ malidp_verify_afbc_framebuffer_size(struct drm_device *dev,if (objs->size < afbc_size) {DRM_DEBUG_KMS ("buffer size (%zu) too small for AFBC buffer size = %u\n" , objs->size, afbc_size); -drm_gem_object_put_unlocked (objs); +drm_gem_object_put (objs);return false; } -drm_gem_object_put_unlocked (objs); +drm_gem_object_put (objs);return true; }Signature · 1 line
2.25.1
Signature · 12 lines
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-develPATCH 14/36 drm/armada: remove _unlocked suffix in drm_object_put_unlocked
In reply to Emil VelikovFrom: Emil Velikov <[email protected]>
Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.
Just drop the suffix. It makes the API cleaner.
Done via the following script:
__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done
--- drivers/gpu/drm/armada/armada_crtc.c | 8 ++++---- drivers/gpu/drm/armada/armada_fb.c | 4 ++-- drivers/gpu/drm/armada/armada_fbdev.c | 6 +++--- drivers/gpu/drm/armada/armada_gem.c | 10 +++++----- 4 files changed, 14 insertions(+), 14 deletions(-)
drivers/gpu/drm/armada/armada_crtc.c +4 -4
@@ -710,13 +710,13 @@ static int armada_drm_crtc_cursor_set(struct drm_crtc *crtc,/* Must be a kernel-mapped object */ if (!obj->addr) { -drm_gem_object_put_unlocked (&obj->obj); +drm_gem_object_put (&obj->obj);return -EINVAL ; }if (obj->obj.size < w * h *4 ) {DRM_ERROR ("buffer is too small\n" ); -drm_gem_object_put_unlocked (&obj->obj); +drm_gem_object_put (&obj->obj);return -ENOMEM ; } }
@@ -724,7 +724,7 @@ static int armada_drm_crtc_cursor_set(struct drm_crtc *crtc,if (dcrtc->cursor_obj) { dcrtc->cursor_obj->update =NULL ; dcrtc->cursor_obj->update_data =NULL ; -drm_gem_object_put_unlocked (&dcrtc->cursor_obj->obj); +drm_gem_object_put (&dcrtc->cursor_obj->obj); } dcrtc->cursor_obj = obj; dcrtc->cursor_w = w;
@@ -760,7 +760,7 @@ static void armada_drm_crtc_destroy(struct drm_crtc *crtc)struct armada_private *priv = crtc->dev->dev_private;if (dcrtc->cursor_obj) -drm_gem_object_put_unlocked (&dcrtc->cursor_obj->obj); +drm_gem_object_put (&dcrtc->cursor_obj->obj); priv->dcrtc[dcrtc->num] =NULL ;drm_crtc_cleanup (&dcrtc->crtc);
drivers/gpu/drm/armada/armada_fb.c +2 -2
@@ -129,12 +129,12 @@ struct drm_framebuffer *armada_fb_create(struct drm_device *dev, goto err; } -drm_gem_object_put_unlocked (&obj->obj); +drm_gem_object_put (&obj->obj);return &dfb->fb; err_unref: -drm_gem_object_put_unlocked (&obj->obj); +drm_gem_object_put (&obj->obj); err:DRM_ERROR ("failed to initialize framebuffer: %d\n" , ret);return ERR_PTR (ret);
drivers/gpu/drm/armada/armada_fbdev.c +3 -3
@@ -51,13 +51,13 @@ static int armada_fbdev_create(struct drm_fb_helper *fbh, ret =armada_gem_linear_back (dev, obj);if (ret) { -drm_gem_object_put_unlocked (&obj->obj); +drm_gem_object_put (&obj->obj);return ret; } ptr =armada_gem_map_object (dev, obj);if (!ptr) { -drm_gem_object_put_unlocked (&obj->obj); +drm_gem_object_put (&obj->obj);return -ENOMEM ; }
@@ -67,7 +67,7 @@ static int armada_fbdev_create(struct drm_fb_helper *fbh,* A reference is now held by the framebuffer object if * successful, otherwise this drops the ref for the error path. */ -drm_gem_object_put_unlocked (&obj->obj); +drm_gem_object_put (&obj->obj);if (IS_ERR (dfb))return PTR_ERR (dfb);
drivers/gpu/drm/armada/armada_gem.c +5 -5
@@ -256,7 +256,7 @@ int armada_gem_dumb_create(struct drm_file *file, struct drm_device *dev,/* drop reference from allocate - handle holds it now */ DRM_DEBUG_DRIVER ("obj %p size %zu handle %#x\n" , dobj, size, handle); err: -drm_gem_object_put_unlocked (&dobj->obj); +drm_gem_object_put (&dobj->obj);return ret; }
@@ -288,7 +288,7 @@ int armada_gem_create_ioctl(struct drm_device *dev, void *data,/* drop reference from allocate - handle holds it now */ DRM_DEBUG_DRIVER ("obj %p size %zu handle %#x\n" , dobj, size, handle); err: -drm_gem_object_put_unlocked (&dobj->obj); +drm_gem_object_put (&dobj->obj);return ret; }
@@ -305,13 +305,13 @@ int armada_gem_mmap_ioctl(struct drm_device *dev, void *data,return -ENOENT ;if (!dobj->obj.filp) { -drm_gem_object_put_unlocked (&dobj->obj); +drm_gem_object_put (&dobj->obj);return -EINVAL ; } addr =vm_mmap (dobj->obj.filp,0 , args->size,PROT_READ |PROT_WRITE ,MAP_SHARED , args->offset); -drm_gem_object_put_unlocked (&dobj->obj); +drm_gem_object_put (&dobj->obj);if (IS_ERR_VALUE (addr))return addr;
@@ -366,7 +366,7 @@ int armada_gem_pwrite_ioctl(struct drm_device *dev, void *data, } unref: -drm_gem_object_put_unlocked (&dobj->obj); +drm_gem_object_put (&dobj->obj);return ret; }
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 15/36 drm/etnaviv: remove _unlocked suffix in drm_object_put_unlocked
In reply to Emil VelikovFrom: Emil Velikov <[email protected]>
Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.
Just drop the suffix. It makes the API cleaner.
Done via the following script:
__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done
--- drivers/gpu/drm/etnaviv/etnaviv_drv.c | 8 ++++---- drivers/gpu/drm/etnaviv/etnaviv_gem.c | 6 +++--- drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c | 2 +- drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-)
drivers/gpu/drm/etnaviv/etnaviv_drv.c +4 -4
@@ -289,7 +289,7 @@ static int etnaviv_ioctl_gem_cpu_prep(struct drm_device *dev, void *data, ret =etnaviv_gem_cpu_prep (obj, args->op, &args->timeout); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; }
@@ -310,7 +310,7 @@ static int etnaviv_ioctl_gem_cpu_fini(struct drm_device *dev, void *data, ret =etnaviv_gem_cpu_fini (obj); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; }
@@ -330,7 +330,7 @@ static int etnaviv_ioctl_gem_info(struct drm_device *dev, void *data,return -ENOENT ; ret =etnaviv_gem_mmap_offset (obj, &args->offset); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; }
@@ -413,7 +413,7 @@ static int etnaviv_ioctl_gem_wait(struct drm_device *dev, void *data, ret =etnaviv_gem_wait_bo (gpu, obj, timeout); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; }
drivers/gpu/drm/etnaviv/etnaviv_gem.c +3 -3
@@ -244,7 +244,7 @@ void etnaviv_gem_mapping_unreference(struct etnaviv_vram_mapping *mapping) mapping->use -=1 ;mutex_unlock (&etnaviv_obj->lock); -drm_gem_object_put_unlocked (&etnaviv_obj->base); +drm_gem_object_put (&etnaviv_obj->base); } struct etnaviv_vram_mapping *etnaviv_gem_mapping_get(
@@ -633,7 +633,7 @@ int etnaviv_gem_new_handle(struct drm_device *dev, struct drm_file *file,/* drop reference from allocate - handle holds it now */ fail: -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; }
@@ -742,6 +742,6 @@ int etnaviv_gem_new_userptr(struct drm_device *dev, struct drm_file *file, ret =drm_gem_handle_create (file, &etnaviv_obj->base, handle);/* drop reference from allocate - handle holds it now */ -drm_gem_object_put_unlocked (&etnaviv_obj->base); +drm_gem_object_put (&etnaviv_obj->base);return ret; }
drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c +1 -1
@@ -136,7 +136,7 @@ struct drm_gem_object *etnaviv_gem_prime_import_sg_table(struct drm_device *dev,return &etnaviv_obj->base; fail: -drm_gem_object_put_unlocked (&etnaviv_obj->base); +drm_gem_object_put (&etnaviv_obj->base);return ERR_PTR (ret); }
drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c +1 -1
@@ -396,7 +396,7 @@ static void submit_cleanup(struct kref *kref)/* if the GPU submit failed, objects might still be locked */ submit_unlock_object (submit, i); -drm_gem_object_put_unlocked (&etnaviv_obj->base); +drm_gem_object_put (&etnaviv_obj->base); }wake_up_all (&submit->gpu->fence_event);
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 16/36 drm/exynos: remove _unlocked suffix in drm_object_put_unlocked
In reply to Emil VelikovFrom: Emil Velikov <[email protected]>
Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.
Just drop the suffix. It makes the API cleaner.
Done via the following script:
__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done
--- drivers/gpu/drm/exynos/exynos_drm_gem.c | 4 ++-- drivers/gpu/drm/exynos/exynos_drm_gem.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_gem.c +2 -2
@@ -139,7 +139,7 @@ static int exynos_drm_gem_handle_create(struct drm_gem_object *obj,DRM_DEV_DEBUG_KMS (to_dma_dev (obj->dev),"gem handle = 0x%x\n" , *handle);/* drop reference from allocate - handle holds it now. */ -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return 0 ; }
@@ -333,7 +333,7 @@ int exynos_drm_gem_get_ioctl(struct drm_device *dev, void *data, args->flags = exynos_gem->flags; args->size = exynos_gem->size; -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return 0 ; }
drivers/gpu/drm/exynos/exynos_drm_gem.h +1 -1
@@ -86,7 +86,7 @@ struct exynos_drm_gem *exynos_drm_gem_get(struct drm_file *filp,*/ static inline void exynos_drm_gem_put (struct exynos_drm_gem *exynos_gem) { -drm_gem_object_put_unlocked (&exynos_gem->base); +drm_gem_object_put (&exynos_gem->base); }/* get buffer information to memory region allocated by gem. */
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 17/36 drm/gma500: remove _unlocked suffix in drm_object_put_unlocked
In reply to Emil VelikovFrom: Emil Velikov <[email protected]>
Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.
Just drop the suffix. It makes the API cleaner.
Done via the following script:
__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done
--- drivers/gpu/drm/gma500/framebuffer.c | 2 +- drivers/gpu/drm/gma500/gem.c | 2 +- drivers/gpu/drm/gma500/gma_display.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/gma500/framebuffer.c +1 -1
@@ -491,7 +491,7 @@ static int psb_fbdev_destroy(struct drm_device *dev,drm_framebuffer_cleanup (fb);if (fb->obj[0 ]) -drm_gem_object_put_unlocked (fb->obj[0 ]); +drm_gem_object_put (fb->obj[0 ]);kfree (fb);return 0 ;
drivers/gpu/drm/gma500/gem.c +1 -1
@@ -82,7 +82,7 @@ int psb_gem_create(struct drm_file *file, struct drm_device *dev, u64 size,return ret; }/* We have the initial and handle reference but need only one now */ -drm_gem_object_put_unlocked (&r->gem); +drm_gem_object_put (&r->gem); *handlep = handle;return 0 ; }
drivers/gpu/drm/gma500/gma_display.c +3 -3
@@ -351,7 +351,7 @@ int gma_crtc_cursor_set(struct drm_crtc *crtc, gt =container_of (gma_crtc->cursor_obj, struct gtt_range, gem);psb_gtt_unpin (gt); -drm_gem_object_put_unlocked (gma_crtc->cursor_obj); +drm_gem_object_put (gma_crtc->cursor_obj); gma_crtc->cursor_obj =NULL ; }return 0 ;
@@ -427,7 +427,7 @@ int gma_crtc_cursor_set(struct drm_crtc *crtc,if (gma_crtc->cursor_obj) { gt = container_of(gma_crtc->cursor_obj, struct gtt_range, gem);psb_gtt_unpin (gt); -drm_gem_object_put_unlocked (gma_crtc->cursor_obj); +drm_gem_object_put (gma_crtc->cursor_obj); } gma_crtc->cursor_obj = obj;
@@ -435,7 +435,7 @@ int gma_crtc_cursor_set(struct drm_crtc *crtc,return ret; unref_cursor: -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; }
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 18/36 drm/i915: remove _unlocked suffix in drm_object_put_unlocked
In reply to Emil VelikovFrom: Emil Velikov <[email protected]>
Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.
Just drop the suffix. It makes the API cleaner.
Done via the following script:
__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done
--- drivers/gpu/drm/i915/gem/i915_gem_object.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/gem/i915_gem_object.h +1 -1
@@ -105,7 +105,7 @@ __attribute__((nonnull))static inline void i915_gem_object_put (struct drm_i915_gem_object *obj) { -drm_gem_object_put_unlocked (&obj->base); +drm_gem_object_put (&obj->base); }#define assert_object_held (obj) dma_resv_assert_held((obj)->base.resv)
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 19/36 drm/lima: remove _unlocked suffix in drm_object_put_unlocked
In reply to Emil VelikovFrom: Emil Velikov <[email protected]>
Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.
Just drop the suffix. It makes the API cleaner.
Done via the following script:
__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done
--- drivers/gpu/drm/lima/lima_gem.c | 10 +++++----- drivers/gpu/drm/lima/lima_sched.c | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/lima/lima_gem.c +5 -5
@@ -134,7 +134,7 @@ int lima_gem_create_handle(struct drm_device *dev, struct drm_file *file, out:/* drop reference from allocate - handle holds it now */ -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return err; }
@@ -243,7 +243,7 @@ int lima_gem_get_info(struct drm_file *file, u32 handle, u32 *va, u64 *offset) *offset =drm_vma_node_offset_addr (&obj->vma_node); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return 0 ; }
@@ -323,7 +323,7 @@ int lima_gem_submit(struct drm_file *file, struct lima_submit *submit)*/ err =lima_vm_bo_add (vm, bo, false);if (err) { -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj); goto err_out0; }
@@ -368,7 +368,7 @@ int lima_gem_submit(struct drm_file *file, struct lima_submit *submit) submit->nr_bos, &ctx);for (i =0 ; i < submit->nr_bos; i++) -drm_gem_object_put_unlocked (&bos[i]->base.base); +drm_gem_object_put (&bos[i]->base.base);if (out_sync) {drm_syncobj_replace_fence (out_sync, fence);
@@ -389,7 +389,7 @@ int lima_gem_submit(struct drm_file *file, struct lima_submit *submit)if (!bos[i])break ;lima_vm_bo_del (vm, bos[i]); -drm_gem_object_put_unlocked (&bos[i]->base.base); +drm_gem_object_put (&bos[i]->base.base); }if (out_sync)drm_syncobj_put (out_sync);
drivers/gpu/drm/lima/lima_sched.c +1 -1
@@ -151,7 +151,7 @@ void lima_sched_task_fini(struct lima_sched_task *task)if (task->bos) {for (i =0 ; i < task->num_bos; i++) -drm_gem_object_put_unlocked (&task->bos[i]->base.base); +drm_gem_object_put (&task->bos[i]->base.base);kfree (task->bos); }
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 20/36 drm/mediatek: remove _unlocked suffix in drm_object_put_unlocked
In reply to Emil VelikovFrom: Emil Velikov <[email protected]>
Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.
Just drop the suffix. It makes the API cleaner.
Done via the following script:
__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done
--- drivers/gpu/drm/mediatek/mtk_drm_gem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/mediatek/mtk_drm_gem.c +1 -1
@@ -117,7 +117,7 @@ int mtk_drm_gem_dumb_create(struct drm_file *file_priv, struct drm_device *dev, goto err_handle_create;/* drop reference from allocate - handle holds it now. */ -drm_gem_object_put_unlocked (&mtk_gem->base); +drm_gem_object_put (&mtk_gem->base);return 0 ;
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 20/36] drm/mediatek: remove _unlocked suffix in drm_object_put_unlocked
Hi, Emil:
Emil Velikov <[email protected]> 於 2020年5月7日 週四 下午11:11寫道:
Quoted 9 lines
From: Emil Velikov <[email protected]>
Spelling out
_unlockedfor each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involvingstruct_mutex.Just drop the suffix. It makes the API cleaner.
Quoted 7 lines
Done via the following script:
__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for__filein $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done
Quoted 23 lines
Cc Chun-Kuang Hu <[email protected]>Cc Philipp Zabel <[email protected]>Cc David Airlie <[email protected]>Signed-off-by Emil Velikov <[email protected]>--- drivers/gpu/drm/mediatek/mtk_drm_gem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/mediatek/mtk_drm_gem.c +1
-2@@ -117,7 +117,7 @@ int mtk_drm_gem_dumb_create(struct drm_file *file_priv, struct drm_device *dev, goto err_handle_create;/* drop reference from allocate - handle holds it now. */ -drm_gem_object_put_unlocked (&mtk_gem->base); +drm_gem_object_put (&mtk_gem->base);return 0 ; --
Quoted 2 lines
2.25.1
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 21/36 drm/mgag200: remove _unlocked suffix in drm_object_put_unlocked
In reply to Emil VelikovFrom: Emil Velikov <[email protected]>
Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.
Just drop the suffix. It makes the API cleaner.
Done via the following script:
__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done
--- drivers/gpu/drm/mgag200/mgag200_cursor.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/mgag200/mgag200_cursor.c +4 -4
@@ -286,7 +286,7 @@ int mgag200_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv, ret =PTR_ERR (src);dev_err (&dev->pdev->dev,"failed to map user buffer updates\n" ); - goto err_drm_gem_object_put_unlocked; + goto err_drm_gem_object_put; } ret =mgag200_show_cursor (mdev, src, width, height);
@@ -295,13 +295,13 @@ int mgag200_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,/* Now update internal buffer pointers */ drm_gem_vram_vunmap (gbo, src); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return 0 ; err_drm_gem_vram_vunmap:drm_gem_vram_vunmap (gbo, src); -err_drm_gem_object_put_unlocked: -drm_gem_object_put_unlocked (obj); +err_drm_gem_object_put: +drm_gem_object_put (obj);return ret; }
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 21/36] drm/mgag200: remove _unlocked suffix in drm_object_put_unlocked
Hi
Am 07.05.20 um 17:08 schrieb Emil Velikov:
Quoted 16 lines
From: Emil Velikov <[email protected]>
Spelling out
_unlockedfor each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involvingstruct_mutex.Just drop the suffix. It makes the API cleaner.
Done via the following script:
__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for__filein $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done
Quoted 4 lines
Cc Dave Airlie <[email protected]>Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>Signed-off-by Emil Velikov <[email protected]>
Quoted 35 lines
--- drivers/gpu/drm/mgag200/mgag200_cursor.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/gpu/drm/mgag200/mgag200_cursor.c +4
-4@@ -286,7 +286,7 @@ int mgag200_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv, ret =PTR_ERR (src);dev_err (&dev->pdev->dev,"failed to map user buffer updates\n" ); - goto err_drm_gem_object_put_unlocked; + goto err_drm_gem_object_put; } ret =mgag200_show_cursor (mdev, src, width, height);@@ -295,13 +295,13 @@ int mgag200_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,/* Now update internal buffer pointers */ drm_gem_vram_vunmap (gbo, src); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return 0 ; err_drm_gem_vram_vunmap:drm_gem_vram_vunmap (gbo, src); -err_drm_gem_object_put_unlocked: -drm_gem_object_put_unlocked (obj); +err_drm_gem_object_put: +drm_gem_object_put (obj);return ret; }
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
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 22/36 drm/msm: remove _unlocked suffix in drm_object_put_unlocked
In reply to Emil VelikovFrom: Emil Velikov <[email protected]>
Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.
Just drop the suffix. It makes the API cleaner.
Done via the following script:
__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done
--- drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 6 +++--- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 2 +- drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c | 4 ++-- drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c | 2 +- drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 2 +- drivers/gpu/drm/msm/dsi/dsi_host.c | 2 +- drivers/gpu/drm/msm/msm_drv.c | 6 +++--- drivers/gpu/drm/msm/msm_fb.c | 4 ++-- drivers/gpu/drm/msm/msm_gem.c | 12 ++++++------ 9 files changed, 20 insertions(+), 20 deletions(-)
drivers/gpu/drm/msm/adreno/a5xx_gpu.c +3 -3
@@ -804,17 +804,17 @@ static void a5xx_destroy(struct msm_gpu *gpu)if (a5xx_gpu->pm4_bo) {msm_gem_unpin_iova (a5xx_gpu->pm4_bo, gpu->aspace); -drm_gem_object_put_unlocked (a5xx_gpu->pm4_bo); +drm_gem_object_put (a5xx_gpu->pm4_bo); }if (a5xx_gpu->pfp_bo) {msm_gem_unpin_iova (a5xx_gpu->pfp_bo, gpu->aspace); -drm_gem_object_put_unlocked (a5xx_gpu->pfp_bo); +drm_gem_object_put (a5xx_gpu->pfp_bo); }if (a5xx_gpu->gpmu_bo) {msm_gem_unpin_iova (a5xx_gpu->gpmu_bo, gpu->aspace); -drm_gem_object_put_unlocked (a5xx_gpu->gpmu_bo); +drm_gem_object_put (a5xx_gpu->gpmu_bo); }adreno_gpu_cleanup (adreno_gpu);
drivers/gpu/drm/msm/adreno/a6xx_gpu.c +1 -1
@@ -795,7 +795,7 @@ static void a6xx_destroy(struct msm_gpu *gpu)if (a6xx_gpu->sqe_bo) {msm_gem_unpin_iova (a6xx_gpu->sqe_bo, gpu->aspace); -drm_gem_object_put_unlocked (a6xx_gpu->sqe_bo); +drm_gem_object_put (a6xx_gpu->sqe_bo); }a6xx_gmu_remove (a6xx_gpu);
drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c +2 -2
@@ -119,7 +119,7 @@ static void unref_cursor_worker(struct drm_flip_work *work, void *val)struct msm_kms *kms = &mdp4_kms->base.base;msm_gem_unpin_iova (val, kms->aspace); -drm_gem_object_put_unlocked (val); +drm_gem_object_put (val); }static void mdp4_crtc_destroy (struct drm_crtc *crtc)
@@ -452,7 +452,7 @@ static int mdp4_crtc_cursor_set(struct drm_crtc *crtc,return 0 ; fail: -drm_gem_object_put_unlocked (cursor_bo); +drm_gem_object_put (cursor_bo);return ret; }
drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c +1 -1
@@ -165,7 +165,7 @@ static void mdp4_destroy(struct msm_kms *kms)if (mdp4_kms->blank_cursor_iova)msm_gem_unpin_iova (mdp4_kms->blank_cursor_bo, kms->aspace); -drm_gem_object_put_unlocked (mdp4_kms->blank_cursor_bo); +drm_gem_object_put (mdp4_kms->blank_cursor_bo);if (aspace) { aspace->mmu->funcs->detach (aspace->mmu);
drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c +1 -1
@@ -166,7 +166,7 @@ static void unref_cursor_worker(struct drm_flip_work *work, void *val)struct msm_kms *kms = &mdp5_kms->base.base;msm_gem_unpin_iova (val, kms->aspace); -drm_gem_object_put_unlocked (val); +drm_gem_object_put (val); }static void mdp5_crtc_destroy (struct drm_crtc *crtc)
drivers/gpu/drm/msm/dsi/dsi_host.c +1 -1
@@ -1132,7 +1132,7 @@ static void dsi_tx_buf_free(struct msm_dsi_host *msm_host) priv = dev->dev_private;if (msm_host->tx_gem_obj) {msm_gem_unpin_iova (msm_host->tx_gem_obj, priv->kms->aspace); -drm_gem_object_put_unlocked (msm_host->tx_gem_obj); +drm_gem_object_put (msm_host->tx_gem_obj); msm_host->tx_gem_obj =NULL ; }
drivers/gpu/drm/msm/msm_drv.c +3 -3
@@ -757,7 +757,7 @@ static int msm_ioctl_gem_cpu_prep(struct drm_device *dev, void *data, ret =msm_gem_cpu_prep (obj, args->op, &timeout); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; }
@@ -775,7 +775,7 @@ static int msm_ioctl_gem_cpu_fini(struct drm_device *dev, void *data, ret =msm_gem_cpu_fini (obj); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; }
@@ -867,7 +867,7 @@ static int msm_ioctl_gem_info(struct drm_device *dev, void *data,break ; } -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; }
drivers/gpu/drm/msm/msm_fb.c +2 -2
@@ -123,7 +123,7 @@ struct drm_framebuffer *msm_framebuffer_create(struct drm_device *dev, out_unref:for (i =0 ; i < n; i++) -drm_gem_object_put_unlocked (bos[i]); +drm_gem_object_put (bos[i]);return ERR_PTR (ret); }
@@ -238,7 +238,7 @@ msm_alloc_stolen_fb(struct drm_device *dev, int w, int h, int p, uint32_t format/* note: if fb creation failed, we can't rely on fb destroy * to unref the bo: */ -drm_gem_object_put_unlocked (bo); +drm_gem_object_put (bo);return ERR_CAST (fb); }
drivers/gpu/drm/msm/msm_gem.c +6 -6
@@ -543,7 +543,7 @@ int msm_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev, *offset =msm_gem_mmap_offset (obj); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj); fail:return ret;
@@ -970,7 +970,7 @@ int msm_gem_new_handle(struct drm_device *dev, struct drm_file *file, ret =drm_gem_handle_create (file, obj, handle);/* drop reference from allocate - handle holds it now */ -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; }
@@ -1089,7 +1089,7 @@ static struct drm_gem_object *_msm_gem_new(struct drm_device *dev,return obj; fail: -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ERR_PTR (ret); }
@@ -1149,7 +1149,7 @@ struct drm_gem_object *msm_gem_import(struct drm_device *dev,return obj; fail: -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ERR_PTR (ret); }
@@ -1185,7 +1185,7 @@ static void *_msm_gem_kernel_new(struct drm_device *dev, uint32_t size,if (locked)drm_gem_object_put_locked (obj);else -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ERR_PTR (ret);
@@ -1217,7 +1217,7 @@ void msm_gem_kernel_put(struct drm_gem_object *bo,if (locked)drm_gem_object_put_locked (bo);else -drm_gem_object_put_unlocked (bo); +drm_gem_object_put (bo); }void msm_gem_object_set_name (struct drm_gem_object *bo,const char *fmt, ...)
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 23/36 drm/nouveau: remove _unlocked suffix in drm_object_put_unlocked
In reply to Emil VelikovFrom: Emil Velikov <[email protected]>
Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.
Just drop the suffix. It makes the API cleaner.
Done via the following script:
__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done
--- drivers/gpu/drm/nouveau/dispnv04/crtc.c | 2 +- drivers/gpu/drm/nouveau/nouveau_abi16.c | 2 +- drivers/gpu/drm/nouveau/nouveau_display.c | 8 ++++---- drivers/gpu/drm/nouveau/nouveau_gem.c | 14 +++++++------- 4 files changed, 13 insertions(+), 13 deletions(-)
drivers/gpu/drm/nouveau/dispnv04/crtc.c +1 -1
@@ -1017,7 +1017,7 @@ nv04_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv, nv_crtc->cursor.set_offset (nv_crtc, nv_crtc->cursor.offset); nv_crtc->cursor.show (nv_crtc, true); out: -drm_gem_object_put_unlocked (gem); +drm_gem_object_put (gem);return ret; }
drivers/gpu/drm/nouveau/nouveau_abi16.c +1 -1
@@ -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->bo.base); +drm_gem_object_put (&chan->ntfy->bo.base); }if (chan->heap.block_size)
drivers/gpu/drm/nouveau/nouveau_display.c +4 -4
@@ -185,7 +185,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->bo.base); +drm_gem_object_put (&fb->nvbo->bo.base);drm_framebuffer_cleanup (drm_fb);kfree (fb);
@@ -267,7 +267,7 @@ nouveau_user_framebuffer_create(struct drm_device *dev,if (ret ==0 )return &fb->base; -drm_gem_object_put_unlocked (gem); +drm_gem_object_put (gem);return ERR_PTR (ret); }
@@ -648,7 +648,7 @@ nouveau_display_dumb_create(struct drm_file *file_priv, struct drm_device *dev,return ret; ret =drm_gem_handle_create (file_priv, &bo->bo.base, &args->handle); -drm_gem_object_put_unlocked (&bo->bo.base); +drm_gem_object_put (&bo->bo.base);return ret; }
@@ -663,7 +663,7 @@ nouveau_display_dumb_map_offset(struct drm_file *file_priv,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_unlocked (gem); +drm_gem_object_put (gem);return 0 ; }
drivers/gpu/drm/nouveau/nouveau_gem.c +7 -7
@@ -279,7 +279,7 @@ nouveau_gem_ioctl_new(struct drm_device *dev, void *data, }/* drop reference from allocate - handle holds it now */ -drm_gem_object_put_unlocked (&nvbo->bo.base); +drm_gem_object_put (&nvbo->bo.base);return ret; }
@@ -358,7 +358,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->bo.base); +drm_gem_object_put (&nvbo->bo.base); } }
@@ -405,14 +405,14 @@ validate_init(struct nouveau_channel *chan, struct drm_file *file_priv, nvbo =nouveau_gem_object (gem);if (nvbo == res_bo) { res_bo =NULL ; -drm_gem_object_put_unlocked (gem); +drm_gem_object_put (gem);continue ; }if (nvbo->reserved_by && nvbo->reserved_by == file_priv) {NV_PRINTK (err, cli,"multiple instances of buffer %d on " "validation list\n" , b->handle); -drm_gem_object_put_unlocked (gem); +drm_gem_object_put (gem); ret = -EINVAL ;break ; }
@@ -929,7 +929,7 @@ nouveau_gem_ioctl_cpu_prep(struct drm_device *dev, void *data, ret = lret;nouveau_bo_sync_for_cpu (nvbo); -drm_gem_object_put_unlocked (gem); +drm_gem_object_put (gem);return ret; }
@@ -948,7 +948,7 @@ nouveau_gem_ioctl_cpu_fini(struct drm_device *dev, void *data, nvbo =nouveau_gem_object (gem);nouveau_bo_sync_for_device (nvbo); -drm_gem_object_put_unlocked (gem); +drm_gem_object_put (gem);return 0 ; }
@@ -965,7 +965,7 @@ nouveau_gem_ioctl_info(struct drm_device *dev, void *data,return -ENOENT ; ret =nouveau_gem_info (file_priv, gem, req); -drm_gem_object_put_unlocked (gem); +drm_gem_object_put (gem);return ret; }
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 24/36 drm/omapdrm: remove _unlocked suffix in drm_object_put_unlocked
In reply to Emil VelikovFrom: Emil Velikov <[email protected]>
Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.
Just drop the suffix. It makes the API cleaner.
Done via the following script:
__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done
--- drivers/gpu/drm/omapdrm/omap_drv.c | 2 +- drivers/gpu/drm/omapdrm/omap_fb.c | 2 +- drivers/gpu/drm/omapdrm/omap_fbdev.c | 2 +- drivers/gpu/drm/omapdrm/omap_gem.c | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/omapdrm/omap_drv.c +1 -1
@@ -503,7 +503,7 @@ static int ioctl_gem_info(struct drm_device *dev, void *data, args->size =omap_gem_mmap_size (obj); args->offset =omap_gem_mmap_offset (obj); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; }
drivers/gpu/drm/omapdrm/omap_fb.c +1 -1
@@ -326,7 +326,7 @@ struct drm_framebuffer *omap_framebuffer_create(struct drm_device *dev, error:while (--i >=0 ) -drm_gem_object_put_unlocked (bos[i]); +drm_gem_object_put (bos[i]);return fb; }
drivers/gpu/drm/omapdrm/omap_fbdev.c +1 -1
@@ -140,7 +140,7 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,/* note: if fb creation failed, we can't rely on fb destroy * to unref the bo: */ -drm_gem_object_put_unlocked (fbdev->bo); +drm_gem_object_put (fbdev->bo); ret =PTR_ERR (fb); goto fail; }
drivers/gpu/drm/omapdrm/omap_gem.c +2 -2
@@ -629,7 +629,7 @@ int omap_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev, *offset =omap_gem_mmap_offset (obj); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj); fail:return ret;
@@ -1348,7 +1348,7 @@ int omap_gem_new_handle(struct drm_device *dev, struct drm_file *file, }/* drop reference from allocate - handle holds it now */ -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return 0 ; }
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 25/36 drm/panfrost: remove _unlocked suffix in drm_object_put_unlocked
In reply to Emil VelikovFrom: Emil Velikov <[email protected]>
Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.
Just drop the suffix. It makes the API cleaner.
Done via the following script:
__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done
--- drivers/gpu/drm/panfrost/panfrost_drv.c | 10 +++++----- drivers/gpu/drm/panfrost/panfrost_gem.c | 4 ++-- drivers/gpu/drm/panfrost/panfrost_job.c | 2 +- drivers/gpu/drm/panfrost/panfrost_mmu.c | 2 +- drivers/gpu/drm/panfrost/panfrost_perfcnt.c | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-)
drivers/gpu/drm/panfrost/panfrost_drv.c +5 -5
@@ -99,7 +99,7 @@ static int panfrost_ioctl_create_bo(struct drm_device *dev, void *data, mapping =panfrost_gem_mapping_get (bo, priv);if (!mapping) { -drm_gem_object_put_unlocked (&bo->base.base); +drm_gem_object_put (&bo->base.base);return -EINVAL ; }
@@ -317,7 +317,7 @@ panfrost_ioctl_wait_bo(struct drm_device *dev, void *data,if (!ret) ret = timeout ? -ETIMEDOUT : -EBUSY ; -drm_gem_object_put_unlocked (gem_obj); +drm_gem_object_put (gem_obj);return ret; }
@@ -351,7 +351,7 @@ static int panfrost_ioctl_mmap_bo(struct drm_device *dev, void *data, args->offset =drm_vma_node_offset_addr (&gem_obj->vma_node); out: -drm_gem_object_put_unlocked (gem_obj); +drm_gem_object_put (gem_obj);return ret; }
@@ -372,7 +372,7 @@ static int panfrost_ioctl_get_bo_offset(struct drm_device *dev, void *data, bo =to_panfrost_bo (gem_obj); mapping =panfrost_gem_mapping_get (bo, priv); -drm_gem_object_put_unlocked (gem_obj); +drm_gem_object_put (gem_obj);if (!mapping)return -EINVAL ;
@@ -438,7 +438,7 @@ static int panfrost_ioctl_madvise(struct drm_device *dev, void *data,mutex_unlock (&bo->mappings.lock);mutex_unlock (&pfdev->shrinker_lock); -drm_gem_object_put_unlocked (gem_obj); +drm_gem_object_put (gem_obj);return ret; }
drivers/gpu/drm/panfrost/panfrost_gem.c +2 -2
@@ -93,7 +93,7 @@ static void panfrost_gem_mapping_release(struct kref *kref) mapping = container_of(kref, struct panfrost_gem_mapping, refcount);panfrost_gem_teardown_mapping (mapping); -drm_gem_object_put_unlocked (&mapping->obj->base.base); +drm_gem_object_put (&mapping->obj->base.base);kfree (mapping); }
@@ -261,7 +261,7 @@ panfrost_gem_create_with_handle(struct drm_file *file_priv,*/ ret =drm_gem_handle_create (file_priv, &shmem->base, handle);/* drop reference from allocate - handle holds it now. */ -drm_gem_object_put_unlocked (&shmem->base); +drm_gem_object_put (&shmem->base);if (ret)return ERR_PTR (ret);
drivers/gpu/drm/panfrost/panfrost_job.c +1 -1
@@ -281,7 +281,7 @@ static void panfrost_job_cleanup(struct kref *ref)if (job->bos) {for (i =0 ; i < job->bo_count; i++) -drm_gem_object_put_unlocked (job->bos[i]); +drm_gem_object_put (job->bos[i]);kvfree (job->bos); }
drivers/gpu/drm/panfrost/panfrost_mmu.c +1 -1
@@ -538,7 +538,7 @@ static int panfrost_mmu_map_fault_addr(struct panfrost_device *pfdev, int as, err_pages:drm_gem_shmem_put_pages (&bo->base); err_bo: -drm_gem_object_put_unlocked (&bo->base.base); +drm_gem_object_put (&bo->base.base);return ret; }
drivers/gpu/drm/panfrost/panfrost_perfcnt.c +2 -2
@@ -156,7 +156,7 @@ static int panfrost_perfcnt_enable_locked(struct panfrost_device *pfdev,gpu_write (pfdev,GPU_PRFCNT_TILER_EN ,0xffffffff );/* The BO ref is retained by the mapping. */ -drm_gem_object_put_unlocked (&bo->base); +drm_gem_object_put (&bo->base);return 0 ;
@@ -167,7 +167,7 @@ static int panfrost_perfcnt_enable_locked(struct panfrost_device *pfdev, err_close_bo:panfrost_gem_close (&bo->base, file_priv); err_put_bo: -drm_gem_object_put_unlocked (&bo->base); +drm_gem_object_put (&bo->base);return ret; }
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 26/36 drm/qxl: remove _unlocked suffix in drm_object_put_unlocked
In reply to Emil VelikovFrom: Emil Velikov <[email protected]>
Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.
Just drop the suffix. It makes the API cleaner.
Done via the following script:
__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done
--- drivers/gpu/drm/qxl/qxl_cmd.c | 2 +- drivers/gpu/drm/qxl/qxl_display.c | 6 +++--- drivers/gpu/drm/qxl/qxl_dumb.c | 2 +- drivers/gpu/drm/qxl/qxl_gem.c | 2 +- drivers/gpu/drm/qxl/qxl_ioctl.c | 4 ++-- drivers/gpu/drm/qxl/qxl_object.c | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-)
drivers/gpu/drm/qxl/qxl_cmd.c +1 -1
@@ -377,7 +377,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->tbo.base); +drm_gem_object_put (&qdev->primary_bo->tbo.base); qdev->primary_bo =NULL ; }
drivers/gpu/drm/qxl/qxl_display.c +3 -3
@@ -783,7 +783,7 @@ static int qxl_plane_prepare_fb(struct drm_plane *plane, qdev->dumb_shadow_bo->surf.width != surf.width || qdev->dumb_shadow_bo->surf.height != surf.height) {if (qdev->dumb_shadow_bo) { -drm_gem_object_put_unlocked +drm_gem_object_put (&qdev->dumb_shadow_bo->tbo.base); qdev->dumb_shadow_bo =NULL ; }
@@ -793,7 +793,7 @@ 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 +drm_gem_object_put (&user_bo->shadow->tbo.base); user_bo->shadow =NULL ; }
@@ -828,7 +828,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->tbo.base); +drm_gem_object_put (&user_bo->shadow->tbo.base); user_bo->shadow =NULL ; } }
drivers/gpu/drm/qxl/qxl_dumb.c +1 -1
@@ -83,6 +83,6 @@ int qxl_mode_dumb_mmap(struct drm_file *file_priv,return -ENOENT ; qobj =gem_to_qxl_bo (gobj); *offset_p =qxl_bo_mmap_offset (qobj); -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);return 0 ; }
drivers/gpu/drm/qxl/qxl_gem.c +1 -1
@@ -97,7 +97,7 @@ int qxl_gem_object_create_with_handle(struct qxl_device *qdev,return r;/* drop reference from allocate - handle holds it now */ *qobj =gem_to_qxl_bo (gobj); -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);return 0 ; }
drivers/gpu/drm/qxl/qxl_ioctl.c +2 -2
@@ -125,7 +125,7 @@ static int qxlhw_handle_to_bo(struct drm_file *file_priv, uint64_t handle, qobj =gem_to_qxl_bo (gobj); ret =qxl_release_list_add (release, qobj); -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);if (ret)return ret;
@@ -347,7 +347,7 @@ static int qxl_update_area_ioctl(struct drm_device *dev, void *data,qxl_bo_unreserve (qobj); out: -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);return ret; }
drivers/gpu/drm/qxl/qxl_object.c +2 -2
@@ -224,7 +224,7 @@ void qxl_bo_unref(struct qxl_bo **bo)if ((*bo) ==NULL )return ; -drm_gem_object_put_unlocked (&(*bo)->tbo.base); +drm_gem_object_put (&(*bo)->tbo.base); *bo =NULL ; }
@@ -326,7 +326,7 @@ void qxl_bo_force_delete(struct qxl_device *qdev)list_del_init (&bo->list);mutex_unlock (&qdev->gem.mutex);/* this should unref the ttm bo */ -drm_gem_object_put_unlocked (&bo->tbo.base); +drm_gem_object_put (&bo->tbo.base); } }
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 27/36 drm/radeon: remove _unlocked suffix in drm_object_put_unlocked
In reply to Emil VelikovFrom: Emil Velikov <[email protected]>
Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.
Just drop the suffix. It makes the API cleaner.
Done via the following script:
__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done
--- drivers/gpu/drm/radeon/radeon_cs.c | 2 +- drivers/gpu/drm/radeon/radeon_cursor.c | 6 ++--- drivers/gpu/drm/radeon/radeon_display.c | 8 +++---- drivers/gpu/drm/radeon/radeon_fb.c | 4 ++-- drivers/gpu/drm/radeon/radeon_gem.c | 30 ++++++++++++------------- drivers/gpu/drm/radeon/radeon_object.c | 2 +- 6 files changed, 26 insertions(+), 26 deletions(-)
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->tbo.base); +drm_gem_object_put (&bo->tbo.base); } }kfree (parser->track);
drivers/gpu/drm/radeon/radeon_cursor.c +3 -3
@@ -309,7 +309,7 @@ int radeon_crtc_cursor_set2(struct drm_crtc *crtc, robj =gem_to_radeon_bo (obj); ret =radeon_bo_reserve (robj, false);if (ret !=0 ) { -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; }/* Only 27 bit offset for legacy cursor */
@@ -319,7 +319,7 @@ int radeon_crtc_cursor_set2(struct drm_crtc *crtc,radeon_bo_unreserve (robj);if (ret) {DRM_ERROR ("Failed to pin new cursor BO (%d)\n" , ret); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; }
@@ -354,7 +354,7 @@ int radeon_crtc_cursor_set2(struct drm_crtc *crtc,radeon_bo_unpin (robj);radeon_bo_unreserve (robj); } -drm_gem_object_put_unlocked (radeon_crtc->cursor_bo); +drm_gem_object_put (radeon_crtc->cursor_bo); } radeon_crtc->cursor_bo = obj;
drivers/gpu/drm/radeon/radeon_display.c +4 -4
@@ -281,7 +281,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->tbo.base); +drm_gem_object_put (&work->old_rbo->tbo.base);kfree (work); }
@@ -613,7 +613,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->tbo.base); +drm_gem_object_put (&work->old_rbo->tbo.base);dma_fence_put (work->fence);kfree (work);return r;
@@ -1337,14 +1337,14 @@ radeon_user_framebuffer_create(struct drm_device *dev, fb =kzalloc (sizeof (*fb),GFP_KERNEL );if (fb ==NULL ) { -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ERR_PTR (-ENOMEM ); } ret =radeon_framebuffer_init (dev, fb, mode_cmd, obj);if (ret) {kfree (fb); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ERR_PTR (ret); }
drivers/gpu/drm/radeon/radeon_fb.c +2 -2
@@ -119,7 +119,7 @@ static void radeonfb_destroy_pinned_object(struct drm_gem_object *gobj)radeon_bo_unpin (rbo);radeon_bo_unreserve (rbo); } -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj); } static int radeonfb_create_pinned_object(struct radeon_fbdev *rfbdev,
@@ -298,7 +298,7 @@ static int radeonfb_create(struct drm_fb_helper *helper, }if (fb && ret) { -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);drm_framebuffer_unregister_private (fb);drm_framebuffer_cleanup (fb);kfree (fb);
drivers/gpu/drm/radeon/radeon_gem.c +15 -15
@@ -275,7 +275,7 @@ int radeon_gem_create_ioctl(struct drm_device *dev, void *data, } r =drm_gem_handle_create (filp, gobj, &handle);/* drop reference from allocate - handle holds it now */ -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);if (r) {up_read (&rdev->exclusive_lock); r =radeon_gem_handle_lockup (rdev, r);
@@ -359,7 +359,7 @@ int radeon_gem_userptr_ioctl(struct drm_device *dev, void *data, r =drm_gem_handle_create (filp, gobj, &handle);/* drop reference from allocate - handle holds it now */ -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);if (r) goto handle_lockup;
@@ -368,7 +368,7 @@ int radeon_gem_userptr_ioctl(struct drm_device *dev, void *data,return 0 ; release_object: -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj); handle_lockup:up_read (&rdev->exclusive_lock);
@@ -402,7 +402,7 @@ int radeon_gem_set_domain_ioctl(struct drm_device *dev, void *data, r =radeon_gem_set_domain (gobj, args->read_domains, args->write_domain); -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);up_read (&rdev->exclusive_lock); r =radeon_gem_handle_lockup (robj->rdev, r);return r;
@@ -421,11 +421,11 @@ int radeon_mode_dumb_mmap(struct drm_file *filp, } robj =gem_to_radeon_bo (gobj);if (radeon_ttm_tt_has_userptr (robj->tbo.ttm)) { -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);return -EPERM ; } *offset_p =radeon_bo_mmap_offset (robj); -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);return 0 ; }
@@ -460,7 +460,7 @@ int radeon_gem_busy_ioctl(struct drm_device *dev, void *data, cur_placement =READ_ONCE (robj->tbo.mem.mem_type); args->domain =radeon_mem_type_to_domain (cur_placement); -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);return r; }
@@ -492,7 +492,7 @@ int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data,if (rdev->asic->mmio_hdp_flush &&radeon_mem_type_to_domain (cur_placement) ==RADEON_GEM_DOMAIN_VRAM ) robj->rdev->asic->mmio_hdp_flush (rdev); -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj); r =radeon_gem_handle_lockup (rdev, r);return r; }
@@ -511,7 +511,7 @@ int radeon_gem_set_tiling_ioctl(struct drm_device *dev, void *data,return -ENOENT ; robj =gem_to_radeon_bo (gobj); r =radeon_bo_set_tiling_flags (robj, args->tiling_flags, args->pitch); -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);return r; }
@@ -534,7 +534,7 @@ int radeon_gem_get_tiling_ioctl(struct drm_device *dev, void *data,radeon_bo_get_tiling_flags (rbo, &args->tiling_flags, &args->pitch);radeon_bo_unreserve (rbo); out: -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);return r; }
@@ -668,14 +668,14 @@ int radeon_gem_va_ioctl(struct drm_device *dev, void *data, r =radeon_bo_reserve (rbo, false);if (r) { args->operation =RADEON_VA_RESULT_ERROR ; -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);return r; } bo_va =radeon_vm_bo_find (&fpriv->vm, rbo);if (!bo_va) { args->operation =RADEON_VA_RESULT_ERROR ;radeon_bo_unreserve (rbo); -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);return -ENOENT ; }
@@ -702,7 +702,7 @@ int radeon_gem_va_ioctl(struct drm_device *dev, void *data, args->operation =RADEON_VA_RESULT_ERROR ; } out: -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);return r; }
@@ -743,7 +743,7 @@ int radeon_gem_op_ioctl(struct drm_device *dev, void *data,radeon_bo_unreserve (robj); out: -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);return r; }
@@ -769,7 +769,7 @@ int radeon_mode_dumb_create(struct drm_file *file_priv, r =drm_gem_handle_create (file_priv, gobj, &handle);/* drop reference from allocate - handle holds it now */ -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);if (r) {return r; }
drivers/gpu/drm/radeon/radeon_object.c +1 -1
@@ -448,7 +448,7 @@ void radeon_bo_force_delete(struct radeon_device *rdev)list_del_init (&bo->list);mutex_unlock (&bo->rdev->gem.mutex);/* this should unref the ttm bo */ -drm_gem_object_put_unlocked (&bo->tbo.base); +drm_gem_object_put (&bo->tbo.base); } }
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 28/36 drm/rockchip: remove _unlocked suffix in drm_object_put_unlocked
In reply to Emil VelikovFrom: Emil Velikov <[email protected]>
Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.
Just drop the suffix. It makes the API cleaner.
Done via the following script:
__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done
--- drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 2 +- drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/rockchip/rockchip_drm_fb.c +1 -1
@@ -88,7 +88,7 @@ rockchip_fb_create(struct drm_device *dev, struct drm_file *file,struct drm_gem_object **obj = afbc_fb->base.obj;for (i =0 ; i < info->num_planes; ++i) -drm_gem_object_put_unlocked (obj[i]); +drm_gem_object_put (obj[i]);kfree (afbc_fb);return ERR_PTR (ret);
drivers/gpu/drm/rockchip/rockchip_drm_gem.c +1 -1
@@ -392,7 +392,7 @@ rockchip_gem_create_with_handle(struct drm_file *file_priv, goto err_handle_create;/* drop reference from allocate - handle holds it now. */ -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return rk_obj;
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 29/36 drm/tegra: remove _unlocked suffix in drm_object_put_unlocked
In reply to Emil VelikovFrom: Emil Velikov <[email protected]>
Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.
Just drop the suffix. It makes the API cleaner.
Done via the following script:
__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done
--- drivers/gpu/drm/tegra/drm.c | 12 ++++++------ drivers/gpu/drm/tegra/fb.c | 6 +++--- drivers/gpu/drm/tegra/gem.c | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-)
drivers/gpu/drm/tegra/drm.c +6 -6
@@ -328,7 +328,7 @@ int tegra_drm_submit(struct tegra_drm_context *context, fail:while (num_refs--) -drm_gem_object_put_unlocked (refs[num_refs]); +drm_gem_object_put (refs[num_refs]);kfree (refs);
@@ -368,7 +368,7 @@ static int tegra_gem_mmap(struct drm_device *drm, void *data, args->offset =drm_vma_node_offset_addr (&bo->gem.vma_node); -drm_gem_object_put_unlocked (gem); +drm_gem_object_put (gem);return 0 ; }
@@ -636,7 +636,7 @@ static int tegra_gem_set_tiling(struct drm_device *drm, void *data, bo->tiling.mode = mode; bo->tiling.value = value; -drm_gem_object_put_unlocked (gem); +drm_gem_object_put (gem);return 0 ; }
@@ -676,7 +676,7 @@ static int tegra_gem_get_tiling(struct drm_device *drm, void *data,break ; } -drm_gem_object_put_unlocked (gem); +drm_gem_object_put (gem);return err; }
@@ -701,7 +701,7 @@ static int tegra_gem_set_flags(struct drm_device *drm, void *data,if (args->flags &DRM_TEGRA_GEM_BOTTOM_UP ) bo->flags |=TEGRA_BO_BOTTOM_UP ; -drm_gem_object_put_unlocked (gem); +drm_gem_object_put (gem);return 0 ; }
@@ -723,7 +723,7 @@ static int tegra_gem_get_flags(struct drm_device *drm, void *data,if (bo->flags &TEGRA_BO_BOTTOM_UP ) args->flags |=DRM_TEGRA_GEM_BOTTOM_UP ; -drm_gem_object_put_unlocked (gem); +drm_gem_object_put (gem);return 0 ; }
drivers/gpu/drm/tegra/fb.c +3 -3
@@ -171,7 +171,7 @@ struct drm_framebuffer *tegra_fb_create(struct drm_device *drm, unreference:while (i--) -drm_gem_object_put_unlocked (&planes[i]->gem); +drm_gem_object_put (&planes[i]->gem);return ERR_PTR (err); }
@@ -235,7 +235,7 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper, info =drm_fb_helper_alloc_fbi (helper);if (IS_ERR (info)) {dev_err (drm->dev,"failed to allocate framebuffer info\n" ); -drm_gem_object_put_unlocked (&bo->gem); +drm_gem_object_put (&bo->gem);return PTR_ERR (info); }
@@ -244,7 +244,7 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper, err =PTR_ERR (fbdev->fb);dev_err (drm->dev,"failed to allocate DRM framebuffer: %d\n" , err); -drm_gem_object_put_unlocked (&bo->gem); +drm_gem_object_put (&bo->gem);return PTR_ERR (fbdev->fb); }
drivers/gpu/drm/tegra/gem.c +2 -2
@@ -24,7 +24,7 @@ static void tegra_bo_put(struct host1x_bo *bo) {struct tegra_bo *obj =host1x_to_tegra_bo (bo); -drm_gem_object_put_unlocked (&obj->gem); +drm_gem_object_put (&obj->gem); }/* XXX move this into lib/scatterlist.c? */
@@ -385,7 +385,7 @@ struct tegra_bo *tegra_bo_create_with_handle(struct drm_file *file,return ERR_PTR (err); } -drm_gem_object_put_unlocked (&bo->gem); +drm_gem_object_put (&bo->gem);return bo; }
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 30/36 drm/v3d: remove _unlocked suffix in drm_object_put_unlocked
In reply to Emil VelikovFrom: Emil Velikov <[email protected]>
Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.
Just drop the suffix. It makes the API cleaner.
Done via the following script:
__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done
--- drivers/gpu/drm/v3d/v3d_bo.c | 6 +++--- drivers/gpu/drm/v3d/v3d_gem.c | 4 ++-- drivers/gpu/drm/v3d/v3d_irq.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/v3d/v3d_bo.c +3 -3
@@ -185,7 +185,7 @@ int v3d_create_bo_ioctl(struct drm_device *dev, void *data, args->offset = bo->node.start <<PAGE_SHIFT ; ret =drm_gem_handle_create (file_priv, &bo->base.base, &args->handle); -drm_gem_object_put_unlocked (&bo->base.base); +drm_gem_object_put (&bo->base.base);return ret; }
@@ -208,7 +208,7 @@ int v3d_mmap_bo_ioctl(struct drm_device *dev, void *data, } args->offset =drm_vma_node_offset_addr (&gem_obj->vma_node); -drm_gem_object_put_unlocked (gem_obj); +drm_gem_object_put (gem_obj);return 0 ; }
@@ -229,6 +229,6 @@ int v3d_get_bo_offset_ioctl(struct drm_device *dev, void *data, args->offset = bo->node.start <<PAGE_SHIFT ; -drm_gem_object_put_unlocked (gem_obj); +drm_gem_object_put (gem_obj);return 0 ; }
drivers/gpu/drm/v3d/v3d_gem.c +2 -2
@@ -358,7 +358,7 @@ v3d_job_free(struct kref *ref)for (i =0 ; i < job->bo_count; i++) {if (job->bo[i]) -drm_gem_object_put_unlocked (job->bo[i]); +drm_gem_object_put (job->bo[i]); }kvfree (job->bo);
@@ -384,7 +384,7 @@ v3d_render_job_free(struct kref *ref)struct v3d_bo *bo, *save;list_for_each_entry_safe (bo, save, &job->unref_list, unref_head) { -drm_gem_object_put_unlocked (&bo->base.base); +drm_gem_object_put (&bo->base.base); }v3d_job_free (ref);
drivers/gpu/drm/v3d/v3d_irq.c +1 -1
@@ -72,7 +72,7 @@ v3d_overflow_mem_work(struct work_struct *work)V3D_CORE_WRITE (0 ,V3D_PTB_BPOS , obj->size); out: -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj); } static irqreturn_t
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 31/36 drm/vc4: remove _unlocked suffix in drm_object_put_unlocked
In reply to Emil VelikovFrom: Emil Velikov <[email protected]>
Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.
Just drop the suffix. It makes the API cleaner.
Done via the following script:
__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done
--- drivers/gpu/drm/vc4/vc4_bo.c | 14 +++++++------- drivers/gpu/drm/vc4/vc4_gem.c | 14 +++++++------- drivers/gpu/drm/vc4/vc4_kms.c | 2 +- drivers/gpu/drm/vc4/vc4_v3d.c | 4 ++-- 4 files changed, 17 insertions(+), 17 deletions(-)
drivers/gpu/drm/vc4/vc4_bo.c +7 -7
@@ -490,7 +490,7 @@ int vc4_dumb_create(struct drm_file *file_priv, bo->madv =VC4_MADV_WILLNEED ; ret =drm_gem_handle_create (file_priv, &bo->base.base, &args->handle); -drm_gem_object_put_unlocked (&bo->base.base); +drm_gem_object_put (&bo->base.base);return ret; }
@@ -834,7 +834,7 @@ int vc4_create_bo_ioctl(struct drm_device *dev, void *data, bo->madv =VC4_MADV_WILLNEED ; ret =drm_gem_handle_create (file_priv, &bo->base.base, &args->handle); -drm_gem_object_put_unlocked (&bo->base.base); +drm_gem_object_put (&bo->base.base);return ret; }
@@ -854,7 +854,7 @@ int vc4_mmap_bo_ioctl(struct drm_device *dev, void *data,/* The mmap offset was set up at BO allocation time. */ args->offset =drm_vma_node_offset_addr (&gem_obj->vma_node); -drm_gem_object_put_unlocked (gem_obj); +drm_gem_object_put (gem_obj);return 0 ; }
@@ -918,7 +918,7 @@ vc4_create_shader_bo_ioctl(struct drm_device *dev, void *data, ret =drm_gem_handle_create (file_priv, &bo->base.base, &args->handle); fail: -drm_gem_object_put_unlocked (&bo->base.base); +drm_gem_object_put (&bo->base.base);return ret; }
@@ -965,7 +965,7 @@ int vc4_set_tiling_ioctl(struct drm_device *dev, void *data, bo =to_vc4_bo (gem_obj); bo->t_format = t_format; -drm_gem_object_put_unlocked (gem_obj); +drm_gem_object_put (gem_obj);return 0 ; }
@@ -1000,7 +1000,7 @@ int vc4_get_tiling_ioctl(struct drm_device *dev, void *data,else args->modifier =DRM_FORMAT_MOD_NONE ; -drm_gem_object_put_unlocked (gem_obj); +drm_gem_object_put (gem_obj);return 0 ; }
@@ -1091,7 +1091,7 @@ int vc4_label_bo_ioctl(struct drm_device *dev, void *data, ret = -ENOMEM ;mutex_unlock (&vc4->bo_lock); -drm_gem_object_put_unlocked (gem_obj); +drm_gem_object_put (gem_obj);return ret; }
drivers/gpu/drm/vc4/vc4_gem.c +7 -7
@@ -58,7 +58,7 @@ vc4_free_hang_state(struct drm_device *dev, struct vc4_hang_state *state)unsigned int i;for (i =0 ; i < state->user_state.bo_count; i++) -drm_gem_object_put_unlocked (state->bo[i]); +drm_gem_object_put (state->bo[i]);kfree (state); }
@@ -808,7 +808,7 @@ vc4_cl_lookup_bos(struct drm_device *dev, fail_put_bo:/* Release any reference to acquired objects. */ for (i =0 ; i < exec->bo_count && exec->bo[i]; i++) -drm_gem_object_put_unlocked (&exec->bo[i]->base); +drm_gem_object_put (&exec->bo[i]->base); fail:kvfree (handles);
@@ -957,7 +957,7 @@ vc4_complete_exec(struct drm_device *dev, struct vc4_exec_info *exec)struct vc4_bo *bo =to_vc4_bo (&exec->bo[i]->base);vc4_bo_dec_usecnt (bo); -drm_gem_object_put_unlocked (&exec->bo[i]->base); +drm_gem_object_put (&exec->bo[i]->base); }kvfree (exec->bo); }
@@ -966,7 +966,7 @@ vc4_complete_exec(struct drm_device *dev, struct vc4_exec_info *exec)struct vc4_bo *bo =list_first_entry (&exec->unref_list, struct vc4_bo, unref_head);list_del (&bo->unref_head); -drm_gem_object_put_unlocked (&bo->base.base); +drm_gem_object_put (&bo->base.base); }/* Free up the allocation of any bin slots we used. */
@@ -1107,7 +1107,7 @@ vc4_wait_bo_ioctl(struct drm_device *dev, void *data, ret =vc4_wait_for_seqno_ioctl_helper (dev, bo->seqno, &args->timeout_ns); -drm_gem_object_put_unlocked (gem_obj); +drm_gem_object_put (gem_obj);return ret; }
@@ -1301,7 +1301,7 @@ vc4_gem_destroy(struct drm_device *dev)* the overflow allocation registers. Now free the object. */ if (vc4->bin_bo) { -drm_gem_object_put_unlocked (&vc4->bin_bo->base.base); +drm_gem_object_put (&vc4->bin_bo->base.base); vc4->bin_bo =NULL ; }
@@ -1382,7 +1382,7 @@ int vc4_gem_madvise_ioctl(struct drm_device *dev, void *data, ret =0 ; out_put_gem: -drm_gem_object_put_unlocked (gem_obj); +drm_gem_object_put (gem_obj);return ret; }
drivers/gpu/drm/vc4/vc4_kms.c +1 -1
@@ -330,7 +330,7 @@ static struct drm_framebuffer *vc4_fb_create(struct drm_device *dev, mode_cmd_local.modifier[0 ] =DRM_FORMAT_MOD_NONE ; } -drm_gem_object_put_unlocked (gem_obj); +drm_gem_object_put (gem_obj); mode_cmd = &mode_cmd_local; }
drivers/gpu/drm/vc4/vc4_v3d.c +2 -2
@@ -308,7 +308,7 @@ static int bin_bo_alloc(struct vc4_dev *vc4) struct vc4_bo, unref_head);list_del (&bo->unref_head); -drm_gem_object_put_unlocked (&bo->base.base); +drm_gem_object_put (&bo->base.base); }return ret;
@@ -344,7 +344,7 @@ static void bin_bo_release(struct kref *ref)if (WARN_ON_ONCE (!vc4->bin_bo))return ; -drm_gem_object_put_unlocked (&vc4->bin_bo->base.base); +drm_gem_object_put (&vc4->bin_bo->base.base); vc4->bin_bo =NULL ; }
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 32/36 drm/vgem: remove _unlocked suffix in drm_object_put_unlocked
In reply to Emil VelikovFrom: Emil Velikov <[email protected]>
Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.
Just drop the suffix. It makes the API cleaner.
Done via the following script:
__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done
--- drivers/gpu/drm/vgem/vgem_drv.c | 6 +++--- drivers/gpu/drm/vgem/vgem_fence.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/vgem/vgem_drv.c +3 -3
@@ -198,7 +198,7 @@ static struct drm_gem_object *vgem_gem_create(struct drm_device *dev, ret =drm_gem_handle_create (file, &obj->base, handle);if (ret) { -drm_gem_object_put_unlocked (&obj->base); +drm_gem_object_put (&obj->base);return ERR_PTR (ret); }
@@ -223,7 +223,7 @@ static int vgem_gem_dumb_create(struct drm_file *file, struct drm_device *dev, args->size = gem_object->size; args->pitch = pitch; -drm_gem_object_put_unlocked (gem_object); +drm_gem_object_put (gem_object);DRM_DEBUG ("Created object of size %llu\n" , args->size);
@@ -251,7 +251,7 @@ static int vgem_gem_dumb_map(struct drm_file *file, struct drm_device *dev, *offset =drm_vma_node_offset_addr (&obj->vma_node); unref: -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; }
drivers/gpu/drm/vgem/vgem_fence.c +1 -1
@@ -182,7 +182,7 @@ int vgem_fence_attach_ioctl(struct drm_device *dev,dma_fence_put (fence); } err: -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; }
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 33/36 drm/virtio: remove _unlocked suffix in drm_object_put_unlocked
In reply to Emil VelikovFrom: Emil Velikov <[email protected]>
Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.
Just drop the suffix. It makes the API cleaner.
Done via the following script:
__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done
--- drivers/gpu/drm/virtio/virtgpu_display.c | 2 +- drivers/gpu/drm/virtio/virtgpu_gem.c | 6 +++--- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/virtio/virtgpu_display.c +1 -1
@@ -307,7 +307,7 @@ virtio_gpu_user_framebuffer_create(struct drm_device *dev, ret =virtio_gpu_framebuffer_init (dev, virtio_gpu_fb, mode_cmd, obj);if (ret) {kfree (virtio_gpu_fb); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return NULL ; }
drivers/gpu/drm/virtio/virtgpu_gem.c +3 -3
@@ -52,7 +52,7 @@ static int virtio_gpu_gem_create(struct drm_file *file, *obj_p = &obj->base.base;/* drop reference from allocate - handle holds it now */ -drm_gem_object_put_unlocked (&obj->base.base); +drm_gem_object_put (&obj->base.base); *handle_p = handle;return 0 ;
@@ -102,7 +102,7 @@ int virtio_gpu_mode_dumb_mmap(struct drm_file *file_priv,if (gobj ==NULL )return -ENOENT ; *offset_p =drm_vma_node_offset_addr (&gobj->vma_node); -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);return 0 ; }
@@ -237,7 +237,7 @@ void virtio_gpu_array_put_free(struct virtio_gpu_object_array *objs)u32 i;for (i =0 ; i < objs->nents; i++) -drm_gem_object_put_unlocked (objs->objs[i]); +drm_gem_object_put (objs->objs[i]);virtio_gpu_array_free (objs); }
drivers/gpu/drm/virtio/virtgpu_ioctl.c +3 -3
@@ -278,7 +278,7 @@ static int virtio_gpu_resource_create_ioctl(struct drm_device *dev, void *data,drm_gem_object_release (obj);return ret; } -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj); rc->res_handle = qobj->hw_res_handle;/* similiar to a VM address */ rc->bo_handle = handle;
@@ -300,7 +300,7 @@ static int virtio_gpu_resource_info_ioctl(struct drm_device *dev, void *data, ri->size = qobj->base.base.size; ri->res_handle = qobj->hw_res_handle; -drm_gem_object_put_unlocked (gobj); +drm_gem_object_put (gobj);return 0 ; }
@@ -417,7 +417,7 @@ static int virtio_gpu_wait_ioctl(struct drm_device *dev, void *data,else if (ret >0 ) ret =0 ; -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; }
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 34/36 drm/vkms: remove _unlocked suffix in drm_object_put_unlocked
In reply to Emil VelikovFrom: Emil Velikov <[email protected]>
Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.
Just drop the suffix. It makes the API cleaner.
Done via the following script:
__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done
--- drivers/gpu/drm/vkms/vkms_gem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/vkms/vkms_gem.c +1 -1
@@ -113,7 +113,7 @@ struct drm_gem_object *vkms_gem_create(struct drm_device *dev,return ERR_CAST (obj); ret =drm_gem_handle_create (file, &obj->gem, handle); -drm_gem_object_put_unlocked (&obj->gem); +drm_gem_object_put (&obj->gem);if (ret)return ERR_PTR (ret);
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 35/36 drm/xen: remove _unlocked suffix in drm_object_put_unlocked
In reply to Emil VelikovFrom: Emil Velikov <[email protected]>
Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.
Just drop the suffix. It makes the API cleaner.
Done via the following script:
__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done
--- drivers/gpu/drm/xen/xen_drm_front.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/xen/xen_drm_front.c +2 -2
@@ -419,7 +419,7 @@ static int xen_drm_drv_dumb_create(struct drm_file *filp, goto fail_handle;/* Drop reference from allocate - handle holds it now */ -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return 0 ; fail_handle:
@@ -427,7 +427,7 @@ static int xen_drm_drv_dumb_create(struct drm_file *filp, xen_drm_front_dbuf_to_cookie(obj)); fail_backend:/* drop reference from allocate */ -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj); fail:DRM_ERROR ("Failed to create dumb buffer: %d\n" , ret);return ret;
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 36/36 drm/gem: remove _unlocked suffix in drm_object_put_unlocked
In reply to Emil VelikovFrom: Emil Velikov <[email protected]>
Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.
Just drop the suffix. It makes the API cleaner.
Done via the following script:
__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done
With this patch, the _unlocked define is no longer needed - remove it.
--- Documentation/gpu/drm-mm.rst | 2 +- drivers/gpu/drm/drm_client.c | 2 +- drivers/gpu/drm/drm_gem.c | 26 ++++++++++---------- drivers/gpu/drm/drm_gem_cma_helper.c | 8 +++--- drivers/gpu/drm/drm_gem_framebuffer_helper.c | 6 ++--- drivers/gpu/drm/drm_gem_shmem_helper.c | 4 +-- drivers/gpu/drm/drm_gem_ttm_helper.c | 2 +- drivers/gpu/drm/drm_gem_vram_helper.c | 10 ++++---- drivers/gpu/drm/drm_prime.c | 6 ++--- include/drm/drm_gem.h | 4 +-- 10 files changed, 34 insertions(+), 36 deletions(-)
Documentation/gpu/drm-mm.rst +1 -1
@@ -178,7 +178,7 @@ GEM Objects Lifetime -------------------- All GEM objects are reference-counted by the GEM core. References can be -acquired and release by calling drm_gem_object_get() and drm_gem_object_put_unlocked() +acquired and release by calling drm_gem_object_get() and drm_gem_object_put() respectively. When the last reference to a GEM object is released the GEM core calls
drivers/gpu/drm/drm_client.c +1 -1
@@ -237,7 +237,7 @@ static void drm_client_buffer_delete(struct drm_client_buffer *buffer)drm_gem_vunmap (buffer->gem, buffer->vaddr);if (buffer->gem) -drm_gem_object_put_unlocked (buffer->gem); +drm_gem_object_put (buffer->gem);if (buffer->handle)drm_mode_destroy_dumb (dev, buffer->handle, buffer->client->file);
drivers/gpu/drm/drm_gem.c +13 -13
@@ -235,7 +235,7 @@ drm_gem_object_handle_put_unlocked(struct drm_gem_object *obj)mutex_unlock (&dev->object_name_lock);if (final) -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj); }/*
@@ -331,7 +331,7 @@ int drm_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev, *offset =drm_vma_node_offset_addr (&obj->vma_node); out: -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; }
@@ -690,7 +690,7 @@ static int objects_lookup(struct drm_file *filp, u32 *handle, int count,* Returns: * * @objs filled in with GEM object pointers. Returned GEM objects need to be -* released with drm_gem_object_put_unlocked(). -ENOENT is returned on a lookup +* released with drm_gem_object_put(). -ENOENT is returned on a lookup * failure. 0 is returned on success. * */
@@ -785,7 +785,7 @@ long drm_gem_dma_resv_wait(struct drm_file *filep, u32 handle,else if (ret >0 ) ret =0 ; -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; }
@@ -860,7 +860,7 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data, err:mutex_unlock (&dev->object_name_lock); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; }
@@ -898,7 +898,7 @@ drm_gem_open_ioctl(struct drm_device *dev, void *data,/* drm_gem_handle_create_tail unlocks dev->object_name_lock. */ ret =drm_gem_handle_create_tail (file_priv, obj, &handle); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);if (ret)return ret;
@@ -991,7 +991,7 @@ EXPORT_SYMBOL(drm_gem_object_free);* driver doesn't use &drm_device.struct_mutex for anything. * * For drivers not encumbered with legacy locking use -* drm_gem_object_put_unlocked() instead. +* drm_gem_object_put() instead. */ void drm_gem_object_put_locked (struct drm_gem_object *obj)
@@ -1030,7 +1030,7 @@ void drm_gem_vm_close(struct vm_area_struct *vma) {struct drm_gem_object *obj = vma->vm_private_data; -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj); }EXPORT_SYMBOL (drm_gem_vm_close);
@@ -1079,7 +1079,7 @@ int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size,if (obj->funcs && obj->funcs->mmap) { ret = obj->funcs->mmap (obj, vma);if (ret) { -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; }WARN_ON (!(vma->vm_flags &VM_DONTEXPAND ));
@@ -1089,7 +1089,7 @@ int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size,else if (dev->driver->gem_vm_ops) vma->vm_ops = dev->driver->gem_vm_ops;else { -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return -EINVAL ; }
@@ -1155,13 +1155,13 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)return -EINVAL ;if (!drm_vma_node_is_allowed (node, priv)) { -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return -EACCES ; }if (node->readonly) {if (vma->vm_flags &VM_WRITE ) { -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return -EINVAL ; }
@@ -1171,7 +1171,7 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma) ret =drm_gem_mmap_obj (obj,drm_vma_node_size (node) <<PAGE_SHIFT , vma); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; }
drivers/gpu/drm/drm_gem_cma_helper.c +4 -4
@@ -114,7 +114,7 @@ struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm,return cma_obj; error: -drm_gem_object_put_unlocked (&cma_obj->base); +drm_gem_object_put (&cma_obj->base);return ERR_PTR (ret); }EXPORT_SYMBOL_GPL (drm_gem_cma_create);
@@ -156,7 +156,7 @@ drm_gem_cma_create_with_handle(struct drm_file *file_priv,*/ ret =drm_gem_handle_create (file_priv, gem_obj, handle);/* drop reference from allocate - handle holds it now. */ -drm_gem_object_put_unlocked (gem_obj); +drm_gem_object_put (gem_obj);if (ret)return ERR_PTR (ret);
@@ -380,13 +380,13 @@ unsigned long drm_gem_cma_get_unmapped_area(struct file *filp,return -EINVAL ;if (!drm_vma_node_is_allowed (node, priv)) { -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return -EACCES ; } cma_obj =to_drm_gem_cma_obj (obj); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return cma_obj->vaddr ? (unsigned long )cma_obj->vaddr : -EINVAL ; }
drivers/gpu/drm/drm_gem_framebuffer_helper.c +3 -3
@@ -95,7 +95,7 @@ void drm_gem_fb_destroy(struct drm_framebuffer *fb)int i;for (i =0 ; i <4 ; i++) -drm_gem_object_put_unlocked (fb->obj[i]); +drm_gem_object_put (fb->obj[i]);drm_framebuffer_cleanup (fb);kfree (fb);
@@ -175,7 +175,7 @@ int drm_gem_fb_init_with_funcs(struct drm_device *dev, + mode_cmd->offsets[i];if (objs[i]->size < min_size) { -drm_gem_object_put_unlocked (objs[i]); +drm_gem_object_put (objs[i]); ret = -EINVAL ; goto err_gem_object_put; }
@@ -189,7 +189,7 @@ int drm_gem_fb_init_with_funcs(struct drm_device *dev, err_gem_object_put:for (i--; i >=0 ; i--) -drm_gem_object_put_unlocked (objs[i]); +drm_gem_object_put (objs[i]);return ret; }
drivers/gpu/drm/drm_gem_shmem_helper.c +2 -2
@@ -360,7 +360,7 @@ drm_gem_shmem_create_with_handle(struct drm_file *file_priv,*/ ret =drm_gem_handle_create (file_priv, &shmem->base, handle);/* drop reference from allocate - handle holds it now. */ -drm_gem_object_put_unlocked (&shmem->base); +drm_gem_object_put (&shmem->base);if (ret)return ERR_PTR (ret);
@@ -684,7 +684,7 @@ drm_gem_shmem_prime_import_sg_table(struct drm_device *dev, err_free_array:kvfree (shmem->pages); err_free_gem: -drm_gem_object_put_unlocked (&shmem->base); +drm_gem_object_put (&shmem->base);return ERR_PTR (ret); }
drivers/gpu/drm/drm_gem_ttm_helper.c +1 -1
@@ -74,7 +74,7 @@ int drm_gem_ttm_mmap(struct drm_gem_object *gem,* ttm has its own object refcounting, so drop gem reference * to avoid double accounting counting. */ -drm_gem_object_put_unlocked (gem); +drm_gem_object_put (gem);return 0 ; }
drivers/gpu/drm/drm_gem_vram_helper.c +5 -5
@@ -618,9 +618,9 @@ int drm_gem_vram_fill_create_dumb(struct drm_file *file, ret =drm_gem_handle_create (file, &gbo->bo.base, &handle);if (ret) - goto err_drm_gem_object_put_unlocked; + goto err_drm_gem_object_put; -drm_gem_object_put_unlocked (&gbo->bo.base); +drm_gem_object_put (&gbo->bo.base); args->pitch = pitch; args->size = size;
@@ -628,8 +628,8 @@ 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->bo.base); +err_drm_gem_object_put: +drm_gem_object_put (&gbo->bo.base);return ret; }EXPORT_SYMBOL (drm_gem_vram_fill_create_dumb);
@@ -737,7 +737,7 @@ int drm_gem_vram_driver_dumb_mmap_offset(struct drm_file *file, gbo =drm_gem_vram_of_gem (gem); *offset =drm_gem_vram_mmap_offset (gbo); -drm_gem_object_put_unlocked (gem); +drm_gem_object_put (gem);return 0 ; }
drivers/gpu/drm/drm_prime.c +3 -3
@@ -270,7 +270,7 @@ void drm_gem_dmabuf_release(struct dma_buf *dma_buf)struct drm_device *dev = obj->dev;/* drop the reference on the export fd holds */ -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);drm_dev_put (dev); }
@@ -329,7 +329,7 @@ int drm_gem_prime_fd_to_handle(struct drm_device *dev,/* _handle_create_tail unconditionally unlocks dev->object_name_lock. */ ret =drm_gem_handle_create_tail (file_priv, obj, handle); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);if (ret) goto out_put;
@@ -500,7 +500,7 @@ int drm_gem_prime_handle_to_fd(struct drm_device *dev, fail_put_dmabuf:dma_buf_put (dmabuf); out: -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj); out_unlock:mutex_unlock (&file_priv->prime.lock);
include/drm/drm_gem.h +1 -3
@@ -188,7 +188,7 @@ struct drm_gem_object {* Reference count of this object * * Please use drm_gem_object_get() to acquire and drm_gem_object_put_locked() -* or drm_gem_object_put_unlocked() to release a reference to a GEM +* or drm_gem_object_put() to release a reference to a GEM * buffer object. */ struct kref refcount;
@@ -376,8 +376,6 @@ drm_gem_object_put(struct drm_gem_object *obj)kref_put (&obj->refcount, drm_gem_object_free); } -#define drm_gem_object_put_unlocked drm_gem_object_put -void drm_gem_object_put_locked (struct drm_gem_object *obj); int drm_gem_handle_create(struct drm_file *file_priv,
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 36/36] drm/gem: remove _unlocked suffix in drm_object_put_unlocked
Hi Emil.
Quoted 16 lines · Emil Velikov
From: Emil Velikov <[email protected]>
Spelling out
_unlockedfor each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involvingstruct_mutex.Just drop the suffix. It makes the API cleaner.
Done via the following script:
__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for__filein $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done
Quoted 5 lines
With this patch, the
_unlockeddefine is no longer needed - remove it.Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>Signed-off-by Emil Velikov <[email protected]>
I had prefeered this was spilt in three patches:
1) drm_gem*
2) drm_client, drm_prime, drm-mm
3) Removal of the define
Maybe just squash 1) and 2) in the above, but I like it spelled out that the backward compatible define is dropped.
Sam
Quoted 358 lines
--- Documentation/gpu/drm-mm.rst | 2 +- drivers/gpu/drm/drm_client.c | 2 +- drivers/gpu/drm/drm_gem.c | 26 ++++++++++---------- drivers/gpu/drm/drm_gem_cma_helper.c | 8 +++--- drivers/gpu/drm/drm_gem_framebuffer_helper.c | 6 ++--- drivers/gpu/drm/drm_gem_shmem_helper.c | 4 +-- drivers/gpu/drm/drm_gem_ttm_helper.c | 2 +- drivers/gpu/drm/drm_gem_vram_helper.c | 10 ++++---- drivers/gpu/drm/drm_prime.c | 6 ++--- include/drm/drm_gem.h | 4 +-- 10 files changed, 34 insertions(+), 36 deletions(-)Documentation/gpu/drm-mm.rst +1
-1@@ -178,7 +178,7 @@ GEM Objects Lifetime -------------------- All GEM objects are reference-counted by the GEM core. References can be -acquired and release by calling drm_gem_object_get() and drm_gem_object_put_unlocked() +acquired and release by calling drm_gem_object_get() and drm_gem_object_put() respectively. When the last reference to a GEM object is released the GEM core callsdrivers/gpu/drm/drm_client.c +1
-1@@ -237,7 +237,7 @@ static void drm_client_buffer_delete(struct drm_client_buffer *buffer)drm_gem_vunmap (buffer->gem, buffer->vaddr);if (buffer->gem) -drm_gem_object_put_unlocked (buffer->gem); +drm_gem_object_put (buffer->gem);if (buffer->handle)drm_mode_destroy_dumb (dev, buffer->handle, buffer->client->file);drivers/gpu/drm/drm_gem.c +13
-13@@ -235,7 +235,7 @@ drm_gem_object_handle_put_unlocked(struct drm_gem_object *obj)mutex_unlock (&dev->object_name_lock);if (final) -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj); }/* @@ -331,7 +331,7 @@ int drm_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev, *offset =drm_vma_node_offset_addr (&obj->vma_node); out: -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; }@@ -690,7 +690,7 @@ static int objects_lookup(struct drm_file *filp, u32 *handle, int count,* Returns: * * @objs filled in with GEM object pointers. Returned GEM objects need to be -* released with drm_gem_object_put_unlocked(). -ENOENT is returned on a lookup +* released with drm_gem_object_put(). -ENOENT is returned on a lookup * failure. 0 is returned on success. * */ @@ -785,7 +785,7 @@ long drm_gem_dma_resv_wait(struct drm_file *filep, u32 handle,else if (ret >0 ) ret =0 ; -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; }@@ -860,7 +860,7 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data, err:mutex_unlock (&dev->object_name_lock); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; }@@ -898,7 +898,7 @@ drm_gem_open_ioctl(struct drm_device *dev, void *data,/* drm_gem_handle_create_tail unlocks dev->object_name_lock. */ ret =drm_gem_handle_create_tail (file_priv, obj, &handle); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);if (ret)return ret;@@ -991,7 +991,7 @@ EXPORT_SYMBOL(drm_gem_object_free);* driver doesn't use &drm_device.struct_mutex for anything. * * For drivers not encumbered with legacy locking use -* drm_gem_object_put_unlocked() instead. +* drm_gem_object_put() instead. */ void drm_gem_object_put_locked (struct drm_gem_object *obj)@@ -1030,7 +1030,7 @@ void drm_gem_vm_close(struct vm_area_struct *vma) {struct drm_gem_object *obj = vma->vm_private_data; -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj); }EXPORT_SYMBOL (drm_gem_vm_close);@@ -1079,7 +1079,7 @@ int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size,if (obj->funcs && obj->funcs->mmap) { ret = obj->funcs->mmap (obj, vma);if (ret) { -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; }WARN_ON (!(vma->vm_flags &VM_DONTEXPAND ));@@ -1089,7 +1089,7 @@ int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size,else if (dev->driver->gem_vm_ops) vma->vm_ops = dev->driver->gem_vm_ops;else { -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return -EINVAL ; }@@ -1155,13 +1155,13 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)return -EINVAL ;if (!drm_vma_node_is_allowed (node, priv)) { -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return -EACCES ; }if (node->readonly) {if (vma->vm_flags &VM_WRITE ) { -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return -EINVAL ; }@@ -1171,7 +1171,7 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma) ret =drm_gem_mmap_obj (obj,drm_vma_node_size (node) <<PAGE_SHIFT , vma); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; }drivers/gpu/drm/drm_gem_cma_helper.c +4
-4@@ -114,7 +114,7 @@ struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm,return cma_obj; error: -drm_gem_object_put_unlocked (&cma_obj->base); +drm_gem_object_put (&cma_obj->base);return ERR_PTR (ret); }EXPORT_SYMBOL_GPL (drm_gem_cma_create);@@ -156,7 +156,7 @@ drm_gem_cma_create_with_handle(struct drm_file *file_priv,*/ ret =drm_gem_handle_create (file_priv, gem_obj, handle);/* drop reference from allocate - handle holds it now. */ -drm_gem_object_put_unlocked (gem_obj); +drm_gem_object_put (gem_obj);if (ret)return ERR_PTR (ret);@@ -380,13 +380,13 @@ unsigned long drm_gem_cma_get_unmapped_area(struct file *filp,return -EINVAL ;if (!drm_vma_node_is_allowed (node, priv)) { -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return -EACCES ; } cma_obj =to_drm_gem_cma_obj (obj); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return cma_obj->vaddr ? (unsigned long )cma_obj->vaddr : -EINVAL ; }drivers/gpu/drm/drm_gem_framebuffer_helper.c +3
-3@@ -95,7 +95,7 @@ void drm_gem_fb_destroy(struct drm_framebuffer *fb)int i;for (i =0 ; i <4 ; i++) -drm_gem_object_put_unlocked (fb->obj[i]); +drm_gem_object_put (fb->obj[i]);drm_framebuffer_cleanup (fb);kfree (fb);@@ -175,7 +175,7 @@ int drm_gem_fb_init_with_funcs(struct drm_device *dev, + mode_cmd->offsets[i];if (objs[i]->size < min_size) { -drm_gem_object_put_unlocked (objs[i]); +drm_gem_object_put (objs[i]); ret = -EINVAL ; goto err_gem_object_put; }@@ -189,7 +189,7 @@ int drm_gem_fb_init_with_funcs(struct drm_device *dev, err_gem_object_put:for (i--; i >=0 ; i--) -drm_gem_object_put_unlocked (objs[i]); +drm_gem_object_put (objs[i]);return ret; }drivers/gpu/drm/drm_gem_shmem_helper.c +2
-2@@ -360,7 +360,7 @@ drm_gem_shmem_create_with_handle(struct drm_file *file_priv,*/ ret =drm_gem_handle_create (file_priv, &shmem->base, handle);/* drop reference from allocate - handle holds it now. */ -drm_gem_object_put_unlocked (&shmem->base); +drm_gem_object_put (&shmem->base);if (ret)return ERR_PTR (ret);@@ -684,7 +684,7 @@ drm_gem_shmem_prime_import_sg_table(struct drm_device *dev, err_free_array:kvfree (shmem->pages); err_free_gem: -drm_gem_object_put_unlocked (&shmem->base); +drm_gem_object_put (&shmem->base);return ERR_PTR (ret); }drivers/gpu/drm/drm_gem_ttm_helper.c +1
-1@@ -74,7 +74,7 @@ int drm_gem_ttm_mmap(struct drm_gem_object *gem,* ttm has its own object refcounting, so drop gem reference * to avoid double accounting counting. */ -drm_gem_object_put_unlocked (gem); +drm_gem_object_put (gem);return 0 ; }drivers/gpu/drm/drm_gem_vram_helper.c +5
-5@@ -618,9 +618,9 @@ int drm_gem_vram_fill_create_dumb(struct drm_file *file, ret =drm_gem_handle_create (file, &gbo->bo.base, &handle);if (ret) - goto err_drm_gem_object_put_unlocked; + goto err_drm_gem_object_put; -drm_gem_object_put_unlocked (&gbo->bo.base); +drm_gem_object_put (&gbo->bo.base); args->pitch = pitch; args->size = size;@@ -628,8 +628,8 @@ 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->bo.base); +err_drm_gem_object_put: +drm_gem_object_put (&gbo->bo.base);return ret; }EXPORT_SYMBOL (drm_gem_vram_fill_create_dumb);@@ -737,7 +737,7 @@ int drm_gem_vram_driver_dumb_mmap_offset(struct drm_file *file, gbo =drm_gem_vram_of_gem (gem); *offset =drm_gem_vram_mmap_offset (gbo); -drm_gem_object_put_unlocked (gem); +drm_gem_object_put (gem);return 0 ; }drivers/gpu/drm/drm_prime.c +3
-3@@ -270,7 +270,7 @@ void drm_gem_dmabuf_release(struct dma_buf *dma_buf)struct drm_device *dev = obj->dev;/* drop the reference on the export fd holds */ -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);drm_dev_put (dev); }@@ -329,7 +329,7 @@ int drm_gem_prime_fd_to_handle(struct drm_device *dev,/* _handle_create_tail unconditionally unlocks dev->object_name_lock. */ ret =drm_gem_handle_create_tail (file_priv, obj, handle); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);if (ret) goto out_put;@@ -500,7 +500,7 @@ int drm_gem_prime_handle_to_fd(struct drm_device *dev, fail_put_dmabuf:dma_buf_put (dmabuf); out: -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj); out_unlock:mutex_unlock (&file_priv->prime.lock);include/drm/drm_gem.h +1
-3@@ -188,7 +188,7 @@ struct drm_gem_object {* Reference count of this object * * Please use drm_gem_object_get() to acquire and drm_gem_object_put_locked() -* or drm_gem_object_put_unlocked() to release a reference to a GEM +* or drm_gem_object_put() to release a reference to a GEM * buffer object. */ struct kref refcount;@@ -376,8 +376,6 @@ drm_gem_object_put(struct drm_gem_object *obj)kref_put (&obj->refcount, drm_gem_object_free); } -#define drm_gem_object_put_unlocked drm_gem_object_put -void drm_gem_object_put_locked (struct drm_gem_object *obj); int drm_gem_handle_create(struct drm_file *file_priv,Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 36/36] drm/gem: remove _unlocked suffix in drm_object_put_unlocked
Quoted 26 lines · Sam Ravnborg
Hi Emil.
Quoted 16 lines · Emil Velikov
From: Emil Velikov <[email protected]>
Spelling out
_unlockedfor each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involvingstruct_mutex.Just drop the suffix. It makes the API cleaner.
Done via the following script:
__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for__filein $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
doneQuoted 5 lines
With this patch, the
_unlockeddefine is no longer needed - remove it.Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>Signed-off-by Emil Velikov <[email protected]>
Quoted 8 lines
I had prefeered this was spilt in three patches:
1) drm_gem*
2)drm_client,drm_prime, drm-mm
3) Removal of the defineMaybe just squash 1) and 2) in the above, but I like it spelled out that the backward compatible define is dropped.
Think that we can combine your and Thomas' suggestions:
- fold all of drm in once patch - move it all to patch 11
- keep the #define removal as separate patch
-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 36/36] drm/gem: remove _unlocked suffix in drm_object_put_unlocked
Hi Emil.
Quoted 32 lines · Emil Velikov
Quoted 31 lines · Sam Ravnborg
Hi Emil.
Quoted 16 lines · Emil Velikov
From: Emil Velikov <[email protected]>
Spelling out
_unlockedfor each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involvingstruct_mutex.Just drop the suffix. It makes the API cleaner.
Done via the following script:
__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for__filein $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
doneQuoted 5 lines
With this patch, the
_unlockeddefine is no longer needed - remove it.Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>Signed-off-by Emil Velikov <[email protected]>I had prefeered this was spilt in three patches:
1) drm_gem*
2)drm_client,drm_prime, drm-mm
3) Removal of the define
Quoted 6 lines
Quoted 3 lines
Maybe just squash 1) and 2) in the above, but I like it spelled out that the backward compatible define is dropped.
Think that we can combine your and Thomas' suggestions:
- fold all of drm in once patch - move it all to patch 11
- keep the #define removal as separate patch
Yup, sound like a good plan.
Sam
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Thomas Zimmermann
maintainerRe: [PATCH 36/36] drm/gem: remove _unlocked suffix in drm_object_put_unlocked
In reply to Emil VelikovHi Emil,
one suggestion for this patch: it seems preferable to merge this patch with patch 11, so that the whole gem core gets converted at once. Afterwards all those other patches convert the drivers. Finally, patch 36 would only remove the define of drm_gem_object_put_unlocked().
Best regards
Thomas
Am 07.05.20 um 17:08 schrieb Emil Velikov:
Quoted 373 lines
From: Emil Velikov <[email protected]>
Spelling out
_unlockedfor each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involvingstruct_mutex.Just drop the suffix. It makes the API cleaner.
Done via the following script:
__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for__filein $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
doneWith this patch, the
_unlockeddefine is no longer needed - remove it.Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>Signed-off-by Emil Velikov <[email protected]>--- Documentation/gpu/drm-mm.rst | 2 +- drivers/gpu/drm/drm_client.c | 2 +- drivers/gpu/drm/drm_gem.c | 26 ++++++++++---------- drivers/gpu/drm/drm_gem_cma_helper.c | 8 +++--- drivers/gpu/drm/drm_gem_framebuffer_helper.c | 6 ++--- drivers/gpu/drm/drm_gem_shmem_helper.c | 4 +-- drivers/gpu/drm/drm_gem_ttm_helper.c | 2 +- drivers/gpu/drm/drm_gem_vram_helper.c | 10 ++++---- drivers/gpu/drm/drm_prime.c | 6 ++--- include/drm/drm_gem.h | 4 +-- 10 files changed, 34 insertions(+), 36 deletions(-)Documentation/gpu/drm-mm.rst +1
-1@@ -178,7 +178,7 @@ GEM Objects Lifetime -------------------- All GEM objects are reference-counted by the GEM core. References can be -acquired and release by calling drm_gem_object_get() and drm_gem_object_put_unlocked() +acquired and release by calling drm_gem_object_get() and drm_gem_object_put() respectively. When the last reference to a GEM object is released the GEM core callsdrivers/gpu/drm/drm_client.c +1
-1@@ -237,7 +237,7 @@ static void drm_client_buffer_delete(struct drm_client_buffer *buffer)drm_gem_vunmap (buffer->gem, buffer->vaddr);if (buffer->gem) -drm_gem_object_put_unlocked (buffer->gem); +drm_gem_object_put (buffer->gem);if (buffer->handle)drm_mode_destroy_dumb (dev, buffer->handle, buffer->client->file);drivers/gpu/drm/drm_gem.c +13
-13@@ -235,7 +235,7 @@ drm_gem_object_handle_put_unlocked(struct drm_gem_object *obj)mutex_unlock (&dev->object_name_lock);if (final) -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj); }/* @@ -331,7 +331,7 @@ int drm_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev, *offset =drm_vma_node_offset_addr (&obj->vma_node); out: -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; }@@ -690,7 +690,7 @@ static int objects_lookup(struct drm_file *filp, u32 *handle, int count,* Returns: * * @objs filled in with GEM object pointers. Returned GEM objects need to be -* released with drm_gem_object_put_unlocked(). -ENOENT is returned on a lookup +* released with drm_gem_object_put(). -ENOENT is returned on a lookup * failure. 0 is returned on success. * */ @@ -785,7 +785,7 @@ long drm_gem_dma_resv_wait(struct drm_file *filep, u32 handle,else if (ret >0 ) ret =0 ; -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; }@@ -860,7 +860,7 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data, err:mutex_unlock (&dev->object_name_lock); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; }@@ -898,7 +898,7 @@ drm_gem_open_ioctl(struct drm_device *dev, void *data,/* drm_gem_handle_create_tail unlocks dev->object_name_lock. */ ret =drm_gem_handle_create_tail (file_priv, obj, &handle); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);if (ret)return ret;@@ -991,7 +991,7 @@ EXPORT_SYMBOL(drm_gem_object_free);* driver doesn't use &drm_device.struct_mutex for anything. * * For drivers not encumbered with legacy locking use -* drm_gem_object_put_unlocked() instead. +* drm_gem_object_put() instead. */ void drm_gem_object_put_locked (struct drm_gem_object *obj)@@ -1030,7 +1030,7 @@ void drm_gem_vm_close(struct vm_area_struct *vma) {struct drm_gem_object *obj = vma->vm_private_data; -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj); }EXPORT_SYMBOL (drm_gem_vm_close);@@ -1079,7 +1079,7 @@ int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size,if (obj->funcs && obj->funcs->mmap) { ret = obj->funcs->mmap (obj, vma);if (ret) { -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; }WARN_ON (!(vma->vm_flags &VM_DONTEXPAND ));@@ -1089,7 +1089,7 @@ int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size,else if (dev->driver->gem_vm_ops) vma->vm_ops = dev->driver->gem_vm_ops;else { -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return -EINVAL ; }@@ -1155,13 +1155,13 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)return -EINVAL ;if (!drm_vma_node_is_allowed (node, priv)) { -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return -EACCES ; }if (node->readonly) {if (vma->vm_flags &VM_WRITE ) { -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return -EINVAL ; }@@ -1171,7 +1171,7 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma) ret =drm_gem_mmap_obj (obj,drm_vma_node_size (node) <<PAGE_SHIFT , vma); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return ret; }drivers/gpu/drm/drm_gem_cma_helper.c +4
-4@@ -114,7 +114,7 @@ struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm,return cma_obj; error: -drm_gem_object_put_unlocked (&cma_obj->base); +drm_gem_object_put (&cma_obj->base);return ERR_PTR (ret); }EXPORT_SYMBOL_GPL (drm_gem_cma_create);@@ -156,7 +156,7 @@ drm_gem_cma_create_with_handle(struct drm_file *file_priv,*/ ret =drm_gem_handle_create (file_priv, gem_obj, handle);/* drop reference from allocate - handle holds it now. */ -drm_gem_object_put_unlocked (gem_obj); +drm_gem_object_put (gem_obj);if (ret)return ERR_PTR (ret);@@ -380,13 +380,13 @@ unsigned long drm_gem_cma_get_unmapped_area(struct file *filp,return -EINVAL ;if (!drm_vma_node_is_allowed (node, priv)) { -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return -EACCES ; } cma_obj =to_drm_gem_cma_obj (obj); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);return cma_obj->vaddr ? (unsigned long )cma_obj->vaddr : -EINVAL ; }drivers/gpu/drm/drm_gem_framebuffer_helper.c +3
-3@@ -95,7 +95,7 @@ void drm_gem_fb_destroy(struct drm_framebuffer *fb)int i;for (i =0 ; i <4 ; i++) -drm_gem_object_put_unlocked (fb->obj[i]); +drm_gem_object_put (fb->obj[i]);drm_framebuffer_cleanup (fb);kfree (fb);@@ -175,7 +175,7 @@ int drm_gem_fb_init_with_funcs(struct drm_device *dev, + mode_cmd->offsets[i];if (objs[i]->size < min_size) { -drm_gem_object_put_unlocked (objs[i]); +drm_gem_object_put (objs[i]); ret = -EINVAL ; goto err_gem_object_put; }@@ -189,7 +189,7 @@ int drm_gem_fb_init_with_funcs(struct drm_device *dev, err_gem_object_put:for (i--; i >=0 ; i--) -drm_gem_object_put_unlocked (objs[i]); +drm_gem_object_put (objs[i]);return ret; }drivers/gpu/drm/drm_gem_shmem_helper.c +2
-2@@ -360,7 +360,7 @@ drm_gem_shmem_create_with_handle(struct drm_file *file_priv,*/ ret =drm_gem_handle_create (file_priv, &shmem->base, handle);/* drop reference from allocate - handle holds it now. */ -drm_gem_object_put_unlocked (&shmem->base); +drm_gem_object_put (&shmem->base);if (ret)return ERR_PTR (ret);@@ -684,7 +684,7 @@ drm_gem_shmem_prime_import_sg_table(struct drm_device *dev, err_free_array:kvfree (shmem->pages); err_free_gem: -drm_gem_object_put_unlocked (&shmem->base); +drm_gem_object_put (&shmem->base);return ERR_PTR (ret); }drivers/gpu/drm/drm_gem_ttm_helper.c +1
-1@@ -74,7 +74,7 @@ int drm_gem_ttm_mmap(struct drm_gem_object *gem,* ttm has its own object refcounting, so drop gem reference * to avoid double accounting counting. */ -drm_gem_object_put_unlocked (gem); +drm_gem_object_put (gem);return 0 ; }drivers/gpu/drm/drm_gem_vram_helper.c +5
-5@@ -618,9 +618,9 @@ int drm_gem_vram_fill_create_dumb(struct drm_file *file, ret =drm_gem_handle_create (file, &gbo->bo.base, &handle);if (ret) - goto err_drm_gem_object_put_unlocked; + goto err_drm_gem_object_put; -drm_gem_object_put_unlocked (&gbo->bo.base); +drm_gem_object_put (&gbo->bo.base); args->pitch = pitch; args->size = size;@@ -628,8 +628,8 @@ 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->bo.base); +err_drm_gem_object_put: +drm_gem_object_put (&gbo->bo.base);return ret; }EXPORT_SYMBOL (drm_gem_vram_fill_create_dumb);@@ -737,7 +737,7 @@ int drm_gem_vram_driver_dumb_mmap_offset(struct drm_file *file, gbo =drm_gem_vram_of_gem (gem); *offset =drm_gem_vram_mmap_offset (gbo); -drm_gem_object_put_unlocked (gem); +drm_gem_object_put (gem);return 0 ; }drivers/gpu/drm/drm_prime.c +3
-3@@ -270,7 +270,7 @@ void drm_gem_dmabuf_release(struct dma_buf *dma_buf)struct drm_device *dev = obj->dev;/* drop the reference on the export fd holds */ -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);drm_dev_put (dev); }@@ -329,7 +329,7 @@ int drm_gem_prime_fd_to_handle(struct drm_device *dev,/* _handle_create_tail unconditionally unlocks dev->object_name_lock. */ ret =drm_gem_handle_create_tail (file_priv, obj, handle); -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj);if (ret) goto out_put;@@ -500,7 +500,7 @@ int drm_gem_prime_handle_to_fd(struct drm_device *dev, fail_put_dmabuf:dma_buf_put (dmabuf); out: -drm_gem_object_put_unlocked (obj); +drm_gem_object_put (obj); out_unlock:mutex_unlock (&file_priv->prime.lock);include/drm/drm_gem.h +1
-3@@ -188,7 +188,7 @@ struct drm_gem_object {* Reference count of this object * * Please use drm_gem_object_get() to acquire and drm_gem_object_put_locked() -* or drm_gem_object_put_unlocked() to release a reference to a GEM +* or drm_gem_object_put() to release a reference to a GEM * buffer object. */ struct kref refcount;@@ -376,8 +376,6 @@ drm_gem_object_put(struct drm_gem_object *obj)kref_put (&obj->refcount, drm_gem_object_free); } -#define drm_gem_object_put_unlocked drm_gem_object_put -void drm_gem_object_put_locked (struct drm_gem_object *obj); int drm_gem_handle_create(struct drm_file *file_priv,
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
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi Emil.
Quoted 17 lines · Emil Velikov
Hi all,
Recently I had a look at the new dmabuf AMDGPU implementation.
Seemingly it was using the wrong
drm_gem_object_putAPI. Namely the locked one, even though the driver isstruct_mutexfree.Upon checking with the documentation, I've noticed it's a bit misleading so I've went ahead and:
- tweaked the drm_gem_object_put/struct_mutex references in the docs
- fixed up the AMDGPU caller
- removed thegem_free_objectdriver hook - \o/
- folddrm_gem_object_put_unlockedand__drm_gem_object_put
-drm_gem_object_put- add_lockedsuffix
-drm_gem_object_put_unlocked- remove_unlockedsuffix
Quoted 4 lines
Although the rename patches are a handful, it does make sense to have a consistent and obviously named API.
Input and reviews are highly appreciated.
All patches I did not comment are:
I see why you introduced _unlocked, and remove it again. So you could ask the compiler to help you.
But I see this as something that should not be committed and only part of your own tree.
But thats not something I feel too strong about - let's just say it confused me a lttle.
The driver patches was only skimmed, as they were mechanical anyway.
Sam
Quoted 134 lines
Emil
Cc Daniel Vetter <[email protected]>Emil Velikov (36):
drm: remove unuseddrm_gem.hinclude
drm/gem: use_unlockedreference indrm_gem_objects_lookupdocs drm/todo: mention i915 in thestruct_mutexsection drm/doc: dropstruct_mutexreferences
drm/doc: dropstruct_mutexrefernce fordrm_gem_object_freedrm/amdgpu: use the unlockeddrm_gem_object_putdrm/gma500: Use lockless gem BO free callback
drm: removedrm_driver::gem_free_object
drm/gem: folddrm_gem_object_put_unlockedand__drm_gem_object_put()drm/gem: add_lockedsuffix todrm_object_put
drm/gem: adddrm_object_puthelper
drm/amd: remove_unlockedsuffix indrm_object_put_unlockeddrm/arm: remove_unlockedsuffix indrm_object_put_unlockeddrm/armada: remove_unlockedsuffix indrm_object_put_unlockeddrm/etnaviv: remove_unlockedsuffix indrm_object_put_unlockeddrm/exynos: remove_unlockedsuffix indrm_object_put_unlockeddrm/gma500: remove_unlockedsuffix indrm_object_put_unlockeddrm/i915: remove_unlockedsuffix indrm_object_put_unlockeddrm/lima: remove_unlockedsuffix indrm_object_put_unlockeddrm/mediatek: remove_unlockedsuffix indrm_object_put_unlockeddrm/mgag200: remove_unlockedsuffix indrm_object_put_unlockeddrm/msm: remove_unlockedsuffix indrm_object_put_unlockeddrm/nouveau: remove_unlockedsuffix indrm_object_put_unlockeddrm/omapdrm: remove_unlockedsuffix indrm_object_put_unlockeddrm/panfrost: remove_unlockedsuffix indrm_object_put_unlockeddrm/qxl: remove_unlockedsuffix indrm_object_put_unlockeddrm/radeon: remove_unlockedsuffix indrm_object_put_unlockeddrm/rockchip: remove_unlockedsuffix indrm_object_put_unlockeddrm/tegra: remove_unlockedsuffix indrm_object_put_unlockeddrm/v3d: remove_unlockedsuffix indrm_object_put_unlockeddrm/vc4: remove_unlockedsuffix indrm_object_put_unlockeddrm/vgem: remove_unlockedsuffix indrm_object_put_unlockeddrm/virtio: remove_unlockedsuffix indrm_object_put_unlockeddrm/vkms: remove_unlockedsuffix indrm_object_put_unlockeddrm/xen: remove_unlockedsuffix indrm_object_put_unlockeddrm/gem: remove_unlockedsuffix indrm_object_put_unlockedDocumentation/gpu/drm-mm.rst | 5 +- Documentation/gpu/todo.rst | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 20 +++--- drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 6 +- drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 6 +- drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 6 +- drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 6 +- .../arm/display/komeda/komeda_framebuffer.c | 6 +- drivers/gpu/drm/arm/malidp_drv.c | 4 +- drivers/gpu/drm/armada/armada_crtc.c | 8 +-- drivers/gpu/drm/armada/armada_fb.c | 4 +- drivers/gpu/drm/armada/armada_fbdev.c | 6 +- drivers/gpu/drm/armada/armada_gem.c | 10 +-- drivers/gpu/drm/drm_client.c | 2 +- drivers/gpu/drm/drm_gem.c | 70 +++++-------------- drivers/gpu/drm/drm_gem_cma_helper.c | 8 +-- drivers/gpu/drm/drm_gem_framebuffer_helper.c | 6 +- drivers/gpu/drm/drm_gem_shmem_helper.c | 4 +- drivers/gpu/drm/drm_gem_ttm_helper.c | 2 +- drivers/gpu/drm/drm_gem_vram_helper.c | 10 +-- drivers/gpu/drm/drm_prime.c | 6 +- drivers/gpu/drm/drm_vm.c | 1 - drivers/gpu/drm/etnaviv/etnaviv_drv.c | 8 +-- drivers/gpu/drm/etnaviv/etnaviv_gem.c | 6 +- drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c | 2 +- drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 2 +- drivers/gpu/drm/exynos/exynos_drm_gem.c | 4 +- drivers/gpu/drm/exynos/exynos_drm_gem.h | 2 +- drivers/gpu/drm/gma500/framebuffer.c | 2 +- drivers/gpu/drm/gma500/gem.c | 2 +- drivers/gpu/drm/gma500/gma_display.c | 6 +- drivers/gpu/drm/gma500/psb_drv.c | 2 +- drivers/gpu/drm/i915/gem/i915_gem_object.h | 2 +- drivers/gpu/drm/lima/lima_gem.c | 10 +-- drivers/gpu/drm/lima/lima_sched.c | 2 +- drivers/gpu/drm/mediatek/mtk_drm_gem.c | 2 +- drivers/gpu/drm/mgag200/mgag200_cursor.c | 8 +-- drivers/gpu/drm/msm/adreno/a5xx_debugfs.c | 4 +- drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 6 +- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 2 +- drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c | 4 +- drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c | 2 +- drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 2 +- drivers/gpu/drm/msm/dsi/dsi_host.c | 2 +- drivers/gpu/drm/msm/msm_drv.c | 8 +-- drivers/gpu/drm/msm/msm_fb.c | 4 +- drivers/gpu/drm/msm/msm_gem.c | 18 ++--- drivers/gpu/drm/msm/msm_gem_submit.c | 2 +- drivers/gpu/drm/msm/msm_gpu.c | 2 +- drivers/gpu/drm/nouveau/dispnv04/crtc.c | 2 +- drivers/gpu/drm/nouveau/nouveau_abi16.c | 2 +- drivers/gpu/drm/nouveau/nouveau_display.c | 8 +-- drivers/gpu/drm/nouveau/nouveau_gem.c | 14 ++-- drivers/gpu/drm/omapdrm/omap_drv.c | 2 +- drivers/gpu/drm/omapdrm/omap_fb.c | 2 +- drivers/gpu/drm/omapdrm/omap_fbdev.c | 2 +- drivers/gpu/drm/omapdrm/omap_gem.c | 4 +- drivers/gpu/drm/panfrost/panfrost_drv.c | 10 +-- drivers/gpu/drm/panfrost/panfrost_gem.c | 4 +- drivers/gpu/drm/panfrost/panfrost_job.c | 2 +- drivers/gpu/drm/panfrost/panfrost_mmu.c | 2 +- drivers/gpu/drm/panfrost/panfrost_perfcnt.c | 4 +- drivers/gpu/drm/qxl/qxl_cmd.c | 2 +- drivers/gpu/drm/qxl/qxl_display.c | 6 +- drivers/gpu/drm/qxl/qxl_dumb.c | 2 +- drivers/gpu/drm/qxl/qxl_gem.c | 2 +- drivers/gpu/drm/qxl/qxl_ioctl.c | 4 +- drivers/gpu/drm/qxl/qxl_object.c | 4 +- drivers/gpu/drm/radeon/radeon_cs.c | 2 +- drivers/gpu/drm/radeon/radeon_cursor.c | 6 +- drivers/gpu/drm/radeon/radeon_display.c | 8 +-- drivers/gpu/drm/radeon/radeon_fb.c | 4 +- drivers/gpu/drm/radeon/radeon_gem.c | 30 ++++---- drivers/gpu/drm/radeon/radeon_object.c | 2 +- drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 2 +- drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 2 +- drivers/gpu/drm/tegra/drm.c | 12 ++-- drivers/gpu/drm/tegra/fb.c | 6 +- drivers/gpu/drm/tegra/gem.c | 4 +- drivers/gpu/drm/v3d/v3d_bo.c | 6 +- drivers/gpu/drm/v3d/v3d_gem.c | 4 +- drivers/gpu/drm/v3d/v3d_irq.c | 2 +- drivers/gpu/drm/vc4/vc4_bo.c | 14 ++-- drivers/gpu/drm/vc4/vc4_gem.c | 14 ++-- drivers/gpu/drm/vc4/vc4_kms.c | 2 +- drivers/gpu/drm/vc4/vc4_v3d.c | 4 +- drivers/gpu/drm/vgem/vgem_drv.c | 6 +- drivers/gpu/drm/vgem/vgem_fence.c | 2 +-
Quoted 16 lines
drivers/gpu/drm/virtio/virtgpu_display.c | 2 +- drivers/gpu/drm/virtio/virtgpu_gem.c | 6 +- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 6 +- drivers/gpu/drm/vkms/vkms_gem.c | 2 +- drivers/gpu/drm/xen/xen_drm_front.c | 4 +- include/drm/drm_drv.h | 8 --- include/drm/drm_gem.h | 28 +++----- 99 files changed, 269 insertions(+), 325 deletions(-)Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 20 lines · Sam Ravnborg
Hi Emil.
Quoted 17 lines · Emil Velikov
Hi all,
Recently I had a look at the new dmabuf AMDGPU implementation.
Seemingly it was using the wrong
drm_gem_object_putAPI. Namely the locked one, even though the driver isstruct_mutexfree.Upon checking with the documentation, I've noticed it's a bit misleading so I've went ahead and:
- tweaked the drm_gem_object_put/struct_mutex references in the docs
- fixed up the AMDGPU caller
- removed thegem_free_objectdriver hook - \o/
- folddrm_gem_object_put_unlockedand__drm_gem_object_put
-drm_gem_object_put- add_lockedsuffix
-drm_gem_object_put_unlocked- remove_unlockedsuffix
Quoted 7 lines
Quoted 4 lines
Although the rename patches are a handful, it does make sense to have a consistent and obviously named API.
Input and reviews are highly appreciated.
All patches I did not comment are:
Acked-by Sam Ravnborg <[email protected]>
Thanks Sam.
Quoted 8 lines
I see why you introduced
_unlocked, and remove it again. So you could ask the compiler to help you.But I see this as something that should not be committed and only part of your own tree.
But thats not something I feel too strong about - let's just say it confused me a lttle.
I believe the confusion should be addressed now.
-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel