dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] drm: Clean up plane helpers
@ 2022-07-20  8:30 Thomas Zimmermann
  2022-07-20  8:30 ` [PATCH 1/7] drm/vmwgfx: Remove trailing whitespace Thomas Zimmermann
                   ` (7 more replies)
  0 siblings, 8 replies; 16+ messages in thread
From: Thomas Zimmermann @ 2022-07-20  8:30 UTC (permalink / raw)
  To: airlied, daniel, airlied, zackr, linux, stefan, alison.wang
  Cc: linux-graphics-maintainer, Thomas Zimmermann, dri-devel

The plane helpers are included by dozens of files without any need. Only
a hand full of source files need anything from drm_plane_helper.h.

Untangle everything and tidy up the code a bit. The patches were built
on x64-64, aarch64 and arm without issues.

Thomas Zimmermann (7):
  drm/vmwgfx: Remove trailing whitespace
  drm/atomic-helper: Move DRM_PLANE_HELPER_NO_SCALING to atomic helpers
  drm/atomic-helper: Remove _HELPER_ infix from
    DRM_PLANE_HELPER_NO_SCALING
  drm: Remove unnecessary include statements of drm_plane_helper.h
  drm/plane-helper: Export individual helpers
  drm/armada: Use drm_plane_helper_destroy()
  drm/fsl-dcu: Use drm_plane_helper_destroy()

 drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h      |  1 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c      |  4 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 +-
 .../gpu/drm/arm/display/komeda/komeda_crtc.c  |  1 -
 .../gpu/drm/arm/display/komeda/komeda_plane.c |  1 -
 drivers/gpu/drm/arm/hdlcd_crtc.c              |  5 +-
 drivers/gpu/drm/arm/malidp_planes.c           |  1 -
 drivers/gpu/drm/armada/armada_crtc.c          |  1 -
 drivers/gpu/drm/armada/armada_overlay.c       |  8 +-
 drivers/gpu/drm/armada/armada_plane.c         |  2 +-
 drivers/gpu/drm/ast/ast_mode.c                |  9 +--
 .../gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c   |  1 -
 drivers/gpu/drm/drm_atomic_helper.c           |  1 -
 drivers/gpu/drm/drm_crtc_helper.c             |  1 -
 drivers/gpu/drm/drm_modeset_helper.c          |  8 +-
 drivers/gpu/drm/drm_plane_helper.c            | 74 +++++++++++++------
 drivers/gpu/drm/drm_simple_kms_helper.c       |  5 +-
 drivers/gpu/drm/exynos/exynos_drm_plane.c     |  1 -
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c   |  8 +-
 drivers/gpu/drm/gma500/psb_intel_display.c    |  2 -
 .../gpu/drm/hisilicon/kirin/kirin_drm_ade.c   |  1 -
 drivers/gpu/drm/i915/display/i9xx_plane.c     |  5 +-
 drivers/gpu/drm/i915/display/intel_atomic.c   |  1 -
 .../gpu/drm/i915/display/intel_atomic_plane.c |  1 -
 drivers/gpu/drm/i915/display/intel_crtc.c     |  1 -
 drivers/gpu/drm/i915/display/intel_cursor.c   |  5 +-
 drivers/gpu/drm/i915/display/intel_display.c  |  1 -
 drivers/gpu/drm/i915/display/intel_sprite.c   |  9 +--
 .../drm/i915/display/skl_universal_plane.c    |  5 +-
 drivers/gpu/drm/i915/intel_pm.c               |  1 -
 drivers/gpu/drm/imx/imx-drm-core.c            |  1 -
 drivers/gpu/drm/imx/ipuv3-plane.c             |  5 +-
 drivers/gpu/drm/ingenic/ingenic-drm-drv.c     |  5 +-
 drivers/gpu/drm/ingenic/ingenic-ipu.c         |  1 -
 drivers/gpu/drm/kmb/kmb_plane.c               |  5 +-
 drivers/gpu/drm/logicvc/logicvc_layer.c       |  5 +-
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c       |  1 -
 drivers/gpu/drm/mediatek/mtk_drm_plane.c      |  9 +--
 drivers/gpu/drm/meson/meson_overlay.c         |  1 -
 drivers/gpu/drm/meson/meson_plane.c           |  3 +-
 drivers/gpu/drm/mgag200/mgag200_mode.c        |  1 -
 drivers/gpu/drm/msm/msm_drv.h                 |  1 -
 drivers/gpu/drm/mxsfb/lcdif_kms.c             |  5 +-
 drivers/gpu/drm/mxsfb/mxsfb_kms.c             |  5 +-
 drivers/gpu/drm/nouveau/dispnv04/crtc.c       |  8 +-
 drivers/gpu/drm/nouveau/dispnv50/base507c.c   |  5 +-
 drivers/gpu/drm/nouveau/dispnv50/curs507a.c   |  5 +-
 drivers/gpu/drm/nouveau/dispnv50/disp.c       |  1 -
 drivers/gpu/drm/nouveau/dispnv50/ovly507e.c   |  5 +-
 drivers/gpu/drm/nouveau/dispnv50/wndwc37e.c   |  5 +-
 drivers/gpu/drm/nouveau/dispnv50/wndwc57e.c   |  1 -
 drivers/gpu/drm/omapdrm/omap_crtc.c           |  1 -
 drivers/gpu/drm/omapdrm/omap_overlay.c        |  1 -
 drivers/gpu/drm/omapdrm/omap_plane.c          |  1 -
 drivers/gpu/drm/qxl/qxl_display.c             |  4 +-
 drivers/gpu/drm/radeon/radeon_display.c       |  1 -
 drivers/gpu/drm/rcar-du/rcar_du_crtc.c        |  1 -
 drivers/gpu/drm/rcar-du/rcar_du_plane.c       |  5 +-
 drivers/gpu/drm/rcar-du/rcar_du_vsp.c         |  1 -
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c   |  9 +--
 drivers/gpu/drm/rockchip/rockchip_drm_vop2.c  |  1 -
 drivers/gpu/drm/shmobile/shmob_drm_crtc.c     |  1 -
 drivers/gpu/drm/sprd/sprd_dpu.c               |  5 +-
 drivers/gpu/drm/sti/sti_crtc.c                |  1 -
 drivers/gpu/drm/sti/sti_plane.h               |  1 -
 drivers/gpu/drm/stm/ltdc.c                    |  1 -
 drivers/gpu/drm/sun4i/sun4i_backend.c         |  1 -
 drivers/gpu/drm/sun4i/sun4i_layer.c           |  1 -
 drivers/gpu/drm/sun4i/sun8i_mixer.c           |  1 -
 drivers/gpu/drm/sun4i/sun8i_ui_layer.c        |  5 +-
 drivers/gpu/drm/sun4i/sun8i_vi_layer.c        |  5 +-
 drivers/gpu/drm/tegra/dc.c                    |  1 -
 drivers/gpu/drm/tegra/plane.c                 |  1 -
 drivers/gpu/drm/tests/drm_plane_helper_test.c | 33 ++++-----
 drivers/gpu/drm/tidss/tidss_crtc.c            |  1 -
 drivers/gpu/drm/tilcdc/tilcdc_plane.c         |  1 -
 drivers/gpu/drm/vboxvideo/vbox_mode.c         | 12 +--
 drivers/gpu/drm/vc4/vc4_kms.c                 |  1 -
 drivers/gpu/drm/vc4/vc4_plane.c               |  1 -
 drivers/gpu/drm/virtio/virtgpu_plane.c        |  5 +-
 drivers/gpu/drm/vkms/vkms_plane.c             |  5 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c           | 11 ++-
 drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c           |  1 -
 drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c          |  3 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c          |  1 -
 drivers/gpu/drm/xlnx/zynqmp_disp.c            |  5 +-
 include/drm/drm_atomic_helper.h               |  9 +++
 include/drm/drm_plane_helper.h                | 29 ++++----
 88 files changed, 189 insertions(+), 223 deletions(-)

-- 
2.36.1


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/7] drm/vmwgfx: Remove trailing whitespace
  2022-07-20  8:30 [PATCH 0/7] drm: Clean up plane helpers Thomas Zimmermann
@ 2022-07-20  8:30 ` Thomas Zimmermann
  2022-07-20 13:23   ` Zack Rusin
  2022-07-20  8:30 ` [PATCH 2/7] drm/atomic-helper: Move DRM_PLANE_HELPER_NO_SCALING to atomic helpers Thomas Zimmermann
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 16+ messages in thread
From: Thomas Zimmermann @ 2022-07-20  8:30 UTC (permalink / raw)
  To: airlied, daniel, airlied, zackr, linux, stefan, alison.wang
  Cc: linux-graphics-maintainer, Thomas Zimmermann, dri-devel

Fix coding style. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c  | 2 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index ff2f735bbe7a..c720a277489b 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -2257,7 +2257,7 @@ static int vmw_du_update_layout(struct vmw_private *dev_priv,
 	drm_modeset_drop_locks(&ctx);
 	drm_modeset_acquire_fini(&ctx);
 	mutex_unlock(&dev->mode_config.mutex);
- 
+
 	return 0;
 }
 
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
index c89ad3a2d141..b29e650d77f4 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
@@ -1383,6 +1383,6 @@ int vmw_kms_sou_readback(struct vmw_private *dev_priv,
 	vmw_validation_revert(&val_ctx);
 out_unref:
 	vmw_validation_unref_lists(&val_ctx);
-	
+
 	return ret;
 }
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 2/7] drm/atomic-helper: Move DRM_PLANE_HELPER_NO_SCALING to atomic helpers
  2022-07-20  8:30 [PATCH 0/7] drm: Clean up plane helpers Thomas Zimmermann
  2022-07-20  8:30 ` [PATCH 1/7] drm/vmwgfx: Remove trailing whitespace Thomas Zimmermann
@ 2022-07-20  8:30 ` Thomas Zimmermann
  2022-07-20  8:30 ` [PATCH 3/7] drm/atomic-helper: Remove _HELPER_ infix from DRM_PLANE_HELPER_NO_SCALING Thomas Zimmermann
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 16+ messages in thread
From: Thomas Zimmermann @ 2022-07-20  8:30 UTC (permalink / raw)
  To: airlied, daniel, airlied, zackr, linux, stefan, alison.wang
  Cc: linux-graphics-maintainer, Thomas Zimmermann, dri-devel

The macro DRM_PLANE_HELPER_NO_SCALING is only useful with the interfaces
in drm_atomic_helper.h, but defined in drm_plane_helper.h. So half of
DRM includes the latter header file for using this macro. Move the macro
and remove the include statements.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/arm/hdlcd_crtc.c                   | 1 -
 drivers/gpu/drm/ast/ast_mode.c                     | 1 -
 drivers/gpu/drm/drm_simple_kms_helper.c            | 1 -
 drivers/gpu/drm/i915/display/i9xx_plane.c          | 1 -
 drivers/gpu/drm/i915/display/intel_cursor.c        | 1 -
 drivers/gpu/drm/i915/display/intel_sprite.c        | 1 -
 drivers/gpu/drm/i915/display/skl_universal_plane.c | 1 -
 drivers/gpu/drm/imx/ipuv3-plane.c                  | 1 -
 drivers/gpu/drm/ingenic/ingenic-drm-drv.c          | 1 -
 drivers/gpu/drm/kmb/kmb_plane.c                    | 1 -
 drivers/gpu/drm/logicvc/logicvc_layer.c            | 1 -
 drivers/gpu/drm/mediatek/mtk_drm_plane.c           | 1 -
 drivers/gpu/drm/meson/meson_plane.c                | 1 -
 drivers/gpu/drm/mxsfb/lcdif_kms.c                  | 1 -
 drivers/gpu/drm/mxsfb/mxsfb_kms.c                  | 1 -
 drivers/gpu/drm/nouveau/dispnv50/base507c.c        | 1 -
 drivers/gpu/drm/nouveau/dispnv50/curs507a.c        | 1 -
 drivers/gpu/drm/nouveau/dispnv50/ovly507e.c        | 1 -
 drivers/gpu/drm/nouveau/dispnv50/wndwc37e.c        | 1 -
 drivers/gpu/drm/rcar-du/rcar_du_plane.c            | 1 -
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c        | 1 -
 drivers/gpu/drm/sprd/sprd_dpu.c                    | 1 -
 drivers/gpu/drm/sun4i/sun8i_ui_layer.c             | 1 -
 drivers/gpu/drm/sun4i/sun8i_vi_layer.c             | 1 -
 drivers/gpu/drm/tests/drm_plane_helper_test.c      | 1 -
 drivers/gpu/drm/virtio/virtgpu_plane.c             | 1 -
 drivers/gpu/drm/vkms/vkms_plane.c                  | 1 -
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c                | 1 -
 drivers/gpu/drm/xlnx/zynqmp_disp.c                 | 1 -
 include/drm/drm_atomic_helper.h                    | 9 +++++++++
 include/drm/drm_plane_helper.h                     | 9 ---------
 31 files changed, 9 insertions(+), 38 deletions(-)

diff --git a/drivers/gpu/drm/arm/hdlcd_crtc.c b/drivers/gpu/drm/arm/hdlcd_crtc.c
index afc9cd856501..3313d75a8860 100644
--- a/drivers/gpu/drm/arm/hdlcd_crtc.c
+++ b/drivers/gpu/drm/arm/hdlcd_crtc.c
@@ -23,7 +23,6 @@
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_of.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_vblank.h>
 
diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
index 214b10178454..7fd2e20f743d 100644
--- a/drivers/gpu/drm/ast/ast_mode.c
+++ b/drivers/gpu/drm/ast/ast_mode.c
@@ -42,7 +42,6 @@
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_gem_vram_helper.h>
 #include <drm/drm_managed.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_simple_kms_helper.h>
 
diff --git a/drivers/gpu/drm/drm_simple_kms_helper.c b/drivers/gpu/drm/drm_simple_kms_helper.c
index 36633590ebf3..64800f158e69 100644
--- a/drivers/gpu/drm/drm_simple_kms_helper.c
+++ b/drivers/gpu/drm/drm_simple_kms_helper.c
@@ -12,7 +12,6 @@
 #include <drm/drm_drv.h>
 #include <drm/drm_gem_atomic_helper.h>
 #include <drm/drm_managed.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_simple_kms_helper.h>
 
diff --git a/drivers/gpu/drm/i915/display/i9xx_plane.c b/drivers/gpu/drm/i915/display/i9xx_plane.c
index 592e5adfed8b..6d22e6edef2a 100644
--- a/drivers/gpu/drm/i915/display/i9xx_plane.c
+++ b/drivers/gpu/drm/i915/display/i9xx_plane.c
@@ -7,7 +7,6 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_blend.h>
 #include <drm/drm_fourcc.h>
-#include <drm/drm_plane_helper.h>
 
 #include "intel_atomic.h"
 #include "intel_atomic_plane.h"
diff --git a/drivers/gpu/drm/i915/display/intel_cursor.c b/drivers/gpu/drm/i915/display/intel_cursor.c
index c2797ad2d313..e49927965a6b 100644
--- a/drivers/gpu/drm/i915/display/intel_cursor.c
+++ b/drivers/gpu/drm/i915/display/intel_cursor.c
@@ -8,7 +8,6 @@
 #include <drm/drm_atomic_uapi.h>
 #include <drm/drm_blend.h>
 #include <drm/drm_damage_helper.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_fourcc.h>
 
 #include "intel_atomic.h"
diff --git a/drivers/gpu/drm/i915/display/intel_sprite.c b/drivers/gpu/drm/i915/display/intel_sprite.c
index 2713faad0625..a10c29226289 100644
--- a/drivers/gpu/drm/i915/display/intel_sprite.c
+++ b/drivers/gpu/drm/i915/display/intel_sprite.c
@@ -39,7 +39,6 @@
 #include <drm/drm_crtc.h>
 #include <drm/drm_damage_helper.h>
 #include <drm/drm_fourcc.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_rect.h>
 
 #include "i915_drv.h"
diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.c b/drivers/gpu/drm/i915/display/skl_universal_plane.c
index c11e15a93164..87c202ec7d1e 100644
--- a/drivers/gpu/drm/i915/display/skl_universal_plane.c
+++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c
@@ -7,7 +7,6 @@
 #include <drm/drm_blend.h>
 #include <drm/drm_damage_helper.h>
 #include <drm/drm_fourcc.h>
-#include <drm/drm_plane_helper.h>
 
 #include "i915_drv.h"
 #include "intel_atomic_plane.h"
diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c b/drivers/gpu/drm/imx/ipuv3-plane.c
index ea5f594955df..26a0e2e2a366 100644
--- a/drivers/gpu/drm/imx/ipuv3-plane.c
+++ b/drivers/gpu/drm/imx/ipuv3-plane.c
@@ -14,7 +14,6 @@
 #include <drm/drm_gem_atomic_helper.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_managed.h>
-#include <drm/drm_plane_helper.h>
 
 #include <video/imx-ipu-v3.h>
 
diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
index 4de729bbf152..be699cc993d5 100644
--- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
+++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
@@ -41,7 +41,6 @@
 #include <drm/drm_of.h>
 #include <drm/drm_panel.h>
 #include <drm/drm_plane.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_vblank.h>
 
diff --git a/drivers/gpu/drm/kmb/kmb_plane.c b/drivers/gpu/drm/kmb/kmb_plane.c
index 89d055a089a6..563b04ca80ee 100644
--- a/drivers/gpu/drm/kmb/kmb_plane.c
+++ b/drivers/gpu/drm/kmb/kmb_plane.c
@@ -14,7 +14,6 @@
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_managed.h>
-#include <drm/drm_plane_helper.h>
 
 #include "kmb_drv.h"
 #include "kmb_plane.h"
diff --git a/drivers/gpu/drm/logicvc/logicvc_layer.c b/drivers/gpu/drm/logicvc/logicvc_layer.c
index 441e3cfce4cf..adeea9fd11d5 100644
--- a/drivers/gpu/drm/logicvc/logicvc_layer.c
+++ b/drivers/gpu/drm/logicvc/logicvc_layer.c
@@ -14,7 +14,6 @@
 #include <drm/drm_fourcc.h>
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_plane.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_print.h>
 
 #include "logicvc_crtc.h"
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_plane.c b/drivers/gpu/drm/mediatek/mtk_drm_plane.c
index 5c0d9ce69931..414269b0f8bc 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_plane.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_plane.c
@@ -11,7 +11,6 @@
 #include <drm/drm_fourcc.h>
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_atomic_helper.h>
-#include <drm/drm_plane_helper.h>
 
 #include "mtk_drm_crtc.h"
 #include "mtk_drm_ddp_comp.h"
diff --git a/drivers/gpu/drm/meson/meson_plane.c b/drivers/gpu/drm/meson/meson_plane.c
index b9ac932af8d0..973ea08ad1a7 100644
--- a/drivers/gpu/drm/meson/meson_plane.c
+++ b/drivers/gpu/drm/meson/meson_plane.c
@@ -20,7 +20,6 @@
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_atomic_helper.h>
 #include <drm/drm_gem_cma_helper.h>
-#include <drm/drm_plane_helper.h>
 
 #include "meson_plane.h"
 #include "meson_registers.h"
diff --git a/drivers/gpu/drm/mxsfb/lcdif_kms.c b/drivers/gpu/drm/mxsfb/lcdif_kms.c
index 1bec1279c8b5..6b52280e3702 100644
--- a/drivers/gpu/drm/mxsfb/lcdif_kms.c
+++ b/drivers/gpu/drm/mxsfb/lcdif_kms.c
@@ -23,7 +23,6 @@
 #include <drm/drm_gem_atomic_helper.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_plane.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_vblank.h>
 
 #include "lcdif_drv.h"
diff --git a/drivers/gpu/drm/mxsfb/mxsfb_kms.c b/drivers/gpu/drm/mxsfb/mxsfb_kms.c
index e38ce5737a5f..1279b4e1697d 100644
--- a/drivers/gpu/drm/mxsfb/mxsfb_kms.c
+++ b/drivers/gpu/drm/mxsfb/mxsfb_kms.c
@@ -26,7 +26,6 @@
 #include <drm/drm_gem_atomic_helper.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_plane.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_vblank.h>
 
 #include "mxsfb_drv.h"
diff --git a/drivers/gpu/drm/nouveau/dispnv50/base507c.c b/drivers/gpu/drm/nouveau/dispnv50/base507c.c
index 788db043a342..65cefaaf88f6 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/base507c.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/base507c.c
@@ -30,7 +30,6 @@
 
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_fourcc.h>
-#include <drm/drm_plane_helper.h>
 
 #include "nouveau_bo.h"
 
diff --git a/drivers/gpu/drm/nouveau/dispnv50/curs507a.c b/drivers/gpu/drm/nouveau/dispnv50/curs507a.c
index 00e19fd959ea..24f7b1963a2a 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/curs507a.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/curs507a.c
@@ -29,7 +29,6 @@
 #include <nvhw/class/cl507a.h>
 
 #include <drm/drm_atomic_helper.h>
-#include <drm/drm_plane_helper.h>
 
 bool
 curs507a_space(struct nv50_wndw *wndw)
diff --git a/drivers/gpu/drm/nouveau/dispnv50/ovly507e.c b/drivers/gpu/drm/nouveau/dispnv50/ovly507e.c
index afd6c7271de1..41ac9c67667c 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/ovly507e.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/ovly507e.c
@@ -24,7 +24,6 @@
 
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_fourcc.h>
-#include <drm/drm_plane_helper.h>
 
 #include <nvif/cl507e.h>
 #include <nvif/event.h>
diff --git a/drivers/gpu/drm/nouveau/dispnv50/wndwc37e.c b/drivers/gpu/drm/nouveau/dispnv50/wndwc37e.c
index 183d2c0e65b6..b8e4c44c0854 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/wndwc37e.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/wndwc37e.c
@@ -23,7 +23,6 @@
 #include "atom.h"
 
 #include <drm/drm_atomic_helper.h>
