Interface generation method and electronic device

By splitting the rendering tree and converting rendering instructions in parallel, the lag problem when generating electronic device interfaces is solved and high-efficiency interface updates are achieved.

CN117806745BActive Publication Date: 2024-10-29HUAWEI TECH CO LTD

Patent Information

Application Number
CN202211281435.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-19
Publication Date
2024-10-29
Estimated Expiration
2042-10-19

AI Technical Summary

Technical Problem

When the electronic device generates the second frame interface, it takes too long for the rendering tree to convert to rendering instructions, causing screen freezes. In order to improve computing power, the CPU frequency needs to be increased, resulting in increased energy consumption and reduced energy efficiency ratio.

Method used

By splitting the rendering tree into multiple sub-rendering trees and converting them into rendering instructions in parallel, the time it takes for the sub-rendering trees to be converted into rendering instructions is reduced, interface lag is avoided, and the CPU frequency is adjusted according to the workload of the rendering tree to balance computing power and energy consumption. .

Benefits of technology

It effectively avoids interface freezes and frame drops, reduces the energy consumption of interface generation, and improves the energy efficiency ratio of interface generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117806745B_ABST
    Figure CN117806745B_ABST
Patent Text Reader

Abstract

The present application discloses an interface generation method and an electronic device, and relates to the field of electronic technology. The interface generation method provided by the present application includes: splitting a rendering tree into multiple sub-rendering trees, converting the multiple sub-rendering trees into rendering instructions in parallel through multiple threads, and then generating an interface based on the rendering instructions, thereby reducing the delay of converting the rendering tree into the rendering instructions, and avoiding frame drops and freezes in the interface.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of electronic technology, and in particular to an interface generation method and an electronic device. Background Art

[0002] With the development of technology, the resolution and refresh rate of the screens of electronic devices are getting higher and higher, wherein the resolution of the screen affects the pixels contained in a frame of interface, and the refresh rate affects the time to generate a frame of interface.

[0003] Before the electronic device displays a first frame interface, the electronic device needs to expend computing resources to generate the first frame interface; before the electronic device displays a second frame interface, the electronic device needs to expend computing resources again to generate the second frame interface.

[0004] When the electronic device fails to generate the second frame interface in time, the content displayed on the screen of the electronic device will freeze. In order to ensure that the second frame interface can be generated in time, the electronic device often increases the CPU operating frequency to improve the computing power of the electronic device, which leads to higher energy consumption for the electronic device to generate a frame interface, reducing the energy efficiency of interface generation. Summary of the invention

[0005] The embodiment of the present application provides an interface generation method and an electronic device. The interface generation method provided in the embodiment of the present application splits a rendering tree into multiple sub-rendering trees, and then converts the multiple sub-rendering trees into rendering instructions in parallel, thereby reducing the time it takes for the sub-rendering trees to be converted into rendering instructions, thereby reducing the time it takes to generate an interface, and avoiding freezes, frame drops, etc. in the interface.

[0006] In a first aspect, an embodiment of the present application provides an interface generation method, which is applied to an electronic device running a first application, the method comprising: the electronic device generates a first rendering tree, the first rendering tree comprising a drawing operation for generating a frame interface of the first application; the electronic device splits the first rendering tree to obtain N sub-rendering trees, where N is greater than 1; the electronic device converts the N sub-rendering trees into first rendering instructions in parallel, the rendering instructions are instructions in a rendering engine, an image processing library, or a GPU driver; the electronic device generates a frame interface of the first application based on the first rendering instruction.

[0007] In the above embodiment, the rendering tree is split into multiple sub-rendering trees, and then the multiple sub-rendering trees are converted into rendering instructions in parallel, which reduces the time it takes to convert the sub-rendering trees into rendering instructions, thereby reducing the time it takes to generate an interface and avoiding freezes, frame drops, etc. in the interface.

[0008] In combination with some embodiments of the first aspect, in some embodiments, the electronic device splits the first rendering tree to obtain N sub-rendering trees, specifically including: the electronic device determines a first task amount, the first task amount is the task amount of the first rendering tree, and the first task amount is used to indicate the time consumption or calculation amount of converting the first rendering tree into the first rendering instruction; in response to the electronic device determining that the first task amount is greater than a first threshold, the electronic device splits the first rendering tree to obtain the N sub-rendering trees.

[0009] In the above embodiment, considering that when the task amount of the rendering tree is greater than the threshold, it takes a long time for the rendering tree to be converted into rendering instructions. In this case, the rendering tree is split into multiple sub-rendering trees to reduce the time. When the task amount of the rendering tree is less than the threshold, the rendering tree may not be split.

[0010] In combination with some embodiments of the first aspect, in some embodiments, after the electronic device determines the first task amount, the method also includes: the electronic device determines M based on the first task amount and the first threshold, where M is less than or equal to N, and M is an integer greater than or equal to the ratio of the first task amount to the first threshold; the electronic device determines the integer greater than or equal to M as N.

[0011] In the above embodiment, splitting the rendering tree may first determine the minimum number of sub-rendering trees that need to be split, and then determine the method of splitting the rendering tree; the number of sub-rendering trees to be split may be determined by a threshold and the task amount of the rendering tree.

[0012] In combination with some embodiments of the first aspect, in some embodiments, the electronic device determines the first task amount, specifically including: the electronic device determines the first task amount by determining the task amount of drawing operations in the first rendering tree.

[0013] In the above embodiment, the first task amount may be determined in a variety of ways.

[0014] In combination with some embodiments of the first aspect, in some embodiments, the N sub-rendering trees include a second rendering tree and a third rendering tree, a difference between the second task amount and the third task amount is less than a difference threshold, the second task amount is the task amount of the second rendering tree, and the second task amount is used to measure the time consumption or the amount of calculation for converting the second rendering tree into rendering instructions, and the third task amount is the task amount of the third rendering tree, and the third task amount is used to measure the time consumption or the amount of calculation for converting the third rendering tree into rendering instructions.

[0015] In the above embodiment, after determining the minimum number of sub-rendering trees that need to be split and splitting the corresponding number of sub-rendering trees, the sub-rendering trees can be further split so that the task amount of each sub-rendering tree is less than a threshold.

[0016] In combination with some embodiments of the first aspect, in some embodiments, the electronic device splits the first rendering tree to obtain N sub-rendering trees, specifically including: the electronic device determines that a root rendering node of the first rendering tree has N child nodes, and the child nodes are rendering nodes directly connected to the rendering node; and the electronic device splits the first rendering tree into the N sub-rendering trees.

[0017] In the above embodiment, the rendering tree may be split according to its data structure to obtain multiple rendering sub-trees.

[0018] In combination with some embodiments of the first aspect, in some embodiments, the electronic device splits the first rendering tree to obtain N sub-rendering trees, specifically including: the electronic device divides the interface of the first application into N areas; the electronic device splits the first rendering tree based on the N areas to obtain N sub-rendering trees, and the N sub-rendering trees correspond one-to-one to the N areas.

[0019] In the above embodiment, the interface may be divided into N regions first, and then the rendering tree may be split according to the regions to obtain N sub-rendering trees.

[0020] In combination with some embodiments of the first aspect, in some embodiments, the electronic device splits the first rendering tree to obtain N sub-rendering trees, specifically including: the electronic device determines a first task amount, the first task amount is the task amount of the first rendering tree, the first task amount is used to measure the time consumption or calculation amount of the first rendering tree being converted into rendering instructions, and the first task amount is greater than a first threshold; the electronic device determines that the root rendering node of the first rendering tree has K child nodes, and K is less than N; the electronic device splits the first rendering tree into K sub-rendering trees; after the electronic device determines that the task amount of the fourth rendering tree is greater than the first threshold, the electronic device splits the fourth rendering tree to obtain N-K+1 rendering sub-trees, the K sub-rendering trees include the fourth rendering tree, and the task amounts of the N rendering sub-trees are all less than the first threshold.

[0021] In the above embodiment, the rendering tree and the rendering subtrees can be split so that the task amount of each rendering subtree is less than the threshold, thereby ensuring that the time for converting the rendering subtree into a rendering instruction will not time out, thereby ensuring timely generation of the interface.

[0022] In combination with some embodiments of the first aspect, in some embodiments, the electronic device converts the N sub-rendering trees into a first rendering instruction in parallel, specifically including: the electronic device fills the instructions converted from the N sub-rendering trees into N buffers through N threads respectively; the electronic device submits the instructions of the N buffers to a first buffer, and the instructions in the first buffer are the first rendering instructions.

[0023] In the above embodiment, after converting multiple rendering subtrees into multiple rendering instructions, it is also necessary to merge the rendering instructions into a buffer, and then submit the buffer to the GPU to drive the GPU to generate an interface.

[0024] In a second aspect, an embodiment of the present application provides an interface generation method, which is applied to an electronic device running a first application, the method comprising: the electronic device generates a first rendering tree through the first process, the first rendering tree includes drawing operations for generating a frame interface of the first process; the electronic device splits the first rendering tree into a second rendering tree and a third rendering tree, the second rendering tree includes some drawing operations in the first rendering tree, the third rendering tree includes some drawing operations in the first rendering tree, and the second rendering tree is different from the third rendering tree; the electronic device converts the second rendering tree into a first rendering instruction through a first thread, the first rendering instruction is stored in a first buffer, and the rendering instruction is an instruction in a rendering engine, an image processing library or a GPU driver; the electronic device converts the third rendering tree into a second rendering instruction through a second thread, and the second instruction is stored in a second buffer; the electronic device generates a frame interface of the first process based on the first rendering instruction and the second rendering instruction.

[0025] In the above embodiment, the electronic device can split the rendering tree generated by the process into multiple rendering trees, generate multiple groups of rendering instructions through different threads, and finally generate a frame of interface based on the multiple groups of rendering instructions. Since the threads are parallel, the time required to convert the rendering tree into rendering instructions can be reduced.

[0026] In combination with some embodiments of the second aspect, in some embodiments, the electronic device determines a first task amount, where the first task amount is the task amount of the first rendering tree, and the first task amount is used to measure the time or computational amount required to convert the first rendering tree into rendering instructions, and the first task amount is greater than a first threshold.

[0027] In the above embodiment, considering that when the task amount of the rendering tree is greater than the threshold, it takes a long time for the rendering tree to be converted into rendering instructions. In this case, the rendering tree is split into multiple sub-rendering trees to reduce the time. When the task amount of the rendering tree is less than the threshold, the rendering tree may not be split.

[0028] In combination with some embodiments of the second aspect, in some embodiments, the electronic device generates a frame interface of the first process based on the first instruction and the second instruction, specifically including: the first rendering instruction is located in a first buffer held by the first thread, the second rendering instruction is located in a second buffer held by the second thread, and the electronic device submits the instructions in the first buffer and the rendering instructions in the second buffer to a third buffer; the electronic device generates a frame interface of the first process based on the third buffer.

[0029] In the above embodiment, the electronic device may submit rendering instructions in multiple buffers to one buffer, thereby driving the GPU to generate an interface.

[0030] In combination with some embodiments of the second aspect, in some embodiments, the third buffer is the second buffer, or the third buffer is the first buffer.

[0031] In a third aspect, an embodiment of the present application provides an interface generation method, which is applied to an electronic device running a first application, the method comprising: the electronic device generates a first rendering tree, the first rendering tree comprising a drawing operation for generating a frame interface of the first application; the electronic device determines a first task amount, the first task amount is the task amount of the first rendering tree, the first task amount is used to measure the time or calculation amount of the first rendering tree being converted into a rendering instruction, the first task amount is greater than a first threshold, and the rendering instruction is an instruction in a rendering engine, an image processing library or a GPU driver; if the first task amount is greater than the first threshold, the electronic device configures the CPU operating frequency to change from a first frequency to a second frequency, and the second frequency is higher than the first frequency; the electronic device generates a frame interface of the first application based on the first rendering tree; during the process of the electronic device generating the one frame interface of the first application, the electronic device operates at the second frequency.

[0032] In the above embodiment, the electronic device can determine whether to adjust the CPU frequency according to the relationship between the task volume of the rendering tree and the threshold. If the task volume of the rendering tree is greater than the threshold, the rendering tree operates at a higher frequency so that the rendering tree can be converted into rendering instructions in a timely manner.

[0033] In combination with some embodiments of the third aspect, in some embodiments, the electronic device generates a frame interface of the first application based on the first rendering tree, specifically including: the electronic device splits the first rendering tree to obtain N sub-rendering trees, where N is an integer greater than 1; the electronic device converts the N sub-rendering trees into first rendering instructions in parallel; the electronic device generates a frame interface of the first application based on the first rendering instructions.

