xref: /aosp_15_r20/external/gmmlib/Source/GmmLib/inc/External/Common/GmmLibDll.h (revision 35ffd701415c9e32e53136d61a677a8d0a8fc4a5)
1 /*==============================================================================
2 Copyright(c) 2017 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 #pragma once
23 
24 #include "GmmCommonExt.h"
25 #include "GmmInfo.h"
26 
27 typedef struct _GMM_INIT_IN_ARGS_
28 {
29     PLATFORM           Platform;
30     void              *pSkuTable;
31     void              *pWaTable;
32     void              *pGtSysInfo;
33     uint32_t           FileDescriptor;
34     GMM_CLIENT ClientType;
35 } GMM_INIT_IN_ARGS;
36 
37 typedef struct _GMM_INIT_OUT_ARGS_
38 {
39     GMM_CLIENT_CONTEXT *pGmmClientContext;
40 } GMM_INIT_OUT_ARGS;
41 
42 // Interfaces exported from  GMM Lib DLL
43 typedef struct _GmmExportEntries
44 {
45 #ifdef _WIN32
46     GMM_STATUS          (GMM_STDCALL *pfnCreateSingletonContext)(const PLATFORM Platform,
47                                                                 const SKU_FEATURE_TABLE* pSkuTable,
48                                                                 const WA_TABLE* pWaTable,
49                                                                 const GT_SYSTEM_INFO* pGtSysInfo);
50 #else
51     GMM_STATUS(GMM_STDCALL *pfnCreateSingletonContext)(const PLATFORM Platform,
52                                                         const void* pSkuTable,
53                                                         const void* pWaTable,
54                                                         const void* pGtSysInfo);
55 #endif
56 
57     void                (GMM_STDCALL *pfnDestroySingletonContext)(void);
58 
59     GMM_CLIENT_CONTEXT* (GMM_STDCALL *pfnCreateClientContext)(GMM_CLIENT ClientType);
60     void                (GMM_STDCALL *pfnDeleteClientContext)(GMM_CLIENT_CONTEXT *pGmmClientContext);
61 }GmmExportEntries;
62 
63 
64 #ifdef __cplusplus
65 extern "C" {
66 #endif
67 
68 /////////////////////////////////////////////////////////////////////////////////////
69 /// Only function exported from GMM lib DLL.
70 /////////////////////////////////////////////////////////////////////////////////////
71     GMM_LIB_API GMM_STATUS GMM_STDCALL InitializeGmm(GMM_INIT_IN_ARGS *pInArgs, GMM_INIT_OUT_ARGS *pOutArgs);
72     GMM_LIB_API void GMM_STDCALL GmmAdapterDestroy(GMM_INIT_OUT_ARGS *pInArgs);
73 
74 #ifdef __cplusplus
75 }
76 #endif
77 
78 typedef GMM_STATUS (GMM_STDCALL *pfnGmmEntry)(GmmExportEntries *);
79 typedef GMM_STATUS (GMM_STDCALL *pfnGmmInit)(GMM_INIT_IN_ARGS *, GMM_INIT_OUT_ARGS *);
80 typedef void (GMM_STDCALL *pfnGmmDestroy)(GMM_INIT_OUT_ARGS *);
81