[REBASE 3/5] drm: Expose modes with aspect ratio, only if requested

Shashank Sharma shashank.sharma at intel.com
Fri Nov 17 09:30:30 UTC 2017


From: aknautiy <ankit.k.nautiyal at intel.com>

We parse the EDID and add all the modes in the connector's
modelist. This adds CEA modes with aspect ratio information
too, regadless of if user space requested this information or
not.

This patch prunes the modes with aspect-ratio information, from
a connector's modelist, if the user-space has not set the aspect
ratio DRM client cap.

Cc: Ville Syrjala <ville.syrjala at linux.intel.com>
Cc: Shashank Sharma <shashank.sharma at intel.com>
Cc: Jose Abreu <jose.abreu at synopsys.com>

Signed-off-by: aknautiy <ankit.k.nautiyal at intel.com>
---
 drivers/gpu/drm/drm_connector.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index 704fc89..a246bb5 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -1285,6 +1285,13 @@ static bool drm_mode_expose_to_userspace(const struct drm_display_mode *mode,
 	 */
 	if (!file_priv->stereo_allowed && drm_mode_is_stereo(mode))
 		return false;
+	/*
+	 * If user-space hasn't configured the driver to expose the modes
+	 * with aspect-ratio, don't expose them.
+	 */
+	if (!file_priv->aspect_ratio_allowed &&
+	    mode->picture_aspect_ratio != HDMI_PICTURE_ASPECT_NONE)
+		return false;
 
 	return true;
 }
-- 
2.7.4



More information about the Intel-gfx-trybot mailing list