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