Frequency point adjustment method and device, and electronic device

CN120670131BActive Publication Date: 2026-08-18HUAWEI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410660199.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-27
Publication Date
2026-08-18
Estimated Expiration
2044-05-27

AI Technical Summary

Technical Problem

目前电子设备上常用的调度方法,是统计各类任务的占空比,并根据历史窗口负载的涨幅趋势,对CPU的负载和GPU的负载做出一定程度的预测,但是CPU的负载和GPU的负载的预测是相对独立的,预测CPU的负载与预测GPU的负载之间没有关联,从而导致在电子设备执行绘帧任务时,如果遇到负载突发的情况,无法及时对CPU和GPU的频点进行调整,这会使得绘帧任务无法及时完成,给用户带来卡顿、不流畅的使用体验

Benefits of technology

[0014] Secondly, embodiments of this application provide an electronic device, including: one or more processors; a memory; multiple application programs; and one or more computer programs, wherein the one or more computer programs are stored in the memory, and the one or more computer programs include instructions that, when executed by the electronic device, cause the electronic device to perform the method provided in the first aspect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120670131B_ABST
    Figure CN120670131B_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a frequency point adjustment method, device and electronic equipment, wherein in the frequency point adjustment method, the electronic equipment obtains a current image frame, determines a rendering quantity and a blur area of the current image frame, then according to the rendering quantity and the blur area, predicts a first time length for a CPU to generate a rendering instruction; and according to a load prediction parameter of a GPU, predicts a second time length for the GPU to execute the rendering instruction, compares the first time length with a residual time length of the CPU to obtain a first comparison result; and compares the second time length with a time length pre-allocated to the GPU to obtain a second comparison result, and finally determines a first target frequency point of the CPU according to the first comparison result, the second comparison result and a first load, so that the load of the CPU and the GPU in the frame drawing task can be predicted, and the frequency point of the CPU can be adjusted according to the CPU load and the GPU load, so that the frame drawing task can be completed in time, and a user can have a smooth use experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of smart terminal technology, and in particular to a frequency adjustment method, apparatus, and electronic device. Background Technology

[0002] When using electronic devices (such as smartphones or tablets), the smoothness of the user experience is a key competitive advantage. In existing technologies, frame rendering tasks in electronic devices typically require the Central Processing Unit (CPU) to perform calculations, followed by the Graphics Processing Unit (GPU) to generate images from the CPU's calculations. Currently, a common scheduling method in electronic devices involves statistically analyzing the duty cycles of various tasks and predicting CPU and GPU loads to some extent based on historical load trends. However, these predictions are relatively independent, lacking correlation. Consequently, when encountering sudden load spikes during frame rendering tasks, the frequency of the CPU and GPU cannot be adjusted promptly, leading to delayed frame rendering and a stuttering, unsmooth user experience. Summary of the Invention

[0003] This application provides a frequency adjustment method, apparatus, and electronic device. This application also provides a computer-readable storage medium to predict the load of the CPU and GPU in the frame drawing task, and adjust the CPU frequency based on the predicted CPU and GPU load, so that the frame drawing task can be completed in a timely manner without frame loss, providing users with a smooth user experience.

[0004] In a first aspect, this application provides a frequency adjustment method, comprising: acquiring a current image frame to be drawn; determining the rendering quantity and blur area of ​​the current image frame via a CPU; predicting a first load of the CPU generating rendering instructions for the current image frame based on the rendering quantity and blur area of ​​the current image frame; and predicting a second load of the GPU executing the rendering instructions based on GPU load prediction parameters; wherein the rendering instructions for the current image frame are generated based on the rendering quantity and the blur area; the GPU load prediction parameters include: the historical load of the GPU, the rendering quantity, and the blur area; and predicting the CPU's frequency for generating the rendering instructions based on the first load and the CPU's highest frequency. A first duration; and a second duration predicted by the GPU for executing the rendering instructions based on the second load and the highest frequency of the GPU; comparing the first duration with the remaining duration of the CPU to obtain a first comparison result; and comparing the second duration with the duration pre-allocated to the GPU to obtain a second comparison result; wherein the remaining duration of the CPU includes the remaining duration after subtracting the duration used to determine the number of renderings and the blur area from the duration pre-allocated to the CPU; and determining a first target frequency of the CPU based on the first comparison result, the second comparison result, and the first load, so that the CPU can use the first target frequency of the CPU to generate rendering instructions for the current image frame.

[0005] In the aforementioned frequency adjustment method, the electronic device acquires the current image frame to be drawn, determines the number of rendering operations and the blurred area of ​​the current image frame through the CPU, and then predicts the first load of the CPU generating rendering instructions for the current image frame based on the number of rendering operations and the blurred area of ​​the current image frame; and predicts the second load of the GPU executing the above rendering instructions based on the GPU load prediction parameters. Next, the electronic device predicts the first duration of the CPU generating the above rendering instructions based on the first load and the CPU's highest frequency; and predicts the second duration of the GPU executing the above rendering instructions based on the second load and the GPU's highest frequency. The first duration is compared with the CPU's remaining time to obtain a first comparison result; and the second duration is compared with the time pre-allocated to the GPU to obtain a second comparison result. Finally, the electronic device determines the first target frequency of the CPU based on the first comparison result, the second comparison result, and the first load, so that the CPU can use the first target frequency of the CPU to generate rendering instructions for the current image frame. This allows for the prediction of the CPU and GPU load in the frame drawing task, and the adjustment of the CPU frequency based on the predicted CPU load and GPU load, thereby ensuring that the frame drawing task can be completed in a timely manner without frame loss, providing users with a smooth user experience.

[0006] In one possible implementation, the historical load of the GPU is associated with one or more of the following: the average GPU load over N historical frames, the variance of the GPU load over N historical frames, and the GPU load over M historical frames; where N and M are integers, and N > M > 0.

[0007] In one possible implementation, determining the first target frequency of the CPU based on the first comparison result, the second comparison result, and the first load includes: determining the target duration of the CPU based on the first comparison result and the second comparison result; and determining the first target frequency of the CPU based on the first load and the target duration of the CPU.

[0008] In one possible implementation, determining the target duration of the CPU based on the first comparison result and the second comparison result includes: if the first comparison result indicates that the first duration is greater than the remaining duration of the CPU, and the second comparison result indicates that the second duration is less than the duration pre-allocated to the GPU, then the target duration of the CPU is determined to be the first duration.

[0009] In one possible implementation, determining the target duration of the CPU based on the first comparison result and the second comparison result includes: if the first comparison result indicates that the first duration is less than the remaining duration of the CPU, and the second comparison result indicates that the second duration is greater than the duration pre-allocated to the GPU, then a first difference between the second duration and the pre-allocated duration to the GPU is calculated, and a second difference between the remaining duration of the CPU and the first duration is calculated; if the second difference is greater than or equal to the first difference, then the target duration of the CPU is determined to be a third duration after subtracting the first difference from the remaining duration of the CPU; if the second difference is less than the first difference, then the target duration of the CPU is determined to be the first duration.

