Dual-thread rendering method, device and storage medium

Through the dual-thread rendering method, the rendering thread and logical thread are configured to fully utilize the resources of the CPU and GPU during the image rendering process, solving the problem of low image rendering rate in the prior art, and achieving more efficient image rendering.

CN114140312BActive Publication Date: 2025-04-29GAODING XIAMEN TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111492768.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-08
Publication Date
2025-04-29
Estimated Expiration
2041-12-08

AI Technical Summary

Technical Problem

In the prior art, in the process of image rendering, processing resources of CPU and GPU cannot be fully utilized, resulting in a decrease in image rendering rate.

Method used

The dual-thread rendering method is adopted, and by configuring the rendering thread and logical thread, the image preparation and rendering can be performed simultaneously, improving the utilization rate of CPU and GPU.

Benefits of technology

The image rendering efficiency is improved, and the resources of the processing equipment are fully utilized by processing data in parallel.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114140312B_ABST
    Figure CN114140312B_ABST
Patent Text Reader

Abstract

The present invention provides a dual-thread rendering method, device and storage medium, which pre-configure a rendering thread and a logical thread, wherein the rendering thread is composed of a first rendering CPU and a first rendering GPU, and the logical thread is composed of a first processing CPU. The dual-thread rendering is performed through the following steps, including: the first processing CPU in the logical thread receives first preparation frame data in a queue, and the first processing CPU performs preparation processing on the first preparation frame data and then sends a logical signal and the processed first preparation frame data to the rendering thread; after receiving the logical signal, the first rendering CPU in the rendering thread sends the first preparation frame data sent together with the logical signal to the first rendering GPU for rendering processing, and after sending the first preparation frame data to the first rendering GPU for rendering processing, the first rendering CPU sends a rendering signal to the first processing CPU in the logical thread; the first processing CPU in the logical thread performs preparation processing on the second preparation frame data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image rendering technology, and in particular to a dual-thread rendering method, device and storage medium. Background Art

[0002] Image rendering is an important technology in image processing, and people usually use image rendering programs / software to render images.

[0003] When rendering an image, the prior art forms a rendering thread based on a single number of CPUs and GPUs. That is, when multiple images in a queue need to be rendered separately, the CPU first needs to prepare the first image in the queue, and the GPU is idle at this time. After the CPU prepares the first image, the CPU sends the first image after preparation to the GPU, and the GPU renders the first image after preparation. At this time, the CPU is idle. After the GPU renders the first image after preparation, the GPU sends a completion signal to the CPU, and the CPU prepares the second image in the queue, and so on. This is repeated to render all the images in the queue in sequence.

[0004] In the rendering method of the prior art, when the CPU is preparing to process an image, the GPU will be in an idle state, and when the GPU is rendering an image, the CPU will be in an idle state. This situation results in the inability to fully utilize the processing resources of the processing device during the image rendering process, that is, the image preparation processing and rendering cannot be performed at the same time, which reduces the image rendering rate. Summary of the invention

[0005] The embodiments of the present invention provide a dual-thread rendering method, device and storage medium, which can improve the utilization rate of the CPU and GPU through a dual-threaded manner, so that image preparation processing and image rendering can be performed simultaneously, thereby improving the image rendering efficiency.

[0006] A first aspect of an embodiment of the present invention provides a dual-thread rendering method, wherein a rendering thread and a logical thread are pre-configured, wherein the rendering thread is composed of a first rendering CPU and a first rendering GPU, and the logical thread is composed of a first processing CPU, and dual-thread rendering is performed through the following steps, including:

[0007] The first processing CPU in the logic thread receives the first preparation frame data in the queue, and the first processing CPU performs preparation processing on the first preparation frame data and then sends the logic signal and the processed first preparation frame data to the rendering thread;

[0008] After receiving the logic signal, the first rendering CPU in the rendering thread sends the first preparation frame data sent together with the logic signal to the first rendering GPU for rendering processing, and after sending the first preparation frame data to the first rendering GPU for rendering processing, the first rendering CPU sends a rendering signal to the first processing CPU in the logic thread;

