Analog method, device, equipment and storage medium of vertical synchronization signal

By centrally managing the virtual machine's vertical synchronization signal and injecting virtual interrupt signals, the problem of lower-than-expected rendering frame rates in graphics applications in virtual displays was solved, achieving more efficient vertical synchronization processing and better display effects.

CN122308771APending Publication Date: 2026-06-30MOORE THREADS TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
MOORE THREADS TECH CO LTD
Filing Date
2026-04-27
Publication Date
2026-06-30

AI Technical Summary

Technical Problem

When using a timer to simulate a vertical synchronization signal in the virtual machine's operating system kernel, the rendering frame rate of the virtual display's graphics applications falls short of expectations, affecting the running performance.

Method used

The host machine manages the vertical synchronization signals in the virtual machine in a unified manner, and generates and injects virtual interrupt signals to ensure that the vertical synchronization operation of the virtual display can be processed in a timely manner.

Benefits of technology

It improves the accuracy of vertical synchronization processing for virtual displays, reduces screen tearing, and enhances the rendering frame rate and performance of graphics applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122308771A_ABST
    Figure CN122308771A_ABST
Patent Text Reader

Abstract

This disclosure provides a method, apparatus, device, and storage medium for simulating vertical synchronization signals, relating to the field of computer technology. In this embodiment, the host machine centrally manages the generation of vertical synchronization signals for virtual displays running and with vertical synchronization enabled in each virtual machine. The virtual interrupt signals corresponding to the generated vertical synchronization signals are injected into the virtual machines, enabling the virtual machines to perform vertical synchronization operations on the virtual displays. For the virtual machines, the virtual interrupt signals corresponding to the vertical synchronization signals from the host machine can enter the interrupt handling path of the virtual machine operating system through an interrupt injection mechanism and be responded to in the virtual machine operating system as device interrupts. The virtual interrupt signals have higher processing priority and lower response latency, enabling the vertical synchronization signals of the virtual displays to be processed in a timely manner, improving the accuracy of vertical synchronization processing, and ensuring that the rendering frame rate of graphics applications in the virtual displays reaches the expected level.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and in particular to a method, apparatus, device, and storage medium for simulating a vertical synchronization signal. Background Technology

[0002] Vertical synchronization (VSync) is a graphics rendering technique used to synchronize the frame output rate of the graphics processing unit (GPU) with the refresh rate of the display to prevent screen tearing.

[0003] In a Virtual Desktop Infrastructure (VDI) environment, a host machine needs to serve multiple virtual machines (guests) simultaneously. Each virtual machine runs at least one virtual display (vDisplay). When the physical GPU in the host machine does not have the ability to provide vertical synchronization signals to multiple virtual displays simultaneously, it is necessary to simulate the vertical synchronization signals corresponding to each virtual display through software methods. This is to ensure that the frame output rate of each virtual display is synchronized with the refresh rate of that virtual display, thus preventing screen tearing.

[0004] In related technologies, the virtual GPU (vGPU) kernel driver in the virtual machine's operating system directly uses a kernel-provided timer to periodically simulate and generate vertical synchronization signals for each virtual display in the virtual machine. However, the vertical synchronization signals generated by the timer in the virtual machine's operating system kernel run in a software interrupt context, causing the rendering frame rate of graphics applications that rely on vertical synchronization signals in the virtual displays to be lower than expected, thus affecting the performance of graphics applications. Summary of the Invention

[0005] To address the problems existing in the aforementioned related technologies, this disclosure provides a method, apparatus, device, and storage medium for simulating vertical synchronization signals.

[0006] The first aspect of this disclosure provides a method for simulating a vertical synchronization signal, applied to a host machine, wherein at least one virtual machine is running on the host machine, and the virtual machine includes at least one virtual display that is running and has vertical synchronization enabled. The method includes: Obtain the vertical synchronization time and refresh rate of each virtual display; In response to the arrival of at least one vertical synchronization moment at the current time, the arrived vertical synchronization moment is determined as the target moment; Determine the target virtual display corresponding to the target time, and generate the target vertical synchronization signal of the target virtual display; Inject a virtual interrupt signal corresponding to the target vertical synchronization signal into the target virtual machine to which the target virtual display belongs, so that the target virtual machine performs vertical synchronization operation on the target virtual display based on the virtual interrupt signal.

[0007] Optionally, the above methods also include: When generating the target vertical synchronization signal for the target virtual display, the vertical synchronization time of the target virtual display is updated based on the target time and the refresh rate of the target virtual display.

[0008] Optionally, updating the vertical synchronization time of the target virtual display based on the target time and the refresh rate of the target virtual display includes: Calculate the next vertical synchronization time of the target virtual display based on the target time and the refresh rate of the target virtual display; Update the vertical synchronization time of the target virtual display to the next vertical synchronization time.

[0009] Optionally, the target virtual display corresponding to the target time mentioned above includes: The vertical synchronization times of each virtual display are sorted in chronological order to construct the target time sequence; Starting from the first vertical synchronization moment in the target time sequence, calculate the time difference between the vertical synchronization moment in the target time sequence and the target moment in turn; If the time difference is less than or equal to the preset time error, the vertical synchronization time corresponding to the time difference is determined as the target vertical synchronization time. If the time difference is greater than the preset time error, stop calculating the time difference between the vertical synchronization moment and the target moment in the target time sequence. The virtual display corresponding to the target vertical synchronization moment is determined as the target virtual display.

[0010] Optionally, the data structure of the target time sequence mentioned above is a self-balancing binary search tree structure; The vertical synchronization times of each virtual display are sorted chronologically to construct the target time sequence, including: In chronological order, the vertical synchronization times of each virtual display are added to the self-balancing binary search tree structure to obtain the target time sequence.

[0011] Optionally, the above methods also include: When generating the target vertical synchronization signal for the target virtual display, the vertical synchronization time of the target virtual display in the target time sequence is updated to the next vertical synchronization time of the target virtual display, and the vertical synchronization times of each virtual display are reordered according to the chronological order to update the target time sequence.

[0012] Optionally, the above response, upon reaching at least one vertical synchronization moment at the current time, determines the reached vertical synchronization moment as the target moment, including: Set the vertical synchronization time of each virtual display to the expiration time of the target timer, which is a timer in the host machine; In response to the target timer detecting that the current time has reached at least one expiration time, the reached expiration time is determined as the target time.

[0013] Optionally, obtaining the vertical synchronization time and refresh rate of each virtual display includes: Receive virtual display information sent by each virtual machine; In the virtual display information, obtain the target display identifier that is in running state and the vertical synchronization function is enabled, determine the virtual display corresponding to the target display identifier as the virtual display that is in running state and the vertical synchronization function is enabled, and obtain the refresh rate of each virtual display. Based on the virtual display information, determine the vertical synchronization reference time of the virtual display; Based on the refresh rate of the virtual display, the vertical synchronization period of the virtual display is calculated, and based on the vertical synchronization reference time and the vertical synchronization period of the virtual display, the vertical synchronization time of the virtual display is calculated.

