All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH xf86-video-intel 1/4] sna/video/sprite: Fix colorkey setup for depth != 24
@ 2018-10-22 13:59 Ville Syrjala
  2018-10-22 13:59 ` [PATCH xf86-video-intel 2/4] sna/video/sprite: Allow sprite Xv with depth 8 and depth 30 Ville Syrjala
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Ville Syrjala @ 2018-10-22 13:59 UTC (permalink / raw)
  To: intel-gfx

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

Set up the colorkey correctly for depth != 24. For 8bpc we
need to replicate the same key value into each channel, for
depth 15/16 we need to mask off the unused low bits in each
channel, and for depth 30 we just use the 8 msbs of each channel
as the colorkey register can't hold the full 10 bits.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 src/sna/sna_video_sprite.c | 52 +++++++++++++++++++++++++++++++++++---
 1 file changed, 49 insertions(+), 3 deletions(-)

diff --git a/src/sna/sna_video_sprite.c b/src/sna/sna_video_sprite.c
index 8b7ae8ae9e75..bb7b200b4dcc 100644
--- a/src/sna/sna_video_sprite.c
+++ b/src/sna/sna_video_sprite.c
@@ -228,6 +228,52 @@ update_dst_box_to_crtc_coords(struct sna *sna, xf86CrtcPtr crtc, BoxPtr dstBox)
 	}
 }
 
+static uint32_t ckey_chan(uint32_t value, int weight)
+{
+	return value << 8 >> weight;
+}
+
+static uint32_t ckey_value_chan(uint32_t value, uint32_t mask,
+				int offset, int weight)
+{
+	return ckey_chan((value & mask) >> offset, weight);
+}
+
+static uint32_t ckey_value(struct sna *sna,
+			   struct sna_video *video)
+{
+	ScrnInfoPtr scrn = sna->scrn;
+	uint32_t r, g ,b;
+
+	if (scrn->depth == 8) {
+		r = g = b = video->color_key & 0xff;
+	} else {
+		r = ckey_value_chan(video->color_key, scrn->mask.red,
+				    scrn->offset.red, scrn->weight.red);
+		g = ckey_value_chan(video->color_key, scrn->mask.green,
+				    scrn->offset.green, scrn->weight.green);
+		b = ckey_value_chan(video->color_key, scrn->mask.blue,
+				    scrn->offset.blue, scrn->weight.blue);
+	}
+
+	return r << 16 | g << 8 | b;
+}
+
+static uint32_t ckey_mask_chan(int weight)
+{
+	return ckey_chan((1 << weight) - 1, weight);
+}
+
+static uint32_t ckey_mask(struct sna *sna)
+{
+	ScrnInfoPtr scrn = sna->scrn;
+	uint32_t r = ckey_mask_chan(scrn->weight.red);
+	uint32_t g = ckey_mask_chan(scrn->weight.green);
+	uint32_t b = ckey_mask_chan(scrn->weight.blue);
+
+	return 0x7 << 24 | r << 16 | g << 8 | b;
+}
+
 static bool
 sna_video_sprite_show(struct sna *sna,
 		      struct sna_video *video,
@@ -260,9 +306,9 @@ sna_video_sprite_show(struct sna *sna,
 		     __FUNCTION__, video->color_key));
 
 		set.plane_id = s.plane_id;
-		set.min_value = video->color_key;
-		set.max_value = video->color_key; /* not used for destkey */
-		set.channel_mask = 0x7 << 24 | 0xff << 16 | 0xff << 8 | 0xff << 0;
+		set.min_value = ckey_value(sna, video);
+		set.max_value = 0; /* not used for destkey */
+		set.channel_mask = ckey_mask(sna);
 		set.flags = 0;
 		if (!video->AlwaysOnTop)
 			set.flags |= 1 << 1; /* COLORKEY_DESTINATION */
-- 
2.18.1

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH xf86-video-intel 2/4] sna/video/sprite: Allow sprite Xv with depth 8 and depth 30
  2018-10-22 13:59 [PATCH xf86-video-intel 1/4] sna/video/sprite: Fix colorkey setup for depth != 24 Ville Syrjala
@ 2018-10-22 13:59 ` Ville Syrjala
  2018-10-22 16:29   ` Chris Wilson
  2018-10-22 13:59 ` [PATCH xf86-video-intel 3/4] sna/video/textured: Enable textured Xv wih " Ville Syrjala
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Ville Syrjala @ 2018-10-22 13:59 UTC (permalink / raw)
  To: intel-gfx

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

