File: media_interfaces_mhw.h

package info (click to toggle)
intel-media-driver 18.4.1%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 77,144 kB
  • sloc: cpp: 784,288; ansic: 95,944; asm: 42,125; python: 353; sh: 156; makefile: 15
file content (135 lines) | stat: -rw-r--r-- 4,612 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/*
* Copyright (c) 2013-2017, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
//!
//! \file     media_interfaces_mhw.h
//! \brief    Gen-specific factory creation of the mhw interfaces
//!

#ifndef __MEDIA_INTERFACES_MHW_H__
#define __MEDIA_INTERFACES_MHW_H__

#include "media_interfaces.h"
#include "igfxfmid.h"
#include "mos_utilities.h"
#include "mos_os.h"

// forward declarations
class MhwCpInterface;
class MhwMiInterface;
class MhwRenderInterface;
class MhwSfcInterface;
class XMHW_STATE_HEAP_INTERFACE;
class MhwVeboxInterface;
class MhwVeboxInterface;
class MhwVdboxMfxInterface;
class MhwVdboxHcpInterface;
class MhwVdboxHucInterface;
class MhwVdboxVdencInterface;

//!
//! \class    MhwInterfaces
//! \brief    MHW interfaces
//!
class MhwInterfaces
{
public:
    virtual ~MhwInterfaces() {}

    //! \brief Determines which interfaces are created
    struct CreateParams
    {
        CreateParams()
        {
            Flags.m_value = 0;
        }

        union
        {
            struct
            {
                uint32_t m_render : 1;
                uint32_t m_sfc : 1;
                uint32_t m_stateHeap : 1;
                uint32_t m_vebox : 1;
                uint32_t m_vdboxAll : 1;
                uint32_t m_mfx : 1;
                uint32_t m_hcp : 1;
                uint32_t m_huc : 1;
                uint32_t m_vdenc : 1;
                uint32_t m_reserved : 23;
            };
            uint32_t m_value;
        } Flags;

        uint8_t m_heapMode = 0; //!< To be deprecated when heap management unified
        bool m_isDecode = false; //!< Whether or not decode is in use, only valid for VDBOX creation
        bool m_isCp     = false; //!< Whether or not CP is in use, CP only need mi and cp interface.
    };

    //! \brief These interfaces are responsible for constructing instructions,
     //!           structures, and registers for hardware.
    MhwCpInterface *m_cpInterface = nullptr;
    MhwMiInterface *m_miInterface = nullptr;
    MhwRenderInterface *m_renderInterface = nullptr;
    MhwSfcInterface *m_sfcInterface = nullptr;
    XMHW_STATE_HEAP_INTERFACE *m_stateHeapInterface = nullptr;
    MhwVeboxInterface *m_veboxInterface = nullptr;
    MhwVdboxMfxInterface *m_mfxInterface = nullptr;
    MhwVdboxHcpInterface *m_hcpInterface = nullptr;
    MhwVdboxHucInterface *m_hucInterface = nullptr;
    MhwVdboxVdencInterface *m_vdencInterface = nullptr;

    //!
    //! \brief    Calls the factory function to initialize all requested interfaces.
    //! \param    [in] params
    //!           Configuration flags for the creation of MHW interfaces.
    //! \param    [in] osInterface
    //!           OS interface
    //! \return   MhwInterfaces*
    //!           returns a valid pointer if successful and nullptr if failed.
    //!
    static MhwInterfaces* CreateFactory(
        CreateParams params,
        PMOS_INTERFACE osInterface);

    //!
    //! \brief    Creates requested MHW interfaces.
    //! \param    [in] params
    //!           Configuration flags for the creation of MHW interfaces.
    //! \param    [in] osInterface
    //!           OS interface
    //! \return   MOS_STATUS_SUCCESS if succeeded, else error code.
    //!
    virtual MOS_STATUS Initialize(
        CreateParams params,
        PMOS_INTERFACE osInterface) = 0;

    //!
    //! \brief    Destroys all created MHW interfaces
    //! \details  If the HAL creation fails, this is used for cleanup
    //!
    void Destroy();
};

extern template class MediaInterfacesFactory<MhwInterfaces>;

#endif // __MEDIA_INTERFACES_MHW_H__