Frame rate switching method and device, electronic equipment, storage medium and product
By predicting and controlling the Vsync-TE signal generation moment of the image frame, the frame drop problem caused by frame rate switching in traditional methods is solved, and the picture smooth effect is achieved.
Patent Information
- Application Number
- CN202311134302.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-04
- Publication Date
- 2025-03-04
- Estimated Expiration
- 2043-09-04
AI Technical Summary
Traditional methods are prone to frame drops during the screen frame rate switching process, resulting in stuttering of the display screen.
After receiving the frame rate switching request in the initial image frame, the second generation time of the Vsync-TE signal of the next image frame of the current image frame is predicted, and the next image frame is controlled to perform picture drawing at the target frame rate according to the time.
Effectively avoid frame drops and ensures picture fluency.
Smart Images

Figure CN119559920A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of screen display technology, and in particular to a frame rate switching method, device, electronic device, storage medium, and product. Background Art
[0002] With the rapid development of electronic device related technologies, the screens of electronic devices can support a variety of different refresh frame rates, for example, 60 Hz, 90 Hz, 120 Hz or even higher refresh frame rates. In different application scenarios, the screen may need to switch the refresh frame rate.
[0003] However, in the process of switching the refresh frame rate of the screen, the traditional method is prone to frame drops, which in turn causes the display screen to become stuck. Summary of the invention
[0004] The embodiments of the present application provide a frame rate switching method, device, electronic device, and computer-readable storage medium, which can avoid frame drops and thus obtain a smooth picture.
[0005] In one aspect, a frame rate switching method is provided, which is applied to an electronic device, and the method includes:
[0006] receiving a frame rate switching request in an initial image frame; the frame rate switching request is used to instruct the refresh frame rate of the electronic device screen to switch 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 moment which is a preset number of frames after the initial image frame, in response to the frame rate switching request, predicting a second generation time of the Vsync-TE signal of the next image frame of the current image frame according to the current moment, the first generation time of the Vsync-TE signal of the current image frame corresponding to the current moment, the working duration of the image frame, and the second frame rate;
[0008] 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.
[0009] On the other hand, a frame rate switching device is provided, which is applied to an electronic device, and the device includes:
[0010] A receiving module, configured to receive a frame rate switching request in an initial image frame; the frame rate switching request is used to instruct the refresh frame rate of the electronic device screen to switch 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 predict, at a current moment which is a preset number of frames after the initial image frame, in response to the frame rate switching request, a second generation moment of the Vsync-TE signal of the next image frame of the current image frame according to the current moment, the first generation moment of the Vsync-TE signal of the current image frame corresponding to the current moment, the working duration of the image frame, and the second frame rate;
[0012] The control module is used 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.
[0013] On the other hand, an electronic device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the steps of the frame rate switching method as described above.
[0014] On the other hand, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the frame rate switching method described above are implemented.
[0015] On the other hand, a computer program product is provided, comprising a computer program, which implements the steps of the frame rate switching method described above when executed by a processor.
[0016] In the above-mentioned frame rate switching method, device, electronic device, storage medium, and product, the electronic device receives a frame rate switching request in the initial image frame; the frame rate switching request is used to instruct the refresh frame rate of the electronic device screen to switch from the first frame rate to the second frame rate; the refresh frame rate of the initial image frame is the first frame rate. At the current moment, which is 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 moment, the first generation time of the Vsync-TE signal of the current image frame corresponding to the current moment, 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 draw the screen at the second frame rate.
[0017] Since the frame rate decision manager uses the first generation time of the Vsync-TE signal of the current image frame corresponding to the current moment 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 moment, it can be known that the moment information of the first generation time is accurate, therefore, the predicted second generation time of the Vsync-TE signal of the next image frame of the current image frame is also accurate. Moreover, 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. Therefore, the frame rate decision manager can accurately infer the various drawing moments in the process of drawing the next image frame at the second frame rate based on the second generation time of the Vsync-TE signal of the next image frame, combined with the first working duration APP-WorkDuration and the second working duration SF-WorkDuration.
[0018] Therefore, the picture is drawn 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, 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 there will be no frame drop in the picture drawing process, and a smooth picture can be obtained. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0020] Figure 1 It is a timing diagram of frame rate switching for a screen in a traditional method;
[0021] Figure 2 A diagram showing an application environment of a frame rate switching method in an embodiment;
[0022] Figure 3 is a flow chart of a frame rate switching method in one embodiment;
[0023] Figure 4 for Figure 3 4 is a flow chart of a method for predicting a second generation time of a Vsync-TE signal of a next image frame of a current image frame;
[0024] Figure 5is a schematic diagram of the relationship between Vsync signals of various image frames in one embodiment;
[0025] Figure 6 is a timing diagram of frame rate switching for a screen in one embodiment;
[0026] Figure 7 for Figure 3 A flowchart of a method for controlling a next image frame to perform screen drawing at a second frame rate according to a second generation moment of a Vsync-TE signal of the next image frame;
[0027] Figure 8 is a schematic diagram of a frame rate switching method in an exemplary embodiment;
[0028] Fig. 9 is a timing diagram of frame rate switching for a screen in another embodiment;
[0029] Fig.10 is a structural block diagram of a frame rate switching device in an embodiment;
[0030] Fig.11 for Fig.10 The structural block diagram of the prediction module;
[0031] Fig.12 FIG. 1 is a schematic diagram of the internal structure of an electronic device in an embodiment. DETAILED DESCRIPTION
[0032] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0033] It is understood that the terms "first", "second", etc. used in this application may be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish a first element from another element. For example, without departing from the scope of this application, a first frame rate may be referred to as a second frame rate, and similarly, a second frame rate may be referred to as a 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, in the UI scenario, the behavior of application drawing and layer display is closely related to the Vsync model. And in the current display framework, different Vsync models need to be established to match the different refresh frame rates of the screen. Therefore, when the screen initiates an instruction to switch the frame rate, the Vsync model of the screen needs to be cleared and rebuilt accordingly, so that the rebuilt Vsync model matches the frame rate after the screen is switched.
[0035] The core idea of establishing the Vsync model is as follows: xi and yi based on the historical preset number of frames are used as independent variables and dependent variables respectively, and a univariate linear regression algorithm is used for simulation to obtain the prediction formula of y=kx+b, which is the Vsync model. Here, yi represents the generation time (TE Time) of the i-th Vsync-TE signal received by the system, and xi represents the generation time of the i-th Vsync-TE signal received by the system, and the period T is rounded down. Here, the period T is the period corresponding to the refresh frame rate of the historical preset number of frames.
[0036] Among them, k in the prediction formula is the statistical value of the period T calculated by the univariate 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 predicted generation time of the Vsync-TE signal with the period T rounded down.
[0037] The relationship between k and xi, yi is shown in the following formula (1), and the relationship between b and xi, yi is shown in the following formula (2):
[0038]
[0039]
[0040] After the screen initiates the behavior of switching the refresh frame rate, it generally takes several frames to rebuild a new Vsync model. Therefore, before the new Vsync model is built, the traditional frame rate switching method still selects the generation time of the Vsync-TE signal of any frame in the historical moment to predict the generation time of the Vsync-TE signal of the image frame after the behavior of switching the refresh frame rate is initiated. Obviously, the predicted generation time of the Vsync-TE signal of the image frame after the behavior of switching the refresh frame rate is wrong. Furthermore, based on the wrong generation time of the Vsync-TE signal of the image frame, the generation time of the Vsync-APP signal and the Vsync-SF signal of the image frame are inferred to be wrong, resulting in the disruption of the display rhythm of the image frame. Then, the image frame is likely to be delayed on the screen due to missing the generation time of the next Vsync-SF signal, causing the display screen to freeze.
[0041] like Figure 1As shown, it is a timing diagram for frame rate switching for the screen in the traditional method. Among them, the first row of Vsync-APP signals in the timing diagram includes two rows of signals, which respectively represent the main thread and the rendering thread of each frame. The second row of Vsync-SF / Vsync-HWC signals in the timing diagram represent the display time of each frame. The third row of Vsync-TE signals in the timing diagram represent the display time of each frame on the screen (referred to as the on-screen time). Assume that a frame rate switching request for the screen is received in the B frame, and the frame rate switching request is used to indicate that the frame rate of the screen is switched from 120Hz to 90Hz. Then, before the new Vsync model is built, in the traditional frame rate switching method, the generation time of the Vsync-TE signal of any frame in the historical moment is still selected to predict the generation time of the Vsync-TE signal that initiates the D frame. Obviously, the predicted generation time of the Vsync-TE signal of the D frame is wrong. Furthermore, based on the erroneous generation time of the Vsync-TE signal of the D frame, the generation time of the Vsync-APP signal and the Vsync-SF signal of the D frame inferred from the reverse are both erroneous. Figure 1 It can be seen that 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 cycle corresponding to 120hz nor the cycle corresponding to 90hz, and is smaller than the cycle corresponding to 120hz. Then, the D frame will miss the generation time of the next Vsync-SF signal, causing the D frame's display rhythm to be disrupted. Then, the D frame is likely to be delayed on the screen due to missing a display, causing the display screen to freeze.
[0042] Figure 2 FIG. 1 is a schematic diagram of an application environment of a frame rate switching method in an embodiment. Figure 2As shown, the application environment includes an electronic device 220, which receives a frame rate switching request in an initial image frame; the frame rate switching request is used to indicate that the refresh frame rate of the electronic device screen is switched from the first frame rate to the second frame rate; the refresh frame rate of the initial image frame is the first frame rate; at the current moment after the initial image frame, which is a preset number of frames apart, in response to the frame rate switching request, according to the current moment, the first generation moment of the Vsync-TE signal of the current image frame corresponding to the current moment, the working duration of the image frame and the second frame rate, the second generation moment of the Vsync-TE signal of the next image frame of the current image frame is predicted; according to the second generation moment of the Vsync-TE signal of the next image frame, the next image frame is controlled to draw the screen at the second frame rate. Among them, the electronic device 220 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices, and the Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart vehicle-mounted devices, smart cars, etc. The portable wearable device can be a smart watch, a smart bracelet, a head-mounted device, etc.
[0043] Figure 3 FIG. 1 is a flow chart of a frame rate switching method in an embodiment. The frame rate switching method in this embodiment is operated at Figure 2 The electronic device in the example is used to describe. Figure 3 As shown, the frame rate switching method includes steps 320 to 360, wherein:
[0044] Step 320, receiving a frame rate switching request in an initial image frame; the frame rate switching request is used to instruct the refresh frame rate of the electronic device screen to switch 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] As more and more functions can be realized on electronic devices, the usage scenarios of electronic devices are also becoming more and more diverse. For example, electronic devices can be used in a variety of scenarios such as playing videos, playing games or general browsing. Since different application scenarios have different requirements for the refresh frame rate of the screen, electronic devices also need to dynamically switch the refresh frame rate as the application scenarios switch.
[0046] Assume that the electronic device receives a frame rate switching request in the initial image frame, wherein the refresh frame rate of the initial image frame is the first frame rate. Here, the frame rate switching request is used to instruct the refresh frame rate of the electronic device screen to switch from the first frame rate (fps1) to the 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 instruct the electronic device to reduce 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 instruct the electronic device to increase the refresh frame rate of the screen. And the screen of the electronic device can support refresh frame rates of 60Hz, 90Hz, 120Hz, 144Hz or even higher.
[0047] Here, when the window manager of the electronic device detects preset operations such as application opening or application switching, or scene switching in the application, a frame rate switching request will be triggered. Alternatively, in an application with a low screen refresh frame rate, when the application layer of the electronic device receives a sliding operation or a click operation from the user, it may be necessary to increase the screen refresh frame rate, so the window manager will also trigger a frame rate switching request. Of course, the present application is not limited to 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 in the initial image frame.
[0048] Step 340, at a current moment which is a preset number of frames after the initial image frame, in response to a frame rate switching request, predict the second generation time of the Vsync-TE signal of the next image frame of the current image frame according to the current moment, the first generation time of the Vsync-TE signal of the current image frame corresponding to the current moment, the working duration of the image frame and the second frame rate.
[0049] After receiving the frame rate switching request for the initial image frame, the frame rate decision manager of the electronic device can determine the frame rate switching strategy and send the frame rate switching strategy to the display synthesis process. Optionally, the frame rate decision manager can respond to the frame rate switching request at the current moment with 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 this application does not limit this. For example, the number of the preset number of frames can be zero frames, one frame, or two or more frames.
[0050] Assuming that the preset number of frames is zero frame, any time between the generation time of the Vsync-APP signal of the next frame of the initial image frame (the first frame after the initial image frame) and the next two frames of the initial image frame (the second frame after the initial image frame) can be taken as the current time. Assuming that the preset number of frames is one frame, any time between the generation time 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 next three frames of the initial image frame (the third frame after the initial image frame) can be taken as the current time.
[0051] Furthermore, the frame rate decision manager can 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 in response to the frame rate switching request at the current time which is a preset number of frames after the initial image frame. Optionally, the frame rate decision manager can 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 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 adopts the first generation time of the Vsync-TE signal of the current image frame corresponding to the current moment 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 moment, it can be known that the moment information of the first generation time is accurate. Therefore, the predicted second generation time 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 generation time of the Vsync-TE signal of the next image frame, control the next image frame to perform screen drawing at the second frame rate.
[0054] After predicting the second generation time 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 generation time of the Vsync-TE signal of the next image frame.
[0055] Optionally, the frame rate decision manager can reversely infer the various drawing moments in the process of drawing the next image frame at the second frame rate based on the second generation moment of the Vsync-TE signal of the next image frame. Among them, 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 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.
[0056] In addition, the display architecture in the electronic device of the present application also defines that the generation time of the Vsync-TE signal of each image frame minus the first working duration APP-WorkDuration can be used to 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 then 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 reversely infer the various drawing times in the process of drawing the picture at the second frame rate of the next image frame based on the second generation time of the Vsync-TE signal of the next image frame, combined 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 process of drawing the picture at the second frame rate of the next image frame can be reversed. Furthermore, the picture can be drawn 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. Among them, after predicting the second generation time of the Vsync-TE signal of the next image frame of the current image frame, the frame rate decision manager reversely deduces 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 of the electronic device of the present application. Therefore, 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 screen is drawn at the second frame rate, and the first working duration APP-WorkDuration of each image frame in the obtained screen is equal, and the second working duration SF-WorkDuration of each image frame is also equal, so there will be no frame drop during the screen drawing process, and a smooth picture can be obtained.
[0057] In an embodiment of the present application, the electronic device receives a frame rate switching request in an initial image frame; the frame rate switching request is used to instruct the refresh frame rate of the electronic device screen to switch 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 moment that is 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 based on the current moment, the first generation time of the Vsync-TE signal of the current image frame corresponding to the current moment, 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 draw the screen at the second frame rate.
[0058] Since the frame rate decision manager uses the first generation time of the Vsync-TE signal of the current image frame corresponding to the current moment 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 moment, it can be known that the moment information of the first generation time is accurate, therefore, the predicted second generation time of the Vsync-TE signal of the next image frame of the current image frame is also accurate. Moreover, 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. Therefore, the frame rate decision manager can accurately infer the various drawing moments in the process of drawing the next image frame at the second frame rate based on the second generation time of the Vsync-TE signal of the next image frame, combined with the first working duration APP-WorkDuration and the second working duration SF-WorkDuration.
[0059] Therefore, the picture is drawn 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, 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 there will be no frame drop in the picture drawing process, and a smooth picture can be obtained.
[0060] In the previous embodiment, it is described that the frame rate decision manager predicts the second generation time of the Vsync-TE signal of the next image frame of the current image frame corresponding to the current time, and reversely predicts the various drawing moments in the process of drawing the next image frame at the second frame rate. Then, based on the various drawing moments, the process of drawing the next image frame at the second frame rate is described. In this 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] like Figure 4 As shown, step 340 predicts 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 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, including:
[0062] Step 342, obtaining a first working duration of the image frame and a second working duration of the image frame.
[0063] like Figure 5 As shown, 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 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 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] The display architecture in the electronic device of the present application also defines that the generation time of the Vsync-TE signal of each image frame is subtracted from the first working duration APP-WorkDuration, and the generation time of the Vsync-SF signal of the image frame can be obtained; the generation time of the Vsync-TE signal of each image frame is subtracted from the first working duration APP-WorkDuration, and then subtracted from the second working duration SF-WorkDuration, and the generation time of the Vsync-APP signal of the image frame can be obtained.
[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 or different from the second working duration SF-WorkDuration of the image frame, and this application does not limit this.
[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 is not switched during the drawing cycle of the current image frame corresponding to the current moment, the first generation moment 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 moment te_last of the Vsync-TE signal of the current image frame corresponding to the current moment can be calculated based on the Vsync model corresponding to the first frame rate.
[0068] Combination Figure 6As shown, it is a timing diagram for frame rate switching for the screen in one embodiment of the present application. Among them, the first row of Vsync-APP signals in the timing diagram includes two rows of signals, which respectively represent the main thread and the rendering thread of each frame. The second row of Vsync-SF / Vsync-HWC signals in the timing diagram represent the display duration of each frame. The third row of Vsync-TE signals in the timing diagram represent the display duration of each frame on the screen (referred to as the on-screen duration). Assume that a frame rate switching request for the screen is received in the B frame, and the frame rate switching request is used to indicate that the frame rate of the screen is switched from 120Hz to 90Hz. After initiating the behavior of switching the refresh frame rate for the screen, it generally takes several frames to rebuild the new Vsync model. Then, 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 is not switched during the drawing cycle 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 seen that the time information of the first generation time te_last of the Vsync-TE signal of the C frame is accurate, so the predicted second generation time te_now of the Vsync-TE signal of the D frame is also accurate.
[0070] Step 346 , predicting a 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, based on the computational relationship among the current moment, the first generation moment, the first working duration of the image frame, the second working duration and the second frame rate of the image frame, and the second generation moment of the Vsync-TE signal of the next image frame of the current image frame defined by the display architecture within the electronic device of the present application, the second generation moment te_now of the Vsync-TE signal of the next image frame of the current image frame can be accurately predicted.
[0072] In the embodiment of the present application, the electronic device obtains the first working duration of the image frame, the second working duration of the image frame, and then obtains the first generation time of the Vsync-TE signal of the current image frame corresponding to the current moment. Finally, according to the operation relationship among the current moment, 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, 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, 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] Furthermore, based on the second generation time of the Vsync-TE signal of the next image frame, combined with the first working duration APP-WorkDuration and the second working duration SF-WorkDuration, the various drawing times in the process of drawing the next image frame at the second frame rate can be accurately inferred.
[0074] In the previous embodiment, a 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 this embodiment, step 344 is further described, and the first generation time of the Vsync-TE signal of the current image frame corresponding to the current moment is obtained, including:
[0075] According to the Vsync model corresponding to the first frame rate, a first generation time of the Vsync-TE signal of the current image frame corresponding to the current time is acquired.
[0076] Combination Figure 6 As shown, since the refresh frame rate is not switched during the drawing cycle 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 using a univariate linear regression algorithm based on the historical preset number of frames xi and yi corresponding to the first frame rate as independent variables and dependent variables, respectively, to obtain a prediction formula of y=kx+b, which 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 embodiment of the present application, since the refresh frame rate is not switched during the drawing cycle of the C frame corresponding to the current moment t, the first generation moment 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 moment of the Vsync-TE signal of the current image frame corresponding to the current moment can be obtained according to the Vsync model corresponding to the first frame rate. It can be seen that the moment information of the first generation moment te_last of the Vsync-TE signal of the C frame is accurate. Therefore, the second generation moment te_now of the Vsync-TE signal of the D frame predicted based on the moment information of the first generation moment te_last of the Vsync-TE signal of the C frame is also accurate.
[0079] In the previous embodiment, a process of obtaining the first generation time of the Vsync-TE signal of the current image frame corresponding to the current moment according to the Vsync model corresponding to the first frame rate is described. In this embodiment, step 346 is further described, and 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 moment, 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, including:
[0080] Calculate a rounding result according to the current moment, the first generation moment, the first working duration, the second working duration, and the second period corresponding to the second frame rate;
[0081] According to the rounding result, the second period, and the first generation time, the second generation time of the Vsync-TE signal of the next image frame of the current image frame is predicted.
[0082] In the aforementioned embodiment, the operational relationship among the current moment, the first generation moment, the first working duration of the image frame, the second working duration and the second frame rate of the image frame, and the second generation moment of the Vsync-TE signal of the next image frame of the current image frame is described based on the display architecture within the electronic device of the present application. The second generation moment 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 the rounding result according to the current moment, the first generation moment, 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 moment, the first working duration and the second working duration can be obtained first. Here, weights can be set for the current moment, the first working duration and the second working duration respectively, and the weighted sum of the current moment, the first working duration and the second working duration can be calculated. Further, the difference between the weighted sum and the first generation moment is obtained, and the rounding result of the ratio of the difference to the second period corresponding to the second frame rate is obtained. Exemplarily, the following formula (3) can be used to calculate the rounding result z:
[0084] z=flow(t+tw+tr-te_last) / p (3)
[0085] Among them, t represents the current moment, 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 moment of the Vsync-TE signal of the current image frame, and p represents the second period corresponding to the second frame rate.
[0086] Then, continue to predict the second generation time of the Vsync-TE signal of the next image frame of the current image frame based on the rounding result, the second period, and the first generation time. Among them, the second period P2 is the period corresponding to the second frame rate fps2. For example, if the second frame rate fps2 is 90hz, the second period P2 is approximately equal to 11.11ms; if the second frame rate fps2 is 120hz, the second period P2 is approximately equal to 8.33ms. For example, the product of the rounding result and the second period can be obtained, and the weighted sum of the product and the second period can be obtained. Obtain the weighted sum of the product and the second period and the weighted sum of the first generation time, and use the weighted sum as the second generation time te_now. Exemplarily, the second generation time te_now can be calculated 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, z represents the rounding result, and p represents the second period corresponding to the second frame rate.
[0089] In an embodiment of the present application, the frame rate decision manager of the electronic device can first calculate the rounding result according to the current moment, the first generation moment, the first working duration, the second working duration and the second period corresponding to the second frame rate when predicting the second generation moment of the Vsync-TE signal of the next image frame of the current image frame. Then, according to the rounding result, the second period and the first generation moment, the second generation moment of the Vsync-TE signal of the next image frame of the current image frame is predicted. Since the first generation moment of the Vsync-TE signal of the current image frame corresponding to the current moment is used when calculating the rounding result, it can be known that the moment information of the first generation moment is accurate, and therefore, the calculated rounding result has a high accuracy, and then the second generation moment of the Vsync-TE signal of the next image frame of the current image frame predicted based on the rounding 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 second generation time of the Vsync-TE signal of the next image frame of the current image frame is further described according to the rounding result, the second cycle, and the first generation time, including:
[0091] Obtain the product of the rounding result and the second period, and obtain the weighted sum of the product and the second period;
[0092] Obtain the weighted sum of the product, the second period, and the first generation time, and use the weighted sum as the second generation time.
[0093] After the rounding result is calculated based on the current moment, the first generation moment, 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 the product of the rounding result and the second period, and obtain the 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, the weighted sum of the product and the second period and the weighted sum of the first generation moment can be further obtained, and the weighted sum can be used as the second generation moment. That is, weights can be set for the weighted sum of the product and the second period and the first generation moment, and the weighted sum can be calculated again to obtain the second generation moment.
[0094] Exemplarily, the second generation time te_now may be calculated using the following formula (5):
[0095] te_now=te_last+flow((t+tw+tr-te_last) / p+1)*p (5)
[0096] The definitions of the parameters in formula (5) are the same as those in formula (3) and formula (4) above, and will not be repeated here.
[0097] In an embodiment of the present application, 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 obtain the weighted sum of the product and the second period and the weighted sum of the first generation time, and use the weighted sum as the second generation time. Since the frame rate decision manager uses the first generation time of the Vsync-TE signal of the current image frame corresponding to the current moment 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 moment, it can be known that the moment information of the first generation time is accurate, and therefore, 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. Figure 7 As shown, in this embodiment, step 360 is further described, which controls 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, including:
[0099] Step 362 , 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.
[0100] Among them, 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 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] Furthermore, the display architecture in the electronic device of the present application also defines that the generation time of the Vsync-TE signal of each image frame minus the first working duration APP-WorkDuration can be used to 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 then 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 reversely infer the various drawing times of the next image frame (D frame) in the process of drawing the picture at the second frame rate based on the second generation time of the Vsync-TE signal of the next image frame (D frame), combined 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 process of drawing the picture at the second frame rate of the next image frame (D frame) can be reversed.
[0102] Step 364, according to the drawing time of the next image frame, control the next image frame to be drawn at the second frame rate.
[0103] Combination Figure 6 As shown, the screen can be drawn 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). Among them, after predicting the second generation time of the Vsync-TE signal of the next image frame (D frame) of the current image frame, the frame rate decision manager reversely deduces the generation time of the Vsync-APP signal and the generation time of the Vsync-SF signal of the next image frame (D frame) based on the first working duration APP-WorkDuration and the second working duration SF-WorkDuration defined in the display architecture of the electronic device of the present application. Therefore, 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), the screen is drawn at the second frame rate, and the first working duration APP-WorkDuration of each image frame in the obtained screen is equal, and the second working duration SF-WorkDuration of each image frame is also equal, then there will be no frame drop during the screen drawing process, and a smooth screen can be obtained.
[0104] In the embodiment of the present application, since the frame rate decision manager predicts the second generation time of the Vsync-TE signal of the next image frame of the current image frame corresponding to the current moment, the first generation time of the Vsync-TE signal of the current image frame corresponding to the current moment is adopted, it can be known that the moment information of the first generation time is accurate, therefore, 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 defined in the display architecture of the electronic device of the present application, the relationship between the second working duration SF-WorkDuration of each image frame, the relationship between the generation time of the Vsync-TE signal of each image frame and APP-WorkDuration, SF-WorkDuration, and the relationship between the generation time of the Vsync-APP signal of each image frame and APP-WorkDuration, SF-WorkDuration, the drawing time of the next image frame can be accurately determined.
[0105] Furthermore, according to the drawing time of the next image frame, the next image frame is controlled to draw the screen at the second frame rate, and the first working duration APP-WorkDuration of each image frame in the obtained screen is equal, and the second working duration SF-WorkDuration of each image frame is also equal, so there will be no frame drop in the screen drawing process, and 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 of the Vsync-TE signal of the next image frame, the first working duration and the second working duration, and controlling the next image frame to draw the screen at the second frame rate according to the drawing time of the next image frame is described. In this embodiment, it is further described that the drawing time includes the rendering time, the synthesis time and the display time; 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, includes:
[0107] Obtaining a first difference result between a second generation time of a Vsync-TE signal of a next image frame and a second working duration, and using the first difference result as a synthesis time of the next image frame;
[0108] Obtain a second difference result of the first difference result and the first working duration, and use the second difference result as the rendering time of the next image frame;
[0109] The second generation time is used as the display time of the next image frame.
[0110] The display architecture within the electronic device of the present application also defines that the generation time of the Vsync-TE signal of each image frame is subtracted from the first working duration APP-WorkDuration, and the generation time of the Vsync-SF signal of the image frame can be obtained; the generation time of the Vsync-TE signal of each image frame is subtracted from the first working duration APP-WorkDuration, and then subtracted from the second working duration SF-WorkDuration, and the generation time of the Vsync-APP signal of the image frame can be obtained.
[0111] Therefore, the frame rate decision manager can calculate a first difference result between 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 use the first difference result as the synthesis time of the next image frame. Exemplarily, the following formula (6) can be used to calculate the synthesis time of the next image frame (D frame):
[0112] Tsf = te_now - tw (6)
[0113] Among them, Tsf represents the synthesis 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 for the first difference result and the first working duration APP-WorkDuration, and the second difference result is used as the rendering time of the next image frame. For example, the following formula (7) can be used to calculate the rendering time of the next image frame (D frame):
[0115] Tapp=tenow-tr-tw (7)
[0116] Among them, 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 used as the display time of the next image frame.
[0118] In the embodiment of the present application, the frame rate decision manager can infer the various drawing moments in the process of drawing the next image frame (D frame) at the second frame rate according to the second generation moment of the Vsync-TE signal of the next image frame (D frame), combined with the first working duration APP-WorkDuration and the second working duration SF-WorkDuration. That is, the generation moment of the Vsync-APP signal and the generation moment of the Vsync-SF signal in the process of drawing the next image frame (D frame) at the second frame rate can be inferred.
[0119] In the previous embodiment, the process of determining the rendering time, synthesis time and display time of the next image frame of the current image frame is described. In this embodiment, it is further described that according to the drawing time of the next image frame, the next image frame is controlled to draw the screen at the second frame rate, including:
[0120] Controlling the image data of the next image frame to be rendered at a second frame rate according to the rendering time to obtain a rendering result of the next image frame;
[0121] Controlling the rendering result of the next image frame to be synthesized at a second frame rate according to the synthesis time to obtain a synthesis result of the next image frame;
[0122] The synthesis result of the next image frame is controlled to be displayed at the second frame rate according to the display time, so as to obtain the display result of the next image frame.
[0123] Optionally, in the process of displaying the picture on the screen, the rendering thread first renders the picture data to obtain the rendering result; then, the synthesis thread synthesizes the rendering result to obtain the synthesis result; finally, the display thread displays the synthesis result to obtain the display result of the picture data. Therefore, if it is necessary to display the next image frame on the screen, then, first, according to the rendering time Tapp of the next image frame (D frame), the image data of the next image frame can be controlled to be rendered at the second frame rate to obtain the 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 within the APP-WorkDuration time, resulting in missing the generation time of the next Vsync-SF signal and delaying the screen, causing the display screen to freeze.
[0124] Secondly, according to the synthesis time Tsf of the next image frame (D frame), the rendering result of the next image frame is controlled to be synthesized at the second frame rate to obtain the synthesis result of the next image frame.
[0125] Finally, according to the display time te_now of the next image frame (D frame), the synthesis result of the next image frame is controlled to be displayed at the second frame rate to obtain the display result of the next image frame.
[0126] In the embodiment of the present application, in the process of controlling the next image frame to draw the screen at the second frame rate according to the drawing time of the next image frame, the electronic device first controls the image data of the next image frame to be rendered at the second frame rate according to the rendering time to obtain the rendering result of the next image frame. Secondly, the rendering result of the next image frame is synthesized at the second frame rate according to the synthesis time to obtain the synthesis result of the next image frame. Finally, the synthesis result of the next image frame is controlled to be displayed at the second frame rate according to the display time to obtain the 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 within the APP-WorkDuration time, resulting in missing the generation time of the next Vsync-SF signal and delaying the screen display, causing the display screen to freeze.
[0128] In an exemplary embodiment, Figure 8 As shown, a frame rate switching method is provided, which is applied to an electronic device, including:
[0129] Step 802: If the window manager detects that a preset operation such as application opening or application switching or scene switching in an application occurs, a frame rate switching request is triggered;
[0130] Step 804, receiving a frame rate switching request in an initial image frame (B frame);
[0131] Step 806, at a current time t which is a preset number of frames (n-1 frames) after the initial image frame (B frame), in response to a frame rate switching request, obtaining a first working duration of the image frame and a second working duration of the image frame;
[0132] Step 808, obtaining the first generation time of the Vsync-TE signal of the current image frame (D frame) corresponding to the current time t;
[0133] Step 810, 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, the above formula (5) is used to predict the second generation time of the Vsync-TE signal of the next image frame (E frame) of the current image frame (D frame);
[0134] Step 812, obtaining a first difference result between a second generation time of the Vsync-TE signal of the next image frame (E frame) and the second working duration, and using the first difference result as the synthesis time of the next image frame (E frame);
[0135] Step 814, obtaining a second difference result between the first difference result and the first working duration, and using the second difference result as the rendering time of the next image frame (E frame);
[0136] Step 816, using the second generated time as the display time of the next image frame (E frame);
[0137] Step 818, controlling the image data of the next image frame (E frame) to be rendered at a second frame rate according to the rendering time, to obtain a rendering result of the next image frame (E frame);
[0138] Step 820, controlling the rendering result of the next image frame to be synthesized at a second frame rate according to the synthesis time, to obtain a synthesis result of the next image frame (E frame);
[0139] Step 822, controlling the synthesis result of the next image frame to be displayed at a second frame rate according to the display time, to obtain the display result of the next image frame (E frame).
[0140] Combination Fig. 9 As shown, it is a timing diagram for frame rate switching for the screen in another embodiment of the present application. Assume that a frame rate switching request for the screen is received in the B frame, and the frame rate switching request is used to indicate that the frame rate of the screen is switched from 120Hz to 90Hz. After the behavior of switching the refresh frame rate for the screen is initiated, it generally takes several frames to rebuild the new Vsync model. Then, at the current time t, it is obvious that the new Vsync model has not been constructed at this time. The first generation time 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 time of the Vsync-TE signal of the E frame with a preset number of frames (n-1 frames) after the initial image frame.
[0141] In the embodiment of the present application, since the refresh frame rate is not switched during the drawing cycle of the D frame corresponding to the current time t, the first generation time 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 seen that the time information of the first generation time te_last of the Vsync-TE signal of the D frame is accurate, so the predicted second generation time te_now of the Vsync-TE signal of the E frame is also accurate.
[0142] Furthermore, based on the second generation time of the Vsync-TE signal of the E frame, combined with the first working duration APP-WorkDuration and the second working duration SF-WorkDuration, the various drawing times in the process of drawing the E frame at the second frame rate can be accurately inferred.
[0143] Therefore, the picture is drawn 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 E frame, 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 there will be no frame drop in the picture drawing process, and a smooth picture can be obtained.
[0144] It should be understood that, although the various steps in the above-mentioned flow chart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the above-mentioned flow chart may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages 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 to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0145] Based on the same inventive concept, Fig.10 As shown, in this embodiment, a frame rate switching device 1000 is further described, and the device includes:
[0146] The receiving module 1020 is used to receive a frame rate switching request in an initial image frame; the frame rate switching request is used to instruct the refresh frame rate of the electronic device screen to switch from the first frame rate to the second frame rate; the refresh frame rate of the initial image frame is the first frame rate;
[0147] The prediction module 1040 is used to predict, in response to a frame rate switching request, at a current moment which is a preset number of frames after the initial image frame, a second generation moment of the Vsync-TE signal of the next image frame of the current image frame according to the current moment, the first generation moment of the Vsync-TE signal of the current image frame corresponding to the current moment, the working duration of the image frame, and the second frame rate;
[0148] The control module 1060 is used to control the next image frame to be drawn at a 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] like Fig.11 As shown, the prediction module 1040 includes:
[0151] A working duration acquisition unit 1042, used to acquire a first working duration of an image frame and a second working duration of an image frame;
[0152] A first generation time acquisition unit 1044 is used to acquire a first generation time of a Vsync-TE signal of a current image frame corresponding to a current time;
[0153] The second generation time acquisition unit 1046 is used 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 also used to calculate the rounding 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 rounding result, the second period and the first generation time.
[0156] In one embodiment, the second generation time acquisition unit 1046 is also used to obtain the weighted sum of the current time, the first working duration and the second working duration; obtain the difference between the weighted sum and the first generation time, and obtain the rounded result of the ratio of the difference to the second period corresponding to the second frame rate.
[0157] In one embodiment, the second generation time acquisition unit 1046 is also used to obtain the product of the rounding result and the second period, and obtain the weighted sum of the product and the second period; obtain the weighted sum of the product and the second period and the weighted sum of the first generation time, and use the weighted sum as the second generation time.
[0158] In one embodiment, the control module 1060 includes:
[0159] A drawing time determination unit, used to determine 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;
[0160] The picture drawing unit is used to control the next image frame to draw the picture at a second frame rate according to the drawing time of the next image frame.
[0161] In one embodiment, the drawing time determination unit is further used to obtain a first difference result between a second generation time of the Vsync-TE signal of the next image frame and a second working duration, and use the first difference result as the synthesis time of the next image frame; obtain a second difference result between the first difference result and the first working duration, and use the second difference result as the rendering time of the next image frame; and use the second generation time as the display time of the next image frame.
[0162] In one embodiment, the screen drawing unit is used to control the image data of the next image frame to be rendered at a second frame rate according to the rendering time, so as to obtain the rendering result of the next image frame; to control the rendering result of the next image frame to be synthesized at the second frame rate according to the synthesis time, so as to obtain the synthesis result of the next image frame; and to control the synthesis result of the next image frame to be displayed at the second frame rate according to the display time, so as to obtain the display result of the next image frame.
[0163] The division of the modules in the above frame rate switching device is only for illustration. In other embodiments, the frame rate switching device may be divided into different modules as needed to complete all or part of the functions of the above frame rate switching device.
[0164] For the specific definition of the frame rate switching device, please refer to the definition of the frame rate switching method above, which will not be repeated here. Each module in the above frame rate switching device can be implemented in whole or in part by software, hardware and a combination thereof. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0165] Fig.12Schematic diagram of the internal structure of an electronic device in an embodiment. The electronic device can be any terminal device such as a mobile phone, a tablet computer, a laptop computer, a desktop computer, a PDA (Personal Digital Assistant), a POS (Point of Sales), a car computer, a wearable device, etc. The electronic device includes a processor and a memory connected via a system bus. Among them, the processor may include one or more processing units. The processor may be a CPU (Central Processing Unit) or a DSP (Digital Signal Processing), etc. The memory may 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 a processor to implement a frame rate switching method provided in each of the following embodiments. The internal memory provides a cache operating environment for the operating system computer program in the non-volatile storage medium.
[0166] The implementation of each module in the frame rate switching device provided in the embodiment of the present application can be in the form of a computer program. The computer program can be run on an electronic device. The program module constituted by the computer program can be stored in the memory of the electronic device. When the computer program is executed by the processor, the steps of the method described in the embodiment of the present application are implemented.
[0167] The embodiment of the present application also provides 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, the processors execute the steps of the frame rate switching method.
[0168] An embodiment of the present application also provides a computer program product including instructions, which, when executed on a computer, enables the computer to execute a frame rate switching method.
[0169] Any reference to memory, storage, database or other medium used in this application may include non-volatile and / or volatile memory. Non-volatile memory may 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 memory may include RAM (Random Access Memory), which is used as an external cache memory. 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 DDRSDRAM (Double Data Rate Synchronous Dynamic Random Access memory), ESDRAM (Enhanced Synchronous Dynamic Random Access memory), SLDRAM (Sync Link Dynamic Random Access Memory), RDRAM (Rambus Dynamic Random Access Memory), and DRDRAM (Direct Rambus Dynamic Random Access Memory).
[0170] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill 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 protection scope of the present application shall be subject to the attached claims.
Claims
1. A frame rate switching method, characterized in that: Applied to electronic equipment, the method comprises: receiving a frame rate switching request in an initial image frame; the frame rate switching request is used to instruct the refresh frame rate of the electronic device screen to switch 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 moment which is a preset number of frames after the initial image frame, in response to the frame rate switching request, predicting a second generation time of the Vsync-TE signal of the next image frame of the current image frame according to the current moment, the first generation time of the Vsync-TE signal of the current image frame corresponding to the current moment, 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.
2. The method according to claim 1, characterized in 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 a first working duration and a 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; The predicting, according to the current moment, the first generation moment of the Vsync-TE signal of the current image frame corresponding to the current moment, the working duration of the image frame and the second frame rate, the second generation moment of the Vsync-TE signal of the next image frame of the current image frame comprises: Acquire a first working duration of the image frame and a second working duration of the image frame; Acquire a first generation time of a Vsync-TE signal of a current image frame corresponding to the current time; 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, the first working duration of the image frame, the second working duration of the image frame and the second frame rate.
3. The method according to claim 2, characterized in that The obtaining of the first generation time of the Vsync-TE signal of the current image frame corresponding to the current time comprises: According to the Vsync model corresponding to the first frame rate, a first generation time of the Vsync-TE signal of the current image frame corresponding to the current time is acquired.
4. The method according to claim 2 or 3, characterized in that: The predicting, according to the current moment, the first generation moment, the first working duration of the image frame, the second working duration of the image frame, and the second frame rate, of the second generation moment of the Vsync-TE signal of the next image frame of the current image frame comprises: Calculate a rounding result according to the current moment, the first generation moment, the first working duration, the second working duration, and a second period corresponding to the second frame rate; A second generation time of a Vsync-TE signal of a next image frame of the current image frame is predicted according to the rounding result, the second period, and the first generation time.
5. The method according to claim 4, characterized in that The calculating the rounding result according to the current moment, the first generation moment, the first working duration, the second working duration and the second period corresponding to the second frame rate includes: Obtaining a weighted sum of the current moment, the first working duration, and the second working duration; The difference between the weighted sum and the first generation time is obtained, and the rounding result of the ratio of the difference to the second period corresponding to the second frame rate is obtained.
6. The method according to claim 4, characterized in that The predicting, according to the rounding result, the second period, and the first generation time, of the second generation time of the Vsync-TE signal of the next image frame of the current image frame comprises: Obtaining a product of the rounding result and the second period, and obtaining a weighted sum of the product and the second period; Obtain a weighted sum of the product, the second period, and the first generation time, and use the weighted sum as the second generation time.
7. The method according to claim 2 or 3, characterized in that: The controlling the next image frame to perform screen drawing 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 a second generation time of the Vsync-TE signal of the next image frame, the first working duration, and the second working duration; According to the drawing time of the next image frame, the next image frame is controlled to be drawn at the second frame rate.
8. The method according to claim 7, characterized in that The drawing time includes a rendering time, a synthesis time and a display time; and 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, includes: Obtaining a first difference result between a second generation time of the Vsync-TE signal of the next image frame and the second working duration, and using the first difference result as a synthesis time of the next image frame; Obtaining a second difference result between the first difference result and the first working duration, and using the second difference result as the rendering time of the next image frame; The second generation time is used as the display time of the next image frame.
9. The method according to claim 8, characterized in that The step 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 includes: Controlling the 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; The synthesis result of the next image frame is controlled to be displayed at the second frame rate according to the display time, so as to obtain the display result of the next image frame.
10. A frame rate switching device, characterized in that: Applied to electronic equipment, the device comprises: A receiving module, configured to receive a frame rate switching request in an initial image frame; the frame rate switching request is used to instruct the refresh frame rate of the electronic device screen to switch 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 predict, at a current moment which is a preset number of frames after the initial image frame, in response to the frame rate switching request, a second generation moment of the Vsync-TE signal of the next image frame of the current image frame according to the current moment, the first generation moment of the Vsync-TE signal of the current image frame corresponding to the current moment, the working duration of the image frame, and the second frame rate; The control module is used 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, wherein a computer program is stored in the memory, wherein: When the computer program is executed by the processor, the processor is caused 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 a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the frame rate switching method according to any one of claims 1 to 9 are implemented.
13. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the frame rate switching method described in any one of claims 1 to 9 are implemented.
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
Image processing method based on vertical synchronization signal and electronic equipment
CN112351326A
Display parameter adjusting method, electronic equipment, chip and readable storage medium
CN114089933A
Frame rate switching method and device
CN116414337A