1 /*
2 * Copyright (c) 2019-2021, 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 //!
24 //! \file     vp_scalability_singlepipe_next.cpp
25 //! \brief    Defines the common interface for media vpp scalability singlepipe mode.
26 //! \details  The media scalability singlepipe interface is further sub-divided by component,
27 //!           this file is for the base interface which is shared by all components.
28 //!
29 #include "vp_scalability_singlepipe_next.h"
30 #include "vp_platform_interface.h"
31 
32 namespace vp
33 {
VpScalabilitySinglePipeNext(void * hwInterface,MediaContext * mediaContext,uint8_t componentType)34 VpScalabilitySinglePipeNext::VpScalabilitySinglePipeNext(void *hwInterface, MediaContext *mediaContext, uint8_t componentType) :
35     MediaScalabilitySinglePipeNext(hwInterface, mediaContext, componentType)
36 {
37     if (hwInterface == nullptr)
38     {
39         return;
40     }
41 
42     m_hwInterface = (PVP_MHWINTERFACE)hwInterface;
43     m_osInterface = m_hwInterface->m_osInterface;
44     m_miItf       = m_hwInterface->m_vpPlatformInterface->GetMhwMiItf();
45 }
46 
~VpScalabilitySinglePipeNext()47 VpScalabilitySinglePipeNext::~VpScalabilitySinglePipeNext()
48 {
49     if (m_scalabilityOption)
50     {
51         MOS_Delete(m_scalabilityOption);
52         m_scalabilityOption = nullptr;
53     }
54 }
55 
Initialize(const MediaScalabilityOption & option)56 MOS_STATUS VpScalabilitySinglePipeNext::Initialize(const MediaScalabilityOption &option)
57 {
58     SCALABILITY_CHK_NULL_RETURN(m_osInterface);
59 
60     m_scalabilityOption = MOS_New(VpScalabilityOption, (const VpScalabilityOption &)option);
61     SCALABILITY_CHK_NULL_RETURN(m_scalabilityOption);
62     if (m_osInterface->osStreamState)
63     {
64         m_osInterface->osStreamState->component = COMPONENT_VPCommon;
65     }
66 
67     return MediaScalabilitySinglePipeNext::Initialize(option);
68 }
69 
CreateSinglePipe(void * hwInterface,MediaContext * mediaContext,uint8_t componentType)70 MOS_STATUS VpScalabilitySinglePipeNext::CreateSinglePipe(void *hwInterface, MediaContext *mediaContext, uint8_t componentType)
71 {
72     SCALABILITY_CHK_NULL_RETURN(hwInterface);
73     SCALABILITY_CHK_NULL_RETURN(mediaContext);
74 
75     ((PVP_MHWINTERFACE) hwInterface)->m_singlePipeScalability  = MOS_New(VpScalabilitySinglePipeNext, hwInterface, mediaContext, scalabilityVp);
76     SCALABILITY_CHK_NULL_RETURN(((PVP_MHWINTERFACE)hwInterface)->m_singlePipeScalability);
77     return MOS_STATUS_SUCCESS;
78 }
79 }
80