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