Skip to contentSkip to conversation

sna: Added AYUV format support for textured and sprite video adapters.

PATCH Superseded Stanislav Lisovskiy 2 participants 3 messages Oct 4, 2018 – Oct 5, 2018

v2 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 sna: Added AYUV format support for textured and sprite video adapters.

sna/gen9+: Had to split out wm_kernel from the sna_composite_op flags, otherwise new shader kernels go beyond existing flags field.

v2: Renamed DRM_FORMAT_XYUV to DRM_FORMAT_XYUV8888.
Added comment about AYUV byte ordering in Gstreamer.

---
 src/render_program/Makefile.am                |   2 +
 .../exa_wm_src_sample_argb_ayuv.g8a           |  60 +++++++
 .../exa_wm_src_sample_argb_ayuv.g8b           |   6 +
 src/sna/gen9_render.c                         |  62 ++++++--
 src/sna/sna_render.h                          |   8 +
 src/sna/sna_video.c                           | 147 ++++++++++++++++++
 src/sna/sna_video.h                           |  20 +++
 src/sna/sna_video_sprite.c                    |  19 ++-
 src/sna/sna_video_textured.c                  |   8 +
 9 files changed, 314 insertions(+), 18 deletions(-)
 create mode 100644 src/render_program/exa_wm_src_sample_argb_ayuv.g8a
 create mode 100644 src/render_program/exa_wm_src_sample_argb_ayuv.g8b
src/render_program/Makefile.am +2 -0
index dc58138f..e35ffa52 100644
@@ -196,6 +196,7 @@ INTEL_G7B =				\
 INTEL_G8A =				\
 	exa_wm_src_affine.g8a 		\
 	exa_wm_src_sample_argb.g8a 	\
+	exa_wm_src_sample_argb_ayuv.g8a \
 	exa_wm_src_sample_nv12.g8a 	\
 	exa_wm_src_sample_planar.g8a 	\
 	exa_wm_write.g8a 		\
@@ -205,6 +206,7 @@ INTEL_G8A =				\
 
 INTEL_G8B =				\
 	exa_wm_src_affine.g8b 		\
+	exa_wm_src_sample_argb_ayuv.g8b \
 	exa_wm_src_sample_argb.g8b 	\
 	exa_wm_src_sample_nv12.g8b 	\
 	exa_wm_src_sample_planar.g8b 	\
src/render_program/exa_wm_src_sample_argb_ayuv.g8a new file +60 -0

60 lines not on this page · raw message

src/render_program/exa_wm_src_sample_argb_ayuv.g8b new file +6 -0
new file mode 100644
index 00000000..4f439141
@@ -0,0 +1,6 @@
+   { 0x00000001, 0x2008060c, 0x00000000, 0x00000000 },
+   { 0x00600001, 0x28200208, 0x008d0000, 0x00000000 },
+   { 0x02800031, 0x21c00a48, 0x06000820, 0x0a8c0001 },
+   { 0x00800001, 0x22400208, 0x002001c0, 0x00000000 },
+   { 0x00800001, 0x21c00208, 0x00200280, 0x00000000 },
+   { 0x00800001, 0x22803ee8, 0x38000000, 0x3f800000 },
src/sna/gen9_render.c +49 -13

183 lines not on this page · raw message

src/sna/sna_render.h +8 -0
index 6669af9d..ef88d1f9 100644
@@ -139,20 +139,25 @@ struct sna_composite_op {
 
 		struct {
 			uint32_t flags;
+			uint8_t wm_kernel;
 		} gen6;
 
 		struct {
 			uint32_t flags;
+			uint8_t wm_kernel;
 		} gen7;
 
 		struct {
 			uint32_t flags;
+			uint8_t wm_kernel;
 		} gen8;
 
 		struct {
 			uint32_t flags;
+			uint8_t wm_kernel;
 		} gen9;
 	} u;
+	unsigned long gen9_kernel;
 
 	void *priv;
 };
