1 /*
2 * Copyright (c) 2017, 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_vebox_tcc.cpp
24 //! \brief    VPHAL VEBOX IECP Total Color Control (TCC) interfaces
25 //! \details  VPHAL VEBOX IECP Total Color Control (TCC) interfaces
26 //!
27 
28 #include "vphal_render_vebox_tcc.h"
29 
30 #if VPHAL_RENDER_VEBOX_TCC_ENABLE
31 
32 //!
33 //! \brief    Vebox set IECP parameter
34 //! \details  Set Vebox IECP state parameter
35 //! \param    [in] pSrcSurface
36 //!           Pointer to input surface of Vebox
37 //! \param    [in,out] pRenderData
38 //!           Pointer to Vebox Render Data
39 //! \return   void
40 //!
SetParams(PVPHAL_SURFACE pSrcSurface,PVPHAL_VEBOX_RENDER_DATA pRenderData)41 void VPHAL_VEBOX_IECP_TCC::SetParams(
42     PVPHAL_SURFACE              pSrcSurface,
43     PVPHAL_VEBOX_RENDER_DATA    pRenderData)
44 {
45     PVPHAL_VEBOX_IECP_PARAMS    pVphalVeboxIecpParams;
46 
47     pVphalVeboxIecpParams = pRenderData->GetVeboxIECPParams();
48 
49     if (pSrcSurface->pColorPipeParams && pRenderData->bColorPipe)
50     {
51         pVphalVeboxIecpParams->pColorPipeParams = pSrcSurface->pColorPipeParams;
52 
53         pRenderData->GetVeboxStateParams()->pVphalVeboxIecpParams = pVphalVeboxIecpParams;
54     }
55 }
56 
57 //!
58 //! \brief    Init Vebox IECP parameter
59 //! \param    [in] pVphalVeboxIecpParams
60 //!           Pointer to input Vphal Iecp parameters
61 //! \param    [in,out] pMhwVeboxIecpParams
62 //!           Pointer to Mhw Iecp parameters
63 //! \return   void
64 //!
InitParams(PVPHAL_VEBOX_IECP_PARAMS pVphalVeboxIecpParams,PMHW_VEBOX_IECP_PARAMS pMhwVeboxIecpParams)65 void VPHAL_VEBOX_IECP_TCC::InitParams(
66     PVPHAL_VEBOX_IECP_PARAMS        pVphalVeboxIecpParams,
67     PMHW_VEBOX_IECP_PARAMS          pMhwVeboxIecpParams)
68 {
69     PVPHAL_COLORPIPE_PARAMS         pVpHalColorPipeParams;
70     PMHW_COLORPIPE_PARAMS           pMhwColorPipeParams;
71 
72     pVpHalColorPipeParams = pVphalVeboxIecpParams->pColorPipeParams;
73     pMhwColorPipeParams = &pMhwVeboxIecpParams->ColorPipeParams;
74     if (pVpHalColorPipeParams)
75     {
76         pMhwColorPipeParams->bActive            = true;
77         pMhwColorPipeParams->bEnableTCC         = pVpHalColorPipeParams->bEnableTCC;
78         pMhwColorPipeParams->TccParams.Red      = pVpHalColorPipeParams->TccParams.Red;
79         pMhwColorPipeParams->TccParams.Green    = pVpHalColorPipeParams->TccParams.Green;
80         pMhwColorPipeParams->TccParams.Blue     = pVpHalColorPipeParams->TccParams.Blue;
81         pMhwColorPipeParams->TccParams.Cyan     = pVpHalColorPipeParams->TccParams.Cyan;
82         pMhwColorPipeParams->TccParams.Magenta  = pVpHalColorPipeParams->TccParams.Magenta;
83         pMhwColorPipeParams->TccParams.Yellow   = pVpHalColorPipeParams->TccParams.Yellow;
84     }
85 }
86 
87 #endif // VPHAL_RENDER_VEBOX_TCC_ENABLE