[0014] Optionally, after obtaining the vertical synchronization time and refresh rate of each virtual display, and before reaching at least one vertical synchronization time in response to the current time, the method further includes: For each virtual display, obtain the hardware resource identifier associated with the virtual display; Multiple virtual displays with the same hardware resource identifier are grouped into virtual display groups; Calculate the time difference between the vertical synchronization moments of any two virtual displays in the virtual display group; If the time difference is less than or equal to the preset safety threshold, the vertical synchronization time of each virtual display in the virtual display group is reallocated to obtain the vertical synchronization time of each virtual display in the reallocated virtual display group. The time difference between the vertical synchronization times of any two virtual displays in the reallocated virtual display group is greater than the preset safety threshold.

[0015] Optionally, the vertical synchronization times of each virtual display in the virtual display group are reallocated to obtain the reallocated vertical synchronization times of each virtual display in the virtual display group, including: Group virtual displays with the same refresh rate into a subgroup within the virtual display group; For each subgroup, calculate the vertical synchronization period corresponding to the subgroup based on the refresh rate of the subgroup; For each subgroup, based on the target number of virtual displays within the subgroup, the vertical synchronization times of each virtual display within the subgroup are evenly distributed within the corresponding vertical synchronization period of the subgroup, resulting in the redistributed vertical synchronization times of each virtual display within the subgroup.

[0016] Optionally, based on the target number of virtual displays within the subgroup, the vertical synchronization times of each virtual display within the subgroup are evenly distributed within the corresponding vertical synchronization period of the subgroup to obtain the redistributed vertical synchronization times of each virtual display within the subgroup, including: The target duration is obtained based on the vertical synchronization cycle and the number of targets corresponding to the subgroup; The target duration is used as the time interval between the vertical synchronization times of two adjacent virtual displays within a subgroup. The vertical synchronization times of each virtual display within the subgroup are then redistributed in sequence according to the order of their vertical synchronization times, resulting in the redistributed vertical synchronization times of each virtual display within the subgroup.

[0017] A second aspect of this disclosure provides a vertical synchronization signal simulation device for use on a host machine, wherein at least one virtual machine is running on the host machine, and the virtual machine includes at least one virtual display that is running and has vertical synchronization enabled. The device includes: The acquisition module is used to acquire the vertical synchronization time and refresh rate of each virtual display; The determination module is used to determine the arrived vertical synchronization moment as the target moment in response to the current time reaching at least one vertical synchronization moment; The generation module is used to determine the target virtual display corresponding to the target time and generate the target vertical synchronization signal of the target virtual display. The interrupt injection module is used to inject a virtual interrupt signal corresponding to the target vertical synchronization signal into the target virtual machine to which the target virtual display belongs, so that the target virtual machine can perform vertical synchronization operation on the target virtual display based on the virtual interrupt signal.

[0018] A third aspect of this disclosure provides a computer device comprising: The memory and processor, wherein the memory stores a computer program that, when executed by the processor, implements the simulation method of the vertical synchronization signal described in the first aspect above.

[0019] A fourth aspect of this disclosure provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method for simulating the vertical synchronization signal of the first aspect described above.

[0020] The technical solution provided in this disclosure has the following advantages compared with related technologies: In this embodiment, the host machine centrally manages the generation of vertical synchronization signals for virtual displays that are running and have enabled vertical synchronization in each virtual machine. The virtual interrupt signals corresponding to the generated vertical synchronization signals are injected into the virtual machines, enabling them to perform vertical synchronization operations on the virtual displays. For the virtual machines, the virtual interrupt signals corresponding to the vertical synchronization signals from the host machine can enter the interrupt handling path of the virtual machine operating system through an interrupt injection mechanism and be responded to as device interrupts in the virtual machine operating system. Compared to the timer-based software interrupt context in related technologies, the virtual interrupt signals in this disclosure have higher processing priority and lower response latency, thus enabling the vertical synchronization signals of the virtual displays to be processed in a timely manner. This improves the accuracy of vertical synchronization processing for virtual displays, reduces or avoids screen tearing in virtual displays, improves the display effect of virtual displays, and ensures that the rendering frame rate of graphics applications relying on vertical synchronization signals in virtual displays reaches the expected level, thereby improving the performance of graphics applications.

[0021] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0022] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.

[0023] To more clearly illustrate the technical solutions in the embodiments or related technologies of this disclosure, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, those skilled in the art can obtain other drawings based on these drawings without creative effort.

[0024] Figure 1 This is a schematic diagram of a vertical synchronization signal simulation provided in an embodiment of this disclosure; Figure 2 This is a flowchart of a method for simulating a vertical synchronization signal provided in an embodiment of this disclosure; Figure 3 This is a schematic diagram of a vertical synchronization signal simulation provided in an embodiment of this disclosure; Figure 4 This is a flowchart of a method for simulating a vertical synchronization signal provided in an embodiment of this disclosure; Figure 5 This is a flowchart of a method for simulating a vertical synchronization signal provided in an embodiment of this disclosure; Figure 6 This is a flowchart of a method for simulating a vertical synchronization signal provided in an embodiment of this disclosure; Figure 7 This is a schematic diagram of the structure of an analog device for a vertical synchronization signal provided in an embodiment of this disclosure; Figure 8 This is a schematic diagram of the structure of a computer device provided in an embodiment of this disclosure. Detailed Implementation

[0025] To better understand the above-mentioned objectives, features, and advantages of this disclosure, the solutions disclosed herein will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.

[0026] Numerous specific details are set forth in the following description in order to provide a full understanding of this disclosure, but this disclosure may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only some, and not all, of the embodiments of this disclosure.

[0027] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.

[0028] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0029] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".

[0030] In related technologies, the virtual GPU (vGPU) kernel driver in the virtual machine's operating system directly uses a kernel-provided timer to periodically simulate and generate vertical synchronization signals for each virtual display in the virtual machine. However, the vertical synchronization signals generated by the timer in the virtual machine's operating system kernel run in a software interrupt context, causing the rendering frame rate of graphics applications that rely on vertical synchronization signals in the virtual displays to be lower than expected, thus affecting the performance of graphics applications.

[0031] Because timer-based software interrupt contexts have low priority, when the virtual machine is under high load and the host machine frequently generates interrupts with higher priority than the software interrupt context, the virtual machine needs to prioritize processing the higher priority interrupts. This causes the execution of the virtual machine's timer callbacks to be delayed, resulting in a delay in the processing of the virtual display's vertical synchronization signal. Consequently, the rendering frame rate of graphics applications that rely on the vertical synchronization signal in the virtual display (such as the frame rate of video decoding, the frequency of desktop screenshots, and the frame rate of post-screen capture encoding) is lower than expected, affecting the performance of graphics applications.

[0032] For example, Figure 1 This is a schematic diagram of a vertical synchronization signal simulation structure, such as... Figure 1 As shown, the host machine runs virtual machines VM1, VM2, and VM3. VM1 includes a running virtual monitor A with vertical synchronization enabled, and timer 101 is a timer in the VM1 operating system kernel. VM2 includes running virtual monitors B and C with vertical synchronization enabled, and timer 102 is a timer in the VM2 operating system kernel. VM3 includes running virtual monitors D and E with vertical synchronization enabled, and timer 103 is a timer in the VM3 operating system kernel. VM1 can simulate the vertical synchronization signal for virtual monitor A using timer 101; VM2 can simulate the vertical synchronization signals for virtual monitors B and C using timer 102; and VM3 can simulate the vertical synchronization signals for virtual monitors D and E using timer 103.

