Method for controlling application frame rate and electronic equipment

By using frame control operation and high-frequency TE signal synthesis technology, the load and temperature problems of electronic devices when drawing complex special effects frames have been solved, and the frame control experience and performance have been optimized.

CN121490370APending Publication Date: 2026-02-10HONOR DEVICE CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411036310.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-30
Publication Date
2026-02-10

AI Technical Summary

Technical Problem

When electronic devices render complex special effects frames, the load increases and the temperature rises, affecting performance and user experience.

Method used

The application frame rate is controlled by frame control operations, including pausing frame rate adjustment when frame drops are detected, resuming frame rate control, and using high-frequency TE signals for display when compositing screen images to avoid performance degradation caused by excessively low frame rates.

Benefits of technology

It optimizes the frame control experience of electronic devices, reduces device load and temperature, and improves game performance and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121490370A_ABST
    Figure CN121490370A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a method for controlling an application frame rate and electronic equipment. In the method, when the frame control operation is adopted and the frame drop occurs in the game, the frame number of the picture frames transmitted to the SF in unit time by the game is the target frame rate. And when it is determined that frame drop exists in the game, the electronic device stops reducing the frame rate of the game through the frame control operation. The frame control stopping operation comprises the steps that when drawing of one frame of picture frame is completed by the game, the frame of picture frame is transmitted to the SF, when the frame of picture frame is transmitted to the SF, a buffer area used for drawing the next frame of picture frame is distributed to the game, the game draws the next frame of picture frame based on the buffer area, the next frame of picture frame after drawing is completed is cached into the buffer area by the game, and the next frame of picture frame after drawing is completed is transmitted to the SF by the game. And transmitting the next frame of picture frame in the buffer area to the SF. And when determining that the preset condition is satisfied, recovering the frame control operation. By using the method, the performance of the game can be kept, and the frame control experience is optimized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of electronic devices, and more particularly to methods and electronic devices for controlling application frame rates. Background Technology

[0002] When electronic devices render (e.g., create frames that provide complex effects), they require significant computing resources. In particular, the processor and graphics card operate at high intensity during this process. Therefore, prolonged rendering of such frames increases the device's workload, generating more heat and causing its temperature to rise. Summary of the Invention

[0003] This application provides a method and an electronic device for controlling the frame rate of an application, which are used to optimize the frame rate control experience.

[0004] In a first aspect, this application provides a method for applying frame rate to an electronic device. The method includes: performing frame control operations, wherein the frame control operations include: controlling the number of frames transmitted by a first application to SurfaceFlinger per unit time to a target frame rate, wherein the target frame rate is less than the set frame rate of the first application; stopping the frame control operations when it is determined that the first application is experiencing frame drops, wherein stopping the frame control operations includes: when the first application completes the rendering of a frame, transmitting the frame to SurfaceFlinger, and allocating a buffer for rendering the next frame to the first application when transmitting the frame to SurfaceFlinger; the frame drops include: the first application experiencing a time interval between transmitting two adjacent frames to SurfaceFlinger that is greater than the reciprocal of the target frame rate; and resuming the frame control operations when it is determined that preset conditions are met.

[0005] In the above embodiments, the first application can be considered as the game APP (hereinafter referred to as "game") involved in the following embodiments. A dropped frame indicates that the time it takes for the current game to draw one frame is too long. Therefore, the number of frames the game transmits to the SF per unit time will be less than the target frame rate. After one dropped frame, another may occur. If frame control operations continue, the number of frames actually drawn by the game per unit time will decrease, further reducing the number of frames transmitted to the SF per unit time to the target frame rate. However, by stopping frame control operations and allowing the game to draw frames according to a preset frame rate, performing frame tracking, and then resuming frame control operations when preset conditions are met, the number of frames transmitted to the SF per unit time can still equal the target frame rate. This maintains game performance and optimizes the frame control experience.

[0006] In conjunction with the first aspect, in some embodiments, the method further includes: when the first application transmits a screen frame to the SurfaceFlinger, controlling the SurfaceFlinger to synthesize a screen image based on the received screen frame; controlling the SurfaceFlinger to transmit the screen image to a display driver; and controlling the display driver to transmit the screen image to the screen of the electronic device for display based on a high-frequency transverse radio wave (TE) signal.

[0007] In the above embodiments, the screen frames transmitted by the first application can be regarded as game screen frames. When SF receives the game screen frame transmitted by game, it can synthesize the screen image based on the game screen frame without waiting for the Vsync signal to arrive. When the screen image is transmitted to the display driver, the display driver can send it to the display after receiving the high-frequency TE signal. Here, the frequency of the high-frequency TE signal is higher than the frequency of the Vsync signal, which allows the display driver to send the image to the display more promptly, which is beneficial to improving the gaming experience.

[0008] In conjunction with the first aspect, in some embodiments, when performing the frame control operation, the screen frames drawn by the first application include a first screen frame and a second screen frame thereafter. The method further includes: transmitting the first screen frame cached in the first buffer to the SurfaceFlinger at a first moment; the first buffer is allocated to the first application at a second moment, which is before the first moment; waiting for a first time period after the first moment, and then allocating the second buffer to the first application, the second buffer being used to cache the second screen frame drawn by the first application, and the second screen frame cached in the second buffer being used to transmit to the SurfaceFlinger for compositing; the first time period is equal to the reciprocal of the target frame rate minus the second time period, and the second time period is the first moment minus the second moment.

[0009] In the above embodiments, the first frame can be regarded as in the following embodiments. Figure 5 The image frame 11 involved in (2) Figure 9 The Nth frame is shown in (2). If the time from the previous frame being drawn to its transmission to the SF is too fast (faster than the reciprocal of the target frame rate), the time that the previous frame was faster than the reciprocal of the target frame rate can be "made up" by delaying the allocation of a buffer for the current frame to the game. This ensures that the number of frames transmitted to the SF per unit time is equal to the target frame rate. In this way, the current frame can be sent to the SF for compositing after it is drawn, and then displayed in a timely manner, which helps to improve responsiveness.

[0010] In conjunction with the first aspect, in some embodiments, when performing the frame control operation, the screen frame drawn by the first application includes a first screen frame, and the method further includes: completing the drawing of the first screen frame by the first application at a first moment; caching the drawn first screen frame in a first buffer, the first buffer being allocated to the first application at a second moment; controlling the first application to wait for a first time period after the first moment, and then transmitting the first screen frame in the first buffer to the SurfaceFlinger; the first time period is equal to the reciprocal of the target frame rate minus the second time period, the second time period being the first moment minus the second moment.

[0011] In the above embodiments, the first frame can be regarded as in the following embodiments. Figure 5 The image frame 11 involved in (1) Figure 9 The Nth frame is shown in (2). When the frame is drawn too quickly, the transmission time of the frame value SF is delayed, so that the number of frames transmitted to SF per unit time in the game is equal to the target frame rate. In this way, the time interval between adjacent frames transmitted to SF can be controlled to be more uniform, which is the reciprocal of the target frame rate.

[0012] In conjunction with the first aspect, in some embodiments, determining that the first application has dropped frames specifically includes: determining that the frame drawn by the first application includes a third frame, such that a third time period is greater than the reciprocal of the target frame rate; wherein the third time period is equal to the time for transmitting the third frame in the third buffer to the SurfaceFlinger minus the time for allocating the third buffer to the first application.

