Frequency point adjusting method and device and electronic equipment

By predicting the CPU and GPU load and adjusting the frequency, the problem of lag caused by sudden load in the frame drawing task of electronic devices is solved, ensuring the timely completion of the frame drawing task and a smooth user experience.

CN120670131AActive Publication Date: 2025-09-19HUAWEI TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202410660199.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-27
Publication Date
2025-09-19
Estimated Expiration
2044-05-27

AI Technical Summary

Technical Problem

In the existing technology, electronic devices independently predict the load of the CPU and GPU during frame drawing tasks, resulting in an inability to adjust the frequency in a timely manner under sudden load conditions, causing a lag and an unsmooth user experience.

Method used

By obtaining the rendering quantity and blurred area of ​​the current image frame, the CPU and GPU load are predicted, and the CPU frequency is adjusted according to the prediction results to ensure the timely completion of the frame drawing task.

Benefits of technology

It can timely adjust the frequency in the event of sudden load, avoid frame loss, and improve the user's smooth usage experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120670131A_ABST
    Figure CN120670131A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a frequency point adjustment method and device and electronic equipment, in the frequency point adjustment method, the electronic equipment obtains a current image frame, determines the rendering number and the fuzzy area of the current image frame, and then predicts a first duration used by a CPU to generate a rendering instruction according to the rendering number and the fuzzy area; according to the load prediction parameter of the GPU, predicting a second duration used by the GPU for executing the rendering instruction, and 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, and finally determining a first target frequency point of the CPU according to the first comparison result, the second comparison result and the first load, so that the load of the CPU and the load of the GPU in the frame drawing task can be predicted, and the frequency point of the CPU is adjusted according to the load of the CPU and the load of the GPU. Therefore, the frame drawing task can be completed in time, and smooth use experience is brought to the user.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of smart terminal technology, and in particular to a frequency adjustment method, device, and electronic device. Background Art

[0002] When using electronic devices (such as smartphones or tablets), the smoothness of user use is a key competitive advantage of electronic devices. In existing related technologies, the frame drawing task in electronic devices generally requires the use of a central processing unit (CPU) to perform calculations first, and then a graphics processing unit (GPU) to generate images based on the CPU's calculation results. The commonly used scheduling method on electronic devices is to count the duty cycles of various tasks and make a certain degree of prediction of the CPU load and GPU load based on the increase trend of the historical window load. However, the predictions of the CPU load and the GPU load are relatively independent, and there is no correlation between the predicted CPU load and the predicted GPU load. As a result, when the electronic device performs the frame drawing task, if a sudden load occurs, the CPU and GPU frequencies cannot be adjusted in time, which will cause the frame drawing task to fail to complete in time, giving the user a stuck and unsmooth user experience. Summary of the Invention

[0003] The embodiments of the present application provide a frequency adjustment method, device, and electronic device. The embodiments of the present application also provide a computer-readable storage medium to predict the load of the CPU and GPU in the frame drawing task, and adjust the CPU frequency according to the predicted CPU load and GPU load, so that the frame drawing task can be completed in time without frame loss, providing users with a smooth user experience.

[0004] In a first aspect, the present application provides a frequency adjustment method, comprising: obtaining a current image frame to be drawn; determining the rendering quantity and blur area of ​​the current image frame through a CPU; predicting a first load of the CPU generating a rendering instruction of the current image frame according to the rendering quantity and blur area of ​​the current image frame; and predicting a second load of the GPU executing the rendering instruction according to a load prediction parameter of the GPU; wherein the rendering instruction of the current image frame is generated according to the rendering quantity and the blur area; the load prediction parameter of the GPU includes: the historical load of the GPU, the rendering quantity and the blur area; predicting the CPU generating the rendering instruction according to the first load and the highest frequency of the CPU. a first duration; and based on the second load and the highest frequency of the GPU, predicting the second duration used by the GPU to execute the rendering instruction; 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 deducting the duration used to determine the rendering quantity and the blurred area from the duration pre-allocated to the CPU; determining the first target frequency of the CPU based on the first comparison result and the second comparison result, as well as the first load, so that the CPU uses the first target frequency of the CPU to generate rendering instructions for the current image frame.

[0005] In the frequency adjustment method, the electronic device obtains a current image frame to be drawn, determines the number of renders and the blur area of ​​the current image frame through the CPU, and then predicts a first load on the CPU for generating rendering instructions for the current image frame based on the number of renders and the blur area of ​​the current image frame; and predicts a second load on the GPU for executing the rendering instructions based on a load prediction parameter of the GPU. Next, the electronic device predicts a first duration for the CPU to generate the rendering instructions based on the first load and the highest frequency of the CPU; and predicts a second duration for the GPU to execute the rendering instructions based on the second load and the highest frequency of the GPU. The electronic device compares the first duration with the remaining CPU duration 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. Finally, the electronic device determines a first target frequency for the CPU based on the first and second comparison results, as well as the first load, so that the CPU generates rendering instructions for the current image frame using the first target frequency. This method predicts the loads of the CPU and GPU in the frame drawing task and adjusts the CPU frequency based on the predicted CPU and GPU loads, ensuring that the frame drawing task is completed in a timely manner without frame drops, providing a smooth user experience.

