Mesa (main): nouveau: improve video limit reporting
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sun Jun 6 19:27:45 UTC 2021
Module: Mesa
Branch: main
Commit: 7d49a6f23c4d5db29705e5463a258cdcecb50b90
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7d49a6f23c4d5db29705e5463a258cdcecb50b90
Author: Ilia Mirkin <imirkin at alum.mit.edu>
Date: Thu May 6 21:35:50 2021 -0400
nouveau: improve video limit reporting
This corrects max width/height/macroblocks reporting, in line with what
the nvidia driver docs suggest is supported.
Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10677>
---
src/gallium/drivers/nouveau/nouveau_vp3_video.c | 65 +++++++++++++++++++++++--
src/gallium/drivers/nouveau/nv50/nv84_video.c | 2 +
2 files changed, 63 insertions(+), 4 deletions(-)
diff --git a/src/gallium/drivers/nouveau/nouveau_vp3_video.c b/src/gallium/drivers/nouveau/nouveau_vp3_video.c
index b28d31e0079..3b59fd0a513 100644
--- a/src/gallium/drivers/nouveau/nouveau_vp3_video.c
+++ b/src/gallium/drivers/nouveau/nouveau_vp3_video.c
@@ -436,9 +436,10 @@ nouveau_vp3_screen_get_video_param(struct pipe_screen *pscreen,
enum pipe_video_entrypoint entrypoint,
enum pipe_video_cap param)
{
- int chipset = nouveau_screen(pscreen)->device->chipset;
- int vp3 = chipset < 0xa3 || chipset == 0xaa || chipset == 0xac;
- int vp5 = chipset >= 0xd0;
+ const int chipset = nouveau_screen(pscreen)->device->chipset;
+ /* Feature Set B = vp3, C = vp4, D = vp5 */
+ const bool vp3 = chipset < 0xa3 || chipset == 0xaa || chipset == 0xac;
+ const bool vp5 = chipset >= 0xd0;
enum pipe_video_format codec = u_reduce_video_profile(profile);
switch (param) {
case PIPE_VIDEO_CAP_SUPPORTED:
@@ -451,8 +452,45 @@ nouveau_vp3_screen_get_video_param(struct pipe_screen *pscreen,
case PIPE_VIDEO_CAP_NPOT_TEXTURES:
return 1;
case PIPE_VIDEO_CAP_MAX_WIDTH:
+ switch (codec) {
+ case PIPE_VIDEO_FORMAT_MPEG12:
+ return vp5 ? 4032 : 2048;
+ case PIPE_VIDEO_FORMAT_MPEG4:
+ return 2048;
+ case PIPE_VIDEO_FORMAT_VC1:
+ return 2048;
+ case PIPE_VIDEO_FORMAT_MPEG4_AVC:
+ if (vp3)
+ return 2032;
+ if (vp5)
+ return 4032;
+ return 2048; /* vp4 */
+ case PIPE_VIDEO_FORMAT_UNKNOWN:
+ return vp5 ? 4032 : 2048;
+ default:
+ debug_printf("unknown video codec: %d\n", codec);
+ return 0;
+ }
case PIPE_VIDEO_CAP_MAX_HEIGHT:
- return vp5 ? 4096 : 2048;
+ switch (codec) {
+ case PIPE_VIDEO_FORMAT_MPEG12:
+ return vp5 ? 4048 : 2048;
+ case PIPE_VIDEO_FORMAT_MPEG4:
+ return 2048;
+ case PIPE_VIDEO_FORMAT_VC1:
+ return 2048;
+ case PIPE_VIDEO_FORMAT_MPEG4_AVC:
+ if (vp3)
+ return 2048;
+ if (vp5)
+ return 4080;
+ return 2048; /* vp4 */
+ case PIPE_VIDEO_FORMAT_UNKNOWN:
+ return vp5 ? 4080 : 2048;
+ default:
+ debug_printf("unknown video codec: %d\n", codec);
+ return 0;
+ }
case PIPE_VIDEO_CAP_PREFERED_FORMAT:
return PIPE_FORMAT_NV12;
case PIPE_VIDEO_CAP_SUPPORTS_INTERLACED:
@@ -478,6 +516,7 @@ nouveau_vp3_screen_get_video_param(struct pipe_screen *pscreen,
case PIPE_VIDEO_PROFILE_VC1_ADVANCED:
return 4;
case PIPE_VIDEO_PROFILE_MPEG4_AVC_BASELINE:
+ case PIPE_VIDEO_PROFILE_MPEG4_AVC_CONSTRAINED_BASELINE:
case PIPE_VIDEO_PROFILE_MPEG4_AVC_MAIN:
case PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH:
return 41;
@@ -485,6 +524,24 @@ nouveau_vp3_screen_get_video_param(struct pipe_screen *pscreen,
debug_printf("unknown video profile: %d\n", profile);
return 0;
}
+ case PIPE_VIDEO_CAP_MAX_MACROBLOCKS:
+ switch (codec) {
+ case PIPE_VIDEO_FORMAT_MPEG12:
+ return vp5 ? 65536 : 8192;
+ case PIPE_VIDEO_FORMAT_MPEG4:
+ return 8192;
+ case PIPE_VIDEO_FORMAT_VC1:
+ return 8190;
+ case PIPE_VIDEO_FORMAT_MPEG4_AVC:
+ if (vp3)
+ return 8190;
+ if (vp5)
+ return 65536;
+ return 8192; /* vp4 */
+ default:
+ debug_printf("unknown video codec: %d\n", codec);
+ return 0;
+ }
default:
debug_printf("unknown video param: %d\n", param);
return 0;
diff --git a/src/gallium/drivers/nouveau/nv50/nv84_video.c b/src/gallium/drivers/nouveau/nv50/nv84_video.c
index 3d276f91149..dd73cd76e5e 100644
--- a/src/gallium/drivers/nouveau/nv50/nv84_video.c
+++ b/src/gallium/drivers/nouveau/nv50/nv84_video.c
@@ -838,6 +838,8 @@ nv84_screen_get_video_param(struct pipe_screen *pscreen,
debug_printf("unknown video profile: %d\n", profile);
return 0;
}
+ case PIPE_VIDEO_CAP_MAX_MACROBLOCKS:
+ return 8192; /* vc-1 actually has 8190, but this is not supported */
default:
debug_printf("unknown video param: %d\n", param);
return 0;
More information about the mesa-commit
mailing list