st/vdpau: use interlacing capabilities
authorChristian König <deathsimple@vodafone.de>
Wed, 1 Feb 2012 22:50:34 +0000 (23:50 +0100)
committerChristian König <deathsimple@vodafone.de>
Mon, 6 Feb 2012 09:35:58 +0000 (10:35 +0100)
Recreate video buffer if need arises.

Signed-off-by: Christian König <deathsimple@vodafone.de>
src/gallium/state_trackers/vdpau/decode.c
src/gallium/state_trackers/vdpau/surface.c

index 00232ad98261f769dd92db75d20eb03364e4e1c9..de9835f5847b877ec5dbedc69a23441a30139896 100644 (file)
@@ -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);
 
index 00c64ee21fc6986e6f650f61ac155af769f272a4..5774a8378ae5ff532aa1fc252281262f6b6ec894 100644 (file)
@@ -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);