st/va: add support for P010 and P016 formats v3
authorChristian König <christian.koenig@amd.com>
Mon, 6 Mar 2017 16:53:04 +0000 (17:53 +0100)
committerChristian König <christian.koenig@amd.com>
Mon, 13 Mar 2017 07:51:38 +0000 (08:51 +0100)
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
v3: fix post processing once more

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Mark Thompson <sw@jkqxz.net>
src/gallium/state_trackers/va/image.c
src/gallium/state_trackers/va/picture.c
src/gallium/state_trackers/va/postproc.c
src/gallium/state_trackers/va/va_private.h

index 2ce22cefe7c74e3254edc93dba0c31e4d0fb0d16..f87de8e5c4e04188af3a5d5d1759e728fcc89209 100644 (file)
@@ -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;
index 62a68786c44b60e2930d43d07c0515f9d6eaa6b3..20fe75085b92bbc690ba854282f2389bd8d99f66 100644 (file)
@@ -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;
index fbec69aec35e84a8a3005dccde4ee5d633860f04..8467b0e8f4231016c42054ef48dac3d26aea8e5b 100644 (file)
@@ -292,7 +292,8 @@ vlVaHandleVAProcPipelineParameterBufferType(vlVaDriver *drv, vlVaContext *contex
    src_region = vlVaRegionDefault(param->surface_region, src_surface->buffer, &def_src_region);
    dst_region = vlVaRegionDefault(param->output_region, context->target, &def_dst_region);
 
-   if (context->target->buffer_format != PIPE_FORMAT_NV12)
+   if (context->target->buffer_format != PIPE_FORMAT_NV12 &&
+       context->target->buffer_format != PIPE_FORMAT_P016)
       return vlVaPostProcCompositor(drv, context, src_region, dst_region,
                                     src, context->target, deinterlace);
    else
index a7cedaeead6204e6d91b283410540ad10c6dadf9..7216aba4379dfb34599d2b2b35b6bc9047113b44 100644 (file)
@@ -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: