Refresh rate adjustment method and related device

By monitoring and adjusting the refresh rate to match the frame rate of the game application, the problem of screen choppy caused by the increase in refresh rate was solved, achieving a balance between screen smoothness and power consumption.

CN122308690APending Publication Date: 2026-06-30HONOR DEVICE CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HONOR DEVICE CO LTD
Filing Date
2024-12-27
Publication Date
2026-06-30

AI Technical Summary

Technical Problem

In game scenarios, an increased refresh rate leads to a decrease in the frame rate, resulting in choppy visuals.

Method used

By monitoring the trends in refresh rate and frame rate, the screen refresh rate is adjusted to match the frame rate of the game application, ensuring that the frame rate is restored to or higher than the original frame rate. A sliding window technique is used to calculate the average frame rate and remove abnormal data to improve the accuracy of the adjustment.

Benefits of technology

It effectively avoids the problem of inconsistent screen display, improves the smoothness of the screen, and reduces the power consumption caused by screen refresh.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122308690A_ABST
    Figure CN122308690A_ABST
Patent Text Reader

Abstract

This application discloses a refresh rate adjustment method and related equipment, belonging to the field of terminal technology. The method includes: at a first moment, a first application renders frames at a first running frame rate; the screen displays image data rendered by the first application at the first refresh rate; at a second moment, in response to a refresh rate switching command, the screen displays image data corresponding to the first application at a second refresh rate, where the second refresh rate is greater than the first refresh rate; the first application renders frames at the second running frame rate; if the second running frame rate is less than the first running frame rate, at a third moment, the screen displays image data corresponding to the first application at a target refresh rate, so that the first application renders frames at a third running frame rate greater than or equal to the first running frame rate; the frame rendering of the first application is synchronized with the screen refresh cycle. This application can ensure the smoothness of the image as much as possible.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of terminal technology, and in particular to a refresh rate adjustment method and related equipment. Background Technology

[0002] With the rapid development of terminal technology, electronic device screens can support multiple refresh rates, which can be adjusted according to changes in the frame rate of applications. For example, when the frame rate of an application running on an electronic device decreases, the electronic device can correspondingly reduce its refresh rate, thereby reducing power consumption.

[0003] Changes in refresh rate also affect the frame rate. For example, if an application's frame rate is 60fps, and the refresh rate is adjusted to 90Hz, the application's frame rate will adaptively adjust to 45fps, meaning it will be adjusted to a multiple of the refresh rate. However, in some scenarios (such as gaming), when the refresh rate increases but the application's frame rate decreases, it can easily affect the smoothness of the visuals. Summary of the Invention

[0004] This application provides a refresh rate adjustment method and related equipment, which can match a more suitable refresh rate for applications and ensure smooth screen display. The technical solution is as follows:

[0005] Firstly, a refresh rate adjustment method is provided for use in electronic devices, the method comprising:

[0006] At a first moment, the first application renders frames at a first running frame rate; the screen displays the image data rendered by the first application at a first refresh rate; at a second moment, in response to a refresh rate switching command, the screen displays the image data corresponding to the first application at a second refresh rate, which is greater than the first refresh rate; the first application renders frames at the second running frame rate; if the second running frame rate is less than the first running frame rate, at a third moment, the screen displays the image data corresponding to the first application at a target refresh rate, so that the first application renders frames at a third running frame rate, which is greater than or equal to the first running frame rate; wherein, the frame rendering of the first application is synchronized with the screen refresh cycle.

[0007] As an example, the first application is a game application.

[0008] As an example, the first time point is t1, the second time point is t2, and the third time point is t3.

[0009] In one possible scenario, the screen refresh rate is the primary refresh rate when the game application is running. In another possible scenario, the screen refresh rate is not the primary refresh rate when the game application is running, but the electronic device can adjust the screen refresh rate to the primary refresh rate at least once.

[0010] The refresh rate switching command may be triggered by the user or determined by the electronic device based on the scenario.

[0011] If the first application draws frames at the third running frame rate, the drawing frame requirements of the first application can be met.

[0012] Therefore, after the screen refresh rate is increased, it is determined whether the frame rate of the first application has decreased. If the frame rate of the first application has decreased, a more suitable refresh rate is determined, i.e., a target refresh rate is established. The target refresh rate is the refresh rate that restores the frame rate of the first application to or higher than its original frame rate. In this way, the problem of screen choppyness caused by the increase in refresh rate can be avoided as much as possible, thus ensuring smooth gameplay.

[0013] As an example of this application, the target refresh rate is an integer multiple of the first refresh rate. This allows the frame rate of the first application to be restored to the original frame rate as closely as possible.

[0014] As an example of this application, the method further includes: determining a first candidate refresh rate based on a first refresh rate when the second running frame rate is less than the first running frame rate. At a fourth moment, the screen displays image data corresponding to the first application at the first candidate refresh rate; the fourth moment is greater than the second moment and less than the third moment. If, after the first application displays the image data corresponding to the first application at the first candidate refresh rate, it then performs frame drawing at a third running frame rate, the first candidate refresh rate is used as the target refresh rate.

[0015] In other words, after one adjustment, if the frame rate of the first application can be adjusted to be greater than or equal to the first frame rate, then the screen will be refreshed at the first candidate refresh rate.

[0016] As an example of this application, if the first application draws frames at a fourth running frame rate after the image data corresponding to the first application is displayed on the screen at a first candidate refresh rate, then the screen displays the image data of the first application at a second refresh rate, wherein the fourth running frame rate is less than the first running frame rate.

[0017] In this way, it can be ensured that when the refresh rate adjustment is triggered by the user, the screen refreshes and displays the image data of the game application according to the user's needs.

[0018] As an example of this application, determining a first candidate refresh rate based on a first refresh rate includes: determining the product of the first refresh rate and a first value; if the product of the first refresh rate and the first value is greater than the maximum refresh rate in the refresh rate set, then the first refresh rate is used as the first candidate refresh rate, wherein the refresh rate set includes all refresh rates supported by the electronic device.

[0019] For example, the first value is 2.

[0020] If twice the first refresh rate is less than the first candidate refresh rate, it means that the refresh rate cannot be adjusted higher. In this case, since the first refresh rate can meet the frame drawing requirements of the first application, the first refresh rate can be directly determined as the first candidate refresh rate so that the screen refreshes and displays at the first candidate refresh rate.

[0021] As an example, the method further includes: if the product of the first refresh rate and the first value is not greater than the refresh rate set, then determining at least one second candidate refresh rate belonging to the refresh rate set, wherein each of the at least one second candidate refresh rate is an integer multiple of the first refresh rate and each of the second candidate refresh rates is less than the maximum refresh rate supported by the electronic device; determining a first candidate refresh rate from the at least one second candidate refresh rate, wherein the first candidate refresh rate is the second candidate refresh rate ranked second in ascending order among the at least one second candidate refresh rates.

[0022] In this way, the smallest refresh rate that is greater than the first refresh rate and is an integer multiple of the first refresh rate can be found, and the screen can be controlled to refresh at this refresh rate. This allows us to determine whether the refresh rate can meet the frame drawing requirements of the first application, while avoiding using the highest refresh rate directly as much as possible, thus reducing the power consumption caused by screen refresh.

[0023] As an example of this application, the method for determining the running frame rate of the first application includes: whenever the first application draws a frame of image data, adding the frame identifier of the currently drawn image data to the frame identifier sequence and recording the drawing time of the currently drawn image data; sliding the sliding window in the frame identifier sequence according to a preset sliding step size, the window length of the sliding window being a second value; each time the sliding window slides once, determining the average running frame rate of the image data indicated by the frame identifier in the current sliding window based on the drawing time of the image data indicated by the frame identifier in the current sliding window and the second value, thus obtaining the average running frame rate corresponding to the current sliding window; when obtaining the average running frame rates corresponding to M sliding windows, determining the average value of the average running frame rates corresponding to the M sliding windows, where M is an integer greater than 1; from the preset running frame rate set, determining the preset running frame rate that is greater than the average value and has the smallest difference from the average value, and the running frame rate of the first application is the determined preset running frame rate.

[0024] The preset sliding step size can be set as needed. The second value can also be set according to actual needs. For example, the preset sliding step size is 5, and the second value is 20.

[0025] In this way, by statistically analyzing the average frame rate of the first application, the actual frame rate of the first application during the frame drawing process can be obtained, providing accurate data for subsequent judgments and thus improving the accuracy of refresh rate adjustment.

[0026] Optionally, before determining the average of the average frame rates corresponding to the M sliding windows, the average frame rates corresponding to the M sliding windows can be filtered to remove abnormal data. Then, the average of the remaining average frame rates corresponding to the sliding windows after filtering can be determined, and combined with a preset set of frame rates to determine the frame rate of the first application. In this way, by removing abnormal data, the accuracy of the calculation can be improved.

[0027] As an example of this application, each time the sliding window is slid, the average running frame rate of the image data indicated by the frame identifier in the current sliding window is determined based on the frame drawing time of the image data indicated by the frame identifier in the current sliding window and the second value, thereby obtaining the average running frame rate corresponding to the current sliding window. This includes: each time the sliding window is slid, determining the total frame drawing time of the image data indicated by the frame identifier in the current sliding window based on the frame drawing time of the image data indicated by the frame identifier in the current sliding window; dividing the total frame drawing time of the image data indicated by the frame identifier in the current sliding window by the second value to obtain the average running frame rate corresponding to the current sliding window.

[0028] In this way, the real-time running frame rate of the first application during the frame drawing process can be determined in real time through the sliding window, providing accurate and reliable data for monitoring changes in refresh rate and running frame rate, and improving the accuracy and effectiveness of refresh rate adjustment.

[0029] In a second aspect, an electronic device is provided, the electronic device comprising: one or more processors, and a memory; the memory being coupled to the one or more processors, the memory being used to store computer program code, the computer program code including computer instructions, wherein the one or more processors invoke the computer instructions to cause the electronic device to perform a refresh rate adjustment method as described in any one aspect.

[0030] Thirdly, a chip system is provided, the chip system being applied to an electronic device, the chip system including one or more processors, the one or more processors being configured to invoke computer instructions to cause the electronic device to perform a refresh rate adjustment method as described in any one of the first aspects.

[0031] Fourthly, a computer-readable storage medium is provided, the computer-readable storage medium including instructions that, when executed on an electronic device, cause the electronic device to perform the refresh rate adjustment method as described in any one of the first aspects.

[0032] Fifthly, a computer program product containing instructions is provided, which, when run on a computer, causes the computer to perform the refresh rate adjustment method described in the first aspect.

[0033] The technical effects achieved by the second, third, fourth, and fifth aspects mentioned above are similar to those achieved by the corresponding technical means in the first aspect mentioned above, and will not be repeated here. Attached Figure Description

[0034] Figure 1 This is a schematic diagram illustrating an interface according to an exemplary embodiment;

[0035] Figure 2 This is a schematic diagram illustrating the overlay effect between layers according to an exemplary embodiment;

[0036] Figure 3 This is a schematic diagram illustrating a drawing and display process according to an exemplary embodiment;

[0037] Figure 4 This is a schematic diagram illustrating image data rendering based on a Vsync signal according to an exemplary embodiment;

[0038] Figure 5This is a schematic flowchart illustrating a refresh rate adjustment method according to an exemplary embodiment;

[0039] Figure 6 This is a schematic diagram illustrating a refresh rate setting interface according to an exemplary embodiment;

[0040] Figure 7 This is a schematic diagram illustrating a sliding window for determining the average running frame rate according to an exemplary embodiment;

[0041] Figure 8 This is a schematic diagram of a sliding window L for removing abnormal data according to an exemplary embodiment;

[0042] Figure 9 This is a schematic diagram illustrating an application scenario according to an exemplary embodiment;

[0043] Figure 10 This is a schematic diagram illustrating the change in refresh rate and running frame rate according to an exemplary embodiment;

[0044] Figure 11 This is a schematic diagram illustrating a decision result feedback according to an exemplary embodiment;

[0045] Figure 12 This is a schematic diagram illustrating a software system of an electronic device according to an exemplary embodiment;

[0046] Figure 13 This is a schematic diagram of a framework for adjusting a refresh rate according to an exemplary embodiment;

[0047] Figure 14 This is a flowchart illustrating a refresh rate adjustment method according to another exemplary embodiment;

[0048] Figure 15 This is a schematic diagram of the structure of an electronic device according to an exemplary embodiment. Detailed Implementation

[0049] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.

[0050] It should be understood that "multiple" as mentioned in this application refers to two or more. In the description of this application, unless otherwise stated, " / " indicates "or," for example, A / B can mean A or B; "and / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist, for example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Furthermore, to facilitate a clear description of the technical solutions of this application, the terms "first," "second," etc., are used to distinguish identical or similar items with essentially the same function and effect. Those skilled in the art will understand that the terms "first," "second," etc., do not limit the quantity or execution order, and that "first," "second," etc., do not necessarily imply differences.

[0051] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.

[0052] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant regulations and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.

[0053] In this application's embodiments, the "user interface (UI)" is the medium through which an application or operating system interacts and exchanges information with the user. It converts the internal form of information into a form that the user can receive. The user interface is source code written in a specific computer language such as Java or Extensible Markup Language (XML). This source code is parsed and rendered on the electronic device, ultimately presenting content that the user can recognize. A common form of user interface is the graphical user interface (GUI), which refers to a user interface related to computer operation displayed graphically. Typically, it can be visible interface elements displayed on the screen of an electronic device, such as text, icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, and widgets.

[0054] Before introducing the refresh rate adjustment method provided in the embodiments of this application, the relevant terms involved in the embodiments of this application will be introduced first.

[0055] (1) Surface: It can be understood as a transparent film or a superimposed transparent sheet. Each layer can contain different image elements. Each application may correspond to one or more layers. The display interface of an electronic device can be composed of one or more layers. In other words, a frame of image displayed on the screen can be composed of one or more layers.

[0056] For example, see Figure 1 The phone's display interface can be composed of three layers: the top status bar 11, the bottom navigation bar 12, and the middle application interface 13. The application interface 13 is the application interface of the application currently running in the foreground.

[0057] The top status bar (11) corresponds to the status bar application layer. The bottom navigation bar (12) corresponds to the navigation bar application layer. The application interface (13) corresponds to the foreground application layer.

[0058] It should be understood that the display interface of an electronic device can also be composed of other layers; the embodiments in this application are merely examples. Figure 1 Let's take an example to illustrate.

[0059] Each layer has corresponding layer properties, which can include information such as the layer's position, size, and level.

[0060] Position information is used to indicate the display position of a layer on the screen. For example, position information may include the pixel coordinates of the layer's endpoints on the screen, such as the pixel coordinates of the top-left, bottom-left, top-right, and bottom-right endpoints.

[0061] Size information is used to indicate the size of the layer.

[0062] Layer information is used to indicate the stacking order of layers in the vertical direction of the screen plane. That is, the layer information of each layer included in a frame of image describes the vertical stacking relationship between the multiple layers included in this frame of image. The higher the layer information, the more prominent the corresponding layer is in the vertical direction of the screen plane.

[0063] For example, see Figure 2 , Figure 2 This is a schematic diagram illustrating the order of multiple layers on the Z-axis according to an embodiment of this application. The layers, displayed on the screen from top to bottom, include surface0, surface1, and surface2. Surface2 partially covers surface1, and surface1 partially covers surface0; that is, surface2 is superimposed on surface1, and surface1 is superimposed on surface0. The layer information for surface0, surface1, and surface2 is represented as 0, 1, and 2, respectively.

[0064] (2) Surfaceflinger (SF): is a system service mainly used to implement functions such as layer creation, control, and management.

[0065] In the display systems of electronic devices, SurfaceFlinger can be used to composite layers. For example, after an application starts, SurfaceFlinger can create a layer for that application, allowing the application to render based on that layer to obtain the layer to be displayed. During the operation of the electronic device, SurfaceFlinger can acquire the layers to be displayed from various applications within the electronic device, and then composite these layers to obtain the image data corresponding to the display interface.

[0066] When compositing layers, Surfaceflinger can use HWC for compositing, or it can use both HWC and the GPU for compositing.

[0067] (3) GPU Compositing: A GPU is a general-purpose image processing device. Besides layer compositing, GPUs can also be used to complete other graphics processing tasks. GPU compositing refers to a layer compositing method that uses the GPU to composite layers. In some layer compositing strategies, GPU compositing is used when HWC compositing cannot meet the compositing conditions, or HWC compositing and GPU compositing are used in combination to achieve the final compositing effect. Specifically, layers that do not meet the conditions can be composited using GPU, and the composited data can be used as input data for HWC compositing for secondary compositing.

[0068] (4) HWC Compositing: This refers to a layer compositing method that uses HWC to composite layers. HWC compositing is a hardware compositing method, meaning that there is a separate hardware processing unit in the electronic device for layer compositing, and the composited result is directly sent to the screen for display (i.e., for display). Its advantages are that the highly customized process and results can produce higher compositing efficiency, and compared to GPU compositing, HWC compositing has relatively lower power consumption. For example, a comparison of HWC compositing and GPU compositing methods can be shown in Table 1 below:

[0069] Table 1

[0070]

[0071] As shown in Table 1, HWC synthesis has advantages over GPU synthesis, such as lower power consumption, higher performance, and faster synthesis speed.

[0072] (5) Frame rate: This refers to the number of still images displayed per second, which determines the speed at which images are generated. Its unit is frames per second (FPS). A higher frame rate can provide smoother visuals and better responsiveness. For example, in video games, the frame rate is crucial to the player's experience. A stable high frame rate can provide a smoother gaming experience, reduce input lag, and improve reaction speed.

[0073] (6) Refresh Rate: This refers to the screen refresh rate of an electronic device. The refresh rate is the number of times the screen refreshes its display per second, measured in Hz (Hertz). Electronic devices support refresh rates including, but not limited to, 60Hz, 90Hz, 120Hz, and 144Hz. For example, a 60Hz refresh rate means the screen can refresh 60 times per second. A higher refresh rate results in lower latency and smoother display, but also higher power consumption.

[0074] In some embodiments, the refresh rate can be adaptively adjusted according to the running frame rate. For example, when the running frame rate is 60 FPS, the electronic device will adaptively adjust the refresh rate to 60 Hz, and when the running frame rate is 120 FPS, the electronic device will adaptively adjust the refresh rate to 120 Hz. Generally, the running frame rate should match or be close to the refresh rate to obtain the best display effect.

[0075] (7) Vertical synchronization (Vsync) signal: used to synchronize the screen refresh rate and the application's frame rate to avoid screen tearing.

[0076] Generally, in a display system, the Vsync signal can simultaneously trigger the application rendering process, the layer compositing process, and the hardware display process. After the screen completes the display of one frame of image data, the hardware side triggers the software side to execute the next display process according to the Vsync signal cycle. Correspondingly, the software side simultaneously triggers the application rendering process, the layer compositing process, and the hardware display process.

[0077] For example, Figure 3 This is a schematic diagram illustrating a display process based on a Vsync signal, according to an exemplary embodiment. Figure 3 As shown, the display system can execute the application rendering process of the i-th frame image data in the Kth Vsync cycle, the layer compositing process of the i-th frame image data in the K+1th Vsync cycle, and the hardware display process of the i-th frame image data in the K+2th Vsync cycle. The hardware side displays the interface based on the image data sent by the software side. Additionally, when the K+1th Vsync signal arrives, i.e., at the beginning of the K+1th Vsync cycle, the application rendering process of the i+1th frame image data can also be started, the layer compositing process of the i+1th frame image data can be executed in the K+2th Vsync cycle, and the hardware display process of the i+1th frame image data can be executed in the K+3th Vsync cycle. Furthermore, when the K+2th Vsync signal arrives, i.e., at the beginning of the K+2th Vsync cycle, the application rendering process of the i+2th frame image data can also be started, the layer compositing process of the i+2th frame image data can be executed in the K+3rd Vsync cycle, and the hardware display process of the i+2th frame image data can be executed in the K+4th Vsync cycle.

[0078] As can be seen, when using vertical synchronization (VSync) technology, to ensure that each frame can be rendered within the screen's refresh cycle, the display system waits for the screen to complete one refresh before starting to render the next frame. This means that the game application draws frames according to the Vsync signal, implying that the application's frame rate is an integer multiple of the refresh rate to ensure that each refresh cycle corresponds to a complete frame rendering cycle. In other words, VSync technology limits the application's frame rate to an integer multiple of the screen's refresh rate.

