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 }; 48 49 class MediaTask 50 { 51 public: ~MediaTask()52 virtual ~MediaTask() {} 53 //! 54 //! \brief Add media packets into current task for further execution 55 //! \param [in] packet 56 //! Pointer to the media packet and its property to add 57 //! \return MOS_STATUS 58 //! MOS_STATUS_SUCCESS if success, else fail reason 59 //! 60 virtual MOS_STATUS AddPacket(PacketProperty *packet); 61 62 //! 63 //! \brief Submit all the packets in the pool for execution 64 //! \param [in] immediateSubmit 65 //! Submit the command buffer is true, otherwise only build the command sequence and 66 //! reserve for future sumission 67 //! \param [in] scalability 68 //! Media scalability state instance for task submit 69 //! \return MOS_STATUS 70 //! MOS_STATUS_SUCCESS if success, else fail reason 71 //! 72 virtual MOS_STATUS Submit(bool immediateSubmit, MediaScalability *scalability, CodechalDebugInterface *debugInterface) = 0; 73 74 //! 75 //! \brief Clear the packets in the pool, this method must be invoked 76 //! after Submit() or when user want to explicitly clears the pool 77 //! \return MOS_STATUS 78 //! MOS_STATUS_SUCCESS if success, else fail reason 79 //! 80 virtual MOS_STATUS Clear(); 81 SetupCmdBufSize(uint32_t cmdBufSize,uint32_t patchListSize)82 virtual void SetupCmdBufSize(uint32_t cmdBufSize, uint32_t patchListSize) 83 { 84 m_cmdBufSize = cmdBufSize; 85 m_patchListSize = patchListSize; 86 } 87 88 enum class TaskType 89 { 90 cmdTask = 1, 91 mdfTask = 2, 92 }; 93 94 protected: 95 std::vector<PacketProperty> m_packets; //!< media packets pool for execution 96 uint32_t m_cmdBufSize = 0; //!< Cmd buffer size for execution 97 uint32_t m_patchListSize = 0; //!< Patch list size for execution 98 MEDIA_CLASS_DEFINE_END(MediaTask) 99 }; 100 101 #endif // !__MEDIA_TASK_H__ 102