1 /*
2 * Copyright (c) 2021, 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_next.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 __MEDIA_SCALABILITY_SINGLEPIPE_NEXT_H__
31 #define __MEDIA_SCALABILITY_SINGLEPIPE_NEXT_H__
32 #include <stdint.h>
33 #include "mos_os_specific.h"
34 #include "mos_defs.h"
35 #include "mos_os.h"
36 #include "media_scalability.h"
37 class MediaContext;
38 class MediaScalabilityOption;
39 
40 class MediaScalabilitySinglePipeNext: public MediaScalability
41 {
42 
43 public:
44     //!
45     //! \brief  Media scalability singlepipe constructor
46     //! \param  [in] hwInterface
47     //!         Pointer to HwInterface
48     //! \param  [in] componentType
49     //!         Component type
50     //!
51     MediaScalabilitySinglePipeNext(void *hwInterface, MediaContext *mediaContext, uint8_t componentType);
52 
53     //!
54     //! \brief  Media scalability singlepipe destructor
55     //!
~MediaScalabilitySinglePipeNext()56     virtual ~MediaScalabilitySinglePipeNext(){};
57 
58     //!
59     //! \brief    Copy constructor
60     //!
61     MediaScalabilitySinglePipeNext(const MediaScalabilitySinglePipeNext&) = delete;
62 
63     //!
64     //! \brief    Copy assignment operator
65     //!
66     MediaScalabilitySinglePipeNext& operator=(const MediaScalabilitySinglePipeNext&) = delete;
67 
68     //!
69     //! \brief   Initialize the media single pipe scalability
70     //! \details It will prepare the resources needed in scalability
71     //!          and initialize the state of scalability
72     //! \param   [in] option
73     //!          Input scalability option
74     //! \return  MOS_STATUS
75     //!          MOS_STATUS_SUCCESS if success, else fail reason
76     //!
77     virtual MOS_STATUS Initialize(const MediaScalabilityOption &option) override;
78 
79     //!
80     //! \brief  Construct parameters for GPU context create.
81     //! \param   [in, out] gpuCtxCreateOption
82     //!          Pointer to the GPU Context Create Option
83     //! \return  MOS_STATUS
84     //!          MOS_STATUS_SUCCESS if success, else fail reason
85     //!
86     virtual MOS_STATUS GetGpuCtxCreationOption(MOS_GPUCTX_CREATOPTIONS *gpuCtxCreateOption) override;
87 
88     //!
89     //! \brief  Destroy the media scalability
90     //! \return MOS_STATUS
91     //!         MOS_STATUS_SUCCESS if success, else fail reason
92     //!
93     virtual MOS_STATUS Destroy() override;
94 
95     //!
96     //! \brief  Update the media scalability singlepipe mode state
97     //! \param  [in] statePars
98     //!         parameters to update the state
99     //! \return MOS_STATUS
100     //!         MOS_STATUS_SUCCESS if success, else fail reason
101     //!
UpdateState(void * statePars)102     virtual MOS_STATUS UpdateState(void *statePars) override { return MOS_STATUS_SUCCESS; }
103 
104     //!
105     //! \brief  Verify command buffer
106     //! \param  [in] requestedSize
107     //!         requested size for command buffer
108     //! \param  [in] requestedPatchListSize
109     //!         requested size for patched list
110     //! \param  [out] singleTaskPhaseSupportedInPak
111     //!         Inidcate if to use single task phase in pak.
112     //! \return MOS_STATUS
113     //!         MOS_STATUS_SUCCESS if success, else fail reason
114     //!
115     virtual MOS_STATUS VerifyCmdBuffer(uint32_t requestedSize,
116                 uint32_t requestedPatchListSize,
117                 bool &singleTaskPhaseSupportedInPak)  override;
118 
119     //!
120     //! \brief  Get command buffer
121     //! \param  [in, out] cmdBuffer
122     //!         Pointer to command buffer
123     //! \return MOS_STATUS
124     //!         MOS_STATUS_SUCCESS if success, else fail reason
125     //!
126     virtual MOS_STATUS GetCmdBuffer(PMOS_COMMAND_BUFFER cmdBuffer, bool frameTrackingRequested = true) override;
127 
128     //!
129     //! \brief  Return command buffer
130     //! \param  [in, out] cmdBuffer
131     //!         Pointer to command buffer
132     //! \return MOS_STATUS
133     //!         MOS_STATUS_SUCCESS if success, else fail reason
134     //!
135     virtual MOS_STATUS ReturnCmdBuffer(PMOS_COMMAND_BUFFER cmdBuffer) override;
136 
137     //!
138     //! \brief  Submit command buffer
139     //! \param  [in, out] cmdBuffer
140     //!         Pointer to command buffer
141     //! \return MOS_STATUS
142     //!         MOS_STATUS_SUCCESS if success, else fail reason
143     //!
144     virtual MOS_STATUS SubmitCmdBuffer(PMOS_COMMAND_BUFFER cmdBuffer) override;
145 
146     //!
147     //! \brief  Add synchronization for pipes.
148     //! \param  [in] syncType
149     //!         type of pipe sync
150     //! \param  [in] semaphoreId
151     //!         Id of the semaphore used for this sync
152     //! \param  [in, out] cmdBuffer
153     //!         Pointer to command buffer
154     //! \return MOS_STATUS
155     //!         MOS_STATUS_SUCCESS if success, else fail reason
156     //!
SyncPipe(uint32_t syncType,uint32_t semaphoreId,PMOS_COMMAND_BUFFER cmdBuffer)157     virtual MOS_STATUS SyncPipe(uint32_t syncType, uint32_t semaphoreId, PMOS_COMMAND_BUFFER cmdBuffer) override { return MOS_STATUS_SUCCESS;};
158 
159     //!
160     //! \brief  Reset semaphore
161     //! \param  [in] syncType
162     //!         type of pipe sync
163     //! \param  [in] semaphoreId
164     //!         Id of the semaphore used for this sync
165     //! \param  [in, out] cmdBuffer
166     //!         Pointer to command buffer
167     //! \return MOS_STATUS
168     //!         MOS_STATUS_SUCCESS if success, else fail reason
169     //!
ResetSemaphore(uint32_t syncType,uint32_t semaphoreId,PMOS_COMMAND_BUFFER cmdBuffer)170     virtual MOS_STATUS ResetSemaphore(uint32_t syncType, uint32_t semaphoreId, PMOS_COMMAND_BUFFER cmdBuffer) override { return MOS_STATUS_SUCCESS;};
171 
172     //!
173     //! \brief  Set hint parameters
174     //! \return MOS_STATUS
175     //!         MOS_STATUS_SUCCESS if success, else fail reason
176     //!
177     virtual MOS_STATUS SetHintParams();
178 
179     //!
180     //! \brief  Populate hint parameters
181     //! \param  [in] cmdBuffer
182     //!         Pointer to command buffer
183     //! \return MOS_STATUS
184     //!         MOS_STATUS_SUCCESS if success, else fail reason
185     //!
186     MOS_STATUS PopulateHintParams(PMOS_COMMAND_BUFFER cmdBuffer);
187 MEDIA_CLASS_DEFINE_END(MediaScalabilitySinglePipeNext)
188 };
189 
190 #endif // !__MEDIA_SCALABILITY_SINGLEPIPE_H__
191 
192