Frame rate switching method and device, electronic equipment, storage medium and product

By predicting and controlling the rendering time of the next image frame during the screen refresh frame rate switching process, the problem of screen stuttering caused by frame drops in traditional methods is solved, ensuring smooth screen performance.

CN119559920BActive Publication Date: 2025-12-19GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311134302.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-04
Publication Date
2025-12-19
Estimated Expiration
2043-09-04

AI Technical Summary

Technical Problem

Traditional methods are prone to frame drops during screen refresh rate switching, causing the display to stutter.

Method used

After receiving a frame rate switching request in the initial image frame, at a preset number of frame intervals, using the current time, the first generation time of the Vsync-TE signal of the corresponding current image frame, the working duration of the image frame, and the second frame rate, the second generation time of the Vsync-TE signal of the next image frame, the working duration of the image frame, and the second frame rate are predicted. The current time is predicted, the second generation time of the Vsync-TE signal of the next image frame is controlled, the generation time of the Vsync-TE signal of the next image frame is controlled, and the generation time of the Vsync-APP signal of the next image frame of the current image frame is predicted, thus deducing the rendering time of the next image frame.

Benefits of technology

It achieves the goal of avoiding frame drops during screen refresh rate switching, ensuring smooth visuals.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119559920B_ABST
    Figure CN119559920B_ABST
Patent Text Reader

Abstract

The application relates to a frame rate switching method and device, electronic equipment, a storage medium and a product. The method comprises the following steps: receiving a frame rate switching request at an initial image frame; the frame rate switching request is used for indicating that the refresh frame rate of the screen of the electronic equipment is switched from a first frame rate to a second frame rate. At a current time interval of a preset number of frames after the initial image frame, in response to the frame rate switching request, a second generation time of a Vsync-TE signal of a next image frame of the current image frame is predicted according to the current time, a first generation time of the Vsync-TE signal of the current image frame corresponding to the current time, the working duration of the image frame and the second frame rate. According to the second generation time of the Vsync-TE signal of the next image frame, the next image frame is controlled to be drawn at the second frame rate. Since the time information of the first generation time is accurate, the second generation time is also accurate, and thus frame dropping does not occur in the picture drawing process, and smooth pictures can be obtained.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of screen display, in particular to a frame rate switching method and device, an electronic device, a storage medium and a product. BACKGROUND

[0002] With the rapid development of electronic device related technologies, the screen of an electronic device can support multiple different refresh frame rates, for example, 60Hz, 90Hz, 120Hz or even higher refresh frame rates. In different application scenarios, the screen may need to switch the refresh frame rate.

[0003] However, the traditional method is prone to frame dropping when switching the refresh frame rate of the screen, which in turn causes the display screen to appear to be stuck. SUMMARY

[0004] The frame rate switching method and device, the electronic device, and the computer readable storage medium provided by the embodiments of the present application can avoid frame dropping, and thus a smooth picture can be obtained.

[0005] In one aspect, a frame rate switching method is provided, applied to an electronic device, and the method comprises:

[0006] receiving a frame rate switching request at an initial image frame; the frame rate switching request is used to indicate that the refresh frame rate of the screen of the electronic device is switched from a first frame rate to a second frame rate; the refresh frame rate of the initial image frame is the first frame rate;

[0007] at a current time interval of a preset number of frames after the initial image frame, in response to the frame rate switching request, predicting a second generation time of a Vsync-TE signal of a next image frame of the current image frame according to the current time, a first generation time of the Vsync-TE signal of the current image frame corresponding to the current time, a working duration of an image frame, and the second frame rate;

[0008] controlling the next image frame to be drawn at the second frame rate according to the second generation time of the Vsync-TE signal of the next image frame.

[0009] In another aspect, a frame rate switching device is provided, applied to an electronic device, and the device comprises:

[0010] a receiving module configured to receive a frame rate switching request at an initial image frame; the frame rate switching request is used to indicate that the refresh frame rate of the screen of the electronic device is switched from a first frame rate to a second frame rate; the refresh frame rate of the initial image frame is the first frame rate;

[0011] a prediction module configured to, at a current time point that is a preset number of frames apart from the initial image frame, in response to the frame rate switching request, predict a second generation time point of a Vsync-TE signal of a next image frame of the current image frame according to the current time point, a first generation time point of the Vsync-TE signal of a current image frame corresponding to the current time point, a working duration of the image frame, and the second frame rate;

[0012] a control module configured to control the next image frame to be rendered at the second frame rate according to the second generation time point of the Vsync-TE signal of the next image frame.

[0013] In another aspect, an electronic device is provided, including a memory and a processor, the memory storing a computer program, the computer program being executed by the processor to cause the processor to perform the steps of the frame rate switching method.

[0014] In another aspect, a computer readable storage medium is provided, storing a computer program, the computer program being executed by a processor to implement the steps of the frame rate switching method.

[0015] In another aspect, a computer program product is provided, including a computer program, the computer program being executed by a processor to implement the steps of the frame rate switching method.

[0016] The frame rate switching method, device, electronic device, storage medium, and product, and the electronic device receives a frame rate switching request for an initial image frame; the frame rate switching request is used to instruct the electronic device to switch a refresh frame rate of a screen of the electronic device from a first frame rate to a second frame rate; the refresh frame rate of the initial image frame is the first frame rate. At a current time point that is a preset number of frames apart from the initial image frame, in response to the frame rate switching request, a second generation time point of a Vsync-TE signal of a next image frame of a current image frame is predicted according to the current time point, a first generation time point of the Vsync-TE signal of the current image frame corresponding to the current time point, a working duration of the image frame, and the second frame rate. The next image frame is controlled to be rendered at the second frame rate according to the second generation time point of the Vsync-TE signal of the next image frame.

[0017] Since the frame rate decision manager adopts the first generation time of the Vsync-TE signal of the current image frame corresponding to the current time when predicting the second generation time of the Vsync-TE signal of the next image frame of the current image frame corresponding to the current time, it can be known that the time information of the first generation time is accurate, and thus the predicted second generation time of the Vsync-TE signal of the next image frame of the current image frame is also accurate. In addition, the display architecture in the electronic device of the present application defines that the working duration of each image frame at the first frame rate is equal to the working duration of the image frame at the second frame rate, and thus the frame rate decision manager can accurately deduce each drawing time in the picture drawing process of the next image frame at the second frame rate according to the second generation time of the Vsync-TE signal of the next image frame, in combination with the first working duration APP-WorkDuration and the second working duration SF-WorkDuration.

[0018] Therefore, based on the generation time of the Vsync-APP signal of the next image frame and the generation time of the Vsync-SF signal, picture drawing is performed at the second frame rate, and the first working duration APP-WorkDuration of each image frame in the obtained picture is equal, and the second working duration SF-WorkDuration of each image frame is also equal, so that no frame dropping occurs in the picture drawing process, and thus a smooth picture can be obtained. BRIEF DESCRIPTION OF DRAWINGS

