Universal graphics card information query method and system under Linux system

By implementing GPUINFO, a universal graphics card information viewing framework in the DRM framework in the Linux system, the problem of inconsistent graphics card information viewing in the Linux system is solved, and unified and convenient viewing of graphics card information is achieved.

CN119719037APending Publication Date: 2025-03-28KYLIN CORP
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411883218.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-19
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

In Linux systems, the lack of unified graphics card information viewing methods leads to inconsistent paths and formats of graphics card manufacturers, making it inconvenient for users to operate.

Method used

The GPUINFO, a common graphics card information viewing framework, is implemented in the DRM framework. The graphics card driver is registered to the framework after initialization, and a device node is generated in the specified directory. The upper-level user calls the graphics card driver's callback interface through these nodes to obtain graphics card information.

Benefits of technology

It realizes a unified view of graphics card memory information, temperature, voltage, main frequency information, firmware information, etc., blocks the differences in graphics card, and provides a unified interface for upper-level users to facilitate operation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119719037A_ABST
    Figure CN119719037A_ABST
Patent Text Reader

Abstract

The invention discloses a universal graphics card information query method and system under a Linux system. The method comprises the following steps: realizing a universal graphics card information viewing framework GPUINFO in a DRM framework; the graphics card driver is registered to a graphics card information viewing framework GPUINFO after being initialized, all equipment nodes corresponding to the graphics card are generated under a specified directory, and when an upper-layer user inquires graphics card information, a callback interface provided by the graphics card driver is called through the equipment nodes to obtain current graphics card information; and unloading the graphics card driver from the graphics card information viewing framework GPUINFO when the graphics card driver is unloaded or quitted, and deleting all the equipment nodes corresponding to the graphics card under the specified directory. The universal display card information viewing is realized by shielding the difference of the display card, and meanwhile, a uniform viewing interface is provided for an upper-layer user, so that the operation of the upper-layer user is facilitated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of hardware management of Linux systems, and in particular to a general graphics card information query method and system under Linux systems. Background Art

[0002] In Linux systems, users can generally view system-related information through some nodes in the / proc directory, such as cat / proc / meminfo to view memory information, cat / proc / cpuinfo to view CPU information, cat / proc / osinfo to view operating system information, etc. However, the Linux operating system does not provide a universal method for viewing graphics card information. In Linux systems, there are currently the following problems in viewing graphics card information: 1. Each graphics card has its own method for viewing its own information, with different paths and different viewing methods; 2. The content and format of each graphics card for viewing their own information are not unified; 3. Some graphics card drivers provide a method for viewing information, while some do not; 4. The viewing of each information implemented by the graphics card is not what the upper-level users want; 5. It is very inconvenient for the upper-level users to view the graphics card information. How to provide a universal method for viewing graphics card information in Linux systems has become a key technical problem that needs to be solved urgently. Summary of the invention

[0003] Technical problem to be solved by the present invention: In view of the above-mentioned problems in the prior art, a universal graphics card information query method and system under a Linux system are provided. The present invention aims to shield the differences in graphics cards to achieve universal graphics card information viewing, and at the same time provide a unified viewing interface for upper-level users to facilitate upper-level user operations.

[0004] In order to solve the above technical problems, the technical solution adopted by the present invention is:

[0005] A general graphics card information query method under Linux system includes the following steps:

[0006] S1, implement a general graphics card information viewing framework GPUINFO in the DRM framework;

[0007] S2, after initialization, the graphics card driver registers to the graphics card information viewing framework GPUINFO and generates all device nodes corresponding to the graphics card in the specified directory. When the upper-level user queries the graphics card information, the callback interface provided by the graphics card driver is called through the device node to obtain the current graphics card information;

[0008] S3, when the graphics card driver is uninstalled or exited, it is uninstalled from the graphics card information viewing framework GPUINFO, and all device nodes corresponding to the graphics card in the specified directory are deleted.

