MVC: CODEC_H264_MVC defination and relatived properties check
[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 /* Extra set of chroma formats supported for H.264 decoding (beyond YUV 4:2:0) */
31 #define EXTRA_H264_DEC_CHROMA_FORMATS \
32     (VA_RT_FORMAT_YUV400)
33
34 /* Extra set of chroma formats supported for JPEG decoding (beyond YUV 4:2:0) */
35 #define EXTRA_JPEG_DEC_CHROMA_FORMATS \
36     (VA_RT_FORMAT_YUV400 | VA_RT_FORMAT_YUV411 | VA_RT_FORMAT_YUV422 | \
37      VA_RT_FORMAT_YUV444)
38
39 extern struct hw_context *i965_proc_context_init(VADriverContextP, struct object_config *);
40 extern struct hw_context *g4x_dec_hw_context_init(VADriverContextP, struct object_config *);
41 extern bool genx_render_init(VADriverContextP);
42
43 static const struct hw_codec_info g4x_hw_codec_info = {
44     .dec_hw_context_init = g4x_dec_hw_context_init,
45     .enc_hw_context_init = NULL,
46     .proc_hw_context_init = NULL,
47     .render_init = genx_render_init,
48     .post_processing_context_init = NULL,
49
50     .max_width = 2048,
51     .max_height = 2048,
52     .min_linear_wpitch = 16,
53     .min_linear_hpitch = 16,
54
55     .has_mpeg2_decoding = 1,
56
57     .num_filters = 0,
58 };
59
60 extern struct hw_context *ironlake_dec_hw_context_init(VADriverContextP, struct object_config *);
61 extern void i965_post_processing_context_init(VADriverContextP, void *, struct intel_batchbuffer *);
62
63 static const struct hw_codec_info ilk_hw_codec_info = {
64     .dec_hw_context_init = ironlake_dec_hw_context_init,
65     .enc_hw_context_init = NULL,
66     .proc_hw_context_init = i965_proc_context_init,
67     .render_init = genx_render_init,
68     .post_processing_context_init = i965_post_processing_context_init,
69
70     .max_width = 2048,
71     .max_height = 2048,
72     .min_linear_wpitch = 16,
73     .min_linear_hpitch = 16,
74
75     .has_mpeg2_decoding = 1,
76     .has_h264_decoding = 1,
77     .has_vpp = 1,
78     .has_accelerated_putimage = 1,
79
80     .num_filters = 0,
81 };
82
83 extern struct hw_context *gen6_dec_hw_context_init(VADriverContextP, struct object_config *);
84 extern struct hw_context *gen6_enc_hw_context_init(VADriverContextP, struct object_config *);
85 static const struct hw_codec_info snb_hw_codec_info = {
86     .dec_hw_context_init = gen6_dec_hw_context_init,
87     .enc_hw_context_init = gen6_enc_hw_context_init,
88     .proc_hw_context_init = i965_proc_context_init,
89     .render_init = genx_render_init,
90     .post_processing_context_init = i965_post_processing_context_init,
91
92     .max_width = 2048,
93     .max_height = 2048,
94     .min_linear_wpitch = 16,
95     .min_linear_hpitch = 16,
96
97     .h264_dec_chroma_formats = EXTRA_H264_DEC_CHROMA_FORMATS,
98
99     .has_mpeg2_decoding = 1,
100     .has_h264_decoding = 1,
101     .has_h264_encoding = 1,
102     .has_vc1_decoding = 1,
103     .has_vpp = 1,
104     .has_accelerated_getimage = 1,
105     .has_accelerated_putimage = 1,
106     .has_tiled_surface = 1,
107     .has_di_motion_adptive = 1,
108
109     .num_filters = 2,
110     .filters = {
111         { VAProcFilterNoiseReduction, I965_RING_NULL },
112         { VAProcFilterDeinterlacing, I965_RING_NULL },
113     },
114 };
115
116 extern struct hw_context *gen7_dec_hw_context_init(VADriverContextP, struct object_config *);
117 extern struct hw_context *gen7_enc_hw_context_init(VADriverContextP, struct object_config *);
118 static const struct hw_codec_info ivb_hw_codec_info = {
119     .dec_hw_context_init = gen7_dec_hw_context_init,
120     .enc_hw_context_init = gen7_enc_hw_context_init,
121     .proc_hw_context_init = i965_proc_context_init,
122     .render_init = genx_render_init,
123     .post_processing_context_init = i965_post_processing_context_init,
124
125     .max_width = 4096,
126     .max_height = 4096,
127     .min_linear_wpitch = 64,
128     .min_linear_hpitch = 16,
129
130     .h264_dec_chroma_formats = EXTRA_H264_DEC_CHROMA_FORMATS,
131     .jpeg_dec_chroma_formats = EXTRA_JPEG_DEC_CHROMA_FORMATS,
132
133     .has_mpeg2_decoding = 1,
134     .has_mpeg2_encoding = 1,
135     .has_h264_decoding = 1,
136     .has_h264_encoding = 1,
137     .has_vc1_decoding = 1,
138     .has_jpeg_decoding = 1,
139     .has_vpp = 1,
140     .has_accelerated_getimage = 1,
141     .has_accelerated_putimage = 1,
142     .has_tiled_surface = 1,
143     .has_di_motion_adptive = 1,
144
145     .num_filters = 2,
146     .filters = {
147         { VAProcFilterNoiseReduction, I965_RING_NULL },
148         { VAProcFilterDeinterlacing, I965_RING_NULL },
149     },
150 };
151
152 extern struct hw_context *gen75_dec_hw_context_init(VADriverContextP, struct object_config *);
153 extern struct hw_context *gen75_enc_hw_context_init(VADriverContextP, struct object_config *);
154 extern struct hw_context *gen75_proc_context_init(VADriverContextP, struct object_config *);
155 static const struct hw_codec_info hsw_hw_codec_info = {
156     .dec_hw_context_init = gen75_dec_hw_context_init,
157     .enc_hw_context_init = gen75_enc_hw_context_init,
158     .proc_hw_context_init = gen75_proc_context_init,
159     .render_init = genx_render_init,
160     .post_processing_context_init = i965_post_processing_context_init,
161
162     .max_width = 4096,
163     .max_height = 4096,
164     .min_linear_wpitch = 64,
165     .min_linear_hpitch = 16,
166
167     .h264_dec_chroma_formats = EXTRA_H264_DEC_CHROMA_FORMATS,
168     .jpeg_dec_chroma_formats = EXTRA_JPEG_DEC_CHROMA_FORMATS,
169
170     .has_mpeg2_decoding = 1,
171     .has_mpeg2_encoding = 1,
172     .has_h264_decoding = 1,
173     .has_h264_encoding = 1,
174     .has_vc1_decoding = 1,
175     .has_jpeg_decoding = 1,
176     .has_vpp = 1,
177     .has_accelerated_getimage = 1,
178     .has_accelerated_putimage = 1,
179     .has_tiled_surface = 1,
180     .has_di_motion_adptive = 1,
181     .has_di_motion_compensated = 1,
182     .has_h264_mvc_decoding = 1,
183     .has_h264_mvc_encoding = 1,
184
185     .num_filters = 5,
186     .filters = {
187         { VAProcFilterNoiseReduction, I965_RING_VEBOX },
188         { VAProcFilterDeinterlacing, I965_RING_VEBOX },
189         { VAProcFilterSharpening, I965_RING_NULL },
190         { VAProcFilterColorBalance, I965_RING_VEBOX},
191         { VAProcFilterSkinToneEnhancement, I965_RING_VEBOX},
192     },
193 };
194
195 extern struct hw_context *gen8_dec_hw_context_init(VADriverContextP, struct object_config *);
196 extern struct hw_context *gen8_enc_hw_context_init(VADriverContextP, struct object_config *);
197 extern void gen8_post_processing_context_init(VADriverContextP, void *, struct intel_batchbuffer *);
198 static const struct hw_codec_info bdw_hw_codec_info = {
199     .dec_hw_context_init = gen8_dec_hw_context_init,
200     .enc_hw_context_init = gen8_enc_hw_context_init,
201     .proc_hw_context_init = gen75_proc_context_init,
202     .render_init = gen8_render_init,
203     .post_processing_context_init = gen8_post_processing_context_init,
204
205     .max_width = 4096,
206     .max_height = 4096,
207     .min_linear_wpitch = 64,
208     .min_linear_hpitch = 16,
209
210     .h264_dec_chroma_formats = EXTRA_H264_DEC_CHROMA_FORMATS,
211     .jpeg_dec_chroma_formats = EXTRA_JPEG_DEC_CHROMA_FORMATS,
212
213     .has_mpeg2_decoding = 1,
214     .has_mpeg2_encoding = 1,
215     .has_h264_decoding = 1,
216     .has_h264_encoding = 1,
217     .has_vc1_decoding = 1,
218     .has_jpeg_decoding = 1,
219     .has_vpp = 1,
220     .has_accelerated_getimage = 1,
221     .has_accelerated_putimage = 1,
222     .has_tiled_surface = 1,
223     .has_di_motion_adptive = 1,
224     .has_di_motion_compensated = 1,
225     .has_vp8_decoding = 1,
226     .has_h264_mvc_decoding = 1,
227     .has_h264_mvc_encoding = 1,
228
229     .num_filters = 5,
230     .filters = {
231         { VAProcFilterNoiseReduction, I965_RING_VEBOX },
232         { VAProcFilterDeinterlacing, I965_RING_VEBOX },
233         { VAProcFilterSharpening, I965_RING_NULL }, /* need to rebuild the shader for BDW */
234         { VAProcFilterColorBalance, I965_RING_VEBOX},
235         { VAProcFilterSkinToneEnhancement, I965_RING_VEBOX},
236     },
237 };
238
239 const struct hw_codec_info *
240 i965_get_codec_info(int devid)
241 {
242     switch (devid) {
243 #undef CHIPSET
244 #define CHIPSET(id, family, dev, str) case id: return &family##_hw_codec_info;
245 #include "i965_pciids.h"
246     default:
247         return NULL;
248     }
249 }
250
251 static const struct intel_device_info g4x_device_info = {
252     .gen = 4,
253
254     .urb_size = 384,
255     .max_wm_threads = 50,       /* 10 * 5 */
256
257     .is_g4x = 1,
258 };
259
260 static const struct intel_device_info ilk_device_info = {
261     .gen = 5,
262
263     .urb_size = 1024,
264     .max_wm_threads = 72,       /* 12 * 6 */
265 };
266
267 static const struct intel_device_info snb_gt1_device_info = {
268     .gen = 6,
269     .gt = 1,
270
271     .urb_size = 1024,
272     .max_wm_threads = 40,
273 };
274
275 static const struct intel_device_info snb_gt2_device_info = {
276     .gen = 6,
277     .gt = 2,
278
279     .urb_size = 1024,
280     .max_wm_threads = 80,
281 };
282
283 static const struct intel_device_info ivb_gt1_device_info = {
284     .gen = 7,
285     .gt = 1,
286
287     .urb_size = 4096,
288     .max_wm_threads = 48,
289
290     .is_ivybridge = 1,
291 };
292
293 static const struct intel_device_info ivb_gt2_device_info = {
294     .gen = 7,
295     .gt = 2,
296
297     .urb_size = 4096,
298     .max_wm_threads = 172,
299
300     .is_ivybridge = 1,
301 };
302
303 static const struct intel_device_info byt_device_info = {
304     .gen = 7,
305     .gt = 1,
306
307     .urb_size = 4096,
308     .max_wm_threads = 48,
309
310     .is_ivybridge = 1,
311     .is_baytrail = 1,
312 };
313
314 static const struct intel_device_info hsw_gt1_device_info = {
315     .gen = 7,
316     .gt = 1,
317
318     .urb_size = 4096,
319     .max_wm_threads = 102,
320
321     .is_haswell = 1,
322 };
323
324 static const struct intel_device_info hsw_gt2_device_info = {
325     .gen = 7,
326     .gt = 2,
327
328     .urb_size = 4096,
329     .max_wm_threads = 204,
330
331     .is_haswell = 1,
332 };
333
334 static const struct intel_device_info hsw_gt3_device_info = {
335     .gen = 7,
336     .gt = 3,
337
338     .urb_size = 4096,
339     .max_wm_threads = 408,
340
341     .is_haswell = 1,
342 };
343
344 static const struct intel_device_info bdw_device_info = {
345     .gen = 8,
346
347     .urb_size = 4096,
348     .max_wm_threads = 64,       /* per PSD */
349 };
350
351 const struct intel_device_info *
352 i965_get_device_info(int devid)
353 {
354     switch (devid) {
355 #undef CHIPSET
356 #define CHIPSET(id, family, dev, str) case id: return &dev##_device_info;
357 #include "i965_pciids.h"
358     default:
359         return NULL;
360     }
361 }