[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative labor.

[0020] Figure 1 Timing diagram for frame rate switching on the screen in the traditional method;

[0021] Figure 2 Application environment diagram of the frame rate switching method in an embodiment;

[0022] Figure 3 Flowchart of the frame rate switching method in an embodiment;

[0023] Figure 4 is Figure 3 Flowchart of the method for predicting the second generation time of the Vsync-TE signal of the next image frame of the current image frame;

[0024] Figure 5A schematic diagram of the relationship between Vsync signals of image frames in an embodiment;

[0025] Figure 6 A timing diagram of frame rate switching for a screen in an embodiment;

[0026] Figure 7 For Figure 3 A flow chart of a method of controlling a next image frame to be rendered at a second frame rate according to a second generation time of a Vsync-TE signal of the next image frame in an embodiment;

[0027] Figure 8 A schematic diagram of a frame rate switching method in an exemplary embodiment;

[0028] Figure 9 A timing diagram of frame rate switching for a screen in another embodiment;

[0029] Figure 10 A block diagram of a frame rate switching device in an embodiment;

[0030] Figure 11 For Figure 10 A block diagram of a prediction module in an embodiment;

[0031] Figure 12 A schematic diagram of an internal structure of an electronic device in an embodiment. DETAILED DESCRIPTION

[0032] In order to make the objects, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and should not be used to limit the present application.

[0033] It can be understood that the terms "first", "second", etc. used in the present application can be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from another element. For example, without departing from the scope of the present application, the first frame rate can be referred to as the second frame rate, and similarly, the second frame rate can be referred to as the first frame rate. Both the first frame rate and the second frame rate are frame rates, but they are not the same frame rate.

[0034] In the current display framework, the behaviors of application rendering and layer sending in the UI scene are closely related to the Vsync model. In the current display framework, different Vsync models need to be established to match different refresh frame rates of the screen. Therefore, when a frame rate switching instruction is initiated for the screen, the Vsync model of the screen also needs to be model emptied and reconstructed accordingly, so that the reconstructed Vsync model matches the frame rate after the screen switches.

[0035] The core idea of establishing the Vsync model is as follows: xi and yi of a preset number of historical frames are taken as independent variables and dependent variables respectively, a linear regression algorithm is used for simulation, and a prediction formula y=kx+b is obtained, which is the Vsync model. Here, yi represents the generation time (TE Time) of the i-th received Vsync-TE signal received by the system, and xi represents the down rounding result of the generation time of the i-th received Vsync-TE signal received by the system to the period T. Here, the period T is the period corresponding to the refresh frame rate of the preset number of historical frames.

[0036] In the prediction formula, k is the statistical value of the period T calculated by the linear regression algorithm, b is the intercept when x is 0, y is the predicted generation time of the Vsync-TE signal, and x is the down rounding result of the predicted generation time of the Vsync-TE signal to the period T.

[0037] The relationship between k and xi, yi is shown in formula (1), and the relationship between b and xi, yi is shown in formula (2):

[0038]

[0039]

[0040] After initiating the switching of the refresh frame rate for the screen, it is generally necessary to re-establish a new Vsync model after several frames. Therefore, in the traditional frame rate switching method, the generation time of the Vsync-TE signal of any frame in the historical time is still selected to predict the generation time of the Vsync-TE signal of the image frame after initiating the switching of the refresh frame rate. Obviously, the predicted generation time of the Vsync-TE signal of the image frame after initiating the switching of the refresh frame rate is wrong. Further, the generation times of the Vsync-APP signal and the Vsync-SF signal of the image frame based on the wrong generation time of the Vsync-TE signal of the image frame are also wrong, which disrupts the display rhythm of the image frame, and the image frame may be delayed on the screen due to missing the generation time of the next Vsync-SF signal, resulting in a display screen with a lag phenomenon.

[0041] As Figure 1The diagram shows the timing diagram for frame rate switching in the traditional method. The first row of the timing diagram, the Vsync-APP signal, includes two lines of signals, representing the main thread and rendering thread for each frame. The second row, the Vsync-SF / Vsync-HWC signals, represents the display duration for each frame. The third row, the Vsync-TE signal, represents the display duration (or on-screen duration) for each frame. Assume that a frame rate switching request is received in frame B, instructing the screen's frame rate to switch from 120Hz to 90Hz. Before the new Vsync model is built, the traditional frame rate switching method still selects the generation time of the Vsync-TE signal from any frame in the history to predict the generation time of the Vsync-TE signal for frame D. Clearly, the predicted generation time of the Vsync-TE signal for frame D is incorrect. Furthermore, based on the incorrect generation time of the Vsync-TE signal in the D frame, the generation times of the Vsync-APP and Vsync-SF signals in the D frame, which were deduced, were also incorrect. From... Figure 1 As can be seen, the time interval between the generation time of the Vsync-APP of the D frame and the generation time of the Vsync-APP of the C frame is neither the period corresponding to 120Hz nor the period corresponding to 90Hz, and is less than the period corresponding to 120Hz. Therefore, the D frame will miss the generation time of the next Vsync-SF signal, disrupting the D frame's display rhythm. This could lead to a delay in the D frame's display due to missing a display signal, causing stuttering in the display.

[0042] Figure 2 This is a schematic diagram illustrating the application environment of a frame rate switching method in one embodiment. For example... Figure 2As shown, the application environment includes an electronic device 220, which receives a frame rate switching request at an initial image frame; the frame rate switching request is used to indicate that the refresh frame rate of the screen of the electronic device is switched from a first frame rate to a second frame rate; the refresh frame rate of the initial image frame is the first frame rate; at a current time point that is separated from the initial image frame by a preset number of frames, in response to the frame rate switching request, a second generation time point of a Vsync-TE signal of a next image frame of a current image frame is predicted according to the current time point, a first generation time point of the Vsync-TE signal of the current image frame corresponding to the current time point, the working duration of the image frame, and the second frame rate; and the next image frame is controlled to perform picture rendering at the second frame rate according to the second generation time point of the Vsync-TE signal of the next image frame. The electronic device 220 can be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, Internet of Things devices, and portable wearable devices. The Internet of Things device can be a smart speaker, a smart television, a smart air conditioner, a smart vehicle-mounted device, a smart car, and the like. The portable wearable device can be a smart watch, a smart bracelet, a head-mounted device, and the like.

[0043] Figure 3 A flowchart of a frame rate switching method in an embodiment is shown. The frame rate switching method in this embodiment is described by taking an electronic device running on the electronic device as an example. As shown in Figure 2 , the frame rate switching method includes steps 320 to 360, wherein, Figure 3

[0044] Step 320: receiving a frame rate switching request at an initial image frame; the frame rate switching request is used to indicate that the refresh frame rate of the screen of the electronic device is switched from a first frame rate to a second frame rate; the refresh frame rate of the initial image frame is the first frame rate.

[0045] With more and more functions that can be realized on the electronic device, the use scenarios of the electronic device are also becoming more and more rich, for example, the electronic device can be applied in playing a video, playing a game, or general browsing, and the like. Since different application scenarios have different requirements for the refresh frame rate of the screen, the electronic device also needs to dynamically switch the refresh frame rate with the switching of the application scenario.

[0046] ​It is assumed that the electronic device receives a frame rate switching request at an initial image frame, where the refresh frame rate of the initial image frame is a first frame rate. Here, the frame rate switching request is used to indicate that the refresh frame rate of the screen of the electronic device is switched from the first frame rate (fps1) to a second frame rate (fps2). The size relationship between the first frame rate and the second frame rate is not limited here. If the first frame rate is greater than the second frame rate, the frame rate switching request is used to indicate that the electronic device reduces the refresh frame rate of the screen; if the first frame rate is less than the second frame rate, the frame rate switching request is used to indicate that the electronic device increases the refresh frame rate of the screen. And the screen of the electronic device can support a refresh frame rate of 60Hz, 90Hz, 120Hz, 144Hz or even higher.

[0047] Here, the window manager of the electronic device detects a preset operation such as application opening or application switching, scene switching in the application, etc., which triggers the frame rate switching request. Alternatively, in an application with a lower refresh frame rate of the screen, the application layer of the electronic device may need to increase the refresh frame rate of the screen when receiving a user's sliding operation or click operation, so the window manager will also trigger the frame rate switching request. Of course, the present application does not limit this. After the window manager of the electronic device triggers the frame rate switching request, the frame rate switching request is sent to the frame rate decision manager of the electronic device. That is, it can be understood that the frame rate decision manager of the electronic device receives the frame rate switching request at the initial image frame.

[0048] At step 340, at a current time interval of a preset number of frames after the initial image frame, in response to the frame rate switching request, the second generation time of the Vsync-TE signal of the next image frame of the current image frame is predicted according to the current time, the first generation time of the Vsync-TE signal of the current image frame corresponding to the current time, the working duration of the image frame and the second frame rate.

[0049] The frame rate decision manager of the electronic device can determine the frame rate switching strategy after receiving the frame rate switching request at the initial image frame, and send the frame rate switching strategy to the display composition process. Alternatively, the frame rate decision manager can respond to the frame rate switching request at a current time interval of a preset number of frames after the initial image frame. Here, the specific number of the preset number of frames can be defined based on the display architecture within the electronic device, and the present application does not limit this. For example, the number of the preset number of frames can be zero frames, one frame, or two frames or more.

[0050] If the preset number of frames is zero, any time between the time of generation of the Vsync-APP signal of the next frame of the initial image frame (the first frame after the initial image frame) and the time of generation of the Vsync-APP signal of the next two frames of the initial image frame (the second frame after the initial image frame) can be taken as the current time. If the preset number of frames is one, any time between the time of generation of the Vsync-APP signal of the next two frames of the initial image frame (the second frame after the initial image frame) and the time of generation of the Vsync-APP signal of the next three frames of the initial image frame (the third frame after the initial image frame) can be taken as the current time.

[0051] Further, the frame rate decision manager can predict the second time of generation of the Vsync-TE signal of the next image frame of the current image frame corresponding to the current time at the current time which is separated from the initial image frame by the preset number of frames, in response to the frame rate switching request. Alternatively, the frame rate decision manager can predict the second time of generation of the Vsync-TE signal of the next image frame of the current image frame according to the current time, the first time of generation of the Vsync-TE signal of the current image frame corresponding to the current time, the working duration of the image frame, and the second frame rate.

[0052] Since the frame rate decision manager predicts the second time of generation of the Vsync-TE signal of the next image frame of the current image frame corresponding to the current time by using the first time of generation of the Vsync-TE signal of the current image frame corresponding to the current time, it can be known that the time information of the first time of generation is accurate, and thus the predicted second time of generation of the Vsync-TE signal of the next image frame of the current image frame is also accurate.

[0053] Step 360, according to the second time of generation of the Vsync-TE signal of the next image frame, the next image frame is controlled to be drawn at the second frame rate.

[0054] After predicting the second time of generation of the Vsync-TE signal of the next image frame of the current image frame, the frame rate decision manager can control the next image frame to be drawn at the second frame rate according to the second time of generation of the Vsync-TE signal of the next image frame.

[0055] Optionally, the frame rate decision manager can back-calculate each drawing time point in the picture drawing process of the next image frame at the second frame rate according to the second generation time point of the Vsync-TE signal of the next image frame. Wherein, the display architecture in the electronic device of the present application defines that the working duration of each image frame at the first frame rate is equal to the working duration of the image frame at the second frame rate; the working duration includes a first working duration APP-WorkDuration and a second working duration SF-WorkDuration; the first working duration is the working duration APP-WorkDuration of the Vsync-APP signal of the image frame, and the second working duration is the working duration SF-WorkDuration of the Vsync-SF signal of the image frame. That is, the first working duration APP-WorkDuration of each image frame is equal, and the second working duration SF-WorkDuration of each image frame is also equal.

[0056] The display architecture in the electronic device also defines that the generation time of the Vsync-TE signal of each image frame minus the first working duration APP-WorkDuration can obtain the generation time of the Vsync-SF signal of the image frame; the generation time of the Vsync-TE signal of each image frame minus the first working duration APP-WorkDuration and minus the second working duration SF-WorkDuration can obtain the generation time of the Vsync-APP signal of the image frame. Therefore, the frame rate decision manager can determine the second generation time of the Vsync-TE signal of the next image frame, and combine the first working duration APP-WorkDuration and the second working duration SF-WorkDuration to back-calculate the drawing time of each image frame in the picture drawing process at the second frame rate. That is, the generation time of the Vsync-APP signal and the generation time of the Vsync-SF signal of the next image frame in the picture drawing process at the second frame rate are back-calculated. Further, the picture drawing at the second frame rate can be based on the generation time of the Vsync-APP signal and the generation time of the Vsync-SF signal of the next image frame. Wherein, the frame rate decision manager, after predicting the second generation time of the Vsync-TE signal of the next image frame of the current image frame, back-calculates the generation time of the Vsync-APP signal and the generation time of the Vsync-SF signal of the next image frame based on the first working duration APP-WorkDuration and the second working duration SF-WorkDuration defined in the display architecture in the electronic device. Therefore, the picture drawing at the second frame rate based on the generation time of the Vsync-APP signal and the generation time of the Vsync-SF signal of the next image frame, the first working duration APP-WorkDuration of each image frame in the obtained picture is equal, and the second working duration SF-WorkDuration of each image frame is also equal, so that there is no frame drop in the picture drawing process, and a smooth picture can be obtained.

[0057] In the embodiments of the present application, the electronic device receives a frame rate switching request at an initial image frame; the frame rate switching request is used to indicate that the refresh frame rate of the screen of the electronic device is switched from a first frame rate to a second frame rate; the refresh frame rate of the initial image frame is the first frame rate. At a current time point which is a preset number of frames after the initial image frame, in response to the frame rate switching request, a second generation time point of a Vsync-TE signal of a next image frame of the current image frame corresponding to the current time point is predicted according to the current time point, a first generation time point of the Vsync-TE signal of the current image frame corresponding to the current time point, a working duration of the image frame and the second frame rate. According to the second generation time point of the Vsync-TE signal of the next image frame, the next image frame is controlled to be drawn at the second frame rate.

[0058] Since the frame rate decision manager predicts the second generation time point of the Vsync-TE signal of the next image frame of the current image frame corresponding to the current time point by using the first generation time point of the Vsync-TE signal of the current image frame corresponding to the current time point, it can be known that the time information of the first generation time point is accurate, and therefore the predicted second generation time point of the Vsync-TE signal of the next image frame of the current image frame is also accurate. In addition, the display architecture in the electronic device of the present application defines that the working duration of each image frame at the first frame rate is equal to the working duration of the image frame at the second frame rate, and therefore the frame rate decision manager can accurately deduce each drawing time point in the drawing process of the next image frame at the second frame rate according to the second generation time point of the Vsync-TE signal of the next image frame, in combination with the first working duration APP-WorkDuration and the second working duration SF-WorkDuration.

[0059] Therefore, based on the generation time point of the Vsync-APP signal of the next image frame and the generation time point of the Vsync-SF signal, the drawing is performed at the second frame rate, and the first working duration APP-WorkDuration of each image frame in the obtained picture is equal, and the second working duration SF-WorkDuration of each image frame is also equal, so that no frame drop occurs in the drawing process, and a smooth picture can be obtained.

[0060] In the previous embodiment, the frame rate decision manager is described to predict the second generation time of the Vsync-TE signal of the next image frame corresponding to the current image frame at the current time, and to back-calculate each drawing time in the picture drawing process of the next image frame at the second frame rate. Then, the picture drawing process of the next image frame at the second frame rate is based on each drawing time. In the present embodiment, it is further described that the working duration of the image frame at the first frame rate is equal to the working duration of the image frame at the second frame rate; the working duration includes the first working duration and the second working duration; the first working duration is the working duration of the Vsync-APP signal of the image frame, and the second working duration is the working duration of the Vsync-SF signal of the image frame.

[0061] As shown in Figure 4 Step 340, according to the current time, the first generation time of the Vsync-TE signal of the current image frame corresponding to the current time, the working duration of the image frame, and the second frame rate, the second generation time of the Vsync-TE signal of the next image frame corresponding to the current image frame is predicted, including:

[0062] Step 342, the first working duration of the image frame and the second working duration of the image frame are obtained.

[0063] As shown in Figure 5 , it is a schematic diagram of the relationship between the Vsync signals of each image frame in an embodiment. Among them, the display architecture in the electronic equipment of the present application defines that the working duration of each image frame at the first frame rate is equal to the working duration of the image frame at the second frame rate; the working duration includes the first working duration APP-WorkDuration and the second working duration SF-WorkDuration; the first working duration is the working duration APP-WorkDuration of the Vsync-APP signal of the image frame, and the second working duration is the working duration SF-WorkDuration of the Vsync-SF signal of the image frame. That is, the first working duration APP-WorkDuration of each image frame is equal, and the second working duration SF-WorkDuration of each image frame is also equal.

[0064] And the display architecture in the electronic device also defines that the generation time of the Vsync-TE signal of each image frame minus the first working duration APP-WorkDuration can obtain the generation time of the Vsync-SF signal of the image frame; the generation time of the Vsync-TE signal of each image frame minus the first working duration APP-WorkDuration and minus the second working duration SF-WorkDuration can obtain the generation time of the Vsync-APP signal of the image frame.

[0065] Therefore, the electronic device can obtain the first working duration APP-WorkDuration of the image frame and the second working duration SF-WorkDuration of the image frame based on the display architecture. Here, the first working duration APP-WorkDuration of the image frame can be equal to the second working duration SF-WorkDuration of the image frame, or can not be equal, which is not limited in the present application.

[0066] Step 344, obtaining the first generation time of the Vsync-TE signal of the current image frame corresponding to the current time.

[0067] Since the refresh frame rate switching is not performed in the drawing period of the current image frame corresponding to the current time, the first generation time te_last of the Vsync-TE signal of the current image frame is still calculated based on the Vsync model corresponding to the first frame rate. Then, the first generation time te_last of the Vsync-TE signal of the current image frame corresponding to the current time can be calculated based on the Vsync model corresponding to the first frame rate.

[0068] In combination with Figure 6As shown, it is a timing diagram for frame rate switching for a screen in an embodiment of the present application. The first row of Vsync-APP signals in the timing diagram includes two rows of signals, representing the main thread and the rendering thread of each frame respectively. The second row of Vsync-SF / Vsync-HWC signals in the timing diagram represents the display time length of each frame. The third row of Vsync-TE signals in the timing diagram represents the display time length (referred to as the on-screen time length) of each frame on the screen. It is assumed that a frame rate switching request for the screen is received at the B frame, which is used to indicate that the frame rate of the screen is switched from 120Hz to 90Hz. After the behavior of initiating the switching of the refresh frame rate for the screen, it is generally necessary to pass through several frames before a new Vsync model is reconstructed. At the current time t, it is obvious that the new Vsync model has not been constructed at this time, and the first generation time te last of the Vsync-TE signal of the current image frame (C frame) corresponding to the current time t can be selected to predict the generation time of the Vsync-TE signal of the D frame.

[0069] Since the refresh frame rate switching is not performed within the drawing period of the C frame corresponding to the current time t, the first generation time te last of the Vsync-TE signal of the C frame is still calculated based on the Vsync model corresponding to the first frame rate. It can be known that the time information of the first generation time te last of the Vsync-TE signal of the C frame is accurate, and therefore the predicted second generation time te now of the Vsync-TE signal of the D frame is also accurate.

[0070] Step 346, predicting the second generation time of the Vsync-TE signal of the next image frame of the current image frame according to the current time, the first generation time, the first working duration of the image frame, the second working duration of the image frame, and the second frame rate.

[0071] Then, the second generation time te now of the Vsync-TE signal of the next image frame of the current image frame can be accurately predicted based on the operation relationship between the current time, the first generation time, the first working duration of the image frame, the second working duration of the image frame, the second frame rate, and the second generation time of the Vsync-TE signal of the next image frame of the current image frame defined by the display architecture in the electronic device of the present application.

[0072] In the embodiments of the present application, the electronic device obtains a first working duration of an image frame, a second working duration of the image frame, and then obtains a first generation time of a Vsync-TE signal of a current image frame corresponding to a current time. Finally, according to an operation relationship between the current time, the first generation time, the first working duration of the image frame, the second working duration of the image frame, and a second generation time of a Vsync-TE signal of a next image frame of the current image frame defined by a display architecture in the electronic device and a second frame rate, the second generation time te_now of the Vsync-TE signal of the next image frame of the current image frame can be accurately predicted.

[0073] Further, according to the second generation time of the Vsync-TE signal of the next image frame, in combination with the first working duration APP-WorkDuration and the second working duration SF-WorkDuration, each drawing time in the picture drawing process of the next image frame at the second frame rate can be accurately deduced.

[0074] In the previous embodiment, the process of how the electronic device accurately predicts the second generation time te_now of the Vsync-TE signal of the next image frame of the current image frame is described. In the present embodiment, step 344 of obtaining the first generation time of the Vsync-TE signal of the current image frame corresponding to the current time is further described, which includes:

[0075] According to the Vsync model corresponding to the first frame rate, the first generation time of the Vsync-TE signal of the current image frame corresponding to the current time is obtained.

[0076] In combination with Figure 6 As shown in FIG. 6, since no refresh frame rate switching is performed within the drawing period of the C frame corresponding to the current time t, the first generation time te_last of the Vsync-TE signal of the C frame is still calculated based on the Vsync model corresponding to the first frame rate. Then, the first generation time of the Vsync-TE signal of the current image frame corresponding to the current time can be obtained according to the Vsync model corresponding to the first frame rate.

[0077] The Vsync model corresponding to the first frame rate can be simulated by using a linear regression algorithm with xi and yi of a historical preset number of frames corresponding to the first frame rate as independent variables and dependent variables respectively, and the prediction formula y=kx+b obtained is the Vsync model. Then, the calculation time of the C frame is input into the Vsync model corresponding to the first frame rate, and the first generation time te_last of the Vsync-TE signal of the C frame can be obtained.

[0078] In the embodiments of the present application, since the refresh frame rate is not switched in the drawing period of the C frame corresponding to the current time t, the first generation time te last of the Vsync-TE signal of the C frame is still calculated based on the Vsync model corresponding to the first frame rate. Then, the first generation time of the Vsync-TE signal of the current image frame corresponding to the current time can be obtained according to the Vsync model corresponding to the first frame rate. It can be known that the time information of the first generation time te last of the Vsync-TE signal of the C frame is accurate, and therefore, the second generation time te now of the Vsync-TE signal of the D frame predicted based on the time information of the first generation time te last of the Vsync-TE signal of the C frame is also accurate.

[0079] In the previous embodiment, the process of obtaining the first generation time of the Vsync-TE signal of the current image frame corresponding to the current time according to the Vsync model corresponding to the first frame rate is described. In the present embodiment, step 346 is further described, which comprises:

[0080] calculating an integral result according to the current time, the first generation time, the first working duration, the second working duration, and the second period corresponding to the second frame rate;

[0081] predicting the second generation time of the Vsync-TE signal of the next image frame of the current image frame according to the integral result, the second period, and the first generation time.

[0082] In the foregoing embodiments, the operation relationship between the current time, the first generation time, the first working duration, the second working duration, the second frame rate, and the second generation time of the Vsync-TE signal of the next image frame of the current image frame defined based on the display architecture in the electronic device of the present application is described, and the second generation time te now of the Vsync-TE signal of the next image frame of the current image frame can be accurately predicted.

[0083] Optionally, the frame rate decision manager of the electronic device can calculate an integral result according to the current time, the first generation time, the first working duration, the second working duration, and the second period corresponding to the second frame rate. For example, the weighted sum of the current time, the first working duration, and the second working duration can be obtained first. Here, the current time, the first working duration, and the second working duration can be respectively set with weights, and the weighted sum of the current time, the first working duration, and the second working duration can be calculated. Further, the difference between the weighted sum and the first generation time is obtained, and the integral result of the ratio of the difference to the second period corresponding to the second frame rate is obtained. Exemplarily, the integral result z can be calculated by using the following formula (3):

[0084] z = flow(t + tw + tr - te last) / p (3)

[0085] wherein t represents the current time, tw represents the first working duration of the image frame, tr represents the second working duration of the image frame, te last represents the first generation time of the Vsync-TE signal of the current image frame, and p represents the second period corresponding to the second frame rate.

[0086] Then, the second generation time of the Vsync-TE signal of the next image frame of the current image frame is predicted according to the integral result and the second period, the first generation time. The second period P2 is the period corresponding to the second frame rate fps2, for example, if the second frame rate fps2 is 90 hz, the second period P2 is about 11.11 ms; if the second frame rate fps2 is 120 hz, the second period P2 is about 8.33 ms. For example, the product of the integral result and the second period can be obtained, and the weighted sum of the product and the second period is obtained. The weighted sum of the product and the second period and the weighted sum of the first generation time are obtained, and the weighted sum is taken as the second generation time te now. Exemplarily, the second generation time te now can be calculated by using the following formula (4):

[0087] te now = te last + z * p + p (4)

[0088] wherein te now is the second generation time of the Vsync-TE signal of the next image frame of the current image frame, and z represents the integral result and p represents the second period corresponding to the second frame rate.

[0089] In the embodiment, the frame rate decision manager of the electronic device can first calculate an integral result according to the current time, the first generation time, the first working duration, the second working duration, and the second period corresponding to the second frame rate, and then predict the second generation time of the Vsync-TE signal of the next image frame of the current image frame according to the integral result, the second period, and the first generation time. Since the first generation time of the Vsync-TE signal of the current image frame corresponding to the current time is used when calculating the integral result, the time information of the first generation time is accurate, and therefore the accuracy of the calculated integral result is high, and the second generation time of the Vsync-TE signal of the next image frame of the current image frame predicted based on the integral result is also accurate.

[0090] In the previous embodiment, the process of predicting the second generation time of the Vsync-TE signal of the next image frame of the current image frame is described. In this embodiment, the process of predicting the second generation time of the Vsync-TE signal of the next image frame of the current image frame according to the integral result, the second period, and the first generation time is further described, including:

[0091] obtaining a product of the integral result and the second period, and obtaining a weighted sum of the product and the second period;

[0092] obtaining a weighted sum of the product and the second period and a weighted sum of the first generation time, and taking the weighted sum as the second generation time.

[0093] After the integral result is calculated according to the current time, the first generation time, the first working duration, the second working duration, and the second period corresponding to the second frame rate, the frame rate decision manager of the electronic device can obtain a product of the integral result and the second period, and obtain a weighted sum of the product and the second period. Here, weights can be set for the product and the second period respectively, and then the weighted sum of the product and the second period is calculated. Then, a weighted sum of the weighted sum of the product and the second period and the first generation time can be further obtained, and the weighted sum is taken as the second generation time. That is, weights can be set for the weighted sum of the product and the second period and the first generation time respectively, and the weighted sum is calculated again to obtain the second generation time.

[0094] Exemplarily, the following formula (5) can be used to calculate the second generation time te_now:

[0095] te_now = te_last + floor ((t + tw + tr - te_last) / p + 1) * p (5)

[0096] The definitions of the parameters in formula (5) are as defined in formula (3) and formula (4) above, and will not be repeated here.

[0097] In the embodiment, the frame rate decision manager of the electronic device can obtain the product of the rounding result and the second period, and obtain the weighted sum of the product and the second period. Then, the weighted sum of the product and the second period and the first generation time of the Vsync-TE signal of the current image frame corresponding to the current time are obtained, and the weighted sum is taken as the second generation time of the Vsync-TE signal of the next image frame of the current image frame. Since the frame rate decision manager adopts the first generation time of the Vsync-TE signal of the current image frame corresponding to the current time to predict the second generation time of the Vsync-TE signal of the next image frame of the current image frame corresponding to the current time, it can be known that the time information of the first generation time is accurate, and thus the predicted second generation time of the Vsync-TE signal of the next image frame of the current image frame is also accurate.

[0098] In the previous embodiment, the process of predicting the second generation time of the Vsync-TE signal of the next image frame of the current image frame is described. As shown in FIG. 3, in the embodiment, step 360 is further described, that is, according to the second generation time of the Vsync-TE signal of the next image frame, the next image frame is controlled to be drawn at the second frame rate, including: Figure 7

[0099] Step 362, according to the second generation time of the Vsync-TE signal of the next image frame, the first working duration and the second working duration, the drawing time of the next image frame is determined.

[0100] In the embodiment, the display architecture in the electronic device is defined, that is, the working duration of each image frame at the first frame rate is equal to the working duration of the image frame at the second frame rate; the working duration includes the first working duration APP-WorkDuration and the second working duration SF-WorkDuration; the first working duration is the working duration APP-WorkDuration of the Vsync-APP signal of the image frame, and the second working duration is the working duration SF-WorkDuration of the Vsync-SF signal of the image frame. That is, the first working duration APP-WorkDuration of each image frame is equal, and the second working duration SF-WorkDuration of each image frame is also equal.

[0101] ​The display architecture in the electronic device also defines that the generation time of the Vsync-SF signal of each image frame can be obtained by subtracting the first working duration APP-WorkDuration from the generation time of the Vsync-TE signal of the image frame; and the generation time of the Vsync-APP signal of each image frame can be obtained by subtracting the first working duration APP-WorkDuration and the second working duration SF-WorkDuration from the generation time of the Vsync-TE signal of the image frame. Therefore, the frame rate decision manager can inversely deduce the drawing time of each drawing process in the picture drawing process of the next image frame (D frame) at the second frame rate according to the second generation time of the Vsync-TE signal of the next image frame (D frame) in combination with the first working duration APP-WorkDuration and the second working duration SF-WorkDuration. That is, the generation time of the Vsync-APP signal and the generation time of the Vsync-SF signal in the picture drawing process of the next image frame (D frame) at the second frame rate are inversely deduced.

[0102] At step 364, the picture drawing of the next image frame at the second frame rate is controlled according to the drawing time of the next image frame.

[0103] In combination with Figure 6 As shown in FIG. 6, the picture drawing at the second frame rate can be performed based on the generation time of the Vsync-APP signal and the generation time of the Vsync-SF signal of the next image frame (D frame). After the frame rate decision manager predicts the second generation time of the Vsync-TE signal of the next image frame (D frame) of the current image frame, the generation time of the Vsync-APP signal and the generation time of the Vsync-SF signal of the next image frame (D frame) are inversely deduced based on the first working duration APP-WorkDuration and the second working duration SF-WorkDuration defined in the display architecture in the electronic device. Therefore, the picture drawing at the second frame rate based on the generation time of the Vsync-APP signal and the generation time of the Vsync-SF signal of the next image frame (D frame) can make the first working duration APP-WorkDuration of each image frame in the obtained picture equal, and the second working duration SF-WorkDuration of each image frame also equal, so that no frame drop occurs in the picture drawing process, and thus a smooth picture can be obtained.

[0104] In the embodiment of the present application, since the frame rate decision manager adopts the first generation time of the Vsync-TE signal of the current image frame corresponding to the current time in predicting the second generation time of the Vsync-TE signal of the next image frame of the current image frame corresponding to the current time, it can be known that the time information of the first generation time is accurate, and thus the predicted second generation time of the Vsync-TE signal of the next image frame of the current image frame is also accurate. In combination with the relationship between the first working duration APP-WorkDuration of each image frame, the relationship between the second working duration SF-WorkDuration of each image frame, and the relationship between the generation time of the Vsync-TE signal of each image frame and the APP-WorkDuration and SF-WorkDuration, and the relationship between the generation time of the Vsync-APP signal of each image frame and the APP-WorkDuration and SF-WorkDuration, the drawing time of the next image frame can be accurately determined.

[0105] Further, according to the drawing time of the next image frame, the next image frame is controlled to be drawn at the second frame rate, and in the obtained picture, the first working duration APP-WorkDuration of each image frame is equal, and the second working duration SF-WorkDuration of each image frame is also equal, so that frame dropping does not occur in the picture drawing process, and thus a smooth picture can be obtained.

[0106] In the previous embodiment, the process of determining the drawing time of the next image frame according to the second generation time, the first working duration and the second working duration of the Vsync-TE signal of the next image frame, and controlling the next image frame to be drawn at the second frame rate according to the drawing time of the next image frame is described. In the present embodiment, it is further described that the drawing time includes a rendering time, a composition time and a display time; the drawing time of the next image frame is determined according to the second generation time, the first working duration and the second working duration of the Vsync-TE signal of the next image frame, including:

[0107] obtaining a first difference result of the second generation time and the second working duration of the Vsync-TE signal of the next image frame, and taking the first difference result as the composition time of the next image frame;

[0108] obtaining a second difference result of the first difference result and the first working duration, and taking the second difference result as the rendering time of the next image frame;

[0109] taking the second generation time as the display time of the next image frame.

[0110] The display architecture in the electronic device also defines that the generation time of the Vsync-TE signal of each image frame minus the first working duration APP-WorkDuration can obtain the generation time of the Vsync-SF signal of the image frame; the generation time of the Vsync-TE signal of each image frame minus the first working duration APP-WorkDuration and minus the second working duration SF-WorkDuration can obtain the generation time of the Vsync-APP signal of the image frame.

[0111] Therefore, the frame rate decision manager can calculate a first difference result of the second generation time te_now of the Vsync-TE signal of the next image frame (D frame) and the second working duration SF-WorkDuration, and take the first difference result as the composition time of the next image frame. Exemplarily, the composition time of the next image frame (D frame) can be calculated by using the following formula (6):

[0112] Tsf = te_now - tw (6)

[0113] Wherein, Tsf represents the composition time of the D frame, in other words, Tsf represents the generation time of the Vsync-SF signal of the D frame; tw represents the SF-WorkDuration of the D frame.

[0114] Then, a second difference result is calculated by the first difference result and the first working duration APP-WorkDuration, and the second difference result is taken as the rendering time of the next image frame. Exemplarily, the rendering time of the next image frame (D frame) can be calculated by using the following formula (7):

[0115] Tapp = te_now - tr - tw (7)

[0116] Wherein, Tapp represents the rendering time of the D frame, in other words, Tapp represents the generation time of the Vsync-APP signal of the D frame; tr represents the APP-WorkDuration of the D frame.

[0117] Finally, the second generation time te_now of the Vsync-TE signal of the next image frame is taken as the display time of the next image frame.

[0118] In the embodiment, the frame rate decision manager can determine the drawing time of the next image frame (D frame) in the picture drawing process at the second frame rate according to the second generation time of the Vsync-TE signal of the next image frame (D frame), in combination with the first working duration APP-WorkDuration and the second working duration SF-WorkDuration. That is, the generation time of the Vsync-APP signal and the generation time of the Vsync-SF signal in the picture drawing process of the next image frame (D frame) at the second frame rate are determined.

[0119] In the previous embodiment, the process of determining the rendering time, the composition time and the display time of the next image frame of the current image frame is described. In this embodiment, the control of the picture drawing of the next image frame at the second frame rate according to the drawing time of the next image frame is further described, including:

[0120] rendering the image data of the next image frame at the second frame rate according to the rendering time to obtain a rendering result of the next image frame;

[0121] composing the rendering result of the next image frame at the second frame rate according to the composition time to obtain a composition result of the next image frame;

[0122] displaying the composition result of the next image frame at the second frame rate according to the display time to obtain a display result of the next image frame.

[0123] Optionally, in the process of displaying the picture on the screen, the picture data is first rendered by the rendering thread to obtain a rendering result, then the rendering result is composed by the composition thread to obtain a composition result, and finally the composition result is displayed by the display thread to obtain a display result of the picture data. Therefore, if the next image frame needs to be displayed on the screen, first, the image data of the next image frame is rendered at the second frame rate according to the rendering time Tapp of the next image frame (D frame) to obtain a rendering result of the next image frame. Since the first working duration APP-WorkDuration of each image frame is equal, and the second working duration SF-WorkDuration of each image frame is also equal, the next image frame (D frame) will not be rendered in the APP-WorkDuration time, resulting in missing the generation time of the next Vsync-SF signal and delaying the on-screen display, so that the display picture appears to be stuck.

[0124] Secondly, the rendering result of the next image frame is composed at the second frame rate according to the composition time Tsf of the next image frame (D frame) to obtain a composition result of the next image frame.

[0125] Finally, the synthesis result of the next image frame is displayed at the second frame rate according to a display time te now of the next image frame (D frame), to obtain a display result of the next image frame.

[0126] In the embodiment, during the process of controlling the next image frame to perform screen drawing at the second frame rate according to the drawing time of the next image frame, first, the image data of the next image frame is rendered at the second frame rate according to the rendering time, to obtain a rendering result of the next image frame. Second, the rendering result of the next image frame is synthesized at the second frame rate according to the synthesis time, to obtain a synthesis result of the next image frame. Finally, the synthesis result of the next image frame is displayed at the second frame rate according to the display time, to obtain a display result of the next image frame.

[0127] Since the first working duration APP-WorkDuration of each image frame is equal, and the second working duration SF-WorkDuration of each image frame is also equal, the next image frame (D frame) will not be rendered incompletely within the APP-WorkDuration time, so as to miss the generation time of the next Vsync-SF signal and delay the on-screen display, and thus the display screen will not appear to be stuck.

[0128] In an exemplary embodiment, as shown in Figure 8 A frame rate switching method is provided, applied to an electronic device, including:

[0129] Step 802, if a preset operation such as application opening or application switching, scene switching in the application, etc. is detected by the window manager, a frame rate switching request is triggered;

[0130] Step 804, the frame rate switching request is received at the initial image frame (B frame);

[0131] Step 806, at a current time t which is separated from the initial image frame (B frame) by a preset number of frames (n-1 frames), the first working duration of the image frame and the second working duration of the image frame are obtained in response to the frame rate switching request;

[0132] Step 808, the first generation time of the Vsync-TE signal of the current image frame (D frame) corresponding to the current time t is obtained;

[0133] Step 810, the second generation time of the Vsync-TE signal of the next image frame (E frame) of the current image frame (D frame) is predicted by using the above formula (5) according to the current time t, the first generation time, the first working duration of the image frame, the second working duration of the image frame, and the second frame rate;

[0134] Step 812, obtaining a first difference result of the second generation moment of the Vsync-TE signal of the next image frame (E frame) and the second working duration, taking the first difference result as a composition moment of the next image frame (E frame);

[0135] Step 814, obtaining a second difference result of the first difference result and the first working duration, taking the second difference result as a rendering moment of the next image frame (E frame);

[0136] Step 816, taking the second generation moment as a display moment of the next image frame (E frame);

[0137] Step 818, rendering image data of the next image frame (E frame) according to the rendering moment at a second frame rate to obtain a rendering result of the next image frame (E frame);

[0138] Step 820, composing the rendering result of the next image frame according to the composition moment at the second frame rate to obtain a composition result of the next image frame (E frame);

[0139] Step 822, displaying the composition result of the next image frame according to the display moment at the second frame rate to obtain a display result of the next image frame (E frame).

[0140] In combination Figure 9 As shown in FIG. 8, it is a timing diagram for frame rate switching of a screen in another embodiment of the present application. It is assumed that a frame rate switching request for the screen is received at B frame, which is used to indicate that the frame rate of the screen is switched from 120 Hz to 90 Hz. After the behavior of switching the refresh frame rate for the screen is initiated, it is generally necessary to pass several frames before a new Vsync model is reconstructed. At the current time t, it is obvious that the new Vsync model has not been constructed at this time, and the first generation moment te_last of the Vsync-TE signal of the current image frame (D frame) corresponding to the current time t can be selected to predict the second generation moment of the Vsync-TE signal of the E frame which is separated by a preset number of frames (n-1 frames) from the initial image frame.

[0141] In the embodiment of the present application, since the refresh frame rate is not switched within the drawing period of the D frame corresponding to the current time t, the first generation moment te_last of the Vsync-TE signal of the D frame is still calculated based on the Vsync model corresponding to the first frame rate. It can be known that the time information of the first generation moment te_last of the Vsync-TE signal of the D frame is accurate, and therefore the predicted second generation moment te_now of the Vsync-TE signal of the E frame is also accurate.

[0142] Further, the second generation time of the Vsync-TE signal of the E frame, in combination with the first working duration APP-WorkDuration and the second working duration SF-WorkDuration, can be used to accurately deduce the drawing time of each frame during the picture drawing process of the E frame at the second frame rate.

[0143] Therefore, based on the generation time of the Vsync-APP signal of the E frame, the generation time of the Vsync-SF signal, and the picture drawing at the second frame rate, the first working duration APP-WorkDuration of each image frame in the obtained picture is equal, and the second working duration SF-WorkDuration of each image frame is also equal, so that frame dropping does not occur during the picture drawing process, and a smooth picture can be obtained.

[0144] It should be understood that although each step in the above flowchart is displayed in sequence according to the arrow, these steps are not necessarily executed in the order indicated by the arrow. Unless otherwise specified herein, the execution of these steps is not strictly limited in sequence, and these steps can be executed in other orders. Moreover, at least part of the steps in the above flowchart can include multiple sub-steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily sequential, but can be executed in rotation or alternation with at least part of other steps or sub-steps or stages of other steps.

[0145] Based on the same inventive concept, as shown in Figure 10 In this embodiment, a frame rate switching device 1000 is further described, which comprises:

[0146] The receiving module 1020 is configured to receive a frame rate switching request for an initial image frame; the frame rate switching request is used to indicate that the refresh frame rate of the screen of the electronic device is switched from a first frame rate to a second frame rate; the refresh frame rate of the initial image frame is the first frame rate.

[0147] The prediction module 1040 is configured to, at a current time point that is spaced apart from the initial image frame by a preset number of frames, in response to the frame rate switching request, predict a second generation time of a Vsync-TE signal of a next image frame of a current image frame according to the current time point, a first generation time of the Vsync-TE signal of the current image frame corresponding to the current time point, a working duration of the image frame, and the second frame rate.

[0148] The control module 1060 is configured to control the next image frame to be drawn at the second frame rate according to the second generation time of the Vsync-TE signal of the next image frame.

[0149] In one embodiment, the working duration of the image frame at the first frame rate is equal to the working duration of the image frame at the second frame rate; the working duration includes the first working duration and the second working duration; the first working duration is the working duration of the Vsync-APP signal of the image frame, and the second working duration is the working duration of the Vsync-SF signal of the image frame.

[0150] As shown in FIG. 10, the prediction module 1040 includes: Figure 11

[0151] The working duration acquisition unit 1042 is configured to acquire the first working duration of the image frame and the second working duration of the image frame.

[0152] The first generation time acquisition unit 1044 is configured to acquire the first generation time of the Vsync-TE signal of the current image frame corresponding to the current time.

[0153] The second generation time acquisition unit 1046 is configured to predict the second generation time of the Vsync-TE signal of the next image frame of the current image frame according to the current time, the first generation time, the first working duration of the image frame, the second working duration of the image frame, and the second frame rate.

[0154] In one embodiment, the first generation time acquisition unit 1044 is further configured to acquire the first generation time of the Vsync-TE signal of the current image frame corresponding to the current time according to the Vsync model corresponding to the first frame rate.

[0155] In one embodiment, the second generation time acquisition unit 1046 is further configured to calculate an integer result according to the current time, the first generation time, the first working duration, the second working duration, and the second period corresponding to the second frame rate; and predict the second generation time of the Vsync-TE signal of the next image frame of the current image frame according to the integer result, the second period, and the first generation time.

[0156] In one embodiment, the second generation time acquisition unit 1046 is further configured to acquire a weighted sum of the current time, the first working duration, and the second working duration; acquire a difference value between the weighted sum and the first generation time; and acquire an integer result of a ratio of the difference value to the second period corresponding to the second frame rate.

[0157] In one embodiment, the second generation time acquisition unit 1046 is further configured to acquire a product of the integer result and the second period, acquire a weighted sum of the product and the second period, and acquire a weighted sum of the product and the second period and the first generation time, and take the weighted sum as the second generation time.

[0158] In one embodiment, the control module 1060 includes:​

[0159] determining a drawing time of the next image frame according to the second generation time of the Vsync-TE signal of the next image frame, the first working duration and the second working duration;

[0160] controlling the next image frame to perform picture drawing at the second frame rate according to the drawing time of the next image frame.

[0161] In one embodiment, the drawing time determining unit is further configured to obtain a first difference result of the second generation time of the Vsync-TE signal of the next image frame and the second working duration, take the first difference result as a composition time of the next image frame; obtain a second difference result of the first difference result and the first working duration, take the second difference result as a rendering time of the next image frame; and take the second generation time as a display time of the next image frame.

[0162] In one embodiment, the picture drawing unit is configured to control image data of the next image frame to perform rendering at the second frame rate according to the rendering time, to obtain a rendering result of the next image frame; control the rendering result of the next image frame to perform composition at the second frame rate according to the composition time, to obtain a composition result of the next image frame; and control the composition result of the next image frame to perform display at the second frame rate according to the display time, to obtain a display result of the next image frame.

[0163] The division of each module in the above frame rate switching device is only used for illustration, and in other embodiments, the frame rate switching device can be divided into different modules as needed to complete all or part of the functions of the above frame rate switching device.

[0164] The specific limitations of the frame rate switching device can refer to the limitations of the frame rate switching method in the above, which will not be repeated here. Each module in the above frame rate switching device can be realized by software, hardware and their combinations in whole or in part. Each module can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory in the computer device in software form, so as to be called and executed by the processor to perform the operations corresponding to each module.

[0165] Figure 12Fig. 1 is a schematic diagram of an internal structure of an electronic device according to an embodiment. The electronic device can be any terminal device such as a mobile phone, a tablet computer, a notebook computer, a desktop computer, a PDA (Personal Digital Assistant), a POS (Point of Sales), a vehicle-mounted computer, a wearable device, etc. The electronic device includes a processor and a memory connected through a system bus. The processor can include one or more processing units. The processor can be a CPU (Central Processing Unit) or a DSP (Digital Signal Processor), etc. The memory can include a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The computer program can be executed by the processor to implement a frame rate switching method provided by each of the embodiments. The internal memory provides a cache running environment for the operating system and the computer program in the non-volatile storage medium.

[0166] The implementation of each module in the frame rate switching device provided in the embodiments of the present application can be in the form of a computer program. The computer program can run on the electronic device. The program modules constituted by the computer program can be stored on the memory of the electronic device. When the computer program is executed by the processor, the steps of the method described in the embodiments of the present application are implemented.

[0167] The embodiments of the present application further provide a computer readable storage medium. One or more non-volatile computer readable storage media containing computer executable instructions, when the computer executable instructions are executed by one or more processors, cause the processors to perform the steps of the frame rate switching method.

[0168] The embodiments of the present application further provide a computer program product containing instructions, when the computer program product runs on a computer, causes the computer to perform the frame rate switching method.

[0169] As used herein, any reference to memory, storage, a database or other medium can include non-volatile and / or volatile storage. Non-volatile storage can include ROM (Read-Only Memory), PROM (Programmable Read-only Memory), EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electrically Erasable Programmable Read-Only Memory), or flash memory. Volatile storage can include RAM (Random Access Memory), which acts as external cache. By way of illustration and not limitation, RAM is available in many forms such as SRAM (Static Random Access Memory), DRAM (Dynamic Random Access Memory), SDRAM (Synchronous Dynamic Random Access Memory), double data rate DDR SDRAM (Double Data Rate Synchronous Dynamic Random Access memory), enhanced SDRAM (ESDRAM), SyncLink DRAM (SLDRAM), RDRAM (Rambus Dynamic Random Access Memory), direct Rambus DRDRAM (Direct Rambus Dynamic Random Access Memory).

