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