A graphics card driver selection mechanism implementation method, device and storage medium

By modularly configuring the graphics card driver and conducting performance tests, the optimal graphics card driver is dynamically selected, solving the problem of inflexible graphics card driver selection on the Shenwei domestic platform and improving 3D graphics display performance.

CN116071218BActive Publication Date: 2026-05-01WUXI ADVANCED TECH RES INST
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
WUXI ADVANCED TECH RES INST
Filing Date
2023-02-17
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

In existing technologies, Shenwei's domestic platform cannot flexibly select the graphics card driver with the best performance, which affects 3D graphics performance.

Method used

By configuring different types of graphics card drivers as kernel-loadable modules, testing their graphics performance, and unloading and loading them according to the type of graphics card driver selected by the system, the system finally loads the graphics card driver module with the best performance into the kernel, thus achieving dynamic selection of graphics card drivers.

Benefits of technology

It improves the efficiency of graphics card tasks such as lighting and rendering, reduces the CPU's graphics data processing pressure, optimizes graphics display effects, and enhances 3D graphics performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116071218B_ABST
    Figure CN116071218B_ABST
Patent Text Reader

Abstract

The application discloses a kind of graphic card drive selection mechanism implementation method, device and storage medium, including different kinds of graphic card drive being configured into the graphic card drive module of loadable kernel;Test the graphic performance of different kinds of graphic card drive;Receive system viewing instruction, view all modules loaded by system, determine the graphic card drive type selected by system;Judge whether the graphic card drive type selected by system is the optimal graphic card drive, if not, unload current graphic card drive, load the optimal graphic card drive module into kernel, the efficiency of the graphic card illumination rendering and the like work is improved, the CPU graphic data processing pressure is reduced, the purpose of optimizing graphic display is achieved, on the basis of meeting software demand, 3D graphic image performance is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a method, apparatus, and storage medium for implementing a graphics card driver selection mechanism, belonging to the field of 3D graphics acceleration technology. Background Technology

[0002] With the rapid development of computer hardware and software technology, 3D graphics acceleration, as an advanced technology, is being widely applied in various domestically developed and innovative information display systems. Its primary purpose is to provide high-performance graphics display and to drive the rapid development of the graphics display field. Graphics acceleration technology mainly addresses the problems of massive graphics processing computations, overloading the Central Processing Unit (CPU), and resulting in poor graphics display quality. It has gone through three stages: no acceleration, 2D acceleration, and 3D acceleration. Employing a "CPU+GPU" heterogeneous computing approach, it reduces the CPU's computational burden and efficiently utilizes the Graphics Processing Unit (GPU) to handle complex graphics processing tasks, thereby improving graphics display quality.

[0003] The development of graphics acceleration technology to the 3D acceleration stage is characterized by the introduction of techniques such as triangle setting, rasterization, texture mapping, geometric transformation, lighting calculation, and rendering. One of its research and implementation methods is hardware acceleration. This acceleration method uses dedicated hardware devices such as GPUs to replace general-purpose processors to handle complex graphics data calculation tasks. By leveraging the high parallelism of dedicated hardware devices, it reduces system load, reduces computation latency, increases throughput, and accelerates graphics data processing.

[0004] Hardware acceleration utilizes the graphics driver as middleware for communication. Different types of graphics drivers offer varying performance levels, and choosing the right driver impacts GPU efficiency and, consequently, graphics acceleration efficiency. Currently, AMD Radeon graphics cards support a variety of graphics drivers with different performance characteristics.

[0005] Currently, with the continuous development of 3D graphics acceleration technology on domestic platforms, improving 3D graphics performance has become an important issue in order to meet the high-performance display needs of different fields.

[0006] In existing technologies, Shenwei's domestic platform adopts a "CPU+GPU" heterogeneous computing approach. Given the limited computing power of the CPU, dedicated hardware devices (GPUs) are used to perform complex graphics processing. The CPU and GPU need to communicate through a graphics card driver as middleware, making the selection of a higher-performance graphics card driver crucial. However, currently, Shenwei's domestic platform often selects the system's default graphics card driver, not allowing users to freely choose. This selection mechanism cannot guarantee that the selected graphics card driver will have optimal performance, failing to meet software requirements and thus impacting 3D graphics performance. Summary of the Invention

[0007] The purpose of this invention is to overcome the shortcomings of the prior art and provide a method, device and storage medium for implementing a graphics card driver selection mechanism, thereby solving the problem that the graphics card driver selection mechanism of the Shenwei domestic platform is inflexible and cannot accurately select the graphics card driver with the best performance, thus affecting the 3D graphics performance.

