| 1 |
/* |
| 2 |
* Copyright (c) 2012-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 |
//! \file vphal_render_sfc_g11_base.cpp |
| 24 |
//! \brief VPHAL SFC Gen11 rendering component |
| 25 |
//! \details The SFC renderer supports Scaling, IEF, CSC/ColorFill and Rotation. |
| 26 |
//! It's responsible for setting up HW states and generating the SFC |
| 27 |
//! commands. |
| 28 |
//! |
| 29 |
#include "vphal_render_vebox_base.h" |
| 30 |
#include "vphal_render_sfc_g11_base.h" |
| 31 |
#include "vp_hal_ddi_utils.h" |
| 32 |
|
| 33 |
#if __VPHAL_SFC_SUPPORTED |
| 34 |
|
| 35 |
bool VphalSfcStateG11::IsInputFormatSupported( |
| 36 |
PVPHAL_SURFACE srcSurface) |
| 37 |
{ |
| 38 |
bool ret = false; |
| 39 |
MEDIA_FEATURE_TABLE *pSkuTable = nullptr; |
| 40 |
|
| 41 |
VPHAL_RENDER_CHK_NULL_NO_STATUS(m_osInterface); |
| 42 |
|
| 43 |
pSkuTable = m_osInterface->pfnGetSkuTable(m_osInterface); |
| 44 |
VPHAL_RENDER_CHK_NULL_NO_STATUS(pSkuTable); |
| 45 |
|
| 46 |
ret = true; |
| 47 |
|
| 48 |
// Check if Input Format is supported |
| 49 |
if ((srcSurface->Format != Format_NV12) && |
| 50 |
(srcSurface->Format != Format_AYUV) && |
| 51 |
(srcSurface->Format != Format_P010) && |
| 52 |
(srcSurface->Format != Format_P016) && |
| 53 |
(srcSurface->Format != Format_Y410) && |
| 54 |
(srcSurface->Format != Format_Y210) && |
| 55 |
// SFC can't support RGB input due to no VEBOX BeCSC |
| 56 |
(((srcSurface->Format != Format_A8B8G8R8) && |
| 57 |
(srcSurface->Format != Format_X8B8G8R8) && |
| 58 |
(srcSurface->Format != Format_A8R8G8B8) && |
| 59 |
(srcSurface->Format != Format_X8R8G8B8)) || |
| 60 |
MEDIA_IS_SKU(pSkuTable, FtrDisableVEBoxFeatures)) && |
| 61 |
!IS_PA_FORMAT(srcSurface->Format)) |
| 62 |
{ |
| 63 |
VPHAL_RENDER_NORMALMESSAGE("Unsupported Source Format '0x%08x' for SFC.", srcSurface->Format); |
| 64 |
ret = false; |
| 65 |
} |
| 66 |
|
| 67 |
finish: |
| 68 |
return ret; |
| 69 |
} |
| 70 |
|
| 71 |
bool VphalSfcStateG11::IsOutputFormatSupported( |
| 72 |
PVPHAL_SURFACE outSurface) |
| 73 |
{ |
| 74 |
bool ret = true; |
| 75 |
|
| 76 |
if (!IS_RGB32_FORMAT(outSurface->Format) && |
| 77 |
// Remove RGB565 support due to quality issue, may reopen this after root cause in the future. |
| 78 |
//!IS_RGB16_FORMAT(outSurface->Format) && |
| 79 |
outSurface->Format != Format_NV12 && |
| 80 |
outSurface->Format != Format_YUY2 && |
| 81 |
outSurface->Format != Format_UYVY && |
| 82 |
outSurface->Format != Format_AYUV) |
| 83 |
{ |
| 84 |
if ((outSurface->TileType == MOS_TILE_Y) && |
| 85 |
(outSurface->Format == Format_P010)) |
| 86 |
{ |
| 87 |
ret = true; |
| 88 |
} |
| 89 |
else |
| 90 |
{ |
| 91 |
VPHAL_RENDER_NORMALMESSAGE("Unsupported Render Target Format '0x%08x' for SFC Pipe.", outSurface->Format); |
| 92 |
|
| 93 |
ret = false; |
| 94 |
} |
| 95 |
} |
| 96 |
|
| 97 |
return ret; |
| 98 |
} |
| 99 |
|
| 100 |
void VphalSfcStateG11::GetInputWidthHeightAlignUnit( |
| 101 |
MOS_FORMAT inputFormat, |
| 102 |
MOS_FORMAT outputFormat, |
| 103 |
uint16_t &widthAlignUnit, |
| 104 |
uint16_t &heightAlignUnit, |
| 105 |
bool isInterlacedScaling) |
| 106 |
{ |
| 107 |
MOS_UNUSED(outputFormat); |
| 108 |
widthAlignUnit = 1; |
| 109 |
heightAlignUnit = 1; |
| 110 |
|
| 111 |
// Apply alignment restriction to Region of the input frame. |
| 112 |
switch (VpHalDDIUtils::GetSurfaceColorPack(inputFormat)) |
| 113 |
{ |
| 114 |
case VPHAL_COLORPACK_420: |
| 115 |
widthAlignUnit = 2; |
| 116 |
heightAlignUnit = 2; |
| 117 |
break; |
| 118 |
case VPHAL_COLORPACK_422: |
| 119 |
widthAlignUnit = 2; |
| 120 |
break; |
| 121 |
default: |
| 122 |
break; |
| 123 |
} |
| 124 |
} |
| 125 |
|
| 126 |
#endif // __VPHAL_SFC_SUPPORTED |