All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] drm/radeon: Inline drm_crtc_init()
@ 2026-11-12 12:45 Thomas Zimmermann
  2026-11-12 12:45 ` [PATCH v2 1/2] " Thomas Zimmermann
  2026-11-12 12:45 ` [PATCH v2 2/2] drm: Remove drm_crtc_init() Thomas Zimmermann
  0 siblings, 2 replies; 7+ messages in thread
From: Thomas Zimmermann @ 2026-11-12 12:45 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, airlied, simona,
	maarten.lankhorst, mripard
  Cc: amd-gfx, dri-devel, sashiko-reviews, Thomas Zimmermann

(was: drm/amdgpu,radeon: Inline drm_crtc_init())

The helper drm_crtc_init() sets up a CRTC with a primary plane for
non-atomic mode setting. Only radeon still uses it.

Inline drm_crtc_init() into radeon and remove it from DRM. All new
code implements atomic mode setting, which does not use drm_crtc_init().
DRM support for kernel panic is not implemented by radeon. Clean it up.

With this series in place, DRM's helpers for drawing panic screens
can be further integrated with other drawing helpers, as outlined
in [1].

Tested on radeon with a Radeon HD 6570.

Requires the patch series at [2].

v2:
- add missing formats for primary plane
- drop amdgpu patches

[1] https://lore.kernel.org/dri-devel/20261019154612.777074-1-tzimmermann@suse.de/
[2] https://lore.kernel.org/amd-gfx/20261111151546.3105062-1-alexander.deucher@amd.com/

Thomas Zimmermann (2):
  drm/radeon: Inline drm_crtc_init()
  drm: Remove drm_crtc_init()

 drivers/gpu/drm/drm_crtc.c              | 26 +++------
 drivers/gpu/drm/drm_modeset_helper.c    | 74 -------------------------
 drivers/gpu/drm/radeon/radeon_display.c | 61 +++++++++++++++++---
 include/drm/drm_modeset_helper.h        |  3 -
 include/drm/drm_plane.h                 |  5 --
 5 files changed, 61 insertions(+), 108 deletions(-)

-- 
2.56.0


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

* [PATCH v2 1/2] drm/radeon: Inline drm_crtc_init()
  2026-11-12 12:45 [PATCH v2 0/2] drm/radeon: Inline drm_crtc_init() Thomas Zimmermann
@ 2026-11-12 12:45 ` Thomas Zimmermann
  2026-11-12 13:21   ` sashiko-bot
  2026-11-12 12:45 ` [PATCH v2 2/2] drm: Remove drm_crtc_init() Thomas Zimmermann
  1 sibling, 1 reply; 7+ messages in thread
From: Thomas Zimmermann @ 2026-11-12 12:45 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, airlied, simona,
	maarten.lankhorst, mripard
  Cc: amd-gfx, dri-devel, sashiko-reviews, Thomas Zimmermann

Inline drm_crtc_init() into radeon CRTC initialization. The helper is
only used by drivers for AMD hardware to implement legacy mode setting.

As in drm_crtc_init(), create a primary plane for the CRTC. Use the same
formats as with drm_crtc_init(). Format modifiers are still marked as
unsupported and handled internally by the plane. For the CRTC, call
drm_crtc_init_with_planes() for initialization. Clean up on errors.

Radeon does not support DRM panic helpers. Therefore do not initialize
the primary plane's panic-helper callbacks.

v2:
- add missing formats for primary plane

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/gpu/drm/radeon/radeon_display.c | 61 ++++++++++++++++++++++---
 1 file changed, 54 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index aac6733ddd82..1a03c641d72f 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -38,6 +38,7 @@
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_modeset_helper.h>
+#include <drm/drm_plane_helper.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_vblank.h>
 #include <drm/radeon_drm.h>
@@ -47,6 +48,31 @@
 #include "radeon.h"
 #include "radeon_kms.h"
 
+static const u32 radeon_primary_plane_formats[] = {
+	DRM_FORMAT_XRGB8888,
+	DRM_FORMAT_ARGB8888,
+	DRM_FORMAT_XBGR8888,
+	DRM_FORMAT_ABGR8888,
+	DRM_FORMAT_XRGB2101010,
+	DRM_FORMAT_ARGB2101010,
+	DRM_FORMAT_BGRX1010102,
+	DRM_FORMAT_BGRA1010102,
+	DRM_FORMAT_RGB565,
+	DRM_FORMAT_XRGB1555,
+	DRM_FORMAT_ARGB1555,
+	DRM_FORMAT_BGRX5551,
+	DRM_FORMAT_BGRA5551,
+	DRM_FORMAT_XRGB4444,
+	DRM_FORMAT_ARGB4444,
+	DRM_FORMAT_C8,
+};
+
+static const struct drm_plane_funcs radeon_primary_plane_funcs = {
+	.update_plane = drm_plane_helper_update_primary,
+	.disable_plane = drm_plane_helper_disable_primary,
+	.destroy = drm_plane_helper_destroy,
+};
+
 static void avivo_crtc_load_lut(struct drm_crtc *crtc)
 {
 	struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
@@ -680,20 +706,31 @@ static const struct drm_crtc_funcs radeon_crtc_funcs = {
 static void radeon_crtc_init(struct drm_device *dev, int index)
 {
 	struct radeon_device *rdev = dev->dev_private;
+	struct drm_plane *primary;
 	struct radeon_crtc *radeon_crtc;
+	int ret;
 
-	radeon_crtc = kzalloc_obj(*radeon_crtc);
-	if (radeon_crtc == NULL)
+	primary = __drm_universal_plane_alloc(dev, sizeof(*primary), 0, 0,
+					      &radeon_primary_plane_funcs,
+					      radeon_primary_plane_formats,
+					      ARRAY_SIZE(radeon_primary_plane_formats),
+					      NULL, DRM_PLANE_TYPE_PRIMARY, NULL);
+	if (IS_ERR(primary))
 		return;
 
+	radeon_crtc = kzalloc_obj(*radeon_crtc);
+	if (!radeon_crtc)
+		goto err_drm_plane_cleanup;
+
 	radeon_crtc->flip_queue = alloc_workqueue("radeon-crtc",
 						  WQ_HIGHPRI | WQ_PERCPU, 0);
-	if (!radeon_crtc->flip_queue) {
-		kfree(radeon_crtc);
-		return;
-	}
+	if (!radeon_crtc->flip_queue)
+		goto err_kfree;
 
-	drm_crtc_init(dev, &radeon_crtc->base, &radeon_crtc_funcs);
+	ret = drm_crtc_init_with_planes(dev, &radeon_crtc->base, primary, NULL,
+					&radeon_crtc_funcs, NULL);
+	if (ret)
+		goto err_destroy_workqueue;
 
 	drm_mode_crtc_set_gamma_size(&radeon_crtc->base, 256);
 	radeon_crtc->crtc_id = index;
@@ -713,6 +750,16 @@ static void radeon_crtc_init(struct drm_device *dev, int index)
 		radeon_atombios_init_crtc(dev, radeon_crtc);
 	else
 		radeon_legacy_init_crtc(dev, radeon_crtc);
+
+	return;
+
+err_destroy_workqueue:
+	destroy_workqueue(radeon_crtc->flip_queue);
+err_kfree:
+	kfree(radeon_crtc);
+err_drm_plane_cleanup:
+	drm_plane_cleanup(primary);
+	kfree(primary);
 }
 
 static const char *encoder_names[38] = {
-- 
2.56.0


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

* [PATCH v2 2/2] drm: Remove drm_crtc_init()
  2026-11-12 12:45 [PATCH v2 0/2] drm/radeon: Inline drm_crtc_init() Thomas Zimmermann
  2026-11-12 12:45 ` [PATCH v2 1/2] " Thomas Zimmermann