-#include <drm/drm_plane_helper.h>
 #include <nouveau_bo.h>
 
 #include <nvif/clc37e.h>
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
index e98b76db703a..473f634da964 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
@@ -16,7 +16,6 @@
 #include <drm/drm_fourcc.h>
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_cma_helper.h>
-#include <drm/drm_plane_helper.h>
 
 #include "rcar_du_drv.h"
 #include "rcar_du_group.h"
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index ad3958b6f8bf..efc783c8f653 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -27,7 +27,6 @@
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_atomic_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_self_refresh_helper.h>
 #include <drm/drm_vblank.h>
diff --git a/drivers/gpu/drm/sprd/sprd_dpu.c b/drivers/gpu/drm/sprd/sprd_dpu.c
index 3664089b6983..03e760260d9c 100644
--- a/drivers/gpu/drm/sprd/sprd_dpu.c
+++ b/drivers/gpu/drm/sprd/sprd_dpu.c
@@ -23,7 +23,6 @@
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
-#include <drm/drm_plane_helper.h>
 
 #include "sprd_drm.h"
 #include "sprd_dpu.h"
diff --git a/drivers/gpu/drm/sun4i/sun8i_ui_layer.c b/drivers/gpu/drm/sun4i/sun8i_ui_layer.c
index 36da962de394..da1d4ec2e22b 100644
--- a/drivers/gpu/drm/sun4i/sun8i_ui_layer.c
+++ b/drivers/gpu/drm/sun4i/sun8i_ui_layer.c
@@ -18,7 +18,6 @@
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_atomic_helper.h>
 #include <drm/drm_gem_cma_helper.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_probe_helper.h>
 
 #include "sun8i_mixer.h"
diff --git a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
index 1fee6499bdd3..4bd295c2d340 100644
--- a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
+++ b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
@@ -11,7 +11,6 @@
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_atomic_helper.h>
 #include <drm/drm_gem_cma_helper.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_probe_helper.h>
 
 #include "sun8i_csc.h"
diff --git a/drivers/gpu/drm/tests/drm_plane_helper_test.c b/drivers/gpu/drm/tests/drm_plane_helper_test.c
index e298766cd41f..ec1654cdfc42 100644
--- a/drivers/gpu/drm/tests/drm_plane_helper_test.c
+++ b/drivers/gpu/drm/tests/drm_plane_helper_test.c
@@ -9,7 +9,6 @@
 
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_framebuffer.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_modes.h>
 
 static void set_src(struct drm_plane_state *plane_state,
diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c
index 6d3cc9e238a4..58f4a52d039e 100644
--- a/drivers/gpu/drm/virtio/virtgpu_plane.c
+++ b/drivers/gpu/drm/virtio/virtgpu_plane.c
@@ -26,7 +26,6 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_damage_helper.h>
 #include <drm/drm_fourcc.h>
-#include <drm/drm_plane_helper.h>
 
 #include "virtgpu_drv.h"
 
diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c
index d8eb674b49a6..22238db6f8a5 100644
--- a/drivers/gpu/drm/vkms/vkms_plane.c
+++ b/drivers/gpu/drm/vkms/vkms_plane.c
@@ -7,7 +7,6 @@
 #include <drm/drm_fourcc.h>
 #include <drm/drm_gem_atomic_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
-#include <drm/drm_plane_helper.h>
 
 #include "vkms_drv.h"
 
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index c720a277489b..a19580109f33 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -29,7 +29,6 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_damage_helper.h>
 #include <drm/drm_fourcc.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_rect.h>
 #include <drm/drm_sysfs.h>
 #include <drm/drm_vblank.h>
diff --git a/drivers/gpu/drm/xlnx/zynqmp_disp.c b/drivers/gpu/drm/xlnx/zynqmp_disp.c
index cc32aa89cf8f..d3bdecabf4e5 100644
--- a/drivers/gpu/drm/xlnx/zynqmp_disp.c
+++ b/drivers/gpu/drm/xlnx/zynqmp_disp.c
@@ -20,7 +20,6 @@
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_managed.h>
 #include <drm/drm_plane.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_vblank.h>
 
 #include <linux/clk.h>
diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h
index 2a0b17842402..ab778aad7359 100644
--- a/include/drm/drm_atomic_helper.h
+++ b/include/drm/drm_atomic_helper.h
@@ -34,6 +34,15 @@
 #include <drm/drm_atomic_state_helper.h>
 #include <drm/drm_util.h>
 
+/*
+ * Drivers that don't allow primary plane scaling may pass this macro in place
+ * of the min/max scale parameters of the plane-state checker function.
+ *
+ * Due to src being in 16.16 fixed point and dest being in integer pixels,
+ * 1<<16 represents no scaling.
+ */
+#define DRM_PLANE_HELPER_NO_SCALING (1<<16)
+
 struct drm_atomic_state;
 struct drm_private_obj;
 struct drm_private_state;
diff --git a/include/drm/drm_plane_helper.h b/include/drm/drm_plane_helper.h
index 331ebd60b3a3..ff85ef41cb33 100644
--- a/include/drm/drm_plane_helper.h
+++ b/include/drm/drm_plane_helper.h
@@ -29,15 +29,6 @@
 #include <drm/drm_modeset_helper_vtables.h>
 #include <drm/drm_modeset_helper.h>
 
-/*
- * Drivers that don't allow primary plane scaling may pass this macro in place
- * of the min/max scale parameters of the update checker function.
- *
- * Due to src being in 16.16 fixed point and dest being in integer pixels,
- * 1<<16 represents no scaling.
- */
-#define DRM_PLANE_HELPER_NO_SCALING (1<<16)
-
 void drm_primary_helper_destroy(struct drm_plane *plane);
 extern const struct drm_plane_funcs drm_primary_helper_funcs;
 
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 3/7] drm/atomic-helper: Remove _HELPER_ infix from DRM_PLANE_HELPER_NO_SCALING
  2022-07-20  8:30 [PATCH 0/7] drm: Clean up plane helpers Thomas Zimmermann
  2022-07-20  8:30 ` [PATCH 1/7] drm/vmwgfx: Remove trailing whitespace Thomas Zimmermann
  2022-07-20  8:30 ` [PATCH 2/7] drm/atomic-helper: Move DRM_PLANE_HELPER_NO_SCALING to atomic helpers Thomas Zimmermann
@ 2022-07-20  8:30 ` Thomas Zimmermann
  2022-07-20  8:30 ` [PATCH 4/7] drm: Remove unnecessary include statements of drm_plane_helper.h Thomas Zimmermann
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 16+ messages in thread
From: Thomas Zimmermann @ 2022-07-20  8:30 UTC (permalink / raw)
  To: airlied, daniel, airlied, zackr, linux, stefan, alison.wang
  Cc: linux-graphics-maintainer, Thomas Zimmermann, dri-devel

Rename DRM_PLANE_HELPER_NO_SCALING to DRM_PLANE_NO_SCALING. The constant
is not really a helper, but rather a characteristic of the plane itself.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c      |  4 +--
 drivers/gpu/drm/arm/hdlcd_crtc.c              |  4 +--
 drivers/gpu/drm/ast/ast_mode.c                |  8 ++---
 drivers/gpu/drm/drm_plane_helper.c            |  4 +--
 drivers/gpu/drm/drm_simple_kms_helper.c       |  4 +--
 drivers/gpu/drm/i915/display/i9xx_plane.c     |  4 +--
 drivers/gpu/drm/i915/display/intel_cursor.c   |  4 +--
 drivers/gpu/drm/i915/display/intel_sprite.c   |  8 ++---
 .../drm/i915/display/skl_universal_plane.c    |  4 +--
 drivers/gpu/drm/imx/ipuv3-plane.c             |  4 +--
 drivers/gpu/drm/ingenic/ingenic-drm-drv.c     |  4 +--
 drivers/gpu/drm/kmb/kmb_plane.c               |  4 +--
 drivers/gpu/drm/logicvc/logicvc_layer.c       |  4 +--
 drivers/gpu/drm/mediatek/mtk_drm_plane.c      |  8 ++---
 drivers/gpu/drm/meson/meson_plane.c           |  2 +-
 drivers/gpu/drm/mxsfb/lcdif_kms.c             |  4 +--
 drivers/gpu/drm/mxsfb/mxsfb_kms.c             |  4 +--
 drivers/gpu/drm/nouveau/dispnv50/base507c.c   |  4 +--
 drivers/gpu/drm/nouveau/dispnv50/curs507a.c   |  4 +--
 drivers/gpu/drm/nouveau/dispnv50/ovly507e.c   |  4 +--
 drivers/gpu/drm/nouveau/dispnv50/wndwc37e.c   |  4 +--
 drivers/gpu/drm/rcar-du/rcar_du_plane.c       |  4 +--
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c   |  8 ++---
 drivers/gpu/drm/sprd/sprd_dpu.c               |  4 +--
 drivers/gpu/drm/sun4i/sun8i_ui_layer.c        |  4 +--
 drivers/gpu/drm/sun4i/sun8i_vi_layer.c        |  4 +--
 drivers/gpu/drm/tests/drm_plane_helper_test.c | 32 +++++++++----------
 drivers/gpu/drm/vboxvideo/vbox_mode.c         |  8 ++---
 drivers/gpu/drm/virtio/virtgpu_plane.c        |  4 +--
 drivers/gpu/drm/vkms/vkms_plane.c             |  4 +--
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c           |  8 ++---
 drivers/gpu/drm/xlnx/zynqmp_disp.c            |  4 +--
 include/drm/drm_atomic_helper.h               |  2 +-
 33 files changed, 90 insertions(+), 90 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c
