dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: dri-devel@lists.freedesktop.org
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Subject: [PATCH 2/5] drm/sun4i: Use drm_mode_get_hv_timing() to populate plane clip rectangle
Date: Tue, 23 Jan 2018 19:08:54 +0200	[thread overview]
Message-ID: <20180123170857.13818-2-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20180123170857.13818-1-ville.syrjala@linux.intel.com>

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

Use drm_mode_get_hv_timing() to fill out the plane clip rectangle.

Note that this replaces crtc_state->adjusted_mode usage with
crtc_state->mode. The latter is the correct choice since that's the
mode the user provided and it matches the plane crtc coordinates
the user also provided.

Once everyone agrees on this we can move the clip handling into
drm_atomic_helper_check_plane_state().

Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/sun4i/sun8i_ui_layer.c | 9 ++++-----
 drivers/gpu/drm/sun4i/sun8i_vi_layer.c | 9 ++++-----
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun8i_ui_layer.c b/drivers/gpu/drm/sun4i/sun8i_ui_layer.c
index 28d7c48d50fe..2f0ccd50b54d 100644
--- a/drivers/gpu/drm/sun4i/sun8i_ui_layer.c
+++ b/drivers/gpu/drm/sun4i/sun8i_ui_layer.c
@@ -211,7 +211,7 @@ static int sun8i_ui_layer_atomic_check(struct drm_plane *plane,
 	struct drm_crtc *crtc = state->crtc;
 	struct drm_crtc_state *crtc_state;
 	int min_scale, max_scale;
-	struct drm_rect clip;
+	struct drm_rect clip = {};
 
 	if (!crtc)
 		return 0;
@@ -220,10 +220,9 @@ static int sun8i_ui_layer_atomic_check(struct drm_plane *plane,
 	if (WARN_ON(!crtc_state))
 		return -EINVAL;
 
-	clip.x1 = 0;
-	clip.y1 = 0;
-	clip.x2 = crtc_state->adjusted_mode.hdisplay;
-	clip.y2 = crtc_state->adjusted_mode.vdisplay;
+	if (crtc_state->enable)
+		drm_mode_get_hv_timing(&crtc_state->mode,
+				       &clip.x2, &clip.y2);
 
 	min_scale = DRM_PLANE_HELPER_NO_SCALING;
 	max_scale = DRM_PLANE_HELPER_NO_SCALING;
diff --git a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
index 40c3b303068a..eb3bf2d7291a 100644
--- a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
+++ b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
@@ -239,7 +239,7 @@ static int sun8i_vi_layer_atomic_check(struct drm_plane *plane,
 	struct drm_crtc *crtc = state->crtc;
 	struct drm_crtc_state *crtc_state;
 	int min_scale, max_scale;
-	struct drm_rect clip;
+	struct drm_rect clip = {};
 
 	if (!crtc)
 		return 0;
@@ -248,10 +248,9 @@ static int sun8i_vi_layer_atomic_check(struct drm_plane *plane,
 	if (WARN_ON(!crtc_state))
 		return -EINVAL;
 
-	clip.x1 = 0;
-	clip.y1 = 0;
-	clip.x2 = crtc_state->adjusted_mode.hdisplay;
-	clip.y2 = crtc_state->adjusted_mode.vdisplay;
+	if (crtc_state->enable)
+		drm_mode_get_hv_timing(&crtc_state->mode,
+				       &clip.x2, &clip.y2);
 
 	min_scale = DRM_PLANE_HELPER_NO_SCALING;
 	max_scale = DRM_PLANE_HELPER_NO_SCALING;
-- 
2.13.6

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2018-01-23 17:09 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-23 17:08 [PATCH 1/5] drm/rcar-du: Use drm_mode_get_hv_timing() to populate plane clip rectangle Ville Syrjala
2018-01-23 17:08 ` Ville Syrjala [this message]
2018-02-02 15:04   ` [PATCH 2/5] drm/sun4i: " Ville Syrjälä
2018-01-23 17:08 ` [PATCH 3/5] drm/armada: Construct a temporary crtc state for plane checks Ville Syrjala
2018-01-23 18:42   ` Russell King - ARM Linux
2018-01-23 19:02     ` Ville Syrjälä
2018-02-02 14:10       ` Ville Syrjälä
2018-02-02 15:10         ` Ville Syrjälä
2018-02-23 15:55           ` Ville Syrjälä
2018-02-23 19:14             ` Russell King - ARM Linux
2018-01-23 17:08 ` [PATCH 4/5] drm/armada: Use drm_mode_get_hv_timing() to populate plane clip rectangle Ville Syrjala
2018-03-05  8:41   ` Daniel Vetter
2018-03-05 18:58     ` Ville Syrjälä
2018-01-23 17:08 ` [PATCH 5/5] drm: Don't pass clip to drm_atomic_helper_check_plane_state() Ville Syrjala
     [not found]   ` <20180123170857.13818-5-ville.syrjala-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2018-01-23 17:46     ` Liviu Dudau
2018-01-26  5:23     ` Neil Armstrong
2018-01-23 18:06   ` Philipp Zabel
2018-01-24  0:12   ` Laurent Pinchart
2018-01-24 19:48   ` Sinclair Yeh
2018-02-05  6:50   ` Shawn Guo
2018-01-24  0:07 ` [PATCH 1/5] drm/rcar-du: Use drm_mode_get_hv_timing() to populate plane clip rectangle Laurent Pinchart
2018-01-24 15:01   ` 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=20180123170857.13818-2-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=maxime.ripard@free-electrons.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox