1 /* 2 * Copyright (c) 2013-2017, 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 //! \file media_interfaces_codechal.h 24 //! \brief Gen-specific factory creation of the codechal interfaces 25 //! 26 27 #ifndef __MEDIA_INTERFACES_CODECHAL_H__ 28 #define __MEDIA_INTERFACES_CODECHAL_H__ 29 30 #include "codechal.h" 31 #include "codechal_hw.h" 32 33 //! 34 //! \class CodechalDevice 35 //! \brief Cddehal device 36 //! 37 class CodechalDevice 38 { 39 public: ~CodechalDevice()40 virtual ~CodechalDevice() {} 41 42 Codechal *m_codechalDevice = nullptr; //!< CodecHal device supporting requested mode 43 44 //! 45 //! \brief Creates the CodecHal device. 46 //! \details Allocates all interfaces necessary for CodecHal to function in the requested configuration and sets up all function pointers. 47 //! \param [in] osInterface 48 //! If an OS interface already exists, it may be passed in here for use by the CodecHal device, if not, one is created. 49 //! \param [in] osDriverContext 50 //! OS context used by to initialize the MOS_INTERFACE, includes information necessary for resource management and interfacing with KMD in general 51 //! \param [in] standardInfo 52 //! Information required to correctly initialize the decode or encode interface for a particular standard. 53 //! \param [in] settings 54 //! Codechal setting information. 55 //! \return Codechal* 56 //! returns a valid pointer if successful and nullptr if failed. 57 //! 58 static Codechal* CreateFactory( 59 PMOS_INTERFACE osInterface, 60 PMOS_CONTEXT osDriverContext, 61 void *standardInfo, 62 void *settings); 63 64 //! 65 //! \brief Initializes platform specific decode and encode states 66 //! \param [in] standardInfo 67 //! Information required to correctly initialize the decode or encode interface for a particular standard. 68 //! \param [in] settings 69 //! Codechal setting information. 70 //! \param [in] mhwInterfaces 71 //! MHW interfaces used to init codechal hw interface. 72 //! \param [in] osInterface 73 //! OS interface for codechal 74 //! \return MOS_STATUS_SUCCESS if succeeded, else error code. 75 //! 76 virtual MOS_STATUS Initialize( 77 void *standardInfo, 78 void *settings, 79 MhwInterfaces *mhwInterfaces, 80 PMOS_INTERFACE osInterface) = 0; 81 }; 82 83 extern template class MediaFactory<uint32_t, CodechalDevice>; 84 85 #endif // __MEDIA_INTERFACES_CODECHAL_H__ 86