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,
54 #define NUM_PP_MODULES 11
56 struct i965_post_processing_context;
58 struct pp_load_save_context
64 struct pp_scaling_context
66 int dest_x; /* in pixel */
67 int dest_y; /* in pixel */
70 float src_normalized_x;
71 float src_normalized_y;
76 int dest_x; /* in pixel */
77 int dest_y; /* in pixel */
80 float src_normalized_x;
81 float src_normalized_y;
86 struct pp_dndi_context
100 struct i965_kernel kernel;
103 VAStatus (*initialize)(VADriverContextP ctx, struct i965_post_processing_context *pp_context,
104 const struct i965_surface *src_surface,
105 const VARectangle *src_rect,
106 struct i965_surface *dst_surface,
107 const VARectangle *dst_rect,
111 struct pp_static_parameter
115 float procamp_constant_c0;
117 /* Load and Same r1.1 */
118 unsigned int source_packed_y_offset:8;
119 unsigned int source_packed_u_offset:8;
120 unsigned int source_packed_v_offset:8;
124 /* Load and Save r1.2 */
126 unsigned int destination_packed_y_offset:8;
127 unsigned int destination_packed_u_offset:8;
128 unsigned int destination_packed_v_offset:8;
134 unsigned int destination_rgb_format:8;
135 unsigned int pad0:24;
140 float procamp_constant_c1;
143 float procamp_constant_c2;
146 unsigned int statistics_surface_picth:16; /* Devided by 2 */
147 unsigned int pad1:16;
152 unsigned int pad0:24;
153 unsigned int top_field_first:8;
156 /* AVS/Scaling r1.6 */
157 float normalized_video_y_scaling_step;
161 float procamp_constant_c5;
166 float procamp_constant_c3;
172 float wg_csc_constant_c4;
175 float wg_csc_constant_c8;
178 float procamp_constant_c4;
187 float wg_csc_constant_c9;
192 float wg_csc_constant_c0;
195 float scaling_step_ratio;
198 float normalized_alpha_y_scaling;
201 float wg_csc_constant_c4;
204 float wg_csc_constant_c1;
207 int horizontal_origin_offset:16;
208 int vertical_origin_offset:16;
213 unsigned int color_pixel;
216 float wg_csc_constant_c2;
220 float wg_csc_constant_c3;
225 float wg_csc_constant_c6;
227 /* ALL r4.1 MBZ ???*/
234 unsigned int pad1:15;
236 unsigned int pad2:16;
241 unsigned int motion_history_coefficient_m2:8;
242 unsigned int motion_history_coefficient_m1:8;
243 unsigned int pad0:16;
248 float wg_csc_constant_c7;
251 float wg_csc_constant_c10;
254 float source_video_frame_normalized_horizontal_origin;
260 float wg_csc_constant_c11;
264 struct pp_inline_parameter
268 int destination_block_horizontal_origin:16;
269 int destination_block_vertical_origin:16;
274 float source_surface_block_normalized_horizontal_origin;
278 unsigned int variance_surface_vertical_origin:16;
279 unsigned int pad0:16;
283 /* AVS/Scaling r5.2 */
284 float source_surface_block_normalized_vertical_origin;
287 float alpha_surface_block_normalized_horizontal_origin;
290 float alpha_surface_block_normalized_vertical_origin;
293 unsigned int alpha_mask_x:16;
294 unsigned int alpha_mask_y:8;
295 unsigned int block_count_x:8;
298 unsigned int block_horizontal_mask:16;
299 unsigned int block_vertical_mask:8;
300 unsigned int number_blocks:8;
302 /* AVS/Scaling r5.7 */
303 float normalized_video_x_scaling_step;
308 float video_step_delta;
311 unsigned int padx[7];
315 struct gen7_pp_static_parameter
319 unsigned int padx[6];
321 unsigned int di_statistics_surface_pitch_div2:16;
322 unsigned int di_statistics_surface_height_div4:16;
324 unsigned int di_top_field_first:8;
325 unsigned int pad0:16;
326 unsigned int pointer_to_inline_parameter:8; /* value: 7 */
331 unsigned int padx[7];
333 unsigned int di_destination_packed_y_component_offset:8;
334 unsigned int di_destination_packed_u_component_offset:8;
335 unsigned int di_destination_packed_v_component_offset:8;
340 float sampler_load_horizontal_scaling_step_ratio;
341 unsigned int padx[7];
345 float sampler_load_vertical_scaling_step;
347 unsigned int di_hoffset_svf_from_dvf:16;
348 unsigned int di_voffset_svf_from_dvf:16;
349 unsigned int padx[5];
353 float sampler_load_vertical_frame_origin;
354 unsigned int padx[7];
358 float sampler_load_horizontal_frame_origin;
359 unsigned int padx[7];
363 struct gen7_pp_inline_parameter
367 unsigned int destination_block_horizontal_origin:16;
368 unsigned int destination_block_vertical_origin:16;
369 /* r7.1: 0xffffffff */
370 unsigned int constant_0;
376 float sampler_load_main_video_x_scaling_step;
379 /* r7.6: must be zero */
380 unsigned int avs_vertical_block_number;
382 unsigned int group_id_number;
386 unsigned int padx[8];
390 struct i965_post_processing_context
393 struct pp_module pp_modules[NUM_PP_MODULES];
394 void *pp_static_parameter;
395 void *pp_inline_parameter;
399 } surface_state_binding_table;
407 int num_interface_descriptors;
418 } sampler_state_table;
423 unsigned int vfe_start;
424 unsigned int cs_start;
426 unsigned int num_vfe_entries;
427 unsigned int num_cs_entries;
429 unsigned int size_vfe_entry;
430 unsigned int size_cs_entry;
438 struct pp_load_save_context pp_load_save_context;
439 struct pp_scaling_context pp_scaling_context;
440 struct pp_avs_context pp_avs_context;
441 struct pp_dndi_context pp_dndi_context;
442 struct pp_dn_context pp_dn_context;
445 int (*pp_x_steps)(void *private_context);
446 int (*pp_y_steps)(void *private_context);
447 int (*pp_set_block_parameter)(struct i965_post_processing_context *pp_context, int x, int y);
449 struct intel_batchbuffer *batch;
452 struct i965_proc_context
454 struct hw_context base;
455 struct i965_post_processing_context pp_context;
459 i965_post_processing(
460 VADriverContextP ctx,
462 const VARectangle *src_rect,
463 const VARectangle *dst_rect,
465 int *has_done_scaling
469 i965_image_processing(VADriverContextP ctx,
470 const struct i965_surface *src_surface,
471 const VARectangle *src_rect,
472 struct i965_surface *dst_surface,
473 const VARectangle *dst_rect);
476 i965_post_processing_terminate(VADriverContextP ctx);
478 i965_post_processing_init(VADriverContextP ctx);
480 #endif /* __I965_POST_PROCESSING_H__ */