[0006] In one possible implementation, the historical load of the GPU is associated with any one or more of the following: the average GPU load of the historical N frames, the GPU load variance of the historical N frames, and the GPU load of the historical M frames; wherein N and M are integers, 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; 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 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 determining the target duration of the CPU 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 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 calculating a first difference between the second duration and the duration pre-allocated to the GPU, and calculating a 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 determining the target duration of the CPU to be a third duration obtained by subtracting the first difference from the remaining duration of the CPU; if the second difference is less than the first difference, then determining the target duration of the CPU 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 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 determining the target duration of the CPU 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 determining the target duration of the CPU to be the remaining duration of the CPU; then the target frequency of the CPU is the highest frequency of the CPU.

[0012] In one possible implementation, after the CPU uses the first target frequency of the CPU to generate the rendering instructions for the current image frame, it also includes: obtaining the sum of the time taken by the CPU to determine the rendering quantity and the blurred area and the time taken to generate the rendering instructions, the sum of the time being a fourth time; determining the target time of the GPU based on the fourth time and the time interval between the start drawing moment of the current image frame and the on-screen moment of the current image frame; determining the target frequency of the GPU based on the target time of the GPU and the second load, so that the GPU uses the target frequency of the GPU to execute the rendering instructions.

[0013] In one possible implementation, before determining the rendering quantity and blur area of ​​the current image frame by the CPU, it also includes: predicting the third load of the CPU for determining the rendering quantity and 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 obtaining the historical average load of the CPU based on the CPU load of historical P frames; wherein P is an integer, P>1; obtaining the larger load between the third load and the historical average load of the CPU; determining the second target frequency of the CPU based on the larger load and the pre-allocated time for determining the rendering quantity and the blur area; determining the rendering quantity and blur area of ​​the current image frame by the CPU includes: the CPU using the second target frequency of the CPU to determine the rendering quantity and blur area of ​​the current image frame.

[0014] In a second aspect, an embodiment of the present application provides an electronic device comprising: one or more processors; a memory; multiple applications; 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, which, when executed by the electronic device, enable the electronic device to execute the method provided in the first aspect.

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

[0016] In a third aspect, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer-readable storage medium is run on a computer, the computer executes the method provided in the first aspect.

[0017] In a fourth aspect, an embodiment of the present application provides a computer program, which, when executed by a computer, is used to execute the method provided in the first aspect.

[0018] In one possible design, the program in the fourth aspect may be stored in whole or in part on a storage medium packaged with the processor, or may be stored in whole or in part on a memory not packaged with the processor. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 A schematic diagram of the execution of a frame drawing task provided in the existing related technology;

[0020] Figure 2 A schematic diagram of the structure of an electronic device provided in one embodiment of the present application;

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

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

[0023] Figure 5 A schematic diagram of executing a frame drawing task provided in one embodiment of the present application;

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

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

[0026] Figure 8 A schematic diagram of determining the GPU frequency provided in one embodiment of the present application;

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

[0028] Figure 10 A schematic diagram of executing a frame drawing task provided in another embodiment of the present application;

[0029] Figure 11 A schematic diagram of executing a frame drawing task provided in yet another embodiment of the present application;

[0030] Figure 12 A schematic structural diagram of an electronic device provided in another embodiment of the present application. DETAILED DESCRIPTION

[0031] The terms used in the implementation section of this application are only used to explain the specific embodiments of this application and are not intended to limit this application.

[0032] For frame drawing tasks, it is generally necessary to use the CPU to perform calculations first, and then use the GPU to generate images based on the CPU's calculation results. However, in the scheduling methods provided by existing related technologies, the predictions of the CPU load and the GPU load are relatively independent. For the drawing of a certain image frame, there is no correlation between the tasks performed by the CPU itself and the tasks performed by the CPU and GPU. The CPU and GPU are unaware of each other's scheduling targets. Therefore, electronic devices can only adjust the frequency of the CPU and GPU separately based on the usage of the hardware. In addition, since there is no correlation between the various tasks, it is impossible to reasonably allocate their respective execution times when the load is uneven. As a result, when the electronic device performs the frame drawing task, if a sudden load occurs, the CPU and GPU frequencies cannot be adjusted in time, which will cause the frame drawing task to fail to be completed in time, giving the user a stuck and unsmooth user experience.

[0033] Specifically, see Figure 1 , Figure 1 The figure is a schematic diagram of executing the frame drawing task provided in the existing related technology. Figure 1 In the process, both the main thread and the rendering thread are executed on the CPU. The main thread can also be called the UI thread. In the main thread, the CPU determines the rendering quantity and blur area corresponding to the image frame to be drawn in the current frame. In the rendering thread, the CPU generates a rendering instruction based on the rendering quantity and blur area determined by the main thread. Then, the GPU executes the rendering instruction to obtain the image of the current frame. The synthesis thread synthesizes the image of the current frame obtained by GPU rendering with the image of the previous frame obtained by rendering the previous frame 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 rectangular bars in the figure represent the execution time of the task in each thread.