[0033] To better understand the inventive concept of the embodiments of this disclosure, the technical solutions of the embodiments of this disclosure will be described below in conjunction with exemplary embodiments.

[0034] The vertical synchronization signal simulation method provided in this disclosure can be executed by a host machine. The host machine can be understood as a physical server or computer device that runs virtualization software in a virtualization environment and provides hardware resources such as a central processing unit (CPU), GPU, memory, and storage for virtual machines; it is the parent entity for running virtual instances. In virtualization technology, the host machine can divide its own resources into multiple independent virtual units through a virtualization management program (such as a hypervisor) for use by multiple virtual machines, achieving efficient resource utilization and isolation.

[0035] In this embodiment of the disclosure, a GPU is provided in the host machine, and at least one virtual machine is running on the host machine. The virtual machine may include at least one virtual display that is running and has vertical synchronization enabled.

[0036] Figure 2 This is a flowchart of a vertical synchronization signal simulation method provided in this disclosure. The method can be executed by a host machine, specifically by a kernel driver on the host machine. The host machine runs at least one virtual machine, which may include at least one virtual display that is running and has vertical synchronization enabled, such as... Figure 2 As shown, the simulation method for the vertical synchronization signal provided in this embodiment includes the following steps: Step 210: Obtain the vertical synchronization time and refresh rate of each virtual display.

[0037] In this embodiment of the disclosure, the host machine can obtain the vertical synchronization time and refresh rate of each virtual display that is running and has enabled vertical synchronization in each virtual machine.

[0038] The vertical synchronization time of a virtual display can be understood as the time when the vertical synchronization signal of the virtual display is generated, which is the synchronization time between the frame output rate of the virtual display and the refresh rate of the virtual display.

[0039] The refresh rate of a virtual display can be understood as the number of times the screen of a virtual display draws or processes images per second.

[0040] In some embodiments, obtaining the vertical synchronization time and refresh rate of each virtual display may include steps 2101-2104: Step 2101: Receive virtual display information sent by each virtual machine.

[0041] In this embodiment of the disclosure, for each virtual machine running on the host machine, the virtual machine can send virtual display information to the host machine when it is initialized, started, registered on the host machine, or when the state of the virtual display in the virtual machine changes.

[0042] Step 2102: In the virtual display information, obtain the target display identifier where the device status is running and the vertical synchronization function is enabled, determine the virtual display corresponding to the target display identifier as the virtual display that is running and has the vertical synchronization function enabled, and obtain the refresh rate of each virtual display.

[0043] In this embodiment of the disclosure, the virtual display information of the virtual machine may include information such as the display identifier, device status, vertical synchronization function status, and refresh rate of each virtual display in the virtual machine.

[0044] When the virtual display's device status is enabled, it is determined that the device status is in the running state.

[0045] When the vertical synchronization function of the virtual display is enabled, the vertical synchronization function of the virtual display is determined to be turned on.

[0046] A display identifier can be understood as information that identifies a virtual display.

[0047] The target display identifier can be understood as information about a virtual display that can determine whether the device is in operation and whether the vertical synchronization function is enabled.

[0048] In this embodiment of the disclosure, the host machine can obtain the display identifiers in the virtual display information where the device status is enabled and the vertical synchronization function status is enabled, determine the display identifiers in the virtual display information as the target display identifiers where the device status is running and the vertical synchronization function status is on, and obtain the refresh rate of each virtual display.

[0049] Step 2103: Determine the vertical synchronization reference time of the virtual display based on the virtual display information.

[0050] The vertical synchronization reference time of a virtual display can be understood as the starting time used to calculate the vertical synchronization time of the virtual display.

[0051] In some embodiments, the virtual display information may include the vertical synchronization reference time of the virtual display, and the host machine can obtain the vertical synchronization reference time of the virtual display from the virtual display information.

[0052] In other embodiments, the host machine can determine the time when the virtual display information is received as the vertical synchronization reference time of the virtual display.

[0053] In other embodiments, the virtual display information may include the configuration effective time of the virtual display. The host machine can obtain the configuration effective time of the virtual display from the virtual display information sent by the virtual machine and determine the configuration effective time of the virtual display as the vertical synchronization reference time of the virtual display.

[0054] Step 2104: Calculate the vertical synchronization period of the virtual display based on its refresh rate, and calculate the vertical synchronization time of the virtual display based on its vertical synchronization reference time and vertical synchronization period.

[0055] In this embodiment of the disclosure, the host machine can calculate the ratio of 1 to the refresh rate of the virtual display to obtain the vertical synchronization period of the virtual display.

[0056] The vertical synchronization period of a virtual display can be understood as the time interval between two vertical synchronization moments of the virtual display.

[0057] For example, when the refresh rate of the virtual display is 60Hz, the vertical synchronization period of the virtual display is (1 / 60) seconds, which is approximately 16.67 milliseconds.

[0058] The initial vertical synchronization time of the virtual display is obtained by shifting the vertical synchronization reference time of the virtual display forward by the vertical synchronization period of the virtual display, that is, by adding the vertical synchronization reference time to the vertical synchronization period of the virtual display. Then, the next vertical synchronization time of the virtual display is obtained by shifting the initial vertical synchronization time forward by the vertical synchronization period of the virtual display.

[0059] For example, let t0 be the vertical synchronization reference time for virtual displays A, B, and C, respectively; the refresh rate of virtual display A is 1 / (t1-t0); the refresh rate of virtual display B is 1 / (t4-t0); and the refresh rate of virtual display C is 1 / (t2-t0). Then the vertical synchronization period of virtual display A is t1-t0, the vertical synchronization period of virtual display B is t4-t0, and the vertical synchronization period of virtual display C is t2-t0. Add the vertical synchronization reference time t0 to the vertical synchronization period t1-t0 of the virtual display A to obtain the first vertical synchronization time t1 of the virtual display A; add the first vertical synchronization time t1 to the vertical synchronization period t1-t0 to obtain the second vertical synchronization time of the virtual display A, and so on, to obtain multiple vertical synchronization times of the virtual display A. Add the vertical synchronization reference time t0 to the vertical synchronization period t4-t0 of the virtual display B to obtain the first vertical synchronization time t4 of the virtual display B; add the first vertical synchronization time t4 to the vertical synchronization period t4-t0 to obtain the second vertical synchronization time of the virtual display B, and so on, to obtain multiple vertical synchronization times of the virtual display B. Add the vertical synchronization reference time t0 to the vertical synchronization period t2-t0 of the virtual display C to obtain the first vertical synchronization time t2 of the virtual display C; add the first vertical synchronization time t2 to the vertical synchronization period t2-t0 to obtain the second vertical synchronization time of the virtual display C, and so on, to obtain multiple vertical synchronization times of the virtual display C.

