dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Gustavo Padovan <gustavo@padovan.org>
To: intel-gfx@lists.freedesktop.org
Cc: Gustavo Padovan <gustavo.padovan@collabora.co.uk>,
	dri-devel@lists.freedesktop.org
Subject: [PATCH v3 07/11] drm: add helper to get crtc timings
Date: Wed, 24 Sep 2014 14:20:28 -0300	[thread overview]
Message-ID: <1411579232-8668-7-git-send-email-gustavo@padovan.org> (raw)
In-Reply-To: <1411579232-8668-1-git-send-email-gustavo@padovan.org>

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

We need to get hdisplay and vdisplay in a few places so create a
helper to make our job easier.

Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/gpu/drm/drm_crtc.c           | 20 +++++++++++++-------
 drivers/gpu/drm/i915/intel_display.c |  6 +++---
 include/drm/drm_crtc.h               |  2 ++
 3 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index b702106..7c0bf9f 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -2490,6 +2490,17 @@ int drm_mode_set_config_internal(struct drm_mode_set *set)
 }
 EXPORT_SYMBOL(drm_mode_set_config_internal);
 
+void drm_crtc_get_hv_timing(const struct drm_display_mode *mode,
+			    int *hdisplay, int *vdisplay)
+{
+	struct drm_display_mode adjusted = *mode;
+
+	drm_mode_set_crtcinfo(&adjusted, CRTC_STEREO_DOUBLE);
+	*hdisplay = adjusted.crtc_hdisplay;
+	*vdisplay = adjusted.crtc_vdisplay;
+}
+EXPORT_SYMBOL(drm_crtc_get_hv_timing);
+
 /**
  * drm_crtc_check_viewport - Checks that a framebuffer is big enough for the
  *     CRTC viewport
@@ -2510,13 +2521,8 @@ int drm_crtc_check_viewport(const struct drm_crtc *crtc,
 	hdisplay = mode->hdisplay;
 	vdisplay = mode->vdisplay;
 
-	if (drm_mode_is_stereo(mode)) {
-		struct drm_display_mode adjusted = *mode;
-
-		drm_mode_set_crtcinfo(&adjusted, CRTC_STEREO_DOUBLE);
-		hdisplay = adjusted.crtc_hdisplay;
-		vdisplay = adjusted.crtc_vdisplay;
-	}
+	if (drm_mode_is_stereo(mode))
+		drm_crtc_get_hv_timing(mode, &hdisplay, &vdisplay);
 
 	if (crtc->invert_dimensions)
 		swap(hdisplay, vdisplay);
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 3cb092c..dfe9ad5 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -10154,9 +10154,9 @@ intel_modeset_pipe_config(struct drm_crtc *crtc,
 	 * computation to clearly distinguish it from the adjusted mode, which
 	 * can be changed by the connectors in the below retry loop.
 	 */
-	drm_mode_set_crtcinfo(&pipe_config->requested_mode, CRTC_STEREO_DOUBLE);
-	pipe_config->pipe_src_w = pipe_config->requested_mode.crtc_hdisplay;
-	pipe_config->pipe_src_h = pipe_config->requested_mode.crtc_vdisplay;
+	drm_crtc_get_hv_timing(&pipe_config->requested_mode,
+			       &pipe_config->pipe_src_w,
+			       &pipe_config->pipe_src_h);
 
 encoder_retry:
 	/* Ensure the port clock defaults are reset when retrying. */
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index c40070a..9b2f6b5 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -950,6 +950,8 @@ extern int drm_plane_init(struct drm_device *dev,
 extern void drm_plane_cleanup(struct drm_plane *plane);
 extern unsigned int drm_plane_index(struct drm_plane *plane);
 extern void drm_plane_force_disable(struct drm_plane *plane);
+extern void drm_crtc_get_hv_timing(const struct drm_display_mode *mode,
+				   int *hdisplay, int *vdisplay);
 extern int drm_crtc_check_viewport(const struct drm_crtc *crtc,
 				   int x, int y,
 				   const struct drm_display_mode *mode,
-- 
1.9.3

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

  parent reply	other threads:[~2014-09-24 17:20 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-24 17:20 [PATCH v3 01/11] drm/i915: Merge of visible and !visible paths for primary planes Gustavo Padovan
2014-09-24 17:20 ` [PATCH v3 02/11] drm/i915: remove leftover from pre-universal planes days Gustavo Padovan
2014-09-24 17:20 ` [PATCH v3 03/11] drm/i915: Fix not checking cursor and object sizes Gustavo Padovan
2014-09-24 17:20 ` [PATCH v3 04/11] drm/i915: move check of intel_crtc_cursor_set_obj() out Gustavo Padovan
2014-10-07 14:47   ` Ville Syrjälä
2014-10-07 15:01     ` Ville Syrjälä
2014-10-08  9:03       ` [Intel-gfx] " Daniel Vetter
2014-09-24 17:20 ` [PATCH v3 05/11] drm/i915: remove intel_crtc_cursor_set_obj() Gustavo Padovan
2014-10-07 14:59   ` Ville Syrjälä
2014-10-24 13:23     ` Gustavo Padovan
2014-10-24 14:35       ` Ville Syrjälä
2014-09-24 17:20 ` [PATCH v3 06/11] drm/i915: split intel_crtc_page_flip() into check() and commit() Gustavo Padovan
2014-10-07 15:44   ` Ville Syrjälä
2014-09-24 17:20 ` Gustavo Padovan [this message]
2014-10-07 15:21   ` [PATCH v3 07/11] drm: add helper to get crtc timings Ville Syrjälä
2014-09-24 17:20 ` [PATCH v3 08/11] drm/i915: create a prepare step for primary planes updates Gustavo Padovan
2014-09-24 17:20 ` [PATCH v3 09/11] drm/i915: create a prepare phase for sprite plane updates Gustavo Padovan
2014-10-07 15:51   ` Ville Syrjälä
2014-09-24 17:20 ` [PATCH v3 10/11] drm/i915: use intel_fb_obj() macros to assign gem objects Gustavo Padovan
2014-10-07 15:52   ` [Intel-gfx] " Ville Syrjälä
2014-09-24 17:20 ` [PATCH v3 11/11] drm/i915: remove intel_pipe_set_base() Gustavo Padovan
2014-10-07 16:27   ` Ville Syrjälä
2014-10-24 13:59     ` Gustavo Padovan
2014-10-24 14:17       ` Ville Syrjälä

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=1411579232-8668-7-git-send-email-gustavo@padovan.org \
    --to=gustavo@padovan.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gustavo.padovan@collabora.co.uk \
    --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;
as well as URLs for NNTP newsgroup(s).