Resource allocation method and device and electronic equipment

Automatically allocate rendering resources by obtaining the weight of the drawing command and determining the rendering complexity, the problems of poor rendering operation convenience and resource waste in the prior art are solved, and a more efficient rendering process is achieved.

CN119718617APending Publication Date: 2025-03-28VIVO MOBILE COMM CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411512768.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-28
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

When handling complex user interfaces, the prior art requires manual addition of rendering whitelists, resulting in poor rendering operation convenience and may cause waste of rendering resources.

Method used

By obtaining the corresponding drawing command weights of the interface to be rendered, the rendering complexity is determined, and the rendering resources are automatically allocated according to this complexity, improving the convenience and speed of rendering operations.

Benefits of technology

It realizes the convenience and speed of rendering operations without manually adding rendering whitelists, and avoids the waste of rendering resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119718617A_ABST
    Figure CN119718617A_ABST
Patent Text Reader

Abstract

The invention discloses a resource allocation method and device and electronic equipment, and belongs to the technical field of terminals. The resource allocation method comprises the steps that M drawing command weights corresponding to a to-be-rendered interface are obtained, the to-be-rendered interface comprises N rendering nodes, each drawing command weight represents the resource size required by one rendering command in one rendering node, M is larger than or equal to N, and M and N are positive integers; according to the M drawing command weights, the rendering complexity of the to-be-rendered interface is determined; and according to the rendering complexity, allocating rendering resources to the to-be-rendered interface.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of terminal technology, and specifically relates to a resource allocation method, device and electronic device. Background Art

[0002] Currently, for complex user interfaces (UI), such as those including many complex UI elements, more resources need to be allocated to avoid interface display freezes.

[0003] Specifically, complex rendering scenes, such as team battle scenes in games, can be manually added to the rendering whitelist, so that when the rendering whitelist includes scenes to be rendered, the electronic device can increase rendering resources for the scenes to be rendered.

[0004] However, according to the above method, since the rendering scene needs to be manually added to the rendering whitelist, the rendering operation is less convenient. Summary of the invention

[0005] The purpose of the embodiments of the present application is to provide a resource allocation method, device and electronic device, which can improve the convenience and speed of rendering operations and avoid waste of rendering resources.

[0006] In a first aspect, an embodiment of the present application provides a resource allocation method, the method comprising: obtaining M drawing command weights corresponding to an interface to be rendered, the interface to be rendered comprising N rendering nodes, each drawing command weight representing the resource size required by a rendering command in a rendering node, M being greater than or equal to N, and M and N being positive integers; determining a rendering complexity of the interface to be rendered based on the M drawing command weights; and allocating rendering resources to the interface to be rendered based on the rendering complexity.

[0007] In a second aspect, an embodiment of the present application provides a resource allocation device, which includes: an acquisition module, a determination module and a processing module. Among them, the acquisition module is used to obtain M drawing command weights corresponding to the interface to be rendered, and the interface to be rendered includes N rendering nodes. Each drawing command weight represents the resource size required by a rendering command in a rendering node, M is greater than or equal to N, and M and N are positive integers. The determination module is used to determine the rendering complexity of the interface to be rendered according to the M drawing command weights obtained by the acquisition module. The processing module is used to allocate rendering resources to the interface to be rendered according to the rendering complexity determined by the determination module.

[0008] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the program or instructions are executed by the processor, the steps of the method described in the first aspect are implemented.

[0009] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.

[0010] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect.

[0011] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the method described in the first aspect.

[0012] In an embodiment of the present application, since each drawing command weight corresponding to the interface to be rendered can represent the resource size required by a drawing command in a rendering node of the interface to be rendered, it can be ensured that the rendering complexity determined according to the M drawing command weights corresponding to the interface to be rendered matches the resource size required by the interface to be rendered, that is, rendering resources can be allocated to the interface to be rendered according to the resource requirements of the interface to be rendered, thereby improving the convenience of rendering operations and the rendering speed, and avoiding waste of rendering resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] Figure 1 It is a flow chart of a resource allocation method provided in an embodiment of the present application;

[0014] Figure 2 This is a flow chart of a resource allocation method provided in an embodiment of the present application;

[0015] Figure 3 is a schematic diagram of the structure of a resource allocation device provided in an embodiment of the present application;

[0016] Figure 4 is a structural schematic diagram of an electronic device provided in an embodiment of the present application;

[0017] Figure 5 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0018] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.

[0019] The following is an explanation of the nouns and terms involved in the embodiments of the present application.

[0020] Display list: A display list usually refers to a series of drawing instructions used to describe drawing 2D or 3D graphics.

[0021] RenderNode: An object used to describe the drawing commands and properties of UI elements, such as 2D or 3D images. Each RenderNode represents an interface element in the interface. The RenderNode contains the drawing command list of the interface element and other drawing-related properties of the interface element.

[0022] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0023] The resource allocation method, device and electronic device provided in the embodiments of the present application are described in detail below with reference to the accompanying drawings through specific embodiments and their application scenarios.

