WO2023216146A1 - Display image updating method and apparatus and storage medium - Google Patents

Display image updating method and apparatus and storage medium Download PDF

Info

Publication number
WO2023216146A1
WO2023216146A1 PCT/CN2022/092232 CN2022092232W WO2023216146A1 WO 2023216146 A1 WO2023216146 A1 WO 2023216146A1 CN 2022092232 W CN2022092232 W CN 2022092232W WO 2023216146 A1 WO2023216146 A1 WO 2023216146A1
Authority
WO
WIPO (PCT)
Prior art keywords
layer
type
processing
application
synchronization signal
Prior art date
Application number
PCT/CN2022/092232
Other languages
French (fr)
Chinese (zh)
Inventor
李丽
刘正亮
许英枫
Original Assignee
北京小米移动软件有限公司
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 北京小米移动软件有限公司 filed Critical 北京小米移动软件有限公司
Priority to PCT/CN2022/092232 priority Critical patent/WO2023216146A1/en
Priority to CN202280004257.7A priority patent/CN117396835A/en
Publication of WO2023216146A1 publication Critical patent/WO2023216146A1/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
    • G06F3/0485Scrolling or panning
    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces

Definitions

  • the present disclosure relates to the field of image processing technology but is not limited to the field of wireless communication technology, and in particular, to an update method, device and storage medium for displaying images.
  • the processing of data to be displayed in the display system mainly includes: application drawing processing, layer synthesis processing and hardware Refresh display processing; in order to avoid display freezes and improve display effects, the display system synchronizes various processes through the system vertical synchronization signal.
  • the process from the beginning of application drawing processing to the final screen display requires about 3 signal cycles of the system vertical synchronization signal. Even in terminal devices with high refresh rates (such as 120Hz), the delay of one frame of image Also about 24ms. For some application scenarios with high requirements on fluency and chirality (such as stylus application scenarios), obvious lags will occur and the user experience will be poor.
  • Embodiments of the present disclosure provide a display image updating method, device, and storage medium.
  • a first aspect of an embodiment of the present disclosure provides a method for updating a display image, which is applied to a terminal device, wherein the method includes:
  • the touch event is At least one first-type layer corresponding to the event is applied for drawing processing;
  • the display image of the display interface is updated.
  • application drawing processing is performed on at least one first type layer corresponding to the touch event, including :
  • the type of the touch event indicates that the touch event is a click event
  • an application drawing process is performed on at least one first type layer corresponding to the click event.
  • the at least one first type layer corresponding to the touch event is applied based on the type of the touch event and the target trigger time of the application drawing process corresponding to the type of the touch event.
  • Drawing processing including:
  • the type of the touch event indicates that the touch event is a sliding event
  • the first synchronization signal is a system vertical synchronization signal that triggers application drawing processing.
  • the method further includes:
  • the preset time is determined based on the difference between the maximum duration and the signal period of the first synchronization signal.
  • the layer synthesis process of the at least one first type layer is triggered to obtain the target image frame, including:
  • layer synthesis processing is performed on the at least one first type layer in the layer synthesis cache to obtain the target image frame.
  • the method further includes:
  • the second synchronization signal is a system vertical synchronization signal that triggers layer synthesis processing
  • performing layer synthesis processing on the at least one first type layer in the layer synthesis cache based on the triggering of the first write operation of the first type layer to obtain the target image frame include:
  • the The at least one first-type layer and the at least one second-type layer in the layer composition cache are subjected to layer composition processing to obtain the target image frame.
  • the method further includes:
  • layer synthesis processing is performed on at least one second type of layer in the layer synthesis cache to obtain The target image frame.
  • the above methods before applying the drawing process to at least one first type layer corresponding to the touch event based on the type of the touch event and the target triggering moment of the application drawing process corresponding to the type, the above methods also include:
  • the window identifier corresponding to the application program includes a preset identifier, it is determined that the terminal device is in the first application state, and at least one first type layer generated by the touch event is obtained.
  • the method further includes:
  • the window identifier corresponding to the application program does not include the preset identifier, it is determined that the terminal device is in the second application state;
  • a layer synthesis process is performed on at least one first type layer after applying the drawing process.
  • a second aspect of the embodiment of the present disclosure provides a device for updating a display image, which is applied to a terminal device, wherein the device includes:
  • a first processing module configured to detect a touch event for the display interface, and when the terminal device is in the first application state, draw a processing target based on the type of the touch event and the application corresponding to the type. At the triggering moment, apply drawing processing to at least one first-type layer corresponding to the touch event;
  • the second processing module is configured to trigger layer synthesis processing on the at least one first-type layer after the application drawing process of the at least one first-type layer is completed to obtain a target image frame;
  • An update module configured to update the display image of the display interface based on the target image frame.
  • the first processing module is configured as:
  • the type of the touch event indicates that the touch event is a click event
  • an application drawing process is performed on at least one first type layer corresponding to the click event.
  • the first processing module is configured as:
  • the type of the touch event indicates that the touch event is a sliding event
  • the first synchronization signal is a system vertical synchronization signal that triggers application drawing processing.
  • the first processing module is configured as:
  • the preset time is determined based on the difference between the maximum duration and the signal period of the first synchronization signal.
  • the second processing module is configured as:
  • layer synthesis processing is performed on the at least one first type layer in the layer synthesis cache to obtain the target image frame.
  • the first processing module is configured as:
  • the second synchronization signal is a system vertical synchronization signal that triggers layer synthesis processing
  • the second processing module is configured as:
  • the The at least one first-type layer and the at least one second-type layer in the layer composition cache are subjected to layer composition processing to obtain the target image frame.
  • the second processing module is configured as:
  • layer synthesis processing is performed on at least one second type of layer in the layer synthesis cache to obtain The target image frame.
  • the first processing module is configured as:
  • the window identifier corresponding to the application program includes a preset identifier, it is determined that the terminal device is in the first application state, and at least one first type layer generated by the touch event is obtained.
  • the first processing module is configured as:
  • the window identifier corresponding to the application program does not include the preset identifier, it is determined that the terminal device is in the second application state;
  • the second processing module is configured as:
  • a layer synthesis process is performed on at least one first type layer after applying the drawing process.
  • a third aspect of the embodiment of the present disclosure provides an updating device for displaying images, including:
  • memory configured to store executable instructions
  • the processor when the processor runs the executable instructions, the processor performs the method for updating the display image provided in the first aspect.
  • a fourth aspect of an embodiment of the present disclosure provides a non-transitory computer-readable storage medium, which when the instructions in the storage medium are executed by a processor of an updating device for displaying an image, enables the updating device for displaying an image to execute the foregoing.
  • the first aspect provides an update method for displaying images.
  • the target triggering moment corresponding to the type of the touch event is determined according to the type of the touch event.
  • the target triggering moment triggers the application drawing processing of at least one first-type layer generated by the touch event; thereby performing application drawing in a timely manner based on different types of touch events generated during the touch process of the display interface. Processing, there is no need to wait for the trigger of the first synchronization signal, reducing the delay in the application drawing process;
  • the layer synthesis process of the at least one first type layer after the application drawing process is directly triggered to obtain the target image frame; there is no need to wait for the second time.
  • the synchronization signal reduces the delay in the layer synthesis process, thereby reducing the time it takes from detecting a touch event to displaying the image frame generated by the touch event on the display interface, significantly reducing the touch delay of the terminal device. , improve the user experience.
  • Figure 1 is a schematic flowchart 1 of a method for updating a display image according to an exemplary embodiment
  • Figure 2 is a schematic flowchart 2 of a method for updating a display image according to an exemplary embodiment
  • Figure 3 is a schematic diagram of the processing of image frames corresponding to the Down event shown in the related art
  • Figure 4 is a schematic diagram of processing an image frame corresponding to a Down event according to an exemplary embodiment
  • Figure 5 is a schematic diagram of the processing of image frames corresponding to the Move event shown in the related art
  • Figure 6 is a schematic diagram of processing an image frame corresponding to a Down event according to an exemplary embodiment
  • Figure 7 is a schematic structural diagram of an updating device for displaying images according to an exemplary embodiment
  • Figure 8 is a block diagram of a terminal device according to an exemplary embodiment.
  • first, second, third, etc. may be used to describe various information in the embodiments of the present disclosure, the information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other.
  • first information may also be called second information, and similarly, the second information may also be called first information.
  • word “if” as used herein may be interpreted as "when” or "when” or "in response to determining.”
  • FIG. 1 is a schematic flowchart 1 of a method for updating a display image according to an exemplary embodiment. The method includes:
  • Step S101 When a touch event for the display interface is detected and the terminal device is in the first application state, based on the type of the touch event and the target trigger time of the application drawing process corresponding to the type, the touch event is detected. Perform application drawing processing on at least one first-type layer corresponding to the touch event;
  • Step S102 After the application drawing process of the at least one first type layer is completed, trigger the layer synthesis process of the at least one first type layer to obtain the target image frame;
  • Step S103 Update the display image of the display interface based on the target image frame.
  • the display image updating method provided by the embodiments of the present disclosure can be applied to a terminal device including a touch screen.
  • the terminal device may include a smart phone, a tablet computer, a notebook computer, etc.
  • step S101 during the use of the terminal device, after detecting a touch event generated by a touch operation on the display interface of the terminal device, it may be determined whether the current terminal device is in the first application state. If the current The terminal device is in the first application state, determines the target trigger time of the application drawing process corresponding to the type of the touch event according to the type of the touch event, and at the target trigger time, performs the processing based on the touch event. At least one first-type layer is generated for application drawing processing.
  • the first application state may be: the application program currently running in the foreground of the terminal device is the target application program.
  • the target application is a preset application with high chirality requirements, such as a drawing application, a document application, etc.
  • the terminal device It can be determined whether the terminal device is in the first application state based on the operating information by obtaining the operating information of the terminal device.
  • the running information of the terminal device at least includes: currently running application information.
  • the types of touch events may include: click (Down) events, slide (Move) events, and lift (Up) events. It can be understood that a user's touch operation on the display interface will generate an event sequence.
  • the event sequence refers to the moment when the touch object touches the display interface until the touch object leaves the display. The moment the interface ends, a series of events occur during this process. That is, an event sequence starts with a Down event, contains an indefinite number of Move events, and finally ends with an Up event.
  • the embodiment of the present disclosure determines the type of the touch event; and obtains the target trigger time corresponding to the type of the touch event that triggers the application drawing process; here, different types of touch events correspond to The target trigger time is different.
  • the Android platform usually after detecting a touch event, it is necessary to wait for the next first synchronization signal, and the first synchronization signal triggers multiple first-type images generated for the touch event. layer to perform application drawing processing; and after the application drawing processing is completed, it is necessary to wait for the next second synchronization signal, and the second synchronization signal triggers layer synthesis processing on multiple first-type layers after application drawing processing,
  • the image frame is obtained; finally, under the trigger of the third synchronization signal, the image currently displayed on the display interface is refreshed based on the image frame.
  • the first synchronization signal is a system vertical synchronization signal that triggers application drawing processing, that is, Vsync-app signal;
  • the second synchronization signal is a system vertical synchronization signal that triggers layer synthesis processing, that is, Vsync-sf signal;
  • the third synchronization signal is a system vertical synchronization signal that triggers hardware refresh processing, that is, the Vsync-hw signal.
  • the first synchronization signal and the second synchronization signal are generated based on the third synchronization signal, that is, the third synchronization signal may be the signal source of the first synchronization signal and the second synchronization signal. ; Or, the first synchronization signal, the second synchronization signal and the third synchronization signal are synchronized. Therefore, the signal periods of the first synchronization signal and the second synchronization signal are the same as the signal period of the third synchronization signal, and the phases are consistent. However, in actual application, due to various factors (for example, different processing performance of different components in the terminal equipment), there is a deviation between the first synchronization signal, the second synchronization signal and the third synchronization signal. If moved, they won't be perfectly aligned.
  • the application drawing process is directly performed on at least one first-type layer generated by the Down event without waiting for the triggering of the first synchronization signal; however, this method does not Processing the subsequently generated first synchronization signal will cause a frame of image drawn in advance to be the same as a frame of image drawn by processing the subsequently generated first synchronization signal, causing the display interface to freeze for one frame; and this This method also does not handle the Move event, and has limited effect on improving the touch delay of the display interface.
  • Embodiments of the present disclosure set different target triggering moments for triggering application drawing processing according to different types of touch events; when a touch event is detected, at least one first-type layer generated by the touch event is passed to the currently running A target application, which performs application drawing processing on at least one first type layer generated by the touch event based on the triggering of the target triggering moment, without waiting for the triggering of the first synchronization signal, thereby reducing Touch delay throughout the touch process.
  • step S102 after the application drawing process of the at least one first-type layer is completed, the application program passes the at least one first-type layer after the application drawing process to Surface Flinger, and triggers the Surface Flinger to apply At least one first-type layer after rendering processing is subjected to layer synthesis processing to obtain a target image frame.
  • the application after the application completes the application drawing process of the at least one first-type layer, it will pass the at least one first-type layer after the application drawing process to Surface Flinger, but so The Surface Flinger needs to wait for the next second synchronization signal, and when triggered by the second synchronization signal, perform layer synthesis processing on at least one first-type layer after applying the drawing process.
  • the embodiment of the present disclosure directly triggers the Surface Flinger to perform layer synthesis processing on at least one first-type layer after applying the drawing process after completing the application drawing process. , no need to wait for the second synchronization signal.
  • step S103 after obtaining the target image frame, the terminal device refreshes the display interface under the trigger of the next third synchronization signal to display the target image frame on the display interface.
  • the third synchronization signal is a hardware signal triggered by the display screen driver of the terminal device, and the signal period of the third synchronization signal is determined according to the screen refresh rate of the display screen of the terminal device. Specifically, the signal period of the third synchronization signal is the reciprocal of the screen refresh rate of the display screen of the terminal device.
  • the screen refresh rate of the display screen of the terminal device is any value such as 60Hz, 70Hz, 75Hz or 80Hz. Taking the screen refresh rate as 60Hz as an example, the signal period of the third synchronization signal is 16.667ms. It should be noted that the terminal device may support multiple different screen refresh rates, and the signal period of the third synchronization signal is determined by the screen refresh rate currently used by the terminal device.
  • the target triggering moment corresponding to the type of the touch event is determined according to the type of the touch event.
  • the target triggering moment triggers the application drawing processing of at least one first-type layer generated by the touch event; thereby performing application drawing in a timely manner based on different types of touch events generated during the touch process of the display interface. Processing, there is no need to wait for the trigger of the first synchronization signal, reducing the delay in the application drawing process;
  • the layer synthesis process of the at least one first type layer after the application drawing process is directly triggered to obtain the target image frame; there is no need to wait for the second time.
  • the synchronization signal reduces the delay in the layer synthesis process, thereby reducing the time it takes from detecting a touch event to displaying the image frame generated by the touch event on the display interface, significantly reducing the touch delay of the terminal device. , improve the user experience.
  • step S101 based on the type of the touch event and the target trigger time of the application drawing process corresponding to the type, at least one first type layer corresponding to the touch event is processed.
  • Apply drawing processing including:
  • the type of the touch event indicates that the touch event is a click event
  • an application drawing process is performed on at least one first type layer corresponding to the click event.
  • the target trigger time corresponding to the Down event is the detection time when the Down event is detected.
  • At least one first-type layer generated by the Down event is transferred to the currently running target application, and the target application is triggered.
  • the program performs application drawing processing on the at least one first type layer.
  • the terminal device when the terminal device detects the Down event, it will pass at least one first-type layer generated by the Down event to the target application, and the target application receives the at least one The first type layer needs to wait for the first synchronization signal, and when triggered by the first synchronization signal, apply drawing processing to at least one first type layer.
  • At least one first-type layer corresponding to the Down event is transferred to the target application, and based on the transfer operation, triggers the target application to process the at least one first-type layer.
  • step S101 based on the type of the touch event and the target trigger time of the application drawing process corresponding to the type, at least one first type layer corresponding to the touch event is processed.
  • Apply drawing processing including:
  • the type of the touch event indicates that the touch event is a sliding event
  • the first synchronization signal is a system vertical synchronization signal that triggers application drawing processing.
  • the target trigger time corresponding to the Move event is the preset before the next first synchronization signal is generated after the Move event is detected. time.
  • the preset time can be set according to actual needs.
  • the target triggering time of the Move event can be: 2 ms before the next first synchronization signal is generated.
  • a terminal device when a terminal device detects a Move event, it will not directly pass at least one first-type layer generated by the Move event to the target application. Instead, after detecting the Move event, it needs to wait for the next step.
  • a first synchronization signal triggered by the first synchronization signal, transmits at least one first-type layer generated by the Move event to the target application, so that the target application receives at least one layer generated by the Move event.
  • a first-type layer applying drawing processing to the at least one first-type layer.
  • the embodiment of the present disclosure can advance the processing timing of the application drawing processing of at least one first-type layer generated by the Move event, that is, the next first synchronization signal after the Move event is detected.
  • At a preset time before generation at least one first-type layer generated by the Move event is transferred to the target application, and the target application is triggered to perform application drawing processing on the at least one first-type layer generated by the Move event;
  • the Surface Flinger is directly triggered to perform layer synthesis processing on at least one first type layer after the application drawing process, so that the synthesis is completed within the signal period of a first synchronization signal.
  • the application drawing processing and layer composition processing of at least one first-type layer generated by the Move event reduces the touch delay of the terminal device.
  • the method further includes:
  • the preset time is determined based on the difference between the maximum duration and the signal period of the first synchronization signal.
  • the first duration required for application drawing processing on the first type of layer and the second duration required for layer synthesis processing on the first type of layer are respectively obtained, and The maximum duration is determined based on the first duration and the second duration.
  • the first time duration required for applying drawing processing to the first type of layer and the second time duration required for layer synthesis processing can be obtained respectively.
  • the robot hand can be used to touch the display interface
  • the Android system trace (System Trace, Systrace) tool can be used to capture the first timing information of the terminal device applying drawing processing to at least one layer, and to perform layer processing on at least one layer. Synthesize the second timing information of the processing; and determine the first duration required to apply drawing processing to the first type of layer based on the plurality of first timing information; determine the first duration required for the first type of layer based on the plurality of second timing information. The second amount of time required for layer compositing processing for a type of layer, thereby determining the maximum time.
  • Systrace is a tool for performance analysis of the Android operating system of the terminal device.
  • the functions of Systrace include tracking the input/output operations of the system, the kernel work queue, the central processor load, and the operating status of each subsystem of the Android operating system.
  • the processing time of applying drawing processing and layer synthesis processing can also be obtained by obtaining multiple historical image frames, and determining the processing time of the first type of image based on the processing time of the multiple historical image frames. The maximum amount of time it takes for a layer to undergo application drawing and layer compositing processing.
  • the application drawing process After determining the maximum duration required to apply the drawing process and the layer synthesis process, determine the difference between the maximum duration and the signal period of the first synchronization signal, and determine the preset based on the difference. time; thus at the preset time before the next first synchronization signal is generated after the Move event is detected, the application drawing process is performed on at least one first type layer generated by the Move event, and the application drawing process is completed Afterwards, directly trigger the layer composition processing of the at least one first type layer, so that the application drawing processing and layer composition processing of the at least one first type layer generated by the Move event can be executed in a first synchronization signal. Completed within the signal cycle, reducing the touch delay of the terminal device.
  • step S102 after the application drawing process of the at least one first-type layer is completed, the layer synthesis process of the at least one first-type layer is triggered to obtain the target image frame.
  • layer synthesis processing is performed on the at least one first type layer in the layer synthesis cache to obtain the target image frame.
  • the target application after the target application completes the application drawing process of at least one first type layer generated by the touch event, it will write the at least one first type layer after the application drawing process into the graph.
  • the layer composition cache After Surface Flinger detects the first write operation to the layer composition cache, based on the triggering of the first write operation, the Surface Flinger reads the first write operation from the layer composition cache. Enter the first type of layer written by the operation, perform layer synthesis processing on the first type of layer, and obtain the target image frame.
  • Surface Flinger usually reads the first type of layer from the layer composition cache and performs layer composition on the first type of layer when triggered by the second synchronization signal. deal with. If Surface Flinger detects the first write operation to the layer synthesis cache only after the last second synchronization signal is generated, at this time, Surface Flinger needs to wait for about one signal period of the second synchronization signal before it can perform all operations on it. The first type of layer written by the first writing operation is subjected to layer synthesis processing.
  • the embodiment of the present disclosure will use the writing time of the first write operation of the layer composition cache as the trigger time to trigger the layer composition process, so that the Surface Flinger detects After the first write operation to the layer composition cache, layer composition processing is directly performed on the first type of layer written by the first write operation without waiting for the next second synchronization signal.
  • the generation of the layer greatly reduces the processing delay in the layer composition process.
  • the method further includes:
  • the second synchronization signal is a system vertical synchronization signal that triggers layer synthesis processing
  • performing layer synthesis processing on the at least one first type layer in the layer synthesis cache based on the triggering of the first write operation of the first type layer to obtain the target image frame include:
  • the The at least one first-type layer and the at least one second-type layer in the layer composition cache are subjected to layer composition processing to obtain the target image frame.
  • the layers to be subjected to application drawing processing and layer synthesis processing include: first type layers and/or second type layers.
  • the second type of layer is triggered by an application event of the application currently running on the terminal device; for example, when the terminal device is in the first application state, the stylus establishes a connection with the terminal device. , a connection establishment prompt window will pop up on the display interface; the connection establishment prompt window image includes at least one second type layer triggered by a connection establishment event.
  • the second type of layer is triggered by application events, there is some delay in the application drawing processing and layer synthesis processing of the second type of layer, which affects the image display of the display interface. The effect will not be affected, so the application drawing processing of the second type of layer can be triggered based on the first synchronization signal; the image synthesis processing can be triggered based on the second synchronization signal. That is, the processing timing of the terminal device's application drawing processing and image synthesis processing for the first type of layer is different from the processing timing of the application drawing processing and image synthesis processing for the second type of layer.
  • the terminal device when the terminal device is in the first application state, that is, when the target application is running on the terminal device, there will be times when both the first type of layer and the second type of layer need to perform image synthesis processing. , for example, when using a stylus to draw on the display interface, prompt information from other applications pops up; at this time, the first type of layer generated by the stylus drawing and the second type of image generated by the prompt information All layers need to be layered.
  • At least one second type of layer after application drawing processing can be written into the layer composition cache. , determine whether there is layer synthesis processing for the first type of layer within the signal period of a second synchronization signal before the second writing operation;
  • Surface Flinger can delay the layer composition processing for the second type of layer, and after detecting the first write operation, based on the first write operation Enter the operation to trigger Surface Flinger to perform image synthesis processing on the first type of layer and the second type of layer in the layer synthesis cache to obtain the target image frame.
  • the method further includes:
  • layer synthesis processing is performed on at least one second type of layer in the layer synthesis cache to obtain The target image frame.
  • Surface Flinger detects the second write operation to the layer composition cache, it determines the signal period based on the signal period of a second synchronization signal before the second write operation. Whether there is layer synthesis processing for the first type of layer;
  • the layer synthesis cache can be based on the trigger of the next second synchronization signal after the second write operation. Perform layer synthesis processing on at least one second type layer to obtain a target image frame.
  • layer synthesis processing can be performed on at least one second type layer in the layer synthesis cache to obtain a target image frame; And under the trigger of the third synchronization signal, the target image frame is refreshed and displayed on the display interface.
  • the method before applying the drawing process to at least one first type layer corresponding to the touch event based on the type of the touch event and the target triggering moment of the application drawing process corresponding to the type, the method also includes:
  • the window identifier corresponding to the application program includes a preset identifier, it is determined that the terminal device is in the first application state, and at least one first type layer generated by the touch event is obtained.
  • the terminal device receives the user's selection operation for the application icon of any application program displayed on the display interface, starts the application program corresponding to the application icon; and responds to the startup of the application program Operation to obtain the window identifier corresponding to the application;
  • the window identification may include: the number, name, etc. of the application window. It can be understood that all open application windows on the display interface have corresponding window identifiers, and the window identifiers can indicate the applications currently running in the foreground of the terminal device.
  • the preset identification may be a preset window identification of a target application; here, the target application may include: a drawing application, a document application, etc.
  • the window identifier of the application program By comparing the window identifier of the application program with the preset identifier, it is determined whether the window identifier of the application program contains the preset identifier; if the window identifier of the application program contains the preset identifier, it means that the terminal device is in The application running in the foreground is the target application, that is, the terminal device is in the first application state.
  • the window identifier corresponding to the application program can be obtained, and based on the window identifier, it can be determined whether the application program currently running in the foreground of the terminal device is the target application program, and When the application program currently running in the foreground of the terminal device is the target application program, that is, when the terminal device is in the first application state, at least one first-type layer generated by the touch event is obtained, so as to facilitate processing based on the touch event.
  • the layer synthesis process of a type of layer is used to obtain the target image frame.
  • the embodiment of the present disclosure determines whether the terminal device is in the first application state with higher chirality requirements by obtaining the window identifier. If the terminal device is in the first application state, at least one first type image generated by the touch event is When performing application drawing processing and layer synthesis processing, there is no need to wait for the triggering of the first synchronization signal and the second synchronization signal, thereby effectively reducing the touch delay in the entire process and improving the user experience.
  • the method further includes:
  • the window identifier corresponding to the application program does not include the preset identifier, it is determined that the terminal device is in the second application state;
  • a layer synthesis process is performed on at least one first type layer after applying the drawing process.
  • the window identifier of the application program by comparing the window identifier of the application program with the preset identifier, it is determined whether the window identifier of the application program contains a preset identifier; if the window identifier corresponding to the application program does not Containing the preset identification indicates that the application program running in the foreground of the terminal device is not the target application program, that is, the terminal device is in the second application state.
  • the application drawing processing and layer synthesis processing of at least one first type layer corresponding to the touch event can be started respectively according to the triggering of the first synchronization signal and the second synchronization signal.
  • FIG. 2 is a flowchart 2 of a method for updating a display image according to an exemplary embodiment. The method includes:
  • Step S201 In response to the startup operation of any application program on the display interface, obtain the window identifier corresponding to the application program; determine whether the window identifier corresponding to the application program includes a preset identifier; if the application program The corresponding window identifier includes a preset identifier, confirming that the terminal device is in the first application state;
  • the terminal device being in the first application state may be: the terminal device is in a stylus application scenario.
  • the window identification of the application program By obtaining the window identification of the application program, it can be determined whether the window identification of the application program includes the window identification corresponding to the stylus application. If the window identification of the application program includes the window identification corresponding to the stylus application, it is determined that the terminal device is in the first Application status.
  • Step S202 A touch event for the display interface is detected. If the type of the touch event indicates that the touch event is a Down event, based on the detection time when the Down event is detected, the corresponding value of the Down event is At least one first-type layer performs application drawing processing;
  • the type of the touch event can be determined first. If the type of the touch event indicates that the touch event is a Down event, the touch event can be At the detection moment when the Down event is detected, application drawing processing is performed on at least one first type layer generated by the Down event.
  • a touch event sequence refers to a series of events generated in the process starting from the moment the touch object touches the screen and ending at the moment the touch object leaves the screen; a touch event sequence is It starts with the Down event, contains at least one Move event in the middle, and finally ends with the Up event.
  • FIG. 3 is a schematic diagram of processing of image frames corresponding to the Down event shown in the related art.
  • the terminal device after detecting the Down event, the terminal device will transfer at least one first-type layer generated by the Down event to the application for application drawing processing when triggered by the next first synchronization signal. That is, the application drawing processing of the Down event needs to wait for the first synchronization signal to be triggered.
  • the first synchronization signal is a Vsync-app signal.
  • FIG. 4 is a schematic diagram of processing an image frame corresponding to a Down event according to an exemplary embodiment.
  • the application drawing processing of at least one first-type layer corresponding to the Down event is immediately started without waiting for the first synchronization signal to be triggered, thereby reducing the delay in the application drawing processing stage.
  • Step S203 If the type of the touch event indicates that the touch event is a Move event, at a preset time before generating the next first synchronization signal, perform a step on at least one first type layer corresponding to the Move event.
  • Application rendering processing wherein the first synchronization signal is a system vertical synchronization signal that triggers application rendering processing;
  • the preset time before generating the next first synchronization signal can be Assume that at a time, apply drawing processing is performed on at least one first-type layer generated by the Move event.
  • FIG. 5 is a schematic diagram of processing of image frames corresponding to the Move event shown in the related art.
  • the terminal device will, under the trigger of the next first synchronization signal, pass at least one first-type layer generated by the Move event to the application for application drawing processing; thus causing the Move event to generate
  • the application drawing process and layer composition process of at least one first-type layer cannot be completed within a signal period of the first synchronization signal.
  • FIG. 6 is a schematic diagram of processing an image frame corresponding to a Down event according to an exemplary embodiment.
  • this example will apply drawing processing to at least one first-type layer generated by the Move event at the preset time before the next first synchronization signal is generated, that is, start at least one layer generated by the Move event in advance.
  • the first type of layer applies drawing processing.
  • the preset time may be 2ms.
  • the maximum duration required to perform application drawing processing and layer synthesis processing on the first type of layer can be obtained; based on the difference between the maximum duration and the signal period of the first synchronization signal value to determine the preset time.
  • the processing time for applying drawing processing to at least one first type layer generated by the Move event is determined in advance, so that The application drawing processing and layer synthesis processing of at least one first-type layer generated by the Move event can be completed within a signal period of the first synchronization signal.
  • Step S204 After the application drawing process of the at least one first type layer is completed, the at least one first type layer after the application drawing process is written into the layer composition cache; based on the first type layer When the first write operation is triggered, perform layer synthesis processing on the at least one first type layer in the layer synthesis cache to obtain the target image frame;
  • At least one first type layer after applying the drawing process is passed to Surface Flinger, so that Surface Flinger receives
  • layer synthesis processing is performed on the first type of layer to obtain the target image frame.
  • the processing of the image frame corresponding to the Down event requires approximately 3-4 signal periods of the vertical synchronization signal, while in this example, the processing of the image frame corresponding to the Down event requires approximately 2- 3 signal periods of the vertical synchronization signal, reducing the delay by approximately one signal period of the vertical synchronization signal.
  • the processing of the image frame corresponding to the Move event requires approximately two signal periods of the vertical synchronization signal, while in this example, the processing of the image frame corresponding to the Down event can be processed in one vertical synchronization signal. It is completed within the signal period, and also reduces the delay of about one signal period of the vertical synchronization signal.
  • based on the triggering of the first synchronization signal apply drawing processing to the acquired at least one second type layer, and write the at least one second type layer after applying the drawing process into the layer composition.
  • Caching wherein the second type of layer is generated by an application event trigger of an application currently running on the terminal device;
  • the second synchronization signal is a system vertical synchronization signal that triggers layer synthesis processing
  • the The at least one first-type layer and the at least one second-type layer in the layer composition cache are subjected to layer composition processing to obtain the target image frame.
  • the terminal device contains two different vertical synchronization signal triggering mechanisms; one is for the first type of layer generated by the terminal device in the first application state; the other is for the first type of layer generated by the terminal device.
  • the second type of layer is for the first type of layer generated by the terminal device.
  • the system vertical synchronization signal triggering mechanism corresponding to the first-type layer is the main one, and the first-type layer is processed first.
  • Layer composition processing of class layers
  • the second type of layer is written into the layer synthesis cache, and it is determined whether there is a request for the first type of layer in the last signal period of the second synchronization signal.
  • Layer synthesis processing if there is layer synthesis processing for the first type of layer in the last signal period of the second synchronization signal, it means that within a second synchronization signal period of layer synthesis processing for the second type of layer , a new first-type layer will be written into the layer composition cache.
  • the layer synthesis process of the second type of layer will not be performed first. Instead, it waits until the first writing operation is detected, and then performs layer synthesis processing on the first type of layer and the second type of layer together under the trigger of the first writing operation.
  • At least one second type of layer in the layer buffer is synthesized. Perform layer synthesis processing to obtain the target image frame.
  • the triggering mechanism of the system vertical synchronization signal corresponding to the second-type layer can be directly used, that is, under the trigger of the second synchronization signal, the third-type layer is The second type of layer is used for layer synthesis processing.
  • Step S205 If the window identifier corresponding to the application program does not include the preset identifier, it is determined that the terminal device is in the second application state; a touch event for the display interface is detected, and the terminal device is in In the second application state, based on the triggering of the first synchronization signal, application drawing processing is performed on at least one first type layer corresponding to the touch event; based on the triggering of the second synchronization signal, application drawing processing is performed on the At least one first-type layer performs layer synthesis processing to obtain the target image frame;
  • the terminal device being in the second application state may be: the terminal device is not in a stylus application scenario.
  • the Android operating system although it takes about 3 signal cycles of the vertical synchronization signal to display a frame of image from stylus drawing to screen display on the display interface, the application scenario of the terminal device is different from that of the handheld device. The performance requirements are not high, and even if there is a delay, it will not affect the display effect of the terminal device; therefore, when the terminal device is in the second application state, the application drawing processing can be executed respectively based on the triggering of the first synchronization signal and the second synchronization signal. and layer compositing.
  • Step S206 Update the display image of the display interface based on the target image frame.
  • the target image frame is refreshed and displayed on the display interface of the terminal device under the trigger of the third synchronization signal.
  • FIG. 7 is a schematic structural diagram of a device for updating a display image according to an exemplary embodiment. As shown in Figure 7, the device is applied to a terminal device.
  • the device 100 includes:
  • the first processing module 101 is configured to detect a touch event for the display interface, and when the terminal device is in the first application state, draw the processing based on the type of the touch event and the application corresponding to the type. At the target trigger moment, apply drawing processing to at least one first-type layer corresponding to the touch event;
  • the second processing module 102 is configured to trigger layer synthesis processing on the at least one first-type layer after the application drawing process of the at least one first-type layer is completed to obtain a target image frame;
  • the update module 103 is configured to update the display image of the display interface based on the target image frame.
  • the first processing module 101 is configured as:
  • the type of the touch event indicates that the touch event is a click event
  • an application drawing process is performed on at least one first type layer corresponding to the click event.
  • the first processing module 101 is configured as:
  • the type of the touch event indicates that the touch event is a sliding event
  • the first synchronization signal is a system vertical synchronization signal that triggers application drawing processing.
  • the first processing module 101 is configured as:
  • the preset time is determined based on the difference between the maximum duration and the signal period of the first synchronization signal.
  • the second processing module 102 is configured to:
  • layer synthesis processing is performed on the at least one first type layer in the layer synthesis cache to obtain the target image frame.
  • the first processing module 101 is configured as:
  • the second synchronization signal is a system vertical synchronization signal that triggers layer synthesis processing
  • the second processing module 102 is configured as:
  • the The at least one first-type layer and the at least one second-type layer in the layer composition cache are subjected to layer composition processing to obtain the target image frame.
  • the second processing module 102 is configured to:
  • layer synthesis processing is performed on at least one second type of layer in the layer synthesis cache to obtain The target image frame.
  • the first processing module 101 is configured as:
  • the window identifier corresponding to the application program includes a preset identifier, it is determined that the terminal device is in the first application state, and at least one first type layer generated by the touch event is obtained.
  • the first processing module 101 is configured as:
  • the window identifier corresponding to the application program does not include the preset identifier, it is determined that the terminal device is in the second application state;
  • the second processing module 102 is configured as:
  • a layer synthesis process is performed on at least one first type layer after applying the drawing process.
  • Figure 8 is a block diagram of a terminal device according to an exemplary embodiment.
  • the terminal device 800 may be a mobile phone, a mobile computer, etc.
  • the terminal device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power supply component 806 , a multimedia component 808 , an audio component 810 , an input/output (I/O) interface 812 , and a sensor component 814 , and communication component 816.
  • the processing component 802 generally controls the overall operations of the terminal device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations.
  • the processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above method. Additionally, processing component 802 may include one or more modules that facilitate interaction between processing component 802 and other components. For example, processing component 802 may include a multimedia module to facilitate interaction between multimedia component 808 and processing component 802.
  • Memory 804 is configured to store various types of data to support operations at device 800 . Examples of such data include instructions for any application or method operating on the terminal device 800, contact data, phonebook data, messages, pictures, videos, etc.
  • Memory 804 may be implemented by any type of volatile or non-volatile storage device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EEPROM), Programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk.
  • SRAM static random access memory
  • EEPROM electrically erasable programmable read-only memory
  • EEPROM erasable programmable read-only memory
  • EPROM Programmable read-only memory
  • PROM programmable read-only memory
  • ROM read-only memory
  • magnetic memory flash memory, magnetic or optical disk.
  • Power supply component 806 provides power to various components of terminal device 800 .
  • Power supply components 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to end device 800 .
  • Multimedia component 808 includes a screen providing an output interface between the terminal device 800 and the user.
  • the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user.
  • the touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide action.
  • multimedia component 808 includes a front-facing camera and/or a rear-facing camera.
  • the front camera and/or the rear camera can receive external multimedia data.
  • Each front-facing camera and rear-facing camera can be a fixed optical lens system or have a focal length and optical zoom capabilities.
  • Audio component 810 is configured to output and/or input audio signals.
  • the audio component 810 includes a microphone (MIC) configured to receive external audio signals when the terminal device 800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode.
  • the received audio signal may be further stored in memory 804 or sent via communication component 816 .
  • audio component 810 also includes a speaker for outputting audio signals.
  • the I/O interface 812 provides an interface between the processing component 802 and a peripheral interface module, which may be a keyboard, a click wheel, a button, etc. These buttons may include, but are not limited to: Home button, Volume buttons, Start button, and Lock button.
  • Sensor component 814 includes one or more sensors for providing various aspects of status assessment for terminal device 800 .
  • the sensor component 814 can detect the open/closed state of the device 800 and the relative positioning of components, such as the display and keypad of the terminal device 800.
  • the sensor component 814 can also detect the terminal device 800 or a component of the terminal device 800. position changes, presence or absence of user contact with the terminal device 800 , orientation or acceleration/deceleration of the terminal device 800 and temperature changes of the terminal device 800 .
  • Sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact.
  • Sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications.
  • the sensor component 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
  • the communication component 816 is configured to facilitate wired or wireless communication between the terminal device 800 and other devices.
  • the terminal device 800 can access a wireless network based on a communication standard, such as Wi-Fi, 4G or 5G, or a combination thereof.
  • the communication component 816 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel.
  • the communications component 816 also includes a near field communications (NFC) module to facilitate short-range communications.
  • NFC near field communications
  • the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
  • RFID radio frequency identification
  • IrDA infrared data association
  • UWB ultra-wideband
  • Bluetooth Bluetooth
  • the terminal device 800 may be configured by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable A programmable gate array (FPGA), controller, microcontroller, microprocessor or other electronic component implementation is used to perform the above method.
  • ASICs application specific integrated circuits
  • DSPs digital signal processors
  • DSPDs digital signal processing devices
  • PLDs programmable logic devices
  • FPGA field programmable A programmable gate array
  • controller microcontroller, microprocessor or other electronic component implementation is used to perform the above method.
  • a non-transitory computer-readable storage medium including instructions such as a memory 804 including instructions, which can be executed by the processor 820 of the terminal device 800 to complete the above method is also provided.
  • the non-transitory computer-readable storage medium may be ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.

