obj_surface->subpic_render_idx = 0;
for(j = 0; j < I965_MAX_SUBPIC_SUM; j++){
obj_surface->subpic[j] = VA_INVALID_ID;
+ obj_surface->obj_subpic[j] = NULL;
}
obj_surface->width = ALIGN(width, 16);
*subpicture = subpicID;
obj_subpic->image = image;
+ obj_subpic->obj_image = obj_image;
obj_subpic->format = m->format;
obj_subpic->width = obj_image->image.width;
obj_subpic->height = obj_image->image.height;
{
struct i965_driver_data *i965 = i965_driver_data(ctx);
struct object_subpic *obj_subpic = SUBPIC(subpicture);
+
+ if (!obj_subpic)
+ return VA_STATUS_ERROR_INVALID_SUBPICTURE;
+
+ assert(obj_subpic->obj_image);
i965_destroy_subpic(&i965->subpic_heap, (struct object_base *)obj_subpic);
return VA_STATUS_SUCCESS;
}
if(global_alpha > 1.0 || global_alpha < 0.0){
return VA_STATUS_ERROR_INVALID_PARAMETER;
}
+
+ if (!obj_subpic)
+ return VA_STATUS_ERROR_INVALID_SUBPICTURE;
+
obj_subpic->global_alpha = global_alpha;
return VA_STATUS_SUCCESS;
struct object_subpic *obj_subpic = SUBPIC(subpicture);
int i, j;
+ if (!obj_subpic)
+ return VA_STATUS_ERROR_INVALID_SUBPICTURE;
+
+ assert(obj_subpic->obj_image);
+
obj_subpic->src_rect.x = src_x;
obj_subpic->src_rect.y = src_y;
obj_subpic->src_rect.width = src_width;
for(j = 0; j < I965_MAX_SUBPIC_SUM; j ++){
if(obj_surface->subpic[j] == VA_INVALID_ID){
- obj_surface->subpic[j] = subpicture;
- break;
+ assert(obj_surface->obj_subpic[j] == NULL);
+ obj_surface->subpic[j] = subpicture;
+ obj_surface->obj_subpic[j] = obj_subpic;
+ break;
}
}
int num_surfaces)
{
struct i965_driver_data *i965 = i965_driver_data(ctx);
+ struct object_subpic *obj_subpic = SUBPIC(subpicture);
int i, j;
+ if (!obj_subpic)
+ return VA_STATUS_ERROR_INVALID_SUBPICTURE;
+
for (i = 0; i < num_surfaces; i++) {
struct object_surface *obj_surface = SURFACE(target_surfaces[i]);
if (!obj_surface)
return VA_STATUS_ERROR_INVALID_SURFACE;
for(j = 0; j < I965_MAX_SUBPIC_SUM; j ++){
- if(obj_surface->subpic[j] == subpicture){
- obj_surface->subpic[j] = VA_INVALID_ID;
- break;
+ if (obj_surface->subpic[j] == subpicture) {
+ assert(obj_surface->obj_subpic[j] == obj_subpic);
+ obj_surface->subpic[j] = VA_INVALID_ID;
+ obj_surface->obj_subpic[j] = NULL;
+ break;
}
}
i965_subpic_render_src_surfaces_state(VADriverContextP ctx,
struct object_surface *obj_surface)
{
- struct i965_driver_data *i965 = i965_driver_data(ctx);
dri_bo *subpic_region;
unsigned int index = obj_surface->subpic_render_idx;
- struct object_subpic *obj_subpic = SUBPIC(obj_surface->subpic[index]);
- struct object_image *obj_image = IMAGE(obj_subpic->image);
+ struct object_subpic *obj_subpic = obj_surface->obj_subpic[index];
+ struct object_image *obj_image = obj_subpic->obj_image;
assert(obj_surface);
assert(obj_surface->bo);
subpic_region = obj_image->bo;
struct object_surface *obj_surface,
const VARectangle *output_rect)
{
- struct i965_driver_data *i965 = i965_driver_data(ctx);
unsigned int index = obj_surface->subpic_render_idx;
- struct object_subpic *obj_subpic = SUBPIC(obj_surface->subpic[index]);
+ struct object_subpic *obj_subpic = obj_surface->obj_subpic[index];
float tex_coords[4], vid_coords[4];
VARectangle dst_rect;
float *constant_buffer;
float global_alpha = 1.0;
unsigned int index = obj_surface->subpic_render_idx;
-
- if(obj_surface->subpic[index] != VA_INVALID_ID){
- struct object_subpic *obj_subpic= SUBPIC(obj_surface->subpic[index]);
- if(obj_subpic->flags & VA_SUBPICTURE_GLOBAL_ALPHA){
- global_alpha = obj_subpic->global_alpha;
- }
- }
+ struct object_subpic *obj_subpic = obj_surface->obj_subpic[index];
+
+ if (obj_subpic->flags & VA_SUBPICTURE_GLOBAL_ALPHA) {
+ global_alpha = obj_subpic->global_alpha;
+ }
dri_bo_map(render_state->curbe.bo, 1);
static void
i965_render_upload_image_palette(
VADriverContextP ctx,
- VAImageID image_id,
+ struct object_image *obj_image,
unsigned int alpha
)
{
struct intel_batchbuffer *batch = i965->batch;
unsigned int i;
- struct object_image *obj_image = IMAGE(image_id);
assert(obj_image);
+ if (!obj_image)
+ return;
+
if (obj_image->image.num_palette_entries == 0)
return;
struct i965_driver_data *i965 = i965_driver_data(ctx);
struct intel_batchbuffer *batch = i965->batch;
unsigned int index = obj_surface->subpic_render_idx;
- struct object_subpic *obj_subpic = SUBPIC(obj_surface->subpic[index]);
+ struct object_subpic *obj_subpic = obj_surface->obj_subpic[index];
assert(obj_subpic);
i965_render_initialize(ctx);
i965_subpic_render_state_setup(ctx, obj_surface, src_rect, dst_rect);
i965_subpic_render_pipeline_setup(ctx);
- i965_render_upload_image_palette(ctx, obj_subpic->image, 0xff);
+ i965_render_upload_image_palette(ctx, obj_subpic->obj_image, 0xff);
intel_batchbuffer_flush(batch);
}
struct i965_driver_data *i965 = i965_driver_data(ctx);
struct intel_batchbuffer *batch = i965->batch;
unsigned int index = obj_surface->subpic_render_idx;
- struct object_subpic *obj_subpic = SUBPIC(obj_surface->subpic[index]);
+ struct object_subpic *obj_subpic = obj_surface->obj_subpic[index];
assert(obj_subpic);
gen6_render_initialize(ctx);
gen6_subpicture_render_setup_states(ctx, obj_surface, src_rect, dst_rect);
gen6_render_emit_states(ctx, PS_SUBPIC_KERNEL);
- i965_render_upload_image_palette(ctx, obj_subpic->image, 0xff);
+ i965_render_upload_image_palette(ctx, obj_subpic->obj_image, 0xff);
intel_batchbuffer_flush(batch);
}
struct i965_driver_data *i965 = i965_driver_data(ctx);
struct intel_batchbuffer *batch = i965->batch;
unsigned int index = obj_surface->subpic_render_idx;
- struct object_subpic *obj_subpic = SUBPIC(obj_surface->subpic[index]);
+ struct object_subpic *obj_subpic = obj_surface->obj_subpic[index];
assert(obj_subpic);
gen7_render_initialize(ctx);
gen7_subpicture_render_setup_states(ctx, obj_surface, src_rect, dst_rect);
gen7_render_emit_states(ctx, PS_SUBPIC_KERNEL);
- i965_render_upload_image_palette(ctx, obj_subpic->image, 0xff);
+ i965_render_upload_image_palette(ctx, obj_subpic->obj_image, 0xff);
intel_batchbuffer_flush(batch);
}