[0024] The resource allocation method, device, and electronic device provided in the embodiments of the present application can be applied to the scene of rendering interface.

[0025] The resource allocation method provided in the embodiment of the present application can be executed when the electronic device runs an application. When the electronic device runs the application, it is necessary to first render each interface element in the interface according to the rendering node corresponding to each interface in the application to realize the display of each interface.

[0026] Exemplarily, in the process of an electronic device running a game application, the electronic device can obtain M drawing command weights corresponding to each game interface in the application, and can determine the rendering complexity of the interface to be rendered based on the M drawing command weights, and can allocate rendering resources to the interface to be rendered based on the rendering complexity; wherein each drawing command weight represents the resource size required by a drawing command of a rendering node in the interface to be rendered, M is greater than or equal to N, and M and N are positive integers. In this way, since each drawing command weight corresponding to the interface to be rendered can represent the resource size required by a drawing command in a rendering node of the interface to be rendered, it can be ensured that the rendering complexity determined according to the M drawing command weights corresponding to the interface to be rendered matches the resource size required by the interface to be rendered, that is, rendering resources can be allocated to the interface to be rendered based on the resource requirements of the interface to be rendered, so that compared with the method of manually adding a rendering whitelist, the resource allocation method provided in the embodiment of the present application can not only improve the convenience of rendering operation and rendering speed, but also avoid the waste of rendering resources.

[0027] Furthermore, since rendering resources are allocated to the interface to be rendered according to its resource requirements, rendering threads of both system applications and third-party applications can obtain the same degree of resource inclination, thereby improving the comprehensive display effect of the electronic device.

[0028] The rendering method provided in the embodiment of the present application can be executed by an electronic device or at least one of the functional modules and entity modules in the electronic device that can implement the search. The specific execution can be determined according to actual use requirements and is not limited in the embodiment of the present application. In the embodiment of the present application, an electronic device executing the rendering method is taken as an example to illustrate the rendering method provided in the embodiment of the present application.

[0029] The present application provides a resource allocation method. Figure 1 A schematic diagram of a resource allocation method according to an embodiment of the present application is shown. Figure 1 As shown, the resource allocation method provided in the embodiment of the present application may include the following steps 101 to 103.

[0030] Step 101: The electronic device obtains M drawing command weights corresponding to the interface to be rendered.

[0031] The interface to be rendered may include N rendering nodes, each drawing command weight may represent the resource size required by a drawing command in a rendering node, M is greater than or equal to N, and M and N are positive integers.

[0032] In some embodiments of the present application, each of the N rendering nodes may describe an interface element in the interface to be rendered, wherein the interface element may include but is not limited to any of the following: graphics, images, text, logos, etc.

[0033] In some embodiments of the present application, the interface elements in the interface to be rendered may be 2D interface elements or 3D interface elements.

[0034] In some embodiments of the present application, the drawing node of the interface element includes a drawing command list of the interface element and the drawing attributes of the interface element, and the drawing command list includes all drawing commands for drawing the interface element.

[0035] In some embodiments of the present application, the electronic device may first obtain the drawing command of each rendering node to obtain M drawing commands; then, for each drawing command in the M drawing commands, the electronic device may determine the drawing command weight of the drawing command according to the drawing command and the first corresponding relationship. The first corresponding relationship is a corresponding relationship between drawing commands and drawing command weights in the rendering system, wherein each drawing command in the rendering system corresponds to a drawing command weight.

[0036] In some embodiments of the present application, the electronic device may construct a weight factor table according to the first corresponding relationship, so that the electronic device may obtain the drawing command weight corresponding to the drawing command by querying the weight factor table.

[0037] It should be noted that in the rendering system, the number of drawing commands is limited. In other words, the rendering system provides a specific number of drawing commands, such as dozens of drawing commands; thus, the task of constructing a weight factor table is feasible.

[0038] Furthermore, since different types of drawing commands require different memory and computing resources, for example, simple drawing of geometric figures may require fewer resources than complex texture mapping or lighting effects. Therefore, the size of resources required by the drawing command can be used to set a drawing command weight for the drawing command. The larger the drawing command weight corresponding to the drawing command, the more resources are required to prepare for the drawing command.

[0039] In some embodiments of the present application, assuming that the application to which the interface to be rendered belongs is a first application, the first application may be any one of the following: a system application, a third-party application.

[0040] For example, system applications may include phone applications, text messaging applications, and settings applications, etc.; third-party applications may include game applications, map applications, etc.

[0041] Step 102: The electronic device determines the rendering complexity of the interface to be rendered according to the M drawing command weights.

[0042] In some embodiments of the present application, the rendering complexity of the interface to be rendered may represent the size of resources required by the interface to be rendered. Specifically, the rendering complexity may represent the size of resources required by the electronic device to complete the rendering of the interface to be rendered within a preset time.

[0043] The preset duration is determined by the refresh frame rate or drawing frame rate of the application to which the interface to be rendered belongs.

[0044] In some embodiments of the present application, in one method, the electronic device may determine the sum of the weights of M drawing commands as the rendering complexity of the interface to be rendered.