[0009] The first processing CPU in the logic thread performs preparation processing on the second preparation frame data in the rendering signal receiving queue in response to the second preparation frame data, where the second preparation frame data is frame data adjacent to the first preparation frame data.

[0010] Optionally, in a possible implementation of the first aspect, the method further includes:

[0011] After determining that the first rendering GPU has completed rendering of the first preparation frame data, the first processing CPU has completed preparation processing of the second preparation frame data, and then sending the second preparation frame data that has completed preparation processing to the first rendering CPU;

[0012] The first rendering CPU sends the second preparation frame data to the first rendering GPU for rendering processing. After sending the second preparation frame data to the second GPU for rendering processing, the first rendering CPU sends a rendering signal to the first processing CPU in the logical thread.

[0013] Optionally, in a possible implementation of the first aspect, the method further includes:

[0014] When it is determined that the first rendering GPU has completed rendering of the first preparation frame data, and the first processing CPU has not completed preparation processing of the second preparation frame data;

[0015] The first rendering CPU controls the first rendering GPU to stop rendering, and after the first processing CPU completes the preparation processing of the second preparation frame data, sends the second preparation frame data to the first rendering CPU, generates a rendering signal, and sends it to the first processing CPU;

[0016] The first processing CPU controls the first rendering GPU to render the second preparation frame data.

[0017] Optionally, in a possible implementation of the first aspect, the method further includes:

[0018] When it is determined that the first rendering GPU has not completed rendering of the first preparation frame data, and the first processing CPU has completed preparation processing of the second preparation frame data;

[0019] The first processing CPU stops the preparation processing, and after the first rendering GPU completes rendering of the first preparation frame data, sends the second preparation frame data to the first rendering CPU, and the first rendering CPU generates a rendering signal and sends it to the first processing CPU;

[0020] The first processing CPU controls the first rendering GPU to render the second preparation frame data.

[0021] Optionally, in a possible implementation of the first aspect, the method further includes:

[0022] Configure a new rendering thread, where the new rendering thread includes a second rendering CPU and a second rendering GPU;

[0023] The first processing CPU performs preparation processing on the third preparation frame data and sends the logic signal and the processed third preparation frame data to the new rendering thread, the second rendering CPU controls the second rendering GPU to perform rendering processing on the processed third preparation frame data, and the second rendering CPU sends a rendering signal to the first processing CPU;

[0024] The first processing CPU determines that there is no preparation frame data being processed at the current moment, and then obtains the fourth preparation frame data in the queue.

[0025] Optionally, in a possible implementation of the first aspect, the method further includes:

[0026] When the first processing CPU determines that there is preparation frame data being processed at the current moment, the fourth preparation frame data in the queue is not obtained at this time. After the first processing CPU completes processing the preparation frame data at the current moment, the fourth preparation frame data in the queue is obtained for processing.

[0027] Optionally, in a possible implementation of the first aspect, the method further includes:

[0028] configuring a new logical thread, the new logical thread including a second processing CPU;

[0029] When the first processing CPU receives the rendering signal from the first rendering CPU and determines that the first processing CPU is preparing the frame data for processing, the first processing CPU sends the rendering signal to the second processing CPU;

[0030] The second processing CPU retrieves corresponding preparation frame data in the queue based on the rendering signal for preparation processing.

[0031] Optionally, in a possible implementation of the first aspect, the method further includes:

[0032] When the first processing CPU receives the rendering signal from the first rendering CPU and determines that the first processing CPU has not processed the preparation frame data at this time, the first processing CPU retrieves the corresponding preparation frame data in the queue based on the rendering signal for preparation processing.

[0033] A second aspect of an embodiment of the present invention provides a dual-thread rendering device, in which a rendering thread and a logic thread are pre-configured, wherein the rendering thread is composed of a first rendering CPU and a first rendering GPU, and the logic thread is composed of a first processing CPU, and dual-thread rendering is performed through the following modules, including:

[0034] A logic processing module, used for enabling a first processing CPU in a logic thread to receive first preparation frame data in a queue, and the first processing CPU performs preparation processing on the first preparation frame data and then sends a logic signal and the processed first preparation frame data to a rendering thread;

