Mesa (main): vdpau: allow state tracker to report a lower number of macroblocks

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Jun 6 19:27:45 UTC 2021


Module: Mesa
Branch: main
Commit: d50e43c8a17184d5f9dd4fa039e4f1dbea0c9067
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d50e43c8a17184d5f9dd4fa039e4f1dbea0c9067

Author: Ilia Mirkin <imirkin at alum.mit.edu>
Date:   Thu May  6 21:13:46 2021 -0400

vdpau: allow state tracker to report a lower number of macroblocks

NVIDIA hardware can process tall or wide videos, but not both at the
same time (for some gens). This limit is provided in units of
macroblocks.

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
Reviewed-by: Leo Liu <leo.liu at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10677>

---

 src/gallium/frontends/vdpau/query.c      | 6 +++++-
 src/gallium/include/pipe/p_video_enums.h | 3 ++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/gallium/frontends/vdpau/query.c b/src/gallium/frontends/vdpau/query.c
index 701d9f220c4..a1e67e315b4 100644
--- a/src/gallium/frontends/vdpau/query.c
+++ b/src/gallium/frontends/vdpau/query.c
@@ -205,7 +205,11 @@ vlVdpDecoderQueryCapabilities(VdpDevice device, VdpDecoderProfile profile,
                                              PIPE_VIDEO_CAP_MAX_HEIGHT);
       *max_level = pscreen->get_video_param(pscreen, p_profile, PIPE_VIDEO_ENTRYPOINT_BITSTREAM,
                                             PIPE_VIDEO_CAP_MAX_LEVEL);
-      *max_macroblocks = (*max_width/16)*(*max_height/16);
+      *max_macroblocks = pscreen->get_video_param(pscreen, p_profile, PIPE_VIDEO_ENTRYPOINT_BITSTREAM,
+                                            PIPE_VIDEO_CAP_MAX_MACROBLOCKS);
+      if (*max_macroblocks == 0) {
+         *max_macroblocks = (*max_width/16)*(*max_height/16);
+      }
    } else {
       *max_width = 0;
       *max_height = 0;
diff --git a/src/gallium/include/pipe/p_video_enums.h b/src/gallium/include/pipe/p_video_enums.h
index 8719b1f8376..e26f73fe1ce 100644
--- a/src/gallium/include/pipe/p_video_enums.h
+++ b/src/gallium/include/pipe/p_video_enums.h
@@ -88,7 +88,8 @@ enum pipe_video_cap
    PIPE_VIDEO_CAP_SUPPORTS_PROGRESSIVE = 6,
    PIPE_VIDEO_CAP_SUPPORTS_INTERLACED = 7,
    PIPE_VIDEO_CAP_MAX_LEVEL = 8,
-   PIPE_VIDEO_CAP_STACKED_FRAMES = 9
+   PIPE_VIDEO_CAP_STACKED_FRAMES = 9,
+   PIPE_VIDEO_CAP_MAX_MACROBLOCKS = 10,
 };
 
 enum pipe_video_entrypoint



More information about the mesa-commit mailing list