index 108e8e8a1a36..a60cb6d84b79 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c
@@ -282,8 +282,8 @@ static int amdgpu_vkms_plane_atomic_check(struct drm_plane *plane,
 		return PTR_ERR(crtc_state);
 
 	ret = drm_atomic_helper_check_plane_state(new_plane_state, crtc_state,
-						  DRM_PLANE_HELPER_NO_SCALING,
-						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
 						  false, true);
 	if (ret != 0)
 		return ret;
diff --git a/drivers/gpu/drm/arm/hdlcd_crtc.c b/drivers/gpu/drm/arm/hdlcd_crtc.c
index 3313d75a8860..636ef9447830 100644
--- a/drivers/gpu/drm/arm/hdlcd_crtc.c
+++ b/drivers/gpu/drm/arm/hdlcd_crtc.c
@@ -251,8 +251,8 @@ static int hdlcd_plane_atomic_check(struct drm_plane *plane,
 			return -EINVAL;
 		return drm_atomic_helper_check_plane_state(new_plane_state,
 							   crtc_state,
-							   DRM_PLANE_HELPER_NO_SCALING,
-							   DRM_PLANE_HELPER_NO_SCALING,
+							   DRM_PLANE_NO_SCALING,
+							   DRM_PLANE_NO_SCALING,
 							   false, true);
 	}
 
diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
index 7fd2e20f743d..103bd4fa698b 100644
--- a/drivers/gpu/drm/ast/ast_mode.c
+++ b/drivers/gpu/drm/ast/ast_mode.c
@@ -554,8 +554,8 @@ static int ast_primary_plane_helper_atomic_check(struct drm_plane *plane,
 						   new_plane_state->crtc);
 
 	ret = drm_atomic_helper_check_plane_state(new_plane_state, crtc_state,
-						  DRM_PLANE_HELPER_NO_SCALING,
-						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
 						  false, true);
 	if (ret)
 		return ret;
@@ -778,8 +778,8 @@ static int ast_cursor_plane_helper_atomic_check(struct drm_plane *plane,
 						   new_plane_state->crtc);
 
 	ret = drm_atomic_helper_check_plane_state(new_plane_state, crtc_state,
-						  DRM_PLANE_HELPER_NO_SCALING,
-						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
 						  true, true);
 	if (ret)
 		return ret;
diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
index 838b32b70bce..bc08edd69030 100644
--- a/drivers/gpu/drm/drm_plane_helper.c
+++ b/drivers/gpu/drm/drm_plane_helper.c
@@ -179,8 +179,8 @@ static int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *c
 	ret = drm_plane_helper_check_update(plane, crtc, fb,
 					    &src, &dest,
 					    DRM_MODE_ROTATE_0,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    DRM_PLANE_HELPER_NO_SCALING,
+					    DRM_PLANE_NO_SCALING,
+					    DRM_PLANE_NO_SCALING,
 					    false, false, &visible);
 	if (ret)
 		return ret;
diff --git a/drivers/gpu/drm/drm_simple_kms_helper.c b/drivers/gpu/drm/drm_simple_kms_helper.c
index 64800f158e69..e9f782119d3d 100644
--- a/drivers/gpu/drm/drm_simple_kms_helper.c
+++ b/drivers/gpu/drm/drm_simple_kms_helper.c
@@ -222,8 +222,8 @@ static int drm_simple_kms_plane_atomic_check(struct drm_plane *plane,
 						   &pipe->crtc);
 
 	ret = drm_atomic_helper_check_plane_state(plane_state, crtc_state,
-						  DRM_PLANE_HELPER_NO_SCALING,
-						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
 						  false, false);
 	if (ret)
 		return ret;
diff --git a/drivers/gpu/drm/i915/display/i9xx_plane.c b/drivers/gpu/drm/i915/display/i9xx_plane.c
index 6d22e6edef2a..0f35f2facdfc 100644
--- a/drivers/gpu/drm/i915/display/i9xx_plane.c
+++ b/drivers/gpu/drm/i915/display/i9xx_plane.c
@@ -325,8 +325,8 @@ i9xx_plane_check(struct intel_crtc_state *crtc_state,
 		return ret;
 
 	ret = intel_atomic_plane_check_clipping(plane_state, crtc_state,
-						DRM_PLANE_HELPER_NO_SCALING,
-						DRM_PLANE_HELPER_NO_SCALING,
+						DRM_PLANE_NO_SCALING,
+						DRM_PLANE_NO_SCALING,
 						i9xx_plane_has_windowing(plane));
 	if (ret)
 		return ret;
diff --git a/drivers/gpu/drm/i915/display/intel_cursor.c b/drivers/gpu/drm/i915/display/intel_cursor.c
index e49927965a6b..16ac560eab49 100644
--- a/drivers/gpu/drm/i915/display/intel_cursor.c
+++ b/drivers/gpu/drm/i915/display/intel_cursor.c
@@ -143,8 +143,8 @@ static int intel_check_cursor(struct intel_crtc_state *crtc_state,
 	}
 
 	ret = intel_atomic_plane_check_clipping(plane_state, crtc_state,
-						DRM_PLANE_HELPER_NO_SCALING,
-						DRM_PLANE_HELPER_NO_SCALING,
+						DRM_PLANE_NO_SCALING,
+						DRM_PLANE_NO_SCALING,
 						true);
 	if (ret)
 		return ret;
diff --git a/drivers/gpu/drm/i915/display/intel_sprite.c b/drivers/gpu/drm/i915/display/intel_sprite.c
index a10c29226289..7649c50b5445 100644
--- a/drivers/gpu/drm/i915/display/intel_sprite.c
+++ b/drivers/gpu/drm/i915/display/intel_sprite.c
@@ -1354,8 +1354,8 @@ g4x_sprite_check(struct intel_crtc_state *crtc_state,
 {
 	struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
 	struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
-	int min_scale = DRM_PLANE_HELPER_NO_SCALING;
-	int max_scale = DRM_PLANE_HELPER_NO_SCALING;
+	int min_scale = DRM_PLANE_NO_SCALING;
+	int max_scale = DRM_PLANE_NO_SCALING;
 	int ret;
 
 	if (g4x_fb_scalable(plane_state->hw.fb)) {
@@ -1425,8 +1425,8 @@ vlv_sprite_check(struct intel_crtc_state *crtc_state,
 		return ret;
 
 	ret = intel_atomic_plane_check_clipping(plane_state, crtc_state,
-						DRM_PLANE_HELPER_NO_SCALING,
-						DRM_PLANE_HELPER_NO_SCALING,
+						DRM_PLANE_NO_SCALING,
+						DRM_PLANE_NO_SCALING,
 						true);
 	if (ret)
 		return ret;
diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.c b/drivers/gpu/drm/i915/display/skl_universal_plane.c
index 87c202ec7d1e..4d6a27757065 100644
--- a/drivers/gpu/drm/i915/display/skl_universal_plane.c
+++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c
@@ -1855,8 +1855,8 @@ static int skl_plane_check(struct intel_crtc_state *crtc_state,
 	struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
 	struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
 	const struct drm_framebuffer *fb = plane_state->hw.fb;
-	int min_scale = DRM_PLANE_HELPER_NO_SCALING;
-	int max_scale = DRM_PLANE_HELPER_NO_SCALING;
+	int min_scale = DRM_PLANE_NO_SCALING;
+	int max_scale = DRM_PLANE_NO_SCALING;
 	int ret;
 
 	ret = skl_plane_check_fb(crtc_state, plane_state);
diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c b/drivers/gpu/drm/imx/ipuv3-plane.c
index 26a0e2e2a366..f1b397693af8 100644
--- a/drivers/gpu/drm/imx/ipuv3-plane.c
+++ b/drivers/gpu/drm/imx/ipuv3-plane.c
@@ -392,8 +392,8 @@ static int ipu_plane_atomic_check(struct drm_plane *plane,
 		return -EINVAL;
 
 	ret = drm_atomic_helper_check_plane_state(new_state, crtc_state,
-						  DRM_PLANE_HELPER_NO_SCALING,
-						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
 						  can_position, true);
 	if (ret)
 		return ret;
diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
index be699cc993d5..f5835e6bf877 100644
--- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
+++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
@@ -481,8 +481,8 @@ static int ingenic_drm_plane_atomic_check(struct drm_plane *plane,
 		return PTR_ERR(priv_state);
 
 	ret = drm_atomic_helper_check_plane_state(new_plane_state, crtc_state,
-						  DRM_PLANE_HELPER_NO_SCALING,
-						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
 						  priv->soc_info->has_osd,
 						  true);
 	if (ret)
diff --git a/drivers/gpu/drm/kmb/kmb_plane.c b/drivers/gpu/drm/kmb/kmb_plane.c
index 563b04ca80ee..e385b8741776 100644
--- a/drivers/gpu/drm/kmb/kmb_plane.c
+++ b/drivers/gpu/drm/kmb/kmb_plane.c
@@ -135,8 +135,8 @@ static int kmb_plane_atomic_check(struct drm_plane *plane,
 						   new_plane_state->crtc);
 	return drm_atomic_helper_check_plane_state(new_plane_state,
 						   crtc_state,
-						   DRM_PLANE_HELPER_NO_SCALING,
-						   DRM_PLANE_HELPER_NO_SCALING,
+						   DRM_PLANE_NO_SCALING,
+						   DRM_PLANE_NO_SCALING,
 						   can_position, true);
 }
 
diff --git a/drivers/gpu/drm/logicvc/logicvc_layer.c b/drivers/gpu/drm/logicvc/logicvc_layer.c
index adeea9fd11d5..466f9bd88bc1 100644
--- a/drivers/gpu/drm/logicvc/logicvc_layer.c
+++ b/drivers/gpu/drm/logicvc/logicvc_layer.c
@@ -116,8 +116,8 @@ static int logicvc_plane_atomic_check(struct drm_plane *drm_plane,
 		}
 	}
 
-	min_scale = DRM_PLANE_HELPER_NO_SCALING;
-	max_scale = DRM_PLANE_HELPER_NO_SCALING;
+	min_scale = DRM_PLANE_NO_SCALING;
+	max_scale = DRM_PLANE_NO_SCALING;
 
 	can_position = (drm_plane->type == DRM_PLANE_TYPE_OVERLAY &&
 			layer->index != (logicvc->config.layers_count - 1) &&
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_plane.c b/drivers/gpu/drm/mediatek/mtk_drm_plane.c
index 414269b0f8bc..2f5e007dd380 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_plane.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_plane.c
@@ -107,8 +107,8 @@ static int mtk_plane_atomic_async_check(struct drm_plane *plane,
 		crtc_state = new_plane_state->crtc->state;
 
 	return drm_atomic_helper_check_plane_state(plane->state, crtc_state,
-						   DRM_PLANE_HELPER_NO_SCALING,
-						   DRM_PLANE_HELPER_NO_SCALING,
+						   DRM_PLANE_NO_SCALING,
+						   DRM_PLANE_NO_SCALING,
 						   true, true);
 }
 
@@ -201,8 +201,8 @@ static int mtk_plane_atomic_check(struct drm_plane *plane,
 
 	return drm_atomic_helper_check_plane_state(new_plane_state,
 						   crtc_state,
-						   DRM_PLANE_HELPER_NO_SCALING,
-						   DRM_PLANE_HELPER_NO_SCALING,
+						   DRM_PLANE_NO_SCALING,
+						   DRM_PLANE_NO_SCALING,
 						   true, true);
 }
 
diff --git a/drivers/gpu/drm/meson/meson_plane.c b/drivers/gpu/drm/meson/meson_plane.c
index 973ea08ad1a7..f3d49e81acf4 100644
--- a/drivers/gpu/drm/meson/meson_plane.c
+++ b/drivers/gpu/drm/meson/meson_plane.c
@@ -94,7 +94,7 @@ static int meson_plane_atomic_check(struct drm_plane *plane,
 	return drm_atomic_helper_check_plane_state(new_plane_state,
 						   crtc_state,
 						   FRAC_16_16(1, 5),
-						   DRM_PLANE_HELPER_NO_SCALING,
+						   DRM_PLANE_NO_SCALING,
 						   false, true);
 }
 
diff --git a/drivers/gpu/drm/mxsfb/lcdif_kms.c b/drivers/gpu/drm/mxsfb/lcdif_kms.c
index 6b52280e3702..b27a54e31343 100644
--- a/drivers/gpu/drm/mxsfb/lcdif_kms.c
+++ b/drivers/gpu/drm/mxsfb/lcdif_kms.c
@@ -392,8 +392,8 @@ static int lcdif_plane_atomic_check(struct drm_plane *plane,
 						   &lcdif->crtc);
 
 	return drm_atomic_helper_check_plane_state(plane_state, crtc_state,
-						   DRM_PLANE_HELPER_NO_SCALING,
-						   DRM_PLANE_HELPER_NO_SCALING,
+						   DRM_PLANE_NO_SCALING,
+						   DRM_PLANE_NO_SCALING,
 						   false, true);
 }
 
diff --git a/drivers/gpu/drm/mxsfb/mxsfb_kms.c b/drivers/gpu/drm/mxsfb/mxsfb_kms.c
index 1279b4e1697d..2da2be6c11f2 100644
--- a/drivers/gpu/drm/mxsfb/mxsfb_kms.c
+++ b/drivers/gpu/drm/mxsfb/mxsfb_kms.c
@@ -530,8 +530,8 @@ static int mxsfb_plane_atomic_check(struct drm_plane *plane,
 						   &mxsfb->crtc);
 
 	return drm_atomic_helper_check_plane_state(plane_state, crtc_state,
-						   DRM_PLANE_HELPER_NO_SCALING,
-						   DRM_PLANE_HELPER_NO_SCALING,
+						   DRM_PLANE_NO_SCALING,
+						   DRM_PLANE_NO_SCALING,
 						   false, true);
 }
 
diff --git a/drivers/gpu/drm/nouveau/dispnv50/base507c.c b/drivers/gpu/drm/nouveau/dispnv50/base507c.c
index 65cefaaf88f6..63f6ee6797bc 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/base507c.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/base507c.c
@@ -237,8 +237,8 @@ base507c_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
 	int ret;
 
 	ret = drm_atomic_helper_check_plane_state(&asyw->state, &asyh->state,
-						  DRM_PLANE_HELPER_NO_SCALING,
-						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
 						  false, true);
 	if (ret)
 		return ret;
diff --git a/drivers/gpu/drm/nouveau/dispnv50/curs507a.c b/drivers/gpu/drm/nouveau/dispnv50/curs507a.c
index 24f7b1963a2a..ec646a6f48d1 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/curs507a.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/curs507a.c
@@ -102,8 +102,8 @@ curs507a_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
 	int ret;
 
 	ret = drm_atomic_helper_check_plane_state(&asyw->state, &asyh->state,
-						  DRM_PLANE_HELPER_NO_SCALING,
-						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
 						  true, true);
 	asyh->curs.visible = asyw->state.visible;
 	if (ret || !asyh->curs.visible)
diff --git a/drivers/gpu/drm/nouveau/dispnv50/ovly507e.c b/drivers/gpu/drm/nouveau/dispnv50/ovly507e.c
index 41ac9c67667c..8c2da56defe0 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/ovly507e.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/ovly507e.c
@@ -106,8 +106,8 @@ ovly507e_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
 	int ret;
 
 	ret = drm_atomic_helper_check_plane_state(&asyw->state, &asyh->state,
-						  DRM_PLANE_HELPER_NO_SCALING,
-						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
 						  true, true);
 	if (ret)
 		return ret;
diff --git a/drivers/gpu/drm/nouveau/dispnv50/wndwc37e.c b/drivers/gpu/drm/nouveau/dispnv50/wndwc37e.c
index b8e4c44c0854..9cf599d14ce8 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/wndwc37e.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/wndwc37e.c
@@ -296,8 +296,8 @@ wndwc37e_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
 		 struct nv50_head_atom *asyh)
 {
 	return drm_atomic_helper_check_plane_state(&asyw->state, &asyh->state,
-						   DRM_PLANE_HELPER_NO_SCALING,
-						   DRM_PLANE_HELPER_NO_SCALING,
+						   DRM_PLANE_NO_SCALING,
+						   DRM_PLANE_NO_SCALING,
 						   true, true);
 }
 
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
index 473f634da964..8e729cc4c209 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
@@ -594,8 +594,8 @@ int __rcar_du_plane_atomic_check(struct drm_plane *plane,
 		return PTR_ERR(crtc_state);
 
 	ret = drm_atomic_helper_check_plane_state(state, crtc_state,
-						  DRM_PLANE_HELPER_NO_SCALING,
-						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
 						  true, true);
 	if (ret < 0)
 		return ret;
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index efc783c8f653..bdd48f87d098 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -808,9 +808,9 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
 	const struct vop_win_data *win = vop_win->data;
 	int ret;
 	int min_scale = win->phy->scl ? FRAC_16_16(1, 8) :
-					DRM_PLANE_HELPER_NO_SCALING;
+					DRM_PLANE_NO_SCALING;
 	int max_scale = win->phy->scl ? FRAC_16_16(8, 1) :
-					DRM_PLANE_HELPER_NO_SCALING;
+					DRM_PLANE_NO_SCALING;
 
 	if (!crtc || WARN_ON(!fb))
 		return 0;
@@ -1059,9 +1059,9 @@ static int vop_plane_atomic_async_check(struct drm_plane *plane,
 	struct vop_win *vop_win = to_vop_win(plane);
 	const struct vop_win_data *win = vop_win->data;
 	int min_scale = win->phy->scl ? FRAC_16_16(1, 8) :
-					DRM_PLANE_HELPER_NO_SCALING;
+					DRM_PLANE_NO_SCALING;
 	int max_scale = win->phy->scl ? FRAC_16_16(8, 1) :
-					DRM_PLANE_HELPER_NO_SCALING;
+					DRM_PLANE_NO_SCALING;
 	struct drm_crtc_state *crtc_state;
 
 	if (plane != new_plane_state->crtc->cursor)
diff --git a/drivers/gpu/drm/sprd/sprd_dpu.c b/drivers/gpu/drm/sprd/sprd_dpu.c
index 03e760260d9c..10d21f7ab02d 100644
--- a/drivers/gpu/drm/sprd/sprd_dpu.c
+++ b/drivers/gpu/drm/sprd/sprd_dpu.c
@@ -523,8 +523,8 @@ static int sprd_plane_atomic_check(struct drm_plane *plane,
 		return PTR_ERR(crtc_state);
 
 	return drm_atomic_helper_check_plane_state(plane_state, crtc_state,
-						  DRM_PLANE_HELPER_NO_SCALING,
-						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
 						  true, true);
 }
 
diff --git a/drivers/gpu/drm/sun4i/sun8i_ui_layer.c b/drivers/gpu/drm/sun4i/sun8i_ui_layer.c
index da1d4ec2e22b..06ed571c37f0 100644
--- a/drivers/gpu/drm/sun4i/sun8i_ui_layer.c
+++ b/drivers/gpu/drm/sun4i/sun8i_ui_layer.c
@@ -245,8 +245,8 @@ static int sun8i_ui_layer_atomic_check(struct drm_plane *plane,
 	if (WARN_ON(!crtc_state))
 		return -EINVAL;
 
-	min_scale = DRM_PLANE_HELPER_NO_SCALING;
-	max_scale = DRM_PLANE_HELPER_NO_SCALING;
+	min_scale = DRM_PLANE_NO_SCALING;
+	max_scale = DRM_PLANE_NO_SCALING;
 
 	if (layer->mixer->cfg->scaler_mask & BIT(layer->channel)) {
 		min_scale = SUN8I_UI_SCALER_SCALE_MIN;
diff --git a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
index 4bd295c2d340..b9473efa308d 100644
--- a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
+++ b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
@@ -379,8 +379,8 @@ static int sun8i_vi_layer_atomic_check(struct drm_plane *plane,
 	if (WARN_ON(!crtc_state))
 		return -EINVAL;
 
-	min_scale = DRM_PLANE_HELPER_NO_SCALING;
-	max_scale = DRM_PLANE_HELPER_NO_SCALING;
+	min_scale = DRM_PLANE_NO_SCALING;
+	max_scale = DRM_PLANE_NO_SCALING;
 
 	if (layer->mixer->cfg->scaler_mask & BIT(layer->channel)) {
 		min_scale = SUN8I_VI_SCALER_SCALE_MIN;
diff --git a/drivers/gpu/drm/tests/drm_plane_helper_test.c b/drivers/gpu/drm/tests/drm_plane_helper_test.c
index ec1654cdfc42..be6cff0020ed 100644
--- a/drivers/gpu/drm/tests/drm_plane_helper_test.c
+++ b/drivers/gpu/drm/tests/drm_plane_helper_test.c
@@ -104,8 +104,8 @@ static void igt_check_plane_state(struct kunit *test)
 	set_src(&plane_state, 0, 0, fb.width << 16, fb.height << 16);
 	set_crtc(&plane_state, 0, 0, fb.width, fb.height);
 	ret = drm_atomic_helper_check_plane_state(&plane_state, &crtc_state,
-						  DRM_PLANE_HELPER_NO_SCALING,
-						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
 						  false, false);
 	KUNIT_EXPECT_FALSE_MSG(test, ret, 0, "Simple clipping check should pass\n");
 	KUNIT_EXPECT_TRUE(test, plane_state.visible);
@@ -115,8 +115,8 @@ static void igt_check_plane_state(struct kunit *test)
 	/* Rotated clipping + reflection, no scaling. */
 	plane_state.rotation = DRM_MODE_ROTATE_90 | DRM_MODE_REFLECT_X;
 	ret = drm_atomic_helper_check_plane_state(&plane_state, &crtc_state,
-						  DRM_PLANE_HELPER_NO_SCALING,
-						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
 						  false, false);
 	KUNIT_EXPECT_FALSE_MSG(test, ret, 0, "Rotated clipping check should pass\n");
 	KUNIT_EXPECT_TRUE(test, plane_state.visible);
@@ -128,15 +128,15 @@ static void igt_check_plane_state(struct kunit *test)
 	set_src(&plane_state, 0, 0, 1023 << 16, 767 << 16);
 	set_crtc(&plane_state, 0, 0, 1023, 767);
 	ret = drm_atomic_helper_check_plane_state(&plane_state, &crtc_state,
-						  DRM_PLANE_HELPER_NO_SCALING,
-						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
 						  false, false);
 	KUNIT_EXPECT_TRUE_MSG(test, ret,
 			      "Should not be able to position on the crtc with can_position=false\n");
 
 	ret = drm_atomic_helper_check_plane_state(&plane_state, &crtc_state,
-						  DRM_PLANE_HELPER_NO_SCALING,
-						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
 						  true, false);
 	KUNIT_EXPECT_FALSE_MSG(test, ret, 0, "Simple positioning should work\n");
 	KUNIT_EXPECT_TRUE(test, plane_state.visible);
@@ -148,12 +148,12 @@ static void igt_check_plane_state(struct kunit *test)
 	set_crtc(&plane_state, 0, 0, 1024, 768);
 	ret = drm_atomic_helper_check_plane_state(&plane_state, &crtc_state,
 						  0x8001,
-						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
 						  false, false);
 	KUNIT_EXPECT_TRUE_MSG(test, ret, "Upscaling out of range should fail.\n");
 	ret = drm_atomic_helper_check_plane_state(&plane_state, &crtc_state,
 						  0x8000,
-						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
 						  false, false);
 	KUNIT_EXPECT_FALSE_MSG(test, ret, 0, "Upscaling exactly 2x should work\n");
 	KUNIT_EXPECT_TRUE(test, plane_state.visible);
@@ -162,11 +162,11 @@ static void igt_check_plane_state(struct kunit *test)
 
 	set_src(&plane_state, 0, 0, 2048 << 16, 1536 << 16);
 	ret = drm_atomic_helper_check_plane_state(&plane_state, &crtc_state,
-						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
 						  0x1ffff, false, false);
 	KUNIT_EXPECT_TRUE_MSG(test, ret, "Downscaling out of range should fail.\n");
 	ret = drm_atomic_helper_check_plane_state(&plane_state, &crtc_state,
-						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
 						  0x20000, false, false);
 	KUNIT_EXPECT_FALSE_MSG(test, ret, 0, "Should succeed with exact scaling limit\n");
 	KUNIT_EXPECT_TRUE(test, plane_state.visible);
@@ -177,7 +177,7 @@ static void igt_check_plane_state(struct kunit *test)
 	set_src(&plane_state, 0, 0, 0x40001, 0x40001);
 	set_crtc(&plane_state, 1022, 766, 4, 4);
 	ret = drm_atomic_helper_check_plane_state(&plane_state, &crtc_state,
-						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
 						  0x10001,
 						  true, false);
 	KUNIT_EXPECT_FALSE_MSG(test, ret, 0, "Should succeed by clipping to exact multiple");
@@ -188,7 +188,7 @@ static void igt_check_plane_state(struct kunit *test)
 	set_src(&plane_state, 0x20001, 0x20001, 0x4040001, 0x3040001);
 	set_crtc(&plane_state, -2, -2, 1028, 772);
 	ret = drm_atomic_helper_check_plane_state(&plane_state, &crtc_state,
-						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
 						  0x10001,
 						  false, false);
 	KUNIT_EXPECT_FALSE_MSG(test, ret, 0, "Should succeed by clipping to exact multiple");
@@ -201,7 +201,7 @@ static void igt_check_plane_state(struct kunit *test)
 	set_crtc(&plane_state, 1022, 766, 4, 4);
 	ret = drm_atomic_helper_check_plane_state(&plane_state, &crtc_state,
 						  0xffff,
-						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
 						  true, false);
 	KUNIT_EXPECT_FALSE_MSG(test, ret, 0, "Should succeed by clipping to exact multiple");
 	KUNIT_EXPECT_TRUE(test, plane_state.visible);
@@ -213,7 +213,7 @@ static void igt_check_plane_state(struct kunit *test)
 	set_crtc(&plane_state, -2, -2, 1028, 772);
 	ret = drm_atomic_helper_check_plane_state(&plane_state, &crtc_state,
 						  0xffff,
-						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
 						  false, false);
 	KUNIT_EXPECT_FALSE_MSG(test, ret, 0, "Should succeed by clipping to exact multiple");
 	KUNIT_EXPECT_TRUE(test, plane_state.visible);
diff --git a/drivers/gpu/drm/vboxvideo/vbox_mode.c b/drivers/gpu/drm/vboxvideo/vbox_mode.c
index fa0d73ce07bc..604ebfbef314 100644
--- a/drivers/gpu/drm/vboxvideo/vbox_mode.c
+++ b/drivers/gpu/drm/vboxvideo/vbox_mode.c
@@ -269,8 +269,8 @@ static int vbox_primary_atomic_check(struct drm_plane *plane,
 	}
 
 	return drm_atomic_helper_check_plane_state(new_state, crtc_state,
-						   DRM_PLANE_HELPER_NO_SCALING,
-						   DRM_PLANE_HELPER_NO_SCALING,
+						   DRM_PLANE_NO_SCALING,
+						   DRM_PLANE_NO_SCALING,
 						   false, true);
 }
 
@@ -351,8 +351,8 @@ static int vbox_cursor_atomic_check(struct drm_plane *plane,
 	}
 
 	ret = drm_atomic_helper_check_plane_state(new_state, crtc_state,
-						  DRM_PLANE_HELPER_NO_SCALING,
-						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
 						  true, true);
 	if (ret)
 		return ret;
diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c
index 58f4a52d039e..fb9dc63d33c7 100644
--- a/drivers/gpu/drm/virtio/virtgpu_plane.c
+++ b/drivers/gpu/drm/virtio/virtgpu_plane.c
@@ -99,8 +99,8 @@ static int virtio_gpu_plane_atomic_check(struct drm_plane *plane,
                 return PTR_ERR(crtc_state);
 
 	ret = drm_atomic_helper_check_plane_state(new_plane_state, crtc_state,
-						  DRM_PLANE_HELPER_NO_SCALING,
-						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
 						  is_cursor, true);
 	return ret;
 }
diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c
index 22238db6f8a5..8a810bfa1264 100644
--- a/drivers/gpu/drm/vkms/vkms_plane.c
+++ b/drivers/gpu/drm/vkms/vkms_plane.c
@@ -138,8 +138,8 @@ static int vkms_plane_atomic_check(struct drm_plane *plane,
 		can_position = true;
 
 	ret = drm_atomic_helper_check_plane_state(new_plane_state, crtc_state,
-						  DRM_PLANE_HELPER_NO_SCALING,
-						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
 						  can_position, true);
 	if (ret != 0)
 		return ret;
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index a19580109f33..214829c32ed8 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -719,8 +719,8 @@ int vmw_du_primary_plane_atomic_check(struct drm_plane *plane,
 							   new_state->crtc);
 
 	ret = drm_atomic_helper_check_plane_state(new_state, crtc_state,
-						  DRM_PLANE_HELPER_NO_SCALING,
-						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
 						  false, true);
 
 	if (!ret && new_fb) {
@@ -761,8 +761,8 @@ int vmw_du_cursor_plane_atomic_check(struct drm_plane *plane,
 							   new_state->crtc);
 
 	ret = drm_atomic_helper_check_plane_state(new_state, crtc_state,
-						  DRM_PLANE_HELPER_NO_SCALING,
-						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
+						  DRM_PLANE_NO_SCALING,
 						  true, true);
 	if (ret)
 		return ret;
diff --git a/drivers/gpu/drm/xlnx/zynqmp_disp.c b/drivers/gpu/drm/xlnx/zynqmp_disp.c
index d3bdecabf4e5..a769422e3f1d 100644
--- a/drivers/gpu/drm/xlnx/zynqmp_disp.c
+++ b/drivers/gpu/drm/xlnx/zynqmp_disp.c
@@ -1150,8 +1150,8 @@ zynqmp_disp_plane_atomic_check(struct drm_plane *plane,
 
 	return drm_atomic_helper_check_plane_state(new_plane_state,
 						   crtc_state,
-						   DRM_PLANE_HELPER_NO_SCALING,
-						   DRM_PLANE_HELPER_NO_SCALING,
+						   DRM_PLANE_NO_SCALING,
+						   DRM_PLANE_NO_SCALING,
 						   false, false);
 }
 
diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h
index ab778aad7359..54b321f20d53 100644
--- a/include/drm/drm_atomic_helper.h
+++ b/include/drm/drm_atomic_helper.h
@@ -41,7 +41,7 @@
  * Due to src being in 16.16 fixed point and dest being in integer pixels,
  * 1<<16 represents no scaling.
  */
-#define DRM_PLANE_HELPER_NO_SCALING (1<<16)
+#define DRM_PLANE_NO_SCALING (1<<16)
 
 struct drm_atomic_state;
 struct drm_private_obj;
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 4/7] drm: Remove unnecessary include statements of drm_plane_helper.h
  2022-07-20  8:30 [PATCH 0/7] drm: Clean up plane helpers Thomas Zimmermann
                   ` (2 preceding siblings ...)
  2022-07-20  8:30 ` [PATCH 3/7] drm/atomic-helper: Remove _HELPER_ infix from DRM_PLANE_HELPER_NO_SCALING Thomas Zimmermann
@ 2022-07-20  8:30 ` Thomas Zimmermann
  2022-07-20  8:30 ` [PATCH 5/7] drm/plane-helper: Export individual helpers Thomas Zimmermann
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 16+ messages in thread
From: Thomas Zimmermann @ 2022-07-20  8:30 UTC (permalink / raw)
  To: airlied, daniel, airlied, zackr, linux, stefan, alison.wang
  Cc: linux-graphics-maintainer, Thomas Zimmermann, dri-devel

Remove the include statement for drm_plane_helper.h from all the files
that don't need it. Althogh the header file is almost empty, many drivers
include it somewhere.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h          | 1 -
 drivers/gpu/drm/arm/display/komeda/komeda_crtc.c  | 1 -
 drivers/gpu/drm/arm/display/komeda/komeda_plane.c | 1 -
 drivers/gpu/drm/arm/malidp_planes.c               | 1 -
 drivers/gpu/drm/armada/armada_crtc.c              | 1 -
 drivers/gpu/drm/armada/armada_overlay.c           | 1 -
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c   | 1 -
 drivers/gpu/drm/drm_atomic_helper.c               | 1 -
 drivers/gpu/drm/drm_crtc_helper.c                 | 1 -
 drivers/gpu/drm/exynos/exynos_drm_plane.c         | 1 -
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c       | 1 -
 drivers/gpu/drm/gma500/psb_intel_display.c        | 2 --
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c   | 1 -
 drivers/gpu/drm/i915/display/intel_atomic.c       | 1 -
 drivers/gpu/drm/i915/display/intel_atomic_plane.c | 1 -
 drivers/gpu/drm/i915/display/intel_crtc.c         | 1 -
 drivers/gpu/drm/i915/display/intel_display.c      | 1 -
 drivers/gpu/drm/i915/intel_pm.c                   | 1 -
 drivers/gpu/drm/imx/imx-drm-core.c                | 1 -
 drivers/gpu/drm/ingenic/ingenic-ipu.c             | 1 -
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c           | 1 -
 drivers/gpu/drm/meson/meson_overlay.c             | 1 -
 drivers/gpu/drm/mgag200/mgag200_mode.c            | 1 -
 drivers/gpu/drm/msm/msm_drv.h                     | 1 -
 drivers/gpu/drm/nouveau/dispnv50/disp.c           | 1 -
 drivers/gpu/drm/nouveau/dispnv50/wndwc57e.c       | 1 -
 drivers/gpu/drm/omapdrm/omap_crtc.c               | 1 -
 drivers/gpu/drm/omapdrm/omap_overlay.c            | 1 -
 drivers/gpu/drm/omapdrm/omap_plane.c              | 1 -
 drivers/gpu/drm/radeon/radeon_display.c           | 1 -
 drivers/gpu/drm/rcar-du/rcar_du_crtc.c            | 1 -
 drivers/gpu/drm/rcar-du/rcar_du_vsp.c             | 1 -
 drivers/gpu/drm/rockchip/rockchip_drm_vop2.c      | 1 -
 drivers/gpu/drm/shmobile/shmob_drm_crtc.c         | 1 -
 drivers/gpu/drm/sti/sti_crtc.c                    | 1 -
 drivers/gpu/drm/sti/sti_plane.h                   | 1 -
 drivers/gpu/drm/stm/ltdc.c                        | 1 -
 drivers/gpu/drm/sun4i/sun4i_backend.c             | 1 -
 drivers/gpu/drm/sun4i/sun4i_layer.c               | 1 -
 drivers/gpu/drm/sun4i/sun8i_mixer.c               | 1 -
 drivers/gpu/drm/tegra/dc.c                        | 1 -
 drivers/gpu/drm/tegra/plane.c                     | 1 -
 drivers/gpu/drm/tidss/tidss_crtc.c                | 1 -
 drivers/gpu/drm/tilcdc/tilcdc_plane.c             | 1 -
 drivers/gpu/drm/vc4/vc4_kms.c                     | 1 -
 drivers/gpu/drm/vc4/vc4_plane.c                   | 1 -
 drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c               | 1 -
 drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c              | 1 -
 drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c              | 1 -
 49 files changed, 50 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
index d788a00043a5..37322550d750 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
@@ -38,7 +38,6 @@
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_framebuffer.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_probe_helper.h>
 #include <linux/i2c.h>
 #include <linux/i2c-algo-bit.h>
diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c
index 59172acb9738..ea56d7fb1b0b 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c
@@ -11,7 +11,6 @@
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc_helper.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_print.h>
 #include <drm/drm_vblank.h>
 
diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_plane.c b/drivers/gpu/drm/arm/display/komeda/komeda_plane.c
index dff22dec54b5..c20ff72f0ae5 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_plane.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_plane.c
@@ -7,7 +7,6 @@
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_blend.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_print.h>
 #include "komeda_dev.h"
 #include "komeda_kms.h"
diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c
index 8a9562642d16..a1cee1a5b523 100644
--- a/drivers/gpu/drm/arm/malidp_planes.c
+++ b/drivers/gpu/drm/arm/malidp_planes.c
@@ -18,7 +18,6 @@
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_print.h>
 
 #include "malidp_hw.h"
diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c
index b7bb90ae787f..15dd667aa2e7 100644
--- a/drivers/gpu/drm/armada/armada_crtc.c
+++ b/drivers/gpu/drm/armada/armada_crtc.c
@@ -12,7 +12,6 @@
 
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_vblank.h>
 
diff --git a/drivers/gpu/drm/armada/armada_overlay.c b/drivers/gpu/drm/armada/armada_overlay.c
index 424250535fed..1db77549189e 100644
--- a/drivers/gpu/drm/armada/armada_overlay.c
+++ b/drivers/gpu/drm/armada/armada_overlay.c
@@ -9,7 +9,6 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_atomic_uapi.h>
 #include <drm/drm_fourcc.h>
-#include <drm/drm_plane_helper.h>
 
 #include "armada_crtc.h"
 #include "armada_drm.h"
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
index 2306ceb3e999..10f31faf140c 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
@@ -16,7 +16,6 @@
 #include <drm/drm_fourcc.h>
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_cma_helper.h>
-#include <drm/drm_plane_helper.h>
 
 #include "atmel_hlcdc_dc.h"
 
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 8bf41aa24068..c6abfd3d4b62 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -38,7 +38,6 @@
 #include <drm/drm_drv.h>
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_atomic_helper.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_print.h>
 #include <drm/drm_self_refresh_helper.h>
 #include <drm/drm_vblank.h>
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index 8a6d54515f92..457448cc60f7 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -45,7 +45,6 @@
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_fourcc.h>
 #include <drm/drm_framebuffer.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_print.h>
 #include <drm/drm_vblank.h>
 
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c
index 66e5f1e34044..7c3aa77186d3 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
@@ -9,7 +9,6 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_blend.h>
 #include <drm/drm_framebuffer.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/exynos_drm.h>
 
 #include "exynos_drm_crtc.h"
diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
index 0cd527f0c146..e4f518e44945 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
@@ -14,7 +14,6 @@
 #include <drm/drm_fourcc.h>
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_cma_helper.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_probe_helper.h>
 
 #include "fsl_dcu_drm_drv.h"
diff --git a/drivers/gpu/drm/gma500/psb_intel_display.c b/drivers/gpu/drm/gma500/psb_intel_display.c
index 9a5ea06a1a8e..531c1781a8fb 100644
--- a/drivers/gpu/drm/gma500/psb_intel_display.c
+++ b/drivers/gpu/drm/gma500/psb_intel_display.c
@@ -9,8 +9,6 @@
 #include <linux/delay.h>
 #include <linux/i2c.h>
 
-#include <drm/drm_plane_helper.h>
-
 #include "framebuffer.h"
 #include "gem.h"
 #include "gma_display.h"
diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
index 61c29c2834e6..2c7059b775a1 100644
--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
+++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
@@ -28,7 +28,6 @@
 #include <drm/drm_fourcc.h>
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_cma_helper.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_vblank.h>
 #include <drm/drm_gem_framebuffer_helper.h>
diff --git a/drivers/gpu/drm/i915/display/intel_atomic.c b/drivers/gpu/drm/i915/display/intel_atomic.c
index 40da7910f845..b94973b5633f 100644
--- a/drivers/gpu/drm/i915/display/intel_atomic.c
+++ b/drivers/gpu/drm/i915/display/intel_atomic.c
@@ -32,7 +32,6 @@
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_fourcc.h>
-#include <drm/drm_plane_helper.h>
 
 #include "i915_drv.h"
 #include "i915_reg.h"
diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.c b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
index efe8591619e3..dd876dbbaa39 100644
--- a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
+++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
@@ -33,7 +33,6 @@
 
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_fourcc.h>
-#include <drm/drm_plane_helper.h>
 
 #include "gt/intel_rps.h"
 
diff --git a/drivers/gpu/drm/i915/display/intel_crtc.c b/drivers/gpu/drm/i915/display/intel_crtc.c
index 4442aa355f86..6792a9056f46 100644
--- a/drivers/gpu/drm/i915/display/intel_crtc.c
+++ b/drivers/gpu/drm/i915/display/intel_crtc.c
@@ -9,7 +9,6 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_fourcc.h>
 #include <drm/drm_plane.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_vblank_work.h>
 
 #include "i915_irq.h"
diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index a0f84cbe974f..bf170bd83ef7 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -42,7 +42,6 @@
 #include <drm/drm_damage_helper.h>
 #include <drm/drm_edid.h>
 #include <drm/drm_fourcc.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_privacy_screen_consumer.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_rect.h>
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index f06babdb3a8c..ef7553b494ea 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -32,7 +32,6 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_blend.h>
 #include <drm/drm_fourcc.h>
-#include <drm/drm_plane_helper.h>
 
 #include "display/intel_atomic.h"
 #include "display/intel_atomic_plane.h"
diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c
index a57812ec36b1..50fd7aac5198 100644
--- a/drivers/gpu/drm/imx/imx-drm-core.c
+++ b/drivers/gpu/drm/imx/imx-drm-core.c
@@ -22,7 +22,6 @@
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_managed.h>
 #include <drm/drm_of.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_vblank.h>
 
diff --git a/drivers/gpu/drm/ingenic/ingenic-ipu.c b/drivers/gpu/drm/ingenic/ingenic-ipu.c
index d13f58ad4769..c117073fd61e 100644
--- a/drivers/gpu/drm/ingenic/ingenic-ipu.c
+++ b/drivers/gpu/drm/ingenic/ingenic-ipu.c
@@ -29,7 +29,6 @@
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_plane.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_property.h>
 #include <drm/drm_vblank.h>
 
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
index 42cc7052b050..112615817dcb 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
@@ -15,7 +15,6 @@
 
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_vblank.h>
 
diff --git a/drivers/gpu/drm/meson/meson_overlay.c b/drivers/gpu/drm/meson/meson_overlay.c
index b4a0518c1028..93c1cd2aab43 100644
--- a/drivers/gpu/drm/meson/meson_overlay.c
+++ b/drivers/gpu/drm/meson/meson_overlay.c
@@ -16,7 +16,6 @@
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_atomic_helper.h>
 #include <drm/drm_gem_cma_helper.h>
-#include <drm/drm_plane_helper.h>
 
 #include "meson_overlay.h"
 #include "meson_registers.h"
diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c
index 225cca2ed60e..a02f599cb9cf 100644
--- a/drivers/gpu/drm/mgag200/mgag200_mode.c
+++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
@@ -20,7 +20,6 @@
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_atomic_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_print.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_simple_kms_helper.h>
diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index b3689a2d27d7..7d5fb0fc22dd 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -27,7 +27,6 @@
 
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_fb_helper.h>
 #include <drm/display/drm_dsc.h>
diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c
index ade2988e85f3..b73fdfbe58ee 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
@@ -39,7 +39,6 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_edid.h>
 #include <drm/drm_fb_helper.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_vblank.h>
 
diff --git a/drivers/gpu/drm/nouveau/dispnv50/wndwc57e.c b/drivers/gpu/drm/nouveau/dispnv50/wndwc57e.c
index 37f6da8b3f2a..1a9a07c77da1 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/wndwc57e.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/wndwc57e.c
@@ -23,7 +23,6 @@
 #include "atom.h"
 
 #include <drm/drm_atomic_helper.h>
-#include <drm/drm_plane_helper.h>
 #include <nouveau_bo.h>
 
 #include <nvif/clc37e.h>
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
index 06a719c104f4..63ddc5127f7b 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -10,7 +10,6 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_mode.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_vblank.h>
 
 #include "omap_drv.h"
diff --git a/drivers/gpu/drm/omapdrm/omap_overlay.c b/drivers/gpu/drm/omapdrm/omap_overlay.c
index b0bc9ad2ef73..fb97c74386f2 100644
--- a/drivers/gpu/drm/omapdrm/omap_overlay.c
+++ b/drivers/gpu/drm/omapdrm/omap_overlay.c
@@ -6,7 +6,6 @@
 
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
-#include <drm/drm_plane_helper.h>
 
 #include "omap_dmm_tiler.h"
 #include "omap_drv.h"
diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c
index b6cb537f7689..24a2ded08b45 100644
--- a/drivers/gpu/drm/omapdrm/omap_plane.c
+++ b/drivers/gpu/drm/omapdrm/omap_plane.c
@@ -8,7 +8,6 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_blend.h>
 #include <drm/drm_gem_atomic_helper.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_fourcc.h>
 #include <drm/drm_framebuffer.h>
 
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index f12675e3d261..ca5598ae8bfc 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -38,7 +38,6 @@
 #include <drm/drm_fourcc.h>
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_framebuffer_helper.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_vblank.h>
 #include <drm/radeon_drm.h>
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
index f361a604337f..227a9be30715 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
@@ -19,7 +19,6 @@
 #include <drm/drm_device.h>
 #include <drm/drm_fb_cma_helper.h>
 #include <drm/drm_gem_cma_helper.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_vblank.h>
 
 #include "rcar_cmm.h"
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
index e778fd52f890..44ac95da9c13 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
@@ -17,7 +17,6 @@
 #include <drm/drm_gem_atomic_helper.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_managed.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_vblank.h>
 
 #include <linux/bitops.h>
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
index e4631f515ba4..552426d5d3a2 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
@@ -29,7 +29,6 @@
 #include <drm/drm_debugfs.h>
 #include <drm/drm_flip_work.h>
 #include <drm/drm_framebuffer.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_vblank.h>
 
diff --git a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
index 071a929e9fe3..387fbd2ab32d 100644
--- a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
+++ b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
@@ -16,7 +16,6 @@
 #include <drm/drm_fourcc.h>
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_cma_helper.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_simple_kms_helper.h>
 #include <drm/drm_vblank.h>
diff --git a/drivers/gpu/drm/sti/sti_crtc.c b/drivers/gpu/drm/sti/sti_crtc.c
index 409795786f03..3c7154f2d5f3 100644
--- a/drivers/gpu/drm/sti/sti_crtc.c
+++ b/drivers/gpu/drm/sti/sti_crtc.c
@@ -11,7 +11,6 @@
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_device.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_print.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_vblank.h>
diff --git a/drivers/gpu/drm/sti/sti_plane.h b/drivers/gpu/drm/sti/sti_plane.h
index 8e33e629d9b0..2c0156bede9c 100644
--- a/drivers/gpu/drm/sti/sti_plane.h
+++ b/drivers/gpu/drm/sti/sti_plane.h
@@ -8,7 +8,6 @@
 #define _STI_PLANE_H_
 
 #include <drm/drm_atomic_helper.h>
-#include <drm/drm_plane_helper.h>
 
 #define to_sti_plane(x) container_of(x, struct sti_plane, drm_plane)
 
diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index da7a0a183b27..8f3307b279e7 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -34,7 +34,6 @@
 #include <drm/drm_gem_atomic_helper.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_of.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_simple_kms_helper.h>
 #include <drm/drm_vblank.h>
diff --git a/drivers/gpu/drm/sun4i/sun4i_backend.c b/drivers/gpu/drm/sun4i/sun4i_backend.c
index 287e8c4bbaea..0c69eab1fd37 100644
--- a/drivers/gpu/drm/sun4i/sun4i_backend.c
+++ b/drivers/gpu/drm/sun4i/sun4i_backend.c
@@ -23,7 +23,6 @@
 #include <drm/drm_fourcc.h>
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_cma_helper.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_probe_helper.h>
 
 #include "sun4i_backend.h"
diff --git a/drivers/gpu/drm/sun4i/sun4i_layer.c b/drivers/gpu/drm/sun4i/sun4i_layer.c
index 648dd0b5b116..98f3176366c0 100644
--- a/drivers/gpu/drm/sun4i/sun4i_layer.c
+++ b/drivers/gpu/drm/sun4i/sun4i_layer.c
@@ -10,7 +10,6 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_blend.h>
 #include <drm/drm_gem_atomic_helper.h>
-#include <drm/drm_plane_helper.h>
 
 #include "sun4i_backend.h"
 #include "sun4i_frontend.h"
diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c
index 648b38a73066..4e9bd9cb6b36 100644
--- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
@@ -19,7 +19,6 @@
 #include <drm/drm_fb_cma_helper.h>
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_cma_helper.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_probe_helper.h>
 
 #include "sun4i_drv.h"
diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
index 747abafb6a5c..bd0f60704467 100644
--- a/drivers/gpu/drm/tegra/dc.c
+++ b/drivers/gpu/drm/tegra/dc.c
@@ -26,7 +26,6 @@
 #include <drm/drm_debugfs.h>
 #include <drm/drm_fourcc.h>
 #include <drm/drm_framebuffer.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_vblank.h>
 
 #include "dc.h"
diff --git a/drivers/gpu/drm/tegra/plane.c b/drivers/gpu/drm/tegra/plane.c
index ca9f03e3675b..10090116895f 100644
--- a/drivers/gpu/drm/tegra/plane.c
+++ b/drivers/gpu/drm/tegra/plane.c
@@ -12,7 +12,6 @@
 #include <drm/drm_fourcc.h>
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_atomic_helper.h>
-#include <drm/drm_plane_helper.h>
 
 #include "dc.h"
 #include "plane.h"
diff --git a/drivers/gpu/drm/tidss/tidss_crtc.c b/drivers/gpu/drm/tidss/tidss_crtc.c
index 2218da3b3ca3..ad4ce9d06622 100644
--- a/drivers/gpu/drm/tidss/tidss_crtc.c
+++ b/drivers/gpu/drm/tidss/tidss_crtc.c
@@ -10,7 +10,6 @@
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_fb_cma_helper.h>
 #include <drm/drm_gem_cma_helper.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_vblank.h>
 
 #include "tidss_crtc.h"
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_plane.c b/drivers/gpu/drm/tilcdc/tilcdc_plane.c
index 960136518814..0ccf791301cb 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_plane.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_plane.c
@@ -5,7 +5,6 @@
  */
 
 #include <drm/drm_atomic.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_fourcc.h>
 #include <drm/drm_framebuffer.h>
diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c
index b45dcdfd7306..4419e810103d 100644
--- a/drivers/gpu/drm/vc4/vc4_kms.c
+++ b/drivers/gpu/drm/vc4/vc4_kms.c
@@ -18,7 +18,6 @@
 #include <drm/drm_crtc.h>
 #include <drm/drm_fourcc.h>
 #include <drm/drm_gem_framebuffer_helper.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_vblank.h>
 
diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c
index 82a650268f19..243b29ab6f85 100644
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -23,7 +23,6 @@
 #include <drm/drm_fourcc.h>
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_atomic_helper.h>
-#include <drm/drm_plane_helper.h>
 
 #include "uapi/drm/vc4_drm.h"
 
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
index e4347faccee0..b8761f16dd78 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
@@ -28,7 +28,6 @@
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_fourcc.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_vblank.h>
 
 #include "vmwgfx_kms.h"
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
index b29e650d77f4..ecd3c2fc978b 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
@@ -29,7 +29,6 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_damage_helper.h>
 #include <drm/drm_fourcc.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_vblank.h>
 
 #include "vmwgfx_kms.h"
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
index eb014b97d156..8650c3aea8f0 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
@@ -29,7 +29,6 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_damage_helper.h>
 #include <drm/drm_fourcc.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_vblank.h>
 
 #include "vmwgfx_kms.h"
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 5/7] drm/plane-helper: Export individual helpers
  2022-07-20  8:30 [PATCH 0/7] drm: Clean up plane helpers Thomas Zimmermann
                   ` (3 preceding siblings ...)
  2022-07-20  8:30 ` [PATCH 4/7] drm: Remove unnecessary include statements of drm_plane_helper.h Thomas Zimmermann
@ 2022-07-20  8:30 ` Thomas Zimmermann
  2022-08-11 16:41   ` Daniel Vetter
  2022-07-20  8:30 ` [PATCH 6/7] drm/armada: Use drm_plane_helper_destroy() Thomas Zimmermann
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 16+ messages in thread
From: Thomas Zimmermann @ 2022-07-20  8:30 UTC (permalink / raw)
  To: airlied, daniel, airlied, zackr, linux, stefan, alison.wang
  Cc: linux-graphics-maintainer, Thomas Zimmermann, dri-devel

Export the individual plane helpers that make up the plane functions and
align the naming with other helpers. The plane helpers are for non-atomic
modesetting and exporting them will simplify a later conversion of drivers
to atomic modesetting.

With struct drm_plane_funcs removed from drm_plane_helper.h, also remove
the include statements. It only needs linux/types.h for uint32_t and a
number of forward declarations.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 +-
 drivers/gpu/drm/armada/armada_plane.c         |  2 +-
 drivers/gpu/drm/drm_modeset_helper.c          |  8 ++-
 drivers/gpu/drm/drm_plane_helper.c            | 70 ++++++++++++++-----
 drivers/gpu/drm/nouveau/dispnv04/crtc.c       |  8 ++-
 drivers/gpu/drm/qxl/qxl_display.c             |  4 +-
 drivers/gpu/drm/vboxvideo/vbox_mode.c         |  4 +-
 include/drm/drm_plane_helper.h                | 22 ++++--
 8 files changed, 88 insertions(+), 33 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 3e83fed540e8..1548f0a1b1c0 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -86,6 +86,7 @@
 #include <drm/drm_vblank.h>
 #include <drm/drm_audio_component.h>
 #include <drm/drm_gem_atomic_helper.h>
+#include <drm/drm_plane_helper.h>
 
 #include "ivsrcid/dcn/irqsrcs_dcn_1_0.h"
 
@@ -7824,7 +7825,7 @@ static void dm_drm_plane_destroy_state(struct drm_plane *plane,
 static const struct drm_plane_funcs dm_plane_funcs = {
 	.update_plane	= drm_atomic_helper_update_plane,
 	.disable_plane	= drm_atomic_helper_disable_plane,
-	.destroy	= drm_primary_helper_destroy,
+	.destroy	= drm_plane_helper_destroy,
 	.reset = dm_drm_plane_reset,
 	.atomic_duplicate_state = dm_drm_plane_duplicate_state,
 	.atomic_destroy_state = dm_drm_plane_destroy_state,
diff --git a/drivers/gpu/drm/armada/armada_plane.c b/drivers/gpu/drm/armada/armada_plane.c
index 959d7f0a5108..cc47c032dbc1 100644
--- a/drivers/gpu/drm/armada/armada_plane.c
+++ b/drivers/gpu/drm/armada/armada_plane.c
@@ -288,7 +288,7 @@ struct drm_plane_state *armada_plane_duplicate_state(struct drm_plane *plane)
 static const struct drm_plane_funcs armada_primary_plane_funcs = {
 	.update_plane	= drm_atomic_helper_update_plane,
 	.disable_plane	= drm_atomic_helper_disable_plane,
-	.destroy	= drm_primary_helper_destroy,
+	.destroy	= drm_plane_helper_destroy,
 	.reset		= armada_plane_reset,
 	.atomic_duplicate_state = armada_plane_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
diff --git a/drivers/gpu/drm/drm_modeset_helper.c b/drivers/gpu/drm/drm_modeset_helper.c
index 0f08319453b2..bd609a978848 100644
--- a/drivers/gpu/drm/drm_modeset_helper.c
+++ b/drivers/gpu/drm/drm_modeset_helper.c
@@ -108,6 +108,12 @@ static const uint32_t safe_modeset_formats[] = {
 	DRM_FORMAT_ARGB8888,
 };
 
+static const struct drm_plane_funcs primary_plane_funcs = {
+	.update_plane = drm_plane_helper_update_primary,
+	.disable_plane = drm_plane_helper_disable_primary,
+	.destroy = drm_plane_helper_destroy,
+};
+
 static struct drm_plane *create_primary_plane(struct drm_device *dev)
 {
 	struct drm_plane *primary;
@@ -127,7 +133,7 @@ static struct drm_plane *create_primary_plane(struct drm_device *dev)
 
 	/* possible_crtc's will be filled in later by crtc_init */
 	ret = drm_universal_plane_init(dev, primary, 0,
-				       &drm_primary_helper_funcs,
+				       &primary_plane_funcs,
 				       safe_modeset_formats,
 				       ARRAY_SIZE(safe_modeset_formats),
 				       NULL,
diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
index bc08edd69030..c7785967f5bf 100644
--- a/drivers/gpu/drm/drm_plane_helper.c
+++ b/drivers/gpu/drm/drm_plane_helper.c
@@ -145,13 +145,36 @@ static int drm_plane_helper_check_update(struct drm_plane *plane,
 	return 0;
 }
 
-static int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *crtc,
-				     struct drm_framebuffer *fb,
-				     int crtc_x, int crtc_y,
-				     unsigned int crtc_w, unsigned int crtc_h,
-				     uint32_t src_x, uint32_t src_y,
-				     uint32_t src_w, uint32_t src_h,
-				     struct drm_modeset_acquire_ctx *ctx)
+/**
+ * drm_plane_helper_update_primary - Helper for updating primary planes
+ * @plane: plane to update
+ * @crtc: the plane's new CRTC
+ * @fb: the plane's new framebuffer
+ * @crtc_x: x coordinate within CRTC
+ * @crtc_y: y coordinate within CRTC
+ * @crtc_w: width coordinate within CRTC
+ * @crtc_h: height coordinate within CRTC
+ * @src_x: x coordinate within source
+ * @src_y: y coordinate within source
+ * @src_w: width coordinate within source
+ * @src_h: height coordinate within source
+ * @ctx: modeset locking context
+ *
+ * This helper validates the given parameters and updates the primary plane.
+ *
+ * This function is only useful for non-atomic modesetting. Don't use
+ * it in new drivers.
+ *
+ * Returns:
+ * Zero on success, or an errno code otherwise.
+ */
+int drm_plane_helper_update_primary(struct drm_plane *plane, struct drm_crtc *crtc,
+				    struct drm_framebuffer *fb,
+				    int crtc_x, int crtc_y,
+				    unsigned int crtc_w, unsigned int crtc_h,
+				    uint32_t src_x, uint32_t src_y,
+				    uint32_t src_w, uint32_t src_h,
+				    struct drm_modeset_acquire_ctx *ctx)
 {
 	struct drm_mode_set set = {
 		.crtc = crtc,
@@ -218,31 +241,40 @@ static int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *c
 	kfree(connector_list);
 	return ret;
 }
+EXPORT_SYMBOL(drm_plane_helper_update_primary);
 
-static int drm_primary_helper_disable(struct drm_plane *plane,
-				      struct drm_modeset_acquire_ctx *ctx)
+/**
+ * drm_plane_helper_disable_primary - Helper for disabling primary planes
+ * @plane: plane to disable
+ * @ctx: modeset locking context
+ *
+ * This helper returns an error when trying to disable the primary
+ * plane.
+ *
+ * This function is only useful for non-atomic modesetting. Don't use
+ * it in new drivers.
+ *
+ * Returns:
+ * An errno code.
+ */
+int drm_plane_helper_disable_primary(struct drm_plane *plane,
+				     struct drm_modeset_acquire_ctx *ctx)
 {
 	return -EINVAL;
 }
+EXPORT_SYMBOL(drm_plane_helper_disable_primary);
 
 /**
- * drm_primary_helper_destroy() - Helper for primary plane destruction
+ * drm_plane_helper_destroy() - Helper for primary plane destruction
  * @plane: plane to destroy
  *
  * Provides a default plane destroy handler for primary planes.  This handler
  * is called during CRTC destruction.  We disable the primary plane, remove
  * it from the DRM plane list, and deallocate the plane structure.
  */
-void drm_primary_helper_destroy(struct drm_plane *plane)
+void drm_plane_helper_destroy(struct drm_plane *plane)
 {
 	drm_plane_cleanup(plane);
 	kfree(plane);
 }
-EXPORT_SYMBOL(drm_primary_helper_destroy);
-
-const struct drm_plane_funcs drm_primary_helper_funcs = {
-	.update_plane = drm_primary_helper_update,
-	.disable_plane = drm_primary_helper_disable,
-	.destroy = drm_primary_helper_destroy,
-};
-EXPORT_SYMBOL(drm_primary_helper_funcs);
+EXPORT_SYMBOL(drm_plane_helper_destroy);
diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
index f9e962fd94d0..660c4cbc0b3d 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
@@ -1275,6 +1275,12 @@ static const uint32_t modeset_formats[] = {
         DRM_FORMAT_XRGB1555,
 };
 
+static const struct drm_plane_funcs nv04_primary_plane_funcs = {
+	.update_plane = drm_plane_helper_update_primary,
+	.disable_plane = drm_plane_helper_disable_primary,
+	.destroy = drm_plane_helper_destroy,
+};
+
 static struct drm_plane *
 create_primary_plane(struct drm_device *dev)
 {
@@ -1289,7 +1295,7 @@ create_primary_plane(struct drm_device *dev)
 
         /* possible_crtc's will be filled in later by crtc_init */
         ret = drm_universal_plane_init(dev, primary, 0,
-                                       &drm_primary_helper_funcs,
+				       &nv04_primary_plane_funcs,
                                        modeset_formats,
                                        ARRAY_SIZE(modeset_formats), NULL,
                                        DRM_PLANE_TYPE_PRIMARY, NULL);
diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c
index 2e8949863d6b..a152a7c6db21 100644
--- a/drivers/gpu/drm/qxl/qxl_display.c
+++ b/drivers/gpu/drm/qxl/qxl_display.c
@@ -902,7 +902,7 @@ static const struct drm_plane_helper_funcs qxl_cursor_helper_funcs = {
 static const struct drm_plane_funcs qxl_cursor_plane_funcs = {
 	.update_plane	= drm_atomic_helper_update_plane,
 	.disable_plane	= drm_atomic_helper_disable_plane,
-	.destroy	= drm_primary_helper_destroy,
+	.destroy	= drm_plane_helper_destroy,
 	.reset		= drm_atomic_helper_plane_reset,
 	.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
@@ -924,7 +924,7 @@ static const struct drm_plane_helper_funcs primary_helper_funcs = {
 static const struct drm_plane_funcs qxl_primary_plane_funcs = {
 	.update_plane	= drm_atomic_helper_update_plane,
 	.disable_plane	= drm_atomic_helper_disable_plane,
-	.destroy	= drm_primary_helper_destroy,
+	.destroy	= drm_plane_helper_destroy,
 	.reset		= drm_atomic_helper_plane_reset,
 	.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
diff --git a/drivers/gpu/drm/vboxvideo/vbox_mode.c b/drivers/gpu/drm/vboxvideo/vbox_mode.c
index 604ebfbef314..341edd982cb3 100644
--- a/drivers/gpu/drm/vboxvideo/vbox_mode.c
+++ b/drivers/gpu/drm/vboxvideo/vbox_mode.c
@@ -477,7 +477,7 @@ static const struct drm_plane_helper_funcs vbox_cursor_helper_funcs = {
 static const struct drm_plane_funcs vbox_cursor_plane_funcs = {
 	.update_plane	= drm_atomic_helper_update_plane,
 	.disable_plane	= drm_atomic_helper_disable_plane,
-	.destroy	= drm_primary_helper_destroy,
+	.destroy	= drm_plane_helper_destroy,
 	DRM_GEM_SHADOW_PLANE_FUNCS,
 };
 
@@ -496,7 +496,7 @@ static const struct drm_plane_helper_funcs vbox_primary_helper_funcs = {
 static const struct drm_plane_funcs vbox_primary_plane_funcs = {
 	.update_plane	= drm_atomic_helper_update_plane,
 	.disable_plane	= drm_atomic_helper_disable_plane,
-	.destroy	= drm_primary_helper_destroy,
+	.destroy	= drm_plane_helper_destroy,
 	.reset		= drm_atomic_helper_plane_reset,
 	.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
diff --git a/include/drm/drm_plane_helper.h b/include/drm/drm_plane_helper.h
index ff85ef41cb33..1781fab24dd6 100644
--- a/include/drm/drm_plane_helper.h
+++ b/include/drm/drm_plane_helper.h
@@ -24,12 +24,22 @@
 #ifndef DRM_PLANE_HELPER_H
 #define DRM_PLANE_HELPER_H
 
-#include <drm/drm_rect.h>
-#include <drm/drm_crtc.h>
-#include <drm/drm_modeset_helper_vtables.h>
-#include <drm/drm_modeset_helper.h>
+#include <linux/types.h>
 
-void drm_primary_helper_destroy(struct drm_plane *plane);
-extern const struct drm_plane_funcs drm_primary_helper_funcs;
+struct drm_crtc;
+struct drm_framebuffer;
+struct drm_modeset_acquire_ctx;
+struct drm_plane;
+
+int drm_plane_helper_update_primary(struct drm_plane *plane, struct drm_crtc *crtc,
+				    struct drm_framebuffer *fb,
+				    int crtc_x, int crtc_y,
+				    unsigned int crtc_w, unsigned int crtc_h,
+				    uint32_t src_x, uint32_t src_y,
+				    uint32_t src_w, uint32_t src_h,
+				    struct drm_modeset_acquire_ctx *ctx);
+int drm_plane_helper_disable_primary(struct drm_plane *plane,
+				     struct drm_modeset_acquire_ctx *ctx);
+void drm_plane_helper_destroy(struct drm_plane *plane);
 
 #endif
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 6/7] drm/armada: Use drm_plane_helper_destroy()
  2022-07-20  8:30 [PATCH 0/7] drm: Clean up plane helpers Thomas Zimmermann
                   ` (4 preceding siblings ...)
  2022-07-20  8:30 ` [PATCH 5/7] drm/plane-helper: Export individual helpers Thomas Zimmermann
@ 2022-07-20  8:30 ` Thomas Zimmermann
  2022-07-20  8:30 ` [PATCH 7/7] drm/fsl-dcu: " Thomas Zimmermann
  2022-07-20 15:08 ` [PATCH 0/7] drm: Clean up plane helpers Sam Ravnborg
  7 siblings, 0 replies; 16+ messages in thread
From: Thomas Zimmermann @ 2022-07-20  8:30 UTC (permalink / raw)
  To: airlied, daniel, airlied, zackr, linux, stefan, alison.wang
  Cc: linux-graphics-maintainer, Thomas Zimmermann, dri-devel

Replace the driver's own function with drm_plane_helper_destroy(). No
functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/armada/armada_overlay.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/armada/armada_overlay.c b/drivers/gpu/drm/armada/armada_overlay.c
index 1db77549189e..f21eb8fb76d8 100644
--- a/drivers/gpu/drm/armada/armada_overlay.c
+++ b/drivers/gpu/drm/armada/armada_overlay.c
@@ -9,6 +9,7 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_atomic_uapi.h>
 #include <drm/drm_fourcc.h>
+#include <drm/drm_plane_helper.h>
 
 #include "armada_crtc.h"
 #include "armada_drm.h"
@@ -297,12 +298,6 @@ armada_overlay_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,
 	return ret;
 }
 
-static void armada_ovl_plane_destroy(struct drm_plane *plane)
-{
-	drm_plane_cleanup(plane);
-	kfree(plane);
-}
-
 static void armada_overlay_reset(struct drm_plane *plane)
 {
 	struct armada_overlay_state *state;
@@ -467,7 +462,7 @@ static int armada_overlay_get_property(struct drm_plane *plane,
 static const struct drm_plane_funcs armada_ovl_plane_funcs = {
 	.update_plane	= armada_overlay_plane_update,
 	.disable_plane	= drm_atomic_helper_disable_plane,
-	.destroy	= armada_ovl_plane_destroy,
+	.destroy	= drm_plane_helper_destroy,
 	.reset		= armada_overlay_reset,
 	.atomic_duplicate_state = armada_overlay_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 7/7] drm/fsl-dcu: Use drm_plane_helper_destroy()
  2022-07-20  8:30 [PATCH 0/7] drm: Clean up plane helpers Thomas Zimmermann
                   ` (5 preceding siblings ...)
  2022-07-20  8:30 ` [PATCH 6/7] drm/armada: Use drm_plane_helper_destroy() Thomas Zimmermann
@ 2022-07-20  8:30 ` Thomas Zimmermann
  2022-08-11 16:46   ` Daniel Vetter
  2022-07-20 15:08 ` [PATCH 0/7] drm: Clean up plane helpers Sam Ravnborg
  7 siblings, 1 reply; 16+ messages in thread
From: Thomas Zimmermann @ 2022-07-20  8:30 UTC (permalink / raw)
  To: airlied, daniel, airlied, zackr, linux, stefan, alison.wang
  Cc: linux-graphics-maintainer, Thomas Zimmermann, dri-devel

Replace the driver's own function with drm_plane_helper_destroy(). No
functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
index e4f518e44945..3b20e79158c8 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
@@ -14,6 +14,7 @@
 #include <drm/drm_fourcc.h>
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_cma_helper.h>
+#include <drm/drm_plane_helper.h>
 #include <drm/drm_probe_helper.h>
 
 #include "fsl_dcu_drm_drv.h"
@@ -170,16 +171,10 @@ static const struct drm_plane_helper_funcs fsl_dcu_drm_plane_helper_funcs = {
 	.atomic_update = fsl_dcu_drm_plane_atomic_update,
 };
 
-static void fsl_dcu_drm_plane_destroy(struct drm_plane *plane)
-{
-	drm_plane_cleanup(plane);
-	kfree(plane);
-}
-
 static const struct drm_plane_funcs fsl_dcu_drm_plane_funcs = {
 	.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
-	.destroy = fsl_dcu_drm_plane_destroy,
+	.destroy = drm_plane_helper_destroy,
 	.disable_plane = drm_atomic_helper_disable_plane,
 	.reset = drm_atomic_helper_plane_reset,
 	.update_plane = drm_atomic_helper_update_plane,
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/7] drm/vmwgfx: Remove trailing whitespace
  2022-07-20  8:30 ` [PATCH 1/7] drm/vmwgfx: Remove trailing whitespace Thomas Zimmermann
@ 2022-07-20 13:23   ` Zack Rusin
  0 siblings, 0 replies; 16+ messages in thread
From: Zack Rusin @ 2022-07-20 13:23 UTC (permalink / raw)
  To: daniel, airlied, linux, airlied, alison.wang, tzimmermann, stefan
  Cc: Linux-graphics-maintainer, dri-devel

On Wed, 2022-07-20 at 10:30 +0200, Thomas Zimmermann wrote:
> Fix coding style. No functional changes.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

Thanks!

Reviewed-by: Zack Rusin <zackr@vmware.com>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/7] drm: Clean up plane helpers
  2022-07-20  8:30 [PATCH 0/7] drm: Clean up plane helpers Thomas Zimmermann
                   ` (6 preceding siblings ...)
  2022-07-20  8:30 ` [PATCH 7/7] drm/fsl-dcu: " Thomas Zimmermann
@ 2022-07-20 15:08 ` Sam Ravnborg
  2022-07-21  6:52   ` Thomas Zimmermann
  7 siblings, 1 reply; 16+ messages in thread
From: Sam Ravnborg @ 2022-07-20 15:08 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: airlied, alison.wang, linux, linux-graphics-maintainer,
	dri-devel, airlied

Hi Thomas,

On Wed, Jul 20, 2022 at 10:30:51AM +0200, Thomas Zimmermann wrote:
> The plane helpers are included by dozens of files without any need. Only
> a hand full of source files need anything from drm_plane_helper.h.
> 
> Untangle everything and tidy up the code a bit. The patches were built
> on x64-64, aarch64 and arm without issues.

Build tested the final result here on a few more archs without any issues.
I like the removal of the include statements and the simpler header
file.

I did not really get what is gained by pushing out drm_plane_funcs
to the drivers but trust this is in the end a better solution.

Series is:
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

	Sam

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/7] drm: Clean up plane helpers
  2022-07-20 15:08 ` [PATCH 0/7] drm: Clean up plane helpers Sam Ravnborg
@ 2022-07-21  6:52   ` Thomas Zimmermann
  0 siblings, 0 replies; 16+ messages in thread
From: Thomas Zimmermann @ 2022-07-21  6:52 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: airlied, alison.wang, linux, dri-devel,
	linux-graphics-maintainer, airlied


[-- Attachment #1.1: Type: text/plain, Size: 1512 bytes --]

Hi Sam

Am 20.07.22 um 17:08 schrieb Sam Ravnborg:
> Hi Thomas,
> 
> On Wed, Jul 20, 2022 at 10:30:51AM +0200, Thomas Zimmermann wrote:
>> The plane helpers are included by dozens of files without any need. Only
>> a hand full of source files need anything from drm_plane_helper.h.
>>
>> Untangle everything and tidy up the code a bit. The patches were built
>> on x64-64, aarch64 and arm without issues.
> 
> Build tested the final result here on a few more archs without any issues.
> I like the removal of the include statements and the simpler header
> file.

Thanks for testing. I was surprised that nothing really needed 
drm_plane_helper.h.

> 
> I did not really get what is gained by pushing out drm_plane_funcs
> to the drivers but trust this is in the end a better solution.

On one hand, I think it's not possible to declare the symbol without 
including drm_plane.h. So removing it reduces the number of include 
statements.

In terms of software design, these exported, pre-initialized data 
structures are like blackboxes and with little flexibility. But DRM 
helpers should rather be like a construction kit, where drivers can pick 
individual pieces from.

> 
> Series is:
> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

Thank you

Best regards
Thomas

> 
> 	Sam

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 5/7] drm/plane-helper: Export individual helpers
  2022-07-20  8:30 ` [PATCH 5/7] drm/plane-helper: Export individual helpers Thomas Zimmermann
@ 2022-08-11 16:41   ` Daniel Vetter
  2022-08-11 18:32     ` Thomas Zimmermann
  0 siblings, 1 reply; 16+ messages in thread
From: Daniel Vetter @ 2022-08-11 16:41 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: airlied, alison.wang, linux, linux-graphics-maintainer,
	dri-devel, airlied

On Wed, Jul 20, 2022 at 10:30:56AM +0200, Thomas Zimmermann wrote:
> Export the individual plane helpers that make up the plane functions and
> align the naming with other helpers. The plane helpers are for non-atomic
> modesetting and exporting them will simplify a later conversion of drivers
> to atomic modesetting.
> 
> With struct drm_plane_funcs removed from drm_plane_helper.h, also remove
> the include statements. It only needs linux/types.h for uint32_t and a
> number of forward declarations.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

So my commit message was maybe not super motivated, but I intentionally
hid these because atomic drivers where using them, which is all bad no
good. Now they're more exposed again, which sucks a bit. Exporting the
complete function table for legacy helpers (and the one open-coded one in
nouveau, not sure we could not move that back to drm_crtc_init) feels much
safer against abuse to me.

I'm not entirely clear why we're doing this, because the include untangle
could also have been achieved with a struct forward decl, which is what
we're usually doing. Can we walk this back please, or am I missing
something here?

Cheers, Daniel

> ---
>  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 +-
>  drivers/gpu/drm/armada/armada_plane.c         |  2 +-
>  drivers/gpu/drm/drm_modeset_helper.c          |  8 ++-
>  drivers/gpu/drm/drm_plane_helper.c            | 70 ++++++++++++++-----
>  drivers/gpu/drm/nouveau/dispnv04/crtc.c       |  8 ++-
>  drivers/gpu/drm/qxl/qxl_display.c             |  4 +-
>  drivers/gpu/drm/vboxvideo/vbox_mode.c         |  4 +-
>  include/drm/drm_plane_helper.h                | 22 ++++--
>  8 files changed, 88 insertions(+), 33 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 3e83fed540e8..1548f0a1b1c0 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -86,6 +86,7 @@
>  #include <drm/drm_vblank.h>
>  #include <drm/drm_audio_component.h>
>  #include <drm/drm_gem_atomic_helper.h>
> +#include <drm/drm_plane_helper.h>
>  
>  #include "ivsrcid/dcn/irqsrcs_dcn_1_0.h"
>  
> @@ -7824,7 +7825,7 @@ static void dm_drm_plane_destroy_state(struct drm_plane *plane,
>  static const struct drm_plane_funcs dm_plane_funcs = {
>  	.update_plane	= drm_atomic_helper_update_plane,
>  	.disable_plane	= drm_atomic_helper_disable_plane,
> -	.destroy	= drm_primary_helper_destroy,
> +	.destroy	= drm_plane_helper_destroy,
>  	.reset = dm_drm_plane_reset,
>  	.atomic_duplicate_state = dm_drm_plane_duplicate_state,
>  	.atomic_destroy_state = dm_drm_plane_destroy_state,
> diff --git a/drivers/gpu/drm/armada/armada_plane.c b/drivers/gpu/drm/armada/armada_plane.c
> index 959d7f0a5108..cc47c032dbc1 100644
> --- a/drivers/gpu/drm/armada/armada_plane.c
> +++ b/drivers/gpu/drm/armada/armada_plane.c
> @@ -288,7 +288,7 @@ struct drm_plane_state *armada_plane_duplicate_state(struct drm_plane *plane)
>  static const struct drm_plane_funcs armada_primary_plane_funcs = {
>  	.update_plane	= drm_atomic_helper_update_plane,
>  	.disable_plane	= drm_atomic_helper_disable_plane,
> -	.destroy	= drm_primary_helper_destroy,
> +	.destroy	= drm_plane_helper_destroy,
>  	.reset		= armada_plane_reset,
>  	.atomic_duplicate_state = armada_plane_duplicate_state,
>  	.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
> diff --git a/drivers/gpu/drm/drm_modeset_helper.c b/drivers/gpu/drm/drm_modeset_helper.c
> index 0f08319453b2..bd609a978848 100644
> --- a/drivers/gpu/drm/drm_modeset_helper.c
> +++ b/drivers/gpu/drm/drm_modeset_helper.c
> @@ -108,6 +108,12 @@ static const uint32_t safe_modeset_formats[] = {
>  	DRM_FORMAT_ARGB8888,
>  };
>  
> +static const struct drm_plane_funcs primary_plane_funcs = {
> +	.update_plane = drm_plane_helper_update_primary,
> +	.disable_plane = drm_plane_helper_disable_primary,
> +	.destroy = drm_plane_helper_destroy,
> +};
> +
>  static struct drm_plane *create_primary_plane(struct drm_device *dev)
>  {
>  	struct drm_plane *primary;
> @@ -127,7 +133,7 @@ static struct drm_plane *create_primary_plane(struct drm_device *dev)
>  
>  	/* possible_crtc's will be filled in later by crtc_init */
>  	ret = drm_universal_plane_init(dev, primary, 0,
> -				       &drm_primary_helper_funcs,
> +				       &primary_plane_funcs,
>  				       safe_modeset_formats,
>  				       ARRAY_SIZE(safe_modeset_formats),
>  				       NULL,
> diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
> index bc08edd69030..c7785967f5bf 100644
> --- a/drivers/gpu/drm/drm_plane_helper.c
> +++ b/drivers/gpu/drm/drm_plane_helper.c
> @@ -145,13 +145,36 @@ static int drm_plane_helper_check_update(struct drm_plane *plane,
>  	return 0;
>  }
>  
> -static int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *crtc,
> -				     struct drm_framebuffer *fb,
> -				     int crtc_x, int crtc_y,
> -				     unsigned int crtc_w, unsigned int crtc_h,
> -				     uint32_t src_x, uint32_t src_y,
> -				     uint32_t src_w, uint32_t src_h,
> -				     struct drm_modeset_acquire_ctx *ctx)
> +/**
> + * drm_plane_helper_update_primary - Helper for updating primary planes
> + * @plane: plane to update
> + * @crtc: the plane's new CRTC
> + * @fb: the plane's new framebuffer
> + * @crtc_x: x coordinate within CRTC
> + * @crtc_y: y coordinate within CRTC
> + * @crtc_w: width coordinate within CRTC
> + * @crtc_h: height coordinate within CRTC
> + * @src_x: x coordinate within source
> + * @src_y: y coordinate within source
> + * @src_w: width coordinate within source
> + * @src_h: height coordinate within source
> + * @ctx: modeset locking context
> + *
> + * This helper validates the given parameters and updates the primary plane.
> + *
> + * This function is only useful for non-atomic modesetting. Don't use
> + * it in new drivers.
> + *
> + * Returns:
> + * Zero on success, or an errno code otherwise.
> + */
> +int drm_plane_helper_update_primary(struct drm_plane *plane, struct drm_crtc *crtc,
> +				    struct drm_framebuffer *fb,
> +				    int crtc_x, int crtc_y,
> +				    unsigned int crtc_w, unsigned int crtc_h,
> +				    uint32_t src_x, uint32_t src_y,
> +				    uint32_t src_w, uint32_t src_h,
> +				    struct drm_modeset_acquire_ctx *ctx)
>  {
>  	struct drm_mode_set set = {
>  		.crtc = crtc,
> @@ -218,31 +241,40 @@ static int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *c
>  	kfree(connector_list);
>  	return ret;
>  }
> +EXPORT_SYMBOL(drm_plane_helper_update_primary);
>  
> -static int drm_primary_helper_disable(struct drm_plane *plane,
> -				      struct drm_modeset_acquire_ctx *ctx)
> +/**
> + * drm_plane_helper_disable_primary - Helper for disabling primary planes
> + * @plane: plane to disable
> + * @ctx: modeset locking context
> + *
> + * This helper returns an error when trying to disable the primary
> + * plane.
> + *
> + * This function is only useful for non-atomic modesetting. Don't use
> + * it in new drivers.
> + *
> + * Returns:
> + * An errno code.
> + */
> +int drm_plane_helper_disable_primary(struct drm_plane *plane,
> +				     struct drm_modeset_acquire_ctx *ctx)
>  {
>  	return -EINVAL;
>  }
> +EXPORT_SYMBOL(drm_plane_helper_disable_primary);
>  
>  /**
> - * drm_primary_helper_destroy() - Helper for primary plane destruction
> + * drm_plane_helper_destroy() - Helper for primary plane destruction
>   * @plane: plane to destroy
>   *
>   * Provides a default plane destroy handler for primary planes.  This handler
>   * is called during CRTC destruction.  We disable the primary plane, remove
>   * it from the DRM plane list, and deallocate the plane structure.
>   */
> -void drm_primary_helper_destroy(struct drm_plane *plane)
> +void drm_plane_helper_destroy(struct drm_plane *plane)
>  {
>  	drm_plane_cleanup(plane);
>  	kfree(plane);
>  }
> -EXPORT_SYMBOL(drm_primary_helper_destroy);
> -
> -const struct drm_plane_funcs drm_primary_helper_funcs = {
> -	.update_plane = drm_primary_helper_update,
> -	.disable_plane = drm_primary_helper_disable,
> -	.destroy = drm_primary_helper_destroy,
> -};
> -EXPORT_SYMBOL(drm_primary_helper_funcs);
> +EXPORT_SYMBOL(drm_plane_helper_destroy);
> diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
> index f9e962fd94d0..660c4cbc0b3d 100644
> --- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c
> +++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
> @@ -1275,6 +1275,12 @@ static const uint32_t modeset_formats[] = {
>          DRM_FORMAT_XRGB1555,
>  };
>  
> +static const struct drm_plane_funcs nv04_primary_plane_funcs = {
> +	.update_plane = drm_plane_helper_update_primary,
> +	.disable_plane = drm_plane_helper_disable_primary,
> +	.destroy = drm_plane_helper_destroy,
> +};
> +
>  static struct drm_plane *
>  create_primary_plane(struct drm_device *dev)
>  {
> @@ -1289,7 +1295,7 @@ create_primary_plane(struct drm_device *dev)
>  
>          /* possible_crtc's will be filled in later by crtc_init */
>          ret = drm_universal_plane_init(dev, primary, 0,
> -                                       &drm_primary_helper_funcs,
> +				       &nv04_primary_plane_funcs,
>                                         modeset_formats,
>                                         ARRAY_SIZE(modeset_formats), NULL,
>                                         DRM_PLANE_TYPE_PRIMARY, NULL);
> diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c
> index 2e8949863d6b..a152a7c6db21 100644
> --- a/drivers/gpu/drm/qxl/qxl_display.c
> +++ b/drivers/gpu/drm/qxl/qxl_display.c
> @@ -902,7 +902,7 @@ static const struct drm_plane_helper_funcs qxl_cursor_helper_funcs = {
>  static const struct drm_plane_funcs qxl_cursor_plane_funcs = {
>  	.update_plane	= drm_atomic_helper_update_plane,
>  	.disable_plane	= drm_atomic_helper_disable_plane,
> -	.destroy	= drm_primary_helper_destroy,
> +	.destroy	= drm_plane_helper_destroy,
>  	.reset		= drm_atomic_helper_plane_reset,
>  	.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
>  	.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
> @@ -924,7 +924,7 @@ static const struct drm_plane_helper_funcs primary_helper_funcs = {
>  static const struct drm_plane_funcs qxl_primary_plane_funcs = {
>  	.update_plane	= drm_atomic_helper_update_plane,
>  	.disable_plane	= drm_atomic_helper_disable_plane,
> -	.destroy	= drm_primary_helper_destroy,
> +	.destroy	= drm_plane_helper_destroy,
>  	.reset		= drm_atomic_helper_plane_reset,
>  	.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
>  	.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
> diff --git a/drivers/gpu/drm/vboxvideo/vbox_mode.c b/drivers/gpu/drm/vboxvideo/vbox_mode.c
> index 604ebfbef314..341edd982cb3 100644
> --- a/drivers/gpu/drm/vboxvideo/vbox_mode.c
> +++ b/drivers/gpu/drm/vboxvideo/vbox_mode.c
> @@ -477,7 +477,7 @@ static const struct drm_plane_helper_funcs vbox_cursor_helper_funcs = {
>  static const struct drm_plane_funcs vbox_cursor_plane_funcs = {
>  	.update_plane	= drm_atomic_helper_update_plane,
>  	.disable_plane	= drm_atomic_helper_disable_plane,
> -	.destroy	= drm_primary_helper_destroy,
> +	.destroy	= drm_plane_helper_destroy,
>  	DRM_GEM_SHADOW_PLANE_FUNCS,
>  };
>  
> @@ -496,7 +496,7 @@ static const struct drm_plane_helper_funcs vbox_primary_helper_funcs = {
>  static const struct drm_plane_funcs vbox_primary_plane_funcs = {
>  	.update_plane	= drm_atomic_helper_update_plane,
>  	.disable_plane	= drm_atomic_helper_disable_plane,
> -	.destroy	= drm_primary_helper_destroy,
> +	.destroy	= drm_plane_helper_destroy,
>  	.reset		= drm_atomic_helper_plane_reset,
>  	.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
>  	.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
> diff --git a/include/drm/drm_plane_helper.h b/include/drm/drm_plane_helper.h
> index ff85ef41cb33..1781fab24dd6 100644
> --- a/include/drm/drm_plane_helper.h
> +++ b/include/drm/drm_plane_helper.h
> @@ -24,12 +24,22 @@
>  #ifndef DRM_PLANE_HELPER_H
>  #define DRM_PLANE_HELPER_H
>  
> -#include <drm/drm_rect.h>
> -#include <drm/drm_crtc.h>
> -#include <drm/drm_modeset_helper_vtables.h>
> -#include <drm/drm_modeset_helper.h>
> +#include <linux/types.h>
>  
> -void drm_primary_helper_destroy(struct drm_plane *plane);
> -extern const struct drm_plane_funcs drm_primary_helper_funcs;
> +struct drm_crtc;
> +struct drm_framebuffer;
> +struct drm_modeset_acquire_ctx;
> +struct drm_plane;
> +
> +int drm_plane_helper_update_primary(struct drm_plane *plane, struct drm_crtc *crtc,
> +				    struct drm_framebuffer *fb,
> +				    int crtc_x, int crtc_y,
> +				    unsigned int crtc_w, unsigned int crtc_h,
> +				    uint32_t src_x, uint32_t src_y,
> +				    uint32_t src_w, uint32_t src_h,
> +				    struct drm_modeset_acquire_ctx *ctx);
> +int drm_plane_helper_disable_primary(struct drm_plane *plane,
> +				     struct drm_modeset_acquire_ctx *ctx);
> +void drm_plane_helper_destroy(struct drm_plane *plane);
>  
>  #endif
> -- 
> 2.36.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 7/7] drm/fsl-dcu: Use drm_plane_helper_destroy()
  2022-07-20  8:30 ` [PATCH 7/7] drm/fsl-dcu: " Thomas Zimmermann
@ 2022-08-11 16:46   ` Daniel Vetter
  0 siblings, 0 replies; 16+ messages in thread
From: Daniel Vetter @ 2022-08-11 16:46 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: airlied, alison.wang, linux, linux-graphics-maintainer,
	dri-devel, airlied

On Wed, Jul 20, 2022 at 10:30:58AM +0200, Thomas Zimmermann wrote:
> Replace the driver's own function with drm_plane_helper_destroy(). No
> functional changes.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

Somewhat aside, but the real fix here is switching over to the drmm
versions of this. As long as all you're doing is cleanup+kfree those
should be safe, even if the driver overall is not converted at all.

Well ok I think you need to minimally convert over to
drmm_mode_config_init(), otherwise things go boom.

Quick grep says we don't have _destroy() helpers for anything else, so
this plane helper here is very much the odd one out, not sure spreading it
is a good idea. Maybe some todo at least?
-Daniel

> ---
>  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
> index e4f518e44945..3b20e79158c8 100644
> --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
> @@ -14,6 +14,7 @@
>  #include <drm/drm_fourcc.h>
>  #include <drm/drm_framebuffer.h>
>  #include <drm/drm_gem_cma_helper.h>
> +#include <drm/drm_plane_helper.h>
>  #include <drm/drm_probe_helper.h>
>  
>  #include "fsl_dcu_drm_drv.h"
> @@ -170,16 +171,10 @@ static const struct drm_plane_helper_funcs fsl_dcu_drm_plane_helper_funcs = {
>  	.atomic_update = fsl_dcu_drm_plane_atomic_update,
>  };
>  
> -static void fsl_dcu_drm_plane_destroy(struct drm_plane *plane)
> -{
> -	drm_plane_cleanup(plane);
> -	kfree(plane);
> -}
> -
>  static const struct drm_plane_funcs fsl_dcu_drm_plane_funcs = {
>  	.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
>  	.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
> -	.destroy = fsl_dcu_drm_plane_destroy,
> +	.destroy = drm_plane_helper_destroy,
>  	.disable_plane = drm_atomic_helper_disable_plane,
>  	.reset = drm_atomic_helper_plane_reset,
>  	.update_plane = drm_atomic_helper_update_plane,
> -- 
> 2.36.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 5/7] drm/plane-helper: Export individual helpers
  2022-08-11 16:41   ` Daniel Vetter
@ 2022-08-11 18:32     ` Thomas Zimmermann
  2022-09-06 19:15       ` Daniel Vetter
  0 siblings, 1 reply; 16+ messages in thread
From: Thomas Zimmermann @ 2022-08-11 18:32 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: airlied, alison.wang, linux, dri-devel,
	linux-graphics-maintainer, airlied


[-- Attachment #1.1: Type: text/plain, Size: 14342 bytes --]

Hi

Am 11.08.22 um 18:41 schrieb Daniel Vetter:
> On Wed, Jul 20, 2022 at 10:30:56AM +0200, Thomas Zimmermann wrote:
>> Export the individual plane helpers that make up the plane functions and
>> align the naming with other helpers. The plane helpers are for non-atomic
>> modesetting and exporting them will simplify a later conversion of drivers
>> to atomic modesetting.
>>
>> With struct drm_plane_funcs removed from drm_plane_helper.h, also remove
>> the include statements. It only needs linux/types.h for uint32_t and a
>> number of forward declarations.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> 
> So my commit message was maybe not super motivated, but I intentionally
> hid these because atomic drivers where using them, which is all bad no
> good. Now they're more exposed again, which sucks a bit. Exporting the
> complete function table for legacy helpers (and the one open-coded one in
> nouveau, not sure we could not move that back to drm_crtc_init) feels much
> safer against abuse to me.
> 
> I'm not entirely clear why we're doing this, because the include untangle
> could also have been achieved with a struct forward decl, which is what
> we're usually doing. Can we walk this back please, or am I missing
> something here?

I don't think you miss anything. It's just ugly to export the complete 
funcs table. If we roll that change back, let's add a comment that 
states the rational you wrote here.

Best regards
Thomas

> 
> Cheers, Daniel
> 
>> ---
>>   .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 +-
>>   drivers/gpu/drm/armada/armada_plane.c         |  2 +-
>>   drivers/gpu/drm/drm_modeset_helper.c          |  8 ++-
>>   drivers/gpu/drm/drm_plane_helper.c            | 70 ++++++++++++++-----
>>   drivers/gpu/drm/nouveau/dispnv04/crtc.c       |  8 ++-
>>   drivers/gpu/drm/qxl/qxl_display.c             |  4 +-
>>   drivers/gpu/drm/vboxvideo/vbox_mode.c         |  4 +-
>>   include/drm/drm_plane_helper.h                | 22 ++++--
>>   8 files changed, 88 insertions(+), 33 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> index 3e83fed540e8..1548f0a1b1c0 100644
>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> @@ -86,6 +86,7 @@
>>   #include <drm/drm_vblank.h>
>>   #include <drm/drm_audio_component.h>
>>   #include <drm/drm_gem_atomic_helper.h>
>> +#include <drm/drm_plane_helper.h>
>>   
>>   #include "ivsrcid/dcn/irqsrcs_dcn_1_0.h"
>>   
>> @@ -7824,7 +7825,7 @@ static void dm_drm_plane_destroy_state(struct drm_plane *plane,
>>   static const struct drm_plane_funcs dm_plane_funcs = {
>>   	.update_plane	= drm_atomic_helper_update_plane,
>>   	.disable_plane	= drm_atomic_helper_disable_plane,
>> -	.destroy	= drm_primary_helper_destroy,
>> +	.destroy	= drm_plane_helper_destroy,
>>   	.reset = dm_drm_plane_reset,
>>   	.atomic_duplicate_state = dm_drm_plane_duplicate_state,
>>   	.atomic_destroy_state = dm_drm_plane_destroy_state,
>> diff --git a/drivers/gpu/drm/armada/armada_plane.c b/drivers/gpu/drm/armada/armada_plane.c
>> index 959d7f0a5108..cc47c032dbc1 100644
>> --- a/drivers/gpu/drm/armada/armada_plane.c
>> +++ b/drivers/gpu/drm/armada/armada_plane.c
>> @@ -288,7 +288,7 @@ struct drm_plane_state *armada_plane_duplicate_state(struct drm_plane *plane)
>>   static const struct drm_plane_funcs armada_primary_plane_funcs = {
>>   	.update_plane	= drm_atomic_helper_update_plane,
>>   	.disable_plane	= drm_atomic_helper_disable_plane,
>> -	.destroy	= drm_primary_helper_destroy,
>> +	.destroy	= drm_plane_helper_destroy,
>>   	.reset		= armada_plane_reset,
>>   	.atomic_duplicate_state = armada_plane_duplicate_state,
>>   	.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
>> diff --git a/drivers/gpu/drm/drm_modeset_helper.c b/drivers/gpu/drm/drm_modeset_helper.c
>> index 0f08319453b2..bd609a978848 100644
>> --- a/drivers/gpu/drm/drm_modeset_helper.c
>> +++ b/drivers/gpu/drm/drm_modeset_helper.c
>> @@ -108,6 +108,12 @@ static const uint32_t safe_modeset_formats[] = {
>>   	DRM_FORMAT_ARGB8888,
>>   };
>>   
>> +static const struct drm_plane_funcs primary_plane_funcs = {
>> +	.update_plane = drm_plane_helper_update_primary,
>> +	.disable_plane = drm_plane_helper_disable_primary,
>> +	.destroy = drm_plane_helper_destroy,
>> +};
>> +
>>   static struct drm_plane *create_primary_plane(struct drm_device *dev)
>>   {
>>   	struct drm_plane *primary;
>> @@ -127,7 +133,7 @@ static struct drm_plane *create_primary_plane(struct drm_device *dev)
>>   
>>   	/* possible_crtc's will be filled in later by crtc_init */
>>   	ret = drm_universal_plane_init(dev, primary, 0,
>> -				       &drm_primary_helper_funcs,
>> +				       &primary_plane_funcs,
>>   				       safe_modeset_formats,
>>   				       ARRAY_SIZE(safe_modeset_formats),
>>   				       NULL,
>> diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
>> index bc08edd69030..c7785967f5bf 100644
>> --- a/drivers/gpu/drm/drm_plane_helper.c
>> +++ b/drivers/gpu/drm/drm_plane_helper.c
>> @@ -145,13 +145,36 @@ static int drm_plane_helper_check_update(struct drm_plane *plane,
>>   	return 0;
>>   }
>>   
>> -static int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *crtc,
>> -				     struct drm_framebuffer *fb,
>> -				     int crtc_x, int crtc_y,
>> -				     unsigned int crtc_w, unsigned int crtc_h,
>> -				     uint32_t src_x, uint32_t src_y,
>> -				     uint32_t src_w, uint32_t src_h,
>> -				     struct drm_modeset_acquire_ctx *ctx)
>> +/**
>> + * drm_plane_helper_update_primary - Helper for updating primary planes
>> + * @plane: plane to update
>> + * @crtc: the plane's new CRTC
>> + * @fb: the plane's new framebuffer
>> + * @crtc_x: x coordinate within CRTC
>> + * @crtc_y: y coordinate within CRTC
>> + * @crtc_w: width coordinate within CRTC
>> + * @crtc_h: height coordinate within CRTC
>> + * @src_x: x coordinate within source
>> + * @src_y: y coordinate within source
>> + * @src_w: width coordinate within source
>> + * @src_h: height coordinate within source
>> + * @ctx: modeset locking context
>> + *
>> + * This helper validates the given parameters and updates the primary plane.
>> + *
>> + * This function is only useful for non-atomic modesetting. Don't use
>> + * it in new drivers.
>> + *
>> + * Returns:
>> + * Zero on success, or an errno code otherwise.
>> + */
>> +int drm_plane_helper_update_primary(struct drm_plane *plane, struct drm_crtc *crtc,
>> +				    struct drm_framebuffer *fb,
>> +				    int crtc_x, int crtc_y,
>> +				    unsigned int crtc_w, unsigned int crtc_h,
>> +				    uint32_t src_x, uint32_t src_y,
>> +				    uint32_t src_w, uint32_t src_h,
>> +				    struct drm_modeset_acquire_ctx *ctx)
>>   {
>>   	struct drm_mode_set set = {
>>   		.crtc = crtc,
>> @@ -218,31 +241,40 @@ static int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *c
>>   	kfree(connector_list);
>>   	return ret;
>>   }
>> +EXPORT_SYMBOL(drm_plane_helper_update_primary);
>>   
>> -static int drm_primary_helper_disable(struct drm_plane *plane,
>> -				      struct drm_modeset_acquire_ctx *ctx)
>> +/**
>> + * drm_plane_helper_disable_primary - Helper for disabling primary planes
>> + * @plane: plane to disable
>> + * @ctx: modeset locking context
>> + *
>> + * This helper returns an error when trying to disable the primary
>> + * plane.
>> + *
>> + * This function is only useful for non-atomic modesetting. Don't use
>> + * it in new drivers.
>> + *
>> + * Returns:
>> + * An errno code.
>> + */
>> +int drm_plane_helper_disable_primary(struct drm_plane *plane,
>> +				     struct drm_modeset_acquire_ctx *ctx)
>>   {
>>   	return -EINVAL;
>>   }
>> +EXPORT_SYMBOL(drm_plane_helper_disable_primary);
>>   
>>   /**
>> - * drm_primary_helper_destroy() - Helper for primary plane destruction
>> + * drm_plane_helper_destroy() - Helper for primary plane destruction
>>    * @plane: plane to destroy
>>    *
>>    * Provides a default plane destroy handler for primary planes.  This handler
>>    * is called during CRTC destruction.  We disable the primary plane, remove
>>    * it from the DRM plane list, and deallocate the plane structure.
>>    */
>> -void drm_primary_helper_destroy(struct drm_plane *plane)
>> +void drm_plane_helper_destroy(struct drm_plane *plane)
>>   {
>>   	drm_plane_cleanup(plane);
>>   	kfree(plane);
>>   }
>> -EXPORT_SYMBOL(drm_primary_helper_destroy);
>> -
>> -const struct drm_plane_funcs drm_primary_helper_funcs = {
>> -	.update_plane = drm_primary_helper_update,
>> -	.disable_plane = drm_primary_helper_disable,
>> -	.destroy = drm_primary_helper_destroy,
>> -};
>> -EXPORT_SYMBOL(drm_primary_helper_funcs);
>> +EXPORT_SYMBOL(drm_plane_helper_destroy);
>> diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
>> index f9e962fd94d0..660c4cbc0b3d 100644
>> --- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c
>> +++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
>> @@ -1275,6 +1275,12 @@ static const uint32_t modeset_formats[] = {
>>           DRM_FORMAT_XRGB1555,
>>   };
>>   
>> +static const struct drm_plane_funcs nv04_primary_plane_funcs = {
>> +	.update_plane = drm_plane_helper_update_primary,
>> +	.disable_plane = drm_plane_helper_disable_primary,
>> +	.destroy = drm_plane_helper_destroy,
>> +};
>> +
>>   static struct drm_plane *
>>   create_primary_plane(struct drm_device *dev)
>>   {
>> @@ -1289,7 +1295,7 @@ create_primary_plane(struct drm_device *dev)
>>   
>>           /* possible_crtc's will be filled in later by crtc_init */
>>           ret = drm_universal_plane_init(dev, primary, 0,
>> -                                       &drm_primary_helper_funcs,
>> +				       &nv04_primary_plane_funcs,
>>                                          modeset_formats,
>>                                          ARRAY_SIZE(modeset_formats), NULL,
>>                                          DRM_PLANE_TYPE_PRIMARY, NULL);
>> diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c
>> index 2e8949863d6b..a152a7c6db21 100644
>> --- a/drivers/gpu/drm/qxl/qxl_display.c
>> +++ b/drivers/gpu/drm/qxl/qxl_display.c
>> @@ -902,7 +902,7 @@ static const struct drm_plane_helper_funcs qxl_cursor_helper_funcs = {
>>   static const struct drm_plane_funcs qxl_cursor_plane_funcs = {
>>   	.update_plane	= drm_atomic_helper_update_plane,
>>   	.disable_plane	= drm_atomic_helper_disable_plane,
>> -	.destroy	= drm_primary_helper_destroy,
>> +	.destroy	= drm_plane_helper_destroy,
>>   	.reset		= drm_atomic_helper_plane_reset,
>>   	.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
>>   	.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
>> @@ -924,7 +924,7 @@ static const struct drm_plane_helper_funcs primary_helper_funcs = {
>>   static const struct drm_plane_funcs qxl_primary_plane_funcs = {
>>   	.update_plane	= drm_atomic_helper_update_plane,
>>   	.disable_plane	= drm_atomic_helper_disable_plane,
>> -	.destroy	= drm_primary_helper_destroy,
>> +	.destroy	= drm_plane_helper_destroy,
>>   	.reset		= drm_atomic_helper_plane_reset,
>>   	.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
>>   	.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
>> diff --git a/drivers/gpu/drm/vboxvideo/vbox_mode.c b/drivers/gpu/drm/vboxvideo/vbox_mode.c
>> index 604ebfbef314..341edd982cb3 100644
>> --- a/drivers/gpu/drm/vboxvideo/vbox_mode.c
>> +++ b/drivers/gpu/drm/vboxvideo/vbox_mode.c
>> @@ -477,7 +477,7 @@ static const struct drm_plane_helper_funcs vbox_cursor_helper_funcs = {
>>   static const struct drm_plane_funcs vbox_cursor_plane_funcs = {
>>   	.update_plane	= drm_atomic_helper_update_plane,
>>   	.disable_plane	= drm_atomic_helper_disable_plane,
>> -	.destroy	= drm_primary_helper_destroy,
>> +	.destroy	= drm_plane_helper_destroy,
>>   	DRM_GEM_SHADOW_PLANE_FUNCS,
>>   };
>>   
>> @@ -496,7 +496,7 @@ static const struct drm_plane_helper_funcs vbox_primary_helper_funcs = {
>>   static const struct drm_plane_funcs vbox_primary_plane_funcs = {
>>   	.update_plane	= drm_atomic_helper_update_plane,
>>   	.disable_plane	= drm_atomic_helper_disable_plane,
>> -	.destroy	= drm_primary_helper_destroy,
>> +	.destroy	= drm_plane_helper_destroy,
>>   	.reset		= drm_atomic_helper_plane_reset,
>>   	.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
>>   	.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
>> diff --git a/include/drm/drm_plane_helper.h b/include/drm/drm_plane_helper.h
>> index ff85ef41cb33..1781fab24dd6 100644
>> --- a/include/drm/drm_plane_helper.h
>> +++ b/include/drm/drm_plane_helper.h
>> @@ -24,12 +24,22 @@
>>   #ifndef DRM_PLANE_HELPER_H
>>   #define DRM_PLANE_HELPER_H
>>   
>> -#include <drm/drm_rect.h>
>> -#include <drm/drm_crtc.h>
>> -#include <drm/drm_modeset_helper_vtables.h>
>> -#include <drm/drm_modeset_helper.h>
>> +#include <linux/types.h>
>>   
>> -void drm_primary_helper_destroy(struct drm_plane *plane);
>> -extern const struct drm_plane_funcs drm_primary_helper_funcs;
>> +struct drm_crtc;
>> +struct drm_framebuffer;
>> +struct drm_modeset_acquire_ctx;
>> +struct drm_plane;
>> +
>> +int drm_plane_helper_update_primary(struct drm_plane *plane, struct drm_crtc *crtc,
>> +				    struct drm_framebuffer *fb,
>> +				    int crtc_x, int crtc_y,
>> +				    unsigned int crtc_w, unsigned int crtc_h,
>> +				    uint32_t src_x, uint32_t src_y,
>> +				    uint32_t src_w, uint32_t src_h,
>> +				    struct drm_modeset_acquire_ctx *ctx);
>> +int drm_plane_helper_disable_primary(struct drm_plane *plane,
>> +				     struct drm_modeset_acquire_ctx *ctx);
>> +void drm_plane_helper_destroy(struct drm_plane *plane);
>>   
>>   #endif
>> -- 
>> 2.36.1
>>
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 5/7] drm/plane-helper: Export individual helpers
  2022-08-11 18:32     ` Thomas Zimmermann
@ 2022-09-06 19:15       ` Daniel Vetter
  2022-09-07  7:09         ` Thomas Zimmermann
  0 siblings, 1 reply; 16+ messages in thread
From: Daniel Vetter @ 2022-09-06 19:15 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: airlied, alison.wang, linux, dri-devel,
	linux-graphics-maintainer, airlied

On Thu, Aug 11, 2022 at 08:32:19PM +0200, Thomas Zimmermann wrote:
> Hi
> 
> Am 11.08.22 um 18:41 schrieb Daniel Vetter:
> > On Wed, Jul 20, 2022 at 10:30:56AM +0200, Thomas Zimmermann wrote:
> > > Export the individual plane helpers that make up the plane functions and
> > > align the naming with other helpers. The plane helpers are for non-atomic
> > > modesetting and exporting them will simplify a later conversion of drivers
> > > to atomic modesetting.
> > > 
> > > With struct drm_plane_funcs removed from drm_plane_helper.h, also remove
> > > the include statements. It only needs linux/types.h for uint32_t and a
> > > number of forward declarations.
> > > 
> > > Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> > 
> > So my commit message was maybe not super motivated, but I intentionally
> > hid these because atomic drivers where using them, which is all bad no
> > good. Now they're more exposed again, which sucks a bit. Exporting the
> > complete function table for legacy helpers (and the one open-coded one in
> > nouveau, not sure we could not move that back to drm_crtc_init) feels much
> > safer against abuse to me.
> > 
> > I'm not entirely clear why we're doing this, because the include untangle
> > could also have been achieved with a struct forward decl, which is what
> > we're usually doing. Can we walk this back please, or am I missing
> > something here?
> 
> I don't think you miss anything. It's just ugly to export the complete funcs
> table. If we roll that change back, let's add a comment that states the
> rational you wrote here.

So I'm way behind on everything, but maybe another option is to just check
in these functions that it's not an atomic modeset driver (i.e.
drm_drv_uses_atomic_modeset()). Or we just hope driver authors are smarter
now and there wont be fallout.

I'm also not clear on why exporting the entire vfunc table is a bad idea?

Either way I'd say up to you.
-Daniel

> 
> Best regards
> Thomas
> 
> > 
> > Cheers, Daniel
> > 
> > > ---
> > >   .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 +-
> > >   drivers/gpu/drm/armada/armada_plane.c         |  2 +-
> > >   drivers/gpu/drm/drm_modeset_helper.c          |  8 ++-
> > >   drivers/gpu/drm/drm_plane_helper.c            | 70 ++++++++++++++-----
> > >   drivers/gpu/drm/nouveau/dispnv04/crtc.c       |  8 ++-
> > >   drivers/gpu/drm/qxl/qxl_display.c             |  4 +-
> > >   drivers/gpu/drm/vboxvideo/vbox_mode.c         |  4 +-
> > >   include/drm/drm_plane_helper.h                | 22 ++++--
> > >   8 files changed, 88 insertions(+), 33 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> > > index 3e83fed540e8..1548f0a1b1c0 100644
> > > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> > > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> > > @@ -86,6 +86,7 @@
> > >   #include <drm/drm_vblank.h>
> > >   #include <drm/drm_audio_component.h>
> > >   #include <drm/drm_gem_atomic_helper.h>
> > > +#include <drm/drm_plane_helper.h>
> > >   #include "ivsrcid/dcn/irqsrcs_dcn_1_0.h"
> > > @@ -7824,7 +7825,7 @@ static void dm_drm_plane_destroy_state(struct drm_plane *plane,
> > >   static const struct drm_plane_funcs dm_plane_funcs = {
> > >   	.update_plane	= drm_atomic_helper_update_plane,
> > >   	.disable_plane	= drm_atomic_helper_disable_plane,
> > > -	.destroy	= drm_primary_helper_destroy,
> > > +	.destroy	= drm_plane_helper_destroy,
> > >   	.reset = dm_drm_plane_reset,
> > >   	.atomic_duplicate_state = dm_drm_plane_duplicate_state,
> > >   	.atomic_destroy_state = dm_drm_plane_destroy_state,
> > > diff --git a/drivers/gpu/drm/armada/armada_plane.c b/drivers/gpu/drm/armada/armada_plane.c
> > > index 959d7f0a5108..cc47c032dbc1 100644
> > > --- a/drivers/gpu/drm/armada/armada_plane.c
> > > +++ b/drivers/gpu/drm/armada/armada_plane.c
> > > @@ -288,7 +288,7 @@ struct drm_plane_state *armada_plane_duplicate_state(struct drm_plane *plane)
> > >   static const struct drm_plane_funcs armada_primary_plane_funcs = {
> > >   	.update_plane	= drm_atomic_helper_update_plane,
> > >   	.disable_plane	= drm_atomic_helper_disable_plane,
> > > -	.destroy	= drm_primary_helper_destroy,
> > > +	.destroy	= drm_plane_helper_destroy,
> > >   	.reset		= armada_plane_reset,
> > >   	.atomic_duplicate_state = armada_plane_duplicate_state,
> > >   	.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
> > > diff --git a/drivers/gpu/drm/drm_modeset_helper.c b/drivers/gpu/drm/drm_modeset_helper.c
> > > index 0f08319453b2..bd609a978848 100644
> > > --- a/drivers/gpu/drm/drm_modeset_helper.c
> > > +++ b/drivers/gpu/drm/drm_modeset_helper.c
> > > @@ -108,6 +108,12 @@ static const uint32_t safe_modeset_formats[] = {
> > >   	DRM_FORMAT_ARGB8888,
> > >   };
> > > +static const struct drm_plane_funcs primary_plane_funcs = {
> > > +	.update_plane = drm_plane_helper_update_primary,
> > > +	.disable_plane = drm_plane_helper_disable_primary,
> > > +	.destroy = drm_plane_helper_destroy,
> > > +};
> > > +
> > >   static struct drm_plane *create_primary_plane(struct drm_device *dev)
> > >   {
> > >   	struct drm_plane *primary;
> > > @@ -127,7 +133,7 @@ static struct drm_plane *create_primary_plane(struct drm_device *dev)
> > >   	/* possible_crtc's will be filled in later by crtc_init */
> > >   	ret = drm_universal_plane_init(dev, primary, 0,
> > > -				       &drm_primary_helper_funcs,
> > > +				       &primary_plane_funcs,
> > >   				       safe_modeset_formats,
> > >   				       ARRAY_SIZE(safe_modeset_formats),
> > >   				       NULL,
> > > diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
> > > index bc08edd69030..c7785967f5bf 100644
> > > --- a/drivers/gpu/drm/drm_plane_helper.c
> > > +++ b/drivers/gpu/drm/drm_plane_helper.c
> > > @@ -145,13 +145,36 @@ static int drm_plane_helper_check_update(struct drm_plane *plane,
> > >   	return 0;
> > >   }
> > > -static int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *crtc,
> > > -				     struct drm_framebuffer *fb,
> > > -				     int crtc_x, int crtc_y,
> > > -				     unsigned int crtc_w, unsigned int crtc_h,
> > > -				     uint32_t src_x, uint32_t src_y,
> > > -				     uint32_t src_w, uint32_t src_h,
> > > -				     struct drm_modeset_acquire_ctx *ctx)
> > > +/**
> > > + * drm_plane_helper_update_primary - Helper for updating primary planes
> > > + * @plane: plane to update
> > > + * @crtc: the plane's new CRTC
> > > + * @fb: the plane's new framebuffer
> > > + * @crtc_x: x coordinate within CRTC
> > > + * @crtc_y: y coordinate within CRTC
> > > + * @crtc_w: width coordinate within CRTC
> > > + * @crtc_h: height coordinate within CRTC
> > > + * @src_x: x coordinate within source
> > > + * @src_y: y coordinate within source
> > > + * @src_w: width coordinate within source
> > > + * @src_h: height coordinate within source
> > > + * @ctx: modeset locking context
> > > + *
> > > + * This helper validates the given parameters and updates the primary plane.
> > > + *
> > > + * This function is only useful for non-atomic modesetting. Don't use
> > > + * it in new drivers.
> > > + *
> > > + * Returns:
> > > + * Zero on success, or an errno code otherwise.
> > > + */
> > > +int drm_plane_helper_update_primary(struct drm_plane *plane, struct drm_crtc *crtc,
> > > +				    struct drm_framebuffer *fb,
> > > +				    int crtc_x, int crtc_y,
> > > +				    unsigned int crtc_w, unsigned int crtc_h,
> > > +				    uint32_t src_x, uint32_t src_y,
> > > +				    uint32_t src_w, uint32_t src_h,
> > > +				    struct drm_modeset_acquire_ctx *ctx)
> > >   {
> > >   	struct drm_mode_set set = {
> > >   		.crtc = crtc,
> > > @@ -218,31 +241,40 @@ static int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *c
> > >   	kfree(connector_list);
> > >   	return ret;
> > >   }
> > > +EXPORT_SYMBOL(drm_plane_helper_update_primary);
> > > -static int drm_primary_helper_disable(struct drm_plane *plane,
> > > -				      struct drm_modeset_acquire_ctx *ctx)
> > > +/**
> > > + * drm_plane_helper_disable_primary - Helper for disabling primary planes
> > > + * @plane: plane to disable
> > > + * @ctx: modeset locking context
> > > + *
> > > + * This helper returns an error when trying to disable the primary
> > > + * plane.
> > > + *
> > > + * This function is only useful for non-atomic modesetting. Don't use
> > > + * it in new drivers.
> > > + *
> > > + * Returns:
> > > + * An errno code.
> > > + */
> > > +int drm_plane_helper_disable_primary(struct drm_plane *plane,
> > > +				     struct drm_modeset_acquire_ctx *ctx)
> > >   {
> > >   	return -EINVAL;
> > >   }
> > > +EXPORT_SYMBOL(drm_plane_helper_disable_primary);
> > >   /**
> > > - * drm_primary_helper_destroy() - Helper for primary plane destruction
> > > + * drm_plane_helper_destroy() - Helper for primary plane destruction
> > >    * @plane: plane to destroy
> > >    *
> > >    * Provides a default plane destroy handler for primary planes.  This handler
> > >    * is called during CRTC destruction.  We disable the primary plane, remove
> > >    * it from the DRM plane list, and deallocate the plane structure.
> > >    */
> > > -void drm_primary_helper_destroy(struct drm_plane *plane)
> > > +void drm_plane_helper_destroy(struct drm_plane *plane)
> > >   {
> > >   	drm_plane_cleanup(plane);
> > >   	kfree(plane);
> > >   }
> > > -EXPORT_SYMBOL(drm_primary_helper_destroy);
> > > -
> > > -const struct drm_plane_funcs drm_primary_helper_funcs = {
> > > -	.update_plane = drm_primary_helper_update,
> > > -	.disable_plane = drm_primary_helper_disable,
> > > -	.destroy = drm_primary_helper_destroy,
> > > -};
> > > -EXPORT_SYMBOL(drm_primary_helper_funcs);
> > > +EXPORT_SYMBOL(drm_plane_helper_destroy);
> > > diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
> > > index f9e962fd94d0..660c4cbc0b3d 100644
> > > --- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c
> > > +++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
> > > @@ -1275,6 +1275,12 @@ static const uint32_t modeset_formats[] = {
> > >           DRM_FORMAT_XRGB1555,
> > >   };
> > > +static const struct drm_plane_funcs nv04_primary_plane_funcs = {
> > > +	.update_plane = drm_plane_helper_update_primary,
> > > +	.disable_plane = drm_plane_helper_disable_primary,
> > > +	.destroy = drm_plane_helper_destroy,
> > > +};
> > > +
> > >   static struct drm_plane *
> > >   create_primary_plane(struct drm_device *dev)
> > >   {
> > > @@ -1289,7 +1295,7 @@ create_primary_plane(struct drm_device *dev)
> > >           /* possible_crtc's will be filled in later by crtc_init */
> > >           ret = drm_universal_plane_init(dev, primary, 0,
> > > -                                       &drm_primary_helper_funcs,
> > > +				       &nv04_primary_plane_funcs,
> > >                                          modeset_formats,
> > >                                          ARRAY_SIZE(modeset_formats), NULL,
> > >                                          DRM_PLANE_TYPE_PRIMARY, NULL);
> > > diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c
> > > index 2e8949863d6b..a152a7c6db21 100644
> > > --- a/drivers/gpu/drm/qxl/qxl_display.c
> > > +++ b/drivers/gpu/drm/qxl/qxl_display.c
> > > @@ -902,7 +902,7 @@ static const struct drm_plane_helper_funcs qxl_cursor_helper_funcs = {
> > >   static const struct drm_plane_funcs qxl_cursor_plane_funcs = {
> > >   	.update_plane	= drm_atomic_helper_update_plane,
> > >   	.disable_plane	= drm_atomic_helper_disable_plane,
> > > -	.destroy	= drm_primary_helper_destroy,
> > > +	.destroy	= drm_plane_helper_destroy,
> > >   	.reset		= drm_atomic_helper_plane_reset,
> > >   	.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
> > >   	.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
> > > @@ -924,7 +924,7 @@ static const struct drm_plane_helper_funcs primary_helper_funcs = {
> > >   static const struct drm_plane_funcs qxl_primary_plane_funcs = {
> > >   	.update_plane	= drm_atomic_helper_update_plane,
> > >   	.disable_plane	= drm_atomic_helper_disable_plane,
> > > -	.destroy	= drm_primary_helper_destroy,
> > > +	.destroy	= drm_plane_helper_destroy,
> > >   	.reset		= drm_atomic_helper_plane_reset,
> > >   	.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
> > >   	.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
> > > diff --git a/drivers/gpu/drm/vboxvideo/vbox_mode.c b/drivers/gpu/drm/vboxvideo/vbox_mode.c
> > > index 604ebfbef314..341edd982cb3 100644
> > > --- a/drivers/gpu/drm/vboxvideo/vbox_mode.c
> > > +++ b/drivers/gpu/drm/vboxvideo/vbox_mode.c
> > > @@ -477,7 +477,7 @@ static const struct drm_plane_helper_funcs vbox_cursor_helper_funcs = {
> > >   static const struct drm_plane_funcs vbox_cursor_plane_funcs = {
> > >   	.update_plane	= drm_atomic_helper_update_plane,
> > >   	.disable_plane	= drm_atomic_helper_disable_plane,
> > > -	.destroy	= drm_primary_helper_destroy,
> > > +	.destroy	= drm_plane_helper_destroy,
> > >   	DRM_GEM_SHADOW_PLANE_FUNCS,
> > >   };
> > > @@ -496,7 +496,7 @@ static const struct drm_plane_helper_funcs vbox_primary_helper_funcs = {
> > >   static const struct drm_plane_funcs vbox_primary_plane_funcs = {
> > >   	.update_plane	= drm_atomic_helper_update_plane,
> > >   	.disable_plane	= drm_atomic_helper_disable_plane,
> > > -	.destroy	= drm_primary_helper_destroy,
> > > +	.destroy	= drm_plane_helper_destroy,
> > >   	.reset		= drm_atomic_helper_plane_reset,
> > >   	.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
> > >   	.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
> > > diff --git a/include/drm/drm_plane_helper.h b/include/drm/drm_plane_helper.h
> > > index ff85ef41cb33..1781fab24dd6 100644
> > > --- a/include/drm/drm_plane_helper.h
> > > +++ b/include/drm/drm_plane_helper.h
> > > @@ -24,12 +24,22 @@
> > >   #ifndef DRM_PLANE_HELPER_H
> > >   #define DRM_PLANE_HELPER_H
> > > -#include <drm/drm_rect.h>
> > > -#include <drm/drm_crtc.h>
> > > -#include <drm/drm_modeset_helper_vtables.h>
> > > -#include <drm/drm_modeset_helper.h>
> > > +#include <linux/types.h>
> > > -void drm_primary_helper_destroy(struct drm_plane *plane);
> > > -extern const struct drm_plane_funcs drm_primary_helper_funcs;
> > > +struct drm_crtc;
> > > +struct drm_framebuffer;
> > > +struct drm_modeset_acquire_ctx;
> > > +struct drm_plane;
> > > +
> > > +int drm_plane_helper_update_primary(struct drm_plane *plane, struct drm_crtc *crtc,
> > > +				    struct drm_framebuffer *fb,
> > > +				    int crtc_x, int crtc_y,
> > > +				    unsigned int crtc_w, unsigned int crtc_h,
> > > +				    uint32_t src_x, uint32_t src_y,
> > > +				    uint32_t src_w, uint32_t src_h,
> > > +				    struct drm_modeset_acquire_ctx *ctx);
> > > +int drm_plane_helper_disable_primary(struct drm_plane *plane,
> > > +				     struct drm_modeset_acquire_ctx *ctx);
> > > +void drm_plane_helper_destroy(struct drm_plane *plane);
> > >   #endif
> > > -- 
> > > 2.36.1
> > > 
> > 
> 
> -- 
> Thomas Zimmermann
> Graphics Driver Developer
> SUSE Software Solutions Germany GmbH
> Maxfeldstr. 5, 90409 Nürnberg, Germany
> (HRB 36809, AG Nürnberg)
> Geschäftsführer: Ivo Totev




-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 5/7] drm/plane-helper: Export individual helpers
  2022-09-06 19:15       ` Daniel Vetter
@ 2022-09-07  7:09         ` Thomas Zimmermann
  0 siblings, 0 replies; 16+ messages in thread
From: Thomas Zimmermann @ 2022-09-07  7:09 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: airlied, alison.wang, linux, dri-devel,
	linux-graphics-maintainer, airlied


[-- Attachment #1.1: Type: text/plain, Size: 16329 bytes --]

Hi

Am 06.09.22 um 21:15 schrieb Daniel Vetter:
> On Thu, Aug 11, 2022 at 08:32:19PM +0200, Thomas Zimmermann wrote:
>> Hi
>>
>> Am 11.08.22 um 18:41 schrieb Daniel Vetter:
>>> On Wed, Jul 20, 2022 at 10:30:56AM +0200, Thomas Zimmermann wrote:
>>>> Export the individual plane helpers that make up the plane functions and
>>>> align the naming with other helpers. The plane helpers are for non-atomic
>>>> modesetting and exporting them will simplify a later conversion of drivers
>>>> to atomic modesetting.
>>>>
>>>> With struct drm_plane_funcs removed from drm_plane_helper.h, also remove
>>>> the include statements. It only needs linux/types.h for uint32_t and a
>>>> number of forward declarations.
>>>>
>>>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>>>
>>> So my commit message was maybe not super motivated, but I intentionally
>>> hid these because atomic drivers where using them, which is all bad no
>>> good. Now they're more exposed again, which sucks a bit. Exporting the
>>> complete function table for legacy helpers (and the one open-coded one in
>>> nouveau, not sure we could not move that back to drm_crtc_init) feels much
>>> safer against abuse to me.
>>>
>>> I'm not entirely clear why we're doing this, because the include untangle
>>> could also have been achieved with a struct forward decl, which is what
>>> we're usually doing. Can we walk this back please, or am I missing
>>> something here?
>>
>> I don't think you miss anything. It's just ugly to export the complete funcs
>> table. If we roll that change back, let's add a comment that states the
>> rational you wrote here.
> 
> So I'm way behind on everything, but maybe another option is to just check
> in these functions that it's not an atomic modeset driver (i.e.

I think I would prefer that.

> drm_drv_uses_atomic_modeset()). Or we just hope driver authors are smarter
> now and there wont be fallout.
> 
> I'm also not clear on why exporting the entire vfunc table is a bad idea?

My complain is that it's a blackbox. When reading the driver, you never 
know what it does. If there are defaults that match most vtables, it's 
better the export an init macro (like we do for many of the callbacks in 
struct drm_driver).

This problem gets worse when one of the driver needs a variant of the 
vtable. Here a number of default callback functions need to be exported 
in addition to the vtable itself. So my take is that it's better to 
export the functions plus an init macro in the first place.

Let me see if I can send an update to the patch.

Best regards
Thomas

> 
> Either way I'd say up to you.
> -Daniel
> 
>>
>> Best regards
>> Thomas
>>
>>>
>>> Cheers, Daniel
>>>
>>>> ---
>>>>    .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 +-
>>>>    drivers/gpu/drm/armada/armada_plane.c         |  2 +-
>>>>    drivers/gpu/drm/drm_modeset_helper.c          |  8 ++-
>>>>    drivers/gpu/drm/drm_plane_helper.c            | 70 ++++++++++++++-----
>>>>    drivers/gpu/drm/nouveau/dispnv04/crtc.c       |  8 ++-
>>>>    drivers/gpu/drm/qxl/qxl_display.c             |  4 +-
>>>>    drivers/gpu/drm/vboxvideo/vbox_mode.c         |  4 +-
>>>>    include/drm/drm_plane_helper.h                | 22 ++++--
>>>>    8 files changed, 88 insertions(+), 33 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>>>> index 3e83fed540e8..1548f0a1b1c0 100644
>>>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>>>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>>>> @@ -86,6 +86,7 @@
>>>>    #include <drm/drm_vblank.h>
>>>>    #include <drm/drm_audio_component.h>
>>>>    #include <drm/drm_gem_atomic_helper.h>
>>>> +#include <drm/drm_plane_helper.h>
>>>>    #include "ivsrcid/dcn/irqsrcs_dcn_1_0.h"
>>>> @@ -7824,7 +7825,7 @@ static void dm_drm_plane_destroy_state(struct drm_plane *plane,
>>>>    static const struct drm_plane_funcs dm_plane_funcs = {
>>>>    	.update_plane	= drm_atomic_helper_update_plane,
>>>>    	.disable_plane	= drm_atomic_helper_disable_plane,
>>>> -	.destroy	= drm_primary_helper_destroy,
>>>> +	.destroy	= drm_plane_helper_destroy,
>>>>    	.reset = dm_drm_plane_reset,
>>>>    	.atomic_duplicate_state = dm_drm_plane_duplicate_state,
>>>>    	.atomic_destroy_state = dm_drm_plane_destroy_state,
>>>> diff --git a/drivers/gpu/drm/armada/armada_plane.c b/drivers/gpu/drm/armada/armada_plane.c
>>>> index 959d7f0a5108..cc47c032dbc1 100644
>>>> --- a/drivers/gpu/drm/armada/armada_plane.c
>>>> +++ b/drivers/gpu/drm/armada/armada_plane.c
>>>> @@ -288,7 +288,7 @@ struct drm_plane_state *armada_plane_duplicate_state(struct drm_plane *plane)
>>>>    static const struct drm_plane_funcs armada_primary_plane_funcs = {
>>>>    	.update_plane	= drm_atomic_helper_update_plane,
>>>>    	.disable_plane	= drm_atomic_helper_disable_plane,
>>>> -	.destroy	= drm_primary_helper_destroy,
>>>> +	.destroy	= drm_plane_helper_destroy,
>>>>    	.reset		= armada_plane_reset,
>>>>    	.atomic_duplicate_state = armada_plane_duplicate_state,
>>>>    	.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
>>>> diff --git a/drivers/gpu/drm/drm_modeset_helper.c b/drivers/gpu/drm/drm_modeset_helper.c
>>>> index 0f08319453b2..bd609a978848 100644
>>>> --- a/drivers/gpu/drm/drm_modeset_helper.c
>>>> +++ b/drivers/gpu/drm/drm_modeset_helper.c
>>>> @@ -108,6 +108,12 @@ static const uint32_t safe_modeset_formats[] = {
>>>>    	DRM_FORMAT_ARGB8888,
>>>>    };
>>>> +static const struct drm_plane_funcs primary_plane_funcs = {
>>>> +	.update_plane = drm_plane_helper_update_primary,
>>>> +	.disable_plane = drm_plane_helper_disable_primary,
>>>> +	.destroy = drm_plane_helper_destroy,
>>>> +};
>>>> +
>>>>    static struct drm_plane *create_primary_plane(struct drm_device *dev)
>>>>    {
>>>>    	struct drm_plane *primary;
>>>> @@ -127,7 +133,7 @@ static struct drm_plane *create_primary_plane(struct drm_device *dev)
>>>>    	/* possible_crtc's will be filled in later by crtc_init */
>>>>    	ret = drm_universal_plane_init(dev, primary, 0,
>>>> -				       &drm_primary_helper_funcs,
>>>> +				       &primary_plane_funcs,
>>>>    				       safe_modeset_formats,
>>>>    				       ARRAY_SIZE(safe_modeset_formats),
>>>>    				       NULL,
>>>> diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
>>>> index bc08edd69030..c7785967f5bf 100644
>>>> --- a/drivers/gpu/drm/drm_plane_helper.c
>>>> +++ b/drivers/gpu/drm/drm_plane_helper.c
>>>> @@ -145,13 +145,36 @@ static int drm_plane_helper_check_update(struct drm_plane *plane,
>>>>    	return 0;
>>>>    }
>>>> -static int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *crtc,
>>>> -				     struct drm_framebuffer *fb,
>>>> -				     int crtc_x, int crtc_y,
>>>> -				     unsigned int crtc_w, unsigned int crtc_h,
>>>> -				     uint32_t src_x, uint32_t src_y,
>>>> -				     uint32_t src_w, uint32_t src_h,
>>>> -				     struct drm_modeset_acquire_ctx *ctx)
>>>> +/**
>>>> + * drm_plane_helper_update_primary - Helper for updating primary planes
>>>> + * @plane: plane to update
>>>> + * @crtc: the plane's new CRTC
>>>> + * @fb: the plane's new framebuffer
>>>> + * @crtc_x: x coordinate within CRTC
>>>> + * @crtc_y: y coordinate within CRTC
>>>> + * @crtc_w: width coordinate within CRTC
>>>> + * @crtc_h: height coordinate within CRTC
>>>> + * @src_x: x coordinate within source
>>>> + * @src_y: y coordinate within source
>>>> + * @src_w: width coordinate within source
>>>> + * @src_h: height coordinate within source
>>>> + * @ctx: modeset locking context
>>>> + *
>>>> + * This helper validates the given parameters and updates the primary plane.
>>>> + *
>>>> + * This function is only useful for non-atomic modesetting. Don't use
>>>> + * it in new drivers.
>>>> + *
>>>> + * Returns:
>>>> + * Zero on success, or an errno code otherwise.
>>>> + */
>>>> +int drm_plane_helper_update_primary(struct drm_plane *plane, struct drm_crtc *crtc,
>>>> +				    struct drm_framebuffer *fb,
>>>> +				    int crtc_x, int crtc_y,
>>>> +				    unsigned int crtc_w, unsigned int crtc_h,
>>>> +				    uint32_t src_x, uint32_t src_y,
>>>> +				    uint32_t src_w, uint32_t src_h,
>>>> +				    struct drm_modeset_acquire_ctx *ctx)
>>>>    {
>>>>    	struct drm_mode_set set = {
>>>>    		.crtc = crtc,
>>>> @@ -218,31 +241,40 @@ static int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *c
>>>>    	kfree(connector_list);
>>>>    	return ret;
>>>>    }
>>>> +EXPORT_SYMBOL(drm_plane_helper_update_primary);
>>>> -static int drm_primary_helper_disable(struct drm_plane *plane,
>>>> -				      struct drm_modeset_acquire_ctx *ctx)
>>>> +/**
>>>> + * drm_plane_helper_disable_primary - Helper for disabling primary planes
>>>> + * @plane: plane to disable
>>>> + * @ctx: modeset locking context
>>>> + *
>>>> + * This helper returns an error when trying to disable the primary
>>>> + * plane.
>>>> + *
>>>> + * This function is only useful for non-atomic modesetting. Don't use
>>>> + * it in new drivers.
>>>> + *
>>>> + * Returns:
>>>> + * An errno code.
>>>> + */
>>>> +int drm_plane_helper_disable_primary(struct drm_plane *plane,
>>>> +				     struct drm_modeset_acquire_ctx *ctx)
>>>>    {
>>>>    	return -EINVAL;
>>>>    }
>>>> +EXPORT_SYMBOL(drm_plane_helper_disable_primary);
>>>>    /**
>>>> - * drm_primary_helper_destroy() - Helper for primary plane destruction
>>>> + * drm_plane_helper_destroy() - Helper for primary plane destruction
>>>>     * @plane: plane to destroy
>>>>     *
>>>>     * Provides a default plane destroy handler for primary planes.  This handler
>>>>     * is called during CRTC destruction.  We disable the primary plane, remove
>>>>     * it from the DRM plane list, and deallocate the plane structure.
>>>>     */
>>>> -void drm_primary_helper_destroy(struct drm_plane *plane)
>>>> +void drm_plane_helper_destroy(struct drm_plane *plane)
>>>>    {
>>>>    	drm_plane_cleanup(plane);
>>>>    	kfree(plane);
>>>>    }
>>>> -EXPORT_SYMBOL(drm_primary_helper_destroy);
>>>> -
>>>> -const struct drm_plane_funcs drm_primary_helper_funcs = {
>>>> -	.update_plane = drm_primary_helper_update,
>>>> -	.disable_plane = drm_primary_helper_disable,
>>>> -	.destroy = drm_primary_helper_destroy,
>>>> -};
>>>> -EXPORT_SYMBOL(drm_primary_helper_funcs);
>>>> +EXPORT_SYMBOL(drm_plane_helper_destroy);
>>>> diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
>>>> index f9e962fd94d0..660c4cbc0b3d 100644
>>>> --- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c
>>>> +++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
>>>> @@ -1275,6 +1275,12 @@ static const uint32_t modeset_formats[] = {
>>>>            DRM_FORMAT_XRGB1555,
>>>>    };
>>>> +static const struct drm_plane_funcs nv04_primary_plane_funcs = {
>>>> +	.update_plane = drm_plane_helper_update_primary,
>>>> +	.disable_plane = drm_plane_helper_disable_primary,
>>>> +	.destroy = drm_plane_helper_destroy,
>>>> +};
>>>> +
>>>>    static struct drm_plane *
>>>>    create_primary_plane(struct drm_device *dev)
>>>>    {
>>>> @@ -1289,7 +1295,7 @@ create_primary_plane(struct drm_device *dev)
>>>>            /* possible_crtc's will be filled in later by crtc_init */
>>>>            ret = drm_universal_plane_init(dev, primary, 0,
>>>> -                                       &drm_primary_helper_funcs,
>>>> +				       &nv04_primary_plane_funcs,
>>>>                                           modeset_formats,
>>>>                                           ARRAY_SIZE(modeset_formats), NULL,
>>>>                                           DRM_PLANE_TYPE_PRIMARY, NULL);
>>>> diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c
>>>> index 2e8949863d6b..a152a7c6db21 100644
>>>> --- a/drivers/gpu/drm/qxl/qxl_display.c
>>>> +++ b/drivers/gpu/drm/qxl/qxl_display.c
>>>> @@ -902,7 +902,7 @@ static const struct drm_plane_helper_funcs qxl_cursor_helper_funcs = {
>>>>    static const struct drm_plane_funcs qxl_cursor_plane_funcs = {
>>>>    	.update_plane	= drm_atomic_helper_update_plane,
>>>>    	.disable_plane	= drm_atomic_helper_disable_plane,
>>>> -	.destroy	= drm_primary_helper_destroy,
>>>> +	.destroy	= drm_plane_helper_destroy,
>>>>    	.reset		= drm_atomic_helper_plane_reset,
>>>>    	.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
>>>>    	.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
>>>> @@ -924,7 +924,7 @@ static const struct drm_plane_helper_funcs primary_helper_funcs = {
>>>>    static const struct drm_plane_funcs qxl_primary_plane_funcs = {
>>>>    	.update_plane	= drm_atomic_helper_update_plane,
>>>>    	.disable_plane	= drm_atomic_helper_disable_plane,
>>>> -	.destroy	= drm_primary_helper_destroy,
>>>> +	.destroy	= drm_plane_helper_destroy,
>>>>    	.reset		= drm_atomic_helper_plane_reset,
>>>>    	.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
>>>>    	.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
>>>> diff --git a/drivers/gpu/drm/vboxvideo/vbox_mode.c b/drivers/gpu/drm/vboxvideo/vbox_mode.c
>>>> index 604ebfbef314..341edd982cb3 100644
>>>> --- a/drivers/gpu/drm/vboxvideo/vbox_mode.c
>>>> +++ b/drivers/gpu/drm/vboxvideo/vbox_mode.c
>>>> @@ -477,7 +477,7 @@ static const struct drm_plane_helper_funcs vbox_cursor_helper_funcs = {
>>>>    static const struct drm_plane_funcs vbox_cursor_plane_funcs = {
>>>>    	.update_plane	= drm_atomic_helper_update_plane,
>>>>    	.disable_plane	= drm_atomic_helper_disable_plane,
>>>> -	.destroy	= drm_primary_helper_destroy,
>>>> +	.destroy	= drm_plane_helper_destroy,
>>>>    	DRM_GEM_SHADOW_PLANE_FUNCS,
>>>>    };
>>>> @@ -496,7 +496,7 @@ static const struct drm_plane_helper_funcs vbox_primary_helper_funcs = {
>>>>    static const struct drm_plane_funcs vbox_primary_plane_funcs = {
>>>>    	.update_plane	= drm_atomic_helper_update_plane,
>>>>    	.disable_plane	= drm_atomic_helper_disable_plane,
>>>> -	.destroy	= drm_primary_helper_destroy,
>>>> +	.destroy	= drm_plane_helper_destroy,
>>>>    	.reset		= drm_atomic_helper_plane_reset,
>>>>    	.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
>>>>    	.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
>>>> diff --git a/include/drm/drm_plane_helper.h b/include/drm/drm_plane_helper.h
>>>> index ff85ef41cb33..1781fab24dd6 100644
>>>> --- a/include/drm/drm_plane_helper.h
>>>> +++ b/include/drm/drm_plane_helper.h
>>>> @@ -24,12 +24,22 @@
>>>>    #ifndef DRM_PLANE_HELPER_H
>>>>    #define DRM_PLANE_HELPER_H
>>>> -#include <drm/drm_rect.h>
>>>> -#include <drm/drm_crtc.h>
>>>> -#include <drm/drm_modeset_helper_vtables.h>
>>>> -#include <drm/drm_modeset_helper.h>
>>>> +#include <linux/types.h>
>>>> -void drm_primary_helper_destroy(struct drm_plane *plane);
>>>> -extern const struct drm_plane_funcs drm_primary_helper_funcs;
>>>> +struct drm_crtc;
>>>> +struct drm_framebuffer;
>>>> +struct drm_modeset_acquire_ctx;
>>>> +struct drm_plane;
>>>> +
>>>> +int drm_plane_helper_update_primary(struct drm_plane *plane, struct drm_crtc *crtc,
>>>> +				    struct drm_framebuffer *fb,
>>>> +				    int crtc_x, int crtc_y,
>>>> +				    unsigned int crtc_w, unsigned int crtc_h,
>>>> +				    uint32_t src_x, uint32_t src_y,
>>>> +				    uint32_t src_w, uint32_t src_h,
>>>> +				    struct drm_modeset_acquire_ctx *ctx);
>>>> +int drm_plane_helper_disable_primary(struct drm_plane *plane,
>>>> +				     struct drm_modeset_acquire_ctx *ctx);
>>>> +void drm_plane_helper_destroy(struct drm_plane *plane);
>>>>    #endif
>>>> -- 
>>>> 2.36.1
>>>>
>>>
>>
>> -- 
>> Thomas Zimmermann
>> Graphics Driver Developer
>> SUSE Software Solutions Germany GmbH
>> Maxfeldstr. 5, 90409 Nürnberg, Germany
>> (HRB 36809, AG Nürnberg)
>> Geschäftsführer: Ivo Totev
> 
> 
> 
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2022-09-07  7:10 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-20  8:30 [PATCH 0/7] drm: Clean up plane helpers Thomas Zimmermann
2022-07-20  8:30 ` [PATCH 1/7] drm/vmwgfx: Remove trailing whitespace Thomas Zimmermann
2022-07-20 13:23   ` Zack Rusin
2022-07-20  8:30 ` [PATCH 2/7] drm/atomic-helper: Move DRM_PLANE_HELPER_NO_SCALING to atomic helpers Thomas Zimmermann
2022-07-20  8:30 ` [PATCH 3/7] drm/atomic-helper: Remove _HELPER_ infix from DRM_PLANE_HELPER_NO_SCALING Thomas Zimmermann
2022-07-20  8:30 ` [PATCH 4/7] drm: Remove unnecessary include statements of drm_plane_helper.h Thomas Zimmermann
2022-07-20  8:30 ` [PATCH 5/7] drm/plane-helper: Export individual helpers Thomas Zimmermann
2022-08-11 16:41   ` Daniel Vetter
2022-08-11 18:32     ` Thomas Zimmermann
2022-09-06 19:15       ` Daniel Vetter
2022-09-07  7:09         ` Thomas Zimmermann
2022-07-20  8:30 ` [PATCH 6/7] drm/armada: Use drm_plane_helper_destroy() Thomas Zimmermann
2022-07-20  8:30 ` [PATCH 7/7] drm/fsl-dcu: " Thomas Zimmermann
2022-08-11 16:46   ` Daniel Vetter
2022-07-20 15:08 ` [PATCH 0/7] drm: Clean up plane helpers Sam Ravnborg
2022-07-21  6:52   ` Thomas Zimmermann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).