Abstract

Embodiments of the present disclosure relate to a display image updating method and apparatus and a storage medium. The method is applied to a terminal device, and the method comprises: when a touch event for a display interface is detected and the terminal device is in a first application state, performing, on the basis of the type of the touch event and a target triggering moment of application drawing processing corresponding to the type, the application drawing processing on at least one first type of layer corresponding to the touch event; after the application drawing processing for the at least one first type of layer is completed, triggering layer synthesis processing for the at least one first type of layer to obtain a target image frame; and updating a display image on the display interface on the basis of the target image frame.

Description

显示图像的更新方法、装置及存储介质Display image update method, device and storage medium 技术领域Technical field
本公开涉及图像处理技术领域但不限于无线通信技术领域,尤其涉及一种显示图像的更新方法、装置及存储介质。The present disclosure relates to the field of image processing technology but is not limited to the field of wireless communication technology, and in particular, to an update method, device and storage medium for displaying images.
背景技术Background technique
随着终端设备技术的快速发展,越来越多的终端设备配置有触控显示屏,具有显示系统;待显示数据在显示系统内的处理过程主要包括:应用绘制处理、图层合成处理和硬件刷新显示处理;为了避免显示卡顿,提升显示效果,显示系统通过系统垂直同步信号进行各个处理之间的同步。With the rapid development of terminal equipment technology, more and more terminal equipment are equipped with touch screens and display systems; the processing of data to be displayed in the display system mainly includes: application drawing processing, layer synthesis processing and hardware Refresh display processing; in order to avoid display freezes and improve display effects, the display system synchronizes various processes through the system vertical synchronization signal.
对于一帧图像而言,从应用绘制处理开始,至最后屏幕显示的过程大约需要3个系统垂直同步信号的信号周期,即使在高刷新率(如120Hz)的终端设备内,一帧图像的延迟也约有24ms。对于一些流畅性、跟手性要求较高的应用场景(例如手写笔应用场景),会出现卡顿明显的情况,用户体验较差。For one frame of image, the process from the beginning of application drawing processing to the final screen display requires about 3 signal cycles of the system vertical synchronization signal. Even in terminal devices with high refresh rates (such as 120Hz), the delay of one frame of image Also about 24ms. For some application scenarios with high requirements on fluency and chirality (such as stylus application scenarios), obvious lags will occur and the user experience will be poor.
发明内容Contents of the invention
本公开实施例提供一种显示图像的更新方法、装置及存储介质。Embodiments of the present disclosure provide a display image updating method, device, and storage medium.
本公开实施例第一方面提供一种显示图像的更新方法,应用于终端设备,其中,所述方法包括:A first aspect of an embodiment of the present disclosure provides a method for updating a display image, which is applied to a terminal device, wherein the method includes:
检测到针对于显示界面的触控事件,且所述终端设备处于第一应用状态时,基于所述触控事件的类型和所述类型对应的应用绘制处理的目标触发时刻,对所述触控事件对应的至少一个第一类图层进行应用绘制处理;When a touch event for the display interface is detected and the terminal device is in the first application state, based on the type of the touch event and the target trigger time of the application drawing process corresponding to the type, the touch event is At least one first-type layer corresponding to the event is applied for drawing processing;
在所述至少一个第一类图层的应用绘制处理完成后,触发对所述至少一个第一类图层的图层合成处理,得到目标图像帧;After the application drawing process of the at least one first type layer is completed, trigger the layer synthesis process of the at least one first type layer to obtain the target image frame;
基于所述目标图像帧,对所述显示界面的显示图像进行更新。Based on the target image frame, the display image of the display interface is updated.
在上述方案中,所述基于所述触控事件的类型和所述类型对应的应用绘制处理的目标触发时刻,对所述触控事件对应的至少一个第一类图层进行应用绘制处理,包括:In the above solution, based on the type of the touch event and the target triggering moment of the application drawing process corresponding to the type, application drawing processing is performed on at least one first type layer corresponding to the touch event, including :
若所述触控事件的类型指示所述触控事件为点击事件,基于检测到所述点击事件的检测时刻,对所述点击事件对应的至少一个第一类图层进行应用绘制处理。If the type of the touch event indicates that the touch event is a click event, based on the detection time when the click event is detected, an application drawing process is performed on at least one first type layer corresponding to the click event.
在上述方案中,所述基于所述触控事件的类型和所述触控事件的类型对应的应用绘制处理的目标触发时刻,对所述触控事件对应的至少一个第一类图层进行应用绘制处理,包括:In the above solution, the at least one first type layer corresponding to the touch event is applied based on the type of the touch event and the target trigger time of the application drawing process corresponding to the type of the touch event. Drawing processing, including:
若所述触控事件的类型指示所述触控事件为滑动事件,在产生下一个第一同步信号前的预设时 刻,对所述滑动事件对应的至少一个第一类图层进行应用绘制处理;其中,所述第一同步信号为触发应用绘制处理的系统垂直同步信号。If the type of the touch event indicates that the touch event is a sliding event, at a preset time before generating the next first synchronization signal, apply drawing processing to at least one first type layer corresponding to the sliding event. ; Wherein, the first synchronization signal is a system vertical synchronization signal that triggers application drawing processing.
在上述方案中,所述方法还包括:In the above solution, the method further includes:
获取对所述第一类图层进行应用绘制处理和图层合成处理所需的最大时长;Obtain the maximum time required to apply drawing processing and layer composition processing to the first type of layer;
基于所述最大时长和所述第一同步信号的信号周期之间的差值,确定所述预设时刻。The preset time is determined based on the difference between the maximum duration and the signal period of the first synchronization signal.
在上述方案中,所述在所述至少一个第一类图层的应用绘制处理完成后,触发对所述至少一个第一类图层的图层合成处理,得到目标图像帧,包括:In the above solution, after the application drawing process of the at least one first type layer is completed, the layer synthesis process of the at least one first type layer is triggered to obtain the target image frame, including:
在所述至少一个第一类图层的应用绘制处理完成后,将应用绘制处理后的至少一个第一类图层写入图层合成缓存中;After the application drawing process of the at least one first type layer is completed, writing the at least one first type layer after the application drawing process into the layer composition cache;
基于所述第一类图层的第一写入操作的触发,对所述图层合成缓存中的所述至少一个第一类图层进行图层合成处理,得到所述目标图像帧。Based on the triggering of the first write operation of the first type layer, layer synthesis processing is performed on the at least one first type layer in the layer synthesis cache to obtain the target image frame.
在上述方案中,所述方法还包括:In the above solution, the method further includes:
基于第一同步信号的触发,对获取的至少一个第二类图层进行应用绘制处理,并将应用绘制处理后的至少一个第二类图层写入所述图层合成缓存;其中,所述第二类图层是由所述终端设备当前运行的应用程序的应用程序事件触发产生的;Based on the triggering of the first synchronization signal, apply drawing processing to the acquired at least one second type layer, and write the at least one second type layer after applying the drawing process into the layer synthesis cache; wherein, the The second type of layer is generated by application event triggering of the application currently running on the terminal device;
基于所述第二类图像的第二写入操作前的一个第二同步信号的信号周期,确定所述一个第二同步信号的信号周期内是否存在对所述第一类图层的图层合成处理;所述第二同步信号为触发图层合成处理的系统垂直同步信号;Based on the signal period of a second synchronization signal before the second writing operation of the second type image, determine whether there is layer synthesis for the first type of layer within the signal period of the second synchronization signal. Processing; the second synchronization signal is a system vertical synchronization signal that triggers layer synthesis processing;
所述基于所述第一类图层的第一写入操作的触发,对所述图层合成缓存中的所述至少一个第一类图层进行图层合成处理,得到所述目标图像帧,包括:performing layer synthesis processing on the at least one first type layer in the layer synthesis cache based on the triggering of the first write operation of the first type layer to obtain the target image frame, include:
若存在对所述第一类图层的图层合成处理,在所述第二写入操作后的一个第二同步信号的信号周期内,基于所述第一写入操作的触发,对所述图层合成缓存中的所述至少一个第一类图层和所述至少一个第二类图层进行图层合成处理,得到所述目标图像帧。If there is layer synthesis processing for the first type of layer, within a signal period of the second synchronization signal after the second writing operation, based on the triggering of the first writing operation, the The at least one first-type layer and the at least one second-type layer in the layer composition cache are subjected to layer composition processing to obtain the target image frame.
在上述方案中,所述方法还包括:In the above solution, the method further includes:
若不存在对所述第一类图层的图层合成处理,基于下一个第二同步信号的触发,对所述图层合成缓存中的至少一个第二类图层进行图层合成处理,得到所述目标图像帧。If there is no layer synthesis processing for the first type of layer, based on the trigger of the next second synchronization signal, layer synthesis processing is performed on at least one second type of layer in the layer synthesis cache to obtain The target image frame.
在上述方案中,在基于所述触控事件的类型和所述类型对应的应用绘制处理的目标触发时刻,对所述触控事件对应的至少一个第一类图层进行应用绘制处理之前,所述方法还包括:In the above solution, before applying the drawing process to at least one first type layer corresponding to the touch event based on the type of the touch event and the target triggering moment of the application drawing process corresponding to the type, the The above methods also include:
响应于针对所述显示界面上的任一应用程序的启动操作,获取所述应用程序对应的窗口标识;In response to a startup operation for any application program on the display interface, obtain the window identifier corresponding to the application program;
确定所述应用程序对应的窗口标识是否包括预设标识;Determine whether the window identifier corresponding to the application program includes a preset identifier;
若所述应用程序对应的窗口标识包括预设标识,确定所述终端设备处于第一应用状态,并获取由所述触控事件产生的至少一个第一类图层。If the window identifier corresponding to the application program includes a preset identifier, it is determined that the terminal device is in the first application state, and at least one first type layer generated by the touch event is obtained.
在上述方案中,所述方法还包括:In the above solution, the method further includes:
若所述应用程序对应的窗口标识不包括所述预设标识,确定所述终端设备处于第二应用状态;If the window identifier corresponding to the application program does not include the preset identifier, it is determined that the terminal device is in the second application state;
检测到针对于所述显示界面的触控事件,且所述终端设备处于所述第二应用状态时,基于第一同步信号的触发,对所述触控事件对应的至少一个第一类图层进行应用绘制处理;When a touch event for the display interface is detected and the terminal device is in the second application state, based on the triggering of the first synchronization signal, at least one first type layer corresponding to the touch event is Perform application drawing processing;
基于第二同步信号的触发,对应用绘制处理后的至少一个第一类图层进行图层合成处理。Based on the triggering of the second synchronization signal, a layer synthesis process is performed on at least one first type layer after applying the drawing process.
本公开实施例第二方面提供一种显示图像的更新装置,应用于终端设备,其中,所述装置包括:A second aspect of the embodiment of the present disclosure provides a device for updating a display image, which is applied to a terminal device, wherein the device includes:
第一处理模块,被配置为检测到针对于显示界面的触控事件,且所述终端设备处于第一应用状态时,基于所述触控事件的类型和所述类型对应的应用绘制处理的目标触发时刻,对所述触控事件对应的至少一个第一类图层进行应用绘制处理;A first processing module configured to detect a touch event for the display interface, and when the terminal device is in the first application state, draw a processing target based on the type of the touch event and the application corresponding to the type. At the triggering moment, apply drawing processing to at least one first-type layer corresponding to the touch event;
第二处理模块,被配置为在所述至少一个第一类图层的应用绘制处理完成后,触发对所述至少一个第一类图层的图层合成处理,得到目标图像帧;The second processing module is configured to trigger layer synthesis processing on the at least one first-type layer after the application drawing process of the at least one first-type layer is completed to obtain a target image frame;
更新模块,被配置为基于所述目标图像帧,对所述显示界面的显示图像进行更新。An update module configured to update the display image of the display interface based on the target image frame.
在上述方案中,所述第一处理模块,被配置为:In the above solution, the first processing module is configured as:
若所述触控事件的类型指示所述触控事件为点击事件,基于检测到所述点击事件的检测时刻,对所述点击事件对应的至少一个第一类图层进行应用绘制处理。If the type of the touch event indicates that the touch event is a click event, based on the detection time when the click event is detected, an application drawing process is performed on at least one first type layer corresponding to the click event.
在上述方案中,所述第一处理模块,被配置为:In the above solution, the first processing module is configured as:
若所述触控事件的类型指示所述触控事件为滑动事件,在产生下一个第一同步信号前的预设时刻,对所述滑动事件对应的至少一个第一类图层进行应用绘制处理;其中,所述第一同步信号为触发应用绘制处理的系统垂直同步信号。If the type of the touch event indicates that the touch event is a sliding event, at a preset time before generating the next first synchronization signal, apply drawing processing to at least one first type layer corresponding to the sliding event. ; Wherein, the first synchronization signal is a system vertical synchronization signal that triggers application drawing processing.
在上述方案中,所述第一处理模块,被配置为:In the above solution, the first processing module is configured as:
获取对所述第一类图层进行应用绘制处理和图层合成处理所需的最大时长;Obtain the maximum time required to apply drawing processing and layer composition processing to the first type of layer;
基于所述最大时长和所述第一同步信号的信号周期之间的差值,确定所述预设时刻。The preset time is determined based on the difference between the maximum duration and the signal period of the first synchronization signal.
在上述方案中,所述第二处理模块,被配置为:In the above solution, the second processing module is configured as:
在所述至少一个第一类图层的应用绘制处理完成后,将应用绘制处理后的至少一个第一类图层写入图层合成缓存中;After the application drawing process of the at least one first type layer is completed, writing the at least one first type layer after the application drawing process into the layer composition cache;
基于所述第一类图层的第一写入操作的触发,对所述图层合成缓存中的所述至少一个第一类图层进行图层合成处理,得到所述目标图像帧。Based on the triggering of the first write operation of the first type layer, layer synthesis processing is performed on the at least one first type layer in the layer synthesis cache to obtain the target image frame.
在上述方案中,所述第一处理模块,被配置为:In the above solution, the first processing module is configured as:
基于第一同步信号的触发,对获取的至少一个第二类图层进行应用绘制处理,并将应用绘制处理后的至少一个第二类图层写入所述图层合成缓存;其中,所述第二类图层是由所述终端设备当前运行的应用程序的应用程序事件触发产生的;Based on the triggering of the first synchronization signal, apply drawing processing to the acquired at least one second type layer, and write the at least one second type layer after applying the drawing process into the layer synthesis cache; wherein, the The second type of layer is generated by application event triggering of the application currently running on the terminal device;
基于所述第二类图像的第二写入操作前的一个第二同步信号的信号周期,确定所述一个第二同步信号的信号周期内是否存在对所述第一类图层的图层合成处理;所述第二同步信号为触发图层合成处理的系统垂直同步信号;Based on the signal period of a second synchronization signal before the second writing operation of the second type image, determine whether there is layer synthesis for the first type of layer within the signal period of the second synchronization signal. Processing; the second synchronization signal is a system vertical synchronization signal that triggers layer synthesis processing;
所述第二处理模块,被配置为:The second processing module is configured as:
若存在对所述第一类图层的图层合成处理,在所述第二写入操作后的一个第二同步信号的信号 周期内,基于所述第一写入操作的触发,对所述图层合成缓存中的所述至少一个第一类图层和所述至少一个第二类图层进行图层合成处理,得到所述目标图像帧。If there is layer synthesis processing for the first type of layer, within a signal period of the second synchronization signal after the second writing operation, based on the triggering of the first writing operation, the The at least one first-type layer and the at least one second-type layer in the layer composition cache are subjected to layer composition processing to obtain the target image frame.
在上述方案中,所述第二处理模块,被配置为:In the above solution, the second processing module is configured as:
若不存在对所述第一类图层的图层合成处理,基于下一个第二同步信号的触发,对所述图层合成缓存中的至少一个第二类图层进行图层合成处理,得到所述目标图像帧。If there is no layer synthesis processing for the first type of layer, based on the trigger of the next second synchronization signal, layer synthesis processing is performed on at least one second type of layer in the layer synthesis cache to obtain The target image frame.
在上述方案中,所述第一处理模块,被配置为:In the above solution, the first processing module is configured as:
响应于针对所述显示界面上的任一应用程序的启动操作,获取所述应用程序对应的窗口标识;In response to a startup operation for any application program on the display interface, obtain the window identifier corresponding to the application program;
确定所述应用程序对应的窗口标识是否包括预设标识;Determine whether the window identifier corresponding to the application program includes a preset identifier;
若所述应用程序对应的窗口标识包括预设标识,确定所述终端设备处于第一应用状态,并获取由所述触控事件产生的至少一个第一类图层。If the window identifier corresponding to the application program includes a preset identifier, it is determined that the terminal device is in the first application state, and at least one first type layer generated by the touch event is obtained.
在上述方案中,所述第一处理模块,被配置为:In the above solution, the first processing module is configured as:
若所述应用程序对应的窗口标识不包括所述预设标识,确定所述终端设备处于第二应用状态;If the window identifier corresponding to the application program does not include the preset identifier, it is determined that the terminal device is in the second application state;
检测到针对于所述显示界面的触控事件,且所述终端设备处于所述第二应用状态时,基于第一同步信号的触发,对所述触控事件对应的至少一个第一类图层进行应用绘制处理;When a touch event for the display interface is detected and the terminal device is in the second application state, based on the triggering of the first synchronization signal, at least one first type layer corresponding to the touch event is Perform application drawing processing;
所述第二处理模块,被配置为:The second processing module is configured as:
基于第二同步信号的触发,对应用绘制处理后的至少一个第一类图层进行图层合成处理。Based on the triggering of the second synchronization signal, a layer synthesis process is performed on at least one first type layer after applying the drawing process.
本公开实施例第三方面提供一种显示图像的更新装置,包括:A third aspect of the embodiment of the present disclosure provides an updating device for displaying images, including:
处理器;processor;
配置为存储可执行指令的存储器;memory configured to store executable instructions;
其中,所述处理器运行所述可执行指令时执行如前述第一方面提供显示图像的更新方法。Wherein, when the processor runs the executable instructions, the processor performs the method for updating the display image provided in the first aspect.
本公开实施例第四方面提供一种非临时性计算机可读存储介质,当所述存储介质中的指令由显示图像的更新装置的处理器执行时,使得所述显示图像的更新装置能够执行前述第一方面提供显示图像的更新方法。A fourth aspect of an embodiment of the present disclosure provides a non-transitory computer-readable storage medium, which when the instructions in the storage medium are executed by a processor of an updating device for displaying an image, enables the updating device for displaying an image to execute the foregoing. The first aspect provides an update method for displaying images.
本公开实施例在检测到显示界面的触控事件,且所述终端设备处于第一应用状态时,根据触控事件的类型,确定与所述触控事件的类型对应的目标触发时刻,在所述目标触发时刻,触发对所述触控事件产生的至少一个第一类图层的应用绘制处理;从而针对性地基于显示界面的触摸过程中产生的不同类型的触控事件,及时进行应用绘制处理,不需要等待第一同步信号的触发,减少应用绘制处理过程中的延迟;In the embodiment of the present disclosure, when a touch event on the display interface is detected and the terminal device is in the first application state, the target triggering moment corresponding to the type of the touch event is determined according to the type of the touch event. The target triggering moment triggers the application drawing processing of at least one first-type layer generated by the touch event; thereby performing application drawing in a timely manner based on different types of touch events generated during the touch process of the display interface. Processing, there is no need to wait for the trigger of the first synchronization signal, reducing the delay in the application drawing process;
并且,在所述至少一个第一类图层的应用绘制处理完成后,直接触发对应用绘制处理后的至少一个第一类图层进行图层合成处理,得到目标图像帧;不需要等待第二同步信号,减少图层合成处理过程中的延迟,从而减少从检测到触控事件,到显示界面显示由所述触控事件产生的图像帧过程所花费的时间,大幅降低终端设备的触控延迟,提升用户的使用体验。Moreover, after the application drawing process of the at least one first type layer is completed, the layer synthesis process of the at least one first type layer after the application drawing process is directly triggered to obtain the target image frame; there is no need to wait for the second time. The synchronization signal reduces the delay in the layer synthesis process, thereby reducing the time it takes from detecting a touch event to displaying the image frame generated by the touch event on the display interface, significantly reducing the touch delay of the terminal device. , improve the user experience.
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本公开实施例。It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and do not limit the embodiments of the present disclosure.
附图说明Description of the drawings
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本发明实施例,并与说明书一起用于解释本发明实施例的原理。The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description serve to explain the principles of the embodiments of the invention.
图1是根据一示例性实施例示出的一种显示图像的更新方法的流程示意图一;Figure 1 is a schematic flowchart 1 of a method for updating a display image according to an exemplary embodiment;
图2是根据一示例性实施例示出的一种显示图像的更新方法的流程示意图二;Figure 2 is a schematic flowchart 2 of a method for updating a display image according to an exemplary embodiment;
图3是相关技术示出的Down事件对应的图像帧的处理示意图;Figure 3 is a schematic diagram of the processing of image frames corresponding to the Down event shown in the related art;
图4是根据一示例性实施例示出的一种Down事件对应的图像帧的处理示意图;Figure 4 is a schematic diagram of processing an image frame corresponding to a Down event according to an exemplary embodiment;
图5是相关技术示出的Move事件对应的图像帧的处理示意图;Figure 5 is a schematic diagram of the processing of image frames corresponding to the Move event shown in the related art;
图6是根据一示例性实施例示出的一种Down事件对应的图像帧的处理示意图;Figure 6 is a schematic diagram of processing an image frame corresponding to a Down event according to an exemplary embodiment;
图7是根据一示例性实施例示出的一种显示图像的更新装置的结构示意图;Figure 7 is a schematic structural diagram of an updating device for displaying images according to an exemplary embodiment;
图8是根据一示例性实施例示出的一种终端设备的框图。Figure 8 is a block diagram of a terminal device according to an exemplary embodiment.
具体实施方式Detailed ways
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本发明实施例相一致的所有实施方式。相反,它们仅是本发明实施例的一些方面相一致的装置和方法的例子。Exemplary embodiments will be described in detail herein, examples of which are illustrated in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings refer to the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with embodiments of the invention. Rather, they are merely examples of apparatus and methods consistent with some aspects of embodiments of the invention.
在本公开实施例使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本公开实施例。在本公开所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。还应当理解,本文中使用的术语“和/或”是指并包含一个或多个相关联的列出项目的任何或所有可能组合。The terminology used in the embodiments of the present disclosure is for the purpose of describing specific embodiments only and is not intended to limit the embodiments of the present disclosure. As used in this disclosure, the singular forms "a," "the" and "the" are intended to include the plural forms as well, unless the context clearly dictates otherwise. It will also be understood that the term "and/or" as used herein refers to and includes any and all possible combinations of one or more of the associated listed items.
应当理解,尽管在本公开实施例可能采用术语第一、第二、第三等来描述各种信息,但这些信息不应限于这些术语。这些术语仅用来将同一类型的信息彼此区分开。例如,在不脱离本公开实施例范围的情况下,第一信息也可以被称为第二信息,类似地,第二信息也可以被称为第一信息。取决于语境,如在此所使用的词语“如果”可以被解释成为“在……时”或“当……时”或“响应于确定”。It should be understood that although the terms first, second, third, etc. may be used to describe various information in the embodiments of the present disclosure, the information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of the embodiments of the present disclosure, the first information may also be called second information, and similarly, the second information may also be called first information. Depending on the context, the word "if" as used herein may be interpreted as "when" or "when" or "in response to determining."
本公开实施例提供一种显示图像的更新方法,如图1所示,图1是根据一示例性实施例示出的一种显示图像的更新方法的流程示意图一。所述方法,包括:An embodiment of the present disclosure provides a method for updating a display image, as shown in Figure 1 . Figure 1 is a schematic flowchart 1 of a method for updating a display image according to an exemplary embodiment. The method includes:
步骤S101,检测到针对于显示界面的触控事件,且所述终端设备处于第一应用状态时,基于所述触控事件的类型和所述类型对应的应用绘制处理的目标触发时刻,对所述触控事件对应的至少一个第一类图层进行应用绘制处理;Step S101: When a touch event for the display interface is detected and the terminal device is in the first application state, based on the type of the touch event and the target trigger time of the application drawing process corresponding to the type, the touch event is detected. Perform application drawing processing on at least one first-type layer corresponding to the touch event;
步骤S102,在所述至少一个第一类图层的应用绘制处理完成后,触发对所述至少一个第一类图层的图层合成处理,得到目标图像帧;Step S102: After the application drawing process of the at least one first type layer is completed, trigger the layer synthesis process of the at least one first type layer to obtain the target image frame;
步骤S103,基于所述目标图像帧,对所述显示界面的显示图像进行更新。Step S103: Update the display image of the display interface based on the target image frame.
本公开实施例提供的显示图像的更新方法可应用于包括触控屏的终端设备,这里,该终端设备可包括:智能手机、平板电脑或笔记本电脑等。The display image updating method provided by the embodiments of the present disclosure can be applied to a terminal device including a touch screen. Here, the terminal device may include a smart phone, a tablet computer, a notebook computer, etc.
在步骤S101中,在终端设备的使用过程中,检测到针对所述终端设备的显示界面的触摸操作而产生的触控事件后,可确定当前终端设备是否处于第一应用状态,若所述当前终端设备处于第一应用状态,根据所述触控事件的类型,确定所述触控事件的类型对应的应用绘制处理的目标触发时刻,并在所述目标触发时刻,对基于所述触控事件生成的至少一个第一类图层进行应用绘制处理。In step S101, during the use of the terminal device, after detecting a touch event generated by a touch operation on the display interface of the terminal device, it may be determined whether the current terminal device is in the first application state. If the current The terminal device is in the first application state, determines the target trigger time of the application drawing process corresponding to the type of the touch event according to the type of the touch event, and at the target trigger time, performs the processing based on the touch event. At least one first-type layer is generated for application drawing processing.
这里,所述第一应用状态可为:所述终端设备当前在前台运行的应用程序为目标应用程序。所述目标应用程序为预先设置的跟手性要求较高的应用程序,例如,绘图类应用程序、文档类应用程序等。Here, the first application state may be: the application program currently running in the foreground of the terminal device is the target application program. The target application is a preset application with high chirality requirements, such as a drawing application, a document application, etc.
可通过获取所述终端设备的运行信息,基于所述运行信息,确定所述终端设备是否处于第一应用状态。其中,所述终端设备的运行信息,至少包括:当前运行的应用程序信息。It can be determined whether the terminal device is in the first application state based on the operating information by obtaining the operating information of the terminal device. Wherein, the running information of the terminal device at least includes: currently running application information.
所述触控事件的类型可包括:点击(Down)事件、滑动(Move)事件和抬起(Up)事件。可以理解的是,用户针对于所述显示界面的触摸操作会产生一个事件序列,所述一个事件序列是指从触控体触摸所述显示界面的那一刻开始,到触控体离开所述显示界面的那一刻结束,这个过程中所产生的的一系列事件。也就是,一个事件序列是以Down事件开始,中间包含有数量不定的Move事件,最终以Up事件结束。The types of touch events may include: click (Down) events, slide (Move) events, and lift (Up) events. It can be understood that a user's touch operation on the display interface will generate an event sequence. The event sequence refers to the moment when the touch object touches the display interface until the touch object leaves the display. The moment the interface ends, a series of events occur during this process. That is, an event sequence starts with a Down event, contains an indefinite number of Move events, and finally ends with an Up event.
本公开实施例在检测到触控事件后,确定所述触控事件的类型;并获取所述触控事件的类型对应的触发应用绘制处理的目标触发时刻;这里,不同类型的触控事件对应的目标触发时刻不同。After detecting a touch event, the embodiment of the present disclosure determines the type of the touch event; and obtains the target trigger time corresponding to the type of the touch event that triggers the application drawing process; here, different types of touch events correspond to The target trigger time is different.
需要说明的是,在Android平台内,通常在检测到触控事件后,需要等待下一个第一同步信号,通过所述第一同步信号触发对所述触控事件生成的多个第一类图层进行应用绘制处理;并且在应用绘制处理完成后,需要等待下一个第二同步信号,通过所述第二同步信号触发对应用绘制处理后的多个第一类图层进行图层合成处理,得到图像帧;最后在第三同步信号的触发下,基于所述图像帧,对显示界面当前显示的图像进行刷新。It should be noted that in the Android platform, usually after detecting a touch event, it is necessary to wait for the next first synchronization signal, and the first synchronization signal triggers multiple first-type images generated for the touch event. layer to perform application drawing processing; and after the application drawing processing is completed, it is necessary to wait for the next second synchronization signal, and the second synchronization signal triggers layer synthesis processing on multiple first-type layers after application drawing processing, The image frame is obtained; finally, under the trigger of the third synchronization signal, the image currently displayed on the display interface is refreshed based on the image frame.
这里,所述第一同步信号为触发应用绘制处理的系统垂直同步信号,即Vsync-app信号;所述第二同步信号为触发图层合成处理的系统垂直同步信号,即Vsync-sf信号;所述第三同步信号为触发硬件刷新处理的系统垂直同步信号,即Vsync-hw信号。Here, the first synchronization signal is a system vertical synchronization signal that triggers application drawing processing, that is, Vsync-app signal; the second synchronization signal is a system vertical synchronization signal that triggers layer synthesis processing, that is, Vsync-sf signal; so The third synchronization signal is a system vertical synchronization signal that triggers hardware refresh processing, that is, the Vsync-hw signal.
需要说明的是,所述第一同步信号、所述第二同步信号是基于所述第三同步信号产生的,即所述第三同步信号可以是第一同步信号和第二同步信号的信号源;或者,所述第一同步信号、第二同步信号与第三同步信号同步。故第一同步信号、第二同步信号的信号周期与所述第三同步信号的信号周期相同,并且相位一致。但是在实际应用过程中,由于各种因素(例如,终端设备内不同元器件的处理性能不同),所述第一同步信号、所述第二同步信号和所述第三同步信号之间存在偏移,不会完全对齐。It should be noted that the first synchronization signal and the second synchronization signal are generated based on the third synchronization signal, that is, the third synchronization signal may be the signal source of the first synchronization signal and the second synchronization signal. ; Or, the first synchronization signal, the second synchronization signal and the third synchronization signal are synchronized. Therefore, the signal periods of the first synchronization signal and the second synchronization signal are the same as the signal period of the third synchronization signal, and the phases are consistent. However, in actual application, due to various factors (for example, different processing performance of different components in the terminal equipment), there is a deviation between the first synchronization signal, the second synchronization signal and the third synchronization signal. If moved, they won't be perfectly aligned.
也就是,从检测到触控事件,到显示界面显示由所述触控事件产生的图像帧这个过程,需要3 个系统垂直同步信号的信号周期;导致触控延迟较严重,对于一些跟手性要求较高的应用场景(例如,绘图场景),用户体验较差。That is to say, the process from detecting a touch event to displaying the image frame generated by the touch event on the display interface requires three signal periods of the system's vertical synchronization signal; resulting in serious touch delays. For some devices with chirality Application scenarios with higher requirements (for example, drawing scenarios) have poor user experience.
相关技术中,为了减低触控延迟,在检测到Down事件后,不等待第一同步信号的触发就直接对Down事件产生的至少一个第一类图层进行应用绘制处理;但是这种方式并未对随后产生的第一同步信号进行处理,会导致提前绘制的一帧图像和由随后产生的第一同步信号处理而绘制的一帧图像相同,使得显示界面出现卡顿一帧的情况;并且这种方式也没有对Move事件进行处理,对显示界面的触控延迟的改善效果有限。In the related technology, in order to reduce the touch delay, after detecting the Down event, the application drawing process is directly performed on at least one first-type layer generated by the Down event without waiting for the triggering of the first synchronization signal; however, this method does not Processing the subsequently generated first synchronization signal will cause a frame of image drawn in advance to be the same as a frame of image drawn by processing the subsequently generated first synchronization signal, causing the display interface to freeze for one frame; and this This method also does not handle the Move event, and has limited effect on improving the touch delay of the display interface.
本公开实施例根据不同类型的触控事件,设置不同的触发应用绘制处理的目标触发时刻;当检测到触控事件后,将触控事件产生的至少一个第一类图层传递至当前运行的目标应用程序,所述目标应用程序基于所述目标触发时刻的触发,对所述触控事件生成的至少一个第一类图层进行应用绘制处理,不需要等待第一同步信号的触发,从而降低整个触摸过程中的触控延迟。Embodiments of the present disclosure set different target triggering moments for triggering application drawing processing according to different types of touch events; when a touch event is detected, at least one first-type layer generated by the touch event is passed to the currently running A target application, which performs application drawing processing on at least one first type layer generated by the touch event based on the triggering of the target triggering moment, without waiting for the triggering of the first synchronization signal, thereby reducing Touch delay throughout the touch process.
在步骤S102中,在所述至少一个第一类图层的应用绘制处理完成后,应用程序将应用绘制处理后的至少一个第一类图层传递给Surface Flinger,并触发所述Surface Flinger对应用绘制处理后的至少一个第一类图层进行图层合成处理,得到目标图像帧。In step S102, after the application drawing process of the at least one first-type layer is completed, the application program passes the at least one first-type layer after the application drawing process to Surface Flinger, and triggers the Surface Flinger to apply At least one first-type layer after rendering processing is subjected to layer synthesis processing to obtain a target image frame.
需要说明的是,相关技术中,应用程序在完成对所述至少一个第一类图层的应用绘制处理后,会将应用绘制处理后的至少一个第一类图层传递给Surface Flinger,但所述Surface Flinger需要等待下一个第二同步信号,在第二同步信号的触发下,对应用绘制处理后的至少一个第一类图层进行图层合成处理。It should be noted that in the related technology, after the application completes the application drawing process of the at least one first-type layer, it will pass the at least one first-type layer after the application drawing process to Surface Flinger, but so The Surface Flinger needs to wait for the next second synchronization signal, and when triggered by the second synchronization signal, perform layer synthesis processing on at least one first-type layer after applying the drawing process.
为了降低触控延迟,本公开实施例在完成对至少一个第一类图层的应用绘制处理后,直接触发所述Surface Flinger对应用绘制处理后的至少一个第一类图层进行图层合成处理,不需要等待第二同步信号。In order to reduce the touch delay, the embodiment of the present disclosure directly triggers the Surface Flinger to perform layer synthesis processing on at least one first-type layer after applying the drawing process after completing the application drawing process. , no need to wait for the second synchronization signal.
在步骤S103中,在得到目标图像帧后,终端设备在下一个第三同步信号的触发下,对显示界面刷新,以在所述显示界面显示所述目标图像帧。In step S103, after obtaining the target image frame, the terminal device refreshes the display interface under the trigger of the next third synchronization signal to display the target image frame on the display interface.
这里,所述第三同步信号是由终端设备的显示屏幕驱动触发的硬件信号,所述第三同步信号的信号周期是根据终端设备的显示屏幕的屏幕刷新率确定的。具体地,所述第三同步信号的信号周期是终端设备的显示屏幕的屏幕刷新率的倒数。Here, the third synchronization signal is a hardware signal triggered by the display screen driver of the terminal device, and the signal period of the third synchronization signal is determined according to the screen refresh rate of the display screen of the terminal device. Specifically, the signal period of the third synchronization signal is the reciprocal of the screen refresh rate of the display screen of the terminal device.
例如,终端设备的显示屏幕的屏幕刷新率为60Hz、70Hz、75Hz或80Hz等的任一值。以屏幕刷新率为60Hz为例,所述第三同步信号的信号周期为16.667ms。需要说明的是,终端设备可能支持多个不同的屏幕刷新率,所述第三同步信号的信号周期由终端设备当前所使用的的屏幕刷新率确定。For example, the screen refresh rate of the display screen of the terminal device is any value such as 60Hz, 70Hz, 75Hz or 80Hz. Taking the screen refresh rate as 60Hz as an example, the signal period of the third synchronization signal is 16.667ms. It should be noted that the terminal device may support multiple different screen refresh rates, and the signal period of the third synchronization signal is determined by the screen refresh rate currently used by the terminal device.
本公开实施例在检测到显示界面的触控事件,且所述终端设备处于第一应用状态时,根据触控事件的类型,确定与所述触控事件的类型对应的目标触发时刻,在所述目标触发时刻,触发对所述触控事件产生的至少一个第一类图层的应用绘制处理;从而针对性地基于显示界面的触摸过程中产生的不同类型的触控事件,及时进行应用绘制处理,不需要等待第一同步信号的触发,减少应用绘制处理过程中的延迟;In the embodiment of the present disclosure, when a touch event on the display interface is detected and the terminal device is in the first application state, the target triggering moment corresponding to the type of the touch event is determined according to the type of the touch event. The target triggering moment triggers the application drawing processing of at least one first-type layer generated by the touch event; thereby performing application drawing in a timely manner based on different types of touch events generated during the touch process of the display interface. Processing, there is no need to wait for the trigger of the first synchronization signal, reducing the delay in the application drawing process;
并且,在所述至少一个第一类图层的应用绘制处理完成后,直接触发对应用绘制处理后的至少一个第一类图层进行图层合成处理,得到目标图像帧;不需要等待第二同步信号,减少图层合成处理过程中的延迟,从而减少从检测到触控事件,到显示界面显示由所述触控事件产生的图像帧过程所花费的时间,大幅降低终端设备的触控延迟,提升用户的使用体验。Moreover, after the application drawing process of the at least one first type layer is completed, the layer synthesis process of the at least one first type layer after the application drawing process is directly triggered to obtain the target image frame; there is no need to wait for the second time. The synchronization signal reduces the delay in the layer synthesis process, thereby reducing the time it takes from detecting a touch event to displaying the image frame generated by the touch event on the display interface, significantly reducing the touch delay of the terminal device. , improve the user experience.
在一些实施例中,所述步骤S101中的基于所述触控事件的类型和所述类型对应的应用绘制处理的目标触发时刻,对所述触控事件对应的至少一个第一类图层进行应用绘制处理,包括:In some embodiments, in step S101, based on the type of the touch event and the target trigger time of the application drawing process corresponding to the type, at least one first type layer corresponding to the touch event is processed. Apply drawing processing, including:
若所述触控事件的类型指示所述触控事件为点击事件,基于检测到所述点击事件的检测时刻,对所述点击事件对应的至少一个第一类图层进行应用绘制处理。If the type of the touch event indicates that the touch event is a click event, based on the detection time when the click event is detected, an application drawing process is performed on at least one first type layer corresponding to the click event.
在本公开实施例中,若当前检测到的触控事件为Down事件,可确定所述Down事件对应的目标触发时刻为检测到所述Down事件的检测时刻。In an embodiment of the present disclosure, if the currently detected touch event is a Down event, it can be determined that the target trigger time corresponding to the Down event is the detection time when the Down event is detected.
故在检测到所述Down事件,且所述终端设备处于第一应用状态时,将所述Down事件产生的至少一个第一类图层传递给当前运行的目标应用程序,并触发所述目标应用程序对所述至少一个第一类图层进行应用绘制处理。Therefore, when the Down event is detected and the terminal device is in the first application state, at least one first-type layer generated by the Down event is transferred to the currently running target application, and the target application is triggered. The program performs application drawing processing on the at least one first type layer.
需要说明的是,相关技术中,当终端设备检测到Down事件后,会将Down事件产生的至少一个第一类图层传递给所述目标应用程序,所述目标应用程序接收到所述至少一个第一类图层后需要等待第一同步信号,在第一同步信号的触发下,对至少一个第一类图层进行应用绘制处理。It should be noted that in the related technology, when the terminal device detects the Down event, it will pass at least one first-type layer generated by the Down event to the target application, and the target application receives the at least one The first type layer needs to wait for the first synchronization signal, and when triggered by the first synchronization signal, apply drawing processing to at least one first type layer.
本公开实施例是在检测到Down事件后,将Down事件对应的至少一个第一类图层传递给目标应用程序,并基于该传递操作,触发目标应用程序对所述至少一个第一类图层进行应用绘制处理,不需要等待第一同步信号,从而减少Down事件对应的应用绘制处理过程中的延迟。In the embodiment of the present disclosure, after detecting the Down event, at least one first-type layer corresponding to the Down event is transferred to the target application, and based on the transfer operation, triggers the target application to process the at least one first-type layer. When performing application drawing processing, there is no need to wait for the first synchronization signal, thereby reducing the delay in the application drawing processing process corresponding to the Down event.
在一些实施例中,所述步骤S101中的基于所述触控事件的类型和所述类型对应的应用绘制处理的目标触发时刻,对所述触控事件对应的至少一个第一类图层进行应用绘制处理,包括:In some embodiments, in step S101, based on the type of the touch event and the target trigger time of the application drawing process corresponding to the type, at least one first type layer corresponding to the touch event is processed. Apply drawing processing, including:
若所述触控事件的类型指示所述触控事件为滑动事件,在产生下一个第一同步信号前的预设时刻,对所述滑动事件对应的至少一个第一类图层进行应用绘制处理;其中,所述第一同步信号为触发应用绘制处理的系统垂直同步信号。If the type of the touch event indicates that the touch event is a sliding event, at a preset time before generating the next first synchronization signal, apply drawing processing to at least one first type layer corresponding to the sliding event. ; Wherein, the first synchronization signal is a system vertical synchronization signal that triggers application drawing processing.
在本公开实施例中,若当前检测到的触控事件为Move事件,可确定所述Move事件对应的目标触发时刻为检测到所述Move事件后的下一个第一同步信号产生前的预设时刻。In the embodiment of the present disclosure, if the currently detected touch event is a Move event, it can be determined that the target trigger time corresponding to the Move event is the preset before the next first synchronization signal is generated after the Move event is detected. time.
这里,预设时刻可根据实际需求进行设定,例如,所述Move事件的目标触发时刻可为:所述下一个第一同步信号产生前2ms。Here, the preset time can be set according to actual needs. For example, the target triggering time of the Move event can be: 2 ms before the next first synchronization signal is generated.
需要说明的是,相关技术中,当终端设备检测到Move事件,不会直接将Move事件产生的至少一个第一类图层传递给目标应用程序,而是在检测到Move事件后,需要等待下一个第一同步信号,在所述第一同步信号的触发下,将Move事件产生的至少一个第一类图层传递给目标应用程序,以便目标应用程序在接收到所述Move事件产生的至少一个第一类图层,对所述至少一个第一类图层进行应用绘制处理。It should be noted that in related technologies, when a terminal device detects a Move event, it will not directly pass at least one first-type layer generated by the Move event to the target application. Instead, after detecting the Move event, it needs to wait for the next step. A first synchronization signal, triggered by the first synchronization signal, transmits at least one first-type layer generated by the Move event to the target application, so that the target application receives at least one layer generated by the Move event. A first-type layer, applying drawing processing to the at least one first-type layer.
即使本公开实施例在目标应用程序完成应用绘制处理后,不等待第二同步信号,直接触发所述 Surface Flinger对应用绘制处理后的至少一个第一类图层进行图层合成处理,也难以保证在一个第一同步信号的信号周期内完成对所述Move事件产生的至少一个第一类图层的应用绘制处理和图层合成处理。Even if the embodiment of the present disclosure directly triggers the Surface Flinger to perform layer synthesis processing on at least one first-type layer after the application drawing process without waiting for the second synchronization signal after the target application completes the application drawing process, it is difficult to ensure that The application drawing processing and layer synthesis processing of at least one first-type layer generated by the Move event is completed within a signal period of a first synchronization signal.
故针对于Move事件,本公开实施例可将所述Move事件产生的至少一个第一类图层的应用绘制处理的处理时机提前,即在检测到所述Move事件后的下一个第一同步信号产生前的预设时刻,将所述Move事件产生的至少一个第一类图层传递给目标应用程序,触发目标应用程序对所述Move事件产生的至少一个第一类图层进行应用绘制处理;Therefore, for the Move event, the embodiment of the present disclosure can advance the processing timing of the application drawing processing of at least one first-type layer generated by the Move event, that is, the next first synchronization signal after the Move event is detected. At a preset time before generation, at least one first-type layer generated by the Move event is transferred to the target application, and the target application is triggered to perform application drawing processing on the at least one first-type layer generated by the Move event;
并在目标应用程序完成应用绘制处理后,直接触发所述Surface Flinger对应用绘制处理后的至少一个第一类图层进行图层合成处理,从而使得在一个第一同步信号的信号周期内完成对所述Move事件产生的至少一个第一类图层的应用绘制处理和图层合成处理,降低终端设备的触控延迟。And after the target application completes the application drawing process, the Surface Flinger is directly triggered to perform layer synthesis processing on at least one first type layer after the application drawing process, so that the synthesis is completed within the signal period of a first synchronization signal. The application drawing processing and layer composition processing of at least one first-type layer generated by the Move event reduces the touch delay of the terminal device.
在一些实施例中,所述方法还包括:In some embodiments, the method further includes:
获取对所述第一类图层进行应用绘制处理和图层合成处理所需的最大时长;Obtain the maximum time required to apply drawing processing and layer composition processing to the first type of layer;
基于所述最大时长和所述第一同步信号的信号周期之间的差值,确定所述预设时刻。The preset time is determined based on the difference between the maximum duration and the signal period of the first synchronization signal.
在本公开实施例中,分别获取对所述第一类图层进行应用绘制处理所需的第一时长,以及对所述第一类图层进行图层合成处理所需的第二时长,并基于所述第一时长和所述第二时长,确定所述最大时长。In this embodiment of the present disclosure, the first duration required for application drawing processing on the first type of layer and the second duration required for layer synthesis processing on the first type of layer are respectively obtained, and The maximum duration is determined based on the first duration and the second duration.
这里,可基于实验测试,分别获取对所述第一类图层进行应用绘制处理所需的第一时长和进行图层合成处理所需的第二时长。Here, based on experimental testing, the first time duration required for applying drawing processing to the first type of layer and the second time duration required for layer synthesis processing can be obtained respectively.
具体的实验测试方法可根据实际情况进行设置,本公开对此不作限定。例如,可利用机械手在显示界面触摸,并使用Android系统跟踪(System Trace,Systrace)工具抓取终端设备对至少一个图层进行应用绘制处理的第一时序信息,以及对至少一个图层进行图层合成处理的第二时序信息;并根据多个第一时序信息,确定对所述第一类图层进行应用绘制处理所需的第一时长;根据多个第二时序信息,确定对所述第一类图层进行图层合成处理所需的第二时长,从而确定出最大时长。Specific experimental testing methods can be set according to actual conditions, and this disclosure does not limit this. For example, the robot hand can be used to touch the display interface, and the Android system trace (System Trace, Systrace) tool can be used to capture the first timing information of the terminal device applying drawing processing to at least one layer, and to perform layer processing on at least one layer. Synthesize the second timing information of the processing; and determine the first duration required to apply drawing processing to the first type of layer based on the plurality of first timing information; determine the first duration required for the first type of layer based on the plurality of second timing information. The second amount of time required for layer compositing processing for a type of layer, thereby determining the maximum time.
这里,所述Systrace是对终端设备的Android操作系统进行性能分析的工具,Systrace的功能包括跟踪系统的输入/输出操作、内核工作队列、中央处理器负载以及Android操作系统各个子系统的运转状态。Here, the Systrace is a tool for performance analysis of the Android operating system of the terminal device. The functions of Systrace include tracking the input/output operations of the system, the kernel work queue, the central processor load, and the operating status of each subsystem of the Android operating system.
在一些实施例中,还可通过获取多个历史图像帧进行应用绘制处理和图层合成处理的处理时长,基于所述多个历史图像帧的所述处理时长,确定对所述第一类图层进行应用绘制处理和图层合成处理所需的最大时长。In some embodiments, the processing time of applying drawing processing and layer synthesis processing can also be obtained by obtaining multiple historical image frames, and determining the processing time of the first type of image based on the processing time of the multiple historical image frames. The maximum amount of time it takes for a layer to undergo application drawing and layer compositing processing.
在确定出应用绘制处理和图层合成处理所需的最大时长后,确定所述最大时长与所述第一同步信号的信号周期之间的差值,基于所述差值,确定所述预设时刻;从而在检测到所述Move事件后的下一个第一同步信号产生前的预设时刻,对所述Move事件产生的至少一个第一类图层进行应用绘制处理,并在完成应用绘制处理后,直接触发对所述至少一个第一类图层的图层合成处理,使得所述Move事件产生的至少一个第一类图层的应用绘制处理和图层合成处理能够在一个第一同步信 号的信号周期内完成,降低终端设备的触控延迟。After determining the maximum duration required to apply the drawing process and the layer synthesis process, determine the difference between the maximum duration and the signal period of the first synchronization signal, and determine the preset based on the difference. time; thus at the preset time before the next first synchronization signal is generated after the Move event is detected, the application drawing process is performed on at least one first type layer generated by the Move event, and the application drawing process is completed Afterwards, directly trigger the layer composition processing of the at least one first type layer, so that the application drawing processing and layer composition processing of the at least one first type layer generated by the Move event can be executed in a first synchronization signal. Completed within the signal cycle, reducing the touch delay of the terminal device.
在一些实施例中,所述步骤S102中的在所述至少一个第一类图层的应用绘制处理完成后,触发对所述至少一个第一类图层的图层合成处理,得到目标图像帧,包括:In some embodiments, in step S102, after the application drawing process of the at least one first-type layer is completed, the layer synthesis process of the at least one first-type layer is triggered to obtain the target image frame. ,include:
在所述至少一个第一类图层的应用绘制处理完成后,将应用绘制处理后的至少一个第一类图层写入图层合成缓存中;After the application drawing process of the at least one first type layer is completed, writing the at least one first type layer after the application drawing process into the layer composition cache;
基于所述第一类图层的第一写入操作的触发,对所述图层合成缓存中的所述至少一个第一类图层进行图层合成处理,得到所述目标图像帧。Based on the triggering of the first write operation of the first type layer, layer synthesis processing is performed on the at least one first type layer in the layer synthesis cache to obtain the target image frame.
在本公开实施例中,目标应用程序在完成对所述触控事件产生的至少一个第一类图层的应用绘制处理后,会将应用绘制处理后的至少一个第一类图层写入图层合成缓存内;Surface Flinger检测到对所述图层合成缓存的第一写入操作后,基于所述第一写入操作的触发,从所述图层合成缓存中读取所述第一写入操作写入的所述第一类图层,对所述第一类图层进行图层合成处理,得到所述目标图像帧。In this embodiment of the present disclosure, after the target application completes the application drawing process of at least one first type layer generated by the touch event, it will write the at least one first type layer after the application drawing process into the graph. Within the layer composition cache; after Surface Flinger detects the first write operation to the layer composition cache, based on the triggering of the first write operation, the Surface Flinger reads the first write operation from the layer composition cache. Enter the first type of layer written by the operation, perform layer synthesis processing on the first type of layer, and obtain the target image frame.
需要说明的是,相关技术中,Surface Flinger通常是在第二同步信号的触发下,从所述图层合成缓存读取第一类图层,并对所述第一类图层进行图层合成处理。若在上一个第二同步信号产生后,Surface Flinger才检测到对所述图层合成缓存的第一写入操作,此时,Surface Flinger需要等待约一个第二同步信号的信号周期,才能对所述第一写入操作写入的所述第一类图层进行图层合成处理。It should be noted that in related technologies, Surface Flinger usually reads the first type of layer from the layer composition cache and performs layer composition on the first type of layer when triggered by the second synchronization signal. deal with. If Surface Flinger detects the first write operation to the layer synthesis cache only after the last second synchronization signal is generated, at this time, Surface Flinger needs to wait for about one signal period of the second synchronization signal before it can perform all operations on it. The first type of layer written by the first writing operation is subjected to layer synthesis processing.
为了减少图层合成过程中的等待时间,本公开实施例将对所述图层合成缓存的第一写入操作的写入时刻,作为触发图层合成处理的触发时刻,从而使得Surface Flinger在检测到对所述图层合成缓存的第一写入操作后,直接对所述第一写入操作写入的所述第一类图层进行图层合成处理,不需要等待下一个第二同步信号的产生,大幅降低图层合成过程的处理延迟情况。In order to reduce the waiting time during the layer composition process, the embodiment of the present disclosure will use the writing time of the first write operation of the layer composition cache as the trigger time to trigger the layer composition process, so that the Surface Flinger detects After the first write operation to the layer composition cache, layer composition processing is directly performed on the first type of layer written by the first write operation without waiting for the next second synchronization signal. The generation of the layer greatly reduces the processing delay in the layer composition process.
在一些实施例中,所述方法还包括:In some embodiments, the method further includes:
基于第一同步信号的触发,对获取的至少一个第二类图层进行应用绘制处理,并将应用绘制处理后的至少一个第二类图层写入所述图层合成缓存;其中,所述第二类图层是由所述终端设备当前运行的应用程序的应用程序事件触发产生的;Based on the triggering of the first synchronization signal, apply drawing processing to the acquired at least one second type layer, and write the at least one second type layer after applying the drawing process into the layer synthesis cache; wherein, the The second type of layer is generated by application event triggering of the application currently running on the terminal device;
基于所述第二类图像的第二写入操作前的一个第二同步信号的信号周期,确定所述一个第二同步信号的信号周期内是否存在对所述第一类图层的图层合成处理;所述第二同步信号为触发图层合成处理的系统垂直同步信号;Based on the signal period of a second synchronization signal before the second writing operation of the second type image, determine whether there is layer synthesis for the first type of layer within the signal period of the second synchronization signal. Processing; the second synchronization signal is a system vertical synchronization signal that triggers layer synthesis processing;
所述基于所述第一类图层的第一写入操作的触发,对所述图层合成缓存中的所述至少一个第一类图层进行图层合成处理,得到所述目标图像帧,包括:performing layer synthesis processing on the at least one first type layer in the layer synthesis cache based on the triggering of the first write operation of the first type layer to obtain the target image frame, include:
若存在对所述第一类图层的图层合成处理,在所述第二写入操作后的一个第二同步信号的信号周期内,基于所述第一写入操作的触发,对所述图层合成缓存中的所述至少一个第一类图层和所述至少一个第二类图层进行图层合成处理,得到所述目标图像帧。If there is layer synthesis processing for the first type of layer, within a signal period of the second synchronization signal after the second writing operation, based on the triggering of the first writing operation, the The at least one first-type layer and the at least one second-type layer in the layer composition cache are subjected to layer composition processing to obtain the target image frame.
在本公开实施例中,待进行应用绘制处理、图层合成处理的图层包括:第一类图层和/或第二类图层。In this embodiment of the present disclosure, the layers to be subjected to application drawing processing and layer synthesis processing include: first type layers and/or second type layers.
需要说明的是,所述第二类图层是由所述终端设备当前运行的应用程序的应用程序事件触发产生的;例如,终端设备处于第一应用状态时,触控笔与终端设备建立连接时,显示界面会弹出的连接建立提示窗口;所述连接建立提示窗口图像包含有至少一个由连接建立事件触发产生的第二类图层。It should be noted that the second type of layer is triggered by an application event of the application currently running on the terminal device; for example, when the terminal device is in the first application state, the stylus establishes a connection with the terminal device. , a connection establishment prompt window will pop up on the display interface; the connection establishment prompt window image includes at least one second type layer triggered by a connection establishment event.
在检测到应用程序事件,且所述终端设备处于第一应用状态时,获取所述应用程序事件产生的至少一个第二类图层,并等待下一个第一同步信号的产生;并基于所述下一个同步信号的触发,对所述至少一个第二类图层进行应用绘制处理,将应用绘制处理后的至少一个第二类图层写入所述图层合成缓存内。When an application event is detected and the terminal device is in the first application state, obtain at least one second type layer generated by the application event and wait for the generation of the next first synchronization signal; and based on the When the next synchronization signal is triggered, apply drawing processing to the at least one second type layer, and write the at least one second type layer after applying the drawing process into the layer synthesis cache.
需要说明的是,由于所述第二类图层是由应用程序事件触发产生的,所述第二类图层的应用绘制处理、图层合成处理过程中存在一些延迟,对显示界面的图像显示效果不会造成影响,故可将基于第一同步信号,触发对第二类图层的应用绘制处理;基于第二同步信号,触发图像合成处理。也就是,终端设备针对于第一类图层的应用绘制处理、图像合成处理的处理时机,和针对于第二类图层的应用绘制处理、图像合成处理的处理时机不同。It should be noted that since the second type of layer is triggered by application events, there is some delay in the application drawing processing and layer synthesis processing of the second type of layer, which affects the image display of the display interface. The effect will not be affected, so the application drawing processing of the second type of layer can be triggered based on the first synchronization signal; the image synthesis processing can be triggered based on the second synchronization signal. That is, the processing timing of the terminal device's application drawing processing and image synthesis processing for the first type of layer is different from the processing timing of the application drawing processing and image synthesis processing for the second type of layer.
Surface Flinger检测到对所述图层合成缓存的第二写入操作后,基于所述第二写入操作前的一个第二同步信号的信号周期,确定所述信号周期内是否存在对第一类图层的图层合成处理;After Surface Flinger detects the second write operation to the layer synthesis cache, based on the signal period of a second synchronization signal before the second write operation, it determines whether there is a request for the first type of data within the signal period. Layer composition processing of layers;
若确定出所述信号周期内存在对第一类图层的图层合成处理,在检测到对所述图层合成缓存的第二写入操作后的下一个第二同步信号的信号周期内,检测对图层合成缓存的第一写入操作,并检测到所述第一写入操作时,触发对图层合成缓存内存储的至少一个第一类图层和至少一个第二类图层进行图层合成处理,得到目标图像帧。If it is determined that there is layer synthesis processing for the first type of layer within the signal period, within the signal period of the next second synchronization signal after the second write operation to the layer synthesis cache is detected, Detecting a first write operation to the layer composition cache, and when detecting the first write operation, triggering the execution of at least one first type layer and at least one second type layer stored in the layer composition cache. Layer synthesis is processed to obtain the target image frame.
需要说明的是,在终端设备处于第一应用状态时,即目标应用程序在所述终端设备的运行过程中,会存在第一类图层和第二类图层都需要进行图像合成处理的时候,例如,当使用触控笔在显示界面上绘制的时候,有其他应用程序的提示信息弹出;此时,由触控笔绘制产生的第一类图层和由提示信息产生的第二类图层都需要进行图层合成处理。It should be noted that when the terminal device is in the first application state, that is, when the target application is running on the terminal device, there will be times when both the first type of layer and the second type of layer need to perform image synthesis processing. , for example, when using a stylus to draw on the display interface, prompt information from other applications pops up; at this time, the first type of layer generated by the stylus drawing and the second type of image generated by the prompt information All layers need to be layered.
为了在终端设备处于第一应用状态时,保障所述第一类图层的图层合成处理是优先的,可在将应用绘制处理后的至少一个第二类图层写入图层合成缓存后,确定所述第二写入操作前的一个第二同步信号的信号周期内是否存在对第一类图层的图层合成处理;In order to ensure that the layer composition processing of the first type of layer is given priority when the terminal device is in the first application state, at least one second type of layer after application drawing processing can be written into the layer composition cache. , determine whether there is layer synthesis processing for the first type of layer within the signal period of a second synchronization signal before the second writing operation;
若存在对所述第一类图层的图层合成处理,Surface Flinger可延迟对所述第二类图层的图层合成处理,在检测到第一写入操作后,基于所述第一写入操作,触发Surface Flinger对图层合成缓存内的第一类图层和第二类图层一起进行图像合成处理,得到目标图像帧。If there is layer composition processing for the first type of layer, Surface Flinger can delay the layer composition processing for the second type of layer, and after detecting the first write operation, based on the first write operation Enter the operation to trigger Surface Flinger to perform image synthesis processing on the first type of layer and the second type of layer in the layer synthesis cache to obtain the target image frame.
可以理解的是,在Surface Flinger完成对第n个触控事件对应的至少一个第一类图层的图像合成处理,得到第n帧目标图像后的一个第二同步信号的信号周期内,Surface Flinger检测到对图层合成缓存写入至少一个第二类图层的第二写入操作;此时若Surface Flinger基于第二类图层的图层合成处理的处理时机,对第二类图层进行图层合成处理,即基于第二同步信号的触发,对第二类图层进行图层合成处理,可能会导致第n+1个触控事件对应的至少一个第一类图层的图层合成处理得到的目 标图像帧,会被推迟一个第三同步信号的信号周期刷新显示在显示界面上,从而造成触控延迟,显示画面卡顿的情况。It can be understood that, within the signal period of a second synchronization signal after Surface Flinger completes the image synthesis processing of at least one first-type layer corresponding to the n-th touch event and obtains the n-th frame target image, Surface Flinger A second write operation of writing at least one second-type layer to the layer composition cache is detected; at this time, if Surface Flinger performs processing on the second-type layer based on the processing timing of the second-type layer's layer composition processing, Layer synthesis processing, that is, performing layer synthesis processing on the second type of layer based on the triggering of the second synchronization signal, may result in the layer synthesis of at least one first type layer corresponding to the n+1th touch event. The processed target image frame will be refreshed and displayed on the display interface after delaying the signal cycle of the third synchronization signal, causing touch delay and display screen freezes.
故本公开实施例中,Surface Flinger在检测到第二写入操作后,需要先确定所述第二写入操作前的一个第二同步信号的信号周期内是否存在对第n个触控事件对应的至少一个第一类图层的图像合成处理,若存在对第n个触控事件对应的至少一个第一类图层的图像合成处理,可延迟对所述第二类图层的图层合成处理;并在所述第二写入操作后的一个第二同步信号的信号周期内,基于第n+1个触控事件对应的至少一个第一类图层的第一写入操作的触发,对所述图层合成缓存中的第n+1个触控事件对应的至少一个第一类图层和所述至少一个第二类图层进行图层合成处理,得到所述目标图像帧,从而在第一类图层和第二类图层都需要进行图像合成处理的时候,减少由于图层合成处理而导致的触控延迟、显示画面卡顿的情况,提升用户的使用体验。Therefore, in this disclosed embodiment, after Surface Flinger detects the second write operation, it needs to first determine whether there is a response to the nth touch event within the signal period of a second synchronization signal before the second write operation. Image synthesis processing of at least one first type layer. If there is image synthesis processing of at least one first type layer corresponding to the n-th touch event, layer synthesis of the second type layer can be delayed. Processing; and within the signal period of a second synchronization signal after the second writing operation, triggering the first writing operation of at least one first type layer corresponding to the n+1th touch event, Perform layer composition processing on at least one first type layer and the at least one second type layer corresponding to the n+1th touch event in the layer composition cache to obtain the target image frame, thereby When both the first type of layer and the second type of layer need to undergo image synthesis processing, the touch delay and display screen freeze caused by the layer synthesis processing are reduced, and the user experience is improved.
在一些实施例中,所述方法还包括:In some embodiments, the method further includes:
若不存在对所述第一类图层的图层合成处理,基于下一个第二同步信号的触发,对所述图层合成缓存中的至少一个第二类图层进行图层合成处理,得到所述目标图像帧。If there is no layer synthesis processing for the first type of layer, based on the trigger of the next second synchronization signal, layer synthesis processing is performed on at least one second type of layer in the layer synthesis cache to obtain The target image frame.
在本公开实施例中,Surface Flinger检测到对所述图层合成缓存的第二写入操作后,基于所述第二写入操作前的一个第二同步信号的信号周期,确定所述信号周期内是否存在对第一类图层的图层合成处理;In the embodiment of the present disclosure, after Surface Flinger detects the second write operation to the layer composition cache, it determines the signal period based on the signal period of a second synchronization signal before the second write operation. Whether there is layer synthesis processing for the first type of layer;
若所述信号周期内不存在对所述第一类图层的图层合成处理,可基于所述第二写入操作后的下一个第二同步信号的触发,对所述图层合成缓存中的至少一个第二类图层进行图层合成处理,得到目标图像帧。If there is no layer synthesis processing for the first type of layer within the signal period, the layer synthesis cache can be based on the trigger of the next second synchronization signal after the second write operation. Perform layer synthesis processing on at least one second type layer to obtain a target image frame.
可以理解的是,若Surface Flinger在所述第二写入操作前的一个第二同步信号的信号周期内未检测到对所述第一类图层的图层合成处理,说明在所述第二写入操作前的一个第二同步信号的信号周期内,触控体未与显示界面接触;故在所述第二写入操作后的一个第二同步信号的信号周期内不会出现第一写入操作,不需要进行对第一类图层的图层合成处理。It can be understood that if Surface Flinger does not detect the layer synthesis processing of the first type of layer within the signal period of a second synchronization signal before the second writing operation, it means that the second During the signal period of the second synchronization signal before the writing operation, the touch body does not contact the display interface; therefore, the first writing will not occur during the signal period of the second synchronization signal after the second writing operation. In the input operation, there is no need to perform layer composition processing on the first type of layer.
此时,可基于所述第二写入操作后的下一个第二同步信号的触发,对所述图层合成缓存中的至少一个第二类图层进行图层合成处理,得到目标图像帧;并在第三同步信号的触发下,将目标图像帧刷新显示在显示界面上。At this time, based on the triggering of the next second synchronization signal after the second writing operation, layer synthesis processing can be performed on at least one second type layer in the layer synthesis cache to obtain a target image frame; And under the trigger of the third synchronization signal, the target image frame is refreshed and displayed on the display interface.
在一些实施例中,在基于所述触控事件的类型和所述类型对应的应用绘制处理的目标触发时刻,对所述触控事件对应的至少一个第一类图层进行应用绘制处理之前,所述方法还包括:In some embodiments, before applying the drawing process to at least one first type layer corresponding to the touch event based on the type of the touch event and the target triggering moment of the application drawing process corresponding to the type, The method also includes:
响应于针对所述显示界面上的任一应用程序的启动操作,获取所述应用程序对应的窗口标识;In response to a startup operation for any application program on the display interface, obtain the window identifier corresponding to the application program;
确定所述应用程序对应的窗口标识是否包括预设标识;Determine whether the window identifier corresponding to the application program includes a preset identifier;
若所述应用程序对应的窗口标识包括预设标识,确定所述终端设备处于第一应用状态,并获取由所述触控事件产生的至少一个第一类图层。If the window identifier corresponding to the application program includes a preset identifier, it is determined that the terminal device is in the first application state, and at least one first type layer generated by the touch event is obtained.
在本公开实施例中,终端设备接收到用户针对于所述显示界面显示的任一应用程序的应用图标的选择操作,启动所述应用图标对应的应用程序;并响应于所述应用程序的启动操作,获取所述应 用程序对应的窗口标识;In an embodiment of the present disclosure, the terminal device receives the user's selection operation for the application icon of any application program displayed on the display interface, starts the application program corresponding to the application icon; and responds to the startup of the application program Operation to obtain the window identifier corresponding to the application;
这里,所述窗口标识可包括:应用窗口的编号、名称等。可以理解的是,显示界面上所打开应用窗口都有对应的窗口标识,所述窗口标识可指示终端设备当前在前台运行的应用程序。Here, the window identification may include: the number, name, etc. of the application window. It can be understood that all open application windows on the display interface have corresponding window identifiers, and the window identifiers can indicate the applications currently running in the foreground of the terminal device.
预设标识可为预先设置的目标应用程序的窗口标识;这里,所述目标应用程序可包括:绘图类应用程序、文档类应用程序等。The preset identification may be a preset window identification of a target application; here, the target application may include: a drawing application, a document application, etc.
通过将所述应用程序的窗口标识与所述预设标识进行对比,确定所述应用程序的窗口标识是否包含有预设标识;若所述应用程序的窗口标识包含预设标识,说明终端设备在前台运行的应用程序为所述目标应用程序,即所述终端设备处于第一应用状态。By comparing the window identifier of the application program with the preset identifier, it is determined whether the window identifier of the application program contains the preset identifier; if the window identifier of the application program contains the preset identifier, it means that the terminal device is in The application running in the foreground is the target application, that is, the terminal device is in the first application state.
可以理解的是,本公开实施例在检测到触控事件后,可通过获取应用程序对应的窗口标识,基于所述窗口标识,确定终端设备当前在前台运行的应用程序是否为目标应用程序,并在所述终端设备当前在前台运行的应用程序为目标应用程序,即终端设备处于第一应用状态时,获取触控事件产生的至少一个第一类图层,以便于基于所述触控事件的类型和所述类型对应的应用绘制处理的目标触发时刻,对所述触控事件对应的至少一个第一类图层进行应用绘制处理,以及在应用绘制处理完成后,触发对所述至少一个第一类图层的图层合成处理,得到目标图像帧。It can be understood that after detecting a touch event in the embodiment of the present disclosure, the window identifier corresponding to the application program can be obtained, and based on the window identifier, it can be determined whether the application program currently running in the foreground of the terminal device is the target application program, and When the application program currently running in the foreground of the terminal device is the target application program, that is, when the terminal device is in the first application state, at least one first-type layer generated by the touch event is obtained, so as to facilitate processing based on the touch event. type and the target triggering moment of the application drawing processing corresponding to the type, perform application drawing processing on at least one first type layer corresponding to the touch event, and after the application drawing processing is completed, trigger the application drawing processing on the at least one first type layer corresponding to the touch event. The layer synthesis process of a type of layer is used to obtain the target image frame.
本公开实施例通过获取窗口标识,确定终端设备是否处于跟手性要求较高的第一应用状态,若所述终端设备处于第一应用状态,在对触控事件产生的至少一个第一类图像进行应用绘制处理和图层合成处理时,不需要等待第一同步信号、第二同步信号的触发,从而有效降低整个过程中的触控延迟,提升用户的使用体验。The embodiment of the present disclosure determines whether the terminal device is in the first application state with higher chirality requirements by obtaining the window identifier. If the terminal device is in the first application state, at least one first type image generated by the touch event is When performing application drawing processing and layer synthesis processing, there is no need to wait for the triggering of the first synchronization signal and the second synchronization signal, thereby effectively reducing the touch delay in the entire process and improving the user experience.
在一些实施例中,所述方法还包括:In some embodiments, the method further includes:
若所述应用程序对应的窗口标识不包括所述预设标识,确定所述终端设备处于第二应用状态;If the window identifier corresponding to the application program does not include the preset identifier, it is determined that the terminal device is in the second application state;
检测到针对于所述显示界面的触控事件,且所述终端设备处于所述第二应用状态时,基于第一同步信号的触发,对所述触控事件对应的至少一个第一类图层进行应用绘制处理;When a touch event for the display interface is detected and the terminal device is in the second application state, based on the triggering of the first synchronization signal, at least one first type layer corresponding to the touch event is Perform application drawing processing;
基于第二同步信号的触发,对应用绘制处理后的至少一个第一类图层进行图层合成处理。Based on the triggering of the second synchronization signal, a layer synthesis process is performed on at least one first type layer after applying the drawing process.
在本公开实施例中,通过将所述应用程序的窗口标识与所述预设标识进行对比,确定所述应用程序的窗口标识是否包含有预设标识;若所述应用程序对应的窗口标识不包含所述预设标识,说明终端设备在前台运行的应用程序不是所述目标应用程序,即所述终端设备处于第二应用状态。In this embodiment of the present disclosure, by comparing the window identifier of the application program with the preset identifier, it is determined whether the window identifier of the application program contains a preset identifier; if the window identifier corresponding to the application program does not Containing the preset identification indicates that the application program running in the foreground of the terminal device is not the target application program, that is, the terminal device is in the second application state.
可以理解的是,考虑到终端设备处于第二应用状态时,即使终端设备出现触控延迟,由于第二应用状态的跟手性要求较低,触控延迟也不会影响终端设备的显示效果。因而在终端设备处于第二应用状态时,可根据第一同步信号、第二同步信号的触发,分别启动对触控事件对应的至少一个第一类图层的应用绘制处理和图层合成处理。It can be understood that, considering that when the terminal device is in the second application state, even if a touch delay occurs on the terminal device, since the chirality requirements of the second application state are lower, the touch delay will not affect the display effect of the terminal device. Therefore, when the terminal device is in the second application state, the application drawing processing and layer synthesis processing of at least one first type layer corresponding to the touch event can be started respectively according to the triggering of the first synchronization signal and the second synchronization signal.
本公开实施例还提供一种显示图像的更新方法,如图2所示,图2是根据一示例性实施例示出的一种显示图像的更新方法的流程示意图二,所述方法包括:An embodiment of the present disclosure also provides a method for updating a display image, as shown in Figure 2. Figure 2 is a flowchart 2 of a method for updating a display image according to an exemplary embodiment. The method includes:
步骤S201,响应于针对所述显示界面上的任一应用程序的启动操作,获取所述应用程序对应的窗口标识;确定所述应用程序对应的窗口标识是否包括预设标识;若所述应用程序对应的窗口标识 包括预设标识,确定所述终端设备处于第一应用状态;Step S201: In response to the startup operation of any application program on the display interface, obtain the window identifier corresponding to the application program; determine whether the window identifier corresponding to the application program includes a preset identifier; if the application program The corresponding window identifier includes a preset identifier, confirming that the terminal device is in the first application state;
在本示例中,终端设备处于第一应用状态可为:终端设备处于手写笔应用场景。In this example, the terminal device being in the first application state may be: the terminal device is in a stylus application scenario.
可通过获取应用程序的窗口标识,确定所述应用程序的窗口标识是否包括手写笔应用对应的窗口标识,若所述应用程序的窗口标识包括手写笔应用对应的窗口标识,确定终端设备处于第一应用状态。By obtaining the window identification of the application program, it can be determined whether the window identification of the application program includes the window identification corresponding to the stylus application. If the window identification of the application program includes the window identification corresponding to the stylus application, it is determined that the terminal device is in the first Application status.
可以理解的是,由于手写笔应用场景的跟手性要求较高,而在Android操作系统中,在显示界面上显示一帧从手写笔绘图到屏幕显示的图像,需要约3个垂直同步信号的信号周期,即使终端设备的显示屏幕的频率刷新率为120Hz,手写笔应用场景下一帧图像的延迟也大约有24ms,严重降低用户的使用体验。It is understandable that due to the high chirality requirements of the stylus application scenario, in the Android operating system, displaying a frame of images from the stylus drawing to the screen display on the display interface requires about 3 vertical synchronization signals. Signal cycle, even if the frequency refresh rate of the display screen of the terminal device is 120Hz, the delay of the next frame of image in the stylus application scenario is about 24ms, seriously reducing the user experience.
步骤S202,检测到针对于显示界面的触控事件,若所述触控事件的类型指示所述触控事件为Down事件,基于检测到所述Down事件的检测时刻,对所述Down事件对应的至少一个第一类图层进行应用绘制处理;Step S202: A touch event for the display interface is detected. If the type of the touch event indicates that the touch event is a Down event, based on the detection time when the Down event is detected, the corresponding value of the Down event is At least one first-type layer performs application drawing processing;
在本示例中,当检测到触控事件,且终端设备处于手写笔应用场景,可先确定所述触控事件的类型,若触控事件的类型指示所述触控事件为Down事件,可在检测到所述Down事件的检测时刻,对所述Down事件产生的至少一个第一类图层进行应用绘制处理。In this example, when a touch event is detected and the terminal device is in a stylus application scenario, the type of the touch event can be determined first. If the type of the touch event indicates that the touch event is a Down event, the touch event can be At the detection moment when the Down event is detected, application drawing processing is performed on at least one first type layer generated by the Down event.
可以理解的是,一个触控事件序列是指从触控体触摸屏幕的那一刻开始,到触控体离开屏幕的那一刻结束的这个过程中所产生的一系列事件;一个触控事件序列是以Down事件开始,中间包含有至少一个Move事件,最终以Up事件结束。It can be understood that a touch event sequence refers to a series of events generated in the process starting from the moment the touch object touches the screen and ending at the moment the touch object leaves the screen; a touch event sequence is It starts with the Down event, contains at least one Move event in the middle, and finally ends with the Up event.
如图3所示,图3是相关技术示出的Down事件对应的图像帧的处理示意图。相关技术中,终端设备在检测到Down事件后,会在下一个第一同步信号的触发下,将Down事件产生的至少一个第一类图层传递给应用进行应用绘制处理。也就是,Down事件的应用绘制处理需要等待第一同步信号触发。这里,所述第一同步信号为Vsync-app信号。As shown in FIG. 3 , FIG. 3 is a schematic diagram of processing of image frames corresponding to the Down event shown in the related art. In the related technology, after detecting the Down event, the terminal device will transfer at least one first-type layer generated by the Down event to the application for application drawing processing when triggered by the next first synchronization signal. That is, the application drawing processing of the Down event needs to wait for the first synchronization signal to be triggered. Here, the first synchronization signal is a Vsync-app signal.
如图4所示,图4是根据一示例性实施例示出的一种Down事件对应的图像帧的处理示意图。本示例在检测到Down事件后,立刻启动对Down事件对应的至少一个第一类图层的应用绘制处理,不需要等到第一同步信号的触发,减少在应用绘制处理阶段的延迟情况。As shown in FIG. 4 , FIG. 4 is a schematic diagram of processing an image frame corresponding to a Down event according to an exemplary embodiment. In this example, after detecting the Down event, the application drawing processing of at least one first-type layer corresponding to the Down event is immediately started without waiting for the first synchronization signal to be triggered, thereby reducing the delay in the application drawing processing stage.
步骤S203,若所述触控事件的类型指示所述触控事件为Move事件,在产生下一个第一同步信号前的预设时刻,对所述Move事件对应的至少一个第一类图层进行应用绘制处理;其中,所述第一同步信号为触发应用绘制处理的系统垂直同步信号;Step S203: If the type of the touch event indicates that the touch event is a Move event, at a preset time before generating the next first synchronization signal, perform a step on at least one first type layer corresponding to the Move event. Application rendering processing; wherein the first synchronization signal is a system vertical synchronization signal that triggers application rendering processing;
在本示例中,当检测到触控事件,且终端设备处于手写笔应用场景时,若触控事件的类型指示所述触控事件为Move事件,可在产生下一个第一同步信号前的预设时刻,对所述Move事件产生的至少一个第一类图层进行应用绘制处理。In this example, when a touch event is detected and the terminal device is in a stylus application scenario, if the type of the touch event indicates that the touch event is a Move event, the preset time before generating the next first synchronization signal can be Assume that at a time, apply drawing processing is performed on at least one first-type layer generated by the Move event.
如图5所示,图5是相关技术示出的Move事件对应的图像帧的处理示意图。相关技术中,终端设备在检测到Move事件后,会在下一个第一同步信号的触发下,将Move事件产生的至少一个第一类图层传递给应用进行应用绘制处理;从而导致Move事件产生的至少一个第一类图层的应用绘 制处理和图层合成处理无法在一个第一同步信号的信号周期内完成。As shown in FIG. 5 , FIG. 5 is a schematic diagram of processing of image frames corresponding to the Move event shown in the related art. In the related technology, after detecting the Move event, the terminal device will, under the trigger of the next first synchronization signal, pass at least one first-type layer generated by the Move event to the application for application drawing processing; thus causing the Move event to generate The application drawing process and layer composition process of at least one first-type layer cannot be completed within a signal period of the first synchronization signal.
如图6所示,图6是根据一示例性实施例示出的一种Down事件对应的图像帧的处理示意图。本示例在检测到Move事件后,会在下一个第一同步信号产生前的预设时刻,对Move事件产生的至少一个第一类图层进行应用绘制处理,即提前启动对Move事件产生的至少一个第一类图层的应用绘制处理。As shown in FIG. 6 , FIG. 6 is a schematic diagram of processing an image frame corresponding to a Down event according to an exemplary embodiment. After detecting the Move event, this example will apply drawing processing to at least one first-type layer generated by the Move event at the preset time before the next first synchronization signal is generated, that is, start at least one layer generated by the Move event in advance. The first type of layer applies drawing processing.
这里,所述预设时刻可为2ms。Here, the preset time may be 2ms.
在一些实施例中,可获取对所述第一类图层进行应用绘制处理和图层合成处理所需的最大时长;基于所述最大时长和所述第一同步信号的信号周期之间的差值,确定所述预设时刻。In some embodiments, the maximum duration required to perform application drawing processing and layer synthesis processing on the first type of layer can be obtained; based on the difference between the maximum duration and the signal period of the first synchronization signal value to determine the preset time.
可以理解的是,基于所述最大时长和所述第一同步信号的信号周期之间的差值,确定提前对Move事件产生的至少一个第一类图层进行应用绘制处理的处理时间,从而使得Move事件产生的至少一个第一类图层的应用绘制处理和图层合成处理能够在一个第一同步信号的信号周期内完成。It can be understood that, based on the difference between the maximum duration and the signal period of the first synchronization signal, the processing time for applying drawing processing to at least one first type layer generated by the Move event is determined in advance, so that The application drawing processing and layer synthesis processing of at least one first-type layer generated by the Move event can be completed within a signal period of the first synchronization signal.
步骤S204,在所述至少一个第一类图层的应用绘制处理完成后,将应用绘制处理后的至少一个第一类图层写入图层合成缓存中;基于所述第一类图层的第一写入操作的触发,对所述图层合成缓存中的所述至少一个第一类图层进行图层合成处理,得到所述目标图像帧;Step S204: After the application drawing process of the at least one first type layer is completed, the at least one first type layer after the application drawing process is written into the layer composition cache; based on the first type layer When the first write operation is triggered, perform layer synthesis processing on the at least one first type layer in the layer synthesis cache to obtain the target image frame;
如图4和图6所示,本示例中在完成对第一类图层的应用绘制处理后,将应用绘制处理后的至少一个第一类图层传递给Surface Flinger,以便Surface Flinger在接收到第一类图层后立刻对第一类图层进行图层合成处理,得到目标图像帧。As shown in Figure 4 and Figure 6, in this example, after completing the application drawing process on the first type layer, at least one first type layer after applying the drawing process is passed to Surface Flinger, so that Surface Flinger receives Immediately after the first type of layer, layer synthesis processing is performed on the first type of layer to obtain the target image frame.
需要说明的是,如图3和图5所示,相关技术中Surface Flinger需要在第二同步信号(即Vsync-sf信号)的触发下,启动图层合成处理;而本示例中根据图层合成缓存的第一写入操作,触发对第一写入操作写入的第一类图层进行图层合成处理,从而实现在完成对第一类图层的应用绘制处理后,立马对第一类图像进行图层合成处理,减少图层合成处理阶段的延迟情况。It should be noted that, as shown in Figure 3 and Figure 5, in the related technology, Surface Flinger needs to start the layer synthesis process under the trigger of the second synchronization signal (ie, Vsync-sf signal); in this example, according to the layer synthesis The first write operation of the cache triggers layer synthesis processing on the first type of layer written by the first write operation, so that after completing the application drawing processing of the first type of layer, the first type of layer can be processed immediately. The image undergoes layer composition processing to reduce delays in the layer composition processing stage.
由图3和图4可知,相关技术中Down事件对应的图像帧的处理过程大约需要3-4个垂直同步信号的信号周期,而本示例中Down事件对应的图像帧的处理过程大约需要2-3个垂直同步信号的信号周期,降低约一个垂直同步信号的信号周期的时延。As can be seen from Figures 3 and 4, in the related art, the processing of the image frame corresponding to the Down event requires approximately 3-4 signal periods of the vertical synchronization signal, while in this example, the processing of the image frame corresponding to the Down event requires approximately 2- 3 signal periods of the vertical synchronization signal, reducing the delay by approximately one signal period of the vertical synchronization signal.
由图5和图6可知,相关技术中Move事件对应的图像帧的处理过程大约需要2个垂直同步信号的信号周期,而本示例中Down事件对应的图像帧的处理可在1个垂直同步信号的信号周期内完成,也降低约一个垂直同步信号的信号周期的时延。As can be seen from Figures 5 and 6, in the related art, the processing of the image frame corresponding to the Move event requires approximately two signal periods of the vertical synchronization signal, while in this example, the processing of the image frame corresponding to the Down event can be processed in one vertical synchronization signal. It is completed within the signal period, and also reduces the delay of about one signal period of the vertical synchronization signal.
在一些实施例中,基于第一同步信号的触发,对获取的至少一个第二类图层进行应用绘制处理,并将应用绘制处理后的至少一个第二类图层写入所述图层合成缓存;其中,所述第二类图层是由所述终端设备当前运行的应用程序的应用程序事件触发产生的;In some embodiments, based on the triggering of the first synchronization signal, apply drawing processing to the acquired at least one second type layer, and write the at least one second type layer after applying the drawing process into the layer composition. Caching; wherein the second type of layer is generated by an application event trigger of an application currently running on the terminal device;
基于所述第二类图像的第二写入操作前的一个第二同步信号的信号周期,确定所述一个第二同步信号的信号周期内是否存在对所述第一类图层的图层合成处理;所述第二同步信号为触发图层合成处理的系统垂直同步信号;Based on the signal period of a second synchronization signal before the second writing operation of the second type image, determine whether there is layer synthesis for the first type of layer within the signal period of the second synchronization signal. Processing; the second synchronization signal is a system vertical synchronization signal that triggers layer synthesis processing;
若存在对所述第一类图层的图层合成处理,在所述第二写入操作后的一个第二同步信号的信号 周期内,基于所述第一写入操作的触发,对所述图层合成缓存中的所述至少一个第一类图层和所述至少一个第二类图层进行图层合成处理,得到所述目标图像帧。If there is layer synthesis processing for the first type of layer, within a signal period of the second synchronization signal after the second writing operation, based on the triggering of the first writing operation, the The at least one first-type layer and the at least one second-type layer in the layer composition cache are subjected to layer composition processing to obtain the target image frame.
在本示例中,终端设备内包含有两种不同的垂直同步信号触发机制;一种是针对于终端设备在第一应用状态下产生的第一类图层;另一种是针对于终端设备产生的第二类图层。In this example, the terminal device contains two different vertical synchronization signal triggering mechanisms; one is for the first type of layer generated by the terminal device in the first application state; the other is for the first type of layer generated by the terminal device. The second type of layer.
当终端设备处于第一应用状态,且存在第一类图层和第二类图层一起进行图层合成时,以第一类图层对应的系统垂直同步信号触发机制为主,优先处理第一类图层的图层合成处理。When the terminal device is in the first application state, and there are first-type layers and second-type layers for layer synthesis, the system vertical synchronization signal triggering mechanism corresponding to the first-type layer is the main one, and the first-type layer is processed first. Layer composition processing of class layers.
当第二类图层完成应用绘制处理后,将所述第二类图层写入图层合成缓存中,并确定在上一个第二同步信号的信号周期内是否存在对第一类图层的图层合成处理,若上一个第二同步信号的信号周期内存在对第一类图层的图层合成处理,说明在对第二类图层进行图层合成处理的一个第二同步信号周期内,会有新的第一类图层写入图层合成缓存中。After the second type of layer completes the application drawing process, the second type of layer is written into the layer synthesis cache, and it is determined whether there is a request for the first type of layer in the last signal period of the second synchronization signal. Layer synthesis processing, if there is layer synthesis processing for the first type of layer in the last signal period of the second synchronization signal, it means that within a second synchronization signal period of layer synthesis processing for the second type of layer , a new first-type layer will be written into the layer composition cache.
基于此,为了降低屏幕出现卡顿的情况,可在第二写入操作后的一个第二同步信号周期内,即使第二同步信号到来,也先不对第二类图层进行图层合成处理,而是等到检测到第一写入操作时,在第一写入操作的触发下,对第一类图层和第二类图层一起进行图层合成处理。Based on this, in order to reduce screen freezes, within a second synchronization signal period after the second writing operation, even if the second synchronization signal arrives, the layer synthesis process of the second type of layer will not be performed first. Instead, it waits until the first writing operation is detected, and then performs layer synthesis processing on the first type of layer and the second type of layer together under the trigger of the first writing operation.
在另一些实施例中,若不存在对所述第一类图层的图层合成处理,基于下一个第二同步信号的触发,对所述图层合成缓存中的至少一个第二类图层进行图层合成处理,得到所述目标图像帧。In other embodiments, if there is no layer synthesis processing for the first type of layer, based on the triggering of the next second synchronization signal, at least one second type of layer in the layer buffer is synthesized. Perform layer synthesis processing to obtain the target image frame.
在本示例中,若上一个第二同步信号的信号周期内部存在对第一类图层的图层合成处理,说明在对第二类图层进行图层合成处理的一个第二同步信号周期内,不会有新的第一类图层写入图层合成缓存中,故可直接采用第二类图层对应的系统垂直同步信号的触发机制,即在第二同步信号的触发下,对第二类图层进行图层合成处理。In this example, if there is layer synthesis processing for the first type of layer within the last signal period of the second synchronization signal, it means that within a second synchronization signal period of layer synthesis processing for the second type of layer , no new first-type layer will be written into the layer synthesis cache, so the triggering mechanism of the system vertical synchronization signal corresponding to the second-type layer can be directly used, that is, under the trigger of the second synchronization signal, the third-type layer is The second type of layer is used for layer synthesis processing.
步骤S205,若所述应用程序对应的窗口标识不包括所述预设标识,确定所述终端设备处于第二应用状态;检测到针对于所述显示界面的触控事件,且所述终端设备处于所述第二应用状态时,基于第一同步信号的触发,对所述触控事件对应的至少一个第一类图层进行应用绘制处理;基于第二同步信号的触发,对应用绘制处理后的至少一个第一类图层进行图层合成处理,得到目标图像帧;Step S205: If the window identifier corresponding to the application program does not include the preset identifier, it is determined that the terminal device is in the second application state; a touch event for the display interface is detected, and the terminal device is in In the second application state, based on the triggering of the first synchronization signal, application drawing processing is performed on at least one first type layer corresponding to the touch event; based on the triggering of the second synchronization signal, application drawing processing is performed on the At least one first-type layer performs layer synthesis processing to obtain the target image frame;
在本示例中,终端设备处于第二应用状态可为:终端设备不处于手写笔应用场景。In this example, the terminal device being in the second application state may be: the terminal device is not in a stylus application scenario.
可以理解的是,在Android操作系统中,虽然在显示界面上显示一帧从手写笔绘图到屏幕显示的图像,需要约3个垂直同步信号的信号周期,但终端设备所处的应用场景跟手性要求不高,即使存在延迟,也不会影响到终端设备的显示效果;故在终端设备处于第二应用状态时,可基于第一同步信号、第二同步信号的触发,分别执行应用绘制处理和图层合成处理。It is understandable that in the Android operating system, although it takes about 3 signal cycles of the vertical synchronization signal to display a frame of image from stylus drawing to screen display on the display interface, the application scenario of the terminal device is different from that of the handheld device. The performance requirements are not high, and even if there is a delay, it will not affect the display effect of the terminal device; therefore, when the terminal device is in the second application state, the application drawing processing can be executed respectively based on the triggering of the first synchronization signal and the second synchronization signal. and layer compositing.
步骤S206,基于所述目标图像帧,对所述显示界面的显示图像进行更新。Step S206: Update the display image of the display interface based on the target image frame.
在本示例中,得到合成后的目标图像帧后,在第三同步信号的触发下,将所述目标图像帧刷新显示在终端设备的显示界面上。In this example, after the synthesized target image frame is obtained, the target image frame is refreshed and displayed on the display interface of the terminal device under the trigger of the third synchronization signal.
本公开实施例还提供一种显示图像的更新装置。图7是根据一示例性实施例示出的一种显示图像的更新装置的结构示意图,如图7所示,所述装置应用于终端设备,所述装置100包括:An embodiment of the present disclosure also provides an updating device for displaying images. Figure 7 is a schematic structural diagram of a device for updating a display image according to an exemplary embodiment. As shown in Figure 7, the device is applied to a terminal device. The device 100 includes:
第一处理模块101,被配置为检测到针对于显示界面的触控事件,且所述终端设备处于第一应 用状态时,基于所述触控事件的类型和所述类型对应的应用绘制处理的目标触发时刻,对所述触控事件对应的至少一个第一类图层进行应用绘制处理;The first processing module 101 is configured to detect a touch event for the display interface, and when the terminal device is in the first application state, draw the processing based on the type of the touch event and the application corresponding to the type. At the target trigger moment, apply drawing processing to at least one first-type layer corresponding to the touch event;
第二处理模块102,被配置为在所述至少一个第一类图层的应用绘制处理完成后,触发对所述至少一个第一类图层的图层合成处理,得到目标图像帧;The second processing module 102 is configured to trigger layer synthesis processing on the at least one first-type layer after the application drawing process of the at least one first-type layer is completed to obtain a target image frame;
更新模块103,被配置为基于所述目标图像帧,对所述显示界面的显示图像进行更新。The update module 103 is configured to update the display image of the display interface based on the target image frame.
在一些实施例中,所述第一处理模块101,被配置为:In some embodiments, the first processing module 101 is configured as:
若所述触控事件的类型指示所述触控事件为点击事件,基于检测到所述点击事件的检测时刻,对所述点击事件对应的至少一个第一类图层进行应用绘制处理。If the type of the touch event indicates that the touch event is a click event, based on the detection time when the click event is detected, an application drawing process is performed on at least one first type layer corresponding to the click event.
在一些实施例中,所述第一处理模块101,被配置为:In some embodiments, the first processing module 101 is configured as:
若所述触控事件的类型指示所述触控事件为滑动事件,在产生下一个第一同步信号前的预设时刻,对所述滑动事件对应的至少一个第一类图层进行应用绘制处理;其中,所述第一同步信号为触发应用绘制处理的系统垂直同步信号。If the type of the touch event indicates that the touch event is a sliding event, at a preset time before generating the next first synchronization signal, apply drawing processing to at least one first type layer corresponding to the sliding event. ; Wherein, the first synchronization signal is a system vertical synchronization signal that triggers application drawing processing.
在一些实施例中,所述第一处理模块101,被配置为:In some embodiments, the first processing module 101 is configured as:
获取对所述第一类图层进行应用绘制处理和图层合成处理所需的最大时长;Obtain the maximum time required to apply drawing processing and layer composition processing to the first type of layer;
基于所述最大时长和所述第一同步信号的信号周期之间的差值,确定所述预设时刻。The preset time is determined based on the difference between the maximum duration and the signal period of the first synchronization signal.
在一些实施例中,所述第二处理模块102,被配置为:In some embodiments, the second processing module 102 is configured to:
在所述至少一个第一类图层的应用绘制处理完成后,将应用绘制处理后的至少一个第一类图层写入图层合成缓存中;After the application drawing process of the at least one first type layer is completed, writing the at least one first type layer after the application drawing process into the layer composition cache;
基于所述第一类图层的第一写入操作的触发,对所述图层合成缓存中的所述至少一个第一类图层进行图层合成处理,得到所述目标图像帧。Based on the triggering of the first write operation of the first type layer, layer synthesis processing is performed on the at least one first type layer in the layer synthesis cache to obtain the target image frame.
在一些实施例中,所述第一处理模块101,被配置为:In some embodiments, the first processing module 101 is configured as:
基于第一同步信号的触发,对获取的至少一个第二类图层进行应用绘制处理,并将应用绘制处理后的至少一个第二类图层写入所述图层合成缓存;其中,所述第二类图层是由所述终端设备当前运行的应用程序的应用程序事件触发产生的;Based on the triggering of the first synchronization signal, apply drawing processing to the acquired at least one second type layer, and write the at least one second type layer after applying the drawing process into the layer synthesis cache; wherein, the The second type of layer is generated by application event triggering of the application currently running on the terminal device;
基于所述第二类图像的第二写入操作前的一个第二同步信号的信号周期,确定所述一个第二同步信号的信号周期内是否存在对所述第一类图层的图层合成处理;所述第二同步信号为触发图层合成处理的系统垂直同步信号;Based on the signal period of a second synchronization signal before the second writing operation of the second type image, determine whether there is layer synthesis for the first type of layer within the signal period of the second synchronization signal. Processing; the second synchronization signal is a system vertical synchronization signal that triggers layer synthesis processing;
所述第二处理模块102,被配置为:The second processing module 102 is configured as:
若存在对所述第一类图层的图层合成处理,在所述第二写入操作后的一个第二同步信号的信号周期内,基于所述第一写入操作的触发,对所述图层合成缓存中的所述至少一个第一类图层和所述至少一个第二类图层进行图层合成处理,得到所述目标图像帧。If there is layer synthesis processing for the first type of layer, within a signal period of the second synchronization signal after the second writing operation, based on the triggering of the first writing operation, the The at least one first-type layer and the at least one second-type layer in the layer composition cache are subjected to layer composition processing to obtain the target image frame.
在一些实施例中,所述第二处理模块102,被配置为:In some embodiments, the second processing module 102 is configured to:
若不存在对所述第一类图层的图层合成处理,基于下一个第二同步信号的触发,对所述图层合成缓存中的至少一个第二类图层进行图层合成处理,得到所述目标图像帧。If there is no layer synthesis processing for the first type of layer, based on the trigger of the next second synchronization signal, layer synthesis processing is performed on at least one second type of layer in the layer synthesis cache to obtain The target image frame.
在一些实施例中,所述第一处理模块101,被配置为:In some embodiments, the first processing module 101 is configured as:
响应于针对所述显示界面上的任一应用程序的启动操作,获取所述应用程序对应的窗口标识;In response to a startup operation for any application program on the display interface, obtain the window identifier corresponding to the application program;
确定所述应用程序对应的窗口标识是否包括预设标识;Determine whether the window identifier corresponding to the application program includes a preset identifier;
若所述应用程序对应的窗口标识包括预设标识,确定所述终端设备处于第一应用状态,并获取由所述触控事件产生的至少一个第一类图层。If the window identifier corresponding to the application program includes a preset identifier, it is determined that the terminal device is in the first application state, and at least one first type layer generated by the touch event is obtained.
在一些实施例中,所述第一处理模块101,被配置为:In some embodiments, the first processing module 101 is configured as:
若所述应用程序对应的窗口标识不包括所述预设标识,确定所述终端设备处于第二应用状态;If the window identifier corresponding to the application program does not include the preset identifier, it is determined that the terminal device is in the second application state;
检测到针对于所述显示界面的触控事件,且所述终端设备处于所述第二应用状态时,基于第一同步信号的触发,对所述触控事件对应的至少一个第一类图层进行应用绘制处理;When a touch event for the display interface is detected and the terminal device is in the second application state, based on the triggering of the first synchronization signal, at least one first type layer corresponding to the touch event is Perform application drawing processing;
所述第二处理模块102,被配置为:The second processing module 102 is configured as:
基于第二同步信号的触发,对应用绘制处理后的至少一个第一类图层进行图层合成处理。Based on the triggering of the second synchronization signal, a layer synthesis process is performed on at least one first type layer after applying the drawing process.
图8是根据一示例性实施例示出的一种终端设备的框图。例如,终端设备800可以是移动电话,移动电脑等。Figure 8 is a block diagram of a terminal device according to an exemplary embodiment. For example, the terminal device 800 may be a mobile phone, a mobile computer, etc.
参照图8,终端设备800可以包括以下一个或多个组件:处理组件802,存储器804,电源组件806,多媒体组件808,音频组件810,输入/输出(I/O)的接口812,传感器组件814,以及通信组件816。Referring to FIG. 8 , the terminal device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power supply component 806 , a multimedia component 808 , an audio component 810 , an input/output (I/O) interface 812 , and a sensor component 814 , and communication component 816.
处理组件802通常控制终端设备800的整体操作,诸如与显示,电话呼叫,数据通信,相机操作和记录操作相关联的操作。处理组件802可以包括一个或多个处理器820来执行指令,以完成上述的方法的全部或部分步骤。此外,处理组件802可以包括一个或多个模块,便于处理组件802和其他组件之间的交互。例如,处理组件802可以包括多媒体模块,以方便多媒体组件808和处理组件802之间的交互。The processing component 802 generally controls the overall operations of the terminal device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above method. Additionally, processing component 802 may include one or more modules that facilitate interaction between processing component 802 and other components. For example, processing component 802 may include a multimedia module to facilitate interaction between multimedia component 808 and processing component 802.
存储器804被配置为存储各种类型的数据以支持在设备800的操作。这些数据的示例包括用于在终端设备800上操作的任何应用程序或方法的指令,联系人数据,电话簿数据,消息,图片,视频等。存储器804可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。 Memory 804 is configured to store various types of data to support operations at device 800 . Examples of such data include instructions for any application or method operating on the terminal device 800, contact data, phonebook data, messages, pictures, videos, etc. Memory 804 may be implemented by any type of volatile or non-volatile storage device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EEPROM), Programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk.
电源组件806为终端设备800的各种组件提供电力。电源组件806可以包括电源管理系统,一个或多个电源,及其他与为终端设备800生成、管理和分配电力相关联的组件。 Power supply component 806 provides power to various components of terminal device 800 . Power supply components 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to end device 800 .
多媒体组件808包括在所述终端设备800和用户之间的提供一个输出接口的屏幕。在一些实施例中,屏幕可以包括液晶显示器(LCD)和触摸面板(TP)。如果屏幕包括触摸面板,屏幕可以被实现为触摸屏,以接收来自用户的输入信号。触摸面板包括一个或多个触摸传感器以感测触摸、滑动和触摸面板上的手势。所述触摸传感器可以不仅感测触摸或滑动动作的边界,而且还检测与所述触摸或滑动操作相关的持续时间和压力。在一些实施例中,多媒体组件808包括一个前置摄像头和/或后置摄像头。当设备800处于操作模式,如拍摄模式或视频模式时,前置摄像头和/或后置摄像头可 以接收外部的多媒体数据。每个前置摄像头和后置摄像头可以是一个固定的光学透镜系统或具有焦距和光学变焦能力。 Multimedia component 808 includes a screen providing an output interface between the terminal device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide action. In some embodiments, multimedia component 808 includes a front-facing camera and/or a rear-facing camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and/or the rear camera can receive external multimedia data. Each front-facing camera and rear-facing camera can be a fixed optical lens system or have a focal length and optical zoom capabilities.
音频组件810被配置为输出和/或输入音频信号。例如,音频组件810包括一个麦克风(MIC),当终端设备800处于操作模式,如呼叫模式、记录模式和语音识别模式时,麦克风被配置为接收外部音频信号。所接收的音频信号可以被进一步存储在存储器804或经由通信组件816发送。在一些实施例中,音频组件810还包括一个扬声器,用于输出音频信号。 Audio component 810 is configured to output and/or input audio signals. For example, the audio component 810 includes a microphone (MIC) configured to receive external audio signals when the terminal device 800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal may be further stored in memory 804 or sent via communication component 816 . In some embodiments, audio component 810 also includes a speaker for outputting audio signals.
I/O接口812为处理组件802和外围接口模块之间提供接口,上述外围接口模块可以是键盘,点击轮,按钮等。这些按钮可包括但不限于:主页按钮、音量按钮、启动按钮和锁定按钮。The I/O interface 812 provides an interface between the processing component 802 and a peripheral interface module, which may be a keyboard, a click wheel, a button, etc. These buttons may include, but are not limited to: Home button, Volume buttons, Start button, and Lock button.
传感器组件814包括一个或多个传感器,用于为终端设备800提供各个方面的状态评估。例如,传感器组件814可以检测到设备800的打开/关闭状态,组件的相对定位,例如所述组件为终端设备800的显示器和小键盘,传感器组件814还可以检测终端设备800或终端设备800一个组件的位置改变,用户与终端设备800接触的存在或不存在,终端设备800方位或加速/减速和终端设备800的温度变化。传感器组件814可以包括接近传感器,被配置用来在没有任何的物理接触时检测附近物体的存在。传感器组件814还可以包括光传感器,如CMOS或CCD图像传感器,用于在成像应用中使用。在一些实施例中,该传感器组件814还可以包括加速度传感器,陀螺仪传感器,磁传感器,压力传感器或温度传感器。 Sensor component 814 includes one or more sensors for providing various aspects of status assessment for terminal device 800 . For example, the sensor component 814 can detect the open/closed state of the device 800 and the relative positioning of components, such as the display and keypad of the terminal device 800. The sensor component 814 can also detect the terminal device 800 or a component of the terminal device 800. position changes, presence or absence of user contact with the terminal device 800 , orientation or acceleration/deceleration of the terminal device 800 and temperature changes of the terminal device 800 . Sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor component 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
通信组件816被配置为便于终端设备800和其他设备之间有线或无线方式的通信。终端设备800可以接入基于通信标准的无线网络,如Wi-Fi,4G或5G,或它们的组合。在一个示例性实施例中,通信组件816经由广播信道接收来自外部广播管理系统的广播信号或广播相关信息。在一个示例性实施例中,所述通信组件816还包括近场通信(NFC)模块,以促进短程通信。例如,在NFC模块可基于射频识别(RFID)技术,红外数据协会(IrDA)技术,超宽带(UWB)技术,蓝牙(BT)技术和其他技术来实现。The communication component 816 is configured to facilitate wired or wireless communication between the terminal device 800 and other devices. The terminal device 800 can access a wireless network based on a communication standard, such as Wi-Fi, 4G or 5G, or a combination thereof. In one exemplary embodiment, the communication component 816 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, the communications component 816 also includes a near field communications (NFC) module to facilitate short-range communications. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
在示例性实施例中,终端设备800可以被一个或多个应用专用集成电路(ASIC)、数字信号处理器(DSP)、数字信号处理设备(DSPD)、可编程逻辑器件(PLD)、现场可编程门阵列(FPGA)、控制器、微控制器、微处理器或其他电子元件实现,用于执行上述方法。In an exemplary embodiment, the terminal device 800 may be configured by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable A programmable gate array (FPGA), controller, microcontroller, microprocessor or other electronic component implementation is used to perform the above method.
在示例性实施例中,还提供了一种包括指令的非临时性计算机可读存储介质,例如包括指令的存储器804,上述指令可由终端设备800的处理器820执行以完成上述方法。例如,所述非临时性计算机可读存储介质可以是ROM、随机存取存储器(RAM)、CD-ROM、磁带、软盘和光数据存储设备等。In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions, such as a memory 804 including instructions, which can be executed by the processor 820 of the terminal device 800 to complete the above method is also provided. For example, the non-transitory computer-readable storage medium may be ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
本领域技术人员在考虑说明书及实践这里公开的发明后,将容易想到本发明的其它实施方案。本公开旨在涵盖本发明的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本发明的一般性原理并包括本公开未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本发明的真正范围和精神由下面的权利要求指出。Other embodiments of the invention will be readily apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. The present disclosure is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common common sense or customary technical means in the technical field that are not disclosed in the present disclosure. . It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims.
应当理解的是,本发明并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱 离其范围进行各种修改和改变。本发明的范围仅由所附的权利要求来限制。It is to be understood that the present invention is not limited to the precise construction described above and illustrated in the accompanying drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the invention is limited only by the appended claims.

