Task processing method and device based on picture rendering

By monitoring the picture rendering tasks executed by the main thread and performing the preloading tasks immediately after it is completed, the problem that the existing technology cannot meet the high fluency requirements is solved, and the picture rendering efficiency and fluency are improved.

CN119225862APending Publication Date: 2024-12-31BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310790099.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-29
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

The existing main thread and rendering thread jointly implement the picture rendering method that cannot meet the requirements of high fluency, especially in scenes with high screen display requirements.

Method used

By monitoring the main thread to perform processing tasks for the currently rendered picture frame, obtain some or all tasks of the next frame to be rendered as preloaded tasks, and immediately enter the target thread (main) after the current rendered picture frame processing task is completed. Execute preload tasks in threads or child threads, and execute preload tasks in advance to improve rendering efficiency.

Benefits of technology

Performing preload tasks in advance improves the efficiency of picture rendering and thus improves the smoothness of picture display.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119225862A_ABST
    Figure CN119225862A_ABST
Patent Text Reader

Abstract

The invention discloses a task processing method based on picture rendering, and the method comprises the steps: monitoring a main thread to execute a processing task corresponding to a current to-be-rendered picture frame, and obtaining a part or all of the processing tasks corresponding to a next to-be-rendered picture frame as a preloading task; when it is monitored that execution of the processing task corresponding to the current to-be-rendered picture frame is finished, in response to execution of the processing task corresponding to the current to-be-rendered picture frame is finished, a target thread is controlled to immediately execute the preloading task, and the target thread can comprise a main thread and / or a sub-thread. By utilizing the scheme, the preloading task does not need to wait for a certain time to be executed after the execution of the processing task corresponding to the current to-be-rendered picture frame is finished, but is executed immediately after the execution of the processing task corresponding to the current to-be-rendered picture frame is finished. That is to say, according to the scheme, the execution time of the preloading task is advanced, correspondingly, the efficiency of picture rendering can be improved, and therefore the fluency of picture display is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a task processing method and device based on picture rendering. Background Art

[0002] Screen rendering can be completed by the main thread and the rendering thread. In a specific example, for a frame of screen, the main thread can first perform the processing tasks related to the frame of screen, obtain the corresponding processing results, and pass the processing results to the rendering thread, which performs the rendering operation.

[0003] Currently, the main thread can execute processing tasks at a certain frequency. Specifically, the time difference between the start time when the main thread executes a processing task corresponding to a certain frame and the start time when the main thread executes a processing task corresponding to the next frame is a fixed value.

[0004] However, in some screen rendering scenarios, the smoothness of the screen display is required to be high, and the current method of jointly implementing screen rendering using the main thread and rendering thread cannot meet the requirements.

[0005] Therefore, a solution is urgently needed to solve the above problems. Summary of the invention

[0006] In order to solve or at least partially solve the above technical problems, an embodiment of the present application provides a task processing method and device based on screen rendering.

[0007] In a first aspect, an embodiment of the present application provides a task processing method based on screen rendering, the method comprising:

[0008] Monitor the main thread to execute the processing task corresponding to the current frame to be rendered;

[0009] Obtain part or all of the processing tasks corresponding to the next frame to be rendered as preload tasks;

[0010] In response to monitoring that the processing task corresponding to the current frame to be rendered is completed, controlling a target thread to immediately execute the preloading task, the target thread including the main thread and / or the child thread.

[0011] Optionally, the processing tasks include input type tasks, animation type tasks, traversal type tasks and submission type tasks;

[0012] The monitoring main thread executes the processing task corresponding to the current picture frame to be rendered, comprising: using a pre-created monitoring task of a submission type to monitor the main thread execute the processing task corresponding to the current picture frame to be rendered;

[0013] The responding to monitoring that the processing task corresponding to the current frame to be rendered is completed includes: responding to monitoring that the monitoring task is triggered.

[0014] Optionally, obtaining part or all of the processing tasks corresponding to the next frame to be rendered as preload tasks includes:

[0015] Acquire a plurality of processing tasks from a preset storage space, wherein the preset storage space stores at least one processing task corresponding to a picture frame to be rendered;

[0016] Determine the processing task corresponding to the next frame to be rendered based on the difference between the processing time of the plurality of processing tasks and the current time;

[0017] The preloading task is determined from the processing tasks corresponding to the next frame to be rendered.

[0018] Optionally, the method further includes:

[0019] Adding the preload task to the task queue;

[0020] The controlling target thread to immediately execute the preloading task includes:

[0021] The target thread is controlled to read the preload task from the task queue and execute the read preload task.

[0022] Optionally, after the target thread executes the read preload task, the method further includes:

[0023] The executed preloading task is deleted from the task queue.

[0024] Optionally, the method further includes:

[0025] In response to the target timer counting reaching a preset value, the main thread reads the task queue, and the target timer counting reaches the preset value, indicating that the time difference between the current moment and the start moment when the main thread starts to execute the processing task corresponding to the current picture frame to be rendered reaches the preset time difference value;

[0026] In response to the existence of tasks in the task queue, the main thread executes the tasks in the task queue;

[0027] or,

[0028] In response to the absence of a task in the task queue, the main thread reads and executes a task from a preset storage space, wherein the preset storage space stores at least one processing task corresponding to a picture frame to be rendered.

[0029] In a second aspect, an embodiment of the present application provides a task processing device based on screen rendering, the device comprising:

[0030] A monitoring unit, used to monitor the main thread to execute the processing task corresponding to the current picture frame to be rendered;

[0031] An acquisition unit, used for acquiring part or all of the processing tasks corresponding to the next frame to be rendered as preloaded tasks;

[0032] The control unit is used to control the target thread to immediately execute the preloading task in response to monitoring that the processing task corresponding to the current picture frame to be rendered is completed, and the target thread includes the main thread and / or the child thread.

[0033] Optionally, the processing tasks include input type tasks, animation type tasks, traversal type tasks and submission type tasks;

[0034] The monitoring unit is used to: monitor the main thread's execution of a processing task corresponding to a current picture frame to be rendered using a pre-created monitoring task of a submission type;

[0035] The control unit is used to: in response to monitoring that the monitoring task is triggered, control the target thread to immediately execute the preloading task, and the target thread includes the main thread and / or the sub-thread.

[0036] Optionally, the acquisition unit is used to:

[0037] Acquire a plurality of processing tasks from a preset storage space, wherein the preset storage space stores at least one processing task corresponding to a picture frame to be rendered;

[0038] Determine the processing task corresponding to the next frame to be rendered based on the difference between the processing time of the plurality of processing tasks and the current time;

[0039] The preloading task is determined from the processing tasks corresponding to the next frame to be rendered.

[0040] Optionally, the device further comprises:

[0041] An adding unit, used for adding the preload task to a task queue;

[0042] The control unit is used for:

[0043] The target thread is controlled to read the preload task from the task queue and execute the read preload task.

[0044] Optionally, the device further comprises:

[0045] The deleting unit is used to delete the executed preloading task from the task queue after the target thread executes the read preloading task.

[0046] Optionally, the device further comprises: a reading unit and a processing unit;

[0047] The reading unit is used for, in response to the target timer count reaching a preset value, the main thread reading the task queue, the target timer count reaching the preset value, indicating that the time difference between the current moment and the start moment when the main thread starts to execute the processing task corresponding to the current picture frame to be rendered reaches the preset time difference value;

[0048] The processing unit is used for:

[0049] In response to the existence of tasks in the task queue, the main thread executes the tasks in the task queue; or, in response to the absence of tasks in the task queue, the main thread reads and executes tasks from a preset storage space, wherein the preset storage space stores at least one processing task corresponding to a picture frame to be rendered.

[0050] In a third aspect, an embodiment of the present application provides a device, the device comprising a processor and a memory;

[0051] The processor is used to execute instructions stored in the memory so that the device executes the method described in any one of the first aspects above.

[0052] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, comprising instructions, wherein the instructions instruct a device to execute any of the methods described in the first aspect above.

[0053] In a fifth aspect, an embodiment of the present application provides a computer program product, which, when executed on a computer, enables the computer to execute any of the methods described in the first aspect above.

[0054] Compared with the prior art, the embodiments of the present application have the following advantages:

[0055] The embodiment of the present application provides a task processing method based on screen rendering. In one example, the method can be applied to a client. In one example, the client can monitor the main thread to execute the processing task corresponding to the current rendered screen frame. The client can also obtain part or all of the tasks in the processing task corresponding to the next frame of the screen frame to be rendered as preloaded tasks. The client can monitor the end of the execution of the processing task corresponding to the current screen frame to be rendered, and in response to the end of the execution of the processing task corresponding to the current screen frame to be rendered, control the target thread to immediately execute the preloaded task, wherein the target thread may include the main thread and / or the child thread. It can be seen that, using this solution, the preloaded task does not need to wait for a certain time after the execution of the processing task corresponding to the current screen frame to be rendered is completed, but is executed immediately after the execution of the processing task corresponding to the current screen frame to be rendered is completed. In other words, this solution advances the execution time of the preloaded task, and accordingly, the efficiency of screen rendering can be improved, thereby improving the fluency of screen display. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0057] Figure 1a A schematic diagram of a rendering method provided in an embodiment of the present application;

[0058] Figure 1b A schematic diagram of another rendering method provided in an embodiment of the present application;

[0059] Figure 2 A flowchart of a task processing method based on screen rendering provided in an embodiment of the present application;

[0060] Figure 3 A schematic diagram of the execution order of a processing task provided in an embodiment of the present application;

[0061] Figure 4 A flowchart of a task processing method based on screen rendering provided in an embodiment of the present application;

[0062] Figure 5 A schematic diagram of the structure of a task processing device based on screen rendering provided in an embodiment of the present application. DETAILED DESCRIPTION

[0063] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0064] The inventor of the present application has found through research that the picture rendering can be completed by the main thread and the rendering thread. In a specific example, for a frame of picture, the main thread can first execute the processing task related to the frame of picture, obtain the corresponding processing result, and pass the processing result to the rendering thread, which performs the rendering operation.

[0065] In one example, the processing task performed by the main thread can also be called "doFrame", which mainly performs animation, measurement, layout, drawing and other tasks related to the display function (view). The rendering task performed by the rendering thread can also be called "drawFrame", which mainly performs View-related drawing instruction conversion and general processing unit (GPU) rendering and other tasks.

[0066] For reference Figure 1a To understand, Figure 1a A schematic diagram of a rendering method provided in an embodiment of the present application. Figure 1a As shown, the main thread executes the processing task and obtains the processing result, which is passed to the rendering thread, and the rendering thread performs rendering based on the processing result.

[0067] Currently, the main thread can execute processing tasks at a certain frequency. Specifically, the time difference between the start time when the main thread executes a processing task corresponding to a certain frame and the start time when the main thread executes a processing task corresponding to the next frame is a fixed value. Figure 1a As shown, the time difference between time t1 and time t2 is a fixed value. The fixed value is determined according to the parameters of the terminal device running the client, and specifically, can be determined according to the frame rate of the screen of the terminal device. For example, if the screen of the terminal device supports refreshing 60 frames per second, the fixed value can be 1000 / 60≈16 milliseconds.

[0068] However, in some screen rendering scenarios, high requirements are placed on the smoothness of screen display. For example, in a video streaming playback scenario, the current method of jointly implementing screen rendering using the main thread and rendering thread cannot meet the requirements.

[0069] At present, in most scenarios, the time required for the main thread to execute the processing task corresponding to the current frame to be rendered is less than the aforementioned time difference, that is, after the main thread executes the processing task corresponding to the current frame to be rendered, it needs to wait for a certain period of time before executing the processing task corresponding to the next frame to be rendered. For the convenience of description, in the following description, the certain period of waiting is referred to as "idle time". If the aforementioned idle time can be used to execute the processing task corresponding to the next frame to be rendered in advance, for example, Figure 1b As shown, the efficiency of screen rendering can be improved.

[0070] In view of this, an embodiment of the present application provides a task processing method and device based on screen rendering, which can improve the efficiency of screen rendering and thus improve the fluency of screen display.

[0071] Various non-limiting implementations of the present application are described in detail below in conjunction with the accompanying drawings.

[0072] Exemplary Methods

[0073] See also Figure 2 , which is a flow chart of a task processing method based on screen rendering provided by an embodiment of the present application. In one example, the method can be applied to a client, and the client can have a screen rendering function. In one example, the client can include a main thread and a rendering thread, and the main thread and the rendering thread jointly implement screen rendering.

[0074] In this embodiment, the method may include, for example, the following steps: S101 - S103 .

[0075] S101: Monitor the main thread to execute the processing task corresponding to the current picture frame to be rendered.

[0076] In an embodiment of the present application, the processing task may include multiple types of tasks. In one example, the processing task may include an input type task, an animation type task, a traversal type task, and a commit type task.

[0077] in:

