Video memory management and control method and system based on virtual video card

By adopting a virtual graphics card-based video memory management method in the Hypervisor virtualization environment, dynamically allocating video memory resources is solved, and the problem of unreasonable video memory management of the client system under Hypervisor virtualization technology is solved, and the rational allocation of video memory resources and system stability are achieved.

CN119415258APending Publication Date: 2025-02-11SMART MOTOR (ZHEJIANG) SOFTWARE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411530393.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-30
Publication Date
2025-02-11

AI Technical Summary

Technical Problem

Hypervisor virtualization technology causes the client system to access physical hardware links in multiple smart cockpit systems to become longer, resulting in unreasonable video memory management. The high load of the client system may lead to insufficient host memory, and the client system cannot effectively control the video memory application volume. .

Method used

Provide a video memory control method based on virtual graphics card. By receiving the client's video memory allocation request, dynamically allocate the first and second types of video memory according to the preset process priority and the video memory usage of the virtual graphics card, generate allocation results and Send to the client.

Benefits of technology

It effectively avoids excessive use of video memory resources, improves the problems of uneven allocation of video memory resources and poor rationality of client systems, and ensures system stability and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119415258A_ABST
    Figure CN119415258A_ABST
Patent Text Reader

Abstract

The invention relates to a video memory management and control method and system based on a virtual video card. The method is applied to a host machine in a Hypervisor environment, and comprises the following steps: receiving a video memory allocation request of each process sent by a client, and determining the previous video memory use total amount of each process; distributing a corresponding video memory for each process according to a preset process priority; for each process, according to the total usage amount of the first type of video memories used by the virtual graphics card, the total usage amount of the second type of video memories and the video memory allocation request of the process, allocating the corresponding usage amount of the first type of video memories or the usage amount of the second type of video memories to the process, and generating a corresponding allocation result; for each process, determining the current total video memory usage amount of the process according to the distribution result and the previous total video memory usage amount of the process; and for each process, sending the allocation result and the current total use amount of the video memory to the corresponding client. According to the method, the system stability of the Hypervisor virtualization scheme is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of intelligent cockpits, and in particular to a video memory management and control method and system based on a virtual graphics card. Background Art

[0002] Hypervisor-based virtualization technology has been widely used in multiple systems of smart cockpits. This technology makes resource scheduling between client systems fairer and system operation safer through methods such as multi-level scheduling and kernel isolation. The current mainstream Hypervisor technology is mainly divided into two categories, namely Type I and Type II. The former completes the fair scheduling of tasks between virtual machine systems through a two-level scheduling model of physical CPU scheduling virtual CPU and virtual CPU scheduling tasks, including open source solutions such as XEN and ACRN; the latter retains the first-level scheduling model and changes the underlying logic originally executed by the Hypervisor into a single kernel module of the host system, including solutions such as KVM. However, the front-end and back-end models of this Hypervisor virtualization technology will cause the client system to access the physical hardware link to become longer. This cross-system video memory management has the following disadvantages: on the one hand, the high load of the client system may cause the host machine to have insufficient memory and enter a low memory trap; on the other hand, the client system cannot effectively control the amount of video memory application. Therefore, it is necessary to provide a video memory control method and system based on a virtual graphics card. Summary of the invention

[0003] In view of the shortcomings of the prior art described above, the purpose of the present invention is to provide a video memory management method, system, device and medium based on a virtual graphics card, which improves the problem of poor rationality of video memory management and allocation of client systems in a Hypervisor virtualization environment in the prior art.

[0004] To achieve the above-mentioned purpose and other related purposes, the present invention provides a video memory management and control method based on a virtual graphics card, which is applied to a host machine in a Hypervisor environment, including: receiving video memory allocation requests of various processes sent by a client, and determining the total video memory usage of each process the previous time; allocating corresponding video memory to each process according to a preset process priority; for each process, according to the total usage of the first category of video memory used by the virtual graphics card, the total usage of the second category of video memory and the video memory allocation request of the process, allocating the corresponding first category of video memory usage or the second category of video memory usage to the process, and generating a corresponding allocation result; for each process, according to the allocation result and the total video memory usage of the process the previous time, determining the current total video memory usage of the process; for each process, sending the allocation result and the current total video memory usage to the corresponding client.

