WO2020207250A1 - 垂直同步方法、装置、终端及存储介质 - Google Patents

垂直同步方法、装置、终端及存储介质 Download PDF

Info

Publication number
WO2020207250A1
WO2020207250A1 PCT/CN2020/081131 CN2020081131W WO2020207250A1 WO 2020207250 A1 WO2020207250 A1 WO 2020207250A1 CN 2020081131 W CN2020081131 W CN 2020081131W WO 2020207250 A1 WO2020207250 A1 WO 2020207250A1
Authority
WO
WIPO (PCT)
Prior art keywords
vertical synchronization
synchronization signal
request
thread
image frame
Prior art date
Application number
PCT/CN2020/081131
Other languages
English (en)
French (fr)
Inventor
彭德良
Original Assignee
Oppo广东移动通信有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Publication of WO2020207250A1 publication Critical patent/WO2020207250A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces

Definitions

  • the embodiments of the present application relate to the field of terminal technologies, and in particular, to a vertical synchronization method, device, terminal, and storage medium.
  • Vsync Vertical synchronization
  • the terminal After the terminal applies the vertical synchronization technology, when the application receives the vertical synchronization signal, it will draw the picture; when the synthesis thread receives the vertical synchronization signal, it will synthesize multiple visible layers and send the synthesized image frame data to the display Screen: When the display screen receives the vertical synchronization signal, it updates the image frame.
  • the embodiments of the present application provide a vertical synchronization method, device, terminal, and storage medium.
  • the technical solutions are as follows:
  • an embodiment of the present application provides a vertical synchronization method, and the method includes:
  • an embodiment of the present application provides a vertical synchronization device, and the device includes:
  • the request receiving module is configured to receive a vertical synchronization signal request sent by the requesting party, and the vertical synchronization signal request is used to request to obtain a vertical synchronization signal;
  • An acquiring module configured to acquire the first request moment of the vertical synchronization signal request and the second request moment of the last received vertical synchronization signal request;
  • the first sending module is configured to send an analog vertical synchronization signal to the requester in response to the request time interval being greater than the duration threshold, where the request time interval is the interval between the first request moment and the second request moment Time interval, the requester is used to perform a predetermined operation according to the analog vertical synchronization signal.
  • the present application provides a terminal including a processor, a memory and a display screen connected to the processor, and program instructions stored on the memory, and the processor executes the program
  • the vertical synchronization method as described in the above aspect is implemented when instructed.
  • a computer-readable storage medium is provided, and program instructions are stored thereon, and when the program instructions are executed by a processor, the vertical synchronization method as described in the above aspect is implemented.
  • the request time interval is calculated according to the first request time of the vertical synchronization signal request and the second request time of the last time the vertical synchronization signal request is received , And when the request time interval is greater than the duration threshold, send an analog vertical synchronization signal to the requester so that the requester can perform a predetermined operation according to the analog vertical synchronization signal; compared with the related technology, it needs to wait for the real vertical synchronization request to perform the operation.
  • the introduction of a vertical synchronization signal simulation mechanism allows the requester to perform a predetermined operation without waiting for the real vertical synchronization signal, thereby shortening the time for the requesting party to wait for the vertical synchronization signal and helping to increase the speed of the display screen.
  • FIG. 1 is a schematic structural diagram of a terminal provided by an exemplary embodiment of the present application.
  • Figure 2 is a schematic diagram of the graphic display process in the Android system
  • Figure 3 is a schematic diagram of the vertical synchronization process in the related art
  • Fig. 4 shows a method flowchart of a vertical synchronization method provided by an exemplary embodiment of the present application
  • FIG. 5 shows a method flowchart of a vertical synchronization method provided by another exemplary embodiment of the present application
  • FIG. 6 is a schematic diagram of the implementation process of the vertical synchronization method shown in FIG. 5;
  • FIG. 7 shows a method flowchart of a vertical synchronization method provided by another exemplary embodiment of the present application.
  • FIG. 8 is a schematic diagram of the principle of the implementation process of the vertical synchronization method shown in FIG. 7;
  • FIG. 9 shows a method flowchart of a vertical synchronization method provided by another exemplary embodiment of the present application.
  • FIG. 10 is a schematic diagram of the principle of the implementation process of the vertical synchronization method shown in FIG. 9;
  • FIG. 11 is a schematic structural diagram of a vertical synchronization device provided by an embodiment of the present application.
  • FIG. 1 shows a schematic structural diagram of a terminal provided by an exemplary embodiment of the present application.
  • the terminal 100 is an electronic device installed with a target application.
  • the target application can be a system program or a third-party application.
  • third-party applications are applications made by third parties other than the user and the operating system.
  • the target application can be a game application or a video playback application.
  • the terminal 100 includes a processor 120 and a memory 140.
  • the processor 120 may include one or more processing cores.
  • the processor 120 uses various interfaces and lines to connect various parts of the entire terminal 100, and executes the terminal by running or executing instructions, programs, code sets, or instruction sets stored in the memory 140, and calling data stored in the memory 140. 100 various functions and processing data.
  • the processor 120 may adopt at least one of digital signal processing (Digital Signal Processing, DSP), Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA), and Programmable Logic Array (Programmable Logic Array, PLA).
  • DSP Digital Signal Processing
  • FPGA Field-Programmable Gate Array
  • PLA Programmable Logic Array
  • the processor 120 may integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU), and a modem.
  • CPU Central Processing Unit
  • GPU Graphics Processing Unit
  • modem modem
  • the CPU mainly processes the operating system, user interface, and application programs; the GPU is used to render and draw the content that the display needs to display; the modem is used to process wireless communication. It can be understood that the above-mentioned modem may not be integrated into the processor 120, but may be implemented by a chip alone.
  • the memory 140 may include random access memory (RAM) or read-only memory (Read-Only Memory).
  • the memory 140 includes a non-transitory computer-readable storage medium.
  • the memory 140 may be used to store instructions, programs, codes, code sets or instruction sets.
  • the memory 140 may include a program storage area and a data storage area.
  • the program storage area may store instructions for implementing the operating system and instructions for at least one function (such as touch function, sound playback function, image playback function, etc.), Instructions used to implement the following method embodiments; the storage data area can store the data involved in the following method embodiments.
  • the terminal 120 in the embodiment of the present application further includes a display screen 160.
  • the display screen 160 is a touch display screen, which is used to receive a user's touch operation on or near any suitable object such as a finger, a touch pen, etc., and to display a user interface of each application program.
  • the display screen 160 is usually arranged on the front panel of the terminal 100 or, at the same time, arranged on the front panel and the rear panel of the terminal 100.
  • the display screen 160 can be designed as a full screen, a curved screen or a special-shaped screen.
  • the display screen 160 can also be designed as a combination of a full screen and a curved screen, or a combination of a special-shaped screen and a curved screen, which is not limited in this embodiment.
  • the structure of the terminal 100 shown in the above drawings does not constitute a limitation on the terminal 100, and the terminal may include more or less components than those shown in the figure, or combine certain components. Components, or different component arrangements.
  • the terminal 100 also includes a radio frequency circuit, an input unit, a sensor, an audio circuit, a wireless fidelity (Wireless Fidelity, WiFi) module, a power supply, a Bluetooth module, and other components, which are not described here.
  • the graphics display process of the terminal is divided into three stages: layer drawing, layer composition and image frame update.
  • the layer drawing is executed by the application program
  • the layer composition is executed by the synthesis thread
  • the image frame update is executed by the display screen.
  • the display screen 21 reads the image frame data from the frame buffer, and the reading process is: starting from the start address of the frame buffer, proceeding from top to bottom, from left to right. Scan to map the scanned content on the display.
  • the terminal adopts a double buffering mechanism, among which, One of the double buffers is used for content reading and display, while the other buffer is used for background graphics synthesis and writing.
  • the front buffer 22 is a frame buffer for the content to be displayed on the display screen
  • the rear buffer 23 is a frame buffer for synthesizing the next frame of graphics.
  • the display screen 21 reads the content in the back buffer 23.
  • the next frame of graphics is synthesized in the front buffer 22 (the front and rear buffer roles interact with each other). change).
  • SurfaceFlinger as a layer compositor (including a compositing thread), is used to synthesize multiple layers (surface) passed by the upper layer (application), and submit it to the buffer of the display 21 for the display 21 to read display.
  • the content in the back buffer 23 is synthesized by SurfaceFlinger24 on multiple surfaces 25.
  • each surface corresponds to a window (window) of the upper layer, such as a dialog box, a status bar, and an activity (Activity).
  • the display screen is based on the hardware vertical synchronization signal (the generation frequency of the hardware vertical synchronization signal is consistent with the display refresh frequency)
  • the image frame is updated, and the application program and the compositing thread perform picture drawing and synthesis by requesting the software vertical synchronization signal (to keep in sync with the hardware synchronization signal).
  • FIG. 3 shows a schematic diagram of the vertical synchronization process in the related art.
  • the application needs to draw a layer, it sends a vertical synchronization signal request to SurfaceFlinger, and waits for SurfaceFlinger to feed back the vertical synchronization signal to the application at the next vertical synchronization time point (the vertical synchronization signal distributed at SurfaceFlinger is the software vertical synchronization signal, and the software vertical
  • the synchronization signal is generated by SurfaceFlinger according to the hardware vertical synchronization signal reported by the hardware).
  • the application receives the vertical synchronization signal, it will draw the layer and send the layer data obtained by drawing to SurfaceFlinger.
  • SurfaceFlinger After SurfaceFlinger receives the layer data, when it reaches the next vertical synchronization time point, it performs layer synthesis according to the layer data, and sends the generated image frame data to the display screen. If the image frame is currently being displayed, the display screen will update the image frame according to the received image frame data at the next vertical synchronization point in time.
  • the application, SurfaceFlinger, and the display screen all need to receive the vertical synchronization signal before they can work, and the application, SurfaceFlinger, and the display screen waiting for the vertical synchronization signal will cause a delay in the screen display.
  • the vertical synchronization signal interval is 16.7ms.
  • the application, SurfaceFlinger, and the display all wait 16.7ms, it will take 50ms for a frame of image to be drawn to display.
  • the vertical synchronization method in order to solve the problem of delay in picture display due to the long waiting time of the vertical synchronization signal in the related art, in the vertical synchronization method provided in the embodiment of the present application, when a vertical synchronization signal request is received, according to the current vertical synchronization signal The request time of the request and the request time of the last vertical synchronization signal request, determine whether the request time interval between two requests is too long, so that when the request time interval is too long, a vertical synchronization signal is simulated to the requester for the requester According to the simulated vertical synchronization signal, the corresponding operation is executed immediately, which shortens the time that the requesting party waits for the vertical synchronization signal, thereby reducing the display delay of the picture.
  • Illustrative embodiments are used for description below.
  • FIG. 4 shows a method flowchart of a vertical synchronization method provided by an exemplary embodiment of the present application.
  • the method may include the following steps.
  • Step 401 Receive a vertical synchronization signal request sent by a requesting party, where the vertical synchronization signal request is used to request to obtain a vertical synchronization signal.
  • the requester includes at least one of an application program and a compositing thread.
  • the vertical synchronization signal request is a vertical synchronization signal request sent by the application program before the layer is drawn, or the compositing thread is in progress.
  • Step 402 Obtain the first request time of the vertical synchronization signal request and the second request time of the last received vertical synchronization signal request.
  • the terminal records the request time of the vertical synchronization signal request every time after receiving the vertical synchronization signal request sent by the requesting party.
  • the terminal obtains the first request moment of the current vertical synchronization signal request and the second request moment of the last request sent by the requester of the vertical synchronization signal.
  • Step 403 In response to the request time interval being greater than the duration threshold, send an analog vertical synchronization signal to the requester.
  • the request time interval is the time interval between the first request moment and the second request moment.
  • the signal performs a predetermined operation.
  • the SurfaceFlinger process includes a signal generation thread and a signal transmission thread, where the signal generation thread is used to generate a standard vertical synchronization signal (generate a nominal vertical synchronization signal based on the hardware vertical synchronization signal), and the signal transmission The thread is used to process the standard vertical synchronization signal (for example, increase the time offset), and then send the vertical synchronization signal to the requester.
  • the signal generation thread is used to generate a standard vertical synchronization signal (generate a nominal vertical synchronization signal based on the hardware vertical synchronization signal), and the signal transmission
  • the thread is used to process the standard vertical synchronization signal (for example, increase the time offset), and then send the vertical synchronization signal to the requester.
  • the signal sending thread needs to receive the standard vertical synchronization signal generated by the signal generation thread before it feeds back the vertical synchronization signal to the requester.
  • the signal sending thread when the requester makes two requests When the request time interval between is greater than the duration threshold (indicating that the vertical synchronization signal is received after a long waiting time after the previous vertical synchronization signal request is sent), the signal sending thread generates an analog vertical synchronization signal and sends the analog vertical synchronization signal Sent to the requester.
  • the signal sending thread in the embodiment of the present application has the function of generating an analog vertical synchronization signal, and the generated analog vertical synchronization signal is the same as the real vertical synchronization signal (the vertical synchronization signal sent to the requesting party according to the standard vertical synchronization signal) , But the analog vertical synchronization signal is not generated according to the hardware vertical synchronization signal, but is obtained through simulation.
  • the analog vertical synchronization signal is provided with a corresponding identifier to distinguish it from the real vertical synchronization signal.
  • the requesting party after receiving the analog vertical synchronization signal, performs a predetermined operation according to the analog vertical synchronization signal. Since there is no need to wait for the real vertical synchronization signal, the time for the requester to request the vertical synchronization signal is shortened, thereby reducing the display delay of the picture.
  • the duration threshold is determined according to the period of the vertical synchronization signal, the period of the vertical synchronization signal is used to indicate the time interval between two adjacent vertical synchronization signals, and the duration threshold is greater than or equal to the period of the vertical synchronization signal.
  • the duration threshold is one vertical synchronization signal period, or 1.2 vertical synchronization signal periods, or 1.5 vertical synchronization signal periods.
  • the refresh frequency of the display screen is 60 Hz
  • the period of the vertical synchronization signal is 16.7 ms
  • the duration threshold is determined to be 16.7 ms.
  • the signal sending thread sends the (real) vertical synchronization signal to the requester according to the standard vertical synchronization signal generated by the signal generation thread, so that the requester can follow
  • the vertical synchronization signal performs a predetermined operation.
  • the introduction of the vertical synchronization signal simulation mechanism allows the requester to perform predetermined operations without waiting for the real vertical synchronization signal, thereby shortening the time for the requesting party to wait for the vertical synchronization signal and helping to improve the speed of the display screen.
  • the duration threshold is determined according to a vertical synchronization signal period, the vertical synchronization signal period is used to indicate a time interval between two adjacent vertical synchronization signals, and the duration threshold is greater than or equal to the vertical synchronization signal period.
  • the requesting party is an application program
  • the receiving the vertical synchronization signal request sent by the requesting party includes:
  • the sending an analog vertical synchronization signal to the requesting party includes:
  • the method further includes:
  • the requesting party is a synthetic thread
  • the receiving the vertical synchronization signal request sent by the requesting party includes:
  • the sending an analog vertical synchronization signal to the requesting party includes:
  • the method further includes:
  • the second vertical synchronization signal is sent to the composition thread, and the composition thread is used for layer composition according to the second vertical synchronization signal.
  • the method further includes:
  • the method further includes:
  • the starting point of the vertical synchronization signal of the display screen is reset, and the image frame displayed on the display screen is updated according to the image frame data.
  • the resetting the start point of the vertical synchronization signal and updating the image frame displayed on the display screen according to the image frame data includes:
  • the reset cost Determining the reset cost for resetting the starting point of the vertical synchronization signal according to the current hardware state, the reset cost including the reset time;
  • the starting point of the vertical synchronization signal is reset, and the image frame displayed on the display screen is updated according to the image frame data.
  • the SurfaceFlinger process includes a signal generation thread (VsyncThread) that generates a standard vertical synchronization signal (ie, a software vertical synchronization signal), and a first active thread (EventThread (APP) that focuses on the vertical synchronization signal of the application program). ), the second active thread (EventThread (Surface)) that pays attention to the vertical synchronization signal of the composition thread, the signal sending thread (DispSyncThread) that sends the vertical synchronization signal according to the standard vertical synchronization signal, and the composition thread that is responsible for the composition layer.
  • VsyncThread signal generation thread
  • EventThread APP
  • APP software vertical synchronization signal
  • APP software vertical synchronization signal
  • APP software vertical synchronization signal
  • APP software vertical synchronization signal
  • APP software vertical synchronization signal
  • APP software vertical synchronization signal
  • APP software vertical synchronization signal
  • APP software vertical synchronization signal
  • APP software vertical synchronization
  • FIG. 5 shows a method flowchart of a vertical synchronization method provided by another exemplary embodiment of the present application.
  • the method may include the following steps.
  • Step 501 Receive a first vertical synchronization signal request sent by an application program.
  • the application when it needs to draw a layer, it sends a first vertical synchronization signal request to the first active thread in the SurfaceFlinger process, and the first active thread sends the first vertical synchronization signal to the signal sending thread. Synchronization signal request.
  • the signal sending thread receives the first vertical synchronization signal request.
  • Step 502 Obtain the first request moment of the first vertical synchronization signal request and the second request moment of the last vertical synchronization signal request.
  • the signal sending thread of the SurfaceFlinger process obtains the first request moment of the first vertical synchronization signal request and the second request moment of the first vertical synchronization signal request sent by the application program last time, and calculates The request time interval between the first request moment and the second request moment.
  • Step 503 In response to the request time interval being greater than the duration threshold, send a first analog vertical synchronization signal to the application program, where the application program is used to draw a picture according to the first analog vertical synchronization signal.
  • the duration threshold is a vertical synchronization signal period of the display screen.
  • the period of the vertical synchronization signal is 16.7 ms.
  • the signal sending thread in the SurfaceFlinger thread when the request time interval between the first request moment and the second request moment is greater than one vertical synchronization signal period, the signal sending thread in the SurfaceFlinger thread generates the first analog vertical synchronization signal through the vertical synchronization signal simulation function, And send the first analog vertical synchronization signal to the application program (first send the first analog vertical synchronization signal to the first active thread, and then the first active thread to the application program).
  • step 502 since the request time interval (20 ms) between two adjacent requests is greater than one vertical synchronization signal period (16.7 ms), SurfaceFlinger immediately sends the first analog vertical synchronization signal to the application.
  • the terminal when n-1 request time intervals between consecutive n (n ⁇ 3) first vertical synchronization signal requests are greater than the duration threshold, the terminal sends the first simulation to the application through the SurfaceFlinger process
  • the vertical synchronization signal is not limited in this embodiment.
  • the application program after receiving the first analog vertical synchronization signal, performs layer drawing, and sends the layer data obtained by drawing to SurfaceFlinger.
  • the application program performs layer drawing after receiving the first analog vertical synchronization signal, and sends the layer data to the SurfaceFlinger process (the synthesis thread in).
  • Step 504 in response to the request time interval being less than the duration threshold, generate a first vertical synchronization signal according to the standard vertical synchronization signal, and the standard vertical synchronization signal is generated by the signal generation thread.
  • the terminal can generate the first vertical synchronization signal according to the standard vertical synchronization signal.
  • the signal sending thread when the request time interval is less than the duration threshold, the signal sending thread generates the first vertical synchronization signal after receiving the standard vertical synchronization signal generated by the signal generation thread.
  • Step 505 Send a first vertical synchronization signal to the application program, where the application program is used to draw a picture according to the first vertical synchronization signal.
  • the terminal sends the first vertical synchronization signal to the application program, so that the application program performs picture drawing according to the first vertical synchronization signal.
  • the signal sending thread sends the first vertical synchronization signal to the first active thread, and the first active thread sends the first vertical synchronization signal to the application program.
  • a vertical synchronization signal is simulated to the application program, so that the application program can immediately draw the layer, avoiding the application program from getting real data for a long time. Vertical synchronization signal, thereby improving the screen drawing efficiency of the application.
  • the composition thread in the SurfaceFlinger process requests a vertical synchronization signal to the signal sending thread in the SurfaceFlinger process.
  • the signal sending thread may send an analog vertical synchronization signal to the composition thread when the request time interval between two adjacent requests (composition thread) is too long.
  • FIG. 7 shows a method flowchart of a vertical synchronization method provided by another exemplary embodiment of the present application. The method may include the following steps.
  • Step 701 Receive a second vertical synchronization signal request sent by the synthesis thread.
  • the composition thread when the composition thread receives the layer data sent by the application program and needs to perform layer composition, it sends a second vertical synchronization signal request to the second active thread in the SurfaceFlinger process.
  • the two active threads send the second vertical synchronization signal request to the signal sending thread.
  • the signal sending thread receives the second vertical synchronization signal request.
  • Step 702 Obtain the first request time of the second vertical synchronization signal request and the second request time of the last received second vertical synchronization signal request.
  • the signal sending thread of the SurfaceFlinger process obtains the first request time of the second vertical synchronization signal request and the second request time of the second vertical synchronization signal request sent by the synthesis thread last time, and calculates The request time interval between the first request moment and the second request moment.
  • Step 703 In response to the request time interval being greater than the duration threshold, send a second analog vertical synchronization signal to the composition thread, and the composition thread is used to perform layer composition according to the second analog vertical synchronization signal.
  • the duration threshold is a vertical synchronization signal period of the display screen.
  • the period of the vertical synchronization signal is 16.7 ms.
  • the signal sending thread in the SurfaceFlinger thread when the request time interval between the first request moment and the second request moment is greater than one vertical synchronization signal period, the signal sending thread in the SurfaceFlinger thread generates the second analog vertical synchronization signal through the vertical synchronization signal simulation function, And send the second analog vertical synchronization signal to the composition thread (first send the second analog vertical synchronization signal to the second active thread, and the second active thread to the composition thread).
  • step 702 since the request time interval (25 ms) between two adjacent requests is greater than one vertical synchronization signal period (16.7 ms), SurfaceFlinger immediately sends the second analog vertical synchronization signal to the synthesis thread.
  • the terminal when n-1 request time intervals between consecutive n (n ⁇ 3) second vertical synchronization signal requests are greater than the duration threshold, the terminal sends the second simulation to the synthesis thread through the SurfaceFlinger process
  • the vertical synchronization signal is not limited in this embodiment.
  • the synthesis thread after receiving the second analog vertical synchronization signal, performs layer synthesis, and sends the synthesized image frame data to the display screen.
  • the signal sending thread in the SurfaceFlinger process (not shown in the figure) Shown) Send a second analog vertical synchronization signal to the composition thread.
  • the compositing thread After the compositing thread receives the second analog vertical synchronization signal, it can perform layer synthesis without waiting for the real vertical synchronization signal, thereby sending the synthesized image frame data to the display screen.
  • Step 704 In response to the request time interval being less than the duration threshold, generate a second vertical synchronization signal according to the standard vertical synchronization signal, and the standard vertical synchronization signal is generated by the signal generation thread.
  • the terminal can generate the second vertical synchronization signal according to the standard vertical synchronization signal.
  • the signal sending thread when the request time interval is less than the duration threshold, the signal sending thread generates the second vertical synchronization signal after receiving the standard vertical synchronization signal generated by the signal generation thread.
  • Step 705 Send a second vertical synchronization signal to the composition thread, and the composition thread is used for layer composition according to the second vertical synchronization signal.
  • the terminal sends a second vertical synchronization signal to the composition thread, so that the composition thread performs layer composition according to the second vertical synchronization signal.
  • the signal sending thread sends the second vertical synchronization signal to the second active thread, and the second active thread sends the second vertical synchronization signal to the composition thread.
  • a vertical synchronization signal is simulated to the compositing thread, so that the compositing thread can immediately perform the layer compositing operation, and avoid the compositing thread from getting the truth for a long time.
  • the vertical synchronization signal thereby improving the efficiency of layer synthesis.
  • the testers performed statistics on the average time drawn to the screen display under the desktop click scene and the in-app click scene respectively.
  • the experimental data obtained is shown in Table 1.
  • the vertical synchronization method provided in the foregoing embodiment is optimized for the software level.
  • the waiting time when the display screen updates the image frame can be optimized from the hardware level.
  • the following steps may be included after steps 703 and 705.
  • step 706 the image frame data is sent to the display screen through the synthesis thread, and the image frame data is obtained after layer synthesis by the synthesis thread.
  • the display screen After the display screen receives the image frame data, it writes the image frame data into the buffer.
  • Step 707 Obtain the display times of the image frame currently displayed on the display screen.
  • the image frame data sent by the synthesis thread is written into the buffer of the display screen, and when the hardware vertical synchronization signal is received, the display screen updates the image frame according to the image frame data in the buffer.
  • the display screen needs to repeatedly display the previous image frame until the synthesis thread sends the new image frame data, in the next vertical synchronization signal cycle Update the image frame, that is, the same image frame is repeatedly displayed multiple times.
  • the terminal when receiving the image frame data sent by the synthesis thread, the terminal does not always update the image frame when it receives the hardware vertical synchronization signal, but Determine whether the image frame needs to be updated immediately according to the image frame currently displayed on the display screen.
  • the display screen when the display screen is displaying, it records the display times of the current image frame.
  • the terminal When receiving the image frame data sent by the synthesis thread, the terminal obtains the display times of the current image frame. Wherein, when the number of display times is 1, it indicates that the current image frame is displayed for the first time, and when the number of display times is greater than 1, it indicates that the current image frame is being repeatedly displayed.
  • Step 708 in response to the display times being greater than 1, reset the start point of the vertical synchronization signal of the display screen, and update the image frame displayed on the display screen according to the image frame data.
  • the terminal If new image frame data is received during the process of repeatedly displaying the current image frame, in order to update the image frame as soon as possible, the terminal does not need to update the image frame according to the hardware vertical synchronization signal, but resets the starting point of the vertical synchronization signal of the display screen. And immediately update the image frame displayed on the display screen according to the received image frame data.
  • the terminal resets the starting point of the vertical synchronization signal by modifying the register of the display screen, and after resetting the starting point of the vertical synchronization signal, the display screen starts from the starting point of the vertical synchronization signal and regenerates the hardware vertical synchronization signal according to the period of the vertical synchronization signal.
  • the display screen displays A frame image frame during the period of 0-T1 vertical synchronization signal, and receives B frame image during the period of display 0-T1 Frame data, so that B-frame image frames are displayed in the period of the vertical synchronization signal of T1-T2.
  • the display screen does not receive new image frame data during the period of the vertical synchronization signal of T1-T2
  • the display screen needs to wait for the new image frame data and display B frame image frames again.
  • the terminal T3 When the C frame image frame data is received at T3 (the interval between T3 and T2 is less than the period of the vertical synchronization signal), since the number of times the B frame image frame currently displayed on the display screen is displayed is greater than 1, the terminal T3 will reset at this time Set the starting point of the vertical synchronization signal, and display C frames in the period of the vertical synchronization signal T3-T4.
  • this step may include the following steps:
  • the terminal first determines the reset cost for resetting the starting point of the vertical synchronization signal according to the current hardware state, and the reset cost includes at least the reset time.
  • the reset time may be the time for the terminal to reset the register of the display screen.
  • the current hardware state includes at least one of processor load, display refresh frequency, and remaining memory, which is not limited in this embodiment.
  • the cost threshold is determined according to the waiting cost, and the waiting cost may be the duration from the next vertical synchronization signal. For example, when the cost threshold is the length of time from the next vertical synchronization signal, if the reset time is greater than the cost threshold, it indicates that when the reset of the start point of the vertical synchronization signal is completed, the next vertical synchronization signal has been received, and the reset start point is invalid at this time. Therefore, there is no need to reset the starting point.
  • the terminal When the reset cost is less than the cost threshold, the terminal resets the starting point of the vertical synchronization signal; if the reset cost is greater than the cost threshold, the terminal continues to display the current image frame until the hardware vertical synchronization signal is received to update the image frame.
  • the dynamic vertical synchronization signal period mechanism is introduced in the embodiment of the present application, so that the display screen can immediately update the image frame according to the received image frame data. Improve the display speed of images.
  • the display screen when the display screen processes the sleep state (in the sleep state, the display screen displays images according to the image frame data in its own memory) and receives new
  • the display screen needs its hardware vertical synchronization signal to update the image frame, resulting in a delay in the image update.
  • the terminal when the image frame data sent by the synthesis thread is received and the display screen is in a sleep state, the terminal resets the starting point of the vertical synchronization signal of the display screen and updates the display screen according to the image frame data.
  • Image frame For the process of resetting the starting point of the vertical synchronization signal of the display screen, reference may be made to the above step 708, which will not be repeated in this embodiment.
  • FIG. 11 shows a schematic structural diagram of a vertical synchronization device provided by an embodiment of the present application.
  • the device can be implemented as all or part of the terminal in Figure 1 through a dedicated hardware circuit, or a combination of software and hardware.
  • the device includes:
  • the request receiving module 1101 is configured to receive a vertical synchronization signal request sent by the requesting party, where the vertical synchronization signal request is used to request to obtain a vertical synchronization signal;
  • the obtaining module 1102 is configured to obtain the first request moment of the vertical synchronization signal request and the second request moment of the last received vertical synchronization signal request;
  • the first sending module 1103 is configured to send an analog vertical synchronization signal to the requester in response to the request time interval being greater than the duration threshold, where the request time interval is between the first request time and the second request time
  • the requester is used to perform a predetermined operation according to the analog vertical synchronization signal.
  • the duration threshold is determined according to a vertical synchronization signal period, the vertical synchronization signal period is used to indicate the time interval between two adjacent vertical synchronization signals, and the duration threshold is greater than or equal to the vertical synchronization signal period .
  • the requesting party is an application program
  • the request receiving module 1101 is configured to:
  • the first sending module 1103 is configured to:
  • the device further includes:
  • a first generation module configured to generate a first vertical synchronization signal according to a standard vertical synchronization signal in response to the request time interval being less than the duration threshold, and the standard vertical synchronization signal is generated by a signal generation thread;
  • the second sending module is configured to send the first vertical synchronization signal to the application program, and the application program is configured to perform picture drawing according to the first vertical synchronization signal.
  • the requester is a synthetic thread
  • the request receiving module 1101 is configured to:
  • the first sending module 1103 is configured to:
  • the device further includes:
  • a second generation module configured to generate a second vertical synchronization signal according to a standard vertical synchronization signal in response to the request time interval being less than the duration threshold, the standard vertical synchronization signal being generated by a signal generation thread;
  • the third sending module is configured to send the second vertical synchronization signal to the composition thread, and the composition thread is used to perform layer composition according to the second vertical synchronization signal.
  • the device further includes:
  • a data sending module configured to send image frame data to the display screen through the synthesis thread, where the image frame data is obtained after layer synthesis by the synthesis thread;
  • the frequency acquisition module is configured to acquire the display times of the image frame currently displayed on the display screen
  • the reset module is configured to reset the starting point of the vertical synchronization signal of the display screen in response to the number of display times being greater than 1, and update the image frame displayed on the display screen according to the image frame data.
  • the device further includes: a reset module for resetting the starting point of the vertical synchronization signal of the display screen in response to the display screen being in the sleep state in the command mode, and according to the image frame data Update the image frame displayed on the display screen.
  • a reset module for resetting the starting point of the vertical synchronization signal of the display screen in response to the display screen being in the sleep state in the command mode, and according to the image frame data Update the image frame displayed on the display screen.
  • the reset module includes:
  • a cost calculation unit configured to determine a reset cost for resetting the starting point of the vertical synchronization signal according to the current hardware state, the reset cost including the reset time;
  • the reset unit is configured to reset the starting point of the vertical synchronization signal in response to the reset cost being less than the cost threshold, and update the image frame displayed on the display screen according to the image frame data.
  • the introduction of the vertical synchronization signal simulation mechanism allows the requester to perform predetermined operations without waiting for the real vertical synchronization signal, thereby shortening the time for the requesting party to wait for the vertical synchronization signal and helping to improve the speed of the display screen.
  • the device provided in the above embodiment when implementing its functions, only uses the division of the above functional modules for illustration.
  • the above functions can be allocated by different functional modules as needed, namely The internal structure of the terminal is divided into different functional modules to complete all or part of the functions described above.
  • the apparatus and method embodiments provided by the above-mentioned embodiments belong to the same concept, and the specific implementation process is detailed in the method embodiments, which will not be repeated here.
  • the present application also provides a computer-readable medium on which program instructions are stored, and when the program instructions are executed by a processor, the vertical synchronization method provided by the foregoing method embodiments is implemented.
  • the present application also provides a computer program product containing instructions, which when run on a computer, causes the computer to execute the vertical synchronization method described in each of the foregoing embodiments.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Controls And Circuits For Display Device (AREA)