[0060] Therefore, the vertical synchronization time of the virtual display can be calculated using the refresh rate of the virtual display and the vertical synchronization reference time, which can improve the accuracy of obtaining the vertical synchronization time.

[0061] Step 220: In response to the arrival of at least one vertical synchronization moment at the current time, determine the arrived vertical synchronization moment as the target moment.

[0062] In this embodiment of the disclosure, after obtaining the vertical synchronization time of each virtual display, the vertical synchronization signal generation module in the host machine can monitor whether the vertical synchronization time has arrived. In response to the current time reaching at least one vertical synchronization time, that is, the current time equals at least one vertical synchronization time, the arrived vertical synchronization time is determined as the target time.

[0063] In some embodiments, a target timer is configured in the host machine, that is, the target timer is a timer in the host machine. For example, the target timer can be configured in the kernel driver of the operating system on the host machine. After the host machine obtains the vertical synchronization time of each virtual display, it can set the vertical synchronization time of each virtual display as the expiration time of the target timer. In response to the target timer detecting that the current time has reached at least one expiration time, the reached expiration time is determined as the target time.

[0064] For example, Figure 3 This is a schematic diagram of a vertical synchronization signal simulation structure, such as... Figure 3 As shown, the host machine 300 runs virtual machines VM1, VM2, and VM3. Virtual machine VM1 includes a virtual monitor A that is running and has vertical synchronization enabled; virtual machine VM2 includes virtual monitors B and C that are running and have vertical synchronization enabled; and virtual machine VM3 includes virtual monitors D and E that are running and have vertical synchronization enabled.

[0065] The host machine 300 can obtain the vertical synchronization time and refresh rate of virtual display A, virtual display B, virtual display C, virtual display D and virtual display E respectively; the host machine 300 is configured with a target timer 301, and the host machine 300 can set the vertical synchronization time of each virtual display to the expiration time of the target timer; in response to the target timer detecting that the current time has reached at least one expiration time, the reached expiration time is determined as the target time.

[0066] Therefore, the vertical synchronization time of the virtual display can be automatically monitored by a timer in the host machine, improving the convenience and accuracy of vertical synchronization time monitoring.

[0067] Step 230: Determine the target virtual display corresponding to the target time and generate the target vertical synchronization signal of the target virtual display.

[0068] In this embodiment of the disclosure, after the upcoming vertical synchronization time is determined as the target time, the host machine can determine the target virtual display corresponding to the target time based on a preset callback function, and then generate the target vertical synchronization signal of the target virtual display.

[0069] The preset callback function can be understood as a function that is automatically called by the host machine's kernel in a specified execution context after the vertical synchronization moment arrives.

[0070] Step 240: Inject a virtual interrupt signal corresponding to the target vertical synchronization signal into the target virtual machine to which the target virtual display belongs, so that the target virtual machine performs vertical synchronization operation on the target virtual display based on the virtual interrupt signal.

[0071] In this embodiment of the disclosure, after generating the target vertical synchronization signal for the target virtual display, the host machine can determine the virtual interrupt signal corresponding to the target vertical synchronization signal. This virtual interrupt signal may include the identification information of the target virtual display. The host machine can then inject this virtual interrupt signal into the operating system of the target virtual machine to which the target virtual display belongs. Upon receiving the virtual interrupt signal, the operating system of the target virtual machine determines the target virtual display corresponding to the virtual interrupt signal based on the identification information within the virtual interrupt signal. It can then perform vertical synchronization operations on the target virtual display through the graphics card driver or display subsystem in the operating system of the target virtual machine, such as submitting new frames or waking up rendering threads.

[0072] Continue with Figure 3 For example, Figure 3As shown, when the host machine 300 detects that the current time has reached at least one vertical synchronization moment through the target timer 301, the host machine 300 can respond to the arrival of at least one vertical synchronization moment by determining the arrived vertical synchronization moment as the target moment. If the target moment is the vertical synchronization moment of the virtual display D, the host machine 300 can determine that the virtual display D is the target virtual display and generate a target vertical synchronization signal for the virtual display D. The host machine 300 injects a virtual interrupt signal corresponding to the target vertical synchronization signal into the virtual machine VM3 to which the virtual display D belongs, so that the virtual machine VM3 performs a vertical synchronization operation on the virtual display D based on the virtual interrupt signal.

[0073] The host machine 300 can uniformly manage the generation of vertical synchronization signals for virtual monitors A, B, C, D, and E in virtual machines, and inject the virtual interrupt signals corresponding to the generated vertical synchronization signals into the virtual machines to which the virtual monitors belong, so that the virtual machines can perform vertical synchronization operations on the virtual monitors.

[0074] In this embodiment of the disclosure, the host machine obtains the vertical synchronization time and refresh rate of each virtual display that is running and has enabled vertical synchronization in each virtual machine; in response to the current time reaching at least one vertical synchronization time, the reached vertical synchronization time is determined as the target time; the target virtual display corresponding to the target time is determined, and a target vertical synchronization signal for the target virtual display is generated; a virtual interrupt signal corresponding to the target vertical synchronization signal is injected into the target virtual machine to which the target virtual display belongs, so that the target virtual machine performs vertical synchronization operation on the target virtual display based on the virtual interrupt signal. This disclosure embodiment manages the generation of vertical synchronization signals for each virtual display running in a virtual machine and with vertical synchronization enabled by the host machine. The virtual interrupt signals corresponding to the generated vertical synchronization signals are injected into the virtual machine, enabling the virtual machine to perform vertical synchronization operations on the virtual displays. For the virtual machine, the virtual interrupt signals corresponding to the vertical synchronization signals from the host machine can enter the interrupt handling path of the virtual machine operating system through the interrupt injection mechanism and be responded to in the virtual machine operating system as device interrupts. Compared to the timer-based software interrupt context in related technologies, the virtual interrupt signals in this disclosure have higher processing priority and lower response latency, thus enabling the vertical synchronization signals of the virtual displays to be processed in a timely manner. This improves the accuracy of vertical synchronization processing of the virtual displays, reduces or avoids screen tearing in the virtual displays, improves the display effect of the virtual displays, and ensures that the rendering frame rate of graphics applications relying on vertical synchronization signals in the virtual displays reaches the expected level, thereby improving the running effect of graphics applications.

[0075] In some embodiments of this disclosure, when generating the target vertical synchronization signal for the target virtual display, the host machine can update the vertical synchronization time of the target virtual display based on the target time and the refresh rate of the target virtual display.

[0076] In some embodiments, updating the vertical synchronization time of the target virtual display based on the target time and the refresh rate of the target virtual display may include S11-S12: S11. Based on the target time and the refresh rate of the target virtual display, calculate the next vertical synchronization time of the target virtual display.

[0077] In this embodiment of the disclosure, the host machine can calculate the target vertical synchronization period of the target virtual display based on the refresh rate of the target virtual display, and then calculate the next vertical synchronization time of the target virtual display based on the target time and the target vertical synchronization period.