[0034] In the above embodiment, the electronic device may further split the rendering tree into multiple sub-rendering trees, and convert the multiple sub-rendering trees into rendering instructions in parallel to reduce the duration of converting the rendering tree into rendering instructions.

[0035] In a fourth aspect, an embodiment of the present application provides an interface generation method, which is applied to an electronic device running a first application, the method comprising: the electronic device generates a first rendering tree, the first rendering tree comprising drawing operations for generating a frame interface of the first application; the electronic device traverses different parts of the first rendering tree through multiple different threads to generate a first rendering instruction, the rendering instruction is an instruction in a rendering engine, an image processing library or a GPU driver; the electronic device generates a frame interface of the first application based on the first rendering instruction.

[0036] In the above embodiment, the electronic device traverses the rendering tree in different orders and converts the rendering tree into rendering instructions in parallel through multiple threads, thereby reducing the latency of converting the rendering tree into rendering instructions and ensuring that the electronic device can generate an interface in a timely manner.

[0037] In combination with some embodiments of the fourth aspect, in some embodiments, before the electronic device traverses the first rendering tree in different orders through multiple different threads to generate a first instruction, the method also includes: the electronic device determines a first task amount, the first task amount is the task amount of the first rendering tree, and the first task amount is used to measure the time or computational amount of converting the first rendering tree into the first rendering instruction; the electronic device determines that the first task amount is greater than a first threshold.

[0038] In the above embodiment, considering that the time required to convert the rendering tree into rendering instructions is long when the amount of tasks of the rendering tree is greater than a threshold, in this case, the rendering tree is converted into rendering instructions in parallel through multiple threads, thereby reducing the conversion time.

[0039] In combination with some embodiments of the fourth aspect, in some embodiments, the electronic device traverses the first rendering tree in different orders through multiple different threads to generate a first instruction, specifically including: the electronic device traverses the first part of the first rendering tree through the first thread, and saves the generated second rendering instruction in the first buffer; the electronic device traverses the second part of the first rendering tree through the second thread, and saves the generated third rendering instruction in the second buffer; the electronic device submits the rendering instructions in the first buffer and the rendering instructions in the second buffer to the third buffer to obtain the first rendering instruction.

[0040] In the above embodiment, rendering instructions generated by conversion of different threads may be located in different buffers, and finally the rendering instructions in different buffers are submitted to the same buffer, thereby driving the GPU to generate an interface.

[0041] In combination with some embodiments of the fourth aspect, in some embodiments, the electronic device submits the rendering instructions in the first buffer and the rendering instructions in the second buffer to the third buffer to obtain the first rendering instruction, specifically including: the rendering instructions in the first buffer include second rendering instructions and third rendering instructions, and the instructions in the second buffer include fourth rendering instructions; the instructions in the third buffer are arranged in the following order: second rendering instructions, fourth rendering instructions, and third rendering instructions.

[0042] In the above embodiment, when the rendering instructions in different buffers are submitted to the same buffer, the order of the rendering instructions can be adjusted, thereby restoring the dependency of the rendering nodes.

[0043] In a fifth aspect, an embodiment of the present application provides an electronic device, comprising: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute: the electronic device generates a first rendering tree, the first rendering tree includes a drawing operation for generating a frame interface of the first application; the electronic device splits the first rendering tree to obtain N sub-rendering trees, where N is greater than 1; the electronic device converts the N sub-rendering trees into a first rendering instruction in parallel, the rendering instruction is an instruction in a rendering engine, an image processing library or a GPU driver; the electronic device generates a frame interface of the first application based on the first rendering instruction.

[0044] In combination with some embodiments of the fifth aspect, in some embodiments, the one or more processors are specifically used to call the computer instruction to enable the electronic device to execute: the electronic device determines a first task amount, the first task amount is the task amount of the first rendering tree, and the first task amount is used to indicate the time consumption or calculation amount of converting the first rendering tree into the first rendering instruction; in response to the electronic device determining that the first task amount is greater than a first threshold, the electronic device splits the first rendering tree to obtain the N sub-rendering trees.

[0045] In combination with some embodiments of the fifth aspect, in some embodiments, the one or more processors are also used to call the computer instructions to cause the electronic device to execute: the electronic device determines M based on the first task amount and the first threshold, and M is less than or equal to N, and M is an integer greater than or equal to the ratio of the first task amount to the first threshold; the electronic device determines the integer greater than or equal to M as N.

[0046] In combination with some embodiments of the fifth aspect, in some embodiments, the one or more processors are specifically used to call the computer instruction to cause the electronic device to execute: the electronic device determines the first task amount by determining the task amount of the drawing operations in the first rendering tree.

[0047] In combination with some embodiments of the fifth aspect, in some embodiments, the N sub-rendering trees include a second rendering tree and the third rendering tree, a difference between the second task volume and the third task volume is less than a difference threshold, the second task volume is the task volume of the second rendering tree, and the second task volume is used to measure the time consumption or the amount of calculation for converting the second rendering tree into rendering instructions, and the third task volume is the task volume of the third rendering tree, and the third task volume is used to measure the time consumption or the amount of calculation for converting the third rendering tree into rendering instructions.

[0048] In combination with some embodiments of the fifth aspect, in some embodiments, the one or more processors are specifically used to call the computer instruction to cause the electronic device to execute: the electronic device determines that the root rendering node of the first rendering tree has N child nodes, and the child nodes are rendering nodes directly connected to the rendering node; the electronic device splits the first rendering tree into N child rendering trees.

[0049] In combination with some embodiments of the fifth aspect, in some embodiments, the one or more processors are specifically used to call the computer instructions to cause the electronic device to execute: the electronic device divides the interface of the first application into N areas; the electronic device splits the first rendering tree based on the N areas to obtain N sub-rendering trees, and the N sub-rendering trees correspond one-to-one to the N areas.

[0050] In combination with some embodiments of the fifth aspect, in some embodiments, the one or more processors are specifically used to call the computer instructions to enable the electronic device to execute: the electronic device determines a first task amount, the first task amount is the task amount of the first rendering tree, the first task amount is used to measure the time or calculation amount of the first rendering tree being converted into rendering instructions, and the first task amount is greater than a first threshold; the electronic device determines that the root rendering node of the first rendering tree has K child nodes, and K is less than N; the electronic device splits the first rendering tree into K sub-rendering trees; after the electronic device determines that the task amount of the fifth rendering tree is greater than the first threshold, the electronic device splits the fifth rendering tree to obtain N-K+1 rendering sub-trees, the K sub-rendering trees include the fifth rendering tree, and the task amounts of the N rendering sub-trees are all less than the first threshold.

[0051] In combination with some embodiments of the fifth aspect, in some embodiments, the one or more processors are specifically used to call the computer instructions to enable the electronic device to execute: the electronic device fills the instructions converted from the N sub-rendering trees into N buffers through N threads respectively; the electronic device submits the instructions of the N buffers to a first buffer, and the instructions in the first buffer are the first rendering instructions.

[0052] In a sixth aspect, an embodiment of the present application provides an electronic device, comprising: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store a computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute: the electronic device generates a first rendering tree through the first process, and the first rendering tree includes a drawing operation for generating a frame interface of the first process; the electronic device splits the first rendering tree into a second rendering tree and a third rendering tree, the second rendering tree includes part of the drawing operations in the first rendering tree, and the third rendering tree includes part of the drawing operations in the first rendering tree, and the second rendering tree is different from the third rendering tree; the electronic device converts the second rendering tree into a first rendering instruction through a first thread, the first rendering instruction is stored in a first buffer, and the rendering instruction is an instruction in a rendering engine, an image processing library or a GPU driver; the electronic device converts the third rendering tree into a second rendering instruction through a second thread, and the second instruction is stored in a second buffer; the electronic device generates a frame interface of the first process based on the first rendering instruction and the second rendering instruction.

[0053] In combination with some embodiments of the sixth aspect, in some embodiments, the one or more processors are further used to call the computer instruction to cause the electronic device to execute: the electronic device determines a first task amount, the first task amount is the task amount of the first rendering tree, the first task amount is used to measure the time or computational amount of converting the first rendering tree into rendering instructions, and the first task amount is greater than a first threshold.

[0054] In combination with some embodiments of the sixth aspect, in some embodiments, the one or more processors are also used to call the computer instructions to enable the electronic device to execute: the first rendering instruction is located in the first buffer held by the first thread, the second rendering instruction is located in the second buffer held by the second thread, and the electronic device submits the instructions in the first buffer and the rendering instructions in the second buffer to the third buffer; the electronic device generates a frame interface of the first process based on the third buffer.

[0055] In combination with some embodiments of the sixth aspect, in some embodiments, the third buffer is the second buffer, or the third buffer is the first buffer.

[0056] In a seventh aspect, an embodiment of the present application provides an electronic device, comprising: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store a computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute: the electronic device generates a first rendering tree, the first rendering tree includes a drawing operation for generating a frame interface of the first application; the electronic device determines a first task amount, the first task amount is the task amount of the first rendering tree, the first task amount is used to measure the time or calculation amount of the first rendering tree being converted into a rendering instruction, the first task amount is greater than a first threshold, and the rendering instruction is an instruction in a rendering engine, an image processing library or a GPU driver; if the first task amount is greater than the first threshold, the electronic device configures the CPU to change its operating frequency from a first frequency to a second frequency, and the second frequency is higher than the first frequency; the electronic device generates a frame interface of the first application based on the first rendering tree; in the process of the electronic device generating a frame interface of the first application, the electronic device operates at the second frequency.

[0057] In combination with some embodiments of the seventh aspect, in some embodiments, the one or more processors are specifically used to call the computer instruction to enable the electronic device to execute: the electronic device splits the first rendering tree to obtain N sub-rendering trees, where N is an integer greater than 1; the electronic device converts the N sub-rendering trees into a first rendering instruction in parallel; the electronic device generates a frame interface of the first application based on the first rendering instruction.

[0058] In an eighth aspect, an embodiment of the present application provides an electronic device, comprising: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute: the electronic device generates a first rendering tree, the first rendering tree includes a drawing operation for generating a frame interface of the first application; the electronic device traverses different parts of the first rendering tree through multiple different threads to generate a first rendering instruction, the rendering instruction is an instruction in a rendering engine, an image processing library or a GPU driver; the electronic device generates a frame interface of the first application based on the first rendering instruction.

[0059] In combination with some embodiments of the eighth aspect, in some embodiments, the one or more processors are further used to call the computer instruction to cause the electronic device to execute: the electronic device determines a first task amount, the first task amount is the task amount of the first rendering tree, and the first task amount is used to measure the time or computational amount of converting the first rendering tree into the first rendering instruction; the electronic device determines that the first task amount is greater than a first threshold.

[0060] In combination with some embodiments of the eighth aspect, in some embodiments, the one or more processors are specifically used to call the computer instructions to enable the electronic device to execute: the electronic device traverses the first part of the first rendering tree through a first thread, and saves the generated second rendering instructions in a first buffer; the electronic device traverses the second part of the first rendering tree through a second thread, and saves the generated third rendering instructions in a second buffer; the electronic device submits the rendering instructions in the first buffer and the rendering instructions in the second buffer to the third buffer to obtain the first rendering instructions.

[0061] In combination with some embodiments of the eighth aspect, in some embodiments, the one or more processors are specifically used to call the computer instructions to cause the electronic device to execute: the rendering instructions of the first buffer include second rendering instructions and third rendering instructions, and the instructions of the second buffer include fourth rendering instructions; the instructions of the third buffer are arranged in the following order: second rendering instructions, fourth rendering instructions, and third rendering instructions.

[0062] In the ninth aspect, an embodiment of the present application provides a chip system, which is applied to an electronic device, and the chip system includes one or more processors, which are used to call computer instructions so that the electronic device executes a method described in the first aspect, the second aspect, the third aspect, the fourth aspect, any possible implementation of the first aspect, any possible implementation of the second aspect, any possible implementation of the third aspect, and any possible implementation of the fourth aspect.

[0063] In the tenth aspect, an embodiment of the present application provides a computer program product comprising instructions. When the above-mentioned computer program product runs on an electronic device, the above-mentioned electronic device executes the method described in the first aspect, the second aspect, the third aspect, the fourth aspect, any possible implementation of the first aspect, any possible implementation of the second aspect, any possible implementation of the third aspect, and any possible implementation of the fourth aspect.

[0064] In the eleventh aspect, an embodiment of the present application provides a computer-readable storage medium, comprising instructions. When the above instructions are executed on an electronic device, the above electronic device executes the method described in the first aspect, the second aspect, the third aspect, the fourth aspect, any possible implementation of the first aspect, any possible implementation of the second aspect, any possible implementation of the third aspect, and any possible implementation of the fourth aspect.

