All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Nautiyal, Ankit K" <ankit.k.nautiyal@intel.com>
To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org
Cc: Jose Abreu <Jose.Abreu@synopsys.com>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	ppaalanen@gmail.com
Subject: [PATCH v8 04/11] drm/edid: Don't send bogus aspect ratios in AVI infoframes
Date: Wed, 14 Mar 2018 19:36:04 +0530	[thread overview]
Message-ID: <1521036371-29889-5-git-send-email-ankit.k.nautiyal@intel.com> (raw)
In-Reply-To: <1521036371-29889-1-git-send-email-ankit.k.nautiyal@intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

If the user mode would specify an aspect ratio other than 4:3 or 16:9
we now silently ignore it. Maybe a better apporoach is to return an
error? Let's try that.

Also we must be careful that we don't try to send illegal picture
aspect in the infoframe as it's only capable of signalling none,
4:3, and 16:9. Currently we're sending these bogus infoframes
whenever the cea mode specifies some other aspect ratio.

Cc: Shashank Sharma <shashank.sharma@intel.com>
Cc: Sean Paul <seanpaul@chromium.org>
Cc: Jose Abreu <Jose.Abreu@synopsys.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
---
 drivers/gpu/drm/drm_edid.c | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index b635fca..8d87ab3 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -4841,6 +4841,7 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
 					 const struct drm_display_mode *mode,
 					 bool is_hdmi2_sink)
 {
+	enum hdmi_picture_aspect picture_aspect;
 	int err;
 
 	if (!frame || !mode)
@@ -4883,13 +4884,23 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
 	 * Populate picture aspect ratio from either
 	 * user input (if specified) or from the CEA mode list.
 	 */
-	if (mode->picture_aspect_ratio == HDMI_PICTURE_ASPECT_4_3 ||
-		mode->picture_aspect_ratio == HDMI_PICTURE_ASPECT_16_9)
-		frame->picture_aspect = mode->picture_aspect_ratio;
-	else if (frame->video_code > 0)
-		frame->picture_aspect = drm_get_cea_aspect_ratio(
-						frame->video_code);
+	picture_aspect = mode->picture_aspect_ratio;
+	if (picture_aspect == HDMI_PICTURE_ASPECT_NONE)
+		picture_aspect = drm_get_cea_aspect_ratio(frame->video_code);
 
+	/*
+	 * The infoframe can't convey anything but none, 4:3
+	 * and 16:9, so if the user has asked for anything else
+	 * we can only satisfy it by specifying the right VIC.
+	 */
+	if (picture_aspect > HDMI_PICTURE_ASPECT_16_9) {
+		if (picture_aspect !=
+		    drm_get_cea_aspect_ratio(frame->video_code))
+			return -EINVAL;
+		picture_aspect = HDMI_PICTURE_ASPECT_NONE;
+	}
+
+	frame->picture_aspect = picture_aspect;
 	frame->active_aspect = HDMI_ACTIVE_ASPECT_PICTURE;
 	frame->scan_mode = HDMI_SCAN_MODE_UNDERSCAN;
 
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2018-03-14 14:06 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-14 14:06 [PATCH v8 00/11] Aspect ratio support in DRM layer Nautiyal, Ankit K
2018-03-14 14:06 ` [PATCH v8 01/11] drm/modes: Introduce drm_mode_match() Nautiyal, Ankit K
2018-03-14 14:06 ` [PATCH v8 02/11] drm/edid: Use drm_mode_match_no_clocks_no_stereo() for consistentcy Nautiyal, Ankit K
2018-03-14 14:06 ` [PATCH v8 03/11] drm/edid: Fix cea mode aspect ratio handling Nautiyal, Ankit K
2018-03-14 14:06 ` Nautiyal, Ankit K [this message]
2018-03-14 14:06 ` [PATCH v8 05/11] video/hdmi: Reject illegal picture aspect ratios Nautiyal, Ankit K
2018-03-14 14:06   ` Nautiyal, Ankit K
2018-03-14 14:06 ` [PATCH v8 06/11] drm: Add DRM client cap for aspect-ratio Nautiyal, Ankit K
2018-03-14 14:06 ` [PATCH v8 07/11] drm: Handle aspect-ratio info in getblob Nautiyal, Ankit K
2018-03-16 18:44   ` kbuild test robot
2018-03-14 14:06 ` [PATCH v8 08/11] drm: Handle aspect ratio info in legacy and atomic modeset paths Nautiyal, Ankit K
2018-03-14 14:06 ` [PATCH v8 09/11] drm: Expose modes with aspect ratio, only if requested Nautiyal, Ankit K
2018-03-14 14:06 ` [PATCH v8 10/11] drm: Add aspect ratio parsing in DRM layer Nautiyal, Ankit K
2018-03-14 14:06 ` [PATCH v8 11/11] drm: Add and handle new aspect ratios " Nautiyal, Ankit K
2018-03-14 15:15 ` ✗ Fi.CI.SPARSE: warning for Aspect ratio support " Patchwork
2018-03-14 15:27 ` ✗ Fi.CI.BAT: failure " Patchwork

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=1521036371-29889-5-git-send-email-ankit.k.nautiyal@intel.com \
    --to=ankit.k.nautiyal@intel.com \
    --cc=Jose.Abreu@synopsys.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ppaalanen@gmail.com \
    /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.