• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 * Copyright (c) 2017-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     vphal_renderer_g12_tgllp.h
24 //! \brief    The header file of VPHAL top level rendering component
25 //! \details  The top renderer is responsible for coordinating the sequence of calls to low level renderers, e.g. DNDI or Comp
26 //!
27 #ifndef __VPHAL_RENDERER_G12TGLLP_H__
28 #define __VPHAL_RENDERER_G12TGLLP_H__
29 
30 #include "vphal_renderer_g12.h"
31 
32 //!
33 //! \brief VPHAL renderer Gen12 class
34 //!
35 class VphalRendererG12Tgllp : public VphalRendererG12
36 {
37 public:
38     //!
39     //! \brief    VphalRendererG12Tgllp constructor
40     //! \details  Based on the HW and OS info, initialize the renderer interfaces
41     //! \param    [in] pRenderHal
42     //!           Pointer to RenderHal Interface Structure
43     //! \param    [in,out] pStatus
44     //!           Pointer to the MOS_STATUS flag.
45     //!           Will assign this flag to MOS_STATUS_SUCCESS if successful, otherwise failed
46     //!
VphalRendererG12Tgllp(PRENDERHAL_INTERFACE pRenderHal,MOS_STATUS * pStatus)47     VphalRendererG12Tgllp(
48         PRENDERHAL_INTERFACE                pRenderHal,
49         MOS_STATUS                          *pStatus) :
50         VphalRendererG12(pRenderHal, pStatus)
51     {
52         bEnableCMFC = true;
53         for (uint32_t nIndex = 0; nIndex < VPHAL_MAX_NUM_DS_SURFACES; nIndex++)
54         {
55             m_pDSSurface[nIndex] = nullptr;
56         }
57     }
58 
59     //!
60     //! \brief    VPHAL renderer destructor
61     //! \details  Destory the resources allocated for the renderers
62     //!           including VEBOX and Composite.
63     //! \param    [in,out] VphalRenderer* pRenderer
64     //!           VPHAL renderer pointer
65     //! \return   VOID
66     //!
~VphalRendererG12Tgllp()67     ~VphalRendererG12Tgllp()
68     {
69         for (uint32_t nIndex = 0; nIndex < VPHAL_MAX_NUM_DS_SURFACES; nIndex++)
70         {
71             if (m_pDSSurface[nIndex])
72             {
73                 m_pOsInterface->pfnFreeResource(m_pOsInterface, &m_pDSSurface[nIndex]->OsResource);
74                 //release 3dlut params
75                 if (m_pDSSurface[nIndex]->p3DLutParams)
76                 {
77                     MOS_FreeMemory(m_pDSSurface[nIndex]->p3DLutParams);
78                     m_pDSSurface[nIndex]->p3DLutParams = nullptr;
79                 }
80             }
81             MOS_FreeMemAndSetNull(m_pDSSurface[nIndex]);
82         }
83     }
84 
85     //!
86     //! \brief    Initialize the KDLL parameters
87     //! \details  Initialize the KDLL parameters
88     //! \return   MOS_STATUS
89     //!
90     MOS_STATUS InitKdllParam();
91 
92     //!
93     //! \brief    Main render function
94     //! \details  The top level renderer function, which may contain multiple
95     //!           passes of rendering
96     //! \param    [in] pcRenderParams
97     //!           Const pointer to VPHAL render parameter
98     //! \return   MOS_STATUS
99     //!           Return MOS_STATUS_SUCCESS if successful, otherwise failed
100     //!
101     MOS_STATUS Render(PCVPHAL_RENDER_PARAMS   pcRenderParams);
102 
103     //!
104     //! \brief    set Render Gpu Context
105     //! \details  set Render Gpu Context based on lumakey and CCS status.
106     //! \param    [in] RenderParams
107     //!           VPHAL render parameter
108     //! \return   MOS_STATUS
109     //!           Return MOS_STATUS_SUCCESS if successful, otherwise failed
110     //!
111     MOS_STATUS SetRenderGpuContext(VPHAL_RENDER_PARAMS& RenderParams);
112 
113 private:
114     //!
115     //! \brief    Scaling function
116     //! \details  The scaling function is only for scaling without other VP features.
117     //!           Down scaling needs 2 pass if scaling ratio is >2 for better quality.
118     //!           Pass#1 DS to 1/2 target resolution; Pass #2: DS from 1/2 target resolution to target resolution
119     //! \param    [in,out] pRenderParams
120     //!           Pointer to VPHAL render parameter
121     //! \return   MOS_STATUS
122     //!           Return MOS_STATUS_SUCCESS if successful, otherwise failed
123     //!
124     MOS_STATUS RenderScaling(
125         PVPHAL_RENDER_PARAMS    pRenderParams);
126 
127     // Surfaces for down scaling if down scaling firstly in the use case scaling + 3dlut
128     PVPHAL_SURFACE    m_pDSSurface[VPHAL_MAX_NUM_DS_SURFACES];
129 };
130 
131 #endif // __VPHAL_RENDER_G12TGLLP_H__
132