Display method and device, chip system, storage medium and program product
By acquiring interface composition information and calculating motion effect speed, the system identifies and processes animation effects, solving the problem of inaccurate recognition caused by changes in the position of animation effect code. This achieves efficient and accurate display of animation effects, improving the user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2026-04-07
AI Technical Summary
When using instrumentation methods to identify animation effects in existing technologies, it is difficult to accurately identify changes in the position of the animation effect code, resulting in discontinuous animation display and affecting user experience.
By acquiring interface composition information, determining the target parent layer when layer attributes change, setting motion effect markers, calculating motion effect speed, updating layer snapshots, identifying and processing animation effects, without depending on the specific location of the animation effect code.
It improves the accuracy and efficiency of animation effect recognition, ensures the normal display of animation effects, maintains the continuity and visual appeal of animation, and enhances the user experience.
Smart Images

Figure CN121807418A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of image processing, and in particular, to a display method, device, chip system, storage medium and program product. BACKGROUND
[0002] In order to improve user experience, electronic devices usually set animation effects in a graphical user interface (GUI), and the animation effects can be composed of multiple consecutive image frames to achieve smooth visual transition. For example, when an application switches from one activity to another, a layer-level animation effect can be used to achieve smooth transition. In the prior art, a method of inserting a plug-in is used to identify the animation effect, and the method of inserting a plug-in usually relies on inserting additional code in the program to identify the animation effect. The inventors have found in the implementation of the embodiments of the present application that in some scenarios, the method of inserting a plug-in used in the prior art to identify the animation effect has limitations. For example, when the code position for implementing the animation effect (such as a layer-level animation effect) changes, the original plug-in position can no longer be effective, resulting in inaccurate identification of the animation effect, which in turn affects its normal display. SUMMARY
[0003] Embodiments of the present application provide a display method, device, chip system, storage medium and program product, which do not depend on the specific position of the animation effect code, improve the universality of identifying the animation effect, can accurately and efficiently identify the animation effect, and in turn can ensure the normal display of the animation effect.
[0004] The first aspect provides a display method applied to an electronic device, the method comprising: obtaining interface composition information; when a preset layer attribute of a layer in the interface composition information is updated, determining that the layer is a target parent layer; setting an animation effect mark for a child layer of the target parent layer; updating a layer snapshot to obtain an updated layer snapshot, the updated layer snapshot comprising the interface composition information and the animation effect mark; calculating an animation effect speed of a target child layer, wherein the target child layer comprises the animation effect mark and a buffer area; and displaying according to the animation effect speed and the updated layer snapshot.
[0005] By obtaining the front interface synthesis information, the electronic device can perceive the preset layer attribute change through the interface synthesis information. When the preset layer attribute of the layer in the interface synthesis information is updated, the layer is determined as the target parent layer, and the preset layer attribute change indicates the animation effect. Thus, the animation effect recognition is triggered based on the actual change of the preset layer attribute, instead of relying on the specific position of the animation effect code. Therefore, even if the implementation code position of the animation effect changes, the recognition effect will not be affected. By setting the dynamic effect mark for the child layer of the target parent layer, the recognition and processing range of the animation effect can be narrowed to the specific and relevant layer, improving the accuracy and efficiency of animation effect recognition and reducing unnecessary calculation and resource consumption. By updating the layer snapshot, the electronic device can obtain the latest information of the layer, providing reliable data support for subsequent animation effect processing and display. By calculating the dynamic effect speed of the target child layer, the starting frame and the ending frame of the animation effect can be determined according to the dynamic effect speed of the target child layer, providing reliable data support for subsequent animation effect processing and display. The specific position of the animation effect code can be independent, and even in the case of changes in the implementation code position of the animation effect, the change of the preset layer attribute can be perceived in real time and the animation effect can be recognized and processed accordingly, thus effectively solving the limitations of the traditional insertion method when facing changes in the animation effect code position. At the same time, by setting the dynamic effect mark and calculating the dynamic effect speed, the starting frame and the ending frame of the animation effect can be determined according to the dynamic effect speed of the target child layer, improving the accuracy of animation effect recognition and processing, and ensuring the normal display of the animation effect. In the dynamically changing interface, it helps to maintain the coherence and visual appeal of the animation, and improves the user experience.
[0006] In one possible implementation, the display according to the dynamic effect speed and the updated layer snapshot includes: determining a decision frame rate according to the dynamic effect speed of each target child layer; and displaying according to the decision frame rate and the updated layer snapshot.
[0007] The dynamic effect speed of the target child layer can be used to indicate the speed of the animation effect, so that the starting frame and the ending frame of the dynamic effect can be determined according to the dynamic effect speed. The electronic device determines a decision frame rate according to the dynamic effect speed of each target child layer. If the dynamic effect speed is fast, the determined decision frame rate is high, so that the smoothness of the subsequent display of the updated layer snapshot can be ensured, which helps to improve the user experience and makes the user feel more natural and coherent animation effect; on the contrary, if the dynamic effect speed is slow, the determined decision frame rate is low, which can save resources.
[0008] In a possible implementation, determining the decision frame rate according to the animation speed of each target sub-layer comprises: for each target sub-layer, determining a first frame rate of the target sub-layer according to a first relationship and the animation speed of the target sub-layer, wherein the first relationship comprises a corresponding relationship between the animation speed and the first frame rate; and determining the decision frame rate according to the first frame rate of each target sub-layer.
[0009] Each target sub-layer can set a corresponding first frame rate according to the animation speed thereof, and the decision frame rate is a result of comprehensive consideration on the basis of the first frame rates of the target sub-layers, balances the animation requirements of the target sub-layers, and provides a display effect of the animation effect.
[0010] In a possible implementation, determining the decision frame rate according to the first frame rate of each target sub-layer comprises: determining a weight of a target sub-layer according to a display size of the target sub-layer on the screen; determining the decision frame rate according to the first frame rate and the weight of each target sub-layer; or selecting a maximum value of the first frame rates of the target sub-layers as the decision frame rate.
[0011] By considering the display size of the target sub-layer on the screen to determine the weight, it can be ensured that the animation speed corresponding to a larger or more eye-catching target sub-layer is paid more attention to. Selecting the maximum value of the first frame rates of the target sub-layers as the decision frame rate can ensure that all the layers can meet the smoothness requirement when the animation effect is played.
[0012] In a possible implementation, calculating the animation speed of the target sub-layer comprises: calculating a position change of the target sub-layer on the screen; and obtaining the animation speed of the target sub-layer according to a display parameter and the position change, wherein the display parameter comprises a frame rate or a refresh rate.
[0013] The accurately calculated position change and animation speed are helpful for the identification of the animation effect, and can ensure that the animation effect can be accurately identified and displayed even if the code position of the animation effect implementation changes, thereby providing a high-quality visual experience.
[0014] In a possible implementation, calculating the position change of the target sub-layer on the screen comprises: obtaining a transformation matrix and position information of the target sub-layer according to the updated layer snapshot; calculating coordinates of four corner points of the target sub-layer after transformation according to the position information and the transformation matrix, to obtain the coordinates of the four corner points after transformation; for each corner point, obtaining a corner point moving distance of the corner point according to the coordinates of the corner point after transformation; and obtaining the position change of the target sub-layer according to the corner point moving distances of the four corner points.
[0015] The position change trend of the target sub-layer in the transformation process can be obtained by calculating the corner point movement distances of the four corner points. These corner point movement distances not only reflect the displacement of the layer in the horizontal and vertical directions, but also provide a solid foundation for obtaining the position change of the target sub-layer. By taking the corner point movement distances of the corner points as quantitative indicators, the degree of position change of the target sub-layer after transformation can be intuitively evaluated.
[0016] In one possible implementation, obtaining the position change of the target sub-layer according to the corner point movement distances of the four corner points includes: taking the maximum value of the corner point movement distances of the four corner points as the position change of the target sub-layer.
[0017] Each corner point of the target sub-layer can experience different movement distances, depending on the specific content of the transformation matrix and the position information of the target sub-layer. However, directly considering the movement distances of all corner points can increase the complexity of calculation and processing time. By taking the maximum movement distance among the four corner points as a measure of the overall position change, the calculation process can be significantly simplified and the processing efficiency can be improved.
[0018] The position change of the target sub-layer can be intuitively reflected by the maximum movement distance of a corner point on its boundary. This is because the maximum movement distance often represents the most significant displacement of the target sub-layer during transformation, and moves the fastest, which can better represent the degree of overall position change.
[0019] In one possible implementation, the preset layer attribute includes the layer position and / or the transformation matrix; when the preset layer attribute of the layer in the interface synthesis information is updated, determining the layer as the target parent layer includes: when the layer position and / or the transformation matrix of the layer are updated, determining the layer as the target parent layer, and setting the dynamic effect control node marker for the target parent layer.
[0020] When the layer position and / or the transformation matrix are updated, animation control can be performed through the dynamic effect control node marker, which can mark the target parent layer and its sub-layers. Subsequently, the dynamic effect speed can be calculated for the target sub-layers, and the dynamic effect can be accurately and quickly identified.
[0021] In one possible implementation, the target parent layer includes a dynamic effect control node marker, and setting the dynamic effect marker for the sub-layers of the target parent layer includes: traversing the layer snapshot tree, determining whether the layer node includes the dynamic effect control node marker; if yes, clearing the dynamic effect control node marker of the layer node and setting the dynamic effect marker; if no, setting the dynamic effect marker for the layer node when the parent layer node of the layer node includes the dynamic effect marker.
[0022] Traversing the layer snapshot tree and setting the dynamic effect marker according to the dynamic effect control node marker of the layer node realizes the transmission of the dynamic effect marker and provides a basis for subsequent determination of the target sub-layer.
[0023] The second aspect provides an electronic device, comprising: a processor and a memory; the memory is configured to store a computer program, the computer program comprising program instructions; the processor is configured to invoke the computer program to execute any one of the above methods.
[0024] The third aspect provides a chip system, the chip system is applied to an electronic device, and the chip system comprises one or more processors, and the one or more processors are configured to invoke computer instructions to enable the electronic device to execute any one of the above methods.
[0025] The fourth aspect provides a computer storage medium, comprising computer instructions, when the computer instructions are run on an electronic device, the electronic device is enabled to execute any one of the above methods.
[0026] The fifth aspect provides a computer program product, the computer program product stores at least one instruction, and the at least one instruction is executed by a processor to implement any one of the above methods.
[0027] The technical effects obtained by the above-mentioned second aspect, third aspect, fourth aspect and fifth aspect are similar to the technical effects obtained by the corresponding technical means in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF DRAWINGS
[0028] Figures 1A-1C An animation effect schematic diagram provided by an embodiment of the present application.
[0029] Figure 2 An electronic device hardware structure schematic diagram provided by an embodiment of the present application.
[0030] Figure 3 An electronic device software structure schematic diagram provided by an embodiment of the present application.
[0031] Figure 4 A SurfaceFlinger structure schematic diagram provided by an embodiment of the present application.
[0032] Figure 5 A display method flowchart provided by an embodiment of the present application.
[0033] Figure 6 Another display method flowchart provided by an embodiment of the present application.
[0034] Figure 7 Another display method flowchart provided by an embodiment of the present application.
[0035] Figure 8 Another display method flowchart provided by an embodiment of the present application. DETAILED DESCRIPTION
[0036] In this document, the terms“comprise”,“comprising”, or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can also include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element preceded by“comprises a” does not, without more constraints, foreclose the existence of additional identical elements in the process, method, article, or apparatus that comprises the element.
[0037] “at least one” means one or more, and“multiple” means two or more. The“and / or” describes the associated objects in the association relationship, which means that there can be three kinds of relationships, for example, A and / or B can represent: A exists alone, A and B exist together, and B exists alone, where A and B can be singular or plural. The terms“first”,“second”,“third”,“fourth” and the like (if any) in the specification and claims of the present application and the drawings are used to distinguish similar objects, and are not used to describe a specific order or sequence.
[0038] In the embodiments of the present application, the words“exemplary” or“for example” are used to mean serving as an example, instance, or illustration. Any embodiment or design scheme described as“exemplary” or“for example” in the embodiments of the present application should not be construed as being more preferred or advantageous than other embodiments or design schemes. Rather, the use of the words“exemplary” or“for example” is intended to present relevant concepts in a concrete manner.
[0039] First, the scenario and technical problems involved in the present application are described.
[0040] Animation effect, also known as motion effect, is realized by sequentially rendering a series of static image frames. Each image frame represents an instantaneous state of an element in the change process, including differences in position, size, or color.
[0041] The animation effect can include a view-level animation effect, a layer-level animation effect, and the like. The view-level animation effect, also referred to as a view-level animation, refers to the display of dynamic effects on a view in a user interface. The view-level animation can be applied to interface elements that inherit from a view, such as buttons, image views, and text views. The layer-level animation effect, also referred to as a layer-level animation, refers to an animation effect that occurs at the layer level, rather than on individual elements within a layer. The layer-level animation involves transformation of the entire layer, such as translation, scaling, rotation, and the like of the layer. Since a Layer is at the Activity level, it is usually the Views within the layer that are animated, and the Layer itself is generally static. A continuous motion is a Layer-level animation. A transition animation between Activities is a layer-level animation, which makes the layer of the current Activity disappear in a certain way and the layer of the new Activity appear in a corresponding way when switching from one Activity to another.
[0042] In order to ensure the normal display of the animation effect, it is necessary to accurately identify the animation effect. As described above, the use of the instrumentation method in the prior art to identify the animation effect has limitations. For example, with the updating of system versions, the code positions for implementing the animation effect frequently change, making it difficult for the instrumentation scheme for a specific version to be continuously effective and the adaptation cost high. For another example, there are various types of animation effects, and the traditional instrumentation method is difficult to comprehensively cover all cases, and is prone to omissions or misjudgments. For another example, the instrumentation method often relies on fixed code positions for monitoring, and these positions are not always the true start or end points of the animation, affecting the accuracy and timeliness of animation identification. For another example, for the animation of a PopupWindow or a floating Layer, the traditional instrumentation method often cannot effectively identify and handle it.
[0043] In addition to accurately identifying the animation effect, the normal display of the animation effect is closely related to the refresh rate and the frame rate of a series of static image frames, and thus the animation effect is related to the refresh rate and the frame rate. The higher the refresh rate and the frame rate, the better the display effect of the animation effect, and the better the user's visual experience.
[0044] The refresh rate refers to the number of times a screen updates a picture per second, measured in hertz (Hz), which determines whether the screen can smoothly display frame images. If the refresh rate of the screen is 60 Hz, it means that the screen can update 60 pictures per second.
[0045] The frame rate refers to the number of frames of an interface display image per second, measured in frames per second (fps), which represents the smoothness of the interface display content. Generally, the higher the frame rate, the smoother the interface display.
[0046] It is understood that the screen refresh rate can switch in kernel space as the frame rate switches in user space within the system. In other words, switching the frame rate in an electronic device will cause the refresh rate to switch accordingly. In this application embodiment, the descriptions of frame rate and refresh rate are not strictly distinguished. Generally, in user space, or from the user's perspective, it can be described as frame rate, and in kernel space, it can be described as refresh rate. Of course, it can also be described as refresh rate in user space and frame rate in kernel space; there is no limitation. It is understood that the distinction between frame rate and refresh rate does not constitute a limitation on the method implementation of the embodiments of this application.
[0047] The following example illustrates an animation effect diagram.
[0048] When a user makes a payment using a payment application, in response to the user entering their payment password, the payment interface is displayed as follows: Figure 1A As shown. In the display Figure 1A When the payment interface is shown, the electronic device's refresh rate is 120Hz. After the user enters their payment password, the application interacts with the cloud. During this interaction, since there's no need to refresh the interface, the screen enters an idle state, and the electronic device reduces its refresh rate to 60Hz. Figure 1B The interface shown is as follows. After successful payment, the electronic device displays a payment success screen as shown. Figure 1C As shown. Based on the previous reduction of the refresh rate of electronic devices to 60Hz, then... Figure 1C The pop-up animation on the payment success page is running at a refresh rate of 60Hz. Due to the reduced refresh rate, the animation effect is poor.
[0049] Therefore, this application provides a display method that can solve the above problems, accurately and efficiently identify animation effects, and improve the display effect of animation effects.
[0050] The display method provided in this application can be applied to electronic devices that can install applications (APPs), such as mobile phones, tablets, wearable devices, in-vehicle devices, augmented reality (AR) / virtual reality (VR) devices, laptops, ultra-mobile personal computers (UMPCs), netbooks, and personal digital assistants (PDAs). This application does not impose any restrictions on the specific type of electronic device.
[0051] For example,Figure 2 is a structural schematic diagram of an electronic device 100 provided by an embodiment of the present application. The electronic device 100 can include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a loudspeaker 170A, a receiver 170B, a microphone 170C, a headset interface 170D, a sensor module 180, a key 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 can include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0052] The processor 110 can include one or more processing units, for example: the processor 110 can include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units can be independent devices or integrated in one or more processors.
[0053] The controller can be the nerve center and command center of the electronic device 100. The controller can generate operation control signals according to instruction operation codes and timing signals to complete the control of instruction fetching and instruction execution.
[0054] The processor 110 can also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory can hold instructions or data that the processor 110 has just used or is using repeatedly. If the processor 110 needs to use the instructions or data again, it can call them directly from the memory. This avoids repeated access and reduces the waiting time of the processor 110, thus improving the efficiency of the system.
[0055] The electronic device 100 implements display functions through a GPU, a display screen 194, and an application processor, etc. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 can include one or more GPUs that execute program instructions to generate or change display information.
[0056] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can adopt a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flex light-emitting diode (FLED), a Miniled, a MicroLed, a Micro-oLed, a quantum dot light emitting diode (QLED), etc. In some embodiments, the electronic device 100 can include 1 or N display screens 194, and N is a positive integer greater than 1.
[0057] It can be understood that the structure shown in the embodiments of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 can include more or fewer components than shown, or combine certain components, or split certain components, or different component arrangements. The components shown can be implemented in hardware, software, or a combination of software and hardware.
[0058] The software system of the electronic device 100 can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. The embodiments of the present application take the Android system with a layered architecture as an example to exemplarily illustrate the software structure of the electronic device 100.
[0059] Figure 3is a software structure block diagram of the electronic device 100 of an embodiment of the present application. The layered architecture divides the software into several layers, each of which has a clear role and division of labor. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom, the application layer, the application framework layer, the system library, the hardware abstraction layer, the kernel layer, and the hardware layer.
[0060] As shown in Figure 3 , the application layer can include a series of applications. The applications can be system applications such as camera, gallery, calendar, call, WLAN, Bluetooth, short message, etc., and can also include third-party applications such as navigation, video playing software, chat software, etc.
[0061] The application framework layer provides application programming interfaces (APIs) and programming frameworks for the applications of the application layer. The application framework layer includes some pre-defined functions.
[0062] As shown in Figure 3 , the application framework layer can include a view system, a window manager service (WMS), a SurfaceFlinger, a frame rate control module, etc.
[0063] In some embodiments, the application framework layer can include a Java framework layer and a native (also referred to as C++ framework layer) framework layer. The view system can be located in the Java framework layer. The SurfaceFlinger and the frame rate control module can be located in the native framework layer.
[0064] The window manager service can be used for window management, window animation management, surface management, and as a relay station for the input system. The WMS can create and manage windows.
[0065] The view system includes visual controls, such as controls for displaying text, controls for displaying pictures, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a short message notification icon can include a view for displaying text and a view for displaying pictures.
[0066] SurfaceFlinger is responsible for compositing the elements of each frame of images in the interface, such as combining the display contents of multiple applications and user interface into a single image frame (i.e., a composite frame), and outputting the composite frame to the display screen, so that the composite image corresponding to the composite frame is displayed on the display screen. SurfaceFlinger manages all display layers (Layers) in the system, including application windows, system UI elements, etc., to ensure that they can be displayed in the correct order and layout.
[0067] The following exemplary describes the working process of SurfaceFlinger:
[0068] SurfaceFlinger obtains the interface composition information of the application. Each application can generate image data of its interface, i.e., interface composition information, through its graphics rendering pipeline (possibly using OpenGL ES, Skia, etc. graphics library), and encapsulate the interface composition information into a Transaction, and submit the Transaction to the BufferQueue managed by SurfaceFlinger. BufferQueue is an efficient image data transmission mechanism that allows seamless data exchange between the application and SurfaceFlinger.
[0069] SurfaceFlinger can periodically read the interface composition information from the BufferQueue to obtain the information of each layer, and composite these layers according to the window management information (such as the Z sequence, size, position, etc. of the window) provided by the WMS. The composition process can involve complex image processing operations, such as transparency blending, color correction, etc., to ensure the quality of the final display image.
[0070] In order to improve the efficiency and performance of composition, SurfaceFlinger can use hardware composer (HWC) or GPU to accelerate the composition process. HWC is a mechanism provided by Android system, which allows direct hardware acceleration of layer composition operations. If HWC is available and can handle the current layer composition task, SurfaceFlinger will prefer to use HWC for composition. If HWC is not available or cannot handle all layers, SurfaceFlinger will fall back to using GPU or other software algorithms to complete the composition task.
[0071] SurfaceFlinger sends the composited frame to the buffer of the display screen, and waits for the vertical synchronization signal (VSync) of the display screen to arrive, and then maps it to the screen to be displayed. In this way, the user can see the display layer composited by SurfaceFlinger, including the application program and the UI element.
[0072] The frame rate control module can be used to make a unified frame rate decision. The frame rate control module can determine the final frame rate according to the frame rates sent by various software or hardware, and output the determined final frame rate to SurfaceFlinger. SurfaceFlinger determines the refresh rate according to the final frame rate. When implementing a real dynamic image (such as an animation effect), the refresh rate can be increased to provide a smoother experience; and when displaying a static image, the refresh rate can be reduced to save power.
[0073] In some embodiments, the frame rate control module can determine the final frame rate through a voting mechanism. For example, if an application program requests a frame rate of 60 FPS, and the system setting suggests reducing the refresh rate to save power, the final refresh rate can be a compromise of the two requests.
[0074] In some embodiments, the frame rate control module can be used to determine the composition frame rate (i.e., the final frame rate) of SurfaceFlinger for image composition according to the content to be displayed by each application program in the application layer or the frame rate sent by each application program, such as the decision frame rate corresponding to the animation effect event below, and send the determined composition frame rate to SurfaceFlinger.
[0075] The application framework layer can also include an activity manager that can provide an activity manager service (AMS), which can be used for the startup, switching, scheduling of system components (such as activities, services, content providers, broadcast receivers), and the management and scheduling of application processes.
[0076] In some embodiments, the application framework layer can also include a content provider, a resource manager, a notification manager, and the like, which are not shown in the figure.
[0077] The system library can include a plurality of functional modules. For example: a surface manager, media libraries, a three-dimensional graphics processing library (such as OpenGL ES), a 2D graphics engine (such as SGL), and the like.
[0078] The surface manager is used to manage the display subsystem, and provides fusion of 2D and 3D layers for a plurality of application programs.
[0079] The media library supports a variety of commonly used audio, video format playback and recording, and static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
[0080] The three-dimensional graphics processing library is used to implement three-dimensional graphics drawing, image rendering, synthesis and layer processing, etc.
[0081] The 2D graphics engine is a drawing engine for 2D drawing.
[0082] The kernel layer is a layer between hardware and software. The kernel layer at least includes display drivers, sensor drivers, etc.
[0083] The display driver is used to display each frame image provided by the SurfaceFlinger on the screen.
[0084] In some embodiments, the display driver is also used to adjust the refresh rate of the screen according to the refresh rate indicated by the SurfaceFlinger, and adjust the generation period of the Vsync signal according to the refresh rate indicated by the SurfaceFlinger. Such adjustment can indirectly affect the rendering strategy of the SurfaceFlinger and the period of the screen display interface, thereby realizing dynamic adjustment of the refresh rate.
[0085] The hardware abstraction layer is a layer between hardware and software. The hardware abstraction layer (hardware abstraction layer, HAL) includes a hardware composer (hardware composer, HWC).
[0086] The hardware composer is an abstract interface of the display system hardware, which is responsible for efficiently synthesizing image frames onto the screen. At the same time, the HAL also includes a graphics memory allocator (Graphics memory allocator, Gralloc) (not shown), which cooperates to optimize graphics rendering and display performance.
[0087] The HWC can synthesize surfaces to the screen with the SurfaceFlinger. Assuming that the screen direction of the electronic device is portrait and the status bar is at the top. The HWC is a hardware abstraction of the display controller system, and the SurfaceFlinger will delegate some synthesis work to the HWC to reduce the load of the GPU. This will consume less power than simply synthesizing through the GPU. By utilizing the hardware synthesis capability of the HWC, the SurfaceFlinger can more effectively manage the display synthesis process, reduce the dependence on the GPU, thereby improving performance while reducing power consumption.
[0088] The hardware layer can include a CPU, a graphic processing unit (GPU), a display screen, and the like.
[0089] The details of the CPU, the GPU, and the display screen can be referred to the above description. Figure 2 Therefore, the details are not described herein.
[0090] It should be noted that the embodiments of the present application are only described by taking the Android system as an example, and the scheme of the present application can also be implemented in other operating systems (for example, the Windows system, the IOS system, and the like) as long as the functions of the respective functional modules are similar to those of the embodiments of the present application.
[0091] In the embodiments of the present application, the SurfaceFlinger is responsible for the composition of the screen display content, including the identification and processing of the animation effect. In the architecture of the SurfaceFlinger, the functions thereof can be indeed decomposed into different modules. Please refer to Figure 4 for an exemplary introduction to the schematic diagram of the SurfaceFlinger provided by the embodiments of the present application.
[0092] The SurfaceFlinger includes a commit module 401, a composite module 402, and a determination decision frame rate module 403.
[0093] The commit module 401 is used to perform a commit operation and is responsible for processing transaction requests from application programs or other system components.
[0094] For example, the transaction request can include changes to the screen display content, such as the creation, destruction, movement, size adjustment, or content update of a window.
[0095] The commit module 401 receives these requests and prepares corresponding data structures for subsequent composite processing.
[0096] The commit module 401 can be used to perform steps S501 to S506 in Figure 5 , and the specific content will be described in detail below.
[0097] The composite module 402 is used to perform a composite operation and is responsible for compositing the images of multiple windows to obtain a composite frame.
[0098] Exemplarily, the synthesis module 402 synthesizes the multiple windows into one single image frame, obtaining a synthesized frame. During the synthesis process, the synthesis module 402 considers factors such as the hierarchical relationship (Z order) of all the layers, transparency, size, and whether the animation effect is involved. In particular, for those layers involved in the animation effect, the synthesis module ensures that the content of the layers is correctly updated and rendered in consecutive time frames to present a smooth animation effect. At the same time, only the visible layers are included in the final synthesized frame, and the invisible layers are ignored to ensure that the synthesized frame only contains visual elements visible to the user.
[0099] The synthesis module 402 can be used to perform steps S507 to S509 in Figure 5 The specific content will be described in detail below.
[0100] The determination decision frame rate module 403 is configured to determine a decision frame rate according to the animation speed of the synthesized frame, and output the decision frame rate to the frame rate control module.
[0101] In particular, the synthesized frame includes multiple layers, including layers specially designed for animation effects. These animation-involved layers are visible in the synthesized frame, meaning that they have visible pixels in the final image output and can be perceived by the audience. The determination decision frame rate module 403 obtains the animation speed of the animation-involved layers in the synthesized frame, and determines the decision frame rate according to the animation speed of the animation-involved layers.
[0102] The determination decision frame rate module 403 can be used to perform steps S510 to S511, the specific content will be described in detail below.
[0103] In an embodiment of the present application, SurfaceFlinger includes a scheduler. The scheduler is responsible for managing the refresh cycle of the display device and the synthesis process of the layers. The scheduler component monitors the VSYNC signal and triggers the submission and synthesis of the layers at the appropriate time to ensure the coherence and smoothness of the screen content. This process involves the cooperative work of multiple sub-modules, including but not limited to the submission module 401, the synthesis module 402, and the determination decision frame rate module 403.
[0104] Through the cooperation of the submission module 401, the synthesis module 402, and the determination decision frame rate module 403, the animation effect can be accurately identified, and through the support of the synthesis module 402 for the animation effect, SurfaceFlinger can achieve smooth transition and animation effect, thereby improving the user experience, which will be described in detail below.
[0105] It can be understood that in the architecture of SurfaceFlinger, the functions of SurfaceFlinger can also be divided into different modules according to other manners, which are not limited in the present application.
[0106] The display method provided by the embodiment of the present application will be described as a whole with reference to the accompanying drawings.
[0107] Please refer to Figure 5 , an exemplary display method provided by the embodiment of the present application is introduced, which can be applied to Figure 2 and Figure 3 The display method can be executed by the SurfaceFlinger of the electronic device, and the display method comprises steps S501 to S511.
[0108] Step S501, obtaining interface synthesis information of an application program.
[0109] In the embodiment of the present application, when the interface of the application program changes, the application program transmits the interface synthesis information to the SurfaceFlinger. The change of the interface of the application program can include but is not limited to the following cases: (1) window state change, such as opening or closing a window of the application program; (2) drawing content update, such as the application program executing an animation effect, which needs to update its graphics layer periodically or on demand; (3) window attribute change, such as the change of attributes such as position, size, shape, color, etc.; (4) system event, such as screen rotation, multi-window mode switching, etc., the system may require all or specific application programs to update their interfaces.
[0110] The interface synthesis information is used to guide the SurfaceFlinger to synthesize to obtain a synthesis frame to present the final screen content. The interface synthesis information can include but is not limited to the following types of information: layer attribute, image data, synchronization and timing information.
[0111] The layer attribute can include but is not limited to: layer position, transformation matrix, animation parameter, layer size, color and texture, transparency, blending mode, Z-axis order.
[0112] Layer position: specifies the position of the layer on the screen, usually in pixels. The position can be an absolute position or a position relative to the parent layer.
[0113] Transformation matrix: used for scaling, rotating and translating the layer, etc. Transformation matrix is a 3x3 matrix, which defines how the layer should be mapped from its original position and direction to a new position and direction on the screen. The transformation matrix can include but is not limited to: translation matrix, scaling matrix, rotation matrix, etc. The transformation matrix can also include the combination of two or more matrices.
[0114] For example, the translation matrix where tx and ty are the translation amounts along the x and y axes, respectively.
[0115] For example, the scaling matrix where sx and sy are the scaling factors along the x and y axes, respectively. If the scaling factor is greater than 1, the figure is enlarged; if it is less than 1, the figure is reduced.
[0116] For example, the rotation matrix where θ is the rotation angle.
[0117] For example, the translation matrix and scaling matrix M = R * T.
[0118] Animation parameters: If the layer participates in animation, these parameters specify the type, duration, timing function, etc. of the animation. Animation parameters allow the layer to change in a predetermined manner.
[0119] Layer size: Defines the width and height of the layer, usually in pixels. The layer size determines the size of the space occupied by the layer on the screen.
[0120] Color and texture: Color can be a solid color fill for the layer, while texture refers to the use of images or patterns to fill the layer. Texture usually comes from an image file or the contents of a buffer.
[0121] Opacity: Also known as alpha value, used to control the transparency of the layer. The opacity ranges from 0 (completely transparent) to 1 (completely opaque).
[0122] Blending mode: The rendering method when the layer is mixed with other layers, affecting the visual effect of the final composite frame.
[0123] Image data can include but not limited to: buffer reference and format and resolution. The content of the layer is usually stored in a buffer, which is a memory area that stores the pixel data of the layer, so the interface composition information can include references to these buffers. The format (such as RGB, YUV, etc.) and resolution (width and height) of the image data.
[0124] Exemplarily, the application encapsulates the interface compositing information into a Transaction and transmits the Transaction to the SurfaceFlinger. The application submits the Transaction to the SurfaceFlinger, which means that the application requests the SurfaceFlinger to use the information of the Transaction to update the display content on the screen. The Transaction is a kind of data structure. The Transaction can be regarded as a set of instructions that guide the SurfaceFlinger how to update and manage the visual elements on the screen. The Transaction can include the interface compositing information, and the information included in the Transaction can refer to the related content of the interface compositing information described above, which will not be repeated here.
[0125] In step S502, the layer snapshot is updated according to the interface compositing information, and an updated layer snapshot is obtained.
[0126] The layer snapshot (LayerSnapshot) can be understood as a snapshot or a copy of the state of the layer (Layer) at a certain moment. As a data structure, the layer snapshot (LayerSnapshot) captures the current state of each layer in the layer snapshot tree in detail, including but not limited to various key attributes of the layer, such as position, transformation matrix (for scaling, rotation, translation, etc.), size, color and texture, transparency, animation parameters, etc. This snapshot mechanism enables the application to effectively manage and track the state of the layer when the interface changes.
[0127] The layer snapshot tree, also known as the layer tree, is a hierarchical data structure. The layer tree represents the organization of all layers and their parent-child relationships. Each layer can contain its own content (such as pictures, text, background color, etc.) and can have child layers, forming a tree structure. In this tree structure, the layer snapshot tree is composed of multiple layer nodes, each of which can represent a layer and include various layer attributes of the layer, such as position, size, transformation matrix, buffer, etc. That is, the layer node not only carries the visual content of the layer (such as pictures, text, background color, etc.), but also contains all related attributes of the layer, such as position, size, transformation matrix, buffer reference, etc.
[0128] The layer node refers to a single layer element in the layer snapshot tree, which can be a parent layer or a child layer. The parent layer refers to the layer above the current layer in the layer hierarchy, and the child layer refers to the layer below the parent layer in the layer hierarchy.
[0129] A layer snapshot can be used to encapsulate the interface composition information into a transaction when the interface of an application changes, and then apply the transaction to the layer snapshot. A layer snapshot can also be used to record the current state of a layer at the beginning of each screen refresh cycle for use in the composition process.
[0130] In the embodiments of the present application, when SurfaceFlinger obtains the interface composition information of an application, the interface composition information describes which layers have changed (e.g., position movement, size adjustment, animation effect, etc.). SurfaceFlinger updates the corresponding layer snapshot according to the interface composition information. This updating process involves updating the information in the interface composition information, such as the information that has been updated (transformed), to the layer snapshot, and merging the latest state of the layer, including all changes in the layer attributes, such as position, size, transformation matrix, etc., to the layer snapshot, to ensure that the layer snapshot always reflects the latest state of the layer.
[0131] In some embodiments, a Transaction can include the change information of one or more layers, and the change information is distinguished by specific flag bits, each of which precisely indicates a certain type of change in the layer attributes. For example, the eFlagsChanged flag bit is used to indicate that the flags or specific attributes (e.g., visibility, transparency, etc.) of a layer have changed; the eDestinationFrameChanged flag bit is used to indicate that the target display frame (position and size) of the layer on the screen has been adjusted; and the ePositionChanged, eMatrixChanged, eBufferTransformChanged, and eTransformToDisplayInverseChanged flag bits correspond to the changes in the layer position, transformation matrix, buffer transformation attribute, and inverse transformation matrix of the layer to the display device, respectively.
[0132] Inside SurfaceFlinger, the layer state object layerFEState is a data structure used inside SurfaceFlinger to represent the state of a layer at a certain time, including its layer position, layer size, transformation matrix, animation parameters, transparency, and other layer attributes.
[0133] Exemplarily, SurfaceFlinger parses the received Transaction. SurfaceFlinger checks the flag bits in the Transaction to determine which layer properties have changed. For each layer whose properties have changed, SurfaceFlinger updates the corresponding layerFEState object that it internally maintains to reflect the changes. SurfaceFlinger updates the internal layer state object layerFEState according to the flag bits in the Transaction. Each layerFEState object corresponds to the change information of one layer, including the layer properties such as the position, size, transformation matrix, animation parameters, transparency, and the like. After updating the state of LayerFEState, SurfaceFlinger can reflect the changes to LayerSnapshot, which can include the following steps: if LayerSnapshot already exists, SurfaceFlinger merges the change information in the Transaction into LayerSnapshot to ensure that LayerSnapshot contains the latest state of the layer. If LayerSnapshot does not exist (for example, this is the first time the layer is updated), SurfaceFlinger can create a new LayerSnapshot object and apply the change information in the Transaction to this new LayerSnapshot.
[0134] In some embodiments, SurfaceFlinger can call a method similar to LayerSnapshot::merge() to apply the update information in the Transaction to the layer snapshot.
[0135] In some embodiments, when it is necessary to generate or update LayerSnapshot, SurfaceFlinger can copy or reference the contents of the current layerFEState.
[0136] In step S503, when the preset layer property of the layer changes, it is determined that the layer is a target parent layer.
[0137] In the embodiments of the present application, when the preset layer property of the layer changes, it indicates that the geometry of the layer changes. The change of the geometry of the layer can include the change of the layer in spatial properties such as position, size, direction, etc., for example, the position of the layer, the size of the layer, the rotation of the layer, the scaling of the layer, the translation of the layer, and the inclination of the layer, etc.
[0138] In some embodiments, the state of the layer is changed when the preset layer attribute of the layer is changed. The state of the layer can include the change of the display state and visual attribute of the layer, such as whether the layer is visible, the change of the transparency of the layer, the mixing mode of the layer, etc.
[0139] In some embodiments, the geometry and state of the layer are changed when the preset layer attribute of the layer is changed.
[0140] In some embodiments, the layer is the target parent layer when the preset layer attribute of the layer is changed, i.e., the layer needs to be updated or processed, such as forced update.
[0141] The preset layer attribute can include, but is not limited to, the layer position, the layer size, the transformation matrix, the transparency, the mixing mode, etc.
[0142] In the embodiments of the present application, when the preset layer attribute of the layer is changed, the layer is determined to be the target parent layer, and the animation control node marker is set for the target parent layer. The animation control node can be used to indicate that the layer is the target parent layer, and the animation control node marker can be used to inform the SurfaceFlinger that the target parent layer involves animation effect.
[0143] In the embodiments of the present application, the animation control node marker for the target parent layer can be a flag or a state. For example, the animation control node marker hnAninationControlNode of the target parent layer is assigned as true, and the target parent layer is marked with the animation control node marker.
[0144] For example, the preset layer attribute includes the layer position and the layer transformation matrix, please refer to Figure 6 for the exemplary introduction of the processing steps of the SurfaceFlinger after receiving the Transactions.
[0145] Step S601, receiving the Transactions.
[0146] Step S602, judging whether the layer position or the transformation matrix is updated.
[0147] In some embodiments, if it is judged that the layer position or the transformation matrix is updated, step S603 is executed, and if it is judged that the layer position or the transformation matrix is not updated, step S601 is executed.
[0148] Step S603, setting the animation control node marker.
[0149] The related content of steps S601 to S603 can refer to steps S501 to S503, and will not be described here again.
[0150] When the layer position or the transformation matrix of the layer in the interface synthesis information is detected to change, the layer is the target parent layer, and the target parent layer is marked with the dynamic effect control node. For example, the ePositionChanged and / or eMatrixChanged flag bits of the layer are detected to be set, and the dynamic effect control node is marked for the layer.
[0151] In another example, when SurfaceFlinger obtains Transactions, the flag bits in Transactions are checked. When any of the following flag bits of a layer is set, that is, the layer attribute corresponding to the flag bit changes, it is determined that the layer is the target parent layer: the flag bit layer_state_t::eFlagsChanged, the flag bit layer_state_t::eDestinationFrameChanged, the flag bit layer_state_t::ePositionChanged, the flag bit layer_state_t::eMatrixChanged, the flag bit layer_state_t::eBufferTransformChanged, the flag bit layer_state_t::eTransformToDisplayInverseChanged, and the flag bit BufferSize, wherein the flag bit BufferSize is set to indicate that the buffer size of the layer changes.
[0152] In another example, when the forceUpdate variable of the layer is true, or: the flag bit corresponding to the preset layer attribute of the layer is set and the variable ignoreLocalTransform of the local transform is false, the layer is the target parent layer.
[0153] In some embodiments, when the preset layer attribute of the layer changes, it is determined that the layer is the target parent layer, which means that SurfaceFlinger needs to perform some special processing on the layer, such as starting or updating an animation effect.
[0154] In step S504, the dynamic effect mark is set for the child layer of the target parent layer by traversing the layer snapshot tree.
[0155] In the embodiments of the present application, when the layer attribute of a layer changes, the change needs to be passed to the layer that finally participates in screen composition. According to the logical relationship of the layer hierarchy, the change information (attribute change) of the layer can be passed down by layer hierarchy traversal, from the parent layer to the child layer, until the layer with a buffer (i.e., the layer actually participating in composition) is reached. Only the layer with a buffer will participate in the final screen composition process. The buffer is an area for storing pixel data to be rendered, and these layers are usually located at the bottom of the layer snapshot tree.
[0156] When the preset layer attribute change of the layer is detected, the system will mark the corresponding parent layer with an animation control node marker. The animation control node marker can be understood as an indicator indicating that the layer or its child layer needs to apply an animation effect. Based on the target parent layer carrying the animation control node marker, the target parent layer is marked with an animation marker, and the instruction of the animation effect is passed from the parent layer to the child layer until the layer with a buffer is reached. The instruction of the animation effect can indicate that the layer or its child layer needs to apply an animation effect. In some embodiments, the layer attribute in the interface composition information includes an animation parameter, and thus the corresponding animation effect is applied based on the animation parameter.
[0157] The animation marker can be an animation label (Animating), which is a specific marker for indicating that the layer participates in the animation effect. Accordingly, when the layer is marked with the animation marker, the animation marker can be passed from the parent layer to the child layer by layer hierarchy traversal until the layer with a buffer is reached, so as to pass the instruction of the layer without a buffer to the layer with a buffer.
[0158] By marking the target parent layer with the animation control node marker, the animation marker is passed according to the animation control node marker in the subsequent layer hierarchy traversal process. Through the mechanism of layer hierarchy traversal and the animation control node marker, the animation marker is finally passed to the buffer layer, so that the layer with a buffer considers the animation effect when synthesizing, and in the subsequent steps, the target child layer can be determined according to the animation marker and the buffer, and then the animation speed of the target child layer is calculated.
[0159] Exemplarily, please refer to 6, after the animation control node marker is set for the target parent layer in step S603.
[0160] In step S604, the layer snapshot tree is traversed.
[0161] In step S605, it is judged whether the layer node includes the animation control node marker.
[0162] When the determination result of step S605 is yes, step S606 is executed. When the determination result of step S605 is no, step S607 is executed.
[0163] In step S606, the animation control node flag is cleared, and the animation flag is set.
[0164] In step S607, it is determined whether the parent layer node includes the animation flag.
[0165] When the determination result of step S607 is yes, step S608 is executed. When the determination result of step S607 is no, step S604 is executed.
[0166] In step S608, the animation flag is set.
[0167] SurfaceFlinger traverses the layer snapshot tree from the top, and determines whether the layer node is marked with the animation control node flag. The top refers to the topmost layer of the layer snapshot tree, which is usually the entire screen or the root layer. If yes, the animation control node flag of the layer node is cleared, and the animation flag is set. If no, it is determined whether the parent layer node corresponding to the layer node has the animation flag. If the parent layer node corresponding to the layer node has the animation flag, the layer node is marked with the animation flag, and the traversal is continued. If the parent layer node corresponding to the layer node does not have the animation flag, the traversal is continued.
[0168] In step S505, for each layer node in the layer snapshot tree, the boundary of the corresponding layer is determined according to the updated layer snapshot, and the updated layer boundary is obtained.
[0169] In the embodiments of the present application, SurfaceFlinger traverses the layer snapshot tree, and can pass the animation flag, or determine the boundary of the corresponding layer according to the updated layer snapshot, and obtain the updated layer boundary of the layer.
[0170] Specifically, SurfaceFlinger traverses the layer snapshot tree, starting from the root layer, and recursively traverses each layer node. For each layer node, SurfaceFlinger obtains the information of the layer corresponding to the layer node, such as the layer position, layer size, and transformation matrix, according to the updated layer snapshot (such as the updated layer snapshot in step S502). SurfaceFlinger calculates the final boundary of the layer on the screen according to the obtained information of the layer and the information of the parent layer of the layer. For example, for each layer, the final boundary of the layer on the screen is calculated according to the transformation of the parent layer and the transformation attribute (such as position, size, and transformation matrix) of the layer itself, and the updated layer boundary of the layer is obtained. For each layer, the same update function is recursively called to update the boundary of the child layer. Continue to traverse and update until all child layer nodes are accessed and updated. When calculating the boundary, the local transformation matrix of the layer is combined with the transformation matrix of the parent layer to determine the position of the layer in the global coordinate system.
[0171] Exemplarily, SurfaceFlinger calls the LayerSnapshotBuilder::updateLayerBounds() function to traverse the layer snapshot tree, starting from the root layer node, and recursively update the boundary of the layer corresponding to each layer node and its child layer node. This process involves calculating the position and size of the layer of each layer node considering the transformation of the parent layer.
[0172] Exemplarily, the layer snapshot is updated once in LayerSnapshot::merge(), at which time the obtained layer snapshot is local and reflects the changes of the layer itself. It is updated again in LayerSnapshotBuilder::updateLayerBounds(), at which time the obtained layer snapshot can reflect the global position and size and reflect the position and size of the layer on the screen.
[0173] Steps S504 and S505 can be executed simultaneously.
[0174] In step S506, the layer snapshot is updated according to the animation mark and the updated layer boundary, and the updated layer snapshot is obtained.
[0175] In the embodiments of the present application, after the layer snapshot tree is traversed in steps S504 and S505, the layer snapshot includes the updated layer boundary and the animation mark, and each layer has the latest snapshot information. The child layer of the target parent layer, such as the target child layer, includes the animation mark.
[0176] In some embodiments, step S505 can not be performed, and SurfaceFlinger performs step S504 to traverse the layer snapshot tree, and set the animation flag for the child layers of the target parent layer, and the child layers of the target parent layer all include the animation flag, and update the corresponding layer snapshot according to the animation flag of the child layer.
[0177] In step S507, the updated layer snapshot is moved to the composition arguments.
[0178] In the embodiments of the present application, SurfaceFlinger moves the updated layer snapshot to the composition arguments, and the composition arguments include information of the updated layer snapshot. The composition arguments are a series of arguments used in the composition process, and include a LayerFE list used in the composition. LayerFE is a component in SurfaceFlinger, and encapsulates the layer attributes of a layer, such as position, size, color, transparency, etc.
[0179] Based on the fact that the updated layer snapshot includes the animation flag and the updated layer boundary, the composition arguments include global position information of all the layers and the animation flag of the target parent layer and its child layers.
[0180] For example, SurfaceFlinger calls moveSnapshotsToCompositionArgs to copy the data of the updated layer snapshot (e.g., the updated layer snapshot updated by LayerSnapshotBuilder) obtained by the above-mentioned traversal to the composition arguments.
[0181] In step S508, the display layer used for displaying is determined according to the composition arguments, and the display layer is used for composing a display image.
[0182] In some embodiments, the display layer includes a visible layer. In other embodiments, the display layer can include a layer that includes a buffer and is not out of the screen and is not completely occluded.
[0183] SurfaceFlinger filters the layers according to the composition arguments to obtain the display layer. For example, SurfaceFlinger filters the composition arguments according to Output.rebuildLayerStacks, such as filtering the LayerFE list, and only keeps the layers that actually include a buffer, are not out of the screen, and are not completely occluded, to obtain a filtered LayerFE list. The filtered LayerFE list includes the visible layers actually used for composition.
[0184] Exemplarily, in the ensureOutputLayerlfVisible process of the SurfaceFlinger executing the composite, further filtering is performed on the LayerFE that actually contains the Buffer, is not out of the screen, and is not completely occluded, to obtain the display layer.
[0185] In some embodiments, the SurfaceFlinger combines the display layers to obtain a composite frame, and the display image corresponding to the composite frame can be displayed on the display screen after the composite frame is sent.
[0186] In some embodiments, the SurfaceFlinger can filter the display layer according to the updated layer snapshot.
[0187] In step S509, the position change of the target sub-layer is calculated.
[0188] The position change can be used to indicate the distance of the layer moving from one position to another in one frame rendering. The position change of the target sub-layer includes the distance of the target sub-layer moving on the screen, such as the distance of the target sub-layer moving along the X-axis and the Y-axis on the screen.
[0189] The target sub-layer includes the animation mark and the buffer.
[0190] The animation mark is set for the sub-layer of the target parent layer in step S504, so that the target sub-layer can be determined according to whether there is an animation mark and whether there is a buffer. After the target sub-layer is determined, the position information and the transformation matrix of the target sub-layer can be obtained according to the updated layer snapshot in step S502 or step S506 or the composite parameter in step S507, and then the position information of the target sub-layer after applying the transformation matrix is calculated according to the obtained transformation matrix and position information, to obtain the transformed position information. According to the transformed position information, the position change of the target sub-layer can be calculated.
[0191] In some embodiments, the display layer obtained in step S508 includes the target sub-layer. In step S509, the SurfaceFlinger calculates the position change of the target sub-layer on the screen in the display layer. The SurfaceFlinger obtains the transformation matrix and the position information of the target sub-layer, which can come from the updated layer snapshot in step S502 or step S506 or the composite parameter in step S507. The position information can be the initial position of the layer. Then, the SurfaceFlinger calculates the position information of the target sub-layer after applying the transformation matrix according to the obtained transformation matrix and position information, to obtain the transformed position information. According to the transformed position information, the position change of the target sub-layer can be calculated.
[0192] For a target sub-layer in the display layer, a transformation matrix and a display size of the target sub-layer are obtained, and the original position and size of the layer are combined with the transformation matrix to calculate a transformed position and size.
[0193] Exemplarily, if the transformation matrix includes a translation matrix, a new position of the layer is obtained according to the original position of the layer and the translation matrix.
[0194] Exemplarily, if the transformation matrix includes a scaling matrix, a new size and a new position of the layer are obtained according to the original size of the layer and the scaling matrix.
[0195] Exemplarily, if the transformation matrix includes a rotation matrix, a new size and a new position of the layer are determined according to the rotation matrix, the original position of the layer, and the original size of the layer.
[0196] In some embodiments, the transformation matrix can include one or more matrices.
[0197] Specifically, SurfaceFlinger obtains the position information and the transformation matrix of the target sub-layer according to the updated layer snapshot in step S502 or step S506 or the composition parameters in step S507, calculates the coordinates of four corner points of the target sub-layer after transformation according to the obtained position information and transformation matrix, obtains the coordinates of the four corner points after transformation, and obtains the position change of the target sub-layer according to the corner point moving distance of each corner point and the distance calculation formula.
[0198] The distance calculation formula can be as follows:
[0199] Where x1 and y1 are the coordinates before transformation, and x2 and y2 are the coordinates after transformation.
[0200] Exemplarily, the four corner points of the position information (original coordinates) of the layer LayerA are (A, B, C, D), where A (x1, y1) is the upper left corner, B (x2, y1) is the upper right corner, C (x2, y2) is the lower right corner, and D (x1, y2) is the lower left corner. x1 and y1 are the coordinates of the upper left corner of the layer, and x2 and y2 are the coordinates of the lower right corner of the layer. The transformation matrix of the current frame of the layer LayerA is a translation matrix For example, the translation matrix is applied in the current frame:
[0201] Upper left corner
[0202] Upper right corner
[0203] Lower right corner
[0204] bottom left corner
[0205] After the translation of the layer Layer A, the coordinates of the top left corner A1 become (x1+tx1, y1+ty1), the coordinates of the top right corner B1 become (x2+tx1, y1+ty1), the coordinates of the bottom right corner C1 become (x2+tx1, y2+ty1), and the coordinates of the bottom left corner D1 become (x1+tx1, y2+ty1).
[0206] For each corner point, the distance after the translation of the corner point is calculated according to the distance calculation formula:
[0207] Corner point moving distance of the top left corner
[0208] Corner point moving distance of the top right corner
[0209] Corner point moving distance of the bottom right corner
[0210] Corner point moving distance of the bottom left corner
[0211] The maximum value of the corner point moving distances DA1, DB1, DC1 and DD1 of the four corner points is taken as the position change of the layer Layer A, and the coordinates (A1, B1, C1, D1) of the above four corner points are recorded and saved.
[0212] The transformation matrix of the layer Layer A in the next frame is a translation matrix The translation matrix is applied in the next frame:
[0213] top left corner
[0214] top right corner
[0215] bottom right corner
[0216] bottom left corner
[0217] After the translation of the layer Layer A, the coordinates of the top left corner A2 become (x1+tx2, y1+ty2), the coordinates of the top right corner B1 become (x2+tx2, y1+ty2), the coordinates of the bottom right corner C1 become (x2+tx2, y2+ty2), and the coordinates of the bottom left corner D1 become (x1+tx2, y2+ty2).
[0218] For each corner point, the distance after translation of the corner point is calculated according to the distance calculation formula, and based on the coordinates (A1, B1, C1, D1) reserved after the last time the transformation matrix is applied, the corner point moving distance between (A1, B1, C1, D1) and (A2, B2, C2, D2) is calculated for each corner point:
[0219] Corner point moving distance of the upper left corner:
[0220]
[0221] Corner point moving distance of the upper right corner:
[0222]
[0223] Corner point moving distance of the lower right corner:
[0224]
[0225] Corner point moving distance of the lower left corner:
[0226]
[0227] The maximum value of the corner point moving distances DA2, DB2, DC2 and DD2 of the four corner points is taken as the position change of the layer LayerA, and the coordinates (A1, B1, C1, D1) of the four corner points are recorded and saved.
[0228] In the embodiment of the present application, the maximum value of the corner point moving distances of the four corner points in the target sub-layer is taken as the position change of the target sub-layer, that is, the corner point moving distance of the corner point moving fastest is taken as the position change of the target sub-layer.
[0229] In step S510, the motion effect speed of the target sub-layer is determined according to the position change of the target sub-layer.
[0230] In the embodiment of the present application, the SurfaceFlinger calculates the motion effect speed of the target sub-layer according to the position change of the target sub-layer and the display parameters, and the display parameters include the refresh rate or the frame rate. The position change of the target sub-layer is multiplied by the frame rate or the refresh rate, and the result obtained can be used to represent the total distance or total displacement of the target sub-layer moving in one second, that is, the motion effect speed of the target sub-layer is obtained.
[0231] Exemplarily, the SurfaceFlinger multiplies the position change of the target sub-layer with the current frame rate of the electronic device, and obtains a total horizontal displacement per second and a total vertical displacement per second. The total horizontal displacement per second: if the horizontal position change per frame is Δx, then the total horizontal displacement per second is Δx×fps. The total vertical displacement per second: if the vertical position change per frame is Δy, then the total vertical displacement per second is Δy×fps. The product of the position change and the frame rate can be used to reflect the total distance moved by the target sub-layer in one second, that is, the motion effect speed of the target sub-layer. The motion effect speed of the target sub-layer.
[0232] Exemplarily, the SurfaceFlinger multiplies the position change of the target sub-layer with the current refresh rate of the electronic device, and obtains the motion effect speed of the target sub-layer.
[0233] In the embodiment of the present application, the start frame and the end frame of the animation effect can be determined according to the motion effect speed of the target sub-layer. For example, if the motion effect speed of the target sub-layer corresponding to a certain frame is relatively higher than that of the previous frame, then the frame can be determined as the start frame. For another example, if the motion effect speed of the target sub-layer of several consecutive frames is relatively lower than that of the previous frames, then the frame rate at which the motion effect speed is reduced can be determined as the end frame.
[0234] In the embodiment of the present application, the start frame and the end frame of the animation effect can be determined according to the motion effect speed of the target sub-layer. For example, if the motion effect speed of the target sub-layer corresponding to a certain frame is relatively higher than that of the previous frame, then the frame can be determined as the start frame. For another example, if the motion effect speed of the target sub-layer of several consecutive frames is relatively lower than that of the previous frames, then the frame rate at which the motion effect speed is reduced can be determined as the end frame.
[0235] In the embodiment of the present application, the SurfaceFlinger obtains the motion effect speed of each target sub-layer, determines the decision frame rate according to the motion effect speed of each target sub-layer, and the higher the motion effect speed of each target sub-layer is, the higher the decision frame rate is. Therefore, the SurfaceFlinger can improve the refresh rate according to the decision frame rate subsequently.
[0236] In the embodiment of the present application, the SurfaceFlinger obtains the motion effect speed of each target sub-layer, determines the corresponding first frame rate according to the motion effect speed of each target sub-layer, and determines the decision frame rate according to the first frame rate of each target sub-layer.
[0237] In the embodiment of the present application, the SurfaceFlinger can determine the first frame rate of each target sub-layer according to the first relationship and the motion effect speed of each target sub-layer, and the first relationship includes the corresponding relationship between the motion effect speed and the first frame rate.
[0238] Exemplarily, the first relationship includes: the motion effect speed less than 480 pixel / s corresponds to the first frame rate 90 fps, and the motion effect speed less than 240 pixel / s corresponds to the first frame rate 60 fps.
[0239] It can be understood that the above-mentioned relationship between the animation effect speed and the first frame rate in the first relationship is only an example, and the embodiments of the present application do not make specific limitations thereto.
[0240] In some embodiments, for each target sub-layer, SurfaceFlinger determines the weight of the target sub-layer according to the display size of the target sub-layer on the screen, and then determines the decision frame rate according to the first frame rate and the weight of each target sub-layer.
[0241] For example, SurfaceFlinger determines the first frame rate of target sub-layer Layer1 as 60fps, the first frame rate of target sub-layer Layer2 as 90fps, and the first frame rate of target sub-layer Layer3 as 60fps according to the first relationship, where the display size of target sub-layer Layer1, Layer2 and Layer3 on the screen is from large to small, and the weights of target sub-layer Layer1, Layer2 and Layer3 are determined as 0.5, 0.3 and 0.2 respectively, and the decision frame rate is: 60fps*0.5+90fps*0.3+60fps*0.2=69fps.
[0242] The relationship between the display size of the target sub-layer on the screen and the corresponding weight can be determined according to the actual situation, and the present application does not make specific limitations thereto.
[0243] In some embodiments, SurfaceFlinger takes the maximum value of the first frame rates of the plurality of target sub-layers as the decision frame rate.
[0244] In some embodiments, a filtering strategy for layer (Layer) changes in animation or dynamic effects is used to ensure that only layer movements that meet certain conditions are considered valid animation effects. The filtering strategy can include but is not limited to: shielding the first movement, area-based filtering, and movement distance-based filtering.
[0245] For example, shielding the first movement: when analyzing the dynamic effects of a layer, it may be chosen to ignore the first position change of the layer. This is because the initial movement of the layer may only start from its initial position, and the real animation effect usually involves continuous movement. Therefore, only when the layer moves in two or more consecutive frames, such movement is considered part of the animation effect.
[0246] As another example, area-based filtering: for small-sized layers, there can be no strict requirement on the frame rate of their animation effects. In dynamic effects, the movement of small layers can not have a significant impact on the user experience, so it can be chosen to ignore the animation effects of these layers. This can be achieved by calculating the area of the layer (e.g., width multiplied by height) and comparing it with a preset threshold. If the area of the layer is smaller than the threshold, it can be considered that it is not a frame rate sensitive animation effect.
[0247] As another example, movement distance-based filtering: for the movement of a layer, if the distance of a single movement significantly exceeds the size of the layer itself, it can not be an intentional animation effect. For example, a layer with a size of 100x200 pixels moves 300 pixels in a frame, such movement can not conform to the expected animation effect. Therefore, these abnormal movements can be filtered out by comparing the size of the layer and the movement distance.
[0248] Please refer to Figure 7 for an exemplary description of another display method provided by embodiments of the present application.
[0249] The Scheduler of SurfaceFlinger can perform a commit operation through the commit module 401. Exemplarily, the commit operation can be performed through methods such as updateLayerBounds, and the specific content can refer to steps S501 to S506 described above. After performing the commit operation, animation control node markers, animation markers, and updated layer snapshots can be obtained.
[0250] The Scheduler of SurfaceFlinger can perform a composite operation through the composite module 402. Exemplarily, the composite operation can be performed through methods such as ensureOutputLayerlfVisible, and the specific content can refer to steps S507 to S508 described above. After screening the display layers, information in the display layers such as position information and transformation matrices can be obtained.
[0251] When performing the composite operation, the position change of the target sub-layer is also calculated, the position change of the target sub-layer is calculated according to the position information and the transformation matrix of the target sub-layer, and the position change of the target sub-layer is obtained. The specific content can refer to step S509.
[0252] The Scheduler of SurfaceFlinger can perform an operation of determining a decision frame rate through the decision frame rate determining module 403, and the specific content can refer to steps S510 to S511 described above.
[0253] The SurfaceFlinger outputs the calculated decision frame rate to the frame rate control module and indicates that the decision frame rate is based on the animation effect event. The AGP determines a final frame rate based on the received decision frame rate and outputs the final frame rate to the SurfaceFlinger.
[0254] The SurfaceFlinger can adjust the refresh rate of the screen according to the final frame rate.
[0255] In the embodiments of the present application, the decision frame rate can be determined according to the animation speed of each target child layer, and then the refresh rate of the screen is adjusted according to the decision frame rate. That is, when displaying the animation effect, the decision frame rate is obtained according to the speed of the pop-up interface, and it is determined whether to increase the frame rate according to the decision frame rate. The higher the speed of the pop-up interface, the higher the increased frame rate.
[0256] Please refer to Figure 8 , which exemplarily introduces another display method provided by the embodiments of the present application. The method is applied to an electronic device and can be executed by the SurfaceFlinger.
[0257] In step S801, interface composition information is obtained.
[0258] The related content of step S801 can be referred to step S501, and will not be repeated here.
[0259] In step S802, when the preset layer attribute of the layer in the interface composition information is updated, it is determined that the layer is a target parent layer.
[0260] The related content of the preset layer attribute and the target parent layer can be referred to the above, and will not be repeated here.
[0261] In the embodiments of the present application, after the SurfaceFlinger obtains the interface composition information, for each layer, it is determined whether the preset layer attribute corresponding to the layer is updated according to the interface composition information. If yes, it is determined that the layer is a target parent layer. If no, the layer is not a target parent layer.
[0262] In some embodiments, the preset layer attribute includes a layer position and / or a transformation matrix. When the preset layer attribute of the layer in the interface composition information is updated, determining that the layer is a target parent layer includes: when the layer position and / or the transformation matrix of the layer are updated, setting an animation control node mark for the layer.
[0263] In step S803, an animation mark is set for the child layer of the target parent layer.
[0264] In the embodiments of the present application, the SurfaceFlinger sets the animation mark for the child layer of the target parent layer to ensure that the animation mark is set for the target child layer of the target parent layer.
[0265] In the embodiments of the present application, the SurfaceFlinger sets the animation mark for the child layer of the target parent layer to ensure that the animation mark is set for the target child layer of the target parent layer.
[0266] In some embodiments, the target parent layer includes an animation control node mark, and setting the animation mark for the child layer of the target parent layer includes: traversing the layer snapshot tree, judging whether the layer node includes the animation control node mark; if yes, clearing the animation control node mark of the layer node and setting the animation mark; and if no, setting the animation mark for the layer node when the parent layer node of the layer node includes the animation mark.
[0267] In the embodiments of the present application, the SurfaceFlinger can update the layer snapshot according to the interface composition information to obtain the updated layer snapshot, and the updated layer snapshot includes the interface composition information. Details can be referred to step S502.
[0268] In the embodiments of the present application, the SurfaceFlinger can update the layer snapshot according to the interface composition information to obtain the updated layer snapshot, and the updated layer snapshot includes the interface composition information. Details can be referred to step S502.
[0269] In the embodiments of the present application, the SurfaceFlinger sets the animation mark for the child layer (such as the target child layer) of the target parent layer after determining the target parent layer according to the preset layer attribute of the interface composition information, and then updates the layer snapshot according to the animation mark to obtain the updated layer snapshot, and the updated layer snapshot includes the animation mark. Details can be referred to step S504 and step S506.
[0270] In some embodiments, the SurfaceFlinger can update the layer snapshot according to the interface composition information to obtain the updated layer snapshot, and then set the animation mark and / or update the boundary of the layer for the child layer of the target parent layer according to the updated layer snapshot, and finally update the layer snapshot again according to the animation mark and / or the boundary of the updated layer to obtain the updated layer snapshot, and the updated layer snapshot includes the animation mark and the boundary of the updated layer. Details can be referred to step S503 to step S506.
[0271] In the embodiments of the present application, the SurfaceFlinger sets the animation mark for the child layer of the target parent layer to ensure that the animation mark is set for the target child layer of the target parent layer.
[0272] In the embodiments of the present application, the calculation of the motion effect speed of the target sub-layer includes: calculating the position change of the target sub-layer on the screen; and obtaining the motion effect speed of the target sub-layer according to the display parameter and the position change, wherein the display parameter includes a frame rate or a refresh rate.
[0273] The correlation of the display parameter, the position change and the motion effect speed can refer to the above description, and will not be repeated here.
[0274] In the embodiments of the present application, the calculation of the position change of the target sub-layer on the screen by the SurfaceFlinger can include: the SurfaceFlinger can obtain the position information and the transformation matrix of the target sub-layer according to the updated layer snapshot in step S502 or step S506 or the composition parameter in step S507. Then, the SurfaceFlinger calculates the coordinates of the four corner points of the target sub-layer after transformation according to the obtained position information and transformation matrix, obtains the coordinates of the four corner points after transformation. Then, for each corner point, the SurfaceFlinger obtains the corner point movement distance of the corner point according to the coordinates of the corner point after transformation, and finally, obtains the position change of the target sub-layer according to the corner point movement distances of the four corner points.
[0275] Exemplarily, the updated layer snapshot is obtained, and the updated layer snapshot can include the latest state of the target sub-layer, including its transformation matrix (such as rotation, scaling, translation, etc.) and position information. The transformation matrix of the target sub-layer is parsed from the layer snapshot. The position information of the target sub-layer in the current scene is obtained from the layer snapshot, which is usually given in the form of coordinate points (such as X, Y coordinates in the screen coordinate system). The coordinates of each corner point are multiplied by the transformation matrix to obtain their new coordinates after transformation. This process considers all transformations (rotation, scaling, translation, etc.) that the layer can undergo. For each corner point, the coordinates before and after transformation (current frame and last frame) are compared. The movement distance of the corner point in the transformation process is obtained by calculating the Euclidean distance between the two coordinate points.
[0276] In some embodiments, the obtaining of the position change of the target sub-layer by the SurfaceFlinger according to the corner point movement distances of the four corner points includes: taking the maximum value of the corner point movement distances of the four corner points as the position change of the target sub-layer.
[0277] It can be understood that the position change of the target sub-layer is calculated according to the corner point movement distances of the four corner points, and in other embodiments, the step can also be calculated according to other manners, which is not specifically limited in the present application.
[0278] In step S806, display is performed according to the motion effect speed and the updated layer snapshot.
[0279] The related content of the motion effect speed can be referred to the above, and will not be described here again.
[0280] In the embodiment of the application, the SurfaceFlinger displays according to the motion effect speed and the updated layer snapshot includes: determining a decision frame rate according to the motion effect speed of each target sub-layer, and displaying according to the decision frame rate and the updated layer snapshot.
[0281] The related content of the decision frame rate can be referred to the above, and will not be described here again.
[0282] In the embodiment of the application, the SurfaceFlinger determines the decision frame rate according to the motion effect speed of each target sub-layer includes: for each target sub-layer, determining a first frame rate of the target sub-layer according to a first relationship and the motion effect speed of the target sub-layer, wherein the first relationship includes a corresponding relationship between the motion effect speed and the first frame rate, and determining the decision frame rate according to the first frame rate of each target sub-layer.
[0283] The related content of the first frame rate and the first relationship can be referred to the above, and will not be described here again.
[0284] In the embodiment of the application, the SurfaceFlinger determines the decision frame rate according to the first frame rate of each target sub-layer includes: determining a weight of the target sub-layer according to a display size of the target sub-layer on the screen, and determining the decision frame rate according to the first frame rate and the weight of each target sub-layer. Alternatively, the SurfaceFlinger takes the maximum value of the first frame rates of the plurality of target sub-layers as the decision frame rate.
[0285] The chip provided in the embodiment of the application can implement the display method in the method embodiments.
[0286] The embodiment of the application provides an electronic device, including: a processor and a memory; the memory is used for storing a computer program, and the computer program includes program instructions; the processor is used for calling the computer program and executing the display method as above.
[0287] The embodiment of the application provides a chip system, which is applied to an electronic device, and includes one or more processors, and the one or more processors are used for calling computer instructions to make the electronic device execute the display method as above.
[0288] The embodiment of the application further provides a computer program product, when the computer program product runs on a computer, makes the computer execute the related steps to implement the display method in the method embodiments.
[0289] The embodiment of the present application further provides a computer storage medium, comprising computer instructions, which, when running on an electronic device, cause the electronic device to perform the display method of the above embodiment.
[0290] The electronic device, the computer storage medium, the computer program product or the chip system provided by the embodiment of the present application are all used to execute the corresponding method provided above, and thus the beneficial effects achieved thereby can refer to the beneficial effects in the corresponding method provided above, which will not be described herein again.
[0291] Through the above description of the embodiments, those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above functional modules is taken as an example for illustration, and in actual application, the above functions can be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.
[0292] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative, for example, the division of the modules or units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another device, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units or components shown or discussed can be indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0293] The units described as separate components can or can not be physically separated, and the components shown as units can be one physical unit or multiple physical units, that is, can be located in one place or can be distributed to multiple different places. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.
[0294] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically independently, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.
[0295] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a readable storage medium. Based on such an understanding, the technical solutions of the embodiments of the present application essentially or say the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The software product is stored in a storage medium, including a number of instructions to make a device (which can be a single-chip microcomputer, a chip, etc.) or a processor execute all or part of the steps of the various embodiments of the method of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), a magnetic disk or an optical disk, and various media that can store program codes.
[0296] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto, any change or replacement within the technical scope disclosed in the present application should be covered within the protection scope of the present application.
Claims
1. A display method, characterized in that, Applied to electronic devices, the method includes: Obtain interface composition information; When the preset layer attributes of the layer in the interface composition information are updated, the layer is determined to be the target parent layer; Set animation markers for the child layers of the target parent layer; Update the layer snapshot to obtain an updated layer snapshot, wherein the updated layer snapshot includes the interface composition information and the motion effect markers; Calculate the motion speed of the target sublayer, wherein the target sublayer includes the motion marker and the buffer; The display is based on the motion speed and the updated layer snapshot.
2. The method as described in claim 1, characterized in that, The step of displaying based on the motion speed and the updated layer snapshot includes: The decision frame rate is determined based on the motion speed of each target sub-layer; The display is based on the decision frame rate and the updated layer snapshot.
3. The method as described in claim 2, characterized in that, The step of determining the decision frame rate based on the motion speed of each of the target sub-layers includes: For each target sublayer, a first frame rate of the target sublayer is determined based on a first relationship and the motion speed of the target sublayer, wherein the first relationship includes the correspondence between the motion speed and the first frame rate; The decision frame rate is determined based on the first frame rate of each target sub-layer.
4. The method as described in claim 3, characterized in that, The step of determining the decision frame rate based on the first frame rate of each of the target sub-layers includes: The weight of the target sublayer is determined based on its display size on the screen. The decision frame rate is determined based on the first frame rate and weight of each target sub-layer; or, The maximum value among the first frame rates of the multiple target sub-layers is used as the decision frame rate.
5. The method according to any one of claims 1 to 4, characterized in that, The calculation of the motion speed of the target sub-layer includes: Calculate the change in the target sublayer's position on the screen; The motion speed of the target sub-layer is obtained based on the display parameters and the position change, wherein the display parameters include frame rate or refresh rate.
6. The method as described in claim 5, characterized in that, The calculation of the position change of the target sublayer on the screen includes: The transformation matrix and position information of the target sublayer are obtained based on the updated layer snapshot; Based on the location information and the transformation matrix, calculate the transformed coordinates of the four corner points of the target sub-layer to obtain the transformed coordinates of the four corner points; For each corner point, the corner point movement distance is obtained based on the transformed coordinates of the corner point; The position change of the target sublayer is obtained based on the corner point movement distance of the four corner points.
7. The method as described in claim 6, characterized in that, The step of obtaining the position change of the target sub-layer based on the corner point movement distance of the four corner points includes: The maximum value among the four corner point movement distances is taken as the position change of the target sublayer.
8. The method according to any one of claims 1 to 7, characterized in that, The preset layer attributes include layer position and / or transformation matrix; When the preset layer attributes of the layer in the interface composition information are updated, determining the layer as the target parent layer includes: When the layer position and / or the transformation matrix of the layer are updated, the layer is determined to be the target parent layer, and a motion control node marker is set for the target parent layer.
9. The method according to any one of claims 1 to 8, characterized in that, The target parent layer includes motion effect control node markers, and setting motion effect markers for the child layers of the target parent layer includes: Traverse the layer snapshot tree and determine whether the layer node includes the animation control node marker; If so, clear the animation control node markers of the layer node and set the animation markers; If not, when the parent layer node of the layer node includes the motion effect mark, set the motion effect mark for the layer node.
10. An electronic device, characterized in that, include: Processor and memory; The memory is used to store computer programs, the computer programs including program instructions; The processor is configured to invoke the computer program to execute the method as described in any one of claims 1 to 9.
11. A chip system applied to an electronic device, characterized in that, The chip system includes one or more processors, which are configured to invoke computer instructions to cause the electronic device to perform the method as described in any one of claims 1 to 9.
12. A computer storage medium, characterized in that, Includes computer instructions that, when executed on an electronic device, cause the electronic device to perform the method as described in any one of claims 1 to 9.
13. A computer program product, characterized in that, The computer program product stores at least one instruction that, when executed by a processor, implements the method as described in any one of claims 1 to 9.