[0010] In one possible implementation, determining the target duration of the CPU based on the first comparison result and the second comparison result includes: if the first comparison result indicates that the first duration is less than or equal to the remaining duration of the CPU, and the second comparison result indicates that the second duration is less than or equal to the duration pre-allocated to the GPU, then the target duration of the CPU is determined to be the remaining duration of the CPU.

[0011] In one possible implementation, determining the target duration of the CPU based on the first comparison result and the second comparison result includes: if the first comparison result is that the first duration is greater than the remaining duration of the CPU, and the second comparison result is that the second duration is greater than the duration pre-allocated to the GPU, then the target duration of the CPU is determined to be the remaining duration of the CPU; and the target frequency of the CPU is the highest frequency of the CPU.

[0012] In one possible implementation, after the CPU generates the rendering instruction for the current image frame using the CPU's first target frequency, the method further includes: obtaining the sum of the time taken by the CPU to determine the number of renderings and the blur area, and the time taken to generate the rendering instruction, wherein the sum of the times is a fourth time; determining the target time of the GPU based on the fourth time and the time interval between the start time of the current image frame and the time when the current image frame is displayed on the screen; and determining the target frequency of the GPU based on the target time of the GPU and the second load, so that the GPU can use the target frequency of the GPU to execute the rendering instruction.

[0013] In one possible implementation, before determining the number of renderings and the blurred area of ​​the current image frame by the CPU, the method further includes: predicting a third load for the CPU to determine the number of renderings and the blurred area of ​​the current image frame based on the initial node type and initial rendering type of the content to be rendered in the current image frame; and obtaining the historical average load of the CPU based on the CPU load of historical P frames; where P is an integer, P>1; obtaining the larger load between the third load and the historical average load of the CPU; and determining a second target frequency point of the CPU based on the larger load and the pre-allocated time for determining the number of renderings and the blurred area; the step of determining the number of renderings and the blurred area of ​​the current image frame by the CPU includes: the CPU using the second target frequency point of the CPU to determine the number of renderings and the blurred area of ​​the current image frame.

[0014] Secondly, embodiments of this application provide an electronic device, including: one or more processors; a memory; multiple application programs; and one or more computer programs, wherein the one or more computer programs are stored in the memory, and the one or more computer programs include instructions that, when executed by the electronic device, cause the electronic device to perform the method provided in the first aspect.

[0015] It should be understood that the second aspect of the embodiments of this application is consistent with the technical solution of the first aspect of the embodiments of this application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation are similar, and will not be described again.

[0016] Thirdly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when run on a computer, causes the computer to perform the method provided in the first aspect.

[0017] Fourthly, embodiments of this application provide a computer program that, when executed by a computer, performs the method provided in the first aspect.

[0018] In one possible design, the program in the fourth aspect can be stored wholly or partially on a storage medium packaged with the processor, or it can be stored wholly or partially on a memory not packaged with the processor. Attached Figure Description

[0019] Figure 1 This is a schematic diagram illustrating the execution of a drawing task provided in existing related technologies;

[0020] Figure 2 This is a schematic diagram of the structure of an electronic device provided in one embodiment of this application;

[0021] Figure 3 A flowchart of a frequency adjustment method provided in one embodiment of this application;

[0022] Figure 4 A schematic diagram of a tree structure of content to be rendered provided in one embodiment of this application;

[0023] Figure 5 This is a schematic diagram illustrating the execution of a drawing task according to an embodiment of this application;

[0024] Figure 6 A schematic diagram illustrating the execution of a frequency adjustment method provided in one embodiment of this application;

[0025] Figure 7 A flowchart of a frequency adjustment method provided in another embodiment of this application;

[0026] Figure 8 A schematic diagram illustrating the determination of GPU frequency points according to one embodiment of this application;

[0027] Figure 9 A flowchart of a frequency adjustment method provided in another embodiment of this application;

[0028] Figure 10 A schematic diagram illustrating the execution of a drawing task provided in another embodiment of this application;

[0029] Figure 11 A schematic diagram illustrating the execution of a drawing task provided in another embodiment of this application;

[0030] Figure 12 A schematic diagram of the structure of an electronic device provided in another embodiment of this application. Detailed Implementation

[0031] The terminology used in the implementation section of this application is for the purpose of explaining specific embodiments of this application only, and is not intended to limit this application.

[0032] For frame rendering tasks, the CPU typically performs calculations first, followed by the GPU generating the image from the CPU's results. However, existing scheduling methods predict CPU and GPU loads relatively independently. For rendering a specific image frame, there's no correlation between tasks executed by the CPU itself, or between tasks executed by the CPU and GPU. The CPU and GPU are unaware of each other's scheduling targets. Therefore, electronic devices can only adjust the CPU and GPU frequencies separately based on hardware usage. Furthermore, because there's no correlation between tasks, execution time cannot be allocated reasonably under uneven load conditions. Consequently, when electronic devices encounter sudden load spikes during frame rendering tasks, they cannot adjust the CPU and GPU frequencies in time, causing frame rendering tasks to fail to complete promptly and resulting in a stuttering and unresponsive user experience.

[0033] Specifically, see Figure 1 , Figure 1 This is a schematic diagram illustrating the execution of a drawing task provided in existing related technologies. Figure 1 In this system, both the main thread and the rendering thread execute on the CPU. The main thread can also be called the UI thread. In the main thread, the CPU determines the number of renders and the blur area corresponding to the image frame to be drawn in the current frame. In the rendering thread, the CPU generates rendering instructions based on the number of renders and the blur area determined by the main thread. Then, the GPU executes the rendering instructions to obtain the image of the current frame. The compositing thread combines the image of the current frame rendered by the GPU with the image of the previous frame rendered to obtain the image frame to be displayed. Finally, the image frame to be displayed is sent to the display screen of the electronic device for display. Figure 1 The rectangles in the text represent the execution time of the task in each thread.

[0034] from Figure 1 As can be seen, there is no correlation between the tasks executed by the CPU's main thread and rendering thread, nor between the tasks executed by the CPU and GPU. Therefore, when determining the CPU and GPU frequencies, they must be determined separately based on their respective loads and scheduling goals. For example, see... Figure 1The tasks pre-allocated to the main thread and rendering thread have the same execution time. However, because the main thread has a lighter load, the CPU frequency is lower during its execution. After the main thread finishes, when the rendering thread starts, the CPU still uses a lower frequency, but the rendering thread's load is higher than the main thread's. Thus, after executing part of the rendering thread's tasks, the CPU might find that continuing to use a lower frequency would prevent the rendering thread from completing its tasks within the pre-allocated execution time. Therefore, the CPU will increase its frequency and use the higher frequency to execute the remaining tasks. This leads to the following problems: First, uneven CPU load, for example, the CPU sometimes runs at a low frequency and sometimes at a high frequency, which increases CPU power consumption. Second, even when using a higher frequency, the rendering thread's tasks may still not be completed within the pre-allocated execution time, resulting in dropped frames and a stuttering, unsmooth user experience.