[0170] The above embodiments only express several implementation manners of the present application, and the description is relatively specific and detailed, but it cannot be understood as a limitation on the patent scope of the present application. It should be noted that, for those skilled in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the patent protection scope of the present application should be subject to the appended claims.

Claims

1. A frame rate conversion method, characterized by, The method is applied to an electronic device, and the method comprises: receiving a frame rate switching request in a rendering stage of an initial image frame; the frame rate switching request is used to indicate that a refresh frame rate of a screen of the electronic device is switched from a first frame rate to a second frame rate; a refresh frame rate of the initial image frame is the first frame rate; at a current time corresponding to a current image frame which is spaced by a preset number of frames after the initial image frame, in response to the frame rate switching request and according to the first frame rate, acquiring a first generation time of a Vsync-TE signal of the current image frame, according to the current time, the first generation time, a working duration of an image frame and the second frame rate, predicting a second generation time of a Vsync-TE signal of a next image frame of the current image frame; controlling the next image frame to perform picture drawing at the second frame rate according to the second generation time of the Vsync-TE signal of the next image frame.

2. The method of claim 1, wherein, The working duration of the image frame at the first frame rate is equal to the working duration of the image frame at the second frame rate; the working duration comprises a first working duration and a second working duration; the first working duration is a working duration of a Vsync-APP signal of the image frame, and the second working duration is a working duration of a Vsync-SF signal of the image frame; The method for predicting the second generation time of the Vsync-TE signal of the next image frame of the current image frame according to the current time, the first generation time, the working duration of the image frame and the second frame rate comprises: acquiring the first working duration of the image frame and the second working duration of the image frame; predicting the second generation time of the Vsync-TE signal of the next image frame of the current image frame according to the current time, the first generation time, the first working duration of the image frame, the second working duration of the image frame and the second frame rate.