[0013] In conjunction with the first aspect, in some embodiments, determining that a preset condition is met specifically includes: simultaneously updating the first time difference and counting the number of target frame images; determining that the preset condition is met when the first time difference is updated to be greater than or equal to 0, or when the number of target frame images reaches a preset number; the initial value of the number of target frame images is 0, and the initial value of the first time difference is equal to the reciprocal of the target frame rate minus the third time period; updating the first time difference, and when a target frame image appears, incrementing the number of target frame images by 1; the updated first time difference is equal to the first time difference before the update plus the second time difference; the second time difference is equal to the reciprocal of the target frame rate minus the fourth time period; the fourth time period is equal to the time for transmitting the fourth frame image in the fourth buffer to the SurfaceFlinger minus the time for allocating the fourth buffer to the first application; the fourth frame image includes the frame image drawn by the first application when the frame control operation is stopped; the fourth frame image includes target frame image and non-target frame image; the target frame image is the frame image in the fourth frame image that makes the second time difference greater than 0.

[0014] In the above embodiments, if frame control is restored because the number of target frames reaches a preset number before the timeout when frame drops is offset by the advance time of the target frame, it is to continue to reduce the load on the electronic device and prevent the frame tracking from not ending for a long time, which would increase the load on the electronic device.

[0015] In conjunction with the first aspect, in some embodiments, before reducing the frame rate of the first application to a target frame rate through frame control operations, the method further includes: determining that the temperature of the electronic device is higher than a preset temperature threshold.

[0016] In conjunction with the first aspect, in some embodiments, performing frame control operations specifically includes: performing the frame control operations in multiple stages; the target frame rate of the frame control operations in the earlier stages is higher than the target frame rate of the frame control operations in the later stages.

[0017] In the above embodiments, the target frame rate of the frame control operation is different in different stages. The target frame rate of the frame control operation in the earlier stage is higher than that in the later stage. This means that the frame rate is gradually reduced when the frame control operation is performed. By slowly reducing the frame rate, the system can smoothly transition and avoid screen stuttering or inconsistency, thereby making the user experience more comfortable.

[0018] In conjunction with the first aspect, in some embodiments, the first application is a game application in the electronic device.

[0019] In a second aspect, embodiments of this application provide an electronic device comprising: one or more processors and a memory; the memory is coupled to the one or more processors and is 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 the method implemented in the first aspect.

[0020] Thirdly, embodiments of this application provide a computer-readable storage medium including instructions that, when executed on an electronic device, cause the electronic device to perform the method as implemented in the first aspect.

[0021] Fourthly, embodiments of this application provide 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 method as implemented in the first aspect.

[0022] Fifthly, embodiments of this application provide a computer program product containing instructions that, when run on an electronic device, cause the electronic device to perform the method as implemented in the first aspect.

[0023] It is understood that the electronic device provided in the second aspect, the computer storage medium provided in the third aspect, the chip system provided in the fourth aspect, and the computer program product provided in the fifth aspect are all used to execute the methods provided in the embodiments of this application. Therefore, other beneficial effects that can be achieved can be referred to the beneficial effects in the corresponding methods, and will not be repeated here. Attached Figure Description

[0024] Figure 1 A schematic diagram is shown illustrating how an electronic device controls the application frame rate based on temperature.

[0025] Figure 2 This diagram illustrates what happens when an electronic device reduces the frame rate of a game.

[0026] Figure 3 This diagram illustrates the process of an electronic device stopping control operations and resuming control frame operations.

[0027] Figure 4 This diagram illustrates another aspect of how electronic devices reduce the frame rate of a game;

[0028] Figure 5 A schematic diagram of frame control operation is shown;

[0029] Figure 6A as well as Figure 6B The diagram illustrates the impact of frame control method 1 and frame control method 2 on responsiveness.

[0030] Figure 7 A schematic diagram of a system architecture for implementing the method for controlling the application frame rate in the embodiments of this application is shown;

[0031] Figure 8 The diagram illustrates an exemplary module interaction diagram for implementing the method of controlling the application frame rate in the embodiments of this application;

[0032] Figure 9 Another schematic diagram of frame control operation is shown;

[0033] Figure 10A as well as Figure 10B A schematic diagram of stopping the control frame operation is shown;