[0078] Specifically, the host machine can calculate the ratio of 1 to the refresh rate of the target virtual display to obtain the target vertical synchronization period of the target virtual display; then, the host machine can move the target time forward by the target vertical synchronization period, that is, add the target time to the target vertical synchronization period to obtain the next vertical synchronization time of the target virtual display.

[0079] S12. Update the vertical synchronization time of the target virtual display to the next vertical synchronization time.

[0080] In this embodiment of the disclosure, after obtaining the next vertical synchronization time of the target virtual display, the host machine can update the vertical synchronization time of the target virtual display to the next vertical synchronization time.

[0081] Continue with Figure 3 For example, Figure 3 As shown, when the host machine 300 detects that the current time has reached at least one vertical synchronization moment through the target timer 301, the host machine 300 can respond to the arrival of at least one vertical synchronization moment by determining the arrived vertical synchronization moment as the target moment. If the target moment is the vertical synchronization moment of the virtual display D, the host machine 300 can determine that the virtual display D is the target virtual display, generate the target vertical synchronization signal of the virtual display D, and update the vertical synchronization moment of the virtual display D based on the target moment and the refresh rate of the virtual display D; inject the virtual interrupt signal corresponding to the target vertical synchronization signal into the virtual machine VM3 to which the virtual display D belongs, so that the virtual machine VM3 performs vertical synchronization operation on the virtual display D based on the virtual interrupt signal.

[0082] Therefore, the vertical synchronization time of the target virtual display can be updated in a timely and accurate manner based on the target time and the refresh rate of the target virtual display.

[0083] Figure 4 This is a flowchart of a vertical synchronization signal simulation method provided in an embodiment of this disclosure. The method can be executed by a host machine running at least one virtual machine, each virtual machine including at least one virtual display that is running and has vertical synchronization enabled, such as... Figure 4 As shown, the simulation method for the vertical synchronization signal provided in this embodiment includes the following steps: Step 410: Obtain the vertical synchronization time and refresh rate of each virtual display.

[0084] Step 420: In response to the arrival of at least one vertical synchronization moment at the current time, determine the arrived vertical synchronization moment as the target moment.

[0085] Step 430: Sort the vertical synchronization times of each virtual display in chronological order to construct the target time sequence.

[0086] In this embodiment of the disclosure, the host machine can sort the vertical synchronization times of each virtual display in chronological order to construct a target time sequence.

[0087] In some embodiments, the data structure of the target time series can be a self-balancing binary search tree structure. For example, the self-balancing binary search tree structure can be any of the following: Red-Black Tree, AVL Tree, SplayTree, Scapegoat Tree, etc.

[0088] A self-balancing binary search tree is a special type of binary search tree that automatically adjusts its structure after inserting or deleting nodes to maintain the tree's balance.

[0089] A red-black tree is a self-balancing binary search tree where each node has a color attribute. It can still efficiently support search, insertion, and deletion operations even in scenarios with frequent insertion and deletion operations.

[0090] The AVL tree structure requires that the absolute value of the height difference between the left and right subtrees of any node does not exceed 1, and strictly maintains balance through rotation operations.

[0091] The splay tree structure can move the most recently visited node to the root by rotation, exhibiting self-adjusting properties.

[0092] The scapegoat tree structure can restore balance by reconstructing subtrees without requiring additional storage of balance information.

[0093] Specifically, the host machine can add the vertical synchronization times of each virtual display to the self-balancing binary search tree structure in chronological order to obtain the target time sequence.

[0094] Step 440: Starting from the first vertical synchronization moment in the target time sequence, calculate the time difference between the vertical synchronization moments in the target time sequence and the target moment in sequence.

[0095] In this embodiment of the disclosure, after obtaining the target time sequence, the host machine can start from the first vertical synchronization moment in the target time sequence and calculate the time difference between the vertical synchronization moment in the target time sequence and the target moment in sequence.

[0096] Step 450: If the time difference is less than or equal to the preset time error, determine the vertical synchronization time corresponding to the time difference as the target vertical synchronization time.

[0097] In this embodiment of the disclosure, if the time difference between the vertical synchronization time and the target time is less than or equal to a preset time error, it indicates that the time difference is within the preset time error range, and the host machine can determine the vertical synchronization time corresponding to the time difference as the target vertical synchronization time.

[0098] In some embodiments, when a time difference is less than or equal to a preset time error, the vertical synchronization time corresponding to the time difference can be determined as the target vertical synchronization time, that is, there is one target vertical synchronization time.

[0099] In other embodiments, when multiple time differences are all less than or equal to a preset time error, the vertical synchronization times corresponding to multiple time differences can all be determined as the target vertical synchronization times, that is, there are multiple target vertical synchronization times.

[0100] The preset time error (tolerance) can be set as needed, for example, 500 microseconds, which is not limited here.

[0101] Step 460: If the time difference is greater than the preset time error, stop calculating the time difference between the vertical synchronization time and the target time in the target time sequence.

[0102] In this embodiment of the disclosure, during the process of sequentially calculating the time difference between the vertical synchronization moment and the target moment in the target time sequence, if a time difference exceeds a preset time error, the host machine can stop calculating the time difference between the vertical synchronization moment and the target moment in the target time sequence. In other words, as soon as a time difference exceeds the preset time error, the calculation of subsequent time differences can be stopped.

[0103] Step 470: Determine the virtual display corresponding to the target vertical synchronization moment as the target virtual display, and generate the target vertical synchronization signal of the target virtual display.

[0104] In this embodiment of the disclosure, when there is one target vertical synchronization moment, there is one target virtual display; when there are multiple target vertical synchronization moments, there are multiple target virtual displays.

[0105] Step 480: Inject a virtual interrupt signal corresponding to the target vertical synchronization signal into the target virtual machine to which the target virtual display belongs, so that the target virtual machine performs vertical synchronization operation on the target virtual display based on the virtual interrupt signal.

[0106] In this embodiment of the disclosure, vertical synchronization signals can be generated in a concentrated manner at vertical synchronization moments with small time intervals. This avoids performing multiple vertical synchronizations in a very short period of time, reduces the load on the host machine's processor in generating vertical synchronization signals, and improves the generation efficiency of vertical synchronization signals.

[0107] In some embodiments of this disclosure, when generating the target vertical synchronization signal of the target virtual display, the host machine can update the vertical synchronization time of the target virtual display in the target time sequence to the next vertical synchronization time of the target virtual display, and reorder the vertical synchronization times of each virtual display according to the chronological order to update the target time sequence.

[0108] Specifically, the host machine can calculate the next vertical synchronization time of the target virtual display based on the target time and the refresh rate of the target virtual display. More specifically, the host machine can calculate the target vertical synchronization period of the target virtual display based on its refresh rate, and then calculate the next vertical synchronization time of the target virtual display based on the target time and the target vertical synchronization period.

[0109] Specifically, the host machine can calculate the ratio of 1 to the refresh rate of the target virtual display to obtain the target vertical synchronization period of the target virtual display. Then, the host machine can move the target time forward by the target vertical synchronization period, that is, add the target time to the target vertical synchronization period to obtain the next vertical synchronization time of the target virtual display, that is, obtain the updated target time sequence.

