diff options
author | Boyuan Zhang <[email protected]> | 2016-07-21 19:40:14 -0400 |
---|---|---|
committer | Christian König <[email protected]> | 2016-07-25 13:30:42 +0200 |
commit | 5bcaa1b9e9707aea7be73b406345bb9e46f92a18 (patch) | |
tree | ca06edfbc85b1c1e5d1509df8b92c5eed24d57b0 /src/gallium/state_trackers/va/surface.c | |
parent | e7b2ce5fd872f6bf348310dcb6541ee5263886d5 (diff) |
st/va: add encode entrypoint v2
VAAPI passes PIPE_VIDEO_ENTRYPOINT_ENCODE as entry point for encoding case. We
will save this encode entry point in config. config_id was used as profile
previously. Now, config has both profile and entrypoint field, and config_id is
used to get the config object. Later on, we pass this entrypoint to
context->templat.entrypoint instead of always hardcoded to
PIPE_VIDEO_ENTRYPOINT_BITSTREAM for decoding case previously. Encode entrypoint
is not accepted by driver until we enable Vaapi encode in later patch.
v2 (chk): fix commit message to match 80 chars, use switch instead of ifs,
fix memory leaks in the error path, implement vlVaQueryConfigEntrypoints
as well, drop VAEntrypointEncPicture (only used for JPEG).
Signed-off-by: Boyuan Zhang <[email protected]>
Signed-off-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.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/gallium/state_trackers/va/surface.c b/src/gallium/state_trackers/va/surface.c index 3e74353f6de..8ce4143f74b 100644 --- a/src/gallium/state_trackers/va/surface.c +++ b/src/gallium/state_trackers/va/surface.c @@ -319,17 +319,18 @@ vlVaUnlockSurface(VADriverContextP ctx, VASurfaceID surface) } VAStatus -vlVaQuerySurfaceAttributes(VADriverContextP ctx, VAConfigID config, +vlVaQuerySurfaceAttributes(VADriverContextP ctx, VAConfigID config_id, VASurfaceAttrib *attrib_list, unsigned int *num_attribs) { vlVaDriver *drv; + vlVaConfig *config; VASurfaceAttrib *attribs; struct pipe_screen *pscreen; int i, j; STATIC_ASSERT(ARRAY_SIZE(vpp_surface_formats) <= VL_VA_MAX_IMAGE_FORMATS); - if (config == VA_INVALID_ID) + if (config_id == VA_INVALID_ID) return VA_STATUS_ERROR_INVALID_CONFIG; if (!attrib_list && !num_attribs) @@ -348,6 +349,13 @@ vlVaQuerySurfaceAttributes(VADriverContextP ctx, VAConfigID config, if (!drv) return VA_STATUS_ERROR_INVALID_CONTEXT; + pipe_mutex_lock(drv->mutex); + config = handle_table_get(drv->htab, config_id); + pipe_mutex_unlock(drv->mutex); + + if (!config) + return VA_STATUS_ERROR_INVALID_CONFIG; + pscreen = VL_VA_PSCREEN(ctx); if (!pscreen) @@ -363,7 +371,7 @@ vlVaQuerySurfaceAttributes(VADriverContextP ctx, VAConfigID config, /* vlVaCreateConfig returns PIPE_VIDEO_PROFILE_UNKNOWN * only for VAEntrypointVideoProc. */ - if (config == PIPE_VIDEO_PROFILE_UNKNOWN) { + if (config->profile == PIPE_VIDEO_PROFILE_UNKNOWN) { for (j = 0; j < ARRAY_SIZE(vpp_surface_formats); ++j) { attribs[i].type = VASurfaceAttribPixelFormat; attribs[i].value.type = VAGenericValueTypeInteger; |