xref: /aosp_15_r20/external/intel-media-driver/media_driver/agnostic/gen12_tgllp/vp/hal/vphal_g12_tgllp.h (revision ba62d9d3abf0e404f2022b4cd7a85e107f48596f)
1 /*
2 * Copyright (c) 2019, 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     vphal_g12_tgllp.h
24 //! \brief    vphal interface clarification for GEN12 TGL LP
25 //! \details  vphal interface clarification for GEN12 TGL LP inlcuding:
26 //!           some marcro, enum, structure, function
27 //!
28 #ifndef __VPHAL_G12TGLLP_H__
29 #define __VPHAL_G12TGLLP_H__
30 
31 #include "vphal.h"
32 
33 //!
34 //! Class VphalStateG12Tgllp
35 //! \brief VPHAL class definition for GEN12 TGL LP
36 //!
37 class VphalStateG12Tgllp : public VphalState
38 {
39 public:
40     //!
41     //! \brief    VphalState Constructor
42     //! \details  Creates instance of VphalState
43     //!           - Caller must call Allocate to allocate all VPHAL states and objects.
44     //! \param    [in] pOsInterface
45     //!           OS interface, if provided externally - may be NULL
46     //! \param    [in,out] pStatus
47     //!           Pointer to the MOS_STATUS flag.
48     //!           Will assign this flag to MOS_STATUS_SUCCESS if successful, otherwise failed
49     //!
VphalStateG12Tgllp(PMOS_INTERFACE pOsInterface,MOS_STATUS * peStatus)50     VphalStateG12Tgllp(
51         PMOS_INTERFACE          pOsInterface,
52         MOS_STATUS              *peStatus) :
53         VphalState(pOsInterface, peStatus)
54     {
55         // check the peStatus returned from VphalState
56         MOS_STATUS eStatus = peStatus ? (*peStatus) : MOS_STATUS_SUCCESS;
57 
58         if (MOS_FAILED(eStatus))
59         {
60             VPHAL_PUBLIC_ASSERTMESSAGE("VphalStateG12Tgllp construct failed due to VphalState() returned failure: eStatus = %d", eStatus);
61             return;
62         }
63 
64         bool                        bComputeContextEnabled;
65 
66         // bComputeContextEnabled is true only if Gen12+ for compute context(CCS). Gen12+, compute context(MOS_GPU_CONTEXT_COMPUTE)
67         // can be used for media kernel. Before Gen12, we only use MOS_GPU_CONTEXT_RENDER which we know as RCS for media kernel.
68         // On TGLLP, CCS has a HW limition for Luma-key/Chroma key feature since 3DSTATE_CHROMA_KEY support for ComputeCS.
69         // Therefore, RCS is by Default on TGLLP.
70         bComputeContextEnabled      = false;
71 
72 #if (_DEBUG || _RELEASE_INTERNAL)
73         bool       computeContextEnabled = false;
74         MOS_STATUS                  eRegKeyReadStatus = MOS_STATUS_SUCCESS;
75         eRegKeyReadStatus = ReadUserSettingForDebug(
76             m_userSettingPtr,
77             computeContextEnabled,
78             __VPHAL_ENABLE_COMPUTE_CONTEXT,
79             MediaUserSetting::Group::Sequence);
80         if (eRegKeyReadStatus == MOS_STATUS_SUCCESS)
81         {
82             bComputeContextEnabled = computeContextEnabled ? true : false;
83         }
84 
85         if (m_skuTable && !MEDIA_IS_SKU(m_skuTable, FtrCCSNode))
86         {
87             bComputeContextEnabled = false;
88         }
89 
90         if (bComputeContextEnabled)
91         {
92             m_renderGpuContext = MOS_GPU_CONTEXT_COMPUTE;
93             m_renderGpuNode    = MOS_GPU_NODE_COMPUTE;
94         }
95 #endif
96     }
97 
98     //!
99     //! \brief    VphalState Destuctor
100     //! \details  Destroys VPHAL and all internal states and objects
101     //! \return   VOID
102     //!
~VphalStateG12Tgllp()103     ~VphalStateG12Tgllp()
104     {
105     }
106 
107     //!
108     //! \brief    Allocate VPHAL Resources
109     //! \details  Allocate VPHAL Resources
110     //!           - Allocate and initialize HW states
111     //!           - Allocate and initialize renderer states
112     //! \param    [in] pVpHalSettings
113     //!           Pointer to VPHAL Settings
114     //! \return   MOS_STATUS
115     //!           Return MOS_STATUS_SUCCESS if successful, otherwise failed
116     //!
117     virtual MOS_STATUS Allocate(
118         const VphalSettings *pVpHalSettings) override;
119 
120 protected:
121 
IsRenderContextBasedSchedulingNeeded()122     virtual bool IsRenderContextBasedSchedulingNeeded() override
123     {
124         return true;
125     }
126 
127     //!
128     //! \brief    Create instance of VphalRenderer
129     //! \details  Create instance of VphalRenderer
130     //! \return   MOS_STATUS
131     //!           Return MOS_STATUS_SUCCESS if successful, otherwise failed
132     //!
133     MOS_STATUS CreateRenderer() override;
134 };
135 
136 #endif  // __VPHAL_G12TGLLP_H__
137