[0045] In some embodiments of the present application, the above step 102 can be implemented by the following step 102A.

[0046] Step 102A: The electronic device determines the rendering complexity of the interface to be rendered according to the M drawing command weights and the attribute change weights corresponding to the N rendering nodes.

[0047] Each attribute change weight indicates whether an attribute of a rendering node has changed.

[0048] In some embodiments of the present application, the attributes of the rendering node may include but are not limited to at least one of the following items of the interface element described by the rendering node: display position, transparency, display size, color, and format.

[0049] In some embodiments of the present application, the change in the attribute of the rendering node may include any of the following: the attribute of the rendering node in the interface to be rendered changes relative to the attribute of the rendering node in the reference interface, such as changing from position 1 to position 2; the reference interface does not include the rendering node. The reference interface is the previous frame interface of the interface to be rendered, that is, the last interface rendered before rendering the interface to be rendered. It can be understood that the reference interface and the interface to be rendered are two interfaces in the same application.

[0050] In some embodiments of the present application, the attribute of the rendering node does not change means that the attribute of the rendering node in the to-be-rendered interface is the same as the attribute of the rendering node in the reference interface.

[0051] It is understandable that when the properties of a rendering node remain unchanged, the rendering node will not consume rendering resources or consume fewer rendering resources; when the properties of a rendering node change, the rendering node may require more rendering resources, which may increase the resource size required for the entire interface to be rendered.

[0052] In some embodiments of the present application, when the attribute of the rendering node remains unchanged, the attribute change weight corresponding to the rendering node may be 0; when the attribute of the rendering node changes, the attribute change weight corresponding to the rendering node may be 1.

[0053] In some embodiments of the present application, the electronic device may set the attribute change weight corresponding to the rendering node according to the change degree of the attribute of the rendering node, wherein the higher the attribute change degree, the greater the attribute change weight.

[0054] For example, when the display size of the rendering node increases by 2 times, the attribute change weight corresponding to the rendering node is 0.8; when the display size of the rendering node increases by 3 times, the attribute change weight corresponding to the rendering node is 1.

[0055] In some embodiments of the present application, the electronic device may set the attribute change weight corresponding to the rendering node according to the number of attribute items changed in the rendering node, wherein the higher the number of attribute items changed, the greater the attribute change weight.

[0056] For example, assuming that a rendering node includes 4 attribute items, if 3 attribute items change, the attribute change weight corresponding to the rendering node may be a1; if all 4 attribute items change, the attribute change weight corresponding to the rendering node may be a2; wherein a2 is greater than a1.

[0057] In this way, since the attribute change weight corresponding to the rendering node can indicate whether the rendering node has changed, and the interface elements in the interface to be rendered that are the same as those in the previous frame interface do not need to be rendered repeatedly, the rendering complexity of the interface to be rendered is determined based on the M drawing command weights corresponding to the interface to be rendered and all attribute change weights of the interface to be rendered, the accuracy of the rendering complexity can be improved, so that rendering resources can be allocated to the interface to be rendered more accurately.

[0058] In some embodiments of the present application, each rendering node in the above-mentioned interface to be rendered may correspond to at least one rendering command weight among the M rendering command weights, and the above-mentioned step 102A may be implemented through the following steps 102A1 to 102A3.

[0059] Step 102A1: The electronic device determines the initial complexity of each rendering node according to at least one drawing command weight corresponding to each rendering node.

[0060] In some embodiments of the present application, the electronic device may sum up at least one drawing command weight corresponding to i rendering nodes to obtain the initial complexity of the i-th rendering node, i=1, 2, ... N. Thus, after the electronic device sums up at least one drawing command weight corresponding to the rendering node to obtain the initial complexity of the N-th rendering node, the electronic device may obtain the initial complexity of the N rendering nodes.

[0061] In some embodiments of the present application, the electronic device may also sum the squares of at least one drawing command weight corresponding to i rendering nodes to obtain a first square sum value, and then perform square root processing on the first square sum value to obtain the initial complexity of the i-th rendering node.

[0062] Of course, the above method of determining the initial complexity of each rendering node according to the drawing command weight corresponding to each rendering node is only for illustration. In actual implementation, the electronic device can also determine the initial complexity of each rendering node according to the drawing command weight corresponding to each rendering node in any other possible manner.

[0063] Step 102A2: The electronic device performs weighted processing on the initial complexity of each rendering node according to the attribute change weight corresponding to each rendering node to obtain the drawing complexity of each rendering node.

[0064] It can be understood that the embodiment of the present application uses the attribute change weight corresponding to the rendering node to correct the initial complexity of the rendering node, which can ensure that the drawing complexity of the rendering node matches the attribute change of the rendering node and the resource requirements of the drawing command.

[0065] In some embodiments of the present application, it is assumed that when the attribute of the rendering node remains unchanged, the attribute change weight corresponding to the rendering node may be 0; when the attribute of the rendering node changes, the attribute change weight corresponding to the rendering node may be 1. Then: if the attribute of a rendering node does not change, the rendering complexity of the rendering node is 1; if the attribute of a rendering node changes, the rendering complexity of the rendering node is.