[0078] Touch screen events are mainly processed in the processing phase of input type tasks;

[0079] The frame callback function that needs to be executed when each frame is refreshed is processed in the processing stage of the animation type task;

[0080] The tasks of measuring, laying out, and drawing the screen are handled in the processing phase of the traversal type tasks.

[0081] The commit type task is the time to do the finishing work when finishing drawing a frame of the screen. When the commit type task is executed, it can be determined that the processing task is completed.

[0082] like Figure 3 As shown, Figure 3 The following is a schematic diagram of the execution order of a processing task provided in an embodiment of the present application. Figure 3 As shown, the input type task, animation type task, traversal type task and commit type task can be executed in sequence. Specifically, the input type task is executed first, and after the input type task is executed, the animation type task is executed, and after the animation type task is executed, the traversal type task is executed, and after the traversal type task is executed, the commit type task is executed.

[0083] In an embodiment of the present application, the client may monitor the main thread's execution of the processing task of the current frame to be rendered to determine whether the processing task corresponding to the current frame to be rendered has been completed.

[0084] In the embodiment of the present application, the client may monitor the main thread to execute various types of tasks in the processing task of the current frame to be rendered, or may monitor only some types of tasks. The embodiment of the present application does not make specific limitations.

[0085] In a specific example, the client can create a commit-type monitoring task, and use the commit-type monitoring task to monitor the main thread's execution of the processing task of the current screen frame to be rendered. Since the monitoring task is of the commit type, when the monitoring task is triggered, it means that the main thread has executed the commit-type task in the processing task of the current screen frame to be rendered. Accordingly, when the monitoring task is triggered, the client can determine that the execution of the processing task corresponding to the current screen frame to be rendered has ended.

[0086] S102: Obtain part or all of the processing tasks corresponding to the next frame to be rendered as preload tasks.

[0087] In an embodiment of the present application, the client may obtain part or all of the processing tasks corresponding to the next frame to be rendered as preload tasks, so as to execute the preload tasks in advance.

[0088] In one example, the client can obtain all the tasks in the processing tasks corresponding to the next frame of the screen frame to be rendered as preloaded tasks. In another example, considering that the aforementioned idle time is limited, it may not be enough to execute all the tasks in the processing tasks corresponding to the next frame of the screen frame to be rendered. Therefore, the client can obtain some of the tasks in the processing tasks corresponding to the next frame of the screen frame to be rendered as preloaded tasks. For example, the input type task in the processing task corresponding to the next frame of the screen frame to be rendered can be obtained as the preloaded task. For another example, the input type task and the animation type task in the processing task corresponding to the next frame of the screen frame to be rendered can be obtained as the preloaded task. For another example, the input type task, the animation type task and the traversal type task in the processing task corresponding to the next frame of the screen frame to be rendered can be obtained as the preloaded task. And so on, which are not listed one by one here.

[0089] In an example, the client may obtain the preloading task by executing A1-A3 as follows.

[0090] A1: Acquire a plurality of processing tasks from a preset storage space, wherein the preset storage space stores at least one processing task corresponding to a picture frame to be rendered.

[0091] A2: Based on the difference between the processing time of the plurality of processing tasks and the current time, determine the processing task corresponding to the next frame to be rendered.

[0092] In an embodiment of the present application, the preset storage space is used to store processing tasks corresponding to the picture frames to be rendered. The client can obtain a plurality of processing tasks from the preset storage space, and further determine the preloaded task from the plurality of tasks.

[0093] In the embodiment of the present application, the preset storage space not only stores the processing tasks corresponding to the picture frames to be rendered, but also stores the processing time corresponding to each processing task. When the client obtains the plurality of tasks, it can also obtain the processing time corresponding to each of the plurality of tasks.

[0094] In one example, the processing tasks corresponding to the picture frames to be rendered may exist in the preset storage space in the form of a linked list. In this case, the client may use a reflection function to obtain the link and traverse the linked list to obtain the several processing tasks. For example, the linked list corresponding to the input type tasks may be traversed to obtain several input type tasks, the linked list corresponding to the animation type tasks may be traversed to obtain several animation type tasks, and so on. These are not listed here one by one.