[0035] To address the above issues, this application provides a frequency adjustment method that allows tasks in the rendering pipeline of an electronic device to perceive and coordinate with the scheduling target within a single rendering frame. Simultaneously, during the execution of a single rendering task, the electronic device continuously accumulates information for that frame. The longer the execution time, the clearer the load of subsequent tasks becomes. Therefore, the load of subsequent tasks can be predicted in advance based on the execution of previous tasks, thereby anticipating sudden load spikes and enabling advance scheduling, thus improving the user experience. It should be noted that the scheduling target mentioned in this application can be understood as the pre-allocated task execution time for the CPU and GPU during the execution of a single rendering task.

[0036] The frequency adjustment method provided in this application can be applied to electronic devices, which may be smartphones, tablets, wearable devices, in-vehicle devices, augmented reality (AR) / virtual reality (VR) devices, laptops, ultra-mobile personal computers (UMPCs), netbooks, or personal digital assistants (PDAs), etc. This application does not impose any restrictions on the specific type of electronic device.

[0037] For example, Figure 2 This is a schematic diagram of the structure of an electronic device provided in one embodiment of this application, as shown below. Figure 2As shown, the electronic device 100 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, a headphone jack 170D, a sensor module 180, buttons 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, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer sensor 180E, a distance sensor 180F, a proximity 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.

[0038] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0039] Processor 110 may include one or more processing units, such as application processors (APs), modem processors, graphics processing units (GPUs), image signal processors (ISPs), controllers, video codecs, digital signal processors (DSPs), baseband processors, and / or neural network processing units (NPUs). These different processing units may be independent devices or integrated into one or more processors.

[0040] The controller can generate operation control signals based on the instruction opcode and timing signals to complete the control of instruction fetching and execution.

[0041] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0042] In some embodiments, the processor 110 may include one or more interfaces. Interfaces 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.

[0043] It is understood that the interface connection relationships between the modules illustrated in the embodiments of this application are merely illustrative and do not constitute a structural limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may also employ different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.

[0044] Electronic device 100 implements display functions through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.

[0045] Display screen 194 is used to display images, videos, etc. Display screen 194 includes a display panel. The display panel may be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a Mini LED, a MicroLED, a Micro-OLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, electronic device 100 may include one or N displays 194, where N is a positive integer greater than 1.

[0046] The software system of electronic device 100 can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This application embodiment takes a layered architecture system as an example.

[0047] For ease of understanding, the following embodiments of this application will be described using the following methods: Figure 2 Taking the electronic device with the structure shown as an example, the frequency adjustment method provided in the embodiments of this application will be specifically described in conjunction with the accompanying drawings and application scenarios.

[0048] Figure 3 A flowchart of a frequency adjustment method provided in one embodiment of this application is shown below. Figure 3 As shown, the frequency adjustment method described above may include:

[0049] Step 301: Electronic device 100 acquires the current image frame to be drawn.

[0050] In some examples, the electronic device 100 may acquire the current image frame to be drawn in response to a user's operation on the target application. This user operation may include clicking the target application's icon or performing an operation on the target application's interface after the application has run. Clicking the target application's icon is used to launch the target application. Of course, user operations on the target application may include other operations, which are not limited in this embodiment. It is understood that after a user operates on the target application, the target application needs to display a corresponding interface. Therefore, after detecting a user's operation on the target application, the electronic device 100 can acquire the current image frame to be drawn in response to the operation.

[0051] In other examples, the electronic device 100 may acquire the current image frame to be drawn during the operation of the target application. For example, assuming the target application is a video playback application, the electronic device 100 acquires the current image frame to be drawn during the video playback process.

[0052] The above are just two examples of how the electronic device 100 acquires the current image frame to be drawn. This embodiment is not limited to these two examples. This embodiment does not limit the way the electronic device 100 acquires the current image frame to be drawn.

[0053] Step 302: Electronic device 100 determines the number of renderings and the blur area of ​​the current image frame through the CPU.

[0054] Specifically, the electronic device 100 can determine the number of renderings for the current image frame by means of the CPU: the CPU determines the number of renderings for the current image frame based on the number of nodes, node type, and rendering type of the content to be rendered in the current image frame.

[0055] See in some examples Figure 4 The content to be rendered in an image frame can be stored in a tree structure, also known as a rendering tree. Therefore, the number of images to be rendered in the current frame can be determined based on the number of nodes, node types, and rendering type. The node types mentioned above can include leaf nodes and container nodes. Figure 4 In the diagram, node 41 is a leaf node, and node 42 is a container node. The leaf node stores the content to be rendered in the image frame and its attributes. For example, the content to be rendered could be an image and / or text, and its attributes could include whether the image has a shadow and / or rounded corners, etc. The container node stores the width and height of the page displaying the image frame. The rendering type is the type of content to be rendered stored in the leaf node, for example, whether the content is an image or text. Figure 4 This is a schematic diagram of a tree structure of the content to be rendered provided in one embodiment of this application.

[0056] See also Figure 5 For the task of drawing a single image frame, the CPU executes two threads: the main thread and the rendering thread. After obtaining the current image frame to be drawn, the main thread starts. During the execution of the main thread, the CPU will perform some pruning on the tree structure of the content to be rendered in the current image frame, deleting some nodes. In this way, after the main thread finishes execution, the tree structure of the content to be rendered in the current image frame is fixed and will not change. Finally, the CPU can determine the number of renderings and the blur area of ​​the current image frame based on the pruned tree structure. Figure 5This is a schematic diagram illustrating the execution of a drawing task according to an embodiment of this application.

[0057] In this step, the blurred area of ​​the current image frame can be the area of ​​the part of the current image frame that has changed relative to the previous image frame. Therefore, the CPU in the electronic device 100 can compare the current image frame with the previous image frame to determine the blurred area of ​​the current image frame.

[0058] In step 303, the electronic device 100 predicts the first load of the CPU generating rendering instructions for the current image frame based on the number of renderings and the blur area of ​​the current image frame; and predicts the second load of the GPU executing the above rendering instructions based on the GPU load prediction parameters.

[0059] The rendering instructions for the current image frame are generated based on the aforementioned rendering quantity and the aforementioned blur area. The GPU load prediction parameters may include: the historical GPU load, the aforementioned rendering quantity, and the aforementioned blur area. In some examples, the historical GPU load may include: the average GPU load of N historical frames, the GPU load variance of N historical frames, and the GPU load of M historical frames; where N and M are integers, N>M>0; in this embodiment, the sizes of N and M can be set by the specific implementation, and this embodiment does not limit the sizes of N and M. For example, N can be 5 and M can be 1.