[0035] a rendering processing module, configured to enable the first rendering CPU in the rendering thread to send the first preparation frame data sent together with the logic signal to the first rendering GPU for rendering processing after receiving the logic signal, and the first rendering CPU to send a rendering signal to the first processing CPU in the logic thread after sending the first preparation frame data to the first rendering GPU for rendering processing;

[0036] The synchronization processing module is used to enable the first processing CPU in the logic thread to respond to the second preparation frame data in the rendering signal receiving queue and perform preparation processing on the second preparation frame data, where the second preparation frame data is frame data adjacent to the first preparation frame data.

[0037] According to a third aspect of an embodiment of the present invention, a readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, it is used to implement the method of the first aspect of the present invention and various possible designs of the first aspect.

[0038] The present invention provides a dual-thread rendering method, device and storage medium, which provide a multi-threaded image processing and rendering method, that is, two types of threads are pre-set, and the preparation frame data is prepared and rendered by the rendering thread and the logical thread respectively. When the logical thread in the present invention prepares the frame data, it can render other image frame data in parallel with the rendering thread. When the rendering thread renders the frame data, it can prepare other image frame data in parallel with the logical thread. In this way, the technical solution provided by the present invention can take preparation and rendering actions for different frame data when performing image rendering, thereby improving the rendering efficiency of the image. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 A flowchart of a first implementation of a dual-thread rendering method;

[0040] Figure 2 A flowchart of a second implementation of the dual-thread rendering method;

[0041] Figure 3 This is a structural diagram of a first implementation of a dual-thread rendering device. DETAILED DESCRIPTION

[0042] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0043] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in sequences other than those illustrated or described herein.

[0044] It should be understood that in various embodiments of the present invention, the size of the sequence number of each process does not mean the 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 the present invention.

[0045] It should be understood that in the present invention, "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or apparatus comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to these processes, methods, products or apparatuses.

[0046] It should be understood that in the present invention, "plurality" refers to two or more than two. "And / or" is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "Contains A, B and C", "Contains A, B, C" means that A, B, and C are all included, "Contains A, B or C" means that one of A, B, and C is included, and "Contains A, B and / or C" means that any one, any two, or any three of A, B, and C are included.

[0047] It should be understood that in the present invention, "B corresponding to A", "B corresponding to A", "A corresponds to B" or "B corresponds to A" means that B is associated with A and B can be determined based on A. Determining B based on A does not mean determining B based only on A, but B can also be determined based on A and / or other information. A and B match when the similarity between A and B is greater than or equal to a preset threshold.

[0048] Depending on the context, "if" as used herein may be interpreted as "when" or "when" or "in response to determining" or "in response to detecting."

[0049] The technical solution of the present invention is described in detail with specific embodiments below. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.

[0050] The present invention provides a dual-thread rendering method, pre-configuring a rendering thread and a logical thread, wherein the rendering thread is composed of a first rendering CPU and a first rendering GPU, and the logical thread is composed of a first processing CPU. The dual threads mentioned in the present invention can be understood as having two types of threads, each type of thread includes at least one, and a certain type of thread can also be multiple. A rendering thread is composed of 1 CPU and 1 GPU. A logical thread is composed of 1 CPU.

[0051] Perform dual-threaded rendering by following the steps below: Figure 1 As shown, including:

[0052] Step S110, the first processing CPU in the logic thread receives the first preparation frame data in the queue, and the first processing CPU performs preparation processing on the first preparation frame data and sends the logic signal and the processed first preparation frame data to the rendering thread. Generally speaking, when processing video data, the video data is composed of several images, and each frame of image can be regarded as a frame data. In the present invention, the first processing CPU can perform preparation processing on the first preparation frame data, and the preparation processing can be a variety of processing methods, such as resolution processing, etc.

[0053] After the first processing CPU performs preparation processing on the first preparation frame data, a logic signal is generated, and the logic signal and the first preparation frame data are sent to the rendering thread. The logic signal can be considered to indicate that the first preparation frame data sent together with the logic signal has been prepared and processed.

