Frame rate control method and related device

By introducing a frame-stabilizing service module in electronic devices, the frame rate of frame sending instructions received by SurfaceFlinger is solved, and the power consumption increase in electronic devices is reduced and user experience is improved. At the same time, the SurfaceFlinger is avoided drop frames.

CN119034205APending Publication Date: 2024-11-29HONOR DEVICE CO LTD
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202310622478.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-05-29
Publication Date
2024-11-29

AI Technical Summary

Technical Problem

Electronic devices use high-performance applications, such as gaming applications, lead to increased power consumption, impact on heating and user experience, and the prior art is difficult to effectively reduce power consumption.

Method used

By introducing a stable frame service module in electronic devices, the frame rate of frame sending instructions received by SurfaceFlinger is controlled, the frame rate is reduced when the frame control conditions are not met, and the frame command is delayed or delayed when the conditions are met, so as to reduce GPU rendering and The frequency of the synthesis is reduced, thereby reducing power consumption.

Benefits of technology

It effectively reduces the power consumption of electronic devices, reduces heat generation, and improves user experience. At the same time, it avoids the frame drop of SurfaceFlinger without affecting the frame rate of the display screen.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119034205A_ABST
    Figure CN119034205A_ABST
Patent Text Reader

Abstract

The invention provides a frame rate control method and a related device, which can control a SurfaceFlinger to receive a frame sending instruction issued by an application at a first frame rate through a frame stabilizing service module when a frame control condition is not met, and can control the SurfaceFlinger to receive a frame sending instruction issued by the application at a second frame rate when the frame control condition is met. And controlling the SurfaceFlinger to receive a frame sending instruction issued by the application at a second frame rate lower than the first frame rate through the frame stabilizing service module. Therefore, when the frame control condition is met, the frame rate of sending the frame sending instruction generated by the application to the SurfaceFlinger can be reduced, and the times of rendering and sending the picture frame triggered by the application within a certain time are further reduced, so that the power consumption of the electronic equipment is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of terminal technology, and in particular to a frame rate control method and related devices. Background Art

[0002] As the application market on electronic devices continues to expand, some application manufacturers (for example, game application manufacturers) have begun to use real physics engines, high-precision rendering and other technologies in their applications, which has also put forward higher requirements on the performance of electronic devices. Therefore, electronic devices will also dispatch more system resources such as processing power and storage capacity to complete the rendering and synthetic display of the application's screen frames. This also brings more power consumption to electronic devices, causing the heat of electronic devices to increase, affecting the user's experience of using the application. Summary of the invention

[0003] The present application provides a frame rate control method and related devices, which can reduce the frame rate of the application's frame sending instructions sent to SurfaceFlinger when the frame control conditions are met, thereby reducing the power consumption of the electronic device.

[0004] In a first aspect, the present application provides a frame rate control method, which is applied to an electronic device, the electronic device includes a stable frame service module, the stable frame service module is located between an application layer and a layer synthesizer SurfaceFlinger, and the electronic device is installed with a first application, the method comprising: the first application generates a frame sending instruction; when the electronic device does not meet the frame control condition, the frame sending instruction generated by the first application is forwarded to the SurfaceFlinger at a first frame rate through the stable frame service module; wherein the frame sending instruction is used to provide a layer buffer buffer of a picture frame to the SurfaceFlinger, the buffer is used to store the picture frame rendered by a GPU, and the SurfaceFlinger is used to synthesize and display the picture frame in the buffer indicated by the frame sending instruction after obtaining the frame sending instruction; when the electronic device meets the frame control condition, the frame sending instruction generated by the first application is forwarded to the SurfaceFlinger at a second frame rate through the stable frame service module, wherein the first frame rate is greater than the second frame rate, and the frame control condition includes that the picture frame rate set by the first application is a full frame rate, the first frame rate is less than or equal to the full frame rate, and the full frame rate is the maximum refresh rate of the picture frame supported by the first application.

[0005] Through a frame rate control method provided by the present application, when the frame control condition is not met, the frame stabilization service module can be used to control SurfaceFlinger to receive the frame sending instruction issued by the application at a first frame rate, and when the frame control condition is met, the frame stabilization service module can be used to control SurfaceFlinger to receive the frame sending instruction issued by the application at a second frame rate lower than the first frame rate. In this way, when the frame control condition is met, the frame rate of the frame sending instruction generated by the application and sent to SurfaceFlinger can be reduced, thereby reducing the number of times the application triggers the rendering of the screen frame and sends the frame within a certain period of time, thereby reducing the power consumption of the electronic device.

[0006] In a possible implementation, the method further includes: obtaining a frame sending instruction generated by the first application from a graphics interface through a stable frame service module; wherein the graphics interface includes any one of the following: an open graphics library OpenGL, an open graphics library OpenGL ES for embedded systems, and a drawing application program interface Vulkan.

[0007] In this way, there is no need to improve the first application, but to adapt the stable frame service module, so that the first application can control the frame rate of the frame through the stable frame service module without any perception, thereby reducing the power consumption of the electronic device.

[0008] In one possible implementation, the frame control condition also includes: the temperature of the electronic device is higher than a specified temperature threshold, and / or the power of the electronic device is lower than a specified power, and / or the occupancy rate of the central processing unit (CPU) of the electronic device is greater than a specified occupancy rate, and / or the first application is a game application.

[0009] In this way, the electronic device can also control the frame rate of the frame sending instruction obtained by SurfaceFlinger when the temperature is too high, and / or the battery is too low, and / or the CPU occupancy is too high, so as to reduce the power consumption of the electronic device in multiple scenarios.

[0010] In one possible implementation, when the frame sending instruction issued by the first application is forwarded to the SurfaceFlinger through the stable frame service module at the second frame rate, the method also includes: synthesizing and displaying N picture frames at the first frame rate through the SurfaceFlinger, the N picture frames including M predicted picture frames, and the M predicted picture frames are generated based on historical picture frames.

[0011] In this way, after lowering the frame rate at which SurfaceFlinger obtains the frame sending instruction to the second frame rate, SurfaceFlinger can synthesize and display the screen frames at the first frame rate by supplementing frames, thereby reducing the power consumption of the electronic device and avoiding frame loss of SurfaceFlinger.

[0012] In a possible implementation manner, M is a difference between the first frame rate and the second frame rate.

[0013] In this way, after the frame rate at which SurfaceFlinger obtains the frame sending instruction is lowered to the second frame rate, the frame rate of SurfaceFlinger's synthetic display remains unchanged at the first frame rate, ensuring the stability of the frame rate during synthetic display.

[0014] In a possible implementation, the frame sending instruction generated by the first application is forwarded to SurfaceFlinger at a first frame rate through the stable frame service module, specifically including: when the first frame sending instruction generated by the first application is obtained through the stable frame service module, the first frame sending instruction is forwarded to the SurfaceFlinger through the stable frame service module; after the first frame sending instruction is forwarded to the SurfaceFlinger through the stable frame service module, when the stable frame service module obtains the second frame sending instruction generated by the first application, the second frame sending instruction is forwarded to the SurfaceFlinger through the stable frame service module.

[0015] In this way, when the frame control conditions are not met, the frame stabilization service module can immediately forward the frame sending instruction to SurfaceFlinger when it obtains the frame sending instruction generated by the first application, thereby ensuring that the frame sending instruction can reach SurfaceFlinger in time.

[0016] In a possible implementation, the frame sending instruction issued by the first application is forwarded to SurfaceFlinger at a second frame rate through the stable frame service module, specifically including: when the third frame sending instruction generated by the first application is obtained through the stable frame service module, the third frame sending instruction is provided to the SurfaceFlinger through the stable frame service module; after the third frame sending instruction is forwarded to the SurfaceFlinger through the stable frame service module, the fourth frame sending instruction generated by the first application is obtained through the stable frame service module; after the stable frame service module obtains the fourth frame sending instruction generated by the first application, the stable frame service module delays forwarding the fourth frame sending instruction to the SurfaceFlinger.

[0017] In this way, when the frame control conditions are met, the stable frame service module can delay forwarding certain frame sending instructions to SurfaceFlinger when it obtains certain frame sending instructions generated by the first application, thereby reducing the frame rate of the frame sending instructions reaching SurfaceFlinger and reducing the power consumption of the electronic device.

[0018] In a possible implementation, after the stable frame service module obtains the fourth frame send instruction issued by the first application, the stable frame service module delays forwarding the fourth frame send instruction to the SurfaceFlinger, specifically including: determining, through the stable frame service module, a first time interval between the stable frame service module obtaining the fourth frame send instruction and obtaining the third frame send instruction; if the first time interval is less than the first frame send interval, after the stable frame service module obtains the fourth frame send instruction, the stable frame service module delays the first time length to forward the fourth frame send instruction to the SurfaceFlinger, wherein the first frame send interval is a control frame period, the control frame period is the inverse of the second frame rate, and the first time length is the difference between the first frame send interval and the first time interval.

[0019] In this way, the delay time for delaying the forwarding of the frame sending instruction to SurfaceFlinger can be determined according to the frame control period corresponding to the second frame rate, so that the frame rate of the frame sending instruction obtained by SurfaceFlinger is controlled at the second frame rate.

[0020] In a possible implementation, the method further includes: if the first time interval is greater than or equal to the first frame sending interval, when the stable frame service module obtains the fourth frame sending instruction, forwarding the fourth frame sending instruction to the SurfaceFlinger through the stable frame service module.

[0021] In a possible implementation, the method also includes: after the stable frame service module delays forwarding the fourth frame sending instruction to the SurfaceFlingre, obtaining the fifth frame sending instruction generated by the first application through the stable frame service module; determining, through the stable frame service module, a second time interval between the stable frame service module obtaining the fifth frame sending instruction and obtaining the fourth frame sending instruction; if the second time interval is less than the second frame sending interval, after the stable frame service module obtains the fifth frame sending instruction, delaying the second time length through the stable frame service module to forward the fifth frame sending instruction to the SurfaceFlinger, wherein the second time length is the difference between the second frame sending interval and the second time interval, and the second frame sending interval is determined by the first time interval, the first frame sending interval and the control frame cycle.

[0022] In this way, since the timing of the application generating the frame sending instruction will fluctuate and is not strictly generated and issued periodically, the delay duration for delaying the forwarding of the frame sending instruction to SurfaceFlinger can be dynamically adjusted to stabilize the frame rate of the frame sending instruction obtained by SurfaceFlinger at the second frame rate.

[0023] In a possible implementation, the second frame sending interval is determined by the following formula:

[0024]

[0025] Wherein, Ta is the first time interval, T1 is the control frame period, TNa is the first frame sending interval, and TNb is the second frame sending interval.

[0026] In this way, through the above formula, it is possible to dynamically determine whether each frame sending instruction is delayed and how long the delay is, and the frame rate of the frame sending instruction obtained by SurfaceFlinger is stabilized at the second frame rate.

[0027] In a possible implementation, the method also includes: after the stable frame service module forwards the third frame sending instruction to the SurfaceFlinger, when the SurfaceFlinger obtains the first vertical synchronization vsync signal, the picture frames in the buffer indicated by the third frame sending instruction are synthesized and displayed by the SurfaceFlinger; after the stable frame service module forwards the fourth frame sending instruction to the SurfaceFlinger, when the SurfaceFlinger obtains the second VSYNC signal, the picture frames in the buffer indicated by the third frame sending instruction are synthesized and displayed by the SurfaceFlinger, and the second vsync signal is the next vsync signal of the first vsync signal.

[0028] In a possible implementation, the method further includes: if it is determined through the stable frame service module that there is no buffer of unsynthesized display frames in the SurfaceFlinger when the SurfaceFlinger obtains the third vsync signal and the estimated time when the stable frame service module obtains the fifth frame sending instruction generated by the first application is later than the time when the SurfaceFlinger obtains the third vsync signal, before the SurfaceFlinger obtains the third vsync signal, the stable frame service module generates a first predicted picture frame based on the picture frames in the buffer indicated by the third frame sending instruction and the picture frames in the buffer specified by the fourth frame sending instruction; and the stable frame service module generates a first predicted picture frame based on the picture frames in the buffer indicated by the third frame sending instruction and the picture frames in the buffer specified by the fourth frame sending instruction. The module provides the first predicted picture frame to the SurfaceFlinger; when the SurfaceFlinger obtains the third vsync signal, the first predicted picture frame is synthesized and displayed by the SurfaceFlinger; wherein the third vsync signal is the next vsync signal of the second vsync signal, and the difference between the time when the SurfaceFlinger obtains the third vsync signal and the time when the SurfaceFlinger obtains the second vsync signal is equal to the difference between the time when the SurfaceFlinger obtains the second vsync signal and the time when the SurfaceFlinger obtains the first vsync signal.

