| 1 | /* |
| 2 | * Copyright (c) 2017-2018, 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_composite_g9.h |
| 24 | //! \brief Common interface and structure used in Composite |
| 25 | //! \details Common interface and structure used in Composite |
| 26 | //! |
| 27 | #ifndef __VPHAL_RENDER_COMPOSITE_G9_H__ |
| 28 | #define __VPHAL_RENDER_COMPOSITE_G9_H__ |
| 29 | |
| 30 | #include "vphal_render_composite.h" |
| 31 | |
| 32 | //! |
| 33 | //! \brief Class to VPHAL Composite G9 render |
| 34 | //! |
| 35 | class CompositeStateG9 : virtual public CompositeState |
| 36 | { |
| 37 | public: |
| 38 | //! |
| 39 | //! \brief Composite Constructor |
| 40 | //! \details Construct Composite render and allocate member data structure |
| 41 | //! \param [in] pOsInterface |
| 42 | //! Pointer to MOS interface structure |
| 43 | //! \param [in] pRenderHal |
| 44 | //! Pointer to RenderHal interface structure |
| 45 | //! \param [in] pPerfData |
| 46 | //! Pointer to performance data structure |
| 47 | //! \param [in] compositeCacheCntl |
| 48 | //! Composite Cache Control Data |
| 49 | //! \param [in,out] peStatus |
| 50 | //! Pointer to MOS status |
| 51 | //! |
| 52 | CompositeStateG9( |
| 53 | PMOS_INTERFACE pOsInterface, |
| 54 | PRENDERHAL_INTERFACE pRenderHal, |
| 55 | PVPHAL_RNDR_PERF_DATA pPerfData, |
| 56 | const VPHAL_COMPOSITE_CACHE_CNTL &compositeCacheCntl, |
| 57 | MOS_STATUS *peStatus) : |
| 58 | CompositeState(pOsInterface, pRenderHal, pPerfData, compositeCacheCntl, peStatus) |
| 59 | { |
| 60 | m_bSamplerSupportRotation = true; // On Gen9+, Rotation is done in sampler. |
| 61 | m_bFallbackIefPatch = false; |
| 62 | m_bKernelSupportDualOutput = true; |
| 63 | m_bKernelSupportHdcDW = true; |
| 64 | m_bAvsTableCoeffExtraEnabled = true; |
| 65 | m_bAvsTableBalancedFilter = true; |
| 66 | m_bApplyTwoLayersCompOptimize = false; |
| 67 | m_bYV12iAvsScaling = true; // On Gen9+, iAVS scaling can support YV12 input format |
| 68 | m_bEnableSamplerLumakey = true; // Enable sampler lumakey on Gen9. |
| 69 | |
| 70 | if (*peStatus != MOS_STATUS_SUCCESS) |
| 71 | { |
| 72 | // super class constructor failed, return directly |
| 73 | return; |
| 74 | } |
| 75 | m_AvsCoeffsCache.Init(POLYPHASE_Y_COEFFICIENT_TABLE_SIZE_G9, POLYPHASE_UV_COEFFICIENT_TABLE_SIZE_G9); |
| 76 | *peStatus = VpHal_RndrCommonInitAVSParams(&m_AvsParameters, |
| 77 | POLYPHASE_Y_COEFFICIENT_TABLE_SIZE_G9, |
| 78 | POLYPHASE_UV_COEFFICIENT_TABLE_SIZE_G9); |
| 79 | } |
| 80 | |
| 81 | //! |
| 82 | //! \brief Composite render Destructor |
| 83 | //! \details Destroy Composite render and release all related RenderState resources |
| 84 | //! |
| 85 | virtual ~CompositeStateG9() |
| 86 | { |
| 87 | } |
| 88 | |
| 89 | protected: |
| 90 | //! |
| 91 | //! \brief Override Static Data |
| 92 | //! \details Override Static Data |
| 93 | //! \param [in] pRenderingData |
| 94 | //! Pointer to REnder Data |
| 95 | //! \param [in] pTarget |
| 96 | //! Pointer to Target Surface |
| 97 | //! \param [in,out] pStatic |
| 98 | //! Pointer to Static Data |
| 99 | //! \return VOID |
| 100 | //! |
| 101 | virtual void SubmitStatesFillGenSpecificStaticData( |
| 102 | PVPHAL_RENDERING_DATA_COMPOSITE pRenderingData, |
| 103 | PVPHAL_SURFACE pTarget, |
| 104 | MEDIA_OBJECT_KA2_STATIC_DATA *pStatic); |
| 105 | |
| 106 | //! |
| 107 | //! \brief Check NV12 luma key sampler solution is needed or not |
| 108 | //! \details This WA is needed before Gen9 platforms |
| 109 | //! \param pSrc |
| 110 | //! [in] Pointer to Source Surface |
| 111 | //! \param pRenderHal |
| 112 | //! [in] Pointer to render hal |
| 113 | //! \return bool |
| 114 | //! Return TRUE if needed, otherwise FALSE |
| 115 | //! |
| 116 | virtual bool IsNV12SamplerLumakeyNeeded(PVPHAL_SURFACE pSrc, PRENDERHAL_INTERFACE pRenderHal) |
| 117 | { |
| 118 | MOS_UNUSED(pRenderHal); |
| 119 | return (pSrc->bUseSamplerLumakey && pSrc->Format == Format_NV12) ? true : false; |
| 120 | } |
| 121 | }; |
| 122 | |
| 123 | #endif // __VPHAL_RENDER_COMPOSITE_G9_H__ |