[0005] In one embodiment of the present invention, allocating the corresponding usage of the first category of video memory or the second category of video memory to the process based on the total usage of the first category of video memory of the virtual graphics card, the total usage of the second category of video memory and the video memory allocation request of the process to generate a corresponding allocation result includes: judging the availability of the first category of video memory based on the total usage of the first category of video memory and the video memory allocation request of the process: if available, allocating the usage of the first category of video memory corresponding to the process to generate an allocation result; if unavailable, determining the allocation result based on the total usage of the second category of video memory and the video memory allocation request of the process.

[0006] In one embodiment of the present invention, determining the availability of the first category of video memory based on the total usage of the first category of video memory and the video memory allocation request of the process includes: determining whether the sum of the total usage of the first category of video memory and the usage of the video memory required in the video memory allocation request is greater than a preset first category threshold: if so, the first category of video memory is unavailable; otherwise, the first category of video memory is available.

[0007] In one embodiment of the present invention, the allocation result is determined based on the total usage of the second category of video memory and the video memory allocation request of the process, including: judging whether the sum of the total usage of the second category of video memory and the usage of the required video memory in the video memory allocation request of the process is greater than a preset second category threshold: if so, rejecting the video memory allocation request of the process, and generating a rejection signal as the allocation result; otherwise, allocating the corresponding usage of the second category of video memory to the process based on the usage of the required video memory in the video memory allocation request of the process, and generating an allocation result.

[0008] In an embodiment of the present invention, the first type of video memory is a VRAM type of video memory, and the second type of video memory is a GTT type of video memory.

[0009] In one embodiment of the present invention, a video memory management and control method based on a virtual graphics card is also provided, which is applied to a client in a Hypervisor environment, including: sending a video memory allocation request of each process to a host machine; receiving the current total video memory usage and corresponding allocation results of the corresponding process fed back by the host machine based on each video memory allocation request, and updating the previous total video memory usage according to the current total video memory usage of each process; and allocating video memory to the corresponding process according to the allocation result of each process.

[0010] In one embodiment of the present invention, after allocating the video memory to the corresponding process according to the allocation result of each process, it also includes: based on the total amount of video memory used by each process, monitoring the video memory usage in each process, and sending a release signal to the host machine after the use is completed.

[0011] In one embodiment of the present invention, the video memory usage in each process is monitored based on the total video memory usage of each process, and a release signal is sent to the host machine after the usage is completed, including: for each process: determining whether the total video memory usage of the process is greater than a preset usage threshold: if so, performing over-limit processing on the process based on a preset over-limit strategy; otherwise, monitoring the video memory usage in the process, and sending a release signal to the host machine after the usage is completed.

[0012] In one embodiment of the present invention, the over-limit processing of the process based on the preset over-limit strategy includes: closing and restarting the process, or sending a stop application instruction to the process to make the process stop sending video memory allocation requests.

[0013] In one embodiment of the present invention, a video memory management and control system based on a virtual graphics card is also provided, the system comprising a host machine and a client machine that are connected to each other in a hypervisor environment, the client machine running in a virtualized environment provided by the host machine: the host machine comprises: a first communication module, for receiving video memory allocation requests of each process sent by the client machine, and sending the allocation result and the current total amount of video memory usage to the corresponding client machine; a video memory allocation module, for allocating corresponding video memory to each process according to a preset process priority; an allocation result generation module, for generating a video memory allocation result for each process according to the total amount of first-class video memory used by the virtual graphics card, the total amount of second-class video memory used and the video memory allocation request of the process , allocating the corresponding first-category video memory usage or second-category video memory usage to the process, and generating a corresponding allocation result; a total usage determination module, used to determine the current total video memory usage of the process for each process according to the allocation result and the previous total video memory usage of the process; the client includes: a second communication module, used to send the video memory allocation request of each process to the host machine, and receive the current total video memory usage and corresponding allocation result of the corresponding process fed back by the host machine based on each video memory allocation request; an update module, used to update the previous total video memory usage according to the current total video memory usage of each process; an allocation module, used to allocate video memory to the corresponding process according to the allocation result of each process.

