Skip to content

Commit 561dde5

Browse files
committed
mtgpu: header file cleanup for forward compatibility
Signed-off-by: Xiaodong Ye <[email protected]>
1 parent 6d45fe6 commit 561dde5

File tree

1 file changed

+20
-26
lines changed

1 file changed

+20
-26
lines changed

src/detection/gpu/mtml.h

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44
// THIS FILE IS CREATED FROM SCRATCH, BY READING THE OFFICIAL MTML API
55
// DOCUMENTATION REFERENCED BELOW, IN ORDER TO MAKE FASTFETCH MIT COMPLIANT.
66

7-
#define MTML_API __attribute__((visibility("default")))
87
#define MTML_DEVICE_PCI_SBDF_BUFFER_SIZE 32
98
#define MTML_DEVICE_NAME_BUFFER_SIZE 32
10-
#define MTML_DEVICE_UUID_BUFFER_SIZE 48
119

1210
/**
1311
* Return values for MTML API calls.
@@ -23,10 +21,6 @@ typedef enum
2321
typedef enum
2422
{
2523
MTML_BRAND_MTT = 0, //!< MTT series.
26-
MTML_BRAND_UNKNOWN, //!< An unknown brand.
27-
28-
// Keep this on the last line.
29-
MTML_BRAND_COUNT //!< The number of brands.
3024
} MtmlBrandType;
3125

3226
typedef struct MtmlLibrary MtmlLibrary;
@@ -57,62 +51,62 @@ typedef struct
5751
} MtmlPciInfo;
5852

5953
// Retrieves the number of cores of a device.
60-
MtmlReturn MTML_API mtmlDeviceCountGpuCores(const MtmlDevice* device, unsigned int* numCores);
54+
MtmlReturn mtmlDeviceCountGpuCores(const MtmlDevice* device, unsigned int* numCores);
6155
// Retrieves the brand of a device.
62-
MtmlReturn MTML_API mtmlDeviceGetBrand(const MtmlDevice *dev, MtmlBrandType *type);
56+
MtmlReturn mtmlDeviceGetBrand(const MtmlDevice *dev, MtmlBrandType *type);
6357
// Retrieves the index associated with the specified device.
64-
MtmlReturn MTML_API mtmlDeviceGetIndex(const MtmlDevice *dev, unsigned int *index);
58+
MtmlReturn mtmlDeviceGetIndex(const MtmlDevice *dev, unsigned int *index);
6559
// Retrieves the name of a device.
66-
MtmlReturn MTML_API mtmlDeviceGetName(const MtmlDevice *dev, char *name, unsigned int length);
60+
MtmlReturn mtmlDeviceGetName(const MtmlDevice *dev, char *name, unsigned int length);
6761
// Retrieves the PCI attributes of a device.
68-
MtmlReturn MTML_API mtmlDeviceGetPciInfo(const MtmlDevice *dev, MtmlPciInfo *pci);
62+
MtmlReturn mtmlDeviceGetPciInfo(const MtmlDevice *dev, MtmlPciInfo *pci);
6963
/**
7064
* Retrieves the UUID of a specified device. The UUID is a hexadecimal string in the
7165
* form of xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, where each 'x' is an ASCII character that represents a hexadecimal
7266
* digit. The UUID is globally unique for every single device thus can be used to identify different devices
7367
* physically.
7468
*/
75-
MtmlReturn MTML_API mtmlDeviceGetUUID(const MtmlDevice *dev, char *uuid, unsigned int length);
69+
MtmlReturn mtmlDeviceGetUUID(const MtmlDevice *dev, char *uuid, unsigned int length);
7670
// Initializes a GPU opaque object to represent a specific graphic core on the target device that is designated by its index.
77-
MtmlReturn MTML_API mtmlDeviceInitGpu(const MtmlDevice *dev, MtmlGpu **gpu);
71+
MtmlReturn mtmlDeviceInitGpu(const MtmlDevice *dev, MtmlGpu **gpu);
7872
// Initializes a memory opaque object to represent the memory on the target device.
79-
MtmlReturn MTML_API mtmlDeviceInitMemory(const MtmlDevice *dev, MtmlMemory **mem);
73+
MtmlReturn mtmlDeviceInitMemory(const MtmlDevice *dev, MtmlMemory **mem);
8074

