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 if (pVEInterface->pOsInterface->bEnableDbgOvrdInVE)
49 {
50 gpuCtxCreatOpts->DebugOverride = true;
51 gpuCtxCreatOpts->LRCACount = 1;
52 gpuCtxCreatOpts->UsingSFC = SFCInuse; // this param ignored when dbgoverride enabled
53 if (g_apoMosEnabled)
54 {
55 CODECHAL_DECODE_CHK_NULL_RETURN(pVEInterface->veInterface);
56 CODECHAL_DECODE_ASSERT(pVEInterface->veInterface->GetEngineCount() == 1);
57 gpuCtxCreatOpts->EngineInstance[0] = pVEInterface->veInterface->GetEngineLogicId(0);
58 }
59 else
60 {
61 CODECHAL_DECODE_ASSERT(pVEInterface->ucEngineCount == 1);
62 gpuCtxCreatOpts->EngineInstance[0] = pVEInterface->EngineLogicId[0];
63 }
64 }
65 else
66 #endif
67 {
68 gpuCtxCreatOpts->LRCACount = 1;
69 gpuCtxCreatOpts->UsingSFC = SFCInuse;
70 }
71
72 return eStatus;
73 }
74
CodecHalDecodeSinglePipeVE_InitInterface(PMOS_INTERFACE pOsInterface,PCODECHAL_DECODE_SINGLEPIPE_VIRTUALENGINE_STATE pVEState)75 MOS_STATUS CodecHalDecodeSinglePipeVE_InitInterface(
76 PMOS_INTERFACE pOsInterface,
77 PCODECHAL_DECODE_SINGLEPIPE_VIRTUALENGINE_STATE pVEState)
78 {
79 PMOS_VIRTUALENGINE_INTERFACE pVEInterface;
80 MOS_VIRTUALENGINE_INIT_PARAMS VEInitParams;
81 MOS_STATUS eStatus = MOS_STATUS_SUCCESS;
82
83 CODECHAL_DECODE_FUNCTION_ENTER;
84
85 CODECHAL_DECODE_CHK_NULL_RETURN(pOsInterface);
86 CODECHAL_DECODE_CHK_NULL_RETURN(pVEState);
87
88 //virtual engine init with singlepipe
89 MOS_ZeroMemory(&VEInitParams, sizeof(VEInitParams));
90 VEInitParams.bScalabilitySupported = false;
91 CODECHAL_DECODE_CHK_STATUS_RETURN(Mos_VirtualEngineInterface_Initialize(pOsInterface, &VEInitParams));
92 pVEState->pVEInterface = pVEInterface = pOsInterface->pVEInterf;
93
94 if (pVEInterface->pfnVEGetHintParams)
95 {
96 CODECHAL_DECODE_CHK_STATUS_RETURN(pVEInterface->pfnVEGetHintParams(pVEInterface, false, &pVEState->pHintParms));
97 }
98
99 return eStatus;
100 }
101
102