@@ -616,6 +621,9 @@ enum {
 	GEN9_WM_KERNEL_VIDEO_NV12_BT709,
 	GEN9_WM_KERNEL_VIDEO_PACKED_BT709,
 
+	GEN9_WM_KERNEL_VIDEO_PACKED_AYUV_BT601,
+	GEN9_WM_KERNEL_VIDEO_PACKED_AYUV_BT709,
+
 	GEN9_WM_KERNEL_VIDEO_RGB,
 	GEN9_WM_KERNEL_COUNT
 };
src/sna/sna_video.c +147 -0

165 lines not on this page · raw message

src/sna/sna_video.h +20 -0
index bbd3f0fd..d18c79e5 100644
@@ -39,6 +39,7 @@ THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define FOURCC_RGB565 ((16 << 24) + ('B' << 16) + ('G' << 8) + 'R')
 #define FOURCC_RGB888 ((24 << 24) + ('B' << 16) + ('G' << 8) + 'R')
 #define FOURCC_NV12 (('2' << 24) + ('1' << 16) + ('V' << 8) + 'N')
+#define FOURCC_AYUV (('V' << 24) + ('U' << 16) + ('Y' << 8) + 'A')
 
 /*
  * Below, a dummy picture type that is used in XvPutImage
@@ -79,6 +80,15 @@ THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 	XvTopToBottom \
 }
 
+#define XVIMAGE_AYUV { \
+	FOURCC_AYUV, XvYUV, LSBFirst, \
+	{'P', 'A', 'S', 'S', 'T', 'H', 'R', 'O', 'U', 'G', 'H', ' ', 'A', 'Y', 'U', 'V'}, \
+	32, XvPacked, 1, 24, 0xff<<16, 0xff<<8, 0xff<<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
+	{'V', 'U', 'Y', 'X', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, \
+	XvTopToBottom \
+}
+
+
 struct sna_video {
 	struct sna *sna;
 
@@ -189,6 +199,16 @@ static inline int is_nv12_fourcc(int id)
 	}
 }
 
+static inline int is_ayuv_fourcc(int id)
+{
+	switch (id) {
+	case FOURCC_AYUV:
+		return 1;
+	default:
+		return 0;
+	}
+}
+
 bool
 sna_video_clip_helper(struct sna_video *video,
 		      struct sna_video_frame *frame,
src/sna/sna_video_sprite.c +14 -5
index 8b7ae8ae..288f1d62 100644
@@ -47,7 +47,7 @@
 #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 DRM_FORMAT_XYUV8888     fourcc_code('X', 'Y', 'U', 'V') /* 2x2 subsampled Cr:Cb plane */
 #define has_hw_scaling(sna, video) ((sna)->kgem.gen < 071 || \
 				    (sna)->kgem.gen >= 0110)
 
