Commit 3179d67e authored by Gwenole Beauchesne's avatar Gwenole Beauchesne Committed by Xiang, Haihao

i965_drv_video: simplify put_surface() and put_subpicture() args.

parent 5b5dfd0e
...@@ -2244,10 +2244,12 @@ i965_PutSurface(VADriverContextP ctx, ...@@ -2244,10 +2244,12 @@ i965_PutSurface(VADriverContextP ctx,
union dri_buffer *buffer; union dri_buffer *buffer;
struct intel_region *dest_region; struct intel_region *dest_region;
struct object_surface *obj_surface; struct object_surface *obj_surface;
VARectangle src_rect, dst_rect;
int ret; int ret;
uint32_t name; uint32_t name;
Bool new_region = False; Bool new_region = False;
int pp_flag = 0; int pp_flag = 0;
/* Currently don't support DRI1 */ /* Currently don't support DRI1 */
if (dri_state->driConnectedFlag != VA_DRI2) if (dri_state->driConnectedFlag != VA_DRI2)
return VA_STATUS_ERROR_UNKNOWN; return VA_STATUS_ERROR_UNKNOWN;
...@@ -2305,16 +2307,21 @@ i965_PutSurface(VADriverContextP ctx, ...@@ -2305,16 +2307,21 @@ i965_PutSurface(VADriverContextP ctx,
if (flags & (VA_BOTTOM_FIELD | VA_TOP_FIELD)) if (flags & (VA_BOTTOM_FIELD | VA_TOP_FIELD))
pp_flag |= I965_PP_FLAG_DEINTERLACING; pp_flag |= I965_PP_FLAG_DEINTERLACING;
intel_render_put_surface(ctx, surface, src_rect.x = srcx;
srcx, srcy, srcw, srch, src_rect.y = srcy;
destx, desty, destw, desth, src_rect.width = srcw;
pp_flag); src_rect.height = srch;
dst_rect.x = destx;
dst_rect.y = desty;
dst_rect.width = destw;
dst_rect.height = desth;
intel_render_put_surface(ctx, surface, &src_rect, &dst_rect, pp_flag);
if(obj_surface->subpic != VA_INVALID_ID) { if(obj_surface->subpic != VA_INVALID_ID) {
intel_render_put_subpicture(ctx, surface, intel_render_put_subpicture(ctx, surface, &src_rect, &dst_rect);
srcx, srcy, srcw, srch, }
destx, desty, destw, desth);
}
dri_swap_buffer(ctx, dri_drawable); dri_swap_buffer(ctx, dri_drawable);
obj_surface->flags |= SURFACE_DISPLAYED; obj_surface->flags |= SURFACE_DISPLAYED;
......
...@@ -1748,18 +1748,14 @@ void pp_nv12_dndi_initialize(VADriverContextP ctx, VASurfaceID surface, int inpu ...@@ -1748,18 +1748,14 @@ void pp_nv12_dndi_initialize(VADriverContextP ctx, VASurfaceID surface, int inpu
} }
static void static void
ironlake_pp_initialize(VADriverContextP ctx, ironlake_pp_initialize(
VASurfaceID surface, VADriverContextP ctx,
int input, VASurfaceID surface,
short srcx, int input,
short srcy, const VARectangle *src_rect,
unsigned short srcw, const VARectangle *dst_rect,
unsigned short srch, int pp_index
short destx, )
short desty,
unsigned short destw,
unsigned short desth,
int pp_index)
{ {
struct i965_driver_data *i965 = i965_driver_data(ctx); struct i965_driver_data *i965 = i965_driver_data(ctx);
struct i965_post_processing_context *pp_context = i965->pp_context; struct i965_post_processing_context *pp_context = i965->pp_context;
...@@ -1842,44 +1838,35 @@ ironlake_pp_initialize(VADriverContextP ctx, ...@@ -1842,44 +1838,35 @@ ironlake_pp_initialize(VADriverContextP ctx,
pp_module = &pp_context->pp_modules[pp_index]; pp_module = &pp_context->pp_modules[pp_index];
if (pp_module->initialize) if (pp_module->initialize)
pp_module->initialize(ctx, surface, input, srcw, srch, destw, desth); pp_module->initialize(ctx, surface, input,
src_rect->width, src_rect->height,
dst_rect->width, dst_rect->height);
} }
static void static void
ironlake_post_processing(VADriverContextP ctx, ironlake_post_processing(
VASurfaceID surface, VADriverContextP ctx,
int input, VASurfaceID surface,
short srcx, int input,
short srcy, const VARectangle *src_rect,
unsigned short srcw, const VARectangle *dst_rect,
unsigned short srch, int pp_index
short destx, )
short desty,
unsigned short destw,
unsigned short desth,
int pp_index)
{ {
ironlake_pp_initialize(ctx, surface, input, ironlake_pp_initialize(ctx, surface, input, src_rect, dst_rect, pp_index);
srcx, srcy, srcw, srch,
destx, desty, destw, desth,
pp_index);
ironlake_pp_states_setup(ctx); ironlake_pp_states_setup(ctx);
ironlake_pp_pipeline_setup(ctx); ironlake_pp_pipeline_setup(ctx);
} }
static void static void
gen6_pp_initialize(VADriverContextP ctx, gen6_pp_initialize(
VASurfaceID surface, VADriverContextP ctx,
int input, VASurfaceID surface,
short srcx, int input,
short srcy, const VARectangle *src_rect,
unsigned short srcw, const VARectangle *dst_rect,
unsigned short srch, int pp_index
short destx, )
short desty,
unsigned short destw,
unsigned short desth,
int pp_index)
{ {
struct i965_driver_data *i965 = i965_driver_data(ctx); struct i965_driver_data *i965 = i965_driver_data(ctx);
struct i965_post_processing_context *pp_context = i965->pp_context; struct i965_post_processing_context *pp_context = i965->pp_context;
...@@ -1962,7 +1949,9 @@ gen6_pp_initialize(VADriverContextP ctx, ...@@ -1962,7 +1949,9 @@ gen6_pp_initialize(VADriverContextP ctx,
pp_module = &pp_context->pp_modules[pp_index]; pp_module = &pp_context->pp_modules[pp_index];
if (pp_module->initialize) if (pp_module->initialize)
pp_module->initialize(ctx, surface, input, srcw, srch, destw, desth); pp_module->initialize(ctx, surface, input,
src_rect->width, src_rect->height,
dst_rect->width, dst_rect->height);
} }
static void static void
...@@ -2206,68 +2195,48 @@ gen6_pp_pipeline_setup(VADriverContextP ctx) ...@@ -2206,68 +2195,48 @@ gen6_pp_pipeline_setup(VADriverContextP ctx)
} }
static void static void
gen6_post_processing(VADriverContextP ctx, gen6_post_processing(
VASurfaceID surface, VADriverContextP ctx,
int input, VASurfaceID surface,
short srcx, int input,
short srcy, const VARectangle *src_rect,
unsigned short srcw, const VARectangle *dst_rect,
unsigned short srch, int pp_index
short destx, )
short desty,
unsigned short destw,
unsigned short desth,
int pp_index)
{ {
gen6_pp_initialize(ctx, surface, input, gen6_pp_initialize(ctx, surface, input, src_rect, dst_rect, pp_index);
srcx, srcy, srcw, srch,
destx, desty, destw, desth,
pp_index);
gen6_pp_states_setup(ctx); gen6_pp_states_setup(ctx);
gen6_pp_pipeline_setup(ctx); gen6_pp_pipeline_setup(ctx);
} }
static void static void
i965_post_processing_internal(VADriverContextP ctx, i965_post_processing_internal(
VASurfaceID surface, VADriverContextP ctx,
int input, VASurfaceID surface,
short srcx, int input,
short srcy, const VARectangle *src_rect,
unsigned short srcw, const VARectangle *dst_rect,
unsigned short srch, int pp_index
short destx, )
short desty,
unsigned short destw,
unsigned short desth,
int pp_index)
{ {
struct i965_driver_data *i965 = i965_driver_data(ctx); struct i965_driver_data *i965 = i965_driver_data(ctx);
if (IS_GEN6(i965->intel.device_id) || if (IS_GEN6(i965->intel.device_id) ||
IS_GEN7(i965->intel.device_id)) IS_GEN7(i965->intel.device_id))
gen6_post_processing(ctx, surface, input, gen6_post_processing(ctx, surface, input, src_rect, dst_rect, pp_index);
srcx, srcy, srcw, srch,
destx, desty, destw, desth,
pp_index);
else else
ironlake_post_processing(ctx, surface, input, ironlake_post_processing(ctx, surface, input, src_rect, dst_rect,
srcx, srcy, srcw, srch,
destx, desty, destw, desth,
pp_index); pp_index);
} }
void void
i965_post_processing(VADriverContextP ctx, i965_post_processing(
VASurfaceID surface, VADriverContextP ctx,
short srcx, VASurfaceID surface,
short srcy, const VARectangle *src_rect,
unsigned short srcw, const VARectangle *dst_rect,
unsigned short srch, unsigned int flags
short destx, )
short desty,
unsigned short destw,
unsigned short desth,
unsigned int flag)
{ {
struct i965_driver_data *i965 = i965_driver_data(ctx); struct i965_driver_data *i965 = i965_driver_data(ctx);
...@@ -2276,18 +2245,16 @@ i965_post_processing(VADriverContextP ctx, ...@@ -2276,18 +2245,16 @@ i965_post_processing(VADriverContextP ctx,
if (i965->render_state.interleaved_uv) { if (i965->render_state.interleaved_uv) {
int internal_input = 0; int internal_input = 0;
if (flag & I965_PP_FLAG_DEINTERLACING) { if (flags & I965_PP_FLAG_DEINTERLACING) {
i965_post_processing_internal(ctx, surface, internal_input, i965_post_processing_internal(ctx, surface, internal_input,
srcx, srcy, srcw, srch, src_rect, dst_rect,
destx, desty, destw, desth,
PP_NV12_DNDI); PP_NV12_DNDI);
internal_input = 1; internal_input = 1;
} }
if (flag & I965_PP_FLAG_AVS) { if (flags & I965_PP_FLAG_AVS) {
i965_post_processing_internal(ctx, surface, internal_input, i965_post_processing_internal(ctx, surface, internal_input,
srcx, srcy, srcw, srch, src_rect, dst_rect,
destx, desty, destw, desth,
PP_NV12_AVS); PP_NV12_AVS);
} }
} }
......
...@@ -351,17 +351,14 @@ struct i965_post_processing_context ...@@ -351,17 +351,14 @@ struct i965_post_processing_context
}; };
void void
i965_post_processing(VADriverContextP ctx, i965_post_processing(
VASurfaceID surface, VADriverContextP ctx,
short srcx, VASurfaceID surface,
short srcy, const VARectangle *src_rect,
unsigned short srcw, const VARectangle *dst_rect,
unsigned short srch, unsigned int flags
short destx, );
short desty,
unsigned short destw,
unsigned short desth,
unsigned int pp_index);
Bool Bool
i965_post_processing_terminate(VADriverContextP ctx); i965_post_processing_terminate(VADriverContextP ctx);
Bool Bool
......
...@@ -927,16 +927,12 @@ i965_subpic_render_upload_vertex(VADriverContextP ctx, ...@@ -927,16 +927,12 @@ i965_subpic_render_upload_vertex(VADriverContextP ctx,
} }
static void static void
i965_render_upload_vertex(VADriverContextP ctx, i965_render_upload_vertex(
VASurfaceID surface, VADriverContextP ctx,
short srcx, VASurfaceID surface,
short srcy, const VARectangle *src_rect,
unsigned short srcw, const VARectangle *dst_rect
unsigned short srch, )
short destx,
short desty,
unsigned short destw,
unsigned short desth)
{ {
struct i965_driver_data *i965 = i965_driver_data(ctx); struct i965_driver_data *i965 = i965_driver_data(ctx);
struct i965_render_state *render_state = &i965->render_state; struct i965_render_state *render_state = &i965->render_state;
...@@ -946,20 +942,20 @@ i965_render_upload_vertex(VADriverContextP ctx, ...@@ -946,20 +942,20 @@ i965_render_upload_vertex(VADriverContextP ctx,
float u1, v1, u2, v2; float u1, v1, u2, v2;
int i, width, height; int i, width, height;
int box_x1 = dest_region->x + destx; int box_x1 = dest_region->x + dst_rect->x;
int box_y1 = dest_region->y + desty; int box_y1 = dest_region->y + dst_rect->y;
int box_x2 = box_x1 + destw; int box_x2 = box_x1 + dst_rect->width;
int box_y2 = box_y1 + desth; int box_y2 = box_y1 + dst_rect->height;
obj_surface = SURFACE(surface); obj_surface = SURFACE(surface);
assert(surface); assert(surface);
width = obj_surface->orig_width; width = obj_surface->orig_width;
height = obj_surface->orig_height; height = obj_surface->orig_height;
u1 = (float)srcx / width; u1 = (float)src_rect->x / width;
v1 = (float)srcy / height; v1 = (float)src_rect->y / height;
u2 = (float)(srcx + srcw) / width; u2 = (float)(src_rect->x + src_rect->width) / width;
v2 = (float)(srcy + srch) / height; v2 = (float)(src_rect->y + src_rect->height) / height;
dri_bo_map(render_state->vb.vertex_buffer, 1); dri_bo_map(render_state->vb.vertex_buffer, 1);
assert(render_state->vb.vertex_buffer->virtual); assert(render_state->vb.vertex_buffer->virtual);
...@@ -1008,16 +1004,12 @@ i965_render_upload_constants(VADriverContextP ctx) ...@@ -1008,16 +1004,12 @@ i965_render_upload_constants(VADriverContextP ctx)
} }
static void static void
i965_surface_render_state_setup(VADriverContextP ctx, i965_surface_render_state_setup(
VASurfaceID surface, VADriverContextP ctx,
short srcx, VASurfaceID surface,
short srcy, const VARectangle *src_rect,
unsigned short srcw, const VARectangle *dst_rect
unsigned short srch, )
short destx,
short desty,
unsigned short destw,
unsigned short desth)
{ {
i965_render_vs_unit(ctx); i965_render_vs_unit(ctx);
i965_render_sf_unit(ctx); i965_render_sf_unit(ctx);
...@@ -1027,22 +1019,16 @@ i965_surface_render_state_setup(VADriverContextP ctx, ...@@ -1027,22 +1019,16 @@ i965_surface_render_state_setup(VADriverContextP ctx,
i965_render_wm_unit(ctx); i965_render_wm_unit(ctx);
i965_render_cc_viewport(ctx); i965_render_cc_viewport(ctx);
i965_render_cc_unit(ctx); i965_render_cc_unit(ctx);
i965_render_upload_vertex(ctx, surface, i965_render_upload_vertex(ctx, surface, src_rect, dst_rect);
srcx, srcy, srcw, srch,
destx, desty, destw, desth);
i965_render_upload_constants(ctx); i965_render_upload_constants(ctx);
} }
static void static void
i965_subpic_render_state_setup(VADriverContextP ctx, i965_subpic_render_state_setup(
VASurfaceID surface, VADriverContextP ctx,
short srcx, VASurfaceID surface,
short srcy, const VARectangle *src_rect,
unsigned short srcw, const VARectangle *dst_rect
unsigned short srch, )
short destx,
short desty,
unsigned short destw,
unsigned short desth)
{ {
i965_render_vs_unit(ctx); i965_render_vs_unit(ctx);
i965_render_sf_unit(ctx); i965_render_sf_unit(ctx);
...@@ -1052,13 +1038,7 @@ i965_subpic_render_state_setup(VADriverContextP ctx, ...@@ -1052,13 +1038,7 @@ i965_subpic_render_state_setup(VADriverContextP ctx,
i965_subpic_render_wm_unit(ctx); i965_subpic_render_wm_unit(ctx);
i965_render_cc_viewport(ctx); i965_render_cc_viewport(ctx);
i965_subpic_render_cc_unit(ctx); i965_subpic_render_cc_unit(ctx);
i965_subpic_render_upload_vertex(ctx, surface, dst_rect);
VARectangle output_rect;
output_rect.x = destx;
output_rect.y = desty;
output_rect.width = destw;
output_rect.height = desth;
i965_subpic_render_upload_vertex(ctx, surface, &output_rect);
} }
...@@ -1546,40 +1526,30 @@ i965_render_initialize(VADriverContextP ctx) ...@@ -1546,40 +1526,30 @@ i965_render_initialize(VADriverContextP ctx)
} }
static void static void
i965_render_put_surface(VADriverContextP ctx, i965_render_put_surface(
VASurfaceID surface, VADriverContextP ctx,
short srcx, VASurfaceID surface,
short srcy, const VARectangle *src_rect,
unsigned short srcw, const VARectangle *dst_rect,
unsigned short srch, unsigned int flags
short destx, )
short desty,
unsigned short destw,
unsigned short desth,
unsigned int flag)
{ {
struct i965_driver_data *i965 = i965_driver_data(ctx); struct i965_driver_data *i965 = i965_driver_data(ctx);
struct intel_batchbuffer *batch = i965->batch; struct intel_batchbuffer *batch = i965->batch;
i965_render_initialize(ctx); i965_render_initialize(ctx);
i965_surface_render_state_setup(ctx, surface, i965_surface_render_state_setup(ctx, surface, src_rect, dst_rect);
srcx, srcy, srcw, srch,
destx, desty, destw, desth);
i965_surface_render_pipeline_setup(ctx); i965_surface_render_pipeline_setup(ctx);
intel_batchbuffer_flush(batch); intel_batchbuffer_flush(batch);
} }
static void static void
i965_render_put_subpicture(VADriverContextP ctx, i965_render_put_subpicture(
VASurfaceID surface, VADriverContextP ctx,
short srcx, VASurfaceID surface,
short srcy, const VARectangle *src_rect,
unsigned short srcw, const VARectangle *dst_rect
unsigned short srch, )
short destx,
short desty,
unsigned short destw,
unsigned short desth)
{ {
struct i965_driver_data *i965 = i965_driver_data(ctx); struct i965_driver_data *i965 = i965_driver_data(ctx);
struct intel_batchbuffer *batch = i965->batch; struct intel_batchbuffer *batch = i965->batch;
...@@ -1589,9 +1559,7 @@ i965_render_put_subpicture(VADriverContextP ctx, ...@@ -1589,9 +1559,7 @@ i965_render_put_subpicture(VADriverContextP ctx,
assert(obj_subpic); assert(obj_subpic);
i965_render_initialize(ctx); i965_render_initialize(ctx);
i965_subpic_render_state_setup(ctx, surface, i965_subpic_render_state_setup(ctx, surface, src_rect, dst_rect);
srcx, srcy, srcw, srch,
destx, desty, destw, desth);
i965_subpic_render_pipeline_setup(ctx); i965_subpic_render_pipeline_setup(ctx);
i965_render_upload_image_palette(ctx, obj_subpic->image, 0xff); i965_render_upload_image_palette(ctx, obj_subpic->image, 0xff);
intel_batchbuffer_flush(batch); intel_batchbuffer_flush(batch);
...@@ -1720,16 +1688,12 @@ gen6_render_depth_stencil_state(VADriverContextP ctx) ...@@ -1720,16 +1688,12 @@ gen6_render_depth_stencil_state(VADriverContextP ctx)
} }
static void static void
gen6_render_setup_states(VADriverContextP ctx, gen6_render_setup_states(
VASurfaceID surface, VADriverContextP ctx,
short srcx, VASurfaceID surface,
short srcy, const VARectangle *src_rect,
unsigned short srcw, const VARectangle *dst_rect
unsigned short srch, )
short destx,
short desty,
unsigned short destw,
unsigned short desth)
{ {
i965_render_dest_surface_state(ctx, 0); i965_render_dest_surface_state(ctx, 0);
i965_render_src_surfaces_state(ctx, surface); i965_render_src_surfaces_state(ctx, surface);
...@@ -1739,9 +1703,7 @@ gen6_render_setup_states(VADriverContextP ctx, ...@@ -1739,9 +1703,7 @@ gen6_render_setup_states(VADriverContextP ctx,
gen6_render_blend_state(ctx); gen6_render_blend_state(ctx);
gen6_render_depth_stencil_state(ctx); gen6_render_depth_stencil_state(ctx);
i965_render_upload_constants(ctx); i965_render_upload_constants(ctx);
i965_render_upload_vertex(ctx, surface, i965_render_upload_vertex(ctx, surface, src_rect, dst_rect);
srcx, srcy, srcw, srch,
destx, desty, destw, desth);
} }
static void static void
...@@ -2088,25 +2050,19 @@ gen6_render_emit_states(VADriverContextP ctx, int kernel) ...@@ -2088,25 +2050,19 @@ gen6_render_emit_states(VADriverContextP ctx, int kernel)
} }
static void static void
gen6_render_put_surface(VADriverContextP ctx, gen6_render_put_surface(
VASurfaceID surface, VADriverContextP ctx,
short srcx, VASurfaceID surface,
short srcy, const VARectangle *src_rect,
unsigned short srcw, const VARectangle *dst_rect,
unsigned short srch, unsigned int flags
short destx, )
short desty,
unsigned short destw,
unsigned short desth,
unsigned int flag)
{ {
struct i965_driver_data *i965 = i965_driver_data(ctx); struct i965_driver_data *i965 = i965_driver_data(ctx);
struct intel_batchbuffer *batch = i965->batch; struct intel_batchbuffer *batch = i965->batch;
gen6_render_initialize(ctx); gen6_render_initialize(ctx);
gen6_render_setup_states(ctx, surface, gen6_render_setup_states(ctx, surface, src_rect, dst_rect);
srcx, srcy, srcw, srch,
destx, desty, destw, desth);
i965_clear_dest_region(ctx); i965_clear_dest_region(ctx);
gen6_render_emit_states(ctx, PS_KERNEL); gen6_render_emit_states(ctx, PS_KERNEL);
intel_batchbuffer_flush(batch); intel_batchbuffer_flush(batch);
...@@ -2135,24 +2091,13 @@ gen6_subpicture_render_blend_state(VADriverContextP ctx) ...@@ -2135,24 +2091,13 @@ gen6_subpicture_render_blend_state(VADriverContextP ctx)
} }
static void static void
gen6_subpicture_render_setup_states(VADriverContextP ctx, gen6_subpicture_render_setup_states(
VASurfaceID surface, VADriverContextP ctx,
short srcx, VASurfaceID surface,
short srcy, const VARectangle *src_rect,
unsigned short srcw, const VARectangle *dst_rect
unsigned short srch, )
short destx,
short desty,
unsigned short destw,
unsigned short desth)
{ {
VARectangle output_rect;
output_rect.x = destx;
output_rect.y = desty;
output_rect.width = destw;
output_rect.height = desth;
i965_render_dest_surface_state(ctx, 0); i965_render_dest_surface_state(ctx, 0);
i965_subpic_render_src_surfaces_state(ctx, surface); i965_subpic_render_src_surfaces_state(ctx, surface);
i965_render_sampler(ctx); i965_render_sampler(ctx);
...@@ -2160,20 +2105,16 @@ gen6_subpicture_render_setup_states(VADriverContextP ctx, ...@@ -2160,20 +2105,16 @@ gen6_subpicture_render_setup_states(VADriverContextP ctx,
gen6_render_color_calc_state(ctx); gen6_render_color_calc_state(ctx);
gen6_subpicture_render_blend_state(ctx); gen6_subpicture_render_blend_state(ctx);
gen6_render_depth_stencil_state(ctx); gen6_render_depth_stencil_state(ctx);
i965_subpic_render_upload_vertex(ctx, surface, &output_rect); i965_subpic_render_upload_vertex(ctx, surface, dst_rect);
} }
static void static void
gen6_render_put_subpicture(VADriverContextP ctx, gen6_render_put_subpicture(
VASurfaceID surface, VADriverContextP ctx,
short srcx, VASurfaceID surface,
short srcy, const VARectangle *src_rect,
unsigned short srcw, const VARectangle *dst_rect
unsigned short srch, )
short destx,
short desty,
unsigned short destw,
unsigned short desth)
{ {
struct i965_driver_data *i965 = i965_driver_data(ctx); struct i965_driver_data *i965 = i965_driver_data(ctx);
struct intel_batchbuffer *batch = i965->batch; struct intel_batchbuffer *batch = i965->batch;
...@@ -2182,9 +2123,7 @@ gen6_render_put_subpicture(VADriverContextP ctx, ...@@ -2182,9 +2123,7 @@ gen6_render_put_subpicture(VADriverContextP ctx,
assert(obj_subpic); assert(obj_subpic);
gen6_render_initialize(ctx); gen6_render_initialize(ctx);
gen6_subpicture_render_setup_states(ctx, surface, gen6_subpicture_render_setup_states(ctx, surface, src_rect, dst_rect);
srcx, srcy, srcw, srch,
destx, desty, destw, desth);
gen6_render_emit_states(ctx, PS_SUBPIC_KERNEL); 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->image, 0xff);
intel_batchbuffer_flush(batch); intel_batchbuffer_flush(batch);
...@@ -2341,16 +2280,12 @@ gen7_render_sampler(VADriverContextP ctx) ...@@ -2341,16 +2280,12 @@ gen7_render_sampler(VADriverContextP ctx)
} }
static void static void
gen7_render_setup_states(VADriverContextP ctx, gen7_render_setup_states(
VASurfaceID surface, VADriverContextP ctx,
short srcx, VASurfaceID surface,
short srcy, const VARectangle *src_rect,
unsigned short srcw, const VARectangle *dst_rect
unsigned short srch, )
short destx,
short desty,
unsigned short destw,
unsigned short desth)
{ {
i965_render_dest_surface_state(ctx, 0); i965_render_dest_surface_state(ctx, 0);
i965_render_src_surfaces_state(ctx, surface); i965_render_src_surfaces_state(ctx, surface);
...@@ -2360,9 +2295,7 @@ gen7_render_setup_states(VADriverContextP ctx, ...@@ -2360,9 +2295,7 @@ gen7_render_setup_states(VADriverContextP ctx,
gen7_render_blend_state(ctx); gen7_render_blend_state(ctx);
gen7_render_depth_stencil_state(ctx); gen7_render_depth_stencil_state(ctx);
i965_render_upload_constants(ctx); i965_render_upload_constants(ctx);
i965_render_upload_vertex(ctx, surface, i965_render_upload_vertex(ctx, surface, src_rect, dst_rect);
srcx, srcy, srcw, srch,
destx, desty, destw, desth);
} }
static void static void
...@@ -2882,25 +2815,19 @@ gen7_render_emit_states(VADriverContextP ctx, int kernel) ...@@ -2882,25 +2815,19 @@ gen7_render_emit_states(VADriverContextP ctx, int kernel)
} }
static void static void
gen7_render_put_surface(VADriverContextP ctx, gen7_render_put_surface(
VASurfaceID surface, VADriverContextP ctx,
short srcx, VASurfaceID surface,
short srcy, const VARectangle *src_rect,
unsigned short srcw, const VARectangle *dst_rect,
unsigned short srch, unsigned int flags
short destx, )
short desty,
unsigned short destw,
unsigned short desth,
unsigned int flag)
{ {
struct i965_driver_data *i965 = i965_driver_data(ctx); struct i965_driver_data *i965 = i965_driver_data(ctx);
struct intel_batchbuffer *batch = i965->batch; struct intel_batchbuffer *batch = i965->batch;
gen7_render_initialize(ctx); gen7_render_initialize(ctx);
gen7_render_setup_states(ctx, surface, gen7_render_setup_states(ctx, surface, src_rect, dst_rect);
srcx, srcy, srcw, srch,
destx, desty, destw, desth);
i965_clear_dest_region(ctx); i965_clear_dest_region(ctx);
gen7_render_emit_states(ctx, PS_KERNEL); gen7_render_emit_states(ctx, PS_KERNEL);
intel_batchbuffer_flush(batch); intel_batchbuffer_flush(batch);
...@@ -2929,24 +2856,13 @@ gen7_subpicture_render_blend_state(VADriverContextP ctx) ...@@ -2929,24 +2856,13 @@ gen7_subpicture_render_blend_state(VADriverContextP ctx)
} }
static void static void
gen7_subpicture_render_setup_states(VADriverContextP ctx, gen7_subpicture_render_setup_states(
VASurfaceID surface, VADriverContextP ctx,
short srcx, VASurfaceID surface,
short srcy, const VARectangle *src_rect,
unsigned short srcw, const VARectangle *dst_rect
unsigned short srch, )
short destx,
short desty,
unsigned short destw,
unsigned short desth)
{ {
VARectangle output_rect;
output_rect.x = destx;
output_rect.y = desty;
output_rect.width = destw;
output_rect.height = desth;
i965_render_dest_surface_state(ctx, 0); i965_render_dest_surface_state(ctx, 0);
i965_subpic_render_src_surfaces_state(ctx, surface); i965_subpic_render_src_surfaces_state(ctx, surface);
i965_render_sampler(ctx); i965_render_sampler(ctx);
...@@ -2954,20 +2870,16 @@ gen7_subpicture_render_setup_states(VADriverContextP ctx, ...@@ -2954,20 +2870,16 @@ gen7_subpicture_render_setup_states(VADriverContextP ctx,
gen7_render_color_calc_state(ctx); gen7_render_color_calc_state(ctx);
gen7_subpicture_render_blend_state(ctx); gen7_subpicture_render_blend_state(ctx);
gen7_render_depth_stencil_state(ctx); gen7_render_depth_stencil_state(ctx);
i965_subpic_render_upload_vertex(ctx, surface, &output_rect); i965_subpic_render_upload_vertex(ctx, surface, dst_rect);
} }
static void static void
gen7_render_put_subpicture(VADriverContextP ctx, gen7_render_put_subpicture(
VASurfaceID surface, VADriverContextP ctx,
short srcx, VASurfaceID surface,
short srcy, const VARectangle *src_rect,
unsigned short srcw, const VARectangle *dst_rect
unsigned short srch, )
short destx,
short desty,
unsigned short destw,
unsigned short desth)
{ {
struct i965_driver_data *i965 = i965_driver_data(ctx); struct i965_driver_data *i965 = i965_driver_data(ctx);
struct intel_batchbuffer *batch = i965->batch; struct intel_batchbuffer *batch = i965->batch;
...@@ -2976,9 +2888,7 @@ gen7_render_put_subpicture(VADriverContextP ctx, ...@@ -2976,9 +2888,7 @@ gen7_render_put_subpicture(VADriverContextP ctx,
assert(obj_subpic); assert(obj_subpic);
gen7_render_initialize(ctx); gen7_render_initialize(ctx);
gen7_subpicture_render_setup_states(ctx, surface, gen7_subpicture_render_setup_states(ctx, surface, src_rect, dst_rect);
srcx, srcy, srcw, srch,
destx, desty, destw, desth);
gen7_render_emit_states(ctx, PS_SUBPIC_KERNEL); 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->image, 0xff);
intel_batchbuffer_flush(batch); intel_batchbuffer_flush(batch);
...@@ -2988,69 +2898,44 @@ gen7_render_put_subpicture(VADriverContextP ctx, ...@@ -2988,69 +2898,44 @@ gen7_render_put_subpicture(VADriverContextP ctx,
/* /*
* global functions * global functions
*/ */
void void
intel_render_put_surface(VADriverContextP ctx, intel_render_put_surface(
VASurfaceID surface, VADriverContextP ctx,
short srcx, VASurfaceID surface,
short srcy, const VARectangle *src_rect,
unsigned short srcw, const VARectangle *dst_rect,
unsigned short srch, unsigned int flags
short destx, )
short desty,
unsigned short destw,
unsigned short desth,
unsigned int flag)
{ {
struct i965_driver_data *i965 = i965_driver_data(ctx); struct i965_driver_data *i965 = i965_driver_data(ctx);
i965_post_processing(ctx, surface, i965_post_processing(ctx, surface, src_rect, dst_rect, flags);
srcx, srcy, srcw, srch,
destx, desty, destw, desth,
flag);
if (IS_GEN7(i965->intel.device_id)) if (IS_GEN7(i965->intel.device_id))
gen7_render_put_surface(ctx, surface, gen7_render_put_surface(ctx, surface, src_rect, dst_rect, flags);
srcx, srcy, srcw, srch,
destx, desty, destw, desth,
flag);
else if (IS_GEN6(i965->intel.device_id)) else if (IS_GEN6(i965->intel.device_id))
gen6_render_put_surface(ctx, surface, gen6_render_put_surface(ctx, surface, src_rect, dst_rect, flags);
srcx, srcy, srcw, srch,
destx, desty, destw, desth,
flag);
else else
i965_render_put_surface(ctx, surface, i965_render_put_surface(ctx, surface, src_rect, dst_rect, flags);
srcx, srcy, srcw, srch,
destx, desty, destw, desth,
flag);
} }
void void
intel_render_put_subpicture(VADriverContextP ctx, intel_render_put_subpicture(
VASurfaceID surface, VADriverContextP ctx,
short srcx, VASurfaceID surface,
short srcy, const VARectangle *src_rect,
unsigned short srcw, const VARectangle *dst_rect
unsigned short srch, )
short destx,
short desty,
unsigned short destw,
unsigned short desth)
{ {
struct i965_driver_data *i965 = i965_driver_data(ctx); struct i965_driver_data *i965 = i965_driver_data(ctx);
if (IS_GEN7(i965->intel.device_id)) if (IS_GEN7(i965->intel.device_id))
gen7_render_put_subpicture(ctx, surface, gen7_render_put_subpicture(ctx, surface, src_rect, dst_rect);
srcx, srcy, srcw, srch,
destx, desty, destw, desth);
else if (IS_GEN6(i965->intel.device_id)) else if (IS_GEN6(i965->intel.device_id))
gen6_render_put_subpicture(ctx, surface, gen6_render_put_subpicture(ctx, surface, src_rect, dst_rect);
srcx, srcy, srcw, srch,
destx, desty, destw, desth);
else else
i965_render_put_subpicture(ctx, surface, i965_render_put_subpicture(ctx, surface, src_rect, dst_rect);
srcx, srcy, srcw, srch,
destx, desty, destw, desth);
} }
Bool Bool
......
...@@ -81,28 +81,22 @@ struct i965_render_state ...@@ -81,28 +81,22 @@ struct i965_render_state
Bool i965_render_init(VADriverContextP ctx); Bool i965_render_init(VADriverContextP ctx);
Bool i965_render_terminate(VADriverContextP ctx); Bool i965_render_terminate(VADriverContextP ctx);
void intel_render_put_surface(VADriverContextP ctx,
VASurfaceID surface,
short srcx,
short srcy,
unsigned short srcw,
unsigned short srch,
short destx,
short desty,
unsigned short destw,
unsigned short desth,
unsigned int flag);
void
intel_render_put_surface(
VADriverContextP ctx,
VASurfaceID surface,
const VARectangle *src_rect,
const VARectangle *dst_rect,
unsigned int flags
);
void void
intel_render_put_subpicture(VADriverContextP ctx, intel_render_put_subpicture(
VASurfaceID surface, VADriverContextP ctx,
short srcx, VASurfaceID surface,
short srcy, const VARectangle *src_rect,
unsigned short srcw, const VARectangle *dst_rect
unsigned short srch, );
short destx,
short desty,
unsigned short destw,
unsigned short desth);
#endif /* _I965_RENDER_H_ */ #endif /* _I965_RENDER_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment