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,
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;
}
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;
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) {
int ring;
};
+struct i965_driver_data;
+
struct hw_codec_info
{
struct hw_context *(*dec_hw_context_init)(VADriverContextP, struct object_config *);
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;