aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/va/surface.c
diff options
context:
space:
mode:
authorMark Thompson <[email protected]>2017-10-09 21:45:03 +0100
committerLeo Liu <[email protected]>2017-10-17 08:23:55 -0400
commit31fb7bbe0be83b2ad769568829a006855639bee8 (patch)
tree3297c623cbf28654d6cf0794867418b7701bddfe /src/gallium/state_trackers/va/surface.c
parentba28c1c9f7800b81f1abfe482e2a03464d585519 (diff)
st/va: Return correct width and height for encode/decode support
Previously this would return the largest possible buffer size, which is much larger than the codecs themselves support. This caused confusion when client applications attempted to decode 8K video thinking it was supported when it isn't. Signed-off-by: Mark Thompson <[email protected]> Reviewed-by: Christian König <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/va/surface.c')
-rw-r--r--src/gallium/state_trackers/va/surface.c40
1 files changed, 30 insertions, 10 deletions
diff --git a/src/gallium/state_trackers/va/surface.c b/src/gallium/state_trackers/va/surface.c
index ccdeabc3ad2..636505b720e 100644
--- a/src/gallium/state_trackers/va/surface.c
+++ b/src/gallium/state_trackers/va/surface.c
@@ -476,17 +476,37 @@ vlVaQuerySurfaceAttributes(VADriverContextP ctx, VAConfigID config_id,
attribs[i].value.value.p = NULL; /* ignore */
i++;
- attribs[i].type = VASurfaceAttribMaxWidth;
- attribs[i].value.type = VAGenericValueTypeInteger;
- attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE;
- attribs[i].value.value.i = vl_video_buffer_max_size(pscreen);
- i++;
+ if (config->entrypoint != PIPE_VIDEO_ENTRYPOINT_UNKNOWN) {
+ attribs[i].type = VASurfaceAttribMaxWidth;
+ attribs[i].value.type = VAGenericValueTypeInteger;
+ attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE;
+ attribs[i].value.value.i =
+ pscreen->get_video_param(pscreen,
+ config->profile, config->entrypoint,
+ PIPE_VIDEO_CAP_MAX_WIDTH);
+ i++;
- attribs[i].type = VASurfaceAttribMaxHeight;
- attribs[i].value.type = VAGenericValueTypeInteger;
- attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE;
- attribs[i].value.value.i = vl_video_buffer_max_size(pscreen);
- i++;
+ attribs[i].type = VASurfaceAttribMaxHeight;
+ attribs[i].value.type = VAGenericValueTypeInteger;
+ attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE;
+ attribs[i].value.value.i =
+ pscreen->get_video_param(pscreen,
+ config->profile, config->entrypoint,
+ PIPE_VIDEO_CAP_MAX_HEIGHT);
+ i++;
+ } else {
+ attribs[i].type = VASurfaceAttribMaxWidth;
+ attribs[i].value.type = VAGenericValueTypeInteger;
+ attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE;
+ attribs[i].value.value.i = vl_video_buffer_max_size(pscreen);
+ i++;
+
+ attribs[i].type = VASurfaceAttribMaxHeight;
+ attribs[i].value.type = VAGenericValueTypeInteger;
+ attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE;
+ attribs[i].value.value.i = vl_video_buffer_max_size(pscreen);
+ i++;
+ }
if (i > *num_attribs) {
*num_attribs = i;