[0060] Figure 6 This is a schematic diagram illustrating the execution of a frequency adjustment method provided in one embodiment of this application. See also: Figure 6 In step 302, the CPU's main thread starts. In the main thread, the CPU determines the number of renderings and the blur area of ​​the current image frame. Then, in step 303, the CPU can predict the first load of the rendering instructions for the current image frame based on the number of renderings and the blur area of ​​the current image frame.

[0061] In other words, such as Figure 5 As shown in Figure 51, after the main thread finishes execution, the number of renderings and the blurred area of ​​the current image frame are passed to the rendering thread. Before the rendering thread is executed, the CPU can predict the CPU load on the rendering thread based on the number of renderings and the blurred area obtained by the main thread, thus realizing the association between the tasks executed by the CPU. At this time, the CPU can also predict the second load of the GPU executing the above rendering instructions based on the GPU load prediction parameters. The GPU load prediction parameters include the above-mentioned number of renderings and the blurred area, thereby realizing the association between the tasks executed by the CPU and the tasks executed by the GPU. The load of the subsequent tasks can be predicted in advance as the previous tasks are executed. In this way, the situation of sudden load can be predicted, and scheduling can be carried out in advance, thus improving the user's operating experience.

[0062] In step 304, the electronic device 100 predicts the first duration for the CPU to generate the rendering instructions based on the first load and the highest frequency of the CPU; and predicts the second duration for the GPU to execute the rendering instructions based on the second load and the highest frequency of the GPU.

[0063] In this embodiment, after predicting the first load, the first duration can be predicted according to the first load and the highest frequency of the CPU, in accordance with equation (1).

[0064]

[0065] In equation (1), the coefficients can be pre-configured parameters.

[0066] Similarly, based on the second load and the highest frequency of the GPU, the second duration can also be predicted according to equation (1). It is conceivable that the first duration is the predicted shortest duration for the CPU to generate rendering instructions, and the second duration is the predicted shortest duration for the GPU to execute rendering instructions.

[0067] Step 305: Electronic device 100 compares the first duration with the remaining duration of the CPU to obtain a first comparison result; and compares the second duration with the duration pre-allocated to the GPU to obtain a second comparison result.

[0068] The remaining CPU time includes the time pre-allocated to the CPU minus the time used to determine the number of renders and the blur area. Specifically, as shown... Figure 5 As shown in Figure 51, after the main thread finishes execution, the rendering thread can not only obtain the number of rendered images and the blurred area of ​​the current image frame, but also the time taken for the CPU to execute the main thread. Thus, the remaining time after subtracting the time taken for the CPU to execute the main thread from the time pre-allocated to the CPU is the available time for the CPU to execute the rendering thread, which is the remaining time of the CPU mentioned above.

[0069] In this embodiment, regarding the time allocated to the CPU and the time allocated to the GPU, in specific implementation, the electronic device 100 can pre-allocate the time corresponding to the time interval between the start of drawing an image frame and the time of displaying it on the screen based on the ratio of the workload of the CPU tasks to the workload of the GPU tasks in the drawing task of an image frame. The ratio of the workload of the CPU tasks to the workload of the GPU tasks in the drawing task of an image frame can be determined based on empirical values. For example, in the drawing task of an image frame, the CPU's workload for executing the main thread accounts for 25% of the average CPU workload, the CPU's workload for executing the rendering thread accounts for 70% of the average CPU workload, and the GPU's workload for executing rendering instructions accounts for 5% of the average CPU workload. If the time interval between the start of drawing an image frame and the time of displaying it on the screen can be 15ms, then the time allocated to the CPU can be 10ms, and the time allocated to the GPU can be 5ms.

[0070] In step 306, the electronic device 100 determines the first target frequency point of the CPU based on the first comparison result and the second comparison result, as well as the first load, so that the CPU can use the first target frequency point of the CPU to generate rendering instructions for the current image frame.

[0071] See also Figure 6 After predicting the first load and the second load in step 303, the electronic device 100 determines the first target frequency of the CPU in step 306. The CPU then adjusts its frequency to the first target frequency, so that the CPU uses the first target frequency when executing the rendering thread.

[0072] Specifically, the electronic device 100 determines the first target frequency of the CPU based on the first comparison result, the second comparison result, and the first load by: determining the target duration of the CPU based on the first comparison result and the second comparison result, and then determining the first target frequency of the CPU based on the first load and the target duration of the CPU. In specific implementation, after determining the target duration of the CPU, the electronic device 100 can determine the first target frequency of the CPU according to equation (1) based on the first load and the target duration of the CPU.

[0073] In one implementation, the electronic device 100 determines the target duration of the CPU based on a first comparison result and a second comparison result as follows: if the first comparison result is that the first duration is greater than the remaining duration of the CPU, and the second comparison result is that the second duration is less than the duration pre-allocated to the GPU, then the target duration of the CPU is determined to be the first duration.

[0074] In this implementation, the first duration is greater than the CPU's remaining time, indicating that even if the CPU increases its frequency to its maximum, it cannot complete the rendering thread's task within the remaining CPU time. The second duration is less than the time pre-allocated to the GPU, meaning that if the GPU executes rendering instructions at its maximum frequency, there is remaining time pre-allocated to the GPU. Therefore, the CPU can preempt the pre-allocated GPU time. In other words, the CPU's target duration is defined as the first duration, which includes the CPU's remaining time and the time preempted from the pre-allocated GPU time. It's conceivable that the amount of time preempted from the pre-allocated GPU time is the third difference between the first duration and the CPU's remaining time. Thus, the expected time for the GPU to execute rendering instructions becomes the second duration minus the remaining time corresponding to the third difference.

[0075] In this implementation, the target duration of the CPU is the first duration. Therefore, according to equation (1), the first target frequency point can be determined as the highest frequency point of the CPU. Thus, the CPU uses the highest frequency point of the CPU to generate the rendering instruction of the current image frame. This achieves the goal of increasing the CPU frequency point when the predicted execution duration is higher than the pre-allocated execution duration, ensuring that the frame drawing task can be completed in a timely manner.

[0076] In another implementation, the electronic device 100 determines the target duration of the CPU based on the first comparison result and the second comparison result as follows: if the first comparison result is that the first duration is less than the remaining duration of the CPU, and the second comparison result is that the second duration is greater than the duration pre-allocated to the GPU, then a first difference between the second duration and the duration pre-allocated to the GPU is calculated, and a second difference between the remaining duration of the CPU and the first duration is calculated; if the second difference is greater than or equal to the first difference, then the target duration of the CPU is determined to be the third duration after subtracting the first difference from the remaining duration of the CPU; if the second difference is less than the first difference, then the target duration of the CPU is determined to be the first duration.