With the colorkey setup fixed the sprite Xv adaptor works just
fine with depth 30.

With depth 8 there is one remaining problem with the usage of
the LUT for gamma vs. C8, but that is purely a kernel issue.

Let's allow both depth 8 and depth 30 with the sprite Xv
adaptor.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 src/sna/sna_video_sprite.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/sna/sna_video_sprite.c b/src/sna/sna_video_sprite.c
index bb7b200b4dcc..d3d722d4d77c 100644
--- a/src/sna/sna_video_sprite.c
+++ b/src/sna/sna_video_sprite.c
@@ -72,7 +72,7 @@ struct local_mode_set_plane {
 
 static Atom xvColorKey, xvAlwaysOnTop, xvSyncToVblank, xvColorspace;
 
-static XvFormatRec formats[] = { {15}, {16}, {24} };
+static XvFormatRec formats[] = { {8}, {15}, {16}, {24}, {30} };
 static const XvImageRec images[] = { XVIMAGE_YUY2, XVIMAGE_UYVY,
 				     XVMC_RGB888 };
 static const XvImageRec images_rgb565[] = { XVIMAGE_YUY2, XVIMAGE_UYVY,
-- 
2.18.1

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH xf86-video-intel 3/4] sna/video/textured: Enable textured Xv wih depth 30
  2018-10-22 13:59 [PATCH xf86-video-intel 1/4] sna/video/sprite: Fix colorkey setup for depth != 24 Ville Syrjala
  2018-10-22 13:59 ` [PATCH xf86-video-intel 2/4] sna/video/sprite: Allow sprite Xv with depth 8 and depth 30 Ville Syrjala
@ 2018-10-22 13:59 ` Ville Syrjala
  2018-10-22 16:29   ` Chris Wilson
  2018-10-22 13:59 ` [PATCH xf86-video-intel 4/4] sna/video/textured: Disable textured Xv for depth 8 Ville Syrjala
  2018-10-22 16:26 ` [PATCH xf86-video-intel 1/4] sna/video/sprite: Fix colorkey setup for depth != 24 Chris Wilson
  3 siblings, 1 reply; 8+ messages in thread
From: Ville Syrjala @ 2018-10-22 13:59 UTC (permalink / raw)
  To: intel-gfx

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

Texured Xv works just fine with depth 30. Allow it.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 src/sna/sna_video_textured.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/sna/sna_video_textured.c b/src/sna/sna_video_textured.c
index a784fe2ec0f4..dd38d4d4e3e7 100644
--- a/src/sna/sna_video_textured.c
+++ b/src/sna/sna_video_textured.c
@@ -39,7 +39,7 @@
 static Atom xvBrightness, xvContrast, xvSyncToVblank, xvColorspace;
 
 static XvFormatRec Formats[] = {
-	{15}, {16}, {24}
+	{15}, {16}, {24}, {30}
 };
 
 static const XvAttributeRec Attributes[] = {
-- 
2.18.1

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH xf86-video-intel 4/4] sna/video/textured: Disable textured Xv for depth 8
  2018-10-22 13:59 [PATCH xf86-video-intel 1/4] sna/video/sprite: Fix colorkey setup for depth != 24 Ville Syrjala
  2018-10-22 13:59 ` [PATCH xf86-video-intel 2/4] sna/video/sprite: Allow sprite Xv with depth 8 and depth 30 Ville Syrjala
  2018-10-22 13:59 ` [PATCH xf86-video-intel 3/4] sna/video/textured: Enable textured Xv wih " Ville Syrjala
@ 2018-10-22 13:59 ` Ville Syrjala
  2018-10-22 16:30   ` Chris Wilson
  2018-10-22 16:26 ` [PATCH xf86-video-intel 1/4] sna/video/sprite: Fix colorkey setup for depth != 24 Chris Wilson
  3 siblings, 1 reply; 8+ messages in thread
From: Ville Syrjala @ 2018-10-22 13:59 UTC (permalink / raw)
  To: intel-gfx

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

We can't output color index formats with the render engine,
so let's disable the textured Xv adaptor for depth 8.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 src/sna/sna_video_textured.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/sna/sna_video_textured.c b/src/sna/sna_video_textured.c
index dd38d4d4e3e7..115cbea42c24 100644
--- a/src/sna/sna_video_textured.c
+++ b/src/sna/sna_video_textured.c
@@ -354,6 +354,12 @@ void sna_video_textured_setup(struct sna *sna, ScreenPtr screen)
 	struct sna_video *video;
 	int nports, i;
 
+	if (sna->scrn->depth == 8) {
+		xf86DrvMsg(sna->scrn->scrnIndex, X_INFO,
+			   "Textured video not supported in 8bpp mode\n");
+		return;
+	}
+
 	if (!sna->render.video) {
 		xf86DrvMsg(sna->scrn->scrnIndex, X_INFO,
 			   "Textured video not supported on this hardware or backend\n");
-- 
2.18.1

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH xf86-video-intel 1/4] sna/video/sprite: Fix colorkey setup for depth != 24
  2018-10-22 13:59 [PATCH xf86-video-intel 1/4] sna/video/sprite: Fix colorkey setup for depth != 24 Ville Syrjala
                   ` (2 preceding siblings ...)
  2018-10-22 13:59 ` [PATCH xf86-video-intel 4/4] sna/video/textured: Disable textured Xv for depth 8 Ville Syrjala
@ 2018-10-22 16:26 ` Chris Wilson
  3 siblings, 0 replies; 8+ messages in thread
From: Chris Wilson @ 2018-10-22 16:26 UTC (permalink / raw)
  To: Ville Syrjala, intel-gfx

Quoting Ville Syrjala (2018-10-22 14:59:26)
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Set up the colorkey correctly for depth != 24. For 8bpc we
> need to replicate the same key value into each channel, for
> depth 15/16 we need to mask off the unused low bits in each
> channel, and for depth 30 we just use the 8 msbs of each channel
> as the colorkey register can't hold the full 10 bits.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  src/sna/sna_video_sprite.c | 52 +++++++++++++++++++++++++++++++++++---
>  1 file changed, 49 insertions(+), 3 deletions(-)
> 
> diff --git a/src/sna/sna_video_sprite.c b/src/sna/sna_video_sprite.c
> index 8b7ae8ae9e75..bb7b200b4dcc 100644
> --- a/src/sna/sna_video_sprite.c
> +++ b/src/sna/sna_video_sprite.c
> @@ -228,6 +228,52 @@ update_dst_box_to_crtc_coords(struct sna *sna, xf86CrtcPtr crtc, BoxPtr dstBox)
>         }
>  }
>  
> +static uint32_t ckey_chan(uint32_t value, int weight)
> +{
> +       return value << 8 >> weight;

Ok, making an 8bit value out of whatever input.

> +}
> +
> +static uint32_t ckey_value_chan(uint32_t value, uint32_t mask,
> +                               int offset, int weight)
> +{
> +       return ckey_chan((value & mask) >> offset, weight);
> +}
> +
> +static uint32_t ckey_value(struct sna *sna,
> +                          struct sna_video *video)
> +{
> +       ScrnInfoPtr scrn = sna->scrn;
> +       uint32_t r, g ,b;
> +
> +       if (scrn->depth == 8) {
> +               r = g = b = video->color_key & 0xff;
> +       } else {
> +               r = ckey_value_chan(video->color_key, scrn->mask.red,
> +                                   scrn->offset.red, scrn->weight.red);
> +               g = ckey_value_chan(video->color_key, scrn->mask.green,
> +                                   scrn->offset.green, scrn->weight.green);
> +               b = ckey_value_chan(video->color_key, scrn->mask.blue,
> +                                   scrn->offset.blue, scrn->weight.blue);

Makes sense.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH xf86-video-intel 2/4] sna/video/sprite: Allow sprite Xv with depth 8 and depth 30
  2018-10-22 13:59 ` [PATCH xf86-video-intel 2/4] sna/video/sprite: Allow sprite Xv with depth 8 and depth 30 Ville Syrjala
@ 2018-10-22 16:29   ` Chris Wilson
  0 siblings, 0 replies; 8+ messages in thread
From: Chris Wilson @ 2018-10-22 16:29 UTC (permalink / raw)
  To: Ville Syrjala, intel-gfx

Quoting Ville Syrjala (2018-10-22 14:59:27)
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> With the colorkey setup fixed the sprite Xv adaptor works just
> fine with depth 30.
> 
> With depth 8 there is one remaining problem with the usage of
> the LUT for gamma vs. C8, but that is purely a kernel issue.
> 
> Let's allow both depth 8 and depth 30 with the sprite Xv
> adaptor.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH xf86-video-intel 3/4] sna/video/textured: Enable textured Xv wih depth 30
  2018-10-22 13:59 ` [PATCH xf86-video-intel 3/4] sna/video/textured: Enable textured Xv wih " Ville Syrjala
@ 2018-10-22 16:29   ` Chris Wilson
  0 siblings, 0 replies; 8+ messages in thread
From: Chris Wilson @ 2018-10-22 16:29 UTC (permalink / raw)
  To: Ville Syrjala, intel-gfx

Quoting Ville Syrjala (2018-10-22 14:59:28)
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Texured Xv works just fine with depth 30. Allow it.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH xf86-video-intel 4/4] sna/video/textured: Disable textured Xv for depth 8
  2018-10-22 13:59 ` [PATCH xf86-video-intel 4/4] sna/video/textured: Disable textured Xv for depth 8 Ville Syrjala
@ 2018-10-22 16:30   ` Chris Wilson
  0 siblings, 0 replies; 8+ messages in thread
From: Chris Wilson @ 2018-10-22 16:30 UTC (permalink / raw)
  To: Ville Syrjala, intel-gfx

Quoting Ville Syrjala (2018-10-22 14:59:29)
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> We can't output color index formats with the render engine,
> so let's disable the textured Xv adaptor for depth 8.

Fair enough, there's probably lots more breakage around the place.
 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-10-22 16:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-22 13:59 [PATCH xf86-video-intel 1/4] sna/video/sprite: Fix colorkey setup for depth != 24 Ville Syrjala
2018-10-22 13:59 ` [PATCH xf86-video-intel 2/4] sna/video/sprite: Allow sprite Xv with depth 8 and depth 30 Ville Syrjala
2018-10-22 16:29   ` Chris Wilson
2018-10-22 13:59 ` [PATCH xf86-video-intel 3/4] sna/video/textured: Enable textured Xv wih " Ville Syrjala
2018-10-22 16:29   ` Chris Wilson
2018-10-22 13:59 ` [PATCH xf86-video-intel 4/4] sna/video/textured: Disable textured Xv for depth 8 Ville Syrjala
2018-10-22 16:30   ` Chris Wilson
2018-10-22 16:26 ` [PATCH xf86-video-intel 1/4] sna/video/sprite: Fix colorkey setup for depth != 24 Chris Wilson

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.