[0034] from Figure 1 It can be seen that there is no correlation between the tasks executed by the CPU's main thread and rendering thread, and between the tasks executed by the CPU and GPU. Therefore, when determining the CPU and GPU frequencies, we can only determine the CPU and GPU frequencies separately based on their respective loads and scheduling targets. For example, see Figure 1, the execution time of the tasks pre-assigned to the main thread and the rendering thread is the same. Since the main thread has a lighter load, the CPU frequency is lower when executing the main thread. After the main thread is executed, the CPU still uses a lower frequency when executing the rendering thread. However, the load of the rendering thread is higher than that of the main thread. In this way, after executing part of the rendering thread's task, the CPU may find that continuing to use the lower frequency will result in the inability to complete the rendering thread's task within the pre-assigned task execution time. Therefore, the CPU will increase the CPU frequency and then use a higher frequency to execute the remaining tasks. This will lead to the following problems: First, the CPU load is uneven. For example, the CPU sometimes runs at a low frequency and sometimes runs at a high frequency, which will increase the CPU's power consumption. Second, even if a higher frequency is used, it is still possible that the rendering thread's task cannot be completed within the pre-assigned task execution time. As a result, the image frames cannot be rendered in time, resulting in frame drops, which gives users a lag and unsmooth user experience.

[0035] Based on the above problems, the embodiment of the present application provides a frequency adjustment method, which allows the tasks in the frame flow of the electronic device to perceive the scheduling target in a single frame and link the scheduling target. At the same time, in the process of executing a single frame task, the electronic device will continuously accumulate information about the current frame. The longer the execution time, the clearer the load of the subsequent task. Therefore, the load of the subsequent task can be predicted in advance as the previous task is executed, so that the load burst can be predicted, and then scheduling can be carried out in advance to improve the user's operating experience. It should be noted that the scheduling target mentioned in the embodiment of the present application can be understood as the task execution time pre-allocated to the CPU and GPU respectively in the process of executing a single frame task.

[0036] The frequency adjustment method provided in the embodiments of the present application can be applied to electronic devices, wherein the above-mentioned electronic devices can be smart phones, tablet computers, wearable devices, vehicle-mounted devices, augmented reality (AR) / virtual reality (VR) devices, laptop computers, ultra-mobile personal computers (UMPCs), netbooks or personal digital assistants (PDAs), etc.; the embodiments of the present application do not impose any restrictions on the specific type of electronic devices.

[0037] For example, Figure 2 A schematic diagram of the structure of an electronic device provided in one embodiment of the present application is shown in FIG. 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, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0038] It should be understood that the structures illustrated in the embodiments of the present application do not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

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

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

[0041] Processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 110. If processor 110 needs to use the same instruction or data again, it can directly access the memory. This avoids duplicate accesses, reduces processor 110 latency, and thus improves system efficiency.

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

[0043] It is understood that the interface connection relationship between the modules illustrated in the embodiments of the present application is merely an illustrative illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods from the above embodiments, or a combination of multiple interface connection methods.

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

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

[0046] The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes a layered architecture system as an example.

[0047] For ease of understanding, the following examples of this application will be described with Figure 2 Taking the electronic device with the structure shown as an example, the frequency adjustment method provided in the embodiment of the present application is specifically described in combination with the accompanying drawings and application scenarios.

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

[0049] In step 301 , the electronic device 100 obtains a current image frame to be drawn.

[0050] In some examples, the electronic device 100 obtains the current image frame to be drawn as follows: in response to a user operation on a target application, the electronic device 100 obtains the current image frame to be drawn of the target application; wherein the above-mentioned user operation on the target application may include: a user clicking on the icon of the target application, or a user operation in the interface of the target application after the target application is running; wherein the user clicking on the icon of the target application is used to start the above-mentioned target application. Of course, the user operation on the target application may also include other operations, which are not limited in this embodiment. It can be understood that after the user operates the target application, the target application needs to display the corresponding interface. Therefore, after detecting the user operation on the target application, in response to the above-mentioned operation, the electronic device 100 can obtain the current image frame to be drawn of the target application.

[0051] In other examples, the electronic device 100 obtains the current image frame to be drawn as follows: during the operation of the target application, the electronic device 100 obtains the current image frame to be drawn by the target application. For example, assuming that the target application is a video playback application, during the process of the target application playing a video, the electronic device 100 obtains the current image frame to be drawn by the target application.

[0052] The above are merely two examples of how the electronic device 100 obtains the current image frame to be drawn. This embodiment is not limited thereto. This embodiment does not limit the manner in which the electronic device 100 obtains the current image frame to be drawn.

[0053] In step 302 , the electronic device 100 determines the rendering quantity and blur area of ​​the current image frame through the CPU.

[0054] Specifically, the electronic device 100 determines the rendering quantity of the current image frame through the CPU by: the CPU determines the rendering quantity of the current image frame according to the number of nodes, node type and rendering type included in the content to be rendered in the current image frame.

[0055] For some examples, see Figure 4 , the content of the image frame to be rendered can be stored in a tree structure, which can also be called a rendering tree. Therefore, the number of nodes to be rendered in the current image frame can be determined based on the number of nodes, node type and rendering type. Among them, the above node types can include leaf nodes and container nodes, Figure 4 In the figure, 41 is a leaf node and 42 is a container node. The leaf node stores the content to be rendered in the image frame and the attributes of the content to be rendered. For example, the content to be rendered can be an image and / or text, and the attributes of the content to be rendered can include whether the image has a shadow and / or whether the image has rounded corners. The container node stores the length and width 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 to be rendered is an image or text. Figure 4 A schematic diagram of a tree structure of content to be rendered provided in one embodiment of the present application.