[0065] It can be understood that the electronic devices provided in the fifth, sixth, seventh and eighth aspects, the chip system provided in the ninth aspect, the computer program product provided in the tenth aspect and the computer storage medium provided in the eleventh aspect are all used to execute the methods provided in the embodiments of the present application. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods, which will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0066] Figure 1 An exemplary schematic diagram of generating a bitmap by an application provided in an embodiment of the present application.

[0067] Figure 2 An exemplary schematic diagram of the process of generating an interface for an electronic device provided in an embodiment of the present application.

[0068] Figure 3 An exemplary schematic diagram of the interface generation method provided in an embodiment of the present application.

[0069] Figure 4 An exemplary schematic diagram of determining the task amount of a rendering tree provided in an embodiment of the present application.

[0070] Figure 5A and Figure 5B An exemplary schematic diagram of splitting a rendering tree provided in an embodiment of the present application.

[0071] Fig. 6A and Figure 6B An exemplary schematic diagram of a split rendering tree provided in an embodiment of the present application.

[0072] Figure 7 Another exemplary schematic diagram of splitting a rendering tree provided in an embodiment of the present application.

[0073] Figure 8 An exemplary schematic diagram of converting a rendering tree into GPU instructions in parallel is provided in an embodiment of the present application.

[0074] Fig. 9A and Fig. 9B Another exemplary schematic diagram of the process of generating an interface for an electronic device provided in an embodiment of the present application.

[0075] Fig.10 Another exemplary schematic diagram of the process of the interface generation method provided in an embodiment of the present application.

[0076] Fig.11 An exemplary schematic diagram of adjusting CPU computing power based on the amount of tasks of a rendering tree provided in an embodiment of the present application.

[0077] Fig.12Another exemplary schematic diagram of the interface generation method provided in an embodiment of the present application.

[0078] Fig.13 An exemplary schematic diagram of a rendering thread traversing a rendering tree in different orders provided in an embodiment of the present application.

[0079] Fig.14 An exemplary schematic diagram of submitting GPU instructions to an instruction queue provided in an embodiment of the present application.

[0080] Fig.15 An exemplary schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application.

[0081] Fig.16 An exemplary schematic diagram of the software structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0082] The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to be used as limitations to the present application. As used in the specification and appended claims of the present application, the singular expressions "one", "a kind of", "the", "above", "the" and "this" are intended to also include plural expressions, unless there is a clear indication to the contrary in the context. It should also be understood that the term "and / or" used in the present application refers to and includes any or all possible combinations of one or more listed items.

[0083] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, unless otherwise specified, "plurality" means two or more.

[0084] The term "user interface (UI)" in the following embodiments of the present application refers to a medium interface for interaction and information exchange between an application or operating system and a user, which realizes the conversion between the internal form of information and the form acceptable to the user. The user interface is a source code written in a specific computer language such as Java and extensible markup language (XML). The interface source code is parsed and rendered on an electronic device, and finally presented as content that can be recognized by the user. The commonly used form of user interface is a graphical user interface (GUI), which refers to a user interface related to computer operation displayed in a graphical manner. It can be a visual interface element such as text, icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets, etc. displayed on the display screen of an electronic device.

[0085] For ease of understanding, the following first introduces the relevant terms and concepts involved in the embodiments of the present application. The terms used in the embodiments of the present invention are only used to explain the specific embodiments of the present invention, and are not intended to limit the present invention.

[0086] The interface is a medium interface for interaction and information exchange between the application and the user. Every time a vertical synchronization signal arrives, the electronic device needs to generate the interface of the application for the foreground application. The frequency of the vertical synchronization signal is related to the refresh rate of the screen of the electronic device. For example, the frequency of the vertical synchronization signal is the same as the refresh rate of the screen of the electronic device.

[0087] That is, each time before the electronic device refreshes the content displayed on the screen, it is necessary to generate the interface of the application for the foreground application, so as to show the newly generated interface of the application to the user when the screen is refreshed.

[0088] Among them, the electronic device generates the interface of the application program, which requires the application program to render and generate the bitmap by itself, and pass its own bitmap to the surface compositor (SurfaceFlinger). That is, the application program, as a producer, performs drawing to generate the bitmap, and stores the bitmap in the buffer queue (BufferQueue) provided by the surface compositor; the surface compositor, as a consumer, continuously obtains the bitmap generated by the application program from the BufferQueue. Among them, the bitmap is located on the surface generated by the application program, and the surface will be filled in the BufferQueue.

[0089] After the surface compositor obtains the bitmap of the visible application, the surface compositor and the hardware compositing strategy module (HWC) determine how to composite the bitmap as a layer.

[0090] After the surface synthesizer and / or the hardware synthesis strategy module performs bitmap synthesis, the surface synthesizer and / or the hardware synthesis strategy module fills the synthesized bitmap into the frame buffer and passes it to the display subsystem (DSS). After getting the synthesized bitmap, the DSS can display the synthesized bitmap on the screen. The frame buffer can be an on-screen buffer. Among them, the bitmap on the surface synthesizer can also be called a layer.

[0091] The process of the application generating a bitmap is as follows Figure 1 shown.

[0092] Figure 1 An exemplary schematic diagram of generating a bitmap by an application provided in an embodiment of the present application.

[0093] like Figure 1 As shown, after receiving the vertical synchronization signal (Vsync), the application starts to generate a bitmap. The specific steps can be divided into three steps, namely step S101, step S102 and step S103.

[0094] S101: The main thread traverses the views of the application and saves the drawing operation of each view into a newly generated rendering tree.

[0095] The main thread (UI thread) invalidates the view hierarchy, and the UI thread traverses the views of the application through measurement method calls (measure()), layout method calls (layout()), and drawing method calls (draw()), determines and saves the drawing operations of each view, and records the view and the drawing operations involved in the view (such as drawline) into the drawing instruction list (displaylist) of the rendering node (RenderNode) of the rendering tree. The data saved in the drawing instruction list can be a drawing operation structure (DrawOP or DrawListOP).

[0096] Among them, the view is the basic element that constitutes the application interface, and a control on the interface can correspond to one or more views.

[0097] Optionally, in some embodiments of the present application, within the drawing method call, the UI thread of the application also reads the content carried by the view into the memory. For example, the image carried by the image view (imageview), the text carried by the text view (textview). Alternatively, within the drawing method call, the UI thread of the application determines the operation of reading the content carried by the view into the memory and records it in the drawing instruction list. The drawing operation structure in the drawing instruction list can also be called a drawing instruction.

[0098] Among them, the drawing operation structure is a data structure used to draw graphics, such as drawing lines, drawing rectangles, drawing text, etc. When the rendering node is traversed, the drawing operation structure will be converted into API calls of the image processing library, interface calls in the OpenGLES library, Vulkan library, and Metal library through the rendering engine. For example, in the rendering engine (Skia library), drawline will be encapsulated as DrawLineOp, which is a data structure containing drawing data such as line length, width and other information. DrawLineOp will be further encapsulated as interface calls in the OpenGLES library, Vulkan library, and Metal library, and then obtain GPU instructions. In the following text, the interface calls in the Skia library, the OpenGLES library interface calls, the Vulkan library interface calls, and / or the Metal library interface calls are uniformly referred to as rendering instructions. That is, the rendering tree will be converted into rendering instructions by the rendering thread, and then further converted into GPU instructions that the GPU can recognize and process. Among them, OpenGLES library, Vulkan library, and Metal library can be collectively referred to as image processing library or graphics rendering library. In the process of generating a frame interface, the electronic device generates rendering instructions through OpenGLES library, Vulkan library or Metal library. The image processing library provides API and driver support for graphics rendering.

[0099] Among them, DrawOP can be stored in the stack of the application in a chain data structure.

[0100] The drawing instruction list may be a buffer, which records all drawing operation structures or identifiers of all drawing operations included in one frame interface of the application, such as addresses, serial numbers, etc. When the application has multiple windows or is displayed on different display areas (display), multiple rendering trees corresponding to the multiple windows need to be generated independently.

[0101] The rendering tree is a data structure generated by the UI thread and used to generate the application interface. The rendering tree may include multiple rendering nodes, each of which includes rendering attributes and a drawing instruction list. The rendering tree records part or all of the information for generating a frame of the application interface.

[0102] Optionally, in some embodiments of the present application, the UI thread may only traverse the view of the dirty area (also referred to as the area that needs to be redrawn) to generate a differential rendering tree. After the differential rendering tree is passed / synchronized to the rendering thread, the rendering thread may determine the rendering tree to be used for the current frame interface rendering by differentially comparing the rendering tree with the rendering tree used for the previous frame rendering.

[0103] S102: The main thread synchronizes the rendering tree to the rendering thread, and the rendering tree is located in the stack of the application.

[0104] The UI thread passes / synchronizes the rendering tree to the rendering thread, where the rendering tree is located in the stack of the process corresponding to the application.

[0105] S103: The rendering thread executes the drawing instructions in the rendering tree to generate a bitmap.

[0106] The rendering thread first obtains a hardware canvas (HardwareCanvas) and performs drawing operations in the rendering tree on the hardware canvas to generate a bitmap. The hardware canvas is located in the surface held by the application, and the surface carries bitmaps or other formats of data for storing image information.

[0107] S104: The rendering thread sends the surface carrying the bitmap to the surface compositor.

[0108] The rendering thread sends the generated bitmap to the surface compositor through the surface to participate in layer synthesis.

[0109] Step S101 can be considered as the construction phase, which is mainly responsible for determining the size, position, transparency and other properties of each view in the application. For example, the drawLine in the view can be encapsulated into a DrawLineOp in the construction, which contains the drawing data such as the length and width of the line, and can also contain the interface call corresponding to the DrawLineOp of the underlying graphics processing library, which is used to call the underlying graphics library to generate a bitmap in the rendering phase.

[0110] Similarly, step S103 can be considered as the rendering stage, which is mainly responsible for traversing the rendering nodes of the rendering tree and performing drawing operations on each rendering node, thereby generating a bitmap on the hardware canvas. In this process, the rendering thread calls the underlying graphics processing library, such as the OpenGLES library, the Vulkan library, the Metal library, etc., and then calls the GPU to complete the rendering to generate a bitmap.

[0111] Figure 2 An exemplary schematic diagram of the process of generating an interface for an electronic device provided in an embodiment of the present application.

[0112] like Figure 2 As shown, the process of generating the first frame interface is as follows: Figure 2 ①, ②, ③, ④ and ⑤; the process of generating the second frame interface is as follows: Figure 2 ⑥, ⑦ and ⑤ among them.

[0113] The process of the electronic device generating the first frame interface includes: after the UI thread of the application receives the vertical synchronization signal, the UI thread of the application generates a rendering tree, such as Figure 2 ① in the figure; after receiving the rendering tree, the rendering thread of the application needs to convert the drawing instruction list and rendering attributes in the rendering tree into GPU instructions, such as Vulkan library instructions, OpenGLES library instructions, Metal instructions, and other instructions that the GPU driver can recognize and process, such as Figure 2 ② in; GPU or GPU driver generates a bitmap after receiving GPU instructions, such as Figure 2 ③; The surface synthesizer and / or hardware synthesis strategy module receives the bitmap and uses the bitmap as a layer to perform layer synthesis, such as Figure 2 ④; The display subsystem receives the synthesized bitmap from the surface synthesizer and / or the hardware synthesis strategy module, and then sends it to the display, such as Figure 2 ⑤ in the.

[0114] The process of the electronic device generating the second frame interface includes: after the UI thread of the application receives the vertical synchronization signal, the UI thread of the application generates a rendering tree, such as Figure 2 ⑥; After receiving the rendering tree, the rendering thread of the application needs to convert the drawing instruction list and rendering attributes in the rendering tree into GPU instructions, such as Vulkan library instructions, OpenGLES library instructions, Metal instructions, and other instructions that the GPU driver can recognize and process, such as Figure 2 ⑦ in the.

[0115] However, in the process of the electronic device generating the second frame interface, since it takes a long time for the rendering thread to convert the drawing instruction list and rendering attributes in the rendering tree into instructions that the GPU can recognize and process, the bitmap cannot be passed to the surface compositor and / or the hardware synthesis strategy module in time. After receiving the vertical synchronization signal, the surface compositor and / or the hardware synthesis strategy module will perform layer synthesis and then send it for display. Since the surface compositor and / or the hardware synthesis strategy module did not receive the interface of the application in the second frame interface, the surface compositor and / or the hardware synthesis strategy module will use the interface of the application in the first frame interface as the interface of the application in the second frame interface to perform layer synthesis and then send it for display. Figure 2 ⑤ in the.

[0116] Obviously, since the rendering thread failed to convert the rendering attributes and drawing instruction lists in the rendering tree into GPU instructions in a timely manner, the GPU could not generate the bitmap in time, which caused the application interface to freeze.