[0029] In this way, the timing of frame loss can be predicted in advance, and before the frame loss, the predicted frame can be supplemented based on the historically rendered frame and given to SurfaceFlinger to prevent SurfaceFlinger from dropping frames when synthesizing and sending them to the display.

[0030] In a second aspect, the present application provides an electronic device comprising: one or more processors and one or more memories; wherein the one or more memories are coupled to the one or more processors, and the one or more memories are used to store computer program code, and the computer program code includes computer instructions, and when the one or more processors execute the computer instructions, the method in any possible implementation of the above-mentioned first aspect is executed.

[0031] In a third aspect, the present application provides another electronic device, comprising one or more functional modules, wherein the one or more functional modules are used to execute the method in the above-mentioned first aspect and any possible implementation manner of the first aspect.

[0032] In a fourth aspect, the present application provides a chip system for use in an electronic device, the chip system comprising a processing circuit and an interface circuit, the interface circuit being used to receive instructions and transmit them to the processing circuit, the processing circuit being used to run instructions to execute the method in the above-mentioned first aspect and any possible implementation method of the first aspect.

[0033] In a fifth aspect, the present application provides a computer-readable storage medium, comprising instructions, characterized in that when the instructions are executed on an electronic device, the method in the above-mentioned first aspect and any possible implementation of the first aspect is executed.

[0034] In a sixth aspect, an embodiment of the present application provides a computer program product. When the computer program product runs on a computer, it enables the computer to execute the method in the above-mentioned first aspect and any possible implementation manner of the first aspect.

[0035] The beneficial effects of the second and sixth aspects can be referred to the beneficial effects of the first aspect and any possible implementation method of the first aspect, and will not be elaborated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0037] Figure 2 A timing diagram of a picture frame from rendering to display provided in an embodiment of the present application;

[0038] Figure 3 A timing diagram of a picture frame from rendering to display under frame rate control provided in an embodiment of the present application;

[0039] Figure 4 A schematic diagram of a frame rate control method provided in an embodiment of the present application;

[0040] Figure 5 A schematic diagram of a software system architecture of an electronic device provided in an embodiment of the present application;

[0041] Fig. 6A A schematic diagram of the software system architecture interaction flow of an electronic device provided in an embodiment of the present application;

[0042] Figure 6B A schematic diagram of a software system architecture interaction flow of an electronic device provided in another embodiment of the present application;

[0043] Figure 7 A schematic diagram of a frame control process provided in an embodiment of the present application;

[0044] Figure 8 This is a frame rate control timing diagram provided in an embodiment of the present application;

[0045] Fig. 9 A schematic diagram of a frame loss prediction process provided in an embodiment of the present application;

[0046] Fig.10 This is a frame rate control timing diagram provided in an embodiment of the present application;

[0047] Fig.11 A schematic diagram of a frame supplement process provided in an embodiment of the present application;

[0048] Fig.12 A schematic diagram of frame filling provided in an embodiment of the present application;

[0049] Fig.13 This is a flow chart of the frame rate control method provided in the implementation of this application. DETAILED DESCRIPTION

[0050] The technical solutions in the embodiments of the present application will be described clearly and in detail below in conjunction with the accompanying drawings. In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in the text is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.

[0051] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, unless otherwise specified, "plurality" means two or more.

[0052] The following introduces the hardware structure of an electronic device provided in an embodiment of the present application.

[0053] Figure 1 A schematic structural diagram of an electronic device 100 provided in an embodiment of the present application is shown.

[0054] It should be understood that Figure 1 The electronic device 100 shown is only an example, and the electronic device 100 may have more Figure 1 More or fewer components may be shown, two or more components may be combined, or there may be a different configuration of components. Figure 1 The various components shown in the EMBODIMENTS 2000 may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application specific integrated circuits.

[0055] The electronic device 100 may include: a processor 110, an external memory interface 120, an internal memory 121, 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, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. Among them, the sensor module 180 may include a gyroscope sensor 180B, an acceleration sensor 180E, and a touch sensor 180K, etc.

[0056] It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or separate some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0057] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0058] The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.

[0059] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

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

[0061] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.

[0062] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.

[0063] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.

[0064] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0065] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).

[0066] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.

[0067] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD). The display screen panel can also be made of an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), miniled, microled, micro-oled, a quantum dot light emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.

[0068] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.

[0069] ISP is used to process the data fed back by camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, ISP can be set in camera 193.

[0070] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.

[0071] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.

[0072] Video codecs are used to compress or decompress digital videos. The electronic device 100 may support one or more video codecs. Thus, the electronic device 100 may play or record videos in a variety of coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.

[0073] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.

[0074] The external memory 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 memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.

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

[0076] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.

[0077] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.

[0078] The speaker 170A, also called a "speaker", is used to convert an audio electrical signal into a sound signal. The electronic device 100 can listen to music or listen to a hands-free call through the speaker 170A.

[0079] The receiver 170B, also called a "earpiece", is used to convert audio electrical signals into sound signals. When the electronic device 100 receives a call or voice message, the voice can be received by placing the receiver 170B close to the human ear.

[0080] Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting their mouth close to microphone 170C to input the sound signal into microphone 170C. The electronic device 100 can be provided with at least one microphone 170C. In other embodiments, the electronic device 100 can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify the sound source, realize directional recording function, etc.

[0081] The earphone interface 170D is used to connect a wired earphone and can be a USB interface 130 or a 3.5 mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.

[0082] The gyro sensor 180B can be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (i.e., x, y, and z axes) can be determined by the gyro sensor 180B. The gyro sensor 180B can be used for anti-shake shooting. For example, when the shutter is pressed, the gyro sensor 180B detects the angle of the electronic device 100 shaking, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse movement to achieve anti-shake. The gyro sensor 180B can also be used for navigation and somatosensory game scenes.

[0083] The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in all directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of the electronic device and is applied to applications such as horizontal and vertical screen switching and pedometers.

[0084] The touch sensor 180K is also called a "touch panel". The touch sensor 180K can be set on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also called a "touch screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device 100, which is different from the position of the display screen 194.

[0085] The button 190 includes a power button, a volume button, etc. The button 190 may be a mechanical button. It may also be a touch button. The electronic device 100 may receive a button input and generate a key signal input related to the user settings and function control of the electronic device 100. The motor 191 may generate a vibration prompt. The SIM card interface 195 is used to connect a SIM card. The SIM card may be connected to or disconnected from the electronic device 100 by inserting the SIM card interface 195 or pulling the SIM card interface 195 out.

[0086] In the embodiment of the present application, the device type of the electronic device 100 can be a mobile phone, a tablet computer, a handheld computer, a desktop computer, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a cellular phone, a personal digital assistant (PDA), as well as smart home devices such as smart large screens and smart speakers, wearable devices such as smart bracelets, smart watches, and smart glasses, extended reality (extended reality, XR) devices such as augmented reality (AR), virtual reality (VR), and mixed reality (MR), vehicle-mounted devices or smart city devices, and the like.

[0087] The following describes the process from rendering to displaying the picture frame.

[0088] First, some concepts related to the rendering and display of picture frames in the embodiments of the present application are introduced.

[0089] 1. Screen refresh rate: refers to the number of times the display screen on an electronic device refreshes the display frame within 1 second. Generally, the refresh rate of the display screen of an electronic device is related to the fixed parameters of the display screen and is a fixed value. For example, the refresh rate can be 60 Hz.

[0090] 2. Rendering frame rate (framerate): Indicates the number of frames that the application's rendering thread calls the GPU to render in 1 second. The rendering frame rate can be controlled by the application.

[0091] 3. Vertical synchronization (vsync) signal: Since the application needs to call the GPU to render the screen frame first, it can store the rendered screen frame in the layer buffer (buffer) and provide it to the layer synthesizer (SurfaceFlinger) for layer synthesis. After SurfaceFlinger takes out the rendered screen frame from the buffer for layer synthesis, it will send the screen frame after layer synthesis to the display screen for refresh display. When SurfaceFlinger sends the screen frame after layer synthesis to the display screen during the screen refresh process, it is easy for the two different screen frames before and after to overlap and display, causing the screen to tear (tearing) on ​​the display screen. Therefore, in order to prevent this screen tearing phenomenon, the hardware module corresponding to the display screen can generate a vsync signal with the same period as the refresh rate and give it to SurfaceFlinger. After receiving the vsync signal each time, SurfaceFlinger can take out the screen frame from the buffer for layer synthesis and send it to the display screen for refresh display.

[0092] Figure 2 A timing diagram of the picture frame from rendering to display provided in an embodiment of the present application is shown.

[0093] like Figure 2 As shown, an application (such as a game application) can send rendering instructions to the GPU to render the screen frame, and after sending the rendering instructions, the application can send a frame sending instruction to SurfaceFlinger. After the GPU renders the screen frame, the GPU can store the screen frame in the buffer indicated by the rendering instruction. After SurfaceFlinger obtains the frame sending instruction, it can obtain the screen frame buffer. After SurfaceFlinger detects that the screen frame buffer is filled with the rendered screen frame, it can wait for the arrival of the next vsync signal, take out the screen frame from the screen frame buffer for layer synthesis, and send it to the display screen for refresh display.

[0094] For example, between vertical synchronization signal 0 (VSYNC0) and vertical synchronization signal 1 (VSYNC1), the application can send rendering instruction A to the GPU and frame instruction A to SurfaceFlinger. After obtaining rendering instruction A, the GPU can render screen frame A and store the rendered screen frame A in the buffer of screen frame A indicated by rendering instruction A. SurfaceFlinger can obtain the buffer of screen frame A by sending frame instruction A, and after detecting that the rendered screen frame A is filled in the buffer of the screen frame, when VSYNC1 arrives, it takes out the screen frame A from the buffer of screen frame A for layer synthesis and sends it to the display screen for refresh display.

[0095] Between vertical synchronization signal 1 (VSYNC1) and vertical synchronization signal 2 (VSYNC2), the application can send rendering instruction B to the GPU and send frame instruction B to SurfaceFlinger. After obtaining rendering instruction B, the GPU can render screen frame B and store the rendered screen frame B in the buffer of screen frame B indicated by rendering instruction B. SurfaceFlinger can obtain the buffer of screen frame B by sending frame instruction B, and after detecting that the buffer of screen frame B is filled with the rendered screen frame B, it can wait until VSYNC2 arrives, take out screen frame B from the buffer of screen frame B for layer synthesis, and send it to the display screen for refresh display.

[0096] Between vertical synchronization signal 2 (VSYNC2) and vertical synchronization signal 3 (VSYNC3), the application can send rendering instruction C to the GPU and send frame instruction C to SurfaceFlinger. After obtaining rendering instruction C, the GPU can render screen frame C and store the rendered screen frame C in the buffer of screen frame C indicated by rendering instruction C. SurfaceFlinger can obtain the buffer of screen frame C by sending frame instruction C, and after detecting that the buffer of screen frame C is filled with the rendered screen frame C, when VSYNC3 arrives, it takes out the screen frame C from the buffer of screen frame C for layer synthesis and sends it to the display screen for refresh display.

[0097] Between vertical synchronization signal 3 (VSYNC3) and vertical synchronization signal 4 (VSYNC4), the application can send rendering instruction D to the GPU and frame instruction D to SurfaceFlinger. After obtaining rendering instruction D, the GPU can render screen frame D and store the rendered screen frame D in the buffer of screen frame D indicated by rendering instruction D. After SurfaceFlinger obtains the buffer of screen frame D by sending frame instruction D and fills the rendered screen frame D in the buffer of screen frame D after detecting it, it can wait until VSYNC4 arrives, take out screen frame D from the buffer of screen frame D for layer synthesis, and send it to the display screen for refresh display.

[0098] Figure 3 A timing diagram of a picture frame from rendering to display under frame rate control provided in an embodiment of the present application is shown.

[0099] like Figure 3 As shown, in order to reduce the power consumption of the electronic device, the frame rate of the rendered picture frame can be controlled to reduce the frame rate of the rendered picture frame. The frame rate control method can be as follows: when the frame rate of the picture frame needs to be reduced, the data processing time of the picture frame can be increased to delay the sending of the rendering instruction to the GPU. In this way, the frame rate of the picture frame can be controlled.

[0100] However, since the application delays sending rendering instructions to the GPU, the GPU may render a certain frame late, and the time when the application provides the frame buffer to SurfaceFlinger through the frame sending instruction is later than the arrival time of the vertical synchronization signal. In this way, SurfaceFlinger will not be able to obtain the frame for synthesis when the vertical synchronization signal arrives, resulting in the frame being stuck on the display.