[0066] Step 102A3: The electronic device determines the rendering complexity of the interface to be rendered according to the N drawing complexities.

[0067] In some embodiments of the present application, the electronic device may sum the N drawing complexities to obtain the rendering complexity of the interface to be rendered.

[0068] In some embodiments of the present application, the electronic device can square N drawing complexities to obtain N square values, then sum the N square values ​​to obtain a second square sum value, and then perform square root processing on the second square sum value to obtain the rendering complexity of the interface to be rendered.

[0069] Of course, the electronic device may also calculate the rendering complexity of the interface to be rendered according to the N drawing complexities in any other possible manner, which is not limited in the embodiments of the present application.

[0070] The following describes a method for determining the rendering complexity of an interface to be rendered in an embodiment of the present application with reference to specific examples.

[0071] For example, it is assumed that the factors affecting the rendering complexity of the application interface may include but are not limited to at least one of the following: (1) the number of render nodes in the interface (renderNodeCount). Since each RenderNode corresponds to an interface element on the application interface, an increase in the number of RenderNodes indicates an increase in the number of interface elements in the application interface, and an increase in the number of interface elements will increase the complexity of the entire application interface.

[0072] (2) The initial complexity of each RenderNode, i.e., drawCmdComplexity. This initial complexity can also be called the complexity of the drawing command list constructed by each RenderNode, i.e., the complexity of the drawing commands in each RenderNode, i.e., the resource size required by the drawing commands in the RenderNode.

[0073] It can be understood that the complexity of the drawing command list depends on the number (drawCmdNums) and type of drawing commands contained in each RenderNode.

[0074] (3) RenderNode's property changes (propertyChange).

[0075] Among them, if the properties of RenderNode change, such as position, transparency, etc., the complexity of the interface to be drawn will increase relative to the reference interface, so it is necessary to recalculate the rendering complexity of the interface to be rendered, that is, the interface to be rendered does not use the rendering complexity of the reference interface, where the reference interface is the last interface rendered before the interface to be rendered.

[0076] Taking into account (1), (2) and (3) above, the electronic device can evaluate the rendering complexity of the interface to be rendered according to the number of RenderNodes of the interface to be rendered, the complexity of the drawing command list corresponding to the RenderNode, and the attribute change weight.

[0077] Specifically, the rendering complexity function Complexity of the interface to be rendered can be expressed by the following formula:

[0078] Among them, Complexity() represents the rendering complexity of the interface to be rendered. Complexity() can accumulate and sum the complexity generated by each RenderNode in the interface to be rendered. RenderNodeCount represents the number of RenderNodes contained in the interface to be rendered. drawCmdComplexity represents the initial complexity of each RenderNode in the interface to be rendered. propertyCha represents the property change weight corresponding to each RenderNode in the interface to be rendered. drawCmdComplexity(i) represents the cumulative sum of the complexity generated by the drawing commands contained in each RenderNode, that is, the initial complexity of each RenderNode. drawCmdNums represents the number of drawing commands contained in a RenderNode. drawCmdWeight(j) represents the drawing command weight corresponding to each drawing command, which can be obtained from the above weight factor table. propertyIsChange(i) represents the property change weight corresponding to each RenderNode, which is used to indicate whether the property of each RenderNode has changed.

[0079] It should be noted that step 102 is illustrated by taking the attribute change weights corresponding to the rendering nodes in the interface to be rendered and the drawing command weights corresponding to the rendering nodes as an example to calculate the rendering complexity of the interface to be rendered. In actual implementation, the rendering complexity of the interface to be rendered can also be combined with the rendering complexity of the first M frames of the interface to be rendered to predict the rendering complexity of the interface to be rendered. That is, the rendering complexity of the first M frames of the interface is used as a component of calculating the rendering complexity of the interface to be rendered.

[0080] In this way, since the initial complexity of each rendering node can be determined according to the drawing command weight corresponding to each rendering node, and the corresponding initial complexity can be corrected using the attribute change weight corresponding to each rendering node to obtain the rendering complexity of each rendering node, the drawing complexity of each rendering node can more accurately represent the actual resource size required by each rendering node, so that the rendering complexity determined according to N drawing complexities can be more accurate, and rendering resources can be more accurately allocated to the interface to be rendered.

[0081] Step 103: The electronic device allocates rendering resources to the interface to be rendered according to the rendering complexity of the interface to be rendered.

[0082] In some embodiments of the present application, after the electronic device allocates rendering resources to the interface to be rendered, the electronic device can use the rendering resources to render interface elements in the interface to be rendered, and display the rendered interface.

[0083] In some embodiments of the present application, the electronic device may render the interface elements in the interface to be rendered using the rendering resources allocated to the interface to be rendered when the rendering conditions of the interface to be rendered are met. The rendering conditions may include but are not limited to at least one of the following: receiving user input, reaching the display time of the interface to be rendered, etc., which may be determined according to actual usage requirements.