Claims (12)

  1. 一种显示图像的更新方法,应用于终端设备,其中,所述方法,包括:A method for updating display images, applied to terminal equipment, wherein the method includes:
    检测到针对于显示界面的触控事件,且所述终端设备处于第一应用状态时,基于所述触控事件的类型和所述类型对应的应用绘制处理的目标触发时刻,对所述触控事件对应的至少一个第一类图层进行应用绘制处理;When a touch event for the display interface is detected and the terminal device is in the first application state, based on the type of the touch event and the target trigger time of the application drawing process corresponding to the type, the touch event is At least one first-type layer corresponding to the event is applied for drawing processing;
    在所述至少一个第一类图层的应用绘制处理完成后,触发对所述至少一个第一类图层的图层合成处理,得到目标图像帧;After the application drawing process of the at least one first type layer is completed, trigger the layer synthesis process of the at least one first type layer to obtain the target image frame;
    基于所述目标图像帧,对所述显示界面的显示图像进行更新。Based on the target image frame, the display image of the display interface is updated.
  2. 根据权利要求1所述的方法,其中,所述基于所述触控事件的类型和所述类型对应的应用绘制处理的目标触发时刻,对所述触控事件对应的至少一个第一类图层进行应用绘制处理,包括:The method according to claim 1, wherein, based on the type of the touch event and the target trigger time of the application drawing process corresponding to the type, at least one first type layer corresponding to the touch event is Perform application drawing processing, including:
    若所述触控事件的类型指示所述触控事件为点击事件,基于检测到所述点击事件的检测时刻,对所述点击事件对应的至少一个第一类图层进行应用绘制处理。If the type of the touch event indicates that the touch event is a click event, based on the detection time when the click event is detected, an application drawing process is performed on at least one first type layer corresponding to the click event.
  3. 根据权利要求1所述的方法,其中,所述基于所述触控事件的类型和所述触控事件的类型对应的应用绘制处理的目标触发时刻,对所述触控事件对应的至少一个第一类图层进行应用绘制处理,包括:The method of claim 1 , wherein the at least one first trigger moment corresponding to the touch event is determined based on the type of the touch event and the target triggering moment of the application drawing process corresponding to the type of the touch event. A type of layer performs application drawing processing, including:
    若所述触控事件的类型指示所述触控事件为滑动事件,在产生下一个第一同步信号前的预设时刻,对所述滑动事件对应的至少一个第一类图层进行应用绘制处理;其中,所述第一同步信号为触发应用绘制处理的系统垂直同步信号。If the type of the touch event indicates that the touch event is a sliding event, at a preset time before generating the next first synchronization signal, apply drawing processing to at least one first type layer corresponding to the sliding event. ; Wherein, the first synchronization signal is a system vertical synchronization signal that triggers application drawing processing.
  4. 根据权利要求3所述的方法,其中,所述方法还包括:The method of claim 3, further comprising:
    获取对所述第一类图层进行应用绘制处理和图层合成处理所需的最大时长;Obtain the maximum time required to apply drawing processing and layer composition processing to the first type of layer;
    基于所述最大时长和所述第一同步信号的信号周期之间的差值,确定所述预设时刻。The preset time is determined based on the difference between the maximum duration and the signal period of the first synchronization signal.
  5. 根据权利要求1所述的方法,其中,所述在所述至少一个第一类图层的应用绘制处理完成后,触发对所述至少一个第一类图层的图层合成处理,得到目标图像帧,包括:The method according to claim 1, wherein after the application drawing process of the at least one first type layer is completed, the layer synthesis process of the at least one first type layer is triggered to obtain the target image. frames, including:
    在所述至少一个第一类图层的应用绘制处理完成后,将应用绘制处理后的至少一个第一类图层写入图层合成缓存中;After the application drawing process of the at least one first type layer is completed, writing the at least one first type layer after the application drawing process into the layer composition cache;
    基于所述第一类图层的第一写入操作的触发,对所述图层合成缓存中的所述至少一个第一类图层进行图层合成处理,得到所述目标图像帧。Based on the triggering of the first write operation of the first type layer, layer synthesis processing is performed on the at least one first type layer in the layer synthesis cache to obtain the target image frame.
  6. 根据权利要求5所述的方法,其中,所述方法还包括:The method of claim 5, further comprising:
    基于第一同步信号的触发,对获取的至少一个第二类图层进行应用绘制处理,并将应用绘制处理后的至少一个第二类图层写入所述图层合成缓存;其中,所述第二类图层是由所述终端设备当前运行的应用程序的应用程序事件触发产生的;Based on the triggering of the first synchronization signal, apply drawing processing to the acquired at least one second type layer, and write the at least one second type layer after applying the drawing process into the layer synthesis cache; wherein, the The second type of layer is generated by application event triggering of the application currently running on the terminal device;
    基于所述第二类图像的第二写入操作前的一个第二同步信号的信号周期,确定所述一个第二同步信号的信号周期内是否存在对所述第一类图层的图层合成处理;所述第二同步信号为触发图层合 成处理的系统垂直同步信号;Based on the signal period of a second synchronization signal before the second writing operation of the second type image, determine whether there is layer synthesis for the first type of layer within the signal period of the second synchronization signal. Processing; the second synchronization signal is a system vertical synchronization signal that triggers layer synthesis processing;
    所述基于所述第一类图层的第一写入操作的触发,对所述图层合成缓存中的所述至少一个第一类图层进行图层合成处理,得到所述目标图像帧,包括:performing layer synthesis processing on the at least one first type layer in the layer synthesis cache based on the triggering of the first write operation of the first type layer to obtain the target image frame, include:
    若存在对所述第一类图层的图层合成处理,在所述第二写入操作后的一个第二同步信号的信号周期内,基于所述第一写入操作的触发,对所述图层合成缓存中的所述至少一个第一类图层和所述至少一个第二类图层进行图层合成处理,得到所述目标图像帧。If there is layer synthesis processing for the first type of layer, within a signal period of the second synchronization signal after the second writing operation, based on the triggering of the first writing operation, the The at least one first-type layer and the at least one second-type layer in the layer composition cache are subjected to layer composition processing to obtain the target image frame.
  7. 根据权利要求6所述的方法,其中,所述方法还包括:The method of claim 6, further comprising:
    若不存在对所述第一类图层的图层合成处理,基于下一个第二同步信号的触发,对所述图层合成缓存中的至少一个第二类图层进行图层合成处理,得到所述目标图像帧。If there is no layer synthesis processing for the first type of layer, based on the trigger of the next second synchronization signal, layer synthesis processing is performed on at least one second type of layer in the layer synthesis cache to obtain The target image frame.
  8. 根据权利要求1所述的方法,其中,在基于所述触控事件的类型和所述类型对应的应用绘制处理的目标触发时刻,对所述触控事件对应的至少一个第一类图层进行应用绘制处理之前,所述方法还包括:The method of claim 1, wherein at least one first type layer corresponding to the touch event is processed at a target triggering moment based on the type of the touch event and the application drawing process corresponding to the type. Before applying the drawing process, the method further includes:
    响应于针对所述显示界面上的任一应用程序的启动操作,获取所述应用程序对应的窗口标识;In response to a startup operation for any application program on the display interface, obtain the window identifier corresponding to the application program;
    确定所述应用程序对应的窗口标识是否包括预设标识;Determine whether the window identifier corresponding to the application program includes a preset identifier;
    若所述应用程序对应的窗口标识包括预设标识,确定所述终端设备处于第一应用状态,并获取由所述触控事件产生的至少一个第一类图层。If the window identifier corresponding to the application program includes a preset identifier, it is determined that the terminal device is in the first application state, and at least one first type layer generated by the touch event is obtained.
  9. 根据权利要求8所述的方法,其中,所述方法还包括:The method of claim 8, further comprising:
    若所述应用程序对应的窗口标识不包括所述预设标识,确定所述终端设备处于第二应用状态;If the window identifier corresponding to the application program does not include the preset identifier, it is determined that the terminal device is in the second application state;
    检测到针对于所述显示界面的触控事件,且所述终端设备处于所述第二应用状态时,基于第一同步信号的触发,对所述触控事件对应的至少一个第一类图层进行应用绘制处理;When a touch event for the display interface is detected and the terminal device is in the second application state, based on the triggering of the first synchronization signal, at least one first type layer corresponding to the touch event is Perform application drawing processing;
    基于第二同步信号的触发,对应用绘制处理后的至少一个第一类图层进行图层合成处理。Based on the triggering of the second synchronization signal, a layer synthesis process is performed on at least one first type layer after applying the drawing process.
  10. 一种显示图像的更新装置,应用于终端设备,其中,包括:An update device for displaying images, applied to terminal equipment, including:
    第一处理模块,被配置为检测到针对于显示界面的触控事件,且所述终端设备处于第一应用状态时,基于所述触控事件的类型和所述类型对应的应用绘制处理的目标触发时刻,对所述触控事件对应的至少一个第一类图层进行应用绘制处理;A first processing module configured to detect a touch event for the display interface, and when the terminal device is in the first application state, draw a processing target based on the type of the touch event and the application corresponding to the type. At the triggering moment, apply drawing processing to at least one first-type layer corresponding to the touch event;
    第二处理模块,被配置为在所述至少一个第一类图层的应用绘制处理完成后,触发对所述至少一个第一类图层的图层合成处理,得到目标图像帧;The second processing module is configured to trigger layer synthesis processing on the at least one first-type layer after the application drawing process of the at least one first-type layer is completed to obtain a target image frame;
    更新模块,被配置为基于所述目标图像帧,对所述显示界面的显示图像进行更新。An update module configured to update the display image of the display interface based on the target image frame.
  11. 一种显示图像的更新装置,其中,包括:An update device for displaying images, which includes:
    处理器;processor;
    配置为存储可执行指令的存储器;memory configured to store executable instructions;
    其中,所述处理器被配置为:执行所述存储器中存储的可执行指令时,实现权利要求1至9中任一项所述的显示图像的更新方法。Wherein, the processor is configured to implement the display image updating method according to any one of claims 1 to 9 when executing executable instructions stored in the memory.
  12. 一种非临时性计算机可读存储介质,当所述存储介质中的指令由显示图像的更新装置的处 理器执行时,使得所述显示图像的更新装置能够执行权利要求1至9中任一项所述的显示图像的更新方法。A non-transitory computer-readable storage medium that, when instructions in the storage medium are executed by a processor of an update device that displays an image, enables the update device that displays an image to perform any one of claims 1 to 9 The method for updating display images.