[0077] In this implementation, the first duration is less than the remaining duration of the CPU, indicating that if the CPU raises its frequency to its highest frequency, the rendering thread can complete its task within the remaining CPU duration. The second duration is greater than the duration pre-allocated to the GPU, indicating that even if the GPU executes the rendering instructions at its highest frequency, it cannot complete the above rendering instructions within the pre-allocated GPU duration. Therefore, the GPU can preempt some duration from the remaining CPU duration. Thus, the first difference and the second difference need to be calculated first. If the second difference is greater than or equal to the first difference, it means that the remaining CPU duration, excluding the first duration, can meet the GPU's needs. Therefore, the GPU can preempt the duration corresponding to the first difference from the remaining CPU duration. The target duration of the CPU can be determined as the third duration after subtracting the first difference from the remaining CPU duration. Then, the CPU can determine the first target frequency of the CPU according to the first load and the third duration, according to formula (1). This allows the CPU to determine a suitable frequency while ensuring that the tasks of both the CPU and the GPU can be completed on time, thereby saving power consumption as much as possible.

[0078] If the second difference is less than the first difference, it means that the remaining CPU time, excluding the first time, cannot fully meet the GPU's needs. Therefore, it is necessary to first meet the time required for the CPU to generate rendering instructions, determine the CPU's target time as the first time, and then allocate the remaining CPU time, excluding the first time, to the GPU. In this case, the CPU's target time is the first time, so according to equation (1), the first target frequency point can be determined as the CPU's highest frequency point. Thus, the CPU can use the CPU's highest frequency point to generate the rendering instructions for the current image frame, complete the rendering thread in the shortest possible time, and then allocate the remaining CPU time, excluding the first time, to the GPU. This allows the GPU to have more execution time, ensuring that the frame drawing task can be completed in a timely manner.

[0079] In another implementation, the electronic device 100 determines the target duration of the CPU based on the first comparison result and the second comparison result as follows: if the first comparison result is that the first duration is less than or equal to the remaining duration of the CPU, and the second comparison result is that the second duration is less than or equal to the duration pre-allocated to the GPU, then the target duration of the CPU is determined to be the remaining duration of the CPU.

[0080] In this implementation, the first duration is less than or equal to the remaining CPU time, indicating that if the CPU raises its frequency to its highest frequency, the rendering thread's task can be completed within the CPU's remaining time. The second duration is less than or equal to the time pre-allocated to the GPU, indicating that if the GPU executes the rendering instructions at its highest frequency, it can also complete the aforementioned rendering instructions within the pre-allocated GPU time. Therefore, the CPU's target duration can be determined as the CPU's remaining time. Then, based on the CPU's remaining time and the first load, the CPU's first target frequency is determined according to equation (1). At this time, the first target frequency is less than or equal to the CPU's highest frequency, meaning that the CPU can use a lower frequency to generate rendering instructions, thereby saving power consumption.

[0081] In another implementation, the electronic device 100 determines the target duration of the CPU based on the first comparison result and the second comparison result as follows: if the first comparison result is that the first duration is greater than the remaining duration of the CPU, and the second comparison result is that the second duration is greater than the duration pre-allocated to the GPU, then the target duration of the CPU is determined to be the remaining duration of the CPU; in this case, the target frequency of the CPU is the highest frequency of the CPU.

[0082] In this implementation, the first duration is greater than the remaining CPU time, indicating that even if the CPU raises its frequency to its highest point, it cannot complete the rendering thread's task within the CPU's remaining time. The second duration is also greater than the time pre-allocated to the GPU, indicating that even if the GPU executes the rendering instructions at its highest frequency, it cannot complete the rendering instructions within the pre-allocated GPU time. In this case, the CPU and GPU do not compete for each other's time and both execute the task at their own highest frequency, thereby minimizing the time required to draw the current image frame.

[0083] In the above frequency adjustment method, the electronic device 100 acquires the current image frame to be drawn, determines the number of renderings and the blur area of ​​the current image frame through the CPU, and then predicts the first load of the CPU to generate the rendering instructions for the current image frame based on the number of renderings and the blur area of ​​the current image frame; and predicts the second load of the GPU to execute the above rendering instructions based on the GPU load prediction parameters. Next, the electronic device 100 predicts the first duration for the CPU to generate the rendering instructions based on the first load and the CPU's highest frequency; and predicts the second duration for the GPU to execute the rendering instructions based on the second load and the GPU's highest frequency. It compares the first duration with the CPU's remaining time to obtain a first comparison result; and compares the second duration with the time pre-allocated to the GPU to obtain a second comparison result. Finally, the electronic device 100 determines the CPU's first target frequency based on the first and second comparison results and the first load, so that the CPU can use the CPU's first target frequency to generate the rendering instructions for the current image frame. This allows for the prediction of the CPU and GPU loads in the frame-drawing task, and the adjustment of the CPU's frequency based on the predicted CPU and GPU loads, ensuring that the frame-drawing task is completed promptly without frame drops, providing a smooth user experience.

[0084] Figure 7 A flowchart of a frequency adjustment method provided in another embodiment of this application is shown below. Figure 7 As shown, this application Figure 3 In the illustrated embodiment, after step 306, the following may also be included:

[0085] Step 701: Electronic device 100 obtains the sum of the time taken by the CPU to determine the above-mentioned rendering quantity and blur area, and the time taken to generate the above-mentioned rendering instructions. The sum of the above-mentioned times is the fourth time.

[0086] In this step, the fourth duration is the sum of the actual time taken by the CPU to execute the main thread and the actual time taken to execute the rendering thread. For example... Figure 5 Zhong 52 and Figure 6 As shown, after the CPU finishes executing the main thread and the rendering thread, the GPU can obtain the actual time taken by the CPU to execute the main thread and the rendering thread.

[0087] Step 702: The electronic device 100 determines the target duration of the GPU based on the fourth duration mentioned above and the time interval between the start time of drawing the current image frame and the time when the current image frame is displayed on the screen.

[0088] Specifically, the target duration of the GPU can be the time interval between the start of drawing the current image frame and the time when the current image frame is displayed on the screen, minus the difference of the fourth duration mentioned above.

[0089] Step 703: Electronic device 100 determines the target frequency of the GPU based on the target duration and second load of the GPU, so that the GPU can use the target frequency of the GPU to execute the above rendering instructions.

[0090] See Figure 6 After determining the target duration of the GPU, the GPU can determine the target frequency of the GPU according to the target duration of the GPU and the second load predicted in step 303, according to formula (1). Then the GPU can use the target frequency of the GPU to execute the above rendering instructions. Then the rendering obtained image can be combined with the image of the previous image frame in the compositing thread to obtain the current image frame to be displayed. After that, the current image frame to be displayed can be displayed on the screen.