[0056] Continue to see Figure 5 For the drawing task of a single image frame, the CPU executes two threads, namely the main thread and the rendering thread. After obtaining the current image frame to be drawn, the main thread is started. During the execution of the main thread, the CPU will perform some cropping on the tree structure of the content to be rendered in the current image frame and delete some nodes. In this way, after the main thread is executed, the tree structure of the content to be rendered in the current image frame is fixed and will not change again. Finally, the CPU can determine the rendering quantity and blur area of ​​the current image frame based on the cropped tree structure. Figure 5A schematic diagram of executing a frame drawing task provided in one embodiment of the present 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 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 predicts a second load of the GPU executing the 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 GPU's historical load, the aforementioned rendering quantity, and the aforementioned blur area. In some examples, the GPU's historical load may include: the GPU's average load over N historical frames, the GPU load variance over N historical frames, and the GPU load over M historical frames. N and M are integers, and N>M>0. In this embodiment, the sizes of N and M can be set arbitrarily during implementation. 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 A schematic diagram of the execution of the frequency adjustment method provided in one embodiment of the present application is shown in FIG. Figure 6 In step 302, the main thread of the CPU is started. In the main thread, the CPU determines the rendering quantity and blur area of ​​the current image frame. Then, in step 303, the CPU can predict the first load of the CPU generating the rendering instruction of the current image frame based on the rendering quantity and blur area of ​​the current image frame.

[0061] That is to say, if Figure 5 As shown in 51, after the main thread is executed, the rendering number and blur area of ​​the current image frame are passed to the rendering thread. Before executing the rendering thread, the CPU can predict the CPU load on the rendering thread based on the rendering number and blur area obtained by the main thread, thereby associating the tasks executed by the CPU; and at this time, the CPU can also predict the second load of the GPU executing the above rendering instructions based on the load prediction parameters of the GPU, and the load prediction parameters of the GPU include the above rendering number and blur area, thereby associating the tasks executed by the CPU with the tasks executed by the GPU, and the load of the subsequent tasks can be predicted in advance as the previous tasks are executed, so that the load burst situation can be predicted, and scheduling can be carried out in advance to improve the user's operating experience.

[0062] In step 304, the electronic device 100 predicts a first duration for the CPU to generate the rendering instruction based on the first load and the highest frequency of the CPU; and predicts a second duration for the GPU to execute the rendering instruction 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 point of the CPU according to formula (1).

[0064]

[0065] In formula (1), the coefficients may 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 formula (1). As you can imagine, the first duration is the predicted minimum duration for the CPU to generate rendering instructions, and the second duration is the predicted minimum duration for the GPU to execute rendering instructions.

[0067] In step 305 , the 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 remaining time after deducting the time used to determine the number of renderings and the blur area from the time pre-allocated to the CPU. Figure 5 As shown in 51, after the main thread is executed, the rendering thread can not only obtain the rendering quantity and blurred area of ​​the current image frame, but also obtain the duration of the CPU executing the main thread. In this way, the remaining duration after subtracting the duration of the CPU executing the main thread from the duration pre-allocated to the CPU is the available duration for the CPU to execute the rendering thread, that is, the aforementioned remaining duration of the CPU.

[0069] In this embodiment, regarding the duration pre-allocated to the CPU and the duration pre-allocated to the GPU, in specific implementation, the electronic device 100 may pre-allocate the duration corresponding to the time interval between the start of drawing an image frame and the screen-up time to the CPU and GPU based on the ratio of the load of the tasks executed by the CPU to the load of the tasks executed by the GPU in the drawing task of an image frame; wherein, in the drawing task of an image frame, the ratio of the load of the tasks executed by the CPU to the load of the tasks executed by the GPU in the drawing task of an image frame may be determined based on empirical values. For example, in the drawing task of an image frame, the load of the tasks executed by the CPU in the main thread accounts for 25% of the average CPU load, the load of the tasks executed by the CPU in the rendering thread accounts for 70% of the average CPU load, and the load of the GPU in executing rendering instructions accounts for 5% of the average CPU load, and the duration corresponding to the time interval between the start of drawing an image frame and the screen-up time may be 15ms, then the duration pre-allocated to the CPU may be 10ms, and the duration pre-allocated to the GPU may be 5ms.

[0070] In step 306 , the electronic device 100 determines a first target frequency of the CPU according to the first comparison result, the second comparison result, and the first load, so that the CPU generates a rendering instruction for the current image frame using the first target frequency of the CPU.

[0071] Continue to see 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, and then the CPU adjusts the frequency to the first target frequency. In this way, when executing the rendering thread, the CPU uses the first target frequency.

