obj_subpic->height = obj_image->image.height;
obj_subpic->pitch = obj_image->image.pitches[0];
obj_subpic->bo = obj_image->bo;
+ obj_subpic->global_alpha = 1.0;
+
return VA_STATUS_SUCCESS;
}
VASubpictureID subpicture,
float global_alpha)
{
- /* TODO */
- return VA_STATUS_ERROR_UNIMPLEMENTED;
+ struct i965_driver_data *i965 = i965_driver_data(ctx);
+ struct object_subpic *obj_subpic = SUBPIC(subpicture);
+
+ if(global_alpha > 1.0 || global_alpha < 0.0){
+ return VA_STATUS_ERROR_INVALID_PARAMETER;
+ }
+ obj_subpic->global_alpha = global_alpha;
+
+ return VA_STATUS_SUCCESS;
}
VAStatus
int width;
int height;
int pitch;
+ float global_alpha;
dri_bo *bo;
unsigned int flags;
};
}
static void
+i965_subpic_render_upload_constants(VADriverContextP ctx,
+ VASurfaceID surface)
+{
+ struct i965_driver_data *i965 = i965_driver_data(ctx);
+ struct i965_render_state *render_state = &i965->render_state;
+ float *constant_buffer;
+ float global_alpha = 1.0;
+ struct object_surface *obj_surface = SURFACE(surface);
+
+ if(obj_surface->subpic != VA_INVALID_ID){
+ struct object_subpic *obj_subpic= SUBPIC(obj_surface->subpic);
+ if(obj_subpic->flags & VA_SUBPICTURE_GLOBAL_ALPHA){
+ global_alpha = obj_subpic->global_alpha;
+ }
+ }
+
+ dri_bo_map(render_state->curbe.bo, 1);
+
+ assert(render_state->curbe.bo->virtual);
+ constant_buffer = render_state->curbe.bo->virtual;
+ *constant_buffer = global_alpha;
+
+ dri_bo_unmap(render_state->curbe.bo);
+}
+
+static void
i965_surface_render_state_setup(
VADriverContextP ctx,
VASurfaceID surface,
i965_subpic_render_wm_unit(ctx);
i965_render_cc_viewport(ctx);
i965_subpic_render_cc_unit(ctx);
+ i965_subpic_render_upload_constants(ctx, surface);
i965_subpic_render_upload_vertex(ctx, surface, dst_rect);
}
gen6_render_color_calc_state(ctx);
gen6_subpicture_render_blend_state(ctx);
gen6_render_depth_stencil_state(ctx);
+ i965_subpic_render_upload_constants(ctx, surface);
i965_subpic_render_upload_vertex(ctx, surface, dst_rect);
}
gen7_render_color_calc_state(ctx);
gen7_subpicture_render_blend_state(ctx);
gen7_render_depth_stencil_state(ctx);
+ i965_subpic_render_upload_constants(ctx, surface);
i965_subpic_render_upload_vertex(ctx, surface, dst_rect);
}
/* Sample the src surface */
include(`exa_wm.g4i')
+
+define(`global_alpha', `r2.0<0,1,0>f')
/* prepare sampler read back gX register, which would be written back to output */
sampler (1,0,F) /* sampler message description, (binding_table,sampler_index,datatype)
/* here(src->dst) we should use src_sampler and src_surface */
mlen 5 rlen 8 { align1 }; /* required message len 5, readback len 8 */
+
+mul (8) src_sample_a_01<1>f src_sample_a_01<1>f global_alpha { align1 };
+mul (8) src_sample_a_23<1>f src_sample_a_23<1>f global_alpha { align1 };
{ 0x00000201, 0x20080061, 0x00000000, 0x00000000 },
{ 0x01800031, 0x21c01d29, 0x008d0000, 0x02580001 },
+ { 0x00600041, 0x228077bd, 0x00200280, 0x00000040 },
+ { 0x00600041, 0x22a077bd, 0x002002a0, 0x00000040 },
{ 0x00000201, 0x20080061, 0x00000000, 0x00000000 },
{ 0x01800031, 0x21c01d29, 0x208d0000, 0x0a8a0001 },
+ { 0x00600041, 0x228077bd, 0x00200280, 0x00000040 },
+ { 0x00600041, 0x22a077bd, 0x002002a0, 0x00000040 },
include(`exa_wm.g4i')
+/* subpicture global alpha */
+define(`global_alpha', `r6.0<0,1,0>f')
+
/* prepare sampler read back gX register, which would be written back to output */
/* use simd16 sampler, param 0 is u, param 1 is v. */
sampler (1,0,F) /* sampler message description, (binding_table,sampler_index,datatype)
/* here(src->dst) we should use src_sampler and src_surface */
mlen 5 rlen 8 { align1 }; /* required message len 5, readback len 8 */
+
+mul (8) src_sample_a_01<1>f src_sample_a_01<1>f global_alpha { align1 };
+mul (8) src_sample_a_23<1>f src_sample_a_23<1>f global_alpha { align1 };
+
{ 0x00000201, 0x20080061, 0x00000000, 0x00000000 },
{ 0x00600201, 0x20200022, 0x008d0000, 0x00000000 },
{ 0x02800031, 0x21c01cc9, 0x00000020, 0x0a8a0001 },
+ { 0x00600041, 0x228077bd, 0x00200280, 0x000000c0 },
+ { 0x00600041, 0x22a077bd, 0x002002a0, 0x000000c0 },
define(`src_msg_gen7', `g65')
define(`src_msg_ind_gen7',`65')
+/* subpicture global alpha */
+define(`global_alpha', `r6.0<0,1,0>f')
+
/* prepare sampler read back gX register, which would be written back to output */
/* use simd16 sampler, param 0 is u, param 1 is v. */
sampler (1,0,F) /* sampler message description, (binding_table,sampler_index,datatype)
/* here(src->dst) we should use src_sampler and src_surface */
mlen 5 rlen 8 { align1 }; /* required message len 5, readback len 8 */
+
+mul (8) src_sample_a_01<1>f src_sample_a_01<1>f global_alpha { align1 mask_disable };
+mul (8) src_sample_a_23<1>f src_sample_a_23<1>f global_alpha { align1 mask_disable };
+
{ 0x00000201, 0x20080061, 0x00000000, 0x00000000 },
{ 0x00600201, 0x28200021, 0x008d0000, 0x00000000 },
{ 0x02800031, 0x21c01ca9, 0x00000820, 0x0a8c0001 },
+ { 0x00600241, 0x228077bd, 0x00200280, 0x000000c0 },
+ { 0x00600241, 0x22a077bd, 0x002002a0, 0x000000c0 },
/*
* A = 1.0
*/
-//mov (16) src_sample_a<1>F 1.0F { compr align1 };
+mov (16) src_sample_a<1>F 1.0F { compr align1 };
{ 0x80802048, 0x22007fbd, 0x008d0340, 0xbec8b439 },
{ 0x00802001, 0x240003bc, 0x008d02c0, 0x00000000 },
{ 0x80802048, 0x22407fbd, 0x008d0340, 0x40011687 },
+ { 0x00802001, 0x228003fd, 0x00000000, 0x3f800000 },
{ 0x80802048, 0x22007fbd, 0x008d0340, 0xbec8b439 },
{ 0x00802001, 0x240003bc, 0x008d02c0, 0x00000000 },
{ 0x80802048, 0x22407fbd, 0x008d0340, 0x40011687 },
+ { 0x00802001, 0x228003fd, 0x00000000, 0x3f800000 },
/*
* A = 1.0
*/
-//mov (16) src_sample_a<1>F 1.0F { compr align1 };
+mov (16) src_sample_a<1>F 1.0F { compr align1 };
{ 0x80800048, 0x22007fbd, 0x008d0340, 0xbec8b439 },
{ 0x00800001, 0x240003bc, 0x008d02c0, 0x00000000 },
{ 0x80800048, 0x22407fbd, 0x008d0340, 0x40011687 },
+ { 0x00800001, 0x228003fd, 0x00000000, 0x3f800000 },
/*
* A = 1.0
*/
-//mov (16) src_sample_a<1>F 1.0F { compr align1 };
+mov (16) src_sample_a<1>F 1.0F { compr align1 };
{ 0x80800048, 0x22007fbd, 0x008d0340, 0xbec8b439 },
{ 0x00800001, 0x240003bc, 0x008d02c0, 0x00000000 },
{ 0x80800048, 0x22407fbd, 0x008d0340, 0x40011687 },
+ { 0x00800001, 0x228003fd, 0x00000000, 0x3f800000 },