[0091] Figure 8 This is a schematic diagram illustrating the determination of GPU frequency points according to one embodiment of this application, as shown below. Figure 8 As shown, after acquiring the current image frame to be drawn, the CPU starts the main thread, creates a cache for the current image frame in the main thread, and determines the blur area and rendering count of the current image frame. Then, the blur area and rendering count are passed to the hint information. The hint information then obtains the average GPU load of the past 5 frames, the variance of the past 5 frames, and the GPU load of the past 1 frame from the GPU's historical load data. This information, along with the average GPU load of the past 5 frames, the variance of the past 5 frames, the GPU load of the past 1 frame, the blur area, and the rendering count, is then sent to the prediction load module. The prediction load module predicts the second load of the GPU based on the average GPU load of the past 5 frames, the variance of the past 5 frames, the GPU load of the past 1 frame, the blur area, and the rendering count. Furthermore, after the CPU finishes executing the rendering thread, the GPU can obtain the actual time taken by the CPU to execute the main thread and the rendering thread, as well as the time interval between the start time of drawing the current image frame and the time when the current image frame is displayed on the screen. Based on the above time interval and the actual time taken, the GPU's target duration is determined. Specifically, the GPU's target duration is the difference between the above time interval and the above actual time taken.

[0092] Finally, the GPU determines the target frequency point of the GPU according to the second load and the target duration of the GPU, according to Equation (1). After adjusting the frequency point of the GPU to the target frequency point of the GPU, the target frequency point of the GPU is sent to the GPU driver. The GPU driver determines the GPU clock cycle (GPU cycle) according to the target frequency point of the GPU.

[0093] In this embodiment, the electronic device 100 can determine the target duration of the GPU based on the actual execution time of the CPU and the time interval between the start time of drawing the current image frame and the time when the current image frame is displayed on the screen. Finally, based on the target duration of the GPU and the second load, the target frequency of the GPU is determined. In this way, the GPU can use the target frequency of the GPU to execute rendering instructions, thereby associating the tasks executed by the CPU with the tasks executed by the GPU. Adjusting the frequency of the GPU based on the actual execution time of the CPU can ensure that the drawing task of the current image frame is completed in a timely manner, providing users with a smooth user experience, while also saving power consumption.

[0094] Figure 9 A flowchart of a frequency adjustment method provided in another embodiment of this application is shown below. Figure 9 As shown, this application Figure 3 In the illustrated embodiment, before step 302, the following may also be included:

[0095] Step 901: Electronic device 100 predicts the third load of the CPU to determine the number of renderings and the blur area of ​​the current image frame based on the initial node type and initial rendering type of the content to be rendered in the current image frame; and obtains the historical average load of the CPU based on the CPU load of historical P frames.

[0096] Where P is an integer, P>1; in specific implementation, the size of P can be set by itself. In this embodiment, the size of P is not limited. For example, P can be 3.

[0097] Step 902, the electronic device 100 obtains the larger of the third load and the historical average load of the CPU mentioned above.

[0098] Step 903: Electronic device 100 determines the second target frequency of the CPU based on the larger load and the pre-allocated time for determining the above-mentioned rendering quantity and the above-mentioned blur area.

[0099] Thus, step 302 can be:

[0100] Step 904: The CPU uses the second target frequency of the CPU to determine the number of images to be rendered and the blur area of ​​the current image frame.

[0101] In this embodiment, after acquiring the current image frame to be drawn, the electronic device 100 starts the main thread, such as... Figure 4As shown, the content to be rendered in the current image frame is stored in a tree structure. Therefore, firstly, the CPU can predict the third load of the main thread based on the initial node type and the initial rendering type to determine the number of renderings and the blur area of ​​the current image frame. In addition, the CPU can also obtain the historical average load of the CPU based on the CPU load of the past 3 frames. Then, the CPU compares the third load and the historical average load of the CPU and takes the larger load. Finally, the CPU determines the second target frequency point of the CPU according to Equation (1) based on the larger load between the third load and the historical average load of the CPU, and the time pre-allocated to the main thread. After that, the CPU uses the above second target frequency point to execute the main thread and determine the number of renderings and the blur area of ​​the current image frame.

[0102] In this embodiment, before executing the main thread, the CPU can predict the third load of the main thread and obtain the historical average load of the CPU. Then, by using the larger of the two loads and the time pre-allocated to the main thread, the CPU's second target frequency point is determined. The CPU then uses the second target frequency point to execute the main thread, thereby determining a suitable frequency point for the CPU to execute the main thread and saving CPU power consumption.

[0103] The frequency adjustment method provided in this application will be illustrated below through two specific examples.

[0104] The system pre-sets the main thread's load to account for 25% of the average CPU load, the rendering thread's load to account for 70% of the average CPU load, and the GPU's load to account for 5% of the average CPU load. For a single image frame rendering task, execution begins after receiving the vertical synchronization (VSYNC) signal and takes 19.9ms to complete (system setting).

[0105] The following assumes that the time interval between the start of drawing an image frame and the time it is displayed on the screen is 15ms. The time allocated to the CPU and GPU is pre-allocated according to the CPU and GPU load relationship. The time allocated to the CPU is 10ms and the time allocated to the GPU is 5ms.

[0106] In one example, first, the CPU follows... Figure 9 The method provided in the illustrated embodiment determines a second target frequency point. Then, the CPU uses the aforementioned second target frequency point to execute the main thread, determining the number of images to be rendered and the blur area of ​​the current image frame, such as... Figure 10 As shown in the example, the CPU takes 5ms to execute the main thread. Figure 10 This is a schematic diagram illustrating the execution of a drawing task provided in another embodiment of this application.

[0107] like Figure 10 As shown in Figure 1001, after the CPU finishes executing the main thread and before executing the rendering thread, the CPU can obtain the duration of the main thread's execution. Then, the CPU executes... Figure 3 In steps 303-305 of the illustrated embodiment, in step 306, the CPU finds that the first comparison result is that the first duration is greater than the CPU's remaining duration (in this example: 10ms - 5ms = 5ms), and the second comparison result is that the second duration is less than the duration pre-allocated to the GPU. Specifically, the first duration being greater than the CPU's remaining duration indicates that the CPU load is bursty, and even if the CPU raises its frequency to its highest point, it cannot complete the rendering thread's task within the CPU's remaining duration. The second duration being less than the duration pre-allocated to the GPU indicates that if the GPU executes the rendering instructions at its highest frequency, there is remaining time pre-allocated to the GPU. Therefore, the CPU can preempt the time pre-allocated to the GPU. Here, it is assumed that the CPU preempts 3ms of the GPU's time, and the CPU's target duration is the CPU's remaining duration plus 3ms, i.e., 8ms.

[0108] Then, based on the 8ms duration and the initial load, the CPU determines its first target frequency according to equation (1), and uses this first target frequency to execute the rendering thread, generating the rendering instructions for the current image frame. In this example, as shown... Figure 10 As shown, the actual time taken by the CPU to execute the rendering thread is 7ms. That is to say, although the expected time for the CPU to execute the rendering thread is 8ms, the CPU actually only takes 7ms to execute the rendering thread. Thus, the sum of the actual time taken by the CPU to execute the main thread and the rendering thread is 5ms + 7ms = 12ms.