[0054] Step S120, after receiving the logic signal, the first rendering CPU in the rendering thread sends the first preparation frame data sent together with the logic signal to the first rendering GPU for rendering processing. After sending the first preparation frame data to the first rendering GPU for rendering processing, the first rendering CPU sends a rendering signal to the first processing CPU in the logic thread. When the first rendering CPU receives the logic signal, it will send the first preparation frame data to the first rendering GPU according to the logic signal. At this time, the first rendering GPU is controlled by the first processing CPU to perform rendering processing on the first preparation frame data. The rendering processing can be in various ways, such as changing the pixel value of the image in the first preparation frame data, etc. And after the first processing CPU controls the first rendering GPU to render the first preparation frame data, the first processing CPU will send a rendering signal to the first processing CPU. The purpose of sending the rendering signal is to notify the first processing CPU that the first rendering GPU has rendered the first preparation frame data.

[0055] Step S130, the first processing CPU in the logic thread responds to the second preparation frame data in the rendering signal receiving queue, and performs preparation processing on the second preparation frame data, where the second preparation frame data is frame data adjacent to the first preparation frame data. When the first processing CPU receives the rendering signal, it will obtain the second preparation frame data in the receiving queue, and then perform preparation processing on the second preparation frame data. The adjacent frame data can be preparation frame data at two adjacent moments.

[0056] Through the above technical solution, the rendering thread and the logic thread will not affect each other, and different preparation frame data can be prepared and rendered in parallel, thereby improving the rendering efficiency of videos and images.

[0057] The technical solution provided by the present invention is as follows: Figure 2 As shown, it also includes:

[0058] Step S210: After the first rendering GPU has finished rendering the first preparation frame data, the first processing CPU has finished preparing the second preparation frame data, and the second preparation frame data that has finished preparing is sent to the first rendering CPU. When the first rendering GPU has finished rendering the first preparation frame data, the first processing CPU has finished preparing the second preparation frame data, and the first processing CPU will send the second preparation frame data to the first rendering GPU, and the first rendering GPU will process the second preparation frame data.

[0059] Step S220: The first rendering CPU sends the second preparation frame data to the first rendering GPU for rendering processing. After sending the second preparation frame data to the second GPU for rendering processing, the first rendering CPU sends a rendering signal to the first processing CPU in the logical thread. After the first rendering CPU sends the second preparation frame data to the second GPU for rendering processing, the first rendering CPU sends a rendering signal to the first processing CPU, and the first processing CPU obtains the preparation frame data in the queue.

[0060] The preparation frame data in the queue are arranged according to their time values ​​and moment values ​​in the video, so that the preparation frame data in the queue are regular.

[0061] The technical solution provided by the present invention also includes:

[0062] When it is determined that the first rendering GPU has completed rendering the first preparation frame data, but the first processing CPU has not completed preparation processing of the second preparation frame data. Since different videos will have different images, different images will form different preparation frame data, and when processing the preparation frame data, due to different requirements, the time for the second CPU to prepare the preparation frame data and the time for the first CPU to render the first rendering GPU and the preparation frame data are variable and different, so it is necessary to monitor the rendering and processing of the first rendering GPU and the second processing CPU in real time, and control the transmission of the preparation frame data between the two threads according to the rendering and processing of the first rendering GPU and the second processing CPU.

[0063] The first rendering CPU controls the first rendering GPU to stop rendering, and after the first processing CPU completes the preparation processing of the second preparation frame data, it sends the second preparation frame data to the first rendering CPU and then generates a rendering signal and sends it to the first processing CPU. When the first rendering GPU completes the rendering of the first preparation frame data, but the first processing CPU has not completed the preparation processing of the second preparation frame data, it proves that the processing speed of the frame data by the first processing CPU is lower than the rendering speed of the frame data by the first rendering GPU. At this time, the first rendering GPU needs to wait for the second processing CPU to perform preparation processing on the corresponding second preparation frame data before rendering the second preparation frame data again.

[0064] The first processing CPU controls the first rendering GPU to render the second preparation frame data.

[0065] The technical solution provided by the present invention also includes:

[0066] It is determined that the first rendering GPU has not completed rendering of the first preparation frame data, and the first processing CPU has completed preparation processing of the second preparation frame data. When the first rendering GPU has not completed rendering of the first preparation frame data, and the first processing CPU has completed preparation processing of the second preparation frame data, it is proved that the processing speed of the first processing CPU for the preparation frame data is greater than the rendering speed of the first rendering GPU for the preparation frame data.

[0067] The first processing CPU stops the preparation processing, and after the first rendering GPU completes rendering of the first preparation frame data, the second preparation frame data is sent to the first rendering CPU, and the first rendering CPU generates a rendering signal and sends it to the first processing CPU. The present invention controls the first processing CPU to stop the preparation processing, and after the first rendering GPU completes rendering of the first preparation frame data, the second preparation frame data is sent to the first rendering CPU, thereby ensuring that the preparation frame data processed by the rendering thread and the logic thread differ by only one moment, thereby ensuring the stability of image rendering.

[0068] The first processing CPU controls the first rendering GPU to render the second preparation frame data.

[0069] The technical solution provided by the present invention also includes:

[0070] A new rendering thread is configured, and the new rendering thread includes a second rendering CPU and a second rendering GPU. Since the processing speeds of the rendering thread and the logical thread for images may be different in different application scenarios, the present invention will configure a new rendering thread in an image processing scenario where the rendering thread processes slower and the logical thread processes faster. Even if one logical thread corresponds to two rendering threads, in an ideal state, if the speed at which the logical thread processes the prepared frame data is twice that of the rendering thread, the logical thread can fully meet the needs of providing the prepared frame data for the two rendering threads, and can ensure that the two rendering threads can work non-stop to maintain the rendering of the prepared frame data. The speed of image rendering is improved.

[0071] After the first processing CPU performs preparation processing on the third preparation frame data, it sends the logic signal and the processed third preparation frame data to the new rendering thread, the second rendering CPU controls the second rendering GPU to render the processed third preparation frame data, and the second rendering CPU sends a rendering signal to the first processing CPU. At this time, after the first processing CPU completes the preparation processing on the third preparation frame data, it will give priority to sending the third preparation frame data and the logic signal to the first rendering CPU, but if it is determined that the first rendering GPU is rendering other image frame data at this time, then the first processing CPU will send the third preparation frame data and the logic signal to the second rendering CPU, so that the second rendering CPU can render the image frame data.

[0072] The first processing CPU determines that there is no preparation frame data being processed at the current moment, and then obtains the fourth preparation frame data in the queue. When the first processing CPU does not have the preparation frame data being processed at this time, the first processing CPU can obtain the fourth preparation frame data in the queue and process the fourth preparation frame data.

[0073] In a possible embodiment, it further includes:

[0074] When the first processing CPU determines that there is preparation frame data being processed at the current moment, the fourth preparation frame data in the queue is not obtained at this time. After the first processing CPU completes processing the preparation frame data at the current moment, the fourth preparation frame data in the queue is obtained for processing.

[0075] The technical solution provided by the present invention also includes:

[0076] A new logical thread is configured, and the new logical thread includes a second processing CPU. Since the processing speeds of the rendering thread and the logical thread for images may be different in different application scenarios, the present invention will configure a new logical thread in an image processing scenario where the logical thread processes slower and the rendering thread processes faster. Even if one rendering thread corresponds to two logical threads, in an ideal state, if the speed of the rendering thread processing the prepared frame data is twice that of the logical thread processing the prepared frame data, the rendering thread can fully meet the needs of providing the prepared frame data for the two logical threads, and can ensure that the two logical threads can work non-stop to keep rendering the prepared frame data. The speed of image rendering is improved.

[0077] When the first processing CPU receives the rendering signal from the first rendering CPU and determines that the first processing CPU is performing preparation processing on the preparation frame data, the first processing CPU sends the rendering signal to the second processing CPU.

[0078] The second processing CPU retrieves corresponding preparation frame data in the queue based on the rendering signal for preparation processing.

[0079] In a possible embodiment, it further includes:

[0080] When the first processing CPU receives the rendering signal from the first rendering CPU and determines that the first processing CPU has not processed the preparation frame data at this time, the first processing CPU retrieves the corresponding preparation frame data in the queue based on the rendering signal for preparation processing.

[0081] In order to better implement the dual-thread rendering method provided by the present invention, the present invention also provides a dual-thread rendering device.

[0082] The present invention provides a dual-thread rendering device, which pre-configures a rendering thread and a logic thread. The rendering thread is composed of a first rendering CPU and a first rendering GPU, and the logic thread is composed of a first processing CPU. The dual-thread rendering is performed through the following modules, such as Figure 3 As shown, including:

[0083] A logic processing module, used for enabling a first processing CPU in a logic thread to receive first preparation frame data in a queue, and the first processing CPU performs preparation processing on the first preparation frame data and then sends a logic signal and the processed first preparation frame data to a rendering thread;

[0084] a rendering processing module, configured to enable the first rendering CPU in the rendering thread to send the first preparation frame data sent together with the logic signal to the first rendering GPU for rendering processing after receiving the logic signal, and the first rendering CPU to send a rendering signal to the first processing CPU in the logic thread after sending the first preparation frame data to the first rendering GPU for rendering processing;

[0085] The synchronization processing module is used to enable the first processing CPU in the logic thread to respond to the second preparation frame data in the rendering signal receiving queue and perform preparation processing on the second preparation frame data, where the second preparation frame data is frame data adjacent to the first preparation frame data.

[0086] Among them, the readable storage medium can be a computer storage medium or a communication medium. The communication medium includes any medium that facilitates the transmission of a computer program from one place to another. The computer storage medium can be any available medium that can be accessed by a general-purpose or special-purpose computer. For example, a readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application-specific integrated circuit (Application Specific Integrated Circuits, abbreviated as: ASIC). In addition, the ASIC can be located in a user device. Of course, the processor and the readable storage medium can also exist in a communication device as discrete components. The readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device, etc.

[0087] The present invention also provides a program product, which includes an execution instruction, which is stored in a readable storage medium. At least one processor of a device can read the execution instruction from the readable storage medium, and at least one processor executes the execution instruction so that the device implements the methods provided in the above various embodiments.

[0088] In the above-mentioned terminal or server embodiments, it should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the present invention may be directly implemented as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.

[0089] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A dual-thread rendering method, characterized in that: Pre-configure a rendering thread and a logic thread, wherein the rendering thread is composed of a first rendering CPU and a first rendering GPU, and the logic thread is composed of a first processing CPU, and perform dual-thread rendering through the following steps, including: The first processing CPU in the logic thread receives the first preparation frame data in the queue, and the first processing CPU performs preparation processing on the first preparation frame data and then sends the logic signal and the processed first preparation frame data to the rendering thread; After receiving the logic signal, the first rendering CPU in the rendering thread sends the first preparation frame data sent together with the logic signal to the first rendering GPU for rendering processing, and after sending the first preparation frame data to the first rendering GPU for rendering processing, the first rendering CPU sends a rendering signal to the first processing CPU in the logic thread; The first processing CPU in the logic thread performs preparation processing on the second preparation frame data in response to the second preparation frame data in the rendering signal receiving queue, where the second preparation frame data is frame data adjacent to the first preparation frame data; Configure a new rendering thread, where the new rendering thread includes a second rendering CPU and a second rendering GPU; The first processing CPU performs preparation processing on the third preparation frame data and sends the logic signal and the processed third preparation frame data to the new rendering thread, the second rendering CPU controls the second rendering GPU to perform rendering processing on the processed third preparation frame data, and the second rendering CPU sends a rendering signal to the first processing CPU; The first processing CPU determines that there is no preparation frame data being processed at the current moment, and then obtains the fourth preparation frame data in the queue.

2. The dual-thread rendering method according to claim 1, characterized in that: Also includes: After determining that the first rendering GPU has completed rendering of the first preparation frame data, the first processing CPU has completed preparation processing of the second preparation frame data, and then sending the second preparation frame data that has completed preparation processing to the first rendering CPU; The first rendering CPU sends the second preparation frame data to the first rendering GPU for rendering processing. After sending the second preparation frame data to the second GPU for rendering processing, the first rendering CPU sends a rendering signal to the first processing CPU in the logical thread.

