Image display method and related device
By optimizing the image display method in electronic devices, ensuring that the layers are drawn, rendered and synthesized within each signal cycle, the problem of discontinuous image display is solved, and the smooth display of images and a good user experience is achieved.
Patent Information
- Application Number
- CN202311283522.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-27
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2043-09-27
AI Technical Summary
Electronic devices spend a lot of time in the process of drawing layers, resulting in discontinuous image display and frame drops, affecting the user experience.
By introducing an image display method in electronic devices, it ensures that the layer is drawn and rendered within each signal cycle, and images are synthesized and displayed, leaving enough time to reduce frame drops.
This method effectively reduces frame drop and screen stuttering observed by users, ensuring smooth image display and good user visual experience.
Smart Images

Figure CN118447141B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of terminal technology, and in particular to image display methods and related devices. Background Art
[0002] Electronic devices can refresh displayed images. Electronic devices can obtain images by drawing, rendering, and synthesizing layers, and display the images on a display screen. However, with the development of electronic devices, in order to meet user needs, electronic devices may spend more time in the process of drawing layers to obtain more exquisite and detailed images. In this way, it may happen that the electronic device cannot display the image coherently, that is, frame loss occurs. How electronic devices can display images coherently to a certain extent is a problem that needs to be solved in this field. Summary of the invention
[0003] The present application provides an image display method and related devices, which can ensure the continuity of images displayed by electronic devices to a certain extent.
[0004] In a first aspect, the present application provides a method for displaying an image, the method being applied to an electronic device, the method comprising:
[0005] At a first moment, the electronic device draws a first layer and then renders the first layer, and the duration of drawing and rendering the first layer does not exceed a single signal cycle, where the signal cycle is a cycle of two adjacent vertical synchronization signals generated by the electronic device;
[0006] At a second moment, the electronic device draws a second layer and then renders the second layer. The duration of drawing and rendering the second layer exceeds a single signal cycle and does not exceed two signal cycles. The second moment is after the first moment, and the second moment is separated from the first moment by a single signal cycle.
[0007] At a third moment, the electronic device synthesizes the first layer to obtain a first image, the third moment is located after the first moment, and the third moment is separated from the first moment by two signal cycles;
[0008] At a fourth moment, the electronic device displays the first image and synthesizes the second layer to obtain a second image, and the fourth moment is separated from the third moment by a single signal cycle;
[0009] At a fifth moment, the electronic device displays the second image, and the fifth moment is separated from the fourth moment by a single signal cycle.
[0010] By implementing the above method, the electronic device can reserve sufficient time (for example, two signal cycles) to draw and render the layer, thereby reducing frame loss and further reducing the phenomenon of screen freezes observed by users. In this way, the smoothness of the electronic device displaying images can be guaranteed to a certain extent, and the user's visual experience is good.
[0011] In combination with the first aspect, in some implementations, when the duration of drawing the second layer does not exceed a single signal cycle, after the electronic device completes drawing the second layer, the method further includes:
[0012] At the third moment, the electronic device draws a third layer and then renders the third layer;
[0013] At the fifth moment, the electronic device synthesizes the third layer to obtain a fifth image;
[0014] At a sixth moment, the electronic device displays the fifth image, and the sixth moment is separated from the fifth moment by a single signal cycle.
[0015] In some implementations, when the drawing time of the previous layer does not exceed a single signal cycle, the electronic device can start drawing and rendering the next layer in response to the vertical synchronization signal 1. In this way, the electronic device can ensure effective drawing and rendering of each frame layer.
[0016] In combination with the first aspect, in some implementations, when the duration of drawing the second layer exceeds a single signal cycle, after the electronic device completes drawing the second layer, the method further includes:
[0017] After the third moment, in response to the electronic device completing drawing the second layer, the electronic device draws a third layer and then renders the third layer;
[0018] At the fifth moment, the electronic device synthesizes the third layer to obtain a fifth image;
[0019] At a sixth moment, the electronic device displays the fifth image, and the sixth moment is separated from the fifth moment by a single signal cycle.
[0020] In some implementations, when the drawing time of the previous layer exceeds a single signal cycle, the electronic device can wait for the UI thread to be idle after receiving the vertical synchronization signal 1 before starting to draw and render the next layer. In this way, the electronic device can also ensure the effective drawing and rendering of each frame layer.
[0021] In combination with the first aspect, in some implementations, when the duration of drawing the second layer does not exceed a single signal cycle, and the duration of drawing and rendering the third layer does not exceed a single signal cycle,
[0022] After the electronic device completes rendering the third layer and before the fourth moment, only the second layer and the third layer are stored in the cache queue of the electronic device.
[0023] In some implementations, the time when the electronic device receives the vertical synchronization signal that triggers the drawing of the rendering layer and the time when the electronic device receives the vertical synchronization signal that triggers the synthesis of the rendered layer are separated by two signal cycles. In other words, if the duration of drawing the second layer does not exceed a single signal cycle, the duration of storing the second layer in the buffer may exceed a single signal cycle. Figure 5 , between time tx3 and time t4, the buffer in the electronic device can store two frames of layers, namely, the rendered frame b and the rendered frame c. In this way, the electronic device can ensure that the layers can be read from the buffer when the layers are subsequently synthesized.
[0024] In combination with the first aspect, in some implementations, the electronic device includes a cache queue, which is used to store layers that have been drawn and rendered by the electronic device but not yet synthesized, and the maximum storage capacity of the cache queue is two frames of layers.
[0025] In the embodiment of the present application, the buffer in the electronic device can store at least 0 frames of layers and can store at most 2 frames of layers. In addition, the electronic device can limit the maximum storage capacity of the buffer to 2 frames of layers. In this way, it can be ensured that the rendered layers will not be discarded by the electronic device.
[0026] In combination with the first aspect, in some implementations, the first moment and the second moment are both moments when a first vertical synchronization signal for triggering drawing and rendering of a layer is received;
[0027] The third moment and the fourth moment are both moments when a second vertical synchronization signal for triggering the synthesis layer is received;
[0028] The fifth moment is the moment when a third vertical synchronization signal for triggering display of an image is received;
[0029] The periods and phases of the first vertical synchronization signal, the second vertical synchronization signal and the third vertical synchronization signal are the same, and the period is consistent with the signal period.
[0030] In some implementations, the first moment is the moment when the first vertical synchronization signal for triggering drawing and rendering of the first layer is received. The second moment is the moment when the first vertical synchronization signal for triggering drawing and rendering of the second layer is received. The third moment is the moment when the second vertical synchronization signal for triggering synthesis of the first layer is received. The fourth moment is the moment when the second vertical synchronization signal for triggering synthesis of the second layer is received and the moment when the third vertical synchronization signal for triggering display of the first image is received. The fifth moment is the moment when the third vertical synchronization signal for triggering display of the second image is received.
[0031] In combination with the first aspect, in some implementations, at the third moment, before the electronic device synthesizes the first layer to obtain the first image, the method further includes:
[0032] The electronic device determines, according to the first moment at which the first vertical synchronization signal is received, a moment two signal cycles after the first moment as the third moment;
[0033] At the fourth moment, before the electronic device synthesizes the second layer to obtain the second image, the method further includes:
[0034] The electronic device determines, according to the second moments of receiving the first vertical synchronization signal, a moment two signal cycles after the second moment as the fourth moment.
[0035] In some implementations, the electronic device can determine, based on the timestamp of each received vertical synchronization signal, that the moment two signal cycles after the first moment of receiving the first vertical synchronization signal is the third moment. The electronic device can respond to the third vertical synchronization signal at the third moment and synthesize the first layer to obtain the first image. In this way, the electronic device can reserve a maximum of two signal cycles to complete drawing and rendering the layer.
[0036] In conjunction with the first aspect, in some implementations, at a first moment, the electronic device draws a first layer, and before rendering the first layer, the method further includes:
[0037] The electronic device starts a first application, which includes one or more of the following: a casual stand-alone game, a casual online game, and a non-competitive game.
[0038] In some implementations, the embodiments of the present application may be applicable to application scenarios that do not require high hand tracking performance, such as video playback scenarios, casual game scenarios, non-competitive game scenarios, and the like.
[0039] In combination with the first aspect, in some implementations, the electronic device further includes: a drawing thread, a rendering thread, a graphics synthesizer, and a display screen, wherein:
[0040] At the first moment, the drawing thread is used to draw the first layer, and then the rendering thread is used to render the first layer;
[0041] At the second moment, the drawing thread is used to draw the second layer, and then the rendering thread is used to render the second layer;
[0042] At the third moment, the graphic synthesizer is used to synthesize the first layer to obtain the first image;
[0043] At the fourth moment, the display screen is used to display the first image, and the graphic synthesizer is used to synthesize the second layer to obtain the second image;
[0044] At the fifth moment, the display screen is used to display the second image.
[0045] In an embodiment of the present application, there are two application scenarios for drawing by the UI thread: 1. When the UI thread is idle, respond to the vertical synchronization signal 1 and start drawing the layer; 2. When the UI thread is occupied, if only the vertical synchronization signal 1 is received, the layer cannot be drawn, and it is necessary to wait until the UI thread is idle before starting to draw the layer. The rendering thread can start rendering the completed layer immediately after the layer is drawn. The image synthesizer can determine the timestamp of the vertical synchronization signal 2 that triggers the synthesis of the rendered layer based on the timestamp of the vertical synchronization signal 1 that triggers the drawing and rendering of the layer, and the two timestamps are separated by two signal cycles. The image synthesizer can respond to the vertical synchronization signal 2 that meets the above conditions to synthesize the layer. The image synthesizer can also be used to read a frame of rendered image from the buffer. The display driver can respond to the vertical synchronization signal 3 and display the synthesized image through the display screen.
[0046] In a second aspect, the present application provides an electronic device, comprising one or more processors and one or more memories. The one or more memories are coupled to the one or more processors, and the one or more memories are used to store computer program codes, and the computer program codes include computer instructions, and when the one or more processors execute the computer instructions, the electronic device executes the method of the first aspect or any implementation of the first aspect.
[0047] In a third aspect, an embodiment of the present application provides a computer storage medium, including computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the method of the first aspect or any implementation method of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 A software structure block diagram of an electronic device provided in an embodiment of the present application;
[0049] Figure 2 A schematic diagram of a vertical synchronization signal provided in an embodiment of the present application;
[0050] Figure 3A A schematic diagram of the principles of drawing layers, rendering layers, synthesizing layers, and displaying images in an electronic device provided in an embodiment of the present application;
[0051] Figure 3B A schematic diagram of the principles of drawing layers, rendering layers, synthesizing layers, and displaying images in another electronic device provided in an embodiment of the present application;
[0052] Figure 3C A schematic diagram of the principles of drawing layers, rendering layers, synthesizing layers, and displaying images in another electronic device provided in an embodiment of the present application;
[0053] Figure 4 A flow chart of an image display method provided in an embodiment of the present application;
[0054] Figure 5 A schematic diagram of the principle of an electronic device using an image display method provided in an embodiment of the present application;
[0055] Figure 6 A flowchart of another image display method provided in an embodiment of the present application;
[0056] Figure 7 A schematic diagram of the principle of another electronic device using an image display method provided in an embodiment of the present application;
[0057] Figure 8 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0058] The technical solutions in the embodiments of the present application will be described clearly and in detail below in conjunction with the accompanying drawings. In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in the text is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.
[0059] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, unless otherwise specified, "plurality" means two or more.
[0060] The term "user interface (UI)" in the following embodiments of the present application refers to a medium interface for interaction and information exchange between an application or operating system and a user, which realizes the conversion between the internal form of information and the form acceptable to the user. The user interface is a source code written in a specific computer language such as Java and extensible markup language (XML). The interface source code is parsed and rendered on an electronic device, and finally presented as content that can be recognized by the user. The commonly used form of user interface is a graphical user interface (GUI), which refers to a user interface related to computer operation displayed in a graphical manner. It can be a visual interface element such as text, icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets, etc. displayed on the display screen of an electronic device.
[0061] First, the software architecture of the electronic device provided in the embodiment of the present application is introduced.
[0062] Exemplarily, the electronic device may be a mobile phone, a tablet computer, a desktop, a laptop, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) device, a virtual reality (VR) device, and the like including a display screen (such as a touch screen). The embodiments of the present application do not impose any special restrictions on the specific form of the electronic device.
[0063] The software system of the electronic device may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present invention takes the Android system of the layered architecture as an example to exemplify the software structure of the electronic device.
[0064] Figure 1 It is a software structure block diagram of the electronic device according to an embodiment of the present invention.
[0065] The layered architecture divides the software into several layers, each with clear roles and division of labor. The 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 Android runtime and system library, and the kernel layer.
[0066] The application layer can include a series of application packages.
[0067] like Figure 1 As shown, the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, etc.
[0068] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.
[0069] like Figure 1 As shown, the application framework layer includes but is not limited to: UI thread and rendering thread. Among them, the UI thread is the thread running in the central processing unit (CPU) of the electronic device. The UI thread is used to draw the layer. The rendering thread is the thread running in the graphics processing unit (GPU) of the electronic device. The rendering thread is used to render the layer after drawing.
[0070] Android Runtime includes core libraries and virtual machines. Android runtime is responsible for scheduling and management of the Android system.
[0071] The core library consists of two parts: one part is the function that needs to be called by the Java language, and the other part is the Android core library.
[0072] The application layer and the application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
[0073] The system library may include multiple functional modules, including but not limited to: InputDispatcher thread, InputReader thread, image synthesizer (Surface Flinger), etc.
[0074] Among them, the InputDispatcher thread is used to wait for new events and distribute new events to applications.
[0075] The InputReader thread is used to read and preprocess the original input event and send the input event to the queue managed by the InputDispatcher thread.
[0076] Surface Flinger is used to synthesize the layers that have finished rendering to obtain an image.
[0077] Most of the classes in the Framework layer are just "intermediaries" for applications to use library files in the system library. Because the upper-layer applications are written in Java, they need the most direct support of Java interfaces, while the system library supports the operation of another language (such as C++). Therefore, the Framework layer acts as an intermediary between the application layer and the system library. The modules in the Framework layer do not really implement specific functions, or only implement part of the functions, but focus on the core library to complete them. The difference is that the Framework layer is mostly written in Java, while the system library is mostly written in C++.
[0078] The kernel layer is the layer between hardware and software. The kernel layer contains at least touch driver, display driver, etc. The kernel layer is used to receive instructions from the software layer to control the corresponding hardware to perform the corresponding tasks.
[0079] Understandably, Figure 1 The illustrated software architecture does not constitute a specific limitation on the electronic device. In other embodiments of the present application, the electronic device may include more or fewer modules than shown in the figure, or combine some modules, or split some modules, etc.
[0080] Combine the following Figure 1 A schematic diagram of the software processing flow for displaying an image provided in an embodiment of the present application is introduced.
[0081] When the touch sensor receives a touch operation, the corresponding hardware interrupt is sent to the kernel layer. The touch driver in the kernel layer processes the touch operation into a touch event (including touch coordinates, timestamp of the touch operation, etc.).
[0082] The touch driver sends the original input event to the InputReader thread of the system library. After the InputReader thread pre-processes the touch event, it sends the touch event to the InputDispatcher thread.
[0083] The application framework layer can identify the specific application corresponding to the touch event.
[0084] The UI thread can draw the layer corresponding to the touch event based on the information provided by the application.
[0085] The rendering thread can render the completed layer.
[0086] Surface Flinger can synthesize the layers after rendering to obtain an image.
[0087] Finally, the display driver calls the synthesized image and presents the synthesized image through the display screen.
[0088] From the above process, we can see that before an image is displayed on the screen, it needs to go through the steps of drawing, rendering and synthesis. Figure 2 A schematic diagram of the vertical synchronization signal used by electronic devices to trigger drawing, rendering, and synthesis.
[0089] like Figure 2 As shown, the vertical synchronization signal 1 can be used to trigger the drawing of the layer and render the layer. Specifically, the vertical synchronization signal 1 can be used to trigger the UI thread to draw the layer and the rendering thread to render the layer drawn by the UI thread. Generally, after the UI thread finishes drawing the layer, the rendering thread can immediately render the drawn layer if there is no rendering task at present.
[0090] The vertical synchronization signal 2 can be used to trigger the synthesis of the rendered layer to obtain an image. Specifically, the vertical synchronization signal 2 can be used to trigger Surface Flinger to synthesize the layer after the rendering thread renders to obtain an image.
[0091] The vertical synchronization signal 3 can be used to trigger hardware to refresh the image displayed on the display screen. The vertical synchronization signal 3 can be a hardware signal triggered by a display driver of the electronic device.
[0092] In an embodiment of the present application, the period for generating the vertical synchronization signal 3 may be determined by the frame rate of the display screen of the electronic device. For example, the period may be the inverse of the frame rate of the display screen. Exemplarily, the frame rate of the display screen of the electronic device may be any value such as 60 Hz, 70 Hz, 75 Hz, 80 Hz, 90 Hz or 120 Hz. Taking the frame rate of the display screen as 60 Hz as an example, the period for generating the vertical synchronization signal 3 is 1 / 60 = 0.01667 seconds (s) = 16.667 milliseconds (ms).
[0093] In a possible implementation, the electronic device may support multiple different frame rates. The frame rate of the electronic device can be switched between the above different frame rates. In the embodiment of the present application, the frame rate is the frame rate currently used by the electronic device. That is, the period for generating the vertical synchronization signal 3 is the inverse of the frame rate currently used by the electronic device.
[0094] like Figure 2 As shown, the electronic device has a vertical synchronization signal 3 triggered by a hardware driver every signal cycle. The vertical synchronization signal 1 and the vertical synchronization signal 2 are generated based on the vertical synchronization signal 3, that is, the vertical synchronization signal 3 can be the signal source of the vertical synchronization signal 1 and the vertical synchronization signal 2. Alternatively, the vertical synchronization signal 1 and the vertical synchronization signal 2 are synchronized with the vertical synchronization signal 3. In other words, the signal cycle of the vertical synchronization signal 1 and the vertical synchronization signal 2 is the same as the signal cycle of the vertical synchronization signal 3, and the phases are consistent.
[0095] For example, Figure 2 As shown, the signal period of vertical synchronization signal 1, the signal period of vertical synchronization signal 2, and the signal period of vertical synchronization signal 3 are the same. Figure 2 As shown, the phases of vertical synchronization signal 1, vertical synchronization signal 2, and vertical synchronization signal 3 are consistent. It is understandable that in the actual implementation process, there may be a certain phase error between vertical synchronization signal 1, vertical synchronization signal 2, and vertical synchronization signal 3 due to various factors (such as processing performance). It should be noted that when understanding the method of the embodiment of the present application, the above phase error is ignored.
[0096] In summary, the vertical synchronization signal 1, the vertical synchronization signal 2 and the vertical synchronization signal 3 are all periodic discrete signals. Figure 2 As shown, there is a vertical synchronization signal 1 every signal cycle, a vertical synchronization signal 2 every signal cycle, and a vertical synchronization signal 3 every signal cycle.
[0097] The signal periods of the vertical synchronization signal 1, vertical synchronization signal 2 and vertical synchronization signal 3 can all be referred to as synchronization period TZ. That is, the synchronization period in the embodiment of the present application is the inverse of the frame rate of the electronic device.
[0098] It should be noted that the name of the vertical synchronization signal may be different in different systems or architectures. For example, in some systems or architectures, the name of the vertical synchronization signal (i.e., vertical synchronization signal 1) used to trigger the drawing of one or more layers may not be VSYNC_APP. However, no matter what the name of the vertical synchronization signal is, as long as it is a synchronization signal with similar functions and conforms to the technical ideas of the method provided in the embodiment of the present application, it should be covered within the scope of protection of the present application.
[0099] Furthermore, in different systems or architectures, the definition of the vertical synchronization signal may also be different.
[0100] For example, in some other systems or architectures, the definition of the vertical synchronization signal 1 may be: vertical synchronization signal 1 may be used to trigger rendering of one or more layers; the definition of vertical synchronization signal 2 may be: vertical synchronization signal 2 may be used to trigger generation of an image based on one or more layers; the definition of vertical synchronization signal 3 may be: vertical synchronization signal 3 may be used to trigger display of an image. In the embodiments of the present application, the definition of the vertical synchronization signal is not limited. However, no matter what definition is given to the vertical synchronization signal, as long as it is a synchronization signal with similar functions and conforms to the technical ideas of the method provided in the embodiments of the present application, it should be covered within the scope of protection of the present application.
[0101] Based on the above Figure 1 and Figure 2 , can respond to touch operations, and the application corresponding to the touch operation in the electronic device can call the UI thread to draw the layer and call the rendering thread to render the drawn layer when receiving the vertical synchronization signal 1. Then, the hardware synthesizer (Hardware Composer, HWC) of the electronic device calls Surface Flinger to synthesize the rendered layer to obtain an image when receiving the vertical signal 2. Afterwards, the display driver of the electronic device displays the synthesized image on the display screen when receiving the vertical synchronization signal 3. In an embodiment of the present application, the above-mentioned drawing, rendering, synthesis, and display are all periodic.
[0102] The following is a schematic diagram of the principles of drawing layers, rendering layers, compositing layers, and displaying images by an electronic device.
[0103] like Figure 3A As shown, illustratively, at time t1, the electronic device receives a vertical synchronization signal 1. The electronic device can respond to the vertical synchronization signal 1 at time t1 and draw a. After the drawing is completed, the electronic device can immediately render a. The above a can refer to one or more layers in the same frame.
[0104] At time t2, the electronic device receives a vertical synchronization signal 2. The electronic device can respond to the vertical synchronization signal 2 at time t2 and synthesize the rendered image a to obtain image A.
[0105] At time t3, the electronic device receives the vertical synchronization signal 3. The electronic device can display image A in response to the vertical synchronization signal 3 at time t3.
[0106] Similarly, at time t2, the electronic device receives the vertical synchronization signal 1. The electronic device can respond to the vertical synchronization signal 1 at time t2 and draw b. After drawing, the electronic device can immediately render b. The above b can refer to one or more layers in the same frame.
[0107] At time t3, the electronic device receives the vertical synchronization signal 2. The electronic device can respond to the vertical synchronization signal 2 at time t3 and synthesize the rendered image b to obtain image B.
[0108] At time t4, the electronic device receives the vertical synchronization signal 3. The electronic device can display image B in response to the vertical synchronization signal 3 at time t4.
[0109] Similarly, at time t3, the electronic device receives the vertical synchronization signal 1. The electronic device can respond to the vertical synchronization signal 1 at time t3 and draw c. After the drawing is completed, the electronic device can immediately render c. The above c can refer to one or more layers in the same frame.
[0110] At time t4, the electronic device receives the vertical synchronization signal 2. The electronic device can respond to the vertical synchronization signal 2 at time t4 and synthesize the rendered image c to obtain image C.
[0111] At time t5, the electronic device receives the vertical synchronization signal 3. The electronic device can display image C in response to the vertical synchronization signal 3 at time t5.
[0112] From the above content, it can be known that when the sum of the time for the electronic device to draw a and render a does not exceed a single signal cycle, the sum of the time for drawing b and rendering b does not exceed a single signal cycle, and the sum of the time for drawing c and rendering c does not exceed a single signal cycle, the electronic device can display image A from time t3 to time t4, image B from time t4 to time t5, and image C from time t5 to time t6. That is, the electronic device can display images continuously, and there will be no situation where no image is displayed in a certain signal cycle.
[0113] However, in some implementations, if the sum of the time taken by the electronic device to draw and render a layer is too long, for example, exceeding a single signal cycle, frame loss may occur.
[0114] The following are schematic diagrams of the principles of drawing layers, rendering layers, compositing layers, and displaying images for several other electronic devices.
[0115] like Figure 3B As shown, at time t1, the electronic device receives a vertical synchronization signal 1. The electronic device can respond to the vertical synchronization signal 1 at time t1 and draw a. After the drawing is completed, the electronic device can render a immediately.
[0116] At time t2, the electronic device receives a vertical synchronization signal 2. The electronic device can respond to the vertical synchronization signal 2 at time t2 and synthesize the rendered image a to obtain image A.
[0117] At time t3, the electronic device receives the vertical synchronization signal 3. The electronic device can display image A in response to the vertical synchronization signal 3 at time t3.
[0118] Similarly, at time t2, the electronic device receives the vertical synchronization signal 1. The electronic device can respond to the vertical synchronization signal 1 at time t2 and draw b. After drawing, the electronic device can immediately render b. However, since the electronic device takes a long time to draw b, the electronic device cannot complete drawing b and rendering b within a single signal cycle. In other words, the electronic device has not completed rendering b at time t3.
[0119] Therefore, the electronic device receives the vertical synchronization signal 2 at time t3, but because the rendering b is not completed at this moment, the electronic device cannot respond to the vertical synchronization signal 2 at time t3 to synthesize image B. Moreover, the electronic device needs the vertical synchronization signal 2 to trigger the synthesis layer to obtain the image. Furthermore, the electronic device can only respond to the vertical synchronization signal 2 at time t4 to synthesize the rendered b to obtain image B. At time t5, the electronic device receives the vertical synchronization signal 3. The electronic device can respond to the vertical synchronization signal 3 at time t5 to display image B.
[0120] like Figure 3C As shown, at time t1, the electronic device receives a vertical synchronization signal 1. The electronic device can respond to the vertical synchronization signal 1 at time t1 and draw a. After the drawing is completed, the electronic device can render a immediately.
[0121] At time t2, the electronic device receives a vertical synchronization signal 2. The electronic device can respond to the vertical synchronization signal 2 at time t2 and synthesize the rendered image a to obtain image A.
[0122] At time t3, the electronic device receives the vertical synchronization signal 3. The electronic device can display image A in response to the vertical synchronization signal 3 at time t3.
[0123] Similarly, at time t2, the electronic device receives the vertical synchronization signal 1. The electronic device can respond to the vertical synchronization signal 1 at time t2 and draw b. After drawing, the electronic device can immediately render b. However, since the time for the electronic device to draw b exceeds a single signal cycle, the electronic device cannot draw b and render b within a single signal cycle. In other words, the electronic device has not completed drawing b at time t3.
[0124] Therefore, the electronic device receives the vertical synchronization signal 2 at time t3, but because the rendering of b is not completed at this moment, the electronic device cannot respond to the vertical synchronization signal 2 at time t3 to synthesize image B. Moreover, the electronic device needs the vertical synchronization signal 2 to trigger the synthesis layer to obtain the image. Furthermore, the electronic device can only respond to the vertical synchronization signal 2 at time t4 to synthesize the rendered b to obtain image B. At time t5, the electronic device receives the vertical synchronization signal 3. The electronic device can respond to the vertical synchronization signal 3 at time t5 to display image B.
[0125] At time t3, the electronic device receives the vertical synchronization signal 1, but since drawing b is not completed at this time, the electronic device cannot respond to the vertical synchronization signal 1 at time t3 to start drawing c. Therefore, the electronic device needs to wait until drawing b is completed before drawing c.
[0126] From the above content, it can be known that when the sum of the time for the electronic device to draw a and render a does not exceed a single signal cycle, and the sum of the time for drawing b and rendering b exceeds a single signal cycle, or when the sum of the time for the electronic device to draw a and render a does not exceed a single signal cycle, and the time for drawing b exceeds a single signal cycle, the electronic device can display image A from time t3 to time t4, and the electronic device can not display any image from time t4 to time t5. That is, the electronic device may drop frames when displaying images, and there may be a situation where no image is displayed within a certain signal cycle.
[0127] In order to reduce the occurrence of the above situation, the embodiment of the present application provides an image display method and electronic device. In this method, after drawing a layer in response to a vertical synchronization signal 1, the electronic device does not synthesize the layer when receiving the first vertical synchronization signal 2, but responds to the second vertical synchronization signal 2 when receiving the second vertical synchronization signal 2, synthesizes the rendered layer to obtain an image. In other words, there are two signal cycles between the vertical synchronization signal 1 that triggers the drawing of the layer and the vertical synchronization signal 2 that triggers the synthesis of the drawn layer.
[0128] Specifically, the electronic device can determine which vertical synchronization signal 2 is the second vertical synchronization signal after the electronic device starts drawing a layer according to respective timestamps of the received vertical synchronization signal 1 and the received vertical synchronization signal 2.
[0129] By implementing the above method, the electronic device can reserve sufficient time (for example, two signal cycles) to draw and render the layer, thereby reducing frame loss and further reducing the phenomenon of screen freezes observed by users. In this way, the smoothness of the electronic device displaying images can be guaranteed to a certain extent, and the user's visual experience is good.
[0130] Combine the following Figure 4A flowchart of an image display method provided in an embodiment of the present application is introduced.
[0131] For example, the execution subject of the method provided in the embodiment of the present application may be a device for processing an image. The device may be any of the above-mentioned electronic devices (for example, the device may be Figure 1 Alternatively, the device may also be a central processing unit (CPU) of an electronic device, or a control module in an electronic device for executing the method provided in the embodiment of the present application.
[0132] In the embodiment of the present application, the method provided by the embodiment of the present application is introduced by taking the above-mentioned electronic device executing the image display method as an example. Among them, the vertical synchronization signal 1 (such as the VSYNC_APP signal) in the embodiment of the present application is the first vertical synchronization signal, the vertical synchronization signal 2 (such as the VSYNC_SF signal) is the second vertical synchronization signal, and the vertical synchronization signal 3 (such as the HW_VSYNC signal) is the third vertical synchronization signal.
[0133] The method flow includes:
[0134] S401: At a first moment, the electronic device draws and renders a first layer, wherein the time for drawing and rendering the first layer is less than a single signal cycle.
[0135] The first moment may be the moment when the electronic device receives the vertical synchronization signal 1. The vertical synchronization signal 1 may be used to trigger the electronic device to draw the first layer. The first layer may refer to the layer that starts to be drawn in response to the vertical synchronization signal 1 at the first moment.
[0136] S402: At a second moment, the electronic device draws and renders a second layer, wherein the time for drawing and rendering the second layer is greater than a single signal cycle and less than two signal cycles.
[0137] The second moment may be the moment when the electronic device receives the vertical synchronization signal 1. The vertical synchronization signal 1 may be used to trigger the electronic device to draw the second layer. The second layer may refer to the layer that starts to be drawn in response to the vertical synchronization signal 1 at the second moment.
[0138] In the embodiment of the present application, the second moment is separated from the first moment by a single signal cycle, and the second moment may be located after the first moment.
[0139] In some implementations, the UI thread periodically starts drawing the UI layer based on the vertical synchronization signal 1. That is, after S401, the UI thread of the electronic device can quickly complete the drawing of the first layer, but because the vertical synchronization signal 1 is not received between the completion of the drawing of the first layer and the second moment, the UI thread of the electronic device will not start drawing the second layer after completing the drawing of the first layer. Instead, it needs to respond to the vertical synchronization signal 1 after receiving the vertical synchronization signal 1 at the second moment, and then start drawing the second layer.
[0140] S403: At a third moment, the electronic device synthesizes a first image based on the first layer, wherein the first moment and the third moment are separated by two signal cycles.
[0141] Since the time for drawing and rendering the first layer is less than a single signal cycle, the electronic device has completed drawing and rendering for the first layer at the third moment, and the electronic device can determine, based on the timestamp information carried by each vertical synchronization signal, that the vertical synchronization signal 2 received at the third moment is the second vertical synchronization signal 2 received after the electronic device starts rendering the first layer. Therefore, the electronic device can respond to the vertical synchronization signal 2 received at the third moment, synthesize the first layer after rendering, and obtain the first image.
[0142] S404: At a fourth moment, the electronic device synthesizes a second image based on the second layer and displays the first image. The second moment and the fourth moment are separated by two signal cycles.
[0143] Since the time for drawing and rendering the second layer is greater than a single signal cycle and less than two signal cycles, the electronic device has completed drawing and rendering for the second layer at the fourth moment, and the electronic device can determine, based on the timestamp information carried by each vertical synchronization signal, that the vertical synchronization signal 2 received at the fourth moment is the second vertical synchronization signal 2 received after the electronic device starts rendering the second layer. Therefore, the electronic device can respond to the vertical synchronization signal 2 received at the fourth moment, synthesize the second layer after rendering, and obtain the second image.
[0144] Since the electronic device has completed synthesizing the first image at the fourth moment, the electronic device can refresh the image displayed by the electronic device in response to the vertical synchronization signal 3 received at the fourth moment, that is, the electronic device can display the first image.
[0145] S405: At a fifth moment, the electronic device displays a second image.
[0146] Since the electronic device has completed synthesizing the second image at the fifth moment, the electronic device can refresh the image displayed by the electronic device in response to the vertical synchronization signal 3 received at the fourth moment, that is, the electronic device can display the second image.
[0147] To better understand the above Figure 4 The image display method flow shown below is combined with Figure 5 For a detailed introduction.
[0148] Figure 5 The schematic diagram of the principle of the image display method used in the electronic device provided in the embodiment of the present application. Figure 4 The image display method shown is described as an example.
[0149] The first moment may refer to moment t1, the second moment may refer to moment t2, the third moment may refer to moment t3, the fourth moment may refer to moment t4, and the fifth moment may refer to moment t5. The first layer may refer to a layer drawn by the electronic device at moment t1, and the second layer may refer to a layer drawn by the electronic device at moment t2. The first image may refer to image A synthesized by the electronic device at moment t3, and the second image may refer to image B synthesized by the electronic device at moment t4.
[0150] like Figure 5 As shown, at time t1, the electronic device receives a vertical synchronization signal 1. The electronic device can respond to the vertical synchronization signal 1 at time t1 and draw a. After drawing, the electronic device can immediately render a. And the electronic device has completed drawing and rendering a before time t2.
[0151] In the embodiment of the present application, there are two signal cycles between the vertical synchronization signal 1 that triggers the drawing of layer a and the vertical synchronization signal 2 that triggers the synthesis of layer a to obtain image A. Therefore, the electronic device does not synthesize the rendered a in response to the vertical synchronization signal 2 received at time t2, but synthesizes the rendered a in response to the vertical synchronization signal 2 received at time t3 to obtain image A. At time t4, the electronic device receives the vertical synchronization signal 3. The electronic device can respond to the vertical synchronization signal 3 at time t4 to display image A.
[0152] At time t2, the electronic device receives the vertical synchronization signal 1. At time t2, the electronic device has completed drawing and rendering of a. Therefore, the electronic device can respond to the vertical synchronization signal 1 at time t2 and draw b. After drawing is completed, the electronic device can immediately render a.
[0153] In the embodiment of the present application, since there are two signal cycles between the vertical synchronization signal 1 that triggers the drawing of layer b and the vertical synchronization signal 2 that triggers the synthesis of layer b to obtain image B, and the electronic device has not yet obtained the rendered b at time t3. Therefore, the electronic device will not synthesize the rendered b in response to the vertical synchronization signal 2 received at time t3, but will synthesize the rendered b in response to the vertical synchronization signal 2 received at time t4 to obtain image B. At time t5, the electronic device receives the vertical synchronization signal 3. The electronic device can respond to the vertical synchronization signal 3 at time t5 to display image B.
[0154] Similarly, since the electronic device can complete drawing b at time t3, the electronic device can respond to the vertical synchronization signal 1 at time t3 to draw c. After drawing is completed, the electronic device can immediately render c. Afterwards, the electronic device can respond to the vertical synchronization signal 2 at time t5 to synthesize the rendered c to obtain image C. Finally, the electronic device can respond to the vertical synchronization signal 3 at time t6 to display image C.
[0155] like Figure 5 As shown, assuming that the electronic device completes rendering a at time tx1, after the electronic device draws and renders a, a can be stored in a cache queue (buffer). The electronic device starts to synthesize the rendered a at time t3 to obtain image A. Since the synthesized layer can be understood as a consuming layer, that is, the electronic device can read a from the buffer at time t3. From the above content, it can be seen that between time tx1 and time t3, the buffer stores a layer, that is, the rendered a.
[0156] Assume that the electronic device completes rendering b at time tx2. After the electronic device draws and renders b, it can store b in the buffer. The electronic device starts to synthesize the rendered b at time t4 to obtain image B. Since the synthesized layer can be understood as a consumed layer, that is, the electronic device can read b from the buffer at time t4. From the above content, it can be seen that between time tx2 and time t4, the buffer stores a layer, that is, the rendered b.
[0157] Assume that the electronic device completes rendering c at time tx3. After the electronic device draws and renders c, it can store c in the buffer. The electronic device starts to synthesize the rendered c at time t5 to obtain image C. Since the synthesized layer can be understood as a consumed layer, that is, the electronic device can read c from the buffer at time t5. From the above content, it can be seen that between time tx3 and time t5, the buffer stores a layer, that is, the rendered c.
[0158] Assume that the electronic device completes rendering d at time tx4. After the electronic device draws and renders d, it can store d in the buffer. The electronic device starts to synthesize the rendered d at time t6 to obtain image D. Since the synthesized layer can be understood as a consumed layer, that is, the electronic device can read d from the buffer at time t6. From the above content, it can be seen that between time tx4 and time t6, the buffer stores a layer, that is, the rendered d.
[0159] However, from Figure 5 It can be seen that time tx1 is between time t1 and time t2, time tx2 and time tx3 are between time t3 and time t4 and time tx2 is before time tx3, and time tx4 is between time t5 and time t6. Therefore, from the above content, it can be known that between t1 and tx1, no layer is stored in the buffer; between tx1 and t3, only one frame of layer is stored in the buffer, that is, the rendered a; between t3 and tx2, no layer is stored in the buffer; between tx2 and tx3, only one frame of layer is stored in the buffer, that is, the rendered b; between tx3 and t4, two frames of layer are stored in the buffer, that is, the rendered b and the rendered c; between t4 and t5, only one frame of layer is stored in the buffer, that is, the rendered c; between t5 and tx4, no layer is stored in the buffer; between tx4 and t6, only one frame of layer is stored in the buffer, that is, the rendered d.
[0160] In the embodiment of the present application, the above Figure 4 The method flow shown is applied in Figure 5 The schematic diagram shown is for illustrative purposes only and can be applied in more scenarios, such as scenarios where the sum of the time it takes for an electronic device to draw and render each frame of a layer does not exceed a single signal cycle, without limitation.
[0161] In some implementations, the electronic device can store the rendered layers in a buffer. When the electronic device synthesizes the layers, it can read the layers to be synthesized from the buffer. In the embodiment of the present application, the maximum storage capacity of the buffer can be set to two frames of layers.
[0162] For example, at time t4, the electronic device has completed drawing and rendering of two frames (e.g., b and c), but the electronic device has not yet started to synthesize the rendered b. That is, between the time when the electronic device completes rendering c and time t4, the buffer in the electronic device stores two frames.
[0163] In the embodiment of the present application, the buffer of the electronic device will not store more than two frames of layers. This is because when the electronic device synthesizes the layers, it consumes one frame of layers stored in the buffer, and before the electronic device performs a layer synthesis operation, the operation of drawing the layer is triggered at most twice.
[0164] For example, at time t4, the buffer in the electronic device stores two layers (b and c). If three layers are to be stored in the buffer, the electronic device needs to respond to vertical synchronization signal 1 before starting to draw the next layer. However, both vertical synchronization signal 1 and vertical synchronization signal 2 arrive at time t5. In other words, while the electronic device is generating layers that can be stored in the buffer, it is also consuming the layers stored in the buffer.
[0165] Exemplarily, the electronic device responds to the vertical synchronization signal 1 at time t4 and starts drawing d. The electronic device can also respond to the vertical synchronization signal 2 at time t4, read the rendered b from the buffer, and synthesize image B. From the above content, it can be seen that the electronic device can ensure that the number of layers stored in the buffer is at most two frames.
[0166] Combined with the above Figure 4 as well as Figure 5 From the relevant description, it can be known that the implementation of the image display method provided in the embodiment of the present application can ensure that the image can be displayed continuously when the electronic device occasionally takes too long to draw and render a single frame layer (for example, exceeding a single signal cycle), and the buffer of the cache layer will not overflow during the process of continuous display of the image by the electronic device.
[0167] Combine the following Figure 6 A flowchart of another image display method provided in an embodiment of the present application is introduced.
[0168] S601: At a first moment, the electronic device draws and renders a first layer, wherein the time for drawing and rendering the first layer is greater than a single signal cycle and less than two signal cycles.
[0169] The first moment may be the moment when the electronic device receives the vertical synchronization signal 1. The vertical synchronization signal 1 may be used to trigger the electronic device to draw the first layer. The first layer may refer to a layer that starts drawing in response to the vertical synchronization signal 1 at the first moment. Specifically, the time for the electronic device to draw the first layer is greater than a single signal cycle.
[0170] S602: After the second moment, the electronic device responds to the completion of drawing the first layer by drawing and rendering the second layer, wherein the time for drawing and rendering the second layer is greater than a single signal cycle and less than two signal cycles.
[0171] The second moment may be the moment when the electronic device receives the vertical synchronization signal 1. The vertical synchronization signal 1 may be used to trigger the electronic device to draw the second layer.
[0172] The electronic device should start drawing the second layer in response to the vertical synchronization signal 1 at the second moment, but because the electronic device has not completed drawing the first layer at the second moment, it cannot start drawing the second layer. Therefore, the second layer needs to wait until the first layer is finished before starting to draw. The second layer may refer to a layer that starts drawing in response to the completion of drawing the first layer after receiving the vertical synchronization signal 1 at the second moment.
[0173] In the embodiment of the present application, the second moment is separated from the first moment by a single signal cycle, and the second moment may be located after the first moment.
[0174] In some implementations, the UI thread periodically starts drawing the UI layer based on the vertical synchronization signal 1. That is, after the electronic device executes S601, the UI thread of the electronic device quickly completes the drawing of the first layer, but because the vertical synchronization signal 1 is not received between the completion of the drawing of the first layer and the second moment, the UI thread of the electronic device will not start drawing the second layer after completing the drawing of the first layer. Instead, it needs to respond to the vertical synchronization signal 1 after receiving the vertical synchronization signal 1 at the second moment, and then start drawing the second layer.
[0175] S603: At a third moment, the electronic device synthesizes a first image based on the first layer, wherein the first moment and the third moment are separated by two signal cycles.
[0176] Since the time for drawing and rendering the first layer is greater than a single signal cycle and less than two signal cycles, the electronic device has completed drawing and rendering for the first layer at the third moment, and the electronic device can determine, based on the timestamp information carried by each vertical synchronization signal, that the vertical synchronization signal 2 received at the third moment is the second vertical synchronization signal 2 received after the electronic device starts rendering the first layer. Therefore, the electronic device can respond to the vertical synchronization signal 2 received at the third moment, synthesize the first layer after rendering, and obtain the first image.
[0177] S604: At a fourth moment, the electronic device synthesizes a second image based on the second layer and displays the first image. The second moment and the fourth moment are separated by two signal cycles.
[0178] Since the time for drawing and rendering the second layer is greater than a single signal cycle and less than two signal cycles, the electronic device has completed the drawing and rendering of the second layer at the fourth moment, and the electronic device can determine, based on the timestamp information carried by each vertical synchronization signal, that the vertical synchronization signal 2 received at the fourth moment is the second vertical synchronization signal 2 received after the electronic device starts rendering the second layer.
[0179] Therefore, the electronic device can respond to the vertical synchronization signal 2 received at the fourth moment to synthesize the second layer after rendering to obtain the second image.
[0180] Since the electronic device has completed synthesizing the first image at the fourth moment, the electronic device can refresh the image displayed by the electronic device in response to the vertical synchronization signal 3 received at the fourth moment, that is, the electronic device can display the first image.
[0181] S605: At a fifth moment, the electronic device displays a second image.
[0182] Since the electronic device has completed synthesizing the second image at the fifth moment, the electronic device can refresh the image displayed by the electronic device in response to the vertical synchronization signal 3 received at the fourth moment, that is, the electronic device can display the second image.
[0183] To better understand the above Figure 6 The image display method shown in the figure is combined with Figure 5 For a detailed introduction.
[0184] Figure 7 The schematic diagram of the principle of the image display method used in the electronic device provided in the embodiment of the present application. Figure 6 The image display method shown is described as an example.
[0185] The first moment may refer to moment t1, the second moment may refer to moment t2, the third moment may refer to moment t3, the fourth moment may refer to moment t4, and the fifth moment may refer to moment t5. The first layer may refer to a layer drawn by the electronic device at moment t1, and the second layer may refer to a layer drawn by the electronic device at moment t2. The first image may refer to image A synthesized by the electronic device at moment t3, and the second image may refer to image B synthesized by the electronic device at moment t4.
[0186] like Figure 7As shown, at time t1, the electronic device receives a vertical synchronization signal 1. The electronic device can respond to the vertical synchronization signal 1 at time t1 and draw a. The duration of drawing a exceeds a single signal cycle. After drawing is completed, the electronic device can render a immediately. And the electronic device has completed rendering a before time t3.
[0187] In the embodiment of the present application, there are two signal cycles between the vertical synchronization signal 1 that triggers the drawing of layer a and the vertical synchronization signal 2 that triggers the synthesis of layer a to obtain image A, and the rendered a has not been obtained at time t2. Therefore, the electronic device will not synthesize the rendered a in response to the vertical synchronization signal 2 received at time t2, but will synthesize the rendered a in response to the vertical synchronization signal 2 received at time t3 to obtain image A.
[0188] At time t4, the electronic device receives the vertical synchronization signal 3. The electronic device can display image A in response to the vertical synchronization signal 3 at time t4.
[0189] Similarly, at time t2, the electronic device receives vertical synchronization signal 1. However, since the electronic device has not completed drawing a at time t2, it cannot start drawing b. The electronic device can start drawing b after time t2 in response to the completion of drawing a. The duration of drawing b exceeds a single signal cycle. After the drawing is completed, the electronic device can immediately render b. And the electronic device has completed rendering b before time t4.
[0190] In the embodiment of the present application, since there are two signal cycles between the vertical synchronization signal 1 that triggers the drawing of layer b and the vertical synchronization signal 2 that triggers the synthesis of layer b to obtain image B, and the electronic device has not yet obtained the rendered image b at time t3, the electronic device will not synthesize the rendered image b in response to the vertical synchronization signal 2 received at time t3, but will synthesize the rendered image b in response to the vertical synchronization signal 2 received at time t4 to obtain image B.
[0191] At time t5, the electronic device receives the vertical synchronization signal 3. The electronic device can display image B in response to the vertical synchronization signal 3 at time t5.
[0192] Similarly, since the electronic device has not completed drawing b at time t3, the electronic device can respond to the completion of drawing b and start drawing c after receiving the vertical synchronization signal 1 at time t3. After the drawing is completed, the electronic device can immediately render c. After that, the electronic device can respond to the vertical synchronization signal 2 at time t5 to synthesize the rendered c to obtain image C. Finally, the electronic device can respond to the vertical synchronization signal 3 at time t6 to display image C.
[0193] like Figure 7As shown, assuming that the electronic device completes rendering a at time tx1, after the electronic device draws and renders a, a can be stored in a cache queue (buffer). The electronic device starts to synthesize the rendered a at time t3 to obtain image A. Since the synthesized layer can be understood as a consuming layer, that is, the electronic device can read a from the buffer at time t3. From the above content, it can be seen that between time tx1 and time t3, the buffer stores a layer, that is, the rendered a.
[0194] Assume that the electronic device completes rendering b at time tx2. After the electronic device draws and renders b, it can store b in the buffer. The electronic device starts to synthesize the rendered b at time t4 to obtain image B. Since the synthesized layer can be understood as a consumed layer, that is, the electronic device can read b from the buffer at time t4. From the above content, it can be seen that between time tx2 and time t4, the buffer stores a layer, that is, the rendered b.
[0195] Assume that the electronic device completes rendering c at time tx3. After the electronic device draws and renders c, it can store c in the buffer. The electronic device starts to synthesize the rendered c at time t5 to obtain image C. Since the synthesized layer can be understood as a consumed layer, that is, the electronic device can read c from the buffer at time t5. From the above content, it can be seen that between time tx3 and time t5, the buffer stores a layer, that is, the rendered c.
[0196] Assume that the electronic device completes rendering d at time tx4. After the electronic device draws and renders d, it can store d in the buffer. The electronic device starts to synthesize the rendered d at time t6 to obtain image D. Since the synthesized layer can be understood as a consumed layer, that is, the electronic device can read d from the buffer at time t6. From the above content, it can be seen that between time tx4 and time t6, the buffer stores a layer, that is, the rendered d.
[0197] However, from Figure 5It can be seen that time tx1 is between time tx2 and time tx3, time tx2 is between time t3 and time t4, time tx3 is between time t4 and time t5, and time tx4 is between time t5 and time t6. Therefore, from the above content, it can be known that between t1 and tx1, no layer is stored in the buffer; between tx1 and t3, only one frame of layer is stored in the buffer, that is, the rendered a; between t3 and tx2, no layer is stored in the buffer; between tx2 and t4, only one frame of layer is stored in the buffer, that is, the rendered b; between t4 and tx3, no layer is stored in the buffer; between tx3 and t5, only one frame of layer is stored in the buffer, that is, the rendered c; between t5 and tx4, no layer is stored in the buffer; between tx4 and t6, only one frame of layer is stored in the buffer, that is, the rendered d.
[0198] In some implementations, the electronic device can store the rendered layers in a buffer. When synthesizing the layers, the electronic device can read the layers to be synthesized from the buffer. In the embodiment of the present application, the maximum storage capacity of the buffer can be set to two frames, but Figure 7 In the schematic diagram shown, a frame of layers is stored in the buffer.
[0199] For example, at time t4, the electronic device has only completed drawing and rendering b, but has not yet completed rendering c, and has not yet started to synthesize the rendered b. That is, at time t4, the electronic device has a frame layer stored in the buffer of the electronic device.
[0200] Combining the above two situations, before the electronic device performs the synthesis operation, the drawing and rendering of the two frames of layers have been completed. Figure 5 As shown in the schematic diagram, the buffer in the electronic device can store two frames of layers; before the electronic device performs the synthesis operation, the drawing and rendering of the two frames of layers are not completed. Figure 7 As shown in the schematic, the buffer in the electronic device may only store one frame layer.
[0201] Combined with the above Figure 6 as well as Figure 7From the relevant description, it can be known that the implementation of the image display method provided in the embodiment of the present application can ensure that the image can be displayed continuously when the electronic device continuously draws and renders a single frame layer for too long (for example, exceeding a single signal cycle), and the buffer of the cache layer will not overflow during the process of continuous display of the image by the electronic device.
[0202] Furthermore, implementing the method provided in the embodiment of the present application can also allow the UI thread to have a maximum of two signal cycles to complete drawing and rendering the layer, and when the maximum drawing and rendering time is two signal cycles, smooth display of the picture can be guaranteed.
[0203] In a possible implementation, the image display method provided in the embodiment of the present application can be applied to games that do not have high requirements for hand tracking, such as casual stand-alone games, non-competitive games, etc.
[0204] The above Figure 4-Figure 7 It can be seen from the relevant description that in the embodiment of the present application, there are two application scenarios for the UI thread to draw: 1. When the UI thread is idle, respond to the vertical synchronization signal 1 and start drawing the layer; 2. When the UI thread is occupied, if only the vertical synchronization signal 1 is received, the layer cannot be drawn, and it is necessary to wait until the UI thread is idle before starting to draw the layer. The rendering thread can start rendering the completed layer immediately after the layer is drawn. The image synthesizer can determine the timestamp of the vertical synchronization signal 2 that triggers the synthesis of the rendered layer based on the timestamp of the vertical synchronization signal 1 that triggers the drawing and rendering of the layer, and the above two timestamps are separated by two signal cycles. The image synthesizer can respond to the vertical synchronization signal 2 that meets the above conditions to synthesize the layer. The image synthesizer can also be used to read a frame of rendered image from the buffer. The display driver can respond to the vertical synchronization signal 3 and display the synthesized image through the display screen.
[0205] Figure 8 A schematic structural diagram of an electronic device 100 is shown.
[0206] The electronic device 100 may be equipped with Or a portable terminal device of other operating systems, the electronic device 100 can be a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, and a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) device, a virtual reality (VR) device, an artificial intelligence (AI) device, a wearable device, a vehicle, a vehicle-mounted device, a smart home device and / or a smart city device, but not limited thereto, the electronic device 100 can also include a laptop computer with a touch-sensitive surface or a touch panel, a desktop computer with a touch-sensitive surface or a touch panel, and other non-portable terminal devices, etc. The embodiment of the present application does not impose any special restrictions on the specific type of the electronic device.
[0207] The electronic device 100 may 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 speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 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 may include a pressure sensor 180A, a gyroscope sensor 180B, an air 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.
[0208] It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0209] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0210] In some implementations, the processor 110 may be configured to respond to a first vertical synchronization signal to start drawing and rendering a layer. The processor 110 may be configured to respond to a second vertical synchronization signal to start synthesizing a layer. The processor 110 may be configured to respond to a third vertical synchronization signal to start displaying a synthesized image. The processor 110 may also be configured to determine a time interval between two signal cycles based on a timestamp of the vertical synchronization signal.
[0211] The processor 110 may also be provided with a memory for storing instructions and data.
[0212] In some embodiments, the memory in the processor 110 is a cache memory. The memory can store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it can be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0213] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0214] The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL).
[0215] In some embodiments, the processor 110 may include multiple groups of I2C buses. The processor 110 may be coupled to the touch sensor 180K, the charger, the flash, the camera 193, etc. through different I2C bus interfaces. For example, the processor 110 may be coupled to the touch sensor 180K through the I2C interface, so that the processor 110 communicates with the touch sensor 180K through the I2C bus interface to realize the touch function of the electronic device 100.
[0216] The I2S interface can be used for audio communication. In some embodiments, the processor 110 can include multiple I2S buses. The processor 110 can be coupled to the audio module 170 via the I2S bus to achieve communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 via the I2S interface to achieve the function of answering a call through a Bluetooth headset.
[0217] The PCM interface can also be used for audio communication, sampling, quantizing and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 can be coupled via a PCM bus interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 via the PCM interface to realize the function of answering calls via a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
[0218] The UART interface is a universal serial data bus used for asynchronous communication. The bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication.
[0219] In some embodiments, the UART interface is generally used to connect the processor 110 and the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 through the UART interface to implement the function of playing music through a Bluetooth headset.
[0220] The MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193. The MIPI interface includes a camera serial interface (CSI), a display serial interface (DSI), etc. In some embodiments, the processor 110 and the camera 193 communicate via the CSI interface to implement the shooting function of the electronic device 100. The processor 110 and the display screen 194 communicate via the DSI interface to implement the display function of the electronic device 100.
[0221] The GPIO interface can be configured by software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 with the camera 193, the display 194, the wireless communication module 160, the audio module 170, the sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.
[0222] The USB interface 130 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transfer data between the electronic device 100 and a peripheral device. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other electronic devices, such as AR devices, etc.
[0223] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present invention is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0224] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. While the charging management module 140 is charging the battery 142, it may also power the electronic device through the power management module 141.
[0225] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera 193, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.
[0226] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0227] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0228] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.
[0229] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.
[0230] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, demodulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0231] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology, etc. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).
[0232] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0233] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
[0234] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.
[0235] The ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. The ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP can be set in the camera 193.
[0236] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
[0237] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
[0238] Video codecs are used to compress or decompress digital videos. The electronic device 100 may support one or more video codecs. Thus, the electronic device 100 may play or record videos in a variety of coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
[0239] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.
[0240] The internal memory 121 may include one or more random access memories (RAM) and one or more non-volatile memories (NVM).
[0241] In some implementations, the internal memory 121 may be used to store the layers that are drawn and rendered by the UI thread.
[0242] Random access memory may include static random-access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM, for example, the fifth generation DDR SDRAM is generally referred to as DDR5 SDRAM), etc.; non-volatile memory may include disk storage devices and flash memory.
[0243] Flash memory can be divided into NOR FLASH, NAND FLASH, 3D NAND FLASH, etc. according to the operating principle; single-level cell (SLC), multi-level cell (MLC), triple-level cell (TLC), quad-level cell (QLC), etc. according to the storage unit potential level; universal flash storage (UFS), embedded multi media card (eMMC), etc. according to the storage specification.
[0244] The random access memory can be directly read and written by the processor 110, and can be used to store executable programs (such as machine instructions) of the operating system or other running programs, and can also be used to store user and application data, etc.
[0245] The non-volatile memory may also store executable programs and user and application data, etc., and may be loaded into the random access memory in advance for direct reading and writing by the processor 110 .
[0246] The external memory interface 120 can be used to connect to an external non-volatile memory to expand the storage capacity of the electronic device 100. The external non-volatile memory communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music and videos are stored in the external non-volatile memory.
[0247] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.
[0248] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.
[0249] The speaker 170A, also called a "speaker", is used to convert an audio electrical signal into a sound signal. The electronic device 100 can listen to music or listen to a hands-free call through the speaker 170A.
[0250] The receiver 170B, also called a "earpiece", is used to convert audio electrical signals into sound signals. When the electronic device 100 receives a call or voice message, the voice can be received by placing the receiver 170B close to the human ear.
[0251] Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting their mouth close to microphone 170C to input the sound signal into microphone 170C. The electronic device 100 can be provided with at least one microphone 170C. In other embodiments, the electronic device 100 can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify the sound source, realize directional recording function, etc.
[0252] The earphone interface 170D is used to connect a wired earphone and can be a USB interface 130 or a 3.5 mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.
[0253] The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be set on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. The capacitive pressure sensor can be a parallel plate including at least two conductive materials. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure according to the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the touch operation intensity according to the pressure sensor 180A. The electronic device 100 can also calculate the touch position according to the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities can correspond to different operation instructions. For example: when a touch operation with a touch operation intensity less than the first pressure threshold acts on the short message application icon, an instruction to view the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, an instruction to create a new short message is executed.
[0254] The gyro sensor 180B can be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (ie, x, y, and z axes) can be determined by the gyro sensor 180B. The gyro sensor 180B can be used for anti-shake shooting.
[0255] For example, when the shutter is pressed, the gyro sensor 180B detects the shaking angle of the electronic device 100, calculates the distance that the lens module needs to compensate according to the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse movement to achieve anti-shake. The gyro sensor 180B can also be used for navigation and somatosensory game scenes.
[0256] The air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist positioning and navigation.
[0257] The magnetic sensor 180D includes a Hall sensor. The electronic device 100 can use the magnetic sensor 180D to detect the opening and closing of the flip leather case. In some embodiments, when the electronic device 100 is a flip phone, the electronic device 100 can detect the opening and closing of the flip cover according to the magnetic sensor 180D. Then, according to the detected opening and closing state of the leather case or the opening and closing state of the flip cover, the flip cover can be automatically unlocked.
[0258] The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in all directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of the electronic device and is applied to applications such as horizontal and vertical screen switching and pedometers.
[0259] The distance sensor 180F is used to measure the distance. The electronic device 100 can measure the distance by infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 can use the distance sensor 180F to measure the distance to achieve fast focusing.
[0260] The proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic device 100 emits infrared light outward through the light emitting diode. The electronic device 100 uses the photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100. When insufficient reflected light is detected, the electronic device 100 can determine that there is no object near the electronic device 100.
[0261] The electronic device 100 can use the proximity light sensor 180G to detect that the user holds the electronic device 100 close to the ear to make a call, so as to automatically turn off the screen to save power. The proximity light sensor 180G can also be used for automatic unlocking and locking of the screen in the leather case mode and pocket mode.
[0262] The ambient light sensor 180L is used to sense the ambient light brightness. The electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in a pocket to prevent accidental touches.
[0263] The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to implement fingerprint unlocking, access application locks, fingerprint photography, fingerprint call answering, etc.
[0264] The temperature sensor 180J is used to detect temperature. In some embodiments, the electronic device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy.
[0265] For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the electronic device 100 reduces the performance of a processor located near the temperature sensor 180J to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to prevent the electronic device 100 from shutting down abnormally due to low temperature. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 boosts the output voltage of the battery 142 to prevent abnormal shutdown due to low temperature.
[0266] The touch sensor 180K is also called a "touch control device". The touch sensor 180K can be set on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, also called a "touch control screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device 100, which is different from the position of the display screen 194.
[0267] The bone conduction sensor 180M can obtain a vibration signal. In some embodiments, the bone conduction sensor 180M can obtain a vibration signal of a vibrating bone block of the vocal part of the human body. The bone conduction sensor 180M can also contact the human pulse to receive a blood pressure beat signal. In some embodiments, the bone conduction sensor 180M can also be set in an earphone and combined into a bone conduction earphone. The audio module 170 can parse out a voice signal based on the vibration signal of the vibrating bone block of the vocal part obtained by the bone conduction sensor 180M to realize a voice function. The application processor can parse the heart rate information based on the blood pressure beat signal obtained by the bone conduction sensor 180M to realize a heart rate detection function.
[0268] The key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key or a touch key. The electronic device 100 may receive key input and generate key signal input related to user settings and function control of the electronic device 100.
[0269] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. For touch operations acting on different areas of the display screen 194, motor 191 can also correspond to different vibration feedback effects. Different application scenarios (for example: time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.
[0270] Indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, messages, missed calls, notifications, etc.
[0271] The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to and separated from the electronic device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195. The electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, and the like. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to implement functions such as calls and data communications. In some embodiments, the electronic device 100 uses an eSIM, i.e., an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.
[0272] An embodiment of the present application also provides a computer storage medium, which includes computer instructions. When the computer instructions are executed on the above-mentioned electronic device, the electronic device executes each function or step executed by the electronic device in the above-mentioned method embodiment.
[0273] The embodiment of the present application also provides a computer program product, when the computer program product is run on a computer, the computer executes each function or step performed by the electronic device in the above method embodiment. The computer may be the above electronic device. Through the description of the above implementation mode, it can be clearly understood by those skilled in the art that for the convenience and simplicity of description, only the division of the above functional modules is used as an example. In practical applications, the above functional distribution can be completed by different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.
[0274] In the 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 schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0275] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0276] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0277] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0278] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application shall be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims
1. A method for image display, characterized in that: The method is applied to an electronic device, and the method comprises: At a first moment, the electronic device draws a first layer and then renders the first layer, and the duration of drawing and rendering the first layer does not exceed a single signal cycle, where the signal cycle is a cycle of two adjacent vertical synchronization signals generated by the electronic device; At a second moment, the electronic device draws a second layer and then renders the second layer, the duration of drawing and rendering the second layer exceeds a single signal cycle and does not exceed two signal cycles, the second moment is after the first moment, and the second moment is separated from the first moment by a single signal cycle; At a third moment, the electronic device synthesizes the first layer to obtain a first image, the third moment is located after the first moment, and the third moment is separated from the first moment by two signal cycles; At a fourth moment, the electronic device displays the first image and synthesizes the second layer to obtain a second image, and the fourth moment is separated from the third moment by a single signal cycle; At a fifth moment, the electronic device displays the second image, and the fifth moment is separated from the fourth moment by a single signal cycle.
2. The method according to claim 1, characterized in that In a case where the duration of drawing the second layer does not exceed a single signal cycle, after the electronic device completes drawing the second layer, the method further includes: At the third moment, the electronic device draws a third layer and then renders the third layer, and the duration of drawing and rendering the third layer does not exceed two signal cycles; At the fifth moment, the electronic device synthesizes the third layer to obtain a fifth image; At a sixth moment, the electronic device displays the fifth image, and the sixth moment is separated from the fifth moment by a single signal cycle.
3. The method according to claim 1, characterized in that In a case where the duration of drawing the second layer exceeds a single signal cycle, after the electronic device completes drawing the second layer, the method further includes: After the third moment, in response to the electronic device completing drawing the second layer, the electronic device draws a third layer and then renders the third layer, and the duration of drawing and rendering the third layer does not exceed two signal cycles; At the fifth moment, the electronic device synthesizes the third layer to obtain a fifth image; At a sixth moment, the electronic device displays the fifth image, and the sixth moment is separated from the fifth moment by a single signal cycle.
4. The method according to claim 2, characterized in that: When the duration of drawing the second layer does not exceed a single signal cycle, and the duration of drawing and rendering the third layer does not exceed a single signal cycle, After the electronic device completes rendering the third layer and before the fourth moment, only the second layer and the third layer are stored in the cache queue of the electronic device.
5. The method according to claim 1, characterized in that The electronic device includes a cache queue, which is used to store layers that have been drawn and rendered by the electronic device but not yet synthesized, and the maximum storage capacity of the cache queue is two frames of layers.
6. The method according to claim 1, characterized in that The first moment and the second moment are both moments when a first vertical synchronization signal for triggering drawing and rendering of a layer is received; The third moment and the fourth moment are both moments when a second vertical synchronization signal for triggering a composite layer is received; The fifth moment is the moment when a third vertical synchronization signal for triggering display of an image is received; The periods and phases of the first vertical synchronization signal, the second vertical synchronization signal, and the third vertical synchronization signal are the same, and the period is consistent with the signal period.
7. The method according to claim 6, characterized in that At the third moment, before the electronic device synthesizes the first layer to obtain the first image, the method further includes: The electronic device determines, according to the first moment of receiving the first vertical synchronization signal, a moment two signal cycles after the first moment as the third moment; At the fourth moment, before the electronic device synthesizes the second layer to obtain the second image, the method further includes: The electronic device determines, according to the second moment when the first vertical synchronization signal is received, a moment two signal cycles after the second moment as the fourth moment.
8. The method according to claim 1, characterized in that At the first moment, the electronic device draws the first layer and before rendering the first layer, the method further includes: The electronic device starts a first application, and the first application includes one or more of the following: a casual stand-alone game, a casual online game, and a non-competitive game.
9. The method according to any one of claims 1 to 8, characterized in that The electronic device further includes: a drawing thread, a rendering thread, a graphics synthesizer, and a display screen, wherein: At the first moment, the drawing thread is used to draw the first layer, and then the rendering thread is used to render the first layer; At the second moment, the drawing thread is used to draw the second layer, and then the rendering thread is used to render the second layer; At the third moment, the graphic synthesizer is used to synthesize the first layer to obtain the first image; At the fourth moment, the display screen is used to display the first image, and the graphic synthesizer is used to synthesize the second layer to obtain the second image; At the fifth moment, the display screen is used to display the second image.
10. An electronic device, characterized in that: include: One or more processors, one or more memories; wherein the one or more memories are coupled to the one or more processors, the one or more memories are used to store computer program codes, the computer program codes include computer instructions, and when the one or more processors execute the computer instructions, the electronic device executes the method as described in any one of claims 1-9.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions. When the program instructions are executed on an electronic device, the electronic device executes the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Image processing method based on vertical synchronization signal and electronic equipment
CN110503708A
Image processing method based on vertical synchronization signal and electronic equipment
CN114338952A