[0008] To achieve the above objectives, the present invention is implemented using the following technical solution:

[0009] In a first aspect, the present invention provides a method for implementing a graphics card driver selection mechanism, comprising:

[0010] Configure different types of graphics card drivers into graphics card driver modules that can load kernels;

[0011] Test the graphics performance of different types of graphics card drivers;

[0012] Receive system view command, view all modules loaded by the system, and determine the type of graphics card driver selected by the system;

[0013] Determine if the graphics card driver selected by the system is the optimal one. If not, uninstall the current graphics card driver and load the optimal graphics card driver module into the kernel.

[0014] Furthermore, the method also includes:

[0015] Receive rendering commands sent by the processor and forward them to the graphics card driver;

[0016] The rendering commands received by the graphics card driver are translated, and the translated rendering commands are sent to the GPU so that the GPU can start rendering work according to the received translated rendering commands.

[0017] Furthermore, the method for testing the graphics performance of different types of graphics card drivers includes:

[0018] Load the driver module of the graphics card under test into the kernel;

[0019] Compile GLmark2 and a 3D computer graphics library using optimization level O2, write test scripts, output the program to a specified file, specify the number of tests, and perform the test.

[0020] When calculating test scores, the maximum and minimum values ​​are removed, and the average of the remaining data is taken as the final test result.

[0021] Load the remaining graphics card driver modules to be tested, and uninstall the tested graphics card driver modules, and continue testing until all graphics card driver modules have been tested.

[0022] Furthermore, when determining whether the graphics card driver type selected by the system is the best performing graphics card driver, if the graphics card driver module loaded into the kernel is the best performing graphics card driver, no changes are needed. If multiple graphics card driver modules are loaded into the kernel, the best performing graphics card driver is retained, and the other graphics card driver modules are uninstalled.

[0023] Secondly, the present invention provides a device for implementing a graphics card driver selection mechanism, comprising:

[0024] The configuration module is used to configure different types of graphics card drivers into a kernel-loadable graphics card driver module;

[0025] The testing module is used to test the graphics performance of different types of graphics card drivers;

[0026] The graphics card driver type determination module is used to receive system viewing commands, view all modules loaded by the system, and determine the type of graphics card driver selected by the system.

[0027] The judgment module is used to determine whether the graphics card driver type selected by the system is the optimal graphics card driver. If not, the current graphics card driver is uninstalled and the optimal graphics card driver module is loaded into the kernel.

[0028] Furthermore, the device also includes:

[0029] The rendering command receiving module is used to receive rendering commands sent by the processor and forward the rendering commands to the graphics card driver;

[0030] The rendering command translation module is used to translate the rendering commands received by the graphics card driver and send the translated rendering commands to the GPU so that the GPU can start drawing work according to the received translated rendering commands.

[0031] Furthermore, the test module includes:

[0032] The loading unit is used to load the driver module of the graphics card under test into the kernel;

[0033] The first test unit is used to compile Glmark2 and a 3D computer graphics library using optimization level O2, write test scripts, output the program to a specified file, specify the number of tests, and perform the test.

[0034] The calculation unit is used to remove the maximum and minimum values ​​when calculating test scores, and take the average of the remaining data as the final test result.

[0035] The second test unit loads the remaining graphics card driver modules to be tested, and uninstalls the tested graphics card driver modules, and continues testing until all graphics card driver modules have been tested.

[0036] Furthermore, in the judgment module, when judging whether the graphics card driver type selected by the system is the graphics card driver with the best performance, if the graphics card driver module loaded into the kernel is the graphics card driver with the best performance, then no change is needed. If multiple graphics card driver modules are loaded into the kernel, then the graphics card driver with the best performance is retained, and the other graphics card driver modules are uninstalled.

[0037] Thirdly, the present invention provides an electronic device, including a processor and a storage medium;

[0038] The storage medium is used to store instructions;

[0039] The processor is configured to operate according to the instructions to perform the steps of the method according to any of the preceding claims.

[0040] Fourthly, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the preceding methods.

[0041] Compared with the prior art, the beneficial effects achieved by the present invention are as follows:

[0042] This invention provides a method for implementing a graphics card driver selection mechanism. The options for graphics card drivers in the kernel are modularized and configured. The best-performing graphics card driver is selected based on the GPU performance test program, and the driver module is dynamically loaded into the kernel. This improves the efficiency of graphics card lighting and rendering, reduces the CPU's graphics data processing pressure, and achieves the goal of optimizing graphics display. While meeting software requirements, it also improves 3D graphics performance. Attached Figure Description