[0079] Some game applications have strict requirements on the ratio of refresh rate to frame rate. These applications render frames based on the Vsync signal. This application primarily uses an example of such a game application. For instance, a game application runs well at a 60Hz refresh rate, with a frame rate of 60fps. When the refresh rate is adjusted to 90Hz, since 90Hz is not an integer multiple of 60Hz, if the game application's actual rendering capability is lower than 90fps, the frame rate will be reduced to 45fps. See, for example... Figure 4 The game application may draw a frame every other Vsync signal, such as drawing a frame when the first Vsync signal arrives, not drawing a frame when the second Vsync signal arrives, drawing a frame when the third Vsync signal arrives, not drawing a frame when the fourth Vsync signal arrives, and so on.

[0080] However, in the above scenario, an issue arises where the refresh rate increases while the frame rate decreases. If the screen refresh rate increases, but the game application's frame rate cannot keep up, the screen will frequently display old image data from the game application while waiting for new image data, resulting in a choppy and unsmooth visual experience.

[0081] Therefore, this application provides a refresh rate adjustment method. This method monitors the refresh rate and the running frame rate. When a change in the refresh rate is detected, the electronic device judges the trend of the screen's refresh rate change and the trend of the game application's running frame rate change, so as to match a more suitable refresh rate to the game application's running frame rate, thereby avoiding the problem of game screen choppyness as much as possible and improving the smoothness of the screen.

[0082] Next, combine Figure 5 The refresh rate adjustment method provided in the embodiments of this application is described below. See also: Figure 5 , Figure 5 This is a flowchart illustrating a refresh rate adjustment method according to an exemplary embodiment. It mainly includes some or all of the following:

[0083] S501: The game application starts in response to the startup command.

[0084] The game applications in this application typically have strict requirements on the ratio of refresh rate to frame rate.

[0085] As an example, a game application icon is displayed on the desktop of an electronic device. When a user wants to play a game, they can click the game application icon on the desktop to trigger a launch command. In response to this launch command, the electronic device launches the game application.

[0086] S502: After the game application runs, it draws frames based on the Vsync signal on the screen side.

[0087] S503: The screen displays image data drawn by the game application at a refresh rate of rf_1.

[0088] In one possible scenario, when the game application launches, the screen's current refresh rate (rf_1) is the same as the game application's original frame rate. This original frame rate refers to the frame rate at which the game was designed, or the ideal frame rate the game application can achieve. For example, if the game application's original frame rate is 60fps and the screen's current refresh rate (rf_1) is also 60Hz, then the game application performs one frame redraw operation each time a Vsync signal arrives.

[0089] In another possible scenario, when the game application launches, the screen's current refresh rate (rf_1) is different from the game application's original frame rate. For example, the screen's current refresh rate (rf_1) might be 90Hz, and the game application's original frame rate might be 60fps, or the screen's current refresh rate (rf_1) might be 144Hz, and the game application's original frame rate might be 60fps. In this case, because the game application supports vertical synchronization (V-Sync), the game application's frame rate will be limited to an integer multiple of the screen's refresh rate (rf_1). For instance, with a screen refresh rate (rf_1) of 90Hz, the game application's frame rate might be limited to 45fps, in which case the game application performs a frame drawing operation every V-Sync signal; similarly, with a screen refresh rate (rf_1) of 144Hz, the game application's frame rate might be limited to 72fps, and again, the game application performs a frame drawing operation every V-Sync signal.

[0090] As an example, the refresh rate rf_1 can be set by the user. See, for example... Figure 6In (a), when the user wants to set the refresh rate, the electronic device can trigger the display of the refresh rate setting interface S60 shown in the figure. The refresh rate setting interface S60 displays multiple settable levels, each corresponding to a different refresh rate. For example, the multiple levels include "High", "Medium", "Standard" and "Smart". The "High" level corresponds to a refresh rate of 120Hz, the "Medium" level corresponds to a refresh rate of 90Hz, and the "Standard" level corresponds to a refresh rate of 60Hz. When the "Smart" level is selected, the electronic device adaptively adjusts the refresh rate according to the scene, up to a maximum of 120Hz.

[0091] For example, see Figure 6 In (a), the user selects control 601 corresponding to the "Standard" setting. In response to the user's selection of control 601, the electronic device sets the screen refresh rate to 60Hz, at which point refresh rate rf_1 is 60Hz. See also... Figure 6 In (b), the user selects the control 602 corresponding to the "medium" setting. In response to the user's selection of the control 602 corresponding to the "medium" setting, the electronic device sets the screen refresh rate to 90Hz. At this time, the refresh rate rf_1 is 90Hz.

[0092] As another example, the refresh rate rf_1 can also be a refresh rate adaptively determined by the electronic device based on the scene. For instance, when the user selects the "Smart" setting in the refresh rate settings interface S60, the electronic device can automatically adjust the refresh rate according to different scenes, with different refresh rates corresponding to different scenes. For example, the electronic device can store different mapping relationships between running frame rates and refresh rates. Based on this mapping relationship, the electronic device can adaptively adjust the refresh rate according to the running frame rate of the focused application. Here, the focused application refers to the application that the user is currently operating through the mouse or keyboard, or the application whose interface is displayed prominently on the screen. For example, when the game application is the focused application, meaning the electronic device determines that the current scene is displaying the game application's interface, and the game application's running frame rate is 60fps, the electronic device adaptively adjusts the screen refresh rate to 60Hz, i.e., refresh rate rf_1 is 60Hz.

[0093] S504: Determines the frame rate (fps_1) after the game application starts running.

[0094] During the rendering process, the game application may not render frames according to the theoretical frame rate due to various reasons. To ensure the accuracy of subsequent calculations, electronic devices can determine the actual frame rate of the game application during the rendering process based on information such as the rendering time and frame identifier of the image data rendered by the game application.

[0095] Frame rendering time refers to the time it takes for a game application to render the corresponding image data.

[0096] A frame identifier is used to uniquely indicate a frame of image data drawn by a game application. Alternatively, a frame identifier can be used to represent an application layer drawn by the game application, that is, to indicate image data that has not been composited.

[0097] As an example of this application, the method for determining the frame rate of a game application includes: whenever the game application draws a frame of image data, adding the frame identifier of the currently drawn image data to the frame identifier sequence and recording the drawing time of the currently drawn image data. A sliding window is slid in the frame identifier sequence according to a preset sliding step size, the window length of which is a second value. Each time the sliding window slides, the average running frame rate of the image data indicated by the frame identifier within the current sliding window is determined based on the drawing time of the image data indicated by the frame identifier within the current sliding window and the second value, thus obtaining the average running frame rate corresponding to the current sliding window. When obtaining the average running frame rates corresponding to M sliding windows, the average value of the average running frame rates corresponding to the M sliding windows is determined, where M is an integer greater than 1. From the preset running frame rate set, the preset running frame rate that is greater than the average value and has the smallest difference from the average value is determined; the running frame rate of the game application is the determined preset running frame rate.

[0098] The frame identifier sequence is used to record the frame identifiers of the image data drawn by the game application.

[0099] The preset sliding step size can be set according to requirements. For example, the preset sliding step size is the length corresponding to 5 frame identifiers, that is, 5 frame identifiers are slid each time.

[0100] The second value can be set according to requirements. For example, the second value is the length corresponding to 20 frame identifiers.

[0101] The preset frame rate set can be set according to actual needs. The preset frame rates in the preset frame rate set are usually common values. For example, the preset frame rate set is {40, 45, 60, 90, 120}.

[0102] M can be set according to actual needs. As an example rather than a limitation, M can be set to 200.

[0103] In other words, the actual frame rate of a game application during frame rendering can be determined by statistically analyzing its average frame rate. To this end, whenever the game application renders a frame of image data, a frame identifier corresponding to that frame is added to the frame identifier sequence, indicating that the game application has completed a frame rendering operation. The electronic device can slide a window in the frame identifier sequence according to a preset sliding step size. Each sliding window contains a second number of frame identifiers. During the sliding process, based on the frame rendering time of the image data indicated by the frame identifier in each sliding window and the second value, the average frame rate of the image data indicated by the frame identifier in each sliding window is determined, thus obtaining the average frame rate corresponding to each sliding window. Whenever a certain number (M) of average frame rates corresponding to sliding windows are statistically analyzed, based on the currently analyzed M average frame rates and a preset set of frame rates, the actual frame rate during the game application's frame rendering process is determined according to the principle of upward archiving.

[0104] The specific implementation of determining the average frame rate of the image data indicated by the frame identifier within each sliding window, based on the frame drawing time of the image data indicated by the frame identifier within each sliding window and a second value, can include: Each time the sliding window slides, determining the total frame drawing time of the image data indicated by the frame identifier within the current sliding window, and dividing the total frame drawing time of the image data indicated by the frame identifier within the current sliding window by the second value, yields the average frame rate corresponding to the current sliding window. For example, determining the time difference between the frame drawing time of the last frame identifier indicated by the frame identifier and the frame drawing time of the first frame identifier indicated by the frame identifier within the current sliding window yields the total frame drawing time of the image data indicated by the frame identifier within the current sliding window. Then, dividing the total frame drawing time by the total number of frames of the image data indicated by the frame identifier within the current sliding window (i.e., the second value) yields the average frame rate corresponding to the current sliding window.

[0105] It is understandable that after the game application starts, the calculation of the average frame rate corresponding to the first sliding window needs to begin after the game application has drawn at least a second number (e.g., 20) frames of image data.

