[Mesa-dev] [PATCH 19/20] st/va: relocate surface with yuyv stream
Leo Liu
leo.liu at amd.com
Tue Aug 15 20:08:37 UTC 2017
Signed-off-by: Leo Liu <leo.liu at amd.com>
---
src/gallium/state_trackers/va/picture.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/src/gallium/state_trackers/va/picture.c b/src/gallium/state_trackers/va/picture.c
index a13c1ecbb2..50f280ab58 100644
--- a/src/gallium/state_trackers/va/picture.c
+++ b/src/gallium/state_trackers/va/picture.c
@@ -592,6 +592,8 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id)
void *feedback;
struct pipe_screen *screen;
bool interlaced;
+ enum pipe_video_format format;
+ bool reloc = false;
if (!ctx)
return VA_STATUS_ERROR_INVALID_CONTEXT;
@@ -627,7 +629,24 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id)
surf->templat.interlaced = screen->get_video_param(screen, context->decoder->profile,
PIPE_VIDEO_ENTRYPOINT_BITSTREAM,
PIPE_VIDEO_CAP_PREFERS_INTERLACED);
+ reloc = true;
+ }
+
+ format = u_reduce_video_profile(context->templat.profile);
+
+ if (format == PIPE_VIDEO_FORMAT_MJPEG && surf->buffer->buffer_format == PIPE_FORMAT_NV12) {
+ if (context->mjpeg.sampling_factor == 0x211111 ||
+ context->mjpeg.sampling_factor == 0x221212) {
+ surf->templat.buffer_format = PIPE_FORMAT_YUYV;
+ reloc = true;
+ } else if (context->mjpeg.sampling_factor != 0x221111) {
+ /* Not NV12 either */
+ mtx_unlock(&drv->mutex);
+ return VA_STATUS_ERROR_INVALID_SURFACE;
+ }
+ }
+ if (reloc) {
surf->buffer->destroy(surf->buffer);
if (vlVaHandleSurfaceAllocate(ctx, surf, &surf->templat) != VA_STATUS_SUCCESS) {
--
2.11.0
More information about the mesa-dev
mailing list