[Mesa-dev] [PATCH 7/9] st/va: add support for P010 and P016 formats v2

Christian König deathsimple at vodafone.de
Thu Mar 9 14:02:30 UTC 2017


From: Christian König <christian.koenig at amd.com>

No hardware I know off can actually support P010 natively. But we can easily
support P016 and as long as nobody decodes anything into the lower 6bits it
doesn't make any difference to P010.

v2: allow P0160 for post processing as well

Signed-off-by: Christian König <christian.koenig at amd.com>
---
 src/gallium/state_trackers/va/image.c      | 12 ++++++++++++
 src/gallium/state_trackers/va/picture.c    |  3 ++-
 src/gallium/state_trackers/va/va_private.h |  7 ++++++-
 3 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/va/image.c b/src/gallium/state_trackers/va/image.c
index 2ce22ce..f87de8e 100644
--- a/src/gallium/state_trackers/va/image.c
+++ b/src/gallium/state_trackers/va/image.c
@@ -41,6 +41,8 @@
 static const VAImageFormat formats[] =
 {
    {VA_FOURCC('N','V','1','2')},
+   {VA_FOURCC('P','0','1','0')},
+   {VA_FOURCC('P','0','1','6')},
    {VA_FOURCC('I','4','2','0')},
    {VA_FOURCC('Y','V','1','2')},
    {VA_FOURCC('Y','U','Y','V')},
@@ -134,6 +136,16 @@ vlVaCreateImage(VADriverContextP ctx, VAImageFormat *format, int width, int heig
       img->data_size  = w * h * 3 / 2;
       break;
 
+   case VA_FOURCC('P','0','1','0'):
+   case VA_FOURCC('P','0','1','6'):
+      img->num_planes = 2;
+      img->pitches[0] = w * 2;
+      img->offsets[0] = 0;
+      img->pitches[1] = w * 2;
+      img->offsets[1] = w * h * 2;
+      img->data_size  = w * h * 3;
+      break;
+
    case VA_FOURCC('I','4','2','0'):
    case VA_FOURCC('Y','V','1','2'):
       img->num_planes = 3;
diff --git a/src/gallium/state_trackers/va/picture.c b/src/gallium/state_trackers/va/picture.c
index 62a6878..20fe750 100644
--- a/src/gallium/state_trackers/va/picture.c
+++ b/src/gallium/state_trackers/va/picture.c
@@ -74,7 +74,8 @@ vlVaBeginPicture(VADriverContextP ctx, VAContextID context_id, VASurfaceID rende
           context->target->buffer_format != PIPE_FORMAT_R8G8B8A8_UNORM &&
           context->target->buffer_format != PIPE_FORMAT_B8G8R8X8_UNORM &&
           context->target->buffer_format != PIPE_FORMAT_R8G8B8X8_UNORM &&
-          context->target->buffer_format != PIPE_FORMAT_NV12)
+          context->target->buffer_format != PIPE_FORMAT_NV12 &&
+          context->target->buffer_format != PIPE_FORMAT_P016)
          return VA_STATUS_ERROR_UNIMPLEMENTED;
 
       return VA_STATUS_SUCCESS;
diff --git a/src/gallium/state_trackers/va/va_private.h b/src/gallium/state_trackers/va/va_private.h
index a7cedae..7216aba4 100644
--- a/src/gallium/state_trackers/va/va_private.h
+++ b/src/gallium/state_trackers/va/va_private.h
@@ -49,7 +49,7 @@
 #define VL_VA_DRIVER(ctx) ((vlVaDriver *)ctx->pDriverData)
 #define VL_VA_PSCREEN(ctx) (VL_VA_DRIVER(ctx)->vscreen->pscreen)
 
-#define VL_VA_MAX_IMAGE_FORMATS 9
+#define VL_VA_MAX_IMAGE_FORMATS 11
 #define VL_VA_ENC_GOP_COEFF 16
 
 static inline enum pipe_video_chroma_format
@@ -73,6 +73,9 @@ VaFourccToPipeFormat(unsigned format)
    switch(format) {
    case VA_FOURCC('N','V','1','2'):
       return PIPE_FORMAT_NV12;
+   case VA_FOURCC('P','0','1','0'):
+   case VA_FOURCC('P','0','1','6'):
+      return PIPE_FORMAT_P016;
    case VA_FOURCC('I','4','2','0'):
       return PIPE_FORMAT_IYUV;
    case VA_FOURCC('Y','V','1','2'):
@@ -101,6 +104,8 @@ PipeFormatToVaFourcc(enum pipe_format p_format)
    switch (p_format) {
    case PIPE_FORMAT_NV12:
       return VA_FOURCC('N','V','1','2');
+   case PIPE_FORMAT_P016:
+      return VA_FOURCC('P','0','1','6');
    case PIPE_FORMAT_IYUV:
       return VA_FOURCC('I','4','2','0');
    case PIPE_FORMAT_YV12:
-- 
2.7.4



More information about the mesa-dev mailing list