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,
377 .has_h264_preenc = 1,
379 .lp_h264_brc_mode = VA_RC_CQP,
380 .h264_brc_mode = VA_RC_CQP | VA_RC_CBR | VA_RC_VBR | VA_RC_MB,
384 { VAProcFilterNoiseReduction, I965_RING_VEBOX },
385 { VAProcFilterDeinterlacing, I965_RING_VEBOX },
386 { VAProcFilterSharpening, I965_RING_NULL }, /* need to rebuild the shader for BDW */
387 { VAProcFilterColorBalance, I965_RING_VEBOX},
388 { VAProcFilterSkinToneEnhancement, I965_RING_VEBOX},
393 static struct hw_codec_info bxt_hw_codec_info = {
394 .dec_hw_context_init = gen9_dec_hw_context_init,
395 .enc_hw_context_init = gen9_enc_hw_context_init,
396 .proc_hw_context_init = gen75_proc_context_init,
397 .render_init = gen9_render_init,
398 .post_processing_context_init = gen9_post_processing_context_init,
399 .max_resolution = gen9_max_resolution,
400 .preinit_hw_codec = gen9_hw_codec_preinit,
402 .max_width = 4096, /* default. See max_resolution */
403 .max_height = 4096, /* default. See max_resolution */
404 .min_linear_wpitch = 64,
405 .min_linear_hpitch = 4,
407 .h264_mvc_dec_profiles = (VA_PROFILE_MASK(H264StereoHigh) |
408 VA_PROFILE_MASK(H264MultiviewHigh)),
409 .vp9_dec_profiles = VP9_PROFILE_MASK(0),
411 .h264_dec_chroma_formats = EXTRA_H264_DEC_CHROMA_FORMATS,
412 .jpeg_dec_chroma_formats = EXTRA_JPEG_DEC_CHROMA_FORMATS,
413 .jpeg_enc_chroma_formats = EXTRA_JPEG_ENC_CHROMA_FORMATS,
414 .hevc_dec_chroma_formats = EXTRA_HEVC_DEC_CHROMA_FORMATS,
416 .has_mpeg2_decoding = 1,
417 .has_h264_decoding = 1,
418 .has_h264_encoding = 1,
419 .has_vc1_decoding = 1,
420 .has_jpeg_decoding = 1,
421 .has_jpeg_encoding = 1,
423 .has_accelerated_getimage = 1,
424 .has_accelerated_putimage = 1,
425 .has_tiled_surface = 1,
426 .has_di_motion_adptive = 1,
427 .has_di_motion_compensated = 1,
428 .has_vp8_decoding = 1,
429 .has_vp8_encoding = 1,
430 .has_h264_mvc_encoding = 1,
431 .has_hevc_decoding = 1,
432 .has_hevc_encoding = 1,
433 .has_hevc10_decoding = 1,
434 .has_vp9_decoding = 1,
436 .has_lp_h264_encoding = 1,
438 .lp_h264_brc_mode = VA_RC_CQP,
439 .h264_brc_mode = VA_RC_CQP | VA_RC_CBR | VA_RC_VBR | VA_RC_MB,
443 { VAProcFilterNoiseReduction, I965_RING_VEBOX },
444 { VAProcFilterDeinterlacing, I965_RING_VEBOX },
445 { VAProcFilterSharpening, I965_RING_NULL },
446 { VAProcFilterColorBalance, I965_RING_VEBOX},
447 { VAProcFilterSkinToneEnhancement, I965_RING_VEBOX},
451 static struct hw_codec_info kbl_hw_codec_info = {
452 .dec_hw_context_init = gen9_dec_hw_context_init,
453 .enc_hw_context_init = gen9_enc_hw_context_init,
454 .proc_hw_context_init = gen75_proc_context_init,
455 .render_init = gen9_render_init,
456 .post_processing_context_init = gen9_post_processing_context_init,
457 .max_resolution = gen9_max_resolution,
458 .preinit_hw_codec = gen9_hw_codec_preinit,
460 .max_width = 4096, /* default. See max_resolution */
461 .max_height = 4096, /* default. See max_resolution */
462 .min_linear_wpitch = 64,
463 .min_linear_hpitch = 4,
465 .h264_mvc_dec_profiles = (VA_PROFILE_MASK(H264StereoHigh) |
466 VA_PROFILE_MASK(H264MultiviewHigh)),
467 .vp9_dec_profiles = VP9_PROFILE_MASK(0) |
469 .vp9_enc_profiles = VP9_PROFILE_MASK(0),
471 .h264_dec_chroma_formats = EXTRA_H264_DEC_CHROMA_FORMATS,
472 .jpeg_dec_chroma_formats = EXTRA_JPEG_DEC_CHROMA_FORMATS,
473 .jpeg_enc_chroma_formats = EXTRA_JPEG_ENC_CHROMA_FORMATS,
474 .hevc_dec_chroma_formats = EXTRA_HEVC_DEC_CHROMA_FORMATS,
475 .vp9_dec_chroma_formats = EXTRA_VP9_DEC_CHROMA_FORMATS,
477 .has_mpeg2_decoding = 1,
478 .has_mpeg2_encoding = 1,
479 .has_h264_decoding = 1,
480 .has_h264_encoding = 1,
481 .has_vc1_decoding = 1,
482 .has_jpeg_decoding = 1,
483 .has_jpeg_encoding = 1,
485 .has_accelerated_getimage = 1,
486 .has_accelerated_putimage = 1,
487 .has_tiled_surface = 1,
488 .has_di_motion_adptive = 1,
489 .has_di_motion_compensated = 1,
490 .has_vp8_decoding = 1,
491 .has_vp8_encoding = 1,
492 .has_h264_mvc_encoding = 1,
493 .has_hevc_decoding = 1,
494 .has_hevc_encoding = 1,
495 .has_hevc10_encoding = 1,
496 .has_hevc10_decoding = 1,
497 .has_vp9_decoding = 1,
499 .has_vp9_encoding = 1,
500 .has_lp_h264_encoding = 1,
502 .lp_h264_brc_mode = VA_RC_CQP,
503 .h264_brc_mode = VA_RC_CQP | VA_RC_CBR | VA_RC_VBR | VA_RC_MB,
507 { VAProcFilterNoiseReduction, I965_RING_VEBOX },
508 { VAProcFilterDeinterlacing, I965_RING_VEBOX },
509 { VAProcFilterSharpening, I965_RING_NULL },
510 { VAProcFilterColorBalance, I965_RING_VEBOX},
511 { VAProcFilterSkinToneEnhancement, I965_RING_VEBOX},
515 static struct hw_codec_info glk_hw_codec_info = {
516 .dec_hw_context_init = gen9_dec_hw_context_init,
517 .enc_hw_context_init = gen9_enc_hw_context_init,
518 .proc_hw_context_init = gen75_proc_context_init,
519 .render_init = gen9_render_init,
520 .post_processing_context_init = gen9_post_processing_context_init,
522 .max_resolution = gen9_max_resolution,
523 .preinit_hw_codec = gen9_hw_codec_preinit,
527 .min_linear_wpitch = 64,
528 .min_linear_hpitch = 4,
530 .h264_mvc_dec_profiles = (VA_PROFILE_MASK(H264StereoHigh) |
531 VA_PROFILE_MASK(H264MultiviewHigh)),
532 .vp9_dec_profiles = VP9_PROFILE_MASK(0) |
535 .vp9_enc_profiles = VP9_PROFILE_MASK(0),
537 .h264_dec_chroma_formats = EXTRA_H264_DEC_CHROMA_FORMATS,
538 .jpeg_dec_chroma_formats = EXTRA_JPEG_DEC_CHROMA_FORMATS,
539 .jpeg_enc_chroma_formats = EXTRA_JPEG_ENC_CHROMA_FORMATS,
540 .hevc_dec_chroma_formats = EXTRA_HEVC_DEC_CHROMA_FORMATS,
541 .vp9_dec_chroma_formats = EXTRA_VP9_DEC_CHROMA_FORMATS,
543 .has_mpeg2_decoding = 1,
544 .has_h264_decoding = 1,
545 .has_h264_encoding = 1,
546 .has_vc1_decoding = 1,
547 .has_jpeg_decoding = 1,
548 .has_jpeg_encoding = 1,
550 .has_accelerated_getimage = 1,
551 .has_accelerated_putimage = 1,
552 .has_tiled_surface = 1,
553 .has_di_motion_adptive = 1,
554 .has_di_motion_compensated = 1,
555 .has_vp8_decoding = 1,
556 .has_vp8_encoding = 1,
557 .has_h264_mvc_encoding = 1,
558 .has_hevc_decoding = 1,
559 .has_hevc_encoding = 1,
560 .has_hevc10_decoding = 1,
561 .has_hevc10_encoding = 1,
562 .has_vp9_decoding = 1,
564 .has_vp9_encoding = 1,
565 .has_lp_h264_encoding = 1,
567 .lp_h264_brc_mode = VA_RC_CQP,
568 .h264_brc_mode = VA_RC_CQP | VA_RC_CBR | VA_RC_VBR | VA_RC_MB,
572 { VAProcFilterNoiseReduction, I965_RING_VEBOX },
573 { VAProcFilterDeinterlacing, I965_RING_VEBOX },
574 { VAProcFilterSharpening, I965_RING_NULL },
575 { VAProcFilterColorBalance, I965_RING_VEBOX},
576 { VAProcFilterSkinToneEnhancement, I965_RING_VEBOX},
580 static struct hw_codec_info cfl_hw_codec_info = {
581 .dec_hw_context_init = gen9_dec_hw_context_init,
582 .enc_hw_context_init = gen9_enc_hw_context_init,
583 .proc_hw_context_init = gen75_proc_context_init,
584 .render_init = gen9_render_init,
585 .post_processing_context_init = gen9_post_processing_context_init,
586 .max_resolution = gen9_max_resolution,
587 .preinit_hw_codec = gen9_hw_codec_preinit,
589 .max_width = 4096, /* default. See max_resolution */
590 .max_height = 4096, /* default. See max_resolution */
591 .min_linear_wpitch = 64,
592 .min_linear_hpitch = 16,
594 .h264_mvc_dec_profiles = (VA_PROFILE_MASK(H264StereoHigh) |
595 VA_PROFILE_MASK(H264MultiviewHigh)),
596 .vp9_dec_profiles = VP9_PROFILE_MASK(0) |
598 .vp9_enc_profiles = VP9_PROFILE_MASK(0),
600 .h264_dec_chroma_formats = EXTRA_H264_DEC_CHROMA_FORMATS,
601 .jpeg_dec_chroma_formats = EXTRA_JPEG_DEC_CHROMA_FORMATS,
602 .jpeg_enc_chroma_formats = EXTRA_JPEG_ENC_CHROMA_FORMATS,
603 .hevc_dec_chroma_formats = EXTRA_HEVC_DEC_CHROMA_FORMATS,
604 .vp9_dec_chroma_formats = EXTRA_VP9_DEC_CHROMA_FORMATS,
606 .has_mpeg2_decoding = 1,
607 .has_mpeg2_encoding = 1,
608 .has_h264_decoding = 1,
609 .has_h264_encoding = 1,
610 .has_vc1_decoding = 1,
611 .has_jpeg_decoding = 1,
612 .has_jpeg_encoding = 1,
614 .has_accelerated_getimage = 1,
615 .has_accelerated_putimage = 1,
616 .has_tiled_surface = 1,
617 .has_di_motion_adptive = 1,
618 .has_di_motion_compensated = 1,
619 .has_vp8_decoding = 1,
620 .has_vp8_encoding = 1,
621 .has_h264_mvc_encoding = 1,
622 .has_hevc_decoding = 1,
623 .has_hevc_encoding = 1,
624 .has_hevc10_encoding = 1,
625 .has_hevc10_decoding = 1,
626 .has_vp9_decoding = 1,
628 .has_vp9_encoding = 1,
629 .has_lp_h264_encoding = 1,
631 .lp_h264_brc_mode = VA_RC_CQP,
632 .h264_brc_mode = VA_RC_CQP | VA_RC_CBR | VA_RC_VBR | VA_RC_MB,
636 { VAProcFilterNoiseReduction, I965_RING_VEBOX },
637 { VAProcFilterDeinterlacing, I965_RING_VEBOX },
638 { VAProcFilterSharpening, I965_RING_NULL },
639 { VAProcFilterColorBalance, I965_RING_VEBOX},
640 { VAProcFilterSkinToneEnhancement, I965_RING_VEBOX},
644 static struct hw_codec_info cnl_hw_codec_info = {
645 .dec_hw_context_init = gen9_dec_hw_context_init,
646 .enc_hw_context_init = gen9_enc_hw_context_init,
647 .proc_hw_context_init = gen75_proc_context_init,
648 .render_init = gen9_render_init,
649 .post_processing_context_init = gen9_post_processing_context_init,
650 .max_resolution = gen9_max_resolution,
651 .preinit_hw_codec = gen9_hw_codec_preinit,
653 .max_width = 4096, /* default. See max_resolution */
654 .max_height = 4096, /* default. See max_resolution */
655 .min_linear_wpitch = 64,
656 .min_linear_hpitch = 16,
658 .h264_mvc_dec_profiles = (VA_PROFILE_MASK(H264StereoHigh) | VA_PROFILE_MASK(H264MultiviewHigh)),
659 .vp9_dec_profiles = VP9_PROFILE_MASK(0) | VP9_PROFILE_MASK(2),
660 .vp9_enc_profiles = VP9_PROFILE_MASK(0),
662 .h264_dec_chroma_formats = EXTRA_H264_DEC_CHROMA_FORMATS,
663 .jpeg_dec_chroma_formats = EXTRA_JPEG_DEC_CHROMA_FORMATS,
664 .jpeg_enc_chroma_formats = EXTRA_JPEG_ENC_CHROMA_FORMATS,
665 .hevc_dec_chroma_formats = EXTRA_HEVC_DEC_CHROMA_FORMATS,
666 .vp9_dec_chroma_formats = EXTRA_VP9_DEC_CHROMA_FORMATS,
668 .has_mpeg2_decoding = 1,
669 .has_mpeg2_encoding = 1,
670 .has_h264_decoding = 1,
671 .has_h264_encoding = 1,
672 .has_vc1_decoding = 1,
673 .has_jpeg_decoding = 1,
674 .has_jpeg_encoding = 1,
676 .has_accelerated_getimage = 1,
677 .has_accelerated_putimage = 1,
678 .has_tiled_surface = 1,
679 .has_di_motion_adptive = 1,
680 .has_di_motion_compensated = 1,
681 .has_vp8_decoding = 1,
682 .has_vp8_encoding = 1,
683 .has_h264_mvc_encoding = 1,
684 .has_hevc_decoding = 1,
685 .has_hevc_encoding = 1,
686 .has_hevc10_decoding = 1,
687 .has_hevc10_encoding = 1,
688 .has_vp9_decoding = 1,
690 .has_vp9_encoding = 0,
691 .has_lp_h264_encoding = 1,
693 .lp_h264_brc_mode = VA_RC_CQP,
694 .h264_brc_mode = VA_RC_CQP | VA_RC_CBR | VA_RC_VBR | VA_RC_MB,
698 { VAProcFilterNoiseReduction, I965_RING_VEBOX },
699 { VAProcFilterDeinterlacing, I965_RING_VEBOX },
700 { VAProcFilterSharpening, I965_RING_NULL },
701 { VAProcFilterColorBalance, I965_RING_VEBOX},
702 { VAProcFilterSkinToneEnhancement, I965_RING_VEBOX},
706 struct hw_codec_info *
707 i965_get_codec_info(int devid)
711 #define CHIPSET(id, family, dev, str) case id: return &family##_hw_codec_info;
712 #include "i965_pciids.h"
718 static const struct intel_device_info g4x_device_info = {
722 .max_wm_threads = 50, /* 10 * 5 */
727 static const struct intel_device_info ilk_device_info = {
731 .max_wm_threads = 72, /* 12 * 6 */
734 static const struct intel_device_info snb_gt1_device_info = {
739 .max_wm_threads = 40,
742 static const struct intel_device_info snb_gt2_device_info = {
747 .max_wm_threads = 80,
750 static const struct intel_device_info ivb_gt1_device_info = {
755 .max_wm_threads = 48,
760 static const struct intel_device_info ivb_gt2_device_info = {
765 .max_wm_threads = 172,
770 static const struct intel_device_info byt_device_info = {
775 .max_wm_threads = 48,
781 static const struct intel_device_info hsw_gt1_device_info = {
786 .max_wm_threads = 102,
791 static const struct intel_device_info hsw_gt2_device_info = {
796 .max_wm_threads = 204,
801 static const struct intel_device_info hsw_gt3_device_info = {
806 .max_wm_threads = 408,
811 static const struct intel_device_info bdw_device_info = {
815 .max_wm_threads = 64, /* per PSD */
818 static const struct intel_device_info chv_device_info = {
822 .max_wm_threads = 64, /* per PSD */
827 static const struct intel_device_info skl_device_info = {
831 .max_wm_threads = 64, /* per PSD */
836 static const struct intel_device_info bxt_device_info = {
840 .max_wm_threads = 64, /* per PSD */
844 static const struct intel_device_info kbl_device_info = {
848 .max_wm_threads = 64, /* per PSD */
853 static const struct intel_device_info glk_device_info = {
857 .max_wm_threads = 64, /* per PSD */
862 static const struct intel_device_info cfl_device_info = {
866 .max_wm_threads = 64, /* per PSD */
871 static const struct intel_device_info cnl_device_info = {
875 .max_wm_threads = 64, /* per PSD */
878 const struct intel_device_info *
879 i965_get_device_info(int devid)
883 #define CHIPSET(id, family, dev, str) case id: return &dev##_device_info;
884 #include "i965_pciids.h"
890 static void cpuid(unsigned int op,
891 uint32_t *eax, uint32_t *ebx,
892 uint32_t *ecx, uint32_t *edx)
894 __cpuid_count(op, 0, *eax, *ebx, *ecx, *edx);
898 * This function doesn't check the length. And the caller should
899 * assure that the length of input string should be greater than 48.
901 static int intel_driver_detect_cpustring(char *model_id)
905 if (model_id == NULL)
908 rdata = (uint32_t *)model_id;
910 /* obtain the max supported extended CPUID info */
911 cpuid(0x80000000, &rdata[0], &rdata[1], &rdata[2], &rdata[3]);
913 /* If the max extended CPUID info is less than 0x80000004, fail */
914 if (rdata[0] < 0x80000004)
917 /* obtain the CPUID string */
918 cpuid(0x80000002, &rdata[0], &rdata[1], &rdata[2], &rdata[3]);
919 cpuid(0x80000003, &rdata[4], &rdata[5], &rdata[6], &rdata[7]);
920 cpuid(0x80000004, &rdata[8], &rdata[9], &rdata[10], &rdata[11]);
922 *(model_id + 48) = '\0';
927 * the hook_list for HSW.
928 * It is captured by /proc/cpuinfo and the space character is stripped.
930 const static char *hsw_cpu_hook_list[] = {
931 "Intel(R)Pentium(R)3556U",
932 "Intel(R)Pentium(R)3560Y",
933 "Intel(R)Pentium(R)3550M",
934 "Intel(R)Celeron(R)2980U",
935 "Intel(R)Celeron(R)2955U",
936 "Intel(R)Celeron(R)2950M",
939 static void hsw_hw_codec_preinit(VADriverContextP ctx, struct hw_codec_info *codec_info)
941 char model_string[64];
942 char *model_ptr, *tmp_ptr;
943 int i, model_len, list_len;
946 memset(model_string, 0, sizeof(model_string));
948 /* If it can't detect cpu model_string, leave it alone */
949 if (intel_driver_detect_cpustring(model_string))
952 /* strip the cpufreq info */
953 model_ptr = model_string;
954 tmp_ptr = strstr(model_ptr, "@");
959 /* strip the space character and convert to the lower case */
960 model_ptr = model_string;
961 model_len = strlen(model_string);
962 for (i = 0; i < model_len; i++) {
963 if (model_string[i] != ' ') {
964 *model_ptr = model_string[i];
971 list_len = sizeof(hsw_cpu_hook_list) / sizeof(char *);
972 model_len = strlen(model_string);
973 for (i = 0; i < list_len; i++) {
974 model_ptr = (char *)hsw_cpu_hook_list[i];
976 if (strlen(model_ptr) != model_len)
979 if (strncasecmp(model_string, model_ptr, model_len) == 0) {
986 codec_info->has_h264_encoding = 0;
987 codec_info->has_h264_mvc_encoding = 0;
988 codec_info->has_mpeg2_encoding = 0;
994 * the hook_list for Sandybride.
995 * It is captured by /proc/cpuinfo and the space character is stripped.
997 const static char *gen6_cpu_hook_list[] = {
998 "Intel(R)Celeron(R)CPU847",
999 "Intel(R)Celeron(R)CPU867",
1002 static void gen6_hw_codec_preinit(VADriverContextP ctx, struct hw_codec_info *codec_info)
1004 char model_string[64];
1005 char *model_ptr, *tmp_ptr;
1006 int i, model_len, list_len;
1009 memset(model_string, 0, sizeof(model_string));
1011 /* If it can't detect cpu model_string, leave it alone */
1012 if (intel_driver_detect_cpustring(model_string))
1015 /* strip the cpufreq info */
1016 model_ptr = model_string;
1017 tmp_ptr = strstr(model_ptr, "@");
1022 /* strip the space character and convert to the lower case */
1023 model_ptr = model_string;
1024 model_len = strlen(model_string);
1025 for (i = 0; i < model_len; i++) {
1026 if (model_string[i] != ' ') {
1027 *model_ptr = model_string[i];
1034 list_len = sizeof(gen6_cpu_hook_list) / sizeof(char *);
1035 model_len = strlen(model_string);
1036 for (i = 0; i < list_len; i++) {
1037 model_ptr = (char *)gen6_cpu_hook_list[i];
1039 if (strlen(model_ptr) != model_len)
1042 if (strncasecmp(model_string, model_ptr, model_len) == 0) {
1049 codec_info->has_h264_encoding = 0;
1055 * the hook_list for Ivybridge.
1056 * It is captured by /proc/cpuinfo and the space character is stripped.
1058 const static char *gen7_cpu_hook_list[] = {
1059 "Intel(R)Celeron(R)CPU1007U",
1060 "Intel(R)Celeron(R)CPU1037U",
1061 "Intel(R)Pentium(R)CPUG2130",
1064 static void gen7_hw_codec_preinit(VADriverContextP ctx, struct hw_codec_info *codec_info)
1066 char model_string[64];
1067 char *model_ptr, *tmp_ptr;
1068 int i, model_len, list_len;
1071 memset(model_string, 0, sizeof(model_string));
1073 /* If it can't detect cpu model_string, leave it alone */
1074 if (intel_driver_detect_cpustring(model_string))
1077 /* strip the cpufreq info */
1078 model_ptr = model_string;
1079 tmp_ptr = strstr(model_ptr, "@");
1084 /* strip the space character and convert to the lower case */
1085 model_ptr = model_string;
1086 model_len = strlen(model_string);
1087 for (i = 0; i < model_len; i++) {
1088 if (model_string[i] != ' ') {
1089 *model_ptr = model_string[i];
1096 list_len = sizeof(gen7_cpu_hook_list) / sizeof(char *);
1097 model_len = strlen(model_string);
1098 for (i = 0; i < list_len; i++) {
1099 model_ptr = (char *)gen7_cpu_hook_list[i];
1101 if (strlen(model_ptr) != model_len)
1104 if (strncasecmp(model_string, model_ptr, model_len) == 0) {
1111 codec_info->has_h264_encoding = 0;
1112 codec_info->has_mpeg2_encoding = 0;
1117 static void gen9_hw_codec_preinit(VADriverContextP ctx, struct hw_codec_info *codec_info)
1119 struct i965_driver_data *i965 = i965_driver_data(ctx);
1121 if (i965->intel.has_huc && codec_info->has_lp_h264_encoding)
1122 codec_info->lp_h264_brc_mode |= (VA_RC_CBR | VA_RC_VBR);