Search

CN-121391586-B - Multi-path image rendering method, device and medium

CN121391586BCN 121391586 BCN121391586 BCN 121391586BCN-121391586-B

Abstract

The application provides a multi-path image rendering method, equipment and medium, wherein the frame rates of the multi-path images are the same and share the same GPU; the method comprises the steps of sequentially obtaining tokens from a driver for each application program, sampling the movement action of a mouse if the tokens are successfully obtained, rendering the image frames of the corresponding application programs in the time slots allocated by the corresponding application programs according to the movement action of the mouse, and releasing the tokens. The technical scheme of the application can effectively avoid the problems of prolonged rendering time, asynchronous input and rendering and queue accumulation caused by the traditional time slice scheduling.

Inventors

  • CHEN ZHEN

Assignees

  • 瀚博半导体(上海)股份有限公司

Dates

Publication Date
20260508
Application Date
20251225

Claims (9)

  1. 1. A method of multi-path image rendering, the multi-path images having the same frame rate and sharing the same GPU, the method comprising: Dividing rendering resource time, namely dividing a rendering period T into m time slots, wherein m is the total number of a plurality of application programs corresponding to a plurality of paths of images, and distributing time slots T0+nT+ (i-1) T/m to T0+nT+iT/m to an ith application program, wherein T0 is reference time, the value range of i is 1 to m, and n is a natural number; Rendering an image frame of a multi-path image, comprising performing the following steps for each application loop in turn: Obtaining a token from the driver; if the token is successfully obtained, sampling the movement action of the mouse, rendering the image frames of the corresponding application programs in the time slots allocated to the corresponding application programs according to the movement action of the mouse, and completing rendering in one allocated time slot without slicing serial for the whole image frame of the application programs, wherein each application program only operates on the time slots allocated to the application programs; releasing the token; And in the process of rendering the image frames of the plurality of application programs, if the tokens are not obtained, waiting for a preset time and then obtaining the tokens from the driver program again.
  2. 2. The method of claim 1, wherein the dividing the rendering resource time includes assigning time slots t0+nt to t0+nt+t/2 to a first application and time slots t0+nt+t/2 to t0+ (n+1) T to a second application, where T0 is a reference time and n is a natural number, while using the total number of applications of the rendering resource m = 2.
  3. 3. The method of claim 2, wherein rendering frames of the multiple images comprises performing the following steps in a loop: Performing rendering of an image frame of a first application, comprising: Obtaining a token from the driver; if the token is successfully obtained, sampling the movement action of the mouse, and rendering the image frame of the first application program in the time slot allocated to the first application program according to the movement action of the mouse; releasing the token; performing rendering of the image frames of the second application, comprising: Obtaining a token from the driver; if the token is successfully obtained, sampling the movement action of the mouse, and rendering the image frame of the second application program in the time slot allocated to the second application program according to the movement action of the mouse; releasing the token.
  4. 4. The method of claim 1, wherein each slot includes a 1ms to 2ms safety margin for switching between different applications.
  5. 5. The method of claim 1, wherein in rendering the image frames of the plurality of applications, if the rendering time of the image frames for the applications exceeds 1ms of the corresponding time slot, the rendering is forcibly ended and the token is released.
  6. 6. The method of claim 1, wherein the rendering quality of the image frames of the respective application is reduced if the rendering time for the image frames of the application exceeds 1ms a plurality of times within the predetermined time Ts.
  7. 7. The method of claim 1, wherein the application is a game.
  8. 8. An electronic device, the electronic device comprising: One or more processors; a memory for storing executable instructions; the one or more processors are configured to implement the method of any of claims 1 to 7 via the executable instructions.
  9. 9. A computer readable storage medium having stored thereon a computer program, which, when executed by a processor, causes the processor to perform the method of any of claims 1 to 7.

Description

Multi-path image rendering method, device and medium Technical Field The application relates to the technical field of computer graphics, in particular to a multipath image rendering method. Background With the rapid development of virtual technology, the requirement for realizing multi-path image rendering on a single display card is increasing, and particularly in price sensitive fields such as cloud games, virtual desktops, multi-user sharing computing resources and the like, the requirement is more prominent. Currently, the mainstream implementation manner is to perform virtualized allocation on resources of a single GPU through a virtual platform. A user may run multiple applications on these virtual platforms, such as by means of a dock, virtual Machine (VM), etc., as well as running multiple games. In order to improve user experience, mainstream graphics card providers have proposed schemes for reducing the rendering delay of a single-path application, such as a Reflex technology of NVIDIA and an Anti-lag technology of AMD, which effectively reduce the input-rendering-display delay of the single-path application by optimizing a synchronization mechanism of a CPU and a GPU, reducing accumulation of rendering queues, and the like. However, in the prior art, when multiple applications share the GPU, a time slice scheduling mechanism is generally adopted, that is, the running time of the GPU is divided into a plurality of tiny time slots, and the tiny time slots are allocated to different applications for use in turn. This scheduling approach has the following significant drawbacks: 1. The rendering time of the single-path application is greatly prolonged, because a plurality of applications alternately occupy the micro time slot of the GPU, the rendering process of the single-frame image is divided into a plurality of discontinuous time slots, so that the actual rendering period of the single-path application is close to the sum of the rendering periods of all applications, for example, when a game with a double-path 30fps frame rate runs at the same time, the single-frame rendering time can be prolonged to more than 33ms from about 16 ms; 2. The input and rendering are asynchronous, namely, the application submits a rendering task after completing the sampling of input signals such as a mouse, a keyboard and the like on a CPU, and if the GPU is occupied by other applications at the moment, the rendering task needs to wait in a queue, so that the delay between the input signals and the final rendering result presentation is obviously increased, and the user experience is affected; 3. Queue accumulation exacerbates the delay that rendering tasks of multiple applications may accumulate in the GPU queue, further lengthening the overall delay input to the display, severely affecting the interactive delay-sensitive application experience of games, etc. Therefore, how to avoid the delay problem caused by time slicing scheduling on the premise that a single GPU supports multi-path application rendering, and to realize low-delay experience close to that of a single-path exclusive GPU becomes a problem to be solved in the prior art. Disclosure of Invention In view of the above, the present application provides a method, apparatus and medium for multi-path image rendering, so as to solve the above technical problems in the prior art. According to an aspect of the present application, there is provided a multi-path image rendering method, the frame rates of the multi-path images being the same and sharing the same GPU, the method comprising: Dividing rendering resource time, namely dividing a rendering period T into m time slots, wherein m is the total number of a plurality of application programs corresponding to a plurality of paths of images, and distributing time slots T0+nT+ (i-1) T/m to T0+nT+iT/m to an ith application program, wherein T0 is reference time, the value range of i is 1 to m, and n is a natural number; Rendering an image frame of a multi-path image, comprising performing the following steps for each application loop in turn: Obtaining a token from the driver; if the token is successfully obtained, sampling the movement action of the mouse, and rendering the image frames of the corresponding application program in the time slots allocated to the corresponding application program according to the movement action of the mouse; releasing the token. According to a preferred embodiment of the present application, the total number of applications simultaneously using rendering resources m=2, and dividing the rendering resource time includes assigning time slots t0+nt to t0+nt+t/2 to a first application, and assigning time slots t0+nt+t/2 to t0+ (n+1) T to a second application, where T0 is a reference time and n is a natural number. According to a preferred embodiment of the application, rendering frames of a multi-path image comprises performing the following steps in a loop: Performing rendering of an