[0084] In some embodiments of the present application, the above step 103 can be implemented by the following steps 103A and 103B.

[0085] Step 103A: The electronic device determines a target complexity range threshold of the rendering complexity of the interface to be rendered.

[0086] Step 103B: The electronic device allocates rendering resources to the interface to be rendered according to the target complexity range threshold.

[0087] In some embodiments of the present application, the electronic device may determine the resource capability corresponding to the target complexity range threshold as the rendering resource of the interface to be rendered. The rendering resource allocated by the electronic device to the interface to be rendered is different for different target complexity range thresholds.

[0088] Exemplarily, the electronic device may determine the operating frequency corresponding to the target complexity range threshold as the operating frequency of the central processing unit (CPU) when rendering the interface to be rendered. For example, the target complexity range threshold may correspond to a high frequency mode or a low frequency mode.

[0089] Exemplarily, the electronic device can determine the thread priority corresponding to the target complexity range threshold as the rendering thread priority of the interface to be rendered, so that the electronic device can use the resources corresponding to the rendering thread priority to render the interface to be rendered. Since the rendering thread priority of the interface to be rendered is determined according to the rendering complexity of the interface to be rendered, and the rendering complexity of the interface to be rendered matches the resource size required by the interface to be rendered, it can be ensured that the rendering resources allocated to the interface to be rendered according to the rendering thread priority of the interface to be rendered meet the resource requirements of the interface to be rendered, and no waste of rendering resources will be caused.

[0090] Exemplarily, the electronic device may determine the working core of the CPU corresponding to the target complexity range threshold as the working core used when rendering the interface to be rendered, wherein the working core of the CPU may include: a large core and a small core.

[0091] It can be understood that the rendering thread priority can control the execution order and resource allocation of the rendering threads of the to-be-rendered interface. Among them, the higher the rendering thread priority, the earlier it is executed, so that resources can be allocated first.

[0092] In some embodiments of the present application, the electronic device may compare the rendering complexity with at least one rendering complexity threshold, and determine the target complexity range threshold of the rendering complexity based on the comparison result, so that rendering resources can be allocated to the interface to be rendered based on the target complexity threshold. It should be noted that the at least one complexity threshold can be divided into at least two complexity range thresholds, wherein each complexity range threshold corresponds to a resource capability of the electronic device, and the larger the upper limit value of the complexity range threshold, the larger the resource capability corresponding to the complexity range threshold, and different complexity threshold range thresholds correspond to different resource capabilities.

[0093] Exemplarily, assuming that at least one rendering complexity threshold includes a rendering complexity threshold, the electronic device can determine whether the rendering complexity of the interface to be rendered is greater than the rendering complexity threshold. If the rendering complexity is greater than the rendering complexity threshold, the rendering complexity is within the first complexity range threshold, otherwise the rendering complexity is within the second complexity range threshold. Among them, if the rendering complexity is less than or equal to the rendering complexity threshold, it means that the current default resource allocation of the electronic device meets the rendering requirements of the interface to be rendered, such as no negative situations such as freezes; if the rendering complexity is greater than the rendering complexity threshold, it means that the current default resource allocation method of the electronic device may cause screen freezes and other situations, and thus it is necessary to increase the system resource allocation strength, such as increasing thread priority.

[0094] In this way, since the target complexity range threshold of the rendering complexity of the interface to be rendered can be determined, and rendering resources are allocated to the interface to be rendered according to the target complexity range threshold, the process of allocating rendering resources to the interface to be rendered can be simplified.

[0095] In the resource allocation method provided in the embodiment of the present application, since each drawing command weight corresponding to the interface to be rendered can represent the resource size required by a drawing command in a rendering node of the interface to be rendered, it can be ensured that the rendering complexity determined according to the M drawing command weights corresponding to the interface to be rendered matches the resource size required by the interface to be rendered, that is, rendering resources can be allocated to the interface to be rendered according to the resource requirements of the interface to be rendered, thereby improving the operational convenience and rendering speed of the rendering and avoiding waste of rendering resources.

[0096] In some embodiments of the present application, before the above step 101, the resource allocation method provided by the embodiment of the present application may further include the following step 104.

[0097] Step 104: The electronic device determines at least two complexity range thresholds according to the first parameter.

[0098] The at least two complexity range thresholds include a target complexity range threshold. The first parameter may include at least one of the following: hardware resource capability information of the electronic device, and a drawing frame rate of an application to which the interface to be rendered belongs.

[0099] In some embodiments of the present application, the hardware resource capability information of the electronic device may indicate the hardware resource capability of the electronic device.

[0100] In some embodiments of the present application, the above-mentioned hardware resource capability information may include but is not limited to any of the following: a device identifier, a CPU identifier of the electronic device, and a CPU model of the electronic device.

