diff options
author | Thong Thai <[email protected]> | 2019-12-18 11:31:28 -0500 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-01-03 16:30:22 +0000 |
commit | 68881af4351898871ae443e9949fada631461f01 (patch) | |
tree | d2683fc7be35f8be13e859113a8ae859bede2854 /src/gallium/state_trackers/va | |
parent | f3569f215d0f46006ce34485d526c5ad56c463bb (diff) |
st/va: Add support for P010, used for 10-bit videos
Signed-off-by: Thong Thai <[email protected]>
Reviewed-by: Leo Liu <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3153>
Diffstat (limited to 'src/gallium/state_trackers/va')
-rw-r--r-- | src/gallium/state_trackers/va/image.c | 16 | ||||
-rw-r--r-- | src/gallium/state_trackers/va/picture.c | 1 | ||||
-rw-r--r-- | src/gallium/state_trackers/va/postproc.c | 1 | ||||
-rw-r--r-- | src/gallium/state_trackers/va/surface.c | 34 |
4 files changed, 37 insertions, 15 deletions
diff --git a/src/gallium/state_trackers/va/image.c b/src/gallium/state_trackers/va/image.c index 1a0712c9761..0a54a90cb4c 100644 --- a/src/gallium/state_trackers/va/image.c +++ b/src/gallium/state_trackers/va/image.c @@ -279,6 +279,9 @@ vlVaDeriveImage(VADriverContextP ctx, VASurfaceID surface, VAImage *image) img->pitches[0] = stride > 0 ? stride : w * 4; assert(img->pitches[0] >= (w * 4)); break; + + case VA_FOURCC('P','0','1','0'): + case VA_FOURCC('P','0','1','6'): case VA_FOURCC('N','V','1','2'): if (surf->buffer->interlaced) { struct pipe_video_buffer *new_buffer; @@ -449,13 +452,20 @@ vlVaGetImage(VADriverContextP ctx, VASurfaceID surface, int x, int y, return VA_STATUS_ERROR_OPERATION_FAILED; } + if (format != surf->buffer->buffer_format) { /* support NV12 to YV12 and IYUV conversion now only */ if ((format == PIPE_FORMAT_YV12 && - surf->buffer->buffer_format == PIPE_FORMAT_NV12) || - (format == PIPE_FORMAT_IYUV && - surf->buffer->buffer_format == PIPE_FORMAT_NV12)) + surf->buffer->buffer_format == PIPE_FORMAT_NV12) || + (format == PIPE_FORMAT_IYUV && + surf->buffer->buffer_format == PIPE_FORMAT_NV12)) convert = true; + else if (format == PIPE_FORMAT_NV12 && + (surf->buffer->buffer_format == PIPE_FORMAT_P010 || + surf->buffer->buffer_format == PIPE_FORMAT_P016)) { + mtx_unlock(&drv->mutex); + return VA_STATUS_ERROR_OPERATION_FAILED; + } else { mtx_unlock(&drv->mutex); return VA_STATUS_ERROR_OPERATION_FAILED; diff --git a/src/gallium/state_trackers/va/picture.c b/src/gallium/state_trackers/va/picture.c index 04d2da0afeb..d292594590c 100644 --- a/src/gallium/state_trackers/va/picture.c +++ b/src/gallium/state_trackers/va/picture.c @@ -81,6 +81,7 @@ vlVaBeginPicture(VADriverContextP ctx, VAContextID context_id, VASurfaceID rende 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_P010 && context->target->buffer_format != PIPE_FORMAT_P016) return VA_STATUS_ERROR_UNIMPLEMENTED; diff --git a/src/gallium/state_trackers/va/postproc.c b/src/gallium/state_trackers/va/postproc.c index 3431b1b48c7..661e3bf9414 100644 --- a/src/gallium/state_trackers/va/postproc.c +++ b/src/gallium/state_trackers/va/postproc.c @@ -353,6 +353,7 @@ vlVaHandleVAProcPipelineParameterBufferType(vlVaDriver *drv, vlVaContext *contex dst_region = vlVaRegionDefault(param->output_region, dst_surface, &def_dst_region); if (context->target->buffer_format != PIPE_FORMAT_NV12 && + context->target->buffer_format != PIPE_FORMAT_P010 && context->target->buffer_format != PIPE_FORMAT_P016) return vlVaPostProcCompositor(drv, context, src_region, dst_region, src, context->target, deinterlace); diff --git a/src/gallium/state_trackers/va/surface.c b/src/gallium/state_trackers/va/surface.c index 391eab65e69..47c6f9b06c9 100644 --- a/src/gallium/state_trackers/va/surface.c +++ b/src/gallium/state_trackers/va/surface.c @@ -754,18 +754,28 @@ vlVaCreateSurfaces2(VADriverContextP ctx, unsigned int format, memset(&templat, 0, sizeof(templat)); - templat.buffer_format = pscreen->get_video_param( - pscreen, - PIPE_VIDEO_PROFILE_UNKNOWN, - PIPE_VIDEO_ENTRYPOINT_BITSTREAM, - PIPE_VIDEO_CAP_PREFERED_FORMAT - ); - templat.interlaced = pscreen->get_video_param( - pscreen, - PIPE_VIDEO_PROFILE_UNKNOWN, - PIPE_VIDEO_ENTRYPOINT_BITSTREAM, - PIPE_VIDEO_CAP_PREFERS_INTERLACED - ); + if (format == VA_RT_FORMAT_YUV420_10BPP) + { + templat.buffer_format = PIPE_FORMAT_P010; + templat.interlaced = false; + } + else + { + templat.buffer_format = pscreen->get_video_param( + pscreen, + PIPE_VIDEO_PROFILE_UNKNOWN, + PIPE_VIDEO_ENTRYPOINT_BITSTREAM, + PIPE_VIDEO_CAP_PREFERED_FORMAT + ); + templat.interlaced = pscreen->get_video_param( + pscreen, + PIPE_VIDEO_PROFILE_UNKNOWN, + PIPE_VIDEO_ENTRYPOINT_BITSTREAM, + PIPE_VIDEO_CAP_PREFERS_INTERLACED + ); + } + + if (expected_fourcc) { enum pipe_format expected_format = VaFourccToPipeFormat(expected_fourcc); |