3. The method of claim 2, wherein, The method for acquiring the first generation time of the Vsync-TE signal of the current image frame according to the first frame rate comprises: acquiring the first generation time of the Vsync-TE signal of the current image frame corresponding to the current time according to a Vsync model corresponding to the first frame rate.

4. The method according to claim 2 or 3, characterized in that, The method for predicting the second generation time of the Vsync-TE signal of the next image frame of the current image frame according to the current time, the first generation time, the first working duration of the image frame, the second working duration of the image frame and the second frame rate comprises: calculating an integral result according to a second period corresponding to the current time, the first generation time, the first working duration, the second working duration and the second frame rate; predicting the second generation time of the Vsync-TE signal of the next image frame of the current image frame according to the integral result, the second period, the first generation time.

5. The method of claim 4, wherein, The calculating an integral result according to the current time, the first generation time, the first working duration, the second working duration and a second period corresponding to the second frame rate comprises: obtaining a weighted sum of the current time, the first working duration and the second working duration; obtaining a difference between the weighted sum and the first generation time, and obtaining an integral result of a ratio of the difference to the second period corresponding to the second frame rate.

6. The method of claim 4, wherein, The predicting a second generation time of a Vsync-TE signal of a next image frame of the current image frame according to the integral result, the second period and the first generation time comprises: obtaining a product of the integral result and the second period, and obtaining a weighted sum of the product and the second period; obtaining a weighted sum of the product and the second period and a weighted sum of the first generation time, and taking the weighted sum as the second generation time.

