2 * Copyright © 2014 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.
28 #include "i965_drv_video.h"
35 /* Extra set of chroma formats supported for H.264 decoding (beyond YUV 4:2:0) */
36 #define EXTRA_H264_DEC_CHROMA_FORMATS \
39 /* Extra set of chroma formats supported for JPEG decoding (beyond YUV 4:2:0) */
40 #define EXTRA_JPEG_DEC_CHROMA_FORMATS \
41 (VA_RT_FORMAT_YUV400 | VA_RT_FORMAT_YUV411 | VA_RT_FORMAT_YUV422 | \
44 /* Extra set of chroma formats supported for JPEG encoding (beyond YUV 4:2:0) */
45 #define EXTRA_JPEG_ENC_CHROMA_FORMATS \
46 (VA_RT_FORMAT_YUV400| VA_RT_FORMAT_YUV422 | VA_RT_FORMAT_YUV444 | VA_RT_FORMAT_RGB32)
48 #define EXTRA_HEVC_DEC_CHROMA_FORMATS \
49 (VA_RT_FORMAT_YUV420_10BPP)
51 #define EXTRA_VP9_DEC_CHROMA_FORMATS \
52 (VA_RT_FORMAT_YUV420_10BPP)
54 /* Defines VA profile as a 32-bit unsigned integer mask */
55 #define VA_PROFILE_MASK(PROFILE) \
56 (1U << VAProfile##PROFILE)
58 #define VP9_PROFILE_MASK(PROFILE) \
61 extern struct hw_context *i965_proc_context_init(VADriverContextP, struct object_config *);
62 extern struct hw_context *g4x_dec_hw_context_init(VADriverContextP, struct object_config *);
63 extern bool genx_render_init(VADriverContextP);
65 static struct hw_codec_info g4x_hw_codec_info = {
66 .dec_hw_context_init = g4x_dec_hw_context_init,
67 .enc_hw_context_init = NULL,
68 .proc_hw_context_init = NULL,
69 .render_init = genx_render_init,
70 .post_processing_context_init = NULL,
74 .min_linear_wpitch = 16,
75 .min_linear_hpitch = 4,
77 .has_mpeg2_decoding = 1,
82 extern struct hw_context *ironlake_dec_hw_context_init(VADriverContextP, struct object_config *);
83 extern void i965_post_processing_context_init(VADriverContextP, void *, struct intel_batchbuffer *);
85 static struct hw_codec_info ilk_hw_codec_info = {
86 .dec_hw_context_init = ironlake_dec_hw_context_init,
87 .enc_hw_context_init = NULL,
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,
94 .min_linear_wpitch = 16,
95 .min_linear_hpitch = 4,
97 .has_mpeg2_decoding = 1,
98 .has_h264_decoding = 1,
100 .has_accelerated_putimage = 1,
105 static void gen6_hw_codec_preinit(VADriverContextP ctx, struct hw_codec_info *codec_info);
107 extern struct hw_context *gen6_dec_hw_context_init(VADriverContextP, struct object_config *);
108 extern struct hw_context *gen6_enc_hw_context_init(VADriverContextP, struct object_config *);
109 static struct hw_codec_info snb_hw_codec_info = {
110 .dec_hw_context_init = gen6_dec_hw_context_init,
111 .enc_hw_context_init = gen6_enc_hw_context_init,
112 .proc_hw_context_init = i965_proc_context_init,
113 .render_init = genx_render_init,
114 .post_processing_context_init = i965_post_processing_context_init,
115 .preinit_hw_codec = gen6_hw_codec_preinit,
119 .min_linear_wpitch = 16,
120 .min_linear_hpitch = 4,
122 .h264_mvc_dec_profiles = VA_PROFILE_MASK(H264StereoHigh),
123 .h264_dec_chroma_formats = EXTRA_H264_DEC_CHROMA_FORMATS,
125 .has_mpeg2_decoding = 1,
126 .has_h264_decoding = 1,
127 .has_h264_encoding = 1,
128 .has_vc1_decoding = 1,
130 .has_accelerated_getimage = 1,
131 .has_accelerated_putimage = 1,
132 .has_tiled_surface = 1,
133 .has_di_motion_adptive = 1,
135 .h264_brc_mode = VA_RC_CQP | VA_RC_CBR | VA_RC_VBR,
139 { VAProcFilterNoiseReduction, I965_RING_NULL },
140 { VAProcFilterDeinterlacing, I965_RING_NULL },
144 static void gen7_hw_codec_preinit(VADriverContextP ctx, struct hw_codec_info *codec_info);
146 extern struct hw_context *gen7_dec_hw_context_init(VADriverContextP, struct object_config *);
147 extern struct hw_context *gen7_enc_hw_context_init(VADriverContextP, struct object_config *);
148 static struct hw_codec_info ivb_hw_codec_info = {
149 .dec_hw_context_init = gen7_dec_hw_context_init,
150 .enc_hw_context_init = gen7_enc_hw_context_init,
151 .proc_hw_context_init = i965_proc_context_init,
152 .render_init = genx_render_init,
153 .post_processing_context_init = i965_post_processing_context_init,
154 .preinit_hw_codec = gen7_hw_codec_preinit,
158 .min_linear_wpitch = 64,
159 .min_linear_hpitch = 4,
161 .h264_mvc_dec_profiles = VA_PROFILE_MASK(H264StereoHigh),
162 .h264_dec_chroma_formats = EXTRA_H264_DEC_CHROMA_FORMATS,
163 .jpeg_dec_chroma_formats = EXTRA_JPEG_DEC_CHROMA_FORMATS,
165 .has_mpeg2_decoding = 1,
166 .has_mpeg2_encoding = 1,
167 .has_h264_decoding = 1,
168 .has_h264_encoding = 1,
169 .has_vc1_decoding = 1,
170 .has_jpeg_decoding = 1,
172 .has_accelerated_getimage = 1,
173 .has_accelerated_putimage = 1,
174 .has_tiled_surface = 1,
175 .has_di_motion_adptive = 1,
176 .has_di_motion_compensated = 1,
178 .h264_brc_mode = VA_RC_CQP | VA_RC_CBR | VA_RC_VBR,
182 { VAProcFilterNoiseReduction, I965_RING_NULL },
183 { VAProcFilterDeinterlacing, I965_RING_NULL },
187 static void hsw_hw_codec_preinit(VADriverContextP ctx, struct hw_codec_info *codec_info);
189 extern struct hw_context *gen75_dec_hw_context_init(VADriverContextP, struct object_config *);
190 extern struct hw_context *gen75_enc_hw_context_init(VADriverContextP, struct object_config *);
191 extern struct hw_context *gen75_proc_context_init(VADriverContextP, struct object_config *);
192 static struct hw_codec_info hsw_hw_codec_info = {
193 .dec_hw_context_init = gen75_dec_hw_context_init,
194 .enc_hw_context_init = gen75_enc_hw_context_init,
195 .proc_hw_context_init = gen75_proc_context_init,
196 .render_init = genx_render_init,
197 .post_processing_context_init = i965_post_processing_context_init,
198 .preinit_hw_codec = hsw_hw_codec_preinit,
202 .min_linear_wpitch = 64,
203 .min_linear_hpitch = 4,
205 .h264_mvc_dec_profiles = (VA_PROFILE_MASK(H264StereoHigh) |
206 VA_PROFILE_MASK(H264MultiviewHigh)),
207 .h264_dec_chroma_formats = EXTRA_H264_DEC_CHROMA_FORMATS,
208 .jpeg_dec_chroma_formats = EXTRA_JPEG_DEC_CHROMA_FORMATS,
210 .has_mpeg2_decoding = 1,
211 .has_mpeg2_encoding = 1,
212 .has_h264_decoding = 1,
213 .has_h264_encoding = 1,
214 .has_vc1_decoding = 1,
215 .has_jpeg_decoding = 1,
217 .has_accelerated_getimage = 1,
218 .has_accelerated_putimage = 1,
219 .has_tiled_surface = 1,
220 .has_di_motion_adptive = 1,
221 .has_di_motion_compensated = 1,
222 .has_h264_mvc_encoding = 1,
224 .h264_brc_mode = VA_RC_CQP | VA_RC_CBR | VA_RC_VBR,
228 { VAProcFilterNoiseReduction, I965_RING_VEBOX },
229 { VAProcFilterDeinterlacing, I965_RING_VEBOX },
230 { VAProcFilterSharpening, I965_RING_NULL },
231 { VAProcFilterColorBalance, I965_RING_VEBOX},
232 { VAProcFilterSkinToneEnhancement, I965_RING_VEBOX},
236 extern struct hw_context *gen8_dec_hw_context_init(VADriverContextP, struct object_config *);
237 extern struct hw_context *gen8_enc_hw_context_init(VADriverContextP, struct object_config *);
238 extern void gen8_post_processing_context_init(VADriverContextP, void *, struct intel_batchbuffer *);
239 static struct hw_codec_info bdw_hw_codec_info = {
240 .dec_hw_context_init = gen8_dec_hw_context_init,
241 .enc_hw_context_init = gen8_enc_hw_context_init,
242 .proc_hw_context_init = gen75_proc_context_init,
243 .render_init = gen8_render_init,
244 .post_processing_context_init = gen8_post_processing_context_init,
248 .min_linear_wpitch = 64,
249 .min_linear_hpitch = 4,
251 .h264_mvc_dec_profiles = (VA_PROFILE_MASK(H264StereoHigh) |
252 VA_PROFILE_MASK(H264MultiviewHigh)),
253 .h264_dec_chroma_formats = EXTRA_H264_DEC_CHROMA_FORMATS,
254 .jpeg_dec_chroma_formats = EXTRA_JPEG_DEC_CHROMA_FORMATS,
256 .has_mpeg2_decoding = 1,
257 .has_mpeg2_encoding = 1,
258 .has_h264_decoding = 1,
259 .has_h264_encoding = 1,
260 .has_vc1_decoding = 1,
261 .has_jpeg_decoding = 1,
263 .has_accelerated_getimage = 1,
264 .has_accelerated_putimage = 1,
265 .has_tiled_surface = 1,
266 .has_di_motion_adptive = 1,
267 .has_di_motion_compensated = 1,
268 .has_vp8_decoding = 1,
269 .has_h264_mvc_encoding = 1,
271 .h264_brc_mode = VA_RC_CQP | VA_RC_CBR | VA_RC_VBR,
275 { VAProcFilterNoiseReduction, I965_RING_VEBOX },
276 { VAProcFilterDeinterlacing, I965_RING_VEBOX },
277 { VAProcFilterSharpening, I965_RING_NULL }, /* need to rebuild the shader for BDW */
278 { VAProcFilterColorBalance, I965_RING_VEBOX},
279 { VAProcFilterSkinToneEnhancement, I965_RING_VEBOX},
283 extern struct hw_context *gen9_dec_hw_context_init(VADriverContextP, struct object_config *);
284 static struct hw_codec_info chv_hw_codec_info = {
285 .dec_hw_context_init = gen9_dec_hw_context_init,
286 .enc_hw_context_init = gen8_enc_hw_context_init,
287 .proc_hw_context_init = gen75_proc_context_init,
288 .render_init = gen8_render_init,
289 .post_processing_context_init = gen8_post_processing_context_init,
293 .min_linear_wpitch = 64,
294 .min_linear_hpitch = 4,
296 .h264_mvc_dec_profiles = (VA_PROFILE_MASK(H264StereoHigh) |
297 VA_PROFILE_MASK(H264MultiviewHigh)),
298 .h264_dec_chroma_formats = EXTRA_H264_DEC_CHROMA_FORMATS,
299 .jpeg_dec_chroma_formats = EXTRA_JPEG_DEC_CHROMA_FORMATS,
300 .jpeg_enc_chroma_formats = EXTRA_JPEG_ENC_CHROMA_FORMATS,
302 .has_mpeg2_decoding = 1,
303 .has_mpeg2_encoding = 1,
304 .has_h264_decoding = 1,
305 .has_h264_encoding = 1,
306 .has_vc1_decoding = 1,
307 .has_jpeg_decoding = 1,
308 .has_jpeg_encoding = 1,
310 .has_accelerated_getimage = 1,
311 .has_accelerated_putimage = 1,
312 .has_tiled_surface = 1,
313 .has_di_motion_adptive = 1,
314 .has_di_motion_compensated = 1,
315 .has_vp8_decoding = 1,
316 .has_vp8_encoding = 1,
317 .has_h264_mvc_encoding = 1,
318 .has_hevc_decoding = 1,
320 .h264_brc_mode = VA_RC_CQP | VA_RC_CBR | VA_RC_VBR,
324 { VAProcFilterNoiseReduction, I965_RING_VEBOX },
325 { VAProcFilterDeinterlacing, I965_RING_VEBOX },
326 { VAProcFilterSharpening, I965_RING_NULL }, /* need to rebuild the shader for BDW */
327 { VAProcFilterColorBalance, I965_RING_VEBOX},
328 { VAProcFilterSkinToneEnhancement, I965_RING_VEBOX},
332 static void gen9_hw_codec_preinit(VADriverContextP ctx, struct hw_codec_info *codec_info);
334 extern struct hw_context *gen9_enc_hw_context_init(VADriverContextP, struct object_config *);
335 extern void gen9_post_processing_context_init(VADriverContextP, void *, struct intel_batchbuffer *);
336 extern void gen9_max_resolution(struct i965_driver_data *, struct object_config *, int *, int *);
337 static struct hw_codec_info skl_hw_codec_info = {
338 .dec_hw_context_init = gen9_dec_hw_context_init,
339 .enc_hw_context_init = gen9_enc_hw_context_init,
340 .proc_hw_context_init = gen75_proc_context_init,
341 .render_init = gen9_render_init,
342 .post_processing_context_init = gen9_post_processing_context_init,
343 .max_resolution = gen9_max_resolution,
344 .preinit_hw_codec = gen9_hw_codec_preinit,
346 .max_width = 4096, /* default. See max_resolution */
347 .max_height = 4096, /* default. See max_resolution */
348 .min_linear_wpitch = 64,
349 .min_linear_hpitch = 4,
351 .h264_mvc_dec_profiles = (VA_PROFILE_MASK(H264StereoHigh) |
352 VA_PROFILE_MASK(H264MultiviewHigh)),
353 .h264_dec_chroma_formats = EXTRA_H264_DEC_CHROMA_FORMATS,
354 .jpeg_dec_chroma_formats = EXTRA_JPEG_DEC_CHROMA_FORMATS,
355 .jpeg_enc_chroma_formats = EXTRA_JPEG_ENC_CHROMA_FORMATS,
357 .has_mpeg2_decoding = 1,
358 .has_mpeg2_encoding = 1,
359 .has_h264_decoding = 1,
360 .has_h264_encoding = 1,
361 .has_vc1_decoding = 1,
362 .has_jpeg_decoding = 1,
363 .has_jpeg_encoding = 1,
365 .has_accelerated_getimage = 1,
366 .has_accelerated_putimage = 1,
367 .has_tiled_surface = 1,
368 .has_di_motion_adptive = 1,
369 .has_di_motion_compensated = 1,
370 .has_vp8_decoding = 1,
371 .has_vp8_encoding = 1,
372 .has_h264_mvc_encoding = 1,
373 .has_hevc_decoding = 1,
374 .has_hevc_encoding = 1,
375 .has_lp_h264_encoding = 1,
376 .has_fei_h264_encoding = 1,
378 .lp_h264_brc_mode = VA_RC_CQP,
379 .h264_brc_mode = VA_RC_CQP | VA_RC_CBR | VA_RC_VBR | VA_RC_MB,
383 { VAProcFilterNoiseReduction, I965_RING_VEBOX },
384 { VAProcFilterDeinterlacing, I965_RING_VEBOX },
385 { VAProcFilterSharpening, I965_RING_NULL }, /* need to rebuild the shader for BDW */
386 { VAProcFilterColorBalance, I965_RING_VEBOX},
387 { VAProcFilterSkinToneEnhancement, I965_RING_VEBOX},
392 static struct hw_codec_info bxt_hw_codec_info = {
393 .dec_hw_context_init = gen9_dec_hw_context_init,
394 .enc_hw_context_init = gen9_enc_hw_context_init,
395 .proc_hw_context_init = gen75_proc_context_init,
396 .render_init = gen9_render_init,
397 .post_processing_context_init = gen9_post_processing_context_init,
398 .max_resolution = gen9_max_resolution,
399 .preinit_hw_codec = gen9_hw_codec_preinit,
401 .max_width = 4096, /* default. See max_resolution */
402 .max_height = 4096, /* default. See max_resolution */
403 .min_linear_wpitch = 64,
404 .min_linear_hpitch = 4,
406 .h264_mvc_dec_profiles = (VA_PROFILE_MASK(H264StereoHigh) |
407 VA_PROFILE_MASK(H264MultiviewHigh)),
408 .vp9_dec_profiles = VP9_PROFILE_MASK(0),
410 .h264_dec_chroma_formats = EXTRA_H264_DEC_CHROMA_FORMATS,
411 .jpeg_dec_chroma_formats = EXTRA_JPEG_DEC_CHROMA_FORMATS,
412 .jpeg_enc_chroma_formats = EXTRA_JPEG_ENC_CHROMA_FORMATS,
413 .hevc_dec_chroma_formats = EXTRA_HEVC_DEC_CHROMA_FORMATS,
415 .has_mpeg2_decoding = 1,
416 .has_h264_decoding = 1,
417 .has_h264_encoding = 1,
418 .has_vc1_decoding = 1,
419 .has_jpeg_decoding = 1,
420 .has_jpeg_encoding = 1,
422 .has_accelerated_getimage = 1,
423 .has_accelerated_putimage = 1,
424 .has_tiled_surface = 1,
425 .has_di_motion_adptive = 1,
426 .has_di_motion_compensated = 1,
427 .has_vp8_decoding = 1,
428 .has_vp8_encoding = 1,
429 .has_h264_mvc_encoding = 1,
430 .has_hevc_decoding = 1,
431 .has_hevc_encoding = 1,
432 .has_hevc10_decoding = 1,
433 .has_vp9_decoding = 1,
435 .has_lp_h264_encoding = 1,
437 .lp_h264_brc_mode = VA_RC_CQP,
438 .h264_brc_mode = VA_RC_CQP | VA_RC_CBR | VA_RC_VBR | VA_RC_MB,
442 { VAProcFilterNoiseReduction, I965_RING_VEBOX },
443 { VAProcFilterDeinterlacing, I965_RING_VEBOX },
444 { VAProcFilterSharpening, I965_RING_NULL },
445 { VAProcFilterColorBalance, I965_RING_VEBOX},
446 { VAProcFilterSkinToneEnhancement, I965_RING_VEBOX},
450 static struct hw_codec_info kbl_hw_codec_info = {
451 .dec_hw_context_init = gen9_dec_hw_context_init,
452 .enc_hw_context_init = gen9_enc_hw_context_init,
453 .proc_hw_context_init = gen75_proc_context_init,
454 .render_init = gen9_render_init,
455 .post_processing_context_init = gen9_post_processing_context_init,
456 .max_resolution = gen9_max_resolution,
457 .preinit_hw_codec = gen9_hw_codec_preinit,
459 .max_width = 4096, /* default. See max_resolution */
460 .max_height = 4096, /* default. See max_resolution */
461 .min_linear_wpitch = 64,
462 .min_linear_hpitch = 4,
464 .h264_mvc_dec_profiles = (VA_PROFILE_MASK(H264StereoHigh) |
465 VA_PROFILE_MASK(H264MultiviewHigh)),
466 .vp9_dec_profiles = VP9_PROFILE_MASK(0) |
468 .vp9_enc_profiles = VP9_PROFILE_MASK(0),
470 .h264_dec_chroma_formats = EXTRA_H264_DEC_CHROMA_FORMATS,
471 .jpeg_dec_chroma_formats = EXTRA_JPEG_DEC_CHROMA_FORMATS,
472 .jpeg_enc_chroma_formats = EXTRA_JPEG_ENC_CHROMA_FORMATS,
473 .hevc_dec_chroma_formats = EXTRA_HEVC_DEC_CHROMA_FORMATS,
474 .vp9_dec_chroma_formats = EXTRA_VP9_DEC_CHROMA_FORMATS,
476 .has_mpeg2_decoding = 1,
477 .has_mpeg2_encoding = 1,
478 .has_h264_decoding = 1,
479 .has_h264_encoding = 1,
480 .has_vc1_decoding = 1,
481 .has_jpeg_decoding = 1,
482 .has_jpeg_encoding = 1,
484 .has_accelerated_getimage = 1,
485 .has_accelerated_putimage = 1,
486 .has_tiled_surface = 1,
487 .has_di_motion_adptive = 1,
488 .has_di_motion_compensated = 1,
489 .has_vp8_decoding = 1,
490 .has_vp8_encoding = 1,
491 .has_h264_mvc_encoding = 1,
492 .has_hevc_decoding = 1,
493 .has_hevc_encoding = 1,
494 .has_hevc10_encoding = 1,
495 .has_hevc10_decoding = 1,
496 .has_vp9_decoding = 1,
498 .has_vp9_encoding = 1,
499 .has_lp_h264_encoding = 1,
501 .lp_h264_brc_mode = VA_RC_CQP,
502 .h264_brc_mode = VA_RC_CQP | VA_RC_CBR | VA_RC_VBR | VA_RC_MB,
506 { VAProcFilterNoiseReduction, I965_RING_VEBOX },
507 { VAProcFilterDeinterlacing, I965_RING_VEBOX },
508 { VAProcFilterSharpening, I965_RING_NULL },
509 { VAProcFilterColorBalance, I965_RING_VEBOX},
510 { VAProcFilterSkinToneEnhancement, I965_RING_VEBOX},
514 static struct hw_codec_info glk_hw_codec_info = {
515 .dec_hw_context_init = gen9_dec_hw_context_init,
516 .enc_hw_context_init = gen9_enc_hw_context_init,
517 .proc_hw_context_init = gen75_proc_context_init,
518 .render_init = gen9_render_init,
519 .post_processing_context_init = gen9_post_processing_context_init,
521 .max_resolution = gen9_max_resolution,
522 .preinit_hw_codec = gen9_hw_codec_preinit,
526 .min_linear_wpitch = 64,
527 .min_linear_hpitch = 4,
529 .h264_mvc_dec_profiles = (VA_PROFILE_MASK(H264StereoHigh) |
530 VA_PROFILE_MASK(H264MultiviewHigh)),
531 .vp9_dec_profiles = VP9_PROFILE_MASK(0) |
534 .vp9_enc_profiles = VP9_PROFILE_MASK(0),
536 .h264_dec_chroma_formats = EXTRA_H264_DEC_CHROMA_FORMATS,
537 .jpeg_dec_chroma_formats = EXTRA_JPEG_DEC_CHROMA_FORMATS,
538 .jpeg_enc_chroma_formats = EXTRA_JPEG_ENC_CHROMA_FORMATS,
539 .hevc_dec_chroma_formats = EXTRA_HEVC_DEC_CHROMA_FORMATS,
540 .vp9_dec_chroma_formats = EXTRA_VP9_DEC_CHROMA_FORMATS,
542 .has_mpeg2_decoding = 1,
543 .has_h264_decoding = 1,
544 .has_h264_encoding = 1,
545 .has_vc1_decoding = 1,
546 .has_jpeg_decoding = 1,
547 .has_jpeg_encoding = 1,
549 .has_accelerated_getimage = 1,
550 .has_accelerated_putimage = 1,
551 .has_tiled_surface = 1,
552 .has_di_motion_adptive = 1,
553 .has_di_motion_compensated = 1,
554 .has_vp8_decoding = 1,
555 .has_vp8_encoding = 1,
556 .has_h264_mvc_encoding = 1,
557 .has_hevc_decoding = 1,
558 .has_hevc_encoding = 1,
559 .has_hevc10_decoding = 1,
560 .has_hevc10_encoding = 1,
561 .has_vp9_decoding = 1,
563 .has_vp9_encoding = 1,
564 .has_lp_h264_encoding = 1,
566 .lp_h264_brc_mode = VA_RC_CQP,
567 .h264_brc_mode = VA_RC_CQP | VA_RC_CBR | VA_RC_VBR | VA_RC_MB,
571 { VAProcFilterNoiseReduction, I965_RING_VEBOX },
572 { VAProcFilterDeinterlacing, I965_RING_VEBOX },
573 { VAProcFilterSharpening, I965_RING_NULL },
574 { VAProcFilterColorBalance, I965_RING_VEBOX},
575 { VAProcFilterSkinToneEnhancement, I965_RING_VEBOX},
579 static struct hw_codec_info cfl_hw_codec_info = {
580 .dec_hw_context_init = gen9_dec_hw_context_init,
581 .enc_hw_context_init = gen9_enc_hw_context_init,
582 .proc_hw_context_init = gen75_proc_context_init,
583 .render_init = gen9_render_init,
584 .post_processing_context_init = gen9_post_processing_context_init,
585 .max_resolution = gen9_max_resolution,
586 .preinit_hw_codec = gen9_hw_codec_preinit,
588 .max_width = 4096, /* default. See max_resolution */
589 .max_height = 4096, /* default. See max_resolution */
590 .min_linear_wpitch = 64,
591 .min_linear_hpitch = 16,
593 .h264_mvc_dec_profiles = (VA_PROFILE_MASK(H264StereoHigh) |
594 VA_PROFILE_MASK(H264MultiviewHigh)),
595 .vp9_dec_profiles = VP9_PROFILE_MASK(0) |
597 .vp9_enc_profiles = VP9_PROFILE_MASK(0),
599 .h264_dec_chroma_formats = EXTRA_H264_DEC_CHROMA_FORMATS,
600 .jpeg_dec_chroma_formats = EXTRA_JPEG_DEC_CHROMA_FORMATS,
601 .jpeg_enc_chroma_formats = EXTRA_JPEG_ENC_CHROMA_FORMATS,
602 .hevc_dec_chroma_formats = EXTRA_HEVC_DEC_CHROMA_FORMATS,
603 .vp9_dec_chroma_formats = EXTRA_VP9_DEC_CHROMA_FORMATS,
605 .has_mpeg2_decoding = 1,
606 .has_mpeg2_encoding = 1,
607 .has_h264_decoding = 1,
608 .has_h264_encoding = 1,
609 .has_vc1_decoding = 1,
610 .has_jpeg_decoding = 1,
611 .has_jpeg_encoding = 1,
613 .has_accelerated_getimage = 1,
614 .has_accelerated_putimage = 1,
615 .has_tiled_surface = 1,
616 .has_di_motion_adptive = 1,
617 .has_di_motion_compensated = 1,
618 .has_vp8_decoding = 1,
619 .has_vp8_encoding = 1,
620 .has_h264_mvc_encoding = 1,
621 .has_hevc_decoding = 1,
622 .has_hevc_encoding = 1,
623 .has_hevc10_encoding = 1,
624 .has_hevc10_decoding = 1,
625 .has_vp9_decoding = 1,
627 .has_vp9_encoding = 1,
628 .has_lp_h264_encoding = 1,
630 .lp_h264_brc_mode = VA_RC_CQP,
631 .h264_brc_mode = VA_RC_CQP | VA_RC_CBR | VA_RC_VBR | VA_RC_MB,
635 { VAProcFilterNoiseReduction, I965_RING_VEBOX },
636 { VAProcFilterDeinterlacing, I965_RING_VEBOX },
637 { VAProcFilterSharpening, I965_RING_NULL },
638 { VAProcFilterColorBalance, I965_RING_VEBOX},
639 { VAProcFilterSkinToneEnhancement, I965_RING_VEBOX},
643 struct hw_codec_info *
644 i965_get_codec_info(int devid)
648 #define CHIPSET(id, family, dev, str) case id: return &family##_hw_codec_info;
649 #include "i965_pciids.h"
655 static const struct intel_device_info g4x_device_info = {
659 .max_wm_threads = 50, /* 10 * 5 */
664 static const struct intel_device_info ilk_device_info = {
668 .max_wm_threads = 72, /* 12 * 6 */
671 static const struct intel_device_info snb_gt1_device_info = {
676 .max_wm_threads = 40,
679 static const struct intel_device_info snb_gt2_device_info = {
684 .max_wm_threads = 80,
687 static const struct intel_device_info ivb_gt1_device_info = {
692 .max_wm_threads = 48,
697 static const struct intel_device_info ivb_gt2_device_info = {
702 .max_wm_threads = 172,
707 static const struct intel_device_info byt_device_info = {
712 .max_wm_threads = 48,
718 static const struct intel_device_info hsw_gt1_device_info = {
723 .max_wm_threads = 102,
728 static const struct intel_device_info hsw_gt2_device_info = {
733 .max_wm_threads = 204,
738 static const struct intel_device_info hsw_gt3_device_info = {
743 .max_wm_threads = 408,
748 static const struct intel_device_info bdw_device_info = {
752 .max_wm_threads = 64, /* per PSD */
755 static const struct intel_device_info chv_device_info = {
759 .max_wm_threads = 64, /* per PSD */
764 static const struct intel_device_info skl_device_info = {
768 .max_wm_threads = 64, /* per PSD */
773 static const struct intel_device_info bxt_device_info = {
777 .max_wm_threads = 64, /* per PSD */
781 static const struct intel_device_info kbl_device_info = {
785 .max_wm_threads = 64, /* per PSD */
790 static const struct intel_device_info glk_device_info = {
794 .max_wm_threads = 64, /* per PSD */
799 static const struct intel_device_info cfl_device_info = {
803 .max_wm_threads = 64, /* per PSD */
808 const struct intel_device_info *
809 i965_get_device_info(int devid)
813 #define CHIPSET(id, family, dev, str) case id: return &dev##_device_info;
814 #include "i965_pciids.h"
820 static void cpuid(unsigned int op,
821 uint32_t *eax, uint32_t *ebx,
822 uint32_t *ecx, uint32_t *edx)
824 __cpuid_count(op, 0, *eax, *ebx, *ecx, *edx);
828 * This function doesn't check the length. And the caller should
829 * assure that the length of input string should be greater than 48.
831 static int intel_driver_detect_cpustring(char *model_id)
835 if (model_id == NULL)
838 rdata = (uint32_t *)model_id;
840 /* obtain the max supported extended CPUID info */
841 cpuid(0x80000000, &rdata[0], &rdata[1], &rdata[2], &rdata[3]);
843 /* If the max extended CPUID info is less than 0x80000004, fail */
844 if (rdata[0] < 0x80000004)
847 /* obtain the CPUID string */
848 cpuid(0x80000002, &rdata[0], &rdata[1], &rdata[2], &rdata[3]);
849 cpuid(0x80000003, &rdata[4], &rdata[5], &rdata[6], &rdata[7]);
850 cpuid(0x80000004, &rdata[8], &rdata[9], &rdata[10], &rdata[11]);
852 *(model_id + 48) = '\0';
857 * the hook_list for HSW.
858 * It is captured by /proc/cpuinfo and the space character is stripped.
860 const static char *hsw_cpu_hook_list[] = {
861 "Intel(R)Pentium(R)3556U",
862 "Intel(R)Pentium(R)3560Y",
863 "Intel(R)Pentium(R)3550M",
864 "Intel(R)Celeron(R)2980U",
865 "Intel(R)Celeron(R)2955U",
866 "Intel(R)Celeron(R)2950M",
869 static void hsw_hw_codec_preinit(VADriverContextP ctx, struct hw_codec_info *codec_info)
871 char model_string[64];
872 char *model_ptr, *tmp_ptr;
873 int i, model_len, list_len;
876 memset(model_string, 0, sizeof(model_string));
878 /* If it can't detect cpu model_string, leave it alone */
879 if (intel_driver_detect_cpustring(model_string))
882 /* strip the cpufreq info */
883 model_ptr = model_string;
884 tmp_ptr = strstr(model_ptr, "@");
889 /* strip the space character and convert to the lower case */
890 model_ptr = model_string;
891 model_len = strlen(model_string);
892 for (i = 0; i < model_len; i++) {
893 if (model_string[i] != ' ') {
894 *model_ptr = model_string[i];
901 list_len = sizeof(hsw_cpu_hook_list) / sizeof(char *);
902 model_len = strlen(model_string);
903 for (i = 0; i < list_len; i++) {
904 model_ptr = (char *)hsw_cpu_hook_list[i];
906 if (strlen(model_ptr) != model_len)
909 if (strncasecmp(model_string, model_ptr, model_len) == 0) {
916 codec_info->has_h264_encoding = 0;
917 codec_info->has_h264_mvc_encoding = 0;
918 codec_info->has_mpeg2_encoding = 0;
924 * the hook_list for Sandybride.
925 * It is captured by /proc/cpuinfo and the space character is stripped.
927 const static char *gen6_cpu_hook_list[] = {
928 "Intel(R)Celeron(R)CPU847",
929 "Intel(R)Celeron(R)CPU867",
932 static void gen6_hw_codec_preinit(VADriverContextP ctx, struct hw_codec_info *codec_info)
934 char model_string[64];
935 char *model_ptr, *tmp_ptr;
936 int i, model_len, list_len;
939 memset(model_string, 0, sizeof(model_string));
941 /* If it can't detect cpu model_string, leave it alone */
942 if (intel_driver_detect_cpustring(model_string))
945 /* strip the cpufreq info */
946 model_ptr = model_string;
947 tmp_ptr = strstr(model_ptr, "@");
952 /* strip the space character and convert to the lower case */
953 model_ptr = model_string;
954 model_len = strlen(model_string);
955 for (i = 0; i < model_len; i++) {
956 if (model_string[i] != ' ') {
957 *model_ptr = model_string[i];
964 list_len = sizeof(gen6_cpu_hook_list) / sizeof(char *);
965 model_len = strlen(model_string);
966 for (i = 0; i < list_len; i++) {
967 model_ptr = (char *)gen6_cpu_hook_list[i];
969 if (strlen(model_ptr) != model_len)
972 if (strncasecmp(model_string, model_ptr, model_len) == 0) {
979 codec_info->has_h264_encoding = 0;
985 * the hook_list for Ivybridge.
986 * It is captured by /proc/cpuinfo and the space character is stripped.
988 const static char *gen7_cpu_hook_list[] = {
989 "Intel(R)Celeron(R)CPU1007U",
990 "Intel(R)Celeron(R)CPU1037U",
991 "Intel(R)Pentium(R)CPUG2130",
994 static void gen7_hw_codec_preinit(VADriverContextP ctx, struct hw_codec_info *codec_info)
996 char model_string[64];
997 char *model_ptr, *tmp_ptr;
998 int i, model_len, list_len;
1001 memset(model_string, 0, sizeof(model_string));
1003 /* If it can't detect cpu model_string, leave it alone */
1004 if (intel_driver_detect_cpustring(model_string))
1007 /* strip the cpufreq info */
1008 model_ptr = model_string;
1009 tmp_ptr = strstr(model_ptr, "@");
1014 /* strip the space character and convert to the lower case */
1015 model_ptr = model_string;
1016 model_len = strlen(model_string);
1017 for (i = 0; i < model_len; i++) {
1018 if (model_string[i] != ' ') {
1019 *model_ptr = model_string[i];
1026 list_len = sizeof(gen7_cpu_hook_list) / sizeof(char *);
1027 model_len = strlen(model_string);
1028 for (i = 0; i < list_len; i++) {
1029 model_ptr = (char *)gen7_cpu_hook_list[i];
1031 if (strlen(model_ptr) != model_len)
1034 if (strncasecmp(model_string, model_ptr, model_len) == 0) {
1041 codec_info->has_h264_encoding = 0;
1042 codec_info->has_mpeg2_encoding = 0;
1047 static void gen9_hw_codec_preinit(VADriverContextP ctx, struct hw_codec_info *codec_info)
1049 struct i965_driver_data *i965 = i965_driver_data(ctx);
1051 if (i965->intel.has_huc && codec_info->has_lp_h264_encoding)
1052 codec_info->lp_h264_brc_mode |= (VA_RC_CBR | VA_RC_VBR);