PCT/CN2022/092232 2022-05-11 2022-05-11 Display image updating method and apparatus and storage medium WO2023216146A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2022/092232 WO2023216146A1 (en) 2022-05-11 2022-05-11 Display image updating method and apparatus and storage medium
CN202280004257.7A CN117396835A (en) 2022-05-11 2022-05-11 Display image updating method, device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2022/092232 WO2023216146A1 (en) 2022-05-11 2022-05-11 Display image updating method and apparatus and storage medium

Publications (1)

Publication Number Publication Date
WO2023216146A1 true WO2023216146A1 (en) 2023-11-16

Family

ID=88729327

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/092232 WO2023216146A1 (en) 2022-05-11 2022-05-11 Display image updating method and apparatus and storage medium

Country Status (2)

Country Link
CN (1) CN117396835A (en)
WO (1) WO2023216146A1 (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011095566A (en) * 2009-10-30 2011-05-12 Yamaha Corp Method for controlling image processor, and program
US20160335737A1 (en) * 2015-05-14 2016-11-17 Qualcomm Innovation Center, Inc. Vsync aligned cpu frequency governor sampling
CN107273130A (en) * 2017-06-20 2017-10-20 深圳市万普拉斯科技有限公司 Method, device and the terminal for accelerating interface to draw
CN107533450A (en) * 2016-03-08 2018-01-02 华为技术有限公司 A kind of display methods and terminal device
CN110503708A (en) * 2019-07-03 2019-11-26 华为技术有限公司 A kind of image processing method and electronic equipment based on vertical synchronizing signal
CN113721785A (en) * 2021-07-07 2021-11-30 荣耀终端有限公司 Method for adjusting sampling rate of touch screen and electronic equipment
CN113986002A (en) * 2021-12-31 2022-01-28 荣耀终端有限公司 Frame processing method, device and storage medium
CN114089933A (en) * 2021-06-09 2022-02-25 荣耀终端有限公司 Display parameter adjusting method, electronic device, chip and readable storage medium
CN114327697A (en) * 2020-09-30 2022-04-12 华为技术有限公司 Event processing method and device

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011095566A (en) * 2009-10-30 2011-05-12 Yamaha Corp Method for controlling image processor, and program
US20160335737A1 (en) * 2015-05-14 2016-11-17 Qualcomm Innovation Center, Inc. Vsync aligned cpu frequency governor sampling
CN107533450A (en) * 2016-03-08 2018-01-02 华为技术有限公司 A kind of display methods and terminal device
CN107273130A (en) * 2017-06-20 2017-10-20 深圳市万普拉斯科技有限公司 Method, device and the terminal for accelerating interface to draw
CN110503708A (en) * 2019-07-03 2019-11-26 华为技术有限公司 A kind of image processing method and electronic equipment based on vertical synchronizing signal
CN114327697A (en) * 2020-09-30 2022-04-12 华为技术有限公司 Event processing method and device
CN114089933A (en) * 2021-06-09 2022-02-25 荣耀终端有限公司 Display parameter adjusting method, electronic device, chip and readable storage medium
CN113721785A (en) * 2021-07-07 2021-11-30 荣耀终端有限公司 Method for adjusting sampling rate of touch screen and electronic equipment
CN113986002A (en) * 2021-12-31 2022-01-28 荣耀终端有限公司 Frame processing method, device and storage medium

Also Published As

Publication number Publication date
CN117396835A (en) 2024-01-12

Similar Documents

Publication Publication Date Title
EP3382520B1 (en) Method and apparatus for operating a display of a mobile terminal
US11183153B1 (en) Image display method and device, electronic device, and storage medium
EP3010226B1 (en) Method and apparatus for obtaining photograph
EP3242204B1 (en) Method and device for multi-task management
CN107330868A (en) image processing method and device
WO2017054354A1 (en) Information processing method and device
US20150194131A1 (en) Image data output control method and electronic device supporting the same
WO2018219197A1 (en) Optical image stabilization control method, mobile terminal, and computer readable storage medium
WO2016065820A1 (en) Memory optimization method and device
CN105930213A (en) Application running method and apparatus
CN108829475B (en) UI drawing method, device and storage medium
WO2017181544A1 (en) Method and device for managing task of instant messaging application
WO2018219210A1 (en) Image stabilization stroke adjustment method, mobile device, and computer storage medium
US20210096734A1 (en) Method and device for managing information
CN112835501A (en) Display method and electronic equipment
CN113703937A (en) Animation switching method and device and storage medium
WO2023216146A1 (en) Display image updating method and apparatus and storage medium
WO2019020008A1 (en) Missed call prompt method, and mobile terminal
CN111880602B (en) Dropped frame detection method and device
US10002589B2 (en) Retaining user selected screen area on user equipment
CN105975188B (en) Picture position adjusting method and device
EP3820154A1 (en) Method and apparatus for implementing osd
US9740524B2 (en) Method and terminal device for executing application chain
US11768592B1 (en) Method and apparatus for resizing window, electronic device, and readable storage medium
US11733863B2 (en) Display data obtaining method, electronic device and 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: 22941104

Country of ref document: EP

Kind code of ref document: A1