[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. The electronic device 100 determines the target duration of the CPU based on the first comparison result and the second comparison result, and then determines the first target frequency of the CPU based on the first load and the target duration of the CPU. In a specific implementation, after determining the target duration of the CPU, the electronic device 100 can determine the first target frequency of the CPU based on the first load and the target duration of the CPU according to formula (1).

[0073] In one implementation, the electronic device 100 determines the target duration of the CPU based on the first comparison result and the second comparison result: 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 remaining duration of the CPU, indicating that even if the CPU raises the frequency to the highest frequency of the CPU, it cannot complete the rendering thread task within the remaining duration of the CPU, and the second duration is less than the duration pre-allocated to the GPU, indicating that if the GPU executes the rendering instruction at the highest frequency of the GPU, the duration pre-allocated to the GPU is remaining. Therefore, the CPU can preempt the duration pre-allocated to the GPU, that is, the target duration of the CPU is determined to be the first duration, which includes the remaining duration of the CPU and the duration pre-allocated to the GPU. It can be imagined that the duration pre-allocated to the GPU is the third difference between the first duration and the remaining duration of the CPU. In this way, the expected duration for the GPU to execute the rendering instruction becomes the remaining duration after deducting the duration corresponding to the third difference from the second duration.

[0075] In this implementation, the target duration of the CPU is the first duration. Therefore, according to formula (1), the first target frequency can be determined as the highest frequency of the CPU. Then, the CPU uses the highest frequency of the CPU to generate rendering instructions for the current image frame. When the predicted execution duration is higher than the pre-allocated execution duration, the CPU frequency is increased to ensure that the frame drawing task can be completed in time.

[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: 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, determine the target duration of the CPU to be a third duration obtained by subtracting the first difference from the remaining duration of the CPU; if the second difference is less than the first difference, determine the target duration of the CPU 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 the frequency to the highest frequency of the CPU, the rendering thread task can be completed within the remaining duration of the CPU. The second duration is greater than the duration pre-allocated to the GPU, indicating that even if the GPU executes the rendering instruction at the highest frequency of the GPU, it cannot complete the execution of the rendering instruction within the duration pre-allocated to the GPU. Therefore, the GPU can preempt part of the duration from the remaining duration of the CPU. Therefore, it is necessary to first calculate the first difference and the second difference. If the second difference is greater than or equal to the first difference, it means that the duration of the remaining duration of the CPU other than the first duration can meet the needs of the GPU. Therefore, the GPU can preempt the duration corresponding to the first difference from the remaining duration of the CPU. The target duration of the CPU can be determined as the third duration obtained by subtracting the first difference from the remaining duration of the CPU. Then, the CPU can determine the first target frequency of the CPU according to formula (1) based on the first load and the third duration, thereby determining a suitable frequency for the CPU while ensuring that the tasks of the CPU and 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 duration, excluding the first duration, cannot fully meet the needs of the GPU. Therefore, it is necessary to first meet the duration of the CPU generating rendering instructions, determine the CPU target duration as the first duration, and then allocate the remaining CPU duration, excluding the first duration, to the GPU. In this case, the CPU target duration is the first duration, so according to formula (1), the first target frequency can be determined as the highest frequency of the CPU. The CPU can then use the highest frequency of the CPU to generate rendering instructions for the current image frame, execute the rendering thread in the shortest time, and then allocate the remaining CPU duration, excluding the first duration, to the GPU. This leaves more execution time for the GPU, 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: 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 duration of the CPU, indicating that if the CPU raises the frequency to the highest frequency of the CPU, the rendering thread task can be completed within the remaining duration of the CPU, and the second duration is less than or equal to the duration pre-allocated to the GPU, indicating that if the GPU executes the rendering instruction at the highest frequency of the GPU, the rendering instruction can also be completed within the duration pre-allocated to the GPU. Therefore, the target duration of the CPU can be determined as the remaining duration of the CPU, and then the first target frequency of the CPU can be determined according to formula (1) based on the remaining duration of the CPU and the first load. At this time, the first target frequency is less than or equal to the highest frequency of the CPU, that is, 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: 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; that is, 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 duration of the CPU, indicating that even if the CPU increases the frequency to the highest frequency of the CPU, it cannot complete the rendering thread task within the remaining duration of the CPU, and the second duration is also greater than the duration pre-allocated to the GPU, indicating that even if the GPU executes the rendering instructions at the highest frequency of the GPU, it cannot complete the rendering instructions within the duration pre-allocated to the GPU. At this time, the CPU and GPU do not preempt each other's duration, and both execute tasks at their own highest frequency points, thereby shortening the time used to draw the current image frame as much as possible.

[0083] In the above-mentioned frequency adjustment method, the electronic device 100 obtains the current image frame to be drawn, determines the rendering quantity and blur area of ​​the current image frame through the CPU, and then predicts the first load of the CPU generating the rendering instruction of the current image frame based on the rendering quantity and blur area of ​​the current image frame; and predicts the second load of the GPU executing the above-mentioned rendering instruction based on the load prediction parameters of the GPU. Next, the electronic device 100 predicts the first duration used by the CPU to generate the above-mentioned rendering instructions based on the above-mentioned first load and the highest frequency of the CPU; and predicts the second duration used by the GPU to execute the above-mentioned rendering instructions based on the second load and the highest frequency of the GPU, compares the above-mentioned 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. Finally, the electronic device 100 determines the first target frequency of the CPU based on the first comparison result and the second comparison result, as well as the first load, so that the CPU uses the above-mentioned first target frequency of the CPU to generate rendering instructions for the current image frame, thereby realizing the prediction of the load of the CPU and GPU in the frame drawing task, and adjusting the frequency of the CPU based on the predicted CPU load and GPU load, so that the frame drawing task can be completed in time without frame loss, bringing a smooth user experience to the user.

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

[0085] In step 701, the electronic device 100 obtains the sum of the time taken by the CPU to determine the rendering quantity and the blurred area and the time taken to generate the rendering instruction, where the sum of the time is a fourth time.

[0086] In this step, the fourth duration is the sum of the actual duration of the CPU executing the main thread and the actual duration of the CPU executing the rendering thread. 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 the CPU spent executing the main thread and the rendering thread.

[0087] In step 702 , the electronic device 100 determines a target GPU duration according to the fourth duration and the time interval between the start of rendering 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 may be 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, minus the difference of the fourth duration.

[0089] In step 703 , the electronic device 100 determines a target frequency of the GPU according to the target duration of the GPU and the second load, so that the GPU executes the rendering instruction using the target frequency of the GPU.

[0090] See also 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 rendering instruction, and then synthesize the rendered image with the image of the previous image frame in the synthesis thread to obtain the current image frame to be displayed, and then the current image frame to be displayed can be displayed on the screen.

[0091] Figure 8 A schematic diagram of determining the GPU frequency provided in one embodiment of the present application is shown as follows: Figure 8 As shown, after obtaining 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 number of the current image frame. The blur area and rendering number are then passed to the Hint information. The Hint information then obtains the GPU average load of the historical 5 frames, the GPU load variance of the historical 5 frames, and the GPU load of the historical 1 frame from the GPU's historical load. The GPU average load of the historical 5 frames, the GPU load variance of the historical 5 frames, the GPU load of the historical 1 frame, the blur area, and the rendering number are then sent to the load prediction module. The load prediction module predicts the second GPU load based on the GPU average load of the historical 5 frames, the GPU load variance of the historical 5 frames, and the GPU load of the historical 1 frame, the blur area, and the rendering number. In addition, after the CPU completes 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 of drawing the current image frame and the time when the current image frame is on the screen. The GPU target time is then determined based on the above time interval and the actual time taken. Specifically, the GPU target time is the difference between the above time interval and the above actual time taken.

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

[0093] In this embodiment, the electronic device 100 can determine the target duration of the GPU based on the actual execution duration of the CPU and the time interval between the start drawing time of the current image frame and the time when the current image frame is displayed on the screen. Finally, based on the above-mentioned 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 above-mentioned target frequency of the GPU to execute rendering instructions, thereby associating the tasks executed by the CPU with the tasks executed by the GPU. The frequency of the GPU is adjusted according to the actual execution time of the CPU, which can not only ensure that the frame drawing task of the current image frame is completed in time, bringing a smooth user experience, but also save power consumption.

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

[0095] In step 901, the electronic device 100 predicts the CPU's third load of determining 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 CPU load based on the CPU load of historical P frames.

[0096] Wherein, P is an integer, P>1; in specific implementation, the size of P can be set by oneself, and this embodiment does not limit the size of P. For example, P can be 3.

[0097] In step 902 , the electronic device 100 obtains a larger load between the third load and the historical average load of the CPU.

[0098] In step 903 , the electronic device 100 determines a second target frequency of the CPU according to the larger load and the pre-allocated time for determining the rendering quantity and the blur area.

[0099] Thus, step 302 may be:

[0100] In step 904 , the CPU uses the second target frequency point of the CPU to determine the rendering quantity and blur area of ​​the current image frame.

[0101] In this embodiment, after obtaining 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 of the current image frame is stored in a tree structure. Therefore, first, the CPU can predict 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 the initial rendering type, that is, predict the third load of the main thread. In addition, the CPU can also obtain the historical average load of the CPU based on the CPU load of the historical three frames. Then, the CPU compares the third load with the historical average load of the CPU and takes the larger load. Finally, the CPU determines the second target frequency of the CPU according to formula (1) based on the larger load of the third load and the historical average load of the CPU and the time pre-allocated to the main thread. Afterwards, the CPU uses the above second target frequency to execute the main thread to 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, and then use the larger of the two loads and the time pre-allocated to the main thread to determine the second target frequency of the CPU. The CPU then uses the second target frequency to execute the above-mentioned main thread, thereby determining a suitable frequency for the CPU to execute the main thread, saving CPU power consumption.

[0103] The frequency adjustment method provided in the embodiment of the present application is described below through two specific examples.

[0104] The main thread load is set to 25% of the average CPU load, the rendering thread load is set to 70%, and the GPU load is set to 5%. For a single frame drawing task, starting with the receipt of the vertical synchronization (VSYNC) signal, it takes 19.9ms to complete (system default).

[0105] Assume 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 load relationship between the CPU and GPU. 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 embodiment shown determines the second target frequency point, and then the CPU uses the second target frequency point to execute the main thread to determine the rendering quantity and blur area of ​​the current image frame, such as Figure 10 As shown in the figure, in this example, the time taken by the CPU to execute the main thread is 5ms. Figure 10 A schematic diagram of executing a frame drawing task provided in another embodiment of the present application.

[0107] like Figure 10 As shown in 1001, after the CPU finishes executing the main thread and before executing the rendering thread, the CPU can obtain the duration of the CPU executing the main thread, and then the CPU executes Figure 3 In the illustrated embodiment, steps 303 to 305 are performed, and in step 306, the CPU finds that the first comparison result is that the first duration is greater than the remaining duration of the CPU (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 is greater than the remaining duration of the CPU, indicating that the CPU load is sudden, and even if the CPU raises the frequency to the highest frequency of the CPU, it cannot complete the rendering thread task within the remaining duration of the CPU. The second duration is less than the duration pre-allocated to the GPU, indicating that if the GPU executes the rendering instruction at the highest frequency of the GPU, the duration pre-allocated to the GPU is remaining. Therefore, the CPU can preempt the duration pre-allocated to the GPU. Here, it is assumed that the CPU preempts the GPU for 3ms. The target duration of the CPU is the remaining duration of the CPU plus 3ms, that is, 8ms.

[0108] Afterwards, the CPU determines the first target frequency of the CPU according to the 8ms duration and the first load according to formula (1), uses the first target frequency to execute the rendering thread, and generates the rendering instructions for the current image frame. In this example, Figure 10 As shown in the figure, the actual time the CPU takes to execute the rendering thread is 7ms. In other words, 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. Therefore, the total time the CPU actually takes to execute the main thread and the rendering thread is 5ms + 7ms = 12ms.

[0109] Next, if Figure 10 As shown in 1002, before the GPU executes the rendering instruction, the GPU can obtain the sum of the actual execution time of the CPU main thread and the rendering thread, which is 12ms in this example. The time interval between the start of the current image frame drawing and the time when the current image frame is displayed on the screen is 15ms, so the GPU target duration can be determined to be 15ms-12ms=3ms. Then, based on the 3ms duration and the second load, the GPU can determine the GPU target frequency according to equation (1). Finally, the GPU uses the GPU target frequency to execute the above rendering instruction. Then, the synthesis thread can synthesize the rendered image with the image of the previous image frame to obtain the current image frame to be displayed, and then 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 embodiment shown determines the second target frequency point, and then the CPU uses the second target frequency point to execute the main thread to determine the rendering quantity and blur area of ​​the current image frame, such as Figure 11 As shown in the figure, in this example, the time taken by the CPU to execute the main thread is 5ms. Figure 11 A schematic diagram of executing a frame drawing task provided in yet another embodiment of the present application.

[0111] Next, before executing the rendering thread, such as Figure 11 As shown in 1101, the CPU can obtain the duration of the CPU execution main thread, and then the CPU executes Figure 3 In the illustrated embodiment, steps 303 to 305, in step 306, the CPU finds that the first comparison result is that the first duration is less than the remaining duration of the CPU (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 is less than the remaining duration of the CPU, indicating that if the CPU raises the frequency to the highest frequency of the CPU, the rendering thread task can be completed within the remaining duration of the CPU, while the second duration is greater than the duration pre-allocated to the GPU, indicating that even if the GPU executes the rendering instruction at the highest frequency of the GPU, it cannot complete the execution of the above rendering instruction within the duration pre-allocated to the GPU. Therefore, it is necessary to increase the frequency of the CPU execution of the rendering thread and shorten the duration of the CPU execution of the rendering thread in order to leave a longer execution time for the GPU. In other words, the GPU needs to seize the duration pre-allocated to the CPU.

[0112] Here, it is assumed that the first difference between the second duration and the duration pre-allocated to the GPU is 2ms, and the second difference between the remaining CPU duration and the first duration is 3ms. In this way, 2ms of the remaining CPU duration can be reserved for the GPU, and the target CPU duration is determined to be 5ms-2ms=3ms. Then, based on the first load and the third duration, the CPU can determine the first target frequency of the CPU according to equation (1), and use the first target frequency to execute the rendering thread and generate rendering instructions for the current image frame. In this way, a suitable frequency can be determined for the CPU while ensuring that both CPU and GPU tasks can be completed on time, thereby saving power as much as possible.

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

[0114] Next, if Figure 11As shown in 1102, before the GPU executes the rendering instruction, the GPU can obtain the sum of the actual execution time of the CPU main thread and the rendering thread, which is 8ms in this example. The time interval between the start of the current image frame drawing and the time when the current image frame is displayed on the screen is 15ms, so the GPU target duration can be determined to be 15ms-8ms=7ms. Then, based on the 7ms duration and the second load, the GPU can determine the GPU target frequency according to equation (1). Finally, the GPU uses the GPU target frequency to execute the above rendering instruction. Then, the synthesis thread can synthesize the rendered image with the image of the previous image frame to obtain the current image frame to be displayed, and then 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 the present application embodiments may also perform other operations or variations of various operations. In addition, the various steps may be performed in a different order than those presented in the above embodiments, and it is possible that not all of the operations in the above embodiments need to be performed.

[0116] It is understandable that, in order to realize the above functions, the electronic device includes hardware and / or software modules corresponding to the execution of each function. In combination with the algorithm steps of each example described in the embodiments disclosed in this application, this application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or 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 combination with the embodiments, but such implementation should not be considered to be beyond the scope of this application.

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

[0118] Figure 12 This is a structural diagram of an electronic device provided by another embodiment of the present application, in which each functional module is divided into corresponding functional modules. Figure 12 A possible schematic diagram of the composition of the electronic device 1200 involved in the above embodiment is shown. Figure 12 As shown, the electronic device 1200 may include: a receiving unit 1201, a processing unit 1202 and a sending unit 1203;

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

[0120] It should be noted that this application Figures 3 to 11 All relevant contents of each step involved in the method embodiment can be referred to 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 the application Figures 3 to 11 The frequency adjustment method provided by the illustrated embodiment can therefore achieve the same effect as the above method.

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

[0123] In the case of adopting an integrated unit, 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 be used to support the electronic device 1200 in executing the steps performed by the receiving unit 1201, the processing unit 1202, and the sending unit 1203. The storage module can be used to support the electronic device 1200 in storing program code and data. The communication module can be used to support communication between the electronic device 1200 and other devices.

[0125] Among them, the processing module can be a processor or a 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 that implements computing functions, such as a combination of one or more microprocessors, a combination of digital signal processing (DSP) and a microprocessor, and so on. The storage module can be a memory. The communication module can specifically be a device that interacts with other electronic devices, such as a radio frequency circuit, 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 Figure 2 Device with the structure shown.

[0127] The embodiment of the present application also provides a computer-readable storage medium, which stores a computer program, which, when executed on a computer, enables the computer to execute the present application. Figures 3 to 11 The method provided by the illustrated embodiment.

[0128] The present invention also provides a computer program product, which includes a computer program that, when executed on a computer, enables the computer to execute the present invention. Figures 3 to 11 The method provided by the illustrated embodiment.

[0129] In the embodiments of the present application, "at least one" refers to one or more, and "more" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent the existence of A alone, the existence of A and B at the same time, and the existence of B alone. Among them, A and B can be singular or plural. The character " / " generally indicates that the previous and next associated 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 single 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, c can be single or multiple.

[0130] Those skilled in the art will appreciate that the various units and algorithm steps described in the embodiments disclosed herein can be implemented using a combination of electronic hardware, computer software, and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians 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 clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0132] In the several embodiments provided in this application, if any function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of this application. The aforementioned storage medium includes various media that can store program code, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk. The above is only a specific embodiment of the present application. Any person skilled in the art can easily think of changes or replacements within the technical scope disclosed in this application, which should be covered within the scope of protection of this application. The scope of protection of this application should be based on the scope of protection of the claims.

Claims

1. A frequency adjustment method, characterized in that: include: Get the current image frame to be drawn; Determining, by the CPU, the rendering quantity and the blur area of ​​the current image frame; Predicting a first load of a CPU generating a rendering instruction for the current image frame based on the number of renderings and the blurred area of ​​the current image frame; and predicting a second load of the GPU executing the rendering instruction based on a load prediction parameter of the GPU; wherein the rendering instruction for the current image frame is generated based on the number of renderings and the blurred area; and the GPU load prediction parameter includes: a historical load of the GPU, the number of renderings, and the blurred area; Predicting a first duration for the CPU to generate the rendering instruction based on the first load and the highest frequency of the CPU; and predicting a second duration for the GPU to execute the rendering instruction 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 deducting the duration used to determine the rendering quantity and the blurred area from the duration pre-allocated to the CPU; A first target frequency of the CPU is determined according to the first comparison result, the second comparison result, and the first load, so that the CPU generates a rendering instruction for the current image frame using the first target frequency of the CPU.

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

3. The method according to claim 1, characterized in that The determining, according to the first comparison result, the second comparison result, and the first load, a first target frequency of the CPU includes: Determining a target CPU duration based on the first comparison result and the second comparison result; A first target frequency of the CPU is determined according to 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 according to 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, 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 according to 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, calculating a first difference between the second duration and the duration pre-allocated to the GPU, and calculating a 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, determining the target duration of the CPU as a third duration obtained by subtracting the first difference from the remaining duration of the CPU; If the second difference is smaller than the first difference, 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 according to 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 according to 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; then the target frequency of the CPU is the highest frequency of the CPU.

8. The method according to any one of claims 1 to 7, characterized in that After the CPU generates the rendering instruction of the current image frame using the first target frequency point of the CPU, the method further includes: Obtaining a sum of a duration used by the CPU to determine the rendering quantity and the blurred area and a duration used to generate the rendering instruction, where the sum of the durations is a fourth duration; Determining a target duration of the GPU according to the fourth duration and a time interval between a drawing start time of the current image frame and a screen-on-screen time of the current image frame; A target frequency of the GPU is determined according to the target duration of the GPU and the second load, so that the GPU executes the rendering instruction using the target frequency of the GPU.

9. The method according to any one of claims 1 to 7, characterized in that: Before determining the rendering quantity and blur area of ​​the current image frame by the CPU, the method further includes: Predicting a third load of the CPU for determining 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 obtaining a historical average load of the CPU based on the CPU load of historical P frames, where P is an integer and P>1; Obtaining a larger load between the third load and the historical average load of the CPU; Determining a second target frequency of the CPU according to the larger load and a pre-allocated time for determining the rendering quantity and the blurred area; The determining, by the CPU, the rendering quantity and the blur area of ​​the current image frame includes: The CPU determines the rendering quantity and the blur area of ​​the current image frame using the second target frequency point of the CPU.

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, and the one or more computer programs include instructions, which, when executed by the electronic device, cause the electronic device to perform the method according to any one of claims 1 to 9.

11. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed on a computer, enables the computer to execute the method according to any one of claims 1 to 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

  • Load processing method and related device

    CN114968546A