Search

EP-4738119-A1 - FREQUENCY MODULATION METHOD AND ELECTRONIC DEVICE

EP4738119A1EP 4738119 A1EP4738119 A1EP 4738119A1EP-4738119-A1

Abstract

A frequency scaling method and an electronic device relate to the field of terminal technologies, and may adjust a frequency of a GPU based on a processing progress of the GPU for a current frame of image, so as to ensure that a frame loss does not occur. The method includes: An electronic device displays a first image. Within a first time range for displaying the first image, the electronic device detects whether first end time at which a GPU completes processing on a second image exceeds first time, where the second image and the first image are two consecutive frames of images, and the first time is within the first time range. The electronic device increases a frequency of the GPU if the first end time exceeds the first time. The electronic device displays the second image after the GPU completes the processing on the second image.

Inventors

  • YANG, Zudi
  • HUANG, Tonghuan
  • GUO, Daoxin

Assignees

  • Honor Device Co., Ltd.

Dates

Publication Date
20260506
Application Date
20240816

Claims (14)

  1. A frequency scaling method, applied to an electronic device, wherein the electronic device comprises a graphics processing unit GPU, and the method comprises: displaying, by the electronic device, a first image; within a first time range for displaying the first image, detecting, by the electronic device, whether first end time at which the GPU completes processing on a second image exceeds first time, wherein the second image and the first image are two consecutive frames of images, and the first time is within the first time range; and increasing, by the electronic device, a frequency of the GPU if the first end time exceeds the first time; and displaying, by the electronic device, the second image after the GPU completes the processing on the second image.
  2. The method according to claim 1, wherein the electronic device further comprises a display driver and a hardware composer HWC, the first time is after second time at which the display driver starts waiting for the GPU to complete the processing on the second image, and after receiving a composition result of the HWC for the second image, the display driver starts waiting for the GPU to complete the processing on the second image.
  3. The method according to claim 2, wherein the detecting, by the electronic device, whether first end time at which the GPU completes processing on a second image exceeds first time comprises: detecting, by the electronic device at the first time, whether the display driver is waiting for the GPU to complete the processing on the second image, wherein if the display driver is waiting for the GPU to complete the processing on the second image, the first end time exceeds the first time; or if the display driver is not waiting for the GPU to complete the processing on the second image, the first end time does not exceed the first time.
  4. The method according to claim 2 or 3, wherein the second time comprises time at which the display driver starts executing a waiting function; and the waiting function is used by the display driver to wait for the GPU to complete the processing on the second image, and after the GPU completes the processing on the second image, the display driver ends executing the waiting function.
  5. The method according to any one of claims 1-4, wherein the increasing, by the electronic device, a frequency of the GPU comprises: increasing, by the electronic device, a minimum frequency of the GPU; and the method further comprises: within the first time range for displaying the first image, detecting, by the electronic device, whether the first end time exceeds third time, and decreasing, by the electronic device, the frequency of the GPU if the first end time does not exceed the third time, wherein the third time is within the first time range, and the third time is before the first time.
  6. The method according to claim 5, wherein the detecting, by the electronic device, whether first end time at which the GPU completes processing on a second image exceeds first time comprises: if the first end time exceeds the third time, detecting, by the electronic device, whether the first end time at which the GPU completes the processing on the second image exceeds the first time.
  7. The method according to claim 5 or 6, wherein the detecting, by the electronic device, whether first end time at which the GPU completes processing on a second image exceeds first time comprises: if a time interval between the first time and fourth time is greater than a duration threshold, detecting, by the electronic device, whether the first end time exceeds the first time; and the detecting, by the electronic device, whether the first end time exceeds third time comprises: if the time interval between the third time and the fourth time is greater than the duration threshold, detecting, by the electronic device, whether the first end time exceeds the third time, wherein the fourth time is time at which the electronic device decreases the frequency of the GPU last time before the first image is displayed.
  8. The method according to any one of claims 5-7, wherein the electronic device does not adjust the frequency of the GPU if the first end time exceeds the third time but does not exceed the first time.
  9. The method according to claim 8, wherein the method further comprises: if first end time corresponding to at least a first quantity of consecutive images exceeds the third time but does not exceed the first time, adjusting, by the electronic device, the frequency of the GPU through dynamic clock and voltage scaling DCVS.
  10. The method according to any one of claims 1-4, wherein the increasing, by the electronic device, a frequency of the GPU comprises: increasing, by the electronic device, an actual operating frequency of the GPU; and after the increasing, by the electronic device, a frequency of the GPU, the method further comprises: adjusting, by the electronic device, the frequency of the GPU through dynamic clock and voltage scaling DCVS.
  11. The method according to claim 10, wherein the method further comprises: if the frequency of the GPU is continuously increased more than a preset quantity of times, decreasing, by the electronic device, the frequency of the GPU to a first value through the DCVS, and increasing, by the electronic device, a minimum frequency of the GPU to a second value, wherein a frequency level to which the second value belongs is one level higher than a frequency level to which the first value belongs.
  12. The method according to any one of claims 2-4, wherein the electronic device further comprises a display; the displaying, by the electronic device, a first image comprises: at fifth time after the GPU completes the processing on the first image, driving, by the display driver, the display to display the first image; and the method further comprises: obtaining, by the electronic device, the fifth time and the second time; adding, by the electronic device, a refresh cycle of the display to the fifth time to obtain sixth time; and determining, by the electronic device, a time point between the second time and the sixth time as the first time point, wherein a proportion of a time interval between the time point and the second time in a time interval between the second time and the sixth time is a first proportion.
  13. An electronic device, comprising a display, one or more processors, and one or more memories, wherein the one or more processors are coupled to the display and the one or more memories, the one or more memories are configured to store computer program code, the computer program code comprises computer instructions, and when the one or more processors execute the computer instructions, the electronic device is enabled to perform the method according to any one of claims 1-12.
  14. A computer-readable storage medium, comprising instructions, wherein when the instructions are run on an electronic device, the electronic device is enabled to perform the method according to any one of claims 1-12.

