1 /*
2 * Copyright (c) 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     mos_os_virtualengine_singlepipe_next.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_singlepipe_next.h"
30 
Destroy()31 void MosOsVeSinglePipe::Destroy()
32 {
33     MOS_OS_FUNCTION_ENTER;
34 
35     return;
36 }
37 
38 #if (_DEBUG || _RELEASE_INTERNAL)
PopulateDbgOvrdParams(MOS_STREAM_HANDLE stream)39 MOS_STATUS MosOsVeSinglePipe::PopulateDbgOvrdParams(MOS_STREAM_HANDLE stream)
40 {
41     MOS_OS_FUNCTION_ENTER;
42 
43     MOS_STATUS     eStatus      = MOS_STATUS_UNKNOWN;
44 
45     MOS_OS_CHK_NULL_RETURN(stream);
46 
47     int32_t        iForceEngine = 0;
48 
49     iForceEngine = MOS_INVALID_FORCEENGINE_VALUE;
50     switch (stream->component)
51     {
52         case COMPONENT_Decode:
53             iForceEngine = stream->eForceVdbox;
54             break;
55         case COMPONENT_VPCommon:
56             iForceEngine = stream->eForceVebox;
57             break;
58         case COMPONENT_Encode:
59         default:
60             eStatus = MOS_STATUS_INVALID_PARAMETER;
61             MOS_OS_ASSERTMESSAGE("Not supported MOS Component.")
62             return eStatus;
63     }
64 
65     MosUtilities::MosZeroMemory(EngineLogicId, sizeof(EngineLogicId));
66     ucEngineCount = 0;
67     if (iForceEngine == 0)
68     {
69         EngineLogicId[0] = 0;
70     }
71     else
72     {
73         uint8_t ui8EngineId = 0;
74         switch (iForceEngine & MOS_FORCEENGINE_MASK)
75         {
76             case 1:
77                 ui8EngineId = 0;
78                 break;
79             case 2:
80                 ui8EngineId = 1;
81                 break;
82             case 3:
83                 ui8EngineId = 2;
84                 break;
85             case 4:
86                 ui8EngineId = 3;
87                 break;
88             default:
89                 eStatus = MOS_STATUS_INVALID_PARAMETER;
90                 MOS_OS_ASSERTMESSAGE("Invalid force engine value.");
91                 return eStatus;
92         }
93         EngineLogicId[0] = ui8EngineId;
94     }
95 
96     ucEngineCount  = 1;
97     eStatus = MOS_STATUS_SUCCESS;
98 
99     return eStatus;
100 }
101 #endif //(_DEBUG || _RELEASE_INTERNAL)
102 
103