diff mbox series

[2/3] drm/msm/mdp4: Add format_mod_supported function

Message ID 20211221101319.7980-3-jose.exposito89@gmail.com (mailing list archive)
State New, archived
Headers show
Series Add missing format_mod_supported functions | expand

Commit Message

José Expósito Dec. 21, 2021, 10:13 a.m. UTC
Implement the missing "drm_plane_funcs.format_mod_supported" function
to avoid exposing an invalid IN_FORMATS blob with modifiers but no
formats.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
---
 drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c
index 49bdabea8ed5..8809f1633786 100644
--- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c
+++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c
@@ -80,6 +80,13 @@  static int mdp4_plane_set_property(struct drm_plane *plane,
 	return -EINVAL;
 }
 
+static bool mdp4_plane_format_mod_supported(struct drm_plane *plane, u32 format,
+		u64 modifier)
+{
+	return (modifier == DRM_FORMAT_MOD_SAMSUNG_64_32_TILE) ||
+	       (modifier == DRM_FORMAT_MOD_LINEAR);
+}
+
 static const struct drm_plane_funcs mdp4_plane_funcs = {
 		.update_plane = drm_atomic_helper_update_plane,
 		.disable_plane = drm_atomic_helper_disable_plane,
@@ -88,6 +95,7 @@  static const struct drm_plane_funcs mdp4_plane_funcs = {
 		.reset = drm_atomic_helper_plane_reset,
 		.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
 		.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
+		.format_mod_supported = mdp4_plane_format_mod_supported,
 };
 
 static void mdp4_plane_cleanup_fb(struct drm_plane *plane,