WO2020207251A1 - Image update method and apparatus, and terminal and storage medium - Google Patents

Image update method and apparatus, and terminal and storage medium Download PDF

Info

Publication number
WO2020207251A1
WO2020207251A1 PCT/CN2020/081134 CN2020081134W WO2020207251A1 WO 2020207251 A1 WO2020207251 A1 WO 2020207251A1 CN 2020081134 W CN2020081134 W CN 2020081134W WO 2020207251 A1 WO2020207251 A1 WO 2020207251A1
Authority
WO
WIPO (PCT)
Prior art keywords
vertical synchronization
synchronization signal
display screen
request
image frame
Prior art date
Application number
PCT/CN2020/081134
Other languages
French (fr)
Chinese (zh)
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 WO2020207251A1 publication Critical patent/WO2020207251A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0487Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser
    • G06F3/0488Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser using a touch-screen or digitiser, e.g. input of commands through traced gestures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/14Digital output to display device ; Cooperation and interconnection of the display device with other functional units
    • G06F3/1407General aspects irrespective of display type, e.g. determination of decimal point position, display with fixed or driving decimal point, suppression of non-significant zeros

Definitions

  • the embodiments of the present application relate to the field of terminal technology, and in particular, to an image update 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 an image update method, device, terminal, and storage medium.
  • the technical solutions are as follows:
  • an embodiment of the present application provides an image update method, the method includes:
  • an image update device which includes:
  • the first sending module is configured to send image frame data to the display screen through a synthesis thread, where the image frame data is obtained after layer synthesis by the synthesis thread;
  • the first acquiring module is configured to acquire the display times of the image frame currently displayed on the display screen
  • the first update module is configured to reset the starting point of the vertical synchronization signal of the display screen in response to the display times being greater than the times threshold, and update the image frames displayed on the display screen according to the image frame data.
  • 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
  • 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 image update method 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 image update method as described in the above aspect is implemented.
  • the display times of the image frames currently displayed on the display screen are obtained, and when the display times are greater than the times threshold, the starting point of the vertical synchronization signal of the display screen is reset for display
  • the screen updates the image frame displayed on the display screen according to the image frame data; compared with the related art, the display screen needs to receive the hardware vertical synchronization signal before it can update the image.
  • the vertical synchronization starting point of the display screen is reset , So that when the display screen receives new image frame data while repeatedly displaying the same image frame, it can immediately update the image according to the image frame data, thus shortening the time for the display screen to wait for the hardware vertical synchronization signal and helping to improve the display The speed of the screen display.
  • 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 principle of the image update process in the related art
  • Fig. 4 shows a method flowchart of an image update method provided by an exemplary embodiment of the present application
  • FIG. 5 is a schematic diagram of the implementation process of the image update method shown in FIG. 4;
  • Fig. 6 is a schematic diagram of the vertical synchronization process in the related art
  • Fig. 7 shows a method flowchart of an image update method provided by another exemplary embodiment of the present application.
  • Fig. 8 shows a method flowchart of an image update method provided by another exemplary embodiment of the present application.
  • FIG. 9 is a schematic diagram of the implementation process of the image update method shown in FIG. 8;
  • FIG. 10 is a schematic structural diagram of an image updating 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 display screen 160 involved in the embodiment of the present application may be a video screen or a command screen.
  • the control integrated circuit (Integrated Circuit, IC) of the video screen does not include Random-Access Memory (RAM), while the control IC of the command screen includes RAM.
  • RAM Random-Access Memory
  • the control signal and image frame data are transmitted to the video screen through the bus in the form of messages, and the video screen displays images according to the received image frame data; when the command screen is working, the image frame data passes through the bus After being transmitted to the command screen, it is written into the frame buffer of RAM, and the command screen reads the image frame data from the frame buffer under the control of the timer, thereby displaying the image according to the image frame data.
  • the display screen 160 in the embodiment of the present application may also support the video mode and the command mode at the same time, 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 components such as 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, etc., which are not repeated 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 SurfaceFlinger from multiple surfaces 24.
  • 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 principle of the process of updating the image of the display screen in the related art.
  • the display screen displays A frame image frame in the vertical synchronization signal period of 0-T1, and receives the image frame data of B frame in the period of display 0-T1, so that in the vertical synchronization signal period of T1-T2 B frame image frame is displayed inside.
  • 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 display screen needs to continue to display the B frame image frame, and at time T3' When the vertical synchronization signal is received, the C frame image frame is displayed according to the new image frame data.
  • the image update method In order to solve the problem of delay in the screen display due to the long waiting time of the vertical synchronization signal in the related art, in the image update method provided by the embodiment of the present application, when the image frame data is sent to the display screen through the synthesis thread, the current display screen is obtained. Displays the display times of the image frame, and resets the starting point of the vertical synchronization signal of the display screen when the display times are greater than the threshold of times, so that the display screen can update the image frame displayed on the display screen according to the image frame data, thus shortening the display screen waiting for the vertical synchronization signal The time can help increase the speed of the display screen to update the picture and reduce the display delay of the picture. Illustrative embodiments are used for description below.
  • FIG. 4 shows a method flowchart of an image update method provided by an exemplary embodiment of the present application.
  • the method may include the following steps.
  • Step 401 Send the image frame data to the display screen through the synthesis thread, and the image frame data is obtained after layer synthesis by the synthesis thread.
  • the drawn layer is sent to the composition thread, and the composition thread synthesizes multiple layers to obtain image frame data, thereby sending the image frame data To the display.
  • the display screen After the display screen receives the image frame data, it writes the image frame data into the buffer.
  • Step 402 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 whether the image frame currently displayed on the display screen is repeatedly displayed.
  • 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 403 in response to the display times being greater than the times threshold, reset the starting point of the vertical synchronization signal of the display screen, and update the image frames displayed on the display screen according to the image frame data.
  • the terminal When the number of display times is greater than the number threshold, it indicates that the current image frame is a repeated display image frame.
  • the terminal 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. , So that the display screen can immediately update the image frames 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 threshold of the number of times is 1 time, that is, when the currently displayed image frame is not displayed for the first time, the terminal will re-start the vertical synchronization signal of the display screen when the new image frame data is synthesized.
  • the display screen displays A frame image frame during the period of 0-T1 vertical synchronization signal, and it receives B frame image during display period 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.
  • 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 times of the image frames currently displayed on the display screen are obtained, and when the display times are greater than the times threshold, the vertical synchronization of the display screen is reset Signal starting point, so that the display screen can update the image frame displayed on the display screen according to the image frame data; compared with the related art, the display screen needs to receive the hardware vertical synchronization signal before it can update the image.
  • the display is reset
  • the vertical synchronization starting point of the screen enables the screen to update the image immediately according to the image frame data when it receives new image frame data while repeatedly displaying the same image frame, thus shortening the time for the display screen to wait for the hardware vertical synchronization signal. Helps increase the speed of the display screen.
  • 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 of the display screen 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 method before the sending the image frame data to the display screen through the synthesis thread, the method further includes:
  • 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 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 requester is the composition 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.
  • step 403 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 can be the time period 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 starting point of the vertical synchronization signal is reset when the reset cost is small, which avoids resetting If the cost is too high, reset the starting point of the vertical synchronization signal.
  • 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 obtains the current display state of the display screen; if the display screen is in the sleep state in command mode, reset the start point of the vertical synchronization signal of the display screen and update according to the image frame data The image frame displayed on the display.
  • the process of resetting the starting point of the vertical synchronization signal of the display screen reference may be made to the above-mentioned embodiment, which will not be repeated here.
  • FIG. 6 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 application receives the vertical synchronization signal, it will draw the layer and send the layer data obtained by drawing to SurfaceFlinger.
  • 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 method provided in the above embodiment can shorten the waiting time of the display screen from the hardware level.
  • the waiting time of the application and SurfaceFlinger can be optimized from the software level. Illustrative embodiments are used for description below.
  • step 401 In a possible implementation manner, based on FIG. 4, as shown in FIG. 7, the following steps may be further included before step 401.
  • Step 701 Receive a vertical synchronization signal request sent by the requester, 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 702 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 703 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, and the requester is used to perform execution according to the analog vertical synchronization signal. Scheduled operation.
  • the SurfaceFlinger process includes a signal generation thread and a signal transmission thread, where the signal generation thread is used to generate standard vertical synchronization signals, and the signal transmission thread is used to process standard vertical synchronization signals (such as After increasing the time offset), the vertical synchronization signal is sent 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) .
  • 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 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.
  • 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. 8 shows a method flowchart of an image updating method provided by another exemplary embodiment of the present application.
  • the method may include the following steps.
  • Step 801 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 802 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 first request The request time interval between time and the second request time.
  • Step 803 In response to the request time interval being greater than the duration threshold, send a first analog vertical synchronization signal to the application program.
  • the request time interval is the time interval between the first request moment and the second request moment.
  • the vertical sync signal draws the picture.
  • 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 802 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 (composite thread in).
  • Step 804 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 805 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.
  • Step 806 Receive a second vertical synchronization signal request sent by the composition 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 807 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 moment of the second vertical synchronization signal request and the second request moment of the second vertical synchronization signal request sent by the synthesis thread last time, and calculates the first request The request time interval between time and the second request time.
  • Step 808 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 807 since the request time interval (25ms) between two adjacent requests is greater than one vertical synchronization signal period (16.7ms), 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 (not shown in the figure) 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 809 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 810 Send a 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 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.
  • step 811 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.
  • Step 812 Obtain the display times of the image frame currently displayed on the display screen.
  • Step 813 in response to the display times being greater than the times threshold, reset the starting point of the vertical synchronization signal of the display screen, and update the image frames displayed on the display screen according to the image frame data.
  • steps 811 to 813 For the implementation process of the foregoing steps 811 to 813, reference may be made to steps 401 to 403, which will not be repeated in this embodiment.
  • 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.
  • 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 are shown in Table 1.
  • FIG. 10 shows a schematic structural diagram of an image updating apparatus 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 first sending module 1001 is configured to send image frame data to the display screen through a synthesis thread, where the image frame data is obtained after layer synthesis by the synthesis thread;
  • the first obtaining module 1002 is configured to obtain the display times of the image frame currently displayed on the display screen;
  • the first update module 1003 is configured to reset the starting point of the vertical synchronization signal of the display screen in response to the display times being greater than the times threshold, and update the image frames displayed on the display screen according to the image frame data.
  • the device further includes:
  • the second acquiring module is used to acquire the current display state of the display screen
  • the second update module is configured to reset the starting point of the vertical synchronization signal of the display screen if the display screen is in the sleep state in the command mode, and update the image frame displayed on the display screen according to the image frame data .
  • the first update module 1003 or the second update module includes:
  • a cost determining 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 update unit is configured to reset the starting point of the vertical synchronization signal if the reset cost is less than the cost threshold, and update the image frame displayed on the display screen according to the image frame data.
  • the device further includes:
  • the first receiving module 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 third acquiring module is 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 second sending module is configured to send an analog vertical synchronization signal to the requesting party in response to the request time interval being greater than the duration threshold, where the request time interval is the time between the first request moment and the second request moment Interval, 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 first receiving module is used to:
  • the second sending module is used 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 third 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 the composition thread
  • the first receiving module is used to:
  • the second sending module is used 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, and the standard vertical synchronization signal is generated by a signal generation thread;
  • the fourth 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 display times of the image frames currently displayed on the display screen are obtained, and when the display times are greater than the times threshold, the vertical synchronization of the display screen is reset Signal starting point, so that the display screen can update the image frame displayed on the display screen according to the image frame data; compared with the related art, the display screen needs to receive the hardware vertical synchronization signal before it can update the image.
  • the display is reset
  • the vertical synchronization starting point of the screen enables the screen to update the image immediately according to the image frame data when it receives new image frame data while repeatedly displaying the same image frame, thus shortening the time for the display screen to wait for the hardware vertical synchronization signal. Helps increase 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 the program instructions implement the image update method provided by the foregoing method embodiments when the program instructions are executed by the processor.
  • the present application also provides a computer program product containing instructions, which when run on a computer, causes the computer to execute the image update method described in each of the foregoing embodiments.