[0101] For example, between vertical synchronization signal 0 (VSYNC0) and vertical synchronization signal 1 (VSYNC1), the application can perform frame rate control and delay sending rendering instruction A to the GPU. After the GPU obtains rendering instruction A, it can render screen frame A. After the GPU renders screen frame A, the application can give the buffer of screen frame A to SurfaceFlinger. After SurfaceFlinger obtains the buffer of screen frame A, it can wait until VSYNC1 arrives, take out screen frame A from the buffer of screen frame A, perform layer synthesis, and send it to the display screen for refresh display.

[0102] Between vertical synchronization signal 1 (VSYNC1) and vertical synchronization signal 2 (VSYNC2), the application can perform frame rate control and delay sending rendering instruction B to the GPU. After obtaining rendering instruction B, the GPU can render screen frame B. However, when VSYNC2 arrives, the GPU has not yet finished rendering screen frame B. After VSYNC2 arrives, the application sends instruction B to send the buffer of screen frame B to SurfaceFlinger. When VSYNC2 arrives, SurfaceFlinger does not obtain the screen frame for layer synthesis and cannot send the latest screen frame to the display. Therefore, if the display does not obtain the new screen frame, it will display screen frame A for two consecutive refresh cycles, resulting in a stuck display frame.

[0103] Between vertical synchronization signal 2 (VSYNC2) and vertical synchronization signal 3 (VSYNC3), the application sends the buffer of frame B to SurfaceFlinger through the frame sending instruction B. After the application sends the buffer of frame B to SurfaceFlinger through the frame sending instruction B, the application can control the frame rate and delay sending rendering instruction C to the GPU. After obtaining rendering instruction C, the GPU can render frame C. After obtaining the buffer of frame B, SurfaceFlinger can wait until VSYNC3 arrives, take out frame B from the buffer of frame B, perform layer synthesis, and send it to the display screen for refresh display.

[0104] The GPU renders frame C between vertical synchronization signal 3 (VSYNC3) and vertical synchronization signal 4 (VSYNC4). After the GPU renders frame C, the application sends the buffer of frame C to SurfaceFlinger by sending instruction C. After SurfaceFlinger obtains the buffer of frame C, it can wait until VSYNC4 arrives, take out frame C from the buffer of frame C, perform layer synthesis, and send it to the display screen for refresh display.

[0105] Through the above frame control method, the frame control time is longer than the original rendering cycle, that is, the rendering frame rate after frame control is lower than the original frame rate, which reduces the GPU's rendering frame rate for the picture frames and reduces the number of GPU renderings within a certain period of time to reduce the power consumption of the electronic device. However, it will also cause picture frame jams.

[0106] The embodiment of the present application provides a frame rate control method, and an electronic device can control the frame rate of the picture frame of an application (for example, a game application) to be slightly lower than the original frame rate specified by the application (for example, controlled from the original 60Hz to 58Hz), so that the load of rendering and frame sending becomes lighter, thereby reducing the use of system resources on the electronic device and reducing the power consumption of the electronic device. Optionally, the electronic device can predict the frame loss timing of the picture frame in advance during the process of controlling the frame rate of the picture frame of the application (for example, a game application). Before the frame loss timing of the picture frame arrives, a predicted picture frame is generated using multiple previously rendered picture frames through an active interpolation method with a lighter load than the process of generating picture frames by the application, and inserted into the queue of the picture frames. In this way, the display frame rate of the picture on the display screen can also reach the original frame rate, which ensures the application performance while reducing the load and power consumption of the electronic device.

[0107] Figure 4 A schematic diagram of a frame rate control method in an embodiment of the present application is shown.

[0108] like Figure 4 As shown, the electronic device can obtain the rendering instructions and frame sending instructions issued by the application through the stable frame service module, and delay the frame sending instructions issued by the application to SurfaceFlinger for a certain period of time. In this way, the frame rate of the rendered screen frame can be controlled to reduce the GPU's rendering frame rate of the screen frame. Since the stable frame service module delays the application's frame sending instructions to SurfaceFlinger, it will appear that the GPU will render a certain screen frame later, so that within a certain vsync signal cycle, SurfaceFlinger cannot obtain the screen frame synthesis layer, and SurfaceFlinger loses the screen frame (abbreviated as frame loss). The electronic device can also predict the timing of frame loss during the frame rate control process, and before the frame loss timing arrives, generate a predicted screen frame based on the historically rendered screen frame, and send the predicted screen frame to SurfaceFlinger before the vsync signal arrives. In this way, the display frame rate of the screen on the display can also reach the original frame rate, which ensures the application performance while reducing the load and power consumption of the electronic device.

[0109] Exemplarily, between vertical synchronization signal 0 (VSYNC0) and vertical synchronization signal 1 (VSYNC1), the application can sequentially send rendering instruction A and frame sending instruction A of screen frame A to the stable frame service module, and the stable frame service module can send rendering instruction A to the GPU. Since the stable frame service module controls the frame rate of the rendered screen frame, the stable frame service module can delay sending frame instruction A to SurfaceFlinger. After obtaining rendering instruction A, the GPU can render screen frame A, and after rendering screen frame A, store screen frame A in the buffer of screen frame A. After obtaining frame sending instruction A, SurfaceFlinger can obtain the buffer of screen frame A. After SurfaceFlinger detects that the buffer of screen frame A is filled with the rendered screen frame A, SurfaceFlinger can wait until VSYNC1 arrives, take out screen frame A from the buffer of screen frame A for layer synthesis, and send it to the display screen for refresh display.

[0110] Between vertical synchronization signal 1 (VSYNC1) and vertical synchronization signal 2 (VSYNC2), the application can send rendering instruction B and frame sending instruction B of screen frame B to the stable frame service module, and the stable frame service module can send rendering instruction B to the GPU. Since the stable frame service module can control the frame rate of the rendered screen frame, the stable frame service module can delay sending frame instruction B to SurfaceFlinger. After obtaining rendering instruction B, the GPU can render screen frame B and store screen frame B in the buffer of screen frame B after rendering screen frame B. The stable frame service module can recognize that SurfaceFlinger cannot obtain screen frame B between vertical synchronization signal 1 (VSYNC1) and vertical synchronization signal 2 (VSYNC2). Therefore, the stable frame service module can generate screen frame 1 and store screen frame 1 in the buffer of screen frame 1 and send it to SurfaceFlinger. Although SurfaceFlinger cannot obtain screen frame B when VSYNC2 arrives. However, before VSYNC2 arrives, the stable frame service module has already given the picture frame 1 to SurfaceFlinger. Therefore, when VSYNC2 arrives, SurfaceFlinger can take out the picture frame 1 for layer synthesis and send it for display.

[0111] Between vertical synchronization signal 2 (VSYNC2) and vertical synchronization signal 3 (VSYNC3), the frame stabilization service module sends frame instruction B to SurfaceFlinger. After SurfaceFlinger obtains the buffer of frame B, it can wait until VSYNC3 arrives, take out frame B from the buffer of frame B, perform layer synthesis, and send it to the display screen for refresh display.

[0112] The application can send rendering instruction C of frame C to the frame stabilization service module, and the frame stabilization service module can send rendering instruction C to the GPU. After obtaining rendering instruction C, the GPU can render frame C and store frame C in the buffer of frame C after rendering.

[0113] Between vertical synchronization signal 3 (VSYNC3) and vertical synchronization signal 4 (VSYNC4), the application can send frame instruction C of screen frame C to the stable frame service module. Since the stable frame service module controls the frame rate of the rendered screen frame, the stable frame service module can delay sending frame instruction C to SurfaceFlinger. After obtaining the frame instruction C, SurfaceFlinger can obtain the buffer of screen frame C. After SurfaceFlinger detects that the buffer of screen frame C is filled with the rendered screen frame C, it can wait until VSYNC4 arrives, take out the screen frame C from the buffer of screen frame C for layer synthesis, and send it to the display screen for refresh display.

[0114] Through the frame rate control method provided in the embodiment of the present application, the total power consumption Power (FPS) of the picture frame generated after the frame rate control can be achieved. real-limit ) and the power consumption of the compensation frame generation (FPS ligntload ), the total power consumption of the frame below the original frame rate (FPS real-max ), that is, Power(FPS real-limit )+Power(FPS ligntload ) <Power(FPS real-max ).

[0115] The following introduces a software system architecture of an electronic device provided in an embodiment of the present application.

[0116] Figure 5 A schematic diagram of a software system architecture of an electronic device provided in an embodiment of the present application is shown.

[0117] like Figure 5 As shown, the software system architecture of the electronic device 100 may include an application (APP) layer, an application framework (FWK) layer, a native service (native) layer, and a kernel (kernel) layer.

[0118] The application layer includes one or more applications, such as game applications, video applications, etc. The application can be used to provide the picture content of the picture frame, and call the graphics interface to configure the GPU to render the picture frame based on the picture content of the picture frame through the stable frame service module.

[0119] The application framework layer may include a layer synthesizer (SurfaceFlinger) and a frame stabilization service module. SurfaceFlinger is used to perform layer synthesis processing on the screen frames rendered by the GPU, generate an interface including the screen frames, and send the interface including the screen frames to the display screen for display. The frame stabilization service module can be used to control the frame rate of the screen frames rendered by the application calling the GPU, and pre-identify the opportunity for frame loss, and generate a predicted screen frame before the frame loss opportunity and give it to SurfaceFlinger, so as to avoid frame jams when the screen displays the screen frames.

[0120] The local service layer may include one or more graphics interfaces. The one or more graphics interfaces may include one or more of an open graphics library (OpenGL), an open graphics library for embedded systems (OpenGL ES), and a graphics application programming interface (Vulkan). The graphics interface may be used to configure a GPU to render a picture frame.

[0121] The kernel layer may include graphics processing unit driver (GPUDriver), etc. Among them, GPU Driver is used to drive GPU to perform upper layer operations (for example, operations of rendering picture frames configured by a graphics interface).

[0122] Taking a game application as an example, the following describes in detail the interaction process of each module in the above software system architecture.

[0123] Fig. 6A A schematic diagram of the software system architecture interaction process of an electronic device provided in an embodiment of the present application is shown.

[0124] like Fig. 6A As shown, the software system architecture interaction process is specifically described by taking a game application as an example. Among them, the game application may include a main thread (Main Thread) and a rendering thread (Render Thread). The stable frame service module may include a frame rate control module, a frame loss prediction module, a frame supplement control module and a stable frame cache module. The layer synthesizer (SurfaceFlinger) may include a SurfaceFlinger information acquisition module.

[0125] The interaction process of each module can be as follows:

[0126] 1. The main thread of the game application can synchronize the game screen content to the rendering thread.

[0127] 2. After the rendering thread obtains the game screen content, it can send rendering instructions to the graphics interface.

[0128] The graphics interface may include any one of OpenGL, OpenGL ES, and Vulkan.

[0129] 3. The graphics interface can forward rendering instructions to the frame rate control module.

[0130] 4. After obtaining the rendering instruction, the frame rate control module can send the rendering instruction to the GPU driver.

[0131] After receiving the rendering instructions, the GPU driver gives the rendering instructions to the GPU to configure the GPU to render the screen frames based on the game screen content, and stores the rendered screen frames into the buffer specified by the rendering instructions.

[0132] After rendering the picture frame, the GPU can store the picture frame in the buffer specified by the rendering instruction.

[0133] 5. After issuing rendering instructions, the rendering thread can send frame instructions to the graphics interface.

[0134] 6. The graphics interface can forward frame instructions to the frame rate control module.

[0135] 7. The frame rate control module can choose to delay or immediately send frame instructions to SurfaceFlinger.

[0136] After obtaining the frame sending instruction, the frame rate control module can determine whether it is necessary to delay sending the frame instruction and the delay time when it is necessary to delay sending the frame instruction based on the control frame rate.

[0137] After SurfaceFlinger obtains the frame sending instruction, it can obtain the buffer address of the picture frame from the frame sending instruction. When the picture frame rendered by the GPU is stored in the buffer, SurfaceFlinger can know in time that the picture frame has been stored in the buffer through the fence mechanism. Therefore, when the next vsync signal arrives, SurfaceFlinger can take the picture frame from the picture frame buffer for layer synthesis to synthesize the interface including the picture frame, and send the interface including the picture frame to the display screen for display.

[0138] After obtaining the frame sending instruction of the current frame, the frame rate control module can determine the rendering time of the current frame according to the time difference between the frame sending instruction of the previous frame and the frame sending instruction of the current frame. The frame rate control module can also determine whether to delay forwarding the frame sending instruction of the current frame to SurfaceFlinger based on the rendering time of the current frame.

[0139] The frame rate control module can also record the frame sending time of the current picture frame and determine the fastest frame sending time of the next picture frame.