[0043] Figure 1 This is a schematic diagram of a graphics card driver selection mechanism based on the rendering process provided in an embodiment of the present invention;

[0044] Figure 2 This is a schematic diagram of a graphics performance testing method for selecting the optimal graphics card driver provided in an embodiment of the present invention. Detailed Implementation

[0045] The present invention will be further described below with reference to the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and should not be used to limit the scope of protection of the present invention.

[0046] Example 1

[0047] This embodiment describes a method for implementing a graphics card driver selection mechanism, including:

[0048] Configure different types of graphics card drivers into graphics card driver modules that can load kernels;

[0049] Test the graphics performance of different types of graphics card drivers;

[0050] Receive system view command, view all modules loaded by the system, and determine the type of graphics card driver selected by the system;

[0051] Determine if the graphics card driver selected by the system is the optimal one. If not, uninstall the current graphics card driver and load the optimal graphics card driver module into the kernel.

[0052] The graphics card driver selection mechanism implementation method provided in this embodiment involves the following steps in its application process:

[0053] S101: Modify graphics card driver configuration options and compile the kernel.

[0054] In this embodiment, a modular and dynamic management approach to kernel configuration options is used to allow users to freely select graphics card drivers. During kernel compilation, the relevant configuration options for graphics card drivers are changed, configuring different types of graphics card drivers as loadable kernel modules (LKMs). The required graphics card driver modules are then loaded into the kernel for use.

[0055] The specific steps are as follows: When compiling the kernel, modify the graphics card driver configuration options to configure the AMD GPU and Radeon graphics card drivers as LKM. Users can then select different graphics card driver modules according to their needs and load them into the kernel, thus achieving the goal of users freely choosing their graphics card driver.

[0056] For example, configure the relevant options such as "CONFIG_DRM_AMDGPU" and "CONFIG_DRM_RADEON" in the kernel configuration file to 'm', then compile the kernel and restart.

[0057] S102: Determine the type of graphics card driver selected by the system.

[0058] After the system starts, you need to check the modules that have been loaded to determine the type of graphics card driver selected by the system.

[0059] For example, the "lsmod" command can be used to view all currently loaded modules in the system. If it includes the amdgpu and Radeon driver modules, the compilation was successful. The "lshw -cvideo|grep configuration" command can then be used to determine the type of graphics card driver currently being used by the system.

[0060] S103: Select the graphics card driver type according to your needs and load the graphics card driver module into the kernel.

[0061] After determining the type of graphics card driver currently used by the system, select the appropriate driver based on requirements. In this embodiment, to improve 3D graphics performance, the best-performing graphics card driver needs to be loaded into the kernel.

[0062] The specific steps are as follows: determine the type of graphics card driver currently in use by the system and the graphics card driver with better performance, load the graphics card driver with the best performance into the kernel for application scheduling.

[0063] For example: Suppose the better-performing graphics card driver is amdgpu. If the graphics card driver loaded into the kernel is radeon, then you need to find the amdgpu.ko file, use the command "insmodamdgpu.ko" to load the module into the kernel, and then use the command "rmmodradeon.ko" to unload the radeon driver module. If the graphics card driver loaded into the kernel is amdgpu, then no changes are needed. If both graphics card drivers are loaded into the kernel, then unload the radeon driver and keep the better-performing amdgpu driver.

[0064] S104: The Shenwei 831 CPU loads the data required for rendering from main memory to video memory.

[0065] The Shenwei 831 CPU uses main memory (Random Access Memory, RAM) to load rendering data such as vertex position color, texture coordinates, and shader parameters from main memory (Random Access Memory, RAM) into the video memory (VRAM) of the AMD Radeon series graphics cards.

[0066] S105: Shenwei 831 CPU sends rendering commands.

[0067] The Shenwei 831 CPU sets the rendering state and sends rendering commands (DrawCall) to the application.

[0068] S106: The application sends rendering commands to OpenGL.

[0069] The application sends rendering commands to OpenGL, but the system cannot directly use OpenGL functions to create a display window. It needs the OpenGL Extension to the X Window System (GLX) to bridge the gap and complete the conversion between OpenGL graphics and X window images.

[0070] S107: OpenGL sends rendering commands and data to the graphics card driver.

[0071] After receiving rendering commands from the application, OpenGL forwards these commands to the graphics card driver.

[0072] S108: The graphics card driver translates rendering commands and sends the translated rendering commands to the GPU.

[0073] After receiving rendering commands and data from OpenGL, the graphics card driver translates these commands into machine language that the GPU can understand, and simultaneously converts texture data and other data into formats supported by the GPU. Once the GPU receives the translated rendering commands, it can begin the rendering process.