[0034] Figure 11 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0035] In some possible implementations, when rendering frames that provide complex effects at frame rate 1 (which can be less than or equal to the application's preset frame rate), if the electronic device's temperature is detected to rise to a temperature threshold, the electronic device can reduce the frame rate (frames per second, FPS) at which the application (providing that frame) renders that frame. The reduced frame rate (denoted as frame rate 2) is less than the application's preset frame rate. By rendering frames at the reduced frame rate, the number of frames rendered by the application per unit time can be reduced, alleviating the load on the electronic device and thus lowering its temperature.

[0036] The methods to obtain the reduced frame rate (frame rate 2) include, but are not limited to, the following two methods.

[0037] Frame rate reduction method 1: such as Figure 1 As shown in (1), as the temperature (see curve S11) changes from low to high, when the electronic device is in an overheated state, the electronic device can directly reduce the application frame rate (see curve S12) from frame rate 1 to frame rate 2.

[0038] Frame rate reduction method 2: such as Figure 1 As shown in Figure (2), as the temperature (see curve S21) changes from low to high, when the electronic device is in an overheated state, the electronic device can gradually reduce the application's frame rate (see curve 22) from frame rate 1 to frame rate 2. That is, the process of reducing the frame rate from frame rate 1 to frame rate 2 is divided into at least two stages, with the frame rate after the reduction in the first stage being higher than the frame rate after the reduction in the second stage. In order to achieve a smooth frame rate decrease, the duration of the frame rate in different stages can be controlled to be the same. In this way, by slowly reducing the frame rate, the system can smoothly transition, avoiding the stuttering or inconsistency caused by directly reducing from frame rate 1 to frame rate 2, thereby making the user experience more comfortable.

[0039] It's important to note that the application's frame rate can represent the number of frames the application renders per unit of time. In some cases, after an application finishes rendering one frame, it transmits it to the Surface Flinger (SF) of the electronic device before rendering the next frame. In this case, the application's frame rate can also represent the number of frames the application transmits to the SF per unit of time.

[0040] In this embodiment, the electronic device is considered to be in an overheated state when its temperature rises to a temperature threshold. This temperature threshold can be 40°C, or other values, such as those between 40°C and 45°C. Different electronic devices may have different temperature thresholds, which can be set according to actual conditions and should not constitute a limitation on this embodiment.

[0041] Frames that can provide complex special effects include game frames, which are typically rendered by electronic devices through game applications. Beyond game frames, frames that can provide complex special effects can also include frames representing three-dimensional scenes rendered by electronic devices through applications such as augmented reality (AR) and virtual reality (VR).

[0042] The following explanation uses controlling the frame rate drop in a game application under overheating conditions as an example to reduce the temperature of the electronic device. Frame rate control methods for other applications can be found in the relevant descriptions, and will not be repeated here.

[0043] Electronic devices can reduce the frame rate (target frame rate) of a game application (gameAPP, or game for short) to a level lower than the preset frame rate of the game application through frame control operations.

[0044] It's important to note that without frame control, when the game determines which game frame to draw (hereinafter referred to as a frame), the electronic device can allocate a buffer for the game to cache the frame. After the game acquires the buffer, the electronic device can start drawing the frame through the game, and when the frame (cached in the buffer) is completed, the frame cached in the buffer is transmitted to the SF. Thus, without frame control, the time from determining which frame to draw to transmitting the frame to the SF is equal to the reciprocal of the preset frame rate. Frame control involves: when the time from allocating the buffer for caching the frame to completing the frame drawing is less than the reciprocal of the target frame rate, controlling the time from determining which frame to draw to transmitting the frame to the SF to be equal to the reciprocal of the target frame rate. The time from allocating the buffer for caching the frame to completing the frame drawing can also be called the frame preparation time period. For detailed information on frame control, please refer to the following... Figure 5 The description will not be elaborated here.

[0045] like Figure 2 As described in (1), the preset frame rate of the game can be 60 FPS. The time from when the game determines to draw a frame to when it transmits the frame to the SF is equal to the reciprocal of the preset frame rate (16.7 ms). Therefore, the time interval between when the electronic device controls the game to transmit adjacent frames to the SF is equal to the reciprocal of the preset frame rate (16.7 ms). Comparison Figure 2 Middle (1) and Figure 2 As shown in (2), the electronic device can reduce the game's frame rate from 60 FPS to 50 FPS. The time from when the game determines to draw a frame to when it transmits the frame to the SF is equal to the reciprocal of the target frame rate (20 ms). Therefore, the time interval between when the electronic device controls the game to transmit adjacent frames to the SF is reduced from 16.7 ms to 20 ms (the reciprocal of 50 FPS).

[0046] refer to Figure 2 After the electronic device transmits the screen frames to the SF (Screen Function), the SF can synthesize the screen image based on the screen frames when the vertical sync (Vsync) signal arrives. The screen image is then transmitted to the display engine, which can display the display interface including the screen frames on the screen when the Vsync signal arrives.

[0047] For ease of explanation, the frame rate that the game achieves when the electronic device performs frame control operations will be referred to as the target frame rate, which is lower than the game's preset frame rate.

[0048] If frame drops occur during frame control, and the electronic device continues to reduce the game's frame rate through frame control, the number of frames actually rendered by the game per unit time will be less than the target frame rate. This means that the number of frames actually transmitted to the server per unit time is less than the number at the target frame rate, resulting in poor game performance. Figure 3As shown in Figure (1), this is a schematic diagram of the game transmitting screen frames to the SF. When the time interval between adjacent screen frames transmitted to the SF is greater than the preset frame drop time, it indicates that the game has experienced a frame drop. The preset frame drop time can be the reciprocal of the target frame rate or greater than the reciprocal of the target frame rate. For example, when the target frame rate is 50, the preset frame drop time can be 20ms or greater than 20ms, for example, a value between (20ms, 30ms). This application does not limit this. Generally speaking, after one frame drop, there may be other frame drops, which further reduces the number of screen frames actually drawn by the game per unit time.

[0049] To maintain game performance and optimize the frame rate control experience during frame control operations, a method for controlling the application's frame rate is proposed. This method ensures that even if frame drops occur during frame control operations, the number of frames transmitted from the game to the application (SF) per unit time equals the target frame rate. For example... Figure 3 As shown in (2), when it is determined that the game is experiencing frame drops, the electronic device stops frame control operations and no longer reduces the game's frame rate. Stopping frame control operations includes: when the game completes the drawing of a frame, it transmits that frame to the SF, and when transmitting the frame to the SF, it allocates a buffer for drawing the next frame to the game, and the game draws the next frame based on this buffer. The game caches the drawn next frame in the buffer and transmits the next frame in the buffer to the SF. If it is determined that the preset conditions are met, frame control operations are resumed.

[0050] Continue to refer to Figure 3 In section (2), determining that the game has dropped frames includes: determining that there is a frame a among the frame frames drawn by the game, and the preparation time of frame a is greater than the reciprocal of the target frame rate. The preparation time of frame a is the time to transmit frame a in the buffer to SF minus the time to allocate a buffer for caching frame a for the game.

[0051] The preset conditions are determined to be met, including: simultaneously updating the timeout when a frame drop occurs and counting the number of target frames. The preset conditions are met if the timeout is updated to be greater than or equal to 0, or if the number of target frames reaches a preset number (e.g., 7 frames). The initial value of the number of target frames is 0, and the initial value of the timeout when a frame drop occurs is the reciprocal of the target frame rate minus the preparation time of frame a. The timeout is updated, and when a target frame occurs, the number of target frames is incremented by 1. The updated timeout is equal to the original timeout plus the advance time or timeout of frame b. Frame b includes frames drawn by the game after frame control operations stop. Frame b includes target frames and non-target frames. Target frames are frames drawn by the game whose preparation time is less than the reciprocal of the target frame rate and have an advance time. The advance time of a target frame is the reciprocal of the target frame rate minus the preparation time of the target frame. A non-target frame is a frame rendered by the game whose preparation time is longer than the reciprocal of the target frame rate. Non-target frames have an overrun time. The overrun time of a non-target frame is the reciprocal of the target frame rate minus the preparation time of the non-target frame.

[0052] It should be noted that, based on the foregoing, the preparation time for a frame includes the time from allocating a buffer for the game to cache the frame (one moment) to the time when the frame is fully drawn (one moment). When frame control is stopped, frame b will be transmitted to SF upon completion of drawing. Therefore, the preparation time for a frame b can be understood as: the time from allocating a buffer for the game to cache that frame b (one moment) to the time when that frame b is transmitted to SF (one moment), that is, the preparation time for that frame b is equal to the time when that frame b is transmitted to SF minus the time when the game allocates a buffer to cache that frame b.

[0053] It should be noted that stopping frame control operations can also be called frame tracking.

[0054] It should also be noted that when the timeout period when a frame drop occurs is updated to be greater than or equal to 0, it means that the timeout period when the frame drop occurs is offset by the advance time of the target frame. Let M be the number of frames drawn when the frame drop occurs and the number of frames drawn by the game before the frame control operation is restored. The time elapsed from the occurrence of a frame drop to the restoration of frame control is the same as the time to draw M frames without a frame drop, ensuring that the number of frames the game transmits to the SF per unit time equals the target frame rate. Before the timeout period when the frame drop occurs is offset by the advance time of the target frame, frame control is restored because the number of target frames has reached a preset number. This is to further reduce the load on the electronic equipment and prevent prolonged frame tracking from increasing the load on the electronic equipment.

[0055] The content that meets the preset conditions is not limited to the foregoing description, and may also include at least one of the following conditions: after stopping the frame control operation, the number of target screen frames reaches a preset number (e.g., 7 frames), or the time exceeding the time limit when a frame drop occurs is offset by the advance time of the target screen frame.

[0056] In some possible implementations, the aforementioned Figure 2 The Vsync signal involved can be a system configuration control signal for the electronic device that matches the game's preset frame rate. It controls the SF's frame-based composition and the display engine's display of the screen image including these frames. Here, the frequency of the Vsync signal indicates the electronic device's screen refresh rate, typically 60Hz, 120Hz, etc. For example, if the Vsync signal is activated 60 times per unit time, the electronic device's screen refresh rate is 60Hz, meaning the electronic device updates the screen image 60 times per unit time based on the Vsync signal.

[0057] When the frame rate of a game application and the frequency of the Vsync signal (or screen refresh rate) do not match, long and short frames will appear on the screen, resulting in choppy visuals and a degraded gaming experience. Here, long and short frames refer to uneven display times for frames on the screen; some frames are displayed for significantly longer than others, causing choppy visuals that are easily noticeable to the user.

[0058] contrast Figure 4 (1) (same as above) Figure 2 (1) and Figure 4 (2) (same as above) Figure 2As shown in (2), the frequency of the Vsync signal remains at 60 Hz, and the game's frame rate decreases from 60 FPS to 50 FPS. The time interval between the electronic device controlling the game to transmit adjacent frame to the SF decreases from 16.7 ms (the reciprocal of 60 FPS) to 20 ms (the reciprocal of 50 FPS). The number of frame draws per unit time controlled by the electronic device decreases from 60 to 50, and the number of frame transmissions per unit time controlled by the electronic device to the SF decreases from 60 to 50. Although this can reduce the load on the electronic device and help lower the temperature, there will be scenarios where the SF has received the Vsync signal but has not received the frame, causing the previous frame to continue to be displayed when the frame should be updated on the screen. For example, when Vsync signal 1, indicating the arrival of the 4th frame, arrives, the display engine displays the 4th frame on the screen. However, if the 5th frame is not transmitted to the SF before Vsync signal 1 arrives, the SF will again synthesize the screen image based on the 4th frame and transmit it to the display engine. Consequently, when Vsync signal 2 arrives, the display engine will continue to display the screen image including the 4th frame. In this case, the 4th frame is displayed as two 16.7ms frames, which are long frames. Frames 1 through 3 are each displayed as one 16.7ms frame, which are short frames compared to the 4th frame. Similarly, as the frames are updated, other long frames will appear after the 4th frame. For example, the 9th frame is also a long frame.

[0059] To address the aforementioned issue of varying frame rates caused by frame rate reduction, electronic devices can enable the Xsync+ high-frequency TE signal scheme when reducing the frame rate of a game application (gameAPP, or game for short) to a level lower than the game application's preset frame rate through frame control operations. Here, TE refers to transverse electric wave signal.

[0060] like Figure 4As shown in (3), the Xsync + high-frequency TE signal scheme is used to control the SF to synthesize the screen image based on the received screen frame when it receives the screen frame transmitted by the game, and transmit the screen image to the display engine without waiting for the Vsync signal. The display engine also does not need to wait for the Vsync signal, but transmits the screen image to the display screen for display when it receives the high-frequency TE signal. The high-frequency TE signal here refers to a transverse radio wave signal with a higher frequency (e.g., 360HZ), which is higher than the Vsync signal and can control the display engine to transmit the received screen image to the display screen for display more promptly. This means that when the game's frame rate drops from 60FPS to 50FPS, the time interval between adjacent screen frames transmitted to the SF can be controlled within 20ms. If the display engine can send the image to the display in time, the update time interval of the screen image, including the screen frame, on the display screen can also be controlled within 20ms, avoiding the aforementioned Figure 4 The long and short frame phenomenon shown in (2) is beneficial to optimizing the frame control experience.

[0061] It should be noted that the "equal to" in the embodiments of this application is not an absolute equal to, and there may be a certain margin of error. For example, in the description of "equal to 16.7ms", "close to 16.7ms" can also be understood as equal to 16.7ms. As another example, the update time interval of the screen image, including the frame, on the display screen can also be controlled at 20ms, and "close to 20ms" can also be understood as 20ms.

[0062] Based on the foregoing, the aforementioned frame control operation involves controlling the time from when the game determines to draw a frame to when it transmits the frame to the SF to be equal to the reciprocal of the target frame rate, when the preparation time of the frame (the time from when the game allocates a buffer for caching the frame to when the time to complete drawing the frame is less than the reciprocal of the target frame rate) is less than the reciprocal of the target frame rate. This controls the number of frames that the game transmits to the SF per unit time to be the target frame rate.

[0063] Based on this, a frame control method (denoted as frame control method 1) is provided here to enable electronic devices to perform frame control operations, as shown in the reference. Figure 5As shown in (1), frame control method 1 includes: a frame (e.g., frame 11) is drawn at time 11a, and the drawn frame 11 is buffered in a buffer. When it is determined that the preparation time of frame 11 is less than the reciprocal of the target frame rate, the electronic device controls the game to wait for a time period 11c after time 11a, and then transmits the frame 11 in the buffer to the SF. The time period 11c is equal to the reciprocal of the target frame rate minus the preparation time of frame 11. The preparation time of frame 11 is the time to complete the drawing of frame 11 minus the time to allocate a buffer for buffering frame 11 for the game.

[0064] The electronic device controls the game to wait for a period of time 11c after time 11a, and then transmit the screen frame 11 in the buffer to the SF. This includes: after time 11a, the electronic device controls the queueBuffer operation to sleep for a period of time 11c. When the queueBuffer operation has been asleep for a period of time 11c, the game is then controlled to transmit the screen frame 11 in the buffer to the SF through the queueBuffer operation.

[0065] Continue to refer to Figure 5 As shown in (1), after the game transmits frame 11 to the SF, it determines to draw frame 12 (the next frame after frame 11). Then, the game requests a buffer from the SF to cache frame 12. The SF allocates a buffer for the game to cache frame 12 through the deQueueBuffer operation. Then, the electronic device performs the aforementioned frame control operation based on frame 12, or stops the frame control operation when it determines that frame 12 is the aforementioned frame that causes frame drops (e.g., frame a). For a description of this process, please refer to the aforementioned related content, which will not be repeated here.

[0066] It should be noted that the buffer mentioned above for caching frame 11 is also allocated to the game by the electronic device control SF through the deQueueBuffer operation.

[0067] Electronic devices based on the aforementioned Figure 5 When frame control method 1 shown in Figure (1) is used to perform frame control operation, although it can control the game's frame rate to drop to the target frame rate, it will result in poor responsiveness for the user when using the game. The reason for the poor responsiveness is that when frame control method 1 is used to perform frame control operation, if the user's operation on the game controls (such as a click operation) is detected, in response to the operation, after the electronic device completes the drawing of the screen frame corresponding to the operation through the game, it still needs to wait for the queueBuffer operation to end its sleep before it can transmit the screen frame corresponding to the operation to SF for compositing, and only after compositing can it be displayed.

[0068] In order to improve the responsiveness of the game when performing frame control operations, another frame control method (referred to as frame control method 2) is provided to enable electronic devices to perform frame control operations.

[0069] refer to Figure 5 As shown in (2), the sleep object for implementing frame control operations in frame control method 2 is not the queueBuffer operation (the sleep object for implementing frame control operations in frame control method 1), but the deQueueBuffer operation. Frame control method 2 includes: when the game transmits screen frame 10 (the screen frame preceding screen frame 11) to the SF at time 11b, it determines to draw screen frame 11. When the preparation time period for screen frame 10 is less than the reciprocal of the target frame rate, the electronic device waits for a time period 11d after time 11b, and then allocates the buffer used to cache screen frame 11 to the game. Time period 11d is equal to the reciprocal of the target frame rate minus the preparation time period for screen frame 10. The preparation time period for screen frame 10 is the time for transmitting screen frame 10 to the SF (time 11b) minus the time for allocating the buffer used to cache screen frame 10 to the game (one time).

[0070] After time 11b, the electronic device waits for a period of time 11d before allocating the buffer used to cache screen frame 11 to the game. This includes: after time 11b, the electronic device controls the deQueueBuffer operation to sleep for a period of time 11d. When the deQueueBuffer operation has been asleep for a period of time 11d, the electronic device controls the SF to allocate the buffer used to cache screen frame 11 to the game through the deQueueBuffer operation.

[0071] Continue to refer to Figure 5 As shown in (2), when the buffer used to cache frame 11 is allocated to game, the electronic device can start drawing frame 11 through game. And when frame 11 is drawn, the control game transfers frame 11 in the buffer to SF through queueBuffer operation (without sleeping).

[0072] In this way, when using frame control method 2 to perform frame control operations, if a user's operation on the game controls in the game (such as a click operation) is detected, the corresponding screen frame is drawn in response to the operation. After the screen frame corresponding to the operation is drawn, it can be transferred to SF for compositing through the queueBuffer operation and then displayed in time to improve responsiveness.

[0073] like Figure 6AAs shown, when using frame control method 2 for frame control operations, after the game starts, the display shows frame 21 at time t1, and at time t1, an operation on the game controls (such as a click operation) is detected, corresponding to frame 22. In response to this operation, the electronic device completes the drawing of frame 22 at time t2. At time t2, the electronic device can control the game to transmit frame 22 in the buffer to SF through the queueBuffer operation. SF combines layer 1 carrying frame 22 with layer 2 of other services to obtain the screen image, and displays the screen image including frame 22 at time t2. That is, the display shows frame 22 at time t2, resulting in good responsiveness.

[0074] Compared to frame control operation using frame control method 1, the responsiveness of frame control operation using frame control method 1 is illustrated as follows: Figure 6B As shown, with Figure 6A Taking a similar scenario as an example, the scenario is as follows: After the game starts, the display shows frame 21 at time t1, and an operation on the game controls (such as a click) is detected at time t1, corresponding to frame 22. In response to this operation, the electronic device completes the rendering of frame 22 at time t2. However, at this time, the electronic device will not... Figure 6A In the first case, the screen display includes frame 22 at time t2. However, when using frame control method 1, the electronic device waits for time t3 (the time for the queuebuffer operation on frame 22) after time t2. At time t3, the electronic device controls the game to transmit frame 22 from the buffer to the SF via the queuebuffer operation. The SF then composites layer 1 carrying frame 22 with layer 2 of other services to obtain the screen display, and displays the screen including frame 22 at time t3. Therefore, since the display shows frame 22 at time t3, which is after time t2, the responsiveness is worse compared to using frame control method 1.

[0075] It should be noted here that... Figure 6A as well as Figure 6B Layer 2 for other services is not mandatory. If the game frame is displayed in full screen, then layer 2 for other services does not need to be displayed. Other services may include services that provide a status bar; in this case, layer 2 here can be the status bar.

[0076] Figure 7 A schematic diagram of a system architecture for implementing the method for controlling the application frame rate in the embodiments of this application is shown.

[0077] like Figure 7As shown, the system architecture is divided into several layers, each with a clear role and division of labor. Layers communicate with each other through software interfaces. In some embodiments, the system architecture is divided into six layers, from top to bottom: application layer, application framework layer, framework native layer, hardware abstraction layer (HAL), kernel layer (also known as the Linux layer), and hardware layer.

[0078] The application layer may include a series of application packages. For example, it may include gameAPP (simply referred to as game). Other services that provide the content in layer 2, as mentioned above, may also be placed in the application layer.

[0079] The application framework layer provides application programming interfaces (APIs) and programming frameworks for applications in the application layer.

[0080] The application framework layer may include a SurfaceView for displaying game frames. The application framework layer may also include a frame rate control module for controlling the electronic device to perform the aforementioned frame control operations.

[0081] The native framework layer sits between the application framework layer and the kernel layer, primarily containing native implementations of hardware access and system services. The native framework layer may include libEGL, which shares a process with SurfaceView, which displays game frames.

[0082] The libEGL library can be called by the game to draw game frames, which are then transmitted to SurfaceFlinger (SF) for compositing. This local framework layer may also include the aforementioned SurfaceFlinger (SF) and a frame rate fading management module. SF is used to compose the screen image based on game frames. The frame rate fading management module determines whether the electronic device is overheating. When the electronic device is overheating, the frame rate fading management module also controls SF to not wait for the Vsync signal when compositing based on game frames, and controls the display driver to not wait for the Vsync signal when sending the image to the display, but instead using a high-frequency TE signal.

[0083] The hardware abstraction layer is an interface layer located between the operating system kernel layer and other layers of electronic devices (such as the local service layer). Its purpose is to abstract the hardware and provide a virtual hardware platform for the operating system.

[0084] The hardware abstraction layer can include a hardware composer (HWC) and a thermal controller. The HWC is invoked by the aforementioned SF (Software Synthesizer) to synthesize screen images based on frame rates. The thermal controller is used to determine the temperature of the electronic device.

[0085] The kernel layer is the layer between hardware and software. It can also be called the driver layer. The kernel layer can include the display driver. The display driver is used to transmit received screen images to the display screen (located at the hardware layer) for display. The game frames included in the screen image are specifically displayed in a surface window on the display screen used to show these game frames.

[0086] The various layers cooperate with each other to complete the method for controlling the application frame rate involved in the embodiments of this application. A description of this process can be found below.

[0087] refer to Figure 7 At point (1), the temperature warning module in the frame rate easing management module can register with thermal to monitor the temperature. thermal can transmit the measured temperature of the electronic device to the temperature warning module. If the temperature warning module determines that the temperature of the electronic device is higher than the preset temperature threshold, the temperature warning module triggers the easing switch module to enable frame rate easing in order to control the frame rate easing of the game.

[0088] refer to Figure 7 At point (2), the gradual reduction switch module determines the target frame rate through the frame rate adjustment module. The frame rate adjustment module sends the target frame rate to the frame rate control module, so that the frame rate control module performs frame control operations to reduce the game's frame rate. This frame rate adjustment module can gradually reduce the target frame rate, so that the frame rate control module divides the frame control operations into different stages. The target frame rate gradually decreases from the beginning to the end of the stages, so that the game's frame rate gradually decreases. For relevant content related to the frame rate control module controlling the reduction of the game's frame rate, please refer to the following... Figure 7 In the middle (2a) and Figure 7 Description of the operation involved in section (2b).

[0089] See Figure 7 In section (2a), the frame rate control module controls the frame rate based on the target frame rate. This process includes: performing the aforementioned frame rate control operations to reduce the game's frame rate to the target frame rate (less than the preset frame rate). See Figure 7In section (2b), after detecting frame drops in the game, the frame rate control module stops frame control operations, causing the game to draw frames based on a preset frame rate, thus achieving frame tracking. When preset conditions are met, the frame rate control module resumes frame control operations. For a detailed description of the frame control operations and the conditions for meeting preset conditions, please refer to the aforementioned content; further details will not be provided here.

[0090] refer to Figure 7 At point (3), the slow-descent switch module notifies SF (SurfaceFlinger) to activate the Xsync+ high-frequency TE signal scheme. The relevant details of this process can be found in the following section. Figure 7 The middle (3a) and Figure 7 Description of the operation involved in section (3b).

[0091] See Figure 7 At point (3a), SF no longer waits for the Vsync signal when synthesizing game screen frames. After receiving the screen frame transmitted by game (game screen frame), SF can synthesize the screen image based on that game screen frame. See Figure 7 At point (3b), SF notifies HWC to enable the high-frequency TE signal. This process includes: HWC sending a high-frequency TE signal to the display driver, causing the display driver to send the display according to the high-frequency TE signal, without waiting for the Vsync signal to arrive before sending the display.

[0092] refer to Figure 7 As shown in (4), under the control of the frame rate control module, the game sends game frame data to the SF. After receiving the game frame data, the SF sends the game frame data to the HWC, calls the HWC to synthesize the game frame data, obtains the screen image, and sends the screen image to the display driver. After receiving the high-frequency TE signal, the display driver transmits the screen image to the display screen for display.

[0093] It should be noted here that... Figure 7 The operation shown in (2) and Figure 7 There is no sequential relationship between the operations shown in (3).

[0094] Figure 8 The diagram illustrates an exemplary module interaction diagram for implementing the method of controlling the application frame rate in the embodiments of this application.

[0095] The modules involved here mainly include a frame rate easing management module, a frame rate control module, a game app, a private server (SF), and a display driver. These modules cooperate to complete the method for controlling the application frame rate involved in this embodiment. The following explanation uses controlling the game's frame rate easing as an example. The details of the frame rate decreasing directly from a preset frame rate to the final target frame rate can be found in the following description and will not be repeated here. The description of the game's frame rate easing process can be found in the following description of steps S101-S105.

[0096] S101. The frame rate descent management module determines that the temperature of the electronic device is higher than the preset temperature threshold.

[0097] As mentioned above Figure 7 As shown in section (1), the frame rate easing management module can monitor the temperature of the electronic device based on thermal signals. It then determines whether the temperature of the electronic device is higher than a preset temperature threshold. If the temperature of the electronic device is higher than the preset temperature threshold, steps S102 and S103 are executed. It should be noted that there is no specific order between steps S102 and S103.

[0098] S102. The frame rate easing management module notifies SF (SurfaceFlinger) to enable the Xsync+ high-frequency TE signal scheme. This process may include steps S102a and S102b.

[0099] The S102a.SF synthesizes the frames received from the game transmission immediately, without waiting for the Vsync signal.

[0100] SF's activation of the Xsync+ high-frequency TE signal scheme means that SF can synthesize the screen image based on the screen frame transmitted by the game when it receives the screen frame, without having to wait for the Vsync signal to arrive before it can synthesize the screen image.

[0101] S102b. The display driver sends the image to the screen immediately upon receiving it, without waiting for the Vsync signal.

[0102] The display driver receives the high-frequency TE signal sent by HWC and displays the data according to the high-frequency TE signal, without waiting for the Vsync signal to arrive before displaying the data.

[0103] The frame rate easing management module can send a set of target frame rates to the frame rate control module. This set of target frame rates can be sent to the frame rate control module all at once or sequentially; this embodiment does not limit this. If the earlier target frame rate in the set is greater than the later target frame rate, the frame rate control module divides the frame control operation into different stages based on this set of target frame rates. The target frame rate gradually decreases from the earlier to the later stages, resulting in a gradual decrease in the game's frame rate. Step S103 below describes the relevant content of frame rate control for the game based on a target frame rate. It should be noted that step S103 can be executed cyclically, and the target frame rate gradually decreases during cyclic execution. Optionally, to increase the smoothness of the frame rate easing, the duration of different target frame rates can be the same.

[0104] S103. The frame rate easing management module sends the target frame rate to the frame rate control module. This process includes steps S103a and S103b.

[0105] S103a. The frame rate control module performs frame control operations, controlling the number of frames drawn by the game per unit time to the target frame rate, and further controlling the number of frames transmitted by the game to the SF per unit time to the target frame rate.

[0106] The frame rate control module can execute the aforementioned frame control method 1 and frame control method 2 to implement frame control operations.

[0107] Among them, frame control method 1 is to control the queueBuffer operation to sleep when the preparation time of the picture frame is less than the reciprocal of the target frame rate, so that the picture frame after it is drawn is transmitted to SF after the queueBuffer operation sleep ends, thereby realizing frame control operation.

[0108] like Figure 9 As shown in (1), in frame control mode 1, the preparation time of a screen frame (e.g., the Nth screen frame) is equal to the time when the Nth screen frame is drawn minus the time when the game allocates a buffer for caching the Nth screen frame. Here, the time when the game allocates a buffer for caching the Nth screen frame can be regarded as the time of the Nth screen frame's deQueueBuffer, that is, the time when the game performs the deQueueBuffer operation to obtain the buffer for caching the Nth screen frame.

[0109] Continue to refer to Figure 9As shown in (1), for the Nth frame, the sleep time (Δt1) of the queueBuffer operation is the reciprocal of the target frame rate (1s / tarFps(ms)) minus the preparation time of the Nth frame. After performing the queueBuffer operation for the Nth frame, the Nth frame can be transmitted to SF.

[0110] It should be noted that, Figure 9 The frameControl shown in (1) indicates that the queueBuffer operation is controlled to sleep. In frame control mode 1, when the (N-1)th frame is transmitted to the SF, the game can determine to draw the Nth frame. When the Nth frame is determined to be drawn, the game performs the deQueueBuffer operation to obtain a buffer for caching the Nth frame. Therefore, in frame control mode 1, the time when the (N-1)th frame is transmitted to the SF, the time when the Nth frame is determined to be drawn, and the time when the Nth frame is deQueueBuffered can be regarded as the same time.

[0111] Frame control method 2 involves controlling the deQueueBuffer operation to sleep when the preparation time of the previous frame is less than the reciprocal of the target frame rate. This delays the start time of drawing the next frame before transmitting the completed next frame to the SF, thus achieving frame control. Essentially, if the time from determining the drawing of the previous frame to its transmission to the SF is too fast (faster than the reciprocal of the target frame rate), delaying the drawing of the next frame "makes up" for the time difference, thereby ensuring that the number of frames transmitted to the SF per unit time is equal to the target frame rate.

[0112] like Figure 9 As shown in (2), in frame control mode 2, the preparation time of the previous frame (e.g., the (N-1)th frame) is equal to the time when the (N-1)th frame is transmitted to the SF minus the time when the game allocates a buffer for caching the (N-1)th frame. Here, the time when the game allocates a buffer for caching the (N-1)th frame can be regarded as the time of the (N-1)th frame's deQueueBuffer, that is, the time when the game performs the deQueueBuffer operation to obtain the buffer for caching the (N-1)th frame.

[0113] Continue to refer to Figure 9As shown in (2), the reciprocal of the target frame rate (1s / tarFps(ms)) minus the preparation time of the (N-1)th frame equals Δt2 (>0). Therefore, the sleep time of the deQueueBuffer operation for the Nth frame is Δt2. By performing the deQueueBuffer operation for the Nth frame, a buffer for caching the Nth frame can be allocated to the game. When the game is allocated a buffer for caching the Nth frame, it starts drawing the Nth frame, and when the Nth frame is drawn, it transfers the Nth frame in the queueBuffer to SF.

[0114] It should be noted that, Figure 9 The frameControl shown in (2) indicates that the deQueueBuffer operation is controlled to sleep. In frame control mode 2, the N-1th frame can be transmitted to the SF when the N-1th frame is completed. When the N-1th frame is transmitted to the SF, the game can determine to draw the Nth frame. However, after determining to draw the Nth frame, the time for the game to perform the deQueueBuffer operation is delayed. Therefore, in frame control mode 2, the time for the N-1th frame to be completed, the time for the N-1th frame to be transmitted to the SF, and the time for determining to draw the Nth frame can be regarded as the same time.

[0115] It should be noted here that... Figure 9 The Nth frame shown can be understood as the aforementioned Figure 5 The image frame 11 is shown in the image. The control process for other image frames can be referred to the control process for the Nth image frame, which will not be repeated here.

[0116] S103b. When it is determined that there is frame dropping in the game, stop the frame control operation, the game draws the screen frames according to the preset frame rate, and then transmits the screen frames to SF according to the preset frame rate.

[0117] When the time interval between the transmission of adjacent frames to the SF is greater than the preset frame drop time, it can be determined that a frame drop has occurred. Here, the preset frame drop time is explained using the reciprocal of the target frame rate as an example.

[0118] The reason why the time interval between adjacent frame transmissions to SF is greater than the reciprocal of the target frame rate is that the frame drawn by the game includes the aforementioned frame 'a', and the preparation time of frame 'a' is greater than the reciprocal of the target frame rate. For example... Figure 10A As shown, the preparation time for frame a is the time to transmit frame a from the buffer to SF minus the time to allocate a buffer for caching frame a for game (which can be considered as...). Figure 10AThe time taken for the deQueueBuffer operation to be performed on frame a). At this time, the timeout due to frame drop (Δt1a < 0) is equal to the reciprocal of the target frame rate (1s / tarFps(ms)) minus the preparation time of frame a, and frame control is not executed.