@ 2026-11-12 12:45 ` Thomas Zimmermann
  2026-11-12 13:01   ` sashiko-bot
                     ` (2 more replies)
  1 sibling, 3 replies; 7+ messages in thread
From: Thomas Zimmermann @ 2026-11-12 12:45 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, airlied, simona,
	maarten.lankhorst, mripard
  Cc: amd-gfx, dri-devel, sashiko-reviews, Thomas Zimmermann

There are no remaining users of drm_crtc_init(), so remove the helper
and the internal data structures for the primary plane that the helper
creates.

Also remove the format_default flag from struct drm_plane. Without
drm_crtc_init(), no drivers set it to true.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/gpu/drm/drm_crtc.c           | 26 +++-------
 drivers/gpu/drm/drm_modeset_helper.c | 74 ----------------------------
 include/drm/drm_modeset_helper.h     |  3 --
 include/drm/drm_plane.h              |  5 --
 4 files changed, 7 insertions(+), 101 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 5295ec122e0d..b7cf18b79b1d 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -334,10 +334,7 @@ static int __drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *
  * @funcs: callbacks for the new CRTC
  * @name: printf style format string for the CRTC name, or NULL for default name
  *
- * Inits a new object created as base part of a driver crtc object. Drivers
- * should use this function instead of drm_crtc_init(), which is only provided
- * for backwards compatibility with drivers which do not yet support universal
- * planes).
+ * Inits a new object created as base part of a driver crtc object.
  * The &drm_crtc_funcs.destroy hook should call drm_crtc_cleanup() and kfree()
  * the crtc structure. The crtc structure should not be allocated with
  * devm_kzalloc().
@@ -417,10 +414,7 @@ static int __drmm_crtc_init_with_planes(struct drm_device *dev,
  * @funcs: callbacks for the new CRTC
  * @name: printf style format string for the CRTC name, or NULL for default name
  *
- * Inits a new object created as base part of a driver crtc object. Drivers
- * should use this function instead of drm_crtc_init(), which is only provided
- * for backwards compatibility with drivers which do not yet support universal
- * planes).
+ * Inits a new object created as base part of a driver crtc object.
  *
  * Cleanup is automatically handled through registering
  * drmm_crtc_cleanup() with drmm_add_action(). The crtc structure should
@@ -806,18 +800,12 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
 
 		/*
 		 * Check whether the primary plane supports the fb pixel format.
-		 * Drivers not implementing the universal planes API use a
-		 * default formats list provided by the DRM core which doesn't
-		 * match real hardware capabilities. Skip the check in that
-		 * case.
 		 */
-		if (!plane->format_default) {
-			if (!drm_plane_has_format(plane, fb->format->format, fb->modifier)) {
-				drm_dbg_kms(dev, "Invalid pixel format %p4cc, modifier 0x%llx\n",
-					    &fb->format->format, fb->modifier);
-				ret = -EINVAL;
-				goto out;
-			}
+		if (!drm_plane_has_format(plane, fb->format->format, fb->modifier)) {
+			drm_dbg_kms(dev, "Invalid pixel format %p4cc, modifier 0x%llx\n",
+				    &fb->format->format, fb->modifier);
+			ret = -EINVAL;
+			goto out;
 		}
 
 		ret = drm_crtc_check_viewport(crtc, crtc_req->x, crtc_req->y,
diff --git a/drivers/gpu/drm/drm_modeset_helper.c b/drivers/gpu/drm/drm_modeset_helper.c
index cca623eb23e5..d462b347bde6 100644
--- a/drivers/gpu/drm/drm_modeset_helper.c
+++ b/drivers/gpu/drm/drm_modeset_helper.c
@@ -101,80 +101,6 @@ void drm_helper_mode_fill_fb_struct(struct drm_device *dev,
 }
 EXPORT_SYMBOL(drm_helper_mode_fill_fb_struct);
 
-/*
- * This is the minimal list of formats that seem to be safe for modeset use
- * with all current DRM drivers.  Most hardware can actually support more
- * formats than this and drivers may specify a more accurate list when
- * creating the primary plane.
- */
-static const uint32_t safe_modeset_formats[] = {
-	DRM_FORMAT_XRGB8888,
-	DRM_FORMAT_ARGB8888,
-};
-
-static const struct drm_plane_funcs primary_plane_funcs = {
-	DRM_PLANE_NON_ATOMIC_FUNCS,
-	DRM_PANIC_PLANE_FUNCS,
-};
-
-/**
- * drm_crtc_init - Legacy CRTC initialization function
- * @dev: DRM device
- * @crtc: CRTC object to init
- * @funcs: callbacks for the new CRTC
- *
- * Initialize a CRTC object with a default helper-provided primary plane and no
- * cursor plane.
- *
- * Note that we make some assumptions about hardware limitations that may not be
- * true for all hardware:
- *
- * 1. Primary plane cannot be repositioned.
- * 2. Primary plane cannot be scaled.
- * 3. Primary plane must cover the entire CRTC.
- * 4. Subpixel positioning is not supported.
- * 5. The primary plane must always be on if the CRTC is enabled.
- *
- * This is purely a backwards compatibility helper for old drivers. Drivers
- * should instead implement their own primary plane. Atomic drivers must do so.
- *
- * Returns:
- * Zero on success, error code on failure.
- */
-int drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
-		  const struct drm_crtc_funcs *funcs)
-{
-	struct drm_plane *primary;
-	int ret;
-
-	/* possible_crtc's will be filled in later by crtc_init */
-	primary = __drm_universal_plane_alloc(dev, sizeof(*primary), 0, 0,
-					      &primary_plane_funcs,
-					      safe_modeset_formats,
-					      ARRAY_SIZE(safe_modeset_formats),
-					      NULL, DRM_PLANE_TYPE_PRIMARY, NULL);
-	if (IS_ERR(primary))
-		return PTR_ERR(primary);
-
-	/*
-	 * Remove the format_default field from drm_plane when dropping
-	 * this helper.
-	 */
-	primary->format_default = true;
-
-	ret = drm_crtc_init_with_planes(dev, crtc, primary, NULL, funcs, NULL);
-	if (ret)
-		goto err_drm_plane_cleanup;
-
-	return 0;
-
-err_drm_plane_cleanup:
-	drm_plane_cleanup(primary);
-	kfree(primary);
-	return ret;
-}
-EXPORT_SYMBOL(drm_crtc_init);
-
 /**
  * drm_mode_config_helper_suspend - Modeset suspend helper
  * @dev: DRM device
diff --git a/include/drm/drm_modeset_helper.h b/include/drm/drm_modeset_helper.h
index 7e3d4c5a7f66..6b9421aee536 100644
--- a/include/drm/drm_modeset_helper.h
+++ b/include/drm/drm_modeset_helper.h
@@ -37,9 +37,6 @@ void drm_helper_mode_fill_fb_struct(struct drm_device *dev,
 				    const struct drm_format_info *info,
 				    const struct drm_mode_fb_cmd2 *mode_cmd);
 
-int drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
-		  const struct drm_crtc_funcs *funcs);
-
 int drm_mode_config_helper_suspend(struct drm_device *dev);
 int drm_mode_config_helper_resume(struct drm_device *dev);
 
diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
index 410d7b02b77a..3f6a1408cf5e 100644
--- a/include/drm/drm_plane.h
+++ b/include/drm/drm_plane.h
@@ -738,11 +738,6 @@ struct drm_plane {
 	uint32_t *format_types;
 	/** @format_count: Size of the array pointed at by @format_types. */
 	unsigned int format_count;
-	/**
-	 * @format_default: driver hasn't supplied supported formats for the
-	 * plane. Used by the non-atomic driver compatibility wrapper only.
-	 */
-	bool format_default;
 
 	/** @modifiers: array of modifiers supported by this plane */
 	uint64_t *modifiers;
-- 
2.56.0


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

* Re: [PATCH v2 2/2] drm: Remove drm_crtc_init()
  2026-11-12 12:45 ` [PATCH v2 2/2] drm: Remove drm_crtc_init() Thomas Zimmermann