Abstract

一种垂直同步方法、装置、终端及存储介质,属于终端技术领域。所述方法包括:接收请求方发送的垂直同步信号请求,垂直同步信号请求用于请求获取垂直同步信号(401);获取垂直同步信号请求的第一请求时刻,以及上一次接收到垂直同步信号请求的第二请求时刻(402);响应于请求时间间隔大于时长阈值,向请求方发送模拟垂直同步信号,请求时间间隔为第一请求时刻与所述第二请求时刻之间的时间间隔,请求方用于根据模拟垂直同步信号执行预定操作(403)。相较于相关技术中需要等待真实的垂直同步请求才能执行操作,通过引入垂直同步信号模拟机制,使得请求方无需等待真实的垂直同步信号也可以执行预定操作,从而缩短了请求方等待垂直同步信号的时间,有助于提高显示屏显示画面的速度。

Description

垂直同步方法、装置、终端及存储介质
本申请要求于2019年04月09日提交的申请号为201910279674.2、发明名称为“垂直同步方法、装置、终端及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请实施例涉及终端技术领域,特别涉及一种垂直同步方法、装置、终端及存储介质。
背景技术
垂直同步(Vertical synchronization,Vsync)是一种提高终端画面流畅度的技术。
终端应用垂直同步技术后,应用程序接收到垂直同步信号时,即进行画面绘制;合成线程接收到垂直同步信号时,即对多个可见图层进行合成,并将合成的图像帧数据发送至显示屏;显示屏接收到垂直同步信号时,即对图像帧进行更新。
发明内容
本申请实施例提供了一种垂直同步方法、装置、终端及存储介质,所述技术方案如下:
一方面,本申请实施例提供了一种垂直同步方法,所述方法包括:
接收请求方发送的垂直同步信号请求,所述垂直同步信号请求用于请求获取垂直同步信号;
获取所述垂直同步信号请求的第一请求时刻,以及上一次接收到所述垂直同步信号请求的第二请求时刻;
响应于请求时间间隔大于时长阈值,向所述请求方发送模拟垂直同步信号,所述请求时间间隔为所述第一请求时刻与所述第二请求时刻之间的时间间隔,所述请求方用于根据所述模拟垂直同步信号执行预定操作。
另一方面,本申请实施例提供了一种垂直同步装置,所述装置包括:
请求接收模块,用于接收请求方发送的垂直同步信号请求,所述垂直同步信号请求用于请求获取垂直同步信号;
获取模块,用于获取所述垂直同步信号请求的第一请求时刻,以及上一次接收到所述垂直同步信号请求的第二请求时刻;
第一发送模块,用于响应于请求时间间隔大于时长阈值时,向所述请求方发送模拟垂直同步信号,所述请求时间间隔为所述第一请求时刻与所述第二请求时刻之间的时间间隔,所述请求方用于根据所述模拟垂直同步信号执行预定操作。
另一方面,本申请提供了一种终端,所述终端包括处理器、与所述处理器相连的存储器和显示屏,以及存储在所述存储器上的程序指令,所述处理器执行所述程序指令时实现如上 述方面所述的垂直同步方法。
另一方面,提供了一种计算机可读存储介质,其上存储有程序指令,所述程序指令被处理器执行时实现如上述方面所述的垂直同步方法。
本申请实施例提供的技术方案带来的有益效果至少包括:
本申请实施例中,接收到请求方发送的垂直同步信号请求后,根据该垂直同步信号请求的第一请求时刻,以及上一次接收到该垂直同步信号请求的第二请求时刻,计算请求时间间隔,并在请求时间间隔大于时长阈值时,向请求方发送模拟垂直同步信号,以便请求方根据模拟垂直同步信号执行预定操作;相较于相关技术中需要等待真实的垂直同步请求才能执行操作,通过引入垂直同步信号模拟机制,使得请求方无需等待真实的垂直同步信号也可以执行预定操作,从而缩短了请求方等待垂直同步信号的时间,有助于提高显示屏显示画面的速度。
附图说明
图1是本申请一个示例性实施例所提供的终端的结构示意图;
图2是Android系统中图形显示过程的原理示意图;
图3是相关技术中垂直同步过程的原理示意图;
图4示出了本申请一个示例性实施例提供的垂直同步方法的方法流程图;
图5示出了本申请另一个示例性实施例提供的垂直同步方法的方法流程图;
图6是图5所示垂直同步方法实施过程的原理示意图;
图7示出了本申请另一个示例性实施例提供的垂直同步方法的方法流程图;
图8是图7所示垂直同步方法实施过程的原理示意图;
图9示出了本申请另一个示例性实施例提供的垂直同步方法的方法流程图;
图10是图9所示垂直同步方法实施过程的原理示意图;
图11是本申请一个实施例提供的垂直同步装置的结构示意图。
具体实施方式
为使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请实施方式作进一步地详细描述。
下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本申请相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本申请的一些方面相一致的装置和方法的例子。
在本申请的描述中,需要理解的是,术语“第一”、“第二”等仅用于描述目的,而不能理解为指示或暗示相对重要性。在本申请的描述中,需要说明的是,除非另有明确的规定和限定,术语“相连”、“连接”应做广义理解,例如,可以是固定连接,也可以是可拆卸连接,或一体地连接;可以是机械连接,也可以是电连接;可以是直接相连,也可以通过中间媒介间 接相连。对于本领域的普通技术人员而言,可以具体情况理解上述术语在本申请中的具体含义。此外,在本申请的描述中,除非另有说明,“多个”是指两个或两个以上。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。字符“/”一般表示前后关联对象是一种“或”的关系。
在对本申请实施例进行解释说明之前,首先对本申请实施例的应用场景进行说明。图1示出了本申请一个示例性实施例所提供的终端的结构示意图。
该终端100是安装有目标应用程序的电子设备。该目标应用程序可以是系统程序或者第三方应用程序。其中,第三方应用程序是除了用户和操作系统之外的第三方制作的应用程序。比如,该目标应用程序可以是游戏应用程序或视频播放应用程序。
可选的,该终端100中包括:处理器120和存储器140。
处理器120可以包括一个或者多个处理核心。处理器120利用各种接口和线路连接整个终端100内的各个部分,通过运行或执行存储在存储器140内的指令、程序、代码集或指令集,以及调用存储在存储器140内的数据,执行终端100的各种功能和处理数据。可选的,处理器120可以采用数字信号处理(Digital Signal Processing,DSP)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、可编程逻辑阵列(Programmable Logic Array,PLA)中的至少一种硬件形式来实现。处理器120可集成中央处理器(Central Processing Unit,CPU)、图像处理器(Graphics Processing Unit,GPU)和调制解调器等中的一种或几种的组合。其中,CPU主要处理操作系统、用户界面和应用程序等;GPU用于负责显示屏所需要显示的内容的渲染和绘制;调制解调器用于处理无线通信。可以理解的是,上述调制解调器也可以不集成到处理器120中,单独通过一块芯片进行实现。
存储器140可以包括随机存储器(Random Access Memory,RAM),也可以包括只读存储器(Read-Only Memory)。可选的,该存储器140包括非瞬时性计算机可读介质(non-transitory computer-readable storage medium)。存储器140可用于存储指令、程序、代码、代码集或指令集。存储器140可包括存储程序区和存储数据区,其中,存储程序区可存储用于实现操作系统的指令、用于至少一个功能的指令(比如触控功能、声音播放功能、图像播放功能等)、用于实现下述各个方法实施例的指令等;存储数据区可存储下面各个方法实施例中涉及到的数据等。
本申请实施例中的终端120还包括显示屏160。可选的,显示屏160是触摸显示屏,用于接收用户使用手指、触摸笔等任何适合的物体在其上或附近的触摸操作,以及显示各个应用程序的用户界面。显示屏160通常设置在终端100的前面板,或者,同时设置在终端100的前面板和后面板。显示屏160可被设计成为全面屏、曲面屏或异型屏。显示屏160还可被设计成为全面屏与曲面屏的结合,异型屏与曲面屏的结合,本实施例对此不加以限定。
除此之外,本领域技术人员可以理解,上述附图所示出的终端100的结构并不构成对终端100的限定,终端可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。比如,终端100中还包括射频电路、输入单元、传感器、音频电路、无线保真(Wireless  Fidelity,WiFi)模块、电源、蓝牙模块等部件,在此不再赘述。
为了便于理解,下面首先对终端中的图形显示系统进行说明,且下述实施例以安卓(Android)图形显示系统为例进行示意性说明。
终端的图形显示过程分为图层绘制、图层合成以及图像帧更新这三个阶段。其中,图层绘制由应用程序执行,图层合成由合成线程执行,图像帧更新则由显示屏执行。
如图2所示,显示屏21从帧缓冲区中读取图像帧数据,且读取的过程为:从帧缓冲区的起始地址开始,按照从上往下,从左往右的顺序进行扫描,从而将扫描到的内容映射在显示屏上。
由于显示屏21中显示的内容需要不断更新,若在同一帧缓冲区内进行读取和写入操作,将会导致显示屏21中同时显示多帧内容,因此,终端采用双缓冲机制,其中,双缓冲区中的一个缓冲区用于内容读取显示,而另一个缓冲区用于后台图形合成和写入。
示意性的,如图2所示,前缓冲区22为显示屏所要显示内容的帧缓冲区,后缓冲区23为用于合成下一帧图形的帧缓冲区。当前一帧显示完毕,后一帧写入完毕时,显示屏21即读取后缓冲区23中的内容,相应的,前缓冲区22中即进行下一帧图形的合成(前后缓冲区角色互换)。
SurfaceFlinger作为图层合成者(其中包括合成线程),用于对上层(应用程序)传递的多个图层(surface)进行合成,并提交到显示屏21的缓冲区中,供显示屏21读取显示。如图2所示,后缓冲区23中的内容由SurfaceFlinger24对多个surface 25合成而成。其中,每个surface对应上层的一个窗口(window),比如对话框、状态栏、活动(Activity)。
为了使应用程序和合成线程能够根据显示屏的刷新频率进行画面绘制及合成,从而避免出现画面卡顿,显示屏根据硬件垂直同步信号(硬件垂直同步信号的产生频率与显示屏的刷新频率一致)进行图像帧更新,而应用程序和合成线程则通过请求软件垂直同步信号(与硬件同步信号保持同步)的方式进行画面绘制和合成。
如图3所示,其示出了相关技术中垂直同步过程的原理示意图。当应用程序需要进行图层绘制时,向SurfaceFlinger发送垂直同步信号请求,等待SurfaceFlinger在下一个垂直同步时间点,向应用程序反馈垂直同步信号(SurfaceFlinger处分发的垂直同步信号为软件垂直同步信号,软件垂直同步信号由SurfaceFlinger根据硬件上报的硬件垂直同步信号生成)。应用程序接收到垂直同步信号后,即进行图层绘制,并将绘制得到的图层数据发送给SurfaceFlinger。SurfaceFlinger接收到图层数据后,在到达下一个垂直同步时间点时,根据图层数据进行图层合成,并将生成的图像帧数据发送给显示屏。若当前正在显示图像帧,显示屏则在下一个垂直同步时间点处根据接收到的图像帧数据进行图像帧更新。
可见,相关技术中,应用程序、SurfaceFlinger和显示屏都需要在接收到垂直同步信号后才能工作,而应用程序、SurfaceFlinger和显示屏在等待垂直同步信号将会造成画面显示出现延迟。比如,对于刷新频率为60Hz的显示屏,其垂直同步信号间隔为16.7ms,在极端情况下,若应用程序、SurfaceFlinger和显示屏都等待了16.7ms,一帧图像的绘制到显示将经过50ms。
为了解决相关技术中,由于垂直同步信号等待时间较长,导致画面显示出现延迟的问题,本申请实施例提供的垂直同步方法中,通过在接收到垂直同步信号请求时,根据本次垂直同步信号请求的请求时刻以及上一次垂直同步信号请求的请求时刻,确定两次请求之间的请求时间间隔是否过长,从而在请求时间间隔过长时,模拟一个垂直同步信号给请求方,以便请求方根据模拟出的垂直同步信号立即执行相应操作,缩短请求方等待垂直同步信号的时间,进而降低画面的显示延迟。下面采用示意性的实施例进行说明。
请参考图4,其示出了本申请一个示例性实施例提供的垂直同步方法的方法流程图。该方法可以包括如下步骤。
步骤401,接收请求方发送的垂直同步信号请求,垂直同步信号请求用于请求获取垂直同步信号。
可选的,该请求方包括应用程序和合成线程中的至少一种,相应的,该垂直同步信号请求是应用程序在进行图层绘制前发送的垂直同步信号请求,或者,是合成线程在进行图层合成前发送的垂直同步信号请求。
步骤402,获取垂直同步信号请求的第一请求时刻,以及上一次接收到垂直同步信号请求的第二请求时刻。
本申请实施例中,终端每次接收请求方发送的垂直同步信号请求后,都会记录垂直同步信号请求的请求时刻。当再次接收到该请求方发送的垂直同步信号请求时,终端即获取当前垂直同步信号请求的第一请求时刻,以及该请求方上一次发送垂直同步信号请求的第二请求时刻,并根据第一请求时刻和第二请求时刻计算相邻两次垂直同步信号请求之间的请求时间间隔,其中,请求时间间隔=第一请求时刻-第二请求时刻。
步骤403,响应于请求时间间隔大于时长阈值,向请求方发送模拟垂直同步信号,请求时间间隔为第一请求时刻与所述第二请求时刻之间的时间间隔,请求方用于根据模拟垂直同步信号执行预定操作。
在一种可能的实施方式中,SurfaceFlinger进程中包含信号生成线程以及信号发送线程,其中,信号生成线程用于产生标准垂直同步信号(基于硬件垂直同步信号生成标称垂直同步信号),而信号发送线程则用于对标准垂直同步信号进行处理(比如增加时间偏置)后,将垂直同步信号发送给请求方。
不同于相关技术中,信号发送线程需要接收到信号生成线程生成的标准垂直同步信号后,才会向请求方反馈垂直同步信号,可选的,本申请实施例中,当请求方相邻两次请求之间的请求时间间隔大于时长阈值时(表明前一次发送垂直同步信号请求后,经过较长的等待时间才接收到垂直同步信号),信号发送线程生成模拟垂直同步信号,并将该模拟垂直同步信号发送给请求方。
可选的,本申请实施例中的信号发送线程具有生成模拟垂直同步信号的功能,且生成的模拟垂直同步信号与真实垂直同步信号(根据标准垂直同步信号向请求方发送的垂直同步信号)相同,只是模拟垂直同步信号并非根据硬件垂直同步信号产生,而是通过模拟得到。
可选的,模拟垂直同步信号设置有相应的标识,从而与真实垂直同步信号进行区分。
相应的,请求方接收到模拟垂直同步信号后,根据模拟垂直同步信号执行预定操作。由于无需等待真实垂直同步信号,因此请求方请求垂直同步信号的时间得到的缩短,进而降低了画面的显示延迟。
在一种可能的实施方式中,该时长阈值根据垂直同步信号周期确定,垂直同步信号周期用于指示相邻两个垂直同步信号之间的时间间隔,且时长阈值大于等于垂直同步信号周期。比如,时长阈值为一个垂直同步信号周期,或1.2个垂直同步信号周期,或1.5个垂直同步信号周期。
在一个示意性的例子中,当显示屏的刷新频率为60Hz时,该垂直同步信号周期为16.7ms,相应的,将时长阈值被确定为16.7ms。
可选的,当请求方相邻两次请求之间的请求时间间隔小于时长阈值时,信号发送线程根据信号生成线程生成的标准垂直同步信号,向请求方发送(真实)垂直同步信号,以便请求方根据垂直同步信号执行预定操作。
综上所述,本申请实施例中,接收到请求方发送的垂直同步信号请求后,根据该垂直同步信号请求的第一请求时刻,以及上一次接收到该垂直同步信号请求的第二请求时刻,计算请求时间间隔,并在请求时间间隔大于时长阈值时,向请求方发送模拟垂直同步信号,以便请求方根据模拟垂直同步信号执行预定操作;相较于相关技术中需要等待真实的垂直同步请求才能执行操作,通过引入垂直同步信号模拟机制,使得请求方无需等待真实的垂直同步信号也可以执行预定操作,从而缩短了请求方等待垂直同步信号的时间,有助于提高显示屏显示画面的速度。
可选的,时长阈值根据垂直同步信号周期确定,所述垂直同步信号周期用于指示相邻两个垂直同步信号之间的时间间隔,且所述时长阈值大于等于所述垂直同步信号周期。
可选的,所述请求方为应用程序;
所述接收请求方发送的垂直同步信号请求,包括:
接收所述应用程序发送的第一垂直同步信号请求;
所述向所述请求方发送模拟垂直同步信号,包括:
向所述应用程序发送第一模拟垂直同步信号,所述应用程序用于根据所述第一模拟垂直同步信号进行画面绘制。
可选的,所述获取所述垂直同步信号请求的第一请求时刻,以及上一次接收到所述垂直同步信号请求的第二请求时刻之后,所述方法还包括:
响应于所述请求时间间隔小于所述时长阈值,根据标准垂直同步信号生成第一垂直同步信号,所述标准垂直同步信号由信号生成线程生成;
向所述应用程序发送所述第一垂直同步信号,所述应用程序用于根据所述第一垂直同步信号进行画面绘制。
可选的,其中,所述请求方为合成线程;
所述接收请求方发送的垂直同步信号请求,包括:
接收所述合成线程发送的第二垂直同步信号请求;
所述向所述请求方发送模拟垂直同步信号,包括:
向所述合成线程发送第二模拟垂直同步信号,所述合成线程用于根据所述第二模拟垂直同步信号进行图层合成。
可选的,所述获取所述垂直同步信号请求的第一请求时刻,以及上一次接收到所述垂直同步信号请求的第二请求时刻之后,所述方法还包括:
响应于所述请求时间间隔小于所述时长阈值,根据标准垂直同步信号生成第二垂直同步信号,所述标准垂直同步信号由信号生成线程生成;
向所述合成线程发送所述第二垂直同步信号,所述合成线程用于根据所述第二垂直同步信号进行图层合成。
可选的,所述向所述合成线程发送所述第二垂直同步信号之后,所述方法还包括:
通过所述合成线程向显示屏发送图像帧数据,所述图像帧数据由所述合成线程进行图层合成后得到;
获取所述显示屏当前显示图像帧的显示次数;
响应于所述显示次数大于1,重置所述显示屏的垂直同步信号起点,并根据所述图像帧数据更新所述显示屏显示的图像帧。
可选的,所述通过所述合成线程向显示屏发送图像帧数据之后,所述方法还包括:
响应于所述显示屏处于命令command模式下的睡眠状态,重置所述显示屏的垂直同步信号起点,并根据所述图像帧数据更新所述显示屏显示的图像帧。
可选的,其中,所述重置垂直同步信号起点,并根据所述图像帧数据更新所述显示屏显示的图像帧,包括:
根据当前硬件状态确定重置垂直同步信号起点的重置代价,所述重置代价包括重置时间;
响应于所述重置代价小于代价阈值,重置垂直同步信号起点,并根据所述图像帧数据更新所述显示屏显示的图像帧。
在一种可能的实施方式中,SurfaceFlinger进程中包括产生标准垂直同步信号(即软件垂直同步信号)的信号生成线程(VsyncThread)、关注应用程序的垂直同步信号的第一活动线程(EventThread(APP))、关注合成线程的垂直同步信号的第二活动线程(EventThread(Surface))、根据标准垂直同步信号发送垂直同步信号的信号发送线程(DispSyncThread)以及负责合成图层的合成线程。下面采用实施例,分别对应用程序请求获取垂直同步信号以及合成线程请求获取垂直同步信号的过程进行说明。
请参考图5,其示出了本申请另一个示例性实施例提供的垂直同步方法的方法流程图。该方法可以包括如下步骤。
步骤501,接收应用程序发送的第一垂直同步信号请求。
在一种可能的实施方式中,当应用程序需要绘制图层时,即向SurfaceFlinger进程中的第一活动线程发送第一垂直同步信号请求,由第一活动线程向信号发送线程发送该第一垂直同 步信号请求。相应的,信号发送线程接收该第一垂直同步信号请求。
步骤502,获取第一垂直同步信号请求的第一请求时刻,以及上一次接收到垂直同步信号请求的第二请求时刻。
与上述步骤402相似的,SurfaceFlinger进程的信号发送线程获取到第一垂直同步信号请求的第一请求时刻,以及上一次接收到应用程序发送的第一垂直同步信号请求的第二请求时刻,并计算第一请求时刻与第二请求时刻之间的请求时间间隔。
在一个示意性的例子中,如图6所示,SurfaceFlinger进程(信号发送线程)获取到第一请求时刻为t1,第二请求时刻为t2,并计算得到请求时间间隔为t1-t2=20ms。
步骤503,响应于请求时间间隔大于时长阈值,向应用程序发送第一模拟垂直同步信号,应用程序用于根据第一模拟垂直同步信号进行画面绘制。
可选的,该时长阈值为显示屏的一个垂直同步信号周期。比如,当终端的显示屏为60Hz时,该垂直同步信号周期为16.7ms。
相应的,当第一请求时刻与第二请求时刻之间的请求时间间隔大于一个垂直同步信号周期时,SurfaceFlinger线程中的信号发送线程则通过垂直同步信号模拟功能,生成第一模拟垂直同步信号,并将第一模拟垂直同步信号发送给应用程序(首先将第一模拟垂直同步信号发送给第一活动线程,由第一活动线程发送给应用程序)。
结合上述步骤502中的示例,由于相邻两次请求之间的请求时间间隔(20ms)大于一个垂直同步信号周期(16.7ms),因此,SurfaceFlinger立即向应用程序发送第一模拟垂直同步信号。
在其他可能的实施方式中,当连续n(n≥3)次第一垂直同步信号请求之间的n-1个请求时间间隔均大于时长阈值时,终端通过SurfaceFlinger进程向应用程序发送第一模拟垂直同步信号,本实施例对此不做限定。
可选的,应用程序接收到该第一模拟垂直同步信号后,进行图层绘制,并将绘制得到的图层数据发送给SurfaceFlinger。示意性的,如图6所示,应用程序接收到第一模拟垂直同步信号后进行图层绘制,并将图层数据发送至SurfaceFlinger进程(中的合成线程)。
步骤504,响应于请求时间间隔小于时长阈值,根据标准垂直同步信号生成第一垂直同步信号,标准垂直同步信号由信号生成线程生成。
当相邻两次请求之间的请求时间间隔小于时长阈值时,表明应用程序等待垂直同步信号的时间较短,因此终端可以根据标准垂直同步信号生成第一垂直同步信号。
在一种可能的实施方式中,当请求时间间隔小于时长阈值时,信号发送线程即在接收到信号生成线程产生的标准垂直同步信号后,生成第一垂直同步信号。
步骤505,向应用程序发送第一垂直同步信号,应用程序用于根据第一垂直同步信号进行画面绘制。
进一步的,终端向应用程序发送第一垂直同步信号,以便应用程序根据第一垂直同步信号进行画面绘制。
在一种可能的实施方式中,信号发送线程将第一垂直同步信号发送至第一活动线程,由 第一活动线程将第一垂直同步信号发送给应用程序。
本实施例中,当应用程序相邻两次请求的请求时间间隔大于时长阈值时,通过模拟一个垂直同步信号给应用程序,使得应用程序能够立即进行图层绘制,避免应用程序长时间得到真实的垂直同步信号,从而提高了应用程序的画面绘制效率。
在一种可能的实施方式中,SurfaceFlinger进程中的合成线程接收到应用程序发送的图层数据后,会向SurfaceFlinger进程中的信号发送线程请求垂直同步信号。为了降低合成线程等待垂直同步信号的时长,信号发送线程可以在(合成线程)相邻两次请求之间的请求时间间隔过长时,向合成线程发送模拟垂直同步信号。请参考图7,其示出了本申请另一个示例性实施例提供的垂直同步方法的方法流程图。该方法可以包括如下步骤。
步骤701,接收合成线程发送的第二垂直同步信号请求。
在一种可能的实施方式中,当合成线程接收到应用程序发送的图层数据,并需要进行图层合成时,即向SurfaceFlinger进程中的第二活动线程发送第二垂直同步信号请求,由第二活动线程向信号发送线程发送该第二垂直同步信号请求。相应的,信号发送线程接收该第二垂直同步信号请求。
步骤702,获取第二垂直同步信号请求的第一请求时刻,以及上一次接收到第二垂直同步信号请求的第二请求时刻。
与上述步骤402相似的,SurfaceFlinger进程的信号发送线程获取到第二垂直同步信号请求的第一请求时刻,以及上一次接收到合成线程发送的第二垂直同步信号请求的第二请求时刻,并计算第一请求时刻与第二请求时刻之间的请求时间间隔。
在一个示意性的例子中,如图8所示,SurfaceFlinger进程(信号发送线程)获取到第一请求时刻为t1,第二请求时刻为t2,并计算得到请求时间间隔为t1-t2=25ms。
步骤703,响应于请求时间间隔大于时长阈值,向合成线程发送第二模拟垂直同步信号,合成线程用于根据第二模拟垂直同步信号进行图层合成。
可选的,该时长阈值为显示屏的一个垂直同步信号周期。比如,当终端的显示屏为60Hz时,该垂直同步信号周期为16.7ms。
相应的,当第一请求时刻与第二请求时刻之间的请求时间间隔大于一个垂直同步信号周期时,SurfaceFlinger线程中的信号发送线程则通过垂直同步信号模拟功能,生成第二模拟垂直同步信号,并将第二模拟垂直同步信号发送给合成线程(首先将第二模拟垂直同步信号发送给第二活动线程,由第二活动线程发送给合成线程)。
结合上述步骤702中的示例,由于相邻两次请求之间的请求时间间隔(25ms)大于一个垂直同步信号周期(16.7ms),因此,SurfaceFlinger立即向合成线程发送第二模拟垂直同步信号。
在其他可能的实施方式中,当连续n(n≥3)次第二垂直同步信号请求之间的n-1个请求时间间隔均大于时长阈值时,终端通过SurfaceFlinger进程向合成线程发送第二模拟垂直同步信号,本实施例对此不做限定。
可选的,合成线程接收到该第二模拟垂直同步信号后,进行图层合成,并将合成得到的图像帧数据发送给显示屏。
结合上述步骤中的示例,如图8所示,由于相邻两次请求的请求时间间隔(25ms)大于一个垂直同步信号周期(16.7ms),因此,SurfaceFlinger进程中的信号发送线程(图中未示出)向合成线程发送第二模拟垂直同步信号。合成线程接收到第二模拟垂直同步信号后,无需等待真实垂直同步信号即可进行图层合成,从而将合成得到的图像帧数据发送至显示屏。
步骤704,响应于请求时间间隔小于时长阈值,根据标准垂直同步信号生成第二垂直同步信号,标准垂直同步信号由信号生成线程生成。
当相邻两次请求之间的请求时间间隔小于时长阈值时,表明合成线程等待垂直同步信号的时间较短,因此终端可以根据标准垂直同步信号生成第二垂直同步信号。
在一种可能的实施方式中,当请求时间间隔小于时长阈值时,信号发送线程即在接收到信号生成线程产生的标准垂直同步信号后,生成第二垂直同步信号。
步骤705,向合成线程发送第二垂直同步信号,合成线程用于根据第二垂直同步信号进行图层合成。
进一步的,终端向合成线程发送第二垂直同步信号,以便合成线程根据第二垂直同步信号进行图层合成。
在一种可能的实施方式中,信号发送线程将第二垂直同步信号发送至第二活动线程,由第二活动线程将第二垂直同步信号发送给合成线程。
本实施例中,当合成线程相邻两次请求的请求时间间隔大于时长阈值时,通过模拟一个垂直同步信号给合成线程,使得合成线程能够立即进行图层合成操作,避免合成线程长时间得到真实的垂直同步信号,从而提高了图层的合成效率。
为了验证上述垂直同步方法的优化效果,测试人员分别对桌面点击场景、应用内点击场景下,绘制到画面显示的平均时长进行统计,得到的实验数据如表一所示。
表一
Figure PCTCN2020081131-appb-000001
通过表一中的数据可以发现,应用上述垂直同步方法后,绘制到画面显示的平均时长分别优化了8ms(桌面点击场景)和9ms(应用内点击场景),且标准差更小,即画面帧率更加稳定。
上述实施例提供的垂直同步方式是针对软件层面的优化,为了进一步降低画面显示延迟,在一种可能的实施方式中,可以从硬件层面对显示屏更新图像帧时的等待时间进行优化。在图7的基础上,如图9所示,步骤703和705之后还可以包括如下步骤。
步骤706,通过合成线程向显示屏发送图像帧数据,图像帧数据由合成线程进行图层合成后得到。
相应的,显示屏接收到该图像帧数据后,即将图像帧数据写入缓冲区中。
步骤707,获取显示屏当前显示图像帧的显示次数。
相关技术中,合成线程发送的图像帧数据被写入显示屏的缓冲区,当接收到硬件垂直同步信号时,显示屏根据缓冲区内的图像帧数据进行图像帧更新。
在一种可能的场景下,若未接收到合成线程发送的新的图像帧数据,显示屏需要重复显示上一图像帧,直至合成线程发送新的图像帧数据后,在下一个垂直同步信号周期内更新图像帧,即同一图像帧存在重复显示多次的情况。为了提高这种场景下图像帧的更新速度,本申请实施例中,当接收到合成线程发送的图像帧数据时,终端并非固定在接收到硬件垂直同步信号时才会进行图像帧更新,而是根据显示屏当前显示的图像帧确定是否需要立即进行图像帧更新。
在一种可能的实施方式中,显示屏进行显示时,会记录当前图像帧的显示次数,当接收到合成线程发送的图像帧数据时,终端即获取当前图像帧的显示次数。其中,当显示次数为1次时,表明当前图像帧为首次显示,当显示次数大于1,表明当前图像帧正在重复显示。
步骤708,响应于显示次数大于1,重置显示屏的垂直同步信号起点,并根据图像帧数据更新显示屏显示的图像帧。
若在重复显示当前图像帧的过程中接收到新的图像帧数据,为了尽快对图像帧进行更新,终端无需根据硬件垂直同步信号进行图像帧更新,而是重置显示屏的垂直同步信号起点,并立即根据接收到的图像帧数据更新显示屏显示的图像帧。
其中,终端通过修改显示屏的寄存器来重置垂直同步信号起点,且重置垂直同步信号起点后,显示屏从该垂直同步信号起点开始,重新根据垂直同步信号周期产生硬件垂直同步信号。
在一个示意性的例子中,如图10所示,显示屏在0-T1这一垂直同步信号周期内显示A帧图像帧,且在显示0-T1这一时间段内收到B帧的图像帧数据,从而在T1-T2这一垂直同步信号周期内显示B帧图像帧。然而,由于在T1-T2这一垂直同步信号周期内,显示屏并未收到新的图像帧数据,因此,显示屏需要等待新的图像帧数据并再次显示B帧图像帧。当在T3(T3与T2的间隔小于垂直同步信号周期)时刻接收到C帧的图像帧数据时,由于显示屏当前显示的B帧图像帧的显示次数大于1,因此,终端T3这一时刻重置垂直同步信号起点, 并在T3-T4这一垂直同步信号周期内显示C帧图像帧。
由于重置垂直同步信号起点时需要一定的开销,因此为了避免出现重置代价过大的情况,在一种可能的实施方式中,本步骤可以包括如下步骤:
一、根据当前硬件状态确定重置垂直同步信号起点的重置代价,重置代价包括重置时间。
可选的,若当前图像帧的显示次数大于1时,终端首先根据当前硬件状态确定重置垂直同步信号起点的重置代价,该重置代价至少包括重置时间。其中,该重置时间可以为终端重置显示屏的寄存器的时间。
可选的,当前硬件状态包括处理器负载、显示屏刷新频率、内存剩余量中的至少一种,本实施例对此不做限定。
二、响应于重置代价小于代价阈值,重置垂直同步信号起点,并根据图像帧数据更新显示屏显示的图像帧。
可选的,该代价阈值根据等待代价确定,该等待代价可以距离下一个垂直同步信号的时长。比如,当代价阈值为距离下一个垂直同步信号的时长时,若重置时间大于代价阈值,表明完成垂直同步信号起点重置时,已经接收到下一个垂直同步信号,此时重置起点无效,因此,无需进行起点重置。
当重置代价小于代价阈值时,终端则重置垂直同步信号起点;若重置代价大于代价阈值时,终端则继续显示当前图像帧,直到接收到硬件垂直同步信号时进行图像帧更新。
不同于相关技术中需要等到硬件垂直同步信号时才能进行图像帧更新,本申请实施例中通过引入动态垂直同步信号周期机制,使得显示屏能够根据接收到的图像帧数据立即进行图像帧更新,从而提高图像的显示速度。
在另一种可能的应用场景下,对于支持命令(Command)模式的显示屏,当显示屏处理睡眠状态(睡眠状态下,显示屏根据自身存储器中的图像帧数据进行图像显示)且接收到新的图像帧数据时,相关技术中,显示屏需要对其硬件垂直同步信号后才能进行图像帧更新,导致图像更新存在延迟。为了降低图像更新延迟,可选的,当接收到合成线程发送的图像帧数据,且显示屏处于睡眠状态时,终端重置显示屏的垂直同步信号起点,并根据图像帧数据更新显示屏显示的图像帧。其中,重置显示屏的垂直同步信号起点的过程可以参考上述步骤708,本实施例在此不再赘述。
下述为本申请装置实施例,可以用于执行本申请方法实施例。对于本申请装置实施例中未披露的细节,请参照本申请方法实施例。
请参考图11,其示出了本申请一个实施例提供的垂直同步装置的结构示意图。该装置可以通过专用硬件电路,或者,软硬件的结合实现成为图1中的终端的全部或一部分,该装置包括:
请求接收模块1101,用于接收请求方发送的垂直同步信号请求,所述垂直同步信号请求用于请求获取垂直同步信号;
获取模块1102,用于获取所述垂直同步信号请求的第一请求时刻,以及上一次接收到所述垂直同步信号请求的第二请求时刻;
第一发送模块1103,用于响应于请求时间间隔大于时长阈值时,向所述请求方发送模拟垂直同步信号,所述请求时间间隔为所述第一请求时刻与所述第二请求时刻之间的时间间隔,所述请求方用于根据所述模拟垂直同步信号执行预定操作。
可选的,所述时长阈值根据垂直同步信号周期确定,所述垂直同步信号周期用于指示相邻两个垂直同步信号之间的时间间隔,且所述时长阈值大于等于所述垂直同步信号周期。
可选的,所述请求方为应用程序;
所述请求接收模块1101,用于:
接收所述应用程序发送的第一垂直同步信号请求;
所述第一发送模块1103,用于:
向所述应用程序发送第一模拟垂直同步信号,所述应用程序用于根据所述第一模拟垂直同步信号进行画面绘制。
可选的,所述装置还包括:
第一生成模块,用于响应于所述请求时间间隔小于所述时长阈值,根据标准垂直同步信号生成第一垂直同步信号,所述标准垂直同步信号由信号生成线程生成;
第二发送模块,用于向所述应用程序发送所述第一垂直同步信号,所述应用程序用于根据所述第一垂直同步信号进行画面绘制。
可选的,所述请求方为合成线程;
所述请求接收模块1101,用于:
接收所述合成线程发送的第二垂直同步信号请求;
所述第一发送模块1103,用于:
向所述合成线程发送第二模拟垂直同步信号,所述合成线程用于根据所述第二模拟垂直同步信号进行图层合成。
可选的,所述装置还包括:
第二生成模块,用于响应于所述请求时间间隔小于所述时长阈值,根据标准垂直同步信号生成第二垂直同步信号,所述标准垂直同步信号由信号生成线程生成;
第三发送模块,用于向所述合成线程发送所述第二垂直同步信号,所述合成线程用于根据所述第二垂直同步信号进行图层合成。
可选的,所述装置还包括:
数据发送模块,用于通过所述合成线程向显示屏发送图像帧数据,所述图像帧数据由所述合成线程进行图层合成后得到;
次数获取模块,用于获取所述显示屏当前显示图像帧的显示次数;
重置模块,用于响应于所述显示次数大于1,则重置所述显示屏的垂直同步信号起点,并根据所述图像帧数据更新所述显示屏显示的图像帧。
可选的,所述装置还包括:重置模块,用于响应于所述显示屏处于命令command模式下 的睡眠状态,重置所述显示屏的垂直同步信号起点,并根据所述图像帧数据更新所述显示屏显示的图像帧。
可选的,所述重置模块,包括:
代价计算单元,用于根据当前硬件状态确定重置垂直同步信号起点的重置代价,所述重置代价包括重置时间;
重置单元,用于响应于所述重置代价小于代价阈值,重置垂直同步信号起点,并根据所述图像帧数据更新所述显示屏显示的图像帧。
综上所述,本申请实施例中,接收到请求方发送的垂直同步信号请求后,根据该垂直同步信号请求的第一请求时刻,以及上一次接收到该垂直同步信号请求的第二请求时刻,计算请求时间间隔,并在请求时间间隔大于时长阈值时,向请求方发送模拟垂直同步信号,以便请求方根据模拟垂直同步信号执行预定操作;相较于相关技术中需要等待真实的垂直同步请求才能执行操作,通过引入垂直同步信号模拟机制,使得请求方无需等待真实的垂直同步信号也可以执行预定操作,从而缩短了请求方等待垂直同步信号的时间,有助于提高显示屏显示画面的速度。
需要说明的是,上述实施例提供的装置,在实现其功能时,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将终端的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。另外,上述实施例提供的装置与方法实施例属于同一构思,其具体实现过程详见方法实施例,这里不再赘述。
本申请还提供一种计算机可读介质,其上存储有程序指令,程序指令被处理器执行时实现上述各个方法实施例提供的垂直同步方法。
本申请还提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述各个实施例所述的垂直同步方法。
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。
本领域普通技术人员可以理解实现上述实施例的帧率控制方法中全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。以上所述仅为本申请的较佳实施例,并不用以限制本申请,凡在本申请的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。

