| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
#ifndef __MEDIA_LIBVA_CAPS_G12_H__ |
| 29 |
#define __MEDIA_LIBVA_CAPS_G12_H__ |
| 30 |
|
| 31 |
#include "media_libva_caps.h" |
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
class MediaLibvaCapsG12 : public MediaLibvaCaps |
| 38 |
{ |
| 39 |
public: |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
MediaLibvaCapsG12(DDI_MEDIA_CONTEXT *mediaCtx) : MediaLibvaCaps(mediaCtx) |
| 44 |
{ |
| 45 |
|
| 46 |
static struct EncodeFormatTable encodeFormatTableTGL[] = |
| 47 |
{ |
| 48 |
{AVC, DualPipe, VA_RT_FORMAT_YUV420}, |
| 49 |
{AVC, Vdenc, VA_RT_FORMAT_YUV420 | VA_RT_FORMAT_YUV422 | VA_RT_FORMAT_YUV444 | VA_RT_FORMAT_RGB32}, |
| 50 |
{HEVC, DualPipe, VA_RT_FORMAT_YUV420 | VA_RT_FORMAT_YUV420_10BPP | VA_RT_FORMAT_YUV420_12 | |
| 51 |
VA_RT_FORMAT_YUV422 | VA_RT_FORMAT_YUV422_10 | VA_RT_FORMAT_YUV422_12}, |
| 52 |
{HEVC, Vdenc, VA_RT_FORMAT_YUV420 | VA_RT_FORMAT_YUV420_10BPP | |
| 53 |
VA_RT_FORMAT_YUV444 | VA_RT_FORMAT_YUV444_10 | VA_RT_FORMAT_RGB32 | |
| 54 |
VA_RT_FORMAT_RGB32_10BPP | VA_RT_FORMAT_YUV422 | VA_RT_FORMAT_YUV422_10}, |
| 55 |
{VP9, Vdenc, VA_RT_FORMAT_YUV420 | VA_RT_FORMAT_YUV420_10BPP | |
| 56 |
VA_RT_FORMAT_YUV444 | VA_RT_FORMAT_YUV444_10 | VA_RT_FORMAT_RGB32 | |
| 57 |
VA_RT_FORMAT_RGB32_10BPP}, |
| 58 |
}; |
| 59 |
m_encodeFormatTable = (struct EncodeFormatTable*)(&encodeFormatTableTGL[0]); |
| 60 |
m_encodeFormatCount = sizeof(encodeFormatTableTGL)/sizeof(struct EncodeFormatTable); |
| 61 |
return; |
| 62 |
} |
| 63 |
|
| 64 |
|
| 65 |
virtual VAStatus Init() override |
| 66 |
{ |
| 67 |
return LoadProfileEntrypoints(); |
| 68 |
} |
| 69 |
|
| 70 |
virtual VAStatus QueryImageFormats(VAImageFormat *formatList, int32_t *num_formats) override; |
| 71 |
|
| 72 |
virtual uint32_t GetImageFormatsMaxNum() override; |
| 73 |
|
| 74 |
virtual bool IsImageSupported(uint32_t fourcc) override; |
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
virtual VAStatus PopulateColorMaskInfo(VAImageFormat *vaImgFmt) override; |
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
CODECHAL_MODE GetEncodeCodecMode(VAProfile profile, VAEntrypoint entrypoint) override; |
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
virtual std::string GetDecodeCodecKey(VAProfile profile) override; |
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
std::string GetEncodeCodecKey(VAProfile profile, |
| 126 |
VAEntrypoint entrypoint, |
| 127 |
uint32_t feiFunction) override; |
| 128 |
|
| 129 |
virtual CODECHAL_MODE GetDecodeCodecMode(VAProfile profile) override; |
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
virtual VAStatus AddEncSurfaceAttributes(VAProfile profile, |
| 153 |
VAEntrypoint entrypoint, |
| 154 |
VASurfaceAttrib *attribList, |
| 155 |
uint32_t &numAttribs); |
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
VAStatus QuerySurfaceAttributes(VAConfigID configId, |
| 175 |
VASurfaceAttrib *attribList, |
| 176 |
uint32_t *numAttribs) override; |
| 177 |
|
| 178 |
virtual bool IsHevcProfile(VAProfile profile) override; |
| 179 |
|
| 180 |
virtual GMM_RESOURCE_FORMAT ConvertMediaFmtToGmmFmt(DDI_MEDIA_FORMAT format) override; |
| 181 |
|
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
|
| 186 |
|
| 187 |
|
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
virtual VAStatus GetSurfaceModifier(DDI_MEDIA_SURFACE* mediaSurface, uint64_t &modifier) override; |
| 193 |
|
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
|
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
|
| 208 |
virtual VAStatus SetExternalSurfaceTileFormat(DDI_MEDIA_SURFACE* mediaSurface, |
| 209 |
uint32_t &tileformat, |
| 210 |
bool &bMemCompEnable, |
| 211 |
bool &bMemCompRC) override; |
| 212 |
|
| 213 |
protected: |
| 214 |
static const uint32_t m_maxHevcEncWidth = |
| 215 |
CODEC_16K_MAX_PIC_WIDTH; |
| 216 |
static const uint32_t m_maxHevcEncHeight = |
| 217 |
CODEC_12K_MAX_PIC_HEIGHT; |
| 218 |
static const uint32_t m_decAvcMaxWidth = |
| 219 |
CODEC_4K_MAX_PIC_WIDTH; |
| 220 |
static const uint32_t m_decAvcMaxHeight = |
| 221 |
CODEC_4K_MAX_PIC_HEIGHT; |
| 222 |
static const uint32_t m_decHevcMax16kWidth = |
| 223 |
CODEC_16K_MAX_PIC_WIDTH; |
| 224 |
static const uint32_t m_decHevcMax16kHeight = |
| 225 |
CODEC_16K_MAX_PIC_HEIGHT; |
| 226 |
static const uint32_t m_decVp9Max16kWidth = |
| 227 |
CODEC_16K_MAX_PIC_WIDTH; |
| 228 |
static const uint32_t m_decVp9Max16kHeight = |
| 229 |
CODEC_16K_MAX_PIC_HEIGHT; |
| 230 |
static const uint32_t m_decAv1Max16kWidth = |
| 231 |
CODEC_16K_MAX_PIC_WIDTH; |
| 232 |
static const uint32_t m_decAv1Max16kHeight = |
| 233 |
CODEC_16K_MAX_PIC_HEIGHT; |
| 234 |
static const uint32_t m_maxVp9EncWidth = |
| 235 |
CODEC_8K_MAX_PIC_WIDTH; |
| 236 |
static const uint32_t m_maxVp9EncHeight = |
| 237 |
CODEC_8K_MAX_PIC_HEIGHT; |
| 238 |
static const uint32_t m_minVp9EncWidth = |
| 239 |
CODEC_128_MIN_PIC_WIDTH; |
| 240 |
static const uint32_t m_minVp9EncHeight = |
| 241 |
CODEC_96_MIN_PIC_HEIGHT; |
| 242 |
static const VAImageFormat m_G12ImageFormats[]; |
| 243 |
static const VAConfigAttribValEncRateControlExt m_encVp9RateControlExt; |
| 244 |
virtual VAStatus GetPlatformSpecificAttrib(VAProfile profile, |
| 245 |
VAEntrypoint entrypoint, |
| 246 |
VAConfigAttribType type, |
| 247 |
unsigned int *value) override; |
| 248 |
|
| 249 |
virtual VAStatus LoadProfileEntrypoints() override; |
| 250 |
virtual VAStatus LoadJpegDecProfileEntrypoints(); |
| 251 |
virtual VAStatus LoadVp9EncProfileEntrypoints() override; |
| 252 |
virtual VAStatus LoadHevcEncProfileEntrypoints() override; |
| 253 |
|
| 254 |
virtual VAStatus CheckEncodeResolution( |
| 255 |
VAProfile profile, |
| 256 |
uint32_t width, |
| 257 |
uint32_t height) override; |
| 258 |
virtual VAStatus CheckDecodeResolution( |
| 259 |
int32_t codecMode, |
| 260 |
VAProfile profile, |
| 261 |
uint32_t width, |
| 262 |
uint32_t height) override; |
| 263 |
virtual VAStatus CreateEncAttributes( |
| 264 |
VAProfile profile, |
| 265 |
VAEntrypoint entrypoint, |
| 266 |
AttribMap **attributeList) override; |
| 267 |
virtual VAStatus CreateDecAttributes( |
| 268 |
VAProfile profile, |
| 269 |
VAEntrypoint entrypoint, |
| 270 |
AttribMap **attributeList) override; |
| 271 |
|
| 272 |
virtual VAStatus LoadHevcDecProfileEntrypoints() override; |
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
|
| 277 |
|
| 278 |
|
| 279 |
|
| 280 |
virtual VAStatus LoadHevcEncLpProfileEntrypoints(); |
| 281 |
|
| 282 |
|
| 283 |
|
| 284 |
|
| 285 |
|
| 286 |
|
| 287 |
|
| 288 |
|
| 289 |
|
| 290 |
|
| 291 |
static bool IsAV1Profile(VAProfile profile); |
| 292 |
|
| 293 |
|
| 294 |
|
| 295 |
|
| 296 |
VAStatus LoadAv1DecProfileEntrypoints(); |
| 297 |
|
| 298 |
|
| 299 |
|
| 300 |
|
| 301 |
|
| 302 |
|
| 303 |
|
| 304 |
|
| 305 |
|
| 306 |
|
| 307 |
|
| 308 |
|
| 309 |
|
| 310 |
|
| 311 |
|
| 312 |
|
| 313 |
VAStatus QueryAVCROIMaxNum(uint32_t rcMode, bool isVdenc, uint32_t *maxNum, bool *isRoiInDeltaQP) override; |
| 314 |
|
| 315 |
|
| 316 |
|
| 317 |
|
| 318 |
|
| 319 |
|
| 320 |
|
| 321 |
|
| 322 |
|
| 323 |
|
| 324 |
|
| 325 |
|
| 326 |
|
| 327 |
|
| 328 |
|
| 329 |
|
| 330 |
virtual VAStatus GetDisplayAttributes( |
| 331 |
VADisplayAttribute *attribList, |
| 332 |
int32_t numAttribs) override; |
| 333 |
|
| 334 |
|
| 335 |
|
| 336 |
|
| 337 |
|
| 338 |
|
| 339 |
|
| 340 |
|
| 341 |
|
| 342 |
|
| 343 |
bool IsHevcSccProfile(VAProfile profile) |
| 344 |
{ |
| 345 |
return ( |
| 346 |
(profile == VAProfileHEVCSccMain) || |
| 347 |
(profile == VAProfileHEVCSccMain10) || |
| 348 |
(profile == VAProfileHEVCSccMain444) || |
| 349 |
(profile == VAProfileHEVCSccMain444_10) |
| 350 |
); |
| 351 |
} |
| 352 |
}; |
| 353 |
#endif |