Abstract

An image update method and apparatus, and a terminal and a storage medium, relating to the technical field of terminals. The method comprises: sending image frame data to a display screen by means of a synthesis thread, the image frame data being obtained after surface synthesis by the synthesis thread (401); obtaining the number of times an image frame is currently displayed on the display screen (402); and if the number of times is greater than a number-of-times threshold, resetting a vertical synchronization signal starting point of the display screen, and updating, according to the image frame data, the image frame displayed on the display screen (403). With respect to the method in the related art that the display screen needs to receive a hardware vertical synchronization signal before it can perform image update, in the method, by resetting the vertical synchronization starting point of the display screen, the display screen can perform image update immediately according to the image frame data upon receipt of a new image frame when the same image frame is repeatedly displayed, so as to shorten the time during which the display screen waits for the hardware vertical synchronization signal, thereby facilitating improvement of the speed of displaying an image on the display screen.

Description

图像更新方法、装置、终端及存储介质Image update method, device, terminal and storage medium
本申请要求于2019年04月09日提交的申请号为201910279696.9、发明名称为“图像更新方法、装置、终端及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed on April 9, 2019 with the application number 201910279696.9 and the invention title "Image update method, device, terminal and storage medium", the entire content of which is incorporated into this application by reference .
技术领域Technical field
本申请实施例涉及终端技术领域,特别涉及一种图像更新方法、装置、终端及存储介质。The embodiments of the present application relate to the field of terminal technology, and in particular, to an image update method, device, terminal, and storage medium.
背景技术Background technique
垂直同步(Vertical synchronization,Vsync)是一种提高终端画面流畅度的技术。Vertical synchronization (Vsync) is a technology that improves the smoothness of terminal screens.
终端应用垂直同步技术后,应用程序接收到垂直同步信号时,即进行画面绘制;合成线程接收到垂直同步信号时,即对多个可见图层进行合成,并将合成的图像帧数据发送至显示屏;显示屏接收到垂直同步信号时,即对图像帧进行更新。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.
发明内容Summary of the invention
本申请实施例提供了一种图像更新方法、装置、终端及存储介质,所述技术方案如下:The embodiments of the present application provide an image update method, device, terminal, and storage medium. The technical solutions are as follows:
一方面,本申请实施例提供了一种图像更新方法,所述方法包括:On the one hand, an embodiment of the present application provides an image update method, the method includes:
通过合成线程向显示屏发送图像帧数据,所述图像帧数据由所述合成线程进行图层合成后得到;Sending image frame data to the display screen through a synthesis thread, where the image frame data is obtained after layer synthesis by the synthesis thread;
获取所述显示屏当前显示图像帧的显示次数;Acquiring the display times of the image frame currently displayed on the display screen;
响应于所述显示次数大于次数阈值,重置所述显示屏的垂直同步信号起点,并根据所述图像帧数据更新所述显示屏显示的图像帧。In response to the display times being greater than the times threshold, resetting the starting point of the vertical synchronization signal of the display screen, and updating the image frames displayed on the display screen according to the image frame data.
另一方面,本申请实施例提供了一种图像更新装置,所述装置包括:On the other hand, an embodiment of the present application provides an image update device, which includes:
第一发送模块,用于通过合成线程向显示屏发送图像帧数据,所述图像帧数据由所述合成线程进行图层合成后得到;The first sending module is configured to send image frame data to the display screen through a synthesis thread, where the image frame data is obtained after layer synthesis by the synthesis thread;
第一获取模块,用于获取所述显示屏当前显示图像帧的显示次数;The first acquiring module is configured to acquire the display times of the image frame currently displayed on the display screen;
第一更新模块,用于响应于所述显示次数大于次数阈值,重置所述显示屏的垂直同步信号起点,并根据所述图像帧数据更新所述显示屏显示的图像帧。The first update module is configured to reset the starting point of the vertical synchronization signal of the display screen in response to the display times being greater than the times threshold, and update the image frames displayed on the display screen according to the image frame data.
另一方面,本申请提供了一种终端,所述终端包括处理器、与所述处理器相连的存储器和显示屏,以及存储在所述存储器上的程序指令,所述处理器执行所述程序指令时实现如上述方面所述的图像更新方法。On the other hand, 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 image update method described in the above aspect is implemented when instructed.
另一方面,提供了一种计算机可读存储介质,其上存储有程序指令,所述程序指令被处理器执行时实现如上述方面所述的图像更新方法。In another aspect, a computer-readable storage medium is provided, and program instructions are stored thereon, and when the program instructions are executed by a processor, the image update method as described in the above aspect is implemented.
本申请实施例提供的技术方案带来的有益效果至少包括:The beneficial effects brought by the technical solutions provided by the embodiments of the present application include at least:
本申请实施例中,通过合成线程向显示屏发送图像帧数据时,获取显示屏当前显示图像帧的显示次数,并在显示次数大于次数阈值时,重置显示屏的垂直同步信号起点,以便显示屏根据图像帧数据更新显示屏显示的图像帧;相较于相关技术中显示屏需要接收到硬件垂直同步信号后才能够进行图像更新,本申请实施例中,通过重置显示屏的垂直同步起点,使得显示屏在重复显示同一图像帧的情况下接收到新的图像帧数据时,能够立即根据图像帧数据进行图像更新,从而缩短了显示屏等待硬件垂直同步信号的时间,有助于提高显示屏显示画面的速度。In the embodiment of the application, when the image frame data is sent to the display screen through the synthesis thread, the display times of the image frames currently displayed on the display screen are obtained, and when the display times are greater than the times threshold, the starting point of the vertical synchronization signal of the display screen is reset for display The screen updates the image frame displayed on the display screen according to the image frame data; compared with the related art, the display screen needs to receive the hardware vertical synchronization signal before it can update the image. In the embodiment of the present application, the vertical synchronization starting point of the display screen is reset , So that when the display screen receives new image frame data while repeatedly displaying the same image frame, it can immediately update the image according to the image frame data, thus shortening the time for the display screen to wait for the hardware vertical synchronization signal and helping to improve the display The speed of the screen display.
附图说明Description of the drawings
图1是本申请一个示例性实施例所提供的终端的结构示意图;FIG. 1 is a schematic structural diagram of a terminal provided by an exemplary embodiment of the present application;
图2是Android系统中图形显示过程的原理示意图;Figure 2 is a schematic diagram of the graphic display process in the Android system;
图3是相关技术中图像更新过程的原理示意图;Figure 3 is a schematic diagram of the principle of the image update process in the related art;
图4示出了本申请一个示例性实施例提供的图像更新方法的方法流程图;Fig. 4 shows a method flowchart of an image update method provided by an exemplary embodiment of the present application;
图5是图4所示图像更新方法实施过程的原理示意图;FIG. 5 is a schematic diagram of the implementation process of the image update method shown in FIG. 4;
图6是相关技术中垂直同步过程的原理示意图;Fig. 6 is a schematic diagram of the vertical synchronization process in the related art;
图7示出了本申请另一个示例性实施例提供的图像更新方法的方法流程图;Fig. 7 shows a method flowchart of an image update method provided by another exemplary embodiment of the present application;
图8示出了本申请另一个示例性实施例提供的图像更新方法的方法流程图;Fig. 8 shows a method flowchart of an image update method provided by another exemplary embodiment of the present application;
图9是图8所示图像更新方法实施过程的原理示意图;FIG. 9 is a schematic diagram of the implementation process of the image update method shown in FIG. 8;
图10是本申请一个实施例提供的图像更新装置的结构示意图。FIG. 10 is a schematic structural diagram of an image updating device provided by an embodiment of the present application.
具体实施方式detailed description
为使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请实施方式作进一步地详细描述。In order to make the objectives, technical solutions, and advantages of the present application clearer, the following will further describe the embodiments of the present application in detail with reference to the accompanying drawings.
下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本申请相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本申请的一些方面相一致的装置和方法的例子。When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings indicate the same or similar elements. The implementation manners described in the following exemplary embodiments do not represent all implementation manners consistent with the present application. On the contrary, they are only examples of devices and methods consistent with some aspects of the application as detailed in the appended claims.
在本申请的描述中,需要理解的是,术语“第一”、“第二”等仅用于描述目的,而不能理解为指示或暗示相对重要性。在本申请的描述中,需要说明的是,除非另有明确的规定和限定,术语“相连”、“连接”应做广义理解,例如,可以是固定连接,也可以是可拆卸连接,或一体地连接;可以是机械连接,也可以是电连接;可以是直接相连,也可以通过中间媒介间接相连。对于本领域的普通技术人员而言,可以具体情况理解上述术语在本申请中的具体含义。此外,在本申请的描述中,除非另有说明,“多个”是指两个或两个以上。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。字符“/”一般表示前后关联对象是一种“或”的关系。In the description of this application, it should be understood that the terms "first", "second", etc. are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance. In the description of this application, it should be noted that, unless otherwise clearly specified and limited, the terms "connected" and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral Ground connection; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium. For those of ordinary skill in the art, the specific meanings of the above-mentioned terms in this application can be understood under specific circumstances. In addition, in the description of this application, unless otherwise specified, "plurality" means two or more. "And/or" describes the association relationship of the associated objects, indicating that there can be three types of relationships, for example, A and/or B, which can mean: A alone exists, both A and B exist, and B alone exists. The character "/" generally indicates that the associated objects are in an "or" relationship.
在对本申请实施例进行解释说明之前,首先对本申请实施例的应用场景进行说明。图1示出了本申请一个示例性实施例所提供的终端的结构示意图。Before explaining the embodiments of the present application, the application scenarios of the embodiments of the present application are first described. Fig. 1 shows a schematic structural diagram of a terminal provided by an exemplary embodiment of the present application.
该终端100是安装有目标应用程序的电子设备。该目标应用程序可以是系统程序或者第三方应用程序。其中,第三方应用程序是除了用户和操作系统之外的第三方制作的应用程序。比如,该目标应用程序可以是游戏应用程序或视频播放应用程序。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. Among them, third-party applications are applications made by third parties other than the user and the operating system. For example, the target application can be a game application or a video playback application.
可选的,该终端100中包括:处理器120和存储器140。Optionally, the terminal 100 includes a processor 120 and a memory 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中,单独通过一块芯片进行实现。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. Optionally, 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). A kind of hardware form to realize. 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. Among them, 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.
存储器140可以包括随机存储器(Random Access Memory,RAM),也可以包括只读存储器(Read-Only Memory)。可选的,该存储器140包括非瞬时性计算机可读介质(non-transitory computer-readable storage medium)。存储器140可用于存储指令、程序、代码、代码集或指令集。存储器140可包括存储程序区和存储数据区,其中,存储程序区可存储用于实现操作系统的指令、用于至少一个功能的指令(比如触控功能、声音播放功能、图像播放功能等)、用于实现下述各个方法实施例的指令等;存储数据区可存储下面各个方法实施例中涉及到的数据等。The memory 140 may include random access memory (RAM) or read-only memory (Read-Only Memory). Optionally, 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.
本申请实施例中的终端120还包括显示屏160。可选的,显示屏160是触摸显示屏,用于接收用户使用手指、触摸笔等任何适合的物体在其上或附近的触摸操作,以及显示各个应用程序的用户界面。显示屏160通常设置在终端100的前面板,或者,同时设置在终端100的前面板和后面板。显示屏160可被设计成为全面屏、曲面屏或异型屏。显示屏160还可被设计成为全面屏与曲面屏的结合,异型屏与曲面屏的结合,本实施例对此不加以限定。The terminal 120 in the embodiment of the present application further includes a display screen 160. Optionally, 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.
可选的,本申请实施例中涉及的显示屏160可以是video屏或者command屏。其中,video屏的控制集成电路(Integrated Circuit,IC)中不包含随机存取存储器(Random-Access Memory,RAM),而command屏的控制IC中包含RAM。video屏在工作状态下,控制信号和图像帧数据以报文的形式通过总线传输给video屏,video屏则根据接收到的图像帧数据显示图像;command屏在工作状态下,图像帧数据通过总线传输给command屏后,被写入RAM的帧缓冲区中,由command屏在定时器控制下从帧缓冲区中读取图像帧数据,从而根据图像帧数据显示图像。当然,本申请实施例中的显示屏160也可以同时支持video模式和command模式,本实施例对此不做限定。Optionally, the display screen 160 involved in the embodiment of the present application may be a video screen or a command screen. Among them, the control integrated circuit (Integrated Circuit, IC) of the video screen does not include Random-Access Memory (RAM), while the control IC of the command screen includes RAM. When the video screen is working, the control signal and image frame data are transmitted to the video screen through the bus in the form of messages, and the video screen displays images according to the received image frame data; when the command screen is working, the image frame data passes through the bus After being transmitted to the command screen, it is written into the frame buffer of RAM, and the command screen reads the image frame data from the frame buffer under the control of the timer, thereby displaying the image according to the image frame data. Of course, the display screen 160 in the embodiment of the present application may also support the video mode and the command mode at the same time, which is not limited in this embodiment.
除此之外,本领域技术人员可以理解,上述附图所示出的终端100的结构并不构成对终端100的限定,终端可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。比如,终端100中还包括射频电路、输入单元、传感器、音频电路、无线保真(Wireless Fidelity,WiFi)模块、电源、蓝牙模块等部件,在此不再赘述。In addition, those skilled in the art can understand that 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. For example, the terminal 100 also includes components such as 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, etc., which are not repeated here.
为了便于理解,下面首先对终端中的图形显示系统进行说明,且下述实施例以安卓(Android)图形显示系统为例进行示意性说明。For ease of understanding, the graphic display system in the terminal is first described below, and the following embodiments take an Android graphic display system as an example for schematic description.
终端的图形显示过程分为图层绘制、图层合成以及图像帧更新这三个阶段。其中,图层绘制由应用程序执行,图层合成由合成线程执行,图像帧更新则由显示屏执行。The graphics display process of the terminal is divided into three stages: layer drawing, layer composition and image frame update. Among them, the layer drawing is executed by the application program, the layer composition is executed by the synthesis thread, and the image frame update is executed by the display screen.
如图2所示,显示屏21从帧缓冲区中读取图像帧数据,且读取的过程为:从帧缓冲区的起始地址开始,按照从上往下,从左往右的顺序进行扫描,从而将扫描到的内容映射在显示屏上。As shown in Figure 2, 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.
由于显示屏21中显示的内容需要不断更新,若在同一帧缓冲区内进行读取和写入操作,将会导致显示屏21中同时显示多帧内容,因此,终端采用双缓冲机制,其中,双缓冲区中的一个缓冲区用于内容读取显示,而另一个缓冲区用于后台图形合成和写入。Since the content displayed in the display 21 needs to be continuously updated, if reading and writing operations are performed in the same frame buffer, multiple frames of content will be displayed on the display 21 at the same time. Therefore, 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.
示意性的,如图2所示,前缓冲区22为显示屏所要显示内容的帧缓冲区,后缓冲区23为用于合成下一帧图形的帧缓冲区。当前一帧显示完毕,后一帧写入完毕时,显示屏21即读取后缓冲区23中的内容,相应的,前缓冲区22中即进行下一帧图形的合成(前后缓冲区角色互换)。Schematically, as shown in FIG. 2, the front buffer 22 is a frame buffer for the content to be displayed on the display screen, and the rear buffer 23 is a frame buffer for synthesizing the next frame of graphics. When the current frame is displayed and the next frame is written, the display screen 21 reads the content in the back buffer 23. Correspondingly, the next frame of graphics is synthesized in the front buffer 22 (the front and rear buffer roles interact with each other). change).
SurfaceFlinger作为图层合成者(其中包括合成线程),用于对上层(应用程序)传递的多个图层(surface)进行合成,并提交到显示屏21的缓冲区中,供显示屏21读取显示。如图2所示,后缓冲区23中的内容由SurfaceFlinger对多个surface 24合成而成。其中,每个surface对应上层的一个窗口(window),比如对话框、状态栏、活动(Activity)。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. As shown in Figure 2, the content in the back buffer 23 is synthesized by SurfaceFlinger from multiple surfaces 24. Among them, each surface corresponds to a window (window) of the upper layer, such as a dialog box, a status bar, and an activity (Activity).
为了使应用程序和合成线程能够根据显示屏的刷新频率进行画面绘制及合成,从而避免出现画面卡顿,显示屏根据硬件垂直同步信号(硬件垂直同步信号的产生频率与显示屏的刷新频率一致)进行图像帧更新,而应用程序和合成线程则通过请求软件垂直同步信号(与硬件同步信号保持同步)的方式进行画面绘制和合成。In order to enable the application program and the synthesis thread to draw and synthesize the screen according to the refresh frequency of the display screen, so as to avoid screen freezes, 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).
如图3所示,其示出了相关技术中显示屏更新图像过程的原理示意图。显示屏在0-T1这一垂直同步信号周期内显示A帧图像帧,且在显示0-T1这一时间段内收到B帧的图像帧数据,从而在T1-T2这一垂直同步信号周期内显示B帧图像帧。然而,由于在T1-T2这一垂直同步信号周期内,显示屏并未收到新的图像帧数据,因此,显示屏需要等待新的图像帧数据并再次显示B帧图像帧。当在T3(T3与T2的间隔小于垂直同步信号周期)时刻接收到C帧的图像帧数据时,由于尚未接收到垂直同步信号,因此显示屏需要继续显示B帧图像帧,并在T3’时刻接收到垂直同步信号时,根据新的图像帧数据显示C帧图像帧。As shown in FIG. 3, it shows a schematic diagram of the principle of the process of updating the image of the display screen in the related art. The display screen displays A frame image frame in the vertical synchronization signal period of 0-T1, and receives the image frame data of B frame in the period of display 0-T1, so that in the vertical synchronization signal period of T1-T2 B frame image frame is displayed inside. However, since 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. 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 vertical synchronization signal has not been received, the display screen needs to continue to display the B frame image frame, and at time T3' When the vertical synchronization signal is received, the C frame image frame is displayed according to the new image frame data.
显然,相关技术中,由于显示屏只有在接收到垂直同步信号时才会进行图像帧更新,导致新的图像帧显示存在延迟。Obviously, in the related art, since the display screen only updates the image frame when the vertical synchronization signal is received, the display of the new image frame is delayed.
为了解决相关技术中,由于垂直同步信号等待时间较长,导致画面显示出现延迟的问题,本申请实施例提供的图像更新方法中,通过合成线程向显示屏发送图像帧数据时,获取显示屏当前显示图像帧的显示次数,并在显示次数大于次数阈值时,重置显示屏的垂直同步信号起点,以便显示屏根据图像帧数据更新显示屏显示的图像帧,从而缩短了显示屏等待垂直同步信号的时间,有助于提高显示屏显示更新画面的速度,降低画面的显示延迟。下面采用示意性的实施例进行说明。In order to solve the problem of delay in the screen display due to the long waiting time of the vertical synchronization signal in the related art, in the image update method provided by the embodiment of the present application, when the image frame data is sent to the display screen through the synthesis thread, the current display screen is obtained. Displays the display times of the image frame, and resets the starting point of the vertical synchronization signal of the display screen when the display times are greater than the threshold of times, so that the display screen can update the image frame displayed on the display screen according to the image frame data, thus shortening the display screen waiting for the vertical synchronization signal The time can help increase the speed of the display screen to update the picture and reduce the display delay of the picture. Illustrative embodiments are used for description below.
请参考图4,其示出了本申请一个示例性实施例提供的图像更新方法的方法流程图。该方法可以包括如下步骤。Please refer to FIG. 4, which shows a method flowchart of an image update method provided by an exemplary embodiment of the present application. The method may include the following steps.
步骤401,通过合成线程向显示屏发送图像帧数据,图像帧数据由合成线程进行图层合成后得到。Step 401: Send the image frame data to the display screen through the synthesis thread, and the image frame data is obtained after layer synthesis by the synthesis thread.
在一种可能的实施方式中,应用程序进行图层绘制后,将绘制得到的图层发送至合成线程,由合成线程对多个图层进行合成,得到图像帧数据,从而将图像帧数据发送至显示屏。In a possible implementation manner, after the application program draws the layer, the drawn layer is sent to the composition thread, and the composition thread synthesizes multiple layers to obtain image frame data, thereby sending the image frame data To the display.
可选的,显示屏接收到该图像帧数据后,即将图像帧数据写入缓冲区中。Optionally, after the display screen receives the image frame data, it writes the image frame data into the buffer.
步骤402,获取显示屏当前显示图像帧的显示次数。Step 402: Obtain the display times of the image frame currently displayed on the display screen.
相关技术中,合成线程发送的图像帧数据被写入显示屏的缓冲区,当接收到硬件垂直同步信号时,显示屏根据缓冲区内的图像帧数据进行图像帧更新。In the related art, 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.
在一种可能的场景下,若未接收到合成线程发送的新的图像帧数据,显示屏需要重复显示上一图像帧,直至合成线程发送新的图像帧数据后,在下一个垂直同步信号周期内更新图像帧,即同一图像帧存在重复显示多次的情况。In a possible scenario, if the new image frame data sent by the synthesis thread is not received, 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.
为了提高这种场景下图像帧的更新速度,本申请实施例中,当接收到合成线程发送的图像帧数据时,终端并非固定在接收到硬件垂直同步信号时才会进行图像帧更新,而是根据显示屏当前显示的图像帧是否重复显示确定是否需要立即进行图像帧更新。In order to improve the update speed of image frames in this scenario, in this embodiment of the application, 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 whether the image frame currently displayed on the display screen is repeatedly displayed.
在一种可能的实施方式中,显示屏进行显示时,会记录当前图像帧的显示次数,当接收到合成线程发送的图像帧数据时,终端即获取当前图像帧的显示次数。其中,当显示次数为1次时,表明当前图像帧为首次显示,当显示次数大于1,表明当前图像帧正在重复显示。In a possible implementation manner, when the display screen is displaying, it records the display times of the current image frame. 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.
步骤403,响应于显示次数大于次数阈值,重置显示屏的垂直同步信号起点,并根据图像帧数据更新显示屏显示的图像帧。 Step 403, in response to the display times being greater than the times threshold, reset the starting point of the vertical synchronization signal of the display screen, and update the image frames displayed on the display screen according to the image frame data.
当显示次数大于次数阈值时,表明当前图像帧为重复显示的图像帧,为了尽快对图像帧进行更新,终端无需根据硬件垂直同步信号进行图像帧更新,而是重置显示屏的垂直同步信号起点,使得显示屏能够立即根据接收到的图像帧数据更新显示屏显示的图像帧。When the number of display times is greater than the number threshold, it indicates that the current image frame is a repeated display 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. , So that the display screen can immediately update the image frames displayed on the display screen according to the received image frame data.
其中,终端通过修改显示屏的寄存器来重置垂直同步信号起点,且重置垂直同步信号起点后,显示屏从该垂直同步信号起点开始,重新根据垂直同步信号周期产生硬件垂直同步信号。Among them, 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.
可选的,该次数阈值为1次,即当前显示的图像帧非首次显示时,终端即在合成新的图像帧数据时,重新显示屏的垂直同步信号起点。Optionally, the threshold of the number of times is 1 time, that is, when the currently displayed image frame is not displayed for the first time, the terminal will re-start the vertical synchronization signal of the display screen when the new image frame data is synthesized.
在一个示意性的例子中,如图5所示,显示屏在0-T1这一垂直同步信号周期内显示A帧图像帧,且在显示0-T1这一时间段内收到B帧的图像帧数据,从而在T1-T2这一垂直同步信号周期内显示B帧图像帧。然而,由于在T1-T2这一垂直同步信号周期内,显示屏并未收到新的图像帧数据,因此,显示屏需要等待新的图像帧数据并再次显示B帧图像帧。当在T3(T3与T2的间隔小于垂直同步信号周期)时刻接收到C帧的图像帧数据时,由于显示屏当前显示的B帧图像帧的显示次数大于1,因此,终端T3这一时刻重置垂直同步信号起点,并在T3-T4这一垂直同步信号周期内显示C帧图像帧。In an illustrative example, as shown in Figure 5, the display screen displays A frame image frame during the period of 0-T1 vertical synchronization signal, and it receives B frame image during display period 0-T1 Frame data, so that B-frame image frames are displayed in the period of the vertical synchronization signal of T1-T2. However, since 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. 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.
不同于相关技术中需要等到硬件垂直同步信号时才能进行图像帧更新,本申请实施例中通过引入动态垂直同步信号周期机制,使得显示屏能够根据接收到的图像帧数据立即进行图像帧更新,从而提高图像的显示速度。Different from the related art that needs to wait for the hardware vertical synchronization signal 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.
综上所述,本申请实施例中,通过合成线程向显示屏发送图像帧数据时,获取显示屏当前显示图像帧的显示次数,并在显示次数大于次数阈值时,重置显示屏的垂直同步信号起点,以便显示屏根据图像帧数据更新显示屏显示的图像帧;相较于相关技术中显示屏需要接收到硬件垂直同步信号后才能够进行图像更新,本申请实施例中,通过重置显示屏的垂直同步起点,使得显示屏在重复显示同一图像帧的情况下接收到新的图像帧数据时,能够立即根据图像帧数据进行图像更新,从而缩短了显示屏等待硬件垂直同步信号的时间,有助于提高显示屏显示画面的速度。To sum up, in the embodiment of the present application, when the image frame data is sent to the display screen through the synthesis thread, the display times of the image frames currently displayed on the display screen are obtained, and when the display times are greater than the times threshold, the vertical synchronization of the display screen is reset Signal starting point, so that the display screen can update the image frame displayed on the display screen according to the image frame data; compared with the related art, the display screen needs to receive the hardware vertical synchronization signal before it can update the image. In this embodiment of the application, the display is reset The vertical synchronization starting point of the screen enables the screen to update the image immediately according to the image frame data when it receives new image frame data while repeatedly displaying the same image frame, thus shortening the time for the display screen to wait for the hardware vertical synchronization signal. Helps increase the speed of the display screen.
可选的,所述通过合成线程向显示屏发送图像帧数据之后,所述方法还包括:Optionally, after the image frame data is sent to the display screen through the synthesis thread, the method further includes:
获取所述显示屏当前所处的显示状态;Acquiring the current display state of the display screen;
响应于所述显示屏处于命令command模式下的睡眠状态,重置所述显示屏的垂直同步信号起点,并根据所述图像帧数据更新所述显示屏显示的图像帧。In response to the display screen being in the sleep state in the command mode, 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.
可选的,所述重置所述显示屏的垂直同步信号起点,并根据所述图像帧数据更新所述显示屏显示的图像帧,包括:Optionally, the resetting the start point of the vertical synchronization signal of the display screen and updating the image frame displayed on the display screen according to the image frame data includes:
根据当前硬件状态确定重置垂直同步信号起点的重置代价,所述重置代价包括重置时间;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;
响应于所述重置代价小于代价阈值,重置所述垂直同步信号起点,并根据所述图像帧数据更新所述显示屏显示的图像帧。In response to the resetting cost being less than the cost threshold, resetting the starting point of the vertical synchronization signal, and updating the image frame displayed on the display screen according to the image frame data.
可选的,所述通过合成线程向显示屏发送图像帧数据之前,所述方法还包括:Optionally, before the sending the image frame data to the display screen through the synthesis thread, the method further includes:
接收请求方发送的垂直同步信号请求,所述垂直同步信号请求用于请求获取垂直同步信号;Receiving 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;
获取所述垂直同步信号请求的第一请求时刻,以及上一次接收到所述垂直同步信号请求的第二请求时刻;Acquiring the first request time of the vertical synchronization signal request and the second request time of the last time the vertical synchronization signal request was received;
响应于请求时间间隔大于时长阈值,向所述请求方发送模拟垂直同步信号,所述请求时间间隔为所述第一请求时刻与所述第二请求时刻之间的时间间隔,所述请求方用于根据所述模拟垂直同步信号执行预定操作。In response to the request time interval being greater than the duration threshold, send an analog vertical synchronization signal to the requester, where the request time interval is the time interval between the first request moment and the second request moment, and the requester uses Performing a predetermined operation according to the analog vertical synchronization signal.
可选的,所述时长阈值根据垂直同步信号周期确定,所述垂直同步信号周期用于指示相 邻两个垂直同步信号之间的时间间隔,且所述时长阈值大于等于所述垂直同步信号周期。Optionally, 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 .
可选的,所述请求方为应用程序;Optionally, the requesting party is an application program;
所述接收请求方发送的垂直同步信号请求,包括:The receiving the vertical synchronization signal request sent by the requesting party includes:
接收所述应用程序发送的第一垂直同步信号请求;Receiving a first vertical synchronization signal request sent by the application program;
所述向所述请求方发送模拟垂直同步信号,包括:The sending an analog vertical synchronization signal to the requesting party includes:
向所述应用程序发送第一模拟垂直同步信号,所述应用程序用于根据所述第一模拟垂直同步信号进行画面绘制。Sending 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.
可选的,所述获取所述垂直同步信号请求的第一请求时刻,以及上一次接收到所述垂直同步信号请求的第二请求时刻之后,所述方法还包括:Optionally, after the acquiring the first request time of the vertical synchronization signal request and the second request time of the vertical synchronization signal request last time, the method further includes:
响应于所述请求时间间隔小于所述时长阈值,则根据标准垂直同步信号生成第一垂直同步信号,所述标准垂直同步信号由信号生成线程生成;In response to the request time interval being less than the duration threshold, generating a first vertical synchronization signal according to a standard vertical synchronization signal, and the standard vertical synchronization signal is generated by a signal generation thread;
向所述应用程序发送所述第一垂直同步信号,所述应用程序用于根据所述第一垂直同步信号进行画面绘制。Sending the 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.
可选的,所述请求方为所述合成线程;Optionally, the requester is the composition thread;
所述接收请求方发送的垂直同步信号请求,包括:The receiving the vertical synchronization signal request sent by the requesting party includes:
接收所述合成线程发送的第二垂直同步信号请求;Receiving a second vertical synchronization signal request sent by the composition thread;
所述向所述请求方发送模拟垂直同步信号,包括:The sending an analog vertical synchronization signal to the requesting party includes:
向所述合成线程发送第二模拟垂直同步信号,所述合成线程用于根据所述第二模拟垂直同步信号进行图层合成。Sending a second analog vertical synchronization signal to the composition thread, where the composition thread is used to perform layer composition according to the second analog vertical synchronization signal.
可选的,所述获取所述垂直同步信号请求的第一请求时刻,以及上一次接收到所述垂直同步信号请求的第二请求时刻之后,所述方法还包括:Optionally, after the acquiring the first request time of the vertical synchronization signal request and the second request time of the vertical synchronization signal request last time, the method further includes:
响应于所述请求时间间隔小于所述时长阈值,则根据标准垂直同步信号生成第二垂直同步信号,所述标准垂直同步信号由信号生成线程生成;In response to the request time interval being less than the duration threshold, generating a second vertical synchronization signal according to a standard vertical synchronization signal, the standard vertical synchronization signal being generated by a signal generation thread;
向所述合成线程发送所述第二垂直同步信号,所述合成线程用于根据所述第二垂直同步信号进行图层合成。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.
由于重置垂直同步信号起点时需要一定的开销,因此为了避免出现重置代价过大的情况,在一种可能的实施方式中,上述步骤403可以包括如下步骤:Since a certain amount of overhead is required to reset the starting point of the vertical synchronization signal, in order to avoid the situation that the resetting cost is too large, in a possible implementation manner, the above step 403 may include the following steps:
一、根据当前硬件状态确定重置垂直同步信号起点的重置代价,重置代价包括重置时间。1. Determine the reset cost for resetting the starting point of the vertical synchronization signal according to the current hardware state, and the reset cost includes the reset time.
可选的,若当前图像帧的显示次数大于1时,终端首先根据当前硬件状态确定重置垂直同步信号起点的重置代价,该重置代价至少包括重置时间。其中,该重置时间可以为终端重置显示屏的寄存器的时间。Optionally, if the display times of the current image frame are greater than 1, 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.
可选的,当前硬件状态包括处理器负载、显示屏刷新频率、内存剩余量中的至少一种,本实施例对此不做限定。Optionally, the current hardware state includes at least one of processor load, display refresh frequency, and remaining memory, which is not limited in this embodiment.
二、响应于重置代价小于代价阈值,重置垂直同步信号起点,并根据图像帧数据更新显示屏显示的图像帧。2. In response to the reset cost being less than the cost threshold, reset the starting point of the vertical synchronization signal, and update the image frame displayed on the display screen according to the image frame data.
可选的,该代价阈值根据等待代价确定,该等待代价可以距离下一个垂直同步信号的时 长。比如,当代价阈值为距离下一个垂直同步信号的时长时,若重置时间大于代价阈值,表明完成垂直同步信号起点重置时,已经接收到下一个垂直同步信号,此时重置起点无效,因此,无需进行起点重置。Optionally, the cost threshold is determined according to the waiting cost, and the waiting cost can be the time period 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.
当重置代价小于代价阈值时,终端则重置垂直同步信号起点;若重置代价大于代价阈值时,终端则继续显示当前图像帧,直到接收到硬件垂直同步信号时进行图像帧更新。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.
本实施例中,通过确定重置垂直同步信号起点的重置代价,并比较重置代价与代价阈值,从而在重置代价较小的情况下进行垂直同步信号起点重置,避免了在重置代价过大的情况下进行垂直同步信号起点重置。In this embodiment, by determining the reset cost of resetting the starting point of the vertical synchronization signal, and comparing the reset cost with the cost threshold, the starting point of the vertical synchronization signal is reset when the reset cost is small, which avoids resetting If the cost is too high, reset the starting point of the vertical synchronization signal.
在另一种可能的应用场景下,对于支持命令(Command)模式的显示屏,当显示屏处理睡眠状态(睡眠状态下,显示屏根据自身存储器中的图像帧数据进行图像显示)且接收到新的图像帧数据时,相关技术中,显示屏需要对其硬件垂直同步信号后才能进行图像帧更新,导致图像更新存在延迟。为了降低图像更新延迟,可选的,终端获取显示屏当前所处的显示状态;若显示屏处于命令command模式下的睡眠状态,则重置显示屏的垂直同步信号起点,并根据图像帧数据更新显示屏显示的图像帧。其中,重置显示屏的垂直同步信号起点的过程可以参考上述实施例,本实施例在此不再赘述。In another possible application scenario, for the display screen that supports the Command mode, 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 In the related art, the display screen needs its hardware vertical synchronization signal to update the image frame, resulting in a delay in the image update. In order to reduce the image update delay, optionally, the terminal obtains the current display state of the display screen; if the display screen is in the sleep state in command mode, reset the start point of the vertical synchronization signal of the display screen and update according to the image frame data The image frame displayed on the display. For the process of resetting the starting point of the vertical synchronization signal of the display screen, reference may be made to the above-mentioned embodiment, which will not be repeated here.
如图6所示,其示出了相关技术中垂直同步过程的原理示意图。当应用程序需要进行图层绘制时,向SurfaceFlinger发送垂直同步信号请求,等待SurfaceFlinger在下一个垂直同步时间点,向应用程序反馈垂直同步信号。应用程序接收到垂直同步信号后,即进行图层绘制,并将绘制得到的图层数据发送给SurfaceFlinger。SurfaceFlinger接收到图层数据后,在到达下一个垂直同步时间点时,根据图层数据进行图层合成,并将生成的图像帧数据发送给显示屏。若当前正在显示图像帧,显示屏则在下一个垂直同步时间点处根据接收到的图像帧数据进行图像帧更新。As shown in FIG. 6, it shows a schematic diagram of the vertical synchronization process in the related art. When 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. After the application receives the vertical synchronization signal, it will draw the layer and send the layer data obtained by drawing to 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.
可见,相关技术中,应用程序、SurfaceFlinger和显示屏都需要在接收到垂直同步信号后才能工作,而应用程序、SurfaceFlinger和显示屏在等待垂直同步信号将会造成画面显示出现延迟。比如,对于刷新频率为60Hz的显示屏,其垂直同步信号间隔为16.7ms,在极端情况下,若应用程序、SurfaceFlinger和显示屏都等待了16.7ms,一帧图像的绘制到显示将经过50ms。It can be seen that in related technologies, 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. For example, for a display with a refresh rate of 60Hz, the vertical synchronization signal interval is 16.7ms. In extreme cases, if the application, SurfaceFlinger, and the display all wait 16.7ms, it will take 50ms for a frame of image to be drawn to display.
上述实施例提供的方法可以从硬件层面缩短显示屏的等待时长,为了进一步提高画面显示速度,可以从软件层面,针对应用程序和SurfaceFlinger的等待时长进行优化。下面采用示意性的实施例进行说明。The method provided in the above embodiment can shorten the waiting time of the display screen from the hardware level. In order to further improve the screen display speed, the waiting time of the application and SurfaceFlinger can be optimized from the software level. Illustrative embodiments are used for description below.
在一种可能的实施方式中,在图4的基础上,如图7所示,步骤401之前还可以包括如下步骤。In a possible implementation manner, based on FIG. 4, as shown in FIG. 7, the following steps may be further included before step 401.
步骤701,接收请求方发送的垂直同步信号请求,垂直同步信号请求用于请求获取垂直同步信号。Step 701: Receive a vertical synchronization signal request sent by the requester, where the vertical synchronization signal request is used to request to obtain a vertical synchronization signal.
可选的,该请求方包括应用程序和合成线程中的至少一种,相应的,该垂直同步信号请求是应用程序在进行图层绘制前发送的垂直同步信号请求,或者,是合成线程在进行图层合成前发送的垂直同步信号请求。Optionally, the requester includes at least one of an application program and a compositing thread. Correspondingly, 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. The vertical synchronization signal request sent before the layer composition.
步骤702,获取垂直同步信号请求的第一请求时刻,以及上一次接收到垂直同步信号请求的第二请求时刻。Step 702: Obtain the first request time of the vertical synchronization signal request and the second request time of the last received vertical synchronization signal request.
本申请实施例中,终端每次接收请求方发送的垂直同步信号请求后,都会记录垂直同步信号请求的请求时刻。当再次接收到该请求方发送的垂直同步信号请求时,终端即获取当前垂直同步信号请求的第一请求时刻,以及该请求方上一次发送垂直同步信号请求的第二请求时刻,并根据第一请求时刻和第二请求时刻计算相邻两次垂直同步信号请求之间的请求时间间隔,其中,请求时间间隔=第一请求时刻-第二请求时刻。In the embodiment of the present application, 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. When receiving the vertical synchronization signal request sent by the requester again, 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. The request time and the second request time calculate the request time interval between two adjacent vertical synchronization signal requests, where the request time interval = the first request time-the second request time.
步骤703,响应于请求时间间隔大于时长阈值,向请求方发送模拟垂直同步信号,请求时间间隔为第一请求时刻与第二请求时刻之间的时间间隔,请求方用于根据模拟垂直同步信号执行预定操作。Step 703: 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, and the requester is used to perform execution according to the analog vertical synchronization signal. Scheduled operation.
在一种可能的实施方式中,SurfaceFlinger进程中包含信号生成线程以及信号发送线程,其中,信号生成线程用于产生标准垂直同步信号,而信号发送线程则用于对标准垂直同步信号进行处理(比如增加时间偏置)后,将垂直同步信号发送给请求方。In a possible implementation manner, the SurfaceFlinger process includes a signal generation thread and a signal transmission thread, where the signal generation thread is used to generate standard vertical synchronization signals, and the signal transmission thread is used to process standard vertical synchronization signals (such as After increasing the time offset), the vertical synchronization signal is sent to the requester.
不同于相关技术中,信号发送线程需要接收到信号生成线程生成的标准垂直同步信号后,才会向请求方反馈垂直同步信号,可选的,本申请实施例中,当请求方相邻两次请求之间的请求时间间隔大于时长阈值时(表明前一次发送垂直同步信号请求后,经过较长的等待时间才接收到垂直同步信号),信号发送线程生成模拟垂直同步信号,并将该模拟垂直同步信号发送给请求方。Different from the related technology, 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. Optionally, in the embodiment of the present application, 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.
可选的,本申请实施例中的信号发送线程具有生成模拟垂直同步信号的功能,且生成的模拟垂直同步信号与真实垂直同步信号(根据标准垂直同步信号向请求方发送的垂直同步信号)相同。Optionally, 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) .
相应的,请求方接收到模拟垂直同步信号后,根据模拟垂直同步信号执行预定操作。由于无需等待真实垂直同步信号,因此请求方请求垂直同步信号的时间得到的缩短,进而降低了画面的显示延迟。Correspondingly, after receiving the analog vertical synchronization signal, the requesting party 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.
在一种可能的实施方式中,该时长阈值根据垂直同步信号周期确定,垂直同步信号周期用于指示相邻两个垂直同步信号之间的时间间隔,且时长阈值大于等于垂直同步信号周期。比如,时长阈值为一个垂直同步信号周期,或1.2个垂直同步信号周期,或1.5个垂直同步信号周期。In a possible implementation manner, 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. For example, the duration threshold is one vertical synchronization signal period, or 1.2 vertical synchronization signal periods, or 1.5 vertical synchronization signal periods.
在一个示意性的例子中,当显示屏的刷新频率为60Hz时,该垂直同步信号周期为16.7ms,相应的,将时长阈值被确定为16.7ms。In an illustrative example, when the refresh frequency of the display screen is 60 Hz, the period of the vertical synchronization signal is 16.7 ms, and accordingly, the duration threshold is determined to be 16.7 ms.
可选的,当请求方相邻两次请求之间的请求时间间隔小于时长阈值时,信号发送线程根据信号生成线程生成的标准垂直同步信号,向请求方发送(真实)垂直同步信号,以便请求方根据垂直同步信号执行预定操作。Optionally, when the request time interval between two adjacent requests of the requester is less than the duration threshold, 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.
本申请实施例中,接收到请求方发送的垂直同步信号请求后,根据该垂直同步信号请求的第一请求时刻,以及上一次接收到该垂直同步信号请求的第二请求时刻,计算请求时间间隔,并在请求时间间隔大于时长阈值时,向请求方发送模拟垂直同步信号,以便请求方根据模拟垂直同步信号执行预定操作;相较于相关技术中需要等待真实的垂直同步请求才能执行操作,通过引入垂直同步信号模拟机制,使得请求方无需等待真实的垂直同步信号也可以执行预定操作,从而缩短了请求方等待垂直同步信号的时间,有助于提高显示屏显示画面的速度。In the embodiment of the present application, after receiving the vertical synchronization signal request sent by the requesting party, 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.
在一种可能的实施方式中,SurfaceFlinger进程中包括产生标准垂直同步信号(即软件垂直同步信号)的信号生成线程(VsyncThread)、关注应用程序的垂直同步信号的第一活动线程(EventThread(APP))、关注合成线程的垂直同步信号的第二活动线程(EventThread(Surface))、根据标准垂直同步信号发送垂直同步信号的信号发送线程(DispSyncThread)以及负责合成图层的合成线程。下面采用实施例,对应用程序请求获取垂直同步信号以及合成线程请求获取垂直同步信号的过程进行说明。In a possible implementation, 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. The following embodiments are used to describe the process of the application program requesting to obtain the vertical synchronization signal and the synthesis thread requesting to obtain the vertical synchronization signal.
请参考图8,其示出了本申请另一个示例性实施例提供的图像更新方法的方法流程图。该方法可以包括如下步骤。Please refer to FIG. 8, which shows a method flowchart of an image updating method provided by another exemplary embodiment of the present application. The method may include the following steps.
步骤801,接收应用程序发送的第一垂直同步信号请求。Step 801: Receive a first vertical synchronization signal request sent by an application program.
在一种可能的实施方式中,当应用程序需要绘制图层时,即向SurfaceFlinger进程中的第一活动线程发送第一垂直同步信号请求,由第一活动线程向信号发送线程发送该第一垂直同步信号请求。相应的,信号发送线程接收该第一垂直同步信号请求。In a possible implementation, when the application 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. Correspondingly, the signal sending thread receives the first vertical synchronization signal request.
步骤802,获取第一垂直同步信号请求的第一请求时刻,以及上一次接收到垂直同步信号请求的第二请求时刻。Step 802: Obtain the first request moment of the first vertical synchronization signal request and the second request moment of the last vertical synchronization signal request.
可选的,SurfaceFlinger进程的信号发送线程获取到第一垂直同步信号请求的第一请求时刻,以及上一次接收到应用程序发送的第一垂直同步信号请求的第二请求时刻,并计算第一请求时刻与第二请求时刻之间的请求时间间隔。Optionally, 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 first request The request time interval between time and the second request time.
在一个示意性的例子中,如图9所示,SurfaceFlinger进程(中的信号发送线程)获取到第一请求时刻为t1,第二请求时刻为t2,并计算得到请求时间间隔为t1-t2=20ms。In an illustrative example, as shown in Figure 9, the SurfaceFlinger process (the signal sending thread in) acquires the first request time as t1 and the second request time as t2, and the calculated request time interval is t1-t2= 20ms.
步骤803,响应于请求时间间隔大于时长阈值,向应用程序发送第一模拟垂直同步信号,请求时间间隔为第一请求时刻与第二请求时刻之间的时间间隔,应用程序用于根据第一模拟垂直同步信号进行画面绘制。Step 803: In response to the request time interval being greater than the duration threshold, send a first analog vertical synchronization signal to the application program. The request time interval is the time interval between the first request moment and the second request moment. The vertical sync signal draws the picture.
可选的,该时长阈值为显示屏的一个垂直同步信号周期。比如,当终端的显示屏为60Hz时,该垂直同步信号周期为16.7ms。Optionally, the duration threshold is a vertical synchronization signal period of the display screen. For example, when the display screen of the terminal is 60 Hz, the period of the vertical synchronization signal is 16.7 ms.
相应的,当第一请求时刻与第二请求时刻之间的请求时间间隔大于一个垂直同步信号周期时,SurfaceFlinger线程中的信号发送线程则通过垂直同步信号模拟功能,生成第一模拟垂直同步信号,并将第一模拟垂直同步信号发送给应用程序(首先将第一模拟垂直同步信号发送给第一活动线程,由第一活动线程发送给应用程序)。Correspondingly, 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).
结合上述步骤802中的示例,由于相邻两次请求之间的请求时间间隔(20ms)大于一个垂直同步信号周期(16.7ms),因此,SurfaceFlinger立即向应用程序发送第一模拟垂直同步信号。With reference to the example in step 802, 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.
在其他可能的实施方式中,当连续n(n≥3)次第一垂直同步信号请求之间的n-1个请求时间间隔均大于时长阈值时,终端通过SurfaceFlinger进程向应用程序发送第一模拟垂直同步信号,本实施例对此不做限定。In other possible implementation manners, 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.
可选的,应用程序接收到该第一模拟垂直同步信号后,进行图层绘制,并将绘制得到的图层数据发送给SurfaceFlinger。示意性的,如图9所示,应用程序接收到第一模拟垂直同步信号后进行图层绘制,并将图层数据发送至SurfaceFlinger进程(中的合成线程)。Optionally, after receiving the first analog vertical synchronization signal, the application program performs layer drawing, and sends the layer data obtained by drawing to SurfaceFlinger. Schematically, as shown in FIG. 9, the application program performs layer drawing after receiving the first analog vertical synchronization signal, and sends the layer data to the SurfaceFlinger process (composite thread in).
步骤804,响应于请求时间间隔小于时长阈值,根据标准垂直同步信号生成第一垂直同步信号,标准垂直同步信号由信号生成线程生成。 Step 804, 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.
当相邻两次请求之间的请求时间间隔小于时长阈值时,表明应用程序等待垂直同步信号的时间较短,因此终端可以根据标准垂直同步信号生成第一垂直同步信号。When the request time interval between two adjacent requests is less than the duration threshold, it indicates that the application program waits for the vertical synchronization signal for a short time, so the terminal can generate the first vertical synchronization signal according to the standard vertical synchronization signal.
在一种可能的实施方式中,当请求时间间隔小于时长阈值时,信号发送线程即在接收到信号生成线程产生的标准垂直同步信号后,生成第一垂直同步信号。In a possible implementation manner, 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.
步骤805,向应用程序发送第一垂直同步信号,应用程序用于根据第一垂直同步信号进行画面绘制。Step 805: 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.
进一步的,终端向应用程序发送第一垂直同步信号,以便应用程序根据第一垂直同步信号进行画面绘制。Further, 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.
在一种可能的实施方式中,信号发送线程将第一垂直同步信号发送至第一活动线程,由第一活动线程将第一垂直同步信号发送给应用程序。In a possible implementation manner, 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.
步骤806,接收合成线程发送的第二垂直同步信号请求。Step 806: Receive a second vertical synchronization signal request sent by the composition thread.
在一种可能的实施方式中,当合成线程接收到应用程序发送的图层数据,并需要进行图层合成时,即向SurfaceFlinger进程中的第二活动线程发送第二垂直同步信号请求,由第二活动线程向信号发送线程发送该第二垂直同步信号请求。相应的,信号发送线程接收该第二垂直同步信号请求。In a possible implementation, 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. Correspondingly, the signal sending thread receives the second vertical synchronization signal request.
步骤807,获取第二垂直同步信号请求的第一请求时刻,以及上一次接收到第二垂直同步信号请求的第二请求时刻。Step 807: 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.
可选的,SurfaceFlinger进程的信号发送线程获取到第二垂直同步信号请求的第一请求时刻,以及上一次接收到合成线程发送的第二垂直同步信号请求的第二请求时刻,并计算第一请求时刻与第二请求时刻之间的请求时间间隔。Optionally, the signal sending thread of the SurfaceFlinger process obtains the first request moment of the second vertical synchronization signal request and the second request moment of the second vertical synchronization signal request sent by the synthesis thread last time, and calculates the first request The request time interval between time and the second request time.
在一个示意性的例子中,SurfaceFlinger进程(信号发送线程)获取到第一请求时刻为t1,第二请求时刻为t2,并计算得到请求时间间隔为t1-t2=25ms。In an illustrative example, the SurfaceFlinger process (signal sending thread) acquires the first request time as t1 and the second request time as t2, and calculates that the request time interval is t1-t2=25ms.
步骤808,响应于请求时间间隔大于时长阈值,向合成线程发送第二模拟垂直同步信号,合成线程用于根据第二模拟垂直同步信号进行图层合成。Step 808: 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.
可选的,该时长阈值为显示屏的一个垂直同步信号周期。比如,当终端的显示屏为60Hz 时,该垂直同步信号周期为16.7ms。Optionally, the duration threshold is a vertical synchronization signal period of the display screen. For example, when the display screen of the terminal is 60 Hz, the period of the vertical synchronization signal is 16.7 ms.
相应的,当第一请求时刻与第二请求时刻之间的请求时间间隔大于一个垂直同步信号周期时,SurfaceFlinger线程中的信号发送线程则通过垂直同步信号模拟功能,生成第二模拟垂直同步信号,并将第二模拟垂直同步信号发送给合成线程(首先将第二模拟垂直同步信号发送给第二活动线程,由第二活动线程发送给合成线程)。Correspondingly, 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).
结合上述步骤807中的示例,由于相邻两次请求之间的请求时间间隔(25ms)大于一个垂直同步信号周期(16.7ms),因此,SurfaceFlinger立即向合成线程发送第二模拟垂直同步信号。With reference to the example in step 807, since the request time interval (25ms) between two adjacent requests is greater than one vertical synchronization signal period (16.7ms), SurfaceFlinger immediately sends the second analog vertical synchronization signal to the synthesis thread.
在其他可能的实施方式中,当连续n(n≥3)次第二垂直同步信号请求之间的n-1个请求时间间隔均大于时长阈值时,终端通过SurfaceFlinger进程向合成线程发送第二模拟垂直同步信号,本实施例对此不做限定。In other possible implementation manners, 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.
可选的,合成线程接收到该第二模拟垂直同步信号后,进行图层合成,并将合成得到的图像帧数据发送给显示屏。Optionally, after receiving the second analog vertical synchronization signal, the synthesis thread performs layer synthesis, and sends the synthesized image frame data to the display screen.
结合上述步骤中的示例,如图9所示,由于相邻两次请求的请求时间间隔(25ms)大于一个垂直同步信号周期(16.7ms),因此,SurfaceFlinger进程中的信号发送线程(图中未示出)向合成线程发送第二模拟垂直同步信号(图中未示出)。合成线程接收到第二模拟垂直同步信号后,无需等待真实垂直同步信号即可进行图层合成,从而将合成得到的图像帧数据发送至显示屏。Combining the example in the above steps, as shown in Figure 9, because the request time interval (25ms) between two adjacent requests is greater than one vertical synchronization signal period (16.7ms), therefore, the signal sending thread in the SurfaceFlinger process (not shown in the figure) (Shown) Send a second analog vertical synchronization signal (not shown in the figure) to the composition 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.
步骤809,响应于请求时间间隔小于时长阈值,根据标准垂直同步信号生成第二垂直同步信号,标准垂直同步信号由信号生成线程生成。Step 809: 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.
当相邻两次请求之间的请求时间间隔小于时长阈值时,表明合成线程等待垂直同步信号的时间较短,因此终端可以根据标准垂直同步信号生成第二垂直同步信号。When the request time interval between two adjacent requests is less than the duration threshold, it indicates that the synthesis thread waits for the vertical synchronization signal for a short time, so the terminal can generate the second vertical synchronization signal according to the standard vertical synchronization signal.
在一种可能的实施方式中,当请求时间间隔小于时长阈值时,信号发送线程即在接收到信号生成线程产生的标准垂直同步信号后,生成第二垂直同步信号。In a possible implementation manner, 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.
步骤810,向合成线程发送第二垂直同步信号,合成线程用于根据第二垂直同步信号进行图层合成。Step 810: Send a 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.
进一步的,终端向合成线程发送第二垂直同步信号,以便合成线程根据第二垂直同步信号进行图层合成。Further, 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.
在一种可能的实施方式中,信号发送线程将第二垂直同步信号发送至第二活动线程,由第二活动线程将第二垂直同步信号发送给合成线程。In a possible implementation manner, 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.
步骤811,通过合成线程向显示屏发送图像帧数据,图像帧数据由合成线程进行图层合成后得到。In step 811, 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.
步骤812,获取显示屏当前显示图像帧的显示次数。Step 812: Obtain the display times of the image frame currently displayed on the display screen.
步骤813,响应于显示次数大于次数阈值,重置显示屏的垂直同步信号起点,并根据图像帧数据更新显示屏显示的图像帧。 Step 813, in response to the display times being greater than the times threshold, reset the starting point of the vertical synchronization signal of the display screen, and update the image frames displayed on the display screen according to the image frame data.
上述步骤811至813的实施过程可以参考步骤401至403,本实施例在此不再赘述。For the implementation process of the foregoing steps 811 to 813, reference may be made to steps 401 to 403, which will not be repeated in this embodiment.
本实施例中,当应用程序相邻两次请求的请求时间间隔大于时长阈值时,通过模拟一个垂直同步信号给应用程序,使得应用程序能够立即进行图层绘制,避免应用程序长时间得到真实的垂直同步信号,从而提高了应用程序的画面绘制效率。In this embodiment, when the request time interval between two adjacent requests of the application program is greater than the duration threshold, 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.
本实施例中,当合成线程相邻两次请求的请求时间间隔大于时长阈值时,通过模拟一个垂直同步信号给合成线程,使得合成线程能够立即进行图层合成操作,避免合成线程长时间得到真实的垂直同步信号,从而提高了图层的合成效率。In this embodiment, when the request time interval between two adjacent requests of the compositing thread is greater than the duration threshold, 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.
为了验证上述方法的优化效果,测试人员分别对桌面点击场景、应用内点击场景下,绘制到画面显示的平均时长进行统计,得到的实验数据如表一所示。In order to verify the optimization effect of the above method, 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 are shown in Table 1.
表一Table I
Figure PCTCN2020081134-appb-000001
Figure PCTCN2020081134-appb-000001
通过表一中的数据可以发现,应用上述方法后,绘制到画面显示的平均时长分别优化了8ms(桌面点击场景)和9ms(应用内点击场景),且标准差更小,即画面帧率更加稳定。From the data in Table 1, it can be found that after applying the above method, the average time drawn to the screen display is optimized by 8ms (desktop click scene) and 9ms (in-app click scene), and the standard deviation is smaller, that is, the frame rate of the picture is higher. stable.
下述为本申请装置实施例,可以用于执行本申请方法实施例。对于本申请装置实施例中未披露的细节,请参照本申请方法实施例。The following are device embodiments of this application, which can be used to implement the method embodiments of this application. For details not disclosed in the device embodiment of this application, please refer to the method embodiment of this application.
请参考图10,其示出了本申请一个实施例提供的图像更新装置的结构示意图。该装置可以通过专用硬件电路,或者,软硬件的结合实现成为图1中的终端的全部或一部分,该装置包括:Please refer to FIG. 10, which shows a schematic structural diagram of an image updating apparatus 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:
第一发送模块1001,用于通过合成线程向显示屏发送图像帧数据,所述图像帧数据由所述合成线程进行图层合成后得到;The first sending module 1001 is configured to send image frame data to the display screen through a synthesis thread, where the image frame data is obtained after layer synthesis by the synthesis thread;
第一获取模块1002,用于获取所述显示屏当前显示图像帧的显示次数;The first obtaining module 1002 is configured to obtain the display times of the image frame currently displayed on the display screen;
第一更新模块1003,用于响应于所述显示次数大于次数阈值,重置所述显示屏的垂直同步信号起点,并根据所述图像帧数据更新所述显示屏显示的图像帧。The first update module 1003 is configured to reset the starting point of the vertical synchronization signal of the display screen in response to the display times being greater than the times threshold, and update the image frames displayed on the display screen according to the image frame data.
可选的,所述装置还包括:Optionally, the device further includes:
第二获取模块,用于获取所述显示屏当前所处的显示状态;The second acquiring module is used to acquire the current display state of the display screen;
第二更新模块,用于若所述显示屏处于命令command模式下的睡眠状态,则重置所述显示屏的垂直同步信号起点,并根据所述图像帧数据更新所述显示屏显示的图像帧。The second update module is configured to reset the starting point of the vertical synchronization signal of the display screen if the display screen is in the sleep state in the command mode, and update the image frame displayed on the display screen according to the image frame data .
可选的,所述第一更新模块1003或第二更新模块,包括:Optionally, the first update module 1003 or the second update module includes:
代价确定单元,用于根据当前硬件状态确定重置垂直同步信号起点的重置代价,所述重置代价包括重置时间;A cost determining 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 update unit is configured to reset the starting point of the vertical synchronization signal if the reset cost is less than the cost threshold, and update the image frame displayed on the display screen according to the image frame data.
可选的,所述装置还包括:Optionally, the device further includes:
第一接收模块,用于接收请求方发送的垂直同步信号请求,所述垂直同步信号请求用于请求获取垂直同步信号;The first receiving module 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 third acquiring module is 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 second sending module is configured to send an analog vertical synchronization signal to the requesting party in response to the request time interval being greater than the duration threshold, where the request time interval is the time between the first request moment and the second request moment Interval, the requester is used to perform a predetermined operation according to the analog vertical synchronization signal.
可选的,所述时长阈值根据垂直同步信号周期确定,所述垂直同步信号周期用于指示相邻两个垂直同步信号之间的时间间隔,且所述时长阈值大于等于所述垂直同步信号周期。Optionally, 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 .
可选的,所述请求方为应用程序;Optionally, the requesting party is an application program;
所述第一接收模块,用于:The first receiving module is used to:
接收所述应用程序发送的第一垂直同步信号请求;Receiving a first vertical synchronization signal request sent by the application program;
所述第二发送模块,用于:The second sending module is used to:
向所述应用程序发送第一模拟垂直同步信号,所述应用程序用于根据所述第一模拟垂直同步信号进行画面绘制。Sending 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.
可选的,所述装置还包括:Optionally, 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 third 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.
可选的,所述请求方为所述合成线程;Optionally, the requester is the composition thread;
所述第一接收模块,用于:The first receiving module is used to:
接收所述合成线程发送的第二垂直同步信号请求;Receiving a second vertical synchronization signal request sent by the composition thread;
所述第二发送模块,用于:The second sending module is used to:
向所述合成线程发送第二模拟垂直同步信号,所述合成线程用于根据所述第二模拟垂直同步信号进行图层合成。Sending a second analog vertical synchronization signal to the composition thread, where the composition thread is used to perform layer composition according to the second analog vertical synchronization signal.
可选的,所述装置还包括:Optionally, 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, and the standard vertical synchronization signal is generated by a signal generation thread;
第四发送模块,用于向所述合成线程发送所述第二垂直同步信号,所述合成线程用于根据所述第二垂直同步信号进行图层合成。The fourth 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.
综上所述,本申请实施例中,通过合成线程向显示屏发送图像帧数据时,获取显示屏当前显示图像帧的显示次数,并在显示次数大于次数阈值时,重置显示屏的垂直同步信号起点,以便显示屏根据图像帧数据更新显示屏显示的图像帧;相较于相关技术中显示屏需要接收到硬件垂直同步信号后才能够进行图像更新,本申请实施例中,通过重置显示屏的垂直同步起点,使得显示屏在重复显示同一图像帧的情况下接收到新的图像帧数据时,能够立即根据图像帧数据进行图像更新,从而缩短了显示屏等待硬件垂直同步信号的时间,有助于提高显示屏显示画面的速度。To sum up, in the embodiment of the present application, when the image frame data is sent to the display screen through the synthesis thread, the display times of the image frames currently displayed on the display screen are obtained, and when the display times are greater than the times threshold, the vertical synchronization of the display screen is reset Signal starting point, so that the display screen can update the image frame displayed on the display screen according to the image frame data; compared with the related art, the display screen needs to receive the hardware vertical synchronization signal before it can update the image. In this embodiment of the application, the display is reset The vertical synchronization starting point of the screen enables the screen to update the image immediately according to the image frame data when it receives new image frame data while repeatedly displaying the same image frame, thus shortening the time for the display screen to wait for the hardware vertical synchronization signal. Helps increase the speed of the display screen.
需要说明的是,上述实施例提供的装置,在实现其功能时,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将终端的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。另外,上述实施例提供的装置与方法实施例属于同一构思,其具体实现过程详见方法实施例,这里不再赘述。It should be noted that the device provided in the above embodiment, when implementing its functions, only uses the division of the above functional modules for illustration. In practical applications, 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. In addition, 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 the program instructions implement the image update method provided by the foregoing method embodiments when the program instructions are executed by the processor.
本申请还提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述各个实施例所述的图像更新方法。The present application also provides a computer program product containing instructions, which when run on a computer, causes the computer to execute the image update method described in each of the foregoing embodiments.
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。The serial numbers of the foregoing embodiments of the present application are only for description, and do not represent the advantages and disadvantages of the embodiments.
本领域普通技术人员可以理解实现上述实施例的帧率控制方法中全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。以上所述仅为本申请的较佳实施例,并不用以限制本申请,凡在本申请的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。Those of ordinary skill in the art can understand that all or part of the steps in the frame rate control method of the foregoing embodiments can be implemented by hardware, or by a program to instruct relevant hardware to complete, and the program can be stored in a computer readable Among the storage media, the aforementioned storage media may be read-only memory, magnetic disks, or optical disks. The above descriptions are only preferred embodiments of this application and are not intended to limit this application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this application shall be included in the protection of this application. Within range.