7. The method of claim 2 or 3, wherein, The controlling the next image frame to be drawn at the second frame rate according to the second generation time of the Vsync-TE signal of the next image frame comprises: determining a drawing time of the next image frame according to the second generation time of the Vsync-TE signal of the next image frame, the first working duration and the second working duration; controlling the next image frame to be drawn at the second frame rate according to the drawing time of the next image frame.

8. The method of claim 7, wherein, The drawing time comprises a rendering time, a synthesis time and a display time; and the determining the drawing time of the next image frame according to the second generation time of the Vsync-TE signal of the next image frame, the first working duration and the second working duration comprises: obtaining a first difference result of the second generation time of the Vsync-TE signal of the next image frame and the second working duration, and taking the first difference result as the synthesis time of the next image frame; obtaining a second difference result of the first difference result and the first working duration, and taking the second difference result as the rendering time of the next image frame; taking the second generation time as the display time of the next image frame.

9. The method of claim 8, wherein, The controlling the next image frame to be drawn at the second frame rate according to the drawing time of the next image frame comprises: controlling image data of the next image frame to be rendered at the second frame rate according to the rendering time, to obtain a rendering result of the next image frame; controlling the rendering result of the next image frame to be synthesized at the second frame rate according to the synthesis time, to obtain a synthesis result of the next image frame; controlling the synthesis result of the next image frame to be displayed at the second frame rate according to the display time, to obtain a display result of the next image frame.

