1 /*
2 * Copyright (c) 2016-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_renderstate.cpp
24 //! \brief    VPHAL RenderState class implementation
25 //! \details  RenderState class function implementation
26 //!
27 #include "vphal_renderer.h"
28 #include "vphal_render_renderstate.h"
29 
30 //!
31 //! \brief    RenderState Constructor
32 //! \details  Construct RenderState and allocate member data structure
33 //! \param    [in] pOsInterface
34 //!           Pointer to MOS interface structure
35 //! \param    [in] pRenderHal
36 //!           Pointer to RenderHal interface structure
37 //! \param    [in] pPerfData
38 //!           Pointer to performance data structure
39 //! \param    [out] peStatus
40 //!           Pointer to MOS status
41 //!
RenderState(PMOS_INTERFACE pOsInterface,PRENDERHAL_INTERFACE pRenderHal,PVPHAL_RNDR_PERF_DATA pPerfData,MOS_STATUS * peStatus)42 RenderState::RenderState(
43     PMOS_INTERFACE              pOsInterface,
44     PRENDERHAL_INTERFACE        pRenderHal,
45     PVPHAL_RNDR_PERF_DATA       pPerfData,
46     MOS_STATUS                  *peStatus) :
47     m_pOsInterface(pOsInterface),
48     m_pRenderHal(pRenderHal),
49     m_pSkuTable(nullptr),
50     m_pWaTable(nullptr),
51     m_bDisableRender(false),
52     m_bSingleSlice(false),
53     m_pPerfData(pPerfData),
54     m_reporting(nullptr)
55 {
56     MOS_STATUS eStatus = MOS_STATUS_SUCCESS;
57 
58     VPHAL_RENDER_CHK_NULL(pRenderHal);
59 
60     // Connect renderer to other VPHAL components (HW/OS interfaces)
61     m_pWaTable  = pRenderHal->pWaTable;
62     m_pSkuTable = pRenderHal->pSkuTable;
63 
64 finish:
65     if (peStatus)
66     {
67         *peStatus = eStatus;
68     }
69 }
70 
71 //!
72 //! \brief    Render function for the pass
73 //! \details  The render function coordinates the advanced renderers and basic
74 //!           renders in one pass
75 //! \param    [in,out] pRenderer
76 //!           VPHAL renderer pointer
77 //! \param    [in,out] pRenderParams
78 //!           Pointer to VPHAL render parameter
79 //! \return   MOS_STATUS
80 //!           Return MOS_STATUS_SUCCESS if successful, otherwise failed
81 //!
SetStatusReportParams(VphalRenderer * pRenderer,PVPHAL_RENDER_PARAMS pRenderParams)82 void RenderState::SetStatusReportParams(
83     VphalRenderer           *pRenderer,
84     PVPHAL_RENDER_PARAMS    pRenderParams)
85 {
86     bool bSurfIsRenderTarget = (pRenderParams->pTarget[0]->SurfType == SURF_OUT_RENDERTARGET);
87     m_StatusTableUpdateParams.bReportStatus       = (pRenderParams->bReportStatus);
88     m_StatusTableUpdateParams.bSurfIsRenderTarget = bSurfIsRenderTarget;
89     m_StatusTableUpdateParams.pStatusTable        = pRenderer->m_statusTable;
90     m_StatusTableUpdateParams.StatusFeedBackID    = pRenderParams->StatusFeedBackID;
91 }
92