[0110] Therefore, the order of the vertical synchronization times of the virtual displays in the target time sequence can be updated in a timely and accurate manner based on the target time and the refresh rate of the target virtual display.

[0111] In related technologies, as the host system's runtime increases, system errors accumulate. In particular, the accumulated errors caused by the aforementioned preset time errors may cluster the vertical synchronization moments of virtual displays with similar refresh rates, resulting in complete synchronization of the vertical synchronization rhythms of numerous virtual displays. Subsequent actions of graphics applications that rely on vertical synchronization will also follow the same rhythm. If the vertical synchronization and subsequent actions of different virtual displays need to share hardware, a large number of concurrent hardware resource requests will cause contention and queuing for hardware resources on the host machine, leading to host load imbalance and frame drops in the output bitstream encoded by the virtual displays. This results in frame drops in the virtual display's display, reduced display quality, and even virtual display failure. For example, after capturing a screen during the vertical synchronization moment of a virtual display, the virtual machine notifies the host machine's hardware to encode the image. A large number of concurrent encoding requests will cause contention and queuing for encoding hardware resources on the host machine, causing frame drops in the virtual machine's screen capture and encoding process, resulting in frame drops in the virtual display's display.

[0112] For example, in related technologies, when virtual displays 1, 2, and 3 have the same refresh rate and share the same encoding hardware (the same hardware resource), after a period of time (e.g., screen capture time), all three virtual displays may simultaneously submit encoding tasks to the host hardware. However, because the three virtual displays share the same encoding hardware, only one virtual display can immediately begin encoding, while the other two virtual displays must wait in line. For instance, when virtual display 3 is encoding, virtual displays 1 and 2 must wait in line. When the second vertical synchronization moment of virtual display 1 arrives, the encoding task of the first vertical synchronization moment of virtual display 1 has not yet been completed. Therefore, the screen capture process will not be triggered during the second vertical synchronization moment, resulting in the loss of the second frame in the screen capture encoding of virtual display 1, leading to frame loss in the output bitstream encoded by virtual display 1, and so on.

[0113] Based on this, in some embodiments of this disclosure, the host machine can execute... Figure 5 A flowchart of a method for simulating a vertical synchronization signal is provided, such as... Figure 5 As shown, the simulation method for the vertical synchronization signal provided in this embodiment includes the following steps: Step 510: Obtain the vertical synchronization time and refresh rate of each virtual display.

[0114] Step 520: For each virtual display, obtain the hardware resource identifier associated with the virtual display.

[0115] In this embodiment of the disclosure, the hardware resource identifier associated with the virtual display can be understood as information that can uniquely identify the hardware resources in the host machine occupied by the virtual display.

[0116] For example, hardware resources could be the GPU resources in the host machine.

[0117] For each virtual display, the host machine can obtain the hardware resource identifier associated with the virtual display.

[0118] Step 530: Divide multiple virtual displays with the same hardware resource identifier into virtual display groups.

[0119] In this embodiment of the disclosure, the host machine can divide multiple virtual displays with the same hardware resource identifier into a virtual display group. That is, multiple virtual displays in a virtual display group share the same hardware resources.

[0120] Step 540: Calculate the time difference between the vertical synchronization times of any two virtual displays in the virtual display group.

[0121] Step 550: If there is a time difference less than or equal to a preset safety threshold, the vertical synchronization time of each virtual display in the virtual display group is redistributed to obtain the vertical synchronization time of each virtual display in the redistributed virtual display group. The time difference between the vertical synchronization times of any two virtual displays in the redistributed virtual display group is greater than the preset safety threshold.

[0122] In this embodiment of the disclosure, the preset security threshold can be understood as the time difference determined based on the minimum processing time or minimum processing delay of the hardware resources in the host machine.

[0123] The preset safety threshold can be set as needed. For example, the preset safety threshold can be the shortest time required for the hardware encoder to process a single frame of image, which is not limited here.

[0124] If the time difference is less than or equal to the preset safety threshold, it indicates that at least two virtual displays in the virtual display group have similar or identical vertical synchronization times. In order to reduce the probability of competition for hardware resources and queuing on the host machine, the host machine can reallocate the vertical synchronization times of each virtual display in the virtual display group to obtain the reallocated vertical synchronization times of each virtual display in the virtual display group.

[0125] Among them, the time difference between the vertical synchronization moments of any two virtual displays in the reallocated virtual display group is greater than the preset safety threshold.

[0126] Step 560: In response to the arrival of at least one vertical synchronization moment at the current time, determine the arrived vertical synchronization moment as the target moment.

[0127] Step 570: Determine the target virtual display corresponding to the target time and generate the target vertical synchronization signal of the target virtual display.

[0128] Step 580: Inject a virtual interrupt signal corresponding to the target vertical synchronization signal into the target virtual machine to which the target virtual display belongs, so that the target virtual machine performs vertical synchronization operation on the target virtual display based on the virtual interrupt signal.

[0129] Therefore, the time difference between the vertical synchronization moments of any two virtual displays sharing the same hardware resources can be controlled within a preset safety threshold. This prevents the vertical synchronization moments of multiple virtual displays sharing the same hardware resources from clustering together and avoids the vertical synchronization rhythm of multiple virtual displays sharing the same hardware resources from synchronizing. This reduces the request for the same frequency hardware resources of the host machine, improves the load balance of the host machine, avoids frame loss in the output bitstream encoded by the virtual displays, ensures that the frame rate of the virtual display meets expectations, and improves the display effect of the virtual displays.

[0130] In some embodiments of this disclosure, the host machine can execute Figure 6 A flowchart of a method for simulating a vertical synchronization signal is provided, such as... Figure 6 As shown, the simulation method for the vertical synchronization signal provided in this embodiment includes the following steps: Step 610: Obtain the vertical synchronization time and refresh rate of each virtual display.

[0131] Step 620: For each virtual display, obtain the hardware resource identifier associated with the virtual display.

[0132] Step 630: Divide multiple virtual displays with the same hardware resource identifier into virtual display groups, and calculate the time difference between the vertical synchronization times of any two virtual displays in the virtual display group.

[0133] Step 640: If there is a time difference less than or equal to a preset safety threshold, divide the virtual displays with the same refresh rate in the virtual display group into a subgroup.

[0134] In this embodiment of the disclosure, the host machine can divide virtual displays with the same refresh rate in the virtual display group into a subgroup.

[0135] For example, if the refresh rates of the virtual displays in the virtual display group include 30Hz, 60Hz, and 120Hz, then the virtual displays with a refresh rate of 30Hz in the virtual display group can be divided into subgroup p1; the virtual displays with a refresh rate of 60Hz in the virtual display group can be divided into subgroup p2; and the virtual displays with a refresh rate of 120Hz in the virtual display group can be divided into subgroup p3.

[0136] Step 650: For each subgroup, calculate the vertical synchronization period corresponding to that subgroup based on the refresh rate of that subgroup.

[0137] In this embodiment of the disclosure, the refresh rate corresponding to a subgroup can be understood as the refresh rate of any virtual display within the subgroup. The vertical synchronization period corresponding to a subgroup can be understood as the vertical synchronization period of any virtual display within the subgroup.

[0138] After dividing virtual displays with the same refresh rate into a subgroup, the host machine can calculate the vertical synchronization period for each subgroup based on the refresh rate of that subgroup. Specifically, the ratio of 1 to the refresh rate of the subgroup can be determined as the vertical synchronization period of that subgroup.

[0139] Step 660: For each subgroup, based on the target number of virtual displays in the subgroup, the vertical synchronization time of each virtual display in the subgroup is evenly distributed within the vertical synchronization period corresponding to the subgroup, so as to obtain the redistributed vertical synchronization time of each virtual display in the subgroup.

[0140] In this subgroup, the time interval between the vertical synchronization moments of two adjacent virtual displays is the same after the reassignment.

[0141] In some embodiments, the above-mentioned method of uniformly distributing the vertical synchronization times of each virtual display in the subgroup within the corresponding vertical synchronization period of the subgroup based on the target number of virtual displays in the subgroup, to obtain the redistributed vertical synchronization times of each virtual display in the subgroup, may include S21-S22: S21. Based on the vertical synchronization cycle and the number of targets corresponding to the subgroup, obtain the target duration.

[0142] For example, the host machine can divide the vertical synchronization period corresponding to the subgroup by the target number of virtual displays in the subgroup to obtain the target duration.

[0143] S22. Using the target duration as the time interval between the vertical synchronization times of two adjacent virtual displays within the subgroup, the vertical synchronization times of each virtual display within the subgroup are redistributed sequentially according to the order of their vertical synchronization times, resulting in the redistributed vertical synchronization times of each virtual display within the subgroup.

[0144] The time interval between the vertical synchronization moments of two adjacent virtual displays within the reassigned subgroup is equal to the target duration.

[0145] For example, the virtual displays in subgroup p2 include virtual displays B, D, and E. The target number of virtual displays in subgroup p2 is 3, and the refresh rate of subgroup p2 is 60Hz. Therefore, the vertical synchronization period for subgroup p2 is (1 / 60) seconds, approximately 16.67 milliseconds. Dividing this vertical synchronization period of 16.67 milliseconds by the target number of 3 yields a target duration of approximately 5.56 milliseconds. At this time, the vertical synchronization time of virtual display B is ta0, the vertical synchronization time of virtual display D is tb0, and the vertical synchronization time of virtual display E is tc0. The vertical synchronization times of the devices are in the order of ta0, tb0, and tc0. The target duration of 5.56 milliseconds is used as the time interval between the vertical synchronization times of two adjacent virtual displays in subgroup p2. The vertical synchronization times ta0, tb0, and tc0 are redistributed in sequence to obtain the redistributed vertical synchronization times ta1, tb1, and tc1 of virtual display B, D, and E, respectively. The time interval between ta1 and tb1 is the target duration of 5.56 milliseconds, and the time interval between tb1 and tc1 is the target duration of 5.56 milliseconds.

[0146] Step 670: In response to the arrival of at least one vertical synchronization moment at the current time, determine the arrived vertical synchronization moment as the target moment.

[0147] Step 680: Determine the target virtual display corresponding to the target time and generate the target vertical synchronization signal for the target virtual display.

[0148] Step 690: Inject a virtual interrupt signal corresponding to the target vertical synchronization signal into the target virtual machine to which the target virtual display belongs, so that the target virtual machine performs vertical synchronization operation on the target virtual display based on the virtual interrupt signal.

[0149] Therefore, the vertical synchronization times of multiple virtual displays sharing the same hardware resources and refresh rate can be evenly distributed or staggered within a single vertical synchronization cycle. This avoids the vertical synchronization times of multiple virtual displays sharing the same hardware resources clustering together and avoids the vertical synchronization rhythm of multiple virtual displays sharing the same hardware resources being synchronized. This reduces the demand on the host machine's hardware resources at the same frequency, improves the load balance of the host machine, avoids frame dropping in the output bitstream encoded by the virtual displays, ensures that the frame rate of the virtual displays meets expectations, and improves the display effect of the virtual displays.

[0150] Figure 7 This is a schematic diagram of a vertical synchronization signal simulation device provided in an embodiment of this disclosure. This device can be understood as the aforementioned host machine or a functional module within the aforementioned host machine. The vertical synchronization signal simulation device provided in this embodiment is applied to a host machine, which runs at least one virtual machine, each virtual machine including at least one virtual display that is running and has vertical synchronization enabled. Figure 7 As shown, the analog device 700 for the vertical synchronization signal includes: The acquisition module 710 is used to acquire the vertical synchronization time and refresh rate of each virtual display; The determination module 720 is used to determine the arriving vertical synchronization moment as the target moment in response to the arrival of at least one vertical synchronization moment at the current time. The generation module 730 is used to determine the target virtual display corresponding to the target time and generate the target vertical synchronization signal of the target virtual display. The interrupt injection module 740 is used to inject a virtual interrupt signal corresponding to the target vertical synchronization signal into the target virtual machine to which the target virtual display belongs, so that the target virtual machine performs vertical synchronization operation on the target virtual display based on the virtual interrupt signal.

[0151] The vertical synchronization signal simulation device provided in this disclosure can implement the method of any of the above embodiments, and its execution mode and beneficial effects are similar, so they will not be described again here.

[0152] This disclosure also provides a computer device, which includes a processor and a memory, wherein the memory stores a computer program. When the computer program is executed by the processor, it can implement the methods of any of the above embodiments. The execution method and beneficial effects are similar, and will not be described again here.

[0153] The computer device in this disclosure can be understood as any device with processing and computing capabilities, including but not limited to electronic devices such as smartphones, laptops, personal digital assistants (PDAs), tablet computers (PADs), digital TVs, and desktop computers.

[0154] Figure 8 This is a schematic diagram of the structure of a computer device provided in an embodiment of this disclosure, such as... Figure 8 As shown, the computer device 800 may include a processor 810 and a memory 820. The memory 820 stores a computer program 821. When the computer program 821 is executed by the processor 810, it can implement the method provided in any of the above embodiments. The execution mode and beneficial effects are similar and will not be described again here.

[0155] Of course, for the sake of simplicity, Figure 8 Only some of the components of the computer device 800 relevant to the present invention are shown in this illustration; components such as buses, input / output interfaces, input devices, and output devices are omitted. In addition, the computer device 800 may include any other suitable components depending on the specific application.

[0156] This disclosure provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it can implement the methods of any of the above embodiments. The execution method and beneficial effects are similar, and will not be described again here.

[0157] The aforementioned computer-readable storage medium may be any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may, for example, include, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0158] The computer program described above can be written in any combination of one or more programming languages ​​to perform the operations of the embodiments of this disclosure. The programming languages ​​include object-oriented programming languages ​​such as Java and C++, as well as conventional procedural programming languages ​​such as C or similar languages. The program code can be executed entirely on the user's computer device, partially on the user's device, as a standalone software package, partially on the user's computer device and partially on a remote computer device, or entirely on a remote computer device or server.

[0159] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.

[0160] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.

