| 1 |
/* |
| 2 |
* Copyright (c) 2020, 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_dg2.h |
| 25 |
//! \brief This file implements the C++ class/interface for dg2 capbilities. |
| 26 |
//! |
| 27 |
|
| 28 |
#ifndef __MEDIA_LIBVA_CAPS_XE_HPM_H__ |
| 29 |
#define __MEDIA_LIBVA_CAPS_XE_HPM_H__ |
| 30 |
|
| 31 |
#include "media_libva.h" |
| 32 |
#include "media_libva_caps_factory.h" |
| 33 |
|
| 34 |
#include "media_libva_caps_g12.h" |
| 35 |
#include "linux_system_info.h" |
| 36 |
|
| 37 |
//! |
| 38 |
//! \class MediaLibvaCapsDG2 |
| 39 |
//! \brief Media libva caps DG2 |
| 40 |
//! |
| 41 |
class MediaLibvaCapsDG2 : public MediaLibvaCapsG12 |
| 42 |
{ |
| 43 |
public: |
| 44 |
//! |
| 45 |
//! \brief Constructor |
| 46 |
//! |
| 47 |
MediaLibvaCapsDG2(DDI_MEDIA_CONTEXT *mediaCtx) : MediaLibvaCapsG12(mediaCtx) |
| 48 |
{ |
| 49 |
// DG2 supported Encode format |
| 50 |
static struct EncodeFormatTable encodeFormatTableDG2[] = |
| 51 |
{ |
| 52 |
{AVC, Vdenc, VA_RT_FORMAT_YUV420 | VA_RT_FORMAT_YUV422 | VA_RT_FORMAT_YUV444 | VA_RT_FORMAT_RGB32}, |
| 53 |
{HEVC, Vdenc, VA_RT_FORMAT_YUV420 | VA_RT_FORMAT_YUV420_10BPP | |
| 54 |
VA_RT_FORMAT_YUV444 | VA_RT_FORMAT_YUV444_10 | VA_RT_FORMAT_RGB32 | |
| 55 |
VA_RT_FORMAT_RGB32_10BPP | VA_RT_FORMAT_YUV422 | VA_RT_FORMAT_YUV422_10}, |
| 56 |
{VP9, Vdenc, VA_RT_FORMAT_YUV420 | VA_RT_FORMAT_YUV420_10BPP | |
| 57 |
VA_RT_FORMAT_YUV444 | VA_RT_FORMAT_YUV444_10 | VA_RT_FORMAT_RGB32 | |
| 58 |
VA_RT_FORMAT_RGB32_10BPP}, |
| 59 |
{AV1, Vdenc, VA_RT_FORMAT_YUV420 | VA_RT_FORMAT_YUV420_10BPP | |
| 60 |
VA_RT_FORMAT_RGB32 | VA_RT_FORMAT_RGB32_10BPP} |
| 61 |
}; |
| 62 |
m_encodeFormatTable = (struct EncodeFormatTable*)(&encodeFormatTableDG2[0]); |
| 63 |
m_encodeFormatCount = sizeof(encodeFormatTableDG2)/sizeof(struct EncodeFormatTable); |
| 64 |
return; |
| 65 |
} |
| 66 |
|
| 67 |
//! |
| 68 |
//! \brief Destructor |
| 69 |
//! |
| 70 |
virtual ~MediaLibvaCapsDG2() {}; |
| 71 |
|
| 72 |
//! |
| 73 |
//! \brief Return the encode codec key for given profile and entrypoint |
| 74 |
//! |
| 75 |
//! \param [in] profile |
| 76 |
//! Specify the VAProfile |
| 77 |
//! |
| 78 |
//! \param [in] entrypoint |
| 79 |
//! Specify the entrypoint |
| 80 |
//! |
| 81 |
//! \param [in] feiFunction |
| 82 |
//! Specify the feiFunction |
| 83 |
//! |
| 84 |
//! \return Std::string encode codec key |
| 85 |
//! |
| 86 |
std::string GetEncodeCodecKey(VAProfile profile, VAEntrypoint entrypoint, uint32_t feiFunction) override; |
| 87 |
|
| 88 |
//! |
| 89 |
//! \brief Return internal encode mode for given profile and entrypoint |
| 90 |
//! |
| 91 |
//! \param [in] profile |
| 92 |
//! Specify the VAProfile |
| 93 |
//! |
| 94 |
//! \param [in] entrypoint |
| 95 |
//! Specify the VAEntrypoint |
| 96 |
//! |
| 97 |
//! \return Codehal mode |
| 98 |
//! |
| 99 |
CODECHAL_MODE GetEncodeCodecMode(VAProfile profile, VAEntrypoint entrypoint) override; |
| 100 |
|
| 101 |
//! |
| 102 |
//! \brief Check if the resolution is valid for a encode profile |
| 103 |
//! |
| 104 |
//! \param [in] profile |
| 105 |
//! Specify the VAProfile |
| 106 |
//! |
| 107 |
//! \param [in] width |
| 108 |
//! Specify the width for checking |
| 109 |
//! |
| 110 |
//! \param [in] height |
| 111 |
//! Specify the height for checking |
| 112 |
//! |
| 113 |
//! \return VAStatus |
| 114 |
//! VA_STATUS_SUCCESS if the resolution is supported |
| 115 |
//! VA_STATUS_ERROR_RESOLUTION_NOT_SUPPORTED if the resolution isn't valid |
| 116 |
//! |
| 117 |
virtual VAStatus CheckEncodeResolution( |
| 118 |
VAProfile profile, |
| 119 |
uint32_t width, |
| 120 |
uint32_t height) override; |
| 121 |
|
| 122 |
//! |
| 123 |
//! \brief Check the encode RT format according to platform and encode format |
| 124 |
//! |
| 125 |
//! \param [in] profile |
| 126 |
//! VAProfile |
| 127 |
//! |
| 128 |
//! \param [in] entrypoint |
| 129 |
//! VAEntrypoint |
| 130 |
//! |
| 131 |
//! \param [in,out] attrib |
| 132 |
//! Pointer to a pointer of VAConfigAttrib that will be created |
| 133 |
//! |
| 134 |
//! \return VAStatus |
| 135 |
//! VA_STATUS_SUCCESS if success |
| 136 |
//! |
| 137 |
virtual VAStatus CheckEncRTFormat( |
| 138 |
VAProfile profile, |
| 139 |
VAEntrypoint entrypoint, |
| 140 |
VAConfigAttrib* attrib) override; |
| 141 |
|
| 142 |
//! |
| 143 |
//! \brief Return the platform specific value by given attribute type |
| 144 |
//! |
| 145 |
//! \param [in] profile |
| 146 |
//! VAProfile |
| 147 |
//! |
| 148 |
//! \param [in] entrypoint |
| 149 |
//! VAEntrypoint |
| 150 |
//! |
| 151 |
//! \param [in] type |
| 152 |
//! VAConfigAttribType |
| 153 |
//! |
| 154 |
//! \param [in,out] value |
| 155 |
//! Pointer to uint32_t that stores the returned value. |
| 156 |
//! |
| 157 |
//! \return VAStatus |
| 158 |
//! VA_STATUS_SUCCESS if success |
| 159 |
//! |
| 160 |
virtual VAStatus GetPlatformSpecificAttrib(VAProfile profile, |
| 161 |
VAEntrypoint entrypoint, |
| 162 |
VAConfigAttribType type, |
| 163 |
unsigned int *value) override; |
| 164 |
|
| 165 |
//! |
| 166 |
//! \brief Create and intialize an attribute vector give encode profile and entrypoint |
| 167 |
//! |
| 168 |
//! \param [in] profile |
| 169 |
//! VA profile |
| 170 |
//! |
| 171 |
//! \param [in] entrypoint |
| 172 |
//! VA entrypoint |
| 173 |
//! |
| 174 |
//! \param [in,out] attributeList |
| 175 |
//! Pointer to a pointer of AttribMap that will be created |
| 176 |
//! |
| 177 |
//! \return VAStatus |
| 178 |
//! VA_STATUS_SUCCESS if success |
| 179 |
//! |
| 180 |
virtual VAStatus CreateEncAttributes( |
| 181 |
VAProfile profile, |
| 182 |
VAEntrypoint entrypoint, |
| 183 |
AttribMap **attributeList) override; |
| 184 |
|
| 185 |
virtual VAStatus LoadProfileEntrypoints() override; |
| 186 |
|
| 187 |
//! |
| 188 |
//! \brief Initialize av1 encode profiles, entrypoints and attributes |
| 189 |
//! |
| 190 |
virtual VAStatus LoadAv1EncProfileEntrypoints(); |
| 191 |
//! |
| 192 |
//! \brief Initialize AVC Low-power encode profiles, entrypoints and attributes |
| 193 |
//! |
| 194 |
virtual VAStatus LoadAvcEncLpProfileEntrypoints() override; |
| 195 |
|
| 196 |
//! |
| 197 |
//! \brief Add surface attributes for Encoding |
| 198 |
//! |
| 199 |
//! \param [in] profile |
| 200 |
//! VAProfile of the configuration |
| 201 |
//! |
| 202 |
//! \param [in] entrypoint |
| 203 |
//! VAEntrypoint of the configuration |
| 204 |
//! |
| 205 |
//! \param [in,out] attribList |
| 206 |
//! Pointer to VASurfaceAttrib array. It returns |
| 207 |
//! the supported surface attributes |
| 208 |
//! |
| 209 |
//! \param [in,out] numAttribs |
| 210 |
//! The number of elements allocated on input |
| 211 |
//! Return the number of elements actually filled in output |
| 212 |
virtual VAStatus AddEncSurfaceAttributes( |
| 213 |
VAProfile profile, |
| 214 |
VAEntrypoint entrypoint, |
| 215 |
VASurfaceAttrib *attribList, |
| 216 |
uint32_t &numAttribs) override; |
| 217 |
|
| 218 |
//! |
| 219 |
//! \brief Get display attributes |
| 220 |
//! returns the current attributes values in "attribList" |
| 221 |
//! |
| 222 |
//! \param [in, out] attribList |
| 223 |
//! the attrib type should be filled. |
| 224 |
//! returns the supported display attributes |
| 225 |
//! |
| 226 |
//! \param [in] numAttribs |
| 227 |
//! the number of supported attributes |
| 228 |
//! |
| 229 |
//! \return VAStatus |
| 230 |
//! VA_STATUS_SUCCESS if success |
| 231 |
//! VA_STATUS_ERROR_MAX_NUM_EXCEEDED if size of attribList is too small |
| 232 |
//! |
| 233 |
virtual VAStatus GetDisplayAttributes( |
| 234 |
VADisplayAttribute * attribList, |
| 235 |
int32_t numAttribs) override; |
| 236 |
}; |
| 237 |
#endif |