[0095] In an embodiment of the present application, after obtaining the several tasks, the task corresponding to the next frame to be rendered can be determined from the several tasks in combination with the processing time corresponding to the several tasks. Specifically, the difference between the processing time of each task in the several tasks and the current time period can be calculated, and the task whose difference is less than the preset time difference can be determined as the task corresponding to the next frame to be rendered. It is reminded here that the preset time difference can be the display time difference between two adjacent frames of the picture. The preset time difference can be determined according to the frame rate of the screen of the terminal device. For example, the preset time difference can be the aforementioned 16 milliseconds.

[0096] A3: Determine the preloading task from the processing tasks corresponding to the next frame to be rendered.

[0097] After determining the processing tasks corresponding to the next frame of the picture to be rendered, part or all of the processing tasks corresponding to the next frame of the picture to be rendered may be determined as the preloaded tasks.

[0098] In one example, after determining the preload task, the preload task can be added to a task queue so that the task can be read from the task queue and executed later. Correspondingly, the preload task can also be deleted from the preset storage space to avoid reading the preload task from the preset storage space again, causing the preload task to be repeatedly executed.

[0099] S103: In response to monitoring that the processing task corresponding to the current frame to be rendered is completed, controlling a target thread to immediately execute the preloading task, the target thread including the main thread and / or the sub-thread.

[0100] As previously mentioned, in one example, the client can determine that the processing task corresponding to the current screen frame to be rendered has been completed when the monitoring task is triggered. In another example, other methods can also be used to determine that the processing task corresponding to the current screen frame to be rendered has been completed. For example, the processing logic of the commit-type task in the processing task can be modified to add an output message to it. When the commit-type task in the processing task is executed, a prompt message is output to prompt the task to end. In this case, the client can determine that the processing task corresponding to the current screen frame to be rendered has been completed when the prompt message is detected.

[0101] In an embodiment of the present application, in order to improve the rendering efficiency of the picture frame and improve the smoothness of the picture display, when the client determines that the processing task corresponding to the current picture frame to be rendered has been completed, it can respond to monitoring that the processing task corresponding to the current picture frame to be rendered has been completed, and control the target thread to immediately execute the preloading task. The target thread mentioned here can be a main thread or a child thread. After the target thread executes the preloading task, the execution result can be passed to the rendering thread so that the rendering thread performs the rendering operation based on the received execution result. As mentioned above, the client can add the preloading task to the task queue. In this case, the client can control the target thread to read the preloading task from the task queue and execute the read preloading task.

[0102] In one example, after the target thread executes the read preloaded task, the client may delete the preloaded task from the task queue, thereby avoiding the waste of storage space by continuing to store the executed tasks in the task queue.

[0103] In another example, after the target thread executes the read preloaded task, the client can add an execution mark for the task that has been executed in the preloaded task in the task queue to indicate that the task has been executed, thereby avoiding the executed task from being read and executed repeatedly.

[0104] In the embodiment of the present application, the client may maintain a target timer, which is used to correspond to the frequency of the main thread executing the processing task, or in other words, the counting result of the target timer is used to indicate the time difference between two consecutive executions of the processing task by the main thread in the traditional technology mentioned above (for example, Figure 1aThe time difference between the corresponding time t1 and time t2). When the target timer count reaches the preset value, it means that the time difference between the current time and the start time of the main thread starting to execute the processing task corresponding to the current frame to be rendered reaches the preset time difference. In this case, the client can respond to the target timer count reaching the preset value, no longer use the target thread to continue to execute the preloading task, but use the main thread to continue to execute the corresponding processing task.

[0105] In an embodiment of the present application, since some or all of the processing tasks corresponding to the next frame to be rendered have been executed in advance, the main thread can start executing from the tasks that have not yet been executed in the processing tasks corresponding to the next frame to be rendered.

[0106] In a specific example, considering that the aforementioned idle time may be limited and insufficient for the target thread to process all preloaded tasks, the tasks that have not been processed in the preloaded tasks are still stored in the task queue. Therefore, in order to avoid the loss of tasks that have not been executed in the preloaded tasks, the main thread can first read the task queue in response to the target timer count reaching a preset value. If there are tasks in the task queue, the main thread first executes the tasks in the task queue. After executing the tasks in the task queue, continue to read the tasks from the aforementioned preset storage space for execution. If there are no tasks in the task queue, the main thread can read the tasks from the aforementioned preset storage space for execution.