[0140] 8. The frame rate control module can send the frame sending time of the current picture frame and the fastest frame sending time of the next picture frame to the frame loss prediction module.

[0141] 9. After obtaining the buffer of the picture frame, SurfaceFlinger can send the buffer information of the picture frame and the timestamp of the vsync signal to the stable frame cache module for storage.

[0142] The buffer information of the picture frame may include the buffer address of the picture frame, the buffer accumulation number of the picture frame, and the like.

[0143] 10. The stable frame buffer module can provide the timestamp of the vsync signal and the buffer accumulation number of the picture frame to the frame loss prediction module.

[0144] The frame loss prediction module can determine the period of the vsync signal. The frame loss prediction module can predict whether there is a frame loss in the next frame based on the timestamp of the latest vsync signal, the buffer accumulation number of the frame, the fastest frame sending time of the next frame, and the vsync period.

[0145] 11. When the frame loss prediction module determines that there is frame loss in the next picture frame, it can send a frame insertion instruction to the frame insertion control module.

[0146] 12. The frame supplement control module can obtain historical picture frames from the stable frame buffer module.

[0147] After acquiring the historical picture frames, the frame interpolation control module can determine the timing of frame interpolation, and when the timing of frame interpolation arrives, generate a predicted picture frame based on the historical picture frames, and store the predicted picture frame in a buffer of the predicted picture frames.

[0148] 13. The frame interpolation control module can give the buffer of the predicted picture frame to SurfaceFlinger.

[0149] After SurfaceFlinger obtains the buffer of the predicted picture frame, it can wait until the next vsync signal arrives, take out the predicted picture frame from the buffer of the predicted picture frame for layer synthesis, so as to synthesize the interface including the predicted picture frame, and send the interface including the predicted picture frame to the display screen for display.

[0150] Among them, the vertical synchronization signal thread (Vsync Thread) can periodically send a vsync signal to SurfaceFlinger.

[0151] In an embodiment of the present application, the frame stabilization service module can control the frame rate of any application when rendering a screen frame and perform frame interpolation at an appropriate time.

[0152] In a possible implementation, the frame stabilization service module may also control the frame rate of the rendered picture frame and perform interpolation at an appropriate interpolation time when it is recognized that a game application calls the GPU to render a picture frame, and / or the frame rate of the picture frame set by the application is greater than or equal to the preset frame rate, and / or the temperature of the electronic device is higher than a specified temperature threshold, and / or the power of the electronic device is lower than a specified power, and / or the CPU occupancy rate of the electronic device is greater than a specified occupancy rate. The preset frame rate may be the maximum picture refresh rate (i.e., full frame rate) that the application can support, and the full frame rate may be equal to the refresh rate of the display screen of the electronic device.

[0153] Through the above Fig. 6A In the software system architecture interaction process shown, the frame stabilization service module can control the rendering frame rate of the application without the application being aware of it, thereby reducing the power consumption of the electronic device.

[0154] Figure 6B A schematic diagram of the software system architecture interaction flow of an electronic device provided in another embodiment of the present application is shown.

[0155] like Figure 6B As shown, the software system architecture interaction process is specifically described by taking a game application as an example. Among them, the game application may include a main thread (Main Thread) and a rendering thread (Render Thread). The stable frame service module may include a frame rate control module, a frame loss prediction module, a frame supplement control module and a stable frame cache module. The layer synthesizer (SurfaceFlinger) may include a SurfaceFlinger information acquisition module.

[0156] The interaction process of each module can be as follows:

[0157] 1. The main thread of the game application can synchronize the game screen content to the rendering thread.

[0158] 2. After the rendering thread obtains the game screen content, it can send rendering instructions to the frame rate control module.

[0159] 3. After obtaining the rendering instruction issued by the rendering thread, the frame rate control module can forward the rendering instruction to the graphics interface.

[0160] The graphics interface may include any one of OpenGL, OpenGL ES, and Vulkan.

[0161] 4. The graphics interface can forward rendering instructions to the GPU driver.

[0162] After receiving the rendering instructions, the GPU driver gives the rendering instructions to the GPU to configure the GPU to render the screen frames based on the game screen content, and stores the rendered screen frames into the buffer specified by the rendering instructions.

[0163] 5. After issuing the rendering instruction, the rendering thread can send a frame instruction to the frame rate control module.

[0164] 6. The frame rate control module can choose to delay or immediately send frame instructions to SurfaceFlinger.

[0165] After SurfaceFlinger obtains the frame sending instruction, it can obtain the buffer address of the picture frame from the frame sending instruction. When the picture frame rendered by the GPU is stored in the buffer, SurfaceFlinger can know in time that the picture frame has been stored in the buffer through the fence mechanism. Therefore, when the next vsync signal arrives, SurfaceFlinger can take the picture frame from the picture frame buffer for layer synthesis to synthesize the interface including the picture frame, and send the interface including the picture frame to the display screen for display.

[0166] After obtaining the frame sending instruction of the current frame, the frame rate control module can determine the rendering time of the current frame according to the time difference between the frame sending instruction of the previous frame and the frame sending instruction of the current frame. The frame rate control module can also determine whether to delay forwarding the frame sending instruction of the current frame to SurfaceFlinger based on the rendering time of the current frame.

[0167] The frame rate control module can also record the frame sending time of the current picture frame and determine the fastest frame sending time of the next picture frame.

[0168] 7. The frame rate control module can send the frame sending time of the current picture frame and the fastest frame sending time of the next picture frame to the frame loss prediction module.

[0169] 8. After obtaining the buffer of the picture frame, SurfaceFlinger can send the buffer information of the picture frame and the timestamp of the vsync signal to the stable frame cache module for storage.

[0170] The buffer information of the picture frame may include the buffer address of the picture frame, the buffer accumulation number of the picture frame, and the like.

[0171] 9. The stable frame buffer module can provide the timestamp of the vsync signal and the buffer accumulation number of the picture frame to the frame loss prediction module.

[0172] The frame loss prediction module can determine the period of the vsync signal. The frame loss prediction module can predict whether there is a frame loss in the next frame based on the timestamp of the latest vsync signal, the buffer accumulation number of the frame, the fastest frame sending time of the next frame, and the vsync period.

[0173] 10. When the frame loss prediction module determines that there is a frame loss in the next picture frame, the frame replacement instruction is sent to the frame replacement control module.

[0174] 11. The frame supplement control module can obtain historical picture frames from the stable frame buffer module.

[0175] After acquiring the historical picture frames, the frame interpolation control module can determine the timing of frame interpolation, and when the timing of frame interpolation arrives, generate a predicted picture frame based on the historical picture frames, and store the predicted picture frame in a buffer of the predicted picture frames.

[0176] 12. The frame interpolation control module can give the buffer of the predicted picture frame to SurfaceFlinger.

[0177] After SurfaceFlinger obtains the buffer of the predicted picture frame, it can wait until the next vsync signal arrives, take out the predicted picture frame from the buffer of the predicted picture frame for layer synthesis, so as to synthesize the interface including the predicted picture frame, and send the interface including the predicted picture frame to the display screen for display.

[0178] Among them, the vertical synchronization signal thread (Vsync Thread) can periodically send a vsync signal to SurfaceFlinger.

[0179] In an embodiment of the present application, the frame stabilization service module can control the frame rate of any application when rendering a screen frame and perform frame interpolation at an appropriate time.

[0180] In a possible implementation, the frame stabilization service module may also control the frame rate of the rendered picture frame and perform interpolation at an appropriate interpolation time when it is recognized that a game application calls the GPU to render a picture frame, and / or the frame rate of the picture frame set by the application is greater than or equal to the preset frame rate, and / or the temperature of the electronic device is higher than a specified temperature threshold, and / or the power of the electronic device is lower than a specified power, and / or the CPU occupancy rate of the electronic device is greater than a specified occupancy rate. The preset frame rate may be the maximum picture refresh rate (i.e., full frame rate) that the application can support, and the full frame rate may be equal to the refresh rate of the display screen of the electronic device.

[0181] The following describes the frame control process of the frame rate control module provided in the embodiment of the present application.

[0182] Figure 7 A schematic diagram of the frame control process provided in an embodiment of the present application is shown.

[0183] like Figure 7 As shown, the control process may include the following steps:

[0184] S701. A frame rate control module may obtain a rendering instruction issued by an application to render a current picture frame.

[0185] S702: The frame rate control module may forward the rendering instruction to the GPU, and configure the GPU to render the current picture frame.

[0186] Among them, the frame rate control module can be Fig. 6A In the manner shown, a rendering instruction for rendering the current picture frame is obtained from the graphics interface, and the frame rate control module can send the rendering instruction for the current picture frame to the GPU through the GPU driver.

[0187] The frame rate control module can also be Figure 6B In the manner shown, a rendering instruction for rendering the current picture frame is directly obtained from the application, and the frame rate control module can send the rendering instruction for the current picture frame to the GPU through the graphics interface and the GPU driver in sequence.

[0188] The graphics interface may include any one of OpenGL, OpenGL ES, and Vulkan.

[0189] S703: The frame rate control module may obtain a frame sending instruction for the current picture frame.

[0190] Among them, the frame rate control module can be Fig. 6A In the manner shown, a frame sending instruction of the current picture frame is obtained from the graphics interface, and the frame rate control module then delays or immediately gives the frame sending instruction of the current picture frame to SurfaceFlinger.

[0191] The frame rate control module can also be Figure 6B In the manner shown, the frame sending instruction for rendering the current screen frame is directly obtained from the application, and the frame rate control module then delays or immediately sends the frame sending instruction of the current screen frame to SurfaceFlinger.

[0192] S704: The frame rate control module calculates the rendering time T of the current picture frame.

[0193] The frame rate control module can determine the rendering time T of the current frame according to the timestamp of the frame sending instruction of the previous frame and the timestamp of the frame sending instruction of the current frame. The rendering time T of the current frame can be the difference between the timestamp of the frame sending instruction of the current frame obtained by the frame rate control module and the timestamp of the frame sending instruction of the previous frame obtained by the frame rate control module. For example, the timestamp of the frame sending instruction of the previous frame can be Ma, and the timestamp of the frame sending instruction of the current frame can be Mb. Therefore, the rendering time T of the current frame = Mb-Ma.

[0194] S705: The frame rate control module determines whether the rendering time T of the current picture frame is less than the fastest frame sending time of the current picture frame.

[0195] The fastest frame sending time of the current frame can be used to indicate the minimum time interval between the frame sending instruction of the current frame and the frame sending instruction of the previous frame when the frame rate of the GPU rendering frame is reduced to the control frame rate.

[0196] Among them, if the previous picture frame is the first picture frame of the application, the frame rate control module immediately forwards the frame sending instruction of the previous picture frame. The frame rate control module can determine the fastest frame sending time TN of the next picture frame as the control frame period T1 based on the control frame rate F1. Among them, the control frame period T1 is the reciprocal of the control frame rate F1, that is, T1=1 / F1. F1 is less than the full frame rate F0. Among them, the full frame rate F0 can be equal to the refresh rate of the display screen. For example, the full frame rate F0 is 60 frames / second, and the control frame rate F1 can be 58 frames / second.

[0197] If the previous frame is not the first frame of the application, the frame rate control module can determine the fastest frame sending time TN' of the current frame according to the frame control period T1, the rendering time T0 of the previous frame, and the fastest frame sending time TN0 of the previous frame.

[0198] When T0 is less than T1, and TN0 is less than T1, TN' may be MIN(T1, TN0+(T1-T0)), that is, the value of TN' is the minimum value of T1 and (TN0+(T1-T0)).

[0199] When T0 is less than T1 and TN' is not less than T1, the value of TN can remain unchanged and continue to be TN0.

[0200] When T0 is not less than T1, TN' may be MAX(0, TN0-(T0-TN0)), that is, the value of TN' is the maximum value between 0 and (TN0-(T0-TN0)).

[0201] If the rendering time T of the current screen frame is less than the fastest frame sending time of the current screen frame, it means that the frame rate of the frame rendered by the game application instructs the GPU to be greater than the frame control rate, the GPU load is too high, and the frame rate of the frame rendered by the GPU needs to be reduced. Therefore, if the rendering time T of the current screen frame is less than the fastest frame sending time of the current screen frame, steps S706 and S707 can be executed.

[0202] If the rendering time T of the current frame is not less than the fastest frame sending time of the current frame, it means that the frame rate of the frame rendered by the game application instructing the GPU is not greater than the frame control rate, the GPU load is not high, and there is no need to reduce the frame rate of the GPU rendering frame. Then directly execute step S707.

[0203] S706: The frame rate control module delays forwarding the frame sending instruction of the current screen frame to SurfaceFlinger.