[0009] Further, when all device nodes corresponding to the graphics card are generated in the specified directory in step S2, all device nodes corresponding to the graphics card are generated in the directory " / proc / gpuinfo / N / ", and "N" in the directory " / proc / gpuinfo / N / " is the number of the graphics card.

[0010] Furthermore, all device nodes in step S2 include part or all of the basic information node baseinfo, the video memory information node meminfo, the firmware information node vbiosinfo, the temperature information node tempinfo, the voltage information node voltageinfo, the frequency information node freqinfo, the graphics card usage information node ratioinfo and other information nodes otherinfo, wherein the data corresponding to the basic information node baseinfo includes the graphics card manufacturer, the graphics card architecture, the graphics card driver name and the graphics card device ID; the data corresponding to the video memory information node meminfo includes the total size of the video memory and the size of the video memory usage; the data corresponding to the firmware information node vbiosinfo includes the graphics card vbios version and the graphics card OEM manufacturer; the data corresponding to the temperature information node tempinfo is temperature information; the data corresponding to the voltage information node voltageinfo is voltage information; the data corresponding to the frequency information node freqinfo is graphics card frequency information, and the graphics card frequency information includes core frequency and memory frequency; the data corresponding to the usage information node ratioinfo is graphics card usage information; and the data corresponding to the other information node otherinfo is information customized by the graphics card manufacturer.

[0011] Further, in step S2, registering to the graphics card information viewing framework GPUINFO is specifically implemented by the graphics card driver by calling the registration interface drm_gpuinfo_register provided by the graphics card information viewing framework GPUINFO, and when calling the registration interface drm_gpuinfo_register, the graphics card driver passes the graphics card information structure drm_gpuinfo_ops callback operation on the graphics card information to the graphics card information viewing framework GPUINFO, and implements the callback interface contained in the graphics card information structure drm_gpuinfo_ops. The callback interface contained in the graphics card information structure drm_gpuinfo_ops includes: a callback interface get_gpuinfo_mask for querying the information supported by the graphics card, a callback interface get_gpuinfo_data for obtaining the graphics card information, and a callback interface free_gpuinfo_data for releasing the obtained graphics card information.

[0012] Furthermore, in step S2, when the device node calls the callback interface provided by the graphics card driver to obtain the current graphics card information, the following steps are included:

[0013] S2.1, the upper user triggers the target device node related operations by querying the corresponding data of the graphics card through the target device node, and the target device node driver calls the callback interface get_gpuinfo_mask to query the information supported by the graphics card;

[0014] S2.2, judging whether the query is supported based on whether the information returned by the information callback interface get_gpuinfo_mask contains items for judging the target device node, if the query is supported, jump to S2.3, otherwise end and return;

[0015] S2.3, the target device node driver calls the graphics card information callback interface get_gpuinfo_data to obtain the latest data of the target device node project and uses it as the latest data corresponding to the target device node;

[0016] S2.4, the target device node driver calls the callback interface free_gpuinfo_data to release the acquired graphics card information to release the latest data corresponding to the target device node.

[0017] Furthermore, the mask field mask defined in the information callback interface get_gpuinfo_mask includes graphics card manufacturer, graphics card architecture, graphics card driver name, graphics card device ID, total video memory size, video memory usage size, graphics card vbios version, graphics card OEM manufacturer, temperature information, voltage information, graphics card frequency information, core frequency, video memory frequency, graphics card usage information and information customized by the graphics card manufacturer; the fields in the data of the graphics card information callback interface free_gpuinfo_data obtained by releasing include: mask field mask, graphics card manufacturer, graphics card architecture, graphics card driver name, graphics card device ID, total video memory size, video memory usage size, graphics card vbios version, graphics card OEM manufacturer, temperature information, voltage information, graphics card frequency information, core frequency, video memory frequency, graphics card usage information and information customized by the graphics card manufacturer, wherein the voltage information includes the number of voltages and the voltage attributes of each voltage, and the voltage attributes include the voltage name and the voltage size.

[0018] Furthermore, in step S3, unloading from the graphics card information viewing framework GPUINFO means that the graphics card driver is implemented by calling an unloading interface drm_gpuinfo_unregister provided by the graphics card information viewing framework GPUINFO.

