1 /*
2 * Copyright (c) 2010-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_render_sfc_g12_base.h
24 //! \brief    The header file of the Gen12 VPHAL SFC rendering component
25 //! \details  The SFC renderer supports Scaling, IEF, CSC/ColorFill and Rotation.
26 //!           It's responsible for setting up HW states and generating the SFC
27 //!           commands.
28 //!
29 #ifndef __VPHAL_RENDER_SFC_G12_BASE_H__
30 #define __VPHAL_RENDER_SFC_G12_BASE_H__
31 
32 #include "mhw_sfc_g12_X.h"
33 #include "vphal_render_sfc_base.h"
34 
35 #if __VPHAL_SFC_SUPPORTED
36 
37 class VphalSfcStateG12 :virtual public VphalSfcState
38 {
39 public:
40     VphalSfcStateG12(
41         PMOS_INTERFACE       osInterface,
42         PRENDERHAL_INTERFACE renderHal,
43         PMHW_SFC_INTERFACE   sfcInterface);
44 
~VphalSfcStateG12()45     virtual ~VphalSfcStateG12()
46     {
47 
48     }
49 
50     //!
51     //! \brief    Initialize sfc render data
52     //! \return   void
53     //!
InitRenderData()54     virtual void InitRenderData()
55     {
56         VphalSfcState::InitRenderData();
57         m_renderData.SfcStateParams = (MHW_SFC_STATE_PARAMS_G12*)MOS_AllocAndZeroMemory(sizeof(MHW_SFC_STATE_PARAMS_G12));
58     }
59 
60 protected:
61     virtual bool IsOutputCapable(
62         bool            isColorFill,
63         PVPHAL_SURFACE  src,
64         PVPHAL_SURFACE  renderTarget);
65 
66     virtual bool IsFormatSupported(
67         PVPHAL_SURFACE      pSrcSurface,
68         PVPHAL_SURFACE      pOutSurface,
69         PVPHAL_ALPHA_PARAMS pAlphaParams);
70 
71     virtual bool IsInputFormatSupported(
72         PVPHAL_SURFACE              srcSurface);
73 
74     virtual bool IsOutputFormatSupported(
75         PVPHAL_SURFACE              outSurface);
76 
77     virtual void GetInputWidthHeightAlignUnit(
78         MOS_FORMAT              inputFormat,
79         MOS_FORMAT              outputFormat,
80         uint16_t                &widthAlignUnit,
81         uint16_t                &heightAlignUnit,
82         bool                    isInterlacedScaling = false);
83 
84     virtual void DetermineCscParams(
85         PVPHAL_SURFACE                  src,
86         PVPHAL_SURFACE                  renderTarget);
87 
88     virtual void DetermineInputFormat(
89         PVPHAL_SURFACE                  src,
90         PVPHAL_VEBOX_RENDER_DATA        veboxRenderData);
91 
92     virtual MOS_STATUS SetSfcStateParams(
93         PVPHAL_VEBOX_RENDER_DATA    pRenderData,
94         PVPHAL_SURFACE              pSrcSurface,
95         PVPHAL_SURFACE              pOutSurface);
96 
97     virtual bool IsOutputPipeSfcFeasible(
98         PCVPHAL_RENDER_PARAMS       pcRenderParams,
99         PVPHAL_SURFACE              pSrcSurface,
100         PVPHAL_SURFACE              pRenderTarget);
101 
102     virtual void SetRenderingFlags(
103         PVPHAL_COLORFILL_PARAMS         pColorFillParams,
104         PVPHAL_ALPHA_PARAMS             pAlphaParams,
105         PVPHAL_SURFACE                  pSrc,
106         PVPHAL_SURFACE                  pRenderTarget,
107         PVPHAL_VEBOX_RENDER_DATA        pRenderData);
108 
109     //!
110     //! \brief    Set SFC MMC States
111     //! \details  Update the SFC output MMC status
112     //! \param    [in] renderData
113     //!           Pointer to Render Data
114     //! \param    [in] outSurface
115     //!           Pointer to Sfc Output Surface
116     //! \param    [in,out] sfcStateParams
117     //!           Pointer to SFC State Params
118     //! \return   MOS_STATUS
119     //!
120     virtual MOS_STATUS SetSfcMmcStatus(
121         PVPHAL_VEBOX_RENDER_DATA    renderData,
122         PVPHAL_SURFACE              outSurface,
123         PMHW_SFC_STATE_PARAMS       sfcStateParams);
124 
125     //!
126     //! \brief    Is the Format MMC Supported in SFC
127     //! \details  Check whether input format is supported by memory compression
128     //! \param    [in] Format
129     //!           Surface format
130     //! \return   true if supported, false if not
131     //!
132     virtual bool IsFormatMMCSupported(
133         MOS_FORMAT                  Format);
134 
135     bool m_disableOutputCentering = false;                      //!< flag for whether to disable Output centering, for validation purpose
136 };
137 
138 #endif // __VPHAL_SFC_SUPPORTED
139 #endif // __VPHAL_RENDER_SFC_G12_BASE_H__
140