[0117] Among them, in different scenarios, the reason why the rendering thread cannot convert the rendering tree into GPU instructions in time can be summarized as: the mismatch between the load of the rendering tree corresponding to the interface of the application to be generated and the computing power of the electronic device. The load of the rendering tree can be expressed in many ways, which are not limited here, for example, the amount of calculation of the rendering tree converted into GPU instructions, the memory usage of the rendering tree, etc. Among them, the matching of the load of the rendering tree and the computing power of the electronic device means that when the computing power of the electronic device is within a certain range, the rendering tree can always be converted into GPU instructions within a preset time; on the contrary, when the time for the rendering tree to be converted into GPU instructions exceeds the preset time, the interface of the application will freeze or drop frames. At this time, the load of the rendering tree does not match the computing power of the electronic device.

[0118] Optionally, in some implementations of the present application, the computing power of the electronic device may be increased by increasing the frequency of the CPU, so that the rendering thread can always convert the rendering tree into GPU instructions in a timely manner.

[0119] However, increasing the CPU frequency will increase the power consumption of the electronic device and reduce the energy efficiency of the electronic device in generating a frame of interface. Furthermore, before the rendering thread converts the rendering tree into GPU instructions, the rendering thread cannot determine the load of converting the rendering tree into GPU instructions and cannot select an appropriate CPU frequency.

[0120] Based on this, embodiments of the present application provide an interface generation method and an electronic device.

[0121] The interface generation method provided in the embodiment of the present application can have a built-in load scoring model on the electronic device. During the process of the UI thread of the application generating the rendering tree, or after the UI thread of the application generates the rendering tree, the UI thread or rendering thread or unified rendering process of the application can determine the load of the rendering tree converted into GPU instructions based on the load scoring model, and the electronic device further selects an appropriate CPU frequency based on the load.

[0122] Among them, the unified rendering process (unirender) is a process independent of the application, which is used to receive the rendering tree generated by the UI threads of different applications. Among them, the application and the unified rendering process complete data interaction through inter-process communication (IPC). For the specific content of the unified rendering process, please refer to the patent application with application number 2021114105136 and the invention name “Interface Generation Method and Electronic Device” and the patent application with application number 202111410643X and the invention name “Interface Generation Method and Electronic Device”, which will not be repeated here.

[0123] It can be understood that the interface generation method provided in the embodiment of the present application determines the load of the rendering tree converted into GPU instructions through a load scoring model, and then selects an appropriate CPU frequency so that the rendering thread or unified rendering process can execute the conversion of GPU instructions in a timely manner, while reducing the power consumption increase caused by increasing the CPU frequency.

[0124] Optionally, in some implementations of the present application, the interface generation method provided in the embodiments of the present application can split the rendering tree of the application, and the multiple rendering trees after splitting are converted into GPU instructions by different threads respectively.

[0125] Optionally, in some implementations of the present application, the interface generation method provided in the embodiments of the present application may modify the order of traversing the rendering tree so that a rendering tree may be traversed simultaneously by multiple threads to generate GPU instructions.

[0126] It is understandable that the interface generation method provided in the embodiment of the present application reduces the time consumption of converting the rendering tree into GPU instructions through multi-threaded parallelism, thereby reducing the probability of interface freezes. Moreover, without considering the overhead of multi-threaded parallelism, if the low-frequency energy efficiency of the CPU of the electronic device is relatively high, the rendering tree can be converted into GPU instructions through multi-threaded parallelism after reducing the frequency, and the energy efficiency of generating a frame of interface can be improved without increasing the time consumption of generating a frame of interface.

[0127] Combine the following Figure 3 The content shown exemplarily introduces the interface generation method and electronic device provided in the embodiments of the present application.

[0128] Figure 3 An exemplary schematic diagram of the process of the interface generation method provided in an embodiment of the present application.

[0129] S301: After receiving a vertical synchronization signal, the UI thread of the application generates a rendering tree corresponding to the current frame interface, and determines the task amount of the rendering tree during the process of generating the rendering tree.

[0130] The rendering tree corresponding to the current frame interface generated by the UI thread of the application can be referred to in the above Figure 1 The text description in will not be repeated here.

[0131] When the UI thread of the application generates a rendering tree, it can determine the task volume of the rendering tree by determining the task volume of each drawing operation or drawing operation structure. The task volume of the rendering tree is used to represent the task volume of converting the rendering tree into GPU instructions during the generation of the current frame interface.

[0132] Among them, when the computing power of the CPU is the same, such as the frequency, the task volume of the rendering tree is positively correlated with the time it takes to convert the rendering tree into GPU instructions.

[0133] Since the more complex the GPU instructions are, the longer it takes to convert the render tree into GPU instructions; and the more complex the GPU instructions are, the longer it takes for the GPU to render and generate the bitmap. Therefore, it can be considered that the amount of work in the render tree is positively correlated with the time it takes to generate the current frame interface.

[0134] The load scoring model may be a task model table as shown below.

[0135] A task model table may be stored locally in the electronic device or in a cloud accessible to the electronic device. The task model table contains task quantity scores corresponding to different drawing operation structures. The task model table is shown in Tables 1 and 2 below.

[0136] Table 1 and Table 2 are exemplary schematic tables of a task model table provided in an embodiment of the present application.

[0137] Table 1

[0138] Drawing operation or drawing operation structure Task volume DrawRect(param1, parameter2) (DrawRectOP) F1(parameter 1, parameter 2) DrawImage(parameter 3, parameter 4) (DrawImageOP) F2(parameter 3, parameter 4) ClipRect(parameter 5) F3(parameter 5)

[0139] As shown in Table 1, the task model table stores the correspondence between drawing operations or drawing operation structures and task amounts. For example, the task amount corresponding to DrawRect (parameter 1, parameter 2) is F1 (parameter 1, parameter 2), the task amount corresponding to DrawImage (parameter 3, parameter 4) is F2 (parameter 3, parameter 4), and the task amount corresponding to ClipRect (parameter 5) is F3 (parameter 5). Among them, F1(), F2(), and F3() are task amount calculation functions corresponding to different drawing operations or drawing operation structures.

[0140] Optionally, in some embodiments of the present application, the task model table may store the correspondence between the drawing operation or drawing operation structure and the time consumption of converting the drawing operation or drawing operation structure into GPU instructions under different CPU computing capabilities, as shown in Table 2.

[0141] Table 2

[0142] Drawing operation or drawing operation structure time consuming DrawRect(param1, parameter2) (DrawRectOP) T1(CPU parameter, parameter 1, parameter 2) DrawImage(parameter 3, parameter 4) (DrawImageOP) T2(CPU parameter, parameter 3, parameter 4) ClipRect(parameter 5) T3 (CPU parameter, parameter 5)

[0143] As shown in Table 2, the time consumption corresponding to DrawRect (parameter 1, parameter 2) is T1 (CPU parameter, parameter 1, parameter 2), the time consumption corresponding to DrawImage (parameter 3, parameter 4) is T2 (CPU parameter, parameter 3, parameter 4), and the task volume corresponding to ClipRect (parameter 5) is T3 (CPU parameter, parameter 5). Among them, T1(), T2(), and T3() are time consumption calculation functions corresponding to different drawing operations or drawing operation structures.

[0144] The task model table may be generated by offline testing. For example, developers of terminal manufacturers may test each drawing operation or drawing operation structure and record the time consumption or task amount to generate the task model table.

[0145] Alternatively, the task model table can be generated and updated online. For example, when a user uses an electronic device, the operating system on the electronic device records the time or amount of tasks of different drawing operations or drawing operation structures in the process of generating the interface, and then records and updates the task model table in real time. In this case, due to the different conditions of electronic devices of the same model, the task model table of the same model of electronic devices can be different, thereby more accurately evaluating the load of a frame interface. The condition of the electronic device may include the degree of aging of the electronic device, etc., which is not limited here.

[0146] Optionally, in some embodiments of the present application, rendering attributes may also be involved in the calculation of the task volume. This is because in the subsequent interface call process converted into the image processing library, the rendering attributes of the rendering node may also act on the drawing operations in the drawing instruction list of the rendering node, thereby affecting the converted GPU instructions.

[0147] Optionally, in some embodiments of the present application, the input parameters of the drawing operation may not be considered, different drawing operations correspond to different task amounts, and the same drawing operation, ie, the input parameters of the drawing operation may be different, corresponding to the same task amount.

[0148] Optionally, in some embodiments of the present application, after the UI thread of the application determines the task amount of the rendering tree, the task amount of the rendering tree can be saved as a separate parameter, and the separate parameter and the rendering tree are passed to the rendering thread or the unified rendering process.

[0149] Optionally, in some implementations of the present application, the UI thread of the application determines the task amount of each rendering node in the process of generating the rendering tree, and the task amount of each rendering node can be saved in the rendering node, such as Figure 4 The parameter used to save the task amount of the rendering node may be referred to as a task parameter.

[0150] Figure 4 An exemplary schematic diagram of determining the task amount of a rendering tree provided in an embodiment of the present application.

[0151] like Figure 4 As shown, the view structure corresponding to the current frame interface of the application is: the subviews of the root view (view container 0) are view container 1 and view container 2, view container 1 has several subviews, and the subviews of view container 2 include view 22.

[0152] When the UI thread of the application traverses the view, the UI thread of the application generates a rendering tree; when the UI thread of the application generates the rendering tree, the UI thread of the application determines the task amount of each rendering node based on the task model table, and then the UI thread of the application saves the task amount of each rendering node in the task parameters of the corresponding rendering node. For example, if the UI thread of the application has traversed the root view and view container 1, the rendering tree in the generation process includes the root rendering node and rendering node 1, and task parameters are added to the root rendering node and rendering node 1. Figure 4 In the figure, the root rendering node is the rendering node corresponding to the root view; rendering node 1 is the rendering node corresponding to view container 1.

[0153] After the UI thread of the application completes traversing the view, each rendering node of the rendering tree includes a task parameter, which stores the task amount of the rendering node. In subsequent processing, the UI thread, the rendering thread, or the rendering process can determine the task amount of the rendering node based on the task parameter in the rendering node.

[0154] Optionally, in some embodiments of the present application, in addition to storing the task amount of the rendering node, the task parameters in the root rendering node of the rendering tree may also store the task amount of the entire rendering tree. Further, for any rendering node in the rendering tree, in addition to storing the task amount of the rendering node, the task parameters in the rendering node may also store the task amount of a child rendering tree with the rendering node as the root rendering node.

[0155] Optionally, in some embodiments of the present application, the UI thread may determine the task amount of the differential rendering tree and save the task amount of the differential rendering tree in the task parameters. After the differential rendering tree is passed to the rendering thread or the unified rendering process, the rendering thread or the unified rendering process generates a rendering tree corresponding to the current frame interface based on the differential rendering tree and the rendering tree corresponding to the previous frame interface, and then determines the rendering tree corresponding to the current frame interface, and then the rendering thread or the unified rendering process determines the task amount of the rendering tree corresponding to the current frame interface.

[0156] S302: When the task amount of the rendering tree is greater than the task amount threshold, the application program splits the rendering tree based on the task amount to obtain multiple sub-rendering trees.

[0157] If the task parameter of the rendering node is used to determine the task volume of the rendering tree, as shown in Table 1 above, the UI thread, rendering thread or unified rendering process of the application determines whether the task volume of the rendering tree is greater than the task volume threshold 1. If the task volume of the rendering tree is greater than the task volume threshold 1, the UI thread, rendering thread or unified rendering process of the application splits the rendering tree to obtain multiple sub-rendering trees. The conditions that the multiple sub-rendering trees after splitting need to meet are: the task volume of any of the multiple sub-rendering trees after splitting is less than the task volume threshold 1.

[0158] Among them, the task volume threshold and the task volume threshold 1 can both be called the first threshold.

[0159] Alternatively, if the task parameters of the rendering node are used to determine the time taken to convert the rendering tree into GPU instructions, as shown in Table 2 above, the UI thread, rendering thread or unified rendering process of the application determines whether the task amount of the rendering tree is greater than the time threshold 1. If the task amount of the rendering tree is greater than the time threshold 1, the UI thread, rendering thread or unified rendering process of the application splits the rendering tree to obtain multiple sub-rendering trees. Among them, the conditions that need to be met by the multiple sub-rendering trees after splitting are: the time taken to convert any of the multiple sub-rendering trees after splitting into GPU instructions is less than the time threshold 1. Among them, the time threshold 1 may be related to the screen refresh rate. For example, the higher the screen refresh rate, the smaller the time threshold 1.

[0160] In the following text, we will take the workload of the render tree as an example. The workload of the render tree can have the same effect as the time-consuming process of converting the render tree into GPU instructions, so they can be replaced with each other.