[0204] When the frame rate control module determines that the frame rate of the GPU rendering screen frame needs to be reduced, the frame sending instruction of the current screen frame can be delayed to be forwarded to SurfaceFlinger. The delay time can be the difference between the fastest frame sending time of the current screen frame and the rendering time T of the current screen frame.

[0205] Specifically, after obtaining the frame sending instruction of the current screen frame, the frame rate control module can sleep for a certain period of time and then wake up automatically. Since the application can render the next screen frame only after the frame sending instruction is sent to SurfaceFlinger, and the frame rate control module delays issuing the frame sending instruction of the current screen frame, the interval between the application rendering screen frames is increased. In other words, the interval between the GPU rendering two adjacent screen frames is reduced. In this way, the number of rendering times of the GPU within a certain period of time is reduced, thereby achieving the purpose of reducing the load of the GPU and reducing the power consumption of electronic devices.

[0206] S707: Determine the fastest frame sending time for the next picture frame.

[0207] Among them, if the current picture frame is the first picture frame of the application, the frame sending instruction of the current picture frame is forwarded immediately. The frame rate control module can determine the fastest frame sending time TN of the next picture frame as the control frame period T1 based on the control frame rate F1. Among them, the control frame period T1 is the reciprocal of the control frame rate F1, that is, T1=1 / F1. F1 is less than the full frame rate F0. Among them, the full frame rate F0 can be equal to the refresh rate of the display screen. For example, the full frame rate F0 is 60 frames / second, and the control frame rate F1 can be 58 frames / second.

[0208] If the current frame is not the first frame of the application, the frame rate control module can determine the fastest frame sending time TN for the next frame according to the frame control period T1, the rendering time T of the current frame, and the fastest frame sending time TN' of the current frame.

[0209] Specifically, the strategy for determining the fastest frame sending time TN for the next picture frame can be shown in the following Table 1:

[0210] Table 1

[0211] Is T less than T1? Is TN' less than T1? The value of TN yes yes MIN(T1, TN'+(T1-T)) yes no Unchanged, TN' no \ MAX(0,TN'-(T-TN'))

[0212] It can be seen from Table 1 above that when T is less than T1 and TN' is less than T1, TN can be MIN(T1, TN'+(T1-T)), that is, the value of TN is the minimum value of T1 and (TN'+(T1-T)).

[0213] When T is less than T1 and TN' is not less than T1, the value of TN can remain unchanged and continue to be TN'.

[0214] When T is not less than T1, TN may be MAX(0, TN'-(T-TN')), that is, the value of TN is the maximum value between 0 and (TN'-(T-TN')).

[0215] After the frame rate control module readjusts the fastest frame sending time TN of the next picture frame, the frame rate control module may continue to wait for the rendering instruction of the next picture frame and re-execute the above steps S701 to S705.

[0216] Combine the following Figure 8 The frame rate control timing diagram shown as an example specifically introduces the frame control process of the frame rate control module.

[0217] like Figure 8 As shown, SurfaceFlinger can periodically receive vertical synchronization signal 0 (VSYNC0), vertical synchronization signal 1 (VSYNC1), vertical synchronization signal 2 (VSYNC2), vertical synchronization signal 3 (VSYNC3), vertical synchronization signal 4 (VSYNC4), and vertical synchronization signal 5 (VSYNC5) in sequence.

[0218] 1. The game application can send rendering instruction A and frame sending instruction A of frame A in sequence between the timestamp of VSYNC0 and the timestamp of VSYNC1. After obtaining rendering instruction A of frame A, the frame rate control module can send rendering instruction A to the GPU. After obtaining rendering instruction A, the GPU can render frame A and store frame A in the buffer of frame A after rendering.

[0219] When the frame rate control module detects the frame sending instruction A, it can determine the rendering time Ta of the picture frame A according to the time difference between obtaining the frame sending instruction of the previous picture frame and obtaining the frame sending instruction A. The frame rate control module can determine the fastest frame sending time TNb of the picture frame B. Picture frame B is the next frame of picture frame A. Among them, when Ta is less than T1, and TNa is less than T1, TNb can be MIN(T1, TNa+(T1-Ta)). That is, the value of TNb is the minimum value between T1 and (TNa+(T1-Ta)). When Ta is less than T1, and TNa is not less than T1, TNb can be TNa. When Ta is not less than T1, TNb can be the maximum value between 0 and (TNa-(Ta-TNa)).

[0220] Since the rendering time Ta of picture frame A is less than the fastest frame sending time TNa of picture frame A, the frame control condition is met. After obtaining the frame sending instruction A of picture frame A, the frame rate control module can send the frame instruction A to SurfaceFlinger with a delay of (TNa-Ta). Among them, the frame sending time of picture frame A can be Mqa. Among them, the fastest frame sending time TNa of picture frame A is confirmed when the frame sending instruction of the previous picture frame of picture frame A is obtained. If the previous picture frame of picture frame A is the first frame, TNa is the frame control period T1.

[0221] After SurfaceFlinger obtains the buffer of frame A through the frame sending instruction A, it can take out frame A from the buffer of frame A for layer synthesis when waiting for VSYNC1 to arrive, so as to send frame A to the display screen for display.

[0222] 2. The game application can send a rendering instruction B for frame B to the frame rate control module between the timestamp of VSYNC1 and the timestamp of VSYNC2. When VSYNC2 arrives, the game application does not send a frame sending instruction B for frame B.

[0223] Since SurfaceFlinger does not obtain the frame sending instruction B of frame B when VSYNC2 arrives, SurfaceFlinger cannot obtain the buffer of frame B when VSYNC2 arrives, resulting in frame loss. The display will display frame A for two consecutive refresh cycles.

[0224] 3. Between the timestamp of VSYNC2 and the timestamp of VSYNC3, the game application sends frame instruction B to the frame rate control module.

[0225] When the frame rate control module detects the frame sending instruction B, it can determine the rendering time Tb of the picture frame B according to the time difference between obtaining the frame sending instruction A and obtaining the frame sending instruction B. The frame rate control module can determine the fastest frame sending time TNc of the picture frame C. Picture frame C is the next frame of picture frame B. When Tb is less than T1, and TNb is less than T1, TNc can be MIN(T1, TNb+(T1-Tb)). That is, the value of TNc is the minimum value between T1 and (TNb+(T1-Tb)). When Tb is less than T1, and TNb is not less than T1, TNc can be TNb. When Tb is not less than T1, TNc can be the maximum value between 0 and (TNb-(Tb-TNb)).

[0226] Since the rendering time Tb of the picture frame B is less than TNb, the frame control condition is met, and the frame rate control module can send the frame instruction B to SurfaceFlinger after obtaining the frame sending instruction B of the picture frame B, and delay (TNb-Tb). The frame sending time of the picture frame B can be Mqb.

[0227] After SurfaceFlinger obtains the buffer of frame B through the frame sending instruction B, it can take out frame B from the buffer of frame B for layer synthesis when waiting for VSYNC3 to arrive, so as to send frame B to the display screen for display.

[0228] After sending frame instruction B, the game application can send rendering instruction C for frame C to the frame rate control module. After obtaining rendering instruction C for frame C, the frame rate control module can send rendering instruction C to the GPU. After obtaining rendering instruction C, the GPU can render frame C and store frame C in the buffer of frame C after rendering.

[0229] 4. Between the timestamp of VSYNC3 and the timestamp of VSYNC4, the game application sends the frame instruction C to the frame rate control module.

[0230] When the frame rate control module detects the frame sending instruction C, it can determine the rendering time Tc of the picture frame C according to the time difference between obtaining the frame sending instruction B and obtaining the frame sending instruction C. The frame rate control module can determine the fastest frame sending time TNd of the picture frame D. Picture frame D is the next frame of picture frame C. Among them, when Tc is less than T1, and TNc is less than T1, TNd can be MIN(T1, TNc+(T1-Tc)). That is, the value of TNd is the minimum value between T1 and (TNc+(T1-Tc)). When Tc is less than T1, and TNc is not less than T1, TNd can be TNc. When Tc is not less than T1, TNd can be the maximum value between 0 and (TNc-(Tc-TNc)).

[0231] Since the rendering time Tc of the picture frame C is greater than or equal to TNc, the frame control condition is not met. After obtaining the frame sending instruction C of the picture frame C, the frame rate control module immediately sends the frame instruction C to SurfaceFlinger.

[0232] After SurfaceFlinger obtains the buffer of frame C through the frame sending instruction C, it can take out frame C from the buffer of frame C for layer synthesis when waiting for VSYNC4 to arrive, so as to send frame C to the display screen for display.

[0233] 5. Between the timestamp of VSYNC4 and the timestamp of VSYNC5, the game application can send the rendering instruction D of the screen frame D to the frame rate control module. After obtaining the rendering instruction D of the screen frame D, the frame rate control module can send the rendering instruction D to the GPU. After obtaining the rendering instruction D, the GPU can render the screen frame D and store the screen frame D in the buffer of the screen frame D after rendering the screen frame D.