@ 2026-11-12 13:01   ` sashiko-bot
  2026-11-12 19:18   ` kernel test robot
  2026-11-12 20:09   ` kernel test robot
  2 siblings, 0 replies; 7+ messages in thread
From: sashiko-bot @ 2026-11-12 13:01 UTC (permalink / raw)
  To: Thomas Zimmermann; +Cc: amd-gfx, dri-devel

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] drm: build failure in amdgpu DCE files after removing
  drm_crtc_init()
--

commit aafe7374dc79cd31dda721134581ac1246ab8089
Author: Thomas Zimmermann <tzimmermann@suse.de>

drm: Remove drm_crtc_init()

This commit removes the legacy drm_crtc_init() helper, its default primary
plane structures, and the format_default flag from struct drm_plane.

> diff --git a/include/drm/drm_modeset_helper.h b/include/drm/drm_modeset_helper.h
> index 7e3d4c5a7f66d..6b9421aee5360 100644
> --- a/include/drm/drm_modeset_helper.h
> +++ b/include/drm/drm_modeset_helper.h
> @@ -37,9 +37,6 @@ void drm_helper_mode_fill_fb_struct(struct drm_device *dev,
>  				    const struct drm_format_info *info,
>  				    const struct drm_mode_fb_cmd2 *mode_cmd);
>  
> -int drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
> -		  const struct drm_crtc_funcs *funcs);
> -
>  int drm_mode_config_helper_suspend(struct drm_device *dev);
>  int drm_mode_config_helper_resume(struct drm_device *dev);
>  

[Severity: High]
Does removing drm_crtc_init() break the build when CONFIG_DRM_AMDGPU is
enabled?

dce_v10_0_crtc_init() in drivers/gpu/drm/amd/amdgpu/dce_v10_0.c (as well
as dce_v8_0_crtc_init() and dce_v6_0_crtc_init()) still calls
drm_crtc_init():

drivers/gpu/drm/amd/amdgpu/dce_v10_0.c:dce_v10_0_crtc_init() {
	...
	drm_crtc_init(adev_to_drm(adev), &amdgpu_crtc->base, &dce_v10_0_crtc_funcs);
	drm_mode_crtc_set_gamma_size(&amdgpu_crtc->base, 256);
	...
}

Building amdgpu therefore fails with an implicit declaration of
drm_crtc_init().

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261112125039.66082-1-tzimmermann@suse.de?part=2

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

* Re: [PATCH v2 1/2] drm/radeon: Inline drm_crtc_init()
  2026-11-12 12:45 ` [PATCH v2 1/2] " Thomas Zimmermann