[0106] For example, see Figure 7In example (a) with a window length of 20 and a preset sliding step size of 5, starting from the beginning of the calculation, after 20 frames (including frames i to j) of image data are drawn, the electronic device determines the time difference between the drawing time of frame j and the drawing time of frame i, thereby obtaining the total drawing time of the image data indicated by the frame identifier within the first sliding window. Then, the determined total drawing time is divided by the number of frames drawn in the first sliding window (i.e., 20) to obtain the average running frame rate corresponding to the first sliding window. See also... Figure 7 In step (b), within the second sliding window (i.e., after the sliding window moves backward by 5 steps), the electronic device determines the time difference between the drawing time of frame i+5 and frame j+5, thereby obtaining the total drawing time for the game application to draw the image data indicated by the frame identifier within the second sliding window. Then, it divides the determined total drawing time by the number of frames drawn (i.e., 20) of the image data within the second sliding window to obtain the average frame rate corresponding to the second sliding window. Similarly, after obtaining the average frame rates corresponding to M sliding windows in this manner, the average of these M average frame rates is determined. Then, following the principle of upward archiving, the preset frame rate closest to this average is found from the preset frame rate set and used as the actual frame rate for the current drawing of the game application. For example, if the average of the average frame rates corresponding to the M sliding windows is 59, and the preset frame rate set is {40, 45, 60, 90, 120}, then the current frame rate of the game application can be determined to be 60fps.

[0107] Optionally, after obtaining the average frame rate corresponding to the M sliding windows, some abnormal data in these M average frame rates can be removed. Then, based on the remaining average frame rate after removal and the preset frame rate set, the current frame rate of the game application is determined in the above manner.

[0108] In one example, during the process of removing outlier data, another sliding window can be created. To distinguish it from the sliding window mentioned above, we will call it sliding window L. After obtaining M average frame rates, the sliding window L is slid across the frame rate sequence composed of the M average frame rates according to a preset sliding step size (e.g., 1). Each time it slides, the standard deviation of the average frame rate within the current sliding window L is calculated. If the standard deviation corresponding to the current sliding window does not exceed the preset standard deviation range, it means that there is no outlier data in the average frame rate within the current sliding window L. If the standard deviation corresponding to the current sliding window L exceeds the preset standard deviation range, outlier average frame rates can be filtered out by determining the standard deviations of adjacent sliding windows L.

[0109] For example, see Figure 8Taking M average frame rates (30, 35, 40, 45, 90, 50, 55, 70...) as an example, if the sliding window L has a window length of 3 and a sliding step size of 1, then within the first sliding window L, the standard deviations of the three average frame rates (30, 35, 40) are determined. If these standard deviations do not exceed the preset standard deviation range, it indicates that there is no outlier data among these three average frame rates. The sliding window L then slides forward one sliding step. Similarly, within the second sliding window L, the standard deviations of the three average frame rates (35, 40, 45) are determined. If these standard deviations do not exceed the preset standard deviation range, it indicates that there is no outlier data among these three average frame rates. The sliding window L then slides forward one sliding step. Within the third sliding window L, the standard deviations of the three average frame rates (40, 45, and 90) are determined. These three standard deviations exceed the preset range. Since the first two average frame rates (40, 45, and 90) are not considered abnormal based on the standard deviations corresponding to the first and second sliding windows L, 90 is determined to be an abnormal value, and the electronic device removes 90. Using this method, all abnormal data across M average frame rates can be removed.

[0110] The above-mentioned preset standard deviation range can be set according to actual needs.

[0111] It is worth mentioning that removing outlier data can improve the accuracy of calculations.

[0112] Optionally, after removing abnormal data, a portion of the average frame rates remaining after removal can be selected according to a certain strategy. Then, the average value of the selected portion of average frame rates is determined, and combined with a preset set of running frame rates, the current running frame rate of the game application is determined.

[0113] In this way, the electronic device can periodically determine the actual frame rate of the game application during its operation.

[0114] S505: Determine if the running frame rate fps_1 is the same as the original frame rate fps_0 of the game application.

[0115] After determining the game application's running frame rate fps_1, it is compared with the game application's original frame rate fps_0 to determine whether the screen's current refresh rate rf_1 can meet the game application's frame rendering requirements. If the running frame rate fps_1 is the same as the game application's original frame rate fps_0, it means that the screen's current refresh rate rf_1 can meet the game application's frame rendering requirements, and the screen maintains its current refresh rate rf_1, proceeding to operation S511 below; if the running frame rate fps_1 is different from the game application's original frame rate fps_0, it means that the screen's current refresh rate rf_1 cannot meet the game application's frame rendering requirements. In this case, the screen refresh rate can be adjusted according to a certain strategy to make the screen refresh rate meet the game application's frame rendering requirements, or in other words, to make the game application's running frame rate reach its original frame rate. For details, please refer to operation S506 and subsequent operations below.

[0116] S506: Determine the third candidate refresh rate rf_2 based on the current running frame rate fps_1 of the game application.

[0117] As an example, the third candidate refresh rate rf_2 can be determined based on the game application's running frame rate fps_1 using the following formula (1):

[0118] rf-2=min{x≥fps-1|x∈Q}(1)

[0119] Where Q represents the set of all refresh rates currently supported by the electronic device.

[0120] S507: The screen displays image data drawn by the game application at the third candidate refresh rate rf_2.

[0121] In other words, if the game application's frame rate is not the original frame rate after it starts, it can first select a refresh rate from the set of refresh rates supported by the electronic device that is greater than the current frame rate and has the smallest difference from the current frame rate, and then control the screen to refresh the display at this refresh rate.

[0122] S508: After the screen refreshes at the third candidate refresh rate rf_2, redetermine the current running frame rate fps_2 of the game application.

[0123] It's understandable that, due to the limitations of the screen's refresh rate, the game application's frame rate will change accordingly after the screen's refresh rate changes. That is, after the screen refreshes at the third candidate refresh rate rf_2, the game application renders frames based on the Vsync signal corresponding to refresh rate rf_2. The electronic device can then further determine the game application's current frame rate fps_2.

[0124] For details on how to determine the frame rate of a game application, please refer to the description in S503.

[0125] S509: Determine whether the running frame rate fps_2 has reached the original frame rate.

[0126] In other words, it determines whether the game application's frame rate (fps_2) reaches the original frame rate after the screen refreshes at the third candidate refresh rate (rf_2). If the game application's frame rate (fps_2) is still not the original frame rate, then proceed to operation S510. If the game application's frame rate is the original frame rate, then the screen refresh rate adjustment ends. Afterwards, proceed to operation S511 as follows.

[0127] S510: Update the running frame rate fps_1 to fps_2 and return to the operation of S506.

[0128] If the game application still does not reach its original frame rate after the screen refreshes at the third candidate refresh rate rf_2, the electronic device continues to determine the next third candidate refresh rate based on the current running frame rate (i.e., fps_2) of the game application using the formula (1) above. After the screen refreshes at the next third candidate refresh rate, the running frame rate of the game application is determined, and it is judged whether the running frame rate of the game application has reached the original frame rate. That is, the operations from S506 to S510 are executed in a loop until the running frame rate of the game application is adjusted to the original frame rate, and the screen refresh rate adjustment ends.

[0129] For example, the original frame rate of the game application is 60fps, and the set of refresh rates supported by the electronic device is {60, 90, 120}. If the screen refresh rate is 90Hz, it is determined by detection that the game application starts at a running frame rate of 45fps. 45fps is not equal to 60fps, therefore the screen refresh rate is adjusted. During this process, according to formula (1), the third candidate refresh rate is determined to be 60Hz, and the electronic device adjusts the screen refresh rate to 60Hz. Afterwards, the electronic device detects the running frame rate of the game application again. If the running frame rate of the game application is 60fps, that is, the original frame rate is reached, then the screen refresh rate adjustment ends.

[0130] For example, if the original frame rate of a game application is 60fps, and the set of refresh rates supported by the electronic device is {60, 90, 120, 144}, and the screen refresh rate is 144Hz, it is determined through detection that the game application starts at a frame rate of 72fps. 72fps is not equal to 60fps, therefore the screen refresh rate is adjusted. During this process, according to formula (1), the third candidate refresh rate is determined to be 90Hz, and the electronic device adjusts the screen refresh rate to 90Hz. Afterwards, the electronic device detects the game application's frame rate again. If the game application's frame rate is 45fps, which is still not 60fps, then the next third candidate refresh rate is determined according to formula (1) to be 60fps, and the electronic device adjusts the screen refresh rate to 60Hz. Afterwards, the electronic device detects the game application's frame rate again. If the game application's frame rate is 60fps, which is the original frame rate, then the screen refresh rate adjustment ends.

[0131] It is worth noting that the embodiments of this application gradually adjust the refresh rate through the above formula (1) to match a more suitable refresh rate for the game application. This can minimize the power consumption caused by the screen refresh rate while ensuring the frame drawing requirements of the game application.

[0132] Then, proceed with the following operation S511.

[0133] S511: At time t1, the screen continues to display the image data drawn by the first application at the first refresh rate.

[0134] t1 is a point in time after the game application has started running; more specifically, t1 is a point in time when the screen displays the game application's image data at the first refresh rate.

[0135] As mentioned earlier, the first refresh rate may be user-set, for example, if refresh rate rf_1 is 60Hz, then the first refresh rate is refresh rate rf_1. Alternatively, the first refresh rate may be a third candidate refresh rate determined after multiple adjustments by the electronic device after the game application starts. For example, if refresh rate rf_1 is not 60Hz, and the third candidate refresh rate is 60Hz after adjustment, then the first refresh rate is the third candidate refresh rate. In other words, the first refresh rate is the refresh rate that allows the game application to render frames at the original frame rate. For example, the first refresh rate is 60Hz.

[0136] At time t1, the screen continues to display the image data of the game application at the first refresh rate. The game application draws frames at the first running frame rate, which is determined by the first refresh rate. The method for determining the first running frame rate can be found in S503.

[0137] It is worth noting that, provided that the first refresh rate can meet the frame drawing requirements of the game application, the screen is refreshed at the first refresh rate. Every time the screen refreshes a frame of image data, the game application is triggered to draw a frame of image data. That is, the screen refresh cycle is the same as the game application's frame drawing cycle. In this way, the smoothness of the game screen can be guaranteed.

[0138] S512: At time t2, in response to the refresh rate switching command, the screen displays the image data corresponding to the game application at a second refresh rate, which is greater than the first refresh rate.

[0139] Time t2 is later than time t1.

[0140] For example, the second refresh rate is 90Hz.

[0141] In one possible scenario, the refresh rate switching command is triggered by the user. See, for example... Figure 6 In (b), after the user sets the refresh rate to the "standard" level in the refresh rate setting interface S60, they reset the refresh rate in the refresh rate setting interface S60 again, for example, by selecting the control 602 corresponding to the "medium" level, thereby triggering the refresh rate switching command.