3. The dual-thread rendering method according to claim 1, characterized in that: Also includes: When it is determined that the first rendering GPU has completed rendering of the first preparation frame data, and the first processing CPU has not completed preparation processing of the second preparation frame data; The first rendering CPU controls the first rendering GPU to stop rendering, and after the first processing CPU completes the preparation processing of the second preparation frame data, sends the second preparation frame data to the first rendering CPU, generates a rendering signal, and sends it to the first processing CPU; The first processing CPU controls the first rendering GPU to render the second preparation frame data.

4. The dual-thread rendering method according to claim 1, characterized in that: Also includes: When it is determined that the first rendering GPU has not completed rendering of the first preparation frame data, and the first processing CPU has completed preparation processing of the second preparation frame data; The first processing CPU stops the preparation processing, and after the first rendering GPU completes rendering of the first preparation frame data, sends the second preparation frame data to the first rendering CPU, and the first rendering CPU generates a rendering signal and sends it to the first processing CPU; The first processing CPU controls the first rendering GPU to render the second preparation frame data.

5. The dual-thread rendering method according to claim 1, characterized in that: Also includes: When the first processing CPU determines that there is preparation frame data being processed at the current moment, the fourth preparation frame data in the queue is not obtained at this time. After the first processing CPU completes processing the preparation frame data at the current moment, the fourth preparation frame data in the queue is obtained for processing.

6. The dual-thread rendering method according to claim 1, characterized in that: Also includes: configuring a new logical thread, the new logical thread including a second processing CPU; When the first processing CPU receives the rendering signal from the first rendering CPU and determines that the first processing CPU is preparing the frame data for processing, the first processing CPU sends the rendering signal to the second processing CPU; The second processing CPU retrieves corresponding preparation frame data in the queue based on the rendering signal for preparation processing.

7. The dual-thread rendering method according to claim 6, characterized in that: Also includes: When the first processing CPU receives the rendering signal from the first rendering CPU and determines that the first processing CPU has not processed the preparation frame data at this time, the first processing CPU retrieves the corresponding preparation frame data in the queue based on the rendering signal for preparation processing.

8. A dual-thread rendering device, characterized in that: Pre-configure a rendering thread and a logic thread, wherein the rendering thread is composed of a first rendering CPU and a first rendering GPU, and the logic thread is composed of a first processing CPU, and perform dual-thread rendering through the following modules, including: A logic processing module, used for enabling a first processing CPU in a logic thread to receive first preparation frame data in a queue, and the first processing CPU performs preparation processing on the first preparation frame data and then sends a logic signal and the processed first preparation frame data to a rendering thread; a rendering processing module, configured to enable the first rendering CPU in the rendering thread to send the first preparation frame data sent together with the logic signal to the first rendering GPU for rendering processing after receiving the logic signal, and the first rendering CPU to send a rendering signal to the first processing CPU in the logic thread after sending the first preparation frame data to the first rendering GPU for rendering processing; a synchronization processing module, configured to enable a first processing CPU in a logic thread to respond to second preparation frame data in the rendering signal receiving queue, and perform preparation processing on the second preparation frame data, wherein the second preparation frame data is frame data adjacent to the first preparation frame data; It also includes a new thread module for configuring a new rendering thread, which includes a second rendering CPU and a second rendering GPU; the first processing CPU prepares the third preparation frame data and sends the logic signal and the processed third preparation frame data to the new rendering thread, the second rendering CPU controls the second rendering GPU to render the processed third preparation frame data, and the second rendering CPU sends a rendering signal to the first processing CPU; the first processing CPU determines that there is no preparation frame data being prepared for processing at the current moment, then obtains the fourth preparation frame data in the queue at this time.

9. A readable storage medium, characterized in that: The readable storage medium stores a computer program, and when the computer program is executed by a processor, it is used to implement the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Image processing method and apparatus

    WO2019071600A1