Description

This application claims priority to Chinese Patent Application No. 202311240144.X, filed with the China National Intellectual Property Administration on September 22, 2023 and entitled "FREQUENCY SCALING METHOD AND ELECTRONIC DEVICE", which is incorporated herein by reference in its entirety. TECHNICAL FIELD Embodiments of this application relate to the field of terminal technologies, and in particular, to a frequency scaling method and an electronic device. BACKGROUND In an electronic device such as a mobile phone or a tablet, a graphics processing unit (Graphics Processing Unit, GPU) is an important component for completing image processing. Image processing may include image rendering and image composition. Generally, if a frequency of the GPU is higher, stronger computing power is provided, and efficiency of image processing is higher. If a frequency of the GPU is higher, the GPU provides weaker computing power, and correspondingly, efficiency of image processing is lower. Therefore, the electronic device may adjust the frequency of the GPU to meet an efficiency requirement of image processing. In the conventional technology, the electronic device may select an appropriate frequency based on usage (GPU_busy) of the GPU. For example, if the usage is continuously above 90% for specific duration, it indicates that when the GPU runs at a current frequency, there is little idle time. Therefore, the electronic device may increase the frequency of the GPU, so that the GPU can have more idle time to meet a requirement for more efficient processing. However, in the foregoing conventional technology, the electronic device increases the frequency of the GPU only after the usage is continuously above 90% for specific duration. The frequency increase is hysteretic, a real-time image processing requirement is not met, and a frame loss may be caused. SUMMARY This application provides a frequency scaling method and an electronic device, to adjust a frequency of a GPU based on a processing progress of the GPU for a current frame of image, so as to ensure that a frame loss does not occur. To achieve the foregoing objective, the following technical solutions are used in this application. According to a first aspect, this application provides a frequency scaling method, applied to an electronic device. The electronic device includes a graphics processing unit GPU. The electronic device displays a first image. Within a first time range for displaying the first image, the electronic device detects whether first end time at which a GPU completes processing on a second image exceeds first time, where the second image and the first image are two consecutive frames of images, and the first time is within the first time range. The electronic device increases a frequency of the GPU if the first end time exceeds the first time. The electronic device displays the second image after the GPU completes the processing on the second image. In other words, when the electronic device displays the first image (that is, a former frame of image in the two consecutive frames of images), the electronic device may process the second image (that is, a latter frame of image in the two consecutive frames of images). In addition, if the GPU does not complete image processing (for example, image rendering and composition) before the first time in a processing process, it indicates that the GPU cannot complete image processing on the second image in a timely manner, and the electronic device may increase the frequency of the GPU, to avoid a frame loss. In this way, the electronic device may increase the frequency of the GPU based on a case that the GPU cannot complete image processing in a timely manner in a processing process of the second image. In one aspect, the electronic device enables the GPU to obtain the second image through processing in a timely manner, to ensure that a frame loss does not occur. In another aspect, the electronic device does not increase the frequency of the GPU in a case that the GPU can complete image processing in a timely manner, so that a resource waste is not caused. In a possible design manner of the first aspect, the electronic device further includes a display driver and a hardware composer HWC. The first time is after second time at which the display driver starts waiting for the GPU to complete the processing on the second image, and after receiving a composition result of the HWC for the second image, the display driver starts waiting for the GPU to complete the processing on the second image. When the display driver starts waiting for the GPU to complete image processing, it indicates that a CPU basically completes related processing of sending an image for display. Then, whether a frame loss occurs mainly depends on operating efficiency of the GPU. Therefore, preset time T0 is configured to be time after the display driver starts waiting for the GPU to complete image processing, and under the impact of only th