[0014] As described above, a video memory management and control method and system based on a virtual graphics card of the present invention has the following beneficial effects: the client sends the video memory allocation request of each process to the host machine, and the host machine dynamically allocates the corresponding type of video memory and the required amount of video memory to each process based on the total usage of the first and second types of video memory already used by the virtual graphics card and the video memory requirements of each process. This avoids excessive occupation of video memory resources. After the allocation is completed, the host machine sends the allocation results of each process and the current total amount of video memory used by the process to the client, so that the client updates the video memory usage record of each process accordingly and allocates video memory resources to the corresponding process. This allows the client to monitor the video memory usage of each process in real time and prevent a process from excessively occupying video memory resources. The problem of uneven allocation and poor rationality of video memory resources of the client in the prior art is improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 A schematic diagram of a process flow of a method for controlling video memory of a host machine based on a virtual graphics card provided by an embodiment of the present invention;

[0016] Figure 2 A flow chart of a method for controlling video memory of a client based on a virtual graphics card provided by an embodiment of the present invention

[0017] Figure 3 Shown is a structural block diagram of a video memory management and control system based on a virtual graphics card provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0018] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details of each item 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 invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.

[0019] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present invention, and thus the drawings only show components related to the present invention 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.

[0020] In the following description, numerous details are discussed to provide a more thorough explanation of the embodiments of the present invention. However, it is obvious to those skilled in the art that the embodiments of the present invention can be implemented without these specific details. In other embodiments, well-known structures and devices are shown in the form of block diagrams rather than in detail to avoid making the embodiments of the present invention difficult to understand.

[0021] The inventors found that the current mainstream Hypervisor technologies are mainly Type I and Type II. The common point of these two mainstream technologies is that different virtual machine systems can access physical external devices through device virtualization solutions such as virtio, vhost and vhost-user. The common point of this type of technology is that the host system simulates the back-end device, the application or system service of the client system is driven by the front end, the client system kernel converts the native device access logic into an instruction set for front-end and back-end interaction, and 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. For example, in the virtual graphics card solution, the rendering process of the client system applies for or releases video memory through the VIRTIO GPU instruction. After the host system parses the instruction, it allocates GTT (Graphics Translation Table) type video memory from the VRAM (Video Random Access Memory) memory domain or system memory according to the content of the rendering process instruction. However, since the Hypervisor virtualization technology adopts the front-end and back-end model, this will inevitably lead to a longer path for the client application or system service to access the physical hardware, and the process and video memory management used by the video memory are located in the client system and the host system respectively. This cross-system video memory management solution has two main problems: on the one hand, the high business load of the client system may cause insufficient memory in the host system; on the other hand, the client system cannot control the amount of video memory requested by the rendering process.

[0022] The present invention provides a video memory control method based on a virtual graphics card. The host system counts the video memory data of each process of the current system according to the video memory management module of the physical graphics card, and distinguishes between VRAM type and GTT type. Because the source of GTT type video memory allocation is system memory, the host system ensures that the current system is away from the low memory operation trap by checking and controlling the water level of GTT type video memory. At the same time, the host system provides VIRTIO GPU instructions to the client system, which is used for the latter to obtain the total video memory of each process of the current system in real time, because the client system does not need to distinguish between VRAM type and GTT type video memory. The client system formulates a video memory control (such as killing process) strategy based on the total video memory of each process to avoid excessive consumption of system video memory by some applications. The video memory types counted by the host system and the client system are different, and the control strategies formulated are different. The present invention can simultaneously meet the above-mentioned two systems to control the host system memory and client video memory usage requirements, and proposes a cross-system video memory allocation method based on Hypervisor virtualization solution. Based on the VRAM type and GTT type video memory data of each process counted by the host system, the host system memory control policy and the host system video memory control policy are generated to improve the cross-system video memory management solution and enhance the system stability of the Hypervisor virtualization solution.

[0023] See also Figure 1 , the video memory control method based on the virtual graphics card is applied to the host machine in the Hypervisor environment, including the following steps:

[0024] S101, receiving a video memory allocation request of each process sent by a client, and determining the total amount of video memory used by each process last time;

