Debian Codegraph @

media_softlet/agnostic/common/shared/task/media_task.h

raw
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_task.h
25 //! \brief Defines the common interface for media task
26 //! \details The media task is further sub-divided into mdf and cmd type
27 //! this file is for the base interface which is shared by all task.
28 //!
29
30 #ifndef __MEDIA_TASK_H__
31 #define __MEDIA_TASK_H__
32 #include <vector>
33 #include <stdint.h>
34 #include "mos_defs.h"
35 #include "media_scalability_defs.h"
36 #include "media_scalability.h"
37
38 class CodechalDebugInterface;
39 class MediaPacket;
40 struct PacketProperty
41 {
42 MediaPacket *packet = nullptr;
43 uint32_t packetId = 0;
44 bool immediateSubmit = false;
45 bool frameTrackingRequested = true;
46 StateParams stateProperty;
47 bool skipOcaBBStartInCmdTask = false;
48 };
49
50 class MediaTask
51 {
52 public:
53 virtual ~MediaTask() {}
54 //!
55 //! \brief Add media packets into current task for further execution
56 //! \param [in] packet
57 //! Pointer to the media packet and its property to add
58 //! \return MOS_STATUS
59 //! MOS_STATUS_SUCCESS if success, else fail reason
60 //!
61 virtual MOS_STATUS AddPacket(PacketProperty *packet);
62
63 //!
64 //! \brief Submit all the packets in the pool for execution
65 //! \param [in] immediateSubmit
66 //! Submit the command buffer is true, otherwise only build the command sequence and
67 //! reserve for future sumission
68 //! \param [in] scalability
69 //! Media scalability state instance for task submit
70 //! \return MOS_STATUS
71 //! MOS_STATUS_SUCCESS if success, else fail reason
72 //!
73 virtual MOS_STATUS Submit(bool immediateSubmit, MediaScalability *scalability, CodechalDebugInterface *debugInterface) = 0;
74
75 //!
76 //! \brief Submit all the packets in the pool for execution
77 //! \param [in] immediateSubmit
78 //! Submit the command buffer is true, otherwise only build the command sequence and
79 //! reserve for future sumission
80 //! \param [in] scalability
81 //! Media scalability state instance for task submit
82 //! \param [in] levelzeroRuntimeInUse
83 //! Whether submit to levelzero runtime instead of MHW
84 //! \return MOS_STATUS
85 //! MOS_STATUS_SUCCESS if success, else fail reason
86 //!
87 virtual MOS_STATUS Submit(bool immediateSubmit, MediaScalability *scalability, CodechalDebugInterface *debugInterface, bool levelzeroRuntimeInUse) = 0;
88
89 //!
90 //! \brief Submit packets to levelzero runtime
91 //! \return MOS_STATUS
92 //! MOS_STATUS_SUCCESS if success, else fail reason
93 //!
94 virtual MOS_STATUS SubmitToLevelzeroRuntime() = 0;
95
96 //!
97 //! \brief Clear the packets in the pool, this method must be invoked
98 //! after Submit() or when user want to explicitly clears the pool
99 //! \return MOS_STATUS
100 //! MOS_STATUS_SUCCESS if success, else fail reason
101 //!
102 virtual MOS_STATUS Clear();
103
104 virtual void SetupCmdBufSize(uint32_t cmdBufSize, uint32_t patchListSize)
105 {
106 m_cmdBufSize = cmdBufSize;
107 m_patchListSize = patchListSize;
108 }
109
110 enum class TaskType
111 {
112 cmdTask = 1,
113 mdfTask = 2,
114 };
115
116 protected:
117 std::vector<PacketProperty> m_packets; //!< media packets pool for execution
118 uint32_t m_cmdBufSize = 0; //!< Cmd buffer size for execution
119 uint32_t m_patchListSize = 0; //!< Patch list size for execution
120 MEDIA_CLASS_DEFINE_END(MediaTask)
121 };
122
123 #endif // !__MEDIA_TASK_H__