[0161] Optionally, in some embodiments of the present application, after the UI thread of the application splits the rendering tree to obtain multiple sub-rendering trees, the data transmitted or synchronized by the UI thread of the application to the rendering thread or the unified rendering process are multiple sub-rendering trees.

[0162] Optionally, in some embodiments of the present application, splitting the rendering tree may take into account the concurrency overhead of threads and / or the dependencies between rendering nodes. The dependency of rendering nodes refers to the need for the drawing operation of the child node to be performed after the drawing operation of the parent node due to the parent-child relationship of the rendering nodes. The parent-child relationship of the rendering nodes may affect whether the interface can be generated correctly, because when the drawing operation of the parent node and the drawing operation in the child node operate on the same pixel, the drawing operation of the parent node needs to be executed before the drawing operation in the child node. On the contrary, when the drawing operation of the parent node and the drawing operation in the child node do not operate on the same pixel, the drawing operation of the parent rendering node is independent of the drawing operation in the child node and has no dependency.

[0163] Optionally, in some embodiments of the present application, without considering the overhead of thread concurrency, the rendering tree is split so that the amount of tasks (or time consumption) of any sub-rendering tree is less than a task amount threshold 1 (or a time threshold 1). The overhead of thread concurrency can also be characterized by the amount of tasks or time consumption.

[0164] Optionally, in some embodiments of the present application, taking into account the overhead of thread concurrency, the rendering tree is split so that the sum of the task volume (or time consumption) of any sub-rendering tree and the task volume (or time consumption) of thread concurrency is less than a task volume threshold 1 (or a time threshold 1).

[0165] Optionally, in some embodiments of the present application, when it is determined that the amount of tasks of the rendering tree is greater than a task amount threshold, the operating system may adjust the computing power of the CPU, such as adjusting the operating frequency of the CPU. Alternatively, when it is determined that the time taken to convert the rendering tree into GPU instructions exceeds a time threshold, the operating system may adjust the computing power of the CPU, such as adjusting the operating frequency of the CPU. The method of adjusting the CPU frequency based on the amount of tasks of the rendering tree can be referred to in the following Fig.10 and Fig.11 The corresponding text description is not repeated here.

[0166] Here are some examples of how to split the rendering tree:

[0167] (1) Splitting method when the task volume of the sub-rendering tree is less than the task volume threshold.

[0168] Figure 5A and Figure 5B An exemplary schematic diagram of splitting a rendering tree provided in an embodiment of the present application.

[0169] S501: Determine whether the task volume of the rendering tree is greater than a task volume threshold 1.

[0170] The UI thread, rendering thread or unified rendering process of the application determines whether the task volume of the rendering tree is greater than the task volume threshold 1, and if so, executes step S502; if not, ends.

[0171] S502: Divide N sub-rendering trees according to the dependency relationship between the root rendering node and the child nodes of the root rendering node.

[0172] If the root rendering node of the rendering tree has N child nodes, the rendering tree is split into N child rendering trees. The child nodes of the root rendering node can be used as the root nodes of the N child rendering trees respectively. Among the N child rendering trees, a child rendering tree has a root rendering node, that is, the root rendering node is used as the root node of the child rendering tree. The child node is a node directly connected to the root node. In the rendering tree, the root node is the root rendering node.

[0173] S503: Determine whether the task amount of each sub-rendering tree in all sub-rendering trees is less than or equal to task amount threshold 1.

[0174] The UI thread, rendering thread or unified rendering process of the application determines whether the task amount of the split sub-rendering tree is greater than the task amount threshold 1, and if so, executes step S502; if not, ends.

[0175] Optionally, in some implementations of the present application, in consideration of the thread parallel overhead, the workload of each sub-rendering tree needs to be added with the overhead of a thread parallelism.

[0176] S504: Split the sub-rendering tree whose task amount is greater than the task amount threshold 1.

[0177] The method of splitting the sub-rendering tree may refer to step S502 or Figure 5B The text description in will not be repeated here.

[0178] If the task volume threshold 1 is 100, Figure 5B As shown, the child nodes of the root rendering node of the rendering tree with a task amount of 200 are rendering node 51 and rendering node 52; the child nodes of rendering node 51 are rendering node 512 and rendering node 513; the child nodes of rendering node 52 are rendering node 521, rendering node 522 and rendering node 523, and the child node of rendering node 522 is rendering node 5221.

[0179] After the first split, a sub-rendering tree with a task amount of 40 and a sub-rendering tree with a task amount of 160 are obtained. The root node of the sub-rendering tree with a task amount of 40 is the root rendering node, the child node of the root rendering node is rendering node 51, and the child nodes of rendering node 51 are rendering nodes 512 and rendering nodes 513. The root node of the rendering tree with a task amount of 160 is rendering node 52, the child nodes of rendering node 52 are rendering nodes 521, rendering node 522 and rendering node 523, and the child node of rendering node 522 is rendering node 5221.

[0180] Since the task volume of the rendering tree with a task volume of 160 is greater than the task volume threshold 1, the second split is performed.

[0181] After the second split, a rendering tree with a task amount of 70, a rendering tree with a task amount of 50, and a rendering tree with a task amount of 40 are obtained. The root node of the rendering tree with a task amount of 70 is rendering node 52, and the child node of rendering node 52 is rendering node 512; the root node of the rendering tree with a task amount of 50 is rendering node 522, and the child node of rendering node 522 is rendering node 5221; the root node of the rendering tree with a task amount of 40 is rendering node 523.

[0182] After the second split, four sub-rendering trees are obtained, and the task amounts of the four sub-rendering trees are all less than the task amount threshold 1; further, in the four sub-rendering trees, the dependencies of the rendering nodes are all preserved. After the four sub-rendering trees are converted into GPU instructions, the complete GPU instructions can be restored by submitting the GPU instructions corresponding to the four sub-rendering trees to the command buffer in the command queue in sequence. For the specific content, please refer to the text description of step S303 below, which will not be repeated here.

[0183] The dependency of the rendering nodes is preserved, which means that since there is no new parent-child relationship between the rendering nodes, the internal order of the GPU instructions corresponding to each child rendering tree does not change; further, after the GPU instructions are submitted to the command queue, the order of all GPU instructions in the command queue will not change. It can be understood that the splitting method of the child rendering tree when the task volume is less than the task volume threshold can ensure that in the subsequent process of converting the rendering tree into GPU instructions, the working time of any thread will not exceed the time corresponding to the task volume threshold, thereby avoiding the occurrence of interface frame drops, interface freezes, etc.

[0184] (2) Load balancing splitting method.

[0185] Fig. 6A and Figure 6B An exemplary schematic diagram of a split rendering tree provided in an embodiment of the present application.

[0186] S601: Determine whether the task volume of the rendering tree is greater than a task volume threshold 1.

[0187] The UI thread, rendering thread or unified rendering process of the application determines whether the task volume of the rendering tree is greater than the task volume threshold 1, and if so, executes step S602; if not, ends.

[0188] S602: Divide N sub-rendering trees according to the dependency relationship between the root rendering node and the child nodes of the root rendering node.

[0189] If the root rendering node has N child nodes, the rendering tree is split into N rendering trees. The child nodes of the root rendering node can be used as the root nodes of the N child rendering trees respectively. Among the N child rendering trees, a child rendering tree has a root rendering node, that is, the root rendering node is used as the root node of the child rendering tree. The child node is a rendering node directly connected to the root node.

[0190] S603: Determine whether the task amount of each sub-rendering tree in all sub-rendering trees satisfies the constraint relationship.

[0191] The UI thread, rendering thread or unified rendering process of the application determines whether the task volume of the sub-rendering tree satisfies the constraint relationship. If so, the process ends; if not, the process executes step S604.

[0192] Optionally, in some embodiments of the present application, the minimum number of sub-rendering trees required may be determined first by the task volume of the rendering tree and the task volume threshold 1. For example, if the task volume of the rendering tree is 200 and the task volume threshold 1 is 30, the minimum number of sub-rendering trees required is determined to be 7. After 7 rendering trees are split, it is determined whether each sub-rendering tree in the sub-rendering tree satisfies the constraint relationship shown below. If the constraint relationship is not satisfied, the sub-rendering tree continues to be split; if the constraint relationship is satisfied, the sub-rendering tree is no longer split.

[0193] For example, let the workload of the rendering tree be load total , the task volume threshold 1 is load thres hold , the thread concurrency overhead is cost, and the task threshold of the sub-rendering tree is Where i is the i-th child rendering tree, and N is the number of concurrent threads (the number of child rendering trees), then the constraint relationship needs to be satisfied and

[0194] Among them, without considering the thread concurrency overhead, the constraint relationship is and

[0195] If load thres hold =80, loadtotal =200, N=5, ε=10, then That is, the task volume of all sub-rendering trees needs to be between 30 and 50 to meet the constraint relationship.

[0196] If N=2, first adjust the size of N (the number of rendering trees) so that Then determine whether it satisfies or

[0197] Optionally, in some embodiments of the present application, it is also possible to first Determines the splitting and combing of the rendering tree. thres hold =80, load total =200, then Calculate N, where is the ceiling function.

[0198] S604: Move the rendering node or further split the sub-rendering tree.

[0199] The UI thread, rendering thread or unified rendering process of the application can move rendering nodes in a sub-rendering tree with a high workload to a sub-rendering tree with a low workload by moving rendering nodes. After the rendering nodes are moved, the dependency between the rendering nodes may be destroyed.

[0200] Alternatively, your application's UI thread, rendering thread, or unified render process can split off high-volume sub-render trees.

[0201] Figure 6B and Figure 5B The rendering tree in the content shown is the same, and because of the Fig. 6A The method shown, if load thres hold =80, load total =200, ε=11, when N=4, the constraint relationship is Since there is a sub-rendering tree with a task volume of 70 in the second split rendering tree, the constraint condition is not met The rendering node needs to be moved or the sub-rendering tree needs to be split. The task volume of the rendering node 52 is 40 and the task volume of the rendering node 521 is 30. The constraint condition cannot be satisfied by moving the rendering node. So further split the sub-rendering tree with a task volume of 70.

[0202] When N=5, The task volumes of the split sub-rendering trees are 40, 40, 30, 50, and 40, respectively, which meet the constraints.

[0203] It is understandable that the load-balanced method of splitting the rendering tree can balance the workload of the different split sub-rendering trees, so as to avoid the short board effect when converting the rendering tree into GPU instructions later, that is, to avoid extending the time of converting the rendering tree into GPU instructions due to the excessive workload of individual sub-rendering trees.

[0204] Optionally, in some embodiments of the present application, in the process of splitting a rendering tree or splitting a sub-rendering tree, rendering nodes with a sibling relationship may be split preferentially.

[0205] Optionally, in some embodiments of the present application, during the process of splitting a rendering tree or splitting a sub-rendering tree, if the rendering attribute of a rendering node is empty, the drawing operation of the rendering node may be split into different sub-rendering trees.

[0206] Optionally, in some embodiments of the present application, during the process of splitting a rendering tree or splitting a sub-rendering tree, if a rendering node does not depend on any rendering node, the rendering node can be arbitrarily moved to a different rendering sub-tree. Figure 5B In the example, if the root rendering node is a transparent rendering node, rendering node 51 does not depend on any rendering node, and rendering node 52 does not depend on any rendering node.

[0207] (3) Display the splitting method of area division.

[0208] Figure 7 Another exemplary schematic diagram of splitting a rendering tree provided in an embodiment of the present application.

[0209] The interface to be generated by the application and displayed in the next frame is interface 701. The application window can be divided into mutually non-blocking areas in a variety of ways, and the content displayed in different areas is the display content corresponding to different sub-rendering trees after the splitting.

[0210] For example, the interface 701 (excluding the status bar) is divided into area 1 and area 2; the view corresponding to area 1 includes view container 1 and child nodes of view container 1; the view corresponding to area 2 includes view container 2 and child nodes of view container 2 such as view 22. In the process of generating the rendering tree, the UI thread of the application can directly generate two child rendering trees, namely, child rendering tree 1 corresponding to area 1 and child rendering tree 2 corresponding to area 2.

[0211] Alternatively, after the UI thread of the application generates the rendering tree, the rendering tree is divided into sub-rendering tree 1 and sub-rendering tree 2 according to the division of regions.

[0212] (4) Split DrawOP

[0213] Optionally, in some implementations of the present application, after the rendering thread or the rendering sub-thread of the unified rendering process traverses the rendering tree to obtain the chain-stored DrawOP, the DrawOP may be directly split.

[0214] S303: The application creates multiple rendering threads and converts multiple sub-rendering trees into GPU instructions in parallel.

[0215] The application creates multiple rendering threads, or the unified rendering process creates multiple sub-rendering threads, and then converts multiple sub-rendering trees into GPU instructions in parallel.