[0119] Once frame 'a' is confirmed to exist, frame control is stopped. The game then renders frames at a preset frame rate and transmits them to the private server (SF) at the same preset frame rate to catch up on dropped frames and "make up" for the lost time. Once preset conditions are met, frame control is resumed, ensuring that, overall, the number of frames transmitted from the game to the SF per unit time maintains the target frame rate.

[0120] Once the preset conditions are met, resume frame control operation and re-execute step S103a, which will not be elaborated here.

[0121] Determining whether the preset conditions are met may include: simultaneously updating the timeout period when a frame drop occurs and counting the number of target frames. If the timeout period is updated to be greater than or equal to 0, or if the number of target frames reaches a preset number (e.g., 7 frames), the preset conditions are determined to be met. Taking the timeout period when a frame drop occurs as the timeout period (Δt1a) of the aforementioned frame a as an example, the relevant content involved in this process can be referred to in the following... Figure 10B Description of steps S201-S206.

[0122] S201a. The initial value of the time exceeding the limit is denoted as the time exceeding the limit of frame a, Δt1a.

[0123] S202. Draw the i-th frame b according to the preset frame rate, where the initial value of i is 1.

[0124] Drawing the i-th frame b according to the preset frame rate means: when the i-th frame b is completed, it is transmitted to SF. When transmitting the i-th frame b to SF, a buffer for drawing the (i+1)-th frame b is allocated to game. game draws the (i+1)-th frame b based on this buffer. game buffers the drawn (i+1)-th frame b in the buffer and transmits the (i+1)-th frame b in the buffer to SF.

