All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Thomas Zimmermann" <tzimmermann@suse.de>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 4/5] drm/radeon: Inline drm_crtc_init()
Date: Tue, 10 Nov 2026 12:18:36 +0000	[thread overview]
Message-ID: <sashiko-outbox-206999@kernel.org> (raw)
In-Reply-To: <20261110120326.538252-5-tzimmermann@suse.de>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] drm/radeon: radeon_crtc_init() breaks non-XRGB8888/ARGB8888
  modesets
--

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

drm/radeon: Inline drm_crtc_init()

This commit inlines drm_crtc_init() into radeon_crtc_init() by allocating
a primary plane with __drm_universal_plane_alloc() and initializing the
CRTC via drm_crtc_init_with_planes().

> diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
> index aac6733ddd82c..4b784df4679f9 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,17 @@
>  #include "radeon.h"
>  #include "radeon_kms.h"
>  
> +static const u32 radeon_primary_plane_formats[] = {
> +	DRM_FORMAT_XRGB8888,
> +	DRM_FORMAT_ARGB8888,
> +};
> +
> +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 +692,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 restricting radeon_primary_plane_formats[] to only two 32-bit formats
cause drm_mode_setcrtc() to reject other pixel formats supported by radeon?

Previously, drm_crtc_init() set primary->format_default = true, which made
drm_mode_setcrtc() skip the drm_plane_has_format() check and leave format
validation to the CRTC callbacks:

drivers/gpu/drm/drm_crtc.c:drm_mode_setcrtc() {
    ...
		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;
			}
		}
    ...
}

Allocating the primary plane via __drm_universal_plane_alloc() leaves
primary->format_default as false (and follow-up commit "drm: Remove
drm_crtc_init()" removes format_default altogether). As a result,
drm_mode_setcrtc() now fails with -EINVAL for 8bpp, 15bpp, 16bpp, and 30bpp
framebuffers (such as C8, RGB565, XRGB1555, and XRGB2101010) that
dce4_crtc_do_set_base(), avivo_crtc_do_set_base(), and
radeon_crtc_do_set_base() handle.

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

  reply	other threads:[~2026-11-10 12:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10 11:53 [PATCH 0/5] drm/amdgpu,radeon: Inline drm_crtc_init() Thomas Zimmermann
2026-11-10 11:53 ` [PATCH 1/5] drm/amdgpu: dce_v6_0: " Thomas Zimmermann
2026-11-10 11:53 ` [PATCH 2/5] drm/amdgpu: dce_v8_0: " Thomas Zimmermann
2026-11-10 11:53 ` [PATCH 3/5] drm/amdgpu: dce_v10_0: " Thomas Zimmermann
2026-11-10 11:53 ` [PATCH 4/5] drm/radeon: " Thomas Zimmermann
2026-11-10 12:18   ` sashiko-bot [this message]
2026-11-10 14:27     ` Thomas Zimmermann
2026-11-10 11:53 ` [PATCH 5/5] drm: Remove drm_crtc_init() Thomas Zimmermann
2026-11-10 12:35 ` [PATCH 0/5] drm/amdgpu,radeon: Inline drm_crtc_init() Maxime Ripard
2026-11-10 21:49 ` Alex Deucher
2026-11-11  9:35   ` Thomas Zimmermann
2026-11-11 15:51     ` Alex Deucher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-206999@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.