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