[0109] Next, as Figure 10 As shown in Figure 1002, before the GPU executes the rendering instructions, the GPU can obtain the sum of the actual time taken by the CPU to execute the main thread and the rendering thread, which is 12ms in this example. The time interval between the start of drawing the current image frame and the time when the current image frame is displayed is 15ms. Therefore, the target duration of the GPU can be determined to be 15ms - 12ms = 3ms. Then, the GPU can determine the target frequency point of the GPU according to the 3ms duration and the second load, according to Equation (1). Finally, the GPU uses the target frequency point of the GPU to execute the above rendering instructions, and then the rendered image can be combined with the image of the previous image frame in the compositing thread to obtain the current image frame to be displayed. After that, the current image frame to be displayed can be displayed on the screen.

[0110] In another example, first, the CPU follows Figure 9The method provided in the illustrated embodiment determines a second target frequency point. Then, the CPU uses the aforementioned second target frequency point to execute the main thread, determining the number of images to be rendered and the blur area of ​​the current image frame, such as... Figure 11 As shown in the example, the CPU takes 5ms to execute the main thread. Figure 11 This is a schematic diagram illustrating the execution of a drawing task provided in another embodiment of this application.

[0111] Next, before executing the rendering thread, such as Figure 11 As shown in Figure 1101, the CPU can obtain the execution time of the main thread, and then the CPU executes... Figure 3 In steps 303-305 of the illustrated embodiment, in step 306, the CPU finds that the first comparison result is that the first duration is less than the CPU's remaining duration (in this example: 10ms - 5ms = 5ms), and the second comparison result is that the second duration is greater than the duration pre-allocated to the GPU. Specifically, the first duration being less than the CPU's remaining duration means that if the CPU increases its frequency to its highest frequency, it can complete the rendering thread's task within the CPU's remaining duration. The second duration being greater than the duration pre-allocated to the GPU means that even if the GPU executes the rendering instructions at its highest frequency, it cannot complete the aforementioned rendering instructions within the pre-allocated duration. Therefore, it is necessary to increase the CPU's frequency for executing the rendering thread and shorten the CPU's execution duration for the rendering thread to allow the GPU a longer execution time. In other words, the GPU needs to preempt the duration pre-allocated to the CPU.

[0112] Here, we assume that the first difference between the second duration and the duration pre-allocated to the GPU is 2ms, and the second difference between the CPU's remaining duration and the first duration is 3ms. Thus, 2ms of the CPU's remaining duration can be reserved for the GPU, determining the CPU's target duration as 5ms – 2ms = 3ms. Then, based on the first load and the third duration, the CPU can determine its first target frequency according to equation (1), and use this first target frequency to execute the rendering thread, generating rendering instructions for the current image frame. This allows for the determination of a suitable frequency for the CPU while ensuring that both the CPU and GPU tasks are completed on time, thereby saving power as much as possible.

[0113] In this example, as Figure 11 As shown, the actual time taken by the CPU to execute the rendering thread is 3ms. Therefore, the sum of the actual time taken by the CPU to execute the main thread and the rendering thread is 5ms + 3ms = 8ms.

[0114] Next, as Figure 11As shown in Figure 1102, before the GPU executes the rendering instructions, the GPU can obtain the sum of the actual time taken by the CPU to execute the main thread and the rendering thread, which is 8ms in this example. The time interval between the start of drawing the current image frame and the time when the current image frame is displayed is 15ms. Therefore, the target duration of the GPU can be determined to be 15ms - 8ms = 7ms. Then, the GPU can determine the target frequency point of the GPU according to the 7ms duration and the second load, according to Equation (1). Finally, the GPU uses the target frequency point of the GPU to execute the above rendering instructions, and then the rendered image can be combined with the image of the previous image frame in the compositing thread to obtain the current image frame to be displayed. After that, the current image frame to be displayed can be displayed on the screen.

[0115] It is understood that some or all of the steps or operations in the above embodiments are merely examples, and other operations or variations thereof can be performed in the embodiments of this application. Furthermore, the steps may be performed in different orders as presented in the above embodiments, and it is not necessary to perform all the operations in the above embodiments.

[0116] It is understood that, in order to achieve the above-mentioned functions, electronic devices include hardware and / or software modules that perform the respective functions. Based on the algorithm steps of the examples described in conjunction with the embodiments disclosed in this application, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed by hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application in conjunction with the embodiments, but such implementation should not be considered beyond the scope of this application.

[0117] This embodiment can divide the electronic device into functional modules according to the above method embodiment. For example, each function can be divided into its own functional module, or two or more functions can be integrated into one module. The integrated module can be implemented in hardware. It should be noted that the module division in this embodiment is illustrative and only represents one logical functional division. In actual implementation, there may be other division methods.

[0118] Figure 12 This is a schematic diagram of the structure of an electronic device provided in another embodiment of this application. In the case where functional modules are divided according to their respective functions, Figure 12 A schematic diagram of a possible composition of the electronic device 1200 involved in the above embodiments is shown, such as... Figure 12 As shown, the electronic device 1200 may include: a receiving unit 1201, a processing unit 1202, and a transmitting unit 1203;

[0119] The processing unit 1202 can be used to support the electronic device 1200 in executing steps 301 to 306, steps 701 to 703, and steps 901 to 903, and / or other processes used in the technical solutions described in the embodiments of this application.

[0120] It should be noted that this application Figures 3 to 11 All relevant content of each step involved in the method embodiment can be referenced from the functional description of the corresponding functional module, and will not be repeated here.

[0121] The electronic device 1200 provided in this embodiment is used to execute this application. Figures 3 to 11 The frequency adjustment method provided in the illustrated embodiment can achieve the same effect as the method described above.

[0122] It should be understood that electronic device 1200 can correspond to Figure 2 The electronic device 100 shown. The functions of the receiving unit 1201 and the transmitting unit 1203 can be determined by… Figure 2 The processor 110, antenna 1, and mobile communication module 150 in the electronic device 100 shown are, and / or, implemented by the processor 110, antenna 2, and wireless communication module 160; the function of the processing unit 1202 can be achieved by... Figure 2 The processor 110 and touch sensor 180K in the electronic device 100 shown are implemented.

[0123] When using integrated units, the electronic device 1200 may include a processing module, a storage module, and a communication module.

[0124] The processing module can be used to control and manage the actions of the electronic device 1200. For example, it can support the electronic device 1200 in executing the steps performed by the receiving unit 1201, processing unit 1202, and sending unit 1203. The storage module can support the electronic device 1200 in storing program code and data. The communication module can support communication between the electronic device 1200 and other devices.

