linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Osipenko <digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Thierry Reding
	<thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Mikko Perttunen <cyndis-/1wQRMveznE@public.gmane.org>,
	Erik Faye-Lund
	<kusmabite-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	DRI Development
	<dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: [PATCH v3 07/20] drm/tegra: dc: Apply clipping to the plane
Date: Thu, 15 Jun 2017 02:18:30 +0300	[thread overview]
Message-ID: <1306db6555e16d0bed85d731d79c05a29fda3bda.1497480757.git.digetx@gmail.com> (raw)
In-Reply-To: <cover.1497480751.git.digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
In-Reply-To: <cover.1497480751.git.digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

On Tegra20 an overlay plane should be clipped, otherwise its output is
distorted once plane crosses display boundary.

Signed-off-by: Dmitry Osipenko <digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Reviewed-by: Erik Faye-Lund <kusmabite-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/gpu/drm/tegra/dc.c | 29 +++++++++++++++++++++--------
 1 file changed, 21 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
index 98ee6abb056c..a7a7cce1afd0 100644
--- a/drivers/gpu/drm/tegra/dc.c
+++ b/drivers/gpu/drm/tegra/dc.c
@@ -486,12 +486,25 @@ static int tegra_plane_state_add(struct tegra_plane *plane,
 {
 	struct drm_crtc_state *crtc_state;
 	struct tegra_dc_state *tegra;
+	struct drm_rect clip;
+	int err;
 
 	/* Propagate errors from allocation or locking failures. */
 	crtc_state = drm_atomic_get_crtc_state(state->state, state->crtc);
 	if (IS_ERR(crtc_state))
 		return PTR_ERR(crtc_state);
 
+	clip.x1 = 0;
+	clip.y1 = 0;
+	clip.x2 = crtc_state->mode.hdisplay;
+	clip.y2 = crtc_state->mode.vdisplay;
+
+	/* Check plane state for visibility and calculate clipping bounds */
+	err = drm_plane_helper_check_state(state, &clip, 0, INT_MAX,
+					   true, true);
+	if (err < 0)
+		return err;
+
 	tegra = to_dc_state(crtc_state);
 
 	tegra->planes |= WIN_A_ACT_REQ << plane->index;
@@ -561,14 +574,14 @@ static void tegra_plane_atomic_update(struct drm_plane *plane,
 		return;
 
 	memset(&window, 0, sizeof(window));
-	window.src.x = plane->state->src_x >> 16;
-	window.src.y = plane->state->src_y >> 16;
-	window.src.w = plane->state->src_w >> 16;
-	window.src.h = plane->state->src_h >> 16;
-	window.dst.x = plane->state->crtc_x;
-	window.dst.y = plane->state->crtc_y;
-	window.dst.w = plane->state->crtc_w;
-	window.dst.h = plane->state->crtc_h;
+	window.src.x = plane->state->src.x1 >> 16;
+	window.src.y = plane->state->src.y1 >> 16;
+	window.src.w = drm_rect_width(&plane->state->src) >> 16;
+	window.src.h = drm_rect_height(&plane->state->src) >> 16;
+	window.dst.x = plane->state->dst.x1;
+	window.dst.y = plane->state->dst.y1;
+	window.dst.w = drm_rect_width(&plane->state->dst);
+	window.dst.h = drm_rect_height(&plane->state->dst);
 	window.bits_per_pixel = fb->format->cpp[0] * 8;
 	window.bottom_up = tegra_fb_is_bottom_up(fb);
 
-- 
2.13.0

  parent reply	other threads:[~2017-06-14 23:18 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-14 23:18 [PATCH v3 00/20] Tegra DRM fixes Dmitry Osipenko
     [not found] ` <cover.1497480751.git.digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-06-14 23:18   ` [PATCH v3 01/20] drm/tegra: Fix lockup on a use of staging API Dmitry Osipenko
     [not found]     ` <7b70a506a9d2355ea6ff19a8c4f4d726b67719b3.1497480754.git.digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-06-15 12:11       ` Thierry Reding
2017-06-14 23:18   ` [PATCH v3 02/20] drm/tegra: Correct idr_alloc() minimum id Dmitry Osipenko
     [not found]     ` <9c19a44219acd988e678cf9abe21363911184625.1497480754.git.digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-06-15 12:13       ` Thierry Reding
2017-06-14 23:18   ` [PATCH v3 03/20] drm/tegra: Check for malformed offsets and sizes in the 'submit' IOCTL Dmitry Osipenko
2017-06-14 23:18   ` [PATCH v3 04/20] drm/tegra: Correct copying of waitchecks and disable them " Dmitry Osipenko
2017-06-14 23:18   ` [PATCH v3 05/20] drm/tegra: Check syncpoint ID " Dmitry Osipenko
2017-06-14 23:18   ` [PATCH v3 06/20] drm/tegra: dc: Avoid reset asserts on Tegra20 Dmitry Osipenko
2017-06-14 23:18   ` Dmitry Osipenko [this message]
2017-06-14 23:18   ` [PATCH v3 08/20] drm/tegra: dc: Disable plane if it is invisible Dmitry Osipenko
2017-06-14 23:18   ` [PATCH v3 09/20] gpu: host1x: Initialize firewall class to the jobs one Dmitry Osipenko
2017-06-14 23:18   ` [PATCH v3 10/20] gpu: host1x: Correct host1x_job_pin() error handling Dmitry Osipenko
2017-06-14 23:18   ` [PATCH v3 11/20] gpu: host1x: Do not leak BO's phys address to userspace Dmitry Osipenko
2017-06-14 23:18   ` [PATCH v3 12/20] gpu: host1x: Forbid relocation address shifting in the firewall Dmitry Osipenko
2017-06-14 23:18   ` [PATCH v3 13/20] gpu: host1x: Forbid RESTART opcode " Dmitry Osipenko
2017-06-14 23:18   ` [PATCH v3 14/20] gpu: host1x: Forbid unrelated SETCLASS " Dmitry Osipenko
2017-06-14 23:18   ` [PATCH v3 15/20] gpu: host1x: Correct swapped arguments in the is_addr_reg() definition Dmitry Osipenko
2017-06-14 23:18   ` [PATCH v3 16/20] gpu: host1x: Check waits in the firewall Dmitry Osipenko
2017-06-14 23:18   ` [PATCH v3 17/20] gpu: host1x: Remove unused 'struct host1x_cmdbuf' Dmitry Osipenko
2017-06-14 23:18   ` [PATCH v3 18/20] gpu: host1x: Remove unused host1x_cdma_stop() definition Dmitry Osipenko
2017-06-14 23:18   ` [PATCH v3 19/20] gpu: host1x: Refactor channel allocation code Dmitry Osipenko
2017-06-14 23:18   ` [PATCH v3 20/20] gpu: host1x: At first try a non-blocking allocation for the gather copy Dmitry Osipenko
2017-06-15 13:33   ` [PATCH v3 00/20] Tegra DRM fixes Thierry Reding

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=1306db6555e16d0bed85d731d79c05a29fda3bda.1497480757.git.digetx@gmail.com \
    --to=digetx-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=cyndis-/1wQRMveznE@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=kusmabite-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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).