Skip to contentSkip to conversation

drm/exynos: Set supported modifiers during plane init

PATCH New Chen-Yu Tsai 1 participant 1 message Nov 23

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/exynos: Set supported modifiers during plane init

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.

---
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(-)
drivers/gpu/drm/exynos/exynos_drm_drv.h +1 -1
index b126cd129944..ab0edb826261 100644
@@ -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;
 };
 
 /*
drivers/gpu/drm/exynos/exynos_drm_plane.c +20 -29

81 lines not on this page · raw message

drivers/gpu/drm/exynos/exynos_mixer.c +7 -1
index 9b210ff7449f..5da871e5ac9c 100644
@@ -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,
 	},
 };
 
Signature · 1 line
2.56.1.831.g720f3f5937-goog