[0074] Figure 2 This is a schematic diagram of a graphics performance testing method for selecting the optimal graphics card driver, as illustrated in one embodiment. The method includes:

[0075] S201: The Shenwei 831 processor is equipped with an AMD Radeon series graphics card connected to a display device.

[0076] In this embodiment, the Shenwei 831 desktop computer, a domestic platform, is used as the base platform. An AMD Radeon series graphics card is connected to the PCIe interface of the Shenwei platform using a graphics card adapter cable. The Shenwei 831 desktop computer equipped with the above-mentioned graphics card is used as the test environment.

[0077] S202: Tests GPU performance when the graphics card loads different graphics card drivers.

[0078] GLMark2 is an open-source GPU performance testing tool that includes a set of benchmark tests written for the OpenGL application programming interface. It covers 3D graphics rendering such as architecture, buffering, lighting, and textures. Each test set lasts for 10 seconds, and the frame rate (FPS) and frame time (FrameTime) are recorded separately.

[0079] The specific steps are as follows: First, load the graphics card driver module to be tested into the kernel; then compile GLmark2 and the 3D computer graphics library (mesa) using the optimization level O2, write a test script, output the program to a specified file, specify the number of tests, remove the maximum and minimum values ​​when calculating the test score, and take the average of the remaining data as the final test result; finally, load another graphics card driver module to be tested, unload the tested graphics card driver module, and continue testing.

[0080] For example: Suppose N tests are specified. After obtaining the test scores, remove the maximum value and the minimum value. The average of the remaining N-2 data points is the final GPU performance score when this graphics card driver is selected.

[0081] S203: Select the best-performing graphics card driver based on performance tests and load it into the kernel.

[0082] In this embodiment, there are two types of graphics card drivers adapted to AMD Radeon series graphics cards: Radeon driver and AMD GPU driver. To select the optimal graphics card driver for the current graphics card, a GL800 performance test is performed. Based on the test results, the graphics card driver type with the best performance is determined and loaded into the kernel.

[0083] For example, AMD Radeon series graphics cards default to selecting the Radeon graphics driver. After GLMark2 performance testing, if the default Radeon driver's performance score is lower than that of the AMD GPU driver, the AMD GPU graphics driver module will be loaded into the kernel and the Radeon driver will be uninstalled. Otherwise, it will be retained, thus achieving the goal of accurately selecting the graphics driver with the best performance.

[0084] This embodiment adopts the above-mentioned modular dynamic management method of kernel configuration options, which modularizes the options related to the graphics card driver in the kernel. The best-performing graphics card driver is selected according to the GPU performance test program, and the driver module is dynamically loaded into the kernel. This improves the efficiency of graphics card lighting and rendering, reduces the CPU graphics data processing pressure, and achieves the purpose of optimizing graphics display. While meeting software requirements, it improves 3D graphics performance.

[0085] Example 2

[0086] This embodiment provides a device for implementing a graphics card driver selection mechanism, including:

[0087] The configuration module is used to configure different types of graphics card drivers into a kernel-loadable graphics card driver module;

[0088] The testing module is used to test the graphics performance of different types of graphics card drivers;

[0089] The graphics card driver type determination module is used to receive system viewing commands, view all modules loaded by the system, and determine the type of graphics card driver selected by the system.

[0090] The judgment module is used to determine whether the graphics card driver type selected by the system is the optimal graphics card driver. If not, the current graphics card driver is uninstalled and the optimal graphics card driver module is loaded into the kernel.

[0091] The rendering command receiving module is used to receive rendering commands sent by the processor and forward the rendering commands to the graphics card driver;

[0092] The rendering command translation module is used to translate the rendering commands received by the graphics card driver and send the translated rendering commands to the GPU so that the GPU can start drawing work according to the received translated rendering commands.

[0093] In a further embodiment, the test module includes:

[0094] The loading unit is used to load the driver module of the graphics card under test into the kernel;

[0095] The first test unit is used to compile Glmark2 and a 3D computer graphics library using optimization level O2, write test scripts, output the program to a specified file, specify the number of tests, and perform the test.

[0096] The calculation unit is used to remove the maximum and minimum values ​​when calculating test scores, and take the average of the remaining data as the final test result.

[0097] The second test unit loads the remaining graphics card driver modules to be tested, and uninstalls the tested graphics card driver modules, and continues testing until all graphics card driver modules have been tested.