[0125] S203. Determine the time difference between the reciprocal of the target frame rate and the preparation time of the i-th frame b, denoted as Δt2i.

[0126] like Figure 10AAs shown, the explanation will be based on the first frame, frame b. The preparation time for the first frame, frame b, is the time it takes to transmit the first frame, frame b, from the buffer to the SF, minus the time it takes to allocate a buffer for caching the first frame, frame b, in the game (which can be considered as...). Figure 10A The time taken to perform the deQueueBuffer operation for the first frame (frame b). At this time, the time difference between the reciprocal of the target frame rate (1s / tarFps(ms)) and the preparation time of the first frame (frame b) is Δt21. Since Δt21 > 0, the first frame (frame b) has an advance time.

[0127] When i is greater than 2, the process of obtaining Δt2i for frame b of the i-th frame is the same as the process of obtaining Δt21 for frame b of the 1st frame, which can be referred to in the relevant description. However, whether Δt2i of frame b of the i-th frame is greater than 0 or less than 0 depends on the preparation time of frame b of the i-th frame, which can also be understood as depending on the length of time the game takes to draw frame b of the i-th frame. Although frame control has stopped and the game draws frames at a preset frame rate, frame drops may continue to occur after frame a drops. Therefore, the relationship between Δt2i and 0 is not definite.