@@ -74,11 +74,11 @@ static Atom xvColorKey, xvAlwaysOnTop, xvSyncToVblank, xvColorspace;
 
 static XvFormatRec formats[] = { {15}, {16}, {24} };
 static const XvImageRec images[] = { XVIMAGE_YUY2, XVIMAGE_UYVY,
-				     XVMC_RGB888 };
+				     XVMC_RGB888, XVIMAGE_AYUV };
 static const XvImageRec images_rgb565[] = { XVIMAGE_YUY2, XVIMAGE_UYVY,
-					    XVMC_RGB888, XVMC_RGB565 };
+					    XVMC_RGB888, XVMC_RGB565, XVIMAGE_AYUV };
 static const XvImageRec images_nv12[] = { XVIMAGE_YUY2, XVIMAGE_UYVY,
-					  XVIMAGE_NV12, XVMC_RGB888, XVMC_RGB565 };
+					  XVIMAGE_NV12, XVMC_RGB888, XVMC_RGB565, XVIMAGE_AYUV };
 static const XvAttributeRec attribs[] = {
 	{ XvSettable | XvGettable, 0, 1, (char *)"XV_COLORSPACE" }, /* BT.601, BT.709 */
 	{ XvSettable | XvGettable, 0, 0xffffff, (char *)"XV_COLORKEY" },
@@ -364,6 +364,10 @@ sna_video_sprite_show(struct sna *sna,
 		case FOURCC_UYVY:
 			f.pixel_format = DRM_FORMAT_UYVY;
 			break;
+		case FOURCC_AYUV:
+			/* i915 doesn't support alpha, so we use XYUV */
+			f.pixel_format = DRM_FORMAT_XYUV8888;
+			break;
 		case FOURCC_YUY2:
 		default:
 			f.pixel_format = DRM_FORMAT_YUYV;
@@ -705,7 +709,12 @@ static int sna_video_sprite_query(ddQueryImageAttributes_ARGS)
 		tmp *= (*h >> 1);
 		size += tmp;
 		break;
-
+	case FOURCC_AYUV:
+		tmp = *w << 2;
+		if (pitches)
+			pitches[0] = tmp;
+		size = *h * tmp;
+		break;
 	default:
 		*w = (*w + 1) & ~1;
 		*h = (*h + 1) & ~1;
src/sna/sna_video_textured.c +8 -0
index a784fe2e..21c5f379 100644
@@ -68,6 +68,8 @@ static const XvImageRec gen4_Images[] = {
 	XVIMAGE_I420,
 	XVIMAGE_NV12,
 	XVIMAGE_UYVY,
+	XVIMAGE_AYUV,
+	XVMC_RGB888,
 	XVMC_YUV,
 };
 
@@ -337,6 +339,12 @@ sna_video_textured_query(ddQueryImageAttributes_ARGS)
 			pitches[0] = size;
 		size *= *h;
 		break;
+	case FOURCC_AYUV:
+		size = *w << 2;
+		if (pitches)
+			pitches[0] = size;
+		size *= *h;
+		break;
 	case FOURCC_XVMC:
 		*h = (*h + 1) & ~1;
 		size = sizeof(uint32_t);
Signature · 6 lines
2.17.1

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

Quoting Stanislav Lisovskiy (2018-10-04 13:49:41)

Quoted 17 lines
src/sna/sna_render.h +2 -0
index 6669af9d..ef88d1f9 100644
@@ -139,20 +139,25 @@ struct sna_composite_op {
 
                struct {
                        uint32_t flags;
+                       uint8_t wm_kernel;
                } gen6;
 
                struct {
                        uint32_t flags;
+                       uint8_t wm_kernel;
                } gen7;
 
                struct {

src/sna/sna_render.h struct sna_composite_op { · line 160

Quoted 10 lines
src/sna/sna_render.h +3 -0
                        uint32_t flags;
+                       uint8_t wm_kernel;
                } gen8;
 
                struct {
                        uint32_t flags;
+                       uint8_t wm_kernel;
                } gen9;
        } u;
+       unsigned long gen9_kernel;

Still the same problems. Additional *unused* parameters in the common which are clearly marked as gen specific, and extra unused gen specific parameters.

Would it be easier if you split the patch up into functional changes? -Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
Quoted 34 lines · Chris Wilson

Quoting Stanislav Lisovskiy (2018-10-04 13:49:41)

Quoted 17 lines
src/sna/sna_render.h +2 -0
index 6669af9d..ef88d1f9 100644
@@ -139,20 +139,25 @@ struct sna_composite_op {
 
                struct {
                        uint32_t flags;
+                       uint8_t wm_kernel;
                } gen6;
 
                struct {
                        uint32_t flags;
+                       uint8_t wm_kernel;
                } gen7;
 
                struct {

src/sna/sna_render.h struct sna_composite_op { · line 160

Quoted 10 lines
src/sna/sna_render.h +3 -0
                        uint32_t flags;
+                       uint8_t wm_kernel;
                } gen8;
 
                struct {
                        uint32_t flags;
+                       uint8_t wm_kernel;
                } gen9;
        } u;
+       unsigned long gen9_kernel;

Still the same problems. Additional *unused* parameters in the common which
are clearly marked as gen specific, and extra unused gen specific parameters.

Quoted 2 lines

Would it be easier if you split the patch up into functional changes? -Chris

Well, I agree, forgot to remove those unneeded gens. Also probably good idea to split it( I just wonder may be should Ville's initial patch go first then, as I used it as a base).

Signature · 7 lines
Best Regards,

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