Display frame rate control method and related apparatus for mitigating flickering and frame loss
This application provides a frame rate control method and a related apparatus. According to the method, when a first application is run on an electronic device, screen display content is refreshed at a first frame rate. When switching from the first application to a second application is performed, frame rate switching is triggered. The frame rate switching is performed in two steps: (1) First, adjust a frequency of a TE signal. (2) Second, adjust a periodicity of a MIPI signal when the counted quantity of image frames received by the HWC reaches the first quantity (where the first quantity may be predetermined and written into storage space of the electronic device) after the frame rate switching instruction is buffered, to cause an adjusted frequency of the TE signal and an adjusted periodicity of the MIPI signal to take effect in a same screen refresh periodicity.
1 . A frame rate control method, applied to an electronic device using a Low Temperature Poly-silicon (LTPS) screen, and comprising:
receiving a first operation of a user;
starting a first application in response to the first operation;
during running of the first application, transmitting an image frame based on a first Mobile Industry Processor Interface (MIPI) signal and sending the image frame for display based on a first TE signal, wherein a frequency of a first Tearing Effect (TE) signal is the same as a first frame rate;
receiving a second operation of the user;
starting a second application in response to the second operation and generating a frame rate switching instruction;
buffering the frame rate switching instruction;
generating a second TE signal based on the first TE signal;
generating a second MIPI signal based on the first MIPI signal when a quantity of image frames received by a hardware composer of the electronic device reaches a first quantity since the frame rate switching instruction has been buffered; and
transmitting the image frame based on the second MIPI signal, and sending the image frame for display based on the second TE signal, wherein a frequency of the second TE signal is the same as a second frame rate, and the second frame rate is different from the first frame rate.
2 . The method according to claim 1 , wherein before the generating a second MIPI signal based on the first MIPI signal when a quantity of image frames received by a hardware composer of the electronic device reaches a first quantity since the frame rate switching instruction has been buffered, the method further comprises:
after the frame rate switching instruction is buffered, counting the quantity of image frames received by the hardware composer of the electronic device; and
when a count value reaches the first quantity, determining that the quantity of image frames received by the hardware composer of the electronic device reaches the first quantity since the frame rate switching instruction has been buffered.
3 . The method according to claim 1 , wherein before the receiving a second operation of the user, the method further comprises:
receiving a third operation of the user; and
closing the first application or returning to a home screen in response to the third operation.
4 . The method according to claim 1 , wherein the first application is a video application, and the second application is an application that displays an image and text.
5 . The method according to claim 1 , wherein before the buffering the frame rate switching instruction, the method further comprises: determining that the first frame rate is higher than the second frame rate.
6 . The method according to claim 1 , wherein the generating a second MIPI signal based on the first MIPI signal when a quantity of image frames received by a hardware composer of the electronic device reaches a first quantity since the frame rate switching instruction has been buffered comprises:
when the quantity of image frames received by the hardware composer reaches the first quantity since the frame rate switching instruction has been buffered, parsing the frame rate switching instruction to obtain the second frame rate;
obtaining, based on mapping relationships between frame rates and periodicities of MIPI signals, a first periodicity matching the second frame rate; and
generating, based on the first periodicity, the second MIPI signal using the first MIPI signal, wherein a periodicity of the second MIPI signal is equal to the first periodicity, and the first periodicity is longer than a periodicity of the first MIPI signal.
7 . The method according to claim 1 , wherein the generating a second TE signal based on the first TE signal comprises:
parsing the frame rate switching instruction to obtain the second frame rate; and
generating a TE frequency adjustment instruction based on the second frame rate, and generating the second TE signal based on the first TE signal in response to the TE frequency adjustment instruction.
8 . A frame rate control method, applied to an electronic device using a Low Temperature Poly-silicon (LTPS) screen, and comprising:
receiving a first operation of a user;
starting a first application in response to the first operation;
during running of the first application, transmitting an image frame based on a first Mobile Industry Processor Interface (MIPI) signal and sending the image frame for display based on a first TE signal, wherein a frequency of a first Tearing Effect (TE) signal is the same as a first frame rate;
receiving a second operation of the user;
starting a second application in response to the second operation;
generating a second TE signal based on the first TE signal in a first periodicity;
generating a second MIPI signal based on the first MIPI signal in a second periodicity, wherein the second periodicity follows the first periodicity, with a preset quantity of first periodicity intervals in between, and a value of the first periodicity interval is a reciprocal of the first frame rate; and
in a third periodicity, transmitting the image frame based on the second MIPI signal, and sending the image frame for display based on the second TE signal, wherein the third periodicity follows the second periodicity, a frequency of the second TE signal is the same as a second frame rate, and the second frame rate is different from the first frame rate.
9 . An electronic device, wherein the electronic device comprises: one or more processors, a memory, and a touch screen, wherein the memory is configured to store program code; and the one or more processors are configured to run the program code to enable the electronic device to:
receive a first operation of a user;
start a first application in response to the first operation;
during running of the first application, transmit an image frame based on a first Mobile Industry Processor Interface (MIPI) signal and sending the image frame for display based on a first TE signal, wherein a frequency of a first Tearing Effect (TE) signal is the same as a first frame rate;
receive a second operation of the user;
start a second application in response to the second operation and generating a frame rate switching instruction;
buffer the frame rate switching instruction;
generate a second TE signal based on the first TE signal;
generating a second MIPI signal based on the first MIPI signal when a quantity of image frames received by a hardware composer of the electronic device reaches a first quantity since the frame rate switching instruction has been buffered; and
transmit the image frame based on the second MIPI signal, and sending the image frame for display based on the second TE signal, wherein a frequency of the second TE signal is the same as a second frame rate, and the second frame rate is different from the first frame rate.