[0107] From the above description, it can be known that, using the solution of the embodiment of the present application, the preloading task does not need to wait for a certain time after the processing task corresponding to the current frame to be rendered is executed, but is executed immediately after the processing task corresponding to the current frame to be rendered is executed. In other words, this solution advances the execution time of the preloading task, and accordingly, the efficiency of the picture rendering can be improved, thereby improving the smoothness of the picture display.

[0108] Next, the solution of the embodiment of the present application is introduced in combination with a specific scenario. Figure 4 , which is a flow chart of a task processing method based on screen rendering provided in an embodiment of the present application. Figure 4 The method shown may include the following S401-S406.

[0109] S401: Using a monitoring task to monitor the main thread to execute a processing task corresponding to the current frame to be rendered.

[0110] S402: acquiring input-type tasks and animation-type tasks in the processing tasks corresponding to the next frame to be rendered as preload tasks, and writing the preload tasks into a task queue and deleting them from a preset storage space.

[0111] S403: In response to monitoring that the monitoring task is triggered, controlling the main thread to read the preloading task from the task queue and executing the read preloading task.

[0112] S404: After the target thread executes the read preload task, the preload task is deleted from the task queue.

[0113] Assume that the preloaded tasks include 10 tasks in total, and after executing S404 , the task queue still includes 3 tasks.

[0114] S405: In response to the target timer counting reaching a preset value, the main thread reads the task queue and executes the three tasks included in the task queue.

[0115] S406: After the three tasks are executed, the main thread reads the traversal type task and the commit type task in the processing task corresponding to the next frame to be rendered from the preset storage space and executes them.

[0116] For the specific implementation of each step in S401-S406, reference may be made to the relevant description of the above embodiment, and a repeated description will not be made here.

[0117] Exemplary Devices

[0118] Based on the method provided in the above embodiment, the embodiment of the present application further provides a device, which is described below in conjunction with the accompanying drawings.

[0119] See also Figure 5 , which is a structural diagram of a task processing device based on screen rendering provided in an embodiment of the present application. Figure 5 The task processing device 500 shown includes: a monitoring unit 501 , an acquisition unit 502 and a control unit 503 .

[0120] A monitoring unit 501 is used to monitor the main thread executing the processing task corresponding to the current picture frame to be rendered;

[0121] An acquisition unit 502 is used to acquire part or all of the processing tasks corresponding to the next frame to be rendered as preloaded tasks;

[0122] The control unit 503 is used to control the target thread to immediately execute the preloading task in response to monitoring that the processing task corresponding to the current picture frame to be rendered is completed, and the target thread includes the main thread and / or the child thread.

[0123] Optionally, the processing tasks include input type tasks, animation type tasks, traversal type tasks and submission type tasks;

[0124] The monitoring unit 501 is used to: monitor the main thread executing the processing task corresponding to the current picture frame to be rendered by using a pre-created monitoring task of the submission type;

[0125] The control unit 503 is used to: in response to monitoring that the monitoring task is triggered, control the target thread to immediately execute the preloading task, and the target thread includes the main thread and / or the sub-thread.

[0126] Optionally, the acquiring unit 502 is configured to:

[0127] Acquire a plurality of processing tasks from a preset storage space, wherein the preset storage space stores at least one processing task corresponding to a picture frame to be rendered;

[0128] Determine the processing task corresponding to the next frame to be rendered based on the difference between the processing time of the plurality of processing tasks and the current time;

[0129] The preloading task is determined from the processing tasks corresponding to the next frame to be rendered.

[0130] Optionally, the device further comprises:

[0131] An adding unit, used for adding the preload task to a task queue;

[0132] The control unit 503 is used to:

[0133] The target thread is controlled to read the preload task from the task queue and execute the read preload task.

[0134] Optionally, the device further comprises:

[0135] The deleting unit is used to delete the executed preloading task from the task queue after the target thread executes the read preloading task.

[0136] Optionally, the device further comprises: a reading unit and a processing unit;

[0137] The reading unit is used for, in response to the target timer count reaching a preset value, the main thread reading the task queue, the target timer count reaching the preset value, indicating that the time difference between the current moment and the start moment when the main thread starts to execute the processing task corresponding to the current picture frame to be rendered reaches the preset time difference value;

[0138] The processing unit is used for:

[0139] In response to the existence of tasks in the task queue, the main thread executes the tasks in the task queue; or, in response to the absence of tasks in the task queue, the main thread reads and executes tasks from a preset storage space, wherein the preset storage space stores at least one processing task corresponding to a picture frame to be rendered.

