vl: reintroduce PIPE_VIDEO_CAP_PREFERED_FORMAT
authorChristian König <deathsimple@vodafone.de>
Tue, 10 Jan 2012 13:03:28 +0000 (14:03 +0100)
committerChristian König <deathsimple@vodafone.de>
Sun, 15 Jan 2012 11:40:44 +0000 (12:40 +0100)
Create the video buffers in the format the driver preffers.
This temporary creates problems with decoder less VDPAU video playback.

Signed-off-by: Christian König <deathsimple@vodafone.de>
src/gallium/drivers/nouveau/nouveau_video.c
src/gallium/drivers/nvfx/nvfx_screen.c
src/gallium/drivers/r300/r300_screen.c
src/gallium/drivers/r600/r600_pipe.c
src/gallium/drivers/softpipe/sp_screen.c
src/gallium/include/pipe/p_video_enums.h
src/gallium/state_trackers/vdpau/surface.c
src/gallium/state_trackers/xorg/xvmc/surface.c

index 2f9f1ca74eb286dae2b5eaa29aa51efb35d428c3..47d332a12b57ec9c7a4c38f2c154d232b8bb25a5 100644 (file)
@@ -835,6 +835,8 @@ nouveau_screen_get_video_param(struct pipe_screen *pscreen,
    case PIPE_VIDEO_CAP_MAX_WIDTH:
    case PIPE_VIDEO_CAP_MAX_HEIGHT:
       return vl_video_buffer_max_size(pscreen);
+   case PIPE_VIDEO_CAP_PREFERED_FORMAT:
+      return PIPE_FORMAT_NV12;
    default:
       debug_printf("unknown video param: %d\n", param);
       return 0;
index 938d67bb331e6ba2ae43e5b3a033ac9fd971cf11..ead777de784498abefeaedfea1d193ea2ff90b52 100644 (file)
@@ -230,6 +230,8 @@ nvfx_screen_get_video_param(struct pipe_screen *screen,
        case PIPE_VIDEO_CAP_MAX_WIDTH:
        case PIPE_VIDEO_CAP_MAX_HEIGHT:
                return vl_video_buffer_max_size(screen);
+       case PIPE_VIDEO_CAP_PREFERED_FORMAT:
+               return PIPE_FORMAT_NV12;
        default:
                return 0;
        }
index 763321b480ef1654dbc2a24dfb83a33f88865ecc..cd3c88d170b325d4f8a740127b28be8e41e73866 100644 (file)
@@ -307,6 +307,8 @@ static int r300_get_video_param(struct pipe_screen *screen,
       case PIPE_VIDEO_CAP_MAX_WIDTH:
       case PIPE_VIDEO_CAP_MAX_HEIGHT:
          return vl_video_buffer_max_size(screen);
+      case PIPE_VIDEO_CAP_PREFERED_FORMAT:
+         return PIPE_FORMAT_NV12;
       default:
          return 0;
    }
index 537024c069b9136c35436f89fe2c0824452d4cb0..b106802255a7efcc1b416b69151c488127528541 100644 (file)
@@ -526,6 +526,8 @@ static int r600_get_video_param(struct pipe_screen *screen,
        case PIPE_VIDEO_CAP_MAX_WIDTH:
        case PIPE_VIDEO_CAP_MAX_HEIGHT:
                return vl_video_buffer_max_size(screen);
+       case PIPE_VIDEO_CAP_PREFERED_FORMAT:
+               return PIPE_FORMAT_NV12;
        default:
                return 0;
        }
index f5ff68c0acc39731f63351657afdbc2b1cf780e2..3a989406685afbd9d4ce7a0c3987675c0ca766db 100644 (file)
@@ -201,6 +201,8 @@ softpipe_get_video_param(struct pipe_screen *screen,
    case PIPE_VIDEO_CAP_MAX_WIDTH:
    case PIPE_VIDEO_CAP_MAX_HEIGHT:
       return vl_video_buffer_max_size(screen);
+   case PIPE_VIDEO_CAP_PREFERED_FORMAT:
+      return PIPE_FORMAT_NV12;
    default:
       return 0;
    }
index 13786067d53534208a4d488723490cec4fcb9ac1..3b61601536ecd928218fa752767ebd83644a344a 100644 (file)
@@ -50,7 +50,8 @@ enum pipe_video_cap
    PIPE_VIDEO_CAP_SUPPORTED = 0,
    PIPE_VIDEO_CAP_NPOT_TEXTURES = 1,
    PIPE_VIDEO_CAP_MAX_WIDTH = 2,
-   PIPE_VIDEO_CAP_MAX_HEIGHT = 3
+   PIPE_VIDEO_CAP_MAX_HEIGHT = 3,
+   PIPE_VIDEO_CAP_PREFERED_FORMAT = 4
 };
 
 enum pipe_video_codec
index 206a8397e9f35b0ce3b84e594cbf179df0b8bfb9..60cbbed276913c9cad9424e0a24dfba6b6109206 100644 (file)
@@ -74,7 +74,12 @@ vlVdpVideoSurfaceCreate(VdpDevice device, VdpChromaType chroma_type,
 
    p_surf->device = dev;
    memset(&tmpl, 0, sizeof(tmpl));
-   tmpl.buffer_format = PIPE_FORMAT_YV12;
+   tmpl.buffer_format = dev->context->pipe->screen->get_video_param
+   (
+      dev->context->pipe->screen,
+      PIPE_VIDEO_PROFILE_UNKNOWN,
+      PIPE_VIDEO_CAP_PREFERED_FORMAT
+   );
    tmpl.chroma_format = ChromaToPipe(chroma_type);
    tmpl.width = width;
    tmpl.height = height;
index 06a3eb963adc2d26e0e1cdb1d05036d6a3fcb0cd..f1c32714cc6a0b7889181f134c815de42749f8df 100644 (file)
@@ -175,7 +175,12 @@ Status XvMCCreateSurface(Display *dpy, XvMCContext *context, XvMCSurface *surfac
       return BadAlloc;
 
    memset(&tmpl, 0, sizeof(tmpl));
-   tmpl.buffer_format = PIPE_FORMAT_NV12;
+   tmpl.buffer_format = pipe->screen->get_video_param
+   (
+      pipe->screen,
+      PIPE_VIDEO_PROFILE_MPEG2_MAIN,
+      PIPE_VIDEO_CAP_PREFERED_FORMAT
+   );
    tmpl.chroma_format = context_priv->decoder->chroma_format;
    tmpl.width = context_priv->decoder->width;
    tmpl.height = context_priv->decoder->height;