All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH] drm/i915: Fix 90/270 degree rotated RGB565 src coord checks
Date: Thu, 25 Apr 2019 23:37:59 +0300	[thread overview]
Message-ID: <20190425203759.16342-1-ville.syrjala@linux.intel.com> (raw)

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

Supposedly both src coordinates have to even when doing 90/270
degree rotation with RGB565. This is definitely true for the
X coordinate (we just get a black screen when it is odd). My
experiments didn't show any misbehaviour with an odd
Y coordinate, but let's trust the spec and reject that one
as well.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_sprite.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 2913e89280d7..2ce380f192f4 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -294,26 +294,29 @@ int intel_plane_check_src_coordinates(struct intel_plane_state *plane_state)
 	src->y1 = src_y << 16;
 	src->y2 = (src_y + src_h) << 16;
 
-	if (!fb->format->is_yuv)
-		return 0;
-
-	/* YUV specific checks */
-	if (!rotated) {
+	if (fb->format->format == DRM_FORMAT_RGB565 && rotated) {
+		hsub = 2;
+		vsub = 2;
+	} else {
 		hsub = fb->format->hsub;
 		vsub = fb->format->vsub;
-	} else {
-		hsub = vsub = max(fb->format->hsub, fb->format->vsub);
 	}
 
+	if (rotated)
+		hsub = vsub = max(hsub, vsub);
+
+	if (hsub == 1 && vsub == 1)
+		return 0;
+
 	if (src_x % hsub || src_w % hsub) {
-		DRM_DEBUG_KMS("src x/w (%u, %u) must be a multiple of %u for %sYUV planes\n",
-			      src_x, src_w, hsub, rotated ? "rotated " : "");
+		DRM_DEBUG_KMS("src x/w (%u, %u) must be a multiple of %u (rotated: %s)\n",
+			      src_x, src_w, hsub, yesno(rotated));
 		return -EINVAL;
 	}
 
 	if (src_y % vsub || src_h % vsub) {
-		DRM_DEBUG_KMS("src y/h (%u, %u) must be a multiple of %u for %sYUV planes\n",
-			      src_y, src_h, vsub, rotated ? "rotated " : "");
+		DRM_DEBUG_KMS("src y/h (%u, %u) must be a multiple of %u (rotated: %s)\n",
+			      src_y, src_h, vsub, yesno(rotated));
 		return -EINVAL;
 	}
 
-- 
2.21.0

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

             reply	other threads:[~2019-04-25 20:38 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-25 20:37 Ville Syrjala [this message]
2019-04-25 20:50 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Fix 90/270 degree rotated RGB565 src coord checks Patchwork
2019-04-25 20:51 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-04-25 21:39 ` ✓ Fi.CI.BAT: success " Patchwork
2019-04-26  9:24 ` ✗ Fi.CI.IGT: failure " Patchwork
2019-04-30 17:33 ` [PATCH v2] " Ville Syrjala
2019-06-05 14:30   ` Maarten Lankhorst
2019-04-30 17:47 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Fix 90/270 degree rotated RGB565 src coord checks (rev2) Patchwork
2019-04-30 17:48 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-04-30 18:27 ` ✓ Fi.CI.BAT: success " Patchwork
2019-05-01 15:54 ` ✗ Fi.CI.IGT: failure " Patchwork
2020-02-28 16:05 ` [Intel-gfx] [PATCH v3] drm/i915: Fix 90/270 degree rotated RGB565 src coord checks Ville Syrjala
2020-02-28 18:20 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Fix 90/270 degree rotated RGB565 src coord checks (rev3) Patchwork
2020-02-28 18:44 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2020-03-01 14:58 ` [Intel-gfx] ✓ Fi.CI.IGT: " 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=20190425203759.16342-1-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --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 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.