[0025] The present invention is applicable to all automotive multi-system solutions implemented based on Hypervisor technology. At present, this scenario is relatively common in the field of vehicle system integration. 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 front-end and back-end tracking method based on the virtual graphics card is described. The host refers to the physical computer running the virtual machine, and the client refers to the virtual machine running in the virtualized environment provided by the host. After the automobile system is powered on, the SOC (System on Chip) boot program reads the Grub configuration table, 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 act as a VMM (Virtual Machine Manager), and the other is to output the instrument interface content. As a VMM, 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 simulated device. The host machine and the client machine communicate through the VIRTIO channel, and the host machine receives the video memory allocation request of each process sent by the client machine through the VIRTIO channel, wherein the video memory allocation request includes the process identifier, the requested video memory size and priority information.

[0026] It should be noted that the VIRTIO GPU backend driver of the host machine will continue to monitor the VIRTIO channel so that video memory allocation can be performed in a timely manner later. After the host machine receives the video memory allocation request sent by the client, it determines the total amount of video memory used by each process in the previous time by searching the video memory usage table according to the video memory allocation request. Among them, the video memory usage table records the identifier of each process and the corresponding total amount of video memory used in the previous time. It is understandable that if the process releases part of the video memory before this, the host machine will update the video memory usage table in time to ensure the accuracy of the data. Furthermore, in one embodiment of the present invention, the first type of video memory is VRAM type video memory, and the second type of video memory is GTT type video memory. VRAM type video memory is located in the VRAM memory domain reserved for startup, and GTT type video memory is located in the system memory domain.

[0027] S102, allocating corresponding video memory to each process according to a preset process priority;

[0028] After receiving the video memory allocation requests of each process sent by the client through the VIRTIO channel, the host sorts all the received video memory allocation requests according to the process priority of each process in the video memory allocation request. Each process is processed in descending order of priority and the corresponding video memory is allocated to it.

[0029] S103. For each process, according to the total usage of the first type of video memory, the total usage of the second type of video memory used by the virtual graphics card, and the video memory allocation request of the process, allocate the corresponding usage of the first type of video memory or the second type of video memory to the process, and generate a corresponding allocation result.

[0030] Since the usage of video memory is limited, for each process, the host determines which type of video memory to allocate to the process and the corresponding video memory usage based on the total usage of the first type of video memory currently used by the virtual graphics card, the total usage of the second type of video memory, and the video memory allocation request of the process, thereby generating an allocation result. The allocation result includes the type of video memory allocated by the host to the process (such as the first type or the second type of video memory), the size of the allocated video memory, etc. The virtual graphics card refers to a virtual device provided by the host in a virtualized environment, which allows the client to perform image rendering and display operations like using a physical graphics card.

[0031] Specifically, in one embodiment of the present invention, allocating the corresponding usage of the first type of video memory or the second type of video memory to the process according to the total usage of the first type of video memory, the total usage of the second type of video memory of the virtual graphics card, and the video memory allocation request of the process, and generating the corresponding allocation result includes:

[0032] According to the total usage of the first type of video memory and the video memory allocation request of the process, the availability of the first type of video memory is determined:

[0033] If available, allocate the usage of the first type of video memory corresponding to the process and generate an allocation result;

[0034] If it is not available, the allocation result is determined based on the total usage of the second-category video memory and the video memory allocation request of the process.

[0035] For each process, the host system allocates the first type of video memory (such as VRAM type video memory) by default. If the first type of video memory cannot be allocated, the second type of video memory (such as GTT type video memory) is downgraded. This is because the GTT type of video memory comes from the host system memory, and excessive allocation may cause insufficient host system memory. Therefore, the host will determine whether the first type of video memory is available based on the total usage of the first type of video memory currently used by the virtual graphics card and the video memory allocation request of the process. If the remaining capacity of the first type of video memory meets the video memory requirements of the process, the host will allocate the required usage from the first type of video memory to the process and generate an allocation result. Conversely, if the remaining capacity of the first type of video memory does not meet the video memory allocation requirements of the process, the host will determine the availability of the second type of video memory based on the total usage of the second type of video memory currently used and the video memory allocation request of the process, thereby determining the allocation result.

