render_init()/render_terminate() callback functions for each platform
[platform/upstream/libva-intel-driver.git] / src / i965_device_info.c
1 /*
2  * Copyright © 2014 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  */
25
26 #include <stdio.h>
27 #include <stdlib.h>
28 #include "i965_drv_video.h"
29
30 extern struct hw_context *i965_proc_context_init(VADriverContextP, struct object_config *);
31 extern struct hw_context *g4x_dec_hw_context_init(VADriverContextP, struct object_config *);
32 extern bool genx_render_init(VADriverContextP);
33
34 static const struct hw_codec_info g4x_hw_codec_info = {
35     .dec_hw_context_init = g4x_dec_hw_context_init,
36     .enc_hw_context_init = NULL,
37     .proc_hw_context_init = NULL,
38     .render_init = genx_render_init,
39
40     .max_width = 2048,
41     .max_height = 2048,
42
43     .has_mpeg2_decoding = 1,
44
45     .num_filters = 0,
46 };
47
48 extern struct hw_context *ironlake_dec_hw_context_init(VADriverContextP, struct object_config *);
49 static const struct hw_codec_info ilk_hw_codec_info = {
50     .dec_hw_context_init = ironlake_dec_hw_context_init,
51     .enc_hw_context_init = NULL,
52     .proc_hw_context_init = i965_proc_context_init,
53     .render_init = genx_render_init,
54
55     .max_width = 2048,
56     .max_height = 2048,
57
58     .has_mpeg2_decoding = 1,
59     .has_h264_decoding = 1,
60     .has_vpp = 1,
61     .has_accelerated_putimage = 1,
62
63     .num_filters = 0,
64 };
65
66 extern struct hw_context *gen6_dec_hw_context_init(VADriverContextP, struct object_config *);
67 extern struct hw_context *gen6_enc_hw_context_init(VADriverContextP, struct object_config *);
68 static const struct hw_codec_info snb_hw_codec_info = {
69     .dec_hw_context_init = gen6_dec_hw_context_init,
70     .enc_hw_context_init = gen6_enc_hw_context_init,
71     .proc_hw_context_init = i965_proc_context_init,
72     .render_init = genx_render_init,
73
74     .max_width = 2048,
75     .max_height = 2048,
76
77     .has_mpeg2_decoding = 1,
78     .has_h264_decoding = 1,
79     .has_h264_encoding = 1,
80     .has_vc1_decoding = 1,
81     .has_vpp = 1,
82     .has_accelerated_getimage = 1,
83     .has_accelerated_putimage = 1,
84     .has_tiled_surface = 1,
85
86     .num_filters = 2,
87     .filters = {
88         { VAProcFilterNoiseReduction, I965_RING_NULL },
89         { VAProcFilterDeinterlacing, I965_RING_NULL },
90     },
91 };
92
93 extern struct hw_context *gen7_dec_hw_context_init(VADriverContextP, struct object_config *);
94 extern struct hw_context *gen7_enc_hw_context_init(VADriverContextP, struct object_config *);
95 static const struct hw_codec_info ivb_hw_codec_info = {
96     .dec_hw_context_init = gen7_dec_hw_context_init,
97     .enc_hw_context_init = gen7_enc_hw_context_init,
98     .proc_hw_context_init = i965_proc_context_init,
99     .render_init = genx_render_init,
100
101     .max_width = 4096,
102     .max_height = 4096,
103
104     .has_mpeg2_decoding = 1,
105     .has_mpeg2_encoding = 1,
106     .has_h264_decoding = 1,
107     .has_h264_encoding = 1,
108     .has_vc1_decoding = 1,
109     .has_jpeg_decoding = 1,
110     .has_vpp = 1,
111     .has_accelerated_getimage = 1,
112     .has_accelerated_putimage = 1,
113     .has_tiled_surface = 1,
114     .has_di_motion_adptive = 1,
115
116     .num_filters = 2,
117     .filters = {
118         { VAProcFilterNoiseReduction, I965_RING_NULL },
119         { VAProcFilterDeinterlacing, I965_RING_NULL },
120     },
121 };
122
123 extern struct hw_context *gen75_dec_hw_context_init(VADriverContextP, struct object_config *);
124 extern struct hw_context *gen75_enc_hw_context_init(VADriverContextP, struct object_config *);
125 extern struct hw_context *gen75_proc_context_init(VADriverContextP, struct object_config *);
126 static const struct hw_codec_info hsw_hw_codec_info = {
127     .dec_hw_context_init = gen75_dec_hw_context_init,
128     .enc_hw_context_init = gen75_enc_hw_context_init,
129     .proc_hw_context_init = gen75_proc_context_init,
130     .render_init = genx_render_init,
131
132     .max_width = 4096,
133     .max_height = 4096,
134
135     .has_mpeg2_decoding = 1,
136     .has_mpeg2_encoding = 1,
137     .has_h264_decoding = 1,
138     .has_h264_encoding = 1,
139     .has_vc1_decoding = 1,
140     .has_jpeg_decoding = 1,
141     .has_vpp = 1,
142     .has_accelerated_getimage = 1,
143     .has_accelerated_putimage = 1,
144     .has_tiled_surface = 1,
145     .has_di_motion_adptive = 1,
146     .has_di_motion_compensated = 1,
147
148     .num_filters = 5,
149     .filters = {
150         { VAProcFilterNoiseReduction, I965_RING_VEBOX },
151         { VAProcFilterDeinterlacing, I965_RING_VEBOX },
152         { VAProcFilterSharpening, I965_RING_NULL },
153         { VAProcFilterColorBalance, I965_RING_VEBOX},
154         { VAProcFilterSkinToneEnhancement, I965_RING_VEBOX},
155     },
156 };
157
158 extern struct hw_context *gen8_dec_hw_context_init(VADriverContextP, struct object_config *);
159 extern struct hw_context *gen8_enc_hw_context_init(VADriverContextP, struct object_config *);
160 static const struct hw_codec_info bdw_hw_codec_info = {
161     .dec_hw_context_init = gen8_dec_hw_context_init,
162     .enc_hw_context_init = gen8_enc_hw_context_init,
163     .proc_hw_context_init = gen75_proc_context_init,
164     .render_init = gen8_render_init,
165
166     .max_width = 4096,
167     .max_height = 4096,
168
169     .has_mpeg2_decoding = 1,
170     .has_mpeg2_encoding = 1,
171     .has_h264_decoding = 1,
172     .has_h264_encoding = 1,
173     .has_vc1_decoding = 1,
174     .has_jpeg_decoding = 1,
175     .has_vpp = 1,
176     .has_accelerated_getimage = 1,
177     .has_accelerated_putimage = 1,
178     .has_tiled_surface = 1,
179     .has_di_motion_adptive = 1,
180     .has_di_motion_compensated = 1,
181     .has_vp8_decoding = 1,
182
183     .num_filters = 5,
184     .filters = {
185         { VAProcFilterNoiseReduction, I965_RING_VEBOX },
186         { VAProcFilterDeinterlacing, I965_RING_VEBOX },
187         { VAProcFilterSharpening, I965_RING_NULL }, /* need to rebuild the shader for BDW */
188         { VAProcFilterColorBalance, I965_RING_VEBOX},
189         { VAProcFilterSkinToneEnhancement, I965_RING_VEBOX},
190     },
191 };
192
193 const struct hw_codec_info *
194 i965_get_codec_info(int devid)
195 {
196     switch (devid) {
197 #undef CHIPSET
198 #define CHIPSET(id, family, dev, str) case id: return &family##_hw_codec_info;
199 #include "i965_pciids.h"
200     default:
201         return NULL;
202     }
203 }
204
205 static const struct intel_device_info g4x_device_info = {
206     .gen = 4,
207
208     .urb_size = 384,
209     .max_wm_threads = 50,       /* 10 * 5 */
210
211     .is_g4x = 1,
212 };
213
214 static const struct intel_device_info ilk_device_info = {
215     .gen = 5,
216
217     .urb_size = 1024,
218     .max_wm_threads = 72,       /* 12 * 6 */
219 };
220
221 static const struct intel_device_info snb_gt1_device_info = {
222     .gen = 6,
223     .gt = 1,
224
225     .urb_size = 1024,
226     .max_wm_threads = 40,
227 };
228
229 static const struct intel_device_info snb_gt2_device_info = {
230     .gen = 6,
231     .gt = 2,
232
233     .urb_size = 1024,
234     .max_wm_threads = 80,
235 };
236
237 static const struct intel_device_info ivb_gt1_device_info = {
238     .gen = 7,
239     .gt = 1,
240
241     .urb_size = 4096,
242     .max_wm_threads = 48,
243
244     .is_ivybridge = 1,
245 };
246
247 static const struct intel_device_info ivb_gt2_device_info = {
248     .gen = 7,
249     .gt = 2,
250
251     .urb_size = 4096,
252     .max_wm_threads = 172,
253
254     .is_ivybridge = 1,
255 };
256
257 static const struct intel_device_info byt_device_info = {
258     .gen = 7,
259     .gt = 1,
260
261     .urb_size = 4096,
262     .max_wm_threads = 48,
263
264     .is_ivybridge = 1,
265     .is_baytrail = 1,
266 };
267
268 static const struct intel_device_info hsw_gt1_device_info = {
269     .gen = 7,
270     .gt = 1,
271
272     .urb_size = 4096,
273     .max_wm_threads = 102,
274
275     .is_haswell = 1,
276 };
277
278 static const struct intel_device_info hsw_gt2_device_info = {
279     .gen = 7,
280     .gt = 2,
281
282     .urb_size = 4096,
283     .max_wm_threads = 204,
284
285     .is_haswell = 1,
286 };
287
288 static const struct intel_device_info hsw_gt3_device_info = {
289     .gen = 7,
290     .gt = 3,
291
292     .urb_size = 4096,
293     .max_wm_threads = 408,
294
295     .is_haswell = 1,
296 };
297
298 static const struct intel_device_info bdw_device_info = {
299     .gen = 8,
300
301     .urb_size = 4096,
302     .max_wm_threads = 64,       /* per PSD */
303 };
304
305 const struct intel_device_info *
306 i965_get_device_info(int devid)
307 {
308     switch (devid) {
309 #undef CHIPSET
310 #define CHIPSET(id, family, dev, str) case id: return &dev##_device_info;
311 #include "i965_pciids.h"
312     default:
313         return NULL;
314     }
315 }