From 746ab3bb131dea8ad015e7804bfcdd6b4cc4f44e Mon Sep 17 00:00:00 2001 From: Stanislav Lisovskiy Date: Tue, 13 Nov 2018 09:45:02 +0200 Subject: sna: Added AYUV format support for textured and sprite video adapters. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit v2: Renamed DRM_FORMAT_XYUV to DRM_FORMAT_XYUV8888. Added comment about AYUV byte ordering in Gstreamer. v3: Removed sna_composite_op flags related change to the separate patch. v4: Fixed review comments, done code refactoring v5: Fixed following review comments: - Fixed comment in shader code for ayuv kernel. - Fixed naming to VIDEO_AYUV_BT601/BT709 for ayuv kernels. - Removed duplicate gen9_kernel parameter, left from previous patches - Added colorspace handling for new AYUV kernel - Fixed naming of sna_copy_packed_data_ayuv to sna_copy_ayuv_data - Started using standard bswap_32 function for byte swapping in sna_copy_ayuv_data - Removed redundant code in sna_copy_ayuv_data so that it looks more neat - Fixed XVIMAGE_AYUV structure initialization to contain proper byte sequence for GST - Fixed bogus comment about subsampling for DRM_FORMAT_XYUV8888 - Fixed AYUV advertisement for all platforms - Removed unnecessary RGB888 declaration. v6: - Fixed surface format not to use alpha as supposed - Now doing byte swapping always during copy - Changed hack, required for GST to work to be at one place - Fixed invalid sampling values for XVIMAGE_AYUV - Fixed sprite format checking order and images_ayuv definition. v7: - Removed reverse_bytes bool parameter, now swapping bytes for XYUV unconditionally both for textured and sprite modes. v8: - Added gen9_images structure, in order to expose AYUV format to proper platforms. Signed-off-by: Stanislav Lisovskiy Reviewed-by: Ville Syrjälä Signed-off-by: Chris Wilson --- src/sna/sna_video_textured.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src/sna/sna_video_textured.c') diff --git a/src/sna/sna_video_textured.c b/src/sna/sna_video_textured.c index 115cbea4..06da36d0 100644 --- a/src/sna/sna_video_textured.c +++ b/src/sna/sna_video_textured.c @@ -71,6 +71,16 @@ static const XvImageRec gen4_Images[] = { XVMC_YUV, }; +static const XvImageRec gen9_Images[] = { + XVIMAGE_YUY2, + XVIMAGE_YV12, + XVIMAGE_I420, + XVIMAGE_NV12, + XVIMAGE_UYVY, + XVIMAGE_AYUV, + XVMC_YUV, +}; + static int sna_video_textured_stop(ddStopVideo_ARGS) { struct sna_video *video = port->devPriv.ptr; @@ -337,6 +347,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); @@ -414,9 +430,12 @@ void sna_video_textured_setup(struct sna *sna, ScreenPtr screen) } else if (sna->kgem.gen < 040) { adaptor->nImages = ARRAY_SIZE(gen3_Images); adaptor->pImages = (XvImageRec *)gen3_Images; - } else { + } else if (sna->kgem.gen < 0110) { adaptor->nImages = ARRAY_SIZE(gen4_Images); adaptor->pImages = (XvImageRec *)gen4_Images; + } else { + adaptor->nImages = ARRAY_SIZE(gen9_Images); + adaptor->pImages = (XvImageRec *)gen9_Images; } #if XORG_XV_VERSION < 2 adaptor->ddAllocatePort = sna_xv_alloc_port; -- cgit v1.2.3