| 1 | /* |
| 2 | * Copyright (c) 2017-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 mhw_vdbox_vdenc_g9_kbl.h |
| 24 | //! \brief Defines functions for constructing Vdbox Vdenc commands on G9 KBL |
| 25 | //! |
| 26 | |
| 27 | #ifndef __MHW_VDBOX_VDENC_G9_KBL_H__ |
| 28 | #define __MHW_VDBOX_VDENC_G9_KBL_H__ |
| 29 | |
| 30 | #include "mhw_vdbox_vdenc_g9_X.h" |
| 31 | #include "mhw_vdbox_vdenc_hwcmd_g9_kbl.h" |
| 32 | |
| 33 | //! MHW Vdbox Vdenc interface for Gen9 KBL platform |
| 34 | /*! |
| 35 | This class defines the Vdenc command construction functions for Gen9 KBL platform |
| 36 | */ |
| 37 | class MhwVdboxVdencInterfaceG9Kbl : public MhwVdboxVdencInterfaceG9<mhw_vdbox_vdenc_g9_kbl> |
| 38 | { |
| 39 | protected: |
| 40 | |
| 41 | enum VdencSurfaceFormat |
| 42 | { |
| 43 | vdencSurfaceFormatYuv422 = 0, //!< YUYV/YUY2 (8:8:8:8 MSB V0 Y1 U0 Y0) |
| 44 | vdencSurfaceFormatRgba4444 = 1, //!< RGBA 32-bit 4:4:4:4 packed (8:8:8:8 MSB-X:B:G:R) |
| 45 | vdencSurfaceFormatYuv444 = 2, //!< YUV 32-bit 4:4:4 packed (8:8:8:8 MSB-Y:U:X:V) |
| 46 | vdencSurfaceFormatY8Unorm = 3, |
| 47 | vdencSurfaceFormatPlanar420_8 = 4, //!< (NV12, IMC1,2,3,4, YV12) |
| 48 | vdencSurfaceFormatYcrcbSwapy422 = 5, //!< UYVY (8:8:8:8 MSB Y1 V0 Y0 U0) |
| 49 | vdencSurfaceFormatYcrcbSwapuv422 = 6, //!< YVYU (8:8:8:8 MSB U0 Y1 V0 Y0) |
| 50 | vdencSurfaceFormatYcrcbSwapuvy422 = 7, //!< VYUY (8:8:8:8 MSB Y1 U0 Y0 V0) |
| 51 | vdencSurfaceFormatP010 = 8, //!< CNL+ |
| 52 | vdencSurfaceFormatRgba_10_10_10_2 = 9, //!< CNL+ |
| 53 | vdencSurfaceFormatY410 = 10, //!< CNL+ |
| 54 | vdencSurfaceFormatNv21 = 11, //!< CNL+ |
| 55 | vdencSurfaceFormatP010Variant = 12 //!< CNL+ |
| 56 | }; |
| 57 | |
| 58 | public: |
| 59 | //! |
| 60 | //! \brief Constructor |
| 61 | //! |
| 62 | MhwVdboxVdencInterfaceG9Kbl(PMOS_INTERFACE osInterface) : MhwVdboxVdencInterfaceG9(osInterface) |
| 63 | { |
| 64 | MHW_FUNCTION_ENTER; |
| 65 | |
| 66 | m_rhoDomainStatsEnabled = true; |
| 67 | } |
| 68 | |
| 69 | //! |
| 70 | //! \brief Destructor |
| 71 | //! |
| 72 | virtual ~MhwVdboxVdencInterfaceG9Kbl() { } |
| 73 | |
| 74 | //! |
| 75 | //! \brief Translate MOS type format to Mediastate VDEnc surface format |
| 76 | //! \details VDBOX protected function to translate mos format to media state format |
| 77 | //! \param MOS_FORMAT format |
| 78 | //! [in] MOS type format |
| 79 | //! \return VdencSurfaceFormat |
| 80 | //! media state surface format |
| 81 | //! |
| 82 | VdencSurfaceFormat MosFormatToVdencSurfaceFormat( |
| 83 | MOS_FORMAT format); |
| 84 | |
| 85 | MOS_STATUS AddVdencSrcSurfaceStateCmd( |
| 86 | PMOS_COMMAND_BUFFER cmdBuffer, |
| 87 | PMHW_VDBOX_SURFACE_PARAMS params); |
| 88 | |
| 89 | MOS_STATUS AddVdencImgStateCmd( |
| 90 | PMOS_COMMAND_BUFFER cmdBuffer, |
| 91 | PMHW_BATCH_BUFFER batchBuffer, |
| 92 | PMHW_VDBOX_AVC_IMG_PARAMS params); |
| 93 | |
| 94 | MOS_STATUS AddVdencWalkerStateCmd( |
| 95 | PMOS_COMMAND_BUFFER cmdBuffer, |
| 96 | PMHW_VDBOX_VDENC_WALKER_STATE_PARAMS params); |
| 97 | |
| 98 | MOS_STATUS AddVdencAvcWeightsOffsetsStateCmd( |
| 99 | PMOS_COMMAND_BUFFER cmdBuffer, |
| 100 | PMHW_VDBOX_AVC_WEIGHTOFFSET_PARAMS params); |
| 101 | |
| 102 | //! |
| 103 | //! \brief Explictly instantiate GetVdencPrimitiveCommandsDataSize of MhwVdboxVdencInterfaceG9 |
| 104 | //! for mhw_vdbox_vdenc_g9_kbl, because there is no VDENC_WEIGHTSOFFSETS_STATE_CMD for |
| 105 | //! SKL and BXT |
| 106 | //! |
| 107 | MOS_STATUS GetVdencPrimitiveCommandsDataSize( |
| 108 | uint32_t mode, |
| 109 | uint32_t *commandsSize, |
| 110 | uint32_t *patchListSize); |
| 111 | }; |
| 112 | |
| 113 | #endif |