| 1 |
/* |
| 2 |
* Copyright (c) 2018-2023, 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 "Software"), |
| 6 |
* to deal in the Software without restriction, including without limitation |
| 7 |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 8 |
* and/or sell copies of the Software, and to permit persons to whom the |
| 9 |
* Software is furnished to do so, subject to the following conditions: |
| 10 |
* |
| 11 |
* The above copyright notice and this permission notice shall be included |
| 12 |
* in all copies or substantial portions of the Software. |
| 13 |
* |
| 14 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 15 |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 16 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 17 |
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR |
| 18 |
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
| 19 |
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 20 |
* OTHER DEALINGS IN THE SOFTWARE. |
| 21 |
*/ |
| 22 |
|
| 23 |
//! |
| 24 |
//! \file media_libva_caps_g12.cpp |
| 25 |
//! \brief This file implements the C++ class/interface for gen12 media capbilities. |
| 26 |
//! |
| 27 |
|
| 28 |
#include "codec_def_encode_hevc_g12.h" |
| 29 |
#include "media_libva_util.h" |
| 30 |
#include "media_libva.h" |
| 31 |
#include "media_libva_vp.h" |
| 32 |
#include "media_libva_caps_cp_interface.h" |
| 33 |
#include "media_libva_caps_g12.h" |
| 34 |
#include "media_libva_caps_factory.h" |
| 35 |
#include "media_ddi_decode_const.h" |
| 36 |
#include "media_ddi_encode_const.h" |
| 37 |
#include "media_ddi_decode_const_g12.h" |
| 38 |
#include "mos_bufmgr_priv.h" |
| 39 |
#include "drm_fourcc.h" |
| 40 |
|
| 41 |
|
| 42 |
#ifndef VA_CENC_TYPE_NONE |
| 43 |
#define VA_CENC_TYPE_NONE 0x00000000 |
| 44 |
#endif |
| 45 |
|
| 46 |
#ifndef VA_ENCRYPTION_TYPE_NONE |
| 47 |
#define VA_ENCRYPTION_TYPE_NONE 0x00000000 |
| 48 |
#endif |
| 49 |
|
| 50 |
const VAImageFormat m_supportedImageformatsG12[] = |
| 51 |
{ |
| 52 |
// "VA_LSB_FIRST" is to identify how following bit masks mapped to address instead of char order in VA_FOURCC_RGBA naming. |
| 53 |
{VA_FOURCC_BGRA, VA_LSB_FIRST, 32, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000}, /* [31:0] A:R:G:B 8:8:8:8 little endian */ |
| 54 |
{VA_FOURCC_RGBA, VA_LSB_FIRST, 32, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000}, /* [31:0] A:B:G:R 8:8:8:8 little endian */ |
| 55 |
{VA_FOURCC_BGRX, VA_LSB_FIRST, 32, 24, 0x00ff0000, 0x0000ff00, 0x000000ff, 0}, /* [31:0] X:R:G:B 8:8:8:8 little endian */ |
| 56 |
{VA_FOURCC_RGBX, VA_LSB_FIRST, 32, 24, 0x000000ff, 0x0000ff00, 0x00ff0000, 0}, /* [31:0] X:B:G:R 8:8:8:8 little endian */ |
| 57 |
{VA_FOURCC_A2R10G10B10, VA_LSB_FIRST, 32, 30, 0x3ff00000, 0x000ffc00, 0x000003ff, 0x30000000}, /* [31:0] A:R:G:B 2:10:10:10 little endian */ |
| 58 |
{VA_FOURCC_A2B10G10R10, VA_LSB_FIRST, 32, 30, 0x000003ff, 0x000ffc00, 0x3ff00000, 0x30000000}, /* [31:0] A:B:G:R 2:10:10:10 little endian */ |
| 59 |
{VA_FOURCC_X2R10G10B10, VA_LSB_FIRST, 32, 30, 0x3ff00000, 0x000ffc00, 0x000003ff, 0}, /* [31:0] X:R:G:B 2:10:10:10 little endian */ |
| 60 |
{VA_FOURCC_X2B10G10R10, VA_LSB_FIRST, 32, 30, 0x000003ff, 0x000ffc00, 0x3ff00000, 0}, /* [31:0] X:B:G:R 2:10:10:10 little endian */ |
| 61 |
{VA_FOURCC_RGB565, VA_LSB_FIRST, 16, 16, 0xf800, 0x07e0, 0x001f, 0}, /* [15:0] R:G:B 5:6:5 little endian */ |
| 62 |
{VA_FOURCC_AYUV, VA_LSB_FIRST, 32, 0,0,0,0,0}, |
| 63 |
#if VA_CHECK_VERSION(1, 13, 0) |
| 64 |
{VA_FOURCC_XYUV, VA_LSB_FIRST, 32, 0,0,0,0,0}, |
| 65 |
#endif |
| 66 |
{VA_FOURCC_Y800, VA_LSB_FIRST, 8, 0,0,0,0,0}, |
| 67 |
{VA_FOURCC_NV12, VA_LSB_FIRST, 12, 0,0,0,0,0}, |
| 68 |
{VA_FOURCC_NV21, VA_LSB_FIRST, 12, 0,0,0,0,0}, |
| 69 |
{VA_FOURCC_YUY2, VA_LSB_FIRST, 16, 0,0,0,0,0}, |
| 70 |
{VA_FOURCC_UYVY, VA_LSB_FIRST, 16, 0,0,0,0,0}, |
| 71 |
{VA_FOURCC_YV12, VA_LSB_FIRST, 12, 0,0,0,0,0}, |
| 72 |
{VA_FOURCC_I420, VA_LSB_FIRST, 12, 0,0,0,0,0}, |
| 73 |
{VA_FOURCC_411P, VA_LSB_FIRST, 12, 0,0,0,0,0}, |
| 74 |
{VA_FOURCC_422H, VA_LSB_FIRST, 16, 0,0,0,0,0}, |
| 75 |
{VA_FOURCC_422V, VA_LSB_FIRST, 16, 0,0,0,0,0}, |
| 76 |
{VA_FOURCC_444P, VA_LSB_FIRST, 24, 0,0,0,0,0}, |
| 77 |
{VA_FOURCC_IMC3, VA_LSB_FIRST, 16, 0,0,0,0,0}, |
| 78 |
{VA_FOURCC_P010, VA_LSB_FIRST, 24, 0,0,0,0,0}, |
| 79 |
{VA_FOURCC_P012, VA_LSB_FIRST, 24, 0,0,0,0,0}, |
| 80 |
{VA_FOURCC_P016, VA_LSB_FIRST, 24, 0,0,0,0,0}, |
| 81 |
{VA_FOURCC_Y210, VA_LSB_FIRST, 32, 0,0,0,0,0}, |
| 82 |
#if VA_CHECK_VERSION(1, 9, 0) |
| 83 |
{VA_FOURCC_Y212, VA_LSB_FIRST, 32, 0,0,0,0,0}, |
| 84 |
#endif |
| 85 |
{VA_FOURCC_Y216, VA_LSB_FIRST, 32, 0,0,0,0,0}, |
| 86 |
{VA_FOURCC_Y410, VA_LSB_FIRST, 32, 0,0,0,0,0}, |
| 87 |
#if VA_CHECK_VERSION(1, 9, 0) |
| 88 |
{VA_FOURCC_Y412, VA_LSB_FIRST, 64, 0,0,0,0,0}, |
| 89 |
#endif |
| 90 |
{VA_FOURCC_Y416, VA_LSB_FIRST, 64, 0,0,0,0,0}, |
| 91 |
{VA_FOURCC_RGBP, VA_LSB_FIRST, 24, 24,0,0,0,0}, |
| 92 |
{VA_FOURCC_BGRP, VA_LSB_FIRST, 24, 24,0,0,0,0}, |
| 93 |
}; |
| 94 |
|
| 95 |
const VAConfigAttribValEncRateControlExt MediaLibvaCapsG12::m_encVp9RateControlExt = |
| 96 |
{ |
| 97 |
{CODECHAL_ENCODE_VP9_MAX_NUM_TEMPORAL_LAYERS - 1, 1, 0} |
| 98 |
}; |
| 99 |
|
| 100 |
VAStatus MediaLibvaCapsG12::QueryImageFormats(VAImageFormat *formatList, int32_t *numFormats) |
| 101 |
{ |
| 102 |
DDI_CHK_NULL(formatList, "Null pointer", VA_STATUS_ERROR_INVALID_PARAMETER); |
| 103 |
DDI_CHK_NULL(numFormats, "Null pointer", VA_STATUS_ERROR_INVALID_PARAMETER); |
| 104 |
int32_t num = 0; |
| 105 |
uint32_t maxNum = GetImageFormatsMaxNum(); |
| 106 |
|
| 107 |
memset(formatList, 0, sizeof(m_supportedImageformatsG12)); |
| 108 |
for (uint32_t idx = 0; idx < maxNum; idx++) |
| 109 |
{ |
| 110 |
formatList[num].fourcc = m_supportedImageformatsG12[idx].fourcc; |
| 111 |
formatList[num].byte_order = m_supportedImageformatsG12[idx].byte_order; |
| 112 |
formatList[num].bits_per_pixel = m_supportedImageformatsG12[idx].bits_per_pixel; |
| 113 |
formatList[num].depth = m_supportedImageformatsG12[idx].depth; |
| 114 |
formatList[num].red_mask = m_supportedImageformatsG12[idx].red_mask; |
| 115 |
formatList[num].green_mask = m_supportedImageformatsG12[idx].green_mask; |
| 116 |
formatList[num].blue_mask = m_supportedImageformatsG12[idx].blue_mask; |
| 117 |
formatList[num].alpha_mask = m_supportedImageformatsG12[idx].alpha_mask; |
| 118 |
num++; |
| 119 |
} |
| 120 |
*numFormats = num; |
| 121 |
|
| 122 |
return VA_STATUS_SUCCESS; |
| 123 |
} |
| 124 |
|
| 125 |
uint32_t MediaLibvaCapsG12::GetImageFormatsMaxNum() |
| 126 |
{ |
| 127 |
return sizeof(m_supportedImageformatsG12)/sizeof(m_supportedImageformatsG12[0]); |
| 128 |
} |
| 129 |
|
| 130 |
bool MediaLibvaCapsG12::IsImageSupported(uint32_t fourcc) |
| 131 |
{ |
| 132 |
uint32_t maxNum = GetImageFormatsMaxNum(); |
| 133 |
for (int32_t idx = 0; idx < maxNum; idx++) |
| 134 |
{ |
| 135 |
if (m_supportedImageformatsG12[idx].fourcc == fourcc) |
| 136 |
{ |
| 137 |
return true; |
| 138 |
} |
| 139 |
} |
| 140 |
|
| 141 |
return false; |
| 142 |
} |
| 143 |
|
| 144 |
VAStatus MediaLibvaCapsG12::PopulateColorMaskInfo(VAImageFormat *vaImgFmt) |
| 145 |
{ |
| 146 |
uint32_t maxNum = GetImageFormatsMaxNum(); |
| 147 |
|
| 148 |
DDI_CHK_NULL(vaImgFmt, "Null pointer", VA_STATUS_ERROR_INVALID_PARAMETER); |
| 149 |
|
| 150 |
for (int32_t idx = 0; idx < maxNum; idx++) |
| 151 |
{ |
| 152 |
if (m_supportedImageformatsG12[idx].fourcc == vaImgFmt->fourcc) |
| 153 |
{ |
| 154 |
vaImgFmt->red_mask = m_supportedImageformatsG12[idx].red_mask; |
| 155 |
vaImgFmt->green_mask = m_supportedImageformatsG12[idx].green_mask; |
| 156 |
vaImgFmt->blue_mask = m_supportedImageformatsG12[idx].blue_mask; |
| 157 |
vaImgFmt->alpha_mask = m_supportedImageformatsG12[idx].alpha_mask; |
| 158 |
|
| 159 |
return VA_STATUS_SUCCESS; |
| 160 |
} |
| 161 |
} |
| 162 |
|
| 163 |
return VA_STATUS_ERROR_INVALID_IMAGE_FORMAT; |
| 164 |
} |
| 165 |
|
| 166 |
CODECHAL_MODE MediaLibvaCapsG12::GetEncodeCodecMode(VAProfile profile, VAEntrypoint entrypoint) |
| 167 |
{ |
| 168 |
if (entrypoint == VAEntrypointStats) |
| 169 |
{ |
| 170 |
return CODECHAL_ENCODE_MODE_AVC; |
| 171 |
} |
| 172 |
|
| 173 |
switch (profile) |
| 174 |
{ |
| 175 |
case VAProfileH264High: |
| 176 |
case VAProfileH264Main: |
| 177 |
case VAProfileH264ConstrainedBaseline: |
| 178 |
return CODECHAL_ENCODE_MODE_AVC; |
| 179 |
case VAProfileMPEG2Main: |
| 180 |
case VAProfileMPEG2Simple: |
| 181 |
return CODECHAL_ENCODE_MODE_MPEG2; |
| 182 |
case VAProfileJPEGBaseline: |
| 183 |
return CODECHAL_ENCODE_MODE_JPEG; |
| 184 |
case VAProfileVP8Version0_3: |
| 185 |
return CODECHAL_ENCODE_MODE_VP8; |
| 186 |
case VAProfileVP9Profile0: |
| 187 |
case VAProfileVP9Profile1: |
| 188 |
case VAProfileVP9Profile2: |
| 189 |
case VAProfileVP9Profile3: |
| 190 |
return CODECHAL_ENCODE_MODE_VP9; |
| 191 |
case VAProfileHEVCMain: |
| 192 |
case VAProfileHEVCMain10: |
| 193 |
case VAProfileHEVCMain12: |
| 194 |
case VAProfileHEVCMain422_10: |
| 195 |
case VAProfileHEVCMain422_12: |
| 196 |
case VAProfileHEVCMain444: |
| 197 |
case VAProfileHEVCMain444_10: |
| 198 |
case VAProfileHEVCSccMain: |
| 199 |
case VAProfileHEVCSccMain10: |
| 200 |
case VAProfileHEVCSccMain444: |
| 201 |
case VAProfileHEVCSccMain444_10: |
| 202 |
return CODECHAL_ENCODE_MODE_HEVC; |
| 203 |
default: |
| 204 |
DDI_ASSERTMESSAGE("Invalid Encode Mode"); |
| 205 |
return CODECHAL_UNSUPPORTED_MODE; |
| 206 |
} |
| 207 |
} |
| 208 |
|
| 209 |
CODECHAL_MODE MediaLibvaCapsG12::GetDecodeCodecMode(VAProfile profile) |
| 210 |
{ |
| 211 |
int8_t vaProfile = (int8_t)profile; |
| 212 |
switch (vaProfile) |
| 213 |
{ |
| 214 |
case VAProfileH264High: |
| 215 |
case VAProfileH264Main: |
| 216 |
case VAProfileH264ConstrainedBaseline: |
| 217 |
return CODECHAL_DECODE_MODE_AVCVLD; |
| 218 |
case VAProfileMPEG2Main: |
| 219 |
case VAProfileMPEG2Simple: |
| 220 |
return CODECHAL_DECODE_MODE_MPEG2VLD; |
| 221 |
case VAProfileJPEGBaseline: |
| 222 |
return CODECHAL_DECODE_MODE_JPEG; |
| 223 |
case VAProfileVP8Version0_3: |
| 224 |
return CODECHAL_DECODE_MODE_VP8VLD; |
| 225 |
case VAProfileVP9Profile0: |
| 226 |
case VAProfileVP9Profile1: |
| 227 |
case VAProfileVP9Profile2: |
| 228 |
case VAProfileVP9Profile3: |
| 229 |
return CODECHAL_DECODE_MODE_VP9VLD; |
| 230 |
case VAProfileHEVCMain: |
| 231 |
case VAProfileHEVCMain10: |
| 232 |
case VAProfileHEVCMain12: |
| 233 |
case VAProfileHEVCMain422_10: |
| 234 |
case VAProfileHEVCMain422_12: |
| 235 |
case VAProfileHEVCMain444: |
| 236 |
case VAProfileHEVCMain444_10: |
| 237 |
case VAProfileHEVCMain444_12: |
| 238 |
case VAProfileHEVCSccMain: |
| 239 |
case VAProfileHEVCSccMain10: |
| 240 |
case VAProfileHEVCSccMain444: |
| 241 |
case VAProfileHEVCSccMain444_10: |
| 242 |
return CODECHAL_DECODE_MODE_HEVCVLD; |
| 243 |
case VAProfileVC1Simple: |
| 244 |
case VAProfileVC1Main: |
| 245 |
case VAProfileVC1Advanced: |
| 246 |
return CODECHAL_DECODE_MODE_VC1VLD; |
| 247 |
case VAProfileAV1Profile0: |
| 248 |
case VAProfileAV1Profile1: |
| 249 |
return CODECHAL_DECODE_MODE_AV1VLD; |
| 250 |
default: |
| 251 |
DDI_ASSERTMESSAGE("Invalid Decode Mode"); |
| 252 |
return CODECHAL_UNSUPPORTED_MODE; |
| 253 |
} |
| 254 |
} |
| 255 |
|
| 256 |
std::string MediaLibvaCapsG12::GetDecodeCodecKey(VAProfile profile) |
| 257 |
{ |
| 258 |
int8_t vaProfile = (int8_t)profile; |
| 259 |
switch (vaProfile) |
| 260 |
{ |
| 261 |
case VAProfileH264High: |
| 262 |
case VAProfileH264Main: |
| 263 |
case VAProfileH264ConstrainedBaseline: |
| 264 |
return DECODE_ID_AVC; |
| 265 |
case VAProfileMPEG2Main: |
| 266 |
case VAProfileMPEG2Simple: |
| 267 |
return DECODE_ID_MPEG2; |
| 268 |
case VAProfileJPEGBaseline: |
| 269 |
return DECODE_ID_JPEG; |
| 270 |
case VAProfileVP8Version0_3: |
| 271 |
return DECODE_ID_VP8; |
| 272 |
case VAProfileVP9Profile0: |
| 273 |
case VAProfileVP9Profile1: |
| 274 |
case VAProfileVP9Profile2: |
| 275 |
case VAProfileVP9Profile3: |
| 276 |
return DECODE_ID_VP9; |
| 277 |
case VAProfileHEVCMain: |
| 278 |
case VAProfileHEVCMain10: |
| 279 |
case VAProfileHEVCMain12: |
| 280 |
case VAProfileHEVCMain422_10: |
| 281 |
case VAProfileHEVCMain422_12: |
| 282 |
case VAProfileHEVCMain444: |
| 283 |
case VAProfileHEVCMain444_10: |
| 284 |
case VAProfileHEVCMain444_12: |
| 285 |
case VAProfileHEVCSccMain: |
| 286 |
case VAProfileHEVCSccMain10: |
| 287 |
case VAProfileHEVCSccMain444: |
| 288 |
case VAProfileHEVCSccMain444_10: |
| 289 |
return DECODE_ID_HEVC_REXT; |
| 290 |
case VAProfileVC1Simple: |
| 291 |
case VAProfileVC1Main: |
| 292 |
case VAProfileVC1Advanced: |
| 293 |
return DECODE_ID_VC1; |
| 294 |
case VAProfileAV1Profile0: |
| 295 |
case VAProfileAV1Profile1: |
| 296 |
return DECODE_ID_AV1; |
| 297 |
default: |
| 298 |
DDI_ASSERTMESSAGE("Invalid Decode Mode"); |
| 299 |
return DECODE_ID_NONE; |
| 300 |
} |
| 301 |
} |
| 302 |
|
| 303 |
std::string MediaLibvaCapsG12::GetEncodeCodecKey(VAProfile profile, VAEntrypoint entrypoint, uint32_t feiFunction) |
| 304 |
{ |
| 305 |
switch (profile) |
| 306 |
{ |
| 307 |
case VAProfileH264High: |
| 308 |
case VAProfileH264Main: |
| 309 |
case VAProfileH264ConstrainedBaseline: |
| 310 |
if (IsEncFei(entrypoint, feiFunction)) |
| 311 |
return ENCODE_ID_AVCFEI; |
| 312 |
else |
| 313 |
return ENCODE_ID_AVC; |
| 314 |
case VAProfileMPEG2Main: |
| 315 |
case VAProfileMPEG2Simple: |
| 316 |
return ENCODE_ID_MPEG2; |
| 317 |
case VAProfileJPEGBaseline: |
| 318 |
return ENCODE_ID_JPEG; |
| 319 |
case VAProfileVP8Version0_3: |
| 320 |
return ENCODE_ID_VP8; |
| 321 |
case VAProfileVP9Profile0: |
| 322 |
case VAProfileVP9Profile1: |
| 323 |
case VAProfileVP9Profile2: |
| 324 |
case VAProfileVP9Profile3: |
| 325 |
return ENCODE_ID_VP9; |
| 326 |
case VAProfileHEVCMain: |
| 327 |
case VAProfileHEVCMain10: |
| 328 |
case VAProfileHEVCMain12: |
| 329 |
case VAProfileHEVCMain422_10: |
| 330 |
case VAProfileHEVCMain422_12: |
| 331 |
case VAProfileHEVCMain444: |
| 332 |
case VAProfileHEVCMain444_10: |
| 333 |
case VAProfileHEVCSccMain: |
| 334 |
case VAProfileHEVCSccMain10: |
| 335 |
case VAProfileHEVCSccMain444: |
| 336 |
case VAProfileHEVCSccMain444_10: |
| 337 |
if (IsEncFei(entrypoint, feiFunction)) |
| 338 |
return ENCODE_ID_HEVCFEI; |
| 339 |
else |
| 340 |
return ENCODE_ID_HEVC; |
| 341 |
case VAProfileNone: |
| 342 |
if (IsEncFei(entrypoint, feiFunction)) |
| 343 |
return ENCODE_ID_AVCFEI; |
| 344 |
else |
| 345 |
return ENCODE_ID_NONE; |
| 346 |
default: |
| 347 |
return ENCODE_ID_NONE; |
| 348 |
} |
| 349 |
} |
| 350 |
|
| 351 |
bool MediaLibvaCapsG12::IsAV1Profile(VAProfile profile) |
| 352 |
{ |
| 353 |
return (profile == (VAProfile)VAProfileAV1Profile0 || |
| 354 |
profile == (VAProfile)VAProfileAV1Profile1); |
| 355 |
} |
| 356 |
|
| 357 |
VAStatus MediaLibvaCapsG12::GetPlatformSpecificAttrib(VAProfile profile, |
| 358 |
VAEntrypoint entrypoint, |
| 359 |
VAConfigAttribType type, |
| 360 |
uint32_t *value) |
| 361 |
{ |
| 362 |
DDI_CHK_NULL(value, "Null pointer", VA_STATUS_ERROR_INVALID_PARAMETER); |
| 363 |
VAStatus status = VA_STATUS_SUCCESS; |
| 364 |
*value = VA_ATTRIB_NOT_SUPPORTED; |
| 365 |
switch ((int)type) |
| 366 |
{ |
| 367 |
case VAConfigAttribEncMaxRefFrames: |
| 368 |
{ |
| 369 |
// just VAConfigAttribEncMaxRefFrames of HEVC VME is different with platforms |
| 370 |
if (entrypoint == VAEntrypointEncSlice && IsHevcProfile(profile)) |
| 371 |
{ |
| 372 |
*value = ENCODE_DP_HEVC_NUM_MAX_VME_L0_REF_G12 | (ENCODE_DP_HEVC_NUM_MAX_VME_L1_REF_G12 << 16); |
| 373 |
} |
| 374 |
else |
| 375 |
{ |
| 376 |
status = VA_STATUS_ERROR_INVALID_PARAMETER; |
| 377 |
} |
| 378 |
break; |
| 379 |
} |
| 380 |
case VAConfigAttribDecProcessing: |
| 381 |
{ |
| 382 |
#ifdef _DECODE_PROCESSING_SUPPORTED |
| 383 |
if ((IsAvcProfile(profile) || IsHevcProfile(profile) || IsJpegProfile(profile) || IsVp9Profile(profile)) |
| 384 |
&& !(MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrDisableVDBox2SFC))) |
| 385 |
{ |
| 386 |
*value = VA_DEC_PROCESSING; |
| 387 |
} |
| 388 |
else |
| 389 |
#endif |
| 390 |
{ |
| 391 |
*value = VA_DEC_PROCESSING_NONE; |
| 392 |
} |
| 393 |
break; |
| 394 |
} |
| 395 |
case VAConfigAttribEncIntraRefresh: |
| 396 |
{ |
| 397 |
if(IsAvcProfile(profile) || (entrypoint == VAEntrypointEncSliceLP && IsHevcProfile(profile))) |
| 398 |
{ |
| 399 |
*value = VA_ENC_INTRA_REFRESH_ROLLING_COLUMN | VA_ENC_INTRA_REFRESH_ROLLING_ROW; |
| 400 |
} |
| 401 |
else |
| 402 |
{ |
| 403 |
*value = VA_ENC_INTRA_REFRESH_NONE; |
| 404 |
} |
| 405 |
break; |
| 406 |
} |
| 407 |
case VAConfigAttribEncROI: |
| 408 |
{ |
| 409 |
if (entrypoint == VAEntrypointEncSliceLP) |
| 410 |
{ |
| 411 |
status = VA_STATUS_ERROR_INVALID_PARAMETER; |
| 412 |
} |
| 413 |
else if (IsAvcProfile(profile)) |
| 414 |
{ |
| 415 |
VAConfigAttribValEncROI roi_attrib = {0}; |
| 416 |
roi_attrib.bits.num_roi_regions = ENCODE_DP_AVC_MAX_ROI_NUM_BRC; |
| 417 |
roi_attrib.bits.roi_rc_priority_support = 1; |
| 418 |
roi_attrib.bits.roi_rc_qp_delta_support = 1; |
| 419 |
*value = roi_attrib.value; |
| 420 |
} |
| 421 |
else if (IsHevcProfile(profile)) |
| 422 |
{ |
| 423 |
VAConfigAttribValEncROI roi_attrib = {0}; |
| 424 |
roi_attrib.bits.num_roi_regions = CODECHAL_ENCODE_HEVC_MAX_NUM_ROI; |
| 425 |
roi_attrib.bits.roi_rc_priority_support = 0; |
| 426 |
roi_attrib.bits.roi_rc_qp_delta_support = 1; |
| 427 |
*value = roi_attrib.value; |
| 428 |
} |
| 429 |
break; |
| 430 |
} |
| 431 |
case VAConfigAttribCustomRoundingControl: |
| 432 |
{ |
| 433 |
*value = 1; |
| 434 |
break; |
| 435 |
} |
| 436 |
case VAConfigAttribEncMaxSlices: |
| 437 |
{ |
| 438 |
if (entrypoint == VAEntrypointEncSlice && IsHevcProfile(profile)) |
| 439 |
{ |
| 440 |
*value = CODECHAL_HEVC_MAX_NUM_SLICES_LVL_6; |
| 441 |
} |
| 442 |
else |
| 443 |
{ |
| 444 |
*value =0; |
| 445 |
status = VA_STATUS_ERROR_INVALID_PARAMETER; |
| 446 |
} |
| 447 |
break; |
| 448 |
} |
| 449 |
case VAConfigAttribMaxPictureWidth: |
| 450 |
{ |
| 451 |
if(profile == VAProfileJPEGBaseline) |
| 452 |
{ |
| 453 |
*value = ENCODE_JPEG_MAX_PIC_WIDTH; |
| 454 |
} |
| 455 |
else if(IsHevcProfile(profile)) |
| 456 |
{ |
| 457 |
*value = CODEC_16K_MAX_PIC_WIDTH; |
| 458 |
} |
| 459 |
else if(IsVp9Profile(profile)) |
| 460 |
{ |
| 461 |
*value = CODEC_8K_MAX_PIC_WIDTH; |
| 462 |
} |
| 463 |
else if(IsAvcProfile(profile)) |
| 464 |
{ |
| 465 |
*value = CODEC_4K_MAX_PIC_WIDTH; |
| 466 |
} |
| 467 |
else if(IsMpeg2Profile(profile)) |
| 468 |
{ |
| 469 |
*value = CODEC_2K_MAX_PIC_WIDTH; |
| 470 |
} |
| 471 |
else |
| 472 |
{ |
| 473 |
*value = CODEC_MAX_PIC_WIDTH; |
| 474 |
} |
| 475 |
break; |
| 476 |
} |
| 477 |
case VAConfigAttribMaxPictureHeight: |
| 478 |
{ |
| 479 |
if(profile == VAProfileJPEGBaseline) |
| 480 |
{ |
| 481 |
*value = ENCODE_JPEG_MAX_PIC_HEIGHT; |
| 482 |
} |
| 483 |
else if(IsHevcProfile(profile)) |
| 484 |
{ |
| 485 |
*value = CODEC_12K_MAX_PIC_HEIGHT; |
| 486 |
} |
| 487 |
else if(IsVp9Profile(profile)) |
| 488 |
{ |
| 489 |
*value = CODEC_8K_MAX_PIC_HEIGHT; |
| 490 |
} |
| 491 |
else if(IsAvcProfile(profile)) |
| 492 |
{ |
| 493 |
*value = CODEC_4K_MAX_PIC_HEIGHT; |
| 494 |
} |
| 495 |
else if(IsMpeg2Profile(profile)) |
| 496 |
{ |
| 497 |
*value = CODEC_2K_MAX_PIC_HEIGHT; |
| 498 |
} |
| 499 |
else |
| 500 |
{ |
| 501 |
*value = CODEC_MAX_PIC_HEIGHT; |
| 502 |
} |
| 503 |
break; |
| 504 |
} |
| 505 |
case VAConfigAttribQPBlockSize: |
| 506 |
{ |
| 507 |
if(IsAvcProfile(profile)) |
| 508 |
{ |
| 509 |
*value = CODECHAL_MACROBLOCK_WIDTH; |
| 510 |
} |
| 511 |
else |
| 512 |
{ |
| 513 |
status = VA_STATUS_ERROR_INVALID_PARAMETER; |
| 514 |
} |
| 515 |
break; |
| 516 |
} |
| 517 |
case VAConfigAttribPredictionDirection: |
| 518 |
{ |
| 519 |
if (!IsHevcSccProfile(profile)) |
| 520 |
{ |
| 521 |
*value = VA_PREDICTION_DIRECTION_PREVIOUS | VA_PREDICTION_DIRECTION_FUTURE | VA_PREDICTION_DIRECTION_BI_NOT_EMPTY; |
| 522 |
} |
| 523 |
else |
| 524 |
{ |
| 525 |
// Here we set |
| 526 |
// VAConfigAttribPredictionDirection: VA_PREDICTION_DIRECTION_PREVIOUS | VA_PREDICTION_DIRECTION_BI_NOT_EMPTY together with |
| 527 |
// VAConfigAttribEncMaxRefFrames: L0 != 0, L1 !=0 |
| 528 |
// to indicate SCC only supports I/low delay B |
| 529 |
*value = VA_PREDICTION_DIRECTION_PREVIOUS | VA_PREDICTION_DIRECTION_BI_NOT_EMPTY; |
| 530 |
} |
| 531 |
break; |
| 532 |
} |
| 533 |
#if VA_CHECK_VERSION(1, 12, 0) |
| 534 |
case VAConfigAttribEncHEVCFeatures: |
| 535 |
{ |
| 536 |
if ((entrypoint == VAEntrypointEncSlice || entrypoint == VAEntrypointEncSliceLP) && IsHevcProfile(profile)) |
| 537 |
{ |
| 538 |
VAConfigAttribValEncHEVCFeatures hevcFeatures = {0}; |
| 539 |
hevcFeatures.bits.separate_colour_planes = VA_FEATURE_NOT_SUPPORTED; |
| 540 |
hevcFeatures.bits.scaling_lists = VA_FEATURE_SUPPORTED; |
| 541 |
hevcFeatures.bits.amp = VA_FEATURE_REQUIRED; |
| 542 |
hevcFeatures.bits.sao = VA_FEATURE_SUPPORTED; |
| 543 |
hevcFeatures.bits.pcm = VA_FEATURE_NOT_SUPPORTED; |
| 544 |
hevcFeatures.bits.temporal_mvp = VA_FEATURE_SUPPORTED; |
| 545 |
hevcFeatures.bits.strong_intra_smoothing = VA_FEATURE_NOT_SUPPORTED; |
| 546 |
hevcFeatures.bits.dependent_slices = VA_FEATURE_NOT_SUPPORTED; |
| 547 |
hevcFeatures.bits.sign_data_hiding = VA_FEATURE_NOT_SUPPORTED; |
| 548 |
hevcFeatures.bits.constrained_intra_pred = VA_FEATURE_NOT_SUPPORTED; |
| 549 |
hevcFeatures.bits.transform_skip = VA_FEATURE_SUPPORTED; |
| 550 |
hevcFeatures.bits.cu_qp_delta = VA_FEATURE_REQUIRED; |
| 551 |
hevcFeatures.bits.weighted_prediction = VA_FEATURE_SUPPORTED; |
| 552 |
hevcFeatures.bits.transquant_bypass = VA_FEATURE_NOT_SUPPORTED; |
| 553 |
hevcFeatures.bits.deblocking_filter_disable = VA_FEATURE_NOT_SUPPORTED; |
| 554 |
*value = hevcFeatures.value; |
| 555 |
} |
| 556 |
break; |
| 557 |
} |
| 558 |
case VAConfigAttribEncHEVCBlockSizes: |
| 559 |
{ |
| 560 |
if (entrypoint == VAEntrypointEncSlice && IsHevcProfile(profile)) |
| 561 |
{ |
| 562 |
VAConfigAttribValEncHEVCBlockSizes hevcBlockSize = {0}; |
| 563 |
hevcBlockSize.bits.log2_max_coding_tree_block_size_minus3 = 3; |
| 564 |
hevcBlockSize.bits.log2_min_coding_tree_block_size_minus3 = 1; |
| 565 |
hevcBlockSize.bits.log2_min_luma_coding_block_size_minus3 = 0; |
| 566 |
hevcBlockSize.bits.log2_max_luma_transform_block_size_minus2 = 3; |
| 567 |
hevcBlockSize.bits.log2_min_luma_transform_block_size_minus2 = 0; |
| 568 |
hevcBlockSize.bits.max_max_transform_hierarchy_depth_inter = 2; |
| 569 |
hevcBlockSize.bits.min_max_transform_hierarchy_depth_inter = 0; |
| 570 |
hevcBlockSize.bits.max_max_transform_hierarchy_depth_intra = 2; |
| 571 |
hevcBlockSize.bits.min_max_transform_hierarchy_depth_intra = 0; |
| 572 |
hevcBlockSize.bits.log2_max_pcm_coding_block_size_minus3 = 0; |
| 573 |
hevcBlockSize.bits.log2_min_pcm_coding_block_size_minus3 = 0; |
| 574 |
*value = hevcBlockSize.value; |
| 575 |
} |
| 576 |
if (entrypoint == VAEntrypointEncSliceLP && IsHevcProfile(profile)) |
| 577 |
{ |
| 578 |
VAConfigAttribValEncHEVCBlockSizes hevcBlockSize = {0}; |
| 579 |
hevcBlockSize.bits.log2_max_coding_tree_block_size_minus3 = 3; |
| 580 |
hevcBlockSize.bits.log2_min_coding_tree_block_size_minus3 = 3; |
| 581 |
hevcBlockSize.bits.log2_min_luma_coding_block_size_minus3 = 0; |
| 582 |
hevcBlockSize.bits.log2_max_luma_transform_block_size_minus2 = 3; |
| 583 |
hevcBlockSize.bits.log2_min_luma_transform_block_size_minus2 = 0; |
| 584 |
hevcBlockSize.bits.max_max_transform_hierarchy_depth_inter = 2; |
| 585 |
hevcBlockSize.bits.min_max_transform_hierarchy_depth_inter = 0; |
| 586 |
hevcBlockSize.bits.max_max_transform_hierarchy_depth_intra = 2; |
| 587 |
hevcBlockSize.bits.min_max_transform_hierarchy_depth_intra = 0; |
| 588 |
hevcBlockSize.bits.log2_max_pcm_coding_block_size_minus3 = 0; |
| 589 |
hevcBlockSize.bits.log2_min_pcm_coding_block_size_minus3 = 0; |
| 590 |
*value = hevcBlockSize.value; |
| 591 |
} |
| 592 |
break; |
| 593 |
} |
| 594 |
#endif |
| 595 |
default: |
| 596 |
status = VA_STATUS_ERROR_INVALID_PARAMETER; |
| 597 |
break; |
| 598 |
} |
| 599 |
return status; |
| 600 |
} |
| 601 |
|
| 602 |
VAStatus MediaLibvaCapsG12::LoadHevcEncProfileEntrypoints() |
| 603 |
{ |
| 604 |
VAStatus status = VA_STATUS_SUCCESS; |
| 605 |
|
| 606 |
#ifdef _HEVC_ENCODE_VME_SUPPORTED |
| 607 |
|
| 608 |
status = MediaLibvaCaps::LoadHevcEncProfileEntrypoints(); |
| 609 |
DDI_CHK_RET(status, "Failed to initialize Caps!"); |
| 610 |
|
| 611 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEncodeHEVC)) |
| 612 |
{ |
| 613 |
SetAttribute(VAProfileHEVCMain, VAEntrypointEncSlice, VAConfigAttribEncTileSupport, 1); |
| 614 |
} |
| 615 |
|
| 616 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEncodeHEVC10bit)) |
| 617 |
{ |
| 618 |
SetAttribute(VAProfileHEVCMain10, VAEntrypointEncSlice, VAConfigAttribEncTileSupport, 1); |
| 619 |
} |
| 620 |
|
| 621 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEncodeHEVC12bit)) |
| 622 |
{ |
| 623 |
SetAttribute(VAProfileHEVCMain12, VAEntrypointEncSlice, VAConfigAttribEncTileSupport, 1); |
| 624 |
} |
| 625 |
|
| 626 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEncodeHEVC10bit422)) |
| 627 |
{ |
| 628 |
SetAttribute(VAProfileHEVCMain422_10, VAEntrypointEncSlice, VAConfigAttribEncTileSupport, 1); |
| 629 |
} |
| 630 |
|
| 631 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEncodeHEVC12bit422)) |
| 632 |
{ |
| 633 |
SetAttribute(VAProfileHEVCMain422_12, VAEntrypointEncSlice, VAConfigAttribEncTileSupport, 1); |
| 634 |
} |
| 635 |
#endif |
| 636 |
return status; |
| 637 |
} |
| 638 |
|
| 639 |
VAStatus MediaLibvaCapsG12::LoadHevcEncLpProfileEntrypoints() |
| 640 |
{ |
| 641 |
VAStatus status = VA_STATUS_SUCCESS; |
| 642 |
const uint8_t rcModeSize = (sizeof(m_encRcMode))/(sizeof(m_encRcMode[0])); |
| 643 |
|
| 644 |
#ifdef _HEVC_ENCODE_VDENC_SUPPORTED |
| 645 |
AttribMap *attributeList = nullptr; |
| 646 |
|
| 647 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEncodeHEVCVdencMain) |
| 648 |
|| MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEncodeHEVCVdencMain10) |
| 649 |
|| MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEncodeHEVCVdencMain444) |
| 650 |
|| MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEncodeHEVCVdencMain10bit444)) |
| 651 |
{ |
| 652 |
status = CreateEncAttributes(VAProfileHEVCMain, VAEntrypointEncSliceLP, &attributeList); |
| 653 |
DDI_CHK_RET(status, "Failed to initialize Caps!"); |
| 654 |
(*attributeList)[VAConfigAttribMaxPictureWidth] = CODEC_16K_MAX_PIC_WIDTH; |
| 655 |
(*attributeList)[VAConfigAttribMaxPictureHeight] = CODEC_12K_MAX_PIC_HEIGHT; |
| 656 |
(*attributeList)[VAConfigAttribEncTileSupport] = 1; |
| 657 |
} |
| 658 |
|
| 659 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEncodeHEVCVdencMain)) |
| 660 |
{ |
| 661 |
uint32_t configStartIdx = m_encConfigs.size(); |
| 662 |
AddEncConfig(VA_RC_CQP); |
| 663 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEnableMediaKernels)) |
| 664 |
{ |
| 665 |
for (int32_t j = 3; j < rcModeSize; j++) |
| 666 |
{ |
| 667 |
AddEncConfig(m_encRcMode[j]); |
| 668 |
AddEncConfig(m_encRcMode[j] | VA_RC_PARALLEL); |
| 669 |
} |
| 670 |
} |
| 671 |
AddProfileEntry(VAProfileHEVCMain, VAEntrypointEncSliceLP, attributeList, |
| 672 |
configStartIdx, m_encConfigs.size() - configStartIdx); |
| 673 |
} |
| 674 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEncodeHEVCVdencMain10bit422)) |
| 675 |
{ |
| 676 |
uint32_t configStartIdx = m_encConfigs.size(); |
| 677 |
AddEncConfig(VA_RC_CQP); |
| 678 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEnableMediaKernels)) |
| 679 |
{ |
| 680 |
for (int32_t j = 3; j < rcModeSize; j++) |
| 681 |
{ |
| 682 |
AddEncConfig(m_encRcMode[j]); |
| 683 |
AddEncConfig(m_encRcMode[j] | VA_RC_PARALLEL); |
| 684 |
} |
| 685 |
} |
| 686 |
AddProfileEntry(VAProfileHEVCMain422_10, VAEntrypointEncSliceLP, attributeList, |
| 687 |
configStartIdx, m_encConfigs.size() - configStartIdx); |
| 688 |
} |
| 689 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEncodeHEVCVdencMain10)) |
| 690 |
{ |
| 691 |
uint32_t configStartIdx = m_encConfigs.size(); |
| 692 |
AddEncConfig(VA_RC_CQP); |
| 693 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEnableMediaKernels)) |
| 694 |
{ |
| 695 |
for (int32_t j = 3; j < rcModeSize; j++) |
| 696 |
{ |
| 697 |
AddEncConfig(m_encRcMode[j]); |
| 698 |
AddEncConfig(m_encRcMode[j] | VA_RC_PARALLEL); |
| 699 |
} |
| 700 |
} |
| 701 |
AddProfileEntry(VAProfileHEVCMain10, VAEntrypointEncSliceLP, attributeList, |
| 702 |
configStartIdx, m_encConfigs.size() - configStartIdx); |
| 703 |
} |
| 704 |
|
| 705 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEncodeHEVCVdencMain444)) |
| 706 |
{ |
| 707 |
uint32_t configStartIdx = m_encConfigs.size(); |
| 708 |
AddEncConfig(VA_RC_CQP); |
| 709 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEnableMediaKernels)) |
| 710 |
{ |
| 711 |
for (int32_t j = 3; j < rcModeSize; j++) |
| 712 |
{ |
| 713 |
AddEncConfig(m_encRcMode[j]); |
| 714 |
AddEncConfig(m_encRcMode[j] | VA_RC_PARALLEL); |
| 715 |
} |
| 716 |
} |
| 717 |
AddProfileEntry(VAProfileHEVCMain444, VAEntrypointEncSliceLP, attributeList, |
| 718 |
configStartIdx, m_encConfigs.size() - configStartIdx); |
| 719 |
} |
| 720 |
|
| 721 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEncodeHEVCVdencMain10bit444)) |
| 722 |
{ |
| 723 |
uint32_t configStartIdx = m_encConfigs.size(); |
| 724 |
AddEncConfig(VA_RC_CQP); |
| 725 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEnableMediaKernels)) |
| 726 |
{ |
| 727 |
for (int32_t j = 3; j < rcModeSize; j++) |
| 728 |
{ |
| 729 |
AddEncConfig(m_encRcMode[j]); |
| 730 |
AddEncConfig(m_encRcMode[j] | VA_RC_PARALLEL); |
| 731 |
} |
| 732 |
} |
| 733 |
AddProfileEntry(VAProfileHEVCMain444_10, VAEntrypointEncSliceLP, attributeList, |
| 734 |
configStartIdx, m_encConfigs.size() - configStartIdx); |
| 735 |
} |
| 736 |
|
| 737 |
// SCC needs a separate attribute list from other profiles |
| 738 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEncodeHEVCVdencMainSCC) |
| 739 |
|| MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEncodeHEVCVdencMain10bitSCC) |
| 740 |
|| MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEncodeHEVCVdencMain444SCC) |
| 741 |
|| MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEncodeHEVCVdencMain10bit444SCC)) |
| 742 |
{ |
| 743 |
status = CreateEncAttributes(VAProfileHEVCSccMain, VAEntrypointEncSliceLP, &attributeList); |
| 744 |
DDI_CHK_RET(status, "Failed to initialize Caps!"); |
| 745 |
(*attributeList)[VAConfigAttribMaxPictureWidth] = CODEC_16K_MAX_PIC_WIDTH; |
| 746 |
(*attributeList)[VAConfigAttribMaxPictureHeight] = CODEC_12K_MAX_PIC_HEIGHT; |
| 747 |
(*attributeList)[VAConfigAttribEncTileSupport] = 1; |
| 748 |
} |
| 749 |
|
| 750 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEncodeHEVCVdencMainSCC)) |
| 751 |
{ |
| 752 |
uint32_t configStartIdx = m_encConfigs.size(); |
| 753 |
AddEncConfig(VA_RC_CQP); |
| 754 |
AddProfileEntry(VAProfileHEVCSccMain, VAEntrypointEncSliceLP, attributeList, |
| 755 |
configStartIdx, m_encConfigs.size() - configStartIdx); |
| 756 |
} |
| 757 |
|
| 758 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEncodeHEVCVdencMain10bitSCC)) |
| 759 |
{ |
| 760 |
uint32_t configStartIdx = m_encConfigs.size(); |
| 761 |
AddEncConfig(VA_RC_CQP); |
| 762 |
AddProfileEntry(VAProfileHEVCSccMain10, VAEntrypointEncSliceLP, attributeList, |
| 763 |
configStartIdx, m_encConfigs.size() - configStartIdx); |
| 764 |
} |
| 765 |
|
| 766 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEncodeHEVCVdencMain444SCC)) |
| 767 |
{ |
| 768 |
uint32_t configStartIdx = m_encConfigs.size(); |
| 769 |
AddEncConfig(VA_RC_CQP); |
| 770 |
AddProfileEntry(VAProfileHEVCSccMain444, VAEntrypointEncSliceLP, attributeList, |
| 771 |
configStartIdx, m_encConfigs.size() - configStartIdx); |
| 772 |
} |
| 773 |
|
| 774 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEncodeHEVCVdencMain10bit444SCC)) |
| 775 |
{ |
| 776 |
uint32_t configStartIdx = m_encConfigs.size(); |
| 777 |
AddEncConfig(VA_RC_CQP); |
| 778 |
AddProfileEntry(VAProfileHEVCSccMain444_10, VAEntrypointEncSliceLP, attributeList, |
| 779 |
configStartIdx, m_encConfigs.size() - configStartIdx); |
| 780 |
} |
| 781 |
#endif |
| 782 |
return status; |
| 783 |
} |
| 784 |
|
| 785 |
VAStatus MediaLibvaCapsG12::LoadVp9EncProfileEntrypoints() |
| 786 |
{ |
| 787 |
VAStatus status = VA_STATUS_SUCCESS; |
| 788 |
|
| 789 |
#ifdef _VP9_ENCODE_VDENC_SUPPORTED |
| 790 |
AttribMap *attributeList = nullptr; |
| 791 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEnableMediaKernels) && |
| 792 |
(MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEncodeVP9Vdenc) || |
| 793 |
MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEncodeVP9Vdenc8bit444) || |
| 794 |
MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEncodeVP9Vdenc10bit420) || |
| 795 |
MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEncodeVP9Vdenc10bit444))) |
| 796 |
{ |
| 797 |
status = CreateEncAttributes(VAProfileVP9Profile0, VAEntrypointEncSliceLP, &attributeList); |
| 798 |
DDI_CHK_RET(status, "Failed to initialize Caps!"); |
| 799 |
(*attributeList)[VAConfigAttribMaxPictureWidth] = m_maxVp9EncWidth; |
| 800 |
(*attributeList)[VAConfigAttribMaxPictureHeight] = m_maxVp9EncHeight; |
| 801 |
(*attributeList)[VAConfigAttribEncDynamicScaling] = 1; |
| 802 |
(*attributeList)[VAConfigAttribEncTileSupport] = 1; |
| 803 |
(*attributeList)[VAConfigAttribEncRateControlExt] = m_encVp9RateControlExt.value; |
| 804 |
} |
| 805 |
|
| 806 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEncodeVP9Vdenc) && |
| 807 |
MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEnableMediaKernels)) |
| 808 |
{ |
| 809 |
uint32_t configStartIdx = m_encConfigs.size(); |
| 810 |
AddEncConfig(VA_RC_CQP); |
| 811 |
AddEncConfig(VA_RC_CBR); |
| 812 |
AddEncConfig(VA_RC_VBR); |
| 813 |
AddEncConfig(VA_RC_ICQ); // for VP9 CQL only |
| 814 |
AddProfileEntry(VAProfileVP9Profile0, VAEntrypointEncSliceLP, attributeList, |
| 815 |
configStartIdx, m_encConfigs.size() - configStartIdx); |
| 816 |
} |
| 817 |
|
| 818 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEncodeVP9Vdenc8bit444) && |
| 819 |
MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEnableMediaKernels)) |
| 820 |
{ |
| 821 |
uint32_t configStartIdx = m_encConfigs.size(); |
| 822 |
AddEncConfig(VA_RC_CQP); |
| 823 |
AddEncConfig(VA_RC_CBR); |
| 824 |
AddEncConfig(VA_RC_VBR); |
| 825 |
AddEncConfig(VA_RC_ICQ); // for VP9 CQL only |
| 826 |
AddProfileEntry(VAProfileVP9Profile1, VAEntrypointEncSliceLP, attributeList, |
| 827 |
configStartIdx, m_encConfigs.size() - configStartIdx); |
| 828 |
} |
| 829 |
|
| 830 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEncodeVP9Vdenc10bit420) && |
| 831 |
MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEnableMediaKernels)) |
| 832 |
{ |
| 833 |
uint32_t configStartIdx = m_encConfigs.size(); |
| 834 |
AddEncConfig(VA_RC_CQP); |
| 835 |
AddEncConfig(VA_RC_CBR); |
| 836 |
AddEncConfig(VA_RC_VBR); |
| 837 |
AddEncConfig(VA_RC_ICQ); // for VP9 CQL only |
| 838 |
AddProfileEntry(VAProfileVP9Profile2, VAEntrypointEncSliceLP, attributeList, |
| 839 |
configStartIdx, m_encConfigs.size() - configStartIdx); |
| 840 |
} |
| 841 |
|
| 842 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEncodeVP9Vdenc10bit444) && |
| 843 |
MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEnableMediaKernels)) |
| 844 |
{ |
| 845 |
uint32_t configStartIdx = m_encConfigs.size(); |
| 846 |
AddEncConfig(VA_RC_CQP); |
| 847 |
AddEncConfig(VA_RC_CBR); |
| 848 |
AddEncConfig(VA_RC_VBR); |
| 849 |
AddEncConfig(VA_RC_ICQ); // for VP9 CQL only |
| 850 |
AddProfileEntry(VAProfileVP9Profile3, VAEntrypointEncSliceLP, attributeList, |
| 851 |
configStartIdx, m_encConfigs.size() - configStartIdx); |
| 852 |
} |
| 853 |
#endif |
| 854 |
return status; |
| 855 |
} |
| 856 |
|
| 857 |
VAStatus MediaLibvaCapsG12::LoadProfileEntrypoints() |
| 858 |
{ |
| 859 |
VAStatus status = VA_STATUS_SUCCESS; |
| 860 |
status = LoadAvcDecProfileEntrypoints(); |
| 861 |
DDI_CHK_RET(status, "Failed to initialize Caps!"); |
| 862 |
status = LoadAvcEncProfileEntrypoints(); |
| 863 |
DDI_CHK_RET(status, "Failed to initialize Caps!"); |
| 864 |
status = LoadAvcEncLpProfileEntrypoints(); |
| 865 |
DDI_CHK_RET(status, "Failed to initialize Caps!"); |
| 866 |
status = LoadMpeg2DecProfileEntrypoints(); |
| 867 |
DDI_CHK_RET(status, "Failed to initialize Caps!"); |
| 868 |
status = LoadMpeg2EncProfileEntrypoints(); |
| 869 |
DDI_CHK_RET(status, "Failed to initialize Caps!"); |
| 870 |
status = LoadVc1DecProfileEntrypoints(); |
| 871 |
DDI_CHK_RET(status, "Failed to initialize Caps!"); |
| 872 |
status = LoadJpegDecProfileEntrypoints(); |
| 873 |
DDI_CHK_RET(status, "Failed to initialize Caps!"); |
| 874 |
status = LoadJpegEncProfileEntrypoints(); |
| 875 |
DDI_CHK_RET(status, "Failed to initialize Caps!"); |
| 876 |
status = LoadHevcDecProfileEntrypoints(); |
| 877 |
DDI_CHK_RET(status, "Failed to initialize Caps!"); |
| 878 |
status = LoadHevcEncProfileEntrypoints(); |
| 879 |
DDI_CHK_RET(status, "Failed to initialize Caps!"); |
| 880 |
status = LoadHevcEncLpProfileEntrypoints(); |
| 881 |
DDI_CHK_RET(status, "Failed to initialize Caps!"); |
| 882 |
status = LoadVp8DecProfileEntrypoints(); |
| 883 |
DDI_CHK_RET(status, "Failed to initialize Caps!"); |
| 884 |
status = LoadVp8EncProfileEntrypoints(); |
| 885 |
DDI_CHK_RET(status, "Failed to initialize Caps!"); |
| 886 |
status = LoadVp9DecProfileEntrypoints(); |
| 887 |
DDI_CHK_RET(status, "Failed to initialize Caps!"); |
| 888 |
status = LoadVp9EncProfileEntrypoints(); |
| 889 |
DDI_CHK_RET(status, "Failed to initialize Caps!"); |
| 890 |
status = LoadAv1DecProfileEntrypoints(); |
| 891 |
DDI_CHK_RET(status, "Failed to initialize Caps!"); |
| 892 |
status = LoadNoneProfileEntrypoints(); |
| 893 |
DDI_CHK_RET(status, "Failed to initialize Caps!"); |
| 894 |
status = m_CapsCp->LoadCpProfileEntrypoints(); |
| 895 |
DDI_CHK_RET(status, "Failed to initialize CP Caps!"); |
| 896 |
|
| 897 |
return status; |
| 898 |
} |
| 899 |
|
| 900 |
VAStatus MediaLibvaCapsG12::CheckEncodeResolution( |
| 901 |
VAProfile profile, |
| 902 |
uint32_t width, |
| 903 |
uint32_t height) |
| 904 |
{ |
| 905 |
switch (profile) |
| 906 |
{ |
| 907 |
case VAProfileJPEGBaseline: |
| 908 |
if (width > m_encJpegMaxWidth |
| 909 |
|| width < m_encJpegMinWidth |
| 910 |
|| height > m_encJpegMaxHeight |
| 911 |
|| height < m_encJpegMinHeight) |
| 912 |
{ |
| 913 |
return VA_STATUS_ERROR_RESOLUTION_NOT_SUPPORTED; |
| 914 |
} |
| 915 |
break; |
| 916 |
case VAProfileMPEG2Simple: |
| 917 |
case VAProfileMPEG2Main: |
| 918 |
if( width > CODEC_MAX_PIC_WIDTH |
| 919 |
|| width < m_encMinWidth |
| 920 |
|| height > CODEC_MAX_PIC_HEIGHT |
| 921 |
|| height < m_encMinHeight) |
| 922 |
{ |
| 923 |
return VA_STATUS_ERROR_RESOLUTION_NOT_SUPPORTED; |
| 924 |
} |
| 925 |
break; |
| 926 |
case VAProfileHEVCMain: |
| 927 |
case VAProfileHEVCMain10: |
| 928 |
case VAProfileHEVCMain12: |
| 929 |
case VAProfileHEVCMain444: |
| 930 |
case VAProfileHEVCMain444_10: |
| 931 |
case VAProfileHEVCMain422_10: |
| 932 |
case VAProfileHEVCMain422_12: |
| 933 |
case VAProfileHEVCSccMain: |
| 934 |
case VAProfileHEVCSccMain10: |
| 935 |
case VAProfileHEVCSccMain444: |
| 936 |
case VAProfileHEVCSccMain444_10: |
| 937 |
if (width > m_maxHevcEncWidth |
| 938 |
|| width < (m_vdencActive ? m_hevcVDEncMinWidth : m_encMinWidth) |
| 939 |
|| height > m_maxHevcEncHeight |
| 940 |
|| height < (m_vdencActive ? m_hevcVDEncMinHeight : m_encMinHeight)) |
| 941 |
{ |
| 942 |
return VA_STATUS_ERROR_RESOLUTION_NOT_SUPPORTED; |
| 943 |
} |
| 944 |
break; |
| 945 |
case VAProfileVP9Profile0: |
| 946 |
case VAProfileVP9Profile1: |
| 947 |
case VAProfileVP9Profile2: |
| 948 |
case VAProfileVP9Profile3: |
| 949 |
if ((width > m_maxVp9EncWidth) || |
| 950 |
(width < m_minVp9EncWidth) || |
| 951 |
(height > m_maxVp9EncHeight) || |
| 952 |
(height < m_minVp9EncHeight) ) |
| 953 |
{ |
| 954 |
return VA_STATUS_ERROR_RESOLUTION_NOT_SUPPORTED; |
| 955 |
} |
| 956 |
break; |
| 957 |
default: |
| 958 |
if (width > m_encMax4kWidth |
| 959 |
|| width < m_encMinWidth |
| 960 |
|| height > m_encMax4kHeight |
| 961 |
|| height < m_encMinHeight) |
| 962 |
{ |
| 963 |
return VA_STATUS_ERROR_RESOLUTION_NOT_SUPPORTED; |
| 964 |
} |
| 965 |
break; |
| 966 |
} |
| 967 |
return VA_STATUS_SUCCESS; |
| 968 |
} |
| 969 |
VAStatus MediaLibvaCapsG12::CheckDecodeResolution( |
| 970 |
int32_t codecMode, |
| 971 |
VAProfile profile, |
| 972 |
uint32_t width, |
| 973 |
uint32_t height) |
| 974 |
{ |
| 975 |
|
| 976 |
uint32_t maxWidth, maxHeight; |
| 977 |
switch (codecMode) |
| 978 |
{ |
| 979 |
case CODECHAL_DECODE_MODE_MPEG2VLD: |
| 980 |
maxWidth = m_decMpeg2MaxWidth; |
| 981 |
maxHeight = m_decMpeg2MaxHeight; |
| 982 |
break; |
| 983 |
case CODECHAL_DECODE_MODE_VC1VLD: |
| 984 |
maxWidth = m_decVc1MaxWidth; |
| 985 |
maxHeight = m_decVc1MaxHeight; |
| 986 |
break; |
| 987 |
case CODECHAL_DECODE_MODE_JPEG: |
| 988 |
maxWidth = m_decJpegMaxWidth; |
| 989 |
maxHeight = m_decJpegMaxHeight; |
| 990 |
break; |
| 991 |
case CODECHAL_DECODE_MODE_AVCVLD: |
| 992 |
maxWidth = m_decAvcMaxWidth; |
| 993 |
maxHeight = m_decAvcMaxHeight; |
| 994 |
break; |
| 995 |
case CODECHAL_DECODE_MODE_HEVCVLD: |
| 996 |
maxWidth = m_decHevcMax16kWidth; |
| 997 |
maxHeight = m_decHevcMax16kHeight; |
| 998 |
break; |
| 999 |
case CODECHAL_DECODE_MODE_VP9VLD: |
| 1000 |
case CODECHAL_DECODE_MODE_AV1VLD: |
| 1001 |
maxWidth = m_decVp9Max16kWidth; |
| 1002 |
maxHeight = m_decVp9Max16kHeight; |
| 1003 |
break; |
| 1004 |
default: |
| 1005 |
maxWidth = m_decDefaultMaxWidth; |
| 1006 |
maxHeight = m_decDefaultMaxHeight; |
| 1007 |
break; |
| 1008 |
} |
| 1009 |
|
| 1010 |
uint32_t alignedHeight; |
| 1011 |
if (profile == VAProfileVC1Advanced) |
| 1012 |
{ |
| 1013 |
alignedHeight = MOS_ALIGN_CEIL(height,32); |
| 1014 |
} |
| 1015 |
else |
| 1016 |
{ |
| 1017 |
alignedHeight = height; |
| 1018 |
} |
| 1019 |
|
| 1020 |
if (width > maxWidth || alignedHeight > maxHeight) |
| 1021 |
{ |
| 1022 |
return VA_STATUS_ERROR_RESOLUTION_NOT_SUPPORTED; |
| 1023 |
} |
| 1024 |
else |
| 1025 |
{ |
| 1026 |
return VA_STATUS_SUCCESS; |
| 1027 |
} |
| 1028 |
} |
| 1029 |
|
| 1030 |
VAStatus MediaLibvaCapsG12::AddEncSurfaceAttributes( |
| 1031 |
VAProfile profile, |
| 1032 |
VAEntrypoint entrypoint, |
| 1033 |
VASurfaceAttrib *attribList, |
| 1034 |
uint32_t &numAttribs) |
| 1035 |
{ |
| 1036 |
DDI_CHK_NULL(attribList, "Null pointer", VA_STATUS_ERROR_INVALID_PARAMETER); |
| 1037 |
|
| 1038 |
if(entrypoint == VAEntrypointEncSlice || entrypoint == VAEntrypointEncSliceLP || entrypoint == VAEntrypointEncPicture || entrypoint == VAEntrypointFEI) |
| 1039 |
{ |
| 1040 |
if (profile == VAProfileHEVCMain10 || profile == VAProfileHEVCSccMain10 || profile == VAProfileVP9Profile2) |
| 1041 |
{ |
| 1042 |
attribList[numAttribs].type = VASurfaceAttribPixelFormat; |
| 1043 |
attribList[numAttribs].value.type = VAGenericValueTypeInteger; |
| 1044 |
attribList[numAttribs].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1045 |
attribList[numAttribs].value.value.i = VA_FOURCC('P', '0', '1', '0'); |
| 1046 |
numAttribs++; |
| 1047 |
|
| 1048 |
if (profile == VAProfileVP9Profile2) |
| 1049 |
{ |
| 1050 |
attribList[numAttribs].type = VASurfaceAttribPixelFormat; |
| 1051 |
attribList[numAttribs].value.type = VAGenericValueTypeInteger; |
| 1052 |
attribList[numAttribs].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1053 |
attribList[numAttribs].value.value.i = VA_FOURCC_P012; |
| 1054 |
numAttribs++; |
| 1055 |
|
| 1056 |
attribList[numAttribs].type = VASurfaceAttribPixelFormat; |
| 1057 |
attribList[numAttribs].value.type = VAGenericValueTypeInteger; |
| 1058 |
attribList[numAttribs].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1059 |
attribList[numAttribs].value.value.i = VA_FOURCC_P016; |
| 1060 |
numAttribs++; |
| 1061 |
} |
| 1062 |
} |
| 1063 |
else if(profile == VAProfileHEVCMain12) |
| 1064 |
{ |
| 1065 |
attribList[numAttribs].type = VASurfaceAttribPixelFormat; |
| 1066 |
attribList[numAttribs].value.type = VAGenericValueTypeInteger; |
| 1067 |
attribList[numAttribs].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1068 |
attribList[numAttribs].value.value.i = VA_FOURCC_P012; |
| 1069 |
numAttribs++; |
| 1070 |
|
| 1071 |
attribList[numAttribs].type = VASurfaceAttribPixelFormat; |
| 1072 |
attribList[numAttribs].value.type = VAGenericValueTypeInteger; |
| 1073 |
attribList[numAttribs].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1074 |
attribList[numAttribs].value.value.i = VA_FOURCC_P016; |
| 1075 |
numAttribs++; |
| 1076 |
} |
| 1077 |
else if (profile == VAProfileHEVCMain444 || profile == VAProfileHEVCSccMain444) |
| 1078 |
{ |
| 1079 |
attribList[numAttribs].type = VASurfaceAttribPixelFormat; |
| 1080 |
attribList[numAttribs].value.type = VAGenericValueTypeInteger; |
| 1081 |
attribList[numAttribs].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1082 |
attribList[numAttribs].value.value.i = VA_FOURCC_AYUV; |
| 1083 |
numAttribs++; |
| 1084 |
|
| 1085 |
#if VA_CHECK_VERSION(1, 13, 0) |
| 1086 |
attribList[numAttribs].type = VASurfaceAttribPixelFormat; |
| 1087 |
attribList[numAttribs].value.type = VAGenericValueTypeInteger; |
| 1088 |
attribList[numAttribs].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1089 |
attribList[numAttribs].value.value.i = VA_FOURCC_XYUV; |
| 1090 |
numAttribs++; |
| 1091 |
#endif |
| 1092 |
} |
| 1093 |
else if (profile == VAProfileHEVCMain444_10 || profile == VAProfileHEVCSccMain444_10) |
| 1094 |
{ |
| 1095 |
attribList[numAttribs].type = VASurfaceAttribPixelFormat; |
| 1096 |
attribList[numAttribs].value.type = VAGenericValueTypeInteger; |
| 1097 |
attribList[numAttribs].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1098 |
attribList[numAttribs].value.value.i = VA_FOURCC_Y410; |
| 1099 |
numAttribs++; |
| 1100 |
} |
| 1101 |
else if(profile == VAProfileHEVCMain422_10) |
| 1102 |
{ |
| 1103 |
attribList[numAttribs].type = VASurfaceAttribPixelFormat; |
| 1104 |
attribList[numAttribs].value.type = VAGenericValueTypeInteger; |
| 1105 |
attribList[numAttribs].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1106 |
attribList[numAttribs].value.value.i = VA_FOURCC_YUY2; |
| 1107 |
numAttribs++; |
| 1108 |
|
| 1109 |
attribList[numAttribs].type = VASurfaceAttribPixelFormat; |
| 1110 |
attribList[numAttribs].value.type = VAGenericValueTypeInteger; |
| 1111 |
attribList[numAttribs].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1112 |
attribList[numAttribs].value.value.i = VA_FOURCC_Y210; |
| 1113 |
numAttribs++; |
| 1114 |
} |
| 1115 |
else if(profile == VAProfileHEVCMain422_12) |
| 1116 |
{ |
| 1117 |
//hevc rext: Y216 12/16bit 422 |
| 1118 |
#if VA_CHECK_VERSION(1, 9, 0) |
| 1119 |
attribList[numAttribs].type = VASurfaceAttribPixelFormat; |
| 1120 |
attribList[numAttribs].value.type = VAGenericValueTypeInteger; |
| 1121 |
attribList[numAttribs].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1122 |
attribList[numAttribs].value.value.i = VA_FOURCC_Y212; |
| 1123 |
numAttribs++; |
| 1124 |
#endif |
| 1125 |
|
| 1126 |
attribList[numAttribs].type = VASurfaceAttribPixelFormat; |
| 1127 |
attribList[numAttribs].value.type = VAGenericValueTypeInteger; |
| 1128 |
attribList[numAttribs].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1129 |
attribList[numAttribs].value.value.i = VA_FOURCC_Y216; |
| 1130 |
numAttribs++; |
| 1131 |
} |
| 1132 |
else if (profile == VAProfileJPEGBaseline) |
| 1133 |
{ |
| 1134 |
for (int32_t j = 0; j < m_numJpegEncSurfaceAttr; j++) |
| 1135 |
{ |
| 1136 |
attribList[numAttribs].type = VASurfaceAttribPixelFormat; |
| 1137 |
attribList[numAttribs].value.type = VAGenericValueTypeInteger; |
| 1138 |
attribList[numAttribs].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1139 |
attribList[numAttribs].value.value.i = m_jpegEncSurfaceAttr[j]; |
| 1140 |
numAttribs++; |
| 1141 |
} |
| 1142 |
} |
| 1143 |
else if (profile == VAProfileVP9Profile1) |
| 1144 |
{ |
| 1145 |
attribList[numAttribs].type = VASurfaceAttribPixelFormat; |
| 1146 |
attribList[numAttribs].value.type = VAGenericValueTypeInteger; |
| 1147 |
attribList[numAttribs].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1148 |
attribList[numAttribs].value.value.i = VA_FOURCC_AYUV; |
| 1149 |
numAttribs++; |
| 1150 |
|
| 1151 |
#if VA_CHECK_VERSION(1, 13, 0) |
| 1152 |
attribList[numAttribs].type = VASurfaceAttribPixelFormat; |
| 1153 |
attribList[numAttribs].value.type = VAGenericValueTypeInteger; |
| 1154 |
attribList[numAttribs].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1155 |
attribList[numAttribs].value.value.i = VA_FOURCC_XYUV; |
| 1156 |
numAttribs++; |
| 1157 |
#endif |
| 1158 |
} |
| 1159 |
else if (profile == VAProfileVP9Profile3) |
| 1160 |
{ |
| 1161 |
attribList[numAttribs].type = VASurfaceAttribPixelFormat; |
| 1162 |
attribList[numAttribs].value.type = VAGenericValueTypeInteger; |
| 1163 |
attribList[numAttribs].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1164 |
attribList[numAttribs].value.value.i = VA_FOURCC_Y410; |
| 1165 |
numAttribs++; |
| 1166 |
|
| 1167 |
#if VA_CHECK_VERSION(1, 9, 0) |
| 1168 |
attribList[numAttribs].type = VASurfaceAttribPixelFormat; |
| 1169 |
attribList[numAttribs].value.type = VAGenericValueTypeInteger; |
| 1170 |
attribList[numAttribs].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1171 |
attribList[numAttribs].value.value.i = VA_FOURCC_Y412; |
| 1172 |
numAttribs++; |
| 1173 |
#endif |
| 1174 |
|
| 1175 |
attribList[numAttribs].type = VASurfaceAttribPixelFormat; |
| 1176 |
attribList[numAttribs].value.type = VAGenericValueTypeInteger; |
| 1177 |
attribList[numAttribs].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1178 |
attribList[numAttribs].value.value.i = VA_FOURCC_Y416; |
| 1179 |
numAttribs++; |
| 1180 |
|
| 1181 |
attribList[numAttribs].type = VASurfaceAttribPixelFormat; |
| 1182 |
attribList[numAttribs].value.type = VAGenericValueTypeInteger; |
| 1183 |
attribList[numAttribs].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1184 |
attribList[numAttribs].value.value.i = VA_FOURCC('A', 'R', 'G', 'B'); |
| 1185 |
numAttribs++; |
| 1186 |
|
| 1187 |
attribList[numAttribs].type = VASurfaceAttribPixelFormat; |
| 1188 |
attribList[numAttribs].value.type = VAGenericValueTypeInteger; |
| 1189 |
attribList[numAttribs].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1190 |
attribList[numAttribs].value.value.i = VA_FOURCC('A', 'B', 'G', 'R'); |
| 1191 |
numAttribs++; |
| 1192 |
} |
| 1193 |
else |
| 1194 |
{ |
| 1195 |
attribList[numAttribs].type = VASurfaceAttribPixelFormat; |
| 1196 |
attribList[numAttribs].value.type = VAGenericValueTypeInteger; |
| 1197 |
attribList[numAttribs].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1198 |
attribList[numAttribs].value.value.i = VA_FOURCC('N', 'V', '1', '2'); |
| 1199 |
numAttribs++; |
| 1200 |
} |
| 1201 |
attribList[numAttribs].type = VASurfaceAttribMaxWidth; |
| 1202 |
attribList[numAttribs].value.type = VAGenericValueTypeInteger; |
| 1203 |
attribList[numAttribs].flags = VA_SURFACE_ATTRIB_GETTABLE; |
| 1204 |
attribList[numAttribs].value.value.i = CODEC_MAX_PIC_WIDTH; |
| 1205 |
|
| 1206 |
if(profile == VAProfileJPEGBaseline) |
| 1207 |
{ |
| 1208 |
attribList[numAttribs].value.value.i = ENCODE_JPEG_MAX_PIC_WIDTH; |
| 1209 |
} |
| 1210 |
else if(IsHevcProfile(profile)) |
| 1211 |
{ |
| 1212 |
attribList[numAttribs].value.value.i = CODEC_16K_MAX_PIC_WIDTH; |
| 1213 |
} |
| 1214 |
else if(IsVp9Profile(profile)) |
| 1215 |
{ |
| 1216 |
attribList[numAttribs].value.value.i = CODEC_8K_MAX_PIC_WIDTH; |
| 1217 |
} |
| 1218 |
if(IsAvcProfile(profile)) |
| 1219 |
{ |
| 1220 |
attribList[numAttribs].value.value.i = CODEC_4K_MAX_PIC_WIDTH; |
| 1221 |
} |
| 1222 |
numAttribs++; |
| 1223 |
|
| 1224 |
attribList[numAttribs].type = VASurfaceAttribMaxHeight; |
| 1225 |
attribList[numAttribs].value.type = VAGenericValueTypeInteger; |
| 1226 |
attribList[numAttribs].flags = VA_SURFACE_ATTRIB_GETTABLE; |
| 1227 |
attribList[numAttribs].value.value.i = CODEC_MAX_PIC_HEIGHT; |
| 1228 |
if(profile == VAProfileJPEGBaseline) |
| 1229 |
{ |
| 1230 |
attribList[numAttribs].value.value.i = ENCODE_JPEG_MAX_PIC_HEIGHT; |
| 1231 |
} |
| 1232 |
else if(IsHevcProfile(profile)) |
| 1233 |
{ |
| 1234 |
uint32_t heightValue = CODEC_12K_MAX_PIC_HEIGHT; |
| 1235 |
GetPlatformSpecificAttrib(profile, entrypoint, VAConfigAttribMaxPictureHeight, &heightValue); |
| 1236 |
attribList[numAttribs].value.value.i = (int32_t) heightValue; |
| 1237 |
} |
| 1238 |
else if(IsVp9Profile(profile)) |
| 1239 |
{ |
| 1240 |
attribList[numAttribs].value.value.i = CODEC_8K_MAX_PIC_HEIGHT; |
| 1241 |
} |
| 1242 |
if(IsAvcProfile(profile)) |
| 1243 |
{ |
| 1244 |
attribList[numAttribs].value.value.i = CODEC_4K_MAX_PIC_HEIGHT; |
| 1245 |
} |
| 1246 |
numAttribs++; |
| 1247 |
|
| 1248 |
attribList[numAttribs].type = VASurfaceAttribMinWidth; |
| 1249 |
attribList[numAttribs].value.type = VAGenericValueTypeInteger; |
| 1250 |
attribList[numAttribs].flags = VA_SURFACE_ATTRIB_GETTABLE; |
| 1251 |
attribList[numAttribs].value.value.i = m_encMinWidth; |
| 1252 |
if(IsHevcProfile(profile)) |
| 1253 |
{ |
| 1254 |
attribList[numAttribs].value.value.i = m_vdencActive ? m_hevcVDEncMinWidth : m_encMinWidth; |
| 1255 |
} |
| 1256 |
else if (IsVp9Profile(profile)) |
| 1257 |
{ |
| 1258 |
attribList[numAttribs].value.value.i = m_vdencActive ? m_minVp9EncWidth : m_encMinWidth; |
| 1259 |
} |
| 1260 |
else if (profile == VAProfileJPEGBaseline) |
| 1261 |
{ |
| 1262 |
attribList[numAttribs].value.value.i = m_encJpegMinWidth; |
| 1263 |
} |
| 1264 |
numAttribs++; |
| 1265 |
|
| 1266 |
attribList[numAttribs].type = VASurfaceAttribMinHeight; |
| 1267 |
attribList[numAttribs].value.type = VAGenericValueTypeInteger; |
| 1268 |
attribList[numAttribs].flags = VA_SURFACE_ATTRIB_GETTABLE; |
| 1269 |
attribList[numAttribs].value.value.i = m_encMinHeight; |
| 1270 |
if(IsHevcProfile(profile)) |
| 1271 |
{ |
| 1272 |
attribList[numAttribs].value.value.i = m_vdencActive ? m_hevcVDEncMinHeight : m_encMinHeight; |
| 1273 |
} |
| 1274 |
else if (IsVp9Profile(profile)) |
| 1275 |
{ |
| 1276 |
attribList[numAttribs].value.value.i = m_vdencActive ? m_minVp9EncHeight : m_encMinHeight; |
| 1277 |
} |
| 1278 |
else if (profile == VAProfileJPEGBaseline) |
| 1279 |
{ |
| 1280 |
attribList[numAttribs].value.value.i = m_encJpegMinHeight; |
| 1281 |
} |
| 1282 |
numAttribs++; |
| 1283 |
|
| 1284 |
attribList[numAttribs].type = VASurfaceAttribMemoryType; |
| 1285 |
attribList[numAttribs].value.type = VAGenericValueTypeInteger; |
| 1286 |
attribList[numAttribs].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1287 |
attribList[numAttribs].value.value.i = VA_SURFACE_ATTRIB_MEM_TYPE_VA | |
| 1288 |
#if VA_CHECK_VERSION(1, 21, 0) |
| 1289 |
VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_3 | |
| 1290 |
#endif |
| 1291 |
VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2; |
| 1292 |
numAttribs++; |
| 1293 |
} |
| 1294 |
|
| 1295 |
return VA_STATUS_SUCCESS; |
| 1296 |
} |
| 1297 |
VAStatus MediaLibvaCapsG12::QuerySurfaceAttributes( |
| 1298 |
VAConfigID configId, |
| 1299 |
VASurfaceAttrib *attribList, |
| 1300 |
uint32_t *numAttribs) |
| 1301 |
{ |
| 1302 |
DDI_CHK_NULL(numAttribs, "Null num_attribs", VA_STATUS_ERROR_INVALID_PARAMETER); |
| 1303 |
|
| 1304 |
if (attribList == nullptr) |
| 1305 |
{ |
| 1306 |
*numAttribs = DDI_CODEC_GEN_MAX_SURFACE_ATTRIBUTES; |
| 1307 |
return VA_STATUS_SUCCESS; |
| 1308 |
} |
| 1309 |
|
| 1310 |
int32_t profileTableIdx = -1; |
| 1311 |
VAEntrypoint entrypoint; |
| 1312 |
VAProfile profile; |
| 1313 |
VAStatus status = GetProfileEntrypointFromConfigId(configId, &profile, &entrypoint, &profileTableIdx); |
| 1314 |
DDI_CHK_RET(status, "Invalid config_id!"); |
| 1315 |
if (profileTableIdx < 0 || profileTableIdx >= m_profileEntryCount) |
| 1316 |
{ |
| 1317 |
return VA_STATUS_ERROR_INVALID_CONFIG; |
| 1318 |
} |
| 1319 |
|
| 1320 |
VASurfaceAttrib *attribs = (VASurfaceAttrib *)MOS_AllocAndZeroMemory(DDI_CODEC_GEN_MAX_SURFACE_ATTRIBUTES * sizeof(*attribs)); |
| 1321 |
if (attribs == nullptr) |
| 1322 |
{ |
| 1323 |
return VA_STATUS_ERROR_ALLOCATION_FAILED; |
| 1324 |
} |
| 1325 |
|
| 1326 |
uint32_t i = 0; |
| 1327 |
|
| 1328 |
if (entrypoint == VAEntrypointVideoProc) /* vpp */ |
| 1329 |
{ |
| 1330 |
attribs[i].type = VASurfaceAttribPixelFormat; |
| 1331 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1332 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1333 |
attribs[i].value.value.i = VA_FOURCC('N', 'V', '1', '2'); |
| 1334 |
i++; |
| 1335 |
|
| 1336 |
attribs[i].type = VASurfaceAttribMaxWidth; |
| 1337 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1338 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1339 |
attribs[i].value.value.i = VP_MAX_PIC_WIDTH; |
| 1340 |
i++; |
| 1341 |
|
| 1342 |
attribs[i].type = VASurfaceAttribMaxHeight; |
| 1343 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1344 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1345 |
attribs[i].value.value.i = VP_MAX_PIC_HEIGHT; |
| 1346 |
i++; |
| 1347 |
|
| 1348 |
attribs[i].type = VASurfaceAttribMinWidth; |
| 1349 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1350 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1351 |
attribs[i].value.value.i = VP_MIN_PIC_WIDTH; |
| 1352 |
i++; |
| 1353 |
|
| 1354 |
attribs[i].type = VASurfaceAttribMinHeight; |
| 1355 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1356 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1357 |
attribs[i].value.value.i = VP_MIN_PIC_HEIGHT; |
| 1358 |
i++; |
| 1359 |
|
| 1360 |
for (int32_t j = 0; j < m_numVpSurfaceAttr && m_vpSurfaceAttr[j]; j++) |
| 1361 |
{ |
| 1362 |
attribs[i].type = VASurfaceAttribPixelFormat; |
| 1363 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1364 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1365 |
attribs[i].value.value.i = m_vpSurfaceAttr[j]; |
| 1366 |
i++; |
| 1367 |
} |
| 1368 |
|
| 1369 |
attribs[i].type = VASurfaceAttribMemoryType; |
| 1370 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1371 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1372 |
#ifdef ANDROID |
| 1373 |
attribs[i].value.value.i = VA_SURFACE_ATTRIB_MEM_TYPE_VA | |
| 1374 |
VA_SURFACE_ATTRIB_MEM_TYPE_USER_PTR | |
| 1375 |
VA_SURFACE_ATTRIB_MEM_TYPE_KERNEL_DRM | |
| 1376 |
VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME | |
| 1377 |
VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2 | |
| 1378 |
#if VA_CHECK_VERSION(1, 21, 0) |
| 1379 |
VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_3 | |
| 1380 |
#endif |
| 1381 |
VA_SURFACE_ATTRIB_MEM_TYPE_ANDROID_GRALLOC; |
| 1382 |
#else |
| 1383 |
attribs[i].value.value.i = VA_SURFACE_ATTRIB_MEM_TYPE_VA | |
| 1384 |
VA_SURFACE_ATTRIB_MEM_TYPE_USER_PTR | |
| 1385 |
VA_SURFACE_ATTRIB_MEM_TYPE_KERNEL_DRM | |
| 1386 |
VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME | |
| 1387 |
#if VA_CHECK_VERSION(1, 21, 0) |
| 1388 |
VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_3 | |
| 1389 |
#endif |
| 1390 |
VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2; |
| 1391 |
#endif |
| 1392 |
i++; |
| 1393 |
|
| 1394 |
attribs[i].type = VASurfaceAttribExternalBufferDescriptor; |
| 1395 |
attribs[i].value.type = VAGenericValueTypePointer; |
| 1396 |
attribs[i].flags = VA_SURFACE_ATTRIB_SETTABLE; |
| 1397 |
attribs[i].value.value.p = nullptr; /* ignore */ |
| 1398 |
i++; |
| 1399 |
} |
| 1400 |
else if (entrypoint == VAEntrypointVLD) /* vld */ |
| 1401 |
{ |
| 1402 |
if (profile == VAProfileHEVCMain10 || profile == VAProfileVP9Profile2) |
| 1403 |
{ |
| 1404 |
attribs[i].type = VASurfaceAttribPixelFormat; |
| 1405 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1406 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1407 |
attribs[i].value.value.i = VA_FOURCC_P010; |
| 1408 |
i++; |
| 1409 |
|
| 1410 |
if(profile == VAProfileVP9Profile2) |
| 1411 |
{ |
| 1412 |
attribs[i].type = VASurfaceAttribPixelFormat; |
| 1413 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1414 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1415 |
attribs[i].value.value.i = VA_FOURCC_P012; |
| 1416 |
i++; |
| 1417 |
|
| 1418 |
attribs[i].type = VASurfaceAttribPixelFormat; |
| 1419 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1420 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1421 |
attribs[i].value.value.i = VA_FOURCC_P016; |
| 1422 |
i++; |
| 1423 |
} |
| 1424 |
} |
| 1425 |
else if (profile == VAProfileAV1Profile0) |
| 1426 |
{ |
| 1427 |
attribs[i].type = VASurfaceAttribPixelFormat; |
| 1428 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1429 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1430 |
attribs[i].value.value.i = VA_FOURCC('N', 'V', '1', '2'); |
| 1431 |
i++; |
| 1432 |
|
| 1433 |
attribs[i].type = VASurfaceAttribPixelFormat; |
| 1434 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1435 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1436 |
attribs[i].value.value.i = VA_FOURCC_P010; |
| 1437 |
i++; |
| 1438 |
} |
| 1439 |
else if(profile == VAProfileHEVCMain12) |
| 1440 |
{ |
| 1441 |
attribs[i].type = VASurfaceAttribPixelFormat; |
| 1442 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1443 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1444 |
attribs[i].value.value.i = VA_FOURCC_P012; |
| 1445 |
i++; |
| 1446 |
|
| 1447 |
attribs[i].type = VASurfaceAttribPixelFormat; |
| 1448 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1449 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1450 |
attribs[i].value.value.i = VA_FOURCC_P016; |
| 1451 |
i++; |
| 1452 |
} |
| 1453 |
else if(profile == VAProfileHEVCMain422_10) |
| 1454 |
{ |
| 1455 |
attribs[i].type = VASurfaceAttribPixelFormat; |
| 1456 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1457 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1458 |
attribs[i].value.value.i = VA_FOURCC_YUY2; |
| 1459 |
i++; |
| 1460 |
|
| 1461 |
attribs[i].type = VASurfaceAttribPixelFormat; |
| 1462 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1463 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1464 |
attribs[i].value.value.i = VA_FOURCC_Y210; |
| 1465 |
i++; |
| 1466 |
} |
| 1467 |
else if(profile == VAProfileHEVCMain422_12) |
| 1468 |
{ |
| 1469 |
//hevc rext: Y216 12/16bit 422 |
| 1470 |
#if VA_CHECK_VERSION(1, 9, 0) |
| 1471 |
attribs[i].type = VASurfaceAttribPixelFormat; |
| 1472 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1473 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1474 |
attribs[i].value.value.i = VA_FOURCC_Y212; |
| 1475 |
i++; |
| 1476 |
#endif |
| 1477 |
|
| 1478 |
attribs[i].type = VASurfaceAttribPixelFormat; |
| 1479 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1480 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1481 |
attribs[i].value.value.i = VA_FOURCC_Y216; |
| 1482 |
i++; |
| 1483 |
|
| 1484 |
attribs[i].type = VASurfaceAttribPixelFormat; |
| 1485 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1486 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1487 |
attribs[i].value.value.i = VA_FOURCC_P012; |
| 1488 |
i++; |
| 1489 |
} |
| 1490 |
else if(profile == VAProfileHEVCMain444 || profile == VAProfileVP9Profile1) |
| 1491 |
{ |
| 1492 |
attribs[i].type = VASurfaceAttribPixelFormat; |
| 1493 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1494 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1495 |
attribs[i].value.value.i = VA_FOURCC_AYUV; |
| 1496 |
i++; |
| 1497 |
|
| 1498 |
#if VA_CHECK_VERSION(1, 13, 0) |
| 1499 |
attribs[i].type = VASurfaceAttribPixelFormat; |
| 1500 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1501 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1502 |
attribs[i].value.value.i = VA_FOURCC_XYUV; |
| 1503 |
i++; |
| 1504 |
#endif |
| 1505 |
} |
| 1506 |
else if(profile == VAProfileHEVCMain444_10 || profile == VAProfileVP9Profile3) |
| 1507 |
{ |
| 1508 |
attribs[i].type = VASurfaceAttribPixelFormat; |
| 1509 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1510 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1511 |
attribs[i].value.value.i = VA_FOURCC_Y410; |
| 1512 |
i++; |
| 1513 |
|
| 1514 |
if(profile == VAProfileVP9Profile3) |
| 1515 |
{ |
| 1516 |
#if VA_CHECK_VERSION(1, 9, 0) |
| 1517 |
attribs[i].type = VASurfaceAttribPixelFormat; |
| 1518 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1519 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1520 |
attribs[i].value.value.i = VA_FOURCC_Y412; |
| 1521 |
i++; |
| 1522 |
#endif |
| 1523 |
|
| 1524 |
attribs[i].type = VASurfaceAttribPixelFormat; |
| 1525 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1526 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1527 |
attribs[i].value.value.i = VA_FOURCC_Y416; |
| 1528 |
i++; |
| 1529 |
} |
| 1530 |
} |
| 1531 |
else if(profile == VAProfileHEVCMain444_12) |
| 1532 |
{ |
| 1533 |
#if VA_CHECK_VERSION(1, 9, 0) |
| 1534 |
attribs[i].type = VASurfaceAttribPixelFormat; |
| 1535 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1536 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1537 |
attribs[i].value.value.i = VA_FOURCC_Y412; |
| 1538 |
i++; |
| 1539 |
|
| 1540 |
attribs[i].type = VASurfaceAttribPixelFormat; |
| 1541 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1542 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1543 |
attribs[i].value.value.i = VA_FOURCC_Y212; |
| 1544 |
i++; |
| 1545 |
#endif |
| 1546 |
|
| 1547 |
attribs[i].type = VASurfaceAttribPixelFormat; |
| 1548 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1549 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1550 |
attribs[i].value.value.i = VA_FOURCC_Y416; |
| 1551 |
i++; |
| 1552 |
|
| 1553 |
attribs[i].type = VASurfaceAttribPixelFormat; |
| 1554 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1555 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1556 |
attribs[i].value.value.i = VA_FOURCC_P012; |
| 1557 |
i++; |
| 1558 |
} |
| 1559 |
else if(profile == VAProfileHEVCSccMain10) |
| 1560 |
{ |
| 1561 |
attribs[i].type = VASurfaceAttribPixelFormat; |
| 1562 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1563 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1564 |
attribs[i].value.value.i = VA_FOURCC_P010; |
| 1565 |
i++; |
| 1566 |
} |
| 1567 |
else if(profile == VAProfileHEVCSccMain444) |
| 1568 |
{ |
| 1569 |
//422/444 8/10bit included |
| 1570 |
attribs[i].type = VASurfaceAttribPixelFormat; |
| 1571 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1572 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1573 |
attribs[i].value.value.i = VA_FOURCC_YUY2; |
| 1574 |
i++; |
| 1575 |
|
| 1576 |
attribs[i].type = VASurfaceAttribPixelFormat; |
| 1577 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1578 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1579 |
attribs[i].value.value.i = VA_FOURCC_Y210; |
| 1580 |
i++; |
| 1581 |
|
| 1582 |
attribs[i].type = VASurfaceAttribPixelFormat; |
| 1583 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1584 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1585 |
attribs[i].value.value.i = VA_FOURCC_AYUV; |
| 1586 |
i++; |
| 1587 |
|
| 1588 |
#if VA_CHECK_VERSION(1, 13, 0) |
| 1589 |
attribs[i].type = VASurfaceAttribPixelFormat; |
| 1590 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1591 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1592 |
attribs[i].value.value.i = VA_FOURCC_XYUV; |
| 1593 |
i++; |
| 1594 |
#endif |
| 1595 |
|
| 1596 |
attribs[i].type = VASurfaceAttribPixelFormat; |
| 1597 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1598 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1599 |
attribs[i].value.value.i = VA_FOURCC_Y410; |
| 1600 |
i++; |
| 1601 |
|
| 1602 |
attribs[i].type = VASurfaceAttribPixelFormat; |
| 1603 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1604 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1605 |
attribs[i].value.value.i = VA_FOURCC('N', 'V', '1', '2'); |
| 1606 |
i++; |
| 1607 |
} else if (profile == VAProfileHEVCSccMain444_10) |
| 1608 |
{ |
| 1609 |
attribs[i].type = VASurfaceAttribPixelFormat; |
| 1610 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1611 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1612 |
attribs[i].value.value.i = VA_FOURCC_AYUV; |
| 1613 |
i++; |
| 1614 |
|
| 1615 |
#if VA_CHECK_VERSION(1, 13, 0) |
| 1616 |
attribs[i].type = VASurfaceAttribPixelFormat; |
| 1617 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1618 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1619 |
attribs[i].value.value.i = VA_FOURCC_XYUV; |
| 1620 |
i++; |
| 1621 |
#endif |
| 1622 |
|
| 1623 |
attribs[i].type = VASurfaceAttribPixelFormat; |
| 1624 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1625 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1626 |
attribs[i].value.value.i = VA_FOURCC_Y410; |
| 1627 |
i++; |
| 1628 |
} |
| 1629 |
else if (profile == VAProfileJPEGBaseline) |
| 1630 |
{ |
| 1631 |
for (int32_t j = 0; j < m_numJpegSurfaceAttr; j++) |
| 1632 |
{ |
| 1633 |
attribs[i].type = VASurfaceAttribPixelFormat; |
| 1634 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1635 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1636 |
attribs[i].value.value.i = m_jpegSurfaceAttr[j]; |
| 1637 |
i++; |
| 1638 |
} |
| 1639 |
} |
| 1640 |
else |
| 1641 |
{ |
| 1642 |
attribs[i].type = VASurfaceAttribPixelFormat; |
| 1643 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1644 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1645 |
attribs[i].value.value.i = VA_FOURCC('N', 'V', '1', '2'); |
| 1646 |
i++; |
| 1647 |
} |
| 1648 |
|
| 1649 |
auto maxWidth = m_decDefaultMaxWidth; |
| 1650 |
auto maxHeight = m_decDefaultMaxHeight; |
| 1651 |
if(IsMpeg2Profile(profile)) |
| 1652 |
{ |
| 1653 |
maxWidth = m_decMpeg2MaxWidth; |
| 1654 |
maxHeight = m_decMpeg2MaxHeight; |
| 1655 |
} |
| 1656 |
else if(IsAvcProfile(profile)) |
| 1657 |
{ |
| 1658 |
maxWidth = m_decAvcMaxWidth; |
| 1659 |
maxHeight = m_decAvcMaxWidth; |
| 1660 |
} |
| 1661 |
else if(IsHevcProfile(profile)) |
| 1662 |
{ |
| 1663 |
maxWidth = m_decHevcMax16kWidth; |
| 1664 |
maxHeight = m_decHevcMax16kWidth; |
| 1665 |
} |
| 1666 |
else if(IsVc1Profile(profile)) |
| 1667 |
{ |
| 1668 |
maxWidth = m_decVc1MaxWidth; |
| 1669 |
maxHeight = m_decVc1MaxHeight; |
| 1670 |
} |
| 1671 |
else if(IsJpegProfile(profile)) |
| 1672 |
{ |
| 1673 |
maxWidth = m_decJpegMaxWidth; |
| 1674 |
maxHeight = m_decJpegMaxHeight; |
| 1675 |
} |
| 1676 |
else if(IsVp9Profile(profile)) |
| 1677 |
{ |
| 1678 |
maxWidth = m_decVp9Max16kWidth; |
| 1679 |
maxHeight = m_decVp9Max16kHeight; |
| 1680 |
} |
| 1681 |
else if(IsAV1Profile(profile)) |
| 1682 |
{ |
| 1683 |
maxWidth = m_decAv1Max16kWidth; |
| 1684 |
maxHeight = m_decAv1Max16kHeight; |
| 1685 |
} |
| 1686 |
|
| 1687 |
attribs[i].type = VASurfaceAttribMaxWidth; |
| 1688 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1689 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE; |
| 1690 |
attribs[i].value.value.i = maxWidth; |
| 1691 |
i++; |
| 1692 |
|
| 1693 |
attribs[i].type = VASurfaceAttribMaxHeight; |
| 1694 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1695 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE; |
| 1696 |
attribs[i].value.value.i = maxHeight; |
| 1697 |
i++; |
| 1698 |
|
| 1699 |
attribs[i].type = VASurfaceAttribMemoryType; |
| 1700 |
attribs[i].value.type = VAGenericValueTypeInteger; |
| 1701 |
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; |
| 1702 |
attribs[i].value.value.i = VA_SURFACE_ATTRIB_MEM_TYPE_VA | |
| 1703 |
#if VA_CHECK_VERSION(1, 21, 0) |
| 1704 |
VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_3 | |
| 1705 |
#endif |
| 1706 |
VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2; |
| 1707 |
i++; |
| 1708 |
} |
| 1709 |
else if(entrypoint == VAEntrypointEncSlice || entrypoint == VAEntrypointEncSliceLP || entrypoint == VAEntrypointEncPicture || entrypoint == VAEntrypointFEI) |
| 1710 |
{ |
| 1711 |
AddEncSurfaceAttributes(profile, entrypoint, attribs, i); |
| 1712 |
} |
| 1713 |
else |
| 1714 |
{ |
| 1715 |
MOS_FreeMemory(attribs); |
| 1716 |
return VA_STATUS_ERROR_UNIMPLEMENTED; |
| 1717 |
} |
| 1718 |
|
| 1719 |
if (i > *numAttribs) |
| 1720 |
{ |
| 1721 |
*numAttribs = i; |
| 1722 |
MOS_FreeMemory(attribs); |
| 1723 |
return VA_STATUS_ERROR_MAX_NUM_EXCEEDED; |
| 1724 |
} |
| 1725 |
|
| 1726 |
*numAttribs = i; |
| 1727 |
MOS_SecureMemcpy(attribList, i * sizeof(*attribs), attribs, i * sizeof(*attribs)); |
| 1728 |
|
| 1729 |
MOS_FreeMemory(attribs); |
| 1730 |
return status; |
| 1731 |
} |
| 1732 |
|
| 1733 |
VAStatus MediaLibvaCapsG12::CreateEncAttributes( |
| 1734 |
VAProfile profile, |
| 1735 |
VAEntrypoint entrypoint, |
| 1736 |
AttribMap **attributeList) |
| 1737 |
{ |
| 1738 |
if(IsVp8Profile(profile)) |
| 1739 |
{ |
| 1740 |
return VA_STATUS_ERROR_UNSUPPORTED_PROFILE; |
| 1741 |
} |
| 1742 |
|
| 1743 |
DDI_CHK_NULL(attributeList, "Null pointer", VA_STATUS_ERROR_INVALID_PARAMETER); |
| 1744 |
|
| 1745 |
VAStatus status = CreateAttributeList(attributeList); |
| 1746 |
DDI_CHK_RET(status, "Failed to initialize Caps!"); |
| 1747 |
|
| 1748 |
auto attribList = *attributeList; |
| 1749 |
DDI_CHK_NULL(attribList, "Null pointer", VA_STATUS_ERROR_INVALID_PARAMETER); |
| 1750 |
|
| 1751 |
VAConfigAttrib attrib; |
| 1752 |
attrib.type = VAConfigAttribRTFormat; |
| 1753 |
status = CheckEncRTFormat(profile, entrypoint, &attrib); |
| 1754 |
DDI_CHK_RET(status, "Failed to Check Encode RT Format!"); |
| 1755 |
(*attribList)[attrib.type] = attrib.value; |
| 1756 |
|
| 1757 |
attrib.type = VAConfigAttribMaxPictureWidth; |
| 1758 |
GetPlatformSpecificAttrib(profile, entrypoint, |
| 1759 |
VAConfigAttribMaxPictureWidth, &attrib.value); |
| 1760 |
(*attribList)[attrib.type] = attrib.value; |
| 1761 |
|
| 1762 |
attrib.type = VAConfigAttribMaxPictureHeight; |
| 1763 |
GetPlatformSpecificAttrib(profile, entrypoint, |
| 1764 |
VAConfigAttribMaxPictureHeight, &attrib.value); |
| 1765 |
(*attribList)[attrib.type] = attrib.value; |
| 1766 |
|
| 1767 |
if (profile == VAProfileJPEGBaseline) |
| 1768 |
{ |
| 1769 |
attrib.type = VAConfigAttribEncJPEG; |
| 1770 |
attrib.value = |
| 1771 |
((JPEG_MAX_QUANT_TABLE << 14) | // max_num_quantization_tables : 3 |
| 1772 |
(JPEG_MAX_NUM_HUFF_TABLE_INDEX << 11) | // max_num_huffman_tables : 3 |
| 1773 |
(1 << 7) | // max_num_scans : 4 |
| 1774 |
(jpegNumComponent << 4)); // max_num_components : 3 |
| 1775 |
// arithmatic_coding_mode = 0 |
| 1776 |
// progressive_dct_mode = 0 |
| 1777 |
// non_interleaved_mode = 0 |
| 1778 |
// differential_mode = 0 |
| 1779 |
(*attribList)[attrib.type] = attrib.value; |
| 1780 |
} |
| 1781 |
|
| 1782 |
attrib.type = VAConfigAttribEncQualityRange; |
| 1783 |
if (profile == VAProfileJPEGBaseline) |
| 1784 |
{ |
| 1785 |
// JPEG has no target usage. |
| 1786 |
attrib.value = 1; |
| 1787 |
} |
| 1788 |
else |
| 1789 |
{ |
| 1790 |
attrib.value = NUM_TARGET_USAGE_MODES - 1;// Indicates TUs from 1 upto the value reported are supported |
| 1791 |
} |
| 1792 |
(*attribList)[attrib.type] = attrib.value; |
| 1793 |
|
| 1794 |
attrib.type = VAConfigAttribEncPackedHeaders; |
| 1795 |
attrib.value = VA_ATTRIB_NOT_SUPPORTED; |
| 1796 |
if ((IsAvcProfile(profile))||(IsHevcProfile(profile))) |
| 1797 |
{ |
| 1798 |
attrib.value = VA_ENC_PACKED_HEADER_PICTURE | |
| 1799 |
VA_ENC_PACKED_HEADER_SEQUENCE | |
| 1800 |
VA_ENC_PACKED_HEADER_SLICE | |
| 1801 |
VA_ENC_PACKED_HEADER_RAW_DATA | |
| 1802 |
VA_ENC_PACKED_HEADER_MISC; |
| 1803 |
} |
| 1804 |
else if (IsMpeg2Profile(profile)) |
| 1805 |
{ |
| 1806 |
attrib.value = VA_ENC_PACKED_HEADER_RAW_DATA; |
| 1807 |
} |
| 1808 |
else if(IsJpegProfile(profile)) |
| 1809 |
{ |
| 1810 |
attrib.value = VA_ENC_PACKED_HEADER_RAW_DATA; |
| 1811 |
} |
| 1812 |
else if(IsVp9Profile(profile)) |
| 1813 |
{ |
| 1814 |
attrib.value = VA_ENC_PACKED_HEADER_RAW_DATA; |
| 1815 |
} |
| 1816 |
|
| 1817 |
(*attribList)[attrib.type] = attrib.value; |
| 1818 |
if(IsJpegProfile(profile)) |
| 1819 |
{ |
| 1820 |
return status; |
| 1821 |
} |
| 1822 |
|
| 1823 |
attrib.type = VAConfigAttribRateControl; |
| 1824 |
attrib.value = VA_RC_CQP; |
| 1825 |
if (entrypoint != VAEntrypointEncSliceLP || |
| 1826 |
(entrypoint == VAEntrypointEncSliceLP && |
| 1827 |
MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEnableMediaKernels) && |
| 1828 |
!IsHevcSccProfile(profile))) // Currently, SCC doesn't support BRC |
| 1829 |
{ |
| 1830 |
attrib.value |= VA_RC_CBR | VA_RC_VBR | VA_RC_MB; |
| 1831 |
if (IsHevcProfile(profile)) |
| 1832 |
{ |
| 1833 |
if (entrypoint != VAEntrypointEncSliceLP) |
| 1834 |
{ |
| 1835 |
attrib.value |= VA_RC_ICQ; |
| 1836 |
} |
| 1837 |
#if VA_CHECK_VERSION(1, 10, 0) |
| 1838 |
else |
| 1839 |
{ |
| 1840 |
attrib.value |= VA_RC_TCBRC; |
| 1841 |
} |
| 1842 |
#endif |
| 1843 |
attrib.value |= VA_RC_VCM | VA_RC_QVBR; |
| 1844 |
} |
| 1845 |
if (IsVp9Profile(profile)) |
| 1846 |
{ |
| 1847 |
attrib.value |= VA_RC_ICQ; |
| 1848 |
} |
| 1849 |
} |
| 1850 |
if (IsAvcProfile(profile) && (entrypoint != VAEntrypointEncSliceLP)) |
| 1851 |
{ |
| 1852 |
attrib.value |= VA_RC_ICQ | VA_RC_VCM | VA_RC_QVBR | VA_RC_AVBR; |
| 1853 |
} |
| 1854 |
if (IsAvcProfile(profile) && |
| 1855 |
((entrypoint == VAEntrypointEncSliceLP) && MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEnableMediaKernels))) |
| 1856 |
{ |
| 1857 |
attrib.value |= VA_RC_QVBR; |
| 1858 |
#if VA_CHECK_VERSION(1, 10, 0) |
| 1859 |
attrib.value |= VA_RC_TCBRC; |
| 1860 |
#endif |
| 1861 |
} |
| 1862 |
if(entrypoint == VAEntrypointFEI) |
| 1863 |
{ |
| 1864 |
attrib.value = VA_RC_CQP; |
| 1865 |
} |
| 1866 |
else if(entrypoint == VAEntrypointStats) |
| 1867 |
{ |
| 1868 |
attrib.value = VA_RC_NONE; |
| 1869 |
} |
| 1870 |
(*attribList)[attrib.type] = attrib.value; |
| 1871 |
|
| 1872 |
attrib.type = VAConfigAttribEncInterlaced; |
| 1873 |
attrib.value = VA_ENC_INTERLACED_NONE; |
| 1874 |
#ifndef ANDROID |
| 1875 |
if(IsAvcProfile(profile) && (entrypoint != VAEntrypointEncSliceLP)) |
| 1876 |
{ |
| 1877 |
attrib.value = VA_ENC_INTERLACED_FIELD; |
| 1878 |
} |
| 1879 |
if(IsMpeg2Profile(profile)) |
| 1880 |
{ |
| 1881 |
attrib.value = VA_ENC_INTERLACED_FRAME; |
| 1882 |
} |
| 1883 |
#endif |
| 1884 |
(*attribList)[attrib.type] = attrib.value; |
| 1885 |
|
| 1886 |
attrib.type = VAConfigAttribEncMaxRefFrames; |
| 1887 |
if (entrypoint == VAEntrypointEncSliceLP) |
| 1888 |
{ |
| 1889 |
attrib.value = DDI_CODEC_VDENC_MAX_L0_REF_FRAMES | (DDI_CODEC_VDENC_MAX_L1_REF_FRAMES << DDI_CODEC_LEFT_SHIFT_FOR_REFLIST1); |
| 1890 |
if (IsHevcProfile(profile)) |
| 1891 |
{ |
| 1892 |
attrib.value = DDI_CODEC_VDENC_MAX_L0_REF_FRAMES_LDB | (DDI_CODEC_VDENC_MAX_L1_REF_FRAMES_LDB << DDI_CODEC_LEFT_SHIFT_FOR_REFLIST1); |
| 1893 |
} |
| 1894 |
} |
| 1895 |
else |
| 1896 |
{ |
| 1897 |
// default value: 1 frame for each reference list |
| 1898 |
attrib.value = 1 | (1 << 16); |
| 1899 |
if(IsAvcProfile(profile)) |
| 1900 |
{ |
| 1901 |
attrib.value = CODECHAL_ENCODE_NUM_MAX_VME_L0_REF | (CODECHAL_ENCODE_NUM_MAX_VME_L1_REF << 16); |
| 1902 |
} |
| 1903 |
if(IsVp8Profile(profile)) |
| 1904 |
{ |
| 1905 |
attrib.value = ENCODE_VP8_NUM_MAX_L0_REF ; |
| 1906 |
} |
| 1907 |
if(IsVp9Profile(profile)) |
| 1908 |
{ |
| 1909 |
attrib.value = ENCODE_VP9_NUM_MAX_L0_REF; |
| 1910 |
} |
| 1911 |
if (IsHevcProfile(profile)) |
| 1912 |
{ |
| 1913 |
GetPlatformSpecificAttrib(profile, entrypoint, |
| 1914 |
VAConfigAttribEncMaxRefFrames, &attrib.value); |
| 1915 |
} |
| 1916 |
} |
| 1917 |
(*attribList)[attrib.type] = attrib.value; |
| 1918 |
|
| 1919 |
attrib.type = VAConfigAttribEncMaxSlices; |
| 1920 |
if (entrypoint == VAEntrypointEncSliceLP) |
| 1921 |
{ |
| 1922 |
if (IsAvcProfile(profile)) |
| 1923 |
{ |
| 1924 |
attrib.value = ENCODE_AVC_MAX_SLICES_SUPPORTED; |
| 1925 |
} |
| 1926 |
else if (IsHevcProfile(profile)) |
| 1927 |
{ |
| 1928 |
attrib.value = ENCODE_HEVC_VDENC_NUM_MAX_SLICES; |
| 1929 |
} |
| 1930 |
} |
| 1931 |
else |
| 1932 |
{ |
| 1933 |
attrib.value = 0; |
| 1934 |
if (IsAvcProfile(profile)) |
| 1935 |
{ |
| 1936 |
attrib.value = ENCODE_AVC_MAX_SLICES_SUPPORTED; |
| 1937 |
} |
| 1938 |
else if (IsHevcProfile(profile)) |
| 1939 |
{ |
| 1940 |
GetPlatformSpecificAttrib(profile, entrypoint, |
| 1941 |
VAConfigAttribEncMaxSlices, &attrib.value); |
| 1942 |
} |
| 1943 |
} |
| 1944 |
(*attribList)[attrib.type] = attrib.value; |
| 1945 |
|
| 1946 |
attrib.type = VAConfigAttribEncSliceStructure; |
| 1947 |
if (entrypoint == VAEntrypointEncSliceLP) |
| 1948 |
{ |
| 1949 |
if (IsHevcProfile(profile)) |
| 1950 |
{ |
| 1951 |
attrib.value = VA_ENC_SLICE_STRUCTURE_POWER_OF_TWO_ROWS | VA_ENC_SLICE_STRUCTURE_EQUAL_ROWS | |
| 1952 |
VA_ENC_SLICE_STRUCTURE_MAX_SLICE_SIZE | VA_ENC_SLICE_STRUCTURE_ARBITRARY_ROWS | VA_ENC_SLICE_STRUCTURE_EQUAL_MULTI_ROWS; |
| 1953 |
} |
| 1954 |
else |
| 1955 |
{ |
| 1956 |
attrib.value = VA_ENC_SLICE_STRUCTURE_EQUAL_ROWS | VA_ENC_SLICE_STRUCTURE_MAX_SLICE_SIZE | |
| 1957 |
VA_ENC_SLICE_STRUCTURE_EQUAL_MULTI_ROWS | VA_ENC_SLICE_STRUCTURE_ARBITRARY_ROWS; |
| 1958 |
} |
| 1959 |
} |
| 1960 |
else |
| 1961 |
{ |
| 1962 |
attrib.value = VA_ENC_SLICE_STRUCTURE_ARBITRARY_MACROBLOCKS; |
| 1963 |
} |
| 1964 |
(*attribList)[attrib.type] = attrib.value; |
| 1965 |
|
| 1966 |
attrib.type = VAConfigAttribEncQuantization; |
| 1967 |
if(IsAvcProfile(profile)) |
| 1968 |
{ |
| 1969 |
attrib.value = VA_ENC_QUANTIZATION_TRELLIS_SUPPORTED; |
| 1970 |
} |
| 1971 |
else |
| 1972 |
{ |
| 1973 |
attrib.value = VA_ENC_QUANTIZATION_NONE; |
| 1974 |
} |
| 1975 |
(*attribList)[attrib.type] = attrib.value; |
| 1976 |
|
| 1977 |
attrib.type = VAConfigAttribEncIntraRefresh; |
| 1978 |
attrib.value = VA_ENC_INTRA_REFRESH_NONE; |
| 1979 |
GetPlatformSpecificAttrib(profile, entrypoint, |
| 1980 |
VAConfigAttribEncIntraRefresh, &attrib.value); |
| 1981 |
(*attribList)[attrib.type] = attrib.value; |
| 1982 |
|
| 1983 |
attrib.type = VAConfigAttribEncSkipFrame; |
| 1984 |
if (entrypoint == VAEntrypointEncSliceLP) |
| 1985 |
{ |
| 1986 |
if (IsAvcProfile(profile)) |
| 1987 |
{ |
| 1988 |
attrib.value = 1; |
| 1989 |
} |
| 1990 |
else |
| 1991 |
{ |
| 1992 |
attrib.value = 0; |
| 1993 |
} |
| 1994 |
} |
| 1995 |
else |
| 1996 |
{ |
| 1997 |
attrib.value = 1; |
| 1998 |
} |
| 1999 |
(*attribList)[attrib.type] = attrib.value; |
| 2000 |
|
| 2001 |
attrib.type = VAConfigAttribEncryption; |
| 2002 |
attrib.value = VA_ATTRIB_NOT_SUPPORTED; |
| 2003 |
if (m_isEntryptSupported) |
| 2004 |
{ |
| 2005 |
attrib.value = 0; |
| 2006 |
uint32_t encryptTypes[DDI_CP_ENCRYPT_TYPES_NUM] = {0}; |
| 2007 |
int32_t numTypes = m_CapsCp->GetEncryptionTypes(profile, |
| 2008 |
encryptTypes, DDI_CP_ENCRYPT_TYPES_NUM); |
| 2009 |
if (numTypes > 0) |
| 2010 |
{ |
| 2011 |
for (int32_t j = 0; j < numTypes; j++) |
| 2012 |
{ |
| 2013 |
attrib.value |= encryptTypes[j]; |
| 2014 |
} |
| 2015 |
} |
| 2016 |
} |
| 2017 |
(*attribList)[attrib.type] = attrib.value; |
| 2018 |
|
| 2019 |
attrib.type = VAConfigAttribEncROI; |
| 2020 |
if (entrypoint == VAEntrypointEncSliceLP) |
| 2021 |
{ |
| 2022 |
VAConfigAttribValEncROI roi_attrib = {0}; |
| 2023 |
if (IsAvcProfile(profile)) |
| 2024 |
{ |
| 2025 |
roi_attrib.bits.num_roi_regions = ENCODE_VDENC_AVC_MAX_ROI_NUMBER_ADV; |
| 2026 |
} |
| 2027 |
else if (IsHevcProfile(profile)) |
| 2028 |
{ |
| 2029 |
roi_attrib.bits.num_roi_regions = CODECHAL_ENCODE_HEVC_MAX_NUM_ROI; |
| 2030 |
} |
| 2031 |
|
| 2032 |
roi_attrib.bits.roi_rc_priority_support = 0; |
| 2033 |
roi_attrib.bits.roi_rc_qp_delta_support = 1; |
| 2034 |
|
| 2035 |
attrib.value = roi_attrib.value; |
| 2036 |
} |
| 2037 |
else |
| 2038 |
{ |
| 2039 |
GetPlatformSpecificAttrib(profile, entrypoint, |
| 2040 |
VAConfigAttribEncROI, &attrib.value); |
| 2041 |
} |
| 2042 |
(*attribList)[attrib.type] = attrib.value; |
| 2043 |
|
| 2044 |
attrib.type = VAConfigAttribProcessingRate; |
| 2045 |
attrib.value = VA_PROCESSING_RATE_ENCODE; |
| 2046 |
(*attribList)[attrib.type] = attrib.value; |
| 2047 |
|
| 2048 |
attrib.type = (VAConfigAttribType)VAConfigAttribEncDirtyRect; |
| 2049 |
if((entrypoint == VAEntrypointEncSliceLP) && IsHevcProfile(profile)) |
| 2050 |
{ |
| 2051 |
attrib.value = CODECHAL_ENCODE_HEVC_MAX_NUM_DIRTYRECT; |
| 2052 |
} |
| 2053 |
else |
| 2054 |
{ |
| 2055 |
attrib.value = 4; |
| 2056 |
} |
| 2057 |
|
| 2058 |
(*attribList)[attrib.type] = attrib.value; |
| 2059 |
|
| 2060 |
attrib.type = VAConfigAttribEncParallelRateControl; |
| 2061 |
if(entrypoint == VAEntrypointEncSliceLP) |
| 2062 |
{ |
| 2063 |
attrib.value = 0; |
| 2064 |
} |
| 2065 |
else |
| 2066 |
{ |
| 2067 |
attrib.value = 1; |
| 2068 |
} |
| 2069 |
(*attribList)[attrib.type] = attrib.value; |
| 2070 |
|
| 2071 |
if ((entrypoint == VAEntrypointFEI) && (IsAvcProfile(profile) || IsHevcProfile(profile))) |
| 2072 |
{ |
| 2073 |
attrib.type = (VAConfigAttribType)VAConfigAttribFEIFunctionType; |
| 2074 |
attrib.value = IsAvcProfile(profile) ? |
| 2075 |
(VA_FEI_FUNCTION_ENC | VA_FEI_FUNCTION_PAK | VA_FEI_FUNCTION_ENC_PAK) : |
| 2076 |
VA_FEI_FUNCTION_ENC_PAK; |
| 2077 |
(*attribList)[attrib.type] = attrib.value; |
| 2078 |
} |
| 2079 |
|
| 2080 |
attrib.type = (VAConfigAttribType)VAConfigAttribFEIMVPredictors; |
| 2081 |
attrib.value = 0; |
| 2082 |
if(IsAvcProfile(profile) || IsHevcProfile(profile)) |
| 2083 |
{ |
| 2084 |
attrib.value = DDI_CODEC_FEI_MAX_NUM_MVPREDICTOR; |
| 2085 |
} |
| 2086 |
(*attribList)[attrib.type] = attrib.value; |
| 2087 |
|
| 2088 |
if(profile == VAProfileNone) |
| 2089 |
{ |
| 2090 |
attrib.type = (VAConfigAttribType)VAConfigAttribStats; |
| 2091 |
VAConfigAttribValStats attribValStats; |
| 2092 |
memset(&attribValStats, 0, sizeof(attribValStats)); |
| 2093 |
attribValStats.bits.max_num_past_references = DDI_CODEC_STATS_MAX_NUM_PAST_REFS; |
| 2094 |
attribValStats.bits.max_num_future_references = DDI_CODEC_STATS_MAX_NUM_FUTURE_REFS; |
| 2095 |
attribValStats.bits.num_outputs = DDI_CODEC_STATS_MAX_NUM_OUTPUTS; |
| 2096 |
attribValStats.bits.interlaced = DDI_CODEC_STATS_INTERLACED_SUPPORT; |
| 2097 |
attrib.value = attribValStats.value; |
| 2098 |
(*attribList)[attrib.type] = attrib.value; |
| 2099 |
} |
| 2100 |
|
| 2101 |
attrib.type = (VAConfigAttribType)VAConfigAttribCustomRoundingControl; |
| 2102 |
GetPlatformSpecificAttrib(profile, entrypoint, |
| 2103 |
(VAConfigAttribType)VAConfigAttribCustomRoundingControl, &attrib.value); |
| 2104 |
(*attribList)[attrib.type] = attrib.value; |
| 2105 |
|
| 2106 |
if (IsAvcProfile(profile) || IsHevcProfile(profile) ) |
| 2107 |
{ |
| 2108 |
attrib.type = (VAConfigAttribType)VAConfigAttribMaxFrameSize; |
| 2109 |
VAConfigAttribValMaxFrameSize attribValMaxFrameSize; |
| 2110 |
memset(&attribValMaxFrameSize, 0, sizeof(attribValMaxFrameSize)); |
| 2111 |
attribValMaxFrameSize.bits.max_frame_size = 1; |
| 2112 |
attribValMaxFrameSize.bits.multiple_pass = 1; |
| 2113 |
attribValMaxFrameSize.bits.reserved = 0; |
| 2114 |
attrib.value = attribValMaxFrameSize.value; |
| 2115 |
(*attribList)[attrib.type] = attrib.value; |
| 2116 |
} |
| 2117 |
|
| 2118 |
if (IsHevcProfile(profile)) |
| 2119 |
{ |
| 2120 |
attrib.type = (VAConfigAttribType) VAConfigAttribPredictionDirection; |
| 2121 |
GetPlatformSpecificAttrib(profile, entrypoint, |
| 2122 |
(VAConfigAttribType)VAConfigAttribPredictionDirection, &attrib.value); |
| 2123 |
(*attribList)[attrib.type] = attrib.value; |
| 2124 |
#if VA_CHECK_VERSION(1, 12, 0) |
| 2125 |
attrib.type = (VAConfigAttribType)VAConfigAttribEncHEVCFeatures; |
| 2126 |
GetPlatformSpecificAttrib(profile, entrypoint, |
| 2127 |
(VAConfigAttribType)VAConfigAttribEncHEVCFeatures, &attrib.value); |
| 2128 |
(*attribList)[attrib.type] = attrib.value; |
| 2129 |
attrib.type = (VAConfigAttribType)VAConfigAttribEncHEVCBlockSizes; |
| 2130 |
GetPlatformSpecificAttrib(profile, entrypoint, |
| 2131 |
(VAConfigAttribType)VAConfigAttribEncHEVCBlockSizes, &attrib.value); |
| 2132 |
(*attribList)[attrib.type] = attrib.value; |
| 2133 |
#endif |
| 2134 |
} |
| 2135 |
|
| 2136 |
return status; |
| 2137 |
} |
| 2138 |
|
| 2139 |
VAStatus MediaLibvaCapsG12::CreateDecAttributes( |
| 2140 |
VAProfile profile, |
| 2141 |
VAEntrypoint entrypoint, |
| 2142 |
AttribMap **attributeList) |
| 2143 |
{ |
| 2144 |
DDI_CHK_NULL(attributeList, "Null pointer", VA_STATUS_ERROR_INVALID_PARAMETER); |
| 2145 |
|
| 2146 |
VAStatus status = CreateAttributeList(attributeList); |
| 2147 |
DDI_CHK_RET(status, "Failed to initialize Caps!"); |
| 2148 |
|
| 2149 |
auto attribList = *attributeList; |
| 2150 |
DDI_CHK_NULL(attribList, "Null pointer", VA_STATUS_ERROR_INVALID_PARAMETER); |
| 2151 |
|
| 2152 |
VAConfigAttrib attrib; |
| 2153 |
attrib.type = VAConfigAttribRTFormat; |
| 2154 |
if ( profile == VAProfileJPEGBaseline ) |
| 2155 |
{ |
| 2156 |
// at present, latest libva have not support RGB24. |
| 2157 |
attrib.value = VA_RT_FORMAT_YUV420 | VA_RT_FORMAT_YUV422 | VA_RT_FORMAT_YUV444 | VA_RT_FORMAT_YUV400 | VA_RT_FORMAT_YUV411 | VA_RT_FORMAT_RGB16 | VA_RT_FORMAT_RGB32; |
| 2158 |
} |
| 2159 |
else if(profile == VAProfileHEVCMain) |
| 2160 |
{ |
| 2161 |
attrib.value = VA_RT_FORMAT_YUV420; |
| 2162 |
} |
| 2163 |
else if(profile == VAProfileHEVCMain10) |
| 2164 |
{ |
| 2165 |
attrib.value = VA_RT_FORMAT_YUV420 |
| 2166 |
| VA_RT_FORMAT_YUV420_10BPP; |
| 2167 |
} |
| 2168 |
else if(profile == VAProfileHEVCMain12) |
| 2169 |
{ |
| 2170 |
attrib.value = VA_RT_FORMAT_YUV420 |
| 2171 |
| VA_RT_FORMAT_YUV420_10BPP |
| 2172 |
| VA_RT_FORMAT_YUV420_12 |
| 2173 |
| VA_RT_FORMAT_YUV400; |
| 2174 |
} |
| 2175 |
else if(profile == VAProfileHEVCMain422_10) |
| 2176 |
{ |
| 2177 |
attrib.value = VA_RT_FORMAT_YUV420 |
| 2178 |
| VA_RT_FORMAT_YUV420_10BPP |
| 2179 |
| VA_RT_FORMAT_YUV422 |
| 2180 |
| VA_RT_FORMAT_YUV422_10 |
| 2181 |
| VA_RT_FORMAT_YUV400; |
| 2182 |
} |
| 2183 |
else if(profile == VAProfileHEVCMain422_12) |
| 2184 |
{ |
| 2185 |
attrib.value = VA_RT_FORMAT_YUV420 |
| 2186 |
| VA_RT_FORMAT_YUV420_10BPP |
| 2187 |
| VA_RT_FORMAT_YUV420_12 |
| 2188 |
| VA_RT_FORMAT_YUV422 |
| 2189 |
| VA_RT_FORMAT_YUV422_10 |
| 2190 |
| VA_RT_FORMAT_YUV422_12 |
| 2191 |
| VA_RT_FORMAT_YUV400; |
| 2192 |
} |
| 2193 |
else if(profile == VAProfileHEVCMain444 || profile == VAProfileHEVCSccMain444) |
| 2194 |
{ |
| 2195 |
attrib.value = VA_RT_FORMAT_YUV420 |
| 2196 |
| VA_RT_FORMAT_YUV422 |
| 2197 |
| VA_RT_FORMAT_YUV444 |
| 2198 |
| VA_RT_FORMAT_YUV400; |
| 2199 |
} |
| 2200 |
else if(profile == VAProfileHEVCMain444_10 || profile == VAProfileHEVCSccMain444_10) |
| 2201 |
{ |
| 2202 |
attrib.value = VA_RT_FORMAT_YUV420 |
| 2203 |
| VA_RT_FORMAT_YUV420_10BPP |
| 2204 |
| VA_RT_FORMAT_YUV422 |
| 2205 |
| VA_RT_FORMAT_YUV422_10 |
| 2206 |
| VA_RT_FORMAT_YUV444 |
| 2207 |
| VA_RT_FORMAT_YUV444_10 |
| 2208 |
| VA_RT_FORMAT_YUV400; |
| 2209 |
} |
| 2210 |
else if(profile == VAProfileHEVCMain444_12) |
| 2211 |
{ |
| 2212 |
attrib.value = VA_RT_FORMAT_YUV420 |
| 2213 |
| VA_RT_FORMAT_YUV420_10BPP |
| 2214 |
| VA_RT_FORMAT_YUV420_12 |
| 2215 |
| VA_RT_FORMAT_YUV422 |
| 2216 |
| VA_RT_FORMAT_YUV422_10 |
| 2217 |
| VA_RT_FORMAT_YUV422_12 |
| 2218 |
| VA_RT_FORMAT_YUV444 |
| 2219 |
| VA_RT_FORMAT_YUV444_10 |
| 2220 |
| VA_RT_FORMAT_YUV444_12 |
| 2221 |
| VA_RT_FORMAT_YUV400; |
| 2222 |
} |
| 2223 |
else if(profile == VAProfileHEVCSccMain) |
| 2224 |
{ |
| 2225 |
attrib.value = VA_RT_FORMAT_YUV420 |
| 2226 |
| VA_RT_FORMAT_YUV400; |
| 2227 |
} |
| 2228 |
else if(profile == VAProfileHEVCSccMain10) |
| 2229 |
{ |
| 2230 |
attrib.value = VA_RT_FORMAT_YUV420 |
| 2231 |
| VA_RT_FORMAT_YUV420_10BPP |
| 2232 |
| VA_RT_FORMAT_YUV400; |
| 2233 |
} |
| 2234 |
else if (profile == VAProfileVP9Profile0) |
| 2235 |
{ |
| 2236 |
attrib.value = VA_RT_FORMAT_YUV420; |
| 2237 |
} |
| 2238 |
else if (profile == VAProfileVP9Profile1) |
| 2239 |
{ |
| 2240 |
attrib.value = VA_RT_FORMAT_YUV422 |
| 2241 |
| VA_RT_FORMAT_YUV444; |
| 2242 |
} |
| 2243 |
else if (profile == VAProfileVP9Profile2) |
| 2244 |
{ |
| 2245 |
attrib.value = VA_RT_FORMAT_YUV420_10BPP |
| 2246 |
| VA_RT_FORMAT_YUV420_12; |
| 2247 |
} |
| 2248 |
else if (profile == VAProfileVP9Profile3) |
| 2249 |
{ |
| 2250 |
attrib.value = VA_RT_FORMAT_YUV422_10 |
| 2251 |
| VA_RT_FORMAT_YUV444_10 |
| 2252 |
| VA_RT_FORMAT_YUV422_12 |
| 2253 |
| VA_RT_FORMAT_YUV444_12; |
| 2254 |
} |
| 2255 |
else if (profile == VAProfileAV1Profile0) |
| 2256 |
{ |
| 2257 |
attrib.value = VA_RT_FORMAT_YUV420 | VA_RT_FORMAT_YUV420_10BPP; |
| 2258 |
} |
| 2259 |
else |
| 2260 |
{ |
| 2261 |
attrib.value = VA_RT_FORMAT_YUV420 | VA_RT_FORMAT_YUV422 | VA_RT_FORMAT_RGB32; |
| 2262 |
} |
| 2263 |
|
| 2264 |
(*attribList)[attrib.type] = attrib.value; |
| 2265 |
|
| 2266 |
attrib.type = VAConfigAttribDecSliceMode; |
| 2267 |
if (IsAvcProfile(profile)) |
| 2268 |
{ |
| 2269 |
attrib.value = VA_DEC_SLICE_MODE_NORMAL | VA_DEC_SLICE_MODE_BASE; |
| 2270 |
} |
| 2271 |
else if (IsHevcProfile(profile)) |
| 2272 |
{ |
| 2273 |
bool hevcmainProfileSupported = false; |
| 2274 |
attrib.value = 0; |
| 2275 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrIntelHEVCVLDMainDecoding) |
| 2276 |
|| MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrIntelHEVCVLDMain10Decoding) |
| 2277 |
|| MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrIntelHEVCVLDMain12bit420Decoding) |
| 2278 |
|| MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrIntelHEVCVLD42210bitDecoding) |
| 2279 |
|| MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrIntelHEVCVLDMain12bit422Decoding) |
| 2280 |
|| MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrIntelHEVCVLD4448bitDecoding) |
| 2281 |
|| MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrIntelHEVCVLD44410bitDecoding) |
| 2282 |
|| MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrIntelHEVCVLDMain12bit444Decoding) |
| 2283 |
|| MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrIntelHEVCVLDMain8bit420SCC) |
| 2284 |
|| MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrIntelHEVCVLDMain10bit420SCC) |
| 2285 |
|| MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrIntelHEVCVLDMain8bit444SCC) |
| 2286 |
|| MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrIntelHEVCVLDMain10bit444SCC)) |
| 2287 |
{ |
| 2288 |
attrib.value |= VA_DEC_SLICE_MODE_NORMAL; |
| 2289 |
hevcmainProfileSupported = true; |
| 2290 |
} |
| 2291 |
if ((MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrHEVCVLDMainShortDecoding) || |
| 2292 |
MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrHEVCVLDMain10ShortDecoding)) |
| 2293 |
&& MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEnableMediaKernels)) |
| 2294 |
{ |
| 2295 |
attrib.value |= VA_DEC_SLICE_MODE_BASE; |
| 2296 |
hevcmainProfileSupported = true; |
| 2297 |
} |
| 2298 |
if (!hevcmainProfileSupported) |
| 2299 |
{ |
| 2300 |
attrib.value = VA_ATTRIB_NOT_SUPPORTED; |
| 2301 |
} |
| 2302 |
} |
| 2303 |
else if (profile == VAProfileVP9Profile0 |
| 2304 |
|| profile == VAProfileVP9Profile2 |
| 2305 |
|| profile == VAProfileVP9Profile1 |
| 2306 |
|| profile == VAProfileVP9Profile3) |
| 2307 |
{ |
| 2308 |
bool vp9ProfileSupported = false; |
| 2309 |
attrib.value = 0; |
| 2310 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrIntelVP9VLDProfile0Decoding8bit420) |
| 2311 |
|| MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrIntelVP9VLDProfile1Decoding8bit444)) |
| 2312 |
{ |
| 2313 |
attrib.value |= VA_DEC_SLICE_MODE_NORMAL | VA_DEC_SLICE_MODE_BASE; |
| 2314 |
vp9ProfileSupported = true; |
| 2315 |
} |
| 2316 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrVP9VLD10bProfile2Decoding) |
| 2317 |
|| MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrIntelVP9VLDProfile3Decoding10bit444)) |
| 2318 |
{ |
| 2319 |
attrib.value |= VA_DEC_SLICE_MODE_NORMAL; |
| 2320 |
vp9ProfileSupported = true; |
| 2321 |
} |
| 2322 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrIntelVP9VLDProfile2Decoding12bit420) |
| 2323 |
|| MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrIntelVP9VLDProfile3Decoding12bit444)) |
| 2324 |
{ |
| 2325 |
attrib.value |= VA_DEC_SLICE_MODE_NORMAL; |
| 2326 |
vp9ProfileSupported = true; |
| 2327 |
} |
| 2328 |
|
| 2329 |
if (!vp9ProfileSupported) |
| 2330 |
{ |
| 2331 |
attrib.value = VA_ATTRIB_NOT_SUPPORTED; |
| 2332 |
} |
| 2333 |
} |
| 2334 |
else if (profile == VAProfileAV1Profile0) |
| 2335 |
{ |
| 2336 |
attrib.value = 0; |
| 2337 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrIntelAV1VLDDecoding8bit420) |
| 2338 |
|| MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrIntelAV1VLDDecoding10bit420)) |
| 2339 |
{ |
| 2340 |
attrib.value |= VA_DEC_SLICE_MODE_NORMAL | VA_DEC_SLICE_MODE_BASE; |
| 2341 |
} |
| 2342 |
else |
| 2343 |
{ |
| 2344 |
attrib.value = VA_ATTRIB_NOT_SUPPORTED; |
| 2345 |
} |
| 2346 |
} |
| 2347 |
else |
| 2348 |
{ |
| 2349 |
attrib.value = VA_DEC_SLICE_MODE_NORMAL; |
| 2350 |
} |
| 2351 |
(*attribList)[attrib.type] = attrib.value; |
| 2352 |
|
| 2353 |
attrib.type = VAConfigAttribDecProcessing; |
| 2354 |
attrib.value = VA_DEC_PROCESSING_NONE; |
| 2355 |
GetPlatformSpecificAttrib(profile, entrypoint, |
| 2356 |
VAConfigAttribDecProcessing, &attrib.value); |
| 2357 |
(*attribList)[attrib.type] = attrib.value; |
| 2358 |
|
| 2359 |
attrib.type = VAConfigAttribMaxPictureWidth; |
| 2360 |
attrib.value = CODEC_MAX_PIC_WIDTH; |
| 2361 |
if(profile == VAProfileJPEGBaseline) |
| 2362 |
{ |
| 2363 |
attrib.value = ENCODE_JPEG_MAX_PIC_WIDTH; |
| 2364 |
} |
| 2365 |
if(IsVc1Profile(profile) || IsMpeg2Profile(profile)) |
| 2366 |
{ |
| 2367 |
attrib.value = CODEC_2K_MAX_PIC_WIDTH; |
| 2368 |
} |
| 2369 |
if(IsVp8Profile(profile)) |
| 2370 |
{ |
| 2371 |
attrib.value = CODEC_4K_MAX_PIC_WIDTH; |
| 2372 |
} |
| 2373 |
if(IsAvcProfile(profile)) |
| 2374 |
{ |
| 2375 |
attrib.value = CODEC_8K_MAX_PIC_WIDTH; |
| 2376 |
} |
| 2377 |
if(IsHevcProfile(profile) || IsVp9Profile(profile) || IsAV1Profile(profile)) |
| 2378 |
{ |
| 2379 |
attrib.value = CODEC_16K_MAX_PIC_WIDTH; |
| 2380 |
} |
| 2381 |
(*attribList)[attrib.type] = attrib.value; |
| 2382 |
|
| 2383 |
attrib.type = VAConfigAttribMaxPictureHeight; |
| 2384 |
attrib.value = CODEC_MAX_PIC_HEIGHT; |
| 2385 |
if(profile == VAProfileJPEGBaseline) |
| 2386 |
{ |
| 2387 |
attrib.value = ENCODE_JPEG_MAX_PIC_HEIGHT; |
| 2388 |
} |
| 2389 |
if(IsVc1Profile(profile) || IsMpeg2Profile(profile)) |
| 2390 |
{ |
| 2391 |
attrib.value = CODEC_2K_MAX_PIC_HEIGHT; |
| 2392 |
} |
| 2393 |
if(IsVp8Profile(profile)) |
| 2394 |
{ |
| 2395 |
attrib.value = CODEC_4K_MAX_PIC_HEIGHT; |
| 2396 |
} |
| 2397 |
if(IsAvcProfile(profile)) |
| 2398 |
{ |
| 2399 |
attrib.value = CODEC_8K_MAX_PIC_HEIGHT; |
| 2400 |
} |
| 2401 |
if(IsHevcProfile(profile) || IsVp9Profile(profile) || IsAV1Profile(profile)) |
| 2402 |
{ |
| 2403 |
attrib.value = CODEC_16K_MAX_PIC_HEIGHT; |
| 2404 |
} |
| 2405 |
(*attribList)[attrib.type] = attrib.value; |
| 2406 |
|
| 2407 |
attrib.type = VAConfigAttribEncryption; |
| 2408 |
|
| 2409 |
attrib.value = VA_ATTRIB_NOT_SUPPORTED; |
| 2410 |
if (m_isEntryptSupported) |
| 2411 |
{ |
| 2412 |
uint32_t encryptTypes[DDI_CP_ENCRYPT_TYPES_NUM] = {0}; |
| 2413 |
int32_t numTypes = m_CapsCp->GetEncryptionTypes(profile, |
| 2414 |
encryptTypes, DDI_CP_ENCRYPT_TYPES_NUM); |
| 2415 |
if (numTypes > 0) |
| 2416 |
{ |
| 2417 |
attrib.value = 0; |
| 2418 |
for (int32_t j = 0; j < numTypes; j++) |
| 2419 |
{ |
| 2420 |
attrib.value |= encryptTypes[j]; |
| 2421 |
} |
| 2422 |
} |
| 2423 |
} |
| 2424 |
(*attribList)[attrib.type] = attrib.value; |
| 2425 |
|
| 2426 |
if(profile == VAProfileJPEGBaseline) |
| 2427 |
{ |
| 2428 |
attrib.type = VAConfigAttribDecJPEG; |
| 2429 |
attrib.value = ((1 << VA_ROTATION_NONE) | (1 << VA_ROTATION_90) | (1 << VA_ROTATION_180) | (1 << VA_ROTATION_270)); |
| 2430 |
(*attribList)[attrib.type] = attrib.value; |
| 2431 |
} |
| 2432 |
|
| 2433 |
if(profile == VAProfileNone) |
| 2434 |
{ |
| 2435 |
attrib.type = (VAConfigAttribType)VAConfigAttribStats; |
| 2436 |
VAConfigAttribValStats attribValStats; |
| 2437 |
memset(&attribValStats, 0, sizeof(attribValStats)); |
| 2438 |
attribValStats.bits.max_num_past_references = DDI_CODEC_STATS_MAX_NUM_PAST_REFS; |
| 2439 |
attribValStats.bits.max_num_future_references = DDI_CODEC_STATS_MAX_NUM_FUTURE_REFS; |
| 2440 |
attribValStats.bits.num_outputs = DDI_CODEC_STATS_MAX_NUM_OUTPUTS; |
| 2441 |
attribValStats.bits.interlaced = DDI_CODEC_STATS_INTERLACED_SUPPORT; |
| 2442 |
attrib.value = attribValStats.value; |
| 2443 |
(*attribList)[attrib.type] = attrib.value; |
| 2444 |
} |
| 2445 |
|
| 2446 |
attrib.type = VAConfigAttribProcessingRate; |
| 2447 |
attrib.value = VA_PROCESSING_RATE_DECODE; |
| 2448 |
(*attribList)[attrib.type] = attrib.value; |
| 2449 |
|
| 2450 |
attrib.type = (VAConfigAttribType)VAConfigAttribCustomRoundingControl; |
| 2451 |
GetPlatformSpecificAttrib(profile, entrypoint, |
| 2452 |
(VAConfigAttribType)VAConfigAttribCustomRoundingControl, &attrib.value); |
| 2453 |
(*attribList)[attrib.type] = attrib.value; |
| 2454 |
|
| 2455 |
#if VA_CHECK_VERSION(1, 11, 0) |
| 2456 |
if(IsAV1Profile(profile) && MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrAV1VLDLSTDecoding)) |
| 2457 |
{ |
| 2458 |
attrib.type = VAConfigAttribDecAV1Features; |
| 2459 |
VAConfigAttribValDecAV1Features feature = {0}; |
| 2460 |
feature.bits.lst_support = true; |
| 2461 |
attrib.value = feature.value; |
| 2462 |
(*attribList)[attrib.type] = attrib.value; |
| 2463 |
} |
| 2464 |
#endif |
| 2465 |
return status; |
| 2466 |
} |
| 2467 |
|
| 2468 |
VAStatus MediaLibvaCapsG12::LoadJpegDecProfileEntrypoints() |
| 2469 |
{ |
| 2470 |
VAStatus status = VA_STATUS_SUCCESS; |
| 2471 |
|
| 2472 |
#ifdef _JPEG_DECODE_SUPPORTED |
| 2473 |
AttribMap *attributeList = nullptr; |
| 2474 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrIntelJPEGDecoding)) |
| 2475 |
{ |
| 2476 |
status = CreateDecAttributes(VAProfileJPEGBaseline, VAEntrypointVLD, &attributeList); |
| 2477 |
DDI_CHK_RET(status, "Failed to initialize Caps!"); |
| 2478 |
|
| 2479 |
uint32_t configStartIdx = m_decConfigs.size(); |
| 2480 |
for(int32_t i = 0; i < 2; i++) |
| 2481 |
{ |
| 2482 |
AddDecConfig(VA_DEC_SLICE_MODE_NORMAL, VA_ENCRYPTION_TYPE_NONE, m_decProcessMode[i]); |
| 2483 |
} |
| 2484 |
AddProfileEntry(VAProfileJPEGBaseline, VAEntrypointVLD, attributeList, configStartIdx, 2); |
| 2485 |
} |
| 2486 |
#endif |
| 2487 |
|
| 2488 |
return status; |
| 2489 |
} |
| 2490 |
|
| 2491 |
VAStatus MediaLibvaCapsG12::LoadAv1DecProfileEntrypoints() |
| 2492 |
{ |
| 2493 |
VAStatus status = VA_STATUS_SUCCESS; |
| 2494 |
|
| 2495 |
#if _AV1_DECODE_SUPPORTED |
| 2496 |
AttribMap *attributeList = nullptr; |
| 2497 |
if ((MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrIntelAV1VLDDecoding8bit420) |
| 2498 |
||MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrIntelAV1VLDDecoding10bit420))) |
| 2499 |
{ |
| 2500 |
status = CreateDecAttributes((VAProfile) VAProfileAV1Profile0, VAEntrypointVLD, &attributeList); |
| 2501 |
DDI_CHK_RET(status, "Failed to initialize Caps!"); |
| 2502 |
|
| 2503 |
uint32_t configStartIdx = m_decConfigs.size(); |
| 2504 |
for (int32_t i = 0; i < 2; i++) |
| 2505 |
{ |
| 2506 |
AddDecConfig(m_decSliceMode[i], VA_CENC_TYPE_NONE, VA_DEC_PROCESSING_NONE); |
| 2507 |
if (m_isEntryptSupported) |
| 2508 |
{ |
| 2509 |
uint32_t encrytTypes[DDI_CP_ENCRYPT_TYPES_NUM]; |
| 2510 |
|
| 2511 |
int32_t numTypes = m_CapsCp->GetEncryptionTypes((VAProfile) VAProfileAV1Profile0, |
| 2512 |
encrytTypes, DDI_CP_ENCRYPT_TYPES_NUM); |
| 2513 |
|
| 2514 |
if (numTypes > 0) |
| 2515 |
{ |
| 2516 |
for (int32_t l = 0; l < numTypes; l++) |
| 2517 |
{ |
| 2518 |
AddDecConfig(m_decSliceMode[i], encrytTypes[l], |
| 2519 |
VA_DEC_PROCESSING_NONE); |
| 2520 |
} |
| 2521 |
} |
| 2522 |
} |
| 2523 |
} |
| 2524 |
|
| 2525 |
AddProfileEntry((VAProfile) VAProfileAV1Profile0, VAEntrypointVLD, attributeList, |
| 2526 |
configStartIdx, m_decConfigs.size() - configStartIdx); |
| 2527 |
} |
| 2528 |
|
| 2529 |
#endif |
| 2530 |
return status; |
| 2531 |
} |
| 2532 |
|
| 2533 |
VAStatus MediaLibvaCapsG12::LoadHevcDecProfileEntrypoints() |
| 2534 |
{ |
| 2535 |
VAStatus status = VA_STATUS_SUCCESS; |
| 2536 |
|
| 2537 |
#ifdef _HEVC_DECODE_SUPPORTED |
| 2538 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrIntelHEVCVLDMainDecoding) |
| 2539 |
|| MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrHEVCVLDMainShortDecoding)) |
| 2540 |
{ |
| 2541 |
LoadDecProfileEntrypoints(VAProfileHEVCMain); |
| 2542 |
} |
| 2543 |
|
| 2544 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrIntelHEVCVLDMain10Decoding) |
| 2545 |
|| MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrHEVCVLDMain10ShortDecoding)) |
| 2546 |
{ |
| 2547 |
LoadDecProfileEntrypoints(VAProfileHEVCMain10); |
| 2548 |
} |
| 2549 |
|
| 2550 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrIntelHEVCVLDMain12bit420Decoding)) |
| 2551 |
{ |
| 2552 |
LoadDecProfileEntrypoints(VAProfileHEVCMain12); |
| 2553 |
} |
| 2554 |
|
| 2555 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrIntelHEVCVLD42210bitDecoding)) |
| 2556 |
{ |
| 2557 |
LoadDecProfileEntrypoints(VAProfileHEVCMain422_10); |
| 2558 |
} |
| 2559 |
|
| 2560 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrIntelHEVCVLDMain12bit422Decoding)) |
| 2561 |
{ |
| 2562 |
LoadDecProfileEntrypoints(VAProfileHEVCMain422_12); |
| 2563 |
} |
| 2564 |
|
| 2565 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrIntelHEVCVLD4448bitDecoding)) |
| 2566 |
{ |
| 2567 |
LoadDecProfileEntrypoints(VAProfileHEVCMain444); |
| 2568 |
} |
| 2569 |
|
| 2570 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrIntelHEVCVLD44410bitDecoding)) |
| 2571 |
{ |
| 2572 |
LoadDecProfileEntrypoints(VAProfileHEVCMain444_10); |
| 2573 |
} |
| 2574 |
|
| 2575 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrIntelHEVCVLDMain12bit444Decoding)) |
| 2576 |
{ |
| 2577 |
LoadDecProfileEntrypoints(VAProfileHEVCMain444_12); |
| 2578 |
} |
| 2579 |
|
| 2580 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrIntelHEVCVLDMain8bit420SCC)) |
| 2581 |
{ |
| 2582 |
LoadDecProfileEntrypoints(VAProfileHEVCSccMain); |
| 2583 |
} |
| 2584 |
|
| 2585 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrIntelHEVCVLDMain10bit420SCC)) |
| 2586 |
{ |
| 2587 |
LoadDecProfileEntrypoints(VAProfileHEVCSccMain10); |
| 2588 |
} |
| 2589 |
|
| 2590 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrIntelHEVCVLDMain8bit444SCC)) |
| 2591 |
{ |
| 2592 |
LoadDecProfileEntrypoints(VAProfileHEVCSccMain444); |
| 2593 |
} |
| 2594 |
|
| 2595 |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrIntelHEVCVLDMain10bit444SCC)) |
| 2596 |
{ |
| 2597 |
LoadDecProfileEntrypoints(VAProfileHEVCSccMain444_10); |
| 2598 |
} |
| 2599 |
|
| 2600 |
#endif |
| 2601 |
return status; |
| 2602 |
} |
| 2603 |
|
| 2604 |
bool MediaLibvaCapsG12::IsHevcProfile(VAProfile profile) |
| 2605 |
{ |
| 2606 |
return ( |
| 2607 |
(profile == VAProfileHEVCMain) || |
| 2608 |
(profile == VAProfileHEVCMain10) || |
| 2609 |
(profile == VAProfileHEVCMain12) || |
| 2610 |
(profile == VAProfileHEVCMain422_10) || |
| 2611 |
(profile == VAProfileHEVCMain422_12) || |
| 2612 |
(profile == VAProfileHEVCMain444) || |
| 2613 |
(profile == VAProfileHEVCMain444_10) || |
| 2614 |
(profile == VAProfileHEVCMain444_12) || |
| 2615 |
(profile == VAProfileHEVCSccMain) || |
| 2616 |
(profile == VAProfileHEVCSccMain10) || |
| 2617 |
(profile == VAProfileHEVCSccMain444) || |
| 2618 |
(profile == VAProfileHEVCSccMain444_10) |
| 2619 |
); |
| 2620 |
} |
| 2621 |
|
| 2622 |
VAStatus MediaLibvaCapsG12::QueryAVCROIMaxNum(uint32_t rcMode, bool isVdenc, uint32_t *maxNum, bool *isRoiInDeltaQP) |
| 2623 |
{ |
| 2624 |
DDI_CHK_NULL(maxNum, "Null pointer", VA_STATUS_ERROR_INVALID_PARAMETER); |
| 2625 |
DDI_CHK_NULL(isRoiInDeltaQP, "Null pointer", VA_STATUS_ERROR_INVALID_PARAMETER); |
| 2626 |
|
| 2627 |
if(isVdenc) |
| 2628 |
{ |
| 2629 |
*maxNum = ENCODE_VDENC_AVC_MAX_ROI_NUMBER_ADV; |
| 2630 |
} |
| 2631 |
else |
| 2632 |
{ |
| 2633 |
switch (rcMode) |
| 2634 |
{ |
| 2635 |
case VA_RC_CQP: |
| 2636 |
*maxNum = ENCODE_DP_AVC_MAX_ROI_NUMBER; |
| 2637 |
break; |
| 2638 |
default: |
| 2639 |
*maxNum = ENCODE_DP_AVC_MAX_ROI_NUM_BRC; |
| 2640 |
break; |
| 2641 |
} |
| 2642 |
} |
| 2643 |
|
| 2644 |
*isRoiInDeltaQP = true; |
| 2645 |
|
| 2646 |
return VA_STATUS_SUCCESS; |
| 2647 |
} |
| 2648 |
|
| 2649 |
GMM_RESOURCE_FORMAT MediaLibvaCapsG12::ConvertMediaFmtToGmmFmt( |
| 2650 |
DDI_MEDIA_FORMAT format) |
| 2651 |
{ |
| 2652 |
switch (format) |
| 2653 |
{ |
| 2654 |
case Media_Format_X8R8G8B8 : return GMM_FORMAT_B8G8R8X8_UNORM_TYPE; |
| 2655 |
case Media_Format_A8R8G8B8 : return GMM_FORMAT_B8G8R8A8_UNORM_TYPE; |
| 2656 |
case Media_Format_X8B8G8R8 : return GMM_FORMAT_R8G8B8X8_UNORM_TYPE; |
| 2657 |
case Media_Format_A8B8G8R8 : return GMM_FORMAT_R8G8B8A8_UNORM_TYPE; |
| 2658 |
case Media_Format_R8G8B8A8 : return GMM_FORMAT_R8G8B8A8_UNORM_TYPE; |
| 2659 |
case Media_Format_R5G6B5 : return GMM_FORMAT_B5G6R5_UNORM_TYPE; |
| 2660 |
case Media_Format_R8G8B8 : return GMM_FORMAT_R8G8B8_UNORM; |
| 2661 |
case Media_Format_RGBP : return GMM_FORMAT_RGBP; |
| 2662 |
case Media_Format_BGRP : return GMM_FORMAT_BGRP; |
| 2663 |
case Media_Format_NV12 : return GMM_FORMAT_NV12_TYPE; |
| 2664 |
case Media_Format_NV21 : return GMM_FORMAT_NV21_TYPE; |
| 2665 |
case Media_Format_YUY2 : return GMM_FORMAT_YUY2; |
| 2666 |
case Media_Format_YVYU : return GMM_FORMAT_YVYU; |
| 2667 |
case Media_Format_UYVY : return GMM_FORMAT_UYVY; |
| 2668 |
case Media_Format_VYUY : return GMM_FORMAT_VYUY; |
| 2669 |
case Media_Format_YV12 : return GMM_FORMAT_YV12_TYPE; |
| 2670 |
case Media_Format_IYUV : return GMM_FORMAT_IYUV_TYPE; |
| 2671 |
case Media_Format_I420 : return GMM_FORMAT_I420_TYPE; |
| 2672 |
case Media_Format_444P : return GMM_FORMAT_MFX_JPEG_YUV444_TYPE; |
| 2673 |
case Media_Format_422H : return GMM_FORMAT_MFX_JPEG_YUV422H_TYPE; |
| 2674 |
case Media_Format_411P : return GMM_FORMAT_MFX_JPEG_YUV411_TYPE; |
| 2675 |
case Media_Format_422V : return GMM_FORMAT_MFX_JPEG_YUV422V_TYPE; |
| 2676 |
case Media_Format_IMC3 : return GMM_FORMAT_IMC3_TYPE; |
| 2677 |
case Media_Format_400P : return GMM_FORMAT_GENERIC_8BIT; |
| 2678 |
case Media_Format_Buffer : return GMM_FORMAT_RENDER_8BIT; |
| 2679 |
case Media_Format_P010 : return GMM_FORMAT_P010_TYPE; |
| 2680 |
case Media_Format_R10G10B10A2: return GMM_FORMAT_R10G10B10A2_UNORM_TYPE; |
| 2681 |
case Media_Format_B10G10R10A2: return GMM_FORMAT_B10G10R10A2_UNORM_TYPE; |
| 2682 |
case Media_Format_R10G10B10X2: return GMM_FORMAT_R10G10B10A2_UNORM_TYPE; |
| 2683 |
case Media_Format_B10G10R10X2: return GMM_FORMAT_B10G10R10A2_UNORM_TYPE; |
| 2684 |
case Media_Format_P012 : return GMM_FORMAT_P016_TYPE; |
| 2685 |
case Media_Format_P016 : return GMM_FORMAT_P016_TYPE; |
| 2686 |
case Media_Format_Y210 : return GMM_FORMAT_Y210_TYPE; |
| 2687 |
#if VA_CHECK_VERSION(1, 9, 0) |
| 2688 |
case Media_Format_Y212 : return GMM_FORMAT_Y212_TYPE; |
| 2689 |
#endif |
| 2690 |
case Media_Format_Y216 : return GMM_FORMAT_Y216_TYPE; |
| 2691 |
case Media_Format_AYUV : return GMM_FORMAT_AYUV_TYPE; |
| 2692 |
#if VA_CHECK_VERSION(1, 13, 0) |
| 2693 |
case Media_Format_XYUV : return GMM_FORMAT_AYUV_TYPE; |
| 2694 |
#endif |
| 2695 |
case Media_Format_Y410 : return GMM_FORMAT_Y410_TYPE; |
| 2696 |
#if VA_CHECK_VERSION(1, 9, 0) |
| 2697 |
case Media_Format_Y412 : return GMM_FORMAT_Y412_TYPE; |
| 2698 |
#endif |
| 2699 |
case Media_Format_Y416 : return GMM_FORMAT_Y416_TYPE; |
| 2700 |
case Media_Format_Y8 : return GMM_FORMAT_MEDIA_Y8_UNORM; |
| 2701 |
case Media_Format_Y16S : return GMM_FORMAT_MEDIA_Y16_SNORM; |
| 2702 |
case Media_Format_Y16U : return GMM_FORMAT_MEDIA_Y16_UNORM; |
| 2703 |
case Media_Format_A16R16G16B16: return GMM_FORMAT_B16G16R16A16_UNORM; |
| 2704 |
case Media_Format_A16B16G16R16: return GMM_FORMAT_R16G16B16A16_UNORM; |
| 2705 |
default : return GMM_FORMAT_INVALID; |
| 2706 |
} |
| 2707 |
} |
| 2708 |
|
| 2709 |
VAStatus MediaLibvaCapsG12::GetDisplayAttributes( |
| 2710 |
VADisplayAttribute *attribList, |
| 2711 |
int32_t numAttribs) |
| 2712 |
{ |
| 2713 |
DDI_CHK_NULL(attribList, "Null attribList", VA_STATUS_ERROR_INVALID_PARAMETER); |
| 2714 |
for(auto i = 0; i < numAttribs; i ++) |
| 2715 |
{ |
| 2716 |
switch(attribList->type) |
| 2717 |
{ |
| 2718 |
#if VA_CHECK_VERSION(1, 15, 0) |
| 2719 |
case VADisplayPCIID: |
| 2720 |
attribList->min_value = attribList->value = attribList->max_value = (m_mediaCtx->iDeviceId & 0xffff) | 0x80860000; |
| 2721 |
attribList->flags = VA_DISPLAY_ATTRIB_GETTABLE; |
| 2722 |
break; |
| 2723 |
#endif |
| 2724 |
case VADisplayAttribCopy: |
| 2725 |
attribList->min_value = attribList->value = attribList->max_value = 1 << VA_EXEC_MODE_POWER_SAVING ; |
| 2726 |
attribList->flags = VA_DISPLAY_ATTRIB_GETTABLE; |
| 2727 |
break; |
| 2728 |
default: |
| 2729 |
attribList->min_value = VA_ATTRIB_NOT_SUPPORTED; |
| 2730 |
attribList->max_value = VA_ATTRIB_NOT_SUPPORTED; |
| 2731 |
attribList->value = VA_ATTRIB_NOT_SUPPORTED; |
| 2732 |
attribList->flags = VA_DISPLAY_ATTRIB_NOT_SUPPORTED; |
| 2733 |
break; |
| 2734 |
} |
| 2735 |
attribList ++; |
| 2736 |
} |
| 2737 |
return VA_STATUS_SUCCESS; |
| 2738 |
} |
| 2739 |
|
| 2740 |
VAStatus MediaLibvaCapsG12::GetSurfaceModifier(DDI_MEDIA_SURFACE* mediaSurface, uint64_t &modifier) |
| 2741 |
{ |
| 2742 |
DDI_CHK_NULL(mediaSurface, "nullptr mediaSurface", VA_STATUS_ERROR_INVALID_SURFACE); |
| 2743 |
DDI_CHK_NULL(mediaSurface->bo, "nullptr mediaSurface->bo", VA_STATUS_ERROR_INVALID_SURFACE); |
| 2744 |
DDI_CHK_NULL(mediaSurface->pGmmResourceInfo, "nullptr mediaSurface->pGmmResourceInfo", VA_STATUS_ERROR_INVALID_SURFACE); |
| 2745 |
GMM_TILE_TYPE gmmTileType = mediaSurface->pGmmResourceInfo->GetTileType(); |
| 2746 |
GMM_RESOURCE_FLAG GmmFlags = {0}; |
| 2747 |
GmmFlags = mediaSurface->pGmmResourceInfo->GetResFlags(); |
| 2748 |
|
| 2749 |
bool bMmcEnabled = false; |
| 2750 |
if ((GmmFlags.Gpu.MMC || |
| 2751 |
GmmFlags.Gpu.CCS) && |
| 2752 |
(GmmFlags.Info.MediaCompressed || |
| 2753 |
GmmFlags.Info.RenderCompressed)) |
| 2754 |
{ |
| 2755 |
bMmcEnabled = true; |
| 2756 |
} |
| 2757 |
else |
| 2758 |
{ |
| 2759 |
bMmcEnabled = false; |
| 2760 |
} |
| 2761 |
|
| 2762 |
if(GMM_TILED_4 == gmmTileType && MEDIA_IS_SKU(&m_mediaCtx->SkuTable, FtrLocalMemory)) |
| 2763 |
{ |
| 2764 |
if(m_mediaCtx->m_auxTableMgr && bMmcEnabled) |
| 2765 |
{ |
| 2766 |
modifier = GmmFlags.Info.MediaCompressed ? I915_FORMAT_MOD_4_TILED_DG2_MC_CCS : |
| 2767 |
- (GmmFlags.Info.RenderCompressed ? I915_FORMAT_MOD_4_TILED_DG2_RC_CCS_CC : I915_FORMAT_MOD_4_TILED); |
| 2768 |
} |
| 2769 |
else |
| 2770 |
{ |
| 2771 |
modifier = I915_FORMAT_MOD_4_TILED; |
| 2772 |
} |
| 2773 |
return VA_STATUS_SUCCESS; |
| 2774 |
} |
| 2775 |
else |
| 2776 |
{ |
| 2777 |
return MediaLibvaCaps::GetSurfaceModifier(mediaSurface, modifier); |
| 2778 |
} |
| 2779 |
} |
| 2780 |
|
| 2781 |
VAStatus MediaLibvaCapsG12::SetExternalSurfaceTileFormat(DDI_MEDIA_SURFACE* mediaSurface, uint32_t &tileformat, bool &bMemCompEnable, bool &bMemCompRC) |
| 2782 |
{ |
| 2783 |
DDI_CHK_NULL(mediaSurface, "nullptr mediaSurface", VA_STATUS_ERROR_INVALID_SURFACE); |
| 2784 |
DDI_CHK_NULL(mediaSurface->pSurfDesc, "nullptr mediaSurface->pSurfDesc", VA_STATUS_ERROR_INVALID_SURFACE); |
| 2785 |
|
| 2786 |
switch (mediaSurface->pSurfDesc->modifier) |
| 2787 |
{ |
| 2788 |
case DRM_FORMAT_MOD_LINEAR: |
| 2789 |
tileformat = TILING_NONE; |
| 2790 |
bMemCompEnable = false; |
| 2791 |
break; |
| 2792 |
case I915_FORMAT_MOD_X_TILED: |
| 2793 |
tileformat = TILING_X; |
| 2794 |
bMemCompEnable = false; |
| 2795 |
break; |
| 2796 |
case I915_FORMAT_MOD_4_TILED: |
| 2797 |
case I915_FORMAT_MOD_Yf_TILED: |
| 2798 |
case I915_FORMAT_MOD_Y_TILED: |
| 2799 |
tileformat = TILING_Y; |
| 2800 |
bMemCompEnable = false; |
| 2801 |
break; |
| 2802 |
case I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS: |
| 2803 |
tileformat = TILING_Y; |
| 2804 |
bMemCompEnable = true; |
| 2805 |
bMemCompRC = true; |
| 2806 |
break; |
| 2807 |
case I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS: |
| 2808 |
tileformat = TILING_Y; |
| 2809 |
bMemCompEnable = true; |
| 2810 |
bMemCompRC = false; |
| 2811 |
break; |
| 2812 |
default: |
| 2813 |
return VA_STATUS_ERROR_INVALID_SURFACE; |
| 2814 |
} |
| 2815 |
|
| 2816 |
return VA_STATUS_SUCCESS; |
| 2817 |
} |
| 2818 |
|
| 2819 |
extern template class MediaLibvaCapsFactory<MediaLibvaCaps, DDI_MEDIA_CONTEXT>; |
| 2820 |
|
| 2821 |
static bool tglLPRegistered = MediaLibvaCapsFactory<MediaLibvaCaps, DDI_MEDIA_CONTEXT>:: |
| 2822 |
RegisterCaps<MediaLibvaCapsG12>((uint32_t)IGFX_TIGERLAKE_LP); |
| 2823 |
|
| 2824 |
#ifdef IGFX_GEN12_RKL_SUPPORTED |
| 2825 |
static bool rklRegistered = MediaLibvaCapsFactory<MediaLibvaCaps, DDI_MEDIA_CONTEXT>:: |
| 2826 |
RegisterCaps<MediaLibvaCapsG12>((uint32_t)IGFX_ROCKETLAKE); |
| 2827 |
#endif |
| 2828 |
|
| 2829 |
|
| 2830 |
#ifdef IGFX_GEN12_ADLS_SUPPORTED |
| 2831 |
static bool adlsRegistered = MediaLibvaCapsFactory<MediaLibvaCaps, DDI_MEDIA_CONTEXT>:: |
| 2832 |
RegisterCaps<MediaLibvaCapsG12>((uint32_t)IGFX_ALDERLAKE_S); |
| 2833 |
#endif |
| 2834 |
|
| 2835 |
#ifdef IGFX_GEN12_DG1_SUPPORTED |
| 2836 |
static bool dg1Registered = MediaLibvaCapsFactory<MediaLibvaCaps, DDI_MEDIA_CONTEXT>:: |
| 2837 |
RegisterCaps<MediaLibvaCapsG12>((uint32_t)IGFX_DG1); |
| 2838 |
#endif |
| 2839 |
|
| 2840 |
#ifdef IGFX_GEN12_ADLP_SUPPORTED |
| 2841 |
static bool adlpRegistered = MediaLibvaCapsFactory<MediaLibvaCaps, DDI_MEDIA_CONTEXT>:: |
| 2842 |
RegisterCaps<MediaLibvaCapsG12>((uint32_t)IGFX_ALDERLAKE_P); |
| 2843 |
#endif |
| 2844 |
|
| 2845 |
#ifdef IGFX_GEN12_ADLN_SUPPORTED |
| 2846 |
static bool adlnRegistered = MediaLibvaCapsFactory<MediaLibvaCaps, DDI_MEDIA_CONTEXT>:: |
| 2847 |
RegisterCaps<MediaLibvaCapsG12>((uint32_t)IGFX_ALDERLAKE_N); |
| 2848 |
#endif |
| 2849 |
|
| 2850 |
|