[PATCH v2] drm/exynos: Set supported modifiers during plane init
From: Chen-Yu Tsai
Date: Mon Nov 23 2026 - 02:25:10 EST
The exynos driver currently checks the modifier in a helper called by
the plane atomic check helper callback. This check only concerns whether
the selected plane supports the tiled format or not. This is tied to
the plane's hardware capability.
Turns out the tiled support was added around the same time modifiers
were being plumbed through DRM planes. The latter provided a way to
describe per-plane modifier support.
Add a field to the hardware plane capability struct to allow adding
an optional list of supported modifiers. This is passed to
drm_universal_plane_init(). This also allows the core to generate
and pass to userspace a list of supported modifiers for each plane.
Also provide a .format_mod_supported callback to restrict
DRM_FORMAT_MOD_SAMSUNG_64_32_TILE to DRM_FORMAT_NV12, matching
framebuffer_check() so the mixer VP plane does not advertise the tiled
modifier for DRM_FORMAT_NV21, and validate modifiers against the plane's
modifier list.
EXYNOS_DRM_PLANE_CAP_TILE and the existing helper are removed, as the
check is now done by the DRM atomic check.
Signed-off-by: Chen-Yu Tsai <wenst@xxxxxxxxxxxx>
---
Changes since v1:
- Add .format_mod_supported callback to restrict
DRM_FORMAT_MOD_SAMSUNG_64_32_TILE to DRM_FORMAT_NV12 (Inki)
- Fix typo in commit message ("down" -> "done")
---
drivers/gpu/drm/exynos/exynos_drm_drv.h | 2 +-
drivers/gpu/drm/exynos/exynos_drm_plane.c | 49 +++++++++--------------
drivers/gpu/drm/exynos/exynos_mixer.c | 8 +++-
3 files changed, 28 insertions(+), 31 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index b126cd129944..ab0edb826261 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -92,7 +92,6 @@ struct exynos_drm_plane {
#define EXYNOS_DRM_PLANE_CAP_DOUBLE (1 << 0)
#define EXYNOS_DRM_PLANE_CAP_SCALE (1 << 1)
#define EXYNOS_DRM_PLANE_CAP_ZPOS (1 << 2)
-#define EXYNOS_DRM_PLANE_CAP_TILE (1 << 3)
#define EXYNOS_DRM_PLANE_CAP_PIX_BLEND (1 << 4)
#define EXYNOS_DRM_PLANE_CAP_WIN_BLEND (1 << 5)
@@ -112,6 +111,7 @@ struct exynos_drm_plane_config {
const uint32_t *pixel_formats;
unsigned int num_pixel_formats;
unsigned int capabilities;
+ const uint64_t *modifiers;
};
/*
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c
index 020e8c9cf7de..92ed00e2b6f9 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
@@ -8,6 +8,7 @@
#include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_blend.h>
+#include <drm/drm_fourcc.h>
#include <drm/drm_framebuffer.h>
#include <drm/drm_print.h>
#include <drm/exynos_drm.h>
@@ -161,6 +162,23 @@ static void exynos_drm_plane_destroy_state(struct drm_plane *plane,
kfree(old_exynos_state);
}
+static bool exynos_plane_format_mod_supported(struct drm_plane *plane,
+ u32 format, u64 modifier)
+{
+ unsigned int i;
+
+ if (modifier == DRM_FORMAT_MOD_SAMSUNG_64_32_TILE &&
+ format != DRM_FORMAT_NV12)
+ return false;
+
+ for (i = 0; i < plane->modifier_count; i++) {
+ if (plane->modifiers[i] == modifier)
+ return true;
+ }
+
+ return false;
+}
+
static struct drm_plane_funcs exynos_plane_funcs = {
.update_plane = drm_atomic_helper_update_plane,
.disable_plane = drm_atomic_helper_disable_plane,
@@ -168,32 +186,9 @@ static struct drm_plane_funcs exynos_plane_funcs = {
.atomic_create_state = exynos_drm_plane_create_state,
.atomic_duplicate_state = exynos_drm_plane_duplicate_state,
.atomic_destroy_state = exynos_drm_plane_destroy_state,
+ .format_mod_supported = exynos_plane_format_mod_supported,
};
-static int
-exynos_drm_plane_check_format(const struct exynos_drm_plane_config *config,
- struct exynos_drm_plane_state *state)
-{
- struct drm_framebuffer *fb = state->base.fb;
- struct drm_device *dev = fb->dev;
-
- switch (fb->modifier) {
- case DRM_FORMAT_MOD_SAMSUNG_64_32_TILE:
- if (!(config->capabilities & EXYNOS_DRM_PLANE_CAP_TILE))
- return -ENOTSUPP;
- break;
-
- case DRM_FORMAT_MOD_LINEAR:
- break;
-
- default:
- DRM_DEV_ERROR(dev->dev, "unsupported pixel format modifier");
- return -ENOTSUPP;
- }
-
- return 0;
-}
-
static int
exynos_drm_plane_check_size(const struct exynos_drm_plane_config *config,
struct exynos_drm_plane_state *state)
@@ -241,10 +236,6 @@ static int exynos_plane_atomic_check(struct drm_plane *plane,
/* translate state into exynos_state */
exynos_plane_mode_set(exynos_state);
- ret = exynos_drm_plane_check_format(exynos_plane->config, exynos_state);
- if (ret)
- return ret;
-
ret = exynos_drm_plane_check_size(exynos_plane->config, exynos_state);
return ret;
}
@@ -308,7 +299,7 @@ int exynos_plane_init(struct drm_device *dev,
&exynos_plane_funcs,
config->pixel_formats,
config->num_pixel_formats,
- NULL, config->type, NULL);
+ config->modifiers, config->type, NULL);
if (err) {
DRM_DEV_ERROR(dev->dev, "failed to initialize plane\n");
return err;
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
index 9b210ff7449f..5da871e5ac9c 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -93,6 +93,12 @@ static const uint32_t vp_formats[] = {
DRM_FORMAT_NV21,
};
+static const uint64_t vp_modifiers[] = {
+ DRM_FORMAT_MOD_LINEAR,
+ DRM_FORMAT_MOD_SAMSUNG_64_32_TILE,
+ DRM_FORMAT_MOD_INVALID
+};
+
struct mixer_context {
struct platform_device *pdev;
struct device *dev;
@@ -148,8 +154,8 @@ static const struct exynos_drm_plane_config plane_configs[MIXER_WIN_NR] = {
.num_pixel_formats = ARRAY_SIZE(vp_formats),
.capabilities = EXYNOS_DRM_PLANE_CAP_SCALE |
EXYNOS_DRM_PLANE_CAP_ZPOS |
- EXYNOS_DRM_PLANE_CAP_TILE |
EXYNOS_DRM_PLANE_CAP_WIN_BLEND,
+ .modifiers = vp_modifiers,
},
};
--
2.56.1.831.g720f3f5937-goog