[0128] If Δt2i>0, perform the following steps S204a and S204b.

[0129] S204a.Δt1a=Δt1a+Δt2i, i=i+1.

[0130] S204b. Target frame +1.

[0131] If Δt2i>0, the i-th frame b has an advance time and is the target frame. The number of target frames can be incremented by 1.

[0132] If Δt2i < 0, only step S204a is executed to update the timeout. However, if Δt2i < 0, the i-th frame b has a timeout and is a non-target frame, so the number of target frames is not incremented by 1.

[0133] S205. Determine whether the number of target frame frames is greater than 7, or Δt1a >= 0.

[0134] If not, proceed to step S202 to continue updating the timeout and counting the number of target frame frames.

[0135] If so, then resume frame control operation. Also, ensure the execution timeout Δt1a = 0 and the target frame = 0 (see...). Figure 10B (Step S206) is used for the next stop control frame operation.

[0136] It should be noted that updating to 0 (greater than or equal to 0) after the timeout does not mean absolutely equal to 0; a state less than 0 but close to 0 can also be interpreted as equal to 0. The aforementioned target frame count reaching a preset number of 7 frames is also an example; it can actually be any other value, such as any integer value between 5 and 10, and should not constitute a limitation on the embodiments of this application.

[0137] In some possible cases, updating the timeout to be greater than or equal to 0 is optional. When the updated timeout is equal to the preset limit value, it can also be regarded as a condition for resuming frame control operation.

