1 /* 2 * Copyright (c) 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 //! 24 //! \file media_scalability_singlepipe.h 25 //! \brief Defines the common interface for media scalability singlepipe mode. 26 //! \details The media scalability singlepipe interface is further sub-divided by component, 27 //! this file is for the base interface which is shared by all components. 28 //! 29 30 #ifndef __ENCODE_SCALABILITY_SINGLEPIPE_H__ 31 #define __ENCODE_SCALABILITY_SINGLEPIPE_H__ 32 #include "mos_defs.h" 33 #include "mos_os.h" 34 #include "codec_hw_next.h" 35 #include "media_scalability_singlepipe_next.h" 36 #include "encode_scalability_option.h" 37 38 namespace encode 39 { 40 41 class EncodeScalabilitySinglePipe: public MediaScalabilitySinglePipeNext 42 { 43 44 public: 45 //! 46 //! \brief Encode scalability singlepipe constructor 47 //! \param [in] hwInterface 48 //! Pointer to HwInterface 49 //! \param [in] componentType 50 //! Component type 51 //! 52 EncodeScalabilitySinglePipe(void *hwInterface, MediaContext *mediaContext, uint8_t componentType); 53 54 //! 55 //! \brief Encode scalability singlepipe destructor 56 //! ~EncodeScalabilitySinglePipe()57 virtual ~EncodeScalabilitySinglePipe(){}; 58 59 //! 60 //! \brief Copy constructor 61 //! 62 EncodeScalabilitySinglePipe(const EncodeScalabilitySinglePipe&) = delete; 63 64 //! 65 //! \brief Copy assignment operator 66 //! 67 EncodeScalabilitySinglePipe& operator=(const EncodeScalabilitySinglePipe&) = delete; 68 69 //! 70 //! \brief Initialize the encode single scalability 71 //! \details It will prepare the resources needed in scalability 72 //! and initialize the state of scalability 73 //! \param [in] option 74 //! Input scalability option 75 //! \return MOS_STATUS 76 //! MOS_STATUS_SUCCESS if success, else fail reason 77 //! 78 virtual MOS_STATUS Initialize(const MediaScalabilityOption &option) override; 79 80 //! 81 //! \brief Update the media scalability singlepipe mode state 82 //! \param [in] statePars 83 //! parameters to update the state 84 //! \return MOS_STATUS 85 //! MOS_STATUS_SUCCESS if success, else fail reason 86 //! 87 virtual MOS_STATUS UpdateState(void *statePars) override; 88 89 //! 90 //! \brief Oca 1st Level BB Start 91 //! \param [in, out] cmdBuffer 92 //! Reference to command buffer 93 //! \return MOS_STATUS 94 //! MOS_STATUS_SUCCESS if success, else fail reason 95 //! 96 MOS_STATUS Oca1stLevelBBStart(MOS_COMMAND_BUFFER &cmdBuffer) override; 97 98 //! 99 //! \brief Oca 1st Level BB End 100 //! \param [in, out] cmdBuffer 101 //! Reference to command buffer 102 //! \return MOS_STATUS 103 //! MOS_STATUS_SUCCESS if success, else fail reason 104 //! 105 MOS_STATUS Oca1stLevelBBEnd(MOS_COMMAND_BUFFER &cmdBuffer) override; 106 107 protected: 108 //! 109 //! \brief Verify command buffer size and patch list size, reallocate if required 110 //! \return MOS_STATUS 111 //! MOS_STATUS_SUCCESS if success, else fail reason 112 //! 113 virtual MOS_STATUS VerifySpaceAvailable(uint32_t requestedSize, 114 uint32_t requestedPatchListSize, 115 bool &singleTaskPhaseSupportedInPak) override; 116 117 //! 118 //! \brief Resizes the cmd buffer and patch list with cmd buffer header 119 //! 120 //! \param [in] requestedCommandBufferSize 121 //! Requested resize command buffer size 122 //! \param [in] requestedPatchListSize 123 //! Requested resize patchlist size 124 //! 125 //! \return MOS_STATUS 126 //! MOS_STATUS_SUCCESS if success, else fail reason 127 //! 128 virtual MOS_STATUS ResizeCommandBufferAndPatchList( 129 uint32_t requestedCommandBufferSize, 130 uint32_t requestedPatchListSize) override; 131 132 virtual MOS_STATUS SendAttrWithFrameTracking(MOS_COMMAND_BUFFER &cmdBuffer, bool frameTrackingRequested) override; 133 134 //void InitMmioRegisters(); 135 //MmioRegistersMfx *GetMmioRegisters(MHW_VDBOX_NODE_IND index); 136 //bool ConvertToMiRegister(MHW_VDBOX_NODE_IND index, MHW_MI_MMIOREGISTERS &mmioRegister); 137 138 private: 139 CodechalHwInterfaceNext *m_hwInterface = nullptr; 140 MediaUserSettingSharedPtr m_userSettingPtr = nullptr; 141 142 ////! \brief Mmio registers address 143 //MHW_MI_MMIOREGISTERS m_mmioRegisters = {}; //!< mfx mmio registers 144 145 MEDIA_CLASS_DEFINE_END(encode__EncodeScalabilitySinglePipe) 146 }; 147 148 } 149 #endif // !__MEDIA_SCALABILITY_SINGLEPIPE_H__ 150 151