| 1 | /* |
| 2 | * Copyright (c) 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 | //! |
| 24 | //! \file vp_phase.h |
| 25 | //! \brief Defines the common interface for vp phase. |
| 26 | //! \details The vp phase interface is further sub-divided by vps, |
| 27 | //! this file is for the base interface which is shared by all vps. |
| 28 | //! |
| 29 | |
| 30 | #ifndef __VP_PHASE_H__ |
| 31 | #define __VP_PHASE_H__ |
| 32 | |
| 33 | #include "vp_pipeline.h" |
| 34 | #include "vp_scalability_option.h" |
| 35 | |
| 36 | namespace vp |
| 37 | { |
| 38 | |
| 39 | class VpPhase : public ComponentState |
| 40 | { |
| 41 | public: |
| 42 | //! |
| 43 | //! \brief vp phase constructor |
| 44 | //! |
| 45 | VpPhase() {}; |
| 46 | |
| 47 | //! |
| 48 | //! \brief vp scalability phase destructor |
| 49 | //! |
| 50 | virtual ~VpPhase() {}; |
| 51 | |
| 52 | //! |
| 53 | //! \brief Initialize the vp scalability phase |
| 54 | //! \param [in] pass |
| 55 | //! Pass for current phase |
| 56 | //! \param [in] pipe |
| 57 | //! Pipe for current phase |
| 58 | //! \param [in] activePipeNum |
| 59 | //! Number of active pipes for current pass |
| 60 | //! \return MOS_STATUS |
| 61 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 62 | //! |
| 63 | virtual MOS_STATUS Initialize(uint8_t pass = 0, |
| 64 | uint8_t pipe = 0, |
| 65 | uint8_t activePipeNum = 1) = 0; |
| 66 | |
| 67 | //! |
| 68 | //! \brief Get command buffer index for current phase, primary command buffer index is zero, |
| 69 | //! secondary command buffer index start from one. |
| 70 | //! \return uint32_t |
| 71 | //! Command buffer index for current phase |
| 72 | //! |
| 73 | virtual uint32_t GetCmdBufIndex() = 0; |
| 74 | |
| 75 | //! |
| 76 | //! \brief Get command buffer submission type |
| 77 | //! \return uint32_t |
| 78 | //! Command buffer submission type |
| 79 | //! |
| 80 | virtual uint32_t GetSubmissionType() = 0; |
| 81 | |
| 82 | //! |
| 83 | //! \brief Get pipe work mode and engine mode |
| 84 | //! \return MOS_STATUS |
| 85 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 86 | //! |
| 87 | virtual MOS_STATUS GetMode(uint32_t &pipeWorkMode, uint32_t &multiEngineMode) = 0; |
| 88 | |
| 89 | //! |
| 90 | //! \brief Get packet id for this phase |
| 91 | //! \return uint32_t |
| 92 | //! Packet id for this phase |
| 93 | //! |
| 94 | virtual uint32_t GetPktId() = 0; |
| 95 | |
| 96 | //! |
| 97 | //! \brief Indicator if this phase submit immediately |
| 98 | //! \return bool |
| 99 | //! True if this phase submit immediately, else fasle |
| 100 | //! |
| 101 | virtual bool ImmediateSubmit() = 0; |
| 102 | |
| 103 | //! |
| 104 | //! \brief Indicator if this phase reuquires context switch |
| 105 | //! \return bool |
| 106 | //! True if this phase reuquires context switch, else fasle |
| 107 | //! |
| 108 | virtual bool RequiresContextSwitch() = 0; |
| 109 | |
| 110 | //! |
| 111 | //! \brief Scalability option for this phase if requires context switch |
| 112 | //! \return VpScalabilityOption * |
| 113 | //! Scalability option for this phase |
| 114 | //! |
| 115 | virtual VpScalabilityOption* GetVpScalabilityOption() = 0; |
| 116 | |
| 117 | //! |
| 118 | //! \brief Get pass number for current phase |
| 119 | //! \return uint8_t |
| 120 | //! Pass number for current phase |
| 121 | //! |
| 122 | virtual uint8_t GetPass() { return m_pass; } |
| 123 | |
| 124 | //! |
| 125 | //! \brief Get pipe number for current phase |
| 126 | //! \return uint8_t |
| 127 | //! Pipe number for current phase |
| 128 | //! |
| 129 | virtual uint8_t GetPipe() { return m_pipe; } |
| 130 | |
| 131 | //! |
| 132 | //! \brief Get active pipe number for current phase |
| 133 | //! \return uint8_t |
| 134 | //! Active pipe number for current phase |
| 135 | //! |
| 136 | virtual uint8_t GetActivePipeNum() { return m_activePipeNum; } |
| 137 | |
| 138 | static constexpr uint32_t m_primaryCmdBufIdx = 0; |
| 139 | static constexpr uint32_t m_secondaryCmdBufIdxBase = m_primaryCmdBufIdx + 1; |
| 140 | |
| 141 | protected: |
| 142 | uint8_t m_pass = 0; //!< Pass index for current phase |
| 143 | uint8_t m_pipe = 0; //!< Pipe index for current phase |
| 144 | uint8_t m_activePipeNum = 1; //!< Number of active pipe number for current pass |
| 145 | |
| 146 | MEDIA_CLASS_DEFINE_END(vp__VpPhase) |
| 147 | }; |
| 148 | |
| 149 | } |
| 150 | #endif // !__VP_PHASE_H__ |
| 151 |