Claims (20)

  1. 一种图像更新方法,所述方法包括:An image update method, the method includes:
    通过合成线程向显示屏发送图像帧数据,所述图像帧数据由所述合成线程进行图层合成后得到;Sending image frame data to the display screen through a synthesis thread, where the image frame data is obtained after layer synthesis by the synthesis thread;
    获取所述显示屏当前显示图像帧的显示次数;Acquiring the display times of the image frame currently displayed on the display screen;
    响应于所述显示次数大于次数阈值,重置所述显示屏的垂直同步信号起点,并根据所述图像帧数据更新所述显示屏显示的图像帧。In response to the display times being greater than the times threshold, resetting the starting point of the vertical synchronization signal of the display screen, and updating the image frames displayed on the display screen according to the image frame data.
  2. 根据权利要求1所述的方法,其中,所述通过合成线程向显示屏发送图像帧数据之后,所述方法还包括:The method according to claim 1, wherein, after the image frame data is sent to the display screen through the synthesis thread, the method further comprises:
    获取所述显示屏当前所处的显示状态;Acquiring the current display state of the display screen;
    响应于所述显示屏处于命令command模式下的睡眠状态,重置所述显示屏的垂直同步信号起点,并根据所述图像帧数据更新所述显示屏显示的图像帧。In response to the display screen being in the sleep state in the command mode, 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.
  3. 根据权利要求1或2所述的方法,其中,所述重置所述显示屏的垂直同步信号起点,并根据所述图像帧数据更新所述显示屏显示的图像帧,包括:The method according to claim 1 or 2, wherein the resetting the start point of the vertical synchronization signal of the display screen and updating the image frame displayed on the display screen according to the image frame data comprises:
    根据当前硬件状态确定重置垂直同步信号起点的重置代价,所述重置代价包括重置时间;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;
    响应于所述重置代价小于代价阈值,重置所述垂直同步信号起点,并根据所述图像帧数据更新所述显示屏显示的图像帧。In response to the resetting cost being less than the cost threshold, resetting the starting point of the vertical synchronization signal, and updating the image frame displayed on the display screen according to the image frame data.
  4. 根据权利要求1或2所述的方法,其中,所述通过合成线程向显示屏发送图像帧数据之前,所述方法还包括:The method according to claim 1 or 2, wherein before the sending the image frame data to the display screen through the synthesis thread, the method further comprises:
    接收请求方发送的垂直同步信号请求,所述垂直同步信号请求用于请求获取垂直同步信号;Receiving 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;
    获取所述垂直同步信号请求的第一请求时刻,以及上一次接收到所述垂直同步信号请求的第二请求时刻;Acquiring the first request time of the vertical synchronization signal request and the second request time of the last time the vertical synchronization signal request was received;
    响应于请求时间间隔大于时长阈值,向所述请求方发送模拟垂直同步信号,所述请求时间间隔为所述第一请求时刻与所述第二请求时刻之间的时间间隔,所述请求方用于根据所述模拟垂直同步信号执行预定操作。In response to the request time interval being greater than the duration threshold, send an analog vertical synchronization signal to the requester, where the request time interval is the time interval between the first request moment and the second request moment, and the requester uses Performing a predetermined operation according to the analog vertical synchronization signal.
  5. 根据权利要求4所述的方法,其中,所述时长阈值根据垂直同步信号周期确定,所述垂直同步信号周期用于指示相邻两个垂直同步信号之间的时间间隔,且所述时长阈值大于等于所述垂直同步信号周期。The method according to claim 4, wherein 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 Equal to the period of the vertical synchronization signal.
  6. 根据权利要求4所述的方法,其中,所述请求方为应用程序;The method according to claim 4, wherein the requesting party is an application program;
    所述接收请求方发送的垂直同步信号请求,包括:The receiving the vertical synchronization signal request sent by the requesting party includes:
    接收所述应用程序发送的第一垂直同步信号请求;Receiving a first vertical synchronization signal request sent by the application program;
    所述向所述请求方发送模拟垂直同步信号,包括:The sending an analog vertical synchronization signal to the requesting party includes:
    向所述应用程序发送第一模拟垂直同步信号,所述应用程序用于根据所述第一模拟垂直同步信号进行画面绘制。Sending 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.
  7. 根据权利要求6所述的方法,其中,所述获取所述垂直同步信号请求的第一请求时刻,以及上一次接收到所述垂直同步信号请求的第二请求时刻之后,所述方法还包括:7. The method according to claim 6, wherein said acquiring the first request time of the vertical synchronization signal request and after the second request time of the last receiving the vertical synchronization signal request, the method further comprises:
    响应于所述请求时间间隔小于所述时长阈值,则根据标准垂直同步信号生成第一垂直同步信号,所述标准垂直同步信号由信号生成线程生成;In response to the request time interval being less than the duration threshold, generating a first vertical synchronization signal according to a standard vertical synchronization signal, and the standard vertical synchronization signal is generated by a signal generation thread;
    向所述应用程序发送所述第一垂直同步信号,所述应用程序用于根据所述第一垂直同步信号进行画面绘制。Sending the 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.
  8. 根据权利要求4所述的方法,其中,所述请求方为所述合成线程;The method according to claim 4, wherein the requestor is the composition thread;
    所述接收请求方发送的垂直同步信号请求,包括:The receiving the vertical synchronization signal request sent by the requesting party includes:
    接收所述合成线程发送的第二垂直同步信号请求;Receiving a second vertical synchronization signal request sent by the composition thread;
    所述向所述请求方发送模拟垂直同步信号,包括:The sending an analog vertical synchronization signal to the requesting party includes:
    向所述合成线程发送第二模拟垂直同步信号,所述合成线程用于根据所述第二模拟垂直同步信号进行图层合成。Sending a second analog vertical synchronization signal to the composition thread, where the composition thread is used to perform layer composition according to the second analog vertical synchronization signal.
  9. 根据权利要求8所述的方法,其中,所述获取所述垂直同步信号请求的第一请求时刻,以及上一次接收到所述垂直同步信号请求的第二请求时刻之后,所述方法还包括:The method according to claim 8, wherein, after said acquiring the first request time of the vertical synchronization signal request and after the second request time of the last receiving the vertical synchronization signal request, the method further comprises:
    响应于所述请求时间间隔小于所述时长阈值,则根据标准垂直同步信号生成第二垂直同步信号,所述标准垂直同步信号由信号生成线程生成;In response to the request time interval being less than the duration threshold, generating a second vertical synchronization signal according to a standard vertical synchronization signal, the standard vertical synchronization signal being generated by a signal generation thread;
    向所述合成线程发送所述第二垂直同步信号,所述合成线程用于根据所述第二垂直同步信号进行图层合成。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.
  10. 一种图像更新装置,其特征在于,所述装置包括:An image update device, characterized in that the device includes:
    第一发送模块,用于通过合成线程向显示屏发送图像帧数据,所述图像帧数据由所述合成线程进行图层合成后得到;The first sending module is configured to send image frame data to the display screen through a synthesis thread, where the image frame data is obtained after layer synthesis by the synthesis thread;
    第一获取模块,用于获取所述显示屏当前显示图像帧的显示次数;The first acquiring module is configured to acquire the display times of the image frame currently displayed on the display screen;
    第一更新模块,用于响应于所述显示次数大于次数阈值,重置所述显示屏的垂直同步信号起点,并根据所述图像帧数据更新所述显示屏显示的图像帧。The first update module is configured to reset the starting point of the vertical synchronization signal of the display screen in response to the display times being greater than the times threshold, and update the image frames displayed on the display screen according to the image frame data.
  11. 根据权利要求10所述的装置,其中,所述装置还包括:The device according to claim 10, wherein the device further comprises:
    第二获取模块,用于获取所述显示屏当前所处的显示状态;The second acquiring module is used to acquire the current display state of the display screen;
    第二更新模块,用于响应于所述显示屏处于命令command模式下的睡眠状态,重置所述显示屏的垂直同步信号起点,并根据所述图像帧数据更新所述显示屏显示的图像帧。The second update module is configured to reset 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 update the image frame displayed on the display screen according to the image frame data .
  12. 根据权利要求10或11所述的装置,其中,所述第一更新模块或第二更新模块,包括:The device according to claim 10 or 11, wherein the first update module or the second update module comprises:
    代价确定单元,用于根据当前硬件状态确定重置垂直同步信号起点的重置代价,所述重置代价包括重置时间;A cost determining 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 updating 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.
  13. 根据权利要求10或11所述的装置,其中,所述装置还包括:The device according to claim 10 or 11, wherein the device further comprises:
    第一接收模块,用于接收请求方发送的垂直同步信号请求,所述垂直同步信号请求用于请求获取垂直同步信号;The first receiving module 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 third acquiring module is 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 second 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 time between the first request moment and the second request moment Interval, the requester is used to perform a predetermined operation according to the analog vertical synchronization signal.
  14. 根据权利要求13所述的装置,其中,所述时长阈值根据垂直同步信号周期确定,所述垂直同步信号周期用于指示相邻两个垂直同步信号之间的时间间隔,且所述时长阈值大于等于所述垂直同步信号周期。The apparatus according to claim 13, wherein 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 Equal to the period of the vertical synchronization signal.
  15. 根据权利要求13所述的装置,其中,所述请求方为应用程序;The device according to claim 13, wherein the requesting party is an application;
    所述第一接收模块,用于:The first receiving module is used to:
    接收所述应用程序发送的第一垂直同步信号请求;Receiving a first vertical synchronization signal request sent by the application program;
    所述第二发送模块,用于:The second sending module is used to:
    向所述应用程序发送第一模拟垂直同步信号,所述应用程序用于根据所述第一模拟垂直同步信号进行画面绘制。Sending 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.
  16. 根据权利要求15所述的装置,其中,所述装置还包括:The device according to claim 15, wherein the device further comprises:
    第一生成模块,用于响应于所述请求时间间隔小于所述时长阈值,则根据标准垂直同步信号生成第一垂直同步信号,所述标准垂直同步信号由信号生成线程生成;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 third 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.
  17. 根据权利要求13所述的装置,其中,所述请求方为所述合成线程;The apparatus according to claim 13, wherein the requestor is the composition thread;
    所述第一接收模块,用于:The first receiving module is used to:
    接收所述合成线程发送的第二垂直同步信号请求;Receiving a second vertical synchronization signal request sent by the composition thread;
    所述第二发送模块,用于:The second sending module is used to:
    向所述合成线程发送第二模拟垂直同步信号,所述合成线程用于根据所述第二模拟垂直同步信号进行图层合成。Sending a second analog vertical synchronization signal to the composition thread, where the composition thread is used to perform layer composition according to the second analog vertical synchronization signal.
  18. 根据权利要求17所述的装置,其中,所述装置还包括:The device according to claim 17, wherein the device further comprises:
    第二生成模块,用于响应于所述请求时间间隔小于所述时长阈值,则根据标准垂直同步信号生成第二垂直同步信号,所述标准垂直同步信号由信号生成线程生成;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, and the standard vertical synchronization signal is generated by a signal generation thread;
    第四发送模块,用于向所述合成线程发送所述第二垂直同步信号,所述合成线程用于根据所述第二垂直同步信号进行图层合成。The fourth 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.
  19. 一种终端,其特征在于,所述终端包括处理器、与所述处理器相连的存储器和显示屏,以及存储在所述存储器上的程序指令,所述处理器执行所述程序指令时实现如权利要求1至9任一所述的图像更新方法。A terminal, characterized in that the terminal includes a processor, a memory and a display screen connected to the processor, and program instructions stored on the memory. When the processor executes the program instructions, The image update method according to any one of claims 1 to 9.
  20. 一种计算机可读存储介质,其特征在于,其上存储有程序指令,所述程序指令被处理器执行时实现如权利要求1至9任一所述的图像更新方法。A computer-readable storage medium, characterized in that program instructions are stored thereon, and when the program instructions are executed by a processor, the image update method according to any one of claims 1 to 9 is realized.
