diff options
author | Feng Jiang <jiangfeng@kylinos.cn> | 2022-09-22 15:48:09 +0800 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2022-11-18 07:46:11 +0000 |
commit | 8b48e11179b34560b838181c0ed6c96d3ec2f80f (patch) | |
tree | 9a6d27083aabb5872a3de26e53ed677a160782c1 /src/gallium/drivers/virgl/virgl_screen.c | |
parent | ebf6158bd0230d60c0c227937e525d2bea5e1a59 (diff) |
virgl/video: Check driver supported profiles and entrypoints
Since the support of video by the device and the driver may be
different, it is necessary to check on the driver side as well.
Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Boyuan Zhang <Boyuan.Zhang@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18831>
Diffstat (limited to 'src/gallium/drivers/virgl/virgl_screen.c')
-rw-r--r-- | src/gallium/drivers/virgl/virgl_screen.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/gallium/drivers/virgl/virgl_screen.c b/src/gallium/drivers/virgl/virgl_screen.c index 663b6814676..7aa5e5241cb 100644 --- a/src/gallium/drivers/virgl/virgl_screen.c +++ b/src/gallium/drivers/virgl/virgl_screen.c @@ -471,6 +471,7 @@ virgl_get_video_param(struct pipe_screen *screen, enum pipe_video_cap param) { unsigned i; + bool drv_supported; struct virgl_video_caps *vcaps = NULL; struct virgl_screen *vscreen; @@ -481,11 +482,26 @@ virgl_get_video_param(struct pipe_screen *screen, if (vscreen->caps.caps.v2.num_video_caps > ARRAY_SIZE(vscreen->caps.caps.v2.video_caps)) return 0; - for (i = 0; i < vscreen->caps.caps.v2.num_video_caps; i++) { - if (vscreen->caps.caps.v2.video_caps[i].profile == profile && - vscreen->caps.caps.v2.video_caps[i].entrypoint == entrypoint) { - vcaps = &vscreen->caps.caps.v2.video_caps[i]; - break; + /* Profiles and entrypoints supported by the driver */ + switch (u_reduce_video_profile(profile)) { + case PIPE_VIDEO_FORMAT_MPEG4_AVC: /* fall through */ + case PIPE_VIDEO_FORMAT_HEVC: + drv_supported = (entrypoint == PIPE_VIDEO_ENTRYPOINT_BITSTREAM || + entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE); + break; + default: + drv_supported = false; + break; + } + + if (drv_supported) { + /* Check if the device supports it, vcaps is NULL means not supported */ + for (i = 0; i < vscreen->caps.caps.v2.num_video_caps; i++) { + if (vscreen->caps.caps.v2.video_caps[i].profile == profile && + vscreen->caps.caps.v2.video_caps[i].entrypoint == entrypoint) { + vcaps = &vscreen->caps.caps.v2.video_caps[i]; + break; + } } } |