@ 2026-11-12 13:21   ` sashiko-bot
  0 siblings, 0 replies; 7+ messages in thread
From: sashiko-bot @ 2026-11-12 13:21 UTC (permalink / raw)
  To: Thomas Zimmermann; +Cc: amd-gfx, dri-devel

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] drm/radeon: radeon_crtc_init() registers DCE4 plane formats on
  all ASICs
- [Low] drm/radeon: commit message inaccurately claims drm_crtc_init()
  formats are used
--

commit 7f6e83326a814c1dd5b8538076f37ab12152984e
Author: Thomas Zimmermann <tzimmermann@suse.de>

drm/radeon: Inline drm_crtc_init()

This commit inlines drm_crtc_init() into radeon_crtc_init(), allocating
a primary plane with an explicit format list and initializing the CRTC via
drm_crtc_init_with_planes().

> As in drm_crtc_init(), create a primary plane for the CRTC. Use the same
> formats as with drm_crtc_init().

[Severity: Low]
Is the commit message still accurate here after v2?  drm_crtc_init() uses
safe_modeset_formats, which only contains DRM_FORMAT_XRGB8888 and
DRM_FORMAT_ARGB8888, whereas v2 expanded radeon_primary_plane_formats[]
to 16 formats.

> diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
> index aac6733ddd82c..1a03c641d72fe 100644
> --- a/drivers/gpu/drm/radeon/radeon_display.c
> +++ b/drivers/gpu/drm/radeon/radeon_display.c
> @@ -38,6 +38,7 @@
>  #include <drm/drm_framebuffer.h>
>  #include <drm/drm_gem_framebuffer_helper.h>
>  #include <drm/drm_modeset_helper.h>
> +#include <drm/drm_plane_helper.h>
>  #include <drm/drm_probe_helper.h>
>  #include <drm/drm_vblank.h>
>  #include <drm/radeon_drm.h>
> @@ -47,6 +48,31 @@
>  #include "radeon.h"
>  #include "radeon_kms.h"
>  
> +static const u32 radeon_primary_plane_formats[] = {
> +	DRM_FORMAT_XRGB8888,
> +	DRM_FORMAT_ARGB8888,
> +	DRM_FORMAT_XBGR8888,
> +	DRM_FORMAT_ABGR8888,
> +	DRM_FORMAT_XRGB2101010,
> +	DRM_FORMAT_ARGB2101010,
> +	DRM_FORMAT_BGRX1010102,
> +	DRM_FORMAT_BGRA1010102,
> +	DRM_FORMAT_RGB565,
> +	DRM_FORMAT_XRGB1555,
> +	DRM_FORMAT_ARGB1555,
> +	DRM_FORMAT_BGRX5551,
> +	DRM_FORMAT_BGRA5551,
> +	DRM_FORMAT_XRGB4444,
> +	DRM_FORMAT_ARGB4444,
> +	DRM_FORMAT_C8,
> +};

[ ... ]

> @@ -680,20 +706,31 @@ static const struct drm_crtc_funcs radeon_crtc_funcs = {
>  static void radeon_crtc_init(struct drm_device *dev, int index)
>  {
>  	struct radeon_device *rdev = dev->dev_private;
> +	struct drm_plane *primary;
>  	struct radeon_crtc *radeon_crtc;
> +	int ret;
>  
> -	radeon_crtc = kzalloc_obj(*radeon_crtc);
> -	if (radeon_crtc == NULL)
> +	primary = __drm_universal_plane_alloc(dev, sizeof(*primary), 0, 0,
> +					      &radeon_primary_plane_funcs,
> +					      radeon_primary_plane_formats,
> +					      ARRAY_SIZE(radeon_primary_plane_formats),
> +					      NULL, DRM_PLANE_TYPE_PRIMARY, NULL);

[Severity: High]
Does registering radeon_primary_plane_formats unconditionally on all
ASICs cause regressions on AVIVO (DCE1-DCE3) and pre-AVIVO hardware?

radeon_primary_plane_formats[] matches dce4_crtc_do_set_base(), whereas
drm_crtc_init() previously advertised only XRGB8888 and ARGB8888 on the
plane and set primary->format_default = true.

On AVIVO hardware (!ASIC_IS_DCE4(rdev)), avivo_crtc_do_set_base() does
not support DRM_FORMAT_ARGB1555, DRM_FORMAT_BGRX5551,
DRM_FORMAT_BGRA5551, DRM_FORMAT_BGRX1010102, or DRM_FORMAT_BGRA1010102.
When userspace selects one of these newly advertised formats,
avivo_crtc_do_set_base() pins target_fb's BO in VRAM before rejecting the
format and returning -EINVAL without unpinning rbo or old_fb:

drivers/gpu/drm/radeon/atombios_crtc.c:avivo_crtc_do_set_base() {
    ...
	r = radeon_bo_pin(rbo, RADEON_GEM_DOMAIN_VRAM, &fb_location);
	if (unlikely(r != 0)) {
		radeon_bo_unreserve(rbo);
		return -EINVAL;
	}
	radeon_bo_get_tiling_flags(rbo, &tiling_flags, NULL);
	radeon_bo_unreserve(rbo);

	switch (target_fb->format->format) {
    ...
	default:
		DRM_ERROR("Unsupported screen format %p4cc\n",
			  &target_fb->format->format);
		return -EINVAL;
	}
}

This permanently leaks the VRAM pin reference (and leaves scanout
unprogrammed during full modesets because atombios_crtc_mode_set()
ignores the return value of atombios_crtc_set_base()).

On pre-AVIVO hardware (!ASIC_IS_AVIVO(rdev)), radeon_crtc_do_set_base()
only switches on target_fb->format->cpp[0] * 8.  Advertising the 10-bpc,
BGR, 4444, and 5551 formats causes them to be misprogrammed as RGB565 or
XRGB8888, while omitting DRM_FORMAT_RGB888 (24-bpp) causes
drm_mode_setcrtc() to reject a format that pre-AVIVO CRTCs support now
that primary->format_default is false.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261112125039.66082-1-tzimmermann@suse.de?part=1

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

* Re: [PATCH v2 2/2] drm: Remove drm_crtc_init()
  2026-11-12 12:45 ` [PATCH v2 2/2] drm: Remove drm_crtc_init() Thomas Zimmermann
  2026-11-12 13:01   ` sashiko-bot
@ 2026-11-12 19:18   ` kernel test robot
  2026-11-12 20:09   ` kernel test robot
  2 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2026-11-12 19:18 UTC (permalink / raw)
  To: Thomas Zimmermann, alexander.deucher, christian.koenig, airlied,
	simona, maarten.lankhorst, mripard
  Cc: llvm, oe-kbuild-all, amd-gfx, dri-devel, sashiko-reviews,
	Thomas Zimmermann

Hi Thomas,

kernel test robot noticed the following build errors:

[auto build test ERROR on drm-misc/drm-misc-next]
[also build test ERROR on linus/master v7.4-rc2 next-20261111]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Thomas-Zimmermann/drm-radeon-Inline-drm_crtc_init/20261112-134508
base:   https://gitlab.freedesktop.org/drm/misc/kernel.git drm-misc-next
patch link:    https://lore.kernel.org/r/20261112125039.66082-3-tzimmermann%40suse.de
patch subject: [PATCH v2 2/2] drm: Remove drm_crtc_init()
config: loongarch-defconfig (https://download.01.org/0day-ci/archive/20261113/202611130312.g6BELEWG-lkp@intel.com/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project c628d639fc66f8e6d8ab1f0cc6b1df38f974e020)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261113/202611130312.g6BELEWG-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202611130312.g6BELEWG-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/gpu/drm/amd/amdgpu/dce_v8_0.c:2603:2: error: call to undeclared function 'drm_crtc_init'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    2603 |         drm_crtc_init(adev_to_drm(adev), &amdgpu_crtc->base, &dce_v8_0_crtc_funcs);
         |         ^
   1 error generated.
--
>> drivers/gpu/drm/amd/amdgpu/dce_v6_0.c:2645:2: error: call to undeclared function 'drm_crtc_init'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    2645 |         drm_crtc_init(adev_to_drm(adev), &amdgpu_crtc->base, &dce_v6_0_crtc_funcs);
         |         ^
   1 error generated.
--
>> drivers/gpu/drm/amd/amdgpu/dce_v10_0.c:2677:2: error: call to undeclared function 'drm_crtc_init'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    2677 |         drm_crtc_init(adev_to_drm(adev), &amdgpu_crtc->base, &dce_v10_0_crtc_funcs);
         |         ^
   1 error generated.


vim +/drm_crtc_init +2603 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c

7e50642d41050c Alex Deucher 2024-10-31  2593  
a2e73f56fa6282 Alex Deucher 2015-04-20  2594  static int dce_v8_0_crtc_init(struct amdgpu_device *adev, int index)
a2e73f56fa6282 Alex Deucher 2015-04-20  2595  {
a2e73f56fa6282 Alex Deucher 2015-04-20  2596  	struct amdgpu_crtc *amdgpu_crtc;
a2e73f56fa6282 Alex Deucher 2015-04-20  2597  
a2e73f56fa6282 Alex Deucher 2015-04-20  2598  	amdgpu_crtc = kzalloc(sizeof(struct amdgpu_crtc) +
a2e73f56fa6282 Alex Deucher 2015-04-20  2599  			      (AMDGPUFB_CONN_LIMIT * sizeof(struct drm_connector *)), GFP_KERNEL);
a2e73f56fa6282 Alex Deucher 2015-04-20  2600  	if (amdgpu_crtc == NULL)
a2e73f56fa6282 Alex Deucher 2015-04-20  2601  		return -ENOMEM;
a2e73f56fa6282 Alex Deucher 2015-04-20  2602  
4a580877bdcb83 Luben Tuikov 2020-08-24 @2603  	drm_crtc_init(adev_to_drm(adev), &amdgpu_crtc->base, &dce_v8_0_crtc_funcs);
a2e73f56fa6282 Alex Deucher 2015-04-20  2604  
a2e73f56fa6282 Alex Deucher 2015-04-20  2605  	drm_mode_crtc_set_gamma_size(&amdgpu_crtc->base, 256);
a2e73f56fa6282 Alex Deucher 2015-04-20  2606  	amdgpu_crtc->crtc_id = index;
a2e73f56fa6282 Alex Deucher 2015-04-20  2607  	adev->mode_info.crtcs[index] = amdgpu_crtc;
a2e73f56fa6282 Alex Deucher 2015-04-20  2608  
a2e73f56fa6282 Alex Deucher 2015-04-20  2609  	amdgpu_crtc->max_cursor_width = CIK_CURSOR_WIDTH;
a2e73f56fa6282 Alex Deucher 2015-04-20  2610  	amdgpu_crtc->max_cursor_height = CIK_CURSOR_HEIGHT;
4a580877bdcb83 Luben Tuikov 2020-08-24  2611  	adev_to_drm(adev)->mode_config.cursor_width = amdgpu_crtc->max_cursor_width;
4a580877bdcb83 Luben Tuikov 2020-08-24  2612  	adev_to_drm(adev)->mode_config.cursor_height = amdgpu_crtc->max_cursor_height;
a2e73f56fa6282 Alex Deucher 2015-04-20  2613  
a2e73f56fa6282 Alex Deucher 2015-04-20  2614  	amdgpu_crtc->crtc_offset = crtc_offsets[amdgpu_crtc->crtc_id];
a2e73f56fa6282 Alex Deucher 2015-04-20  2615  
a2e73f56fa6282 Alex Deucher 2015-04-20  2616  	amdgpu_crtc->pll_id = ATOM_PPLL_INVALID;
a2e73f56fa6282 Alex Deucher 2015-04-20  2617  	amdgpu_crtc->adjusted_clock = 0;
a2e73f56fa6282 Alex Deucher 2015-04-20  2618  	amdgpu_crtc->encoder = NULL;
a2e73f56fa6282 Alex Deucher 2015-04-20  2619  	amdgpu_crtc->connector = NULL;
a2e73f56fa6282 Alex Deucher 2015-04-20  2620  	drm_crtc_helper_add(&amdgpu_crtc->base, &dce_v8_0_crtc_helper_funcs);
7e50642d41050c Alex Deucher 2024-10-31  2621  	drm_plane_helper_add(amdgpu_crtc->base.primary, &dce_v8_0_drm_primary_plane_helper_funcs);
a2e73f56fa6282 Alex Deucher 2015-04-20  2622  
a2e73f56fa6282 Alex Deucher 2015-04-20  2623  	return 0;
a2e73f56fa6282 Alex Deucher 2015-04-20  2624  }
a2e73f56fa6282 Alex Deucher 2015-04-20  2625  

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [PATCH v2 2/2] drm: Remove drm_crtc_init()
  2026-11-12 12:45 ` [PATCH v2 2/2] drm: Remove drm_crtc_init() Thomas Zimmermann
  2026-11-12 13:01   ` sashiko-bot
  2026-11-12 19:18   ` kernel test robot
