Display screen refreshing method and related device
By skipping frames when the display does not generate new image frames, the power consumption loss and screen flickering caused by repeated display refresh are solved, and normal image display is achieved when necessary.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-14
- Publication Date
- 2026-03-17
AI Technical Summary
When the display screen of an electronic device does not generate image frames for a long time or the frame rate is lower than the refresh rate, it will result in power loss and may cause screen flickering problems caused by the display screen repeatedly refreshing the same image.
When no new image frames are generated on the display, frame skipping is used to avoid refreshing and maintain the image frames on the display until a certain threshold condition is met or the refresh rate is reduced, ensuring that new image frames are refreshed normally when necessary.
It reduces power consumption of electronic devices, avoids screen flickering caused by prolonged periods without a refreshed display, and ensures normal display of image frames when needed.
Smart Images

Figure CN121686971A_ABST
Abstract
Description
[0001] This application is a divisional application of Chinese Patent Application No. 2024112966810, filed on September 14, 2024, entitled "A method for refreshing a display screen and related apparatus". Technical Field
[0002] This application relates to the field of terminal technology, and in particular to a method and apparatus for refreshing a display screen. Background Technology
[0003] After generating an image frame, the electronic device sends it to the display screen. The display screen can refresh the displayed image according to the refresh rate, thus presenting a continuous and smooth display effect. For example, the display screen of an electronic device can refresh the displayed image at a fixed refresh rate of 60Hz, 90Hz, or 120Hz.
[0004] However, refreshing the display screen of electronic devices can lead to significant power consumption. For example, if an electronic device does not generate image frames for an extended period, or generates image frames at an extremely low frame rate, the display may show the same repetitive image even after multiple refreshes. Conversely, if an electronic device continuously generates image frames, but the frame rate is lower than the refresh rate (e.g., when playing video), the video consists of multiple consecutive video frames (i.e., image frames). If the video's frame rate is lower than the device's refresh rate, the display may refresh two or more times before showing a new image. Both of these situations result in increased power consumption for the electronic device. Summary of the Invention
[0005] To address the aforementioned issues, this application provides a display refresh method and related apparatus, with the aim of reducing power consumption losses in electronic devices.
[0006] In one aspect, this application provides a method for refreshing a display screen, which can be applied to an electronic device, such as a mobile phone, tablet computer, or laptop computer. The electronic device may include a first application and a display screen, such as a video playback application, a social communication application, or an information reading application.
[0007] In this method, during the process of displaying a first image frame on the screen, a first application can generate a second image frame; at a first moment, the electronic device receives a first Vsync signal, and then, in response to the first Vsync signal, the electronic device can display the second image frame on the screen; after the first moment, the first application does not generate an image frame until the second moment, at the second moment, the electronic device receives a second Vsync signal, and then, in response to the second Vsync signal, the electronic device can maintain the display of the second image frame on the screen without performing a refresh operation, wherein the first moment is later than the second moment.
[0008] For example, a display cycle is defined between two consecutive Vsync signals. During display cycle 1, the display screen shows a first image frame, and the first application generates a second image frame. At a first moment, the electronic device receives the first Vsync signal, indicating the end of display cycle 1 and entering display cycle 2. In response to the first Vsync signal, the electronic device can refresh and display the newly generated second image frame on the screen. During display cycle 2, the display screen shows the second image frame, and the first application does not generate any image frames. At a second moment, the electronic device receives the second Vsync signal, indicating the end of display cycle 2 and entering display cycle 3. During display cycle 2 between the first and second moments, the first application does not generate any image frames. During display cycle 3, in response to the second Vsync signal, the electronic device can maintain the display of the second image frame without performing a refresh operation on the screen.
[0009] In this way, if the first application does not generate an image frame, the display screen can continue to display the previous second image frame without performing a refresh operation, thus avoiding the power loss caused by the display screen performing a refresh operation and still displaying repeated image frames.
[0010] In one possible implementation, the refresh method of the display screen may further include: while the display screen is maintaining the display of the second image frame, the first application generates a third image frame; at a third moment, the electronic device receives a third Vsync signal, and in response to the third Vsync signal, the electronic device can refresh and display the third image frame on the display screen.
[0011] For example, a display cycle is defined between two consecutive Vsync signals. During display cycle 3 following the second moment, the second image frame is displayed on the screen. At the third moment, the electronic device receives the third Vsync signal, indicating the end of display cycle 3 and the start of display cycle 4. During display cycle 3 between the second and third moments, the first application generates the third image frame. During display cycle 4, in response to the third Vsync signal, the electronic device can perform a refresh operation on the screen to refresh and display the third image frame.
[0012] Thus, when the first application generates a new image frame, the electronic device can perform a refresh operation on the display screen to refresh and display the third image frame, thus avoiding affecting the normal display of the new image frame.
[0013] In one possible implementation, the refresh method of the display screen may further include: between a first moment and a fourth moment, the first application does not generate an image frame; at the fourth moment, the electronic device receives a fourth Vsync signal; and the electronic device may, in response to the fourth Vsync signal, refresh and display a second image frame on the display screen.
[0014] For example, a display cycle exists between two consecutive Vsync signals. During display cycle 3 following the second moment, no refresh operation is performed on the display screen, and the second image frame is maintained. At the fourth moment, the electronic device receives the fourth Vsync signal, indicating the end of display cycle 3 and the start of display cycle 4. During display cycle 3 between the second and fourth moments, the first application does not generate an image frame. During display cycle 4, in response to the fourth Vsync signal, the electronic device can perform a refresh operation on the display screen, refreshing and displaying the second image frame.
[0015] In this way, if the electronic device does not perform a refresh operation on the display screen to maintain the display of the second image frame, but the first application does not generate a new image frame, the electronic device can perform a refresh operation on the display screen again to refresh and display the repeated second image frame. This avoids problems such as screen flickering caused by not refreshing the display screen for a long time, and can maintain the performance of the electronic device.
[0016] In one possible implementation, between the first and fourth time points, the first application does not generate an image frame, and the electronic device receives N Vsync signals, where N is greater than 0, for example, N=1. At the second time point between the first and fourth time points, the electronic device receives a second Vsync signal; or, for example, N=2. At the second time point between the first and fourth time points, the electronic device receives a second Vsync signal. At a time point between the second and fourth time points, the electronic device may receive another Vsync signal, and in response to this Vsync signal, the electronic device may also maintain the display of the second image frame on the display screen without performing a refresh operation.
[0017] This indicates that the electronic device can maintain the display of the second image frame without performing a refresh operation on the display screen once or multiple times. Subsequently, if the first application does not generate a new image frame, the electronic device can perform a refresh operation on the display screen again to refresh and display the repeated second image frame. This can further reduce power consumption and also avoid problems such as screen flickering caused by not refreshing the display screen for a long time.
[0018] In one possible implementation, before the electronic device refreshes and displays the second image frame on the display screen in response to the fourth Vsync signal, the refresh method of the display screen further includes: the electronic device determining that the number of times the display screen does not perform a refresh action reaches a first threshold, for example, determining that the number of times the display screen does not perform a refresh action consecutively reaches the first threshold.
[0019] For example, if the first threshold is 1, and there is a display cycle between two consecutive Vsync signals, then during display cycle 3 after the second moment, no refresh operation is performed on the display screen, and the second image frame is maintained. At the fourth moment, the electronic device receives the fourth Vsync signal, indicating the end of display cycle 3 and the start of display cycle 4. During display cycle 3 between the second and fourth moments, the first application does not generate an image frame, and the number of times the display screen does not perform a refresh operation reaches 1. During display cycle 4, in response to the fourth Vsync signal, the electronic device can perform a refresh operation on the display screen, refreshing and displaying the second image frame.
[0020] For example, the number of times the display screen does not refresh can be determined by the number of frame skips. The electronic device can calculate the number of frame skips in response to the Vsync signal. Based on the above example, and taking a frame skip count of 1 as an example, in the display cycle 3 after the second moment, no refresh action is performed on the display screen, and the second image frame is maintained. It is determined that the number of times the display screen does not perform a refresh action is 1, and the electronic device can decrement the frame skip count by 1. In the display cycle 4, the electronic device responds to the fourth Vsync signal and determines that the frame skip count is 0. It can then be determined that the number of times the display screen does not perform a refresh action reaches 1, and the electronic device can perform a refresh action on the display screen to refresh and display the second image frame.
[0021] For example, if the first threshold is 2, and there is a display cycle between two consecutive Vsync signals, then during display cycle 3 after the second moment, no refresh operation is performed on the display screen, and the second image frame is maintained. Similarly, during display cycle 4 after display cycle 3, no refresh operation is performed on the display screen, and the second image frame is maintained. At the fourth moment, the electronic device receives the fourth Vsync signal, indicating the end of display cycle 4 and the start of display cycle 5. During display cycles 3 and 4 between the second and fourth moments, the first application does not generate any image frames, and the number of consecutive times the display screen does not perform a refresh operation reaches 2. During display cycle 5, in response to the fourth Vsync signal, the electronic device can perform a refresh operation on the display screen, refreshing and displaying the second image frame.
[0022] In this way, the number of times the display screen does not perform a refresh action can be limited based on the first threshold, which can more accurately avoid problems such as screen flickering caused by prolonged periods without refreshing the display screen, thereby maintaining the performance of electronic devices.
[0023] In one possible implementation, during a first period between a first moment and a second moment, where the first period is a display cycle, the display screen continuously displays the second image frame. The refresh method of the display screen further includes: between the first moment and a fifth moment, the first application does not generate an image frame; at the fifth moment, the electronic device receives a fifth Vsync signal, and in response to the fifth Vsync signal, the electronic device can refresh and display the second image frame on the display screen; at the sixth moment, the electronic device receives a sixth Vsync signal; during a second period between the fifth moment and the sixth moment, where the second period is a display cycle, the display screen continuously displays the second image frame; the duration of the first period is shorter than the duration of the second period, indicating that the frequency of refresh by the electronic device on the display screen has decreased, and the refresh rate has decreased.
[0024] Thus, if the electronic device does not perform a refresh operation on the display screen to maintain the display of the second image frame, but the first application does not generate a new image frame, the electronic device can perform a refresh operation on the display screen again to refresh and display the repeated second image frame, and reduce the refresh rate. The electronic device can continuously display the second image frame for a longer time between the fifth and sixth moments, which can reduce the power consumption of the electronic device.
[0025] In one possible implementation, between the first and fifth time points, the first application does not generate an image frame, and the electronic device receives L Vsync signals, where L is greater than 0, for example, L = 2. At the second time point between the first and fifth time points, the electronic device receives a second Vsync signal. At a time point between the second and fifth time points, the electronic device may receive another Vsync signal, and in response to this Vsync signal, the electronic device may refresh and display a second image frame on the display screen for a longer period of time before the arrival of the sixth time point.
[0026] Thus, if no new image frames are generated in the first application, the electronic device can reduce the refresh rate and display the second image frame for a longer period between the fifth and sixth moments, thereby reducing the power consumption of the electronic device.
[0027] In one possible implementation, before the electronic device refreshes and displays the second image frame on the display screen in response to the fifth Vsync signal, the refresh method of the display screen further includes: determining that the number of display cycles in which the first application has not continuously generated image frames reaches a second threshold, wherein the display cycle refers to the duration between two consecutive Vsync signals received by the electronic device.
[0028] For example, if the electronic device receives two Vsync signals at time 1 and time 2 respectively, and does not receive any Vsync signal between time 1 and time 2, then the time between time 1 and time 2 is the display period.
[0029] For example, the second threshold is 3. If the first application does not generate an image frame for three consecutive display cycles, the electronic device receives a fifth Vsync signal, indicating that the third display cycle of the three consecutive display cycles has ended and the next display cycle has begun. In response to the fifth Vsync signal, the electronic device can refresh and display a second image frame on the display screen.
[0030] In this way, when the number of consecutive display cycles in which no image frames are generated in the first application reaches a second threshold, the electronic device is considered to be in low power consumption, the refresh rate of the display screen is reduced, and thus the power consumption of the electronic device is reduced.
[0031] In one possible implementation, the refresh method of the display screen further includes: at a seventh moment, the electronic device receives a seventh Vsync signal; in response to the seventh Vsync signal, the electronic device determines that the first application has not generated an image frame between the second moment and the seventh moment, indicating that no new image frame has been generated after the second image frame; and the electronic device determines that the number of display cycles in which the first application has not generated an image frame consecutively has not reached a second threshold, where the display cycle refers to the duration between two consecutive Vsync signals received by the electronic device, indicating that the electronic device does not need to reduce the refresh rate; and the electronic device determines that the number of times the display screen does not perform a refresh operation has not reached a first threshold, indicating that a refresh operation can be avoided on the display screen. Subsequently, the electronic device does not perform a refresh operation on the display screen and maintains the display of the second image frame.
[0032] Thus, if it is determined that the first application has not generated an image frame, that the electronic device does not need to reduce the refresh rate, and that the refresh action can be avoided on the display screen, the electronic device will not perform a refresh action on the display screen and will continue to display the second image frame. This avoids affecting the normal display of the image frame on the one hand, and avoids problems such as screen flickering caused by the electronic device not performing a refresh action on the display screen for a long time on the other hand.
[0033] In one possible implementation, the display refresh method further includes: at an eighth time point, the electronic device receives an eighth Vsync signal; in response to this eighth Vsync signal, if the electronic device determines that the first application has generated an image frame between the second time point and the eighth time point, it indicates that a new image frame needs to be displayed; or, the electronic device determines that the number of display cycles in which the first application has not generated an image frame consecutively reaches a second threshold, where the display cycle refers to the duration between two consecutive Vsync signals received by the electronic device, which can be considered as the electronic device being in a low-power state, capable of reducing the refresh rate; or, the electronic device determines that the number of times the display screen does not perform a refresh action reaches a first threshold. If any one of the above three conditions is met, the electronic device refreshes and displays an image frame on the display screen. Specifically, if the first condition is met, the electronic device can refresh and display the latest image frame generated by the first application on the display screen; if the second or third condition is met, the electronic device can refresh and display the second image frame on the display screen.
[0034] Thus, when it is determined that the first application generates an image frame, or that the electronic device will reduce the refresh rate, or that the number of times the refresh action is not performed on the display screen reaches a first threshold, the electronic device performs a refresh action on the display screen to display the image frame. On the one hand, the newly generated image frame of the first application is displayed normally, and on the other hand, the screen flickering and other problems caused by the electronic device not performing a refresh action on the display screen for a long time are avoided.
[0035] In one possible implementation, the display refresh method further includes calculating a first threshold based on the ratio of the refresh rate of the second image frame to the lowest refresh rate. For example, the first threshold can be obtained by subtracting 1 from the ratio of the refresh rate of the second image frame to the lowest refresh rate. In this way, by calculating the first threshold considering the refresh rate of the second image frame displayed on the screen by the electronic device, the display is prevented from not performing refresh actions too many times, which could cause the refresh rate of the electronic device to fall below the latest refresh rate, thereby avoiding problems such as screen flickering.
[0036] In a second aspect, this application provides an electronic device including a memory and a processor; the memory stores computer program code, which includes computer instructions; one or more processors invoke the computer instructions to cause the electronic device to execute the display refresh method of the first aspect described above.
[0037] Thirdly, this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the display screen refresh method described in the first aspect.
[0038] Fourthly, this application provides a computer program product including computer program code, which, when executed by an electronic device, implements the display screen refresh method described in the first aspect. Attached Figure Description
[0039] Figure 1 This is a schematic diagram of a display screen refresh method provided in related technologies;
[0040] Figure 2 This is a schematic diagram of another display refresh method provided in related technologies;
[0041] Figure 3a Signaling interaction diagram of a display screen refresh method provided in an embodiment of this application;
[0042] Figure 3b A software architecture diagram of an electronic device provided in an embodiment of this application;
[0043] Figure 4 A schematic diagram illustrating a refresh rate provided in an embodiment of this application;
[0044] Figure 5 A schematic diagram illustrating the display of an image frame as provided in an embodiment of this application;
[0045] Figure 6 Signaling interaction diagram of another display screen refresh method provided in the embodiments of this application;
[0046] Figure 7 A schematic diagram illustrating a display screen refresh method provided in an embodiment of this application;
[0047] Figure 8 A schematic diagram illustrating the judgment logic of a display refresh method provided in an embodiment of this application;
[0048] Figure 9 A schematic diagram illustrating the judgment logic of another display refresh method provided in this application embodiment;
[0049] Figure 10 Signaling interaction diagram of another display screen refresh method provided in the embodiments of this application;
[0050] Figure 11 This is a schematic diagram of another display screen refresh method provided in an embodiment of this application. Detailed Implementation
[0051] To ensure clarity and conciseness in the description of the following embodiments, the terminology used in the embodiments of this application will first be explained. It should be understood that this explanation is for the purpose of better understanding the embodiments of this application and does not necessarily constitute a limitation on the embodiments of this application.
[0052] Refresh rate: refers to the number of image frames that an electronic device's display refreshes per second. For example, if the refresh rate of an electronic device is 60Hz, it means that the display of the electronic device can refresh and display 60 image frames per second.
[0053] Frame rate: refers to the number of image frames that an electronic device can generate and display per second. For example, if an electronic device's video playback application plays a video with a frame rate of 30fps, it means that the electronic device can send 30 frames of the video to the display screen in 1 second, and the display screen of the electronic device can display these 30 frames of video in 1 second.
[0054] Vsync (Vertical Synchronization) signal: This refers to a synchronization pulse signal emitted by an electronic device before its display refreshes to a new image frame. In some embodiments, the electronic device can emit Vsync signals based on its refresh rate; for example, if the refresh rate of the electronic device is 60Hz, it can emit Vsync signals 60 times per second.
[0055] Display cycle: refers to the duration during which the display screen of an electronic device shows the information between the times corresponding to the two consecutive Vsync signals when the electronic device receives two consecutive Vsync signals.
[0056] In related technologies, the refresh rate of an electronic device may be the same as its frame rate. The display of the electronic device refreshes once based on the refresh rate, allowing it to display a new image frame and providing a smoother visual experience. However, it is also possible for the frame rate of the electronic device to be lower than its refresh rate.
[0057] In scenarios where electronic devices are stationary, such as on a desktop, in the interface of an e-book application, or in the interface of a browser application, the screen of the electronic device may display static images for a long time, that is, display repeated image frames for a long time. The electronic device does not generate new image frames for a long time, or generates image frames at an extremely low frame rate.
[0058] like Figure 1As shown, the electronic device displays image frame 0 in the first display cycle. During the first display cycle, the electronic device can generate image frame 1. The process of generating image frame 1 includes: the GPU of the electronic device first renders the various layers of image frame 1; the CPU of the electronic device then composites the various layers of image frame 1 to obtain image frame 1. Upon receiving the Vsync signal, the electronic device can enter the second display cycle, and the LCD screen can refresh and display image frame 1. Similarly, in the second display cycle, the electronic device can generate image frame 2, and in the third display cycle, the electronic device can display image frame 2. After the third display cycle, no new image frame is generated, and the electronic device's display screen will refresh and repeatedly display image frame 2 based on a preset refresh rate.
[0059] Based on the scenario described above, it is evident that when an electronic device's display refreshes the screen based on the refresh rate, the same image may still be displayed even after multiple refreshes. This results in the display refreshing the same image frame multiple times, causing unnecessary power consumption and resulting in power loss.
[0060] When electronic devices are playing videos, their displays continuously update the image and show new frames. However, if the video frame rate is lower than the refresh rate, the screen may display the same image repeatedly after the refresh.
[0061] like Figure 2 As shown, for example, the video frame rate is 30fps, and the electronic device's refresh rate is 60Hz. In the first display cycle, the electronic device displays image frame 0, and in the first display cycle, the electronic device can generate image frame 1. Upon receiving the Vsync signal, the electronic device can enter the second display cycle, and the display screen can refresh and display image frame 1. In the second display cycle, the electronic device can generate image frame 2. Upon receiving the Vsync signal, the electronic device can enter the third display cycle, and the display screen can refresh and display image frame 2. In the third display cycle, the electronic device does not generate a new image frame. Upon receiving the Vsync signal, the electronic device can enter the fourth display cycle, and the display screen will refresh and display the same image frame 2. In the fourth display cycle, the electronic device can generate image frame 3, and so on. Subsequently, the electronic device will refresh and display the same image frame twice.
[0062] Based on the scenarios described above, it is evident that electronic device displays refresh the screen based on the refresh rate, which may result in the screen refreshing twice or even more before displaying a new image. This means that the display may refresh twice or even more for the same image frame, leading to unnecessary power consumption and resulting in power loss.
[0063] Therefore, in order to solve the above problems, this application provides a display screen refresh method. When the electronic device does not generate a new image frame in the previous display cycle, the electronic device may not refresh and display repeated image frames on the display screen in the current display cycle. This can also be called performing frame skipping operation to reduce power consumption.
[0064] First, we will introduce the refresh rate modes of electronic devices, including idle mode and the adaptive refresh rate mode provided in the embodiments of this application.
[0065] When an electronic device is in adaptive refresh rate mode, if a new image frame is generated in each display cycle, the display screen can refresh the displayed image frame based on a preset refresh rate. If no new image frame is generated in a display cycle, the display screen may not refresh, i.e., a frame skipping operation is performed. Figure 3a The first embodiment is described in detail. For example, when the adaptive refresh rate flag bit is True or 1, it indicates that the electronic device is in adaptive refresh rate mode.
[0066] When an electronic device is in idle mode, if no new image frames are generated during the device's display cycle, the screen will refresh and display repetitive image frames based on the refresh rate, and frame skipping is not possible. Figure 10 The following is a detailed description of Embodiment 3. For example, when the adaptive refresh rate flag is False or 0, it indicates that the electronic device is in idle mode.
[0067] It should be noted that the idle mode flag can also be set to False to indicate that the electronic device is in adaptive refresh rate mode, and the idle mode flag can be set to True to indicate that the electronic device is in idle mode. This application does not limit this.
[0068] Next, combined Figures 3a-11 This application provides a detailed description of the display screen refresh method provided in the embodiments.
[0069] Example 1:
[0070] The following section uses the example of an electronic device in adaptive refresh rate mode generating a new image frame in the previous display cycle to introduce the refresh method of the display screen in the current display cycle.
[0071] like Figure 3bAs shown, the Android operating system is used as an example for electronic devices. The Android system can adopt a layered architecture, with each layer having a clear role and division of labor. Layers communicate with each other through software interfaces. In some embodiments, the system is divided into five layers, from top to bottom: the Application (APP) layer, the Application Framework layer (also known as the Native framework layer), the Hardware Abstraction Layer (HAL), the Driver layer (also known as the Kernel layer), and the Hardware layer. It should be noted that mobile phones can also run the iOS operating system; this application does not limit this.
[0072] In some embodiments, the application layer includes a first application, the native layer includes the display engine service SurfaceFlinger, the HAL layer includes the compositor HardwareComposer (HWC), the kernel layer includes the display driver, and the hardware layer includes the display screen.
[0073] like Figure 3a As shown, combined with Figure 3b The software structure of the electronic device shown includes a refresh method for the display screen that may include the following steps:
[0074] S301: The first application stores image data in the rendering buffer.
[0075] Image data describes the attributes of the image frame to be generated, such as pixel values, color, and transparency. The rendering buffer is used to temporarily store image data.
[0076] In some embodiments, the image data can be drawn by a first application. For example, the first application is a social communication application, a gallery application, a consultation and reading application, etc. The first application can draw image data of the application interface. For example, a consultation and reading application can draw the text of an e-book in response to a user's viewing operation; another example is a social communication application, which can draw pinyin characters, emoticons, etc. in response to a user's triggering operation on a chat box.
[0077] In some embodiments, the image data may also be decoded by a first application. For example, the first application may be a video playback application, which, in response to a user's playback operation on a video, can decode the video to obtain image data.
[0078] S302: SurfaceFlinger reads image data from the rendering buffer.
[0079] In some embodiments, SurfaceFlinger can read image data from the render buffer and render based on the refresh rate. For example, with a refresh rate of 60Hz, SurfaceFlinger can read image data from the render buffer 60 times per second and render it, or read image data from the render buffer and render it once every 16.7ms.
[0080] The MIPI driver can send the APP_Vsync signal to SurfaceFlinger based on the refresh rate. For example, if the refresh rate is 60Hz, the MIPI driver can send the APP_Vsync signal to SurfaceFlinger once every 16.7ms. SurfaceFlinger responds to the APP_Vsync signal by reading image data from the rendering buffer and rendering it.
[0081] like Figure 3b As shown, the MIPI driver, also known as the Display Serial Interface (DSI) driver, is a component of the display driver. The DSI driver can call the hardware-level DSI interface to send the APP_Vsync signal to SurfaceFlinger.
[0082] S303: SurfaceFlinger renders multiple layers based on image data.
[0083] In some embodiments, SurfaceFlinger can invoke a graphics processing unit (GPU) to render multiple layers based on image data.
[0084] For example, taking a video playback application as the first application, multiple layers may include video frames, progress bars, comment sections, etc.
[0085] It should be noted that the example of SurfaceFlinger rendering multiple layers based on image data is only for illustration. SurfaceFlinger may also render a single layer based on image data, and this application does not limit this.
[0086] S304: SurfaceFlinger calls HWC to composite multiple layers to obtain an image frame.
[0087] In some embodiments, SurfaceFlinger can also call HWC based on the refresh rate to synthesize multiple layers into an image frame.
[0088] For example, the MIPI driver can send the SF_Vsync signal to SurfaceFlinger based on the refresh rate. For example, if the refresh rate is 60Hz, the MIPI driver can send the SF_Vsync signal to SurfaceFlinger once every 16.7ms. SurfaceFlinger can respond to the SF_Vsync signal by calling HWC to composite multiple layers to obtain an image frame.
[0089] like Figure 3b As shown, the DSI driver can call the hardware layer's DSI interface to send the SF_Vsync signal to SurfaceFlinger.
[0090] S305: SurfaceFlinger sends a commit to the display driver via HWC.
[0091] The `commit` command is used to indicate that the display driver has created a new image frame.
[0092] In some embodiments, the commit may carry a pre-set refresh rate, such as the refresh rate of a video frame.
[0093] S306: The display driver responds to commit by updating the composition flag to 1 and the idle flag to 0.
[0094] The compositing flag is used to indicate the compositing status of an image frame. For example, a compositing flag of 1 indicates that a new image frame has been composited, and a compositing flag of 0 indicates that no new image frame has been composited.
[0095] It should be noted that setting the synthesis flag to 1 or 0 is only an example; it can be any other value, as long as it can distinguish whether a new image frame has been synthesized.
[0096] The commit is sent by surfaceFlinger to the display driver via HWC after the image frame is composited. Therefore, the display driver can update the composite flag to 1 in response to commit.
[0097] Idle refers to a state in which an electronic device is in a low-power state, such as when the electronic device does not generate new image frames for a long time, or generates new image frames at a very low frame rate.
[0098] To solve this problem, when an electronic device is in idle mode, it can enter idle mode and reduce the refresh rate, which can also be referred to as lowering the refresh rate.
[0099] The idle flag is used to count display cycles in which no new image frames are generated. When the idle flag equals M, it indicates that the electronic device has not generated a new image frame for M-1 consecutive display cycles (this can also be described as the number of consecutive display cycles without image frames reaching a second threshold). This indicates that the electronic device is in a low-power state and will enter idle mode. When the idle flag is less than M, it indicates that the electronic device will not enter idle mode. M can be any pre-set value greater than 1.
[0100] When the display driver receives a commit, it indicates that a new image frame has been generated. The electronic device does not need to enter idle mode, and the idle flag can be recounted, so the display driver can update it to 0.
[0101] It should be noted that the display driver updating the idle flag to 0 upon receiving a commit is just an example; it can also be updated to other values, which can indicate recounting the display cycles in which the electronic device has not received a commit.
[0102] For a detailed introduction to idle mode, please refer to Example 3 below, which will not be elaborated here.
[0103] S307: SurfaceFlinger stores image frames in the display buffer.
[0104] The rendering buffer is used to temporarily store image frames.
[0105] SurfaceFlinger stores the synthesized image frames in the display buffer via HWC.
[0106] It should be noted that when SurfaceFlinger renders a layer based on image data, SurfaceFlinger can also call HWC to store the image frame in the display buffer without executing S304.
[0107] S308: The display driver reads the image frame synthesized by HWC from the display buffer.
[0108] In some embodiments, the display driver may read image frames in response to a commit. Accordingly, S307 may be executed first, followed by S305.
[0109] S309: Display driver receives Vsync signal.
[0110] In some embodiments, S301-S308 described above can be executed within the previous display cycle. When the display driver receives the Vsync signal, it indicates that the previous display cycle has ended and the current display cycle will begin.
[0111] Combination Figure 1 As shown, for example, when an electronic device generates a new image frame 2 in the second display cycle, it receives a Vsync signal, indicating that the second display cycle has ended and the third display cycle will begin.
[0112] In some embodiments, the MIPI driver can send a Vsync signal to the display driver based on the refresh rate. For example, if the refresh rate is 120Hz, the MIPI driver can send a Vsync signal to the display driver once every 8.3ms.
[0113] like Figure 3b As shown, the MIPI driver can call the hardware layer's DSI interface to send the Vsync signal to the display driver.
[0114] The Vsync signal, along with the APP_Vsync and SF_Vsync signals mentioned above, is sent based on the refresh rate, but there are some differences in their phases. For example, after the MIPI driver sends the APP_Vsync signal to SurfaceFlinger, it waits 2ms before sending the SF_Vsync signal to SurfaceFlinger. Then, 2ms later, the display driver sends the Vsync signal to the display driver.
[0115] S310: The display driver responds to the Vsync signal by incrementing the idle flag by 1.
[0116] Based on the above description of S306, the idle flag is used to count display cycles in which no new image frames have been generated. After receiving the Vsync signal, the display driver can increment the idle flag by 1. When the idle flag is 1, it indicates that a new image frame was generated in the previous cycle, and there is no need to enter idle mode again.
[0117] It should be noted that adding 1 to the idle flag is just an example; other values can also be added to achieve the counting effect.
[0118] S311: The display driver checks if the idle flag is equal to M; otherwise, it executes S312.
[0119] Based on the description of S310, the idle flag is 1 and M is a value greater than 1. Therefore, the display driver can determine that the idle flag is not equal to M and can continue to execute S312.
[0120] It should be noted that an example where the idle flag is equal to M can be found in the description of Example 3 below.
[0121] It should be emphasized that S311 is an optional execution step, and can be omitted if the synthesis flag is set to 1.
[0122] S312: The display driver determines that the composition flag bit is 1 and sends the image frame and clock signal to the display screen.
[0123] It should be understood that the display driver typically sends image frames at a fixed time. During the remaining duration of a display cycle, the display driver can send a clock signal to the display to fill the cycle. The clock signal has the same number of rows and columns as the image frame resolution. The clock signal is non-display data, and the display does not need to respond upon receiving it.
[0124] like Figure 4 As shown, the duration for the display driver to send image frames to the display screen is fixed at different refresh rates, for example, 7ms. With an electronic device refresh rate of 120Hz, one display cycle lasts approximately 8.3ms, leaving 1.3ms for the display driver to send a clock signal to the display screen. With an electronic device refresh rate of 60Hz, one display cycle lasts approximately 16.7ms, leaving 9.7ms for the display driver to send a clock signal to the display screen. With an electronic device refresh rate of 30Hz, one display cycle lasts approximately 26.7ms, leaving 19.7ms for the display driver to send a clock signal to the display screen.
[0125] Based on the above description of S306, the composite flag bit is updated to 1, indicating that a new image frame was generated in the previous display cycle, and the current display cycle can display the new image frame. Therefore, the display driver can send the image frame and clock signal to the display screen based on the preset refresh rate.
[0126] S313: The display screen refreshes the display image based on a preset refresh rate in response to receiving image frames and clock signals.
[0127] Once the display screen receives the image frame, it can refresh the display screen based on a preset refresh rate to show the user the content corresponding to the image frame.
[0128] S314: The display driver updates the composition flag to 0.
[0129] A new image frame has been sent to the display screen. If no new image frame is generated, the display driver can reset the composition flag to 0.
[0130] Combination Figure 3bAs shown, HWC can include a commit module. SurfaceFlinger can send a commit to the display driver through the commit module, which means executing S305 described above. The display driver includes a judgment driver and a DSI driver. The judgment driver can execute S306, S308, S310-S312, and S314 described above, and the DSI driver can execute S309 described above.
[0131] Combination Figure 5 As shown, the electronic device includes an AP (indicating the part of the electronic device other than the display screen) and a module (including the display panel). The DSI can send the APP_Vsync signal to render the layer. The DSI can send the SF_Vsync signal to synthesize the image frame. Then the DSI interface can send the image frame to the panel. For detailed information, please refer to Embodiment 1, which will not be repeated here.
[0132] Furthermore, it should be understood that in the embodiments of this application, if the electronic device does not generate a new image frame in one display cycle, the display screen will not refresh in the next display cycle, thus reducing power consumption (see Embodiment 2 for detailed information). However, if the electronic device does not generate a new image in several consecutive display cycles, continuous frame skipping can easily lead to problems such as screen flickering. Therefore, a frame skipping number can be preset to avoid excessive frame skipping on the display screen.
[0133] Therefore, to address this issue, the display driver can calculate the number of frame skips. In some embodiments, the number of frame skips can be calculated based on the current refresh rate of the electronic device (also referred to as the refresh rate of the second image frame, which is the refresh rate of the most recently generated image frame by the first application) and the minimum refresh rate. In a display cycle where a new image frame is generated, the display driver can determine the current refresh rate based on the refresh rate carried in the commit. In a display cycle where no new image frame is generated, the display driver can determine the current refresh rate based on the refresh rate carried in the most recent commit of the previous display cycle, and then round down the ratio of the current refresh rate to the minimum refresh rate and subtract 1 to obtain the number of frame skips.
[0134] For example, if the current refresh rate is 120Hz and the minimum refresh rate is 30Hz, the number of frame skips is 3; if the current refresh rate is 60Hz and the minimum refresh rate is 30Hz, the number of frame skips is 1; if the current refresh rate is 40Hz and the minimum refresh rate is 30Hz, the number of frame skips is 0.
[0135] In some embodiments, the display driver may calculate the number of frame skips once after receiving a Vsync signal, that is, it may be calculated once per display cycle. This application does not limit this.
[0136] In this embodiment, considering that the number of frame skips is related to the current refresh rate, the display driver can calculate the number of frame skips once after obtaining the refresh rate carried by a commit, so as to use it within the display cycle in which frame skipping will occur. For relevant examples, please refer to the description of Embodiment 2. For example, it can be calculated after executing S312. This application does not limit this, and it can also be calculated once in each display cycle, or it can be calculated in the display cycle in which no new image frames are generated.
[0137] Thus, when the electronic device is in adaptive refresh rate mode, the electronic device generates a new image frame, which can be sent to the display normally without affecting the normal display of the new image frame.
[0138] It should be noted that during the execution of S312, even if the number of frame skips is greater than 0, if the synthesis flag is 1, that is, if the first application generates a new image frame, the electronic device will still refresh the display screen, that is, refresh and display the screen corresponding to the new image frame (also known as refreshing the display image frame). See Embodiment 2 for details. Figure 7 Related explanations.
[0139] Example 2:
[0140] The following section describes the refresh method of the display screen in the current display cycle and the next display cycle, taking an electronic device in adaptive refresh rate mode as an example. The electronic device does not generate new image frames in the previous display cycle, the current display cycle, and the next display cycle, and displays image frames normally in the previous display cycle, with a frame skipping count of 1.
[0141] like Figure 6 As shown, combined with Figure 3b The software structure of the electronic device shown includes a refresh method for the display screen that may include the following steps:
[0142] S601: Display driver receives Vsync signal.
[0143] If the electronic device does not generate a new image frame in the previous display cycle, the display driver receives the Vsync signal, indicating that the previous display cycle has ended and the current display cycle will begin.
[0144] Combination Figure 7As shown, for example, in Embodiment 2, the previous display cycle is the third display cycle. During the second display cycle, the first application generates image frame 2 (also referred to as the second image frame), and the display screen displays image frame 1 (also referred to as the first image frame). Subsequently, at the end of the second display cycle, the display driver receives a Vsync signal (also referred to as the electronic device receiving the first Vsync signal at the first moment), indicating that the third display cycle has begun. The electronic device can refresh and display image frame 2 on the display screen. In the third display cycle, the electronic device does not generate a new image frame (also referred to as the first application not generating an image frame between the first and second moments), and displays image frame 2 on the display screen. At the end of the third display cycle, after the display driver receives the Vsync signal (that is, S601 is executed, also referred to as the electronic device receiving the second Vsync signal at the second moment), it indicates that the third display cycle has ended and the fourth display cycle will begin.
[0145] It should be noted that other implementations of S601 can be found in the description of S309 in Embodiment 1, and will not be repeated here.
[0146] S602: The display driver responds to the Vsync signal by incrementing the idle flag by 1.
[0147] S603: The display driver checks if the idle flag is equal to M; otherwise, it executes S604.
[0148] It should be noted that the implementation methods of S602-S603 can be found in the description of S309-S310 in Embodiment 1, and will not be repeated here.
[0149] Combination Figure 7 As shown, assuming M equals 5, the previous display cycle in Example 2 is the third display cycle. The electronic device generates a new image frame 2 in the second display cycle, indicating that the idle flag bit is updated to 1 based on the received Vsync signal at the end of the second display cycle. The electronic device does not generate a new image frame in the third display cycle, indicating that no commit is received in the third display cycle, and the idle flag bit is still 1 and is not set to 0. At the end of the third display cycle, based on the received Vsync signal, the idle flag bit +1 equals 2. In the fourth display cycle, the display driver can determine that the idle flag bit is not equal to M, and there is no need to enter idle mode in the fourth display cycle.
[0150] S604: The display driver determines that the composition flag is not 1, the frame skipping count is not 0, and the adaptive refresh rate flag is True, and sends the clock signal to the display screen.
[0151] In some embodiments, the number of frame skips can be calculated based on the current refresh rate and the minimum refresh rate. Refer to Embodiment 1 for an introduction to the number of frame skips. If no new image frame is generated in the previous display cycle, the number of frame skips can be calculated based on the display cycle in which the most recent new image frame was generated.
[0152] Combination Figure 7 As shown, in Embodiment 2, the previous display cycle is the third display cycle. The electronic device generates a new image frame 2 in the second display cycle and calculates the frame skipping number as 1. The electronic device does not generate a new image frame in the third display cycle, indicating that no commit is received in the third display cycle. In the fourth display cycle, the current refresh rate can be obtained using the second display cycle, and the frame skipping number is still 1.
[0153] In Example 2, no new image frame was generated in the previous display cycle, the synthesis flag bit in the current display cycle is not 1, the frame skipping number is 1 and not 0, the next display cycle does not enter idle mode, the adaptive refresh rate flag bit is still True, indicating that the electronic device is in adaptive refresh rate mode and can skip frames. Therefore, the display driver can send the clock signal to the display screen without sending repeated image frames to the display screen.
[0154] S605: The display screen receives clock signals.
[0155] If the display screen does not receive an image frame in the current display cycle, but only a clock signal, it may not refresh or respond to the display. (Based on S601) Figure 7 For example, it can also be said that the electronic device responds to the second Vsync signal by not performing a refresh operation on the display screen and maintaining the display of the second image frame.
[0156] For example, after receiving a clock signal, the display screen may ignore the clock signal and not respond at all, or it may use the clock signal to detect errors in the data transmission process and take corresponding measures to recover. This application does not limit this.
[0157] Thus, when an electronic device is in adaptive refresh rate mode, without generating new image frames and with the number of frame skips not being zero, the display screen of the electronic device can remain refreshed, thereby reducing the power consumption of the electronic device.
[0158] S606: The display driver will reduce the frame skipping count by 1.
[0159] In Example 2, the frame skipping count is 1. After the display screen skips a frame once, the display driver can subtract 1 from the frame skipping count to get a frame skipping count of 0.
[0160] S607: Display driver receives Vsync signal.
[0161] If the electronic device does not generate a new image frame during the current display cycle, the display driver receives the Vsync signal, indicating that the current display cycle has ended and the next display cycle will begin.
[0162] Based on the S601 example, combined with Figure 7 As shown, for example, in Embodiment 2, the current display cycle is the fourth display cycle. The electronic device does not generate a new image frame during the fourth display cycle. The display screen still shows image frame 2 during the fourth display cycle, but the screen is not refreshed; it is an empty frame. Subsequently, upon receiving the Vsync signal, it indicates that the fourth display cycle has ended and the fifth display cycle will begin.
[0163] It should be noted that other implementations of S607 can be found in the description of S309 in Embodiment 1, and will not be repeated here.
[0164] S608: The display driver responds to the Vsync signal by incrementing the idle flag by 1.
[0165] S609: The display driver checks if the idle flag is equal to M; otherwise, it executes S609.
[0166] Based on the S603 example, combined with Figure 7 As shown, assuming M equals 5, at the end of the third display cycle, based on the received Vsync signal, the idle flag bit +1 equals 2 (see S602 described above). No new image frame is generated in the fourth display cycle either. At the end of the fourth display cycle, based on the received Vsync signal, the idle flag bit +1 equals 3 (see S608 described above). The display driver can determine that the idle flag bit is not equal to M, and there is no need to enter idle mode in the fifth display cycle.
[0167] S610: The display driver determines that the frame skipping count is 0 and sends the repeated image frames and clock signals to the display screen.
[0168] If the display has skipped frames in the current display cycle, making the frame skipping count 0, in the next display cycle, the display driver can determine that the frame skipping count is 0 (also known as the number of times the display has not performed a refresh action has reached the first threshold, and the value of the frame skipping count is the first threshold), indicating that there will be no more frame skipping in the next display cycle. Therefore, the image frame displayed in the previous display cycle is sent to the display as a repeated image frame and clock signal.
[0169] S611: The display screen responds to receiving repeated image frames and clock signals by refreshing the display of repeated images based on a preset refresh rate.
[0170] like Figure 7As shown, assuming that the next display cycle of Embodiment 2 is the fifth display cycle (also referred to as the end time of the fourth display cycle being the fourth moment, when the display driver receives the fourth Vsync signal), in the fifth display cycle, the display screen also displays image frame 2 (also referred to as the second image frame), but image frame 2 is repeatedly sent to the display screen, and the display screen refreshes and displays the repeated image frame 2 based on a preset refresh rate.
[0171] Furthermore, in some embodiments, after the display refreshes and displays repeated image frames, the frame skipping count can be recalculated. Since no new image frames have been generated, it indicates that the current refresh rate remains unchanged (see the description of S604), and the frame skipping count can be calculated to still be 1.
[0172] See also Figure 7 For example, in Embodiment 2, the next display cycle is the fifth display cycle. In the fifth display cycle, the display screen refreshes and displays the repeated image frame 2. No image frame is generated in the fifth display cycle, so S601-605 can be executed repeatedly. The synthesis flag bit is 0. The sixth display cycle will not enter idle mode, and the number of frame skips is not 0. Therefore, in the sixth display cycle, the display screen only receives the clock signal and does not refresh.
[0173] See also Figure 7 As shown, in the sixth display cycle, image frame 2 (also referred to as the second image frame) is displayed on the screen. The first application can generate image frame 3 (also referred to as the third image frame). That is, at the end of the sixth display cycle (also referred to as the third moment), the display driver can receive the Vsync signal (also referred to as the third Vsync signal), indicating the start of the seventh display cycle. In response to the Vsync signal, the display driver determines that the synthesis flag bit is 1, and can send image frame 3 and the clock signal to the screen. Subsequently, image frame 3 can be refreshed and displayed on the screen. For a detailed description of the steps, please refer to Embodiment 1, which will not be repeated here.
[0174] Combination Figure 8 As shown, when a new image frame is generated, SurfaceFlinger can send a commit (also known as AtomicCommit) to the display driver via HWC. After receiving the Vsync signal, the driver can determine whether a commit has been received between this Vsync signal and the previous Vsync signal, or whether the frame skipping count is 0, or whether it has entered idle mode. If any of these three conditions are met, the display cannot perform frame skipping but instead performs a refresh operation (also known as a refresh action). If none of the above three conditions are met, the display can perform frame skipping. Specifically, if the driver determines that the idle flag is equal to M, it can determine that it has entered idle mode and reduces the refresh rate.
[0175] Combination Figure 9 As shown, after receiving the Vsync signal, the display driver can first calculate the number of frame skips. Then, the display driver can determine whether a commit has been received (e.g., whether the composition flag is 1), or whether the number of frame skips is 0, or whether it has entered idle mode (e.g., whether the idle flag is equal to M). If any of the above three conditions are met, the display cannot perform a frame skip operation. If none of the above three conditions are met, the display can perform a frame skip operation.
[0176] Thus, on the one hand, the display screen does not need to refresh when no new image frames are generated, reducing power consumption; on the other hand, by limiting the number of frame skips, the flickering problem caused by the display screen not refreshing for a long time can be avoided, thereby maintaining the performance of electronic devices.
[0177] Example 3:
[0178] The following example illustrates the refresh method of the display screen in the current display cycle, taking as an example that the electronic device was in adaptive refresh rate mode in the previous display cycle and did not generate any new image frames in the previous display cycle, with the idle flag set to 3 and M set to 4, and will enter idle mode in the current display cycle.
[0179] like Figure 10 As shown, combined with Figure 3b The software structure of the electronic device shown includes a refresh method for the display screen that may include the following steps:
[0180] S101: Display driver receives Vsync signal.
[0181] If the electronic device does not generate a new image frame in the previous display cycle, the display driver receives the Vsync signal, indicating that the previous display cycle has ended and the current display cycle will begin.
[0182] Combination Figure 11 As shown, assuming the previous display cycle of Embodiment 3 is the fifth display cycle, and no new image frame is generated in the fifth display cycle, after receiving the Vsync signal, it indicates that the fifth display cycle has ended and the sixth display cycle will begin. The sixth display cycle is the current display cycle of Embodiment 3.
[0183] S102: The display driver responds to the Vsync signal by incrementing the idle flag by 1.
[0184] The display driver responds to the Vsync signal by incrementing the idle flag by 1. When the idle flag is 3, incrementing the idle flag by 1 equals 4.
[0185] S103: The display driver checks if the idle flag is equal to M; if so, it executes S104.
[0186] The idle flag value of M indicates that the display driver has not received a commit within M-1 consecutive display cycles, meaning that no new image frames have been generated within M-1 consecutive display cycles.
[0187] In Example 3, M is 4, and the idle flag bit + 1 equals 4. The display driver determines that the idle flag bit is equal to M, indicating that the display driver can determine that the idle flag bit will enter idle mode.
[0188] like Figure 11 As shown, assuming M is 4, the sixth display cycle is the current display cycle of Example 3. In the first display cycle, the GPU of the electronic device renders and the CPU synthesizes to obtain image frame 1. In the second display cycle, the GPU of the electronic device renders and the CPU synthesizes to obtain image frame 2. No new image frames are generated in the three consecutive display cycles from the third to the fifth display cycle. In the sixth display cycle, it will enter idle mode.
[0189] S104: The display driver updates the adaptive refresh rate flag to False.
[0190] It should be understood that when an electronic device skips frames (see S604-S605 described above), the display screen of the electronic device does not refresh, which essentially lowers the refresh rate. If the device skips frames again and enters idle mode within a display cycle, the refresh rate will be lowered again on top of the already lowered refresh rate. The display screen will not refresh for even longer, which may cause the refresh rate to fall below the minimum refresh rate supported by the electronic device, resulting in screen flickering. Therefore, to avoid this situation, frame skipping is no longer performed when the electronic device is about to enter idle mode.
[0191] See also Figure 11 As shown, assuming the sixth display cycle enters idle mode and frames will skip during the sixth display cycle, it means that the display will only receive the clock signal during the sixth display cycle. With a frame skipping count of 1, the display refreshes once starting from the fifth display cycle and only refreshes once more at the end of the sixth display cycle, which can easily lead to screen flickering.
[0192] Therefore, when an electronic device is about to enter idle mode, the display driver updates the adaptive refresh rate flag to False, indicating that the electronic device will not skip frames in idle mode. That is, even if the number of frame skips in the current display cycle is not 0, the display screen will still refresh.
[0193] S105: The display driver sends repeated image frames and more clock signals to the display screen.
[0194] When an electronic device is in idle mode, the display driver can send repeated image frames and more clock signals to the display screen to reduce the refresh rate.
[0195] For example, combined Figure 4 and Figure 11 As shown, the electronic device can enter idle mode in the sixth display cycle (the sixth display cycle can also be called the second cycle between the fifth and sixth moments; the fifth Vsync signal is obtained at the fifth moment, and the sixth Vsync signal is obtained at the sixth moment). The display driver can send repeated image frames 2 and more clock signals to the display screen to lower the refresh rate. For example, in the first to fifth display cycles, the refresh rate of the electronic device is 120Hz. In the fifth display cycle, after the display driver sends an image frame to the display screen, it can send a 1.3ms clock signal to the display screen. In the sixth display cycle, the refresh rate of the electronic device is reduced to 60Hz, and after the display driver sends an image frame to the display screen, it can send a 9.7ms clock signal to the display screen.
[0196] Combination Figure 11 As shown, the electronic device can display image frame 2 (also known as the second image frame) in the third display cycle. The third display cycle can also be called the first cycle between the first moment and the second moment. The first Vsync signal is obtained in the first moment and the second Vsync signal is obtained in the second moment.
[0197] S106: In response to receiving repeated image frames and more clock signals, the display refreshes the repeated images based on a reduced refresh rate.
[0198] Furthermore, when an electronic device is in idle mode, if the display driver receives a commit in a display cycle, it indicates that a new image frame has been generated in that display cycle. The electronic device can exit idle mode in the next display cycle and refresh the display screen based on the previously preset refresh rate, or increase the refresh rate to the preset refresh rate.
[0199] Furthermore, in some embodiments, when the electronic device is in idle mode, if the display driver receives a commit within a display cycle, it can again set the adaptive refresh rate flag to True, indicating that the electronic device has exited idle mode and entered adaptive refresh rate mode. The electronic device can then skip frames again when needed. For example, in Embodiment 1, while executing S306, the adaptive refresh rate flag can be updated to True.
[0200] like Figure 11As shown, in the seventh display cycle, the electronic device's GPU renders and the CPU synthesizes image frame 3. The electronic device can exit idle mode in the eighth display cycle, and the refresh rate is increased. For example, the refresh rate of the electronic device is restored from 60Hz to the preset 120Hz in adaptive refresh rate mode. Subsequently, the display screen of the electronic device can still refresh the display based on 120Hz, and can skip frames again if needed.
[0201] In this way, when an electronic device is about to enter idle mode, it avoids performing frame skipping operations, thereby preventing screen flickering due to prolonged periods without refresh, and further maintaining the performance of the electronic device.
[0202] As described in Examples 1 to 3, the display screen will refresh and display image frames when any one of the following three conditions is met: the synthesis flag is 1, the frame skipping count is 0, or the idle flag is M. It is also possible for any two or all three conditions to be met simultaneously. This indicates that the display screen will refresh and display image frames when a new image frame is generated, the frame skipping count reaches the limit, or the screen is about to enter idle mode.
[0203] When the synthesis flag is 0, the number of frame skips is not 0, and the idle flag is not equal to M, the idle flag not equal to M indicates that the adaptive refresh rate flag is also True. The display can not refresh the display, that is, the frame skipping operation can be performed. The display driver only sends a clock signal to the display (also known as an empty frame) to reduce power consumption.
[0204] For example, combining Figure 11 As shown, at the end of the third display cycle (also known as the seventh moment), the electronic device receives a Vsync signal (also known as the seventh Vsync signal). In response to the Vsync signal, the electronic device determines that the first application has not generated an image frame between the end of the second display cycle (also known as the second moment) and the end of the third display cycle. For example, the second threshold is 3, and it is determined that the number of display cycles in which the first application has not generated an image frame is 1, which does not reach the second threshold. For example, the first threshold is 1, and it is determined that the number of times the display screen does not perform a refresh operation is 0, which does not reach the first threshold. The electronic device can perform a frame skipping operation (also known as not performing a refresh operation) on the display screen to maintain the display of image frame 2 (also known as the second image frame).
[0205] For example, combining Figure 11As shown, at the end of the seventh display cycle (also known as the eighth moment), the electronic device receives a Vsync signal (also known as the eighth Vsync signal). In response to the Vsync signal, the electronic device determines that the first application generates image frame 3 between the end of the sixth display cycle (also known as the second moment, or a moment between the second moment and the eighth moment) and the end of the seventh display cycle, and can refresh and display image frame 3 on the display screen (refresh and display the newly generated image frame of the first application).
[0206] For example, combining Figure 11 As shown, assuming the second threshold is 3, at the end of the fifth display cycle (also known as the eighth moment), the electronic device receives a Vsync signal (also known as the eighth Vsync signal). In response to the Vsync signal, the electronic device determines that the first application has not generated image frames in the third to fifth display cycles. This indicates that the electronic device determines that the number of display cycles in which image frames have not been generated consecutively has reached the second threshold 3. The electronic device can then refresh and display image frame 2 on the screen.
[0207] For example, combining Figure 11 As shown, assuming the first threshold is 1, at the end of the fourth display cycle (also known as the eighth moment), the electronic device receives a Vsync signal (also known as the eighth Vsync signal). In response to the Vsync signal, the electronic device determines that the first application performed a frame skipping operation in the fourth display cycle (also known as not performing a refresh action). This indicates that the electronic device determines that the number of times the display screen does not perform a refresh action has reached the first threshold 1. The electronic device can refresh and display image frame 2 on the display screen.
[0208] It should be noted that the mobile phone mentioned in the above embodiments is merely an example. In some embodiments, the electronic device can be a tablet computer, wearable device, in-vehicle device, augmented reality (AR) / virtual reality (VR) device, laptop computer, ultra-mobile personal computer (UMPC), netbook, personal digital assistant (PDA), or other terminal device. This application does not impose any special limitations on the specific form of the aforementioned electronic device.
[0209] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a computer, can implement one or more steps of any of the above-described display refresh methods.
[0210] Computer-readable storage media can be non-transitory computer-readable storage media, such as ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage devices.
[0211] Another embodiment of this application provides a computer program product containing instructions. When executed by a computer, this computer program product can implement one or more steps of any of the above-described display refresh methods.
[0212] The electronic device, computer-readable storage medium, and computer program product provided in this embodiment are all used to execute the corresponding display screen refresh method provided above. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects in the corresponding display screen refresh method provided above, and will not be repeated here.
[0213] The terms "first," "second," and "third," etc., used in this application specification, claims, and drawings are used to distinguish different objects, not to limit a specific order.
[0214] In the embodiments of this application, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design that is described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design. Specifically, the use of the terms "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0215] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A method of refreshing a display screen, characterized by, The method is applied to an electronic device, the electronic device comprising a first application and a display screen, and the method comprising: In a process in which the display screen displays a first image frame, the first application generates a second image frame; At a first time, the electronic device displays the second image frame on the display screen in response to a first Vsync signal, the first Vsync signal being obtained at the first time; At a second time, the electronic device does not perform a refresh action on the display screen in response to a second Vsync signal, and maintains display of the second image frame, the second Vsync signal being obtained at the second time, the second time being later than the first time.
2. The method of claim 1, wherein, Further comprising: In a process in which the display screen maintains display of the second image frame, the first application generates a third image frame; At a third time, the electronic device refreshes display of the third image frame on the display screen in response to a third Vsync signal, the third Vsync signal being obtained at the third time.
3. The method of claim 1, wherein, Further comprising: At a fourth time, the electronic device refreshes display of the second image frame on the display screen in response to a fourth Vsync signal, the fourth Vsync signal being obtained at the fourth time; The first application does not generate an image frame between the first time and the fourth time.
4. The method of claim 3, wherein, Before the electronic device refreshes display of the second image frame on the display screen in response to the fourth Vsync signal, further comprising: Determining that a number of times that the display screen does not perform a refresh action reaches a first threshold value.
5. The method of claim 1, wherein, In a first period between the first time and the second time, the display screen continuously displays the second image frame; the method further comprising: At a fifth time, the electronic device refreshes display of the second image frame on the display screen in response to a fifth Vsync signal, the fifth Vsync signal being obtained at the fifth time; At a sixth time, the electronic device obtains a sixth Vsync signal; In a second period between the fifth time and the sixth time, the display screen continuously displays the second image frame; a length of the first period is less than a length of the second period; the first application does not generate an image frame between the first time and the fifth time.
6. The method of claim 5, wherein, Before the electronic device refreshes display of the second image frame on the display screen in response to the fifth Vsync signal, further comprising: Determining that a number of display periods in which the first application continuously does not generate an image frame reaches a second threshold value, the display period referring to a length of time between two Vsync signals that are continuously obtained by the electronic device.
7. The method of claim 1, wherein, Further comprising: At a seventh time, the electronic device does not perform a refresh action on the display screen in response to a seventh Vsync signal, and maintains display of the second image frame, the seventh Vsync signal being obtained at the seventh time, the electronic device determining that the first application does not generate an image frame between the second time and the seventh time, determining that the number of display periods in which the first application continuously does not generate an image frame does not reach the second threshold value, and determining that the number of times that the display screen does not perform a refresh action does not reach the first threshold value. The seventh Vsync signal is obtained at the seventh time point; and the display period refers to a time length between two Vsync signals obtained by the electronic device in succession.
8. The method of claim 1, wherein, Further comprising: At an eighth time point, the electronic device determines, in response to an eighth Vsync signal, that the first application generates image frames between the second time point and the eighth time point, or that the number of display periods in which the first application continuously does not generate image frames reaches a second threshold value, or that the number of times that the display screen does not perform a refresh action reaches a first threshold value, and refreshes and displays image frames on the display screen; the eighth Vsync signal is obtained at the eighth time point. The display period refers to a time length between two Vsync signals obtained by the electronic device in succession.
9. The method according to claim 4, 7 or 8, characterized in that, Further comprising: The first threshold value is calculated based on a ratio of a refresh rate of the second image frame to a minimum refresh rate.
10. An electronic device, comprising: The electronic device comprises a memory and a processor. The memory is coupled to the processor, and the memory is configured to store computer program code, the computer program code comprising computer instructions, and one or more processors invoke the computer instructions to cause the electronic device to perform the display screen refresh method according to any one of claims 1-9.
11. A computer readable storage medium, characterized in that, The computer program is stored on the computer readable storage medium, and the computer program is executed by the processor to implement the display screen refresh method according to any one of claims 1-9.
12. A computer program product, characterised in that, The computer program code is executed by the electronic device to implement the steps of the display screen refresh method according to any one of claims 1-9.