| 1 |
/* |
| 2 |
* Copyright (c) 2017, 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 |
//! \file media_libva_caps_g9_kbl.cpp |
| 24 |
//! \brief This file implements the C++ class/interface for KBL media capbilities. |
| 25 |
//! |
| 26 |
|
| 27 |
#include "media_libva_util.h" |
| 28 |
#include "media_libva.h" |
| 29 |
#include "media_libva_caps_g9_kbl.h" |
| 30 |
#include "media_libva_caps_factory.h" |
| 31 |
|
| 32 |
MediaLibvaCapsG9Kbl::MediaLibvaCapsG9Kbl(DDI_MEDIA_CONTEXT *mediaCtx) : MediaLibvaCapsG9(mediaCtx) |
| 33 |
{ |
| 34 |
return; |
| 35 |
} |
| 36 |
|
| 37 |
VAStatus MediaLibvaCapsG9Kbl::GetMbProcessingRateEnc( |
| 38 |
MEDIA_FEATURE_TABLE *skuTable, |
| 39 |
uint32_t tuIdx, |
| 40 |
uint32_t codecMode, |
| 41 |
bool vdencActive, |
| 42 |
uint32_t *mbProcessingRatePerSec) |
| 43 |
{ |
| 44 |
DDI_CHK_NULL(skuTable, "Null pointer", VA_STATUS_ERROR_INVALID_PARAMETER); |
| 45 |
DDI_CHK_NULL(mbProcessingRatePerSec, "Null pointer", VA_STATUS_ERROR_INVALID_PARAMETER); |
| 46 |
|
| 47 |
uint32_t gtIdx = 0; |
| 48 |
|
| 49 |
// Calculate the GT index based on GT type |
| 50 |
if (MEDIA_IS_SKU(skuTable, FtrGT1)) |
| 51 |
{ |
| 52 |
gtIdx = 4; |
| 53 |
} |
| 54 |
else if (MEDIA_IS_SKU(skuTable, FtrGT1_5)) |
| 55 |
{ |
| 56 |
gtIdx = 3; |
| 57 |
} |
| 58 |
else if (MEDIA_IS_SKU(skuTable, FtrGT2)) |
| 59 |
{ |
| 60 |
gtIdx = 2; |
| 61 |
} |
| 62 |
else if (MEDIA_IS_SKU(skuTable, FtrGT3)) |
| 63 |
{ |
| 64 |
gtIdx = 1; |
| 65 |
} |
| 66 |
else if (MEDIA_IS_SKU(skuTable, FtrGT4)) |
| 67 |
{ |
| 68 |
gtIdx = 0; |
| 69 |
} |
| 70 |
else |
| 71 |
{ |
| 72 |
return VA_STATUS_ERROR_INVALID_PARAMETER; |
| 73 |
} |
| 74 |
|
| 75 |
if (codecMode == CODECHAL_ENCODE_MODE_AVC) |
| 76 |
{ |
| 77 |
if (MEDIA_IS_SKU(skuTable, FtrULX)) |
| 78 |
{ |
| 79 |
const uint32_t mbRate[7][5] = |
| 80 |
{ |
| 81 |
// GT4 | GT3 | GT2 | GT1.5 | GT1 |
| 82 |
{ 0, 0, 1029393, 1029393, 676280 }, |
| 83 |
{ 0, 0, 975027, 975027, 661800 }, |
| 84 |
{ 0, 0, 776921, 776921, 640000 }, |
| 85 |
{ 0, 0, 776921, 776921, 640000 }, |
| 86 |
{ 0, 0, 776921, 776921, 640000 }, |
| 87 |
{ 0, 0, 416051, 416051, 317980 }, |
| 88 |
{ 0, 0, 214438, 214438, 180655 } |
| 89 |
}; |
| 90 |
|
| 91 |
if (gtIdx == 0 || gtIdx == 1) |
| 92 |
{ |
| 93 |
return VA_STATUS_ERROR_INVALID_PARAMETER; |
| 94 |
} |
| 95 |
*mbProcessingRatePerSec = mbRate[tuIdx][gtIdx]; |
| 96 |
} |
| 97 |
else if (MEDIA_IS_SKU(skuTable, FtrULT)) |
| 98 |
{ |
| 99 |
const uint32_t KBLULT_MB_RATE[7][5] = |
| 100 |
{ |
| 101 |
// GT4 | GT3 | GT2 | GT1.5 | GT1 |
| 102 |
{ 1544090, 1544090, 1544090, 1029393, 676280 }, |
| 103 |
{ 1462540, 1462540, 1462540, 975027, 661800 }, |
| 104 |
{ 1165381, 1165381, 1165381, 776921, 640000 }, |
| 105 |
{ 1165381, 1165381, 1165381, 776921, 640000 }, |
| 106 |
{ 1165381, 1165381, 1165381, 776921, 640000 }, |
| 107 |
{ 624076, 624076, 624076, 416051, 317980 }, |
| 108 |
{ 321657, 321657, 321657, 214438, 180655 } |
| 109 |
}; |
| 110 |
|
| 111 |
*mbProcessingRatePerSec = KBLULT_MB_RATE[tuIdx][gtIdx]; |
| 112 |
} |
| 113 |
else |
| 114 |
{ |
| 115 |
// regular KBL |
| 116 |
const uint32_t mbRate[7][5] = |
| 117 |
{ |
| 118 |
// GT4 | GT3 | GT2 | GT1.5 | GT1 |
| 119 |
{ 1544090, 1544090, 1544090, 1029393, 676280 }, |
| 120 |
{ 1462540, 1462540, 1462540, 975027, 661800 }, |
| 121 |
{ 1165381, 1165381, 1165381, 776921, 640000 }, |
| 122 |
{ 1165381, 1165381, 1165381, 776921, 640000 }, |
| 123 |
{ 1165381, 1165381, 1165381, 776921, 640000 }, |
| 124 |
{ 624076, 624076, 624076, 416051, 317980 }, |
| 125 |
{ 321657, 321657, 321657, 214438, 180655 } |
| 126 |
}; |
| 127 |
|
| 128 |
*mbProcessingRatePerSec = mbRate[tuIdx][gtIdx]; |
| 129 |
} |
| 130 |
} |
| 131 |
else if (codecMode == CODECHAL_ENCODE_MODE_HEVC) |
| 132 |
{ |
| 133 |
const uint32_t mbRate[7][5] = |
| 134 |
{ |
| 135 |
// GT4 | GT3 | GT2 | GT1.5 | GT1 |
| 136 |
{ 500000, 500000, 500000, 500000, 500000 }, |
| 137 |
{ 500000, 500000, 500000, 500000, 500000 }, |
| 138 |
{ 250000, 250000, 250000, 250000, 250000 }, |
| 139 |
{ 250000, 250000, 250000, 250000, 250000 }, |
| 140 |
{ 250000, 250000, 250000, 250000, 250000 }, |
| 141 |
{ 125000, 125000, 125000, 125000, 125000 }, |
| 142 |
{ 125000, 125000, 125000, 125000, 125000 } |
| 143 |
}; |
| 144 |
|
| 145 |
*mbProcessingRatePerSec = mbRate[tuIdx][gtIdx]; |
| 146 |
} |
| 147 |
return VA_STATUS_SUCCESS; |
| 148 |
} |
| 149 |
|
| 150 |
extern template class MediaLibvaCapsFactory<MediaLibvaCaps, DDI_MEDIA_CONTEXT>; |
| 151 |
|
| 152 |
bool kblRegistered = MediaLibvaCapsFactory<MediaLibvaCaps, DDI_MEDIA_CONTEXT>:: |
| 153 |
RegisterCaps<MediaLibvaCapsG9Kbl>((uint32_t)IGFX_KABYLAKE); |