From e58a1e8f68b3b740d915468012573a4d7befb875 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Christian=20K=C3=B6nig?= Date: Mon, 6 Mar 2017 17:53:04 +0100 Subject: [PATCH] st/va: add support for P010 and P016 formats v3 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Mark Thompson --- src/gallium/state_trackers/va/image.c | 12 ++++++++++++ src/gallium/state_trackers/va/picture.c | 3 ++- src/gallium/state_trackers/va/postproc.c | 3 ++- src/gallium/state_trackers/va/va_private.h | 7 ++++++- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/gallium/state_trackers/va/image.c b/src/gallium/state_trackers/va/image.c index 2ce22cefe7c..f87de8e5c4e 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 62a68786c44..20fe75085b9 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/postproc.c b/src/gallium/state_trackers/va/postproc.c index fbec69aec35..8467b0e8f42 100644 --- a/src/gallium/state_trackers/va/postproc.c +++ b/src/gallium/state_trackers/va/postproc.c @@ -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 diff --git a/src/gallium/state_trackers/va/va_private.h b/src/gallium/state_trackers/va/va_private.h index a7cedaeead6..7216aba4379 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.30.2