intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 3/6] drm/i915: Fix overlay colorkey for 30bpp and 8bpp
Date: Mon, 28 Oct 2019 13:30:33 +0200	[thread overview]
Message-ID: <20191028113036.27553-3-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20191028113036.27553-1-ville.syrjala@linux.intel.com>

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

As with the video sprites the colorkey is always specified
as 8bpc. For 10bpc primary plane formats we just ignore the
two lsbs of each component. For C8 we'll replicate the same
key to each chanel, which is what the hardware wants.

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

diff --git a/drivers/gpu/drm/i915/display/intel_overlay.c b/drivers/gpu/drm/i915/display/intel_overlay.c
index 848ce07a8ec2..23829374f751 100644
--- a/drivers/gpu/drm/i915/display/intel_overlay.c
+++ b/drivers/gpu/drm/i915/display/intel_overlay.c
@@ -101,12 +101,15 @@
 #define CLK_RGB24_MASK		0x0
 #define CLK_RGB16_MASK		0x070307
 #define CLK_RGB15_MASK		0x070707
-#define CLK_RGB8I_MASK		0xffffff
 
+#define RGB30_TO_COLORKEY(c) \
+	(((c & 0x3FC00000) >> 6) | ((c & 0x000FF000) >> 4) | ((c & 0x000003FC) >> 2))
 #define RGB16_TO_COLORKEY(c) \
 	(((c & 0xF800) << 8) | ((c & 0x07E0) << 5) | ((c & 0x001F) << 3))
 #define RGB15_TO_COLORKEY(c) \
 	(((c & 0x7c00) << 9) | ((c & 0x03E0) << 6) | ((c & 0x001F) << 3))
+#define RGB8I_TO_COLORKEY(c) \
+	(((c & 0xFF) << 16) | ((c & 0XFF) << 8) | ((c & 0xFF) << 0))
 
 /* overlay flip addr flag */
 #define OFC_UPDATE		0x1
@@ -673,8 +676,8 @@ static void update_colorkey(struct intel_overlay *overlay,
 
 	switch (format) {
 	case DRM_FORMAT_C8:
-		key = 0;
-		flags |= CLK_RGB8I_MASK;
+		key = RGB8I_TO_COLORKEY(key);
+		flags |= CLK_RGB24_MASK;
 		break;
 	case DRM_FORMAT_XRGB1555:
 		key = RGB15_TO_COLORKEY(key);
@@ -684,6 +687,11 @@ static void update_colorkey(struct intel_overlay *overlay,
 		key = RGB16_TO_COLORKEY(key);
 		flags |= CLK_RGB16_MASK;
 		break;
+	case DRM_FORMAT_XRGB2101010:
+	case DRM_FORMAT_XBGR2101010:
+		key = RGB30_TO_COLORKEY(key);
+		flags |= CLK_RGB24_MASK;
+		break;
 	default:
 		flags |= CLK_RGB24_MASK;
 		break;
-- 
2.21.0

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

WARNING: multiple messages have this Message-ID (diff)
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH 3/6] drm/i915: Fix overlay colorkey for 30bpp and 8bpp
Date: Mon, 28 Oct 2019 13:30:33 +0200	[thread overview]
Message-ID: <20191028113036.27553-3-ville.syrjala@linux.intel.com> (raw)
Message-ID: <20191028113033.GPLu-RlIUHU6Xeo2TySaZKR52whXg47ZbgvuVbHKYio@z> (raw)
In-Reply-To: <20191028113036.27553-1-ville.syrjala@linux.intel.com>

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

As with the video sprites the colorkey is always specified
as 8bpc. For 10bpc primary plane formats we just ignore the
two lsbs of each component. For C8 we'll replicate the same
key to each chanel, which is what the hardware wants.

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

diff --git a/drivers/gpu/drm/i915/display/intel_overlay.c b/drivers/gpu/drm/i915/display/intel_overlay.c
index 848ce07a8ec2..23829374f751 100644
--- a/drivers/gpu/drm/i915/display/intel_overlay.c
+++ b/drivers/gpu/drm/i915/display/intel_overlay.c
@@ -101,12 +101,15 @@
 #define CLK_RGB24_MASK		0x0
 #define CLK_RGB16_MASK		0x070307
 #define CLK_RGB15_MASK		0x070707
-#define CLK_RGB8I_MASK		0xffffff
 
+#define RGB30_TO_COLORKEY(c) \
+	(((c & 0x3FC00000) >> 6) | ((c & 0x000FF000) >> 4) | ((c & 0x000003FC) >> 2))
 #define RGB16_TO_COLORKEY(c) \
 	(((c & 0xF800) << 8) | ((c & 0x07E0) << 5) | ((c & 0x001F) << 3))
 #define RGB15_TO_COLORKEY(c) \
 	(((c & 0x7c00) << 9) | ((c & 0x03E0) << 6) | ((c & 0x001F) << 3))
+#define RGB8I_TO_COLORKEY(c) \
+	(((c & 0xFF) << 16) | ((c & 0XFF) << 8) | ((c & 0xFF) << 0))
 
 /* overlay flip addr flag */
 #define OFC_UPDATE		0x1
@@ -673,8 +676,8 @@ static void update_colorkey(struct intel_overlay *overlay,
 
 	switch (format) {
 	case DRM_FORMAT_C8:
-		key = 0;
-		flags |= CLK_RGB8I_MASK;
+		key = RGB8I_TO_COLORKEY(key);
+		flags |= CLK_RGB24_MASK;
 		break;
 	case DRM_FORMAT_XRGB1555:
 		key = RGB15_TO_COLORKEY(key);
@@ -684,6 +687,11 @@ static void update_colorkey(struct intel_overlay *overlay,
 		key = RGB16_TO_COLORKEY(key);
 		flags |= CLK_RGB16_MASK;
 		break;
+	case DRM_FORMAT_XRGB2101010:
+	case DRM_FORMAT_XBGR2101010:
+		key = RGB30_TO_COLORKEY(key);
+		flags |= CLK_RGB24_MASK;
+		break;
 	default:
 		flags |= CLK_RGB24_MASK;
 		break;
-- 
2.21.0

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

  parent reply	other threads:[~2019-10-28 11:30 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-28 11:30 [PATCH 1/6] drm/i915: Fix i845/i865 cursor width Ville Syrjala
2019-10-28 11:30 ` [Intel-gfx] " Ville Syrjala
2019-10-28 11:30 ` [PATCH 2/6] drm/i915: Fix max cursor size for i915g/gm Ville Syrjala
2019-10-28 11:30   ` [Intel-gfx] " Ville Syrjala
2020-05-15 16:31   ` Chris Wilson
2019-10-28 11:30 ` Ville Syrjala [this message]
2019-10-28 11:30   ` [Intel-gfx] [PATCH 3/6] drm/i915: Fix overlay colorkey for 30bpp and 8bpp Ville Syrjala
2020-05-15 16:38   ` Chris Wilson
2019-10-28 11:30 ` [PATCH 4/6] drm/i915: Configure overlay cc_out precision based on crtc gamma config Ville Syrjala
2019-10-28 11:30   ` [Intel-gfx] " Ville Syrjala
2020-05-15 16:40   ` Chris Wilson
2019-10-28 11:30 ` [PATCH 5/6] drm/i915: Enable pipe gamma for the overlay Ville Syrjala
2019-10-28 11:30   ` [Intel-gfx] " Ville Syrjala
2020-05-15 16:40   ` Chris Wilson
2019-10-28 11:30 ` [PATCH 6/6] drm/i915: Protect overlay colorkey macro arguments Ville Syrjala
2019-10-28 11:30   ` [Intel-gfx] " Ville Syrjala
2020-05-15 16:41   ` Chris Wilson
2019-10-28 14:20 ` [PATCH 1/6] drm/i915: Fix i845/i865 cursor width Maarten Lankhorst
2019-10-28 14:20   ` [Intel-gfx] " Maarten Lankhorst
2019-10-28 15:05   ` Ville Syrjälä
2019-10-28 15:05     ` [Intel-gfx] " Ville Syrjälä
2019-10-28 15:57     ` Maarten Lankhorst
2019-10-28 15:57       ` [Intel-gfx] " Maarten Lankhorst
2019-10-28 14:43 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/6] " Patchwork
2019-10-28 14:43   ` [Intel-gfx] " Patchwork
2019-10-28 15:04 ` ✓ Fi.CI.BAT: success " Patchwork
2019-10-28 15:04   ` [Intel-gfx] " Patchwork
2019-10-29 10:10 ` ✗ Fi.CI.IGT: failure " Patchwork
2019-10-29 10:10   ` [Intel-gfx] " 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=20191028113036.27553-3-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 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).