[0138] It should also be noted that, Figure 10A The example used is frame control method 1. The actual frame control method 2 involves the same description of judging the timeout of frame a as frame control method 1. You can refer to the relevant content, which will not be repeated here.

[0139] For SF, after enabling the Xsync+ high-frequency te signal scheme, the following steps S104 can be performed to synthesize the screen image in a timely manner.

[0140] When S104.SF receives a frame transmitted by the game, it synthesizes a screen image based on the frame.

[0141] Subsequently, the screen image is transmitted to the display driver, and the display is confirmed to be sent to the display according to the following steps S105.

[0142] S105. The display driver transmits the screen image to the display screen for display based on the high-frequency TE signal.

[0143] After receiving the high-frequency TE signal, the display driver transmits the screen image to the display screen for display.

[0144] It should also be noted that, in addition to implementing the method of controlling the application frame rate involved in the embodiments of this application in an overheated state, the electronic device can also be used in other scenarios. For example, when the battery of the electronic device is too low, the power consumption of the electronic device can be reduced and the battery level can be slowed down by implementing the method of controlling the application frame rate.

[0145] The following describes an exemplary electronic device provided in the embodiments of this application.

[0146] Figure 11 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application.

[0147] The following uses an electronic device as an example to illustrate the embodiments in detail. It should be understood that the electronic device may have more than Figure 11The more or fewer components shown can be combined into two or more components, or they can have different component configurations. Figure 11 The various components shown can be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application-specific integrated circuits.

[0148] The electronic device 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.

[0149] 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.

