A display screen refreshing method and related device
By not refreshing when the display screen does not generate a new image frame and refreshing when a new image frame is generated, the display power loss and splashing problems are solved, and efficient power consumption management and stable display of electronic devices are realized.
Patent Information
- Application Number
- CN202411296681.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-14
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2044-09-14
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 cause power loss, and there may be a flash screen problem caused by the display screen displaying repeated images for a long time.
When the display screen does not generate a new image frame, the electronic device does not perform a refresh action on the display screen, maintains the display of the previous frame, and refreshes it when generating a new image frame. The refresh frequency is controlled through the adaptive refresh rate mode to limit the number of frame skipping times to avoid the flashing screen.
It reduces the power consumption loss of electronic devices, avoids the splashing problem caused by the long-term failure of the display screen, and ensures the normal display of the image.
Smart Images

Figure CN119091828B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of terminal technology, and in particular to a display screen refresh method and related devices. Background Art
[0002] After an electronic device generates an image frame, it sends it to a display screen. The display screen can refresh the 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 image at a fixed refresh rate of 60Hz, 90Hz, or 120Hz.
[0003] However, there may be a problem of large power consumption loss when the display screen of an electronic device refreshes the displayed image. For example, if the electronic device does not generate an image frame for a long time, or generates an image frame at an extremely low frame rate, the display screen of the electronic device will still display repeated images after being refreshed multiple times. For another example, the electronic device continuously generates image frames, but the frame rate may be lower than the refresh rate. Taking the electronic device playing a video as an example, the video includes multiple continuous video frames (i.e., image frames). The frame rate of the video is lower than the refresh rate of the electronic device, which may cause the display screen of the electronic device to refresh twice or more times to display a new image. The above situations will all lead to power consumption loss of the electronic device. Summary of the Invention
[0004] In order to solve the above problems, the present application provides a display screen refresh method and related devices, the purpose of which is to reduce the power consumption loss of electronic equipment.
[0005] In the first aspect, the present application provides a method for refreshing a display screen, which can be applied to electronic devices, such as mobile phones, tablet computers, laptop computers, etc. The electronic device may include a first application and a display screen, such as a video playback application, a social communication application, a consulting and reading application, etc.
[0006] In this method, while the display screen displays the first image frame, the first application can generate a second image frame; at a first moment, the electronic device obtains a first Vsync signal, and then, in response to the first Vsync signal, the electronic device can refresh and display the second image frame on the display screen; the first application does not generate an image frame after the first moment until the second moment, and at the second moment, the electronic device obtains a second Vsync signal, and then, in response to the second Vsync signal, the electronic device may not perform a refresh action on the display screen and maintain displaying the second image frame, wherein the first moment is later than the second moment.
[0007] For example, there is a display cycle between two consecutive Vsync signals. In display cycle 1, the display screen displays the first image frame, and the first application generates the second image frame. At the first moment, the electronic device obtains the first Vsync signal, indicating that display cycle 1 ends and enters display cycle 2. In response to the first Vsync signal, the electronic device can refresh and display the second image frame newly generated by the first application on the display screen. In display cycle 2, the display screen displays the second image frame, and the first application does not generate an image frame. At the second moment, the electronic device obtains the second Vsync signal, indicating that display cycle 2 ends and enters display cycle 3. In display cycle 2 between the first moment and the second moment, the first application does not generate an image frame. In display cycle 3, the electronic device can respond to the second Vsync signal and not perform a refresh action on the display screen, and maintain displaying the second image frame.
[0008] In this way, when the first application does not generate an image frame, the display screen may not perform a refresh action and still maintain displaying the previous second image frame, thereby avoiding power consumption loss caused by the display screen performing a refresh action and still displaying repeated image frames.
[0009] In one possible implementation, the method for refreshing the display screen may further include: while the display screen maintains displaying the second image frame, the first application generates a third image frame; at a third moment, the electronic device obtains a third Vsync signal, and the electronic device can refresh and display the third image frame on the display screen in response to the third Vsync signal.
[0010] For example, the interval between two consecutive Vsync signals is a display cycle. After the second moment, during display cycle 3, the second image frame is displayed on the display screen. At the third moment, the electronic device receives a 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 a third image frame. During display cycle 4, the electronic device, in response to the third Vsync signal, can execute a refresh operation on the display screen to refresh and display the third image frame.
[0011] In this way, when the first application generates a new image frame, the third image frame, the electronic device can normally perform a refresh action on the display screen to refresh and display the third image frame, thereby avoiding affecting the normal display of the new image frame.
[0012] In one possible implementation, the method for refreshing the display screen may further include: between the first moment and the fourth moment, the first application does not generate an image frame; at the fourth moment, the electronic device obtains a fourth Vsync signal; and the electronic device may respond to the fourth Vsync signal to refresh and display the second image frame on the display screen.
[0013] For example, a display cycle is defined between two consecutive Vsync signals. During display cycle 3 after the second moment, no refresh action is performed on the display screen, and the second image frame is displayed. At a fourth moment, the electronic device receives a 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, the electronic device, in response to the fourth Vsync signal, may perform a refresh action on the display screen, refreshing the display of the second image frame.
[0014] In this way, when 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 continues to fail to generate a new image frame, the electronic device can perform a refresh operation on the display screen again to refresh the display of the repeated second image frame, thereby avoiding problems such as screen flickering caused by long-term non-refreshing on the display screen, and maintaining the performance of the electronic device.
[0015] In one possible implementation, between the first moment and the fourth moment, the first application does not generate an image frame, and the electronic device obtains N Vsync signals, where N is greater than 0, for example, N=1, and at the second moment between the first moment and the fourth moment, the electronic device obtains a second Vsync signal; for another example, N=2, and at the second moment between the first moment and the fourth moment, the electronic device obtains a second Vsync signal, and at a moment between the second moment and the fourth moment, the electronic device can obtain another Vsync signal, and in response to the Vsync signal, the electronic device can also maintain the display of the second image frame without performing a refresh action on the display screen.
[0016] This indicates that the electronic device can perform no refresh action on the display screen once or multiple times, maintaining the display of the second image frame, and then, when the first application continues to fail to 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, which can further reduce power consumption loss and avoid problems such as screen flickering caused by long periods of no refresh on the display screen.
[0017] In one possible implementation, before the electronic device responds to the fourth Vsync signal and refreshes and displays the second image frame on the display screen, the refreshing method of the display screen also includes: the electronic device determines 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 continuously reaches the first threshold.
[0018] For example, if the first threshold is 1, the period between two consecutive Vsync signals is one display cycle. During display cycle 3 after the second moment, no refresh action is performed on the display screen, and the second image frame is displayed. At a fourth moment, the electronic device receives a fourth Vsync signal, indicating the end of display cycle 3 and the entry into 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 action reaches one. During display cycle 4, the electronic device, in response to the fourth Vsync signal, may perform a refresh action on the display screen, refreshing the display of the second image frame.
[0019] Exemplarily, 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 the number of frame skips as 1 as an example, in display cycle 3 after the second moment, no refresh action is performed on the display screen, and the second image frame is maintained for display. It is determined that the number of times the display screen does not refresh is 1, and the electronic device can reduce the number of frame skips by 1; in display cycle 4, the electronic device responds to the fourth Vsync signal and determines that the number of frame skips is 0, and further determines that the number of times the display screen does not refresh reaches 1. The electronic device can perform a refresh action on the display screen to refresh and display the second image frame.
[0020] For example, if the first threshold is 2, and the period between two consecutive Vsync signals is one display cycle, no refresh action is performed on the display screen during display cycle 3 after the second moment, and the second image frame is maintained on display. Also, no refresh action is performed on the display screen during display cycle 4 after display cycle 3, and the second image frame is maintained on display. At the fourth moment, the electronic device receives a fourth Vsync signal, indicating the end of display cycle 4 and the entry into 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 times the display screen has not continuously performed a refresh action reaches two. During display cycle 5, the electronic device, in response to the fourth Vsync signal, may perform a refresh action on the display screen, refreshing the display of the second image frame.
[0021] 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 long periods of non-refreshing on the display screen, thereby maintaining the performance of the electronic device.
[0022] In one possible implementation, in a first period between the first moment and the second moment, the first period is a display period, and the display screen continuously displays the second image frame. The refreshing method of the display screen also includes: between the first moment and the fifth moment, the first application does not generate an image frame, and at the fifth moment, the electronic device obtains a fifth Vsync signal, and the electronic device can refresh and display the second image frame on the display screen in response to the fifth Vsync signal; at the sixth moment, the electronic device obtains a sixth Vsync signal; in a second period between the fifth moment and the sixth moment, the second period is a display period, and the display screen continuously displays the second image frame; the duration of the first period is less than the duration of the second period, indicating that the refresh frequency of the electronic device on the display screen has become lower, and the refresh rate has decreased.
[0023] In this way, when the electronic device does not perform a refresh action on the display screen to maintain the display of the second image frame, but the first application continues to fail to generate a new image frame, the electronic device can perform a refresh operation on the display screen again to refresh the display of the repeated second image frame and reduce the refresh rate. The electronic device can continue to display the second image frame for a longer time between the fifth moment and the sixth moment, thereby reducing the power consumption of the electronic device.
[0024] In one possible implementation, between the first moment and the fifth moment, the first application does not generate an image frame, and the electronic device obtains L Vsync signals, where L is greater than 0, for example, L=2. At a second moment between the first moment and the fifth moment, the electronic device obtains a second Vsync signal. At a moment between the second moment and the fifth moment, the electronic device can obtain another Vsync signal, and in response to the Vsync signal, the electronic device can refresh and display a second image frame for a longer time on the display screen before the sixth moment arrives.
[0025] In this way, when the first application continues not to generate new image frames, the electronic device can reduce the refresh rate and continue to display the second image frame for a longer time between the fifth moment and the sixth moment, which can reduce the power consumption of the electronic device.
[0026] In one possible implementation, before the electronic device responds to the fifth Vsync signal and refreshes and displays the second image frame on the display screen, the refreshing method of the display screen also includes: determining that the number of display cycles in which the first application has not continuously generated image frames reaches a second threshold, and the display cycle refers to the length of time between the electronic device continuously obtaining two Vsync signals.
[0027] For example, the electronic device obtains two Vsync signals at time 1 and time 2 respectively, and does not obtain any Vsync signal between time 1 and time 2. The period between time 1 and time 2 is the display period.
[0028] Exemplarily, the second threshold is 3, the first application does not generate an image frame in three consecutive display cycles, and the electronic device obtains the fifth Vsync signal, indicating that the third display cycle of the three consecutive display cycles ends and enters the next display cycle. The electronic device responds to the fifth Vsync signal and can refresh and display the second image frame on the display screen.
[0029] In this way, when the number of display periods in which the first application does not continuously generate image frames 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 the power consumption of the electronic device is thereby reduced.
[0030] In one possible implementation, the refresh method of the display screen also includes: at the seventh moment, the electronic device obtains the seventh Vsync signal, and the electronic device responds to the seventh Vsync signal to determine 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 continuously generated an image frame has not reached a second threshold value, where the display cycle refers to the length of time between two consecutive Vsync signals obtained by the electronic device, indicating that the electronic device may 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 action has not reached a first threshold value, indicating that a refresh action can be performed on the display screen. Subsequently, the electronic device does not perform a refresh action on the display screen and maintains displaying the second image frame.
[0031] In this way, when it is determined that the first application has not generated an image frame, it is determined that the electronic device does not need to reduce the refresh rate, and it is determined that the refresh action can be performed without executing the display screen, the electronic device does not execute the refresh action on the display screen and maintains displaying the second image frame. On the one hand, it avoids affecting the normal display of the image frame, and on the other hand, it avoids problems such as screen flickering caused by the electronic device not executing the refresh action on the display screen for a long time.
[0032] In one possible implementation, the method for refreshing the display screen further includes: at an eighth moment, the electronic device obtains an eighth Vsync signal, and in response to the eighth Vsync signal, when it is determined that the first application generates an image frame between the second moment and the eighth moment, the electronic device indicates that a new image frame needs to be displayed; or, the electronic device determines that the number of display periods in which the first application has not continuously generated an image frame reaches a second threshold value, where the display period refers to the duration between two consecutive Vsync signals obtained by the electronic device, and it can be considered that the electronic device is in a low-power state and can reduce 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 value. If any of the above three conditions is met, the electronic device refreshes and displays the image frame on the display screen. 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, and if the second or third condition is met, the electronic device can refresh and display the second image frame on the display screen.
[0033] In this way, when it is determined that the first application generates an image frame, or when it is determined that the electronic device will reduce the refresh rate, or when it is determined that the number of times a refresh action is not performed on the display screen reaches a first threshold, the electronic device performs a refresh action on the display screen and displays the image frame. On the one hand, it normally displays the newly generated image frame of the first application, and on the other hand, it avoids problems such as screen flickering caused by the electronic device not performing a refresh action on the display screen for a long time.
[0034] In one possible implementation, the display screen refresh method further includes calculating a first threshold value based on a ratio of the refresh rate of the second image frame to the minimum refresh rate. For example, the first threshold value is calculated based on the ratio of the refresh rate of the second image frame to the minimum refresh rate minus 1. In this way, the first threshold value is calculated by taking into account the refresh rate at which the electronic device refreshes and displays the second image frame on the display screen, thereby preventing the display screen from failing to refresh too many times, causing the refresh rate of the electronic device to fall below the latest refresh rate, thereby preventing problems such as screen flickering in the electronic device.
[0035] In a second aspect, the present application provides an electronic device comprising a memory and a processor; the memory stores computer program code, and the computer program code comprises computer instructions; one or more processors call the computer instructions so that the electronic device executes the display screen refresh method of the first aspect mentioned above.
[0036] In a third aspect, the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the display screen refreshing method of the first aspect described above is implemented.
[0037] In a fourth aspect, the present application provides a computer program product, which includes a computer program code. When the computer program code is executed by an electronic device, it implements the display screen refresh method of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 A schematic diagram of a display screen refresh method provided in the related art;
[0039] Figure 2 A schematic diagram of another display screen refresh method provided in the related art;
[0040] Figure 3a A signaling interaction diagram of a display screen refresh method provided in an embodiment of the present application;
[0041] Figure 3b A software architecture diagram of an electronic device provided in an embodiment of the present application;
[0042] Figure 4 A schematic diagram of a refresh rate provided in an embodiment of the present application;
[0043] Figure 5 A schematic diagram of an image frame transmission and display provided in an embodiment of the present application;
[0044] Figure 6 A signaling interaction diagram of another display screen refresh method provided in an embodiment of the present application;
[0045] Figure 7 A schematic diagram of a display screen refresh method provided in an embodiment of the present application;
[0046] Figure 8 A schematic diagram of the judgment logic of a display screen refresh method provided in an embodiment of the present application;
[0047] Figure 9 A schematic diagram of the judgment logic of another display screen refresh method provided in an embodiment of the present application;
[0048] Figure 10 A signaling interaction diagram of another display screen refresh method provided in an embodiment of the present application;
[0049] Figure 11 A schematic diagram of another display screen refresh method provided in an embodiment of the present application. DETAILED DESCRIPTION
[0050] In order to make the description of the following embodiments clear and concise, the vocabulary involved in the embodiments of the present application is first explained. It should be understood that this explanation is for a clearer understanding of the embodiments of the present application and does not necessarily constitute a limitation of the embodiments of the present application.
[0051] Refresh rate: refers to the number of times an electronic device's display screen refreshes an image frame per second. For example, a refresh rate of 60 Hz means that the electronic device's display screen can refresh and display image frames 60 times per second.
[0052] 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 player application plays a video with a frame rate of 30fps, this means that the electronic device can send 30 frames of the video to the display screen in 1 second, and the electronic device's display screen can display these 30 frames in 1 second.
[0053] A Vsync (Vertical Synchronization) signal is a synchronization pulse signal emitted by an electronic device before its display screen refreshes an image frame. In some embodiments, the electronic device may emit a Vsync signal based on a refresh rate. For example, if the refresh rate is 60 Hz, the electronic device may emit a Vsync signal 60 times per second.
[0054] Display cycle: refers to the duration between the times corresponding to two consecutive Vsync signals received by the electronic device and the time period during which the electronic device's display screen displays.
[0055] In related technologies, the refresh rate of an electronic device may be the same as the frame rate. Each time the electronic device's display screen is refreshed based on the refresh rate, the display screen can display a new image frame, providing a smoother visual experience. However, it is also possible that the frame rate of an electronic device is lower than the refresh rate.
[0056] When the electronic device is on a static desktop, in the application interface of an e-book application, in the application interface of a browser application, or in other scenarios, the display screen of the electronic device may display a static image for a long time, that is, display repeated image frames for a long time, and the electronic device may not generate new image frames for a long time, or the frame rate of the generated image frames may be extremely low.
[0057] like Figure 1As shown, the electronic device displays image frame 0 in the first display cycle. In the first display cycle, the electronic device can generate image frame 1. The process of generating image frame 1 includes: the electronic device's GPU can first render to obtain the various layers of image frame 1, and the electronic device's CPU can then synthesize the various layers of image frame 1 to obtain image frame 1; the electronic device can enter the second display cycle upon receiving the Vsync signal, and the display LCD can refresh and display image frame 1. Similarly, the electronic device can generate image frame 2 in the second display cycle, and can display image frame 2 in the third display cycle. If no new image frame is generated after the third display cycle, the electronic device's display will refresh and repeatedly display image frame 2 based on a pre-set refresh rate.
[0058] Based on the scenario described above, it shows that the display screen of the electronic device refreshes the display screen based on the refresh rate. It may appear that repeated images are displayed after multiple refreshes. The display screen will refresh the same image frame multiple times, causing the electronic device to waste unnecessary power consumption and cause power loss.
[0059] When an electronic device is playing a video, the display screen of the electronic device will continuously update the picture and display new image frames. However, the frame rate of the video may be lower than the refresh rate, causing the display screen to display repeated pictures after refreshing.
[0060] like Figure 2 As shown, for example, if the frame rate of the video is 30fps and the refresh rate of the electronic device is 60Hz, the electronic device displays image frame 0 in the first display cycle, and can generate image frame 1 in the first display cycle; the electronic device can enter the second display cycle upon receiving the Vsync signal, and the display screen can refresh and display image frame 1, and can generate image frame 2 in the second display cycle; the electronic device can enter the third display cycle upon receiving the Vsync signal, and the display screen can refresh and display image frame 2, and the electronic device does not generate a new image frame in the third display cycle; the electronic device can enter the fourth display cycle upon receiving the Vsync signal, and the display screen will refresh and display a repeated image frame 2, and can generate image frame 3 in the fourth display cycle, and so on. Subsequent electronic devices will refresh and display the same image twice for the same image frame.
[0061] Based on the scenario described above, the display screen of the electronic device refreshes the display image based on the refresh rate, and it may be refreshed twice or even multiple times before a new image is displayed. The display screen may refresh twice or even multiple times for the same image frame, which also causes the electronic device to waste unnecessary power consumption and cause power loss.
[0062] Therefore, in order to solve the above problems, an embodiment of the present application provides a method for refreshing a display screen. When the electronic device did 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 a frame skipping operation to reduce power consumption loss.
[0063] First, the refresh rate modes of the electronic device are introduced, including the idle mode and the adaptive refresh rate mode provided in the embodiments of the present application.
[0064] When the electronic device is in adaptive refresh rate mode, if a new image frame is generated in each display cycle of the electronic device, the display screen of the electronic device can refresh the displayed image frame based on the preset refresh rate. If a new image frame is not generated in the display cycle of the electronic device, the display screen may not refresh the display, that is, perform a frame skipping operation. Figure 3a This is described in detail in the embodiment 1. For example, when the adaptive refresh rate flag is True or 1, it indicates that the electronic device is in the adaptive refresh rate mode.
[0065] When the electronic device is in idle mode and no new image frames are generated during the display cycle of the electronic device, the display screen will refresh and display repeated image frames based on the refresh rate and cannot perform frame skipping. Figure 10 This is described in detail in the third embodiment. For example, when the adaptive refresh rate flag is False or 0, it indicates that the electronic device is in idle mode.
[0066] It should be noted that when the idle mode flag is False, it indicates that the electronic device is in adaptive refresh rate mode; when the idle mode flag is True, it indicates that the electronic device is in idle mode. This application does not limit this.
[0067] Next, combine Figure 3a-Figure 11 The refreshing method of the display screen provided in the embodiment of the present application is described in detail.
[0068] Example 1:
[0069] The following describes a method for refreshing a display screen in a current display cycle, taking an example where an electronic device is in an adaptive refresh rate mode and generates a new image frame in a previous display cycle.
[0070] like Figure 3bAs shown, the operating system of the electronic device is the Android system as an example. The Android system can adopt a layered architecture, and each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the system is divided into five layers, from top to bottom, namely the application (Application, APP) layer, the application framework layer (also known as the native framework Native layer), the hardware abstraction layer (Hardware Abstraction Layer, HAL), the driver layer (also known as the kernel layer) and the hardware layer. It should be noted that the mobile phone can also run the iOS operating system, and this application does not limit this.
[0071] In some embodiments, the application layer includes a first application, the Native layer includes a display engine service SurfaceFlinger, the HAL layer includes a compositor HardwareComposer (HWC for short), the Kernel layer includes a display driver, and the hardware layer includes a display screen.
[0072] like Figure 3a As shown, combined Figure 3b The software structure of the electronic device shown in FIG. 1 , and the method for refreshing the display screen may include the following steps:
[0073] S301: A first application stores image data in a rendering buffer.
[0074] Image data is used to describe the properties of the image frame to be generated, such as pixel value, color, transparency, etc. The rendering buffer is used to temporarily store image data.
[0075] In some embodiments, the image data may be drawn by a first application. For example, the first application is a social communication application, a gallery application, a consulting and reading application, etc. The first application may draw image data of the application interface. For example, a consulting and reading application may draw text in an e-book in response to a user viewing an e-book; or a social communication application may draw pinyin characters, emoticons, etc. in response to a user triggering a chat box.
[0076] In some embodiments, the image data may also be obtained by decoding the first application. For example, the first application may be a video playback application, which may decode the video to obtain the image data in response to a user's operation to play the video.
[0077] S302: SurfaceFlinger reads image data from the rendering buffer.
[0078] In some embodiments, SurfaceFlinger can read image data from the render buffer for rendering based on the refresh rate. For example, if the refresh rate is 60Hz, SurfaceFlinger can read image data from the render buffer for rendering 60 times in 1 second, and read image data from the render buffer and render it every 16.7ms.
[0079] The mipi driver can send an APP_Vsync signal to SurfaceFlinger based on the refresh rate. For example, if the refresh rate is 60Hz, the mipi driver can send an APP_Vsync signal to SurfaceFlinger every 16.7ms. SurfaceFlinger can read image data from the rendering buffer and render it in response to the APP_Vsync signal.
[0080] like Figure 3b As shown, the mipi driver can also be called the display serial interface (DSI) driver. The display driver includes the DSI driver. The DSI driver can call the DSI interface of the hardware layer to send an APP_Vsync signal to SurfaceFlinger.
[0081] S303: SurfaceFlinger renders multiple layers based on the image data.
[0082] In some embodiments, SurfaceFlinger can call a graphics processing unit (GPU) to render multiple layers based on image data.
[0083] For example, taking the first application as a video playback application, the multiple layers may include video frames, a progress bar, a comment area, and the like.
[0084] It should be noted that SurfaceFlinger rendering multiple layers based on image data is only an example. SurfaceFlinger may also render one layer based on image data, and this application does not limit this.
[0085] S304: SurfaceFlinger calls HWC to synthesize multiple layers to obtain an image frame.
[0086] In some embodiments, SurfaceFlinger may also call HWC based on the refresh rate to synthesize multiple layers to obtain an image frame.
[0087] For example, the mipi driver can send an SF_Vsync signal to SurfaceFlinger based on the refresh rate. For example, if the refresh rate is 60Hz, the mipi driver can send an SF_Vsync signal to SurfaceFlinger every 16.7ms. SurfaceFlinger can call HWC to synthesize multiple layers to obtain an image frame in response to the APP_Vsync signal.
[0088] like Figure 3b As shown, the DSI driver can call the DSI interface of the hardware layer to send the SF_Vsync signal to SurfaceFlinger.
[0089] S305: SurfaceFlinger sends commit to the display driver through HWC.
[0090] Commit is used to instruct the display driver that a new image frame has been synthesized.
[0091] In some embodiments, commit may carry a preset refresh rate, such as a refresh rate for displaying video frames.
[0092] S306 : In response to commit, the display driver updates the composition flag bit to 1 and the idle flag bit to 0.
[0093] The synthesis flag bit is used to indicate the synthesis state of the image frame. For example, if the synthesis flag bit is 1, it indicates that a new image frame is synthesized, and if the synthesis flag bit is 0, it indicates that no new image frame is synthesized.
[0094] It should be noted that the synthesis flag bit being 1 or 0 is only an example and may be other values as long as it can distinguish whether a new image frame is synthesized.
[0095] Commit is sent by surfaceFlinger to the display driver through HWC after the image frame is synthesized, so the display driver can update the synthesis flag bit to 1 in response to commit.
[0096] Idle means that the electronic device is in a low power consumption state, for example, the electronic device does not generate new image frames for a long time, or generates new image frames at an extremely low frame rate.
[0097] To solve this problem, when the electronic device is idle, the electronic device can enter idle mode and reduce the refresh rate, which can also be called lowering the refresh rate.
[0098] The idle flag is used to count display cycles in which no new image frames are generated. If the idle flag is equal to M, it indicates that the electronic device has not generated any new image frames within M-1 consecutive display cycles (which can also be referred to as the number of consecutive display cycles in which no image frames are generated reaches a second threshold), and it can be considered that the electronic device is in a low-power state and will enter idle mode. If 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.
[0099] When the display driver receives commit, it indicates that a new image frame is 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.
[0100] It should be noted that the display driver updating the idle flag to 0 upon receiving commit is only an example, and may also be updated to other values, which may indicate recounting the display cycles in which the electronic device has not received commit continuously.
[0101] For an introduction to the idle mode, please refer to the detailed description of Example 3 below, which will not be expanded here.
[0102] S307: SurfaceFlinger stores the image frame in the display buffer.
[0103] The render buffer is used to temporarily store image frames.
[0104] SurfaceFlinger stores the synthesized image frame in the display buffer through HWC.
[0105] It should be noted that when SurfaceFlinger obtains a layer based on image data rendering, SurfaceFlinger can also call HWC to store the image frame in the display buffer without executing S304.
[0106] S308: The display driver reads the image frame synthesized by the HWC from the display buffer.
[0107] In some embodiments, the display driver may read the image frame in response to commit. Accordingly, S307 may be executed first, and then S305 may be executed.
[0108] S309: The display driver receives a Vsync signal.
[0109] In some embodiments, S301 - S308 described above may be executed in the previous display cycle. When the display driver receives the Vsync signal, it indicates that the previous display cycle ends and the current display cycle will begin.
[0110] Combine Figure 1 As shown, for example, the electronic device generates a new image frame 2 in the second display period. After receiving the Vsync signal, it indicates that the second display period ends and the third display period will begin.
[0111] In some embodiments, the mipi driver may send a Vsync signal to the display driver based on the refresh rate. For example, if the refresh rate is 120 Hz, the mipi driver may send a Vsync signal to the display driver every 8.3 ms.
[0112] like Figure 3b As shown, the mipi driver can call the DSI interface of the hardware layer to send a Vsync signal to the display driver.
[0113] The Vsync signal, APP_Vsync signal, and SF_Vsync signal mentioned above are all 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, the mipi driver sends the SF_Vsync signal to SurfaceFlinger 2ms later, and after another 2ms, the display driver sends the Vsync signal to the display driver.
[0114] S310: The display driver responds to the Vsync signal and sets the idle flag to +1.
[0115] As described in S306 above, the idle flag is used to count display cycles in which no new image frames are generated. After the display driver receives the Vsync signal, it can increment the idle flag by 1. A value of 1 indicates that a new image frame was generated in the previous cycle and that there is no need to enter idle mode next.
[0116] It should be noted that the idle flag bit + 1 is only an example, and other values can also be added as long as counting can be achieved.
[0117] S311: The display driver determines whether the idle flag is equal to M, otherwise executes S312.
[0118] Based on the introduction 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.
[0119] It should be noted that, for an example where the idle flag bit is equal to M, reference may be made to the description of Example 3 below.
[0120] It should be emphasized that S311 is an optional execution step and may not be executed when the synthesis flag bit is 1.
[0121] S312: The display driver determines that the synthesis flag bit is 1, and sends the image frame and the clock signal to the display screen.
[0122] It should be understood that the display driver typically sends image frames at a fixed time. During the remainder of a display cycle, the display driver can send a clock signal to the display to fill the remaining display 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 display a response after receiving the clock signal.
[0123] like Figure 4 As shown, at different refresh rates, the duration of the display driver sending image frames to the display screen is fixed, for example, 7ms. If the refresh rate of the electronic device is 120Hz, the duration of a display cycle is approximately 8.3ms, and the remaining 1.3ms is available for the display driver to send a clock signal to the display screen; if the refresh rate of the electronic device is 60Hz, the duration of a display cycle is approximately 16.7ms, and the remaining 9.7ms is available for the display driver to send a clock signal to the display screen; if the refresh rate of the electronic device is 30Hz, the duration of a display cycle is approximately 26.7ms, and the remaining 19.7ms is available for the display driver to send a clock signal to the display screen.
[0124] Based on the introduction of S306 above, the synthesis flag bit is updated to 1, indicating that a new image frame is generated in the previous display cycle and the new image frame can be displayed in the current display cycle. Therefore, the display driver can send the image frame and clock signal to the display screen based on the preset refresh rate.
[0125] S313: In response to receiving the image frame and the clock signal, the display screen refreshes the display image based on a preset refresh rate.
[0126] When 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.
[0127] S314: The display driver updates the synthesis flag bit to 0.
[0128] The new image frame has been sent to the display screen. If there is no new image frame generated, the display driver can reset the synthesis flag bit and update it to 0.
[0129] Combine Figure 3bAs shown, HWC can include a commit module, and SurfaceFlinger can send a commit to the display driver through the commit module, that is, execute S305 described above. The display driver includes a judgment driver and a DSI driver. The judgment driver can execute S306, S308, S310-S312, S314 described above, and the DSI driver can execute S309 described above.
[0130] Combine 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 a display screen panel). The DSI can send an APP_Vsync signal to render a layer. The DSI can send an SF_Vsync signal to synthesize an image frame. Then the DSI interface can send the image frame to the panel for display. For relevant detailed introduction, please refer to Example 1, which will not be repeated here.
[0131] Furthermore, it should be understood that in the embodiments of the present application, if the electronic device does not generate a new image frame in one display cycle, the display screen may not be refreshed in the next display cycle, and frame skipping may be performed to reduce power consumption (for details, see Example 2). However, if the electronic device does not generate a new image for multiple consecutive display cycles, continuous frame skipping may easily cause problems such as screen flickering on the display screen. Therefore, a frame skipping count may be pre-set to prevent excessive frame skipping on the display screen.
[0132] Therefore, in order to solve this problem, 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 known as the refresh rate of the second image frame, the refresh rate of the second image frame is the refresh rate of the latest image frame generated by the first application) and the minimum refresh rate. In the display cycle of generating a new image frame, the display driver can determine the current refresh rate based on the refresh rate carried by the commit. In the display cycle when no new image frame is generated, the display driver can determine the current refresh rate based on the refresh rate carried by the most recent commit in the previous display cycle, and round down the ratio of the current refresh rate to the minimum refresh rate minus 1 as the number of frame skips.
[0133] For example, the current refresh rate is 120Hz, the minimum refresh rate is 30Hz, and the calculated number of frame skips is 3; the current refresh rate is 60Hz, the minimum refresh rate is 30Hz, and the calculated number of frame skips is 1; the current refresh rate is 40Hz, the minimum refresh rate is 30Hz, and the calculated number of frame skips is 0.
[0134] 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, which is not limited in this application.
[0135] In the embodiment of the present application, 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 in a commit, and use it in the display cycle in which frame skipping will occur. For related examples, please refer to the description of Example 2. For example, the calculation can be performed after executing S312, but this application does not limit this. The calculation can also be performed once in each display cycle, or even in a display cycle when no new image frames are generated.
[0136] In this way, when the electronic device is in the adaptive refresh rate mode, the electronic device generates a new image frame and can display the new image frame normally, avoiding affecting the normal display of the new image frame.
[0137] It should be noted that, during the execution of S312, even if the number of frame skipping is greater than 0, when the synthesis flag bit is 1, that is, when the first application generates a new image frame, the electronic device will refresh the display screen, that is, refresh and display the screen corresponding to the new image frame (also referred to as refreshing the display image frame). For details, see the second embodiment. Figure 7 Related instructions.
[0138] Example 2:
[0139] The following describes a method for refreshing the display screen in the current display cycle and the next display cycle, taking an electronic device in adaptive refresh rate mode, where no new image frames are generated in the previous display cycle, the current display cycle, and the next display cycle, and image frames are displayed normally in the previous display cycle with a frame skipping count of 1 as an example.
[0140] like Figure 6 As shown, combined Figure 3b The software structure of the electronic device shown in FIG. 1 , and the method for refreshing the display screen may include the following steps:
[0141] S601: The display driver receives a Vsync signal.
[0142] The electronic device did not generate a new image frame in the previous display cycle. The display driver receives the Vsync signal, indicating that the previous display cycle ends and the current display cycle will begin.
[0143] Combine Figure 7As shown, for example, the previous display cycle of Example 2 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 the Vsync signal (also referred to as the electronic device obtaining the first Vsync signal at the first moment), indicating that the third display cycle has begun, and 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 moment and the second moment), and displays image frame 2 on the display screen. After the display driver receives the Vsync signal at the end of the third display cycle (i.e., executing S601, which can also be referred to as the electronic device obtaining the second Vsync signal at the second moment), it indicates that the third display cycle has ended and the fourth display cycle will begin.
[0144] It should be noted that other implementations of S601 can be found in the introduction of S309 in the first embodiment, and will not be described in detail here.
[0145] S602: The display driver responds to the Vsync signal and sets the idle flag to +1.
[0146] S603: The display driver determines whether the idle flag is equal to M, otherwise executes S604.
[0147] It should be noted that the implementation of S602-S603 can be found in the introduction of S309-S310 in the first embodiment, and will not be repeated here.
[0148] Combine Figure 7 As shown, assuming that M is equal to 5, the previous display cycle of Example 2 is the third display cycle, and the electronic device generates a new image frame 2 in the second display cycle, indicating that the idle flag is updated to 1 based on the received Vsync signal at the end of the second display cycle, and 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 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 + 1 is equal to 2. In the fourth display cycle, the display driver can determine that the idle flag is not equal to M, and there is no need to enter the idle mode in the fourth display cycle.
[0149] S604: The display driver determines that the synthesis flag bit is not 1, the number of frame skips is not 0, and the adaptive refresh rate flag bit is True, and sends the clock signal to the display screen.
[0150] In some embodiments, the number of frame skips can be calculated based on the current refresh rate and the minimum refresh rate. Please refer to the introduction of the number of frame skips in Example 1. If no new image frame is generated in the previous display cycle, the number of frame skips calculated based on the display cycle of the most recent new image frame generation can be used for judgment.
[0151] Combine Figure 7 As shown, the previous display cycle of Example 2 is the third display cycle. The electronic device generates a new image frame 2 in the second display cycle, and calculates the number of frame skips to be 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 number of frame skips is still 1.
[0152] In embodiment 2, no new image frame is generated in the previous display cycle, the synthesis mark bit in the current display cycle is not 1, the number of frame skipping is 1, not 0, the next display cycle does not enter idle mode, and the adaptive refresh rate mark 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.
[0153] S605: The display screen receives a clock signal.
[0154] The display screen does not receive an image frame in the current display cycle, but only receives a clock signal, so it may not refresh or respond to the display. Figure 7 This example can also be referred to as the electronic device not performing a refresh action on the display screen in response to the second Vsync signal, and maintaining display of the second image frame.
[0155] For example, after receiving the clock signal, the display screen can ignore the clock signal and not respond, or it can use the clock signal to detect errors in the data transmission process and take corresponding measures to recover. This application does not limit this.
[0156] In this way, when the electronic device is in the adaptive refresh rate mode, no new image frame is generated and the number of frame skips is not 0, the display screen of the electronic device may not refresh the display, thereby reducing the power consumption of the electronic device.
[0157] S606: The display driver will skip the number of frames -1.
[0158] In the second embodiment, the number of frame skipping times is 1. After the display screen skips a frame once, the display driver can obtain the number of frame skipping times as 0 by subtracting 1 from the number of frame skipping times.
[0159] S607: The display driver receives the Vsync signal.
[0160] The electronic device does not generate a new image frame in the current display cycle. The display driver receives the Vsync signal, indicating that the current display cycle ends and the next display cycle will begin.
[0161] Based on the S601 example, combined Figure 7 As shown, for example, in Example 2, the current display cycle is the fourth display cycle. The electronic device does not generate a new image frame in the fourth display cycle. In the fourth display cycle, the display screen still displays image frame 2, but the display screen is not refreshed, which is an empty frame. Subsequently, after receiving the Vsync signal, it indicates that the fourth display cycle ends and the fifth display cycle will begin.
[0162] It should be noted that other implementations of S607 can refer to the introduction of S309 in the first embodiment and will not be described in detail here.
[0163] S608: The display driver responds to the Vsync signal and sets the idle flag to +1.
[0164] S609: The display driver determines whether the idle flag is equal to M, otherwise executes S609.
[0165] Based on the example of S603, combined with Figure 7 As shown, assuming that M is equal to 5, at the end of the third display cycle, based on the received Vsync signal, the idle flag bit +1 is equal to 2 (see S602 described above), and no new image frame is generated in the fourth display cycle. At the end of the fourth display cycle, based on the received Vsync signal, the idle flag bit +1 is equal to 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 the idle mode in the fifth display cycle.
[0166] S610: The display driver determines that the number of frame skipping is 0, and sends the repeated image frame and clock signal to the display screen.
[0167] In the current display cycle, the display screen has skipped frames, making the number of frame skips 0. In the next display cycle, the display driver can determine that the number of frame skips is 0 (it can also be called the number of times the display screen does not perform a refresh action reaches a first threshold, and the value of the number of frame skips 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 screen as a repeated image frame and clock signal.
[0168] S611: In response to receiving the repeated image frame and the clock signal, the display screen refreshes and displays the repeated image based on a preset refresh rate.
[0169] like Figure 7As shown, assuming that the next display cycle of Example 2 is the fifth display cycle (which can also be called the end moment of the fourth display cycle is the fourth moment, and the display driver receives the fourth Vsync signal), in the fifth display cycle, the display screen also displays image frame 2 (which can also be called 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 pre-set refresh rate.
[0170] In addition, in some embodiments, after the display screen refreshes to display repeated image frames, the number of frame skips can be calculated again. Since no new image frames have been generated, it indicates that the current refresh rate remains unchanged (see the introduction of S604), and the number of frame skips can be calculated to be still 1.
[0171] Continue to see Figure 7 For example, the next display cycle of Example 2 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. S601-605 can be repeatedly executed, the synthesis mark bit is 0, and the sixth display cycle will not enter the idle mode, and the number of frame jumps is not 0. Therefore, in the sixth display cycle, the display screen only receives the clock signal and is not refreshed.
[0172] Continue to see Figure 7 As shown, in the sixth display cycle, image frame 2 (also referred to as the second image frame) is displayed on the display screen, and 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 a Vsync signal (also referred to as the third Vsync signal), indicating that the seventh display cycle has begun. The display driver responds to the Vsync signal, determines that the synthesis flag bit is 1, and can send image frame 3 and the clock signal to the display screen. Subsequently, the image frame 3 can be refreshed and displayed on the display screen. For an introduction to the detailed steps, please refer to Example 1 and will not be repeated here.
[0173] Combine Figure 8 As shown, when a new image frame is generated, SurfaceFlinger can send a commit (also called AtomicCommit) to the display driver through HWC. After receiving the Vsync signal, the judgment driver can determine whether a commit is received between this Vsync signal and the previous Vsync signal, or whether the number of frame skips is 0, or whether it enters idle mode. When any of the above three conditions is met, the display screen cannot perform a frame skip operation, but performs a refresh operation (also called a refresh action). When none of the above three conditions are met, the display screen can perform a frame skip operation. Among them, when the judgment driver determines that the idle flag bit is equal to M, it can determine to enter idle mode and reduce the refresh rate.
[0174] Combine Figure 9 As shown, after the display driver receives the Vsync signal, the display driver can first calculate the number of frame skipping times, and then the display driver can determine whether a commit is received (for example, whether the synthesis mark bit is 1), or determine whether the number of frame skipping times is 0, or determine whether to enter the idle mode (for example, determine whether the idle mark bit is equal to M). If any of the above three conditions is met, the display screen cannot perform the frame skipping operation. If none of the above three conditions are met, the display screen can perform the frame skipping operation.
[0175] In this way, on the one hand, when no new image frame is generated, the display screen does not need to be refreshed, reducing power consumption loss; on the other hand, by limiting the number of frame skips, the screen flickering problem caused by the display screen not being refreshed for a long time can be avoided, thereby maintaining the performance of the electronic device.
[0176] Example 3:
[0177] The following describes a method for refreshing the display screen in the current display cycle, taking the case where the electronic device is in adaptive refresh rate mode in the previous display cycle, no new image frames are generated in the previous display cycle, the idle flag is 3, M is 4, and the current display cycle will enter idle mode as an example.
[0178] like Figure 10 As shown, combined Figure 3b The software structure of the electronic device shown in FIG. 1 , and the method for refreshing the display screen may include the following steps:
[0179] S101: The display driver receives a Vsync signal.
[0180] The electronic device did not generate a new image frame in the previous display cycle. The display driver receives the Vsync signal, indicating that the previous display cycle ends and the current display cycle will begin.
[0181] Combine Figure 11 As shown, assuming that the previous display cycle of Example 3 is the fifth display cycle, no new image frame is generated in the fifth display cycle, after receiving the Vsync signal, it indicates that the fifth display cycle ends and enters the sixth display cycle. The sixth display cycle is the current display cycle of Example 3.
[0182] S102: The display driver responds to the Vsync signal and sets the idle flag to +1.
[0183] The display driver responds to the Vsync signal, sets the idle flag bit to +1, the idle flag bit is 3, and the idle flag bit +1 is equal to 4.
[0184] S103: The display driver determines whether the idle flag is equal to M, and if so, executes S104.
[0185] The idle flag bit is equal to M, which is used to indicate that the display driver has not received a commit within M-1 consecutive display cycles, indicating that no new image frame has been generated within M-1 consecutive display cycles.
[0186] In the third embodiment, M is 4, the idle flag bit + 1 is equal to 4, and 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 the idle mode.
[0187] like Figure 11 As shown, assuming that 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 display cycle to the fifth display cycle, and the idle mode will be entered in the sixth display cycle.
[0188] S104: The display driver updates the adaptive refresh rate flag to False.
[0189] 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 the display, which essentially lowers the refresh rate. Assuming that frames are skipped and the device enters idle mode within a display cycle, the refresh rate will be lowered again on the basis of lowering the refresh rate. The display screen will not refresh the display for a longer time, which may easily cause the refresh rate to be lower than the minimum refresh rate supported by the electronic device, resulting in screen flickering. Therefore, in order to avoid this situation, when the electronic device is about to enter idle mode, it will no longer skip frames.
[0190] See also Figure 11 As shown, assuming that the sixth display cycle enters idle mode and frames are skipped in the sixth display cycle, it means that the display screen will only receive a clock signal in the sixth display cycle. When the number of frame skips is 1, the display screen will refresh once from the fifth display cycle and will not refresh again until the end of the sixth display cycle, which may easily cause screen flickering.
[0191] Therefore, when the electronic device is about to enter idle mode, the display driver updates the adaptive refresh rate flag to False, indicating that the electronic device does 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 will still refresh the display.
[0192] S105: The display driver sends repeated image frames and more clock signals to the display screen.
[0193] When the 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.
[0194] For example, in combination 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 moment and the sixth moment, the fifth Vsync signal is obtained at the fifth moment, and the sixth Vsync signal is obtained at the sixth moment), and 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 display cycle-the fifth display cycle, the refresh rate of the electronic device is 120Hz. In the fifth display cycle, after the display driver sends the 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. After the display driver sends the image frame to the display screen, it can send a 9.7ms clock signal to the display screen.
[0195] Combine Figure 11 As shown, the electronic device can display image frame 2 (also called the second image frame) in the third display period. The third display period can also be called the first period between the first moment and the second moment. The first Vsync signal is obtained at the first moment and the second Vsync signal is obtained at the second moment.
[0196] S106 : In response to receiving the repeated image frames and more clock signals, the display screen refreshes and displays the repeated images based on the reduced refresh rate.
[0197] In addition, when the electronic device is in idle mode, the display driver receives a commit in a display cycle, indicating that a new image frame is generated in the display cycle. The electronic device can exit idle mode in the next display cycle. The electronic device can refresh the display screen based on the refresh rate pre-set before recovery, and can increase the refresh rate to the pre-set refresh rate.
[0198] Furthermore, in some embodiments, when the electronic device is in idle mode, the display driver may set the adaptive refresh rate flag to True upon receiving a commit signal during a display cycle, indicating that the electronic device has exited idle mode and entered adaptive refresh rate mode. The electronic device may then skip frames again when necessary. For example, in Embodiment 1, the adaptive refresh rate flag may be updated to True while executing S306.
[0199] 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 pre-set 120Hz in the adaptive refresh rate mode. The display screen of the electronic device can subsequently refresh the display image based on 120Hz, and can skip frames again if necessary.
[0200] In this way, when the electronic device is about to enter the idle mode, the electronic device is prevented from performing a frame skipping operation, thereby preventing the display screen from flickering due to not refreshing for a long time, and further maintaining the performance of the electronic device.
[0201] Based on the descriptions of Examples 1 to 3, it can be seen that when the synthesis flag is 1, the number of frame skips is 0, or the idle flag is M, and any of the three conditions are met, the display screen will refresh the displayed image frame. It is also possible that any two or three of the above conditions are met simultaneously. This indicates that the display screen will refresh the displayed image frame when a new image frame is generated, the number of frame skips reaches the limit, or the idle mode is about to be entered.
[0202] 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 is not equal to M, indicating that the adaptive refresh rate flag is also True, the display does not need to refresh the display, that is, the frame skip operation can be performed, and the display driver only sends a clock signal (also called an empty frame) to the display to reduce power consumption loss.
[0203] For example, combining Figure 11 As shown, at the end moment of the third display cycle (also referred to as the seventh moment), the electronic device obtains a Vsync signal (also referred to as the seventh Vsync signal), and the electronic device responds to the Vsync signal to determine that the first application has not generated an image frame between the end moment of the second display cycle (also referred to as the second moment) and the end moment 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 continuously 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 action is 0, which does not reach the first threshold. The electronic device can perform a frame skipping operation (also referred to as not performing a refresh action) on the display screen to maintain the display of image frame 2 (also referred to as the second image frame).
[0204] For example, combining Figure 11As shown, at the end moment of the seventh display cycle (also known as the eighth moment), the electronic device obtains a Vsync signal (also known as the eighth Vsync signal), and the electronic device responds to the Vsync signal to determine that the first application generates image frame 3 between the end moment of the sixth display cycle (also known as the second moment, or also known as a moment between the second moment and the eighth moment) and the end moment 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).
[0205] For example, combining Figure 11 As shown, assuming that the second threshold is 3, at the end of the fifth display cycle (also referred to as the eighth moment), the electronic device obtains a Vsync signal (also referred to as the eighth Vsync signal), and the electronic device responds to the Vsync signal to determine that the first application has not generated image frames in the third display cycle to the fifth display cycle, indicating that the electronic device has determined that the number of display cycles in which no image frames have been generated continuously has reached the second threshold 3, and the electronic device can refresh the display image frame 2 on the display screen.
[0206] For example, combining Figure 11 As shown, assuming that the first threshold is 1, at the end moment of the fourth display cycle (also referred to as the eighth moment), the electronic device obtains a Vsync signal (also referred to as the eighth Vsync signal), and the electronic device responds to the Vsync signal to determine that the first application performs a frame skipping operation (also referred to as not performing a refresh action) in the fourth display cycle, indicating that the electronic device determines that the number of times the display screen does not perform a refresh action reaches the first threshold 1, and the electronic device can refresh the display image frame 2 on the display screen.
[0207] It should be noted that the electronic device in the above embodiment is a mobile phone for illustrative purposes only. In some embodiments, the electronic device may be a tablet computer, a wearable device, an in-vehicle device, an augmented reality (AR) / virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), or other terminal device. This application does not impose any particular restrictions on the specific form of the above electronic devices.
[0208] An embodiment of the present application further provides a computer-readable storage medium storing a computer program, which, when executed by a computer, can implement one or more steps in any of the above-mentioned display screen refreshing methods.
[0209] The computer readable storage medium may be a non-transitory computer readable storage medium, for example, a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
[0210] Another embodiment of the present application further provides a computer program product comprising instructions, which, when executed by a computer, can implement one or more steps in any of the above-mentioned display screen refreshing methods.
[0211] 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 that can be achieved can refer to the beneficial effects in the corresponding display screen refresh method provided above, and will not be repeated here.
[0212] The terms "first", "second" and "third" in the specification, claims and drawings of this application are used to distinguish different objects rather than to limit a specific order.
[0213] In the embodiments of this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of this application should not be interpreted as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.
[0214] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for refreshing a display screen, characterized in that: Applied to an electronic device, the electronic device includes a first application and a display screen, and the method includes: During the process of displaying the first image frame on the display screen, the first application generates a second image frame; At a first moment, the electronic device refreshes and displays the second image frame on the display screen in response to a first Vsync signal; the first Vsync signal is obtained at the first moment; and a frame rate of image frames generated by the first application is less than a refresh rate of the display screen; At a second moment, the electronic device does not perform a refresh action on the display screen in response to a second Vsync signal, and maintains displaying the second image frame; the second Vsync signal is obtained at the second moment; the second moment is later than the first moment; and the first application does not generate an image frame between the first moment and the second moment; At a fifth moment, it is determined that a number of display periods during which the first application has not continuously generated an image frame reaches a second threshold, and the electronic device refreshes and displays the second image frame on the display screen in response to a fifth Vsync signal; the fifth Vsync signal is obtained at the fifth moment; and the display period refers to a duration between two consecutive Vsync signals obtained by the electronic device; At a sixth moment, the electronic device obtains a sixth Vsync signal; In which, in the first period between the first moment and the second moment, the display screen continuously displays the second image frame; in the second period between the fifth moment and the sixth moment, the display screen continuously displays the second image frame; the duration of the first period is less than the duration of the second period; the first application does not generate an image frame between the first moment and the fifth moment.
2. The method according to claim 1, characterized in that Also includes: During the process of the display screen maintaining displaying the second image frame, the first application generates a third image frame; At a third moment, the electronic device refreshes and displays the third image frame on the display screen in response to a third Vsync signal; the third Vsync signal is obtained at the third moment.
3. The method according to claim 1, characterized in that Also includes: At a fourth moment, the electronic device refreshes and displays the second image frame on the display screen in response to a fourth Vsync signal; the fourth Vsync signal is obtained at the fourth moment; The first application does not generate any image frames between the first moment and the fourth moment.
4. The method according to claim 3, characterized in that Before the electronic device refreshes and displays the second image frame on the display screen in response to the fourth Vsync signal, the electronic device further includes: It is determined that the number of times that the display screen does not perform a refresh action reaches a first threshold.
5. The method according to claim 1, characterized in that Also includes: At a seventh moment, the electronic device determines, in response to the seventh Vsync signal, that the first application has not generated an image frame between the second moment and the seventh moment, determines that a number of display periods in which the first application has not continuously generated an image frame has not reached a second threshold, and determines that a number of times the display screen has not performed a refresh action has not reached a first threshold, and then does not perform a refresh action on the display screen, and maintains displaying the second image frame. The seventh Vsync signal is obtained at the seventh moment; and the display period refers to the duration between two consecutive Vsync signals obtained by the electronic device.
6. The method according to claim 1, characterized in that Also includes: At an eighth moment, the electronic device determines, in response to an eighth Vsync signal, that the first application generates an image frame between the second moment and the eighth moment, or determines that the number of display cycles in which the first application does not continuously generate an image frame reaches a second threshold, or determines that the number of times the display screen does not perform a refresh action reaches a first threshold, and refreshes and displays the image frame on the display screen; the eighth Vsync signal is obtained at the eighth moment; The display period refers to the duration between two consecutive Vsync signals obtained by the electronic device.
7. The method according to any one of claims 4 to 6, characterized in that Also includes: The first threshold is calculated based on the ratio of the refresh rate of the second image frame to the minimum refresh rate.
8. An electronic device, characterized in that: including memory and processor; The memory is coupled to the processor, and the memory is used to store computer program code, where the computer program code includes computer instructions. One or more of the processors call the computer instructions to enable the electronic device to execute the display screen refresh method according to any one of claims 1 to 7.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for refreshing a display screen according to any one of claims 1 to 7 is implemented.
10. A computer program product, characterized in that The invention comprises computer program codes, which, when executed by an electronic device, implement the steps of the method for refreshing a display screen according to any one of claims 1 to 7.
Citation Information
Patent Citations
Method and apparatus for controlling refreshing frequency, time schedule controller, and display apparatus
CN107799053A