OSDN Git Service

5ffee2cf83f97300b530262acacda5b2501fdbad
[android-x86/hardware-intel-common-vaapi.git] / src / gen75_vpp_gpe.h
1 /*
2  * Copyright © 2010 Intel Corporation
3  *
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:
11  *
12  * The above copyright notice and this permission notice (including the
13  * next paragraph) shall be included in all copies or substantial portions
14  * of the Software.
15  *
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.
23  *
24  * Authors:
25  *    Li Xiaowei <xiaowei.a.li@intel.com>
26  *
27  */
28
29 #ifndef GEN75_VPP_GPE
30 #define GEN75_VPP_GPE
31
32 #include <drm.h>
33 #include <i915_drm.h>
34 #include <intel_bufmgr.h>
35 #include <va/va_vpp.h>
36 #include "i965_gpe_utils.h"
37
38 #define MAX_SURF_IN_SUM 5
39
40 enum VPP_GPE_TYPE{
41    VPP_GPE_SHARPENING,
42    VPP_GPE_BLENDING,
43    VPP_GPE_SCENE_CHANGE_DETECTION,
44    VPP_GPE_FILTER_SUM,
45 };
46
47 typedef struct _KernelParameterBase{
48    unsigned short pic_width;
49    unsigned short pic_height;
50 }KernelParameterBase;
51
52 typedef struct _KernelParameterSharpening{
53    KernelParameterBase base;
54 }KernelParameterSharpening;
55
56 typedef struct _ThreadParameterBase{
57   unsigned int pic_width;
58   unsigned int pic_height;
59   unsigned int v_pos;
60   unsigned int h_pos;
61 }ThreadParameterBase;
62
63 typedef struct _ThreadParameterSharpenig{
64    ThreadParameterBase base;
65    unsigned int l_amount;
66    unsigned int d_amount;
67 }ThreadParameterSharpening;
68
69 struct vpp_gpe_context{
70     struct intel_batchbuffer *batch;
71     struct i965_gpe_context gpe_ctx;
72     struct i965_buffer_surface vpp_batchbuffer;
73     struct i965_buffer_surface vpp_kernel_return;
74
75     VAProcPipelineParameterBuffer *pipeline_param;
76     enum VPP_GPE_TYPE filter_type;
77     unsigned int sub_shader_index;
78     unsigned int sub_shader_sum;
79   
80     unsigned char * kernel_param;  
81     unsigned int kernel_param_size;
82
83     unsigned char * thread_param;  
84     unsigned int thread_param_size;
85     unsigned int thread_num;
86
87     struct object_surface *surface_pipeline_input_object;
88     struct object_surface *surface_output_object;
89     VASurfaceID  surface_tmp;
90     struct object_surface *surface_tmp_object;
91     struct object_surface *surface_input_object[MAX_SURF_IN_SUM];
92     unsigned  int forward_surf_sum;
93     unsigned  int backward_surf_sum;
94
95     unsigned int in_frame_w;
96     unsigned int in_frame_h;
97     unsigned int is_first_frame;
98
99     void (*gpe_context_init)(VADriverContextP ctx,
100                              struct i965_gpe_context *gpe_context);
101
102     void (*gpe_context_destroy)(struct i965_gpe_context *gpe_context);
103
104     void (*gpe_load_kernels)(VADriverContextP ctx,
105                              struct i965_gpe_context *gpe_context,
106                              struct i965_kernel *kernel_list,
107                              unsigned int num_kernels);
108
109 };
110
111 struct vpp_gpe_context *
112 vpp_gpe_context_init(VADriverContextP ctx);
113
114 void 
115 vpp_gpe_context_destroy(VADriverContextP ctx,
116                         struct vpp_gpe_context* vpp_context);
117
118 VAStatus
119 vpp_gpe_process_picture(VADriverContextP ctx,
120                         struct vpp_gpe_context * vpp_context);
121 #endif