8175
// Retrieves the maximum supported clock speed for the device's graphic core.
82-
MtmlReturn MTML_API mtmlGpuGetMaxClock(const MtmlGpu *gpu, unsigned int *clockMhz);
76+
MtmlReturn mtmlGpuGetMaxClock(const MtmlGpu *gpu, unsigned int *clockMhz);
8377
// Retrieves the current temperature readings for the device's graphic core, in degrees Celsius.
84-
MtmlReturn MTML_API mtmlGpuGetTemperature(const MtmlGpu *gpu, unsigned int *temp);
78+
MtmlReturn mtmlGpuGetTemperature(const MtmlGpu *gpu, unsigned int *temp);
8579
// Retrieves the current utilization rate for the device's graphic core.
86-
MtmlReturn MTML_API mtmlGpuGetUtilization(const MtmlGpu *gpu, unsigned int *utilization);
80+
MtmlReturn mtmlGpuGetUtilization(const MtmlGpu *gpu, unsigned int *utilization);
8781

8882
// Retrieves the number of devices that can be accessed by the library opaque object.
89-
MtmlReturn MTML_API mtmlLibraryCountDevice(const MtmlLibrary *lib, unsigned int *count);
83+
MtmlReturn mtmlLibraryCountDevice(const MtmlLibrary *lib, unsigned int *count);
9084
/**
9185
* Initializes a device opaque object to represent a device that is designated by its index.
9286
* The index ranges from (0) to (deviceCount - 1), where deviceCount is retrieved from \ref mtmlLibraryCountDevice().
9387
*/
94-
MtmlReturn MTML_API mtmlLibraryInit(MtmlLibrary **lib);
88+
MtmlReturn mtmlLibraryInit(MtmlLibrary **lib);
9589
/**
9690
* Initializes a device opaque object to represent a device that is designated by its index.
9791
* The index ranges from (0) to (deviceCount - 1), where deviceCount is retrieved from \ref mtmlLibraryCountDevice().
9892
*/
99-
MtmlReturn MTML_API mtmlLibraryInitDeviceByIndex(const MtmlLibrary *lib, unsigned int index, MtmlDevice **dev);
93+
MtmlReturn mtmlLibraryInitDeviceByIndex(const MtmlLibrary *lib, unsigned int index, MtmlDevice **dev);
10094
/**
10195
* Initializes a device opaque object to represent a device that is designated by its PCI Sbdf.
10296
* The PCI Sbdf format like 00000000:3a:00.0 refer to \ref MtmlPciInfo::sbdf.
10397
*/
104-
MtmlReturn MTML_API mtmlLibraryInitDeviceByPciSbdf(const MtmlLibrary *lib, const char *pciSbdf, MtmlDevice **dev);
98+
MtmlReturn mtmlLibraryInitDeviceByPciSbdf(const MtmlLibrary *lib, const char *pciSbdf, MtmlDevice **dev);
10599
// Initializes a MtmlSystem opaque pointer that is bound to a library opaque object.
106-
MtmlReturn MTML_API mtmlLibraryInitSystem(const MtmlLibrary *lib, MtmlSystem **sys);
100+
MtmlReturn mtmlLibraryInitSystem(const MtmlLibrary *lib, MtmlSystem **sys);
107101
/**
108102
* Shuts down the library opaque object that is previously initialized by \ref mtmlLibraryInit() and releases its resources.
109103
* The \a lib pointer cannot be used anymore after this function returns.
110104
*/
111-
MtmlReturn MTML_API mtmlLibraryShutDown(MtmlLibrary *lib);
105+
MtmlReturn mtmlLibraryShutDown(MtmlLibrary *lib);
112106

113107
// Retrieves the amount of total memory available on the device, in bytes.
114-
MtmlReturn MTML_API mtmlMemoryGetTotal(const MtmlMemory *mem, unsigned long long *total);
108+
MtmlReturn mtmlMemoryGetTotal(const MtmlMemory *mem, unsigned long long *total);
115109
// Retrieves the amount of used memory on the device, in bytes.
116-
MtmlReturn MTML_API mtmlMemoryGetUsed(const MtmlMemory *mem, unsigned long long *used);
110+
MtmlReturn mtmlMemoryGetUsed(const MtmlMemory *mem, unsigned long long *used);
117111
// Retrieves the current memory utilization rate for the device.
118-
MtmlReturn MTML_API mtmlMemoryGetUtilization(const MtmlMemory *mem, unsigned int *utilization);
112+
MtmlReturn mtmlMemoryGetUtilization(const MtmlMemory *mem, unsigned int *utilization);

0 commit comments

Comments
 (0)