summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2017-06-09 18:15:11 +0300
committerChris Wilson <chris@chris-wilson.co.uk>2017-09-27 19:01:05 +0100
commit291fdcdc09420d8e422617070731eb3da3d55b44 (patch)
tree11b601896dba3f54dfa7c9a3c74ae6b21864feb7
parent8906d8b0e2767c91e54c89434c6229944c6c7ab0 (diff)
sna/video: Expose NV12 support for the textured Xv adaptor on gen4+
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
-rw-r--r--src/sna/sna_video.h9
-rw-r--r--src/sna/sna_video_textured.c28
2 files changed, 36 insertions, 1 deletions
diff --git a/src/sna/sna_video.h b/src/sna/sna_video.h
index bb963e7f..6b1c864c 100644
--- a/src/sna/sna_video.h
+++ b/src/sna/sna_video.h
@@ -70,6 +70,15 @@ THE USE OR OTHER DEALINGS IN THE SOFTWARE.
XvTopToBottom \
}
+/* no standard define for this */
+#define XVIMAGE_NV12 { \
+ FOURCC_NV12, XvYUV, LSBFirst, \
+ {'N','V','1','2', 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \
+ 12, XvPlanar, 2, 0, 0, 0, 0, 8, 8, 8, 1, 2, 2, 1, 2, 2, \
+ {'Y','U','V', 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, 0}, \
+ XvTopToBottom \
+}
+
struct sna_video {
struct sna *sna;
diff --git a/src/sna/sna_video_textured.c b/src/sna/sna_video_textured.c
index 3cce5cf1..bcd42320 100644
--- a/src/sna/sna_video_textured.c
+++ b/src/sna/sna_video_textured.c
@@ -61,6 +61,15 @@ static const XvImageRec gen3_Images[] = {
XVMC_YUV,
};
+static const XvImageRec gen4_Images[] = {
+ XVIMAGE_YUY2,
+ XVIMAGE_YV12,
+ XVIMAGE_I420,
+ XVIMAGE_NV12,
+ XVIMAGE_UYVY,
+ XVMC_YUV,
+};
+
static int sna_video_textured_stop(ddStopVideo_ARGS)
{
struct sna_video *video = port->devPriv.ptr;
@@ -298,6 +307,20 @@ sna_video_textured_query(ddQueryImageAttributes_ARGS)
offsets[2] = size;
size += tmp;
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;
case FOURCC_UYVY:
case FOURCC_YUY2:
default:
@@ -374,9 +397,12 @@ void sna_video_textured_setup(struct sna *sna, ScreenPtr screen)
if (sna->kgem.gen < 030) {
adaptor->nImages = ARRAY_SIZE(gen2_Images);
adaptor->pImages = (XvImageRec *)gen2_Images;
- } else {
+ } else if (sna->kgem.gen < 040) {
adaptor->nImages = ARRAY_SIZE(gen3_Images);
adaptor->pImages = (XvImageRec *)gen3_Images;
+ } else {
+ adaptor->nImages = ARRAY_SIZE(gen4_Images);
+ adaptor->pImages = (XvImageRec *)gen4_Images;
}
#if XORG_XV_VERSION < 2
adaptor->ddAllocatePort = sna_xv_alloc_port;