[0019] The present invention also proposes a universal graphics card information query system under Linux system, comprising a microprocessor and a memory connected to each other, wherein the microprocessor is programmed or configured to execute any one of the universal graphics card information query methods under Linux system.

[0020] The present invention also proposes a computer-readable storage medium, in which a computer program or instruction is stored. The computer program or instruction is programmed or configured to execute any one of the general graphics card information query methods under the Linux system through a processor.

[0021] The present invention also provides a computer program product, including a computer program or an instruction, wherein the computer program or the instruction is programmed or configured to execute, through a processor, any one of the general graphics card information query methods under the Linux system.

[0022] Compared with the prior art, the present invention mainly has the following advantages:

[0023] The present invention provides a universal graphics card information viewing framework GPUINFO. After initialization, the graphics card driver is registered to the graphics card information viewing framework GPUINFO and generates all device nodes corresponding to the graphics card in a specified directory. When an upper-level user queries the graphics card information, the device node calls a callback interface provided by the graphics card driver to obtain the current graphics card information, thereby realizing the viewing of common information such as graphics card memory information, temperature, voltage, main frequency information, firmware information, GPU usage rate, and special features and function information of the graphics card. At the same time, a unified viewing interface is provided for the upper-level users to facilitate the operation of the upper-level users. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 is a flow chart of an embodiment of the present invention.

[0025] Figure 2 This is a flow chart for querying graphics card information in an embodiment of the present invention. DETAILED DESCRIPTION

[0026] Before introducing the specific embodiments of the present invention, the related existing research is first introduced.

[0027] The Korean invention patent application with publication number KR20230016133A mentions GPUINFO, but it only designs a GPUINFO.table in the implementation process, places the relevant parameters of the GPU in the table, and provides parameters for selection during the optimization process. This is not a research direction related to the present invention.

[0028] The Chinese invention patent application with publication number CN117931581A discloses a graphics processor monitoring method, device, medium and server monitoring system, which relates to the field of server monitoring technology and is used to realize the collection and monitoring of GPU information. In view of the problem that the current reliance on the host system will affect user services, a graphics processor monitoring method is provided, and the acquisition of GPU information is realized through an out-of-band communication channel between the BMC and the GPU, thereby bypassing the host system and not interfering with user services. Furthermore, the present invention also pre-classifies GPU information into three categories according to different attributes and needs: boot information, static information and dynamic information, and uses different capture frequencies to obtain them respectively, thereby further reducing the occupation of BMC resources while ensuring the timeliness of GPU information collection and the monitoring effect, thereby realizing a more stable and reliable AI server service. This solution mainly provides monitoring of GPU. Although it mentions that "graphics processor module information includes: firmware version number, factory material number, product model, primary manufacturer identification, secondary manufacturer identification, primary device identification and secondary device identification, performance indicator information, temperature and power consumption information, load information, error and fault information", it does not provide a method for obtaining this information, and the acquisition of this information depends on the operating system. The present invention provides a unified method for obtaining this information from the operating system layer.

[0029] In addition, the method also mentions that "all boot information is stored in the first_GPU_info directory of the BMC; all static information is stored in the static_GPU_info directory of the BMC; and all dynamic information is stored in the dynamics_GPU_info directory of the BMC". However, the GPUINFO information of the present invention can support multiple graphics cards by querying the device nodes in the / proc / gpu / N / (the number of the Nth graphics card) directory, which is essentially different from the method.

[0030] The invention patent application with publication number CN117762654A relates to a method, device, equipment and storage medium for an application to collect GPU information. The method includes: controlling a first application to collect target GPU information from target hardware in a GPU, and storing the target GPU information in a memory; for any second application, reading the target GPU information from the memory; wherein the first application and the second application are both applications requesting to collect the target GPU information, and the first application and the second application are different applications. This method is mainly a specific method for Moore Thread to implement the collection of temperature, voltage, frequency, etc. for its graphics card. This method cannot be applied to other graphics cards. The present invention provides a universal GPUINFO method, which is applicable to various graphics card manufacturers and provides a unified access method for upper-level users.

