1 /*
2 * Copyright (c) 2016-2018, 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_singlepipe_virtualengine.cpp
24 //! \brief Implements the decode interface extension for single pipe virtual engine.
25 //! \details Implements all functions required by CodecHal for single pipe decoding with virtual engine interface.
26 //!
27 #include "codechal_decode_singlepipe_virtualengine.h"
28 #include "mos_os_virtualengine_next.h"
29
30 //==<Functions>=======================================================
CodecHalDecodeSinglePipeVE_ConstructParmsForGpuCtxCreation(PCODECHAL_DECODE_SINGLEPIPE_VIRTUALENGINE_STATE pVEState,PMOS_GPUCTX_CREATOPTIONS_ENHANCED gpuCtxCreatOpts,bool SFCInuse)31 MOS_STATUS CodecHalDecodeSinglePipeVE_ConstructParmsForGpuCtxCreation(
32 PCODECHAL_DECODE_SINGLEPIPE_VIRTUALENGINE_STATE pVEState,
33 PMOS_GPUCTX_CREATOPTIONS_ENHANCED gpuCtxCreatOpts,
34 bool SFCInuse)
35 {
36 PMOS_VIRTUALENGINE_INTERFACE pVEInterface;
37 MOS_STATUS eStatus = MOS_STATUS_SUCCESS;
38
39 CODECHAL_DECODE_FUNCTION_ENTER;
40
41 CODECHAL_DECODE_CHK_NULL_RETURN(pVEState);
42 CODECHAL_DECODE_CHK_NULL_RETURN(pVEState->pVEInterface);
43 CODECHAL_DECODE_CHK_NULL_RETURN(gpuCtxCreatOpts);
44
45 pVEInterface = pVEState->pVEInterface;
46
47 #if (_DEBUG || _RELEASE_INTERNAL)
48 CODECHAL_DECODE_CHK_NULL_RETURN(pVEInterface->pOsInterface);
49 if (pVEInterface->pOsInterface->bEnableDbgOvrdInVE)
50 {
51 gpuCtxCreatOpts->DebugOverride = true;
52 gpuCtxCreatOpts->LRCACount = 1;
53 gpuCtxCreatOpts->UsingSFC = SFCInuse; // this param ignored when dbgoverride enabled
54 if (pVEInterface->pOsInterface->apoMosEnabled)
55 {
56 CODECHAL_DECODE_CHK_NULL_RETURN(pVEInterface->veInterface);
57 CODECHAL_DECODE_ASSERT(pVEInterface->veInterface->GetEngineCount() == 1);
58 gpuCtxCreatOpts->EngineInstance[0] = pVEInterface->veInterface->GetEngineLogicId(0);
59 }
60 else
61 {
62 CODECHAL_DECODE_ASSERT(pVEInterface->ucEngineCount == 1);
63 gpuCtxCreatOpts->EngineInstance[0] = pVEInterface->EngineLogicId[0];
64 }
65 }
66 else
67 #endif
68 {
69 gpuCtxCreatOpts->LRCACount = 1;
70 gpuCtxCreatOpts->UsingSFC = SFCInuse;
71 }
72
73 return eStatus;
74 }
75
CodecHalDecodeSinglePipeVE_InitInterface(PMOS_INTERFACE pOsInterface,PCODECHAL_DECODE_SINGLEPIPE_VIRTUALENGINE_STATE pVEState)76 MOS_STATUS CodecHalDecodeSinglePipeVE_InitInterface(
77 PMOS_INTERFACE pOsInterface,
78 PCODECHAL_DECODE_SINGLEPIPE_VIRTUALENGINE_STATE pVEState)
79 {
80 PMOS_VIRTUALENGINE_INTERFACE pVEInterface;
81 MOS_VIRTUALENGINE_INIT_PARAMS VEInitParams;
82 MOS_STATUS eStatus = MOS_STATUS_SUCCESS;
83
84 CODECHAL_DECODE_FUNCTION_ENTER;
85
86 CODECHAL_DECODE_CHK_NULL_RETURN(pOsInterface);
87 CODECHAL_DECODE_CHK_NULL_RETURN(pVEState);
88
89 //virtual engine init with singlepipe
90 MOS_ZeroMemory(&VEInitParams, sizeof(VEInitParams));
91 VEInitParams.bScalabilitySupported = false;
92 CODECHAL_DECODE_CHK_STATUS_RETURN(pOsInterface->pfnVirtualEngineInterfaceInitialize(pOsInterface, &VEInitParams));
93 pVEState->pVEInterface = pVEInterface = pOsInterface->pVEInterf;
94
95 if (pVEInterface->pfnVEGetHintParams)
96 {
97 CODECHAL_DECODE_CHK_STATUS_RETURN(pVEInterface->pfnVEGetHintParams(pVEInterface, false, &pVEState->pHintParms));
98 }
99
100 return eStatus;
101 }
102
103