[0234] Between the timestamp of VSYNC4 and the timestamp of VSYNC5, the game application can send a frame instruction D to the frame rate control module. When the frame rate control module obtains the frame instruction D, it can determine the rendering time Td of the picture frame D based on the time difference between obtaining the frame instruction C and obtaining the frame instruction D. The frame rate control module can determine the rendering time Td of the picture frame E( Figure 8 The fastest frame transmission time TNe (not shown in the figure). Picture frame E is the next picture frame of picture frame D. Among them, when Td is less than T1, and TNd is less than T1, TNe can be MIN(T1, TNd+(T1-Td)). That is, the value of TNe is the minimum value between T1 and (TNd+(T1-Td)). When Td is less than T1, and TNd is not less than T1, TNe can be TNd. When Td is not less than T1, TNe can be the maximum value between 0 and (TNd-(Td-TNd)).

[0235] Since the rendering time Td of the picture frame D is greater than or equal to TNd, the frame control condition is not met. After obtaining the frame sending instruction D of the picture frame D, the frame rate control module immediately sends the frame instruction D to SurfaceFlinger.

[0236] After obtaining the buffer of the screen frame D through the frame sending instruction D, SurfaceFlinger can take out the screen frame D from the buffer of the screen frame D for layer synthesis when waiting for VSYNC5 to arrive, so as to send the screen frame D to the display screen for display.

[0237] Above Figure 8 The examples shown are only used to explain the present application and should not be construed as limiting.

[0238] The following introduces the frame loss prediction process of the above-mentioned frame loss prediction module provided in the embodiments of the present application.

[0239] Fig. 9 A schematic diagram of the frame loss prediction process provided in an embodiment of the present application is shown.

[0240] like Fig. 9 As shown, the frame loss prediction process may include the following steps:

[0241] S901. A frame loss prediction module may receive a first notification from a frame rate control module, where the first notification is used to indicate that a frame sending instruction for a current picture frame has been obtained.

[0242] The frame rate control module may send a first notification to the frame loss prediction module when obtaining a frame sending instruction of the current picture frame.

[0243] S902, the frame loss prediction module can obtain the latest vsync signal timestamp (Mm), the buffer accumulation number of the picture frame (bufferNum) and the fastest frame sending time (TN) of the next picture frame.

[0244] The frame loss prediction module can obtain the latest vsync signal timestamp (Mm) and the buffer accumulation number (bufferNum) of the picture frame from the stable frame buffer module. The frame loss prediction module can obtain the fastest frame transmission time (TN) of the next picture frame from the frame rate control module.

[0245] The process of determining the fastest frame transmission time (TN) for the next frame can refer to the above Figure 7 , Figure 8 The textual part of the illustrated embodiment will not be repeated here.

[0246] S903: The frame loss prediction module may determine whether the buffer accumulation number of the picture frame is greater than 0.

[0247] If the buffer accumulation number of the picture frame is greater than 0, it means that SurfaceFlinger will not drop the frame when the next vsync signal arrives. Therefore, the frame drop prediction module can execute step S904.

[0248] If the buffer accumulation number of the picture frame is 0, it means that SurfaceFlinger may drop a frame when the next vsync signal arrives. Therefore, the frame drop prediction module can execute steps S905 to S908.

[0249] S904: The frame loss prediction module may determine that no frame supplementation is required.

[0250] S905. The frame loss prediction module determines the frame sending time (Mq) and vsync period (Pv) of the current picture frame.

[0251] The frame rate control module can record the frame sending time (Mq) of the current picture frame when obtaining the frame sending instruction of the current picture frame. The frame loss prediction module can obtain the frame sending time (Mq) of the current picture frame from the frame rate control module.

[0252] The frame loss prediction module may determine the vsync period (Pv) based on the full frame rate F0, that is, Pv=1 / F0.

[0253] In a possible implementation, the frame loss prediction module may also determine the vsync period (Pv) based on the difference between the timestamps of two adjacent vsync signals.

[0254] S906: The frame loss prediction module may determine the fastest frame sending time (Mn) for the next picture frame based on the frame sending time (Mq) of the current picture frame and the fastest frame sending time (TN) for the next picture frame.

[0255] Among them, Mn=Mq+TN.

[0256] S907: The frame loss prediction module may determine the vsync signal timestamp (Mv) of the next picture frame to be displayed based on the latest vsync signal timestamp (Mm) and the vsync period (Pv).

[0257] Among them, Mv=Mm+2*Pv.

[0258] S908: The frame loss prediction module may determine whether the fastest frame sending time (Mn) of the next picture frame is later than the vsync signal timestamp (Mv) of sending and displaying the next picture frame.

[0259] If the fastest frame sending time (Mn) of the next picture frame is later than the vsync signal timestamp (Mv) of the next picture frame, it means that SurfaceFlinger will drop a frame when the next vsync signal arrives. Therefore, the frame drop prediction module can execute step S909.

[0260] If the fastest frame sending time (Mn) of the next picture frame is not later than the vsync signal timestamp (Mv) of the next picture frame, it means that SurfaceFlinger will not drop frames when the next vsync signal arrives. Therefore, the frame drop prediction module can execute step S904.

[0261] S909: The frame loss prediction module determines that a frame supplement is required.

[0262] When the frame loss prediction module determines that frame supplementation is required, a frame supplementation instruction may be sent to the frame supplementation control module.

[0263] Combine the following Fig.10 The frame rate control timing diagram shown as an example specifically introduces the process of predicting frame loss by the above-mentioned frame loss prediction module.

[0264] like Fig.10 As shown, SurfaceFlinger can periodically receive vertical synchronization signal 0 (VSYNC0), vertical synchronization signal 1 (VSYNC1), vertical synchronization signal 2 (VSYNC2), vertical synchronization signal 3 (VSYNC3), vertical synchronization signal 4 (VSYNC4), and vertical synchronization signal 5 (VSYNC5) in sequence.

[0265] 1. The game application can send rendering instruction A and frame sending instruction A of frame A in sequence between the timestamp of VSYNC0 and the timestamp of VSYNC1. After obtaining rendering instruction A of frame A, the frame rate control module can send rendering instruction A to the GPU. After obtaining rendering instruction A, the GPU can render frame A and store frame A in the buffer of frame A after rendering.

[0266] When the frame rate control module detects the frame sending instruction A, it can determine the rendering time Ta of the picture frame A according to the time difference between obtaining the frame sending instruction of the previous picture frame and obtaining the frame sending instruction A. The frame rate control module can determine the fastest frame sending time TNb of the picture frame B. Picture frame B is the next frame of picture frame A. Among them, when Ta is less than T1, and TNa is less than T1, TNb can be MIN(T1, TNa+(T1-Ta)). That is, the value of TNb is the minimum value between T1 and (TNa+(T1-Ta)). When Ta is less than T1, and TNa is not less than T1, TNb can be TNa. When Ta is not less than T1, TNb can be the maximum value between 0 and (TNa-(Ta-TNa)).

[0267] Since the rendering time Ta of picture frame A is less than the fastest frame sending time TNa of picture frame A, the frame control condition is met. After obtaining the frame sending instruction A of picture frame A, the frame rate control module can send the frame instruction A to SurfaceFlinger with a delay of (TNa-Ta). Among them, the frame sending time of picture frame A can be Mqa. Among them, the fastest frame sending time TNa of picture frame A is confirmed when the frame sending instruction of the previous picture frame of picture frame A is obtained. If the previous picture frame of picture frame A is the first frame, TNa is the frame control period T1.

[0268] After SurfaceFlinger obtains the buffer of frame A through the frame sending instruction A, it can take out frame A from the buffer of frame A for layer synthesis when waiting for VSYNC1 to arrive, so as to send frame A to the display screen for display.

[0269] When the frame rate control module detects the frame sending instruction A, it can notify the frame loss prediction module to enter the frame loss prediction process.

[0270] The frame loss prediction module can obtain the frame sending time Mqa of the picture frame A and the latest vsync signal timestamp Mm (at this time, the timestamp M0 of VYSNC0) from the frame rate control module. The frame loss prediction module can determine that the vsync signal timestamp Mv of the next picture frame to be sent and displayed is the timestamp M2 of VSYNC2 based on the timestamp M0 of VYSNC0 and the vsync signal period Pv, where M2=M0+2*Pv.

[0271] The frame loss prediction module can determine the fastest frame sending time Mnb of the picture frame B based on the frame sending time Mqa of the picture frame A and the fastest rendering time TNb of the picture frame B. Wherein, Mnb=Mqa+TNb.

[0272] Among them, since the fastest frame sending time Mnb of the picture frame B is later than the timestamp M2 of VSYNC2, the frame loss prediction module determines that a frame needs to be supplemented before the vsync timestamp M2. The frame loss prediction module can send a frame supplement instruction to the frame supplement control module. After obtaining the frame supplement instruction, the frame supplement control module can complete the frame supplement before the timestamp M2 of VSYNC2, and store the generated compensation frame 1 in the buffer of compensation frame 1, and provide it to SurfaceFlingr. After obtaining the buffer of compensation frame 1, SurfaceFlinger can take out compensation frame 1 from the buffer of compensation frame 1 for layer synthesis when receiving VSYNC2, so as to send compensation frame 1 to the display screen for display.

[0273] The frame loss prediction module can also determine the frame interpolation timing of the compensation frame 1, and carry the frame interpolation timing of the compensation frame 1 in the frame interpolation instruction and send it to the frame interpolation control module. The frame interpolation control module can interpolate the frame when the frame interpolation timing arrives. For example, the frame interpolation timing of the compensation frame 1 can be (Mqa+(T1) / 2).

[0274] 2. The game application can send a rendering instruction B for frame B to the frame rate control module between the timestamp of VSYNC1 and the timestamp of VSYNC2. When VSYNC2 arrives, the game application does not send a frame sending instruction B for frame B.

[0275] When VSYNC2 arrives, SurfaceFlinger does not obtain the frame sending instruction B of frame B, but the frame supplement control module has stored the generated frame 1 in the buffer of frame 1 before the timestamp of VSYNC2 arrives and provided it to SurfaceFlinger. When VSYNC2 arrives, SurfaceFlinger can take frame 1 out of the buffer of frame 1 for layer synthesis to send frame 1 to the display screen for display.

[0276] 3. Between the timestamp of VSYNC2 and the timestamp of VSYNC3, the game application sends frame instruction B to the frame rate control module.

[0277] When the frame rate control module detects the frame sending instruction B, it can determine the rendering time Tb of the picture frame B according to the time difference between obtaining the frame sending instruction A and obtaining the frame sending instruction B. The frame rate control module can determine the fastest frame sending time TNc of the picture frame C. When Tb is less than T1, and TNb is less than T1, TNc can be MIN(T1, TNb+(T1-Tb)). That is, the value of TNc is the minimum value between T1 and (TNb+(T1-Tb)). When Tb is less than T1, and TNb is not less than T1, TNc can be TNb. When Tb is not less than T1, TNc can be the maximum value between 0 and (TNb-(Tb-TNb)).

[0278] Since the rendering time Tb of the picture frame B is less than TNb, the frame control condition is met, and the frame rate control module can send the frame instruction B to SurfaceFlinger after obtaining the frame sending instruction B of the picture frame B, and delay (TNb-Tb). The frame sending time of the picture frame B can be Mqb.

[0279] After SurfaceFlinger obtains the buffer of frame B through the frame sending instruction B, it can take out frame B from the buffer of frame B for layer synthesis when waiting for VSYNC3 to arrive, so as to send frame B to the display screen for display.

[0280] After sending frame instruction B, the game application can send rendering instruction C for frame C to the frame rate control module. After obtaining rendering instruction C for frame C, the frame rate control module can send rendering instruction C to the GPU. After obtaining rendering instruction C, the GPU can render frame C and store frame C in the buffer of frame C after rendering.

[0281] When the frame rate control module detects the frame sending instruction B, it can notify the frame loss prediction module to enter the frame loss prediction process.

[0282] The frame loss prediction module can obtain the frame sending time Mqb of the picture frame B and the latest vsync signal timestamp Mm (at this time, the timestamp M3 of VYSNC2) from the frame rate control module. The frame loss prediction module can determine that the vsync signal timestamp Mv of the next picture frame to be sent and displayed is the timestamp M4 of VSYNC4 based on the timestamp M2 of VYSNC2 and the vsync signal period Pv, where M4=M2+2*Pv.

[0283] The frame loss prediction module can determine the fastest frame sending time Mnc of the picture frame C based on the frame sending time Mqb of the picture frame B and the fastest rendering time TNc of the picture frame C. Wherein, Mnc=Mqb+TNc.

[0284] Among them, since the fastest frame sending time Mnc of the picture frame C is earlier than the timestamp M4 of VSYNC4, the frame loss prediction module determines that before the timestamp M4 of VSYNC4, there is no need to supplement the frame.

[0285] 4. Between the timestamp of VSYNC3 and the timestamp of VSYNC4, the game application sends the frame instruction C to the frame rate control module.

[0286] When the frame rate control module detects the frame sending instruction C, it can determine the rendering time Tc of the picture frame C according to the time difference between obtaining the frame sending instruction B and obtaining the frame sending instruction C. The frame rate control module can determine the fastest frame sending time TNd of the picture frame D. Among them, when Tc is less than T1, and TNc is less than T1, TNd can be MIN(T1, TNc+(T1-Tc)). That is, the value of TNd is the minimum value between T1 and (TNc+(T1-Tc)). When Tc is less than T1, and TNc is not less than T1, TNd can be TNc. When Tc is not less than T1, TNd can be the maximum value between 0 and (TNc-(Tc-TNc)).

[0287] Since the rendering time Tc of the picture frame C is greater than or equal to TNc, the frame control condition is not met. After obtaining the frame sending instruction C of the picture frame C, the frame rate control module immediately sends the frame instruction C to SurfaceFlinger.

[0288] After SurfaceFlinger obtains the buffer of frame C through the frame sending instruction C, it can take out frame C from the buffer of frame C for layer synthesis when waiting for VSYNC4 to arrive, so as to send frame C to the display screen for display.

[0289] When the frame rate control module detects the frame sending instruction C, it can notify the frame loss prediction module to enter the frame loss prediction process.

[0290] The frame loss prediction module can obtain the frame sending time Mqc of the picture frame C and the latest vsync signal timestamp Mm (at this time, the timestamp M3 of VYSNC3) from the frame rate control module. The frame loss prediction module can determine that the vsync signal timestamp Mv of the next picture frame to be sent and displayed is the timestamp M5 of VSYNC5 based on the timestamp M3 of VYSNC3 and the vsync signal period Pv, where M5=M3+2*Pv.

[0291] The frame loss prediction module can determine the fastest frame sending time Mnd of the picture frame D based on the frame sending time Mqc of the picture frame C and the fastest rendering time TNd of the picture frame D. Wherein, Mnd=Mqc+TNd.

[0292] Among them, since the fastest frame sending time Mnd of the picture frame D is earlier than the timestamp M5 of VSYNC4, the frame loss prediction module determines that before the vsync timestamp M5, there is no need to supplement the frame.

[0293] 5. Between the timestamp of VSYNC4 and the timestamp of VSYNC5, the game application can send the rendering instruction D of the screen frame D to the frame rate control module. After obtaining the rendering instruction D of the screen frame D, the frame rate control module can send the rendering instruction D to the GPU. After obtaining the rendering instruction D, the GPU can render the screen frame D and store the screen frame D in the buffer of the screen frame D after rendering the screen frame D.

[0294] Between the timestamp of VSYNC4 and the timestamp of VSYNC5, the game application can send a frame instruction D to the frame rate control module. When the frame rate control module obtains the frame instruction D, it can determine the rendering time Td of the picture frame D based on the time difference between obtaining the frame instruction C and obtaining the frame instruction D. The frame rate control module can determine the rendering time Td of the picture frame E( Figure 8 The fastest frame transmission time TNe (not shown) is used, and the picture frame E is the next picture frame of the picture frame D. Among them, when Td is less than T1, and TNd is less than T1, TNe can be MIN(T1, TNd+(T1-Td)). That is, the value of TNe is the minimum value between T1 and (TNd+(T1-Td)). When Td is less than T1, and TNd is not less than T1, TNe can be TNd. When Td is not less than T1, TNe can be the maximum value between 0 and (TNd-(Td-TNd)).

[0295] Since the rendering time Td of the picture frame D is greater than or equal to TNd, the frame control condition is not met. After obtaining the frame sending instruction D of the picture frame D, the frame rate control module immediately sends the frame instruction D to SurfaceFlinger.

[0296] After obtaining the buffer of the screen frame D through the frame sending instruction D, SurfaceFlinger can take out the screen frame D from the buffer of the screen frame D for layer synthesis when waiting for VSYNC5 to arrive, so as to send the screen frame D to the display screen for display.

[0297] Above Fig.10 The examples shown are only used to explain the present application and should not be construed as limiting.

[0298] The following describes the frame interpolation process of the frame interpolation control module provided in the embodiment of the present application.

[0299] Fig.11 A schematic diagram of the frame supplement process provided in an embodiment of the present application is shown.

[0300] like Fig.11 As shown, the frame supplement process may include the following steps:

[0301] S1101. A frame supplement control module may detect a frame supplement instruction, and the frame supplement instruction may include a frame supplement timing.

[0302] S1102: The frame interpolation control module may determine whether the current time reaches a frame interpolation timing.

[0303] If the current time reaches the frame interpolation opportunity, the frame interpolation control module may execute step S1103.

[0304] If the current time has not reached the frame supplement opportunity, the frame supplement control module may wait until the frame supplement opportunity is reached and execute step S1103.

[0305] Among them, due to the short-term multi-tasking concurrency, the system will be overloaded and some tasks cannot be executed in time, and the system resources cannot be reasonably utilized. Therefore, in the embodiment of the present application, the middle time between the rendering time of two original picture frames can be used as the best time to add frames, so as to reasonably utilize system resources. Among them, the best time to add frames can be obtained by the frame sending time Mq of the current picture frame and the frame control period T1. Among them, the best time to add frames can be (Mq+(T1 / 2)).

[0306] For example, as above Fig.10 As shown, the frame sending time of picture frame A is Mqa, and the frame loss prediction module determines that picture frame 1 needs to be generated after picture frame A. Therefore, the best frame supplementation time of picture frame 1 can be (Mqa+(T1 / 2)).

[0307] S1103 . The frame supplement control module generates a predicted picture frame through historically rendered picture frames, stores the predicted picture frame into a buffer, and provides the buffer of the predicted picture frame to SurfaceFlinger.

[0308] In an exemplary embodiment, since the similarity of the picture contents in adjacent picture frames is relatively high, the frame compensation control module can identify the movement trajectory of the picture contents in picture frame N-1 and picture frame N through the rendered picture frame N-1 and picture frame N, and can adjust the display position of the picture content in picture frame N based on the movement trajectory of the picture content, thereby obtaining the compensation frame X.

[0309] After SurfaceFlinger obtains the buffer of the predicted picture frame from the interpolation frame control module, it can wait for the arrival of the next vsync signal. When SurfaceFlinger receives the next vsync signal, it can take out the predicted picture frame from the buffer of the predicted picture frame for layer synthesis, generate an interface including the predicted picture frame, and send the predicted picture frame interface to the display screen for display.

[0310] After the frame interpolation control module provides the buffer of the predicted picture frame to SurfaceFlinger, the frame interpolation control module can wait for the frame loss prediction module to send the next frame interpolation instruction.

[0311] Among them, Fig.12 As shown, the interpolation control module can generate the predicted picture frame by frame extrapolation. That is, the interpolation control module can generate the predicted picture frame by using a plurality of picture frames that have been rendered by the game application through the GPU before the interpolation.

[0312] For example, the game application has rendered frame N-1 and frame N in sequence through the GPU, wherein the frame loss prediction module determines that frame X needs to be generated after frame N. Therefore, the interpolation frame control module can generate frame X based on the rendered frame N-1 and frame N. After the interpolation frame control module generates frame X and gives it to SurfaceFlinger, the game application continues to render frame N+1 through the GPU.

[0313] For example, the above Fig.10 As shown, the frame loss prediction module determines that the picture frame 1 needs to be generated after the picture frame A. Therefore, the frame supplement control module can generate the picture frame 1 based on the adjacent picture frame 0 and the picture frame A that have been rendered.

[0314] Since the interpolation frame control module generates the compensation frame by using the multiple frames that the game application has rendered by the GPU before the interpolation frame, the generation of the predicted frame does not need to be rendered by the GPU. Therefore, compared with the rendering process of the original frame, the generation process of the predicted frame consumes less power.

[0315] In a possible implementation, when there is only one rendered frame before the frame interpolation opportunity, the frame interpolation control module may abandon the frame interpolation.

[0316] In a possible implementation, when there are two rendered frames before the frame interpolation opportunity, but there are abnormalities in the two rendered frames, the frame interpolation control module may abandon the frame interpolation.

[0317] Fig.13The following is a flow chart showing an exemplary method for controlling a frame rate provided in an embodiment of the present application.

[0318] like Fig.13 As shown, the frame rate control method can be applied to an electronic device, wherein the electronic device may include a first application, a stable frame service module and SurfaceFlinger. The stable frame service module is located between the application layer and SurfaceFlinger. The frame rate control method may include the following steps:

[0319] S1301. The first application may generate a frame sending instruction.

[0320] Among them, the frame send instruction can be used to provide the buffer of the picture frame to SurfaceFlinger.

[0321] The buffer can be used to store the frames rendered by the GPU.

[0322] SurfaceFlinger can be used to synthesize and display the screen frame in the buffer indicated by the frame sending instruction after obtaining the frame sending instruction.

[0323] For the rendering and frame sending process of the first application to the screen frame, please refer to the aforementioned Fig. 6A , Figure 6B The embodiments shown in the above description will not be described in detail here.

[0324] S1302: Determine whether the electronic device meets the frame control condition.

[0325] If the frame control condition is not met, step S1303 is executed. If the frame control condition is met, step S1304 is executed.

[0326] S1303. Forward the frame sending instruction generated by the first application to SurfaceFlinger at the first frame rate through the frame stabilization service module.

[0327] S1304. Forward the frame sending instruction generated by the first application to SurfaceFlinger at a second frame rate through the stable frame service module, wherein the second frame rate is lower than the first frame rate.

[0328] For example, the second frame rate may be 50 Hz and the first frame rate may be 60 Hz.

[0329] The frame control condition may include that the picture frame rate set by the first application is a full frame rate, and / or the temperature of the electronic device is higher than a specified temperature threshold, and / or the power of the electronic device is lower than a specified power, and / or the occupancy rate of the central processing unit (CPU) of the electronic device is greater than a specified occupancy rate, and / or the first application is a game application.

[0330] The first frame rate is less than or equal to the full frame rate, and the full frame rate is the maximum refresh rate of the picture frame supported by the first application. For example, the maximum refresh rate of the screen of the electronic device is 60 Hz. The maximum refresh rate of the picture frame supported by the first application is 60 Hz.

[0331] In a possible implementation, the frame stabilization service module can obtain the frame sending instruction generated by the first application from a graphics interface; wherein the graphics interface includes any of the following: an open graphics library OpenGL, an open graphics library for embedded systems OpenGL ES, and a drawing application program interface Vulkan. In this way, there is no need to improve the first application, but to adapt the frame stabilization service module, so that the first application can control the frame rate of the frame sending through the frame stabilization service module without being aware of it, thereby reducing the power consumption of the electronic device.

[0332] For details, please refer to the above Fig. 6A The illustrated embodiments will not be described in detail here.

[0333] In a possible implementation, the frame stabilization service module may directly obtain the frame sending instruction generated by the first application from the first application. Figure 6B The illustrated embodiments will not be described in detail here.

[0334] In a possible implementation, the electronic device can synthesize and display N screen frames at the first frame rate through the SurfaceFlinger at the second frame rate through the stable frame service module, and the N screen frames include M predicted screen frames, and the M predicted screen frames are generated based on historical screen frames. In this way, after reducing the frame rate of the frame sending instruction obtained by SurfaceFlinger to the second frame rate, SurfaceFlinger can synthesize and display the screen frames at the first frame rate by supplementing frames, which can reduce the power consumption of the electronic device and avoid SurfaceFlinger frame loss.

[0335] Among them, M can be the difference between the first frame rate and the second frame rate. For example, the first frame rate can be 60Hz, and the second frame rate can be 50Hz. SurfaceFlinger obtains 50 frame sending instructions per second, and SurfaceFlinger can synthesize and display the picture frames corresponding to the 50 frame sending instructions and the 10 predicted picture frames generated by the supplementary frames per second.

[0336] For details, please refer to the above Fig. 9 , Fig.10 , Fig.11 , Fig.12 The illustrated embodiments will not be described in detail here.

[0337] In a possible implementation, when the stable frame service module does not control the frame, the stable frame service module can immediately forward the frame sending instruction obtained by the first application to SurfaceFlinger. When the stable frame service module obtains the first frame sending instruction generated by the first application, the stable frame service module can immediately forward the first frame sending instruction to SurfaceFlinger. When the stable frame service obtains the second frame sending instruction generated by the first application, the stable frame service can immediately forward the second frame sending instruction to SurfaceFlinger.

[0338] In a possible implementation, when the stable frame service module does not control the frame, the stable frame service module can delay forwarding certain frame sending instructions obtained from the first application to SurfaceFlinger. When the stable frame service module obtains the third frame sending instruction generated by the first application, the third frame sending instruction is provided to the SurfaceFlinger through the stable frame service module; after the third frame sending instruction is forwarded to the SurfaceFlinger through the stable frame service module, the fourth frame sending instruction generated by the first application is obtained through the stable frame service module; after the stable frame service module obtains the fourth frame sending instruction generated by the first application, the stable frame service module delays forwarding the fourth frame sending instruction to the SurfaceFlinger.

[0339] Specifically, the stable frame service module can determine the first time interval between the stable frame service module obtaining the fourth frame sending instruction and obtaining the third frame sending instruction; if the first time interval is less than the first frame sending interval, after the stable frame service module obtains the fourth frame sending instruction, the stable frame service module delays the first time length and forwards the fourth frame sending instruction to the SurfaceFlinger, wherein the first frame sending interval is the frame control period, the frame control period is the inverse of the second frame rate, and the first time length is the difference between the first frame sending interval and the first time interval.

[0340] If the first time interval is greater than or equal to the first frame sending interval, the stable frame service module may immediately forward the fourth frame sending instruction to the SurfaceFlinger upon obtaining the fourth frame sending instruction.

[0341] After the stable frame service module delays forwarding the fourth frame sending instruction to the SurfaceFlinger, the stable frame service module can obtain the fifth frame sending instruction generated by the first application. The stable frame service module can determine the second time interval between the stable frame service module obtaining the fifth frame sending instruction and obtaining the fourth frame sending instruction; if the second time interval is less than the second frame sending interval, after the stable frame service module obtains the fifth frame sending instruction, the stable frame service module can delay the second time length to forward the fifth frame sending instruction to the SurfaceFlinger, wherein the second time length is the difference between the second frame sending interval and the second time interval, and the second frame sending interval is determined by the first time interval, the first frame sending interval and the control frame cycle.

[0342] The second frame sending interval is determined by the following formula:

[0343]

[0344] Wherein, Ta is the first time interval, T1 is the control frame period, TNa is the first frame sending interval, and TNb is the second frame sending interval.

[0345] Among them, the first time interval is the rendering time of the picture frame corresponding to the fourth frame sending instruction, and the first frame sending interval is the fastest frame sending time of the picture frame corresponding to the fourth frame sending instruction. The first duration is the delay duration of the picture frame corresponding to the fourth frame sending instruction. The second time interval is the rendering time of the picture frame corresponding to the fifth frame sending instruction, and the second frame sending interval is the fastest frame sending time of the picture frame corresponding to the fifth frame sending instruction. The second duration is the delay duration of the picture frame corresponding to the fifth frame sending instruction.

[0346] For more information about the rendering time of a frame, the fastest frame delivery time, and the delay time of a frame, please refer to the above. Fig. 6A , Figure 6B , Figure 7 , Figure 8 The illustrated embodiment will not be described in detail here.

[0347] After the stable frame service module forwards the third frame sending instruction to the SurfaceFlinger, SurfaceFlinger can synthesize and display the picture frames in the buffer indicated by the third frame sending instruction through SurfaceFlinger when the first vertical synchronization vsync signal is obtained; after the stable frame service module forwards the fourth frame sending instruction to the SurfaceFlinger, SurfaceFlinger can synthesize and display the picture frames in the buffer indicated by the third frame sending instruction through SurfaceFlinger when the second vsync signal is obtained, and the second vsync signal is the next vsync signal of the first vsync signal.

[0348] If the stable frame service module determines that there is no buffer of unsynthesized display frames in SurfaceFlinger when SurfaceFlinger obtains the third vsync signal and the estimated time when the stable frame service module obtains the fifth frame sending instruction generated by the first application is later than the time when SurfaceFlinger obtains the third vsync signal, before SurfaceFlinger obtains the third vsync signal, the stable frame service module generates a first predicted frame based on the frame in the buffer indicated by the third frame sending instruction and the frame in the buffer specified by the fourth frame sending instruction; the first predicted frame is provided to the SurfaceFlinger through the stable frame service module; when SurfaceFlinger obtains the third vsync signal, SurfaceFlinger synthesizes and displays the first predicted frame; wherein the third vsync signal is the next vsync signal of the second vsync signal, and the difference between the time when SurfaceFlinger obtains the third vsync signal and the time when SurfaceFlinger obtains the second vsync signal is equal to the difference between the time when SurfaceFlinger obtains the second vsync signal and the time when SurfaceFlinger obtains the first vsync signal.

[0349] Among them, the vertical synchronization signal thread (Vsync Thread) can periodically send a vsync signal to SurfaceFlinger.

[0350] For details about the frame loss prediction process and frame supplement process, please refer to the above Fig. 9 , Fig.10 , Fig.11 , Fig.12 The illustrated embodiment will not be described in detail here.

[0351] Through a frame rate control method provided by an embodiment of the present application, an electronic device can control the frame rate of the picture frame of an application (for example, a game application) to be slightly lower than the original frame rate specified by the application (for example, controlled from the original 60Hz to 58Hz), so that the load of rendering and frame sending becomes lighter, thereby reducing the use of system resources on the electronic device and reducing the power consumption of the electronic device. Optionally, the electronic device can predict the frame loss timing of the picture frame in advance during the process of controlling the frame rate of the picture frame of the application (for example, a game application). Before the frame loss timing of the picture frame arrives, a predicted picture frame is generated using multiple previously rendered picture frames through an active interpolation method that is lighter in load than the process of generating picture frames by the application, and is inserted into the queue of the picture frame. In this way, the display frame rate of the picture on the display screen can also reach the original frame rate, which ensures the application performance while reducing the load and power consumption of the electronic device.

[0352] The embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.

[0353] The embodiments of the present application also provide a computer program product. When the computer program product is executed on an electronic device, the electronic device can implement the steps in the above-mentioned various method embodiments.

[0354] The embodiment of the present application also provides a chip system, the chip system includes a processor, the processor is coupled to a memory, and the processor executes a computer program stored in the memory to implement the steps of any method embodiment of the present application. The chip system can be a single chip or a chip module composed of multiple chips.

[0355] The term "user interface (UI), or interface for short) in the specification and drawings of this application refers to the medium interface for interaction and information exchange between an application or operating system and a user, which realizes the conversion between the internal form of information and the form acceptable to the user. The user interface of an application is source code written in a specific computer language such as Java and extensible markup language (XML). The interface source code is parsed and rendered on the terminal device, and finally presented as content that the user can recognize, such as pictures, text, buttons and other controls. Controls, also called widgets, are the basic elements of the user interface. Typical controls include toolbars, menu bars, text boxes, buttons, scroll bars, pictures and text. The properties and contents of controls in the interface are defined by tags or nodes, such as XML through <textview> 、 <imgview> 、 <videoview>The controls contained in the interface are specified by nodes such as . A node corresponds to a control or attribute in the interface. After parsing and rendering, the node is presented as user-visible content. In addition, many applications, such as hybrid applications, usually also contain web pages in their interfaces. A web page, also known as a page, can be understood as a special control embedded in the application interface. A web page is source code written in a specific computer language, such as hypertext markup language (HTML), cascading style sheets (CSS), JavaScript (JS), etc. The web page source code can be loaded and displayed as user-recognizable content by a browser or a web page display component with similar functions to a browser. The specific content contained in a web page is also defined by tags or nodes in the web page source code. For example, HTML is defined by 、 、 <video> 、 <canvas>To define the elements and attributes of a web page.

[0356] The most common form of user interface is graphical user interface (GUI), which refers to a user interface related to computer operation that is displayed in a graphical manner. It can be an icon, window, control or other interface element displayed on the display screen of an electronic device, where a control can include icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets and other visual interface elements.

[0357] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part 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, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. 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 contains one or more available media integration. The available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk), etc.

[0358] Those skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by computer programs to instruct related hardware, and the programs can be stored in computer-readable storage media. When the programs are executed, they can include the processes of the above-mentioned method embodiments. The aforementioned storage media include: ROM or random access memory RAM, magnetic disk or optical disk and other media that can store program codes.

[0359] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.< / canvas> < / video> < / videoview> < / imgview> < / textview>

Claims

1. A frame rate control method, characterized in that: Applied to an electronic device, the electronic device includes a stable frame service module, the stable frame service module is located between an application layer and a layer synthesizer SurfaceFlinger, the electronic device is installed with a first application, and the method includes: The first application generates a frame sending instruction; When the electronic device does not meet the frame control condition, forwarding the frame sending instruction generated by the first application to the SurfaceFlinger at a first frame rate through the stable frame service module; wherein the frame sending instruction is used to provide the layer buffer buffer of the picture frame to the SurfaceFlinger, and the buffer is used to store the picture frame rendered by the GPU, and the SurfaceFlinger is used to synthesize and display the picture frame in the buffer indicated by the frame sending instruction after obtaining the frame sending instruction; When the electronic device meets the frame control condition, the frame sending instruction generated by the first application is forwarded to the SurfaceFlinger at a second frame rate through the stable frame service module, wherein the first frame rate is greater than the second frame rate, and the frame control condition includes that the picture frame rate set by the first application is the full frame rate, the first frame rate is less than or equal to the full frame rate, and the full frame rate is the maximum refresh rate of the picture frame supported by the first application.

2. The method according to claim 1, characterized in that The method further comprises: The frame sending instruction generated by the first application is obtained from the graphics interface through the frame stabilization service module; wherein the graphics interface includes any one of the following: an open graphics library OpenGL, an open graphics library OpenGL ES for embedded systems, and a drawing application program interface Vulkan.

3. The method according to claim 1, characterized in that The frame control conditions also include: the temperature of the electronic device is higher than a specified temperature threshold, and / or the power of the electronic device is lower than a specified power, and / or the occupancy rate of the central processing unit (CPU) of the electronic device is greater than a specified occupancy rate, and / or the first application is a game application.

4. The method according to any one of claims 1 to 3, characterized in that When forwarding the frame sending instruction sent by the first application to the SurfaceFlinger at the second frame rate through the stable frame service module, the method further includes: The SurfaceFlinger synthesizes and displays N picture frames at the first frame rate, wherein the N picture frames include M predicted picture frames, and the M predicted picture frames are generated based on historical picture frames.

5. The method according to claim 4, characterized in that M is the difference between the first frame rate and the second frame rate.

6. The method according to claim 4 or 5, characterized in that: The step of forwarding the frame sending instruction generated by the first application to SurfaceFlinger at a first frame rate through the frame stabilization service module specifically includes: When a first frame sending instruction generated by the first application is acquired through the stable frame service module, the first frame sending instruction is forwarded to the SurfaceFlinger through the stable frame service module; After the first frame sending instruction is forwarded to the SurfaceFlinger through the stable frame service module, when the stable frame service module obtains the second frame sending instruction generated by the first application, the second frame sending instruction is forwarded to the SurfaceFlinger through the stable frame service module.

7. The method according to any one of claims 4 to 6, characterized in that: The step of forwarding the frame sending instruction issued by the first application to SurfaceFlinger at the second frame rate through the frame stabilization service module specifically includes: When the third frame sending instruction generated by the first application is acquired through the stable frame service module, the third frame sending instruction is provided to the SurfaceFlinger through the stable frame service module; After forwarding the third frame sending instruction to the SurfaceFlinger through the stable frame service module, obtaining the fourth frame sending instruction generated by the first application through the stable frame service module; After the stable frame service module obtains the fourth frame sending instruction generated by the first application, the stable frame service module delays forwarding the fourth frame sending instruction to the SurfaceFlinger.

8. The method according to claim 7, characterized in that After the stable frame service module obtains the fourth frame sending instruction sent by the first application, delaying forwarding the fourth frame sending instruction to the SurfaceFlinger through the stable frame service module specifically includes: Determine, by the stable frame service module, a first time interval between when the stable frame service module obtains the fourth frame sending instruction and when the stable frame service module obtains the third frame sending instruction; If the first time interval is less than the first frame sending interval, after the stable frame service module obtains the fourth frame sending instruction, the stable frame service module delays the first duration and forwards the fourth frame sending instruction to the SurfaceFlinger, wherein the first frame sending interval is a frame control period, the frame control period is the inverse of the second frame rate, and the first duration is the difference between the first frame sending interval and the first time interval.

9. The method according to claim 8, characterized in that The method further comprises: If the first time interval is greater than or equal to the first frame sending interval, when the stable frame service module obtains the fourth frame sending instruction, the fourth frame sending instruction is forwarded to the SurfaceFlinger through the stable frame service module.

10. The method according to any one of claims 7 to 9, characterized in that: The method further comprises: After the stable frame service module delays forwarding the fourth frame sending instruction to the SurfaceFlingre, the stable frame service module obtains the fifth frame sending instruction generated by the first application; Determine, by the stable frame service module, a second time interval between when the stable frame service module obtains the fifth frame sending instruction and when it obtains the fourth frame sending instruction; If the second time interval is less than the second frame sending interval, after the stable frame service module obtains the fifth frame sending instruction, the stable frame service module delays the second time length and forwards the fifth frame sending instruction to the SurfaceFlinger, wherein the second time length is the difference between the second frame sending interval and the second time interval, and the second frame sending interval is determined by the first time interval, the first frame sending interval and the control frame cycle.

11. The method according to claim 10, characterized in that The second frame sending interval is determined by the following formula: Among them, Ta is the first time interval, T1 is the control frame period, TNa is the first frame sending interval, and TNb is the second frame sending interval.

12. The method according to any one of claims 7 to 11, characterized in that: The method further comprises: After the frame stabilization service module forwards the third frame sending instruction to the SurfaceFlinger, when the SurfaceFlinger obtains the first vertical synchronization vsync signal, the picture frame in the buffer indicated by the third frame sending instruction is synthesized and displayed by the SurfaceFlinger; After the stable frame service module forwards the fourth frame sending instruction to the SurfaceFlinger, when the SurfaceFlinger obtains the second vsync signal, the screen frame in the buffer indicated by the third frame sending instruction is synthesized and displayed through the SurfaceFlinger, and the second vsync signal is the next vsync signal of the first vsync signal.

13. The method according to claim 12, characterized in that The method further comprises: If it is determined by the stable frame service module that there is no buffer of unsynthesized display screen frames in the SurfaceFlinger when the SurfaceFlinger obtains the third vsync signal, and the estimated time when the stable frame service module obtains the fifth frame sending instruction generated by the first application is later than the time when the SurfaceFlinger obtains the third vsync signal, before the SurfaceFlinger obtains the third vsync signal, the stable frame service module generates a first predicted screen frame based on the screen frames in the buffer indicated by the third frame sending instruction and the screen frames in the buffer specified by the fourth frame sending instruction; Providing the first predicted picture frame to the SurfaceFlinger through the stable frame service module; When the SurfaceFlinger obtains the third vsync signal, the first predicted picture frame is synthesized and displayed by the SurfaceFlinger; Among them, the third vsync signal is the next vsync signal of the second vsync signal, and the difference between the time when the SurfaceFlinger obtains the third vsync signal and the time when the SurfaceFlinger obtains the second vsync signal is equal to the difference between the time when the SurfaceFlinger obtains the second vsync signal and the time when the SurfaceFlinger obtains the first vsync signal.

14. An electronic device, characterized in that: It comprises one or more processors and one or more memories; wherein, the one or more memories are coupled to the one or more processors, and the one or more memories are used to store computer program code, and the computer program code includes computer instructions, and when the one or more processors execute the computer instructions, the first electronic device executes the method as described in any one of claims 1-13.

15. A chip system, characterized in that: The chip system is applied to an electronic device, and the chip system includes a processing circuit and an interface circuit, the interface circuit is used to receive instructions and transmit them to the processing circuit, and the processing circuit is used to run the instructions to execute the method as described in any one of claims 1-13.

16. A computer-readable storage medium, characterized in that: The method comprises instructions, which, when executed on an electronic device, cause the electronic device to execute the method as claimed in any one of claims 1 to 13.

Citation Information

Cited By

  • Display control method, electronic equipment and storage medium

    CN119356512A

  • Frame rate control method and related apparatus

    EP4647137A1

  • Frame rate control method and related apparatus

    WO2024244631A1