[0142] In another possible scenario, the refresh rate switching command can also be triggered by a specific scenario. For example, in cases where the refresh rate of the electronic device can be adaptively adjusted, see [reference needed]. Figure 9 If, during the display of the game application interface, the user triggers the electronic device to overlay the instant messaging application interface on the game application interface (S91), and the original frame rate of the instant messaging application is different from the original frame rate of the game application, this scenario triggers a refresh rate switching command.

[0143] In response to a refresh rate switching command, the electronic device adjusts the screen refresh rate to a second refresh rate. Thus, the screen displays the image data corresponding to the game application at the second refresh rate, such as displaying the image data corresponding to the game application at a refresh rate of 90Hz.

[0144] S513: The game application renders frames at the second running frame rate.

[0145] As mentioned earlier, the game application draws frames based on the Vsync signal on the screen side. Therefore, after the screen refresh rate switches from the first refresh rate to the second refresh rate, the game application's running frame rate switches from the first running frame rate to the second running frame rate.

[0146] The method for determining the second running frame rate of the game application can be found in step S503.

[0147] S514: Determine whether the second running frame rate is less than the first running frame rate.

[0148] After the screen refresh rate is switched, the electronic device determines the second running frame rate according to the implementation method of S503, and then compares the second running frame rate with the first running frame rate to determine whether the second running frame rate is less than the first running frame rate.

[0149] If the second running frame rate is not less than the first running frame rate, that is, the second running frame rate is greater than or equal to the first running frame rate, then proceed to the following operation S515; otherwise, if the second running frame rate is less than the first running frame rate, then proceed to the following operation S516 and subsequent operations.

[0150] S515: The screen continues to maintain the second refresh rate, and game applications continue to draw frames at the second running frame rate.

[0151] In other words, if the second running frame rate is greater than or equal to the first running frame rate, it means that the running frame rate of the game application has not decreased after the refresh rate is increased, and there will be no problem of screen choppyness. Therefore, in this case, the second refresh rate of the screen is maintained, and the game application continues to draw frames at the second running frame rate.

[0152] S516: Determine the first candidate refresh rate based on the first refresh rate.

[0153] When the second refresh rate is greater than the first refresh rate and the second frame rate is less than the first frame rate, it means that the screen refresh rate has increased, but the frame rate of the game application has decreased. In order to avoid the problem of screen choppyness as much as possible, the electronic device determines a refresh rate that can better match the frame rate of the game application.

[0154] Therefore, the electronic device determines a first candidate refresh rate based on a first refresh rate. In one example, the electronic device can determine the product of the first refresh rate and a first value, which can be set as needed; for example, the first value is 2. Then, the first candidate refresh rate is determined based on this product, which may include the following two cases:

[0155] The first scenario: If the product of the first refresh rate and the first value is greater than the maximum refresh rate in the refresh rate set, then the first refresh rate is taken as the first candidate refresh rate. The refresh rate set includes all refresh rates supported by the electronic device.

[0156] For example, electronic devices support refresh rates of 30Hz, 60Hz, and 90Hz. If the first refresh rate is 60Hz and the first value is 2, then since the product of the first refresh rate and the first value is greater than the maximum refresh rate in the refresh rate set (i.e., the product of 60Hz and 2 is 120Hz, which is greater than 90Hz), the first refresh rate can be directly used as the first candidate refresh rate.

[0157] Otherwise, the method for determining the first candidate refresh rate is described in the second case below.

[0158] The second scenario: If the product of the first refresh rate and the first value is not greater than the maximum refresh rate in the refresh rate set, then at least one second candidate refresh rate belonging to the refresh rate set is determined. Each of the at least one second candidate refresh rate is an integer multiple of the first refresh rate, and each second candidate refresh rate is less than the maximum refresh rate supported by the electronic device. A first candidate refresh rate is determined from the at least one second candidate refresh rate, and the first candidate refresh rate is the second-ranked second candidate refresh rate in ascending order.

[0159] For example, provided that the refresh rate is less than the maximum refresh rate supported by the electronic device, the first refresh rate can be multiplied by positive integers such as 1, 2, and 3 to obtain at least one second candidate refresh rate. Then, the second smallest value can be selected from the at least one second candidate refresh rate as the first candidate refresh rate.

[0160] For example, electronic devices support refresh rates of 30Hz, 60Hz, 90Hz, 120Hz, and 144Hz. If the first refresh rate is 60Hz and the first value is 2, then since the product of the first refresh rate and the first value is not greater than the maximum refresh rate in the refresh rate set (i.e., the product of 60Hz and 2 is 120Hz), which belongs to the refresh rate set, according to the second implementation method, at least one second candidate refresh rate that meets the conditions is found, including 60Hz and 120Hz. The second smallest second candidate refresh rate (i.e., 120Hz) among these two second candidate refresh rates is determined as the first candidate refresh rate.

[0161] The process of determining the first candidate refresh rate described above can be represented by the following formula (2):

[0162]

[0163] Where rf3 represents the first candidate refresh rate, rf1 represents the first refresh rate, the first value is 2, Q represents the set of all refresh rates supported by the electronic device, max(Q) represents the maximum value among all refresh rates supported by the electronic device, N is a positive integer, and second-min{} represents taking the second smallest value in the set.

[0164] It should be noted that the above implementation of determining the first candidate refresh rate when the product of the first refresh rate and the first value is not greater than the maximum refresh rate in the refresh rate set is merely exemplary. In another example, it can also be determined in other ways. Exemplarily, the maximum second candidate refresh rate among at least one second candidate refresh rate can also be determined as the first candidate refresh rate, and this application embodiment does not limit this.

[0165] S517: At time t3, the screen displays the image data corresponding to the first application at the first candidate refresh rate.

[0166] That is, after determining the first candidate refresh rate, the screen refreshes at the first candidate refresh rate to display the image data corresponding to the first application.

[0167] S518: After displaying the image data corresponding to the first application on the screen at the first candidate refresh rate, determine the running frame rate fps_h of the first application.

[0168] The method for determining the frame rate fps_h of the first application can be found in step S503 above, and will not be repeated here.

[0169] S519: Determine whether the running frame rate fps_h is greater than or equal to the first running frame rate.

[0170] This involves comparing the running frame rate fps_h with the first running frame rate to determine how the game application's running frame rate changes after the screen refresh rate is adjusted to the first candidate refresh rate.

[0171] If the running frame rate fps_h is greater than or equal to the first running frame rate, then proceed to operation S520; otherwise, if the running frame rate fps_h is less than the first running frame rate, then proceed to operation S521.

[0172] S520: The screen remains on displaying the game application's image data at the first candidate refresh rate.

[0173] At this point, the first candidate refresh rate can be referred to as the target refresh rate. The screen will then continue to display the game application's image data at the target refresh rate.

[0174] If the running frame rate fps_h is greater than or equal to the first running frame rate, it means that the current first candidate refresh rate allows the game application to render frames at a frame rate higher than or equal to the first running frame rate. In other words, even after the screen refresh rate is increased, it can still meet the rendering requirements of the game application, ensuring the smoothness of the game screen. Therefore, the screen continues to refresh at the first candidate refresh rate until a refresh rate switching instruction is received again, at which point the refresh rate is adjusted according to the refresh rate switching instruction.

[0175] As an example, when the running frame rate fps_h is greater than or equal to the first running frame rate, the running frame rate fps_h can also be called the third running frame rate, which is the running frame rate of the game application when the screen is running at the target refresh rate.

[0176] In one example, the target refresh rate is 120Hz, which allows the game application to render frames at 60fps. See, for an example... Figure 10 , Figure 10 This diagram illustrates the change in refresh rate and frame rate according to an exemplary embodiment, obtainable using trace software. In the first time period, the screen refreshes at 60Hz, with a Vsync signal period of 16.6ms. As shown in the diagram, the game application renders frames at 60fps, with a frame-drawing period of 16.6ms and a time interval of 16.6ms between adjacent frames. In the second time period, the screen refresh rate increases to 90Hz, with a Vsync signal period of 11.1ms. The game application then renders frames at 45fps, with a frame-drawing period of 22.2ms and a time interval of 22.2ms between adjacent frames. During the third time period, the electronic device increases the screen refresh rate to 120Hz according to the above process. With the screen refreshing at 120Hz, the Vsync signal period is 0.83ms. As shown in the diagram, the game application resumes rendering frames at a runtime of 60fps, meaning the frame-drawing period is 16.6ms, and the time interval between two adjacent frames is 16.6ms. Therefore, even with an increased screen refresh rate and a decreased game application frame rate, increasing the screen refresh rate to 120Hz allows the game application to continue rendering frames at a runtime of 60fps.

[0177] As an example of this application, after the electronic device automatically adjusts the refresh rate in the manner described above, it can provide feedback on the adjustment decision to the user. The user can then determine whether to maintain the adjusted refresh rate (i.e., the target refresh rate) based on the feedback. For example, see [link to relevant documentation]. Figure 11 After the electronic device automatically adjusts, it can display something like this. Figure 11The refresh rate decision prompt box shown in box 111 includes a prompt message, such as "An abnormal frame rate has been detected. The refresh rate has been adjusted to the optimal level. Do you want to maintain the current refresh rate?". The refresh rate decision prompt box 111 also includes "Yes" and "No" options. If the user clicks the "Yes" option in the refresh rate decision prompt box 111, it means the user agrees to the screen refreshing at the adjusted refresh rate. In this case, in response to the user's click of the "Yes" option in the refresh rate decision prompt box 111, the electronic device maintains the screen refresh rate at the target refresh rate. If the user clicks the "No" option in the refresh rate decision prompt box 111, it means the user disagrees with the screen refreshing at the adjusted refresh rate. In this case, in response to the user's click of the "No" option in the refresh rate decision prompt box 111, the electronic device can adjust the screen refresh rate back to the second refresh rate, that is, the screen re-displays the game application's image data at the second refresh rate.

[0178] It should be noted that the above explanation uses the example of an electronic device automatically displaying a refresh rate decision prompt box 111 on the screen after automatically adjusting the refresh rate. In another example, the electronic device's desktop provides an application with management functions for game applications, such as a game manager application. After the user triggers the electronic device to launch the game manager application, the electronic device displays the refresh rate decision prompt box 111 through the game manager application. Alternatively, if the user authorizes the electronic device to display notifications from the game manager application, the electronic device can display notifications through the game manager application even if the game manager application is not launched, and the notification is as shown in the refresh rate decision prompt box 111.

