2 * Copyright © 2010 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sub license, and/or sell copies of the Software, and to
9 * permit persons to whom the Software is furnished to do so, subject to
10 * the following conditions:
12 * The above copyright notice and this permission notice (including the
13 * next paragraph) shall be included in all copies or substantial portions
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
19 * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
20 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 * Xiang Haihao <haihao.xiang@intel.com>
29 #ifndef __I965_POST_PROCESSING_H__
30 #define __I965_POST_PROCESSING_H__
32 #define MAX_PP_SURFACES 48
34 #define I965_PP_FLAG_TOP_FIELD 1
35 #define I965_PP_FLAG_BOTTOM_FIELD 2
36 #define I965_PP_FLAG_MCDI 4
37 #define I965_PP_FLAG_AVS 8
42 PP_NV12_LOAD_SAVE_N12,
43 PP_NV12_LOAD_SAVE_PL3,
53 #define NUM_PP_MODULES 10
55 struct i965_post_processing_context;
57 struct pp_load_save_context
63 struct pp_scaling_context
65 int dest_x; /* in pixel */
66 int dest_y; /* in pixel */
69 float src_normalized_x;
70 float src_normalized_y;
75 int dest_x; /* in pixel */
76 int dest_y; /* in pixel */
79 float src_normalized_x;
80 float src_normalized_y;
85 struct pp_dndi_context
99 struct i965_kernel kernel;
102 VAStatus (*initialize)(VADriverContextP ctx, struct i965_post_processing_context *pp_context,
103 const struct i965_surface *src_surface,
104 const VARectangle *src_rect,
105 struct i965_surface *dst_surface,
106 const VARectangle *dst_rect,
110 struct pp_static_parameter
114 float procamp_constant_c0;
116 /* Load and Same r1.1 */
117 unsigned int source_packed_y_offset:8;
118 unsigned int source_packed_u_offset:8;
119 unsigned int source_packed_v_offset:8;
123 /* Load and Save r1.2 */
125 unsigned int destination_packed_y_offset:8;
126 unsigned int destination_packed_u_offset:8;
127 unsigned int destination_packed_v_offset:8;
133 unsigned int destination_rgb_format:8;
134 unsigned int pad0:24;
139 float procamp_constant_c1;
142 float procamp_constant_c2;
145 unsigned int statistics_surface_picth:16; /* Devided by 2 */
146 unsigned int pad1:16;
151 unsigned int pad0:24;
152 unsigned int top_field_first:8;
155 /* AVS/Scaling r1.6 */
156 float normalized_video_y_scaling_step;
160 float procamp_constant_c5;
165 float procamp_constant_c3;
171 float wg_csc_constant_c4;
174 float wg_csc_constant_c8;
177 float procamp_constant_c4;
186 float wg_csc_constant_c9;
191 float wg_csc_constant_c0;
194 float scaling_step_ratio;
197 float normalized_alpha_y_scaling;
200 float wg_csc_constant_c4;
203 float wg_csc_constant_c1;
206 int horizontal_origin_offset:16;
207 int vertical_origin_offset:16;
212 unsigned int color_pixel;
215 float wg_csc_constant_c2;
219 float wg_csc_constant_c3;
224 float wg_csc_constant_c6;
226 /* ALL r4.1 MBZ ???*/
233 unsigned int pad1:15;
235 unsigned int pad2:16;
240 unsigned int motion_history_coefficient_m2:8;
241 unsigned int motion_history_coefficient_m1:8;
242 unsigned int pad0:16;
247 float wg_csc_constant_c7;
250 float wg_csc_constant_c10;
253 float source_video_frame_normalized_horizontal_origin;
259 float wg_csc_constant_c11;
263 struct pp_inline_parameter
267 int destination_block_horizontal_origin:16;
268 int destination_block_vertical_origin:16;
273 float source_surface_block_normalized_horizontal_origin;
277 unsigned int variance_surface_vertical_origin:16;
278 unsigned int pad0:16;
282 /* AVS/Scaling r5.2 */
283 float source_surface_block_normalized_vertical_origin;
286 float alpha_surface_block_normalized_horizontal_origin;
289 float alpha_surface_block_normalized_vertical_origin;
292 unsigned int alpha_mask_x:16;
293 unsigned int alpha_mask_y:8;
294 unsigned int block_count_x:8;
297 unsigned int block_horizontal_mask:16;
298 unsigned int block_vertical_mask:8;
299 unsigned int number_blocks:8;
301 /* AVS/Scaling r5.7 */
302 float normalized_video_x_scaling_step;
307 float video_step_delta;
310 unsigned int padx[7];
314 struct gen7_pp_static_parameter
318 unsigned int padx[6];
320 unsigned int di_statistics_surface_pitch_div2:16;
321 unsigned int di_statistics_surface_height_div4:16;
323 unsigned int di_top_field_first:8;
324 unsigned int pad0:16;
325 unsigned int pointer_to_inline_parameter:8; /* value: 7 */
330 unsigned int padx[7];
332 unsigned int di_destination_packed_y_component_offset:8;
333 unsigned int di_destination_packed_u_component_offset:8;
334 unsigned int di_destination_packed_v_component_offset:8;
339 float sampler_load_horizontal_scaling_step_ratio;
340 unsigned int padx[7];
344 float sampler_load_vertical_scaling_step;
346 unsigned int di_hoffset_svf_from_dvf:16;
347 unsigned int di_voffset_svf_from_dvf:16;
348 unsigned int padx[5];
352 float sampler_load_vertical_frame_origin;
353 unsigned int padx[7];
357 float sampler_load_horizontal_frame_origin;
358 unsigned int padx[7];
362 struct gen7_pp_inline_parameter
366 unsigned int destination_block_horizontal_origin:16;
367 unsigned int destination_block_vertical_origin:16;
368 /* r7.1: 0xffffffff */
369 unsigned int constant_0;
375 float sampler_load_main_video_x_scaling_step;
378 /* r7.6: must be zero */
379 unsigned int avs_vertical_block_number;
381 unsigned int group_id_number;
385 unsigned int padx[8];
389 struct i965_post_processing_context
392 struct pp_module pp_modules[NUM_PP_MODULES];
393 void *pp_static_parameter;
394 void *pp_inline_parameter;
398 } surface_state_binding_table;
406 int num_interface_descriptors;
417 } sampler_state_table;
422 unsigned int vfe_start;
423 unsigned int cs_start;
425 unsigned int num_vfe_entries;
426 unsigned int num_cs_entries;
428 unsigned int size_vfe_entry;
429 unsigned int size_cs_entry;
437 struct pp_load_save_context pp_load_save_context;
438 struct pp_scaling_context pp_scaling_context;
439 struct pp_avs_context pp_avs_context;
440 struct pp_dndi_context pp_dndi_context;
441 struct pp_dn_context pp_dn_context;
444 int (*pp_x_steps)(void *private_context);
445 int (*pp_y_steps)(void *private_context);
446 int (*pp_set_block_parameter)(struct i965_post_processing_context *pp_context, int x, int y);
448 struct intel_batchbuffer *batch;
451 struct i965_proc_context
453 struct hw_context base;
454 struct i965_post_processing_context pp_context;
458 i965_post_processing(
459 VADriverContextP ctx,
461 const VARectangle *src_rect,
462 const VARectangle *dst_rect,
464 int *has_done_scaling
468 i965_image_processing(VADriverContextP ctx,
469 const struct i965_surface *src_surface,
470 const VARectangle *src_rect,
471 struct i965_surface *dst_surface,
472 const VARectangle *dst_rect);
475 i965_post_processing_terminate(VADriverContextP ctx);
477 i965_post_processing_init(VADriverContextP ctx);
479 #endif /* __I965_POST_PROCESSING_H__ */