[0101] In some embodiments of the present application, when the application drawing frame rate is the same, the greater the hardware resource capability of the electronic device, the greater the default rendering resources of the electronic device, and thus the greater the lower limit value of the complexity range threshold; or, when the hardware resource capability of the electronic device is the same, the smaller the application drawing frame rate, the electronic device has more time to render a complex interface under the default rendering resources of the electronic device, and thus the greater the lower limit value of the complexity range threshold.

[0102] In some embodiments of the present application, the electronic device may select at least two complexity range thresholds that satisfy the first parameter from a preset complexity range threshold table based on the first parameter.

[0103] The preset complexity range threshold table includes a plurality of complexity range thresholds, and each complexity range threshold corresponds to an application drawing frame rate and a piece of hardware resource information.

[0104] It is understandable that the electronic device can divide the hardware resources of the electronic device into multiple resource segments, each resource segment corresponds to a complexity range threshold, so that the rendering complexity of the to-be-rendered interface is at different complexity range thresholds, and the electronic device can allocate different levels of resources to it.

[0105] In this way, since at least two complexity range thresholds for applying for rendering resources for the interface to be rendered can be determined based on the device information of the electronic device and / or the application drawing frame rate of the application to which the interface to be rendered belongs, it can be ensured that the resources corresponding to the at least two complexity range thresholds match the hardware resource capabilities of the electronic device and / or the application drawing frame rate of the application to which the interface to be rendered belongs, thereby improving the accuracy of allocating rendering resources to the interface to be rendered.

[0106] The complete process of the resource allocation method provided in the embodiment of the present application is exemplarily described below.

[0107] For example, Figure 2 As shown, the embodiment of the present application provides a resource allocation method, such as Figure 2As shown, the resource allocation method may include the following steps:

[0108] Step 201: The electronic device constructs a weight factor table.

[0109] The weight factor table includes drawing commands in the rendering system and a drawing command weight corresponding to each drawing command, and the drawing command weight is used to indicate the size of resources consumed by a drawing command.

[0110] Step 202: The electronic device constructs a complexity range threshold table according to at least one application drawing frame rate and at least one hardware resource information.

[0111] The preset complexity range threshold table includes a plurality of complexity range thresholds and an application drawing frame rate and a hardware resource information corresponding to each complexity range threshold; and the at least one hardware resource information indicates a hardware resource segment of the electronic device.

[0112] Step 203: The electronic device obtains M drawing command weights corresponding to the interface to be rendered from a weight factor table according to the M drawing commands in the interface to be rendered.

[0113] Step 204: The electronic device determines the rendering complexity of the interface to be rendered according to the M drawing command weights.

[0114] Step 205: The electronic device determines a target complexity range threshold of the rendering complexity.

[0115] It should be noted that the target complexity range is a complexity range threshold in the above complexity range threshold table corresponding to the application drawing frame rate of the application to which the to-be-rendered interface belongs.

[0116] Step 206: The electronic device allocates rendering resources to the interface to be rendered according to the target complexity range threshold.

[0117] In this way, because it can be based on the dynamic evaluation of the complexity of the rendering task, it aims to optimize the system's resource allocation for rendering tasks and improve the system's rendering efficiency and performance. The complexity of the DisplayList of the entire interface is evaluated by comprehensively evaluating the number of RenderNodes, the drawing command list constructed by each RenderNode, and the attribute changes. Then, according to the size of the complexity, the allocation of system resources is dynamically adjusted, such as increasing the priority of the thread, to ensure that under high load conditions, the system can fully utilize resources for rendering, while avoiding too many system resources being occupied by rendering tasks under low load conditions. It has a positive effect on reducing power consumption and improving the overall graphics rendering efficiency of the device, so as to further improve the user experience.

[0118] The resource allocation method provided in the embodiment of the present application can be executed by a resource allocation device. In the embodiment of the present application, the resource allocation device provided in the embodiment of the present application is described by taking the resource allocation device executing the resource allocation method as an example.

[0119] Figure 3 FIG. 1 shows a possible structural diagram of a resource allocation device involved in some embodiments of the present application. Figure 3 As shown, the resource allocation device 70 may include: an acquisition module 71 , a determination module 72 and a processing module 73 .

[0120] The acquisition module 71 is used to acquire M drawing command weights corresponding to the interface to be rendered, the interface to be rendered includes N rendering nodes, each drawing command weight represents the resource size required by a rendering command in a rendering node, M is greater than or equal to N, and M and N are positive integers. The determination module 72 is used to determine the rendering complexity of the interface to be rendered according to the M drawing command weights acquired by the acquisition module 71. The processing module 73 is used to allocate rendering resources to the interface to be rendered according to the rendering complexity determined by the determination module 72.

[0121] In a possible implementation, the determination module 72 is specifically configured to determine the rendering complexity according to the M drawing command weights and the attribute change weights corresponding to the N rendering nodes;

[0122] Each attribute change weight represents whether an attribute of a rendering node has changed.

[0123] In a possible implementation, each rendering node in the to-be-rendered interface corresponds to at least one of the M rendering command weights; the determination module 72 is specifically configured to:

[0124] Determine an initial complexity of each rendering node according to at least one drawing command weight corresponding to each rendering node;