[0179] S521: The screen displays the game application's image data at a second refresh rate.

[0180] If the running frame rate fps_h is less than the first running frame rate, it means that even adjusting the screen refresh rate cannot increase the game application's running frame rate. In this case, the screen can revert to displaying the game application's image data at the second refresh rate. This ensures that when the refresh rate adjustment is triggered by the user, the screen refreshes and displays the game application's image data according to the user's needs.

[0181] As an example, when the running frame rate fps_h is less than the first running frame rate, the running frame rate fps_h can also be called the fourth running frame rate.

[0182] It should be noted that the implementation of S521 described above is merely exemplary. Other implementations may also be included in another example. For instance, if the running frame rate fps_h is less than the first running frame rate, the refresh rate can be further adjusted. For example, if it is less than the maximum refresh rate supported by the screen, the first candidate refresh rate can be doubled, and then it can be determined whether the running frame rate of the game application is greater than or equal to the first running frame rate. If it is still less, the screen refresh rate is restored to the second refresh rate. Otherwise, if the running frame rate of the game application is greater than or equal to the first running frame rate, the screen displays the game application's image data at the increased refresh rate. Alternatively, the screen refresh rate can be directly adjusted to the highest refresh rate supported by the electronic device, such as 144Hz.

[0183] In this embodiment, after the screen refresh rate is increased, it is determined whether the game application's frame rate has decreased. If the game application's frame rate has decreased, a more suitable refresh rate is determined for the game application's frame rate, i.e., a target refresh rate is determined. The target refresh rate is the refresh rate that restores the game application's frame rate to or higher than its original frame rate. This minimizes the possibility of choppy gameplay caused by increased refresh rates, thus ensuring smooth gameplay.

[0184] The software system of the electronic device involved in the embodiments of this application can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This application embodiment uses the layered architecture Android system as an example to illustrate the software system of the electronic device.

[0185] Figure 12 This is a block diagram of a software system for an electronic device provided in an embodiment of this application. See also... Figure 12 A layered architecture divides software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into multiple layers, from top to bottom: application layer (App layer), application framework layer (FWK layer), native layer, hardware abstraction layer (HAL layer), and kernel layer.

[0186] The application layer can include a series of application packages. For example... Figure 12As shown, the application package may include a game application and a game manager application. The game manager application can be used to manage the business data of the game application. For example, the game manager application can be used to display decision results to the user.

[0187] In addition, the application package may also include applications such as instant messaging, camera, gallery, calendar, calling, map, music, video, and SMS (not shown in the figure).

[0188] Applications in the application layer can be used to interact directly with the user. For example, the game manager includes a user interaction module that can be used to interact directly with the user. These applications can be built-in system applications or non-system-level applications. Furthermore, these applications can have icons and application interfaces, or they can have application interfaces without icons, or they can have neither icons nor application interfaces.

[0189] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions. For example... Figure 12 As shown, the application framework layer may include a window manager, content provider, view system, phone manager, resource manager, notification manager, etc.

[0190] The window manager is used to manage windowed applications. It can retrieve screen size, determine the presence of a status bar, lock the screen, and capture screenshots, among other things.

[0191] Content providers are used to store and retrieve data and make that data accessible to applications. This data can include videos, images, audio, phone calls made and received, browsing history and bookmarks, phone books, etc.

[0192] A view system includes visual controls, such as controls that display text and controls that display images.

[0193] A view system can be used to build the display interface of an application. The display interface can consist of one or more views, such as a view that displays SMS notification icons, a view that displays text, and a view that displays images.

[0194] A phone manager is used to provide communication functions for electronic devices, such as managing call status (including connection, hang-up, etc.).

[0195] The file explorer provides applications with various resources, such as localized strings, icons, images, layout files, video files, etc.

[0196] The notification manager allows applications to display notifications in the status bar. These notifications can be used to convey informational messages and can disappear automatically after a short pause without user interaction. The notification manager can also display notifications as icons or scrollbar text in the system's top status bar. Furthermore, it can display notifications as dialog boxes on the screen.

[0197] The native layer can also be called the local framework layer or the local algorithm layer, etc. As an example of this application, the native layer may include, but is not limited to, a drawing tool service and a frame rate management service. In some examples, the drawing tool service is Surfaceflinger, and the frame rate management service is the Accelerated Graphical Port (AGP) service, which will be used as an example below.

[0198] SurfaceFlinger can be used to create layers for an application after it launches. For example, an application can send a layer creation request to SurfaceFlinger upon startup, and SurfaceFlinger will create the layer accordingly. Afterward, SurfaceFlinger sends the ID of the created layer to the application. Additionally, after creating layers for the application, SurfaceFlinger can allocate a corresponding cache queue to the application. This cache queue is used to cache the image data of the application's layers. Thus, when the application is drawing frames, it renders the layers, obtains the layer's image data, and adds the layer's image data to the cache queue. During compositing, SurfaceFlinger retrieves the data to be composited from the application's cache queue, performs compositing on the retrieved data, and then sends the composited image data for display.

[0199] For example, the process of displaying image data is explained using the display of the desktop interface after an electronic device is powered on. The desktop interface includes the application interface of the status bar application, the application interface of the navigation bar application, and the application interface of the desktop application. After the electronic device is powered on, the status bar application starts up and sends a layer creation request to SurfaceFlinger. SurfaceFlinger creates a corresponding layer 1 for the status bar application and sends the ID of layer 1 to the status bar application. In addition, after creating layer 1 for the status bar application, SurfaceFlinger can also allocate a corresponding cache queue 1 for layer 1. Cache queue 1 is used to cache the image data of layer 1.

[0200] Similarly, after the electronic device is powered on, the navigation bar application starts up and sends a layer creation request to Surfaceflinger. Surfaceflinger creates a corresponding layer 2 for the navigation bar application and sends the ID of layer 2 to the navigation bar application. In addition, after Surfaceflinger creates layer 2 for the navigation bar application, it can also allocate a corresponding cache queue 2 for layer 2. Cache queue 2 is used to cache the image data of layer 2.

[0201] In addition, after the electronic device is powered on, the desktop application starts up and sends a layer creation request to Surfaceflinger. Surfaceflinger creates a corresponding layer 3 for the desktop application and sends the ID of layer 3 to the desktop application. In addition, after Surfaceflinger creates layer 3 for the desktop application, it can also allocate a corresponding cache queue 3 for layer 3. Cache queue 3 is used to cache the image data of layer 3.

[0202] When the Kth Vsync signal arrives, the status bar application renders layer 1 to obtain the image data of layer 1. After that, the image data of layer 1 can be cached in the cache queue 1 corresponding to layer 1.

[0203] When the Kth Vsync signal arrives, the navigation bar application renders layer 2 to obtain the image data of layer 2. After that, the image data of layer 2 can be cached in the cache queue 2 corresponding to layer 2.

[0204] When the Kth Vsync signal arrives, the desktop application renders layer 3 to obtain the image data of layer 3. After that, the image data of layer 3 can be cached in the cache queue 3 corresponding to layer 3.

[0205] When the (K+1)th Vsync signal arrives, Surfaceflinger retrieves the image data of layer 1 from the cache queue corresponding to layer 1, the image data of layer 2 from the cache queue corresponding to layer 2, and the image data of layer 3 from the cache queue corresponding to layer 3.

[0206] SurfaceFlinger synthesizes all the acquired image data to obtain the image data to be displayed. When the (K+2)th Vsync signal arrives, SurfaceFlinger sends the image data to be displayed, thus completing the display of the desktop interface.

[0207] Additionally, SurfaceFlinger is also used for message distribution. For example, see... Figure 13When a game application draws a frame of image data, Surfaceflinger notifies the AGP service, for example, by sending the frame identifier of the image data drawn by the game application to the AGP service, and also sends the drawing time to the AGP service. In one example, this frame identifier is used to represent a frame of image data drawn by the game application.

[0208] AGP services can be used to calculate the actual frame rate of an application during the frame drawing process; they can also be used to determine the screen refresh rate based on changes in the frame rate and refresh rate, and send the determined refresh rate to Surfaceflinger so that Surfaceflinger can switch the screen refresh rate.

[0209] As an example of this application, see Figure 13 The AGP service includes a frame rate calculation module and a refresh rate decision module. The frame rate calculation module can calculate the actual running frame rate of the game application during the frame drawing process in real time, and then report it to the refresh rate decision module. The refresh rate decision module can decide the screen refresh rate based on the change between the refresh rate and the running frame rate.

[0210] Further, see Figure 13 The refresh rate decision module may also include a refresh rate and frame rate monitoring module and a decision module. The refresh rate and frame rate monitoring module is used to receive the actual running frame rate of the game application during the frame drawing process reported by the frame rate calculation module, and monitor the changes in refresh rate and running frame rate. For example, the changes in refresh rate and running frame rate can be monitored in the form of key-value pairs. The decision module is used to decide the screen refresh rate based on the changes in refresh rate and running frame rate.

[0211] The Hardware Abstraction Layer (HAL) sits between the framework layer and the kernel layer, and its purpose is to abstract the hardware. The HAL hides the hardware interface details of a specific platform, providing a virtual hardware platform for the software system, making it hardware-independent and portable across multiple platforms. As an example in this application, the HAL layer includes a hardware composer (HWC). The hardware composer acts as a bridge for information exchange between Surfaceflinger and the kernel layer. Surfaceflinger can use the hardware composer to composite layers to obtain the foreground interface image to be displayed.

[0212] For example, after retrieving the image data of the layer to be composited from the cache queue, SurfaceFlinger can send a compositing strategy retrieval request to HWC. This request carries the layer information of the layer to be composited. The layer information may include the number of layers and the content category of each layer. Optionally, the layer information may also include the content data volume of each layer, the layer ID, and layer attributes. HWC determines the compositing strategy for the layer based on this information. If HWC is determined to have the capability to composite the layer based on the layer information, the compositing strategy is set to HWC compositing; otherwise, it is set to HWC+GPU compositing. When the compositing strategy is HWC compositing, SurfaceFlinger composites the image data of the layer to be composited using HWC; when the compositing strategy is HWC+GPU compositing, SurfaceFlinger composites the image data of the layer to be composited using HWC+GPU. The composited image data can then be displayed.

