From: Thomas Zimmermann <tzimmermann@suse.de>
To: alexander.deucher@amd.com, christian.koenig@amd.com,
airlied@gmail.com, simona@ffwll.ch,
maarten.lankhorst@linux.intel.com, mripard@kernel.org
Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
sashiko-reviews@lists.linux.dev,
Thomas Zimmermann <tzimmermann@suse.de>
Subject: [PATCH 1/5] drm/amdgpu: dce_v6_0: Inline drm_crtc_init()
Date: Tue, 10 Nov 2026 12:53:27 +0100 [thread overview]
Message-ID: <20261110120326.538252-2-tzimmermann@suse.de> (raw)
In-Reply-To: <20261110120326.538252-1-tzimmermann@suse.de>
Inline drm_crtc_init() into DCE v6 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.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
dce 6
---
drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 44 +++++++++++++++++++++++++--
1 file changed, 41 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
index f0722bdaeab6..18c5d21be45e 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
@@ -27,6 +27,8 @@
#include <drm/drm_fourcc.h>
#include <drm/drm_modeset_helper.h>
#include <drm/drm_modeset_helper_vtables.h>
+#include <drm/drm_panic_helper.h>
+#include <drm/drm_plane_helper.h>
#include <drm/drm_vblank.h>
#include "amdgpu.h"
@@ -2607,6 +2609,18 @@ static const struct drm_crtc_helper_funcs dce_v6_0_crtc_helper_funcs = {
.get_scanout_position = amdgpu_crtc_get_scanout_position,
};
+static const u32 dce_v6_0_drm_primary_plane_formats[] = {
+ DRM_FORMAT_XRGB8888,
+ DRM_FORMAT_ARGB8888,
+};
+
+static const struct drm_plane_funcs dce_v6_0_drm_primary_plane_funcs = {
+ .update_plane = drm_plane_helper_update_primary,
+ .disable_plane = drm_plane_helper_disable_primary,
+ .destroy = drm_plane_helper_destroy,
+ DRM_PANIC_PLANE_FUNCS,
+};
+
static void dce_v6_0_panic_flush(struct drm_plane *plane)
{
struct drm_framebuffer *fb;
@@ -2635,14 +2649,31 @@ static const struct drm_plane_helper_funcs dce_v6_0_drm_primary_plane_helper_fun
static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index)
{
+ struct drm_device *dev = adev_to_drm(adev);
+ struct drm_plane *primary;
struct amdgpu_crtc *amdgpu_crtc;
+ int ret;
+
+ /* possible_crtc's will be filled in later by crtc_init */
+ primary = __drm_universal_plane_alloc(dev, sizeof(*primary), 0, 0,
+ &dce_v6_0_drm_primary_plane_funcs,
+ dce_v6_0_drm_primary_plane_formats,
+ ARRAY_SIZE(dce_v6_0_drm_primary_plane_formats),
+ NULL, DRM_PLANE_TYPE_PRIMARY, NULL);
+ if (IS_ERR(primary))
+ return PTR_ERR(primary);
amdgpu_crtc = kzalloc(sizeof(struct amdgpu_crtc) +
(AMDGPUFB_CONN_LIMIT * sizeof(struct drm_connector *)), GFP_KERNEL);
- if (amdgpu_crtc == NULL)
- return -ENOMEM;
+ if (!amdgpu_crtc) {
+ ret = -ENOMEM;
+ goto err_drm_plane_cleanup;
+ }
- drm_crtc_init(adev_to_drm(adev), &amdgpu_crtc->base, &dce_v6_0_crtc_funcs);
+ ret = drm_crtc_init_with_planes(dev, &amdgpu_crtc->base, primary, NULL,
+ &dce_v6_0_crtc_funcs, NULL);
+ if (ret)
+ goto err_kfree;
drm_mode_crtc_set_gamma_size(&amdgpu_crtc->base, 256);
amdgpu_crtc->crtc_id = index;
@@ -2663,6 +2694,13 @@ static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index)
drm_plane_helper_add(amdgpu_crtc->base.primary, &dce_v6_0_drm_primary_plane_helper_funcs);
return 0;
+
+err_kfree:
+ kfree(amdgpu_crtc);
+err_drm_plane_cleanup:
+ drm_plane_cleanup(primary);
+ kfree(primary);
+ return ret;
}
static int dce_v6_0_early_init(struct amdgpu_ip_block *ip_block)
--
2.56.0
next prev parent reply other threads:[~2026-11-10 12:03 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 ` Thomas Zimmermann [this message]
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
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=20261110120326.538252-2-tzimmermann@suse.de \
--to=tzimmermann@suse.de \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=simona@ffwll.ch \
/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.