[0125] According to the attribute change weight corresponding to each rendering node, the initial complexity of each rendering node is weighted to obtain the drawing complexity of each rendering node;

[0126] Determine the rendering complexity based on the N drawing complexities.

[0127] In a possible implementation, the processing module 73 is specifically used to determine a target complexity range threshold of the rendering complexity; and, according to the target complexity range threshold, allocate rendering resources to the interface to be rendered.

[0128] In a possible implementation, the determination module 72 is further configured to determine at least two complexity range thresholds matching the first parameter before the acquisition module 71 acquires the M drawing command weights corresponding to the to-be-rendered interface, wherein the at least two complexity range thresholds include a target complexity range threshold;

[0129] The first parameter includes at least one of the following: hardware resource capability information of the electronic device, and a drawing frame rate of the application to which the interface to be rendered belongs.

[0130] An embodiment of the present application provides a resource allocation device. Since each drawing command weight corresponding to the interface to be rendered can represent the resource size required by a drawing command in a rendering node of the interface to be rendered, it can ensure that the rendering complexity determined according to the M drawing command weights corresponding to the interface to be rendered matches the resource size required by the interface to be rendered, that is, the resource allocation device can allocate rendering resources to the interface to be rendered according to the resource requirements of the interface to be rendered, thereby improving the operational convenience and rendering speed of the resource allocation device and avoiding waste of rendering resources.

[0131] The resource allocation device in the embodiment of the present application can be an electronic device, or a component in the electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or other devices other than a terminal. Exemplarily, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (augmented reality, AR) / virtual reality (virtual reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.

[0132] The resource allocation device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.

[0133] The resource allocation device provided in the embodiment of the present application can implement each process implemented in the above-mentioned resource allocation method embodiment and achieve the same technical effect. To avoid repetition, it will not be described here.

[0134] Alternatively, if Figure 4 As shown, an embodiment of the present application also provides an electronic device 400, including a processor 401 and a memory 402, wherein the memory 402 stores programs or instructions that can be executed on the processor 401, and when the program or instruction is executed by the processor 401, each step of the above-mentioned resource allocation method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0135] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.

[0136] Figure 5 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of the present application.

[0137] The electronic device 1500 includes but is not limited to: a radio frequency unit 1501, a network module 1502, an audio output unit 1503, an input unit 1504, a sensor 1505, a display unit 1506, a user input unit 1507, an interface unit 1508, a memory 1509, and a processor 1510 and other components.

[0138] Those skilled in the art will appreciate that the electronic device 1500 may also include a power source (such as a battery) for supplying power to each component, and the power source may be logically connected to the processor 1510 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Figure 5 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.

[0139] Among them, the above-mentioned processor 1510 is used to obtain M drawing command weights corresponding to the interface to be rendered, the interface to be rendered includes N rendering nodes, each drawing command weight represents the resource size required by a rendering command in a rendering node, M is greater than or equal to N, M and N are positive integers; and according to the M drawing command weights, determine the rendering complexity of the interface to be rendered; and, according to the rendering complexity, allocate rendering resources to the interface to be rendered.

[0140] Optionally, the processor 1510 is specifically configured to determine rendering complexity according to the M drawing command weights and the attribute change weights corresponding to the N rendering nodes;

[0141] Each attribute change weight represents whether an attribute of a rendering node has changed.

[0142] Optionally, each rendering node in the to-be-rendered interface corresponds to at least one rendering command weight among the M rendering command weights, and the processor 1510 is specifically configured to:

[0143] Determine an initial complexity of each rendering node according to at least one drawing command weight corresponding to each rendering node;

[0144] According to the attribute change weight corresponding to each rendering node, the initial complexity of each rendering node is weighted to obtain the drawing complexity of each rendering node;

[0145] Determine the rendering complexity based on the N drawing complexities.

[0146] Optionally, the processor 1510 is specifically configured to determine a target complexity range threshold of the rendering complexity; and, based on the target complexity range threshold, allocate rendering resources to the interface to be rendered.

[0147] Optionally, the processor 1510 is further configured to determine at least two complexity range thresholds matching the first parameter before obtaining the M drawing command weights corresponding to the interface to be rendered, wherein the at least two complexity range thresholds include a target complexity range threshold;

[0148] The first parameter includes at least one of the following: hardware resource capability information of the electronic device, and a drawing frame rate of the application to which the interface to be rendered belongs.

[0149] The embodiment of the present application provides an electronic device, since each drawing command weight corresponding to the interface to be rendered can characterize the resource size required by a drawing command in a rendering node of the interface to be rendered, it can ensure that the rendering complexity determined according to the M drawing command weights corresponding to the interface to be rendered matches the resource size required by the interface to be rendered, that is, the electronic device can allocate rendering resources for the interface to be rendered according to the resource requirements of the interface to be rendered, thereby improving the convenience of operation and rendering speed of the electronic device rendering, and avoiding the waste of rendering resources. It should be understood that in the embodiment of the present application, the input unit 1504 may include a graphics processor (Graphics Processing Unit, GPU) 15041 and a microphone 15042, and the graphics processor 15041 processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The display unit 1506 may include a display panel 15061, and the display panel 15061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 1507 includes a touch panel 15071 and at least one of other input devices 15072. The touch panel 15071 is also called a touch screen. The touch panel 15071 may include two parts: a touch detection device and a touch controller. Other input devices 15072 may include, but are not limited to, a physical keyboard, function keys (such as a volume control key, a switch key, etc.), a trackball, a mouse, and a joystick, which will not be described in detail here.

