1 /*
2 * Copyright (c) 2017-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 codechal_decode_downsampling_g12.cpp
24 //! \brief Implements the decode interface extension for downsampling on Gen12.
25 //!
26 #include "codechal_decoder.h"
27
28 #if defined(ENABLE_KERNELS) && !defined(_FULL_OPEN_SOURCE)
29 #include "igcodeckrn_g12.h"
30 #endif
31
32 #include "codechal_decode_downsampling_g12.h"
33 #include "mhw_render_g12_X.h"
34 #include "codechal_mmc_g12.h"
35
FieldScalingInterfaceG12(CodechalHwInterface * hwInterface)36 FieldScalingInterfaceG12::FieldScalingInterfaceG12(CodechalHwInterface *hwInterface) :
37 FieldScalingInterface()
38 {
39 CODECHAL_DECODE_FUNCTION_ENTER;
40
41 #if defined(ENABLE_KERNELS) && !defined(_FULL_OPEN_SOURCE)
42 m_kernelBase = (uint8_t*)IGCODECKRN_G12;
43 #else
44 m_kernelBase = NULL;
45 #endif
46
47 InitInterfaceStateHeapSetting(hwInterface);
48 }
49
SetupMediaVfe(PMOS_COMMAND_BUFFER cmdBuffer,MHW_KERNEL_STATE * kernelState)50 MOS_STATUS FieldScalingInterfaceG12::SetupMediaVfe(
51 PMOS_COMMAND_BUFFER cmdBuffer,
52 MHW_KERNEL_STATE *kernelState)
53 {
54 MHW_VFE_PARAMS_G12 vfeParams = {};
55 vfeParams.pKernelState = kernelState;
56
57 CODECHAL_DECODE_CHK_STATUS_RETURN(m_renderInterface->AddMediaVfeCmd(cmdBuffer, &vfeParams));
58
59 return MOS_STATUS_SUCCESS;
60 }
61
InitMmcState()62 MOS_STATUS FieldScalingInterfaceG12::InitMmcState()
63 {
64 #ifdef _MMC_SUPPORTED
65 if (m_mmcState == nullptr)
66 {
67 m_mmcState = MOS_New(CodecHalMmcStateG12, m_hwInterface);
68 CODECHAL_DECODE_CHK_NULL_RETURN(m_mmcState);
69 }
70 #endif
71 return MOS_STATUS_SUCCESS;
72 }