Performance optimization method and system based on virtual graphics card
By allocating independent graphics cache to the display window of the client system in the Hypervisor virtualization environment, it can independently synthesize and send graphics, and solve the problem of wasted graphics card resources, achieving efficient utilization of graphics card resources and improving system performance.
Patent Information
- Application Number
- CN202411683299.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-22
- Publication Date
- 2025-03-14
AI Technical Summary
In the prior art, there is waste of graphics card resources in Hypervisor virtualization environment, especially when the client system refreshes multiple screens, the host system needs to render super large images, resulting in waste of graphics card resources.
By obtaining scene information, set the current scene mode of the host system. When the single-screen refresh mode is used, an independent display cache is allocated to the display window of the client system, so that each client system can independently synthesize and display.
On the premise of retaining the screen splicing function of the host system, the display window of the client system is refreshed independently, avoiding the existence of still screen synthesis and graphics delivery in the entire display channel, thereby saving graphics card resources and improving system performance and user experience.
Smart Images

Figure CN119621234A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of virtualization technology, and in particular to a performance optimization method and system based on a virtual graphics card. Background Art
[0002] Virtualization technology has been widely used in multiple systems in smart cockpits. Through methods such as multi-level scheduling and kernel isolation, this technology makes resource scheduling between client systems fairer and system operation safer. The current mainstream Hypervisor technology is mainly divided into two categories, Type I and Type II. These two types mainly differ in scheduling models, and there is no obvious difference in IO virtualization solutions. The former uses a two-level scheduling model in which the physical CPU schedules the virtual CPU and the virtual CPU schedules tasks to complete fair scheduling of tasks between virtual machine systems, including open source solutions such as XEN and ACRN; the latter retains the first-level scheduling model and turns the underlying logic originally executed by the Hypervisor into a single kernel module of the host system, including solutions such as KVM.
[0003] The common point of these two types of mainstream hypervisor technologies is that they use device virtualization solutions such as virtio, vhost and vhost-user to realize the access requirements of different virtual machine systems to physical external devices. For example, for a virtual graphics card, the rendering process of the client system applies for / releases video memory, submits rendering tasks, submits synthesis tasks, and submits display tasks through VIRTIO GPU instructions. After the host system parses the instructions, it allocates / releases video memory or completes rendering, synthesis or display tasks according to the content of the rendering process instructions. In the current graphics card virtualization technology solution, the client system's multiple screens (even if only a single screen is refreshed) are synthesized and displayed at the same time. The screen splicing function of the host system makes it necessary to render a very large screen before physically displaying it, resulting in a waste of graphics card resources. Summary of the invention
[0004] In view of the above-mentioned shortcomings of the prior art, the purpose of the present application is to provide a performance optimization method and system based on a virtual graphics card to improve the problem of graphics card resource waste in the hypervisor virtualization environment in the prior art.
[0005] To achieve the above objectives and other related objectives, the present application provides a performance optimization method based on a virtual graphics card, which is applied to a host system in a Hypervisor environment. The method includes:
[0006] Get scene information;
[0007] Setting the current scene mode of the host system according to the scene information;
[0008] When the current scene mode of the host system is the single-screen refresh mode, an independent display buffer is allocated to the display window corresponding to each client system, so that each client system can synthesize and display independently.
[0009] In an optional embodiment of the present application, the scene information includes a first type of scene or a second type of scene different from the first type of scene, wherein the first type of scene includes a boot animation scene or a car exhibition scene;
[0010] Determining the current scene mode of the host system according to the scene information includes:
[0011] Determine whether the scene information is the first type of scene:
[0012] If not, the current scene mode of the host system is set to a single-screen refresh mode;
[0013] If so, the current scene mode of the host system is set to the screen splicing mode.
[0014] In an optional embodiment of the present application, the method further includes:
[0015] When the current scene mode of the host system is the screen splicing mode, an overall canvas corresponding to all display windows is created, and the overall canvas is used to receive the spliced contents of all display windows;
[0016] When a single display window is updated, the entire canvas is forced to be synthesized and displayed to achieve linkage of multiple display windows.
[0017] In an optional embodiment of the present application, the method further includes:
[0018] When exiting the screen splicing mode, the entire canvas is destroyed, video memory resources are released, and the single screen refresh mode is switched.
[0019] In an optional embodiment of the present application, before acquiring the scene information, the method further includes:
[0020] Initialize the back-end simulation program and start each of the client systems;
[0021] Create display windows corresponding to the host system and each of the client systems.
[0022] In an optional embodiment of the present application, the host system is an instrument system provided on the vehicle chip, and the client system is a central control system provided on the vehicle chip; the display window corresponding to the instrument system includes at least an HMI interface window, and the display window corresponding to the central control system includes at least a CSD interface window.
[0023] To achieve the above-mentioned purpose and other related purposes, the present application provides a performance optimization method based on a virtual graphics card, which is applied to a client system in a Hypervisor environment, and the method includes:
[0024] After the host system allocates an independent display buffer to the display window of the client system, the number of sub-display windows in the client system is obtained;
[0025] Determining whether the number of sub-display windows in the client system is greater than a preset threshold;
[0026] When the number of the sub-display windows exceeds the preset threshold, the forced synthesis function is turned off, so that the different sub-display windows in the client system are independently synthesized and displayed independently.
[0027] In an optional embodiment of the present application, the method further includes:
[0028] Obtaining a screen refresh status of the client system;
[0029] Determine whether to refresh each sub-display window in a single cycle according to the screen refresh state:
[0030] If not, only the sub-display window that needs to be refreshed by the client system is subjected to layer synthesis and screen display.
[0031] To achieve the above-mentioned purpose and other related purposes, the present application provides a performance optimization system based on a virtual graphics card, the system comprising a host system and a client system that are connected to each other in a hypervisor environment, the client system running in a virtualized environment provided by the host;
[0032] The host system comprises:
[0033] A scene information acquisition module, used to acquire scene information;
[0034] a scene mode determination module, configured to set a current scene mode of the host system according to the scene information; and
[0035] The cache setting module is used to allocate an independent display buffer to the display window corresponding to each client system when the current scene mode of the host system is the single-screen refresh mode, so that each client system can synthesize and display independently.
[0036] In an optional embodiment of the present application, the client system includes:
[0037] A window quantity acquisition module, used for acquiring the number of sub-display windows in the client system after the host system allocates an independent display buffer to the display window of the client system;
[0038] a window quantity determination module, configured to determine whether the number of sub-display windows within the client system is greater than a preset threshold; and
[0039] The synthesis closing module closes the forced synthesis function when the number of the sub-display windows exceeds the preset threshold, so that the different sub-display windows in the client system are independently synthesized and displayed independently.
[0040] In the present application, the host system obtains scene information; sets the current scene mode of the host system according to the scene information; when the current scene mode of the host system is the single-screen refresh mode, allocates an independent display buffer to the display window corresponding to each client system, so that each client system can independently synthesize and display, thereby realizing independent refresh of the display window of the client system while retaining the screen splicing function of the host system, avoiding static screen synthesis and display in the entire display channel, thereby saving graphics card resources.
[0041] In the present application, the client system can obtain the number of sub-display windows in the host system after the host system allocates an independent display buffer for the corresponding display window, and when the number of sub-display windows exceeds a preset threshold, the forced synthesis function is turned off to enable the different sub-display windows in the client system to be independently synthesized and independently displayed. By using the present application, it is possible to achieve independent refresh of any sub-window in each client system while retaining the screen splicing function of the host system, avoiding static screen synthesis and display in the entire display channel, and further saving graphics card resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 A flowchart of a performance optimization method based on a virtual graphics card in an exemplary embodiment of the present application is shown;
[0043] Figure 2 A flowchart of a performance optimization method based on a virtual graphics card in another exemplary embodiment of the present application is shown;
[0044] Figure 3 A structural block diagram of a performance optimization system based on a virtual graphics card according to an exemplary embodiment of the present application is shown. DETAILED DESCRIPTION
[0045] The following describes the implementation of the present application through specific examples, and those skilled in the art can easily understand other advantages and effects of the present application from the contents disclosed in this specification. The present application can also be implemented or applied through other different specific implementations, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present application.
[0046] It should be noted that the illustrations provided in this embodiment only illustrate the basic concept of the present application in a schematic manner, and therefore the drawings only show components related to the present application rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.
[0047] The current mainstream hypervisor technologies are mainly Type I and Type II. Both of these mainstream technologies use device virtualization solutions such as virtio, vhost, and vhost-user to achieve different virtual machine systems' access requirements to physical external devices. The common point of these technologies is that the host system simulates the backend device, the client system's application or system service is driven by the front end, and the client system kernel converts the native device access logic into an instruction set for front-end and back-end interaction. The back-end device simulation program receives the above instruction set and completes the client system's access link to the physical device with the help of the physical device driver.
[0048] For example, in the virtual graphics card solution, the rendering process of the client system applies for / releases video memory, submits rendering tasks, submits synthesis tasks, and submits display tasks through VIRTIO GPU instructions. After the host system parses the instructions, it allocates / releases video memory according to the content of the rendering process instructions, or completes rendering, synthesis, or display tasks. In the current graphics card virtualization technology solution, since the client system has multiple screens (even if only a single screen is refreshed) that are synthesized and displayed at the same time, the screen splicing function of the host system requires rendering of a very large screen before physical display. Since both layer synthesis and screen display use graphics card resources, the current graphics card virtualization technology solution has the following disadvantages: on the one hand, a single-screen refresh of the client system causes multi-screen synthesis and multi-screen display, resulting in a waste of graphics card resources; on the other hand, a single-screen refresh of a single-client system causes the host system to render a very large screen (the content includes the host display window and multiple client display windows), further resulting in a waste of graphics card resources.
[0049] The present application provides a performance optimization method based on a virtual graphics card, and the client system can determine whether to perform layer synthesis and screen display on each screen in a single cycle according to the screen refresh status. If only a single screen is refreshed, then only single-screen synthesis and single-screen display are performed in the display cycle. At the same time, the host system splits the display channel between the ordinary display window and the display window of the client system, and even splits the display window of multiple screens within the client system. In this way, any window of any client can be refreshed, and the entire display channel will not have the problem of static screen synthesis and display causing waste of graphics card resources. In addition, the solution of the present application can still retain the screen splicing function of the host system. The single-screen refresh mode and the screen splicing mode are distinguished by scenes. The system startup animation scene and the exhibition car scene both use the screen splicing mode, and other scenes use the single-screen refresh mode.
[0050] Figure 1 A flowchart of a performance optimization method based on a virtual graphics card in an exemplary embodiment of the present application is shown, including steps S101 to S103, which can be executed by a host system.
[0051] Step S101, obtaining scene information, wherein the scene information may include one of a first category of scenes and a second category of scenes, the first category of scenes being different from the second category of scenes, the first category of scenes may include boot-up animation scenes, exhibition car scenes, etc., which require multiple display windows to be refreshed synchronously, reflecting scenes in which multiple display windows are linked, and the second category of scenes include normal driving scenes, reversing scenes, etc., which can be refreshed independently by a single display window, and do not require multiple display windows to be linked, serving as a basis for setting the current scene mode of the host system in the subsequent step S102.
[0052] This application is applicable to all automotive multi-system and multi-screen solutions based on Hypervisor technology. This scenario is currently common in the field of vehicle system integration, where the host refers to the physical computer running the virtual machine, and the host system as the client refers to the virtual machine running in the virtualized environment provided by the host. Taking the instrument system (as the host system) and the central control system (as the client system) running on the vehicle chip as an example, the performance optimization method based on the virtual graphics card is explained.
[0053] After the car system is powered on, the car chip boot program reads the Grub configuration table and loads the Hypervisor image, the host system kernel image and the root file system image. The host system has two main functions: one is to serve as a VMM (Virtual Machine Manager) and the other is to output the instrument interface content.
[0054] The host system acts as a VMM, initializes the backend simulation program, and starts each of the client systems. Specifically, the host system initializes each module of the device simulation process of the client system, mainly creating a virtual CPU, reserving memory space, and initializing each simulation device, etc., to ensure that the client system can operate normally in a virtualized environment. Instrument-related services are not within the scope of this application and are not described in detail.
[0055] The host system initializes the display service and creates display windows corresponding to the host system and each of the client systems, that is, creates multiple display windows corresponding to the instrument system and the central control system, wherein the display window corresponding to the instrument system includes an HMI interface window (mandatory) and a HUD interface window (optional), and the display window corresponding to the central control system includes a CSD interface window (mandatory), a PSD interface window (optional) and an FPL interface window (optional).
[0056] Step S102: setting the current scene mode of the host system according to the scene information.
[0057] When the vehicle system is in the first type of scene, such as the boot animation scene and the exhibition car scene, multiple display windows need to be linked to display the boot animation, exhibition car screen and other scene pictures, and when the vehicle system is in the second type of scene, such as the normal driving scene and the reversing scene, it only needs to refresh the content in a single display window. Therefore, after the client system obtains the scene information, it can determine the current scene mode of the host system according to whether the scene information contains the first type of scene information of the system. Specifically, the client system can determine whether the scene information is the first type of scene by:
[0058] If so, the current scene mode of the host system is set to the screen splicing mode.
[0059] If not, the current scene mode of the host system is set to the single-screen refresh mode.
[0060] Step S103, when the current scene mode of the host system is the single-screen refresh mode, an independent display buffer is allocated to the display window corresponding to each client system, so that each client system can independently synthesize and display.
[0061] When the host system is in single-screen refresh mode, since the display windows do not need to be refreshed at the same time, the host system can allocate independent display buffers for the display windows corresponding to the client systems, so that each client system can synthesize and display independently, thereby realizing independent refresh of the display windows of the client systems without interfering with each other, avoiding static screen synthesis and display in the entire display channel, thereby saving graphics card resources and improving the performance of the overall system and user experience.
[0062] In addition, in order to retain the screen splicing function of the host system, when the vehicle system is in the boot animation scene or the exhibition car scene, that is, when the current scene mode of the host system is the screen splicing mode, the host system can also create an overall canvas corresponding to all display windows, and use the overall canvas to undertake the spliced content of all display windows, so that when a single display window or part of the display window is updated, the overall canvas is forced to be synthesized and displayed to realize the linkage of multiple display windows. When exiting the screen splicing mode, the overall canvas is destroyed, the video memory resources are released, and the single screen refresh mode is switched.
[0063] Figure 2 A flowchart of a performance optimization method based on a virtual graphics card in another exemplary embodiment of the present application is shown, including steps S201 to S203, which can be executed by a client system.
[0064] Step S201, after the host system allocates an independent display buffer to the display window of the client system, the number of sub-display windows inside the client system is obtained;
[0065] Step S202, determining whether the number of sub-display windows in the client system is greater than a preset threshold;
[0066] Step S203: when the number of the sub-display windows exceeds the preset threshold, the forced synthesis function is turned off, so that the different sub-display windows in the client system are independently synthesized and displayed.
[0067] Since each client system may also have the problem of multi-screen display, each screen corresponds to a sub-display window inside the client system. Since each sub-display window usually does not need to be refreshed at the same time, if the client system still uses the existing multiple sub-display windows to be synthesized and displayed at the same time, it will waste graphics card resources. Based on this, the present application can first obtain the number of sub-display windows inside the client system when the host system is in single-screen refresh mode and allocate an independent display buffer for the display window of each client system, and then determine whether the number of sub-display windows inside the client system is greater than a preset threshold, wherein the preset threshold is 1. When the number of sub-display windows exceeds the preset threshold, that is, when the number of sub-display windows is multiple, the forced synthesis function of the corresponding client system is turned off so that different sub-display windows inside the client system are independently synthesized and displayed independently, so that the screen refresh status of the client system can be obtained in the subsequent screen refresh process; according to the screen refresh status, it is determined whether each sub-display window is refreshed in a single cycle: if not, that is, only part of the sub-display windows are refreshed in a single cycle, then the client system can perform layer synthesis and screen display on the sub-display windows that need to be refreshed, so as to further reduce the occupancy rate of graphics card resources and improve the overall system performance and user experience.
[0068] Figure 3 A performance optimization system based on a virtual graphics card in an exemplary embodiment of the present application is shown, wherein the system includes a host system and a client system that are communicatively connected to each other in a Hypervisor environment, and the client system runs in a virtualized environment provided by the host.
[0069] The host system includes a scene information acquisition module 101, a scene mode determination module 102 and a cache setting module 103. The scene information acquisition module 101 is used to acquire scene information; the scene mode determination module 102 is used to set the current scene mode of the host system according to the scene information; the cache setting module 103 is used to allocate an independent display buffer to the display window corresponding to each client system when the current scene mode of the host system is a single-screen refresh mode, so that each client system independently synthesizes and displays.
[0070] The client system includes a window number acquisition module 201, a window number determination module 202 and a synthesis closing module 203. The window number acquisition module 201 is used to acquire the number of sub-display windows in the client system after the host system allocates an independent display buffer to the display window of the client system; the window number determination module 202 is used to determine whether the number of sub-display windows in the client system is greater than a preset threshold; the synthesis closing module 203 turns off the forced synthesis function when the number of sub-display windows exceeds the preset threshold, so that different sub-display windows in the client system are independently synthesized and independently displayed.
[0071] For the specific definition of the performance optimization system based on the virtual graphics card, please refer to the definition of the performance optimization method based on the virtual graphics card above, which will not be repeated here. Each module in the above-mentioned performance optimization system based on the virtual graphics card can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in hardware format, or can be stored in the memory in the computer device in software format, so that the processor can call the operations corresponding to the above modules.
[0072] It should be noted that, in order to highlight the innovative part of the present invention, the present embodiment does not introduce modules that are not closely related to solving the technical problem proposed by the present invention, but this does not mean that there are no other modules in the present embodiment.
[0073] In summary, in the present application, the host system obtains scene information; sets the current scene mode of the host system according to the scene information; when the current scene mode of the host system is a single-screen refresh mode, allocates an independent display buffer to the display window corresponding to each of the client systems, so that each of the client systems can be independently synthesized and displayed, thereby realizing independent refresh of the display window of the client system under the premise of retaining the screen splicing function of the host system, avoiding the existence of static screen synthesis and display in the entire display channel, thereby saving graphics card resources and improving the performance and user experience of the overall system. In addition, the client system can obtain the number of sub-display windows inside it after the host system allocates an independent display buffer to its corresponding display window, and when the number of sub-display windows exceeds a preset threshold, turn off the forced synthesis function, so that the different sub-display windows inside the client system are independently synthesized and independently displayed, thereby realizing independent refresh of any sub-window in each client system, avoiding the existence of static screen synthesis and display in the entire display channel, further saving graphics card resources, and improving the performance and user experience of the overall system. Therefore, the present invention effectively overcomes various shortcomings in the prior art and has a high industrial utilization value.
[0074] In the description herein, many specific details are provided, such as examples of parts and / or methods, to provide a complete understanding of the embodiments of the present application. However, those skilled in the art will recognize that the embodiments of the present application can be practiced without one or more specific details or by other devices, systems, components, methods, parts, materials, parts, etc. In other cases, known structures, materials or operations are not specifically shown or described in detail to avoid blurring the aspects of the embodiments of the present application.
[0075] The above description of the embodiment shown in the application (including the content described in the abstract of the specification) is not intended to be exhaustive or to limit the application to the precise form disclosed herein. Although the specific embodiment of the application and the example of the application are described herein for the purpose of illustration only, as those skilled in the art will recognize and understand, various equivalent modifications can be within the spirit and scope of the present invention. As pointed out, these modifications can be made to the application according to the above description of the embodiment described in the application, and these modifications will be within the spirit and scope of the application.
Claims
1. A performance optimization method based on a virtual graphics card, characterized in that: Applied to a host system in a Hypervisor environment, the method comprises: Get scene information; Setting the current scene mode of the host system according to the scene information; When the current scene mode of the host system is the single-screen refresh mode, an independent display buffer is allocated to the display window corresponding to each client system, so that each client system can synthesize and display independently.
2. The performance optimization method based on a virtual graphics card according to claim 1, characterized in that: The scene information includes a first type of scene or a second type of scene different from the first type of scene, wherein the first type of scene includes a boot animation scene or a car exhibition scene; Determining the current scene mode of the host system according to the scene information includes: Determine whether the scene information is the first type of scene: If yes, setting the current scene mode of the host system to the screen splicing mode; If not, the current scene mode of the host system is set to the single-screen refresh mode.
3. The performance optimization method based on a virtual graphics card according to claim 2, characterized in that: The method further comprises: When the current scene mode of the host system is the screen splicing mode, an overall canvas corresponding to all display windows is created, and the overall canvas is used to receive the spliced contents of all display windows; When a single display window is updated, the entire canvas is forced to be synthesized and displayed to achieve linkage of multiple display windows.
4. The performance optimization method based on a virtual graphics card according to claim 3, characterized in that: The method further comprises: When exiting the screen splicing mode, the entire canvas is destroyed, video memory resources are released, and the single screen refresh mode is switched.
5. The performance optimization method of a virtual graphics card according to claim 1, characterized in that: Before obtaining scene information, it also includes: Initialize the back-end simulation program and start each of the client systems; Create display windows corresponding to the host system and each of the client systems.
6. The performance optimization method of a virtual graphics card according to claim 5, characterized in that: The host system is an instrument system arranged on the vehicle chip, and the client system is a central control system arranged on the vehicle chip; the display window corresponding to the instrument system includes at least an HMI interface window, and the display window corresponding to the central control system includes at least a CSD interface window.
7. A performance optimization method based on a virtual graphics card, characterized in that: Applied to a client system in a Hypervisor environment, the method comprises: After the host system allocates an independent display buffer to the display window of the client system, the number of sub-display windows in the client system is obtained; Determining whether the number of sub-display windows in the client system is greater than a preset threshold; When the number of the sub-display windows exceeds the preset threshold, the forced synthesis function is turned off, so that the different sub-display windows in the client system are independently synthesized and displayed independently.
8. The performance optimization method based on a virtual graphics card according to claim 7, characterized in that: The method further comprises: Obtaining a screen refresh status of the client system; Determine whether to refresh each sub-display window in a single cycle according to the screen refresh state: If not, single-screen synthesis and single-screen display are performed only on the sub-display window that needs to be refreshed on the client system.
9. A performance optimization system based on a virtual graphics card, characterized in that: The system includes a host system and a client system that are connected to each other in a hypervisor environment, and the client system runs in a virtualized environment provided by the host; The host system comprises: A scene information acquisition module, used to acquire scene information; a scene mode determination module, configured to set a current scene mode of the host system according to the scene information; and The cache setting module is used to allocate an independent display buffer to the display window corresponding to each client system when the current scene mode of the host system is the single-screen refresh mode, so that each client system can synthesize and display independently.
10. The performance optimization system based on virtual graphics card according to claim 9, characterized in that: The client system comprises: A window quantity acquisition module, used for acquiring the number of sub-display windows in the client system after the host system allocates an independent display buffer to the display window of the client system; a window quantity determination module, configured to determine whether the number of sub-display windows within the client system is greater than a preset threshold; and The synthesis closing module closes the forced synthesis function when the number of the sub-display windows exceeds the preset threshold, so that the different sub-display windows in the client system are independently synthesized and displayed independently.