[0140] Since the device 500 is a device corresponding to the method provided in the above method embodiment, the specific implementation of each unit of the device 500 is based on the same concept as the above method embodiment. Therefore, for the specific implementation of each unit of the device 500, reference can be made to the description part of the above method embodiment, which will not be repeated here.

[0141] The embodiment of the present application also provides a device, the device comprising a processor and a memory;

[0142] The processor is used to execute the instructions stored in the memory, so that the device executes the task processing method based on screen rendering provided by the above method embodiment.

[0143] An embodiment of the present application provides a computer-readable storage medium, including instructions, wherein the instructions instruct a device to execute the task processing method based on screen rendering provided in the above method embodiment.

[0144] An embodiment of the present application provides a computer program product. When the computer program product is run on a computer, the computer is enabled to execute the task processing method based on screen rendering provided by the above method embodiment.

[0145] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.

[0146] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

[0147] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.

Claims

1. A task processing method based on picture rendering, characterized in that: The method comprises: Monitor the main thread to execute the processing task corresponding to the current frame to be rendered; Obtain part or all of the processing tasks corresponding to the next frame to be rendered as preload tasks; In response to monitoring that the processing task corresponding to the current frame to be rendered is completed, controlling a target thread to immediately execute the preloading task, the target thread including the main thread and / or the child thread.

2. The method according to claim 1, characterized in that: The processing tasks include input type tasks, animation type tasks, traversal type tasks and submission type tasks; The monitoring main thread executes the processing task corresponding to the current picture frame to be rendered, comprising: using a pre-created monitoring task of a submission type to monitor the main thread execute the processing task corresponding to the current picture frame to be rendered; The responding to monitoring that the processing task corresponding to the current frame to be rendered is completed includes: responding to monitoring that the monitoring task is triggered.

3. The method according to claim 1, characterized in that Obtain part or all of the processing tasks corresponding to the next frame to be rendered as preload tasks, including: Acquire a plurality of processing tasks from a preset storage space, wherein the preset storage space stores at least one processing task corresponding to a picture frame to be rendered; Determine the processing task corresponding to the next frame to be rendered based on the difference between the processing time of the plurality of processing tasks and the current time; The preloading task is determined from the processing tasks corresponding to the next frame to be rendered.

4. The method according to claim 1, characterized in that The method further comprises: Adding the preload task to the task queue; The controlling target thread to immediately execute the preloading task includes: The target thread is controlled to read the preload task from the task queue and execute the read preload task.

5. The method according to claim 4, characterized in that After the target thread executes the read preload task, the method further includes: The executed preloading task is deleted from the task queue.

6. The method according to claim 5, characterized in that The method further comprises: In response to the target timer counting reaching a preset value, the main thread reads the task queue, and the target timer counting reaches the preset value, indicating that the time difference between the current moment and the start moment when the main thread starts to execute the processing task corresponding to the current picture frame to be rendered reaches the preset time difference value; In response to the existence of tasks in the task queue, the main thread executes the tasks in the task queue; or, In response to the absence of a task in the task queue, the main thread reads and executes a task from a preset storage space, wherein the preset storage space stores at least one processing task corresponding to a picture frame to be rendered.

7. A task processing device based on picture rendering, characterized in that: The device comprises: A monitoring unit, used to monitor the main thread to execute the processing task corresponding to the current picture frame to be rendered; An acquisition unit, used for acquiring part or all of the processing tasks corresponding to the next frame to be rendered as preloaded tasks; The control unit is used to control the target thread to immediately execute the preloading task in response to monitoring that the processing task corresponding to the current picture frame to be rendered is completed, and the target thread includes the main thread and / or the child thread.

8. The device according to claim 7, characterized in that The processing tasks include input type tasks, animation type tasks, traversal type tasks and submission type tasks; The monitoring unit is used to: monitor the main thread's execution of a processing task corresponding to a current picture frame to be rendered using a pre-created monitoring task of a submission type; The control unit is used to: in response to monitoring that the monitoring task is triggered, control the target thread to immediately execute the preloading task, and the target thread includes the main thread and / or the sub-thread.

9. A device, characterized in that: The device comprises a processor and a memory; The processor is configured to execute instructions stored in the memory, so that the device performs the method according to any one of claims 1 to 6.

10. A computer-readable storage medium, characterized in that: The method comprises instructions for instructing a device to execute the method according to any one of claims 1 to 6.