[0036] In an embodiment of the present invention, judging the availability of the first type of video memory according to the total usage of the first type of video memory and the video memory allocation request of the process includes:

[0037] Determine whether the sum of the total usage of the first-category video memory and the usage of the video memory required in the video memory allocation request is greater than a preset first-category threshold:

[0038] If so, the first type of video memory is unavailable;

[0039] Otherwise, the first type of video memory is available.

[0040] The host machine sums the total usage of the first-class video memory currently used by the virtual graphics card and the usage of the video memory required by the process to obtain the total usage of the first-class video memory after the application. It is determined whether the total usage of the first-class video memory after the application is greater than the preset first-class threshold: if so, it means that after allocating the first-class video memory to the process, it will exceed the capacity limit of the first-class video memory, so the first-class video memory is not available, and the allocation result of the process needs to be determined according to the availability of the second-class video memory. On the contrary, if the total usage of the first-class video memory after the application is less than or equal to the first-class threshold, it means that the remaining available capacity of the first-class video memory meets the request of the process, so the first-class video memory is available, and the host machine will allocate the corresponding amount of first-class video memory resources to the process according to the resource usage required by the process, and generate an allocation result. By calculating and judging the total usage of the video memory after the application, the host system can effectively prevent the over-allocation of video memory resources, ensure the rational use of video memory, and improve the flexibility and stability of the host in video memory management.

[0041] In one embodiment of the present invention, determining the allocation result based on the total usage of the second-category video memory and the video memory allocation request of the process includes:

[0042] Determine whether the total usage of the second-category video memory and the usage of the video memory required in the video memory allocation request of the process is greater than a preset second-category threshold:

[0043] If so, the video memory allocation request of the process is rejected, and a rejection signal is generated as the allocation result;

[0044] Otherwise, based on the usage of the video memory required in the video memory allocation request of the process, the corresponding usage of the second type of video memory is allocated to the process, and an allocation result is generated.

[0045] For each process, the host machine sums the total usage of the second-class video memory currently used by the virtual graphics card and the usage of video memory in the video memory allocation request of the process to obtain the total usage of the second-class video memory after the application. Determine whether the total usage of the second-class video memory after the application is greater than the second-class threshold (such as 4GB): If so, it means that after allocating the second-class video memory to the process, the capacity limit of the second-class video memory will be exceeded. At this time, the host machine will reject the video memory allocation request of the process and generate a rejection signal as the allocation result. On the contrary, if the total usage of the second-class video memory after the application is less than or equal to the second-class threshold, it means that the current remaining capacity of the second-class video memory can meet the requirements of the process. Therefore, according to the usage of the video memory required by the process, a certain amount of second-class video memory resources are allocated to it from the second-class video memory to generate an allocation result. Furthermore, in order to ensure smooth allocation of video memory, in one embodiment of the present invention, after generating a rejection application signal as an allocation result, it also includes: the host machine restricts the allocation behavior of the second type of video memory according to a preset memory management strategy, or restarts the corresponding client to completely release the second type of video memory occupied by the client application.

[0046] S104: for each process, determine the current total usage of video memory of the process according to the allocation result and the previous total usage of video memory of the process.

[0047] For each process, the host machine sums the allocation result of the process and the total amount of video memory used by the process in the previous time obtained through the video memory usage table to obtain the current total amount of video memory used by the process. It can be understood that regardless of whether the video memory of the process is successfully allocated, an allocation result will be generated. Among them, when the allocation is successful, the allocation result includes the newly allocated video memory usage for the process, so in this case, the total amount of video memory used by the process is the sum of its previous total amount of video memory used and the newly allocated video memory usage. On the contrary, if the allocation fails, the current total amount of video memory used by the process is the sum of its previous total amount of video memory used and the current actual allocation usage. Among them, the total amount of video memory used by the process includes the common usage of the first type of video memory and the second type of video memory. In this way, the host machine can monitor the usage of each process in real time and send the usage to the corresponding client, so that the client can effectively manage its own video memory resources to ensure the stability and efficiency of system operation.

[0048] S105 . For each process, send the allocation result and the current total amount of video memory usage to the corresponding client.