[0150] The memory 1509 can be used to store software programs and various data. The memory 1509 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory 1509 may include a volatile memory or a non-volatile memory, or the memory 1509 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct memory bus random access memory (DRRAM). The memory 1509 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.

[0151] The processor 1510 may include one or more processing units; optionally, the processor 1510 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor 1510.

[0152] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the various processes of the above-mentioned resource allocation embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0153] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.

[0154] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned resource allocation embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0155] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.

[0156] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned resource allocation embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0157] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0158] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0159] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. A resource allocation method, characterized in that: The method comprises: Obtain M drawing command weights corresponding to the to-be-rendered interface, where the to-be-rendered interface includes N rendering nodes, each drawing command weight represents the resource size required by a rendering command in a rendering node, M is greater than or equal to N, and M and N are positive integers; Determining the rendering complexity of the interface to be rendered according to the M drawing command weights; Allocate rendering resources to the interface to be rendered according to the rendering complexity.

2. The method according to claim 1, characterized in that: Determining the rendering complexity of the to-be-rendered interface according to the M drawing command weights includes: Determining the rendering complexity according to the M drawing command weights and the attribute change weights corresponding to the N rendering nodes; Each attribute change weight represents whether an attribute of a rendering node has changed.

3. The method according to claim 2, characterized in that Each rendering node in the to-be-rendered interface corresponds to at least one rendering command weight among the M rendering command weights; The determining the rendering complexity according to the M drawing command weights and the attribute change weights of the N rendering nodes includes: Determining the initial complexity of each rendering node according to the drawing command weight corresponding to each rendering node; According to the attribute change weight corresponding to each rendering node, weighted processing is performed on the initial complexity of each rendering node to obtain the drawing complexity of each rendering node; The rendering complexity is determined according to the N drawing complexities.

4. The method according to claim 1, characterized in that: The allocating rendering resources to the to-be-rendered interface according to the rendering complexity includes: Determining a target complexity range threshold for the rendering complexity; According to the target complexity range threshold, rendering resources are allocated to the interface to be rendered.

5. The method according to claim 1, characterized in that Before obtaining the M drawing command weights corresponding to the to-be-rendered interface, the method further includes: Determining at least two complexity range thresholds matching the first parameter, wherein the at least two complexity range thresholds include the target complexity range threshold; The first parameter includes at least one of the following: hardware resource capability information of the electronic device, and a drawing frame rate of an application to which the interface to be rendered belongs.

6. A resource allocation device, characterized in that: The device comprises: an acquisition module, a determination module and a processing module; The acquisition module is used to acquire M drawing command weights corresponding to the to-be-rendered interface, the to-be-rendered interface includes N rendering nodes, each drawing command weight represents the resource size required by a rendering command in a rendering node, M is greater than or equal to N, and M and N are positive integers; The determining module is used to determine the rendering complexity of the to-be-rendered interface according to the M drawing command weights acquired by the acquiring module; The processing module is used to allocate rendering resources to the interface to be rendered according to the rendering complexity determined by the determining module.

7. The device according to claim 6, characterized in that The determination module is specifically configured to determine the rendering complexity according to the M drawing command weights and the attribute change weights corresponding to the N rendering nodes; Each attribute change weight represents whether an attribute of a rendering node has changed.

8. The device according to claim 7, characterized in that Each rendering node in the to-be-rendered interface corresponds to at least one rendering command weight among the M rendering command weights; the determining module is specifically configured to: Determining an initial complexity of each rendering node according to at least one drawing command weight corresponding to each rendering node; According to the attribute change weight corresponding to each rendering node, weighted processing is performed on the initial complexity of each rendering node to obtain the drawing complexity of each rendering node; The rendering complexity is determined according to the N drawing complexities.

9. The device according to claim 6, characterized in that The processing module is specifically used to determine a target complexity range threshold of the rendering complexity; and, according to the target complexity range threshold, allocate rendering resources to the interface to be rendered.

10. The device according to claim 6, characterized in that The determining module is further configured to determine at least two complexity range thresholds matching the first parameter before the acquiring module acquires the M drawing command weights corresponding to the to-be-rendered interface, wherein the at least two complexity range thresholds include the target complexity range threshold; The first parameter includes at least one of the following: hardware resource capability information of the electronic device, and a drawing frame rate of an application to which the interface to be rendered belongs.

11. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a program or instruction that can be run on the processor, and when the program or instruction is executed by the processor, the steps of the resource allocation method according to any one of claims 1 to 5 are implemented.