[0098] In a further embodiment, when the judgment module determines whether the graphics card driver type selected by the system is the graphics card driver with the best performance, if the graphics card driver module loaded into the kernel is the graphics card driver with the best performance, then no changes are needed. If multiple graphics card driver modules are loaded into the kernel, then the graphics card driver with the best performance is retained, and the other graphics card driver modules are unloaded.

[0099] Example 3

[0100] This embodiment provides an electronic device, including a processor and a storage medium;

[0101] The storage medium is used to store instructions;

[0102] The processor is configured to operate according to the instructions to perform the steps of the method according to any one of Embodiment 1.

[0103] Example 4

[0104] This embodiment provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the methods described in Embodiment 1.

[0105] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A method for implementing a graphics card driver selection mechanism, characterized in that, include: Configure different types of graphics card drivers into graphics card driver modules that can load kernels; Test the graphics performance of different types of graphics card drivers; Receive system view command, view all modules loaded by the system, and determine the type of graphics card driver selected by the system; Determine if the graphics card driver type selected by the system is the optimal graphics card driver. If not, uninstall the current graphics card driver and load the optimal graphics card driver module into the kernel. The method for testing the graphics performance of different types of graphics card drivers includes: Load the driver module of the graphics card under test into the kernel; Compile GLmark2 and a 3D computer graphics library using optimization level O2, write test scripts, output the program to a specified file, specify the number of tests, and perform the test. When calculating test scores, the maximum and minimum values ​​are removed, and the average of the remaining data is taken as the final test result. Load the remaining graphics card driver modules to be tested, and uninstall the tested graphics card driver modules, and continue testing until all graphics card driver modules have been tested.

2. The method for implementing the graphics card driver selection mechanism according to claim 1, characterized in that, The method further includes: Receive rendering commands sent by the processor and forward them to the graphics card driver; The rendering commands received by the graphics card driver are translated, and the translated rendering commands are sent to the GPU so that the GPU can start rendering work according to the received translated rendering commands.

3. The method for implementing the graphics card driver selection mechanism according to claim 1, characterized in that, When determining whether the graphics card driver selected by the system is the best performing graphics card driver, if the graphics card driver module loaded into the kernel is the best performing graphics card driver, no changes are needed. If multiple graphics card driver modules are loaded into the kernel, the best performing graphics card driver is retained, and the other graphics card driver modules are uninstalled.

4. A device for implementing a graphics card driver selection mechanism, characterized in that, include: The configuration module is used to configure different types of graphics card drivers into a kernel-loadable graphics card driver module; The testing module is used to test the graphics performance of different types of graphics card drivers; The graphics card driver type determination module is used to receive system viewing commands, view all modules loaded by the system, and determine the type of graphics card driver selected by the system. The judgment module is used to determine whether the graphics card driver type selected by the system is the optimal graphics card driver. If not, the current graphics card driver is uninstalled and the optimal graphics card driver module is loaded into the kernel. The test module includes: The loading unit is used to load the driver module of the graphics card under test into the kernel; The first test unit is used to compile Glmark2 and a 3D computer graphics library using optimization level O2, write test scripts, output the program to a specified file, specify the number of tests, and perform the test. The calculation unit is used to remove the maximum and minimum values ​​when calculating test scores, and take the average of the remaining data as the final test result. The second test unit loads the remaining graphics card driver modules to be tested, and uninstalls the tested graphics card driver modules, and continues testing until all graphics card driver modules have been tested.

5. The device for implementing the graphics card driver selection mechanism according to claim 4, characterized in that, The device further includes: The rendering command receiving module is used to receive rendering commands sent by the processor and forward the rendering commands to the graphics card driver; The rendering command translation module is used to translate the rendering commands received by the graphics card driver and send the translated rendering commands to the GPU so that the GPU can start drawing work according to the received translated rendering commands.

6. The graphics card driver selection mechanism implementation device according to claim 4, characterized in that, In the judgment module, when judging whether the graphics card driver type selected by the system is the graphics card driver with the best performance, if the graphics card driver module loaded into the kernel is the graphics card driver with the best performance, then no change is needed. If multiple graphics card driver modules are loaded into the kernel, then the graphics card driver with the best performance is retained, and the other graphics card driver modules are uninstalled.

7. An electronic device, characterized in that: Including processor and storage media; The storage medium is used to store instructions; The processor is configured to operate according to the instructions to perform the steps of the method according to any one of claims 1 to 3.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When executed by a processor, the program implements the steps of the method according to any one of claims 1 to 3.

Citation Information

Patent Citations

  • Image display scheduling method applied to Android system, terminal and storage medium

    CN113064727A

  • Server-based microkernel operating system deployment method and operating system

    CN113127077A