[0213] The kernel layer is the layer between hardware and software. At a minimum, the kernel layer contains display drivers, camera drivers, audio drivers, and sensor drivers. These drivers enable the display screen, front / rear cameras, audio players, sensors, and more.

[0214] exist Figure 12 Based on the illustrated embodiment, the following will combine Figure 14 The refresh rate adjustment method provided in the embodiments of this application will be described in detail. Figure 14 In this embodiment, taking the interaction of an electronic device through multiple modules as an example, the method may include some or all of the following:

[0215] S1401: Game application launched.

[0216] In one example, the electronic device's desktop displays an application icon for a game application. When a user wants to open the game application, they can click on the application icon. In response to the user's click on the game application icon, the game application launches.

[0217] S1402: After the game application starts, it draws frames according to the Vsync signal of the screen.

[0218] For example, in response to a user opening a game application, the game application can send a layer creation request to Surfaceflinger. This layer creation request requests Surfaceflinger to create a corresponding layer 4 for the game application. Surfaceflinger creates layer 4 for the game application and a corresponding cache queue 4 for layer 4. Surfaceflinger sends the layer ID of layer 4 to the game application. When a Vsync signal arrives, for example, the i-th Vsync signal arrives, the game application renders layer 4 according to the Vsync signal, obtaining the image data of layer 4. i is an integer greater than or equal to 1.

[0219] In one possible scenario, when a game application launches, the screen refresh rate is the same as the game application's original frame rate. In this case, the screen refresh rate can meet the game application's frame-drawing requirements, and the game application draws frames at the original frame rate. For example, if the game application's original frame rate is 60fps and the screen refresh rate is 60Hz, then every time a Vsync signal arrives, the game application performs one frame-drawing process, or one rendering process.

[0220] In another possible scenario, when the game application launches, the screen's refresh rate may differ from the game application's original frame rate. In this case, the screen's refresh rate may not meet the game application's frame rate requirements. Therefore, a refresh rate adjustment operation is needed to ensure the screen's refresh rate meets the game application's frame rate requirements. The adjustment process can be found in [link to relevant documentation]. Figure 5 S506 to S510 in the series.

[0221] Once the screen's refresh rate meets the frame rate requirements of the game application, the screen refreshes and displays the image at the first refresh rate.

[0222] As an example of this application, the screen refresh rate is the same as the original frame rate of the game application when the game application starts.

[0223] S1403: Each time the game application completes a drawing operation, it adds the drawn image data to the cache queue 4.

[0224] After the game application renders layer 4 and obtains the image data of layer 4, it adds the image data of layer 4 to the cache queue 4.

[0225] S1404: Surfaceflinger retrieves the image data currently being drawn by the game application from cache queue 4.

[0226] For example, when the (i+1)th Vsync signal arrives, Surfaceflinger retrieves the image data currently being drawn by the game application from cache queue 4.

[0227] S1405: Surfaceflinger sends frame information of the image data currently being drawn by the game application to the frame rate calculation module.

[0228] As an example, frame information includes the frame identifier and the frame time of the currently drawn image data. The frame identifier is used to identify a frame of image data drawn by the game application; the frame time indicates the time when the current image data was drawn, and the frame time can be a timestamp.

[0229] In addition, each time Surfaceflinger acquires image data, it synthesizes the acquired image data according to the layer compositing strategy to obtain the image data to be displayed. Then, Surfaceflinger sends the image data for display based on the Vsync signal, for example, when the (i+2)th Vsync signal arrives, the obtained image data is sent for display.

[0230] It should be noted that this embodiment of the application uses the example of obtaining image data from the cache queue corresponding to a game application for illustration. In one possible case, in addition to the game application, there may also be application interfaces of other applications that need to be displayed. In this case, Surfaceflinger obtains image data from the cache queues corresponding to each application, then synthesizes the obtained image data according to the layer compositing strategy, and sends the synthesized image data for display. This embodiment of the application will not elaborate further on this.

[0231] S1406: The frame rate calculation module adds the frame identifier from the frame information to the frame identifier sequence.

[0232] S1407: The frame rate calculation module determines the running frame rate of the game application based on the frame identifier sequence and the frame drawing time.

[0233] For its specific implementation, please refer to the previous text. Figure 5 S503 in the illustrated embodiment.

[0234] When the screen refreshes at the first refresh rate, the game application runs at the first frame rate.

[0235] S1408: The frame rate calculation module reports to the refresh rate decision module once each time it determines the running frame rate.

[0236] S1409: The refresh rate decision module stores the refresh rate and the running frame rate in correspondence.

[0237] As an example, the frame rate calculation module can store the refresh rate and the running frame rate of the game application in the form of key-value pairs, such as {"refresh rate", "running frame rate"}, so that when it is necessary to determine the running frame rate of the game application later, the key-value pairs can be directly queried.

[0238] During the game application's frame drawing process, the operations S1403 to S1409 described above are repeated. That is, every time the game application draws a frame of image data, the frame rate calculation module records the frame information of the currently drawn image data and determines the application's current running frame rate based on the recorded frame information. Then, it is reported to the refresh rate decision module, which stores the information accordingly.

[0239] S1410: In response to the refresh rate switching command, the refresh rate decision module sends a second refresh rate to Surfaceflinger.

[0240] As mentioned earlier, refresh rate switching commands may be user-triggered, for example, see [link to relevant documentation]. Figure 6 The user reset the refresh rate through the settings application; the refresh rate switching command may also be triggered after a scene change is detected, for example, see [link to relevant documentation]. Figure 9 In multi-window scenarios, after receiving a refresh rate switching command, the refresh rate decision module can send a second refresh rate to SurfaceFlinger, so that SurfaceFlinger can trigger the screen to adjust the refresh rate to the second refresh rate.

[0241] The second refresh rate can be carried in the refresh rate switching command. For example, when the user resets the refresh rate through the settings application, the refresh rate switching command sent by the settings application to the refresh rate decision module carries the second refresh rate to be switched to. Alternatively, the second refresh rate may also be determined by the refresh rate decision module based on the scenario, for example, in... Figure 9 In the scenario shown, the refresh rate decision module determines the second refresh rate based on the multi-window scenario.

[0242] S1411: Surfaceflinger sends a second refresh rate to the display driver.

[0243] S1412: The display driver sends a switching command 1 (carrying the second refresh rate) to the screen.

[0244] Switching command 1 is used to instruct the refresh rate to be adjusted to the second refresh rate.

[0245] In this way, in response to the refresh rate switching command, the screen refresh rate is switched to the second refresh rate.

[0246] It should be noted that this embodiment of the application uses the example of the refresh rate decision module sending the target refresh rate to SurfaceFlinger. In another instance, the refresh rate decision module can also directly call the interface provided by the underlying layer (such as the hardware abstraction layer) to trigger the screen to switch refresh rates, and this embodiment of the application does not limit this.

[0247] S1413: The refresh rate decision module determines the second running frame rate of the game application at the second refresh rate.

[0248] Since the electronic device cyclically executes operations S1403 to S1409, the refresh rate decision module can determine the second running frame rate of the game application at the second refresh rate, for example, by querying from stored key-value pairs.

[0249] S1414: When the second refresh rate is greater than the first refresh rate and the second running frame rate is less than the first running frame rate, the refresh rate decision module determines the first candidate refresh rate.

[0250] If the second running frame rate is lower than the first running frame rate, it indicates a situation where the refresh rate increases while the running frame rate decreases, i.e., an anomaly has occurred. In this case, to ensure the game application's frame rate requirements, the refresh rate decision module determines the first candidate refresh rate. For its specific implementation, please refer to [link to relevant documentation]. Figure 5 S516 in the illustrated embodiment.

[0251] S1415: The refresh rate decision module sends the first candidate refresh rate to Surfaceflinger.

[0252] S1416: Surfaceflinger sends the first candidate refresh rate to the display driver.

[0253] S1417: The display driver sends a switching instruction 2 (carrying the first candidate refresh rate) to the screen.

[0254] In this way, the screen refresh rate is switched from the second refresh rate to the first candidate refresh rate.

[0255] S1418: The refresh rate decision module determines the running frame rate fps_h of the game application at the first candidate refresh rate.

[0256] Similarly, since the electronic device cyclically executes operations S1403 to S1409, the refresh rate decision module is able to determine the running frame rate fps_h of the game application at the first candidate refresh rate.

[0257] S1419: If the running frame rate fps_h is greater than or equal to the first running frame rate, the refresh rate decision module stops the refresh rate adjustment operation.

[0258] If the running frame rate fps_h is greater than or equal to the first running frame rate, it means that the first candidate refresh rate can meet the frame drawing requirements of the game application. At this time, the refresh rate decision module will no longer instruct the refresh rate to be adjusted.

[0259] It should be noted that the embodiments of this application are described with the example of a running frame rate fps_h being greater than or equal to the first running frame rate. In another case, if the running frame rate fps_h is less than the first running frame rate, the refresh rate decision module instructs the screen to adjust the refresh rate back to the second refresh rate through Surfaceflinger. The adjustment process can be found in S1412 to S1417.

[0260] It should be noted that the embodiments in this application are illustrated using the example of a second running frame rate being less than a first running frame rate. If the second running frame rate is greater than or equal to the first running frame rate, it means that the adjusted second refresh rate can meet the frame drawing requirements of the game application. In this case, the screen continues to display the image data of the game application at the second refresh rate, and correspondingly, the game application continues to draw frames at the second running frame rate.

[0261] In this embodiment, after the screen refresh rate is increased, it is determined whether the game application's frame rate has decreased. If the game application's frame rate has decreased, a more suitable refresh rate is determined for the game application's frame rate, restoring it to or above its original level. This minimizes the risk of a decrease in the game application's frame rate due to an increased refresh rate, thus preventing screen choppyness and ensuring smooth gameplay.

[0262] In one possible embodiment, the game application manufacturer may also provide the electronic device manufacturer with a mapping relationship between the expected running frame rate and the expected refresh rate. In this way, after the game application is launched, the electronic device can directly adjust the screen refresh rate to the expected refresh rate according to the mapping relationship to meet the frame drawing requirements of the game application during operation.