[0216] The number of rendering threads is consistent with the number of sub-rendering trees after the splitting or the number of sub-rendering threads is consistent with the number of sub-rendering trees after the splitting.

[0217] Figure 8 An exemplary schematic diagram of converting a rendering tree into GPU instructions in parallel is provided in an embodiment of the present application.

[0218] like Figure 8 As shown, after splitting the rendering tree, sub-rendering tree 1 to sub-rendering tree N are obtained.

[0219] Different threads, such as rendering threads or sub-rendering threads, traverse different sub-rendering trees to obtain GPU instructions. Among them, the unified rendering process, the UI thread or rendering thread of the application can also apply for N command buffers from the command buffer pool (commandBufferpool), such as Figure 8 Command buffer 1 to command buffer N in the , N command buffers are used to store GPU instructions corresponding to different sub-rendering trees.

[0220] Optionally, in some embodiments of the present application, when traversing the rendering tree, the thread first encapsulates the drawing operation into a drawing operation structure (e.g., DrawOP), and then converts it into GPU instructions, such as interface calls in the OpenGLES library, Vulkan library, and Metal library.

[0221] After different threads obtain GPU instructions, the GPU instructions in each command buffer are submitted to the buffer in the instruction queue (such as the Primarily Buffer) in sequence. The sequence is the same as the traversal order of the rendering nodes in the rendering tree, that is, if the traversal order of the rendering nodes in the sub-rendering tree 1 is earlier than the traversal order of the rendering nodes in the sub-rendering tree N, the GPU instructions in the command buffer 1 in the Primarily Buffer will be executed first, and the GPU instructions in the command buffer 2 in the Primarily Buffer will be executed later. Submitting data in different command buffers to the buffer in the instruction queue can be implemented in the following multiple ways, which are not limited here.

[0222] Optionally, in some embodiments of the present application, when the electronic device converts the rendering tree into GPU instructions through the Vulkan library, then, illustratively, the GPU instructions in command buffer 1 or command buffer N can be submitted to the Primarily Buffer in the instruction queue through the vkQueueSubmit method call. In which, since it involves data synchronization from multiple command buffers to the buffer in the instruction queue, the electronic device can complete the synchronization through a semaphore.

[0223] Optionally, in some implementations of the present application, the electronic device may also move data of multiple command buffers to a buffer in the instruction queue by means of pointer operations.

[0224] Optionally, in some implementations of the present application, the electronic device may also move the data of multiple command buffers to the buffer in the instruction queue by copying.

[0225] Optionally, in some implementations of the present application, command buffer 1 may be a buffer in an instruction queue, such as a Primarily Buffer, and GPU instructions in other command buffers need to be submitted to command buffer 1.

[0226] Alternatively, in some embodiments of the present application, instead of applying for N command buffers from the command buffer pool, N address ranges may be divided in the Primarily Buffer to carry GPU instructions corresponding to different sub-rendering trees. For example, 0x000000-0x0000FF is the address range corresponding to the first command buffer, and 0x000100-0x0001FF is the address range corresponding to the second command buffer.

[0227] S304: After the GPU executes the GPU instruction to generate a bitmap, the surface synthesizer and / or the hardware synthesis strategy module performs layer synthesis on the bitmap for display.

[0228] Among them, after the bitmap is generated, the bitmap will be obtained by the surface synthesizer and / or the hardware synthesis strategy module, and then the parameters will be used for layer synthesis. The synthesized bitmap will be obtained by the display subsystem for display.

[0229] Electronic equipment is in accordance with Figure 3 After the interface generation method shown is executed, the process of the electronic device generating the interface is as follows Fig. 9A and Fig. 9B shown.

[0230] Fig. 9A and Fig. 9B Another exemplary schematic diagram of the process of generating an interface for an electronic device provided in an embodiment of the present application.

[0231] contrast Fig. 9A and Figure 2 The content shown, Fig. 9A and Figure 2 The same contents as shown are not repeated here. Fig. 9A In ⑦, since the electronic device uses two rendering threads (such as Fig. 9A Rendering thread 1 and rendering thread 2 in the rendering tree convert the rendering tree into GPU instructions, reducing the latency of converting the rendering tree into GPU instructions; the GPU can receive the GPU instructions in time to generate a bitmap, such as Fig. 9A ⑧ in; The GPU can then pass the generated bitmap to the surface compositor and / or hardware compositing strategy module, such as Fig. 9A Finally, the display subsystem can send the bitmap after the layer is synthesized to the display, such as Fig. 9A ⑩ in the figure, there will be no interface lag.

[0232] Fig. 9A and Fig. 9B The difference shown is that the process of converting the rendering tree into GPU instructions can be executed by the rendering sub-thread of the unified rendering process, such as Fig. 9B ⑦ in the figure. For example, the rendering subthread of the unified rendering process can be Fig. 9B Rendering sub-thread 1 and rendering sub-thread 2 in Fig. 9A and Fig. 9B The same content will not be repeated again.

[0233] Combination of the above Figure 3 The content shown in FIG. 1 introduces the process of the interface generation method in one embodiment of the present application. Figure 3 The content shown shows the process of different interface generation methods.

[0234] Optionally, in some embodiments of the present application, after determining the amount of tasks of the rendering tree, the rendering tree may not be split, but the computing power of the CPU may be provided to reduce the time consumption of converting the rendering tree into GPU instructions.

[0235] Fig.10 Another exemplary schematic diagram of the process of the interface generation method provided in an embodiment of the present application.

[0236] S1001: After receiving a vertical synchronization signal, the UI thread of the application generates a rendering tree corresponding to the current frame interface, and determines the task amount of the rendering tree during the process of generating the rendering tree.

[0237] The content of step S1001 can refer to the text description of step S301 above, which will not be repeated here.

[0238] S1002: When the task amount of the rendering tree is greater than a task amount threshold, adjust the computing power of the CPU based on the task amount of the rendering tree.

[0239] When the amount of tasks in the rendering tree is greater than the threshold, the UI thread, rendering thread, and unified rendering process of the application pass the amount of tasks in the rendering tree to the operating system, which adjusts the computing power of the CPU based on the amount of tasks in the rendering tree, for example, by adjusting the CPU frequency.

[0240] Fig.11 An exemplary schematic diagram of adjusting CPU computing power based on the amount of tasks of a rendering tree provided in an embodiment of the present application.

[0241] For example, Fig.11 As shown, when the task amount of the rendering tree is 0-100, the task amount of the rendering tree may not be sent to the operating system, or the operating system does not adjust the CPU frequency after receiving the task amount of the rendering tree; when the task amount of the rendering tree is 101-200, the operating system adjusts the CPU frequency to frequency 1 after receiving the task amount of the rendering tree; when the task amount of the rendering tree is 201-300, the operating system adjusts the CPU frequency to frequency 2 after receiving the task amount of the rendering tree, wherein frequency 2 is higher than frequency 1.

[0242] After the rendering tree is converted into GPU instructions, the operating system adjusts the CPU's computing power to the state before the adjustment, such as Fig.11 The default frequency in .

[0243] Optionally, in some embodiments of the present application, after splitting the rendering tree and traversing the rendering tree through multiple threads, the CPU frequency can be reduced. For example, when the task volume of the rendering tree is 101-200, the operating system determines to process the rendering tree in parallel through three threads after receiving the task volume of the rendering tree, and adjusts the CPU frequency to frequency 3; when the task volume of the rendering tree is 201-300, the operating system determines to process the rendering tree in parallel through five threads after receiving the task volume of the rendering tree, and adjusts the CPU frequency to frequency 4, wherein frequency 3 is lower than frequency 4.

[0244] It is understandable that by adjusting the computing power of the CPU, the time it takes to convert the rendering tree into GPU instructions can be reduced, thereby reducing the probability of interface freezes and frame drops.

[0245] S1003: After converting the rendering tree into GPU instructions, a bitmap is generated, and the surface synthesizer and / or the hardware synthesis strategy module performs layer synthesis on the bitmap for display.

[0246] The content of step S1003 can be found in Figure 1 The text description in step 304 will not be repeated here.

[0247] Optionally, in some embodiments of the present application, after determining the amount of work for the rendering tree, the rendering tree may not be split, but the rendering tree may be traversed by multiple threads in different traversal orders, thereby reducing the time consumption of converting the rendering tree into GPU instructions.

[0248] Fig.12 Another exemplary schematic diagram of the interface generation method provided in an embodiment of the present application.

[0249] S1201: After receiving the vertical synchronization signal, the UI thread of the application generates a rendering tree corresponding to the current frame interface, and determines the task amount of the rendering tree during the process of generating the rendering tree.

[0250] Among them, step S1201 can refer to the text description in step S301, and will not be repeated here.

[0251] S1202: When the task amount of the rendering tree is greater than the task amount threshold, multiple rendering threads traverse the rendering tree in parallel in different orders and convert the rendering tree into GPU instructions.

[0252] The number of rendering threads can be determined by the workload of the rendering tree. For example, let the workload of the rendering tree be load total , the task volume threshold is load thres hold , the number of rendering threads is N, then in is a round-up function. Different rendering threads traverse the rendering tree in different orders to generate GPU instructions, such as Fig.13 and Fig.14 shown.

[0253] Optionally, in some implementations of the present application, the number of rendering threads may also be a preconfigured fixed value.

[0254] Fig.13 An exemplary schematic diagram of a rendering thread traversing a rendering tree in different orders provided in an embodiment of the present application.

[0255] like Fig.13 As shown, the root node of the rendering tree is the root rendering node, the child nodes of the root rendering node are rendering node 1 and rendering node 2, the child nodes of rendering node 1 are rendering node 11 and rendering node 12, the child nodes of rendering node 2 are rendering node 21, rendering node 22 and rendering node 23, and the child node of rendering node 22 is rendering node 221.

[0256] First, the traversal order of thread 2 is: root rendering node, rendering node 1, rendering node 11, and rendering node 12. The traversal order of thread 1 is: rendering node 2, rendering node 21, rendering node 22, rendering node 23, and rendering node 221.

[0257] Next, when thread 2 has traversed the root rendering node, rendering node 1, rendering node 11, and rendering node 12, thread 1 traverses to rendering node 21.

[0258] Optionally, in some embodiments of the present application, when thread 2 has traversed rendering node 1, rendering node 11, and rendering node 12, thread 1 traverses to rendering node 21, and then thread 1 continues to traverse rendering node 22, rendering node 23, and rendering node 221. Then, according to Figure 8 As shown in the content, the GPU instructions generated by different threads traversing the rendering nodes are located in different command buffers and need to be submitted to the buffer of the instruction queue in sequence.

[0259] Optionally, in some embodiments of the present application, when thread 2 has traversed rendering node 1, rendering node 11, and rendering node 12, after thread 1 traverses to rendering node 21, thread 1 traverses rendering node 22, rendering node 23, and rendering node 221 in sequence, and thread 2 traverses rendering node 23, rendering node 22, and rendering node 221 in sequence. In the case of traversal in this manner, rendering node 23 is traversed by thread 2, and rendering node 22 and rendering node 221 are traversed by thread 1. Then, according to Fig.14 As shown, GPU instructions of different command buffers are submitted to the buffer of the command queue.

[0260] Fig.14 An exemplary schematic diagram of submitting GPU instructions to an instruction queue provided in an embodiment of the present application.

[0261] Since the rendering node 23 is traversed by thread 2, the GPU instructions corresponding to the rendering node 23 are saved in command buffer 2. In order to reconstruct the dependency relationship of the rendering nodes in the rendering tree, in the process of submitting the GPU instructions in command buffer 1 and command buffer 2 to the command queue, the order between different GPU instructions needs to be adjusted.

[0262] For example, first, GPU instructions corresponding to the root rendering node, rendering node 1, rendering node 11, and rendering node 12 are submitted from command buffer 2 to the buffer in the command queue; then, all GPU instructions in command buffer 1 are submitted to the buffer in the command queue; finally, the remaining GPU instructions in command buffer 2 (i.e., the GPU instructions corresponding to rendering node 23) are submitted to the buffer in the command queue.

[0263] Optionally, in some embodiments of the present application, all GPU instructions of command buffer 2 and command buffer 1 may be submitted to the buffer of the command queue in sequence. In this case, the dependency relationship of the rendering nodes of the rendering tree may not be reconstructed. If rendering node 23 has a dependency relationship with rendering node 2, the dependency relationship of the rendering nodes of the rendering tree is not reconstructed; if rendering node 23 has no dependency relationship with rendering node 2, the dependency relationship of the rendering nodes of the rendering tree is reconstructed.

[0264] S1203: After the GPU executes the GPU instruction to generate a bitmap, the surface synthesizer and / or the hardware synthesis strategy module performs layer synthesis on the bitmap for display.

[0265] The content of step S1203 may refer to the text description of step S304 above, which will not be repeated here.

[0266] The hardware structure and software architecture of the electronic device provided in the embodiments of the present application are introduced below.

[0267] Fig.15 An exemplary schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application.

[0268] The electronic device may be a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) device, a virtual reality (VR) device, an artificial intelligence (AI) device, a wearable device, a vehicle-mounted device, a smart home device and / or a smart city device. The embodiments of the present application do not impose any special restrictions on the specific type of the electronic device.

[0269] The electronic device may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0270] It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device. In other embodiments of the present application, the electronic device may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0271] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0272] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.

[0273] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0274] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0275] The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple groups of I2C buses. The processor 110 may be coupled to the touch sensor 180K, the charger, the flash, the camera 193, etc. through different I2C bus interfaces. For example, the processor 110 may be coupled to the touch sensor 180K through the I2C interface, so that the processor 110 communicates with the touch sensor 180K through the I2C bus interface to realize the touch function of the electronic device.

[0276] The I2S interface can be used for audio communication. In some embodiments, the processor 110 can include multiple I2S buses. The processor 110 can be coupled to the audio module 170 via the I2S bus to achieve communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 via the I2S interface to achieve the function of answering a call through a Bluetooth headset.

[0277] The PCM interface can also be used for audio communication, sampling, quantizing and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 can be coupled via a PCM bus interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 via the PCM interface to realize the function of answering calls via a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.

[0278] The UART interface is a universal serial data bus for asynchronous communication. The bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, the UART interface is generally used to connect the processor 110 and the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 through the UART interface to implement the function of playing music through a Bluetooth headset.

[0279] The MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193. The MIPI interface includes a camera serial interface (CSI), a display serial interface (DSI), etc. In some embodiments, the processor 110 and the camera 193 communicate via the CSI interface to realize the shooting function of the electronic device. The processor 110 and the display screen 194 communicate via the DSI interface to realize the display function of the electronic device.

[0280] The GPIO interface can be configured by software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 with the camera 193, the display 194, the wireless communication module 160, the audio module 170, the sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.

[0281] The USB interface 130 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge an electronic device, and can also be used to transfer data between an electronic device and a peripheral device. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other electronic devices, such as AR devices, etc.

[0282] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present invention is only a schematic illustration and does not constitute a structural limitation of the electronic device. In other embodiments of the present application, the electronic device may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

[0283] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of an electronic device. While the charging management module 140 is charging the battery 142, it may also power the electronic device through the power management module 141.

[0284] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera 193, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.

[0285] The wireless communication function of the electronic device can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor.

[0286] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.

[0287] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to electronic devices. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.

[0288] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.

[0289] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to electronic devices. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the electromagnetic wave signal and filters it, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, perform frequency modulation on it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0290] In some embodiments, the antenna 1 of the electronic device is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS may include global positioning system (GPS), global navigation satellite system (GLONASS), Beidou navigation satellite system (BDS), quasi-zenith satellite system (QZSS) and / or satellite based augmentation system (SBAS).

[0291] The electronic device implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.

[0292] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device may include 1 or N display screens 194, where N is a positive integer greater than 1.

[0293] The electronic device can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.

[0294] ISP is used to process the data fed back by camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise and brightness of the image. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, ISP can be set in camera 193.

[0295] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device may include 1 or N cameras 193, where N is a positive integer greater than 1.

[0296] Digital signal processors are used to process digital signals. In addition to processing digital image signals, they can also process other digital signals. For example, when an electronic device selects a frequency point, a digital signal processor is used to perform Fourier transform on the frequency point energy.

[0297] Video codecs are used to compress or decompress digital videos. Electronic devices can support one or more video codecs. In this way, electronic devices can play or record videos in multiple coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.

[0298] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and continuously self-learn. NPU can realize applications such as intelligent cognition of electronic devices, such as image recognition, face recognition, voice recognition, text understanding, etc.

[0299] The internal memory 121 may include one or more random access memories (RAM) and one or more non-volatile memories (NVM).

[0300] Random access memory may include static random-access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM, for example, the fifth generation DDR SDRAM is generally referred to as DDR5 SDRAM), etc.;

[0301] Non-volatile memory may include disk storage devices and flash memory.

[0302] Flash memory can be divided into NOR FLASH, NAND FLASH, 3D NAND FLASH, etc. according to the operating principle; single-level cell (SLC), multi-level cell (MLC), triple-level cell (TLC), quad-level cell (QLC), etc. according to the storage unit potential level; universal flash storage (UFS), embedded multi media card (eMMC), etc. according to the storage specification.

[0303] The random access memory can be directly read and written by the processor 110, and can be used to store executable programs (such as machine instructions) of the operating system or other running programs, and can also be used to store user and application data.

[0304] The non-volatile memory may also store executable programs and user and application data, etc., and may be loaded into the random access memory in advance for direct reading and writing by the processor 110 .

[0305] The external memory interface 120 can be used to connect to an external non-volatile memory to expand the storage capacity of the electronic device. The external non-volatile memory communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music and videos are stored in the external non-volatile memory.

[0306] The electronic device can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.

[0307] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.

[0308] The speaker 170A, also called a "speaker", is used to convert an audio electrical signal into a sound signal. The electronic device can listen to music or listen to a hands-free call through the speaker 170A.

[0309] The receiver 170B, also called a "earpiece", is used to convert audio electrical signals into sound signals. When the electronic device receives a call or voice message, the voice can be received by placing the receiver 170B close to the human ear.

[0310] Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting their mouth close to the microphone 170C to input the sound signal into the microphone 170C. The electronic device can be provided with at least one microphone 170C. In other embodiments, the electronic device can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device can also be provided with three, four or more microphones 170C to realize the collection of sound signals, noise reduction, identification of sound sources, and directional recording function, etc.

[0311] The earphone interface 170D is used to connect a wired earphone and can be a USB interface 130 or a 3.5 mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.

[0312] The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be set on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. The capacitive pressure sensor can be a parallel plate including at least two conductive materials. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device determines the intensity of the pressure based on the change in capacitance. When a touch operation acts on the display screen 194, the electronic device detects the touch operation intensity according to the pressure sensor 180A. The electronic device can also calculate the touch position according to the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities can correspond to different operation instructions. For example: when a touch operation with a touch operation intensity less than the first pressure threshold acts on the short message application icon, an instruction to view the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, an instruction to create a new short message is executed.

[0313] The gyro sensor 180B can be used to determine the motion posture of the electronic device. In some embodiments, the angular velocity of the electronic device around three axes (i.e., x, y, and z axes) can be determined by the gyro sensor 180B. The gyro sensor 180B can be used for anti-shake shooting. For example, when the shutter is pressed, the gyro sensor 180B detects the angle of the electronic device shaking, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shaking of the electronic device through reverse movement to achieve anti-shake. The gyro sensor 180B can also be used for navigation and somatosensory game scenes.

[0314] The air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist positioning and navigation.

[0315] The magnetic sensor 180D includes a Hall sensor. The electronic device can use the magnetic sensor 180D to detect the opening and closing of the flip leather case. In some embodiments, when the electronic device is a flip phone, the electronic device can detect the opening and closing of the flip cover according to the magnetic sensor 180D. Then, according to the detected opening and closing state of the leather case or the opening and closing state of the flip cover, the flip cover can be automatically unlocked.

[0316] The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device in all directions (generally three axes). When the electronic device is stationary, it can detect the magnitude and direction of gravity. It can also be used to identify the posture of the electronic device and is applied to applications such as horizontal and vertical screen switching and pedometers.

[0317] The distance sensor 180F is used to measure the distance. The electronic device can measure the distance by infrared or laser. In some embodiments, when shooting a scene, the electronic device can use the distance sensor 180F to measure the distance to achieve fast focusing.

[0318] The proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic device emits infrared light outward through the light emitting diode. The electronic device uses a photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device. When insufficient reflected light is detected, the electronic device can determine that there is no object near the electronic device. The electronic device can use the proximity light sensor 180G to detect when the user holds the electronic device close to the ear to talk, so as to automatically turn off the screen to save power. The proximity light sensor 180G can also be used in leather case mode and pocket mode to automatically unlock and lock the screen.

[0319] The ambient light sensor 180L is used to sense the ambient light brightness. The electronic device can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device is in a pocket to prevent accidental touch.

[0320] The fingerprint sensor 180H is used to collect fingerprints. Electronic devices can use the collected fingerprint characteristics to achieve fingerprint unlocking, access application locks, fingerprint photography, fingerprint call answering, etc.

[0321] The temperature sensor 180J is used to detect temperature. In some embodiments, the electronic device uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the electronic device reduces the performance of a processor located near the temperature sensor 180J to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device heats the battery 142 to avoid abnormal shutdown of the electronic device due to low temperature. In other embodiments, when the temperature is lower than another threshold, the electronic device boosts the output voltage of the battery 142 to avoid abnormal shutdown due to low temperature.

[0322] The touch sensor 180K is also called a "touch control device". The touch sensor 180K can be set on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also called a "touch control screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device, which is different from the position of the display screen 194.

[0323] The bone conduction sensor 180M can obtain a vibration signal. In some embodiments, the bone conduction sensor 180M can obtain a vibration signal of a vibrating bone block of the vocal part of the human body. The bone conduction sensor 180M can also contact the human pulse to receive a blood pressure beat signal. In some embodiments, the bone conduction sensor 180M can also be set in an earphone and combined into a bone conduction earphone. The audio module 170 can parse out a voice signal based on the vibration signal of the vibrating bone block of the vocal part obtained by the bone conduction sensor 180M to realize a voice function. The application processor can parse the heart rate information based on the blood pressure beat signal obtained by the bone conduction sensor 180M to realize a heart rate detection function.

[0324] The key 190 includes a power key, a volume key, etc. The key 190 can be a mechanical key or a touch key. The electronic device can receive key input and generate key signal input related to user settings and function control of the electronic device.

[0325] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. For touch operations acting on different areas of the display screen 194, motor 191 can also correspond to different vibration feedback effects. Different application scenarios (for example: time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.

[0326] Indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, messages, missed calls, notifications, etc.

[0327] The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to and separated from the electronic device by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195. The electronic device can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, and the like. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external memory cards. The electronic device interacts with the network through the SIM card to implement functions such as calls and data communications. In some embodiments, the electronic device uses an eSIM, i.e., an embedded SIM card. The eSIM card can be embedded in an electronic device and cannot be separated from the electronic device.

[0328] Fig.16 An exemplary schematic diagram of the software structure of an electronic device provided in an embodiment of the present application.

[0329] The software system of the electronic device may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present invention takes the Android system of the layered architecture as an example to exemplify the software structure of the electronic device.

[0330] The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime and system library, and the kernel layer.

[0331] The application layer can include a series of application packages.

[0332] like Fig.16 As shown, the application package may include camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message and other applications.

[0333] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.

[0334] like Fig.16 As shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and the like.

[0335] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.

[0336] Content providers are used to store and retrieve data and make it accessible to applications. The data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.

[0337] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.

[0338] The phone manager is used to provide communication functions for electronic devices, such as the management of call status (including answering, hanging up, etc.).

[0339] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.

[0340] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.

[0341] Optionally, in some embodiments of the present application, the view system includes a rendering tree task amount estimation module, which determines the task amount of the rendering tree during the process of generating the rendering tree or after the rendering tree is generated.

[0342] Optionally, in some embodiments of the present application, the view system includes a rendering tree splitting module, which can split the rendering tree in different ways, wherein different rendering trees are traversed by different threads to generate GPU instructions.

[0343] Optionally, in some embodiments of the present application, the CPU scheduling module may adjust the computing power of the CPU based on the amount of tasks of the rendering tree, such as adjusting the frequency of the CPU.

[0344] Android Runtime includes core libraries and virtual machines. Android runtime is responsible for scheduling and management of the Android system.

[0345] The core library consists of two parts: one part is the function that needs to be called by the Java language, and the other part is the Android core library.

[0346] The application layer and the application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.

[0347] The system library can include multiple functional modules, such as browser engine (webkit), rendering engine, surface compositor, hardware compositing strategy module, media library, image processing library (such as OpenGL ES), rendering engine (such as Skia library), etc.

[0348] The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.

[0349] The image processing library is used to implement 3D graphics drawing, image rendering, etc.

[0350] A rendering engine is a drawing engine for 2D drawings.

[0351] The kernel layer is the layer between hardware and software. The kernel layer includes display driver, camera driver, audio driver, sensor driver, etc.

[0352] Optionally, in some embodiments of the present application, the display subsystem includes a display driver.

[0353] As used in the above embodiments, the term "when..." may be interpreted to mean "if..." or "after..." or "in response to determining..." or "in response to detecting...", depending on the context. Similarly, the phrases "upon determining..." or "if (the stated condition or event) is detected" may be interpreted to mean "if determining..." or "in response to determining..." or "upon detecting (the stated condition or event)" or "in response to detecting (the stated condition or event)", depending on the context.

[0354] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, a computer, a server or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, a data center, etc. that contains one or more available media integration. The available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk), etc.