[0031] Embodiment 1

[0032] This embodiment proposes a general graphics card information query method under Linux system, based on the general graphics card information viewing framework GPUINFO, to realize the viewing of common information such as graphics card memory information, temperature, voltage, main frequency information, firmware information, GPU usage rate, and graphics card-specific features and function information, and at the same time provide a unified viewing interface for upper-level users to facilitate upper-level user operations. Figure 1 As shown, the method of this embodiment includes the following steps:

[0033] S1, implement a general graphics card information viewing framework GPUINFO in the DRM framework;

[0034] S2, after initialization, the graphics card driver registers to the graphics card information viewing framework GPUINFO and generates all device nodes corresponding to the graphics card in the specified directory. When the upper-level user queries the graphics card information, the callback interface provided by the graphics card driver is called through the device node to obtain the current graphics card information;

[0035] S3, when the graphics card driver is uninstalled or exited, it is uninstalled from the graphics card information viewing framework GPUINFO, and all device nodes corresponding to the graphics card in the specified directory are deleted.

[0036] The following is a detailed description of each step.

[0037] In step S1 of this embodiment, when the graphics card information viewing framework GPUINFO is implemented, the two interfaces provided by the graphics card information viewing framework GPUINFO are specifically registered, namely the registration interface drm_gpuinfo_register and the uninstallation interface drm_gpuinfo_unregister. The registration interface drm_gpuinfo_register and the uninstallation interface drm_gpuinfo_unregister are provided by the graphics card information viewing framework GPUINFO to the graphics card driver for calling, and are respectively used for registering to the graphics card information viewing framework GPUINFO when the graphics card driver is initialized and uninstalling from the graphics card information viewing framework GPUINFO when the graphics card driver exits.

[0038] When the graphics card driver calls the registration interface drm_gpuinfo_register for registration, the graphics card driver needs to pass the graphics card information structure drm_gpuinfo_ops to the graphics card information viewing framework GPUINFO, and implement the callback operation interface contained in the graphics card information structure drm_gpuinfo_ops, mainly including the information interface get_gpuinfo_mask for querying the graphics card support display, the graphics card information interface get_gpuinfo_data for obtaining the graphics card information, and the graphics card information interface free_gpuinfo_data for releasing the obtained graphics card information.

[0039] In this embodiment, the registration interface drm_gpuinfo_register and the unloading interface drm_gpuinfo_unregister are defined as follows:

[0040] int drm_gpuinfo_register(void*handle,struct drm_gpuinfo_ops*ops);

[0041] int drm_gpuinfo_unregister(void*handle);

[0042] Among them, int drm_gpuinfo_register(void*handle,struct drm_gpuinfo_ops*ops) means registering the operation function pointer in the graphics card information structure drm_gpuinfo_ops into the system for use in subsequent operations. int drm_gpuinfo_unregister(void*handle) means unregistering the previously registered graphics card driver from the system.

[0043] In this embodiment, the operation content of the graphics card information structure drm_gpuinfo_ops is defined as follows:

[0044]

[0045] Among them, uint32(*get_gpuinfo_mask)(void*handle) represents the function pointer for obtaining the graphics card information mask mask. Through this function, the mask value of the currently supported graphics card information field is obtained. int(*get_gpuinfo_data)(void*handle,struct drm_gpuinfo_data*data) represents the function pointer for obtaining graphics card information data. Through this function, the corresponding graphics card information data is obtained according to the specified mask and filled into the graphics card information structure drm_gpuinfo_ops. int(*free_gpuinfo_data)(void*handle,struct drm_gpuinfo_data*data) represents the function pointer for releasing graphics card information data. Through this function, the dynamically allocated resources in the graphics card information structure drm_gpuinfo_ops are released.

