st/va: reallocate the buffer if the layout isn't supported
authorLeo Liu <leo.liu@amd.com>
Tue, 29 Aug 2017 02:59:56 +0000 (22:59 -0400)
committerLeo Liu <leo.liu@amd.com>
Thu, 7 Sep 2017 17:32:36 +0000 (13:32 -0400)
So that it makes more clear for buffer reallocation based
on buffers layout for both decoder and encoder.

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
src/gallium/state_trackers/va/picture.c

index 47e63d3b30ccc6c8624828cf77b55a545989673f..ee099fad6eec57fbd1d561bf0b185556fea6025a 100644 (file)
@@ -591,7 +591,7 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id)
    vlVaSurface *surf;
    void *feedback;
    struct pipe_screen *screen;
-   bool interlaced;
+   bool supported;
    bool realloc = false;
    enum pipe_format format;
 
@@ -621,14 +621,17 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id)
    context->mpeg4.frame_num++;
 
    screen = context->decoder->context->screen;
-   interlaced = screen->get_video_param(screen, context->decoder->profile,
-                                        context->decoder->entrypoint,
-                                        PIPE_VIDEO_CAP_SUPPORTS_INTERLACED);
-
-   if (surf->buffer->interlaced != interlaced) {
-      surf->templat.interlaced = screen->get_video_param(screen, context->decoder->profile,
-                                                         PIPE_VIDEO_ENTRYPOINT_BITSTREAM,
-                                                         PIPE_VIDEO_CAP_PREFERS_INTERLACED);
+   supported = screen->get_video_param(screen, context->decoder->profile,
+                                       context->decoder->entrypoint,
+                                       surf->buffer->interlaced ?
+                                       PIPE_VIDEO_CAP_SUPPORTS_INTERLACED :
+                                       PIPE_VIDEO_CAP_SUPPORTS_PROGRESSIVE);
+
+   if (!supported) {
+      surf->templat.interlaced = screen->get_video_param(screen,
+                                       context->decoder->profile,
+                                       context->decoder->entrypoint,
+                                       PIPE_VIDEO_CAP_PREFERS_INTERLACED);
       realloc = true;
    }