| 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 mos_os_virtualengine_singlepipe.cpp |
| 24 | //! \brief Implements the MOS interface extension for Cross OS, supporting virtual engine single pipe mode. |
| 25 | //! \details Implements the MOS interface extension for Cross OS, supporting virtual engine single pipe mode. Only necessary when KMD supports virtual engine. |
| 26 | //! |
| 27 | |
| 28 | #include "mos_os.h" |
| 29 | #include "mos_os_virtualengine.h" |
| 30 | #include "mos_os_virtualengine_next.h" |
| 31 | |
| 32 | //==<Functions>======================================================= |
| 33 | void Mos_VirtualEngine_SinglePipe_Destroy( |
| 34 | PMOS_VIRTUALENGINE_INTERFACE pVEInterface) |
| 35 | { |
| 36 | MOS_OS_FUNCTION_ENTER; |
| 37 | MOS_OS_CHK_NULL_NO_STATUS_RETURN(pVEInterface); |
| 38 | MOS_OS_CHK_NULL_NO_STATUS_RETURN(pVEInterface->pOsInterface); |
| 39 | PMOS_INTERFACE pOsInterface = pVEInterface->pOsInterface; |
| 40 | if (pOsInterface->apoMosEnabled && pVEInterface->veInterface) |
| 41 | { |
| 42 | pVEInterface->veInterface->Destroy(); |
| 43 | MOS_Delete(pVEInterface->veInterface); |
| 44 | } |
| 45 | |
| 46 | return; |
| 47 | } |
| 48 | |
| 49 | #if (_DEBUG || _RELEASE_INTERNAL) |
| 50 | MOS_STATUS Mos_VirtualEngine_SinglePipe_PopulateDbgOvrdParams( |
| 51 | PMOS_VIRTUALENGINE_INTERFACE pVEInterface) |
| 52 | { |
| 53 | PMOS_INTERFACE pOsInterface = nullptr; |
| 54 | int32_t iForceEngine = 0; |
| 55 | MOS_STATUS eStatus = MOS_STATUS_UNKNOWN; |
| 56 | |
| 57 | MOS_OS_FUNCTION_ENTER; |
| 58 | |
| 59 | MOS_OS_CHK_NULL(pVEInterface); |
| 60 | MOS_OS_CHK_NULL(pVEInterface->pOsInterface); |
| 61 | |
| 62 | pOsInterface = pVEInterface->pOsInterface; |
| 63 | |
| 64 | iForceEngine = MOS_INVALID_FORCEENGINE_VALUE; |
| 65 | switch (pOsInterface->Component) |
| 66 | { |
| 67 | case COMPONENT_Decode: |
| 68 | iForceEngine = pOsInterface->eForceVdbox; |
| 69 | break; |
| 70 | case COMPONENT_VPCommon: |
| 71 | iForceEngine = pOsInterface->eForceVebox; |
| 72 | break; |
| 73 | case COMPONENT_Encode: |
| 74 | default: |
| 75 | eStatus = MOS_STATUS_INVALID_PARAMETER; |
| 76 | MOS_OS_ASSERTMESSAGE("Not supported MOS Component.") |
| 77 | goto finish; |
| 78 | } |
| 79 | |
| 80 | MOS_ZeroMemory(pVEInterface->EngineLogicId, sizeof(pVEInterface->EngineLogicId)); |
| 81 | pVEInterface->ucEngineCount = 0; |
| 82 | if (iForceEngine == 0) |
| 83 | { |
| 84 | pVEInterface->EngineLogicId[0] = 0; |
| 85 | } |
| 86 | else |
| 87 | { |
| 88 | uint8_t ui8EngineId = 0; |
| 89 | switch (iForceEngine & MOS_FORCEENGINE_MASK) |
| 90 | { |
| 91 | case 1: |
| 92 | ui8EngineId = 0; |
| 93 | break; |
| 94 | case 2: |
| 95 | ui8EngineId = 1; |
| 96 | break; |
| 97 | case 3: |
| 98 | ui8EngineId = 2; |
| 99 | break; |
| 100 | case 4: |
| 101 | ui8EngineId = 3; |
| 102 | break; |
| 103 | default: |
| 104 | eStatus = MOS_STATUS_INVALID_PARAMETER; |
| 105 | MOS_OS_ASSERTMESSAGE("Invalid force engine value."); |
| 106 | goto finish; |
| 107 | } |
| 108 | pVEInterface->EngineLogicId[0] = ui8EngineId; |
| 109 | } |
| 110 | |
| 111 | pVEInterface->ucEngineCount = 1; |
| 112 | eStatus = MOS_STATUS_SUCCESS; |
| 113 | finish: |
| 114 | return eStatus; |
| 115 | } |
| 116 | #endif //(_DEBUG || _RELEASE_INTERNAL) |
| 117 |