From 8f54929c5d9a07a999cb0a55c406062fd8cdfb74 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Christian=20K=C3=B6nig?= Date: Wed, 1 Feb 2012 23:50:34 +0100 Subject: [PATCH] st/vdpau: use interlacing capabilities MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Recreate video buffer if need arises. Signed-off-by: Christian König --- src/gallium/state_trackers/vdpau/decode.c | 10 +++++++++- src/gallium/state_trackers/vdpau/surface.c | 6 ++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/vdpau/decode.c b/src/gallium/state_trackers/vdpau/decode.c index 00232ad9826..de9835f5847 100644 --- a/src/gallium/state_trackers/vdpau/decode.c +++ b/src/gallium/state_trackers/vdpau/decode.c @@ -393,6 +393,7 @@ vlVdpDecoderRender(VdpDecoder decoder, VdpStatus ret; struct pipe_screen *screen; struct pipe_video_decoder *dec; + bool buffer_support[2]; unsigned i; union { struct pipe_picture_desc base; @@ -424,8 +425,12 @@ vlVdpDecoderRender(VdpDecoder decoder, // TODO: Recreate decoder with correct chroma return VDP_STATUS_INVALID_CHROMA_TYPE; + buffer_support[0] = screen->get_video_param(screen, dec->profile, PIPE_VIDEO_CAP_SUPPORTS_PROGRESSIVE); + buffer_support[1] = screen->get_video_param(screen, dec->profile, PIPE_VIDEO_CAP_SUPPORTS_INTERLACED); + if (vlsurf->video_buffer == NULL || - !screen->is_video_format_supported(screen, vlsurf->video_buffer->buffer_format, dec->profile)) { + !screen->is_video_format_supported(screen, vlsurf->video_buffer->buffer_format, dec->profile) || + buffer_support[vlsurf->video_buffer->interlaced]) { /* destroy the old one */ if (vlsurf->video_buffer) @@ -434,6 +439,9 @@ vlVdpDecoderRender(VdpDecoder decoder, /* set the buffer format to the prefered one */ vlsurf->templat.buffer_format = screen->get_video_param(screen, dec->profile, PIPE_VIDEO_CAP_PREFERED_FORMAT); + /* also set interlacing to decoders preferences */ + vlsurf->templat.interlaced = screen->get_video_param(screen, dec->profile, PIPE_VIDEO_CAP_PREFERS_INTERLACED); + /* and recreate the video buffer */ vlsurf->video_buffer = dec->context->create_video_buffer(dec->context, &vlsurf->templat); diff --git a/src/gallium/state_trackers/vdpau/surface.c b/src/gallium/state_trackers/vdpau/surface.c index 00c64ee21fc..5774a8378ae 100644 --- a/src/gallium/state_trackers/vdpau/surface.c +++ b/src/gallium/state_trackers/vdpau/surface.c @@ -85,6 +85,12 @@ vlVdpVideoSurfaceCreate(VdpDevice device, VdpChromaType chroma_type, p_surf->templat.chroma_format = ChromaToPipe(chroma_type); p_surf->templat.width = width; p_surf->templat.height = height; + p_surf->templat.interlaced = pipe->screen->get_video_param + ( + pipe->screen, + PIPE_VIDEO_PROFILE_UNKNOWN, + PIPE_VIDEO_CAP_PREFERS_INTERLACED + ); p_surf->video_buffer = pipe->create_video_buffer(pipe, &p_surf->templat); *surface = vlAddDataHTAB(p_surf); -- 2.30.2