PCT/CN2020/081134 2019-04-09 2020-03-25 Image update method and apparatus, and terminal and storage medium WO2020207251A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910279696.9 2019-04-09
CN201910279696.9A CN109992232B (en) 2019-04-09 2019-04-09 Image updating method, device, terminal and storage medium

Publications (1)

Publication Number Publication Date
WO2020207251A1 true WO2020207251A1 (en) 2020-10-15

Family

ID=67132634

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/081134 WO2020207251A1 (en) 2019-04-09 2020-03-25 Image update method and apparatus, and terminal and storage medium

Country Status (2)

Country Link
CN (1) CN109992232B (en)
WO (1) WO2020207251A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115002542A (en) * 2022-05-26 2022-09-02 展讯半导体(南京)有限公司 Frame rate adjusting method and device, computer readable storage medium and terminal

Families Citing this family (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110018874B (en) * 2019-04-09 2021-07-13 Oppo广东移动通信有限公司 Vertical synchronization method, device, terminal and storage medium
CN109992232B (en) * 2019-04-09 2022-02-01 Oppo广东移动通信有限公司 Image updating method, device, terminal and storage medium
CN110764725A (en) * 2019-10-18 2020-02-07 中科创达软件股份有限公司 Vehicle machine system main screen and auxiliary screen display method and device and electronic equipment
CN111124230B (en) * 2019-12-24 2020-11-17 腾讯科技(深圳)有限公司 Input response method, device, electronic equipment and computer readable storage medium
CN114327344A (en) * 2020-01-06 2022-04-12 Oppo广东移动通信有限公司 Method and device for controlling display frequency of display screen and electronic equipment
CN113160747B (en) * 2020-01-22 2022-08-05 Oppo广东移动通信有限公司 Display screen frequency conversion method, display driving integrated circuit chip and application processor
CN111787388B (en) * 2020-07-10 2022-11-11 海信视像科技股份有限公司 Display device
CN113630639B (en) * 2020-05-07 2022-04-19 海信视像科技股份有限公司 Display device
WO2021223517A1 (en) * 2020-05-07 2021-11-11 海信视像科技股份有限公司 Display device
CN111752520A (en) * 2020-06-28 2020-10-09 Oppo广东移动通信有限公司 Image display method, image display device, electronic equipment and computer readable storage medium
CN113867663B (en) * 2020-10-22 2024-04-09 华为技术有限公司 Display method and electronic equipment
CN113727174A (en) * 2021-07-14 2021-11-30 深圳市有为信息技术发展有限公司 Method and device for controlling vehicle satellite positioning system video platform to play and electronic equipment
CN114217730A (en) * 2021-12-27 2022-03-22 科大讯飞股份有限公司 Writing display method, device, equipment, system and storage medium
CN114020097B (en) * 2022-01-10 2022-06-17 北京鲸鲮信息系统技术有限公司 Signal synchronization method and device, electronic equipment and storage medium
CN114489545B (en) * 2022-01-28 2022-08-02 广州文石信息科技有限公司 Screen updating request scanning method and device, storage medium and related equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101968728A (en) * 2010-09-27 2011-02-09 广东威创视讯科技股份有限公司 Processing method and device after acquiring vertical synchronization time during image update
CN102004620A (en) * 2010-11-09 2011-04-06 广东威创视讯科技股份有限公司 Image updating method and device
CN107786748A (en) * 2017-10-31 2018-03-09 广东欧珀移动通信有限公司 Method for displaying image and equipment
US20180268512A1 (en) * 2017-03-15 2018-09-20 Microsoft Technology Licensing, Llc Techniques for reducing perceptible delay in rendering graphics
CN109992232A (en) * 2019-04-09 2019-07-09 Oppo广东移动通信有限公司 Image updating method, device, terminal and storage medium
CN110018874A (en) * 2019-04-09 2019-07-16 Oppo广东移动通信有限公司 Vertical synchronization method, apparatus, terminal and storage medium

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9251552B2 (en) * 2012-06-28 2016-02-02 Intel Corporation Method and apparatus for managing image data for presentation on a display
JP6207980B2 (en) * 2013-11-11 2017-10-04 Eizo株式会社 Display device and display method
US10482568B2 (en) * 2014-05-28 2019-11-19 Sony Corporation Information processor and information processing method
US9728166B2 (en) * 2015-08-20 2017-08-08 Qualcomm Incorporated Refresh rate matching with predictive time-shift compensation
JP6703800B2 (en) * 2016-04-01 2020-06-03 シャープ株式会社 Display device, display device control method, and control program
CN107665665A (en) * 2017-10-27 2018-02-06 康佳集团股份有限公司 A kind of guard method of OLED display screen, intelligent television and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101968728A (en) * 2010-09-27 2011-02-09 广东威创视讯科技股份有限公司 Processing method and device after acquiring vertical synchronization time during image update
CN102004620A (en) * 2010-11-09 2011-04-06 广东威创视讯科技股份有限公司 Image updating method and device
US20180268512A1 (en) * 2017-03-15 2018-09-20 Microsoft Technology Licensing, Llc Techniques for reducing perceptible delay in rendering graphics
CN107786748A (en) * 2017-10-31 2018-03-09 广东欧珀移动通信有限公司 Method for displaying image and equipment
CN109992232A (en) * 2019-04-09 2019-07-09 Oppo广东移动通信有限公司 Image updating method, device, terminal and storage medium
CN110018874A (en) * 2019-04-09 2019-07-16 Oppo广东移动通信有限公司 Vertical synchronization method, apparatus, terminal and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115002542A (en) * 2022-05-26 2022-09-02 展讯半导体(南京)有限公司 Frame rate adjusting method and device, computer readable storage medium and terminal

Also Published As

Publication number Publication date
CN109992232B (en) 2022-02-01
CN109992232A (en) 2019-07-09

Similar Documents

Publication Publication Date Title
WO2020207251A1 (en) Image update method and apparatus, and terminal and storage medium
WO2020207250A1 (en) Vertical synchronization method and apparatus, terminal, and storage medium
JP6894976B2 (en) Image smoothness improvement method and equipment
TWI242753B (en) Apparatus, method and system with a graphics-rendering engine having a graphics context manager
WO2020156132A1 (en) Gpu performance bottleneck determining method and device, terminal, and storage medium
US20220222783A1 (en) Systems and methods for frame time smoothing based on modified animation advancement and use of post render queues
WO2021244666A1 (en) Video playing control method and apparatus, and computer device and storage medium
WO2023046164A1 (en) Image display method, ddic, display screen module, and terminal
WO2024012098A1 (en) Control method and apparatus for display screen, electronic device, and storage medium
JPH11327526A (en) Storage device, device and method for processing image and device and method for controlling refresh operation
KR20220143667A (en) Reduced display processing unit delivery time to compensate for delayed graphics processing unit render times
US8447035B2 (en) Contract based memory management for isochronous streams
CN115101025B (en) LCD control circuit supporting virtual frame buffering and control method thereof
WO2007055067A1 (en) Information processing device, graphic processor, control processor, and information processing method
WO2023005042A1 (en) Image rendering method, apparatus, device, and computer-readable storage medium
JP2000029456A (en) Display drawing and displaying method and display device
JP2000245966A (en) Method and device for processing image
JP6612292B2 (en) CONVERSION SYSTEM, VIDEO OUTPUT DEVICE, AND CONVERSION METHOD
WO1999040518A1 (en) Method and apparatus to synchronize graphics rendering and display
CN114327103B (en) Touch screen delay optimization method and terminal
TW201409350A (en) A processing method of external image apparatus, and a external image apparatus
US11763778B2 (en) Reduced vertical blanking regions for display systems that support variable refresh rates
CN114153416B (en) Display control method and related device
WO2023184242A1 (en) Display control method and apparatus, image processing apparatus, and display device
CN115576871A (en) Virtual reality rendering method, device, terminal and computer storage medium

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: 20786732

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: 20786732

Country of ref document: EP

Kind code of ref document: A1