[0049] For each process, the host updates the corresponding total amount of video memory usage according to the allocation result of the process, packages the allocation result and total amount of video memory usage of the process, and sends them to the corresponding client through the VIRTIO channel. After receiving this information, the client can adjust the video memory management strategy in real time according to the feedback allocation result and total amount of video memory usage, so as to ensure that each process can use the allocated video memory resources normally.

[0050] like Figure 2 As shown, the present invention also provides a video memory management method based on a virtual graphics card, which is applied to a client in a Hypervisor environment, and the method includes the following steps:

[0051] S201, sending a video memory allocation request of each process to a host machine.

[0052] In the Hypervisor solution, the client system's application encapsulates the SUBMIT 3D instruction type through the VIRTIO GPU instruction, triggering the host system's backend program to execute the video memory request. Specifically, during the client startup, the client's system services and various applications will apply for video memory from the client's backend, and the requested video memory is mainly used to store texture rendering results in the application hardware acceleration scenario. When a process in the client needs video memory resources, the virtual graphics driver will encapsulate the video memory allocation request into a standardized instruction (such as the SUBMIT 3D instruction) and send it to the client, where the video memory allocation request contains information such as the process's identifier and the required video memory usage. The client sends the received video memory allocation requests of each process to the host through the VIRTIO channel. After receiving these requests, the host allocates corresponding video memory resources to each process according to the request content, and feeds back the processed information to the client.

[0053] S202, receiving the current total video memory usage and corresponding allocation results of the corresponding process fed back by the host machine based on each video memory allocation request, and updating the previous total video memory usage according to the current total video memory usage of each process.

[0054] After receiving the current total video memory usage and allocation results of each process from the host, the client updates the previous total video memory usage of each process according to the current total video memory usage of each process. By synchronizing the latest total video memory usage of each process fed back by the host to the local record, the real-time statistical data is ensured, which is convenient for subsequent effective monitoring of the video memory resources of each process.

[0055] S203. Allocate video memory to corresponding processes according to the allocation results of each process.

[0056] The client parses the allocation results of each process fed back by the host machine, obtains the type and amount of video memory allocated to each process, and allocates the required video memory to the corresponding process.

[0057] In one embodiment of the present invention, after allocating video memory to the corresponding process according to the allocation result of each process, it also includes: based on the total amount of video memory used by each process, monitoring the video memory usage in each process, and sending a release signal to the host machine after the use is completed. After the client allocates video memory resources to the corresponding process according to the allocation result, it also monitors the video memory usage of each process in real time based on the total amount of video memory used by each process. When the client monitors that a process has completed the use of video memory resources, it will send a release signal to the host machine so that the host machine can release the occupied video memory resources in time and wait for other subsequent allocation needs.

[0058] In one embodiment of the present invention, the video memory usage in each process is monitored based on the total video memory usage of each process, and a release signal is sent to the host machine after the usage is completed, including:

[0059] For each process:

[0060] Determine whether the total amount of video memory used by the process is greater than the preset usage threshold:

[0061] If so, the process is handled as over-limit based on the preset over-limit strategy;

[0062] Otherwise, the usage of the video memory in the process is monitored, and after the usage is completed, a release signal is sent to the host machine.

[0063] For each process, the client determines whether the current total amount of video memory used by the process is greater than the usage threshold (such as 900MB): If so, the process will be processed for over-limit according to the preset over-limit policy to prevent a single process from excessively occupying video memory resources and affecting subsequent resource allocation. Conversely, if the total amount of video memory used by the process does not exceed the usage threshold, the client will continue to monitor the video memory usage of the process until the process is used up. When the client monitors that the video memory of a process has been used up, it will send a release signal to the host machine, thereby notifying the host machine to reclaim the corresponding video memory resources. After receiving the release signal, the host machine releases the occupied video memory and updates the total video memory usage of the process in the video memory usage table, waiting for subsequent allocation to other processes.

[0064] In one embodiment of the present invention, the over-limit processing of the process based on the preset over-limit strategy includes: closing and restarting the process, or sending a stop application instruction to the process to make the process stop sending video memory allocation requests. When the client monitors that the total video memory usage of a process is greater than the usage threshold, the process will be closed and restarted to release the video memory resources occupied by it, so that the process can be re-run in a controlled environment. Alternatively, the client sends a stop application instruction to the process to stop the process from sending new video memory allocation requests to avoid occupying more video memory resources. It can be understood that the host machine and the client in the present invention can be a one-to-one setting, or one host machine can correspond to multiple clients, which is not limited here.

