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 5/5] drm: Remove drm_crtc_init()
Date: Tue, 10 Nov 2026 12:53:31 +0100 [thread overview]
Message-ID: <20261110120326.538252-6-tzimmermann@suse.de> (raw)
In-Reply-To: <20261110120326.538252-1-tzimmermann@suse.de>
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>
---
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
next prev parent reply other threads:[~2026-11-10 12:04 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
2026-11-10 14:27 ` Thomas Zimmermann
2026-11-10 11:53 ` Thomas Zimmermann [this message]
2026-11-10 12:35 ` [PATCH 0/5] drm/amdgpu,radeon: " 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-6-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.