[0046] In this embodiment, the mask field mask defined in the information callback interface get_gpuinfo_mask includes the graphics card manufacturer, graphics card architecture, graphics card driver name, graphics card device ID, total video memory size, video memory usage size, graphics card vbios version, graphics card OEM manufacturer, temperature information, voltage information, graphics card frequency information, core frequency, video memory frequency, graphics card usage information and graphics card manufacturer-defined information. The definition of the mask field mask is as follows:

[0047]

[0048]

[0049] In this embodiment, the fields in the data of the graphics card information callback interface free_gpuinfo_data obtained by releasing include: mask field mask, graphics card manufacturer, graphics card architecture, graphics card driver name, graphics card device ID, total video memory size, video memory usage size, graphics card vbios version, graphics card OEM manufacturer, temperature information, voltage information, graphics card frequency information, core frequency, video memory frequency, graphics card usage information and graphics card manufacturer customized information, wherein the voltage information includes the number of voltages and the voltage attributes of each voltage, and the voltage attributes include the voltage name and voltage size. The data format is defined as follows:

[0050]

[0051]

[0052] In step S2 of this embodiment, registering to the graphics card information viewing framework GPUINFO is specifically implemented by the graphics card driver by calling the registration interface drm_gpuinfo_register provided by the graphics card information viewing framework GPUINFO, and when calling the registration interface drm_gpuinfo_register, the graphics card driver passes the graphics card information structure drm_gpuinfo_ops callback operation on the graphics card information to the graphics card information viewing framework GPUINFO, and implements the callback interface included in the graphics card information structure drm_gpuinfo_ops, namely the information callback interface get_gpuinfo_mask for querying the graphics card support display, the graphics card information callback interface get_gpuinfo_data for obtaining the graphics card information, and the graphics card information release callback interface free_gpuinfo_data for releasing the obtained graphics card information as described above.

[0053] In step S2 of this embodiment, the directory " / proc / gpuinfo / N / " is used as the designated directory, and "N" in the directory " / proc / gpuinfo / N / " is the number of the Nth graphics card. After the graphics card driver completes registration, the graphics card information viewing framework GPUINFO implements all nodes of the graphics card information in the / proc / gpuinfo / N / directory for the graphics card, including: basic information node baseinfo, memory information node meminfo, firmware information node vbiosinfo, temperature information node tempinfo, voltage information node voltageinfo, frequency information node freqinfo, graphics card usage information node ratioinfo and part or all of other information nodes otherinfo, wherein the data corresponding to the basic information node baseinfo includes the graphics card manufacturer, graphics card architecture, graphics card driver name and graphics card device ID; the data corresponding to the memory information node meminfo includes the total size of the graphics card and the size of the used graphics card; the data corresponding to the firmware information node vbiosinfo includes the graphics card vbios version and the graphics card OEM manufacturer; the data corresponding to the temperature information node tempinfo is temperature information; the data corresponding to the voltage information node voltageinfo is voltage information; the data corresponding to the frequency information node freqinfo is graphics card frequency information, and the graphics card frequency information includes core frequency and memory frequency; the data corresponding to the usage information node ratioinfo is graphics card usage information; and the data corresponding to the other information node otherinfo is information customized by the graphics card manufacturer.

[0054] like Figure 2 As shown, in step S2, when the callback interface provided by the graphics card driver is called by the device node to obtain the current graphics card information, the following steps are included:

[0055] S2.1, the upper user obtains the data corresponding to the graphics card by querying the information of the target device node in / proc / gpuinfo / N / (the number of the Nth graphics card);

[0056] The query operation of querying the corresponding data of the graphics card through the target device node will trigger the relevant operations of the target device node. The target device node driver will first call the callback interface get_gpuinfo_mask to query the information supported by the graphics card;

[0057] S2.2, judging whether the query is supported according to whether the information in the mask field returned by the information callback interface get_gpuinfo_mask contains an item for judging the target device node, if the mask field contains an item for judging the target device node, the query is supported, otherwise the query is not supported;

[0058] If the query is supported, jump to S2.3, otherwise end and return;

[0059] S2.3, the target device node driver calls the graphics card information callback interface get_gpuinfo_data to obtain the latest data content of the target device node project and sets it as the latest data corresponding to the target device node;

