if (packed_type & VAEncPackedHeaderMiscMask) {
idx = I965_PACKED_MISC_HEADER_BASE;
packed_type = (~VAEncPackedHeaderMiscMask & packed_type);
- assert(packed_type > 0);
+ ASSERT_RET(packed_type > 0, 0);
idx += (packed_type - 1);
} else {
idx = I965_PACKED_HEADER_BASE;
default:
/* Should not get here */
- assert(0);
+ ASSERT_RET(0, 0);
break;
}
}
- assert(idx < 4);
+ ASSERT_RET(idx < 4, 0);
return idx;
}
}
/* If the assert fails then I965_MAX_PROFILES needs to be bigger */
- assert(i <= I965_MAX_PROFILES);
+ ASSERT_RET(i <= I965_MAX_PROFILES, VA_STATUS_ERROR_OPERATION_FAILED);
*num_profiles = i;
return VA_STATUS_SUCCESS;
}
/* If the assert fails then I965_MAX_ENTRYPOINTS needs to be bigger */
- assert(n <= I965_MAX_ENTRYPOINTS);
+ ASSERT_RET(n <= I965_MAX_ENTRYPOINTS, VA_STATUS_ERROR_OPERATION_FAILED);
*num_entrypoints = n;
return n > 0 ? VA_STATUS_SUCCESS : VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
}
VAStatus vaStatus = VA_STATUS_SUCCESS;
int i;
- assert(obj_config);
+ ASSERT_RET(obj_config, VA_STATUS_ERROR_INVALID_CONFIG);
*profile = obj_config->profile;
*entrypoint = obj_config->entrypoint;
*num_attribs = obj_config->num_attribs;
index > memory_attibute->num_buffers)
return VA_STATUS_ERROR_INVALID_PARAMETER;
- assert(obj_surface->orig_width == memory_attibute->width);
- assert(obj_surface->orig_height == memory_attibute->height);
- assert(memory_attibute->num_planes >= 1);
+ ASSERT_RET(obj_surface->orig_width == memory_attibute->width, VA_STATUS_ERROR_INVALID_PARAMETER);
+ ASSERT_RET(obj_surface->orig_height == memory_attibute->height, VA_STATUS_ERROR_INVALID_PARAMETER);
+ ASSERT_RET(memory_attibute->num_planes >= 1, VA_STATUS_ERROR_INVALID_PARAMETER);
obj_surface->fourcc = memory_attibute->pixel_format;
obj_surface->width = memory_attibute->pitches[0];
switch (obj_surface->fourcc) {
case VA_FOURCC('N', 'V', '1', '2'):
- assert(memory_attibute->num_planes == 2);
- assert(memory_attibute->pitches[0] == memory_attibute->pitches[1]);
+ ASSERT_RET(memory_attibute->num_planes == 2, VA_STATUS_ERROR_INVALID_PARAMETER);
+ ASSERT_RET(memory_attibute->pitches[0] == memory_attibute->pitches[1], VA_STATUS_ERROR_INVALID_PARAMETER);
obj_surface->subsampling = SUBSAMPLE_YUV420;
obj_surface->y_cb_offset = obj_surface->height;
case VA_FOURCC('Y', 'V', '1', '2'):
case VA_FOURCC('I', 'M', 'C', '1'):
- assert(memory_attibute->num_planes == 3);
- assert(memory_attibute->pitches[1] == memory_attibute->pitches[2]);
+ ASSERT_RET(memory_attibute->num_planes == 3, VA_STATUS_ERROR_INVALID_PARAMETER);
+ ASSERT_RET(memory_attibute->pitches[1] == memory_attibute->pitches[2], VA_STATUS_ERROR_INVALID_PARAMETER);
obj_surface->subsampling = SUBSAMPLE_YUV420;
obj_surface->y_cr_offset = obj_surface->height;
case VA_FOURCC('I', '4', '2', '0'):
case VA_FOURCC('I', 'Y', 'U', 'V'):
case VA_FOURCC('I', 'M', 'C', '3'):
- assert(memory_attibute->num_planes == 3);
- assert(memory_attibute->pitches[1] == memory_attibute->pitches[2]);
+ ASSERT_RET(memory_attibute->num_planes == 3, VA_STATUS_ERROR_INVALID_PARAMETER);
+ ASSERT_RET(memory_attibute->pitches[1] == memory_attibute->pitches[2], VA_STATUS_ERROR_INVALID_PARAMETER);
obj_surface->subsampling = SUBSAMPLE_YUV420;
obj_surface->y_cb_offset = obj_surface->height;
case VA_FOURCC('Y', 'U', 'Y', '2'):
case VA_FOURCC('U', 'Y', 'V', 'Y'):
- assert(memory_attibute->num_planes == 1);
+ ASSERT_RET(memory_attibute->num_planes == 1, VA_STATUS_ERROR_INVALID_PARAMETER);
obj_surface->subsampling = SUBSAMPLE_YUV422H;
obj_surface->y_cb_offset = 0;
case VA_FOURCC('R', 'G', 'B', 'X'):
case VA_FOURCC('B', 'G', 'R', 'A'):
case VA_FOURCC('B', 'G', 'R', 'X'):
- assert(memory_attibute->num_planes == 1);
+ ASSERT_RET(memory_attibute->num_planes == 1, VA_STATUS_ERROR_INVALID_PARAMETER);
obj_surface->subsampling = SUBSAMPLE_RGBX;
obj_surface->y_cb_offset = 0;
break;
case VA_FOURCC('Y', '8', '0', '0'): /* monochrome surface */
- assert(memory_attibute->num_planes == 1);
+ ASSERT_RET(memory_attibute->num_planes == 1, VA_STATUS_ERROR_INVALID_PARAMETER);
obj_surface->subsampling = SUBSAMPLE_YUV400;
obj_surface->y_cb_offset = 0;
break;
case VA_FOURCC('4', '1', '1', 'P'):
- assert(memory_attibute->num_planes == 3);
- assert(memory_attibute->pitches[1] == memory_attibute->pitches[2]);
+ ASSERT_RET(memory_attibute->num_planes == 3, VA_STATUS_ERROR_INVALID_PARAMETER);
+ ASSERT_RET(memory_attibute->pitches[1] == memory_attibute->pitches[2], VA_STATUS_ERROR_INVALID_PARAMETER);
obj_surface->subsampling = SUBSAMPLE_YUV411;
obj_surface->y_cb_offset = 0;
break;
case VA_FOURCC('4', '2', '2', 'H'):
- assert(memory_attibute->num_planes == 3);
- assert(memory_attibute->pitches[1] == memory_attibute->pitches[2]);
+ ASSERT_RET(memory_attibute->num_planes == 3, VA_STATUS_ERROR_INVALID_PARAMETER);
+ ASSERT_RET(memory_attibute->pitches[1] == memory_attibute->pitches[2], VA_STATUS_ERROR_INVALID_PARAMETER);
obj_surface->subsampling = SUBSAMPLE_YUV422H;
obj_surface->y_cb_offset = obj_surface->height;
break;
case VA_FOURCC('4', '2', '2', 'V'):
- assert(memory_attibute->num_planes == 3);
- assert(memory_attibute->pitches[1] == memory_attibute->pitches[2]);
+ ASSERT_RET(memory_attibute->num_planes == 3, VA_STATUS_ERROR_INVALID_PARAMETER);
+ ASSERT_RET(memory_attibute->pitches[1] == memory_attibute->pitches[2], VA_STATUS_ERROR_INVALID_PARAMETER);
obj_surface->subsampling = SUBSAMPLE_YUV422H;
obj_surface->y_cb_offset = obj_surface->height;
break;
case VA_FOURCC('4', '4', '4', 'P'):
- assert(memory_attibute->num_planes == 3);
- assert(memory_attibute->pitches[1] == memory_attibute->pitches[2]);
+ ASSERT_RET(memory_attibute->num_planes == 3, VA_STATUS_ERROR_INVALID_PARAMETER);
+ ASSERT_RET(memory_attibute->pitches[1] == memory_attibute->pitches[2], VA_STATUS_ERROR_INVALID_PARAMETER);
obj_surface->subsampling = SUBSAMPLE_YUV444;
obj_surface->y_cb_offset = obj_surface->height;
return 1;
default:
- assert(0);
+ ASSERT_RET(0, 0);
return 0;
}
}
for (i = 0; i < num_attribs && attrib_list; i++) {
if ((attrib_list[i].type == VASurfaceAttribPixelFormat) &&
(attrib_list[i].flags & VA_SURFACE_ATTRIB_SETTABLE)) {
- assert(attrib_list[i].value.type == VAGenericValueTypeInteger);
+ ASSERT_RET(attrib_list[i].value.type == VAGenericValueTypeInteger, VA_STATUS_ERROR_INVALID_PARAMETER);
expected_fourcc = attrib_list[i].value.value.i;
}
if ((attrib_list[i].type == VASurfaceAttribMemoryType) &&
(attrib_list[i].flags & VA_SURFACE_ATTRIB_SETTABLE)) {
- assert(attrib_list[i].value.type == VAGenericValueTypeInteger);
+ ASSERT_RET(attrib_list[i].value.type == VAGenericValueTypeInteger, VA_STATUS_ERROR_INVALID_PARAMETER);
if (attrib_list[i].value.value.i == VA_SURFACE_ATTRIB_MEM_TYPE_KERNEL_DRM)
memory_type = I965_SURFACE_MEM_GEM_FLINK; /* flinked GEM handle */
if ((attrib_list[i].type == VASurfaceAttribExternalBufferDescriptor) &&
(attrib_list[i].flags == VA_SURFACE_ATTRIB_SETTABLE)) {
- assert(attrib_list[i].value.type == VAGenericValueTypePointer);
+ ASSERT_RET(attrib_list[i].value.type == VAGenericValueTypePointer, VA_STATUS_ERROR_INVALID_PARAMETER);
memory_attibute = (VASurfaceAttribExternalBuffers *)attrib_list[i].value.value.p;
}
}
if (memory_attibute->pixel_format) {
if (expected_fourcc)
- assert(memory_attibute->pixel_format == expected_fourcc);
+ ASSERT_RET(memory_attibute->pixel_format == expected_fourcc, VA_STATUS_ERROR_INVALID_PARAMETER);
else
expected_fourcc = memory_attibute->pixel_format;
}
- assert(expected_fourcc);
+ ASSERT_RET(expected_fourcc, VA_STATUS_ERROR_INVALID_PARAMETER);
if (memory_attibute->pitches[0]) {
int bpp_1stplane = bpp_1stplane_by_fourcc(expected_fourcc);
- assert(bpp_1stplane);
+ ASSERT_RET(bpp_1stplane, VA_STATUS_ERROR_INVALID_PARAMETER);
obj_surface->width = memory_attibute->pitches[0]/bpp_1stplane;
obj_surface->user_h_stride_set = true;
- assert(IS_ALIGNED(obj_surface->width, 16));
- assert(obj_surface->width >= width);
+ ASSERT_RET(IS_ALIGNED(obj_surface->width, 16), VA_STATUS_ERROR_INVALID_PARAMETER);
+ ASSERT_RET(obj_surface->width >= width, VA_STATUS_ERROR_INVALID_PARAMETER);
if (memory_attibute->offsets[1]) {
- assert(!memory_attibute->offsets[0]);
+ ASSERT_RET(!memory_attibute->offsets[0], VA_STATUS_ERROR_INVALID_PARAMETER);
obj_surface->height = memory_attibute->offsets[1]/memory_attibute->pitches[0];
obj_surface->user_v_stride_set = true;
- assert(IS_ALIGNED(obj_surface->height, 16));
- assert(obj_surface->height >= height);
+ ASSERT_RET(IS_ALIGNED(obj_surface->height, 16), VA_STATUS_ERROR_INVALID_PARAMETER);
+ ASSERT_RET(obj_surface->height >= height, VA_STATUS_ERROR_INVALID_PARAMETER);
}
}
}
for (i = num_surfaces; i--; ) {
struct object_surface *obj_surface = SURFACE(surface_list[i]);
- assert(obj_surface);
+ ASSERT_RET(obj_surface, VA_STATUS_ERROR_INVALID_SURFACE);
i965_destroy_surface(&i965->surface_heap, (struct object_base *)obj_surface);
}
if (!obj_subpic)
return VA_STATUS_ERROR_INVALID_SUBPICTURE;
- assert(obj_subpic->obj_image);
+ ASSERT_RET(obj_subpic->obj_image, VA_STATUS_ERROR_INVALID_SUBPICTURE);
i965_destroy_subpic(&i965->subpic_heap, (struct object_base *)obj_subpic);
return VA_STATUS_SUCCESS;
}
if (!obj_subpic)
return VA_STATUS_ERROR_INVALID_SUBPICTURE;
- assert(obj_subpic->obj_image);
+ ASSERT_RET(obj_subpic->obj_image, VA_STATUS_ERROR_INVALID_SUBPICTURE);
obj_subpic->src_rect.x = src_x;
obj_subpic->src_rect.y = src_y;
struct i965_driver_data *i965 = i965_driver_data(ctx);
struct object_context *obj_context = CONTEXT(context);
- assert(obj_context);
+ ASSERT_RET(obj_context, VA_STATUS_ERROR_INVALID_CONTEXT);
if (i965->current_context_id == context)
i965->current_context_id = VA_INVALID_ID;
struct object_buffer *obj_buffer = BUFFER(buf_id);
VAStatus vaStatus = VA_STATUS_SUCCESS;
- assert(obj_buffer);
-
- if (!obj_buffer)
- return VA_STATUS_ERROR_INVALID_BUFFER;
+ ASSERT_RET(obj_buffer, VA_STATUS_ERROR_INVALID_BUFFER);
if ((num_elements < 0) ||
(num_elements > obj_buffer->max_num_elements)) {
struct object_buffer *obj_buffer = BUFFER(buf_id);
VAStatus vaStatus = VA_STATUS_ERROR_UNKNOWN;
- assert(obj_buffer && obj_buffer->buffer_store);
- assert(obj_buffer->buffer_store->bo || obj_buffer->buffer_store->buffer);
- assert(!(obj_buffer->buffer_store->bo && obj_buffer->buffer_store->buffer));
-
- if (!obj_buffer || !obj_buffer->buffer_store)
- return VA_STATUS_ERROR_INVALID_BUFFER;
+ ASSERT_RET(obj_buffer && obj_buffer->buffer_store, VA_STATUS_ERROR_INVALID_BUFFER);
+ ASSERT_RET(obj_buffer->buffer_store->bo || obj_buffer->buffer_store->buffer, VA_STATUS_ERROR_INVALID_BUFFER);
+ ASSERT_RET(!(obj_buffer->buffer_store->bo && obj_buffer->buffer_store->buffer), VA_STATUS_ERROR_INVALID_BUFFER);
if (NULL != obj_buffer->buffer_store->bo) {
unsigned int tiling, swizzle;
else
dri_bo_map(obj_buffer->buffer_store->bo, 1);
- assert(obj_buffer->buffer_store->bo->virtual);
+ ASSERT_RET(obj_buffer->buffer_store->bo->virtual, VA_STATUS_ERROR_OPERATION_FAILED);
*pbuf = obj_buffer->buffer_store->bo->virtual;
if (obj_buffer->type == VAEncCodedBufferType) {
delimiter3 = MPEG2_DELIMITER3;
delimiter4 = MPEG2_DELIMITER4;
} else {
- assert(0);
+ ASSERT_RET(0, VA_STATUS_ERROR_UNSUPPORTED_PROFILE);
}
for (i = 0; i < obj_buffer->size_element - I965_CODEDBUFFER_HEADER_SIZE - 3 - 0x1000; i++) {
if ((buf_id & OBJECT_HEAP_OFFSET_MASK) != BUFFER_ID_OFFSET)
return VA_STATUS_ERROR_INVALID_BUFFER;
- assert(obj_buffer && obj_buffer->buffer_store);
- assert(obj_buffer->buffer_store->bo || obj_buffer->buffer_store->buffer);
- assert(!(obj_buffer->buffer_store->bo && obj_buffer->buffer_store->buffer));
-
- if (!obj_buffer || !obj_buffer->buffer_store)
- return VA_STATUS_ERROR_INVALID_BUFFER;
+ ASSERT_RET(obj_buffer && obj_buffer->buffer_store, VA_STATUS_ERROR_INVALID_BUFFER);
+ ASSERT_RET(obj_buffer->buffer_store->bo || obj_buffer->buffer_store->buffer, VA_STATUS_ERROR_OPERATION_FAILED);
+ ASSERT_RET(!(obj_buffer->buffer_store->bo && obj_buffer->buffer_store->buffer), VA_STATUS_ERROR_OPERATION_FAILED);
if (NULL != obj_buffer->buffer_store->bo) {
unsigned int tiling, swizzle;
struct i965_driver_data *i965 = i965_driver_data(ctx);
struct object_buffer *obj_buffer = BUFFER(buffer_id);
- assert(obj_buffer);
-
- if (!obj_buffer)
- return VA_STATUS_ERROR_INVALID_BUFFER;
+ ASSERT_RET(obj_buffer, VA_STATUS_ERROR_INVALID_BUFFER);
i965_destroy_buffer(&i965->buffer_heap, (struct object_base *)obj_buffer);
VAStatus vaStatus;
int i;
- assert(obj_context);
-
- if (!obj_context)
- return VA_STATUS_ERROR_INVALID_CONTEXT;
-
- assert(obj_surface);
-
- if (!obj_surface)
- return VA_STATUS_ERROR_INVALID_SURFACE;
-
+ ASSERT_RET(obj_context, VA_STATUS_ERROR_INVALID_CONTEXT);
+ ASSERT_RET(obj_surface, VA_STATUS_ERROR_INVALID_SURFACE);
obj_config = obj_context->obj_config;
- assert(obj_config);
+ ASSERT_RET(obj_config, VA_STATUS_ERROR_INVALID_CONFIG);
switch (obj_config->profile) {
case VAProfileMPEG2Simple:
break;
default:
- assert(0);
- vaStatus = VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
+ ASSERT_RET(0, VA_STATUS_ERROR_UNSUPPORTED_PROFILE);
break;
}
VAStatus vaStatus = VA_STATUS_SUCCESS;
int i;
- assert(obj_context);
-
- if (!obj_context)
- return VA_STATUS_ERROR_INVALID_CONTEXT;
+ ASSERT_RET(obj_context, VA_STATUS_ERROR_INVALID_CONTEXT);
for (i = 0; i < num_buffers && vaStatus == VA_STATUS_SUCCESS; i++) {
struct object_buffer *obj_buffer = BUFFER(buffers[i]);
{
struct encode_state *encode = &obj_context->codec_state.encode;
- assert(obj_buffer->buffer_store->bo == NULL);
- assert(obj_buffer->buffer_store->buffer);
+ ASSERT_RET(obj_buffer->buffer_store->bo == NULL, VA_STATUS_ERROR_INVALID_BUFFER);
+ ASSERT_RET(obj_buffer->buffer_store->buffer, VA_STATUS_ERROR_INVALID_BUFFER);
i965_release_buffer_store(&encode->packed_header_param[type_index]);
i965_reference_buffer_store(&encode->packed_header_param[type_index], obj_buffer->buffer_store);
{
struct encode_state *encode = &obj_context->codec_state.encode;
- assert(obj_buffer->buffer_store->bo == NULL);
- assert(obj_buffer->buffer_store->buffer);
+ ASSERT_RET(obj_buffer->buffer_store->bo == NULL, VA_STATUS_ERROR_INVALID_BUFFER);
+ ASSERT_RET(obj_buffer->buffer_store->buffer, VA_STATUS_ERROR_INVALID_BUFFER);
i965_release_buffer_store(&encode->packed_header_data[type_index]);
i965_reference_buffer_store(&encode->packed_header_data[type_index], obj_buffer->buffer_store);
struct encode_state *encode = &obj_context->codec_state.encode;
VAEncMiscParameterBuffer *param = NULL;
- assert(obj_buffer->buffer_store->bo == NULL);
- assert(obj_buffer->buffer_store->buffer);
+ ASSERT_RET(obj_buffer->buffer_store->bo == NULL, VA_STATUS_ERROR_INVALID_BUFFER);
+ ASSERT_RET(obj_buffer->buffer_store->buffer, VA_STATUS_ERROR_INVALID_BUFFER);
param = (VAEncMiscParameterBuffer *)obj_buffer->buffer_store->buffer;
VAStatus vaStatus = VA_STATUS_ERROR_UNKNOWN;
int i;
- assert(obj_context);
-
- if (!obj_context)
- return VA_STATUS_ERROR_INVALID_CONTEXT;
+ ASSERT_RET(obj_context, VA_STATUS_ERROR_INVALID_CONTEXT);
for (i = 0; i < num_buffers; i++) {
struct object_buffer *obj_buffer = BUFFER(buffers[i]);
{
struct encode_state *encode = &obj_context->codec_state.encode;
- assert(encode->last_packed_header_type == VAEncPackedHeaderSequence ||
+ ASSERT_RET(encode->last_packed_header_type == VAEncPackedHeaderSequence ||
encode->last_packed_header_type == VAEncPackedHeaderPicture ||
encode->last_packed_header_type == VAEncPackedHeaderSlice ||
(((encode->last_packed_header_type & VAEncPackedHeaderMiscMask) == VAEncPackedHeaderMiscMask) &&
- ((encode->last_packed_header_type & (~VAEncPackedHeaderMiscMask)) != 0)));
+ ((encode->last_packed_header_type & (~VAEncPackedHeaderMiscMask)) != 0)),
+ VA_STATUS_ERROR_ENCODING_ERROR);
vaStatus = i965_encoder_render_packed_header_data_buffer(ctx,
obj_context,
obj_buffer,
VAStatus vaStatus = VA_STATUS_SUCCESS;
int i;
- assert(obj_context);
-
- if (!obj_context)
- return VA_STATUS_ERROR_INVALID_CONTEXT;
+ ASSERT_RET(obj_context, VA_STATUS_ERROR_INVALID_CONTEXT);
for (i = 0; i < num_buffers && vaStatus == VA_STATUS_SUCCESS; i++) {
struct object_buffer *obj_buffer = BUFFER(buffers[i]);
VAStatus vaStatus = VA_STATUS_ERROR_UNKNOWN;
obj_context = CONTEXT(context);
- assert(obj_context);
-
- if (!obj_context)
- return VA_STATUS_ERROR_INVALID_CONTEXT;
+ ASSERT_RET(obj_context, VA_STATUS_ERROR_INVALID_CONTEXT);
if (num_buffers <= 0)
return VA_STATUS_ERROR_INVALID_PARAMETER;
obj_config = obj_context->obj_config;
- assert(obj_config);
+ ASSERT_RET(obj_config, VA_STATUS_ERROR_INVALID_CONFIG);
if (VAEntrypointVideoProc == obj_config->entrypoint) {
vaStatus = i965_proc_render_picture(ctx, context, buffers, num_buffers);
struct object_context *obj_context = CONTEXT(context);
struct object_config *obj_config;
- assert(obj_context);
-
- if (!obj_context)
- return VA_STATUS_ERROR_INVALID_CONTEXT;
-
+ ASSERT_RET(obj_context, VA_STATUS_ERROR_INVALID_CONTEXT);
obj_config = obj_context->obj_config;
- assert(obj_config);
+ ASSERT_RET(obj_config, VA_STATUS_ERROR_INVALID_CONFIG);
if (obj_context->codec_type == CODEC_PROC) {
- assert(VAEntrypointVideoProc == obj_config->entrypoint);
+ ASSERT_RET(VAEntrypointVideoProc == obj_config->entrypoint, VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT);
} else if (obj_context->codec_type == CODEC_ENC) {
- assert(VAEntrypointEncSlice == obj_config->entrypoint);
+ ASSERT_RET(VAEntrypointEncSlice == obj_config->entrypoint, VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT);
if (!(obj_context->codec_state.encode.pic_param ||
obj_context->codec_state.encode.pic_param_ext)) {
}
}
- assert(obj_context->hw_context->run);
+ ASSERT_RET(obj_context->hw_context->run, VA_STATUS_ERROR_OPERATION_FAILED);
return obj_context->hw_context->run(ctx, obj_config->profile, &obj_context->codec_state, obj_context->hw_context);
}
struct i965_driver_data *i965 = i965_driver_data(ctx);
struct object_surface *obj_surface = SURFACE(render_target);
- assert(obj_surface);
+ ASSERT_RET(obj_surface, VA_STATUS_ERROR_INVALID_SURFACE);
if(obj_surface->bo)
drm_intel_bo_wait_rendering(obj_surface->bo);
struct i965_driver_data *i965 = i965_driver_data(ctx);
struct object_surface *obj_surface = SURFACE(render_target);
- assert(obj_surface);
+ ASSERT_RET(obj_surface, VA_STATUS_ERROR_INVALID_SURFACE);
if (obj_surface->bo) {
if (drm_intel_bo_busy(obj_surface->bo)){
return va_status;
}
-void
+VAStatus
i965_check_alloc_surface_bo(VADriverContextP ctx,
struct object_surface *obj_surface,
int tiled,
int region_width, region_height;
if (obj_surface->bo) {
- assert(obj_surface->fourcc);
- assert(obj_surface->fourcc == fourcc);
- assert(obj_surface->subsampling == subsampling);
- return;
+ ASSERT_RET(obj_surface->fourcc, VA_STATUS_ERROR_INVALID_SURFACE);
+ ASSERT_RET(obj_surface->fourcc == fourcc, VA_STATUS_ERROR_INVALID_SURFACE);
+ ASSERT_RET(obj_surface->subsampling == subsampling, VA_STATUS_ERROR_INVALID_SURFACE);
+ return VA_STATUS_SUCCESS;
}
obj_surface->x_cb_offset = 0; /* X offset is always 0 */
obj_surface->x_cr_offset = 0;
if ((tiled && !obj_surface->user_disable_tiling)) {
- assert(fourcc != VA_FOURCC('I', '4', '2', '0') &&
+ ASSERT_RET(fourcc != VA_FOURCC('I', '4', '2', '0') &&
fourcc != VA_FOURCC('I', 'Y', 'U', 'V') &&
- fourcc != VA_FOURCC('Y', 'V', '1', '2'));
+ fourcc != VA_FOURCC('Y', 'V', '1', '2'),
+ VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT);
if (obj_surface->user_h_stride_set) {
- assert(IS_ALIGNED(obj_surface->width, 128));
+ ASSERT_RET(IS_ALIGNED(obj_surface->width, 128), VA_STATUS_ERROR_INVALID_PARAMETER);
} else
obj_surface->width = ALIGN(obj_surface->orig_width, 128);
if (obj_surface->user_v_stride_set) {
- assert(IS_ALIGNED(obj_surface->height, 32));
+ ASSERT_RET(IS_ALIGNED(obj_surface->height, 32), VA_STATUS_ERROR_INVALID_PARAMETER);
} else
obj_surface->height = ALIGN(obj_surface->orig_height, 32);
default:
/* Never get here */
- assert(0);
+ ASSERT_RET(0, VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT);
break;
}
} else {
default:
/* Never get here */
- assert(0);
+ ASSERT_RET(0, VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT);
break;
}
}
obj_surface->fourcc = fourcc;
obj_surface->subsampling = subsampling;
assert(obj_surface->bo);
+ return VA_STATUS_SUCCESS;
}
VAStatus i965_DeriveImage(VADriverContextP ctx,
unsigned int fourcc = VA_FOURCC('Y', 'V', '1', '2');
i965_guess_surface_format(ctx, surface, &fourcc, &is_tiled);
int sampling = get_sampling_from_fourcc(fourcc);
- i965_check_alloc_surface_bo(ctx, obj_surface, is_tiled, fourcc, sampling);
+ va_status = i965_check_alloc_surface_bo(ctx, obj_surface, is_tiled, fourcc, sampling);
}
- assert(obj_surface->fourcc);
+ if (va_status != VA_STATUS_SUCCESS)
+ return va_status;
+
+ ASSERT_RET(obj_surface->fourcc, VA_STATUS_ERROR_INVALID_SURFACE);
w_pitch = obj_surface->width;
break;
default:
/* Never get here */
- assert(0);
+ ASSERT_RET(0, 0);
break;
}
}
}
-static void
+static VAStatus
get_image_i420(struct object_image *obj_image, uint8_t *image_data,
struct object_surface *obj_surface,
const VARectangle *rect)
const int U = obj_image->image.format.fourcc == obj_surface->fourcc ? 1 : 2;
const int V = obj_image->image.format.fourcc == obj_surface->fourcc ? 2 : 1;
unsigned int tiling, swizzle;
+ VAStatus va_status = VA_STATUS_SUCCESS;
if (!obj_surface->bo)
- return;
+ return VA_STATUS_ERROR_INVALID_SURFACE;
- assert(obj_surface->fourcc);
+ ASSERT_RET(obj_surface->fourcc, VA_STATUS_ERROR_INVALID_SURFACE);
dri_bo_get_tiling(obj_surface->bo, &tiling, &swizzle);
if (tiling != I915_TILING_NONE)
dri_bo_map(obj_surface->bo, 0);
if (!obj_surface->bo->virtual)
- return;
+ return VA_STATUS_ERROR_INVALID_SURFACE;
/* Dest VA image has either I420 or YV12 format.
Source VA surface alway has I420 format */
drm_intel_gem_bo_unmap_gtt(obj_surface->bo);
else
dri_bo_unmap(obj_surface->bo);
+
+ return va_status;
}
-static void
+static VAStatus
get_image_nv12(struct object_image *obj_image, uint8_t *image_data,
struct object_surface *obj_surface,
const VARectangle *rect)
{
uint8_t *dst[2], *src[2];
unsigned int tiling, swizzle;
+ VAStatus va_status = VA_STATUS_SUCCESS;
if (!obj_surface->bo)
- return;
+ return VA_STATUS_ERROR_INVALID_SURFACE;
assert(obj_surface->fourcc);
dri_bo_get_tiling(obj_surface->bo, &tiling, &swizzle);
dri_bo_map(obj_surface->bo, 0);
if (!obj_surface->bo->virtual)
- return;
+ return VA_STATUS_ERROR_INVALID_SURFACE;
/* Both dest VA image and source surface have NV12 format */
dst[0] = image_data + obj_image->image.offsets[0];
drm_intel_gem_bo_unmap_gtt(obj_surface->bo);
else
dri_bo_unmap(obj_surface->bo);
+
+ return va_status;
}
-static void
+static VAStatus
get_image_yuy2(struct object_image *obj_image, uint8_t *image_data,
struct object_surface *obj_surface,
const VARectangle *rect)
{
uint8_t *dst, *src;
unsigned int tiling, swizzle;
+ VAStatus va_status = VA_STATUS_SUCCESS;
if (!obj_surface->bo)
- return;
+ return VA_STATUS_ERROR_INVALID_SURFACE;
assert(obj_surface->fourcc);
dri_bo_get_tiling(obj_surface->bo, &tiling, &swizzle);
dri_bo_map(obj_surface->bo, 0);
if (!obj_surface->bo->virtual)
- return;
+ return VA_STATUS_ERROR_INVALID_SURFACE;
/* Both dest VA image and source surface have YUYV format */
dst = image_data + obj_image->image.offsets[0];
drm_intel_gem_bo_unmap_gtt(obj_surface->bo);
else
dri_bo_unmap(obj_surface->bo);
+
+ return va_status;
}
static VAStatus
{
struct i965_driver_data *i965 = i965_driver_data(ctx);
struct i965_render_state *render_state = &i965->render_state;
+ VAStatus va_status = VA_STATUS_SUCCESS;
struct object_surface *obj_surface = SURFACE(surface);
if (!obj_surface)
if (obj_surface->fourcc != obj_image->image.format.fourcc)
return VA_STATUS_ERROR_INVALID_IMAGE_FORMAT;
- VAStatus va_status;
void *image_data = NULL;
va_status = i965_MapBuffer(ctx, obj_image->image.buf, &image_data);
break;
}
- i965_UnmapBuffer(ctx, obj_image->image.buf);
+ if (va_status != VA_STATUS_SUCCESS)
+ return va_status;
+
+ va_status = i965_UnmapBuffer(ctx, obj_image->image.buf);
return va_status;
}
struct i965_driver_data *i965 = i965_driver_data(ctx);
struct i965_surface src_surface;
struct i965_surface dst_surface;
- VAStatus va_status;
+ VAStatus va_status = VA_STATUS_SUCCESS;
VARectangle rect;
struct object_surface *obj_surface = SURFACE(surface);
struct object_image *obj_image = IMAGE(image);
VAImageID image)
{
struct i965_driver_data * const i965 = i965_driver_data(ctx);
- VAStatus va_status;
+ VAStatus va_status = VA_STATUS_SUCCESS;
if (HAS_ACCELERATED_GETIMAGE(i965))
va_status = i965_hw_getimage(ctx,
return va_status;
}
-static void
+static VAStatus
put_image_i420(struct object_surface *obj_surface,
const VARectangle *dst_rect,
struct object_image *obj_image, uint8_t *image_data,
const int U = obj_image->image.format.fourcc == obj_surface->fourcc ? 1 : 2;
const int V = obj_image->image.format.fourcc == obj_surface->fourcc ? 2 : 1;
unsigned int tiling, swizzle;
+ VAStatus va_status = VA_STATUS_SUCCESS;
- if (!obj_surface->bo)
- return;
+ ASSERT_RET(obj_surface->bo, VA_STATUS_ERROR_INVALID_SURFACE);
- assert(obj_surface->fourcc);
- assert(dst_rect->width == src_rect->width);
- assert(dst_rect->height == src_rect->height);
+ ASSERT_RET(obj_surface->fourcc, VA_STATUS_ERROR_INVALID_SURFACE);
+ ASSERT_RET(dst_rect->width == src_rect->width, VA_STATUS_ERROR_UNIMPLEMENTED);
+ ASSERT_RET(dst_rect->height == src_rect->height, VA_STATUS_ERROR_UNIMPLEMENTED);
dri_bo_get_tiling(obj_surface->bo, &tiling, &swizzle);
if (tiling != I915_TILING_NONE)
dri_bo_map(obj_surface->bo, 0);
if (!obj_surface->bo->virtual)
- return;
+ return VA_STATUS_ERROR_INVALID_SURFACE;
/* Dest VA image has either I420 or YV12 format.
Source VA surface alway has I420 format */
drm_intel_gem_bo_unmap_gtt(obj_surface->bo);
else
dri_bo_unmap(obj_surface->bo);
+
+ return va_status;
}
-static void
+static VAStatus
put_image_nv12(struct object_surface *obj_surface,
const VARectangle *dst_rect,
struct object_image *obj_image, uint8_t *image_data,
{
uint8_t *dst[2], *src[2];
unsigned int tiling, swizzle;
+ VAStatus va_status = VA_STATUS_SUCCESS;
if (!obj_surface->bo)
- return;
+ return VA_STATUS_ERROR_INVALID_SURFACE;
- assert(obj_surface->fourcc);
- assert(dst_rect->width == src_rect->width);
- assert(dst_rect->height == src_rect->height);
+ ASSERT_RET(obj_surface->fourcc, VA_STATUS_ERROR_INVALID_SURFACE);
+ ASSERT_RET(dst_rect->width == src_rect->width, VA_STATUS_ERROR_UNIMPLEMENTED);
+ ASSERT_RET(dst_rect->height == src_rect->height, VA_STATUS_ERROR_UNIMPLEMENTED);
dri_bo_get_tiling(obj_surface->bo, &tiling, &swizzle);
if (tiling != I915_TILING_NONE)
dri_bo_map(obj_surface->bo, 0);
if (!obj_surface->bo->virtual)
- return;
+ return VA_STATUS_ERROR_INVALID_SURFACE;
/* Both dest VA image and source surface have NV12 format */
dst[0] = (uint8_t *)obj_surface->bo->virtual;
drm_intel_gem_bo_unmap_gtt(obj_surface->bo);
else
dri_bo_unmap(obj_surface->bo);
+
+ return va_status;
}
-static void
+static VAStatus
put_image_yuy2(struct object_surface *obj_surface,
const VARectangle *dst_rect,
struct object_image *obj_image, uint8_t *image_data,
{
uint8_t *dst, *src;
unsigned int tiling, swizzle;
+ VAStatus va_status = VA_STATUS_SUCCESS;
- if (!obj_surface->bo)
- return;
-
- assert(obj_surface->fourcc);
- assert(dst_rect->width == src_rect->width);
- assert(dst_rect->height == src_rect->height);
+ ASSERT_RET(obj_surface->bo, VA_STATUS_ERROR_INVALID_SURFACE);
+ ASSERT_RET(obj_surface->fourcc, VA_STATUS_ERROR_INVALID_SURFACE);
+ ASSERT_RET(dst_rect->width == src_rect->width, VA_STATUS_ERROR_UNIMPLEMENTED);
+ ASSERT_RET(dst_rect->height == src_rect->height, VA_STATUS_ERROR_UNIMPLEMENTED);
dri_bo_get_tiling(obj_surface->bo, &tiling, &swizzle);
if (tiling != I915_TILING_NONE)
dri_bo_map(obj_surface->bo, 0);
if (!obj_surface->bo->virtual)
- return;
+ return VA_STATUS_ERROR_INVALID_SURFACE;
/* Both dest VA image and source surface have YUY2 format */
dst = (uint8_t *)obj_surface->bo->virtual;
drm_intel_gem_bo_unmap_gtt(obj_surface->bo);
else
dri_bo_unmap(obj_surface->bo);
+
+ return va_status;
}
{
struct i965_driver_data *i965 = i965_driver_data(ctx);
struct object_surface *obj_surface = SURFACE(surface);
-
- if (!obj_surface)
- return VA_STATUS_ERROR_INVALID_SURFACE;
-
struct object_image *obj_image = IMAGE(image);
- if (!obj_image)
- return VA_STATUS_ERROR_INVALID_IMAGE;
+ VAStatus va_status = VA_STATUS_SUCCESS;
+ void *image_data = NULL;
+
+ ASSERT_RET(obj_surface, VA_STATUS_ERROR_INVALID_SURFACE);
+ ASSERT_RET(obj_image, VA_STATUS_ERROR_INVALID_IMAGE);
if (src_x < 0 || src_y < 0)
return VA_STATUS_ERROR_INVALID_PARAMETER;
else {
/* VA is surface not used for decoding, use same VA image format */
- i965_check_alloc_surface_bo(
+ va_status = i965_check_alloc_surface_bo(
ctx,
obj_surface,
0, /* XXX: don't use tiled surface */
get_sampling_from_fourcc (obj_image->image.format.fourcc));
}
- VAStatus va_status;
- void *image_data = NULL;
+ if (va_status != VA_STATUS_SUCCESS)
+ return va_status;
va_status = i965_MapBuffer(ctx, obj_image->image.buf, &image_data);
if (va_status != VA_STATUS_SUCCESS)
switch (obj_image->image.format.fourcc) {
case VA_FOURCC('Y','V','1','2'):
case VA_FOURCC('I','4','2','0'):
- put_image_i420(obj_surface, &dest_rect, obj_image, image_data, &src_rect);
+ va_status = put_image_i420(obj_surface, &dest_rect, obj_image, image_data, &src_rect);
break;
case VA_FOURCC('N','V','1','2'):
- put_image_nv12(obj_surface, &dest_rect, obj_image, image_data, &src_rect);
+ va_status = put_image_nv12(obj_surface, &dest_rect, obj_image, image_data, &src_rect);
break;
case VA_FOURCC('Y','U','Y','2'):
- put_image_yuy2(obj_surface, &dest_rect, obj_image, image_data, &src_rect);
+ va_status = put_image_yuy2(obj_surface, &dest_rect, obj_image, image_data, &src_rect);
break;
default:
va_status = VA_STATUS_ERROR_OPERATION_FAILED;
break;
}
+ if (va_status != VA_STATUS_SUCCESS)
+ return va_status;
- i965_UnmapBuffer(ctx, obj_image->image.buf);
+ va_status = i965_UnmapBuffer(ctx, obj_image->image.buf);
return va_status;
}
VAStatus va_status = VA_STATUS_SUCCESS;
VARectangle src_rect, dst_rect;
- if (!obj_surface)
- return VA_STATUS_ERROR_INVALID_SURFACE;
-
- if (!obj_image || !obj_image->bo)
- return VA_STATUS_ERROR_INVALID_IMAGE;
+ ASSERT_RET(obj_surface,VA_STATUS_ERROR_INVALID_SURFACE);
+ ASSERT_RET(obj_image && obj_image->bo, VA_STATUS_ERROR_INVALID_IMAGE);
if (src_x < 0 ||
src_y < 0 ||
surface_sampling);
}
- assert(obj_surface->fourcc);
+ ASSERT_RET(obj_surface->fourcc, VA_STATUS_ERROR_INVALID_SURFACE);
src_surface.base = (struct object_base *)obj_image;
src_surface.type = I965_SURFACE_TYPE_IMAGE;
i965 = i965_driver_data(ctx);
obj_buffer = BUFFER(buf_id);
- assert(obj_buffer);
-
- if (!obj_buffer)
- return VA_STATUS_ERROR_INVALID_BUFFER;
+ ASSERT_RET(obj_buffer, VA_STATUS_ERROR_INVALID_BUFFER);
*type = obj_buffer->type;
*size = obj_buffer->size_element;
struct object_surface *obj_surface = NULL;
VAImage tmpImage;
- assert(fourcc);
- assert(luma_stride);
- assert(chroma_u_stride);
- assert(chroma_v_stride);
- assert(luma_offset);
- assert(chroma_u_offset);
- assert(chroma_v_offset);
- assert(buffer_name);
- assert(buffer);
+ ASSERT_RET(fourcc, VA_STATUS_ERROR_INVALID_PARAMETER);
+ ASSERT_RET(luma_stride, VA_STATUS_ERROR_INVALID_PARAMETER);
+ ASSERT_RET(chroma_u_stride, VA_STATUS_ERROR_INVALID_PARAMETER);
+ ASSERT_RET(chroma_v_stride, VA_STATUS_ERROR_INVALID_PARAMETER);
+ ASSERT_RET(luma_offset, VA_STATUS_ERROR_INVALID_PARAMETER);
+ ASSERT_RET(chroma_u_offset, VA_STATUS_ERROR_INVALID_PARAMETER);
+ ASSERT_RET(chroma_v_offset, VA_STATUS_ERROR_INVALID_PARAMETER);
+ ASSERT_RET(buffer_name, VA_STATUS_ERROR_INVALID_PARAMETER);
+ ASSERT_RET(buffer, VA_STATUS_ERROR_INVALID_PARAMETER);
tmpImage.image_id = VA_INVALID_ID;
} else if (base->type == VAProcFilterDeinterlacing) {
VAProcFilterParameterBufferDeinterlacing *deint = (VAProcFilterParameterBufferDeinterlacing *)base;
- assert(deint->algorithm == VAProcDeinterlacingBob ||
+ ASSERT_RET(deint->algorithm == VAProcDeinterlacingBob ||
deint->algorithm == VAProcDeinterlacingMotionAdaptive ||
- deint->algorithm == VAProcDeinterlacingMotionCompensated);
+ deint->algorithm == VAProcDeinterlacingMotionCompensated,
+ VA_STATUS_ERROR_INVALID_PARAMETER);
if (deint->algorithm == VAProcDeinterlacingMotionAdaptive ||
deint->algorithm == VAProcDeinterlacingMotionCompensated);