[0355] Those skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by computer programs to instruct related hardware, and the programs can be stored in computer-readable storage media. When the programs are executed, they can include the processes of the above-mentioned method embodiments. The aforementioned storage media include: ROM or random access memory RAM, magnetic disk or optical disk and other media that can store program codes.

Claims

1. An interface generation method, characterized in that: Applied to an electronic device running a first application, the method includes: The electronic device generates a first rendering tree, where the first rendering tree includes a drawing operation for generating a frame interface of the first application; The electronic device determines, in the process of generating the first rendering tree, from a task model table, a time consumption for converting each drawing operation or drawing operation structure in the first rendering tree into a GPU instruction according to the current computing power of the CPU on the electronic device, wherein the task model table stores a correspondence between the drawing operation or drawing operation structure and the time consumption for converting the drawing operation or drawing operation structure into a GPU instruction under different CPU computing powers; The electronic device determines the task amount of each rendering node in the first rendering tree based on the time consumed for each rendering operation or rendering operation structure in the first rendering tree to be converted into a GPU instruction; The electronic device splits the first rendering tree into N sub-rendering trees based on the task amount of each rendering node in the first rendering tree, where N is greater than 1; The electronic device converts the N sub-rendering trees into first rendering instructions in parallel, where the rendering instructions are instructions in a rendering engine, an image processing library, or a GPU driver; The electronic device generates a frame interface of the first application based on the first rendering instruction.

2. The method according to claim 1, characterized in that The electronic device splits the first rendering tree into N sub-rendering trees based on the task amount of each rendering node in the first rendering tree, specifically including: The electronic device determines a first task amount based on the task amount of each rendering node in the first rendering tree, where the first task amount is the task amount of the first rendering tree, and the first task amount is used to indicate the time consumption or calculation amount of converting the first rendering tree into the first rendering instruction; In response to the electronic device determining that the first task amount is greater than a first threshold, the electronic device splits the first rendering tree to obtain the N sub-rendering trees.

3. The method according to claim 2, characterized in that After the electronic device determines the first task amount based on the task amount of each rendering node in the first rendering tree, the method further includes: The electronic device determines M based on the first task amount and the first threshold, where M is less than or equal to N, and M is an integer greater than or equal to the ratio of the first task amount to the first threshold; The electronic device determines an integer greater than or equal to M as N.

4. The method according to any one of claims 1 to 3, characterized in that The N sub-rendering trees include a second rendering tree and a third rendering tree, a difference between a second task amount and a third task amount is less than a difference threshold, the second task amount is the task amount of the second rendering tree, and the second task amount is used to measure the time consumption or the amount of calculation for converting the second rendering tree into rendering instructions, and the third task amount is the task amount of the third rendering tree, and the third task amount is used to measure the time consumption or the amount of calculation for converting the third rendering tree into rendering instructions.

5. The method according to claim 1, characterized in that The electronic device splits the first rendering tree into N sub-rendering trees based on the task amount of each rendering node in the first rendering tree, specifically including: The electronic device determines a first task amount based on the task amount of each rendering node in the first rendering tree, the first task amount being the task amount of the first rendering tree, the first task amount being used to measure the time consumption or the amount of calculation required to convert the first rendering tree into rendering instructions, and the first task amount being greater than a first threshold; The electronic device determines that a root rendering node of the first rendering tree has K child nodes, where K is less than N; Splitting, by the electronic device, the first rendering tree into K sub-rendering trees; After the electronic device determines that the task amount of the fourth rendering tree is greater than the first threshold, the electronic device splits the fourth rendering tree to obtain N-K+1 rendering subtrees, the K sub-rendering trees include the fourth rendering tree, and the task amounts of the N rendering subtrees are all less than the first threshold.

6. The method according to any one of claims 1 to 3, characterized in that The electronic device converts the N sub-rendering trees into first rendering instructions in parallel, specifically including: The electronic device fills the instructions converted from the N sub-rendering trees into N buffers respectively through N threads; The electronic device submits the instructions of the N buffers to a first buffer, and the instructions in the first buffer are the first rendering instructions.

7. An interface generation method, characterized in that: Applied to an electronic device, a first process is running on the electronic device, and the method includes: The electronic device generates a first rendering tree through the first process, where the first rendering tree includes a drawing operation for generating a frame interface of the first process; The electronic device determines, in the process of generating the first rendering tree, from a task model table, a time consumption for converting each drawing operation or drawing operation structure in the first rendering tree into a GPU instruction according to the current computing power of the CPU on the electronic device, wherein the task model table stores a correspondence between the drawing operation or drawing operation structure and the time consumption for converting the drawing operation or drawing operation structure into a GPU instruction under different CPU computing powers; The electronic device determines the task amount of each rendering node in the first rendering tree based on the time consumed for each rendering operation or rendering operation structure in the first rendering tree to be converted into a GPU instruction; The electronic device splits the first rendering tree into a second rendering tree and a third rendering tree based on the task amount of each rendering node in the first rendering tree, wherein the second rendering tree includes some rendering operations in the first rendering tree, the third rendering tree includes some rendering operations in the first rendering tree, and the second rendering tree is different from the third rendering tree; The electronic device converts the second rendering tree into a first rendering instruction through a first thread, wherein the first rendering instruction is stored in a first buffer, and the rendering instruction is an instruction in a rendering engine, an image processing library, or a GPU driver; The electronic device converts the third rendering tree into a second rendering instruction through a second thread, and the second rendering instruction is stored in a second buffer; The electronic device generates a frame interface of the first process based on the first rendering instruction and the second rendering instruction.

8. The method according to claim 7, characterized in that The method further comprises: The electronic device determines a first task amount based on the task amount of each rendering node in the first rendering tree, where the first task amount is the task amount of the first rendering tree, and the first task amount is used to measure the time consumption or calculation amount of converting the first rendering tree into rendering instructions, and the first task amount is greater than a first threshold.

9. The method according to claim 7 or 8, characterized in that: The electronic device generates a frame interface of the first process based on the first rendering instruction and the second rendering instruction, specifically including: The first rendering instruction is located in a first buffer held by the first thread, the second rendering instruction is located in a second buffer held by the second thread, and the electronic device submits the instructions in the first buffer and the rendering instructions in the second buffer to a third buffer; The electronic device generates a frame interface of the first process based on the third buffer.

10. The method according to claim 9, characterized in that The third buffer is the second buffer, or the third buffer is the first buffer.

11. An interface generation method, characterized in that: Applied to an electronic device, a first application program is running on the electronic device, and the method includes: The electronic device generates a first rendering tree, where the first rendering tree includes a drawing operation for generating a frame interface of the first application; The electronic device determines, in the process of generating the first rendering tree, from a task model table, a time consumption for converting each drawing operation or drawing operation structure in the first rendering tree into a GPU instruction according to the current computing power of the CPU on the electronic device, wherein the task model table stores a correspondence between the drawing operation or drawing operation structure and the time consumption for converting the drawing operation or drawing operation structure into a GPU instruction under different CPU computing powers; The electronic device determines the task amount of each rendering node in the first rendering tree based on the time consumed for each rendering operation or rendering operation structure in the first rendering tree to be converted into a GPU instruction; The electronic device determines a first task amount based on the task amount of each rendering node in the first rendering tree, the first task amount being the task amount of the first rendering tree, the first task amount being used to measure the time consumption or the amount of calculation of converting the first rendering tree into rendering instructions, the first task amount being greater than a first threshold, and the rendering instructions being instructions in a rendering engine, an image processing library, or a GPU driver; If the first task amount is greater than the first threshold, the operating frequency of the CPU configured in the electronic device is changed from the first frequency to the second frequency, and the second frequency is higher than the first frequency; The electronic device generates a frame interface of the first application based on the first rendering tree; During the process of the electronic device generating a frame interface of the first application, the electronic device operates at the second frequency.

12. The method according to claim 11, wherein the electronic device generates a frame interface of the first application based on the first rendering tree, specifically comprising: The electronic device splits the first rendering tree into N sub-rendering trees, where N is an integer greater than 1; The electronic device converts the N sub-rendering trees into first rendering instructions in parallel; The electronic device generates a frame interface of the first application based on the first rendering instruction.

13. A method for generating an interface, characterized in that: Applied to an electronic device, a first application program is running on the electronic device, and the method includes: The electronic device generates a first rendering tree, where the first rendering tree includes a drawing operation for generating a frame interface of the first application; The electronic device determines, in the process of generating the first rendering tree, from a task model table, a time consumption for converting each drawing operation or drawing operation structure in the first rendering tree into a GPU instruction according to the current computing power of the CPU on the electronic device, wherein the task model table stores a correspondence between the drawing operation or drawing operation structure and the time consumption for converting the drawing operation or drawing operation structure into a GPU instruction under different CPU computing powers; The electronic device determines the task amount of each rendering node in the first rendering tree based on the time consumed for each rendering operation or rendering operation structure in the first rendering tree to be converted into a GPU instruction; The electronic device traverses different parts of the first rendering tree through a plurality of different threads based on the task amount of each rendering node in the first rendering tree to generate a first rendering instruction, where the rendering instruction is an instruction in a rendering engine, an image processing library or a GPU driver; The electronic device generates a frame interface of the first application based on the first rendering instruction.

14. The method according to claim 13, characterized in that Before the electronic device traverses different parts of the first rendering tree through a plurality of different threads to generate a first rendering instruction, the method further includes: The electronic device determines a first task amount, where the first task amount is the task amount of the first rendering tree, and the first task amount is used to measure the time consumption or the amount of calculation required to convert the first rendering tree into the first rendering instruction; The electronic device determines that the first task amount is greater than a first threshold.

15. The method according to claim 13 or 14, characterized in that The electronic device traverses different parts of the first rendering tree through a plurality of different threads to generate a first rendering instruction, specifically including: The electronic device traverses the first part of the first rendering tree through a first thread, and saves the generated second rendering instruction in a first buffer; The electronic device traverses the second part of the first rendering tree through a second thread, and saves the generated third rendering instruction in a second buffer; The electronic device submits the rendering instructions in the first buffer and the rendering instructions in the second buffer to a third buffer to obtain the first rendering instructions.

16. The method according to claim 15, characterized in that After the electronic device traverses the second part of the first rendering tree through the second thread and saves the generated third rendering instruction in the second buffer, the method further includes: The electronic device traverses the third part of the first rendering tree through the first thread, and saves the generated fourth rendering instruction in the first buffer, wherein the rendering node corresponding to the fourth rendering instruction is a child node of the rendering node corresponding to the third rendering instruction, and the rendering node corresponding to the third rendering instruction is a child node of the rendering node corresponding to the second rendering instruction; The electronic device submits the rendering instruction in the first buffer and the rendering instruction in the second buffer to the third buffer to obtain the first rendering instruction, specifically including: The rendering instructions of the first buffer include the second rendering instructions and the fourth rendering instructions, and the instructions of the second buffer include the third rendering instructions; The instructions in the third buffer are arranged in the following order: the second rendering instruction, the third rendering instruction, and the fourth rendering instruction.

17. An electronic device, characterized in that: The electronic device comprises: one or more processors and a memory; The memory is coupled to the one or more processors, and the memory is used to store computer program codes, wherein the computer program codes include computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute the method according to any one of claims 1 to 16.

18. A chip system, characterized in that: The chip system is applied to an electronic device, and the chip system includes one or more processors, and the processor is used to call computer instructions so that the electronic device executes the method as described in any one of claims 1-16.

19. A computer-readable storage medium comprising instructions, characterized in that: When the instructions are executed on an electronic device, the electronic device is caused to execute the method as claimed in any one of claims 1 to 16.

20. A computer program product comprising instructions, characterized in that When the computer program product is executed on an electronic device, the electronic device is enabled to execute the method according to any one of claims 1 to 16.

Citation Information

Patent Citations

  • View rendering method, device, storage medium and intelligent terminal

    CN109064538A

  • User interface rendering method and device, client device and electronic device

    CN110764849A

  • Video processing method and device

    CN112218117A

  • Processor frequency adjusting method and device, electronic equipment and storage medium

    CN113138655A

  • Instruction synchronization method and system, and server

    CN113328821A

Cited By

  • Interface generation method and electronic device

    EP4571502A1

  • Interface generation method and electronic device

    WO2024083014A1