[0125] The processing module can be a processor or controller, which can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. The processor can also be a combination of functions that implement computing capabilities, such as a combination of one or more microprocessors, a combination of digital signal processing (DSP) and a microprocessor, etc. The storage module can be a memory. The communication module can specifically be a device that interacts with other electronic devices, such as radio frequency circuitry, a Bluetooth chip, and / or a Wi-Fi chip.

[0126] In one embodiment, when the processing module is a processor and the storage module is a memory, the electronic device 1200 involved in this embodiment can be a device having... Figure 2 The device with the structure shown.

[0127] This application also provides a computer-readable storage medium storing a computer program that, when run on a computer, causes the computer to execute this application. Figures 3 to 11 The method provided in the illustrated embodiment.

[0128] This application also provides a computer program product, which includes a computer program that, when run on a computer, causes the computer to execute this application. Figures 3 to 11 The method provided in the illustrated embodiment.

[0129] In this application embodiment, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent the existence of A alone, A and B simultaneously, or B alone. A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of singular or plural items. For example, at least one of a, b, and c can represent: a, b, c, a and b, a and c, b and c, or a and b and c, where a, b, and c can be single or multiple.

[0130] Those skilled in the art will recognize that the units and algorithm steps described in the embodiments disclosed herein can be implemented using electronic hardware, computer software, or a combination of electronic hardware and software. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0131] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0132] In the several embodiments provided in this application, any function, if implemented as a software functional unit and sold or used as an independent product, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks. The above descriptions are merely specific embodiments of this application. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the protection scope of this application. The protection scope of this application should be determined by the protection scope of the claims.

Claims

1. A frequency adjustment method, characterized in that, include: Get the current image frame to be drawn; The CPU determines the number of images rendered and the area of ​​blur in the current image frame. Based on the number of renderings and the blurred area of ​​the current image frame, a first load of CPU generating rendering instructions for the current image frame is predicted; and a second load of GPU executing the rendering instructions is predicted based on GPU load prediction parameters; wherein, the rendering instructions for the current image frame are generated based on the number of renderings and the blurred area; the GPU load prediction parameters include: the historical load of the GPU, the number of renderings, and the blurred area; Based on the first load and the highest frequency of the CPU, a first duration for the CPU to generate the rendering instructions is predicted; and based on the second load and the highest frequency of the GPU, a second duration for the GPU to execute the rendering instructions is predicted. The first duration is compared with the remaining duration of the CPU to obtain a first comparison result; and the second duration is compared with the duration pre-allocated to the GPU to obtain a second comparison result; wherein the remaining duration of the CPU includes the remaining duration after subtracting the duration used to determine the number of renders and the blur area from the duration pre-allocated to the CPU. Based on the first comparison result and the second comparison result, as well as the first load, a first target frequency point of the CPU is determined so that the CPU can use the first target frequency point of the CPU to generate rendering instructions for the current image frame.

2. The method according to claim 1, characterized in that, The historical load of the GPU is associated with one or more of the following: the average GPU load of historical N frames, the variance of the GPU load of historical N frames, and the GPU load of historical M frames; where N and M are integers, and N>M>0.

3. The method according to claim 1, characterized in that, Determining the first target frequency point of the CPU based on the first comparison result, the second comparison result, and the first load includes: The target duration of the CPU is determined based on the first comparison result and the second comparison result; The first target frequency of the CPU is determined based on the first load and the target duration of the CPU.

4. The method according to claim 3, characterized in that, Determining the target CPU duration based on the first comparison result and the second comparison result includes: If the first comparison result is that the first duration is greater than the remaining duration of the CPU, and the second comparison result is that the second duration is less than the duration pre-allocated to the GPU, then the target duration of the CPU is determined to be the first duration.

5. The method according to claim 3, characterized in that, Determining the target CPU duration based on the first comparison result and the second comparison result includes: If the first comparison result is that the first duration is less than the remaining duration of the CPU, and the second comparison result is that the second duration is greater than the duration pre-allocated to the GPU, then calculate the first difference between the second duration and the duration pre-allocated to the GPU, and calculate the second difference between the remaining duration of the CPU and the first duration. If the second difference is greater than or equal to the first difference, then the target duration of the CPU is determined to be the third duration after subtracting the first difference from the remaining duration of the CPU. If the second difference is less than the first difference, then the target duration of the CPU is determined to be the first duration.

6. The method according to claim 3, characterized in that, Determining the target CPU duration based on the first comparison result and the second comparison result includes: If the first comparison result is that the first duration is less than or equal to the remaining duration of the CPU, and the second comparison result is that the second duration is less than or equal to the duration pre-allocated to the GPU, then the target duration of the CPU is determined to be the remaining duration of the CPU.

7. The method according to claim 3, characterized in that, Determining the target CPU duration based on the first comparison result and the second comparison result includes: If the first comparison result is that the first duration is greater than the remaining duration of the CPU, and the second comparison result is that the second duration is greater than the duration pre-allocated to the GPU, then the target duration of the CPU is determined to be the remaining duration of the CPU; and the target frequency of the CPU is the highest frequency of the CPU.

8. The method according to any one of claims 1-7, characterized in that, After the CPU generates the rendering instructions for the current image frame using the CPU's first target frequency point, it further includes: The sum of the time taken by the CPU to determine the number of renders and the blur area, and the time taken to generate the render instructions, is the fourth time. The target duration of the GPU is determined based on the fourth duration and the time interval between the start time of the current image frame and the time when the current image frame is displayed on the screen. Based on the target duration of the GPU and the second load, the target frequency of the GPU is determined so that the GPU can use the target frequency to execute the rendering instructions.

9. The method according to any one of claims 1-7, characterized in that, Before determining the number of rendered images and the blurred area of ​​the current image frame via the CPU, the process also includes: Based on the initial node type and initial rendering type of the content to be rendered in the current image frame, the third load of the CPU is predicted to determine the number of renderings and the blur area of ​​the current image frame; and based on the CPU load of historical P frames, the historical average load of the CPU is obtained; where P is an integer, P>1. The larger of the third load and the historical average load of the CPU is obtained; Based on the larger load and the pre-allocated time for determining the number of renders and the blurred area, the second target frequency of the CPU is determined; The process of determining the number of renders and the blur area of ​​the current image frame via the CPU includes: The CPU uses its second target frequency to determine the number of images to be rendered and the area of ​​blur in the current image frame.

10. An electronic device, characterized in that, include: One or more processors; Memory; Multiple applications; And one or more computer programs, wherein the one or more computer programs are stored in the memory, the one or more computer programs including instructions that, when executed by the electronic device, cause the electronic device to perform the method as described in any one of claims 1-9.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when run on a computer, causes the computer to perform the method as described in any one of claims 1-9.

Citation Information

Patent Citations

  • Frequency adjustment method and device of graphic processor, terminal and storage medium

    CN110209501A

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

    CN113138655A