[0065] See also Figure 3 The video memory management and control system 300 based on a virtual graphics card includes a host machine and a client machine that are used in a hypervisor environment and are connected to each other for communication. The client machine runs in a virtualized environment provided by the host machine. The host machine includes a first communication module 301, a video memory allocation module 302, an allocation result generation module 303, and a total usage determination module 304. The first communication module 301 is used to receive the video memory allocation request of each process sent by the client machine, and send the allocation result and the current total video memory usage to the corresponding client machine. The video memory allocation module 302 is used to allocate corresponding video memory to each process according to the preset process priority. The allocation result generation module 303 is used to allocate the corresponding first-class video memory usage or the second-class video memory usage to each process according to the total usage of the first-class video memory used by the virtual graphics card, the total usage of the second-class video memory, and the video memory allocation request of the process, and generate the corresponding allocation result. The total usage determination module 304 is used to determine the current total video memory usage of the process according to the allocation result and the previous total video memory usage of the process. The client includes a second communication module 305, an update module 306 and an allocation module 307. The second communication module 305 is used to send the video memory allocation request of each process to the host machine, and receive the current total video memory usage and corresponding allocation result of the corresponding process fed back by the host machine based on each video memory allocation request. The update module 306 is used to update the previous total video memory usage according to the current total video memory usage of each process. The allocation module 307 is used to allocate video memory to the corresponding process according to the allocation result of each process.

[0066] For the specific limitations of the video memory control system based on the virtual graphics card, please refer to the limitations of the video memory control method based on the virtual graphics card above, which will not be repeated here. Each module in the above-mentioned video memory control system based on the virtual graphics card can be implemented in whole or in part through 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 of the computer device in software format, so that the processor can call the operations corresponding to the above modules.

[0067] 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.

[0068] In summary, the present invention discloses a method and system for video memory management based on a virtual graphics card. The client sends the video memory allocation request of each process to the host machine, and the host machine dynamically allocates the corresponding type of video memory and the required amount of video memory for each process based on the total usage of the first and second types of video memory already used by the virtual graphics card and the video memory requirements of each process. This avoids excessive occupation of video memory resources. After the allocation is completed, the host machine sends the allocation results of each process and the current total amount of video memory used by the process to the client machine, so that the client machine updates the video memory usage record of each process accordingly and allocates video memory resources to the corresponding process. This allows the client machine to monitor the video memory usage of each process in real time and prevent a process from excessively occupying video memory resources. The problem of uneven allocation and poor rationality of video memory resources of the client machine in the prior art is improved. Therefore, the present invention effectively overcomes the various shortcomings in the prior art and has a high industrial utilization value.

[0069] The above embodiments are merely illustrative of the principles and effects of the present invention, and are not intended to limit the present invention. Anyone familiar with the art may modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by a person of ordinary skill in the art without departing from the spirit and technical concept disclosed by the present invention shall still be covered by the claims of the present invention.

Claims

1. A video memory management and control method based on a virtual graphics card, characterized in that: Applied to a host machine in a Hypervisor environment, the method comprises: Receive video memory allocation requests of each process sent by the client, and determine the total amount of video memory used by each process last time; Allocate corresponding video memory to each process according to the preset process priority: For each process, according to the total usage of the first type of video memory used by the virtual graphics card, the total usage of the second type of video memory and the video memory allocation request of the process, allocate the corresponding usage of the first type of video memory or the usage of the second type of video memory to the process, and generate a corresponding allocation result; For each process, determine the current total amount of video memory used by the process according to the allocation result and the previous total amount of video memory used by the process; For each process, the allocation result and the current total amount of video memory usage are sent to the corresponding client.