@ 2026-11-12 20:09   ` kernel test robot
  2 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2026-11-12 20:09 UTC (permalink / raw)
  To: Thomas Zimmermann, alexander.deucher, christian.koenig, airlied,
	simona, maarten.lankhorst, mripard
  Cc: oe-kbuild-all, amd-gfx, dri-devel, sashiko-reviews,
	Thomas Zimmermann

Hi Thomas,

kernel test robot noticed the following build errors:

[auto build test ERROR on drm-misc/drm-misc-next]
[also build test ERROR on linus/master v7.4-rc2 next-20261111]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Thomas-Zimmermann/drm-radeon-Inline-drm_crtc_init/20261112-134508
base:   https://gitlab.freedesktop.org/drm/misc/kernel.git drm-misc-next
patch link:    https://lore.kernel.org/r/20261112125039.66082-3-tzimmermann%40suse.de
patch subject: [PATCH v2 2/2] drm: Remove drm_crtc_init()
config: arc-randconfig-1001-20261112 (https://download.01.org/0day-ci/archive/20261113/202611130335.vCIEnRqF-lkp@intel.com/config)
compiler: arc-linux-gcc (GCC) 12.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261113/202611130335.vCIEnRqF-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202611130335.vCIEnRqF-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/gpu/drm/amd/amdgpu/dce_v10_0.c: In function 'dce_v10_0_crtc_init':
>> drivers/gpu/drm/amd/amdgpu/dce_v10_0.c:2677:9: error: implicit declaration of function 'drm_crtc_init'; did you mean 'drm_exec_init'? [-Werror=implicit-function-declaration]
    2677 |         drm_crtc_init(adev_to_drm(adev), &amdgpu_crtc->base, &dce_v10_0_crtc_funcs);
         |         ^~~~~~~~~~~~~
         |         drm_exec_init
   cc1: some warnings being treated as errors
--
   drivers/gpu/drm/amd/amdgpu/dce_v8_0.c: In function 'dce_v8_0_crtc_init':
>> drivers/gpu/drm/amd/amdgpu/dce_v8_0.c:2603:9: error: implicit declaration of function 'drm_crtc_init'; did you mean 'drm_exec_init'? [-Werror=implicit-function-declaration]
    2603 |         drm_crtc_init(adev_to_drm(adev), &amdgpu_crtc->base, &dce_v8_0_crtc_funcs);
         |         ^~~~~~~~~~~~~
         |         drm_exec_init
   cc1: some warnings being treated as errors
--
   drivers/gpu/drm/amd/amdgpu/dce_v6_0.c: In function 'dce_v6_0_crtc_init':
>> drivers/gpu/drm/amd/amdgpu/dce_v6_0.c:2645:9: error: implicit declaration of function 'drm_crtc_init'; did you mean 'drm_exec_init'? [-Werror=implicit-function-declaration]
    2645 |         drm_crtc_init(adev_to_drm(adev), &amdgpu_crtc->base, &dce_v6_0_crtc_funcs);
         |         ^~~~~~~~~~~~~
         |         drm_exec_init
   cc1: some warnings being treated as errors


vim +2677 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c

7e50642d41050c Alex Deucher 2024-10-31  2667  
aaa36a976bbb9b Alex Deucher 2015-04-20  2668  static int dce_v10_0_crtc_init(struct amdgpu_device *adev, int index)
aaa36a976bbb9b Alex Deucher 2015-04-20  2669  {
aaa36a976bbb9b Alex Deucher 2015-04-20  2670  	struct amdgpu_crtc *amdgpu_crtc;
aaa36a976bbb9b Alex Deucher 2015-04-20  2671  
aaa36a976bbb9b Alex Deucher 2015-04-20  2672  	amdgpu_crtc = kzalloc(sizeof(struct amdgpu_crtc) +
aaa36a976bbb9b Alex Deucher 2015-04-20  2673  			      (AMDGPUFB_CONN_LIMIT * sizeof(struct drm_connector *)), GFP_KERNEL);
aaa36a976bbb9b Alex Deucher 2015-04-20  2674  	if (amdgpu_crtc == NULL)
aaa36a976bbb9b Alex Deucher 2015-04-20  2675  		return -ENOMEM;
aaa36a976bbb9b Alex Deucher 2015-04-20  2676  
4a580877bdcb83 Luben Tuikov 2020-08-24 @2677  	drm_crtc_init(adev_to_drm(adev), &amdgpu_crtc->base, &dce_v10_0_crtc_funcs);
aaa36a976bbb9b Alex Deucher 2015-04-20  2678  
aaa36a976bbb9b Alex Deucher 2015-04-20  2679  	drm_mode_crtc_set_gamma_size(&amdgpu_crtc->base, 256);
aaa36a976bbb9b Alex Deucher 2015-04-20  2680  	amdgpu_crtc->crtc_id = index;
aaa36a976bbb9b Alex Deucher 2015-04-20  2681  	adev->mode_info.crtcs[index] = amdgpu_crtc;
aaa36a976bbb9b Alex Deucher 2015-04-20  2682  
aaa36a976bbb9b Alex Deucher 2015-04-20  2683  	amdgpu_crtc->max_cursor_width = 128;
aaa36a976bbb9b Alex Deucher 2015-04-20  2684  	amdgpu_crtc->max_cursor_height = 128;
4a580877bdcb83 Luben Tuikov 2020-08-24  2685  	adev_to_drm(adev)->mode_config.cursor_width = amdgpu_crtc->max_cursor_width;
4a580877bdcb83 Luben Tuikov 2020-08-24  2686  	adev_to_drm(adev)->mode_config.cursor_height = amdgpu_crtc->max_cursor_height;
aaa36a976bbb9b Alex Deucher 2015-04-20  2687  
aaa36a976bbb9b Alex Deucher 2015-04-20  2688  	switch (amdgpu_crtc->crtc_id) {
aaa36a976bbb9b Alex Deucher 2015-04-20  2689  	case 0:
aaa36a976bbb9b Alex Deucher 2015-04-20  2690  	default:
aaa36a976bbb9b Alex Deucher 2015-04-20  2691  		amdgpu_crtc->crtc_offset = CRTC0_REGISTER_OFFSET;
aaa36a976bbb9b Alex Deucher 2015-04-20  2692  		break;
aaa36a976bbb9b Alex Deucher 2015-04-20  2693  	case 1:
aaa36a976bbb9b Alex Deucher 2015-04-20  2694  		amdgpu_crtc->crtc_offset = CRTC1_REGISTER_OFFSET;
aaa36a976bbb9b Alex Deucher 2015-04-20  2695  		break;
aaa36a976bbb9b Alex Deucher 2015-04-20  2696  	case 2:
aaa36a976bbb9b Alex Deucher 2015-04-20  2697  		amdgpu_crtc->crtc_offset = CRTC2_REGISTER_OFFSET;
aaa36a976bbb9b Alex Deucher 2015-04-20  2698  		break;
aaa36a976bbb9b Alex Deucher 2015-04-20  2699  	case 3:
aaa36a976bbb9b Alex Deucher 2015-04-20  2700  		amdgpu_crtc->crtc_offset = CRTC3_REGISTER_OFFSET;
aaa36a976bbb9b Alex Deucher 2015-04-20  2701  		break;
aaa36a976bbb9b Alex Deucher 2015-04-20  2702  	case 4:
aaa36a976bbb9b Alex Deucher 2015-04-20  2703  		amdgpu_crtc->crtc_offset = CRTC4_REGISTER_OFFSET;
aaa36a976bbb9b Alex Deucher 2015-04-20  2704  		break;
aaa36a976bbb9b Alex Deucher 2015-04-20  2705  	case 5:
aaa36a976bbb9b Alex Deucher 2015-04-20  2706  		amdgpu_crtc->crtc_offset = CRTC5_REGISTER_OFFSET;
aaa36a976bbb9b Alex Deucher 2015-04-20  2707  		break;
aaa36a976bbb9b Alex Deucher 2015-04-20  2708  	}
aaa36a976bbb9b Alex Deucher 2015-04-20  2709  
aaa36a976bbb9b Alex Deucher 2015-04-20  2710  	amdgpu_crtc->pll_id = ATOM_PPLL_INVALID;
aaa36a976bbb9b Alex Deucher 2015-04-20  2711  	amdgpu_crtc->adjusted_clock = 0;
aaa36a976bbb9b Alex Deucher 2015-04-20  2712  	amdgpu_crtc->encoder = NULL;
aaa36a976bbb9b Alex Deucher 2015-04-20  2713  	amdgpu_crtc->connector = NULL;
aaa36a976bbb9b Alex Deucher 2015-04-20  2714  	drm_crtc_helper_add(&amdgpu_crtc->base, &dce_v10_0_crtc_helper_funcs);
7e50642d41050c Alex Deucher 2024-10-31  2715  	drm_plane_helper_add(amdgpu_crtc->base.primary, &dce_v10_0_drm_primary_plane_helper_funcs);
aaa36a976bbb9b Alex Deucher 2015-04-20  2716  
aaa36a976bbb9b Alex Deucher 2015-04-20  2717  	return 0;
aaa36a976bbb9b Alex Deucher 2015-04-20  2718  }
aaa36a976bbb9b Alex Deucher 2015-04-20  2719  

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

end of thread, other threads:[~2026-11-12 20:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-12 12:45 [PATCH v2 0/2] drm/radeon: Inline drm_crtc_init() Thomas Zimmermann
2026-11-12 12:45 ` [PATCH v2 1/2] " Thomas Zimmermann
2026-11-12 13:21   ` sashiko-bot
2026-11-12 12:45 ` [PATCH v2 2/2] drm: Remove drm_crtc_init() Thomas Zimmermann
2026-11-12 13:01   ` sashiko-bot
2026-11-12 19:18   ` kernel test robot
2026-11-12 20:09   ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.