Claims (20)

  1. 一种垂直同步方法,所述方法包括:
    接收请求方发送的垂直同步信号请求,所述垂直同步信号请求用于请求获取垂直同步信号;
    获取所述垂直同步信号请求的第一请求时刻,以及上一次接收到所述垂直同步信号请求的第二请求时刻;
    响应于请求时间间隔大于时长阈值,向所述请求方发送模拟垂直同步信号,所述请求时间间隔为所述第一请求时刻与所述第二请求时刻之间的时间间隔,所述请求方用于根据所述模拟垂直同步信号执行预定操作。
  2. 根据权利要求1所述的方法,其中,所述时长阈值根据垂直同步信号周期确定,所述垂直同步信号周期用于指示相邻两个垂直同步信号之间的时间间隔,且所述时长阈值大于等于所述垂直同步信号周期。
  3. 根据权利要求1或2所述的方法,其中,所述请求方为应用程序;
    所述接收请求方发送的垂直同步信号请求,包括:
    接收所述应用程序发送的第一垂直同步信号请求;
    所述向所述请求方发送模拟垂直同步信号,包括:
    向所述应用程序发送第一模拟垂直同步信号,所述应用程序用于根据所述第一模拟垂直同步信号进行画面绘制。
  4. 根据权利要求3所述的方法,其中,所述获取所述垂直同步信号请求的第一请求时刻,以及上一次接收到所述垂直同步信号请求的第二请求时刻之后,所述方法还包括:
    响应于所述请求时间间隔小于所述时长阈值,根据标准垂直同步信号生成第一垂直同步信号,所述标准垂直同步信号由信号生成线程生成;
    向所述应用程序发送所述第一垂直同步信号,所述应用程序用于根据所述第一垂直同步信号进行画面绘制。
  5. 根据权利要求1或2所述的方法,其中,所述请求方为合成线程;
    所述接收请求方发送的垂直同步信号请求,包括:
    接收所述合成线程发送的第二垂直同步信号请求;
    所述向所述请求方发送模拟垂直同步信号,包括:
    向所述合成线程发送第二模拟垂直同步信号,所述合成线程用于根据所述第二模拟垂直同步信号进行图层合成。
  6. 根据权利要求5所述的方法,其中,所述获取所述垂直同步信号请求的第一请求时刻,以及上一次接收到所述垂直同步信号请求的第二请求时刻之后,所述方法还包括:
    响应于所述请求时间间隔小于所述时长阈值,根据标准垂直同步信号生成第二垂直同步信号,所述标准垂直同步信号由信号生成线程生成;
    向所述合成线程发送所述第二垂直同步信号,所述合成线程用于根据所述第二垂直同步信号进行图层合成。
  7. 根据权利要求6所述的方法,其中,所述向所述合成线程发送所述第二垂直同步信号之后,所述方法还包括:
    通过所述合成线程向显示屏发送图像帧数据,所述图像帧数据由所述合成线程进行图层合成后得到;
    获取所述显示屏当前显示图像帧的显示次数;
    响应于所述显示次数大于1,重置所述显示屏的垂直同步信号起点,并根据所述图像帧数据更新所述显示屏显示的图像帧。
  8. 根据权利要求7所述的方法,其中,所述通过所述合成线程向显示屏发送图像帧数据之后,所述方法还包括:
    响应于所述显示屏处于命令command模式下的睡眠状态,重置所述显示屏的垂直同步信号起点,并根据所述图像帧数据更新所述显示屏显示的图像帧。
  9. 根据权利要求7或8所述的方法,其中,所述重置垂直同步信号起点,并根据所述图像帧数据更新所述显示屏显示的图像帧,包括:
    根据当前硬件状态确定重置垂直同步信号起点的重置代价,所述重置代价包括重置时间;
    响应于所述重置代价小于代价阈值,重置垂直同步信号起点,并根据所述图像帧数据更新所述显示屏显示的图像帧。
  10. 一种垂直同步装置,其特征在于,所述装置包括:
    请求接收模块,用于接收请求方发送的垂直同步信号请求,所述垂直同步信号请求用于请求获取垂直同步信号;
    获取模块,用于获取所述垂直同步信号请求的第一请求时刻,以及上一次接收到所述垂直同步信号请求的第二请求时刻;
    第一发送模块,用于响应于请求时间间隔大于时长阈值,向所述请求方发送模拟垂直同步信号,所述请求时间间隔为所述第一请求时刻与所述第二请求时刻之间的时间间隔,所述请求方用于根据所述模拟垂直同步信号执行预定操作。
  11. 根据权利要求10所述的装置,其中,所述时长阈值根据垂直同步信号周期确定,所述垂直同步信号周期用于指示相邻两个垂直同步信号之间的时间间隔,且所述时长阈值大于等于所述垂直同步信号周期。
  12. 根据权利要求10或11所述的装置,其中,所述请求方为应用程序;
    所述请求接收模块,用于:
    接收所述应用程序发送的第一垂直同步信号请求;
    所述第一发送模块,用于:
    向所述应用程序发送第一模拟垂直同步信号,所述应用程序用于根据所述第一模拟垂直同步信号进行画面绘制。
  13. 根据权利要求12所述的装置,其中,所述装置还包括:
    第一生成模块,用于响应于所述请求时间间隔小于所述时长阈值,根据标准垂直同步信号生成第一垂直同步信号,所述标准垂直同步信号由信号生成线程生成;
    第二发送模块,用于向所述应用程序发送所述第一垂直同步信号,所述应用程序用于根据所述第一垂直同步信号进行画面绘制。
  14. 根据权利要求10或11所述的装置,其中,所述请求方为合成线程;
    所述请求接收模块,用于:
    接收所述合成线程发送的第二垂直同步信号请求;
    所述第一发送模块,用于:
    向所述合成线程发送第二模拟垂直同步信号,所述合成线程用于根据所述第二模拟垂直同步信号进行图层合成。
  15. 根据权利要求14所述的装置,其中,所述装置还包括:
    第二生成模块,用于响应于所述请求时间间隔小于所述时长阈值,根据标准垂直同步信号生成第二垂直同步信号,所述标准垂直同步信号由信号生成线程生成;
    第三发送模块,用于向所述合成线程发送所述第二垂直同步信号,所述合成线程用于根据所述第二垂直同步信号进行图层合成。
  16. 根据权利要求15所述的装置,其中,所述装置还包括:
    数据发送模块,用于通过所述合成线程向显示屏发送图像帧数据,所述图像帧数据由所述合成线程进行图层合成后得到;
    次数获取模块,用于获取所述显示屏当前显示图像帧的显示次数;
    重置模块,用于响应于所述显示次数大于1,重置所述显示屏的垂直同步信号起点,并根据所述图像帧数据更新所述显示屏显示的图像帧。
  17. 根据权利要求16所述的装置,其中,所述装置还包括:
    重置模块,用于响应于所述显示屏处于命令command模式下的睡眠状态,重置所述显示屏的垂直同步信号起点,并根据所述图像帧数据更新所述显示屏显示的图像帧。
  18. 根据权利要求16或17所述的装置,其中,所述重置模块,包括:
    代价计算单元,用于根据当前硬件状态确定重置垂直同步信号起点的重置代价,所述重置代价包括重置时间;
    重置单元,用于响应于所述重置代价小于代价阈值,重置垂直同步信号起点,并根据所述图像帧数据更新所述显示屏显示的图像帧。
  19. 一种终端,其特征在于,所述终端包括处理器、与所述处理器相连的存储器和显示屏,以及存储在所述存储器上的程序指令,所述处理器执行所述程序指令时实现如权利要求1至9任一所述的垂直同步方法。
  20. 一种计算机可读存储介质,其特征在于,其上存储有程序指令,所述程序指令被处理器执行时实现如权利要求1至9任一所述的垂直同步方法。
