From: sashiko-bot@kernel.org
To: "Thomas Zimmermann" <tzimmermann@suse.de>
Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 1/2] drm/radeon: Inline drm_crtc_init()
Date: Thu, 12 Nov 2026 13:21:14 +0000 [thread overview]
Message-ID: <sashiko-outbox-211164@kernel.org> (raw)
In-Reply-To: <20261112125039.66082-2-tzimmermann@suse.de>
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
next prev parent reply other threads:[~2026-11-12 13:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
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-211164@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=amd-gfx@lists.freedesktop.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.