2. The video memory management and control method based on a virtual graphics card according to claim 1, characterized in that: The method allocates the corresponding usage of the first type of video memory or the second type of video memory to the process according to the total usage of the first type of video memory, the total usage of the second type of video memory of the virtual graphics card and the video memory allocation request of the process, and generates a corresponding allocation result, including: According to the total usage of the first type of video memory and the video memory allocation request of the process, the availability of the first type of video memory is determined: If available, allocate the usage of the first type of video memory corresponding to the process and generate an allocation result; If it is not available, the allocation result is determined based on the total usage of the second-category video memory and the video memory allocation request of the process.

3. The video memory management and control method based on a virtual graphics card according to claim 2, characterized in that: The determining, according to the total usage of the first-category video memory and the video memory allocation request of the process, the availability of the first-category video memory comprises: Determine whether the sum of the total usage of the first-category video memory and the usage of the video memory required in the video memory allocation request is greater than a preset first-category threshold: If so, the first type of video memory is unavailable; Otherwise, the first type of video memory is available.

4. The video memory management and control method based on a virtual graphics card according to claim 2, characterized in that: The determining the allocation result based on the total usage of the second-type video memory and the video memory allocation request of the process includes: Determine whether the total usage of the second-category video memory and the usage of the video memory required in the video memory allocation request of the process is greater than a preset second-category threshold: If so, the video memory allocation request of the process is rejected, and a rejection signal is generated as the allocation result; Otherwise, based on the usage of the video memory required in the video memory allocation request of the process, the corresponding usage of the second type of video memory is allocated to the process, and an allocation result is generated.

5. The video memory management and control method based on a virtual graphics card according to claim 1, characterized in that: The first type of video memory is a VRAM type of video memory, and the second type of video memory is a GTT type of video memory.

6. A method for controlling video memory based on a virtual graphics card, characterized in that: Applied to a client in a Hypervisor environment, the method comprises: Send the video memory allocation request of each process to the host machine; Receive the current total amount of video memory usage and the corresponding allocation result of the corresponding process fed back by the host machine based on each video memory allocation request, and update the previous total amount of video memory usage according to the current total amount of video memory usage of each process; Based on the allocation results of each process, the video memory is allocated to the corresponding process.

7. The method for controlling video memory based on a virtual graphics card according to claim 6, characterized in that: After allocating the video memory to the corresponding process according to the allocation result of each process, the method further includes: monitoring the video memory usage in each process based on the total video memory usage of each process, and sending a release signal to the host machine after the usage is completed.

8. The method for controlling video memory based on a virtual graphics card according to claim 7, characterized in that: The method of monitoring the usage of video memory in each process based on the total amount of video memory used by each process, and sending a release signal to the host machine after the usage is completed, includes: For each process: Determine whether the total amount of video memory used by the process is greater than the preset usage threshold: If so, the process is handled as over-limit based on the preset over-limit strategy; Otherwise, the usage of the video memory in the process is monitored, and after the usage is completed, a release signal is sent to the host machine.

9. The method for controlling video memory based on a virtual graphics card according to claim 8, characterized in that: The over-limit processing for the process based on the preset over-limit strategy includes: closing and restarting the process, or sending a stop application instruction to the process to make the process stop sending video memory allocation requests.

10. A video memory management and control system based on a virtual graphics card, characterized in that: The system includes a host machine and a client machine that are connected to each other in a hypervisor environment, and the client machine runs in a virtualized environment provided by the host machine: The host machine comprises: The first communication module is used to receive the video memory allocation request of each process sent by the client, and send the allocation result and the current total amount of video memory usage to the corresponding client; A video memory allocation module is used to allocate corresponding video memory to each process according to a preset process priority; an allocation result generating module, for allocating corresponding usage of the first type of video memory or the second type of video memory to each process according to the total usage of the first type of video memory used by the virtual graphics card, the total usage of the second type of video memory and the video memory allocation request of the process, and generating a corresponding allocation result; A usage total amount determination module is used to determine the current total amount of video memory usage of each process according to the allocation result and the previous total amount of video memory usage of the process; The client comprises: A second communication module is used to send the video memory allocation request of each process to the host machine, and receive the current total video memory usage and corresponding allocation result of the corresponding process fed back by the host machine based on each video memory allocation request; An update module is used to update the previous total amount of video memory usage according to the current total amount of video memory usage of each process; The allocation module is used to allocate video memory to corresponding processes according to the allocation results of each process.