Skip to contentSkip to conversation

Remove duplicate exa_wm_yuv_rgb.g5a shader source

PATCH In review Ville Syrjala 2 participants 10 messages May 29, 2018 – May 31, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/8 Remove duplicate exa_wm_yuv_rgb.g5a shader source

From: Ville Syrjälä <[email protected]>

exa_wm_yuv_rgb.g5a is identical to exa_wm_yuv_rgb.g4a. Just use a symlink intead of duplicating the whole file.

---
 src/render_program/exa_wm_yuv_rgb.g5a | 99 +----------------------------------
 1 file changed, 1 insertion(+), 98 deletions(-)
 mode change 100644 => 120000 src/render_program/exa_wm_yuv_rgb.g5a
src/render_program/exa_wm_yuv_rgb.g5a deleted +0 -98
deleted file mode 100644
index 4fb2576ab5f9..000000000000
@@ -1,98 +0,0 @@
-/*
- * Copyright © 2006 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- *
- * Authors:
- *    Keith Packard <[email protected]>
- *    Eric Anholt <[email protected]>
- *
- */
-
-include(`exa_wm.g4i')
-
-define(`YCbCr_base',	`src_sample_base')
-
-define(`Cr',		`src_sample_r')
-define(`Cr_01',		`src_sample_r_01')
-define(`Cr_23',		`src_sample_r_23')
-
-define(`Y',		`src_sample_g')
-define(`Y_01',		`src_sample_g_01')
-define(`Y_23',		`src_sample_g_23')
-
-define(`Cb',		`src_sample_b')
-define(`Cb_01',		`src_sample_b_01')
-define(`Cb_23',		`src_sample_b_23')
-
-define(`Crn',		`mask_sample_r')
-define(`Crn_01',	`mask_sample_r_01')
-define(`Crn_23',	`mask_sample_r_23')
-
-define(`Yn',		`mask_sample_g')
-define(`Yn_01',		`mask_sample_g_01')
-define(`Yn_23',		`mask_sample_g_23')
-
-define(`Cbn',		`mask_sample_b')
-define(`Cbn_01',	`mask_sample_b_01')
-define(`Cbn_23',	`mask_sample_b_23')
-
-    /* color space conversion function:
-     * R = Clamp ( 1.164(Y-16/255) + 1.596(Cr-128/255), 0, 1)
-     * G = Clamp ( 1.164(Y-16/255) - 0.813(Cr-128/255) - 0.392(Cb-128/255), 0, 1)
-     * B = Clamp ( 1.164(Y-16/255) + 2.017(Cb-128/255), 0, 1)
-     */
-
-    /* Normalize Y, Cb and Cr:
-     *
-     * Yn = (Y - 16/255) * 1.164
-     * Crn = Cr - 128 / 255
-     * Cbn = Cb - 128 / 255
-     */
-add (16)    Yn<1>F		Y<8,8,1>F	-0.0627451F { compr align1 };
-mul (16)    Yn<1>F		Yn<8,8,1>F	1.164F	    { compr align1 };
-
-add (16)    Crn<1>F		Cr<8,8,1>F	-0.501961F  { compr align1 };
-
-add (16)    Cbn<1>F		Cb<8,8,1>F	-0.501961F  { compr align1 };
-
-    /* 
-     * R = Y + Cr * 1.596
-     */
-mov (16)    acc0<1>F		Yn<8,8,1>F		    { compr align1 };
-mac.sat(16) src_sample_r<1>F	Crn<8,8,1>F	1.596F	    { compr align1 };
-     
-    /*
-     * G = Crn * -0.813 + Cbn * -0.392 + Y
-     */
-mov (16)    acc0<1>F		Yn<8,8,1>F		    { compr align1 };
-mac (16)    acc0<1>F		Crn<8,8,1>F    	-0.813F	    { compr align1 };
-mac.sat(16) src_sample_g<1>F	Cbn<8,8,1>F    	-0.392F	    { compr align1 };
-
-    /*
-     * B = Cbn * 2.017 + Y
-     */
-mov (16)    acc0<1>F	        Yn<8,8,1>F		    { compr align1 };
-mac.sat(16) src_sample_b<1>F	Cbn<8,8,1>F     2.017F	    { compr align1 };
-
-    /*
-     * A = 1.0
-     */
-mov (16)    src_sample_a<1>F	1.0F			    { compr align1 };
src/render_program/exa_wm_yuv_rgb.g5a new file +1 -0
new file mode 120000
index 000000000000..d34d246d5a9b
@@ -0,0 +1 @@
+exa_wm_yuv_rgb.g4a
\ No newline at end of file
Signature · 6 lines
2.16.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 2/8 Rename current yuv->rgb shader sources to exa_wm_yuv_rgb_bt601

From: Ville Syrjälä <[email protected]>

Our current yuv->rgb shaders follow the BT.601 conversion formula. Rename the shader sources to indicate that fact.

---
 src/render_program/Makefile.am                     | 22 +++++++++++-----------
 src/render_program/exa_wm_yuv_rgb.g5a              |  1 -
 src/render_program/exa_wm_yuv_rgb.g6a              |  1 -
 src/render_program/exa_wm_yuv_rgb.g7a              |  1 -
 ...exa_wm_yuv_rgb.g4a => exa_wm_yuv_rgb_bt601.g4a} |  0
 ...exa_wm_yuv_rgb.g4b => exa_wm_yuv_rgb_bt601.g4b} |  0
 ..._rgb.g4b.gen5 => exa_wm_yuv_rgb_bt601.g4b.gen5} |  0
 src/render_program/exa_wm_yuv_rgb_bt601.g5a        |  1 +
 ...exa_wm_yuv_rgb.g5b => exa_wm_yuv_rgb_bt601.g5b} |  0
 src/render_program/exa_wm_yuv_rgb_bt601.g6a        |  1 +
 ...exa_wm_yuv_rgb.g6b => exa_wm_yuv_rgb_bt601.g6b} |  0
 src/render_program/exa_wm_yuv_rgb_bt601.g7a        |  1 +
 ...exa_wm_yuv_rgb.g7b => exa_wm_yuv_rgb_bt601.g7b} |  0
 ...exa_wm_yuv_rgb.g8a => exa_wm_yuv_rgb_bt601.g8a} |  0
 ...exa_wm_yuv_rgb.g8b => exa_wm_yuv_rgb_bt601.g8b} |  0
 src/sna/brw/brw_test_gen4.c                        |  4 ++--
 src/sna/brw/brw_test_gen5.c                        |  4 ++--
 src/sna/brw/brw_test_gen6.c                        |  4 ++--
 src/sna/brw/brw_test_gen7.c                        |  4 ++--
 src/sna/gen4_render.c                              |  6 +++---
 src/sna/gen5_render.c                              |  6 +++---
 src/sna/gen6_render.c                              |  6 +++---
 src/sna/gen7_render.c                              |  6 +++---
 src/sna/gen8_render.c                              |  6 +++---
 src/sna/gen9_render.c                              |  6 +++---
 src/uxa/i965_video.c                               | 16 ++++++++--------
 26 files changed, 48 insertions(+), 48 deletions(-)
 delete mode 120000 src/render_program/exa_wm_yuv_rgb.g5a
 delete mode 120000 src/render_program/exa_wm_yuv_rgb.g6a
 delete mode 120000 src/render_program/exa_wm_yuv_rgb.g7a
 rename src/render_program/{exa_wm_yuv_rgb.g4a => exa_wm_yuv_rgb_bt601.g4a} (100%)
 rename src/render_program/{exa_wm_yuv_rgb.g4b => exa_wm_yuv_rgb_bt601.g4b} (100%)
 rename src/render_program/{exa_wm_yuv_rgb.g4b.gen5 => exa_wm_yuv_rgb_bt601.g4b.gen5} (100%)
 create mode 120000 src/render_program/exa_wm_yuv_rgb_bt601.g5a
 rename src/render_program/{exa_wm_yuv_rgb.g5b => exa_wm_yuv_rgb_bt601.g5b} (100%)
 create mode 120000 src/render_program/exa_wm_yuv_rgb_bt601.g6a
 rename src/render_program/{exa_wm_yuv_rgb.g6b => exa_wm_yuv_rgb_bt601.g6b} (100%)
 create mode 120000 src/render_program/exa_wm_yuv_rgb_bt601.g7a
 rename src/render_program/{exa_wm_yuv_rgb.g7b => exa_wm_yuv_rgb_bt601.g7b} (100%)
 rename src/render_program/{exa_wm_yuv_rgb.g8a => exa_wm_yuv_rgb_bt601.g8a} (100%)
 rename src/render_program/{exa_wm_yuv_rgb.g8b => exa_wm_yuv_rgb_bt601.g8b} (100%)
src/render_program/Makefile.am +11 -11
index 7b835e1a3fde..4493673435b6 100644
@@ -15,7 +15,7 @@ INTEL_G4A =				\
 	exa_wm_ca.g4a			\
 	exa_wm_ca_srcalpha.g4a		\
 	exa_wm_write.g4a 		\
-	exa_wm_yuv_rgb.g4a		\
+	exa_wm_yuv_rgb_bt601.g4a	\
 	exa_wm_xy.g4a			\
 	$(NULL)
 
@@ -45,7 +45,7 @@ INTEL_G4B = 				\
 	exa_wm_ca.g4b			\
 	exa_wm_ca_srcalpha.g4b		\
 	exa_wm_write.g4b 		\
-	exa_wm_yuv_rgb.g4b		\
+	exa_wm_yuv_rgb_bt601.g4b	\
 	exa_wm_xy.g4b			\
 	$(NULL)
 
@@ -67,7 +67,7 @@ INTEL_G4B_GEN5 = 				\
 	exa_wm_ca.g4b.gen5			\
 	exa_wm_ca_srcalpha.g4b.gen5		\
 	exa_wm_write.g4b.gen5 			\
-	exa_wm_yuv_rgb.g4b.gen5			\
+	exa_wm_yuv_rgb_bt601.g4b.gen5		\
 	exa_wm_xy.g4b.gen5			\
 	$(NULL)
 
@@ -88,7 +88,7 @@ INTEL_G5A =				\
 	exa_wm_ca.g5a			\
 	exa_wm_ca_srcalpha.g5a		\
 	exa_wm_write.g5a 		\
-	exa_wm_yuv_rgb.g5a		\
+	exa_wm_yuv_rgb_bt601.g5a	\
 	exa_wm_xy.g5a			\
 	$(NULL)
 
@@ -109,7 +109,7 @@ INTEL_G5B = 				\
 	exa_wm_ca.g5b			\
 	exa_wm_ca_srcalpha.g5b		\
 	exa_wm_write.g5b 		\
-	exa_wm_yuv_rgb.g5b		\
+	exa_wm_yuv_rgb_bt601.g5b	\
 	exa_wm_xy.g5b			\
 	$(NULL)
 
@@ -133,7 +133,7 @@ INTEL_G6A =				\
 	exa_wm_ca_srcalpha.g6a		\
 	exa_wm_noca.g6a			\
 	exa_wm_write.g6a 		\
-	exa_wm_yuv_rgb.g6a		\
+	exa_wm_yuv_rgb_bt601.g6a	\
 	$(NULL)
 
 INTEL_G6B =				\
@@ -151,7 +151,7 @@ INTEL_G6B =				\
 	exa_wm_ca_srcalpha.g6b		\
 	exa_wm_noca.g6b			\
 	exa_wm_write.g6b 		\
-	exa_wm_yuv_rgb.g6b		\
+	exa_wm_yuv_rgb_bt601.g6b	\
 	$(NULL)
 
 INTEL_G7A =				\
@@ -166,7 +166,7 @@ INTEL_G7A =				\
 	exa_wm_src_sample_nv12.g7a 	\
 	exa_wm_src_sample_planar.g7a 	\
 	exa_wm_write.g7a 		\
-	exa_wm_yuv_rgb.g7a		\
+	exa_wm_yuv_rgb_bt601.g7a	\
 	$(NULL)
 
 INTEL_G7B =				\
@@ -181,7 +181,7 @@ INTEL_G7B =				\
 	exa_wm_src_sample_nv12.g7b 	\
 	exa_wm_src_sample_planar.g7b 	\
 	exa_wm_write.g7b 		\
-	exa_wm_yuv_rgb.g7b		\
+	exa_wm_yuv_rgb_bt601.g7b	\
 	$(NULL)
 
 INTEL_G8A =				\
@@ -190,7 +190,7 @@ INTEL_G8A =				\
 	exa_wm_src_sample_nv12.g8a 	\
 	exa_wm_src_sample_planar.g8a 	\
 	exa_wm_write.g8a 		\
-	exa_wm_yuv_rgb.g8a		\
+	exa_wm_yuv_rgb_bt601.g8a	\
 	$(NULL)
 
 INTEL_G8B =				\
@@ -199,7 +199,7 @@ INTEL_G8B =				\
 	exa_wm_src_sample_nv12.g8b 	\
 	exa_wm_src_sample_planar.g8b 	\
 	exa_wm_write.g8b 		\
-	exa_wm_yuv_rgb.g8b		\
+	exa_wm_yuv_rgb_bt601.g8b	\
 	$(NULL)
 
 EXTRA_DIST = 		\
src/render_program/exa_wm_yuv_rgb.g5a deleted +0 -1
deleted file mode 120000
index d34d246d5a9b..000000000000
@@ -1 +0,0 @@
-exa_wm_yuv_rgb.g4a
\ No newline at end of file
src/render_program/exa_wm_yuv_rgb.g6a deleted +0 -1
deleted file mode 120000
index d34d246d5a9b..000000000000
@@ -1 +0,0 @@
-exa_wm_yuv_rgb.g4a
\ No newline at end of file
src/render_program/exa_wm_yuv_rgb.g7a deleted +0 -1
deleted file mode 120000
index d34d246d5a9b..000000000000
@@ -1 +0,0 @@
-exa_wm_yuv_rgb.g4a
\ No newline at end of file
src/render_program/exa_wm_yuv_rgb_bt601.g4a renamed from src/render_program/exa_wm_yuv_rgb.g4a +0 -0
similarity index 100%
rename from src/render_program/exa_wm_yuv_rgb.g4a
rename to src/render_program/exa_wm_yuv_rgb_bt601.g4a
src/render_program/exa_wm_yuv_rgb_bt601.g4b renamed from src/render_program/exa_wm_yuv_rgb.g4b +0 -0
similarity index 100%
rename from src/render_program/exa_wm_yuv_rgb.g4b
rename to src/render_program/exa_wm_yuv_rgb_bt601.g4b
src/render_program/exa_wm_yuv_rgb_bt601.g4b.gen5 renamed from src/render_program/exa_wm_yuv_rgb.g4b.gen5 +0 -0
similarity index 100%
rename from src/render_program/exa_wm_yuv_rgb.g4b.gen5
rename to src/render_program/exa_wm_yuv_rgb_bt601.g4b.gen5
src/render_program/exa_wm_yuv_rgb_bt601.g5a new file +1 -0
new file mode 120000
index 000000000000..8c98e82d0f02
@@ -0,0 +1 @@
+exa_wm_yuv_rgb_bt601.g4a
\ No newline at end of file
src/render_program/exa_wm_yuv_rgb_bt601.g5b renamed from src/render_program/exa_wm_yuv_rgb.g5b +0 -0
similarity index 100%
rename from src/render_program/exa_wm_yuv_rgb.g5b
rename to src/render_program/exa_wm_yuv_rgb_bt601.g5b
src/render_program/exa_wm_yuv_rgb_bt601.g6a new file +1 -0
new file mode 120000
index 000000000000..8c98e82d0f02
@@ -0,0 +1 @@
+exa_wm_yuv_rgb_bt601.g4a
\ No newline at end of file
src/render_program/exa_wm_yuv_rgb_bt601.g6b renamed from src/render_program/exa_wm_yuv_rgb.g6b +0 -0
similarity index 100%
rename from src/render_program/exa_wm_yuv_rgb.g6b
rename to src/render_program/exa_wm_yuv_rgb_bt601.g6b
src/render_program/exa_wm_yuv_rgb_bt601.g7a new file +1 -0
new file mode 120000
index 000000000000..8c98e82d0f02
@@ -0,0 +1 @@
+exa_wm_yuv_rgb_bt601.g4a
\ No newline at end of file
src/render_program/exa_wm_yuv_rgb_bt601.g7b renamed from src/render_program/exa_wm_yuv_rgb.g7b +0 -0
similarity index 100%
rename from src/render_program/exa_wm_yuv_rgb.g7b
rename to src/render_program/exa_wm_yuv_rgb_bt601.g7b
src/render_program/exa_wm_yuv_rgb_bt601.g8a renamed from src/render_program/exa_wm_yuv_rgb.g8a +0 -0
similarity index 100%
rename from src/render_program/exa_wm_yuv_rgb.g8a
rename to src/render_program/exa_wm_yuv_rgb_bt601.g8a
src/render_program/exa_wm_yuv_rgb_bt601.g8b renamed from src/render_program/exa_wm_yuv_rgb.g8b +0 -0
similarity index 100%
rename from src/render_program/exa_wm_yuv_rgb.g8b
rename to src/render_program/exa_wm_yuv_rgb_bt601.g8b
src/sna/brw/brw_test_gen4.c +2 -2
index c0a185f3ce7f..78ff74653b63 100644
@@ -115,7 +115,7 @@ static const uint32_t ps_kernel_packed_static[][4] = {
 #include "exa_wm_xy.g4b"
 #include "exa_wm_src_affine.g4b"
 #include "exa_wm_src_sample_argb.g4b"
-#include "exa_wm_yuv_rgb.g4b"
+#include "exa_wm_yuv_rgb_bt601.g4b"
 #include "exa_wm_write.g4b"
 };
 
@@ -123,7 +123,7 @@ static const uint32_t ps_kernel_planar_static[][4] = {
 #include "exa_wm_xy.g4b"
 #include "exa_wm_src_affine.g4b"
 #include "exa_wm_src_sample_planar.g4b"
-#include "exa_wm_yuv_rgb.g4b"
+#include "exa_wm_yuv_rgb_bt601.g4b"
 #include "exa_wm_write.g4b"
 };
 
src/sna/brw/brw_test_gen5.c +2 -2
index 5f909fe55a2a..e821ce8bb814 100644
@@ -115,7 +115,7 @@ static const uint32_t ps_kernel_packed_static[][4] = {
 #include "exa_wm_xy.g5b"
 #include "exa_wm_src_affine.g5b"
 #include "exa_wm_src_sample_argb.g5b"
-#include "exa_wm_yuv_rgb.g5b"
+#include "exa_wm_yuv_rgb_bt601.g5b"
 #include "exa_wm_write.g5b"
 };
 
@@ -123,7 +123,7 @@ static const uint32_t ps_kernel_planar_static[][4] = {
 #include "exa_wm_xy.g5b"
 #include "exa_wm_src_affine.g5b"
 #include "exa_wm_src_sample_planar.g5b"
-#include "exa_wm_yuv_rgb.g5b"
+#include "exa_wm_yuv_rgb_bt601.g5b"
 #include "exa_wm_write.g5b"
 };
 
src/sna/brw/brw_test_gen6.c +2 -2
index 813ea8ac07fd..9603b9d99ceb 100644
@@ -98,14 +98,14 @@ static const uint32_t ps_kernel_masknoca_projective[][4] = {
 static const uint32_t ps_kernel_packed[][4] = {
 #include "exa_wm_src_affine.g6b"
 #include "exa_wm_src_sample_argb.g6b"
-#include "exa_wm_yuv_rgb.g6b"
+#include "exa_wm_yuv_rgb_bt601.g6b"
 #include "exa_wm_write.g6b"
 };
 
 static const uint32_t ps_kernel_planar[][4] = {
 #include "exa_wm_src_affine.g6b"
 #include "exa_wm_src_sample_planar.g6b"
-#include "exa_wm_yuv_rgb.g6b"
+#include "exa_wm_yuv_rgb_bt601.g6b"
 #include "exa_wm_write.g6b"
 };
 
src/sna/brw/brw_test_gen7.c +2 -2
index 297ae470cb1b..658b6699594a 100644
@@ -98,14 +98,14 @@ static const uint32_t ps_kernel_masknoca_projective[][4] = {
 static const uint32_t ps_kernel_packed[][4] = {
 #include "exa_wm_src_affine.g7b"
 #include "exa_wm_src_sample_argb.g7b"
-#include "exa_wm_yuv_rgb.g7b"
+#include "exa_wm_yuv_rgb_bt601.g7b"
 #include "exa_wm_write.g7b"
 };
 
 static const uint32_t ps_kernel_planar[][4] = {
 #include "exa_wm_src_affine.g7b"
 #include "exa_wm_src_sample_planar.g7b"
-#include "exa_wm_yuv_rgb.g7b"
+#include "exa_wm_yuv_rgb_bt601.g7b"
 #include "exa_wm_write.g7b"
 };
 
src/sna/gen4_render.c +3 -3
index f74b76f092e2..01f8040f79fe 100644
@@ -103,7 +103,7 @@ static const uint32_t ps_kernel_packed_static[][4] = {
 #include "exa_wm_xy.g4b"
 #include "exa_wm_src_affine.g4b"
 #include "exa_wm_src_sample_argb.g4b"
-#include "exa_wm_yuv_rgb.g4b"
+#include "exa_wm_yuv_rgb_bt601.g4b"
 #include "exa_wm_write.g4b"
 };
 
@@ -111,7 +111,7 @@ static const uint32_t ps_kernel_planar_static[][4] = {
 #include "exa_wm_xy.g4b"
 #include "exa_wm_src_affine.g4b"
 #include "exa_wm_src_sample_planar.g4b"
-#include "exa_wm_yuv_rgb.g4b"
+#include "exa_wm_yuv_rgb_bt601.g4b"
 #include "exa_wm_write.g4b"
 };
 
@@ -119,7 +119,7 @@ static const uint32_t ps_kernel_nv12_static[][4] = {
 #include "exa_wm_xy.g4b"
 #include "exa_wm_src_affine.g4b"
 #include "exa_wm_src_sample_nv12.g4b"
-#include "exa_wm_yuv_rgb.g4b"
+#include "exa_wm_yuv_rgb_bt601.g4b"
 #include "exa_wm_write.g4b"
 };
 
src/sna/gen5_render.c +3 -3
index 46535f7ba085..bed4a3edd7ab 100644
@@ -93,7 +93,7 @@ static const uint32_t ps_kernel_packed_static[][4] = {
 #include "exa_wm_xy.g5b"
 #include "exa_wm_src_affine.g5b"
 #include "exa_wm_src_sample_argb.g5b"
-#include "exa_wm_yuv_rgb.g5b"
+#include "exa_wm_yuv_rgb_bt601.g5b"
 #include "exa_wm_write.g5b"
 };
 
@@ -101,7 +101,7 @@ static const uint32_t ps_kernel_planar_static[][4] = {
 #include "exa_wm_xy.g5b"
 #include "exa_wm_src_affine.g5b"
 #include "exa_wm_src_sample_planar.g5b"
-#include "exa_wm_yuv_rgb.g5b"
+#include "exa_wm_yuv_rgb_bt601.g5b"
 #include "exa_wm_write.g5b"
 };
 
@@ -109,7 +109,7 @@ static const uint32_t ps_kernel_nv12_static[][4] = {
 #include "exa_wm_xy.g5b"
 #include "exa_wm_src_affine.g5b"
 #include "exa_wm_src_sample_nv12.g5b"
-#include "exa_wm_yuv_rgb.g5b"
+#include "exa_wm_yuv_rgb_bt601.g5b"
 #include "exa_wm_write.g5b"
 };
 
src/sna/gen6_render.c +3 -3
index e847062f7a79..39ea5b6ff558 100644
@@ -104,21 +104,21 @@ static const struct gt_info gt2_info = {
 static const uint32_t ps_kernel_packed[][4] = {
 #include "exa_wm_src_affine.g6b"
 #include "exa_wm_src_sample_argb.g6b"
-#include "exa_wm_yuv_rgb.g6b"
+#include "exa_wm_yuv_rgb_bt601.g6b"
 #include "exa_wm_write.g6b"
 };
 
 static const uint32_t ps_kernel_planar[][4] = {
 #include "exa_wm_src_affine.g6b"
 #include "exa_wm_src_sample_planar.g6b"
-#include "exa_wm_yuv_rgb.g6b"
+#include "exa_wm_yuv_rgb_bt601.g6b"
 #include "exa_wm_write.g6b"
 };
 
 static const uint32_t ps_kernel_nv12[][4] = {
 #include "exa_wm_src_affine.g6b"
 #include "exa_wm_src_sample_nv12.g6b"
-#include "exa_wm_yuv_rgb.g6b"
+#include "exa_wm_yuv_rgb_bt601.g6b"
 #include "exa_wm_write.g6b"
 };
 
src/sna/gen7_render.c +3 -3
index c3f81c52a9c1..b1fdfb5199c5 100644
@@ -196,21 +196,21 @@ inline static bool is_hsw(struct sna *sna)
 static const uint32_t ps_kernel_packed[][4] = {
 #include "exa_wm_src_affine.g7b"
 #include "exa_wm_src_sample_argb.g7b"
-#include "exa_wm_yuv_rgb.g7b"
+#include "exa_wm_yuv_rgb_bt601.g7b"
 #include "exa_wm_write.g7b"
 };
 
 static const uint32_t ps_kernel_planar[][4] = {
 #include "exa_wm_src_affine.g7b"
 #include "exa_wm_src_sample_planar.g7b"
-#include "exa_wm_yuv_rgb.g7b"
+#include "exa_wm_yuv_rgb_bt601.g7b"
 #include "exa_wm_write.g7b"
 };
 
 static const uint32_t ps_kernel_nv12[][4] = {
 #include "exa_wm_src_affine.g7b"
 #include "exa_wm_src_sample_nv12.g7b"
-#include "exa_wm_yuv_rgb.g7b"
+#include "exa_wm_yuv_rgb_bt601.g7b"
 #include "exa_wm_write.g7b"
 };
 
src/sna/gen8_render.c +3 -3
index 46369d6b1193..eadb09ebf1f3 100644
@@ -96,21 +96,21 @@
 static const uint32_t ps_kernel_packed[][4] = {
 #include "exa_wm_src_affine.g8b"
 #include "exa_wm_src_sample_argb.g8b"
-#include "exa_wm_yuv_rgb.g8b"
+#include "exa_wm_yuv_rgb_bt601.g8b"
 #include "exa_wm_write.g8b"
 };
 
 static const uint32_t ps_kernel_planar[][4] = {
 #include "exa_wm_src_affine.g8b"
 #include "exa_wm_src_sample_planar.g8b"
-#include "exa_wm_yuv_rgb.g8b"
+#include "exa_wm_yuv_rgb_bt601.g8b"
 #include "exa_wm_write.g8b"
 };
 
 static const uint32_t ps_kernel_nv12[][4] = {
 #include "exa_wm_src_affine.g8b"
 #include "exa_wm_src_sample_nv12.g8b"
-#include "exa_wm_yuv_rgb.g8b"
+#include "exa_wm_yuv_rgb_bt601.g8b"
 #include "exa_wm_write.g8b"
 };
 
src/sna/gen9_render.c +3 -3
index dd25b7b1da3e..721a186a0ce9 100644
@@ -97,21 +97,21 @@
 static const uint32_t ps_kernel_packed[][4] = {
 #include "exa_wm_src_affine.g8b"
 #include "exa_wm_src_sample_argb.g8b"
-#include "exa_wm_yuv_rgb.g8b"
+#include "exa_wm_yuv_rgb_bt601.g8b"
 #include "exa_wm_write.g8b"
 };
 
 static const uint32_t ps_kernel_planar[][4] = {
 #include "exa_wm_src_affine.g8b"
 #include "exa_wm_src_sample_planar.g8b"
-#include "exa_wm_yuv_rgb.g8b"
+#include "exa_wm_yuv_rgb_bt601.g8b"
 #include "exa_wm_write.g8b"
 };
 
 static const uint32_t ps_kernel_nv12[][4] = {
 #include "exa_wm_src_affine.g8b"
 #include "exa_wm_src_sample_nv12.g8b"
-#include "exa_wm_yuv_rgb.g8b"
+#include "exa_wm_yuv_rgb_bt601.g8b"
 #include "exa_wm_write.g8b"
 };
 
src/uxa/i965_video.c +8 -8
index 438ab909ca62..9b9203b66f25 100644
@@ -101,7 +101,7 @@ static const uint32_t ps_kernel_packed_static[][4] = {
 #include "exa_wm_xy.g4b"
 #include "exa_wm_src_affine.g4b"
 #include "exa_wm_src_sample_argb.g4b"
-#include "exa_wm_yuv_rgb.g4b"
+#include "exa_wm_yuv_rgb_bt601.g4b"
 #include "exa_wm_write.g4b"
 };
 
@@ -109,7 +109,7 @@ static const uint32_t ps_kernel_planar_static[][4] = {
 #include "exa_wm_xy.g4b"
 #include "exa_wm_src_affine.g4b"
 #include "exa_wm_src_sample_planar.g4b"
-#include "exa_wm_yuv_rgb.g4b"
+#include "exa_wm_yuv_rgb_bt601.g4b"
 #include "exa_wm_write.g4b"
 };
 
@@ -122,7 +122,7 @@ static const uint32_t ps_kernel_packed_static_gen5[][4] = {
 #include "exa_wm_xy.g4b.gen5"
 #include "exa_wm_src_affine.g4b.gen5"
 #include "exa_wm_src_sample_argb.g4b.gen5"
-#include "exa_wm_yuv_rgb.g4b.gen5"
+#include "exa_wm_yuv_rgb_bt601.g4b.gen5"
 #include "exa_wm_write.g4b.gen5"
 };
 
@@ -130,7 +130,7 @@ static const uint32_t ps_kernel_planar_static_gen5[][4] = {
 #include "exa_wm_xy.g4b.gen5"
 #include "exa_wm_src_affine.g4b.gen5"
 #include "exa_wm_src_sample_planar.g4b.gen5"
-#include "exa_wm_yuv_rgb.g4b.gen5"
+#include "exa_wm_yuv_rgb_bt601.g4b.gen5"
 #include "exa_wm_write.g4b.gen5"
 };
 
@@ -138,14 +138,14 @@ static const uint32_t ps_kernel_planar_static_gen5[][4] = {
 static const uint32_t ps_kernel_packed_static_gen6[][4] = {
 #include "exa_wm_src_affine.g6b"
 #include "exa_wm_src_sample_argb.g6b"
-#include "exa_wm_yuv_rgb.g6b"
+#include "exa_wm_yuv_rgb_bt601.g6b"
 #include "exa_wm_write.g6b"
 };
 
 static const uint32_t ps_kernel_planar_static_gen6[][4] = {
 #include "exa_wm_src_affine.g6b"
 #include "exa_wm_src_sample_planar.g6b"
-#include "exa_wm_yuv_rgb.g6b"
+#include "exa_wm_yuv_rgb_bt601.g6b"
 #include "exa_wm_write.g6b"
 };
 
@@ -153,14 +153,14 @@ static const uint32_t ps_kernel_planar_static_gen6[][4] = {
 static const uint32_t ps_kernel_packed_static_gen7[][4] = {
 #include "exa_wm_src_affine.g7b"
 #include "exa_wm_src_sample_argb.g7b"
-#include "exa_wm_yuv_rgb.g7b"
+#include "exa_wm_yuv_rgb_bt601.g7b"
 #include "exa_wm_write.g7b"
 };
 
 static const uint32_t ps_kernel_planar_static_gen7[][4] = {
 #include "exa_wm_src_affine.g7b"
 #include "exa_wm_src_sample_planar.g7b"
-#include "exa_wm_yuv_rgb.g7b"
+#include "exa_wm_yuv_rgb_bt601.g7b"
 #include "exa_wm_write.g7b"
 };
 
Signature · 6 lines
2.16.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

PATCH 3/8 sna/video: Add XV_COLORSPACE attribute for the textured Xv adaptor

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

Allow the client to select between BT.601 and BT.709 via the XV_COLORSPACE port attribute with the textured Xv adaptor as well.

Since the BT.601 coefficients are currently hardcoded in the yuv->rgb shader, let's just add a mostly duplicated shader with hardcoded BT.709 coefficients instead. Not the most elegant solution but avoids having to touch any state setup etc.

---
 src/render_program/Makefile.am                   |  11 +++
 src/render_program/exa_wm_yuv_rgb_bt601.g4a      |  32 ++++--
 src/render_program/exa_wm_yuv_rgb_bt601.g8a      |  31 ++++--
 src/render_program/exa_wm_yuv_rgb_bt709.g4a      | 111 +++++++++++++++++++++
 src/render_program/exa_wm_yuv_rgb_bt709.g4b      |  12 +++
 src/render_program/exa_wm_yuv_rgb_bt709.g4b.gen5 |  12 +++
 src/render_program/exa_wm_yuv_rgb_bt709.g5a      |   1 +
 src/render_program/exa_wm_yuv_rgb_bt709.g5b      |  12 +++
 src/render_program/exa_wm_yuv_rgb_bt709.g6a      |   1 +
 src/render_program/exa_wm_yuv_rgb_bt709.g6b      |  12 +++
 src/render_program/exa_wm_yuv_rgb_bt709.g7a      |   1 +
 src/render_program/exa_wm_yuv_rgb_bt709.g7b      |  12 +++
 src/render_program/exa_wm_yuv_rgb_bt709.g8a      | 118 +++++++++++++++++++++++
 src/render_program/exa_wm_yuv_rgb_bt709.g8b      |  19 ++++
 src/sna/gen4_render.c                            |  67 +++++++++++--
 src/sna/gen4_render.h                            |  11 ++-
 src/sna/gen5_render.c                            |  67 +++++++++++--
 src/sna/gen5_render.h                            |  11 ++-
 src/sna/gen6_render.c                            |  67 ++++++++++---
 src/sna/gen7_render.c                            |  53 +++++++---
 src/sna/gen8_render.c                            |  53 +++++++---
 src/sna/gen9_render.c                            |  53 +++++++---
 src/sna/sna_render.h                             |  44 ++++++---
 src/sna/sna_video_textured.c                     |  12 ++-
 24 files changed, 724 insertions(+), 99 deletions(-)
 create mode 100644 src/render_program/exa_wm_yuv_rgb_bt709.g4a
 create mode 100644 src/render_program/exa_wm_yuv_rgb_bt709.g4b
 create mode 100644 src/render_program/exa_wm_yuv_rgb_bt709.g4b.gen5
 create mode 120000 src/render_program/exa_wm_yuv_rgb_bt709.g5a
 create mode 100644 src/render_program/exa_wm_yuv_rgb_bt709.g5b
 create mode 120000 src/render_program/exa_wm_yuv_rgb_bt709.g6a
 create mode 100644 src/render_program/exa_wm_yuv_rgb_bt709.g6b
 create mode 120000 src/render_program/exa_wm_yuv_rgb_bt709.g7a
 create mode 100644 src/render_program/exa_wm_yuv_rgb_bt709.g7b
 create mode 100644 src/render_program/exa_wm_yuv_rgb_bt709.g8a
 create mode 100644 src/render_program/exa_wm_yuv_rgb_bt709.g8b
src/render_program/Makefile.am +11 -0
index 4493673435b6..dc58138f356e 100644
@@ -16,6 +16,7 @@ INTEL_G4A =				\
 	exa_wm_ca_srcalpha.g4a		\
 	exa_wm_write.g4a 		\
 	exa_wm_yuv_rgb_bt601.g4a	\
+	exa_wm_yuv_rgb_bt709.g4a	\
 	exa_wm_xy.g4a			\
 	$(NULL)
 
@@ -46,6 +47,7 @@ INTEL_G4B = 				\
 	exa_wm_ca_srcalpha.g4b		\
 	exa_wm_write.g4b 		\
 	exa_wm_yuv_rgb_bt601.g4b	\
+	exa_wm_yuv_rgb_bt709.g4b	\
 	exa_wm_xy.g4b			\
 	$(NULL)
 
@@ -68,6 +70,7 @@ INTEL_G4B_GEN5 = 				\
 	exa_wm_ca_srcalpha.g4b.gen5		\
 	exa_wm_write.g4b.gen5 			\
 	exa_wm_yuv_rgb_bt601.g4b.gen5		\
+	exa_wm_yuv_rgb_bt709.g4b.gen5		\
 	exa_wm_xy.g4b.gen5			\
 	$(NULL)
 
@@ -89,6 +92,7 @@ INTEL_G5A =				\
 	exa_wm_ca_srcalpha.g5a		\
 	exa_wm_write.g5a 		\
 	exa_wm_yuv_rgb_bt601.g5a	\
+	exa_wm_yuv_rgb_bt709.g5a	\
 	exa_wm_xy.g5a			\
 	$(NULL)
 
@@ -110,6 +114,7 @@ INTEL_G5B = 				\
 	exa_wm_ca_srcalpha.g5b		\
 	exa_wm_write.g5b 		\
 	exa_wm_yuv_rgb_bt601.g5b	\
+	exa_wm_yuv_rgb_bt709.g5b	\
 	exa_wm_xy.g5b			\
 	$(NULL)
 
@@ -134,6 +139,7 @@ INTEL_G6A =				\
 	exa_wm_noca.g6a			\
 	exa_wm_write.g6a 		\
 	exa_wm_yuv_rgb_bt601.g6a	\
+	exa_wm_yuv_rgb_bt709.g6a	\
 	$(NULL)
 
 INTEL_G6B =				\
@@ -152,6 +158,7 @@ INTEL_G6B =				\
 	exa_wm_noca.g6b			\
 	exa_wm_write.g6b 		\
 	exa_wm_yuv_rgb_bt601.g6b	\
+	exa_wm_yuv_rgb_bt709.g6b	\
 	$(NULL)
 
 INTEL_G7A =				\
@@ -167,6 +174,7 @@ INTEL_G7A =				\
 	exa_wm_src_sample_planar.g7a 	\
 	exa_wm_write.g7a 		\
 	exa_wm_yuv_rgb_bt601.g7a	\
+	exa_wm_yuv_rgb_bt709.g7a	\
 	$(NULL)
 
 INTEL_G7B =				\
@@ -182,6 +190,7 @@ INTEL_G7B =				\
 	exa_wm_src_sample_planar.g7b 	\
 	exa_wm_write.g7b 		\
 	exa_wm_yuv_rgb_bt601.g7b	\
+	exa_wm_yuv_rgb_bt709.g7b	\
 	$(NULL)
 
 INTEL_G8A =				\
@@ -191,6 +200,7 @@ INTEL_G8A =				\
 	exa_wm_src_sample_planar.g8a 	\
 	exa_wm_write.g8a 		\
 	exa_wm_yuv_rgb_bt601.g8a	\
+	exa_wm_yuv_rgb_bt709.g8a	\
 	$(NULL)
 
 INTEL_G8B =				\
@@ -200,6 +210,7 @@ INTEL_G8B =				\
 	exa_wm_src_sample_planar.g8b 	\
 	exa_wm_write.g8b 		\
 	exa_wm_yuv_rgb_bt601.g8b	\
+	exa_wm_yuv_rgb_bt709.g8b	\
 	$(NULL)
 
 EXTRA_DIST = 		\
src/render_program/exa_wm_yuv_rgb_bt601.g4a +23 -9
index 4fb2576ab5f9..7bc8dd14d9c4 100644
@@ -55,14 +55,24 @@ define(`Cbn_01',	`mask_sample_b_01')
 define(`Cbn_23',	`mask_sample_b_23')
 
     /* color space conversion function:
-     * R = Clamp ( 1.164(Y-16/255) + 1.596(Cr-128/255), 0, 1)
-     * G = Clamp ( 1.164(Y-16/255) - 0.813(Cr-128/255) - 0.392(Cb-128/255), 0, 1)
-     * B = Clamp ( 1.164(Y-16/255) + 2.017(Cb-128/255), 0, 1)
+     * Cy = 255/(235-16)
+     * R = Clamp ( 255/(235-16)(Y-16/255) +
+     *             255/112(1.0-Kr)(Cr-128/255), 0, 1)
+     * G = Clamp ( 255/(235-16)(Y-16/255) -
+     *             255/112(1.0-Kr)Kr/Kg(Cr-128/255) -
+     *             255/112(1.0-Kb)Kb/Kg(Cb-128/255), 0, 1)
+     * B = Clamp ( 255/(235-16)(Y-16/255) +
+     *             255/112(1.0-Kb)(Cb-128/255), 0, 1)
+     *
+     * BT.601:
+     * Kr = 0.299
+     * Kb = 0.114
+     * Kg = (1.0 - Kr - Kb) = 0.587
      */
 
     /* Normalize Y, Cb and Cr:
      *
-     * Yn = (Y - 16/255) * 1.164
+     * Yn = (Y - 16/255) * 255/(235-16)
      * Crn = Cr - 128 / 255
      * Cbn = Cb - 128 / 255
      */
@@ -73,21 +83,25 @@ add (16)    Crn<1>F		Cr<8,8,1>F	-0.501961F  { compr align1 };
 
 add (16)    Cbn<1>F		Cb<8,8,1>F	-0.501961F  { compr align1 };
 
-    /* 
-     * R = Y + Cr * 1.596
+    /*
+     * R = Yn +
+     *     Crn * 255/112 * (1.0 - Kr)
      */
 mov (16)    acc0<1>F		Yn<8,8,1>F		    { compr align1 };
 mac.sat(16) src_sample_r<1>F	Crn<8,8,1>F	1.596F	    { compr align1 };
-     
+
     /*
-     * G = Crn * -0.813 + Cbn * -0.392 + Y
+     * G = Yn -
+     *     Crn * 255/112 * (1.0 - Kr) * Kr / Kg -
+     *     Cbn * 255/112 * (1.0 - Kb) * Kb / Kg
      */
 mov (16)    acc0<1>F		Yn<8,8,1>F		    { compr align1 };
 mac (16)    acc0<1>F		Crn<8,8,1>F    	-0.813F	    { compr align1 };
 mac.sat(16) src_sample_g<1>F	Cbn<8,8,1>F    	-0.392F	    { compr align1 };
 
     /*
-     * B = Cbn * 2.017 + Y
+     * B = Yn +
+     *     Cbn * 255/112 * (1.0 - Kb)
      */
 mov (16)    acc0<1>F	        Yn<8,8,1>F		    { compr align1 };
 mac.sat(16) src_sample_b<1>F	Cbn<8,8,1>F     2.017F	    { compr align1 };
src/render_program/exa_wm_yuv_rgb_bt601.g8a +22 -9
index 34973ba88592..360501dc9653 100644
@@ -55,14 +55,23 @@ define(`Cbn_01',	`mask_sample_b_01')
 define(`Cbn_23',	`mask_sample_b_23')
 
     /* color space conversion function:
-     * R = Clamp ( 1.164(Y-16/255) + 1.596(Cr-128/255), 0, 1)
-     * G = Clamp ( 1.164(Y-16/255) - 0.813(Cr-128/255) - 0.392(Cb-128/255), 0, 1)
-     * B = Clamp ( 1.164(Y-16/255) + 2.017(Cb-128/255), 0, 1)
+     * R = Clamp ( 255/(235-16)(Y-16/255) +
+     *             255/112(1.0-Kr)(Cr-128/255), 0, 1)
+     * G = Clamp ( 255/(235-16)(Y-16/255) -
+     *             255/112(1.0-Kr)Kr/Kg(Cr-128/255) -
+     *             255/112(1.0-Kb)Kb/Kg(Cb-128/255), 0, 1)
+     * B = Clamp ( 255/(235-16)(Y-16/255) +
+     *             255/112(1.0-Kb)(Cb-128/255), 0, 1)
+     *
+     * BT.601:
+     * Kr = 0.299
+     * Kb = 0.114
+     * Kg = (1.0 - Kr - Kb) = 0.587
      */
 
     /* Normalize Y, Cb and Cr:
      *
-     * Yn = (Y - 16/255) * 1.164
+     * Yn = (Y - 16/255) * 255/(235-16)
      * Crn = Cr - 128 / 255
      * Cbn = Cb - 128 / 255
      */
@@ -73,16 +82,19 @@ add (16)    Crn<1>F		Cr<8,8,1>F	-0.501961F  { compr align1 };
 
 add (16)    Cbn<1>F		Cb<8,8,1>F	-0.501961F  { compr align1 };
 
-    /* 
-     * R = Y + Cr * 1.596
+    /*
+     * R = Yn +
+     *     Crn * 255/112 * (1.0 - Kr)
      */
 mov (8)    acc0<1>F		Yn_01<8,8,1>F		    { compr align1 };
 mac.sat(8) src_sample_r_01<1>F	Crn_01<8,8,1>F	1.596F	    { compr align1 };
-     
+
 mov (8)    acc0<1>F		Yn_23<8,8,1>F		    { compr align1 };
 mac.sat(8) src_sample_r_23<1>F	Crn_23<8,8,1>F	1.596F	    { compr align1 };
     /*
-     * G = Crn * -0.813 + Cbn * -0.392 + Y
+     * G = Yn -
+     *     Crn * 255/112 * (1.0 - Kr) * Kr / Kg -
+     *     Cbn * 255/112 * (1.0 - Kb) * Kb / Kg
      */
 mov (8)    acc0<1>F		Yn_01<8,8,1>F		    { compr align1 };
 mac (8)    acc0<1>F		Crn_01<8,8,1>F    	-0.813F	    { compr align1 };
@@ -92,7 +104,8 @@ mov (8)    acc0<1>F		Yn_23<8,8,1>F	    { compr align1 };
 mac (8)    acc0<1>F		Crn_23<8,8,1>F    	-0.813F	    { compr align1 };
 mac.sat(16) src_sample_g_23<1>F	Cbn_23<8,8,1>F    	-0.392F	    { compr align1 };
     /*
-     * B = Cbn * 2.017 + Y
+     * B = Yn +
+     *     Cbn * 255/112 * (1.0 - Kb)
      */
 mov (8)    acc0<1>F	        Yn_01<8,8,1>F		    { compr align1 };
 mac.sat(8) src_sample_b_01<1>F	Cbn_01<8,8,1>F     2.017F	    { compr align1 };
src/render_program/exa_wm_yuv_rgb_bt709.g4a new file +111 -0

111 lines not on this page · raw message

src/render_program/exa_wm_yuv_rgb_bt709.g4b new file +12 -0
new file mode 100644
index 000000000000..5b7621b54b43
@@ -0,0 +1,12 @@
+   { 0x00802040, 0x23007fbd, 0x008d0200, 0xbd808081 },
+   { 0x00802041, 0x23007fbd, 0x008d0300, 0x3f94fdf4 },
+   { 0x00802040, 0x22c07fbd, 0x008d01c0, 0xbf008084 },
+   { 0x00802040, 0x23407fbd, 0x008d0240, 0xbf008084 },
+   { 0x00802001, 0x240003bc, 0x008d0300, 0x00000000 },
+   { 0x80802048, 0x21c07fbd, 0x008d02c0, 0x3fe58106 },
+   { 0x00802001, 0x240003bc, 0x008d0300, 0x00000000 },
+   { 0x00802048, 0x24007fbc, 0x008d02c0, 0xbf0872b0 },
+   { 0x80802048, 0x22007fbd, 0x008d0340, 0xbe5a1cac },
+   { 0x00802001, 0x240003bc, 0x008d0300, 0x00000000 },
+   { 0x80802048, 0x22407fbd, 0x008d0340, 0x40072b02 },
+   { 0x00802001, 0x228003fd, 0x00000000, 0x3f800000 },
src/render_program/exa_wm_yuv_rgb_bt709.g4b.gen5 new file +12 -0
new file mode 100644
index 000000000000..5b7621b54b43
@@ -0,0 +1,12 @@
+   { 0x00802040, 0x23007fbd, 0x008d0200, 0xbd808081 },
+   { 0x00802041, 0x23007fbd, 0x008d0300, 0x3f94fdf4 },
+   { 0x00802040, 0x22c07fbd, 0x008d01c0, 0xbf008084 },
+   { 0x00802040, 0x23407fbd, 0x008d0240, 0xbf008084 },
+   { 0x00802001, 0x240003bc, 0x008d0300, 0x00000000 },
+   { 0x80802048, 0x21c07fbd, 0x008d02c0, 0x3fe58106 },
+   { 0x00802001, 0x240003bc, 0x008d0300, 0x00000000 },
+   { 0x00802048, 0x24007fbc, 0x008d02c0, 0xbf0872b0 },
+   { 0x80802048, 0x22007fbd, 0x008d0340, 0xbe5a1cac },
+   { 0x00802001, 0x240003bc, 0x008d0300, 0x00000000 },
+   { 0x80802048, 0x22407fbd, 0x008d0340, 0x40072b02 },
+   { 0x00802001, 0x228003fd, 0x00000000, 0x3f800000 },
src/render_program/exa_wm_yuv_rgb_bt709.g5a new file +1 -0
new file mode 120000
index 000000000000..9b4ca31203c3
@@ -0,0 +1 @@
+exa_wm_yuv_rgb_bt709.g4a
\ No newline at end of file
src/render_program/exa_wm_yuv_rgb_bt709.g5b new file +12 -0
new file mode 100644
index 000000000000..5b7621b54b43
@@ -0,0 +1,12 @@
+   { 0x00802040, 0x23007fbd, 0x008d0200, 0xbd808081 },
+   { 0x00802041, 0x23007fbd, 0x008d0300, 0x3f94fdf4 },
+   { 0x00802040, 0x22c07fbd, 0x008d01c0, 0xbf008084 },
+   { 0x00802040, 0x23407fbd, 0x008d0240, 0xbf008084 },
+   { 0x00802001, 0x240003bc, 0x008d0300, 0x00000000 },
+   { 0x80802048, 0x21c07fbd, 0x008d02c0, 0x3fe58106 },
+   { 0x00802001, 0x240003bc, 0x008d0300, 0x00000000 },
+   { 0x00802048, 0x24007fbc, 0x008d02c0, 0xbf0872b0 },
+   { 0x80802048, 0x22007fbd, 0x008d0340, 0xbe5a1cac },
+   { 0x00802001, 0x240003bc, 0x008d0300, 0x00000000 },
+   { 0x80802048, 0x22407fbd, 0x008d0340, 0x40072b02 },
+   { 0x00802001, 0x228003fd, 0x00000000, 0x3f800000 },
src/render_program/exa_wm_yuv_rgb_bt709.g6a new file +1 -0
new file mode 120000
index 000000000000..9b4ca31203c3
@@ -0,0 +1 @@
+exa_wm_yuv_rgb_bt709.g4a
\ No newline at end of file
src/render_program/exa_wm_yuv_rgb_bt709.g6b new file +12 -0
new file mode 100644
index 000000000000..392957e70c38
@@ -0,0 +1,12 @@
+   { 0x00800040, 0x23007fbd, 0x008d0200, 0xbd808081 },
+   { 0x00800041, 0x23007fbd, 0x008d0300, 0x3f94fdf4 },
+   { 0x00800040, 0x22c07fbd, 0x008d01c0, 0xbf008084 },
+   { 0x00800040, 0x23407fbd, 0x008d0240, 0xbf008084 },
+   { 0x00800001, 0x240003bc, 0x008d0300, 0x00000000 },
+   { 0x80800048, 0x21c07fbd, 0x008d02c0, 0x3fe58106 },
+   { 0x00800001, 0x240003bc, 0x008d0300, 0x00000000 },
+   { 0x00800048, 0x24007fbc, 0x008d02c0, 0xbf0872b0 },
+   { 0x80800048, 0x22007fbd, 0x008d0340, 0xbe5a1cac },
+   { 0x00800001, 0x240003bc, 0x008d0300, 0x00000000 },
+   { 0x80800048, 0x22407fbd, 0x008d0340, 0x40072b02 },
+   { 0x00800001, 0x228003fd, 0x00000000, 0x3f800000 },
src/render_program/exa_wm_yuv_rgb_bt709.g7a new file +1 -0
new file mode 120000
index 000000000000..9b4ca31203c3
@@ -0,0 +1 @@
+exa_wm_yuv_rgb_bt709.g4a
\ No newline at end of file
src/render_program/exa_wm_yuv_rgb_bt709.g7b new file +12 -0
new file mode 100644
index 000000000000..392957e70c38
@@ -0,0 +1,12 @@
+   { 0x00800040, 0x23007fbd, 0x008d0200, 0xbd808081 },
+   { 0x00800041, 0x23007fbd, 0x008d0300, 0x3f94fdf4 },
+   { 0x00800040, 0x22c07fbd, 0x008d01c0, 0xbf008084 },
+   { 0x00800040, 0x23407fbd, 0x008d0240, 0xbf008084 },
+   { 0x00800001, 0x240003bc, 0x008d0300, 0x00000000 },
+   { 0x80800048, 0x21c07fbd, 0x008d02c0, 0x3fe58106 },
+   { 0x00800001, 0x240003bc, 0x008d0300, 0x00000000 },
+   { 0x00800048, 0x24007fbc, 0x008d02c0, 0xbf0872b0 },
+   { 0x80800048, 0x22007fbd, 0x008d0340, 0xbe5a1cac },
+   { 0x00800001, 0x240003bc, 0x008d0300, 0x00000000 },
+   { 0x80800048, 0x22407fbd, 0x008d0340, 0x40072b02 },
+   { 0x00800001, 0x228003fd, 0x00000000, 0x3f800000 },
src/render_program/exa_wm_yuv_rgb_bt709.g8a new file +118 -0

118 lines not on this page · raw message

src/render_program/exa_wm_yuv_rgb_bt709.g8b new file +19 -0
new file mode 100644
index 000000000000..9bfe1ca4b919
@@ -0,0 +1,19 @@
+   { 0x00800040, 0x23003ae8, 0x3e8d0200, 0xbd808081 },
+   { 0x00800041, 0x23003ae8, 0x3e8d0300, 0x3f94fdf4 },
+   { 0x00800040, 0x22c03ae8, 0x3e8d01c0, 0xbf008084 },
+   { 0x00800040, 0x23403ae8, 0x3e8d0240, 0xbf008084 },
+   { 0x00600001, 0x24003ae0, 0x008d0300, 0x00000000 },
+   { 0x80600048, 0x21c03ae8, 0x3e8d02c0, 0x3fe58106 },
+   { 0x00600001, 0x24003ae0, 0x008d0320, 0x00000000 },
+   { 0x80600048, 0x21e03ae8, 0x3e8d02e0, 0x3fe58106 },
+   { 0x00600001, 0x24003ae0, 0x008d0300, 0x00000000 },
+   { 0x00600048, 0x24003ae0, 0x3e8d02c0, 0xbf0872b0 },
+   { 0x80600048, 0x22003ae8, 0x3e8d0340, 0xbe5a1cac },
+   { 0x00600001, 0x24003ae0, 0x008d0320, 0x00000000 },
+   { 0x00600048, 0x24003ae0, 0x3e8d02e0, 0xbf0872b0 },
+   { 0x80800048, 0x22203ae8, 0x3e8d0360, 0xbe5a1cac },
+   { 0x00600001, 0x24003ae0, 0x008d0300, 0x00000000 },
+   { 0x80600048, 0x22403ae8, 0x3e8d0340, 0x40072b02 },
+   { 0x00600001, 0x24003ae0, 0x008d0320, 0x00000000 },
+   { 0x80600048, 0x22603ae8, 0x3e8d0360, 0x40072b02 },
+   { 0x00800001, 0x22803ee8, 0x38000000, 0x3f800000 },
src/sna/gen4_render.c +58 -9

109 lines not on this page · raw message

src/sna/gen4_render.h +8 -3
index 3b37f96adc74..f516c316c096 100644
@@ -2685,9 +2685,14 @@ typedef enum {
 	WM_KERNEL_OPACITY,
 	WM_KERNEL_OPACITY_P,
 
-	WM_KERNEL_VIDEO_PLANAR,
-	WM_KERNEL_VIDEO_NV12,
-	WM_KERNEL_VIDEO_PACKED,
+	WM_KERNEL_VIDEO_PLANAR_BT601,
+	WM_KERNEL_VIDEO_NV12_BT601,
+	WM_KERNEL_VIDEO_PACKED_BT601,
+
+	WM_KERNEL_VIDEO_PLANAR_BT709,
+	WM_KERNEL_VIDEO_NV12_BT709,
+	WM_KERNEL_VIDEO_PACKED_BT709,
+
 	KERNEL_COUNT
 } wm_kernel_t;
 
src/sna/gen5_render.c +58 -9

109 lines not on this page · raw message

src/sna/gen5_render.h +8 -3
index f1a9a68c2e71..8901480a6d0f 100644
@@ -2765,9 +2765,14 @@ typedef enum {
 	WM_KERNEL_OPACITY,
 	WM_KERNEL_OPACITY_P,
 
-	WM_KERNEL_VIDEO_PLANAR,
-	WM_KERNEL_VIDEO_NV12,
-	WM_KERNEL_VIDEO_PACKED,
+	WM_KERNEL_VIDEO_PLANAR_BT601,
+	WM_KERNEL_VIDEO_NV12_BT601,
+	WM_KERNEL_VIDEO_PACKED_BT601,
+
+	WM_KERNEL_VIDEO_PLANAR_BT709,
+	WM_KERNEL_VIDEO_NV12_BT709,
+	WM_KERNEL_VIDEO_PACKED_BT709,
+
 	KERNEL_COUNT
 } wm_kernel_t;
 #endif
src/sna/gen6_render.c +56 -11

109 lines not on this page · raw message

src/sna/gen7_render.c +42 -11

108 lines not on this page · raw message

src/sna/gen8_render.c +42 -11

108 lines not on this page · raw message

src/sna/gen9_render.c +42 -11

108 lines not on this page · raw message

src/sna/sna_render.h +32 -12

68 lines not on this page · raw message

src/sna/sna_video_textured.c +11 -1
index bcd4232024e0..a784fe2ec0f4 100644
@@ -36,7 +36,7 @@
 
 #define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, true)
 
-static Atom xvBrightness, xvContrast, xvSyncToVblank;
+static Atom xvBrightness, xvContrast, xvSyncToVblank, xvColorspace;
 
 static XvFormatRec Formats[] = {
 	{15}, {16}, {24}
@@ -44,6 +44,7 @@ static XvFormatRec Formats[] = {
 
 static const XvAttributeRec Attributes[] = {
 	{XvSettable | XvGettable, -1, 1, (char *)"XV_SYNC_TO_VBLANK"},
+	{XvSettable | XvGettable, 0, 1, (char *)"XV_COLORSPACE"}, /* BT.601, BT.709 */
 	//{XvSettable | XvGettable, -128, 127, (char *)"XV_BRIGHTNESS"},
 	//{XvSettable | XvGettable, 0, 255, (char *)"XV_CONTRAST"},
 };
@@ -102,6 +103,11 @@ sna_video_textured_set_attribute(ddSetPortAttribute_ARGS)
 			return BadValue;
 
 		video->SyncToVblank = value;
+	} else if (attribute == xvColorspace) {
+		if (value < 0 || value > 1)
+			return BadValue;
+
+		video->colorspace = value;
 	} else
 		return BadMatch;
 
@@ -119,6 +125,8 @@ sna_video_textured_get_attribute(ddGetPortAttribute_ARGS)
 		*value = video->contrast;
 	else if (attribute == xvSyncToVblank)
 		*value = video->SyncToVblank;
+	else if (attribute == xvColorspace)
+		*value = video->colorspace;
 	else
 		return BadMatch;
 
@@ -426,6 +434,7 @@ void sna_video_textured_setup(struct sna *sna, ScreenPtr screen)
 		v->sna = sna;
 		v->textured = true;
 		v->alignment = 4;
+		v->colorspace = 1; /* BT.709 */
 		v->SyncToVblank = (sna->flags & SNA_NO_WAIT) == 0;
 
 		RegionNull(&v->clip);
@@ -446,6 +455,7 @@ void sna_video_textured_setup(struct sna *sna, ScreenPtr screen)
 
 	xvBrightness = MAKE_ATOM("XV_BRIGHTNESS");
 	xvContrast = MAKE_ATOM("XV_CONTRAST");
+	xvColorspace = MAKE_ATOM("XV_COLORSPACE");
 	xvSyncToVblank = MAKE_ATOM("XV_SYNC_TO_VBLANK");
 
 	DBG(("%s: '%s' initialized %d ports\n", __FUNCTION__, adaptor->name, adaptor->nPorts));
Signature · 6 lines
2.16.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

PATCH 4/8 sna/video/sprite: Add sprite planes in order

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

On SKL+ dst color keying only works between the first sprite and the primary. We probably wante the first Xv port to be the first sprite plane so that the user gets working colorkeying for the port that is most likely to be used first. No way to get dst colorkeying with the other ports :(

---
 src/sna/sna_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/sna/sna_display.c +1 -1
index 62cd3ab5b44c..66a941ae7301 100644
@@ -3475,7 +3475,7 @@ static void add_sprite_plane(struct sna_crtc *crtc,
 		return;
 
 	memcpy(sprite, details, sizeof(*sprite));
-	list_add(&sprite->link, &crtc->sprites);
+	list_add_tail(&sprite->link, &crtc->sprites);
 }
 
 static void
Signature · 6 lines
2.16.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw

PATCH 5/8 sna/video/sprite: Query planes for RGB565

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

Not all sprite planes support RGB565. Insrtead of hardcoding which platforms have it let's ask the kernel instead.

---
 src/sna/sna.h              |  1 +
 src/sna/sna_display.c      | 76 ++++++++++++++++++++++++++++++++++++++++++++++
 src/sna/sna_video_sprite.c |  2 +-
 3 files changed, 78 insertions(+), 1 deletion(-)
src/sna/sna.h +1 -0
index 6fe1f0d252e6..496460ca6a84 100644
@@ -636,6 +636,7 @@ extern bool sna_crtc_set_sprite_rotation(xf86CrtcPtr crtc, unsigned idx, uint32_
 extern void sna_crtc_set_sprite_colorspace(xf86CrtcPtr crtc, unsigned idx, int colorspace);
 extern uint32_t sna_crtc_to_sprite(xf86CrtcPtr crtc, unsigned idx);
 extern bool sna_crtc_is_transformed(xf86CrtcPtr crtc);
+bool sna_has_sprite_format(struct sna *sna, uint32_t format);
 
 #define CRTC_VBLANK 0x7
 #define CRTC_ON 0x80000000
src/sna/sna_display.c +76 -0

82 lines not on this page · raw message

src/sna/sna_video_sprite.c +1 -1
index 56391aa6f581..a4f3205b6fc9 100644
@@ -754,7 +754,7 @@ void sna_video_sprite_setup(struct sna *sna, ScreenPtr screen)
 	adaptor->pAttributes = (XvAttributeRec *)attribs;
 	adaptor->pImages = (XvImageRec *)images;
 	adaptor->nImages = 3;
-	if (sna->kgem.gen == 071)
+	if (sna_has_sprite_format(sna, DRM_FORMAT_RGB565))
 		adaptor->nImages = 4;
 
 #if XORG_XV_VERSION < 2
Signature · 6 lines
2.16.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

PATCH 6/8 sna/video/sprite: Add NV12 support

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

Starting from ~KBL planes can do NV12. Let's make use that capability in the sprite Xv adaptor.

---
 src/sna/sna_video_sprite.c | 57 +++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 49 insertions(+), 8 deletions(-)
src/sna/sna_video_sprite.c +49 -8
index a4f3205b6fc9..f6d6f0b45b6c 100644
@@ -46,6 +46,7 @@
 #define DRM_FORMAT_XRGB8888     fourcc_code('X', 'R', '2', '4') /* [31:0] x:R:G:B 8:8:8:8 little endian */
 #define DRM_FORMAT_YUYV         fourcc_code('Y', 'U', 'Y', 'V') /* [31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian */
 #define DRM_FORMAT_UYVY         fourcc_code('U', 'Y', 'V', 'Y') /* [31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian */
+#define DRM_FORMAT_NV12         fourcc_code('N', 'V', '1', '2') /* 2x2 subsampled Cr:Cb plane */
 
 #define has_hw_scaling(sna, video) ((sna)->kgem.gen < 071 || \
 				    ((sna)->kgem.gen >= 0110 && (video)->AlwaysOnTop))
@@ -72,7 +73,12 @@ struct local_mode_set_plane {
 static Atom xvColorKey, xvAlwaysOnTop, xvSyncToVblank, xvColorspace;
 
 static XvFormatRec formats[] = { {15}, {16}, {24} };
-static const XvImageRec images[] = { XVIMAGE_YUY2, XVIMAGE_UYVY, XVMC_RGB888, XVMC_RGB565 };
+static const XvImageRec images[] = { XVIMAGE_YUY2, XVIMAGE_UYVY,
+				     XVMC_RGB888 };
+static const XvImageRec images_rgb565[] = { XVIMAGE_YUY2, XVIMAGE_UYVY,
+					    XVMC_RGB888, XVMC_RGB565 };
+static const XvImageRec images_nv12[] = { XVIMAGE_YUY2, XVIMAGE_UYVY,
+					  XVIMAGE_NV12, XVMC_RGB888, XVMC_RGB565 };
 static const XvAttributeRec attribs[] = {
 	{ XvSettable | XvGettable, 0, 1, (char *)"XV_COLORSPACE" }, /* BT.601, BT.709 */
 	{ XvSettable | XvGettable, 0, 0xffffff, (char *)"XV_COLORKEY" },
@@ -307,8 +313,6 @@ sna_video_sprite_show(struct sna *sna,
 		f.width = frame->width;
 		f.height = frame->height;
 		f.flags = 1 << 1; /* +modifiers */
-		f.handles[0] = frame->bo->handle;
-		f.pitches[0] = frame->pitch[0];
 
 		switch (frame->bo->tiling) {
 		case I915_TILING_NONE:
@@ -323,6 +327,18 @@ sna_video_sprite_show(struct sna *sna,
 			break;
 		}
 
+		if (is_nv12_fourcc(frame->id)) {
+			f.handles[0] = frame->bo->handle;
+			f.handles[1] = frame->bo->handle;
+			f.pitches[0] = frame->pitch[1];
+			f.pitches[1] = frame->pitch[0];
+			f.offsets[0] = 0;
+			f.offsets[1] = frame->UBufOffset;
+		} else {
+			f.handles[0] = frame->bo->handle;
+			f.pitches[0] = frame->pitch[0];
+		}
+
 		switch (frame->id) {
 		case FOURCC_RGB565:
 			f.pixel_format = DRM_FORMAT_RGB565;
@@ -332,6 +348,9 @@ sna_video_sprite_show(struct sna *sna,
 			f.pixel_format = DRM_FORMAT_XRGB8888;
 			purged = sna->scrn->depth != 24;
 			break;
+		case FOURCC_NV12:
+			f.pixel_format = DRM_FORMAT_NV12;
+			break;
 		case FOURCC_UYVY:
 			f.pixel_format = DRM_FORMAT_UYVY;
 			break;
@@ -633,7 +652,7 @@ static int sna_video_sprite_query(ddQueryImageAttributes_ARGS)
 {
 	struct sna_video *video = port->devPriv.ptr;
 	struct sna_video_frame frame;
-	int size;
+	int size, tmp;
 
 	if (*w > video->sna->mode.max_crtc_width)
 		*w = video->sna->mode.max_crtc_width;
@@ -654,6 +673,21 @@ static int sna_video_sprite_query(ddQueryImageAttributes_ARGS)
 		size = 4;
 		break;
 
+	case FOURCC_NV12:
+		*h = (*h + 1) & ~1;
+		size = (*w + 3) & ~3;
+		if (pitches)
+			pitches[0] = size;
+		size *= *h;
+		if (offsets)
+			offsets[1] = size;
+		tmp = (*w + 3) & ~3;
+		if (pitches)
+			pitches[1] = tmp;
+		tmp *= (*h >> 1);
+		size += tmp;
+		break;
+
 	default:
 		*w = (*w + 1) & ~1;
 		*h = (*h + 1) & ~1;
@@ -752,10 +786,17 @@ void sna_video_sprite_setup(struct sna *sna, ScreenPtr screen)
 						 ARRAY_SIZE(formats));
 	adaptor->nAttributes = ARRAY_SIZE(attribs);
 	adaptor->pAttributes = (XvAttributeRec *)attribs;
-	adaptor->pImages = (XvImageRec *)images;
-	adaptor->nImages = 3;
-	if (sna_has_sprite_format(sna, DRM_FORMAT_RGB565))
-		adaptor->nImages = 4;
+
+	if (sna_has_sprite_format(sna, DRM_FORMAT_NV12)) {
+		adaptor->pImages = (XvImageRec *)images_nv12;
+		adaptor->nImages = ARRAY_SIZE(images_nv12);
+	} else if (sna_has_sprite_format(sna, DRM_FORMAT_RGB565)) {
+		adaptor->pImages = (XvImageRec *)images_rgb565;
+		adaptor->nImages = ARRAY_SIZE(images_rgb565);
+	} else {
+		adaptor->pImages = (XvImageRec *)images;
+		adaptor->nImages = ARRAY_SIZE(images);
+	}
 
 #if XORG_XV_VERSION < 2
 	adaptor->ddAllocatePort = sna_xv_alloc_port;
Signature · 6 lines
2.16.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw

PATCH 7/8 sna/video/sprite: Make NV12 take the GPU scaling fallback

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

Even unscaled NV12 needs the plane scaler on SKL+, so when unscaled NV12 setplane fails we should still take the GPU scaling fallback path.

---
 src/sna/sna_video_sprite.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
src/sna/sna_video_sprite.c +10 -2
index f6d6f0b45b6c..0f52f0328fc0 100644
@@ -415,6 +415,15 @@ sna_video_sprite_show(struct sna *sna,
 	return true;
 }
 
+static bool need_scaling(const struct sna_video_frame *frame,
+			 const BoxRec *dst)
+{
+	/* SKL+ need the plane scaler even for unscaled NV12 */
+	return frame->id == FOURCC_NV12 ||
+		frame->src.x2 - frame->src.x1 != dst->x2 - dst->x1 ||
+		frame->src.y2 - frame->src.y1 != dst->y2 - dst->y1;
+}
+
 static int sna_video_sprite_put_image(ddPutImage_ARGS)
 {
 	struct sna_video *video = port->devPriv.ptr;
@@ -562,8 +571,7 @@ off:
 		}
 
 		if (!hw_scaling && sna->render.video &&
-		    !((frame.src.x2 - frame.src.x1) == (dst.x2 - dst.x1) &&
-		      (frame.src.y2 - frame.src.y1) == (dst.y2 - dst.y1))) {
+		    need_scaling(&frame, &dst)) {
 			ScreenPtr screen = to_screen_from_sna(sna);
 			PixmapPtr scaled;
 			RegionRec r;
Signature · 6 lines
2.16.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

PATCH 8/8 sna/video/sprite: Try disabling plane before giving up on colorkey

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

When we're trying to reinstate the colorkey we might fail on account of the plane still being enable with a configuration that prevent the use of colorkey. This happens easily with NV12 since the plane scaler required by even unscaled NV12 is not compatible with colorkey.

To work around the problem let's try disabling the plane first, then re-enable the colorkey, and finally we will try to re-enable the plane. The plane re-enable may fail, in which case we'll head to the GPU scaling fallback path. The cost is a flash of the colorkey when the plane blink off and then back on.

Help me atomic ioctl, you're my only hope!

---
 src/sna/sna_video_sprite.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
src/sna/sna_video_sprite.c +13 -3
index 0f52f0328fc0..f713abcb9151 100644
@@ -270,9 +270,19 @@ sna_video_sprite_show(struct sna *sna,
 		if (drmIoctl(sna->kgem.fd,
 			     LOCAL_IOCTL_I915_SET_SPRITE_COLORKEY,
 			     &set)) {
-			xf86DrvMsg(sna->scrn->scrnIndex, X_ERROR,
-				   "failed to update color key, disabling future updates\n");
-			video->has_color_key = false;
+			memset(&s, 0, sizeof(s));
+			s.plane_id = sna_crtc_to_sprite(crtc, video->idx);
+
+			/* try to disable the plane first */
+			if (drmIoctl(video->sna->kgem.fd, LOCAL_IOCTL_MODE_SETPLANE, &s))
+				xf86DrvMsg(video->sna->scrn->scrnIndex, X_ERROR,
+					   "failed to disable plane\n");
+
+			if (drmIoctl(sna->kgem.fd, LOCAL_IOCTL_I915_SET_SPRITE_COLORKEY, &set)) {
+				xf86DrvMsg(sna->scrn->scrnIndex, X_ERROR,
+					   "failed to update color key, disabling future updates\n");
+				video->has_color_key = false;
+			}
 		}
 
 		video->color_key_changed &= ~(1 << pipe);
Signature · 6 lines
2.16.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 8/8
#8 lore raw

Re: [PATCH xf86-video-intel 8/8] sna/video/sprite: Try disabling plane before giving up on colorkey

Quoting Ville Syrjala (2018-05-29 19:33:15)

Quoted 13 lines

From: Ville Syrjälä <[email protected]>

When we're trying to reinstate the colorkey we might fail on account of the plane still being enable with a configuration that prevent the use of colorkey. This happens easily with NV12 since the plane scaler required by even unscaled NV12 is not compatible with colorkey.

To work around the problem let's try disabling the plane first, then re-enable the colorkey, and finally we will try to re-enable the plane. The plane re-enable may fail, in which case we'll head to the GPU scaling fallback path. The cost is a flash of the colorkey when the plane blink off and then back on.

Quoted 3 lines

Help me atomic ioctl, you're my only hope!

Though I glazed over at the asm patches, I concur that merely adding further crud is the easiest way to add colorspace encoding support. The rest of the patches looked fine, so the series is

Thanks,
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#9 lore raw

Re: [PATCH xf86-video-intel 8/8] sna/video/sprite: Try disabling plane before giving up on colorkey

Quoting Chris Wilson (2018-05-31 10:30:13)

Quoted 18 lines

Quoting Ville Syrjala (2018-05-29 19:33:15)

Quoted 13 lines

From: Ville Syrjälä <[email protected]>

When we're trying to reinstate the colorkey we might fail on account of the plane still being enable with a configuration that prevent the use of colorkey. This happens easily with NV12 since the plane scaler required by even unscaled NV12 is not compatible with colorkey.

To work around the problem let's try disabling the plane first, then re-enable the colorkey, and finally we will try to re-enable the plane. The plane re-enable may fail, in which case we'll head to the GPU scaling fallback path. The cost is a flash of the colorkey when the plane blink off and then back on.

Quoted 3 lines

Help me atomic ioctl, you're my only hope!

Quoted 7 lines

Though I glazed over at the asm patches, I concur that merely adding further crud is the easiest way to add colorspace encoding support. The rest of the patches looked fine, so the series is

Thanks,

And pushed, double thanks.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx