Add a functor to hw_codec_info to allow each hw instance to report maximum resolution on a per-codec basis.
Signed-off-by: U. Artie Eoff <ullysses.a.e...@intel.com> --- src/i965_drv_video.c | 32 +++++++++++++++++++++++++++----- src/i965_drv_video.h | 9 +++++++++ 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/src/i965_drv_video.c b/src/i965_drv_video.c index 13813243ea46..6204c67f9c0e 100644 --- a/src/i965_drv_video.c +++ b/src/i965_drv_video.c @@ -2069,6 +2069,20 @@ i965_destroy_context(struct object_heap *heap, struct object_base *obj) object_heap_free(heap, obj); } +static inline void +max_resolution(struct i965_driver_data *i965, + struct object_config *obj_config, + int *w, /* out */ + int *h) /* out */ +{ + if (i965->codec_info->max_resolution) { + i965->codec_info->max_resolution(i965, obj_config, w, h); + } else { + *w = i965->codec_info->max_width; + *h = i965->codec_info->max_height; + } +} + VAStatus i965_CreateContext(VADriverContextP ctx, VAConfigID config_id, @@ -2086,14 +2100,18 @@ i965_CreateContext(VADriverContextP ctx, VAStatus vaStatus = VA_STATUS_SUCCESS; int contextID; int i; + int max_width; + int max_height; if (NULL == obj_config) { vaStatus = VA_STATUS_ERROR_INVALID_CONFIG; return vaStatus; } - if (picture_width > i965->codec_info->max_width || - picture_height > i965->codec_info->max_height) { + max_resolution(i965, obj_config, &max_width, &max_height); + + if (picture_width > max_width || + picture_height > max_height) { vaStatus = VA_STATUS_ERROR_RESOLUTION_NOT_SUPPORTED; return vaStatus; } @@ -5363,7 +5381,9 @@ i965_QuerySurfaceAttributes(VADriverContextP ctx, struct object_config *obj_config; int i = 0; VASurfaceAttrib *attribs = NULL; - + int max_width; + int max_height; + if (config == VA_INVALID_ID) return VA_STATUS_ERROR_INVALID_CONFIG; @@ -5750,16 +5770,18 @@ i965_QuerySurfaceAttributes(VADriverContextP ctx, attribs[i].value.value.p = NULL; /* ignore */ i++; + max_resolution(i965, obj_config, &max_width, &max_height); + attribs[i].type = VASurfaceAttribMaxWidth; attribs[i].value.type = VAGenericValueTypeInteger; attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE; - attribs[i].value.value.i = i965->codec_info->max_width; + attribs[i].value.value.i = max_width; i++; attribs[i].type = VASurfaceAttribMaxHeight; attribs[i].value.type = VAGenericValueTypeInteger; attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE; - attribs[i].value.value.i = i965->codec_info->max_height; + attribs[i].value.value.i = max_height; i++; if (i > *num_attribs) { diff --git a/src/i965_drv_video.h b/src/i965_drv_video.h index c86ace7e4d39..968cd7d19377 100644 --- a/src/i965_drv_video.h +++ b/src/i965_drv_video.h @@ -347,6 +347,8 @@ struct i965_filter int ring; }; +struct i965_driver_data; + struct hw_codec_info { struct hw_context *(*dec_hw_context_init)(VADriverContextP, struct object_config *); @@ -356,6 +358,13 @@ struct hw_codec_info void (*post_processing_context_init)(VADriverContextP, void *, struct intel_batchbuffer *); void (*preinit_hw_codec)(VADriverContextP, struct hw_codec_info *); + /** + * Allows HW info to support per-codec max resolution. If this functor is + * not initialized, then @max_width and @max_height will be used as the + * default maximum resolution for all codecs on this HW info. + */ + void (*max_resolution)(struct i965_driver_data *, struct object_config *, int *, int *); + int max_width; int max_height; int min_linear_wpitch; -- 2.1.0 _______________________________________________ Libva mailing list Libva@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libva