Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Damien Lespiau <damien.lespiau@intel.com>
To: dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Subject: [PATCH 06/22] drm: Extract add_hdmi_mode() out of do_hdmi_vsdb_modes()
Date: Wed, 25 Sep 2013 16:45:24 +0100	[thread overview]
Message-ID: <1380123940-14340-7-git-send-email-damien.lespiau@intel.com> (raw)
In-Reply-To: <1380123940-14340-1-git-send-email-damien.lespiau@intel.com>

So we respect a nice design of having similar functions at the same
level, in this case:

do_hdmi_vsdb_modes()
  - add_hdmi_mandatory_stereo_modes()
  - add_hdmi_mode()

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
 drivers/gpu/drm/drm_edid.c | 36 +++++++++++++++++++++---------------
 1 file changed, 21 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 52e6087..7366007 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -2634,6 +2634,26 @@ static int add_hdmi_mandatory_stereo_modes(struct drm_connector *connector)
 	return modes;
 }
 
+static int add_hdmi_mode(struct drm_connector *connector, u8 vic)
+{
+	struct drm_device *dev = connector->dev;
+	struct drm_display_mode *newmode;
+
+	vic--; /* VICs start at 1 */
+	if (vic >= ARRAY_SIZE(edid_4k_modes)) {
+		DRM_ERROR("Unknown HDMI VIC: %d\n", vic);
+		return 0;
+	}
+
+	newmode = drm_mode_duplicate(dev, &edid_4k_modes[vic]);
+	if (!newmode)
+		return 0;
+
+	drm_mode_probed_add(connector, newmode);
+
+	return 1;
+}
+
 /*
  * do_hdmi_vsdb_modes - Parse the HDMI Vendor Specific data block
  * @connector: connector corresponding to the HDMI sink
@@ -2646,7 +2666,6 @@ static int add_hdmi_mandatory_stereo_modes(struct drm_connector *connector)
 static int
 do_hdmi_vsdb_modes(struct drm_connector *connector, const u8 *db, u8 len)
 {
-	struct drm_device *dev = connector->dev;
 	int modes = 0, offset = 0, i;
 	u8 vic_len;
 
@@ -2679,23 +2698,10 @@ do_hdmi_vsdb_modes(struct drm_connector *connector, const u8 *db, u8 len)
 	vic_len = db[8 + offset] >> 5;
 
 	for (i = 0; i < vic_len && len >= (9 + offset + i); i++) {
-		struct drm_display_mode *newmode;
 		u8 vic;
 
 		vic = db[9 + offset + i];
-
-		vic--; /* VICs start at 1 */
-		if (vic >= ARRAY_SIZE(edid_4k_modes)) {
-			DRM_ERROR("Unknown HDMI VIC: %d\n", vic);
-			continue;
-		}
-
-		newmode = drm_mode_duplicate(dev, &edid_4k_modes[vic]);
-		if (!newmode)
-			continue;
-
-		drm_mode_probed_add(connector, newmode);
-		modes++;
+		modes += add_hdmi_mode(connector, vic);
 	}
 
 out:
-- 
1.8.3.1

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

  parent reply	other threads:[~2013-09-25 15:45 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-25 15:45 HDMI stereo support v6 Damien Lespiau
2013-09-25 15:45 ` [PATCH 01/22] drm: Move the GET_CAP macros next to the corresponding ioctl structure Damien Lespiau
2013-09-25 15:45 ` [PATCH 02/22] drm: Add a SET_CLIENT_CAP ioctl Damien Lespiau
2013-09-25 15:45 ` [PATCH 03/22] drm: Add HDMI stereo 3D flags to struct drm_mode_modeinfo Damien Lespiau
2013-09-25 15:45 ` [PATCH 04/22] drm: Add a STEREO_3D capability to the SET_CLIENT_CAP ioctl Damien Lespiau
2013-09-25 15:45 ` [PATCH 05/22] drm/edid: Expose mandatory stereo modes for HDMI sinks Damien Lespiau
2013-09-25 15:45 ` Damien Lespiau [this message]
2013-09-25 15:45 ` [PATCH 07/22] drm: Reject modes with more than 1 stereo flags set Damien Lespiau
2013-09-25 15:45 ` [PATCH 08/22] drm: Set the relevant infoframe field when scanning out a 3D mode Damien Lespiau
2013-09-25 15:45 ` [PATCH 09/22] drm: Make drm_match_cea_mode() return the underlying 2D VIC for 3d modes Damien Lespiau
2013-09-25 15:45 ` [PATCH 10/22] drm: Carry over the stereo flags when adding the alternate mode Damien Lespiau
2013-09-25 15:45 ` [PATCH 11/22] drm: Make exposing stereo modes a per-connector opt-in Damien Lespiau
2013-09-25 15:45 ` [PATCH 12/22] drm: Factor out common CRTC viewport checking code Damien Lespiau
2013-09-25 15:45 ` [PATCH 13/22] drm: Check the fb size against the adjusted v/hdisplay for stereo modes Damien Lespiau
2013-09-25 15:45 ` [PATCH 14/22] drm: Remove clock_index from struct drm_display_mode Damien Lespiau
2013-09-25 15:45 ` [PATCH 15/22] drm: Remove synth_clock " Damien Lespiau
2013-09-25 15:45 ` [PATCH 16/22] drm: Introduce a crtc_clock for " Damien Lespiau
2013-09-25 15:45 ` [PATCH 17/22] drm: Implement timings adjustments for frame packing Damien Lespiau
2013-09-25 15:45 ` [PATCH 18/22] drm/i915: Use crtc_clock in intel_dump_crtc_timings() Damien Lespiau
2013-09-25 15:45 ` [PATCH 19/22] drm/i915: Use crtc_clock with the adjusted mode Damien Lespiau
2013-09-25 15:45 ` [PATCH 20/22] drm/i915: Ask the DRM core do make stereo timings adjustements Damien Lespiau
2013-09-25 15:45 ` [PATCH 21/22] drm/i915: Prefer crtc_{h|v}display for pipe src dimensions Damien Lespiau
2013-09-25 15:45 ` [PATCH 22/22] drm/i915: Allow stereo modes on HDMI Damien Lespiau
2013-09-25 16:47 ` Upstreaming the stereo v6 series Damien Lespiau
2013-09-26  9:40   ` Daniel Vetter

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=1380123940-14340-7-git-send-email-damien.lespiau@intel.com \
    --to=damien.lespiau@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox