GPU rendering control method and device, equipment and storage medium

By generating rendering wait events and trigger signals using the CPU, the problem of uncontrollable GPU rendering timing is solved, enabling flexible control of GPU rendering timing and synchronized display effects.

CN121961824APending Publication Date: 2026-05-01GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
Filing Date
2024-10-31
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

In the graphics processing process, the rendering timing of the GPU is uncontrollable, which makes it impossible for graphics developers to adjust and control the timing of GPU rendering.

Method used

The CPU generates rendering wait events and trigger signals to control the GPU's rendering timing. The specific steps include generating rendering wait events and sending them to the task execution thread, blocking the execution of rendering instructions, and sending a trigger signal to execute the rendering instructions when the rendering wait event is triggered.

Benefits of technology

It enables the CPU to control the GPU rendering timing, improving rendering flexibility and synchronized display effects, avoiding the direct execution of rendering instructions, and enhancing the ability to control rendering instructions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121961824A_ABST
    Figure CN121961824A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a GPU rendering control method and device, equipment and a storage medium, and the method comprises the steps: generating a rendering waiting event through a rendering thread under the condition that at least one rendering instruction is called through the rendering thread, and transmitting the rendering waiting event and the at least one rendering instruction to a task execution thread, the rendering waiting event is used for indicating the task execution thread to block execution of at least one rendering instruction; and under the condition that the rendering waiting event is triggered, sending a trigger signal to a task execution thread to enable the task execution thread to execute the at least one rendering instruction. According to the method, the CPU can trigger the execution of the GPU rendering task, and the CPU can control the rendering time sequence of the GPU.
Need to check novelty before this filing date? Find Prior Art

Description

A GPU rendering control method, apparatus, device, and storage medium Technical Field

[0001] This application relates to timing control technology, and includes, but is not limited to, a GPU rendering control method, apparatus, device, and storage medium. Background Technology

[0002] In the process of graphics processing using a graphics processing unit (GPU), a rendering thread is usually required to provide corresponding rendering instructions.

[0003] In related technologies, rendering is performed synchronously after the rendering instruction is sent to the corresponding task execution thread of the graphics processor. For the GPU task execution thread, the execution timing of the rendering is uncontrollable, which makes it impossible for graphics developers to adjust the timing of GPU rendering accordingly. Summary of the Invention

[0004] In view of this, the GPU rendering control method, apparatus, device, and storage medium provided in the embodiments of this application can be triggered by the CPU to execute GPU rendering tasks, and can realize the CPU's control over the GPU's rendering timing. The GPU rendering control method, apparatus, device, and storage medium provided in the embodiments of this application are implemented as follows:

[0005] One aspect of this application provides a GPU rendering control method applied to a central processing unit (CPU) of a terminal device. The terminal device further includes a graphics processing unit (GPU). The terminal device includes a rendering thread invoked by the CPU and a task execution thread invoked by the GPU. The method includes:

[0006] When at least one rendering instruction is invoked through the rendering thread, a rendering wait event is generated by the rendering thread, and the rendering wait event and at least one rendering instruction are sent to the task execution thread. The rendering wait event is used to instruct the task execution thread to block the execution of at least one rendering instruction.

[0007] When a rendering wait event is triggered, a trigger signal is sent to the task execution thread to cause the task execution thread to execute at least one rendering instruction.

[0008] Another aspect of this application provides a GPU rendering control method applied to a graphics processing unit (GPU) of a terminal device. The terminal device further includes a central processing unit (CPU), and includes a rendering thread invoked by the CPU and a task execution thread invoked by the GPU. The method includes:

[0009] Receive a render wait event and at least one render instruction sent by the render thread. The render wait event is used to instruct the task execution thread to block the execution of at least one render instruction.

[0010] Upon receiving a trigger signal, execute at least one rendering instruction. The trigger signal is sent when a rendering wait event is triggered.

[0011] Another aspect of the embodiments of this application also provides a GPU rendering control device, applied to the central processing unit (CPU) of a terminal device, the terminal device further includes a graphics processing unit (GPU), the terminal device includes a rendering thread invoked by the CPU and a task execution thread invoked by the GPU, the device includes: a rendering module and a triggering module;

[0012] The rendering module is used to generate a rendering wait event through the rendering thread when at least one rendering instruction is invoked through the rendering thread, and send the rendering wait event and at least one rendering instruction to the task execution thread. The rendering wait event is used to instruct the task execution thread to block the execution of at least one rendering instruction.

[0013] The trigger module is used to send a trigger signal to the task execution thread when a rendering wait event is triggered, so that the task execution thread executes at least one rendering instruction.

[0014] Another aspect of the embodiments of this application also provides a GPU rendering control device, applied to the graphics processor GPU of a terminal device. The terminal device also includes a central processing unit CPU. The terminal device includes a rendering thread called by the CPU and a task execution thread called by the GPU. The device includes: a waiting module and an execution module.

[0015] The waiting module is used to receive rendering wait events and at least one rendering instruction sent by the rendering thread. The rendering wait event is used to instruct the task execution thread to block the execution of at least one rendering instruction.

[0016] The execution module is used to execute at least one rendering instruction upon receiving a trigger signal, which is sent when a rendering wait event is triggered.

[0017] The computer device provided in this application includes a memory and a processor. The memory stores a computer program that can run on the processor, and the processor executes the program to implement the method of this application.

[0018] The computer-readable storage medium provided in this application embodiment stores a computer program thereon, which, when executed by a processor, implements the method provided in this application embodiment.

[0019] This application also provides a chip with a computer program stored on it, which implements the method provided in this application during operation.

[0020] The GPU rendering control method, apparatus, device, and storage medium provided in this application embodiment can generate a rendering wait event when at least one rendering instruction is called by a rendering thread, and send the rendering wait event and at least one rendering instruction to a task execution thread; when the rendering wait event is triggered, a trigger signal is sent to the task execution thread to cause the task execution thread to execute at least one rendering instruction. By generating a rendering wait event, the direct execution of rendering instructions can be avoided. Furthermore, when a rendering wait event is triggered, the execution of the rendering instruction can be indicated by sending a trigger signal, thereby allowing the CPU to trigger the execution of the GPU rendering task and enabling the CPU to control the rendering timing of the GPU. Attached Figure Description

[0021] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0022] Figure 1 is a schematic diagram of the application scenario provided in the embodiments of this application;

[0023] Figure 2 is a flowchart illustrating the GPU rendering control method applied to the CPU provided in the embodiments of this application;

[0024] Figure 3 is a schematic diagram of the logic for determining whether a command is a target rendering instruction according to an embodiment of this application;

[0025] Figure 4 is a schematic diagram of the logic for determining whether a rendering wait event has been triggered, provided in an embodiment of this application.

[0026] Figure 5 is a flowchart illustrating the GPU rendering control method applied to a GPU provided in the embodiments of this application;

[0027] Figure 6 is a schematic diagram of thread interaction provided in the embodiments of this application;

[0028] Figure 7 is a schematic diagram of the overall interaction flow of the GPU rendering control method provided in the embodiments of this application;

[0029] Figure 8 is a schematic diagram of the structure of the GPU rendering control device applied to the CPU provided in the embodiment of this application;

[0030] Figure 9 is a schematic diagram of the structure of the GPU rendering control device applied to the GPU provided in the embodiments of this application;

[0031] Figure 10 is a schematic diagram of the structure of the computer device provided in the embodiments of this application. Detailed Implementation

[0032] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the specific technical solutions of this application will be further described in detail below with reference to the accompanying drawings of the embodiments of this application. The following embodiments are used to illustrate this application, but are not intended to limit the scope of this application.

[0033] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.

[0034] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0035] It should be noted that the terms "first, second, third" used in the embodiments of this application are used to distinguish similar or different objects and do not represent a specific order of objects. It can be understood that "first, second, third" can be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.

[0036] In the process of graphics processing using a graphics processing unit (GPU), a rendering thread is usually required to provide corresponding rendering instructions.

[0037] In related technologies, rendering is performed synchronously after the rendering instruction is sent to the corresponding task execution thread of the graphics processor. For the GPU task execution thread, the execution timing of the rendering is uncontrollable, which makes it impossible for graphics developers to adjust the timing of GPU rendering accordingly.

[0038] To address the aforementioned problems in related technologies, this application provides a GPU rendering control method, the practical application scenarios of which will be explained below.

[0039] Figure 1 is a schematic diagram of the application scenario provided in the embodiment of this application. Referring to Figure 1, the scenario may include a terminal device, which may include: a central processing unit (CPU110) and a graphics processing unit (GPU120).

[0040] The CPU110 and GPU120 can be connected via a bus. In this scenario, the CPU110 is used to call rendering instructions and send rendering instructions to the GPU120. The GPU120 is used to execute the rendering instructions, thereby realizing the graphics rendering work.

[0041] It should be noted that the terminal device may include, but is not limited to, mobile phones, wearable devices (such as smartwatches, smart bracelets, smart glasses, etc.), tablets, laptops, in-vehicle terminals, PCs (Personal Computers), etc. The functions implemented by this method can be achieved by the processor in the terminal device calling program code. Of course, the program code can be stored in computer storage media. Therefore, the terminal device includes at least a processor and storage media.

[0042] The CPU110 can be the terminal device and the core processing unit, responsible for interpreting and executing instructions and processing data in the terminal device. The CPU110 controls various hardware components in the terminal device, such as memory, storage, and input / output devices, etc., without specific limitations.

[0043] GPU120 can be the display core, visual processor, or display chip of the terminal device. It is a microprocessor specifically designed to perform image and graphics-related calculations on the terminal device.

[0044] The following explains the specific implementation process of the GPU rendering control method for CPU provided in the embodiments of this application.

[0045] Figure 2 is a flowchart illustrating the GPU rendering control method applied to the CPU provided in this embodiment of the application. Referring to Figure 2, the method includes:

[0046] S210: When at least one rendering instruction is invoked through the rendering thread, a rendering wait event is generated through the rendering thread, and the rendering wait event and at least one rendering instruction are sent to the task execution thread.

[0047] Optionally, the execution entity of this method can be the aforementioned CPU. Multiple threads can be configured in the terminal device, such as a rendering thread and a task execution thread. The rendering thread can be a thread called by the CPU to implement the rendering instruction call; the task execution thread can be a thread called by the GPU to implement the rendering instruction execution.

[0048] In one embodiment, the rendering thread can sequentially call multiple rendering instructions in a preset order. Each rendering instruction can be used to indicate a rendering task. The GPU can call the task execution thread to execute the rendering instruction, thereby completing the corresponding rendering task.

[0049] For example, videos, animations, and dynamic effects displayed in an application on a terminal device can all be the result of executing one or more rendering instructions.

[0050] The rendering thread can generate a rendering wait event, which is associated with at least one rendering instruction preceding the generation of the rendering wait event. The rendering wait event is used to instruct the task execution thread to block the execution of at least one rendering instruction.

[0051] It should be noted that if there is a rendering instruction before the rendering wait event, the rendering wait event can be used to instruct the task execution thread to block the execution of this rendering instruction; if there are two or more rendering instructions before the rendering wait event, the rendering wait event can be used to instruct the task execution thread to block the execution of these two or more rendering instructions.

[0052] Optionally, the rendering wait event can be generated actively by the CPU, or triggered by user operation, or triggered by other threads in the CPU; no specific restrictions are imposed here.

[0053] It should be noted that after generating a render wait event, the render wait event, along with any invoked render instructions that were not yet sent to the task execution thread before the render wait event, can be sent to the task execution thread.

[0054] In one embodiment, since in related technologies, a rendering instruction is generated in the rendering thread and then transmitted to the task execution thread, in order to prevent all invoked rendering instructions from being sent to the task execution thread before the rendering wait event is generated, the rendering thread can be configured accordingly. For example, it can be configured that rendering instructions generated after a certain time will not be sent to the task execution thread; or, it can be configured that after generating a certain type of rendering instruction, the rendering instruction or type of rendering instruction will not be sent to the task execution thread. No specific restrictions are imposed here, and one of the methods can be selected according to actual needs to achieve the retention of rendering instructions in the rendering thread.

[0055] For example, after a render wait event is generated, if there are two render instructions, render instruction A and render instruction B, that have been invoked but not yet sent to the task execution thread before the render wait event, then the render wait event, along with render instructions A and B, can be sent to the task execution thread.

[0056] It should be noted that since the function of the rendering wait event is to block the execution of other rendering instructions sent at the same time, after the task execution thread receives the rendering wait event, it can block the execution of other rendering instructions.

[0057] For example, if the rendering thread sends a render wait event along with render instruction A and render instruction B to the task execution thread, the task execution thread can block the execution of render instruction A and render instruction B based on the render wait event.

[0058] It should be noted that there may be multiple different task execution threads in a GPU. Render wait events will only prevent the execution of rendering instructions sent with it, and will not prevent the execution of rendering instructions in other threads.

[0059] S220: When a rendering wait event is triggered, send a trigger signal to the task execution thread to cause the task execution thread to execute at least one rendering instruction.

[0060] It should be noted that the CPU can detect whether a rendering wait event has been triggered. For example, it can determine whether a rendering wait event has been triggered by receiving a certain instruction or by the completion of a preset event. Alternatively, after generating the rendering wait event, a clock can be set, and the rendering wait event can be triggered after a certain time. No specific restrictions are imposed here; one of the methods for triggering the rendering wait event can be chosen according to actual needs.

[0061] When a rendering wait event is triggered, the CPU can send a trigger signal to the task execution thread, which can be used to instruct the task execution thread to stop blocking rendering instructions and instead execute the blocked rendering instructions.

[0062] For example, if the rendering thread sends a rendering wait event along with rendering instructions A and B to the task execution thread, the task execution thread can block the execution of rendering instructions A and B based on the rendering wait event before receiving the trigger signal. After receiving the trigger signal, the task execution thread can stop blocking and execute rendering instructions A and B instead.

[0063] It should be noted that the CPU of a terminal device can trigger the execution of rendering instructions in the GPU by means of a trigger signal. The generation time of the trigger signal can be actively controlled by the CPU. Therefore, it is possible to enable the CPU to trigger the execution of GPU rendering tasks and to control the rendering timing of the GPU.

[0064] The GPU rendering control method provided in this application embodiment can generate a rendering wait event when at least one rendering instruction is called by a rendering thread, and send the rendering wait event and at least one rendering instruction to a task execution thread. When the rendering wait event is triggered, a trigger signal is sent to the task execution thread to cause the task execution thread to execute at least one rendering instruction. By generating a rendering wait event, the direct execution of rendering instructions can be avoided. Furthermore, when a rendering wait event is triggered, a trigger signal can be sent to indicate that the rendering instruction is being executed, allowing the CPU to trigger the execution of the GPU rendering task and enabling the CPU to control the GPU rendering timing.

[0065] The following explains one feasible implementation of the generation of rendering wait events provided in the embodiments of this application.

[0066] It should be noted that the terminal device also includes the target thread invoked by the CPU.

[0067] The target thread can be a thread synchronized with the rendering thread. The target thread can be used to execute any other tasks, such as calling other types of instructions, monitoring the process of a certain event, etc., without specific restrictions.

[0068] Optionally, before generating the render wait event via the render thread, the method further includes: creating a software synchronization handle (sw sync) via the target thread.

[0069] It should be noted that the software synchronization sw sync handle can be a general synchronization mechanism handle, through which rendering wait events can be generated.

[0070] For example, a software synchronization swsync handle can be created by user triggering or by the target thread actively generating it.

[0071] It should be noted that the sw sync handle can provide a set of APIs (Application Programming Interfaces), and the rendering thread and the target thread can be synchronized through these APIs.

[0072] Correspondingly, the rendering thread generates rendering wait events, including controlling the rendering thread to call the sw sync handle to generate rendering wait events.

[0073] It should be noted that after the target thread creates the sw sync handle, the rendering thread can call the sw sync handle, and the rendering thread can generate a rendering wait event after calling the handle.

[0074] In one embodiment, the sw sync handle can be a handle applicable within the CPU. By creating this handle, the generation of rendering wait events can be realized, and the timing control of the GPU rendering thread can be realized, such as controlling the blocking of rendering instructions.

[0075] In a GPU rendering control method provided in this application embodiment, a software synchronization handle (swsync) can be created through a target thread; the rendering thread is then controlled to call the swsync handle to generate rendering wait events. The generation of rendering wait events is achieved through the software synchronization handle (swsync), thereby enabling timing control of GPU rendering by the CPU.

[0076] The following explains one feasible implementation of the target rendering instruction provided in the embodiments of this application.

[0077] Figure 3 is a logical diagram illustrating the determination of whether it is a target rendering instruction provided in an embodiment of this application. Referring to Figure 3, before generating a rendering wait event through the rendering thread, the method further includes:

[0078] S310: Determine whether at least one rendering instruction is a target rendering instruction.

[0079] Among them, the target rendering instruction is the instruction that is processed synchronously with the rendering instruction currently being executed by the GPU.

[0080] Optionally, the rendering instruction currently being executed by the GPU can be an instruction being executed by another thread of the GPU. During the execution process, the GPU can call multiple different task execution threads to execute different rendering instructions.

[0081] For example, rendering instruction C is the instruction that the GPU is executing for rendering, such as an instruction to render a short video; rendering instruction A is an instruction in the rendering thread, such as an instruction to display animation on top of the short video. In this case, it can be determined that rendering instruction A and rendering instruction C are synchronously processed instructions, that is, it can be determined that rendering instruction A is the target rendering instruction; rendering instruction B is another instruction in the rendering thread, such as an instruction to display animation in music software. It can be determined that rendering instruction B and rendering instruction C are not synchronously processed instructions, that is, it can be determined that rendering instruction B is not the target rendering instruction.

[0082] In one feasible embodiment, a rendering wait event and at least one target rendering instruction can be sent to the task execution thread to achieve blocking execution of the target rendering instruction.

[0083] It should be noted that when there are multiple rendering instructions, it can be determined whether each rendering instruction is a target rendering instruction. If it is, it can be sent together during the transmission of rendering wait events. If it is not a target rendering instruction, it can be kept in the rendering thread and not sent to the task execution thread.

[0084] It should be noted that the CPU can determine whether a rendering instruction is the target rendering instruction based on the relationship between rendering instructions generated by different threads.

[0085] Optionally, in actual implementation, selecting synchronously processed rendering instructions as target rendering instructions is only one approach. In actual implementation, other custom conditions can also be used to determine whether each rendering instruction is a target rendering instruction.

[0086] Correspondingly, the rendering thread calls the sw sync handle to generate rendering wait events, including:

[0087] S320: When at least one rendering instruction is the target rendering instruction, control the rendering thread to call the sw sync handle to generate a rendering wait event.

[0088] It should be noted that during the process of generating the wait event, it is possible to first determine whether there is a target rendering instruction.

[0089] For example, if there is a rendering instruction, and that rendering instruction is the target rendering instruction, the rendering thread can be controlled to call the sw sync handle to generate a rendering wait event.

[0090] For example, if there are multiple rendering instructions, as long as there is a target rendering instruction among these instructions, the rendering thread can be controlled to call the sw sync handle to generate a rendering wait event.

[0091] In the GPU rendering control method provided in this application embodiment, it is possible to determine whether at least one rendering instruction is a target rendering instruction; if at least one rendering instruction is a target rendering instruction, the rendering thread is controlled to call the swsync handle to generate a rendering wait event. Specifically, generating the rendering wait event when the rendering instruction is determined to be a target rendering instruction ensures that the rendering instruction corresponding to the generated rendering wait event is a synchronization instruction for other instructions that need to be rendered, thereby enabling more accurate and appropriate control of CPU-GPU synchronous rendering and improving the synchronous display effect of GPU rendering.

[0092] In one embodiment, after determining whether at least one rendering instruction is a target rendering instruction, the method includes:

[0093] S330: If the rendering instruction is not the target rendering instruction, the rendering instruction will continue to be called through the rendering thread.

[0094] It should be noted that if it is determined that the rendering instruction is not the target rendering instruction, the generation of the rendering wait event can be skipped, and the rendering thread can be allowed to continue calling the rendering instruction instead.

[0095] For example, if there is a rendering instruction that is not the target rendering instruction, the rendering thread can continue to call the rendering instruction.

[0096] For example, if there are multiple rendering instructions, and none of these rendering instructions are the target rendering instructions, then the rendering thread can continue to call the rendering instructions.

[0097] It should be noted that in the relevant technologies, the rendering thread and the task execution thread need to perform rendering synchronously during their operation. For example, after the rendering thread generates rendering instruction A, it needs to send rendering instruction A to the task execution thread. After the task execution thread finishes execution, it sends a synchronization message to the rendering thread. After receiving the synchronization message, the rendering thread can continue to call rendering instructions, such as calling rendering instruction B. That is to say, in the relevant technologies, the rendering thread needs to complete the next rendering instruction call based on the synchronization message returned by the task execution thread. After the target rendering instruction is determined, it does not need to wait for the synchronization message sent by the task execution thread; the rendering thread can continue to execute the subsequent rendering instruction calls.

[0098] The GPU rendering control method provided in this application embodiment allows rendering instructions to continue being called through the rendering thread even when the rendering instruction is not the target rendering instruction. This method of continuing to call rendering instructions through the rendering thread eliminates the need for synchronization with the task execution thread, avoiding blocking of the rendering thread and allowing it to more flexibly implement rendering instruction calls.

[0099] The following is a schematic diagram illustrating one possible process for determining whether a rendering wait event has been triggered, provided in an embodiment of this application.

[0100] Figure 4 is a schematic diagram of the logic for determining whether a rendering wait event has been triggered according to an embodiment of this application. Referring to Figure 4, before sending a trigger signal to the task execution thread when the rendering wait event has been triggered, the method further includes:

[0101] S410: Monitor whether the rendering wait event is triggered via the target thread.

[0102] It should be noted that, in actual implementation, the target thread can be used to monitor the triggering of rendering wait events to determine whether the rendering wait events have been triggered.

[0103] There are several possible scenarios in which the rendering wait event can be triggered. For example, the target thread can monitor the timing clock, and once the clock reaches a certain time, it can be determined that the rendering wait event has been triggered.

[0104] Alternatively, user-triggered actions can be monitored. If a user-triggered action is detected, it can be determined that a rendering wait event has been triggered.

[0105] In one embodiment, monitoring whether a rendering wait event is triggered via a target thread includes: monitoring whether there is a trigger instruction corresponding to a triggering operation via the target thread; and determining that a rendering wait event is triggered if a trigger instruction exists.

[0106] It should be noted that trigger controls can be set in the display interface of the terminal device. After the user clicks the trigger control, a trigger command is generated. This trigger command is the trigger instruction corresponding to the trigger operation, and its existence can be monitored through the target thread. Specifically, if the trigger control is not operated, no corresponding trigger command will exist; only after the trigger control is triggered will the corresponding trigger command be generated.

[0107] If the target thread detects a triggering instruction, it can be determined that the rendering wait event is being penalized.

[0108] Optionally, the target thread can be monitored in real time, so that it can be monitored immediately after the trigger command is generated; or it can be monitored periodically to determine whether the trigger command exists at regular intervals.

[0109] In addition to the methods mentioned above, the target thread can also monitor whether a certain event or task has been completed, thereby enabling monitoring of rendering wait events.

[0110] For example, after the target rendering instruction is sent to the task execution thread, the target thread can monitor whether the resources required by the target rendering instruction have been loaded when it is executed; if so, it can determine that the rendering wait event has been triggered; conversely, if they have not been loaded, it can determine that the rendering wait event has not been triggered.

[0111] For example, if there are two target rendering instructions, namely rendering instruction A and rendering instruction B, the target thread can monitor whether the resources required by rendering instruction A and rendering instruction B have been loaded when they are executed. If both have been loaded, it can be determined that the rendering wait event has been triggered.

[0112] Accordingly, when a rendering wait event is triggered, a trigger signal is sent to the task execution thread, including:

[0113] S420: When a rendering wait event is triggered, generate and send a trigger signal via the target thread.

[0114] It should be noted that after the rendering wait event is triggered, a trigger signal can be generated by the target thread and sent to the task execution thread. Correspondingly, after receiving the trigger signal sent by the target thread, the task execution thread can execute the rendering of the target rendering instruction.

[0115] In the GPU rendering control method provided in this application embodiment, a target thread can monitor whether a rendering wait event is triggered; when a rendering wait event is triggered, a trigger signal is generated and sent by the target thread. Monitoring the rendering wait event and generating the trigger signal by the target thread allows for more accurate and faster generation of the trigger signal without affecting the rendering thread's operation, thus enabling more flexible GPU rendering control.

[0116] The above process mainly focuses on the implementation process of the CPU in the terminal device to implement the GPU rendering control method. The following explains the implementation process of the GPU rendering control method applied to the GPU provided in the embodiments of this application.

[0117] Figure 5 is a flowchart illustrating a GPU rendering control method applied to a GPU provided in an embodiment of this application. Referring to Figure 5, the method includes:

[0118] S510: Receives a rendering wait event and at least one rendering instruction sent by the rendering thread.

[0119] The render wait event is used to instruct the task execution thread to block the execution of at least one render instruction.

[0120] It should be noted that the GPU can receive rendering wait events and at least one rendering instruction sent by the rendering thread by calling the task execution thread.

[0121] After receiving a rendering wait event and at least one rendering instruction, the GPU can block the execution of the rendering instruction based on the rendering wait event. For example, if the task execution thread receives a rendering wait event and rendering instructions A and B, it can block the execution of rendering instructions A and B based on the rendering wait event, causing rendering instructions A and B to be in a waiting state.

[0122] S520: Upon receiving a trigger signal, execute at least one rendering instruction.

[0123] The trigger signal is sent when a rendering wait event is triggered.

[0124] It should be noted that the task execution thread can also receive trigger signals sent by the CPU. After the rendering wait event is triggered, the CPU can send a trigger signal to the task execution thread. After receiving the trigger signal, the task execution thread can stop blocking the rendering instructions and start executing the corresponding rendering instructions.

[0125] For example, if the task execution thread receives a rendering wait event and rendering instructions A and B, it can stop blocking rendering instructions A and B based on the trigger instruction and instead execute rendering instructions A and B.

[0126] It should be noted that multiple rendering instructions can be transmitted in a preset order, such as executing rendering instruction A first and then rendering instruction B, or executing rendering instruction B first and then rendering instruction A. The task execution thread can execute these instructions sequentially according to the transmission order.

[0127] Optionally, the execution order of these waiting rendering instructions can also be set in the rendering wait event. If the task execution thread receives a trigger signal, it can execute rendering instruction A and rendering instruction B according to the execution order in the rendering wait event. There are no specific restrictions here, and one of the execution orders can be selected to complete the execution of these rendering instructions.

[0128] The GPU rendering control method provided in this embodiment can receive a rendering wait event and at least one rendering instruction sent by the rendering thread; upon receiving a trigger signal, it executes at least one rendering instruction. The rendering wait event is used to instruct the task execution thread to block the execution of at least one rendering instruction; the trigger signal is sent when the rendering wait event is triggered. The CPU can control the GPU rendering timing through the rendering wait event and the trigger signal, thereby enabling more flexible execution of rendering instructions.

[0129] In one embodiment, the terminal device further includes a target thread invoked by the CPU, which executes at least one rendering instruction upon receiving a trigger signal, including: upon receiving a trigger signal sent by the target thread, executing at least one rendering instruction, wherein the target thread is used to create a software synchronization swsync handle and control the rendering thread to invoke the swsync handle to generate a rendering wait event.

[0130] It should be noted that the trigger signal can be a signal sent by the target thread in the terminal device. The target thread can be another thread called by the CPU, and the target thread can be a synchronous thread with the rendering thread.

[0131] For example, in a terminal device, a target thread can be set for each rendering thread, so that trigger signals can be generated and transmitted through the target thread.

[0132] Optionally, the target thread can also create a software synchronization handle (swsync) and control the rendering thread to call the swsync handle to generate a rendering wait event, thereby causing the rendering thread to send the rendering wait event and at least one rendering instruction to the task execution thread.

[0133] In the GPU rendering control method provided in this application embodiment, at least one rendering instruction can be executed upon receiving a trigger signal sent by a target thread. The target thread is used to create a software synchronization handle (sw sync) and control the rendering thread to call the sw sync handle to generate rendering wait events. The target thread allows for more accurate and flexible control of the CPU's rendering timing over the GPU.

[0134] To more clearly explain the interaction between the multiple threads provided in the embodiments of this application, the following explains the interaction process between the rendering thread, the target thread, and the task execution thread provided in the embodiments of this application.

[0135] Figure 6 is a schematic diagram of thread interaction provided in an embodiment of this application. Referring to Figure 6, the method includes:

[0136] S610: Software synchronization handle created by the target thread.

[0137] S620: The rendering thread calls the sw sync handle to generate a rendering wait event.

[0138] S630: The rendering thread sends the rendering wait event and at least one rendering instruction to the task execution thread.

[0139] S640: The execution of rendering instructions is blocked by the task execution thread.

[0140] S650: The target thread generates a trigger signal and sends it to the task execution thread.

[0141] S660: At least one rendering instruction is executed by the task execution thread.

[0142] It should be noted that the above steps S610-S660 have been explained in the previous embodiments and will not be repeated here. Figure 6 shows the interaction relationship between the three threads.

[0143] The following section will explain in detail the steps that need to be executed by the three threads during the interaction process in this embodiment of the application.

[0144] Figure 7 is a schematic diagram of the overall interaction flow of the GPU rendering control method provided in the embodiments of this application. Please refer to Figure 7. Figure 7 is explained using the example of rendering instruction A and rendering instruction B in the rendering thread. For three different threads:

[0145] After receiving a rendering wait event, the task execution thread can put rendering instruction A and rendering instruction B into a waiting state. After receiving a trigger signal, it can start executing rendering instruction A and rendering instruction B. After execution is complete, it can execute other instructions.

[0146] The rendering thread can sequentially call rendering instruction A and rendering instruction B. If rendering instruction A and rendering instruction B are determined to be target rendering instructions, it calls the software synchronization handle (sw sync) created by the target thread to generate a rendering wait event. This rendering wait event, along with rendering instructions A and B, can then be sent to the task execution thread. After sending, or if the instruction is not the target rendering instruction, other rendering instructions can be called.

[0147] The target thread can execute its own thread tasks and create a software synchronization handle (sw sync). It can then monitor whether rendering wait events are triggered. If not, it can continue to execute its own thread tasks. If triggered, it can generate a trigger signal and send the signal to the task execution thread, after which it can execute other tasks.

[0148] It should be understood that although the steps in the above flowcharts are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the above flowcharts may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.

[0149] Based on the foregoing embodiments, this application provides a GPU rendering control device, which includes various modules and units included in each module, and can be implemented by a processor; of course, it can also be implemented by specific logic circuits; in the implementation process, the processor can be a central processing unit (CPU), microprocessor (MPU), digital signal processor (DSP) or field programmable gate array (FPGA), etc.

[0150] Figure 8 is a schematic diagram of the structure of the GPU rendering control device applied to the CPU provided in the embodiment of this application. Referring to Figure 8, the device is a central processing unit (CPU) applied to a terminal device. The terminal device also includes a graphics processing unit (GPU). The terminal device includes a rendering thread called by the CPU and a task execution thread called by the GPU. The device includes: a rendering module 810 and a triggering module 820.

[0151] The rendering module 810 is used to generate a rendering wait event through the rendering thread when at least one rendering instruction is called through the rendering thread, and send the rendering wait event and at least one rendering instruction to the task execution thread. The rendering wait event is used to instruct the task execution thread to block the execution of at least one rendering instruction.

[0152] Trigger module 820 is used to send a trigger signal to the task execution thread when a rendering wait event is triggered, so that the task execution thread executes at least one rendering instruction.

[0153] In one embodiment, the terminal device further includes a target thread invoked by the CPU, and a rendering module 810, which is also used to create a software synchronization sw sync handle through the target thread; and to control the rendering thread to invoke the sw sync handle to generate rendering wait events.

[0154] In one embodiment, the rendering module 810 is further configured to determine whether at least one rendering instruction is a target rendering instruction, wherein the target rendering instruction is an instruction that is processed synchronously with the instruction currently being rendered by the GPU; if at least one rendering instruction is a target rendering instruction, the rendering thread is controlled to call the sw sync handle to generate a rendering wait event.

[0155] In one embodiment, the rendering module 810 is further configured to continue calling the rendering instruction through the rendering thread if the rendering instruction is not the target rendering instruction.

[0156] In one embodiment, the triggering module 820 is further configured to monitor whether a rendering wait event is triggered via the target thread; and if a rendering wait event is triggered, to generate and send a trigger signal via the target thread.

[0157] In one embodiment, the triggering module 820 is specifically used to monitor whether there is a triggering instruction corresponding to the triggering operation through the target thread; if there is a triggering instruction, it determines that the rendering wait event has been triggered.

[0158] The GPU rendering control device provided in this application embodiment can generate a rendering wait event when at least one rendering instruction is called through a rendering thread, and send the rendering wait event and at least one rendering instruction to a task execution thread; when the rendering wait event is triggered, a trigger signal is sent to the task execution thread to cause the task execution thread to execute at least one rendering instruction. By generating a rendering wait event, the direct execution of rendering instructions can be avoided. Furthermore, when a rendering wait event is triggered, the execution of the rendering instruction can be indicated by sending a trigger signal, thereby allowing the CPU to trigger the execution of the GPU rendering task and enabling the CPU to control the rendering timing of the GPU.

[0159] Figure 9 is a schematic diagram of the structure of the GPU rendering control device applied to the GPU provided in the embodiment of this application. Referring to Figure 9, the GPU rendering control device is applied to the graphics processor GPU of the terminal device. The terminal device also includes a central processing unit CPU. The terminal device includes a rendering thread called by the CPU and a task execution thread called by the GPU. The device includes: a waiting module 910 and an execution module 920.

[0160] The waiting module 910 is used to receive a rendering wait event and at least one rendering instruction sent by the rendering thread. The rendering wait event is used to instruct the task execution thread to block the execution of at least one rendering instruction.

[0161] The execution module 920 is used to execute at least one rendering instruction upon receiving a trigger signal, which is sent when a rendering wait event is triggered.

[0162] In one embodiment, the terminal device further includes a target thread invoked by the CPU, and an execution module 920, specifically used to execute at least one rendering instruction upon receiving a trigger signal sent by the target thread. The target thread is used to create a software synchronization handle (sw sync) and control the rendering thread to invoke the sw sync handle to generate a rendering wait event.

[0163] The GPU rendering control device provided in this embodiment can receive rendering wait events and at least one rendering instruction sent by the rendering thread; and execute at least one rendering instruction upon receiving a trigger signal. The rendering wait event is used to instruct the task execution thread to block the execution of at least one rendering instruction; the trigger signal is sent when the rendering wait event is triggered. The CPU can control the GPU rendering timing through the rendering wait event and the trigger signal, thereby enabling more flexible execution of rendering instructions.

[0164] The descriptions of the above device embodiments are similar to those of the above method embodiments, and have similar beneficial effects. For technical details not disclosed in the device embodiments of this application, please refer to the descriptions of the method embodiments of this application for understanding.

[0165] It should be noted that the module division of the GPU rendering control device shown in Figures 8 or 9 of this application embodiment is illustrative and only represents one logical functional division. In actual implementation, there may be other division methods. Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, exist as separate physical units, or have two or more units integrated into one unit. The integrated units can be implemented in hardware, as software functional units, or a combination of software and hardware.

[0166] It should be noted that, in the embodiments of this application, if the above-described methods are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, or the parts that contribute to related technologies, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause an electronic device to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), magnetic disks, or optical disks. Thus, the embodiments of this application are not limited to any specific hardware and software combination.

[0167] Figure 10 is a schematic diagram of the structure of the computer device provided in this embodiment of the application. Referring to Figure 10, this embodiment of the application provides a computer device, which can be the terminal device described above, and its internal structure diagram is shown in Figure 10. The computer device includes a processor 1020, a memory, and a network interface 1040 connected via a system bus 1010. The processor 1020 of the computer device provides computing and control capabilities. The memory of the computer device includes a non-volatile storage medium 1031 and an internal memory 1032. The non-volatile storage medium 1031 stores an operating system, computer programs, and a database. The internal memory 1032 provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database of the computer device is used to store data. The network interface 1040 of the computer device is used to communicate with external terminals via a network connection. When the computer program is executed by the processor 1020, it implements the above-described method.

[0168] This application provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the method provided in the above embodiments.

[0169] This application provides a computer program product containing instructions that, when run on a computer, cause the computer to perform the steps in the method provided in the above-described method embodiments.

[0170] This application also provides a chip with a computer program stored on it, which implements the method provided in this application during operation.

[0171] Those skilled in the art will understand that the structure shown in Figure 10 is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or may combine certain components, or may have different component arrangements.

[0172] In one embodiment, the GPU rendering control device provided in this application can be implemented as a computer program, which can run on the computer device shown in FIG10. The memory of the computer device can store the various program modules that make up the above-described device. The computer program composed of the various program modules causes the processor to execute the steps in the methods of the various embodiments of this application described in this specification.

[0173] It should be noted that the descriptions of the storage medium and device embodiments above are similar to the descriptions of the method embodiments above, and have similar beneficial effects. For technical details not disclosed in the storage medium, storage medium, and device embodiments of this application, please refer to the descriptions of the method embodiments of this application for understanding.

[0174] It should be understood that the phrases "one embodiment," "an embodiment," or "some embodiments" mentioned throughout the specification mean that a specific feature, structure, or characteristic related to an embodiment is included in at least one embodiment of this application. Therefore, "in one embodiment," "in one embodiment," or "in some embodiments" appearing throughout the specification do not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. It should be understood that in the various embodiments of this application, the sequence numbers of the above-described processes do not imply a sequential order of execution; the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application. The sequence numbers of the above-described embodiments are merely for descriptive purposes and do not represent the superiority or inferiority of the embodiments. The descriptions of the various embodiments above tend to emphasize the differences between the various embodiments; their similarities or commonalities can be referred to mutually, and for the sake of brevity, they will not be repeated here.

[0175] In this article, the term "and / or" is merely a description of the relationship between related objects, indicating that there can be three kinds of relationships. For example, object A and / or object B can represent three situations: object A exists alone, object A and object B exist simultaneously, and object B exists alone.

[0176] It should be noted that, in this document, 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. Unless otherwise specified, 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 that element.

[0177] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The embodiments described above are merely illustrative. For example, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple modules or components can be combined, or integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed can be through some interfaces, and the indirect coupling or communication connection between devices or modules can be electrical, mechanical, or other forms.

[0178] The modules described above as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules. They may be located in one place or distributed across multiple network units. Some or all of the modules may be selected to achieve the purpose of this embodiment according to actual needs.

[0179] In addition, each functional module in the various embodiments of this application can be integrated into one processing unit, or each module can be a separate unit, or two or more modules can be integrated into one unit; the integrated modules can be implemented in hardware or in the form of hardware plus software functional units.

[0180] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media that can store program code, such as mobile storage devices, read-only memory (ROM), magnetic disks, or optical disks.

[0181] Alternatively, if the integrated units described above are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, or the parts that contribute to related technologies, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause an electronic device to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROMs, magnetic disks, or optical disks.

[0182] The methods disclosed in the several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.

[0183] The features disclosed in the several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.

[0184] The features disclosed in the several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method or device embodiments.

[0185] The above description is merely an embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A GPU rendering control method, characterized in that, A central processing unit (CPU) is applied to a terminal device, the terminal device further including a graphics processing unit (GPU), the terminal device including a rendering thread invoked by the CPU and a task execution thread invoked by the GPU, the method comprising: when at least one rendering instruction is invoked by the rendering thread, generating a rendering wait event by the rendering thread, and sending the rendering wait event and the at least one rendering instruction to the task execution thread, the rendering wait event being used to instruct the task execution thread to block the execution of the at least one rendering instruction; when the rendering wait event is triggered, sending a trigger signal to the task execution thread to cause the task execution thread to execute the at least one rendering instruction.

2. The method according to claim 1, characterized in that, The terminal device further includes a target thread invoked by the CPU. Before generating a rendering wait event through the rendering thread, the method further includes: creating a software synchronization SW sync handle through the target thread; generating a rendering wait event through the rendering thread includes: controlling the rendering thread to invoke the SW sync handle to generate a rendering wait event.

3. The method according to claim 2, characterized in that, Before generating the rendering wait event through the rendering thread, the method further includes: determining whether the at least one rendering instruction is a target rendering instruction, wherein the target rendering instruction is an instruction that is processed synchronously with the instruction currently being rendered by the GPU; controlling the rendering thread to call the swsync handle to generate the rendering wait event includes: when the at least one rendering instruction is a target rendering instruction, controlling the rendering thread to call the swsync handle to generate the rendering wait event.

4. The method according to claim 3, characterized in that, After determining whether the at least one rendering instruction is a target rendering instruction, the method includes: if the rendering instruction is not a target rendering instruction, continuing to call the rendering instruction through the rendering thread.

5. The method according to claim 2, characterized in that, Before sending a trigger signal to the task execution thread when the rendering wait event is triggered, the method further includes: monitoring whether the rendering wait event is triggered through the target thread; sending a trigger signal to the task execution thread when the rendering wait event is triggered includes: generating and sending the trigger signal through the target thread when the rendering wait event is triggered.

6. The method according to claim 5, characterized in that, The step of monitoring whether the rendering wait event is triggered through the target thread includes: monitoring whether there is a trigger instruction corresponding to the triggering operation through the target thread; and determining that the rendering wait event is triggered if the trigger instruction exists.

7. A GPU rendering control method, characterized in that, A graphics processing unit (GPU) is applied to a terminal device, the terminal device further comprising a central processing unit (CPU), the terminal device including a rendering thread invoked by the CPU and a task execution thread invoked by the GPU, the method comprising: receiving a rendering wait event and at least one rendering instruction sent by the rendering thread, the rendering wait event being used to instruct the task execution thread to block the execution of the at least one rendering instruction; and executing the at least one rendering instruction upon receiving a trigger signal, the trigger signal being sent upon the rendering wait event being triggered.

8. The method according to claim 7, characterized in that, The terminal device further includes a target thread invoked by the CPU. The step of executing the at least one rendering instruction upon receiving a trigger signal includes: executing the at least one rendering instruction upon receiving a trigger signal sent by the target thread, wherein the target thread is used to create a software synchronization handle (sw sync) and control the rendering thread to invoke the sw sync handle to generate the rendering wait event.

9. A GPU rendering control device, characterized in that, A central processing unit (CPU) for use in a terminal device, the terminal device further including a graphics processing unit (GPU), the terminal device including a rendering thread invoked by the CPU and a task execution thread invoked by the GPU, the device including: a rendering module and a triggering module; the rendering module is configured to generate a rendering wait event through the rendering thread when at least one rendering instruction is invoked through the rendering thread, and send the rendering wait event and the at least one rendering instruction to the task execution thread, the rendering wait event being used to instruct the task execution thread to block the execution of the at least one rendering instruction; the triggering module is configured to send a trigger signal to the task execution thread when the rendering wait event is triggered, so that the task execution thread executes the at least one rendering instruction.

10. A GPU rendering control device, characterized in that, A graphics processing unit (GPU) for use in a terminal device, the terminal device further comprising a central processing unit (CPU), the terminal device including a rendering thread invoked by the CPU and a task execution thread invoked by the GPU, the device comprising: a waiting module and an execution module; the waiting module being configured to receive a rendering wait event and at least one rendering instruction sent by the rendering thread, the rendering wait event being configured to instruct the task execution thread to block the execution of the at least one rendering instruction; the execution module being configured to execute the at least one rendering instruction upon receiving a trigger signal, the trigger signal being sent upon the rendering wait event being triggered.

11. A computer device comprising a memory and a processor, the memory storing a computer program executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the method according to any one of claims 1-6 or 7-8.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1-6 or 7-8.