[0150] In this embodiment of the application, the processor 110 can call computer instructions stored in the internal memory 121 to cause the electronic device to execute the method in this embodiment of the application.

[0151] This application also provides a chip system including at least one processor for implementing the functions involved in the methods performed by the electronic device in any of the above embodiments.

[0152] In one possible design, the chip system also includes a memory for storing program instructions and data, which may be located within or outside the processor.

[0153] The chip system can consist of chips or include chips and other discrete components.

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

[0155] Optionally, the chip system may contain one or more memories. These memories may be integrated with the processor or separated from it; this application does not limit the specific implementation.

[0156] For example, the memory can be a non-transient processor, such as a read-only memory (ROM), which can be integrated on the same chip as the processor or set on different chips. This application does not specifically limit the type of memory or the way the memory and processor are set.

[0157] This application also provides a computer program product comprising: a computer program (also referred to as code or instructions) that, when run, causes a computer to perform the method executed by the electronic device in any of the above embodiments.

[0158] This application also provides a computer-readable storage medium storing a computer program (also referred to as code or instructions). When the computer program is run, it causes the computer to perform the method executed by the electronic device in any of the above embodiments.

[0159] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit it. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.

[0160] As used in the above embodiments, depending on the context, the term "when..." can be interpreted as meaning "if...", "after...", "in response to determining...", or "in response to detecting...". Similarly, depending on the context, the phrase "when determining..." or "if (the stated condition or event) is interpreted as meaning "if determining...", "in response to determining...", "when (the stated condition or event) is detected", or "in response to detecting (the stated condition or event)".

[0161] The terminology used in the embodiments of this application is for the purpose of describing particular embodiments only and is not intended to be limiting of this application. As used in the specification and appended claims of this application, the singular expressions “a,” “an,” “the,” “the,” “the,” and “this” are intended to include the plural expressions as well, unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in this application refers to and includes any or all possible combinations of one or more of the listed items.

[0162] The terms "first" and "second" are used for descriptive purposes only and should not be construed as implying or suggesting relative importance or implicitly indicating the number of indicated technical features. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more.

[0163] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program 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 website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state drive), etc.

[0164] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This program can be stored in a computer-readable storage medium, and when executed, it can include the processes described in the above method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM or random access memory (RAM), magnetic disks, or optical disks.

Claims

1. A method for controlling the frame rate of an application, characterized in that, Applied to electronic devices, the method includes: Perform frame control operation, the frame control operation includes: controlling the number of frames of screen frames transmitted by the first application to SurfaceFlinger per unit time to a target frame rate, the target frame rate being less than the set frame rate of the first application; When it is determined that the first application is experiencing frame drops, the frame control operation is stopped. Stopping the frame control operation includes: when the first application completes the rendering of a frame, transmitting the frame to the SurfaceFlinger, and when transmitting the frame to the SurfaceFlinger, allocating a buffer for rendering the next frame to the first application; the frame drops include: the first application experiencing a time interval between transmitting two adjacent frames to the SurfaceFlinger that is greater than the reciprocal of the target frame rate; If the preset conditions are met, the control frame operation is resumed.

2. The method according to claim 1, characterized in that, The method further includes: When the first application transmits the screen frame to the SurfaceFlinger, the SurfaceFlinger is controlled to synthesize the screen image based on the received screen frame; The SurfaceFlinger is controlled to transmit the screen image to the display driver; The display driver controls the transmission of the screen image to the screen of the electronic device for display based on the high-frequency transverse electromagnetic wave (TE) signal.

3. The method according to claim 1 or 2, characterized in that, When performing the frame control operation, the frame drawn by the first application includes a first frame and a subsequent second frame. The method further includes: The first frame cached in the first buffer is transmitted to the SurfaceFlinger at a first moment; the first buffer is allocated to the first application at a second moment, which is before the first moment. After the first moment, wait for a first time period, and then allocate the second buffer to the first application. The second buffer is used to cache the second screen frame drawn by the first application. The second screen frame cached in the second buffer is used to transmit to the SurfaceFlinger for compositing. The first time period is equal to the reciprocal of the target frame rate minus the second time period. The second time period is the first moment minus the second moment.

4. The method according to claim 1 or 2, characterized in that, When performing the frame control operation, the first application draws a first frame in the frame, and the method further includes: The first application completes the drawing of the first screen frame at a first moment; the drawn first screen frame is cached in a first buffer, which is allocated to the first application at a second moment; The first application is controlled to wait for a first time period after the first moment, and then transmit the first frame in the first buffer to the SurfaceFlinger; the first time period is equal to the reciprocal of the target frame rate minus the second time period, and the second time period is the first moment minus the second moment.

5. The method according to claim 3 or 4, characterized in that, Determining that the first application has dropped frames specifically includes: determining that the frame drawn by the first application includes a third frame, such that the third time period is greater than the reciprocal of the target frame rate; wherein, the third time period is equal to the time for transmitting the third frame in the third buffer to the SurfaceFlinger minus the time for allocating the third buffer to the first application.

6. The method according to claim 5, characterized in that, The preset conditions are met, including: Simultaneously update the first time difference and count the number of target frames. If the first time difference is updated to be greater than or equal to 0, or if the number of target frames reaches a preset number, it is determined that the preset condition is met. The initial value of the number of target frames is 0, and the initial value of the first time difference is equal to the reciprocal of the target frame rate minus the third time period. Update the first time difference, and when a target frame appears, increment the number of target frames by 1. The updated first time difference is equal to the first time difference before the update plus the second time difference. The second time difference is equal to the reciprocal of the target frame rate minus the fourth time period. The fourth time period is equal to the time for transmitting the fourth frame in the fourth buffer to the SurfaceFlinger minus the time for allocating the fourth buffer to the first application. The fourth frame includes the frame drawn by the first application when the frame control operation is stopped. The fourth frame includes target frames and non-target frames. The target frame is the frame in the fourth frame that makes the second time difference greater than 0.

7. The method according to any one of claims 1-6, characterized in that, Before reducing the frame rate of the first application to the target frame rate through frame control operations, the method further includes: The temperature of the electronic device is determined to be higher than a preset temperature threshold.

8. The method according to any one of claims 1-7, characterized in that, Performing control frame operations specifically includes: The frame control operation is performed in multiple stages; the target frame rate of the frame control operation in the earlier stage is higher than the target frame rate of the frame control operation in the later stage.

9. The method according to any one of claims 1-8, characterized in that, The first application is a game application in the electronic device.

10. An electronic device, characterized in that, include: 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, the one or more processors invoking the computer instructions to cause the electronic device to perform the method as described in any one of claims 1-9.

11. A computer-readable storage medium comprising computer instructions, characterized in that, When the computer instructions are executed on the electronic device, the electronic device causes the electronic device to perform the method as described in any one of claims 1-9.

12. A chip system applied to an electronic device, characterized in that, The chip system includes one or more processors, which are configured to invoke computer instructions to cause the electronic device to perform the method as described in any one of claims 1-9.

13. A computer program product containing instructions, characterized in that, When the computer program product is run on an electronic device, it causes the electronic device to perform the method as described in any one of claims 1-9.

Citation Information

Patent Citations

  • Game control device, game system, and program

    CN110022953A

  • Central processor frequency control method and related device

    CN111338838A

  • Animation frame rate control method and device, equipment and storage medium

    CN115761057A

  • Frame rate switching method and apparatus

    US20240105107A1