[0161] The above description is merely a specific embodiment of this disclosure, enabling those skilled in the art to understand or implement it. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this disclosure. Therefore, this disclosure is not to be limited to the embodiments described herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method of simulating a vertical synchronization signal, characterized by, Applied to a host machine, wherein at least one virtual machine is running on the host machine, and the virtual machine includes at least one virtual display that is running and has vertical synchronization enabled, the method includes: Obtain the vertical synchronization time and refresh rate of each virtual display; In response to the arrival of at least one of the vertical synchronization moments at the current time, the arrived vertical synchronization moment is determined as the target moment; Determine the target virtual display corresponding to the target time, and generate the target vertical synchronization signal of the target virtual display; A virtual interrupt signal corresponding to the target vertical synchronization signal is injected into the target virtual machine to which the target virtual display belongs, so that the target virtual machine performs vertical synchronization operation on the target virtual display based on the virtual interrupt signal.

2. The method of claim 1, wherein, The method further includes: When generating the target vertical synchronization signal for the target virtual display, the vertical synchronization time of the target virtual display is updated based on the target time and the refresh rate of the target virtual display.

3. The method of claim 2, wherein, The step of updating the vertical synchronization time of the target virtual display based on the target time and the refresh rate of the target virtual display includes: Based on the target time and the refresh rate of the target virtual display, calculate the next vertical synchronization time of the target virtual display; Update the vertical synchronization time of the target virtual display to the next vertical synchronization time.

4. The method of claim 1, wherein, Determining the target virtual display corresponding to the target time includes: The vertical synchronization times of each virtual display are sorted in chronological order to construct a target time sequence; Starting from the first vertical synchronization moment in the target time sequence, calculate the time difference between the vertical synchronization moments in the target time sequence and the target moment in sequence. If the time difference is less than or equal to a preset time error, the vertical synchronization time corresponding to the time difference is determined as the target vertical synchronization time. If the time difference is greater than the preset time error, stop calculating the time difference between the vertical synchronization moment in the target time sequence and the target moment. The virtual display corresponding to the target vertical synchronization time is determined as the target virtual display.

5. The method of claim 4, wherein, The data structure of the target time sequence is a self-balancing binary search tree structure; The step of sorting the vertical synchronization times of each virtual display in chronological order to construct a target time sequence includes: According to the chronological order, the vertical synchronization times of each virtual display are added to the self-balancing binary search tree structure in sequence to obtain the target time sequence.

6. The method of claim 4, wherein, The method further includes: When generating the target vertical synchronization signal of the target virtual display, the vertical synchronization time of the target virtual display in the target time sequence is updated to the next vertical synchronization time of the target virtual display, and the vertical synchronization times of each virtual display are reordered according to the chronological order to update the target time sequence.

7. The method according to any one of claims 1 to 6, characterized in that, The response, which arrives at at least one vertical synchronization moment at the current time, determines the arrived vertical synchronization moment as the target moment, including: Set the vertical synchronization time of each virtual display to the expiration time of the target timer, where the target timer is a timer in the host machine; In response to the target timer detecting that the current time has reached at least one of the expiration times, the reached expiration time is determined as the target time.

8. The method according to any one of claims 1-6, characterized in that, The step of obtaining the vertical synchronization time and refresh rate of each of the virtual displays includes: Receive virtual display information sent by each of the virtual machines; In the virtual display information, the target display identifier is obtained when the display status is running and the vertical synchronization function is enabled. The virtual display corresponding to the target display identifier is determined as a virtual display that is running and has enabled the vertical synchronization function, and the refresh rate of each virtual display is obtained. Based on the virtual display information, determine the vertical synchronization reference time of the virtual display; Based on the refresh rate of the virtual display, the vertical synchronization period of the virtual display is calculated, and based on the vertical synchronization reference time of the virtual display and the vertical synchronization period, the vertical synchronization time of the virtual display is calculated.

9. The method according to any one of claims 1-6, characterized in that, After obtaining the vertical synchronization time and refresh rate of each of the virtual displays, and before the response reaches at least one vertical synchronization time at the current time, the method further includes: For each virtual display, obtain the hardware resource identifier associated with the virtual display; Multiple virtual displays with the same hardware resource identifier are grouped into virtual display groups; Calculate the time difference between the vertical synchronization moments of any two virtual displays in the virtual display group; If the time difference is less than or equal to a preset safety threshold, the vertical synchronization time of each virtual display in the virtual display group is reallocated to obtain the vertical synchronization time of each virtual display in the virtual display group after reallocation. The time difference between any two virtual displays in the virtual display group after reallocation is greater than the preset safety threshold.

10. The method according to claim 9, characterized in that, The step of reallocating the vertical synchronization times of each virtual display in the virtual display group to obtain the reallocated vertical synchronization times of each virtual display in the virtual display group includes: Virtual displays with the same refresh rate in the virtual display group are divided into a subgroup; For each subgroup, the vertical synchronization period corresponding to the subgroup is calculated based on the refresh rate corresponding to the subgroup; For each subgroup, based on the target number of virtual displays within the subgroup, the vertical synchronization times of each virtual display within the subgroup are evenly distributed within the vertical synchronization period corresponding to the subgroup, resulting in the redistributed vertical synchronization times of each virtual display within the subgroup.

11. The method according to claim 10, characterized in that, Based on the target number of virtual displays within the subgroup, the vertical synchronization times of each virtual display within the subgroup are evenly distributed within the corresponding vertical synchronization period of the subgroup to obtain the redistributed vertical synchronization times of each virtual display within the subgroup, including: The target duration is obtained based on the vertical synchronization cycle corresponding to the subgroup and the target number; The target duration is used as the time interval between the vertical synchronization times of two adjacent virtual displays within the subgroup. The vertical synchronization times of each virtual display within the subgroup are redistributed in sequence according to the order of their vertical synchronization times, resulting in the redistributed vertical synchronization times of each virtual display within the subgroup.

12. A device for simulating a vertical synchronization signal, characterized in that, Applied to a host machine, wherein at least one virtual machine is running on the host machine, and the virtual machine includes at least one virtual display that is running and has vertical synchronization enabled, the device includes: The acquisition module is used to acquire the vertical synchronization time and refresh rate of each of the virtual displays; The determination module is configured to determine the arrived vertical synchronization time as the target time in response to the arrival of at least one of the vertical synchronization times at the current time. A generation module is used to determine the target virtual display corresponding to the target time and generate the target vertical synchronization signal of the target virtual display. An interrupt injection module is used to inject a virtual interrupt signal corresponding to the target vertical synchronization signal into the target virtual machine to which the target virtual display belongs, so that the target virtual machine performs a vertical synchronization operation on the target virtual display based on the virtual interrupt signal.

13. A computer device, characterized in that, include: A memory and a processor, wherein the memory stores a computer program that, when executed by the processor, implements a method for simulating a vertical synchronization signal as described in any one of claims 1-11.

14. A computer-readable storage medium, characterized in that, The storage medium stores a computer program that, when executed by a processor, implements a method for simulating the vertical synchronization signal as described in any one of claims 1-11.