[0060] S2.4, the target device node driver calls the callback interface free_gpuinfo_data to release the acquired graphics card information to release the latest data corresponding to the target device node.

[0061] In step S3 of this embodiment, uninstalling from the graphics card information viewing framework GPUINFO means that the graphics card driver is implemented by calling the uninstall interface drm_gpuinfo_unregister provided by the graphics card information viewing framework GPUINFO mentioned above. When the graphics card driver is uninstalled or exited, it calls the uninstall interface drm_gpuinfo_unregister to complete the uninstallation of the graphics card information viewing framework GPUINFO, and at the same time deletes all device nodes in the corresponding directory / proc / gpuinfo / N / (the number of the Nth graphics card).

[0062] Embodiment 2

[0063] This embodiment provides a universal graphics card information query system under Linux system, including a microprocessor and a memory connected to each other, and the microprocessor is programmed or configured to execute the universal graphics card information query method under Linux system described in embodiment 1.

[0064] This embodiment also proposes a computer-readable storage medium, in which a computer program or instruction is stored. The computer program or instruction is programmed or configured to execute the general graphics card information query method under the Linux system described in Example 1 through a processor.

[0065] This embodiment further provides a computer program product, including a computer program or instructions, which are programmed or configured to execute the general graphics card information query method under the Linux system described in the first embodiment through a processor.

[0066] In summary, the present invention proposes a universal graphics card information query method and system under Linux system, which can effectively solve the problem of unification of graphics card information viewing methods and interfaces. The graphics card driver only needs to call the registration interface to complete the registration of the GPUINFO framework and pass the callback operation to the GPUINFO framework to obtain the corresponding GPUINFO callback function, which can shield the differences of graphics cards. At the same time, the upper-level user can directly view the nodes under the / proc / gpuinfo / directory to realize universal graphics card information viewing.

[0067] Those skilled in the art will appreciate that the technical solutions provided by the embodiments of the present application may be in the form of methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes. The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1 A process or multiple processes and / or boxes Figure 1These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0068] The above is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should also be regarded as the protection scope of the present invention.

Claims

1. A general graphics card information query method under Linux system, characterized in that: The steps include: S1, implement a general graphics card information viewing framework GPUINFO in the DRM framework; S2, after initialization, the graphics card driver registers to the graphics card information viewing framework GPUINFO and generates all device nodes corresponding to the graphics card in the specified directory. When the upper-level user queries the graphics card information, the callback interface provided by the graphics card driver is called through the device node to obtain the current graphics card information; S3, when the graphics card driver is uninstalled or exited, it is uninstalled from the graphics card information viewing framework GPUINFO, and all device nodes corresponding to the graphics card in the specified directory are deleted.

2. The general graphics card information query method under Linux system according to claim 1, characterized in that: When all device nodes corresponding to the graphics card are generated in the specified directory in step S2, all device nodes corresponding to the graphics card are located in the directory " / proc / gpuinfo / N / ", where "N" in the directory " / proc / gpuinfo / N / " is the number of the graphics card.

3. The general graphics card information query method under Linux system according to claim 1, characterized in that: All device nodes in step S2 include part or all of the basic information node baseinfo, the video memory information node meminfo, the firmware information node vbiosinfo, the temperature information node tempinfo, the voltage information node voltageinfo, the frequency information node freqinfo, the graphics card usage information node ratioinfo and other information nodes otherinfo, wherein the data corresponding to the basic information node baseinfo includes the graphics card manufacturer, the graphics card architecture, the graphics card driver name and the graphics card device ID; the data corresponding to the video memory information node meminfo includes the total size of the video memory and the size of the used video memory; the data corresponding to the firmware information node vbiosinfo includes the graphics card vbios version and the graphics card OEM manufacturer; the data corresponding to the temperature information node tempinfo is the temperature information; the data corresponding to the voltage information node voltageinfo is the voltage information; the data corresponding to the frequency information node freqinfo is the graphics card frequency information, and the graphics card frequency information includes the core frequency and the memory frequency; the data corresponding to the usage information node ratioinfo is the graphics card usage information; and the data corresponding to the other information node otherinfo is the information customized by the graphics card manufacturer.