[0263] The refresh rate adjustment method provided in this application embodiment can be applied to devices such as mobile phones, action cameras (GoPro), digital cameras, tablet computers, desktop computers, laptops, handheld computers, notebook computers, in-vehicle devices, ultra-mobile personal computers (UMPCs), netbooks, cellular phones, personal digital assistants (PDAs), augmented reality (AR) / virtual reality (VR) devices, etc., and this application embodiment does not limit it.

[0264] Figure 15 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. See also... Figure 15 The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, a sensor module 180, buttons 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

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

[0266] Processor 110 may include one or more processing units, such as: application processor (AP), modem processor, graphics processing unit (GPU), image signal processor (ISP), controller, memory, video codec, digital signal processor (DSP), baseband processor, and / or neural network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0267] The controller can be the nerve center and command center of the electronic device 100. The controller can generate operation control signals according to the instruction opcode and timing signals to complete the control of fetching and executing instructions.

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

[0269] In some embodiments, the processor 110 may include one or more interfaces, such as an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

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

[0271] The charging management module 140 receives charging input from a charger, which can be either a wireless or wired charger. While charging the battery 142, the charging management module 140 can also power the electronic device 100 via the power management module 141. The power management module 141 connects the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and powers the processor 110, internal memory 121, external memory, display screen 194, camera 193, and wireless communication module 160, etc.

[0272] The wireless communication function of electronic device 100 can be realized through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor, etc.

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

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

[0275] Terminal 100 can perform shooting functions through ISP, camera 193, video codec, GPU, display 194 and application processor.

[0276] The ISP is used to process the data fed back by the camera 193. In some embodiments, the ISP may be located in the camera 193.

[0277] Camera 193 is used to capture still images or videos. An object passes through the lens to generate an optical image that is projected onto a photosensitive element. The photosensitive element converts the light signal into an electrical signal, which is then passed to an ISP (Internet Service Provider) for conversion into a digital image signal. The ISP outputs the digital image signal to a DSP (Digital Signal Processor) for processing. The DSP converts the digital image signal into image signals in standard formats such as RGB and YUV. In some embodiments, the electronic device 100 may include one or N cameras 193, where N is an integer greater than 1.

[0278] The external storage interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external storage interface 120 to perform data storage functions, such as saving music, video, and other files on the external memory card.

[0279] Internal memory 121 can be used to store computer-executable program code, which includes instructions. Processor 110 executes various functional applications and data processing of electronic device 100 by running the instructions stored in internal memory 121. Internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback, image playback, etc.), etc. The data storage area may store data created by electronic device 100 during use (such as audio data, phonebook, etc.). Furthermore, internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.

[0280] Electronic device 100 can implement audio functions, such as music playback and recording, through audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D and application processor.

[0281] Buttons 190 include a power button, volume buttons, etc. Electronic device 100 can receive button input and generate key signal inputs related to user settings and function control of electronic device 100.

[0282] Motor 191 can generate vibration alerts. Motor 191 can be used for incoming call vibration alerts or for touch vibration feedback.

[0283] This application also provides a chip system applied to an electronic device. The chip system includes one or more processors, which are used to invoke computer instructions to cause the electronic device to perform the methods described in the above embodiments.

[0284] It should be understood that each step in the above method embodiments can be completed by integrated logic circuits in the processor hardware or by instructions in software form. The method steps disclosed in the embodiments of this application can be directly manifested as being executed by a hardware processor, or being executed by a combination of hardware and software modules in the processor.

[0285] This application also provides an electronic device that may include a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the method performed by the electronic device as described in any of the above embodiments.

[0286] This application also provides a chip system including a processing circuit and an interface circuit. The interface circuit is used to receive computer instructions and transmit them to the processing circuit. The processing circuit is used to execute the computer instructions to implement the method performed by the electronic device as in any of the above embodiments.

[0287] This application also provides a chip system including at least one processor for implementing the methods executed by the electronic device in any of the above embodiments. In one possible design, the chip system further includes a memory for storing program instructions and data, the memory being located within or outside the processor.

[0288] A chip system can consist of chips or include chips and other discrete components.

[0289] Optionally, there may be one or more processors in the chip system. The processor can be implemented in hardware or software. When implemented in hardware, the processor can be a logic circuit, integrated circuit, etc. When implemented in software, the processor can be a general-purpose processor, implemented by reading software code stored in memory.

[0290] Optionally, the chip system may contain one or more memories. These memories may be integrated with the processor or disposed separately; this application does not limit this. For example, the memory may be a non-transient processor, such as a read-only memory (ROM), which may be integrated with the processor on the same chip or disposed on different chips. This application does not specifically limit the type of memory or the arrangement of the memory and processor.

[0291] For example, the chip system may be a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on chip (SoC), a central processor unit (CPU), a network processor (NP), a digital signal processor (DSP), a micro controller unit (MCU), a programmable logic device (PLD), or other integrated chips.

[0292] This application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method executed by the electronic device in any of the above embodiments.

[0293] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the method executed by the electronic device as described in any of the above embodiments.

[0294] The various embodiments of this application can be combined arbitrarily to achieve different technical effects.

[0295] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line, DSL) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer, or a data storage device such as a server or data center that integrates one or more available media. The available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., Digital Versatile Discs (DVDs)), or semiconductor media (e.g., Solid State Disks (SSDs)).

[0296] The above descriptions are optional embodiments provided by this application and are not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the technical scope disclosed in this application should be included within the protection scope of this application.

Claims

1. A refresh rate adjustment method, characterized in that, Applied to electronic devices, the method includes: At the first moment, the first application in the electronic device draws frames at a first running frame rate; The screen of the electronic device displays image data drawn by the first application at a first refresh rate; At the second moment, in response to the refresh rate switching command, the screen displays the image data corresponding to the first application at a second refresh rate, which is greater than the first refresh rate; The first application draws frames at a second running frame rate; When the second running frame rate is less than the first running frame rate, at the third moment, the screen displays the image data corresponding to the first application at the target refresh rate, so that the first application draws frames at the third running frame rate, which is greater than or equal to the first running frame rate. The frame rendering of the first application is synchronized with the refresh cycle of the screen.

2. The method as described in claim 1, characterized in that, The target refresh rate is an integer multiple of the first refresh rate.

3. The method as described in claim 1 or 2, characterized in that, The method further includes: If the second running frame rate is less than the first running frame rate, a first candidate refresh rate is determined based on the first refresh rate; At the fourth moment, the screen displays the image data corresponding to the first application at the first candidate refresh rate, the fourth moment being greater than the second moment and less than the third moment; If, after the image data corresponding to the first application is displayed on the screen at the first candidate refresh rate, the first application draws frames at the third running frame rate, then the first candidate refresh rate is taken as the target refresh rate.

4. The method as described in claim 3, characterized in that, The method further includes: If, after the screen displays the image data corresponding to the first application at the first candidate refresh rate, the first application performs frame drawing at the fourth running frame rate, then the screen displays the image data corresponding to the first application at the second refresh rate, wherein the fourth running frame rate is less than the first running frame rate.

5. The method as described in claim 3 or 4, characterized in that, The step of determining the first candidate refresh rate based on the first refresh rate includes: Determine the product of the first refresh rate and the first value, where the first value is 2; If the product of the first refresh rate and the first value is greater than the maximum refresh rate in the refresh rate set, then the first refresh rate is used as the first candidate refresh rate, wherein the refresh rate set includes all refresh rates supported by the electronic device.

6. The method as described in claim 5, characterized in that, The method further includes: If the product of the first refresh rate and the first value is not greater than the maximum refresh rate in the refresh rate set, then at least one second candidate refresh rate belonging to the refresh rate set is determined. Each of the at least one second candidate refresh rates is an integer multiple of the first refresh rate, and each second candidate refresh rate is less than the maximum refresh rate supported by the electronic device. The first candidate refresh rate is determined from the at least one second candidate refresh rate, wherein the first candidate refresh rate is the second candidate refresh rate ranked second in ascending order among the at least one second candidate refresh rates.

7. The method according to any one of claims 1-6, characterized in that, The method for determining the frame rate of the first application includes: Whenever the first application draws a frame of image data, it adds the frame identifier of the currently drawn image data to the frame identifier sequence and records the drawing time of the currently drawn image data. The sliding window is slid in the frame identifier sequence according to a preset sliding step size, and the window length of the sliding window is a second value; Each time the sliding window is slid, the average running frame rate of the image data indicated by the frame identifier in the current sliding window is determined based on the drawing frame time of the image data indicated by the frame identifier in the current sliding window and the second value, so as to obtain the average running frame rate corresponding to the current sliding window; When obtaining the average running frame rate corresponding to M sliding windows, the average value of the average running frame rate corresponding to the M sliding windows is determined, where M is an integer greater than 1; From a set of preset running frame rates, a preset running frame rate that is greater than the average value and has the smallest difference from the average value is determined, and the running frame rate of the first application is the determined preset running frame rate.

8. The method as described in claim 7, characterized in that, Each time the sliding window slides once, the average running frame rate of the image data indicated by the frame identifier in the current sliding window is determined based on the frame drawing time of the image data indicated by the frame identifier in the current sliding window and the second value, thus obtaining the average running frame rate corresponding to the current sliding window, including: Each time the sliding window is slid, the total frame drawing time of the image data indicated by the frame identifier in the current sliding window is determined according to the frame drawing time of the image data indicated by the frame identifier in the current sliding window; Divide the total frame drawing time of the image data indicated by the frame identifier in the current sliding window by the second value to obtain the average running frame rate corresponding to the current sliding window.

9. An electronic device, characterized in that, The electronic device includes: one or more processors, and a memory; the memory is coupled to the one or more processors, the memory being used to store computer program code, the computer program code including computer instructions, and the one or more processors calling the computer instructions to cause the electronic device to perform the refresh rate adjustment method as described in any one of claims 1-8.

10. A chip system, characterized in that, The chip system is applied to an electronic device, and the chip system includes one or more processors, the one or more processors being used to invoke computer instructions to cause the electronic device to perform the refresh rate adjustment method according to any one of claims 1-8.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed on a computer, cause the computer to perform the refresh rate adjustment method as described in any one of claims 1-8.

12. A computer program product containing instructions, characterized in that, When it is run on a computer, it causes the computer to perform the refresh rate adjustment method as described in any one of claims 1-8.