10. A frame rate conversion apparatus characterized by comprising: The device is applied to an electronic device, and the device comprises: a receiving module configured to receive a frame rate switching request in a rendering stage of an initial image frame; the frame rate switching request is used to indicate that a refresh frame rate of a screen of the electronic device is switched from a first frame rate to a second frame rate; the refresh frame rate of the initial image frame is the first frame rate; a prediction module, configured to, in response to the frame rate switching request and according to a first generation time of a Vsync-TE signal of a current image frame corresponding to a current time interval of a preset number of frames after the initial image frame, predict a second generation time of a Vsync-TE signal of a next image frame of the current image frame according to the current time interval, the first generation time, a working duration of an image frame and a second frame rate; a control module, configured to control the next image frame to be drawn at the second frame rate according to the second generation time of the Vsync-TE signal of the next image frame.

11. An electronic device comprising a memory and a processor, said memory having stored therein a computer program, characterised in that, The computer program, when executed by the processor, causes the processor to perform the steps of the frame rate switching method according to any one of claims 1 to 9.

12. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program, when executed by the processor, implements the steps of the frame rate switching method according to any one of claims 1 to 9.

13. A computer program product comprising a computer program, characterized in that, The computer program, when executed by the processor, implements the steps of the frame rate switching method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Frame rate control method, device thereof, storage medium and terminal

    CN109157839A

  • Input response method and device, electronic equipment and computer readable storage medium

    CN111124230A