4. The general graphics card information query method under Linux system according to claim 1, characterized in that: In step S2, registering to the graphics card information viewing framework GPUINFO is specifically implemented by the graphics card driver by calling the registration interface drm_gpuinfo_register provided by the graphics card information viewing framework GPUINFO, and when calling the registration interface drm_gpuinfo_register, the graphics card driver passes the graphics card information structure drm_gpuinfo_ops to the graphics card information viewing framework GPUINFO, and implements the callback interface included in the graphics card information structure drm_gpuinfo_ops. The callback interface included in the graphics card information structure drm_gpuinfo_ops includes: a callback interface get_gpuinfo_mask for querying the information supported by the graphics card, a callback interface get_gpuinfo_data for obtaining the graphics card information, and a callback interface free_gpuinfo_data for releasing the obtained graphics card information.

5. The general graphics card information query method under Linux system according to claim 4, characterized in that: In step S2, when the callback interface provided by the graphics card driver is called by the device node to obtain the current graphics card information, the following steps are included: S2.1, the upper user triggers the target device node related operations by querying the corresponding data of the graphics card through the target device node, and the target device node driver calls the callback interface get_gpuinfo_mask to query the information supported by the graphics card; S2.2, judging whether the query is supported based on whether the information returned by the information callback interface get_gpuinfo_mask contains items for judging the target device node, if the query is supported, jump to S2.3, otherwise end and return; S2.3, the target device node driver calls the graphics card information callback interface get_gpuinfo_data to obtain the latest data of the target device node project and uses it as the latest data corresponding to the target device node; S2.4, the target device node driver calls the callback interface free_gpuinfo_data for releasing the acquired graphics card information to release the latest data corresponding to the acquired target device node.

6. The general graphics card information query method under Linux system according to claim 4, characterized in that: The mask field mask defined in the information callback interface get_gpuinfo_mask includes graphics card manufacturer, graphics card architecture, graphics card driver name, graphics card device ID, total video memory size, video memory usage size, graphics card vbios version, graphics card OEM manufacturer, temperature information, voltage information, graphics card frequency information, core frequency, video memory frequency, graphics card usage information and information customized by the graphics card manufacturer; the fields in the data of the graphics card information callback interface free_gpuinfo_data obtained by releasing include: mask field mask, graphics card manufacturer, graphics card architecture, graphics card driver name, graphics card device ID, total video memory size, video memory usage size, graphics card vbios version, graphics card OEM manufacturer, temperature information, voltage information, graphics card frequency information, core frequency, video memory frequency, graphics card usage information and information customized by the graphics card manufacturer, wherein the voltage information includes the number of voltages and the voltage attributes of each voltage, and the voltage attributes include the voltage name and the voltage size.

7. The general graphics card information query method under Linux system according to claim 1, characterized in that: Uninstalling from the graphics card information viewing framework GPUINFO in step S3 means that the graphics card driver is implemented by calling the unloading interface drm_gpuinfo_unregister provided by the graphics card information viewing framework GPUINFO.

8. A general graphics card information query system under Linux system, comprising a microprocessor and a memory connected to each other, characterized in that: The microprocessor is programmed or configured to execute the general graphics card information query method under the Linux system as described in any one of claims 1 to 7.

9. A computer-readable storage medium having a computer program or instruction stored therein, characterized in that: The computer program or instruction is programmed or configured to execute the general graphics card information query method under the Linux system as described in any one of claims 1 to 7 through a processor.

10. A computer program product comprising a computer program or instructions, characterized in that The computer program or instruction is programmed or configured to execute the general graphics card information query method under the Linux system as described in any one of claims 1 to 7 through a processor.

Citation Information

Patent Citations

  • Method and device for collecting GPU information by application program, equipment and storage medium

    CN117762654A

  • Graphic processor monitoring method and device, medium and server monitoring system

    CN117931581A