PCT/CN2020/081131 2019-04-09 2020-03-25 垂直同步方法、装置、终端及存储介质 WO2020207250A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910279674.2A CN110018874B (zh) 2019-04-09 2019-04-09 垂直同步方法、装置、终端及存储介质
CN201910279674.2 2019-04-09

Publications (1)

Publication Number Publication Date
WO2020207250A1 true WO2020207250A1 (zh) 2020-10-15

Family

ID=67190784

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/081131 WO2020207250A1 (zh) 2019-04-09 2020-03-25 垂直同步方法、装置、终端及存储介质

Country Status (2)

Country Link
CN (1) CN110018874B (zh)
WO (1) WO2020207250A1 (zh)

Families Citing this family (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109992232B (zh) * 2019-04-09 2022-02-01 Oppo广东移动通信有限公司 图像更新方法、装置、终端及存储介质
CN110018874B (zh) * 2019-04-09 2021-07-13 Oppo广东移动通信有限公司 垂直同步方法、装置、终端及存储介质
CN112351326B (zh) * 2019-08-09 2022-08-19 荣耀终端有限公司 一种基于垂直同步信号的图像处理方法及电子设备
CN111124230B (zh) * 2019-12-24 2020-11-17 腾讯科技(深圳)有限公司 输入响应方法、装置、电子设备及计算机可读存储介质
WO2021134452A1 (en) 2019-12-31 2021-07-08 Qualcomm Incorporated Methods and apparatus to facilitate frame per second rate switching via touch event signals
CN112019921A (zh) * 2020-09-01 2020-12-01 北京德火科技有限责任公司 应用于虚拟演播室的肢体动作数据处理方法
CN112019922A (zh) * 2020-09-01 2020-12-01 北京德火科技有限责任公司 应用于虚拟演播室的面部表情数据处理方法
CN114531519B (zh) * 2020-10-31 2024-04-26 华为技术有限公司 一种基于垂直同步信号的控制方法及电子设备
CN112486606B (zh) * 2020-11-19 2022-08-12 湖南麒麟信安科技股份有限公司 一种基于Android系统的云桌面显示优化方法及系统
CN113190315B (zh) * 2021-04-29 2022-11-25 安徽华米健康医疗有限公司 一种显示器刷新方法及其装置
CN114217730A (zh) * 2021-12-27 2022-03-22 科大讯飞股份有限公司 一种书写显示方法、装置、设备、系统及存储介质
CN114020097B (zh) * 2022-01-10 2022-06-17 北京鲸鲮信息系统技术有限公司 信号同步方法、装置、电子设备及存储介质
CN117492628A (zh) * 2022-07-26 2024-02-02 华为技术有限公司 一种图像处理方法及装置

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103593155A (zh) * 2013-11-06 2014-02-19 华为终端有限公司 显示帧生成方法和终端设备
US20170220062A1 (en) * 2016-02-03 2017-08-03 Qualcomm Incorporated Frame based clock rate adjustment for processing unit
CN107220019A (zh) * 2017-05-15 2017-09-29 努比亚技术有限公司 一种基于动态vsync信号的渲染方法、移动终端及存储介质
CN108228358A (zh) * 2017-12-06 2018-06-29 广东欧珀移动通信有限公司 修正垂直同步信号的方法、装置、移动终端以及存储介质
CN108829475A (zh) * 2018-05-29 2018-11-16 北京小米移动软件有限公司 Ui绘制方法、装置及存储介质
CN109992232A (zh) * 2019-04-09 2019-07-09 Oppo广东移动通信有限公司 图像更新方法、装置、终端及存储介质
CN110018874A (zh) * 2019-04-09 2019-07-16 Oppo广东移动通信有限公司 垂直同步方法、装置、终端及存储介质

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9601085B2 (en) * 2013-09-20 2017-03-21 Synaptics Incorporated Device and method for synchronizing display and touch controller with host polling
CN105307021B (zh) * 2015-10-26 2018-07-24 成都市极米科技有限公司 图像显示更新方法及装置
CN105867755A (zh) * 2015-11-06 2016-08-17 乐视移动智能信息技术(北京)有限公司 一种提高画面流畅性的方法和终端设备
CN105653085B (zh) * 2015-12-23 2018-07-24 小米科技有限责任公司 触摸响应方法和装置
CN107273130B (zh) * 2017-06-20 2020-08-04 深圳市万普拉斯科技有限公司 加速界面绘制的方法、装置和终端
CN109474768A (zh) * 2017-09-08 2019-03-15 中兴通讯股份有限公司 一种提高图像流畅度的方法及装置
CN108519923A (zh) * 2018-03-01 2018-09-11 北京三快在线科技有限公司 一种卡顿检测方法及装置和电子设备
CN108921951B (zh) * 2018-07-02 2023-06-20 京东方科技集团股份有限公司 虚拟现实图像显示方法及其装置、虚拟现实设备

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103593155A (zh) * 2013-11-06 2014-02-19 华为终端有限公司 显示帧生成方法和终端设备
US20170220062A1 (en) * 2016-02-03 2017-08-03 Qualcomm Incorporated Frame based clock rate adjustment for processing unit
CN107220019A (zh) * 2017-05-15 2017-09-29 努比亚技术有限公司 一种基于动态vsync信号的渲染方法、移动终端及存储介质
CN108228358A (zh) * 2017-12-06 2018-06-29 广东欧珀移动通信有限公司 修正垂直同步信号的方法、装置、移动终端以及存储介质
CN108829475A (zh) * 2018-05-29 2018-11-16 北京小米移动软件有限公司 Ui绘制方法、装置及存储介质
CN109992232A (zh) * 2019-04-09 2019-07-09 Oppo广东移动通信有限公司 图像更新方法、装置、终端及存储介质
CN110018874A (zh) * 2019-04-09 2019-07-16 Oppo广东移动通信有限公司 垂直同步方法、装置、终端及存储介质

Also Published As

Publication number Publication date
CN110018874A (zh) 2019-07-16
CN110018874B (zh) 2021-07-13

Similar Documents

Publication Publication Date Title
WO2020207251A1 (zh) 图像更新方法、装置、终端及存储介质
WO2020207250A1 (zh) 垂直同步方法、装置、终端及存储介质
JP6894976B2 (ja) 画像円滑性向上方法および装置
WO2020156132A1 (zh) Gpu性能瓶颈的确定方法、装置、终端及存储介质
US8026919B2 (en) Display controller, graphics processor, rendering processing apparatus, and rendering control method
US6331854B1 (en) Method and apparatus for accelerating animation in a video graphics system
WO2021244666A1 (zh) 视频播放的控制方法、装置、计算机设备和存储介质
CN104268113B (zh) Dpi接口的lcd控制器以及其自适应带宽的方法
US20220222783A1 (en) Systems and methods for frame time smoothing based on modified animation advancement and use of post render queues
WO2023046164A1 (zh) 图像显示方法、ddic、显示屏模组及终端
WO2024012098A1 (zh) 显示屏的控制方法、装置、电子设备及存储介质
US9466089B2 (en) Apparatus and method for combining video frame and graphics frame
JPH11327526A (ja) 記憶装置と画像処理装置およびその方法とリフレッシュ動作制御装置およびその方法
US8194065B1 (en) Hardware system and method for changing a display refresh rate
WO2024067159A1 (zh) 视频生成方法、装置、电子设备及存储介质
WO2022064423A1 (en) Reduced vertical blanking regions for display systems that support variable refresh rates
CN115101025B (zh) 一种支持虚拟帧缓冲的lcd控制电路及其控制方法
CN115576871A (zh) 一种虚拟现实渲染方法、装置、终端及计算机存储介质
CN111475665B (zh) 图片播放方法、装置、终端及存储介质
JP2000029456A (ja) ディスプレイ描画・表示方法およびディスプレイ装置
JP2000245966A (ja) 画像処理方法及び画像処理装置
JP6612292B2 (ja) 変換システム、映像出力装置及び変換方法
JP2006092209A (ja) 画像処理装置およびその方法
WO1999040518A1 (en) Method and apparatus to synchronize graphics rendering and display
CN114327103B (zh) 一种触屏延时优化方法及终端

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20788626

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20788626

Country of ref document: EP

Kind code of ref document: A1