WO2024041047A1 - Screen refresh rate switching method and electronic device - Google Patents

Screen refresh rate switching method and electronic device Download PDF

Info

Publication number
WO2024041047A1
WO2024041047A1 PCT/CN2023/094624 CN2023094624W WO2024041047A1 WO 2024041047 A1 WO2024041047 A1 WO 2024041047A1 CN 2023094624 W CN2023094624 W CN 2023094624W WO 2024041047 A1 WO2024041047 A1 WO 2024041047A1
Authority
WO
WIPO (PCT)
Prior art keywords
refresh rate
screen
display screen
signal
surfaceflinger
Prior art date
Application number
PCT/CN2023/094624
Other languages
French (fr)
Chinese (zh)
Inventor
李时进
周健
Original Assignee
荣耀终端有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 荣耀终端有限公司 filed Critical 荣耀终端有限公司
Publication of WO2024041047A1 publication Critical patent/WO2024041047A1/en

Links

Classifications

    • GPHYSICS
    • G09EDUCATION; CRYPTOGRAPHY; DISPLAY; ADVERTISING; SEALS
    • G09GARRANGEMENTS OR CIRCUITS FOR CONTROL OF INDICATING DEVICES USING STATIC MEANS TO PRESENT VARIABLE INFORMATION
    • G09G5/00Control arrangements or circuits for visual indicators common to cathode-ray tube indicators and other visual indicators
    • G09G5/36Control arrangements or circuits for visual indicators common to cathode-ray tube indicators and other visual indicators characterised by the display of a graphic pattern, e.g. using an all-points-addressable [APA] memory
    • G09G5/39Control of the bit-mapped memory
    • G09G5/393Arrangements for updating the contents of the bit-mapped memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/14Digital output to display device ; Cooperation and interconnection of the display device with other functional units
    • G06F3/147Digital output to display device ; Cooperation and interconnection of the display device with other functional units using display panels
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Definitions

  • the present application relates to the field of image processing and display technology, and in particular to a screen refresh rate switching method and electronic equipment.
  • At least two signal periods need to pass at the initial screen refresh rate of the display, for example If the initial screen refresh rate of the display screen is 10Hz and the corresponding signal period is 100ms, it will take at least 200ms to switch the screen refresh rate of the display screen from the low refresh rate of 10Hz back to the high refresh rate of 60Hz, 90Hz or 120Hz. Rate. Under such a mechanism, lag may occur when the screen refresh rate of the display is switched from a low refresh rate back to a high refresh rate.
  • this application provides a screen refresh rate switching method and electronic device, which can quickly switch the screen refresh rate of the display screen from a low refresh rate to a high refresh rate and optimize the switching performance.
  • this application provides a screen refresh rate switching method, which method can be applied to electronic equipment, where the electronic equipment includes a display screen.
  • the method includes: when the screen refresh rate of the display screen is a third refresh rate, in response to the electronic device switching from displaying dynamic images to displaying static images, switching the screen refresh rate of the display screen from the third refresh rate to the first refresh rate rate, and set the signal period of the first Vsync signal to the preset period.
  • the third refresh rate is greater than the first refresh rate, and the first refresh rate is less than or equal to the preset threshold, and the preset period is less than the reciprocal of the first refresh rate.
  • the SurfaceFlinger of the electronic device receives the first refresh rate switching instruction.
  • the first refresh rate switching instruction is used to instruct the screen refresh rate of the display screen to switch from the first refresh rate to the second refresh rate.
  • the second refresh rate is greater than the preset threshold.
  • SurfaceFlinger sends a first refresh rate switching instruction to the display driver of the electronic device.
  • the first Vsync signal is used to trigger SurfaceFlinger for layer synthesis.
  • the display driver switches the screen refresh rate of the display screen from the first refresh rate to the second refresh rate.
  • the screen refresh rate of the display screen is switched from the third refresh rate to the first refresh rate, because the first refresh rate is less than or equal to the preset refresh rate.
  • Set the threshold to a low refresh rate so this can reduce the power consumption of electronic devices when displaying static images.
  • the signal period of the first Vsync signal is set to a preset period. In this way, after the electronic device switches from displaying static images to displaying dynamic images, the screen refresh rate of the display screen needs to be switched from the first refresh rate to the second refresh rate.
  • the electronic device can be in the current signal period of the first Vsync signal (i.e., the preset period) At the end, the corresponding first refresh rate switching command is issued. Since the preset period is less than the reciprocal of the first refresh rate, compared to the native mechanism of the Android system, SurfaceFlinger needs to wait until a cycle whose length is the reciprocal of the first refresh rate ends before downloading. By issuing the first refresh rate switching command, the timeliness of SurfaceFlinger's issuance of the first refresh rate switching command is improved, so that the display screen can receive and respond to the first refresh rate switching command in a timely manner and quickly complete the screen refresh rate switching.
  • this application provides a screen refresh rate switching method, which method can be applied to an electronic device, where the electronic device includes a display screen.
  • the method includes: SurfaceFlinger of the electronic device receives a first refresh rate switching instruction from an upper layer.
  • the first refresh rate switching instruction is used to instruct the screen refresh rate of the display screen to switch from the first refresh rate to the second refresh rate.
  • the first refresh rate is less than or equal to the preset threshold, and the second refresh rate is greater than the preset threshold.
  • SurfaceFlinger sends a first refresh rate switching instruction to the display driver of the electronic device.
  • the first Vsync signal is used to trigger SurfaceFlinger for layer synthesis.
  • the signal period of the first Vsync signal is set to a preset period when the screen refresh rate of the display screen is the first refresh rate.
  • the preset period is less than the reciprocal of the first refresh rate.
  • the display driver switches the screen refresh rate of the display screen from the first refresh rate to the second refresh rate.
  • the above-mentioned first refresh rate is less than or equal to the preset threshold, which is a low refresh rate
  • the second refresh rate is greater than the preset threshold, which is a high refresh rate
  • the signal period of the first Vsync signal is set to the preset period.
  • the preset period is less than the reciprocal of the first refresh rate, compared to the native mechanism of the Android system, SurfaceFlinger needs to wait until a cycle whose length is the reciprocal of the first refresh rate ends before it can be issued.
  • the timeliness of SurfaceFlinger issuing the first refresh rate switching command is improved, so that the display screen can also receive the first refresh rate switching command in time, and respond to the first refresh rate switching command in a timely manner to refresh the screen.
  • rate switching thus reducing the switching time of the screen refresh rate of the display screen, avoiding lagging, improving the chirality of the electronic device, and improving the user experience.
  • the above method further includes: The display driver sends a second Vsync signal to SurfaceFlinger according to the first signal period to indicate the screen refresh rate of the display screen to SurfaceFlinger.
  • the second Vsync signal can trigger the display screen to refresh the display image frame, and the first signal period is equal to the reciprocal of the second refresh rate.
  • the display driver periodically sends the second Vsync signal to SurfaceFlinger according to the first signal period (that is, the reciprocal of the second refresh rate).
  • the first signal period that is, the reciprocal of the second refresh rate.
  • SurfaceFlinger used for SurfaceFlinger for Vsync signal calibration.
  • SurfaceFlinger can determine that the screen refresh rate of the display screen has switched to the second refresh rate based on the period of receiving the second Vsync signal, and SurfaceFlinger can periodically generate the first Vsync signal according to the reciprocal of the second refresh rate.
  • the first Vsync signal and the second Vsync signal can maintain periodic synchronization.
  • the SurfaceFlinger of the electronic device receives the Before the first refresh rate switching instruction from the upper layer, the above method further includes: the display screen receives a second refresh rate switching instruction.
  • the second refresh rate switching instruction is used to instruct the screen refresh rate of the display screen to switch to the first refresh rate.
  • the display screen switches the screen refresh rate of the display screen to a preset refresh rate, and sends a second Vsync signal to SurfaceFlinger through the display driver according to the preset cycle.
  • the preset period is equal to the reciprocal of the preset refresh rate, and the preset refresh rate is greater than the preset threshold.
  • SurfaceFlinger receives the second Vsync signal from the display driver.
  • the display screen after the display screen receives the second refresh rate switching command, it can respond to the second refresh rate switching command by first switching the screen refresh rate of the display screen to the preset refresh rate, so that according to the preset cycle, Periodically send the second Vsync signal to SurfaceFlinger for SurfaceFlinger to perform Vsync signal calibration. After SurfaceFlinger completes the Vsync signal calibration, it can set the signal period of the first Vsync signal to the preset period and run according to the preset period. In this way, when a new refresh rate switching command is subsequently received (such as a first refresh rate command), the new refresh rate switching command can be issued in time.
  • a new refresh rate switching command is subsequently received (such as a first refresh rate command)
  • the new refresh rate switching command can be issued in time.
  • the method further includes: in response to the second refresh rate switching instruction, the display screen switches the screen refresh rate of the display screen to the first refresh rate after a preset period of time.
  • the display screen after the display screen receives the second refresh rate switching instruction, it can first switch the screen refresh rate of the display screen to the preset refresh rate in response to the second refresh rate switching instruction. In this way, the display screen can periodically send the second Vsync signal to SurfaceFlinger according to the preset cycle for SurfaceFlinger to perform Vsync signal calibration. After SurfaceFlinger completes the Vsync signal calibration, you can set the signal period of the first Vsync signal to the preset period.
  • the display screen can switch the screen refresh rate of the display screen to the first refresh rate after a preset period of time, that is, it runs according to a cycle whose length is the reciprocal of the first refresh rate, that is, according to the length
  • the display image frame is refreshed in a reciprocal period of the first refresh rate to reduce power consumption.
  • the preset refresh rate is a screen refresh rate supported by the display screen.
  • the display screen after the display screen receives the second refresh rate switching instruction, it can respond to the second refresh rate switching instruction and refresh the screen of the display screen before switching the screen refresh rate of the display screen to the first refresh rate. rate switches to the default refresh rate. In this way, the display screen can send the second Vsync signal to SurfaceFlinger according to the preset period for SurfaceFlinger to perform Vsync signal calibration.
  • the first refresh rate is a target refresh rate when the display screen displays a static image.
  • the screen refresh rate of the display screen can be set to the first refresh rate (low refresh rate) to reduce power consumption.
  • the preset refresh rate is 120Hz; the first refresh rate is 10Hz or 1Hz; and the second refresh rate is 60Hz, 90Hz or 120Hz.
  • the display screen after the display screen receives the second refresh rate switching instruction, it can first switch the screen refresh rate of the display screen to the preset refresh rate of 120 Hz in response to the second refresh rate switching instruction. In this way, the display screen can send the second Vsync signal to SurfaceFlinger according to the 8ms cycle for SurfaceFlinger to perform Vsync signal calibration. After SurfaceFlinger completes the Vsync signal calibration, the first Vsync signal can be The cycle is set to 8ms and runs according to the 8ms cycle.
  • the display screen can switch the screen refresh rate of the display screen to 10Hz or 1Hz after a preset period of time, that is, it runs according to a cycle of 100ms or 1000ms, that is, it refreshes the display according to a cycle of 100ms or 1000ms. image frames to reduce power consumption.
  • SurfaceFlinger receives the first refresh rate switching command
  • SurfaceFlinger can issue the first refresh rate switching command after the current 8ms cycle ends, so that the display screen receives the first refresh rate switching command in time and
  • the screen refresh rate is switched to 60Hz, 90Hz or 120Hz.
  • the first refresh rate switching instruction is triggered by the electronic device after receiving a notification or user operation when displaying a static image.
  • notifications or user operations are used to trigger the electronic device to update the interface.
  • the electronic device when it displays a static image, if it receives a notification or user operation, it can trigger the first refresh rate switching instruction, thereby controlling the screen refresh rate of the display screen from the first refresh rate (low refresh rate) Switch to the second refresh rate (high refresh rate).
  • the second refresh rate switching instruction is triggered when the electronic device switches from displaying dynamic images to displaying static images.
  • the electronic device when the electronic device switches from displaying dynamic images to displaying static images, it can trigger the second refresh rate switching instruction to control the screen refresh rate of the display screen to switch to the first refresh rate (low refresh rate) to reduce power consumption. .
  • the present application provides an electronic device, which includes a display screen, a memory, and one or more processors.
  • the display, memory and processor are coupled.
  • the memory is used to store computer program code, which includes computer instructions.
  • the electronic device executes the method described in the first aspect or the second aspect and any possible design manner thereof.
  • the present application provides a chip system, which is applied to an electronic device including a display screen.
  • the chip system includes one or more interface circuits and one or more processors.
  • the interface circuit and the processor are interconnected through lines.
  • the interface circuit is used to receive signals from the memory of the electronic device and send signals to the processor, the signals including computer instructions stored in the memory.
  • the processor executes the computer instructions
  • the electronic device executes the method described in the first aspect or the second aspect and any possible design manner thereof.
  • the present application provides a computer storage medium that includes computer instructions.
  • the computer instructions When the computer instructions are run on an electronic device, the electronic device causes the electronic device to execute the first aspect or the second aspect and any possibility thereof. The design method described.
  • the present application provides a computer program product.
  • the computer program product When the computer program product is run on a computer, it causes the computer to execute the method described in the first aspect or the second aspect and any possible design manner thereof.
  • Figure 1 is a schematic diagram of the Vsync mechanism of an Android system in an embodiment of the present application
  • Figure 2A is a block diagram of an electronic device software structure provided by an embodiment of the present application.
  • Figure 2B is a schematic diagram of the hardware structure of an electronic device provided by an embodiment of the present application.
  • Figure 3 is a flow chart of a native refresh rate switching of the Android system in an embodiment of the present application
  • Figure 4 is a refresh rate switching flow chart provided by an embodiment of the present application.
  • FIG. 5 is a schematic diagram of refresh rate switching provided by an embodiment of the present application.
  • Figure 6 is another refresh rate switching flow chart provided by an embodiment of the present application.
  • Figure 7 is another refresh rate switching schematic diagram provided by an embodiment of the present application.
  • Figure 8A is another refresh rate switching flow chart provided by an embodiment of the present application.
  • Figure 8B is another refresh rate switching schematic diagram provided by an embodiment of the present application.
  • Figure 9 is a flow chart of interaction between modules in a screen refresh rate switching method provided by an embodiment of the present application.
  • Figure 10 is a schematic structural diagram of a chip system provided by an embodiment of the present application.
  • the display process of an application in an Android terminal device can be divided into three stages: APP drawing and rendering, layer integrator (SurfaceFlinger) synthesis, and display refresh display.
  • the screen refresh rate is divided into vertical refresh rate and horizontal refresh rate.
  • the generally mentioned screen refresh rate usually refers to the vertical refresh rate.
  • the vertical refresh rate indicates the number of times the image displayed on the display is refreshed per second, measured in Hz (hertz). For example, a 60Hz screen means that a display can refresh and display image frames 60 times in 1 second. The higher the screen refresh rate, the more times the display can refresh and display image frames in 1 second. Correspondingly, the smoothness of the picture will be higher.
  • Frame rate refers to the number of frames of images generated by the graphics card (graphics processor) per second.
  • Frame rate number of frames (Frames)/time (Time), the unit is frames per second (frames per second, f/s, also called fps).
  • a high frame rate results in smoother, more realistic animations. The higher the frame rate (fps), the smoother the displayed action will be. Now the performance of graphics cards has improved significantly, and the frame rates that can be achieved are getting higher and higher. But if the frame rate exceeds the screen refresh rate, it will only waste graphics processing power, so the frame rate that exceeds the refresh rate is wasted. And because the display can't update at the same speed, frame rates that are too high can cause screen tearing.
  • Vsync vertical synchronization
  • the display principle of the Android system is based on the Vsync mechanism. Under the Vsync mechanism, there are two types of Vsync signals in the Android system: one is the Vsync signal generated by hardware, which can be called the hardware Vsync signal (Vsync-HW signal, later called the second Vsync signal); the other is software simulated
  • the Vsync signal can be called a software Vsync signal (hereinafter referred to as the first Vsync signal).
  • the first Vsync signal may include a Vsync-APP signal and a Vsync-SF signal.
  • SurfaceFlinger can receive the second Vsync signal and perform Vsync signal calibration, that is, generate the first Vsync signal according to the second Vsync signal, so that the first Vsync signal and the second Vsync signal maintain period synchronization, that is, make the signal of the first Vsync signal
  • the period varies with the signal period of the second Vsync signal.
  • the signal period of the second Vsync signal is equal to the reciprocal of the screen refresh rate of the display screen. For example, when switching the screen refresh rate, SurfaceFlinger turns on Vsync signal calibration.
  • the frequency of the second Vsync signal reported by the display screen switches from 60Hz to 120Hz, that is, the signal period of the second Vsync signal switches from 16ms to 8ms.
  • SurfaceFlinger turns on Vsync signal calibration, receives the second Vsync signal, and determines that the display has completed the screen refresh rate switch based on the cycle of receiving the second Vsync signal, then switches the signal cycle of the first Vsync signal from 16ms to 8ms. , to maintain periodic synchronization of the first Vsync signal and the second Vsync signal.
  • SurfaceFlinger can use the DiscSync::addResyncSample function to determine whether a second Vsync signal needs to be input. If not needed, SurfaceFlinger can turn off the second Vsync signal input through the EventControlThread thread, thus turning off Vsync signal calibration. After a period of time, if SurfaceFlinger needs to receive the second Vsync signal again to calibrate the first Vsync signal, the second Vsync signal input can be enabled again through the EventControlThread thread to enable Vsync signal calibration.
  • the refresh process of the display screen is from left to right (horizontal refresh, Horizontal Scanning) and from top to bottom (vertical refresh, Vertical Scanning), sequentially displaying the pixels on the image.
  • a vertical refresh cycle is completed, there will be a short blank period (ie, Vertical Blanking Interval, VBI, vertical retrace period).
  • VBI Vertical Blanking Interval
  • the display screen sends out the second Vsync signal. Therefore, the V in Vsync refers to the vertical in vertical refresh.
  • the period during which the display screen sends the second Vsync signal is equal to the time it takes for the display screen to refresh and display an image frame.
  • Vsync for example, under the Vsync mechanism, in the display process of APP in Android terminal devices, APP drawing and rendering are triggered by the Vsync-APP signal, SurfaceFlinger synthesis is triggered by the Vsync-SF signal, and display refresh display is triggered by the second Vsync signal.
  • the APP After receiving a Vsync-APP signal, the APP starts drawing and rendering the next image frame by calling the Central Processing Unit (CPU) and Graphic Processing Unit (GPU).
  • CPU Central Processing Unit
  • GPU Graphic Processing Unit
  • SurfaceFlinger receives a Vsync-SF signal, it starts synthesizing the next image frame.
  • the display screen receives a Vsync-HW signal, it starts displaying the next image frame.
  • FIG. 1 shows a schematic diagram of the Android Vsync mechanism. As shown in Figure 1, based on the Vsync mechanism of the Android system, the Android terminal device display process is as follows:
  • the display screen displays the image frame Frame0 synthesized by SurfaceFlinger; the image frame Frame1 synthesized by SurfaceFlinger and drawn and rendered by APP; the APP draws and renders the image frame Frame2;
  • the display screen displays the image frame Frame1 synthesized by SurfaceFlinger; the image frame Frame2 synthesized by SurfaceFlinger and drawn and rendered by APP; the APP draws and renders the image frame Frame3;
  • the display screen displays the image frame Frame2 synthesized by SurfaceFlinger; the image frame Frame3 synthesized by SurfaceFlinger and drawn and rendered by APP; the APP draws and renders the image frame Frame4;
  • the display screen displays the image frame Frame3 synthesized by SurfaceFlinger; the image frame Frame4 drawn and rendered by the APP is synthesized by SurfaceFlinger; the image frame Frame5 is drawn and rendered by the APP, and so on.
  • the signal period refers to the signal period of the first Vsync signal and the second Vsync signal.
  • the first Vsync signal maintains periodic synchronization with the second Vsync signal.
  • the Android terminal device will pass through 2 signal cycles from drawing an image frame to the final display of the image frame on the display screen, which means there is a delay of 2 signal cycles.
  • Software systems of electronic devices can adopt layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture.
  • the embodiment of this application takes the Android system with a layered architecture as an example to illustrate the software structure of the electronic device.
  • FIG. 2A is a software structure block diagram of an electronic device according to an embodiment of the present application.
  • the layered architecture divides the software into several layers, and each layer has clear roles and division of labor.
  • the layers communicate through software interfaces.
  • the Android system is divided into five layers, from top to bottom: application layer, application framework layer, Android runtime (Android runtime, ART) and native C/C++ library, hardware abstraction layer (Hardware Abstract Layer, HAL) and the kernel layer.
  • the application layer can include a series of application packages.
  • the application package can include camera, gallery, calendar, calling, map, navigation, WLAN, Bluetooth, music, video, short message and other applications.
  • the application framework layer provides an application programming interface (API) and programming framework for applications in the application layer.
  • API application programming interface
  • the application framework layer includes some predefined functions.
  • the application framework layer can include the refresh rate control module, SurfaceFlinger, window manager, content provider, view system, resource manager, notification manager, activity manager, input manager, etc.
  • the refresh rate control module has the ability to sense external events.
  • the refresh rate control module can detect user interface (UI) events from the application or hardware abstraction layer or kernel layer of the application layer through APIs.
  • the UI event may be triggered by the user's click operation or sliding operation on the electronic device.
  • the UI event may be automatically triggered by the electronic device.
  • the foreground application of an electronic device automatically switches screens, the above UI event can be triggered.
  • the foreground application is an application corresponding to the interface currently displayed on the display screen of the electronic device.
  • the electronic device receives a message notification and needs to display a pop-up window, which triggers the above UI event.
  • the screen refresh rate suitable for the current display scene can be determined, and the display screen is controlled to switch the screen refresh rate to the screen refresh rate suitable for the current display scene.
  • the switching process of the screen refresh rate of the display screen may include: the refresh rate control module sends a refresh rate switching instruction to SurfaceFlinger, SurfaceFlinger issues the refresh rate switching instruction to HWC (hwcomposer, hardware synthesis module), and HWC then issues the refresh rate
  • the switching instruction is given to the display driver.
  • the display driver After receiving the refresh rate switching instruction, the display driver notifies the display driver chip to switch to the target refresh rate.
  • the display driver chip drives the display (such as OLED or LCD) to complete the screen refresh rate switching and refresh the screen with the new one.
  • the image is refreshed and displayed at a certain rate, and the display driver chip periodically sends a second Vsync signal to the display driver.
  • the display driver reports the second Vsync signal.
  • SurfaceFlinger receives the second Vsync signal, and determines whether the signal period of the second Vsync signal is the period corresponding to the target refresh rate based on the received period of the second Vsync signal. If so, it can be determined that the screen refresh rate switching is completed.
  • SurfaceFlinger generates the corresponding first Vsync signal according to the cycle corresponding to the target refresh rate.
  • APP and SurfaceFlinger will perform layer drawing and layer processing only after receiving the first Vsync signal. Rendering and layer compositing operations. In this way, the frame rate of the layer drawing, layer rendering and layer composition operations of the APP and SurfaceFlinger can be switched to be consistent with the target refresh rate.
  • the window manager provides window management service (Window Manager Service, WMS).
  • WMS can be used for window management, window animation management, surface management, and as a transfer station for the input system.
  • Content providers are used to store and retrieve data and make this data accessible to applications.
  • This data can include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
  • the view system includes visual controls, such as controls that display text, controls that display pictures, etc.
  • a view system can be used to build applications.
  • the display interface can be composed of one or more views.
  • a display interface including a text message notification icon may include a view for displaying text and a view for displaying pictures.
  • the resource manager provides various resources to applications, such as localized strings, icons, pictures, layout files, video files, etc.
  • the notification manager allows applications to display notification information in the status bar, which can be used to convey notification-type messages and can automatically disappear after a short stay without user interaction.
  • the notification manager is used to notify download completion, message reminders, etc.
  • the notification manager can also be notifications that appear in the status bar at the top of the system in the form of charts or scroll bar text, such as notifications for applications running in the background, or notifications that appear on the screen in the form of conversation windows. For example, text information is prompted in the status bar, a beep sounds, the electronic device vibrates, the indicator light flashes, etc.
  • the input manager can provide input management service (Input Manager Service, IMS).
  • IMS can be used to manage system input, such as touch screen input, key input, sensor input, etc.
  • IMS takes out events from the input device node and distributes the events to appropriate windows through interaction with WMS.
  • the Android runtime includes core libraries and Android runtime.
  • the Android runtime is responsible for converting source code into machine code.
  • the Android runtime mainly includes the use of ahead or time (AOT) compilation technology and just in time (JIT) compilation technology.
  • the core library is mainly used to provide basic Java class library functions, such as basic data structures, mathematics, IO, tools, databases, networks and other libraries.
  • the core library provides APIs for users to develop Android applications.
  • Native C/C++ libraries can include multiple function modules. For example: surface manager (surface manager), media framework (Media Framework), libc, OpenGL ES, SQLite, Webkit, etc.
  • the surface manager is used to manage the display subsystem and provides the integration of 2D and 3D layers for multiple applications.
  • the media framework supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc.
  • the media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
  • OpenGL ES provides the drawing and manipulation of 2D graphics and 3D graphics in applications. SQLite provides a lightweight relational database for electronic device 100 applications.
  • the hardware abstraction layer runs in user space, encapsulates the kernel layer driver, and provides a calling interface to the upper layer.
  • the hardware abstraction layer can include HWC.
  • HWC has the function or ability to use hardware to complete the combination and display of image data.
  • the specific image display can be completed by multiple classes such as SurfaceFlinger, HWC, display screen, etc.
  • HWC is a module of the hardware abstraction layer that synthesizes and displays windows/layers in the Android system. Provide hardware support for SurfaceFlinger service.
  • HWC provides all soft layer information to HWC and asks HWC how to process it. Furthermore, HWC can decide whether to use HWC's underlying hardware (for example, hardware synthesizer) or GPU synthesis based on hardware performance; for example, HWC will mark the synthesis method for each layer, whether it is synthesized through GPU or HWC. On the one hand, SurfaceFlinger processes soft layers that require GPU synthesis and submits the results to the display through HWC; on the other hand, soft layers that require hardware compositor synthesis are processed by HWC itself.
  • hardware for example, hardware synthesizer
  • GPU synthesis for example, GPU synthesis
  • HWC will mark the synthesis method for each layer, whether it is synthesized through GPU or HWC.
  • Soft layers that require hardware compositor synthesis are processed by HWC itself.
  • SurfaceFlinger can use 3D graphics processing libraries (such as OpenGL ES) to synthesize layers, which requires and consumes GPU resources.
  • 3D graphics processing libraries such as OpenGL ES
  • Most GPUs are not optimized for layer compositing, and while SurfaceFlinger composites layers through the GPU, applications cannot use the GPU for their own rendering.
  • HWC performs layer synthesis through a hardware synthesizer, which can reduce the synthesis pressure on the GPU.
  • the kernel layer is the layer between hardware and software.
  • the kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.
  • the hardware involved may include display driver chips (such as display driver integrated circuit, DDIC) and display screens (such as OLED or LCD).
  • the display driver is used to drive the DDIC to complete display processing and implementation.
  • the display screen will display the interface of application A.
  • Application A sends the display parameters of the interface to be displayed to SurfaceFlinger.
  • SurfaceFlinger is responsible for controlling the integration of the surface.
  • the interface here may be the interface presented by the status bar, the system bar, the application itself (the interface to be displayed by application A), wallpaper, background, etc. Therefore, SurfaceFlinger can not only obtain the display parameters of the interface to be displayed by application A, but also obtain the display parameters of other interfaces.
  • SurfaceFlinger sends the display parameters of each interface (such as memory address, color, etc.) to HWC through interfaces (such as set Layer Buffer, set Layer Color, etc.) for interface fusion.
  • HWC is obtained through the underlying hardware of HWC (such as hardware synthesizer) according to the display parameters of each interface.
  • HWC sends the underlying hardware-synthesized image to the kernel-layer display driver.
  • the display driver of the kernel layer sends the synthesized image to the display driver chip of the hardware layer.
  • the display driver chip of the hardware layer performs secondary processing on the synthesized image and sends the secondary processed image to the display screen for display.
  • the display driver at the hardware layer directly sends the synthesized image to the display screen for display.
  • the display screen can complete a refresh display process.
  • the electronic device can execute the above refresh display process in a certain period according to the screen refresh rate of the display screen.
  • the screen refresh rate of the display screen is 60Hz
  • the corresponding signal period is 16ms, which is equivalent to executing the above refresh display process every 16ms.
  • the electronic device in the embodiment of the present application 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, and a cellular phone.
  • PDAs personal digital assistants
  • AR augmented reality
  • VR virtual reality
  • FIG. 2B is a schematic structural diagram of an electronic device 200 provided by an embodiment of the present application.
  • the electronic device 200 may include a processor 210, an external memory interface 220, an internal memory 221, a universal serial bus (USB) interface 230, a charging management module 240, a power management module 241, a battery 242, and an antenna 1 , antenna 2, mobile communication module 250, wireless communication module 260, audio module 270, sensor module 280, button 290, motor 291, indicator 292, camera 293, display screen 294, and subscriber identification module (SIM) Card interface 295, etc.
  • SIM subscriber identification module
  • the sensor module 280 may include a touch sensor. It can be understood that the structure illustrated in this embodiment does not constitute a specific limitation on the electronic device 200 . In other embodiments, the electronic device 200 may include more or fewer components than illustrated, or some components may be combined, or some components may be separated, or may be arranged differently. The components illustrated may be implemented in hardware, software, or a combination of software and hardware.
  • Processor 210 may include one or more processing units. Among them, different processing units can be independent devices or integrated in one or more processors.
  • the controller may be the nerve center and command center of the electronic device 200 .
  • the controller can generate operation control signals based on the instruction operation code and timing signals to complete the control of fetching and executing instructions.
  • the processor 210 may also be provided with a memory for storing instructions and data.
  • the memory in processor 210 is cache memory. This memory may hold instructions or data that have been recently used or recycled by processor 210 . If the processor 210 needs to use the instructions or data again, it can be called directly from the memory. Repeated access is avoided and the waiting time of the processor 210 is reduced, thus improving the efficiency of the system.
  • processor 210 may include one or more interfaces. Interfaces may include integrated circuit (inter-integrated circuit, I2C) interface, integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, pulse code modulation (pulse code modulation, PCM) interface, universal asynchronous receiver and transmitter (universal asynchronous receiver/transmitter (UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, subscriber identity module (SIM) interface, and /or universal serial bus (USB) interface, etc.
  • I2C integrated circuit
  • I2S integrated circuit built-in audio
  • PCM pulse code modulation
  • UART universal asynchronous receiver and transmitter
  • MIPI mobile industry processor interface
  • GPIO general-purpose input/output
  • SIM subscriber identity module
  • USB universal serial bus
  • the interface connection relationships between the modules illustrated in this embodiment are only schematic illustrations and do not constitute a structural limitation of the electronic device 200 .
  • the electronic device 200 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
  • the charge management module 240 is used to receive charging input from the charger. While charging the battery 242, the charging management module 240 can also provide power to the electronic device through the power management module 241.
  • the power management module 241 is used to connect the battery 242, the charging management module 240 and the processor 210.
  • the power management module 241 receives input from the battery 242 and/or the charging management module 240 and supplies power to the processor 210, internal memory 221, external memory, display screen 294, camera 293, wireless communication module 260, etc.
  • the power management module 241 may also be provided in the processor 210 .
  • the power management module 241 and the charging management module 240 may also be provided in the same device.
  • the wireless communication function of the electronic device 200 can be implemented through the antenna 1, the antenna 2, the mobile communication module 250, the wireless communication module 260, the modem processor and the baseband processor.
  • Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals.
  • Each antenna in electronic device 200 may be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example: Antenna 1 can be reused as a diversity antenna for a wireless LAN.
  • the mobile communication module 250 can provide wireless communication solutions including 2G/3G/4G/5G applied to the electronic device 200 .
  • the mobile communication module 250 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc.
  • the mobile communication module 250 can receive electromagnetic waves from the antenna 1, perform filtering, amplification and other processing on the received electromagnetic waves, and transmit them to the modem processor for demodulation.
  • the mobile communication module 250 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves through the antenna 1 for radiation.
  • a modem processor may include a modulator and a demodulator.
  • 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.
  • the baseband processor After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor.
  • the application processor outputs sound signals through the audio device, or displays images or videos through the display screen 294.
  • the wireless communication module 260 can provide applications on the electronic device 200 including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) network), Bluetooth (bluetooth, BT), and global navigation satellites.
  • WLAN wireless local area networks
  • System global navigation satellite system, GNSS
  • frequency modulation frequency modulation, FM
  • near field communication technology near field communication, NFC
  • infrared technology infrared, IR
  • the wireless communication module 260 may be one or more devices integrating at least one communication processing module.
  • the wireless communication module 260 receives electromagnetic waves via the antenna 2 , frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 210 .
  • the wireless communication module 260 can also receive the signal to be sent from the processor 210, frequency modulate it, amplify it, and convert it into electromagnetic waves through the antenna 2 for radiation.
  • the antenna 1 of the electronic device 200 is coupled to the mobile communication module 250, and the antenna 2 is coupled to the wireless communication module 260, so that the electronic device 200 can communicate with the network and other devices through wireless communication technology.
  • the electronic device 200 implements display functions through a GPU, a display screen 294, an application processor, and the like.
  • the GPU is an image processing microprocessor and is connected to the display screen 294 and the application processor. GPUs are used to perform mathematical and geometric calculations for graphics rendering.
  • Processor 210 may include one or more GPUs that execute program instructions to generate or alter display information.
  • the display screen 294 is used to display images, videos, etc.
  • the display screen 294 includes a display panel.
  • the display panel can use 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 (active-matrix organic light emitting diode).
  • LCD liquid crystal display
  • OLED organic light-emitting diode
  • AMOLED organic light-emitting diode
  • FLED flexible light-emitting diode
  • Miniled MicroLed
  • Micro-OLED quantum dot light emitting diode
  • QLED quantum dot light emitting diode
  • the display screen 294 in the embodiment of the present application may be a touch screen. That is, the display screen 294 integrates a touch sensor.
  • the touch sensor may also be referred to as a "touch panel.” That is to say, the display screen 294 may include a display panel and a touch panel.
  • the touch sensor and the display screen 294 form a touch screen, which is also called a "touch screen”.
  • Touch sensors are used to detect touches on or near them. After the touch operation detected by the touch sensor, it can be passed to the upper layer by the kernel layer driver (such as TP driver) to determine the touch event type. Visual output related to the touch operation may be provided through display screen 294. In other embodiments, the touch sensor may also be provided The surface of the electronic device 200 is in a different position from the display screen 294 .
  • the electronic device 200 can implement the shooting function through an ISP, a camera 293, a video codec, a GPU, a display screen 294, and an application processor.
  • the ISP is used to process the data fed back by the camera 293.
  • Camera 293 is used to capture still images or video.
  • Digital signal processors are used to process digital signals. In addition to digital image signals, they can also process other digital signals.
  • Video codecs are used to compress or decompress digital video.
  • Electronic device 200 may support one or more video codecs. In this way, the electronic device 200 can play or record videos in multiple encoding formats, such as: moving picture experts group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
  • MPEG moving picture experts group
  • the external memory interface 220 can be used to connect an external memory card, such as a MicroSD card, to expand the storage capacity of the electronic device 200 .
  • the external memory card communicates with the processor 210 through the external memory interface 220 to implement the data storage function. Such as saving music, videos, etc. files in external memory card.
  • Internal memory 221 may be used to store computer executable program code, which includes instructions.
  • the processor 210 executes instructions stored in the internal memory 221 to execute various functional applications and data processing of the electronic device 200 .
  • the processor 210 can execute instructions stored in the internal memory 221, and the internal memory 221 can include a program storage area and a data storage area.
  • the stored program area can store an operating system, at least one application program required for a function (such as a sound playback function, an image playback function, etc.).
  • the storage data area may store data created during use of the electronic device 200 (such as audio data, phone book, etc.).
  • the internal memory 221 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.
  • the electronic device 200 can implement audio functions through the audio module 270, the speaker 270A, the receiver 270B, the microphone 170C, the headphone interface 270D, and the application processor. Such as music playback, recording, etc.
  • the audio module 270 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. Audio module 270 may also be used to encode and decode audio signals.
  • the buttons 290 include a power button, a volume button, etc.
  • Key 290 may be a mechanical key. It can also be a touch button.
  • the electronic device 200 may receive key input and generate key signal input related to user settings and function control of the electronic device 200 .
  • the motor 291 can generate vibration prompts.
  • the motor 291 can be used for vibration prompts for incoming calls and can also be used for touch vibration feedback.
  • the indicator 292 may be an indicator light, which may be used to indicate charging status, power changes, or may be used to indicate messages, missed calls, notifications, etc.
  • the SIM card interface 295 is used to connect a SIM card.
  • the SIM card can be connected to or separated from the electronic device 200 by inserting it into the SIM card interface 295 or pulling it out from the SIM card interface 295 .
  • the electronic device 200 may support 1 or N SIM card interfaces, where N is a positive integer greater than 1.
  • SIM card interface 295 can support Nano SIM card, Micro SIM card, SIM card, etc.
  • the electronic device does not receive notifications, etc., no pop-up window appears, and the display screen of the electronic device displays a static image, at this time, the screen refresh rate of the display screen is changed from high to high.
  • Switching the refresh rate to a low refresh rate can save power and CPU resources.
  • low refresh rate means that the screen refresh rate of the display screen is less than or equal to the preset threshold, such as the screen refresh rate is 10Hz or 1Hz.
  • High refresh rate means that the screen refresh rate of the display is greater than the preset threshold, such as the screen refresh rate of 60Hz, 90Hz or 120Hz.
  • the display screen needs to exit the low refresh rate and switch back to the high refresh rate.
  • Figure 3 shows a screen refresh rate switching flow chart under the native mechanism of the Android system in a scenario where the display screen needs to exit a low refresh rate and switch back to a high refresh rate.
  • the screen refresh rate switching process under the native mechanism of the Android system includes the following steps:
  • the first refresh rate switching instruction is used to instruct the screen refresh rate of the display screen to switch from the first refresh rate to the second refresh rate.
  • the first refresh rate is less than or equal to the preset threshold, and the second refresh rate is greater than the preset threshold.
  • the frame rate control module of the electronic device will respond to the above situation after sensing the above situation.
  • SurfaceFlinger issues a first refresh rate switching command to instruct the display screen refresh rate to switch from the first refresh rate to the second refresh rate.
  • SurfaceFlinger receives the first refresh rate switching instruction.
  • a first Vsync signal will be generated to trigger SurfaceFlinger to perform new layer synthesis, and Send the first refresh rate switching command to the display driver; and start Vsync signal calibration.
  • the display driver receives the first refresh rate switching command and sends the first refresh rate switching command to the display screen.
  • the display screen receives the first refresh rate switching instruction, and refreshes and displays an image frame in the i+1th signal period.
  • the display screen refreshes and displays one image frame.
  • the screen refresh rate of the display screen is switched from the first refresh rate to the second refresh rate, and the image frame is refreshed and displayed according to the second refresh rate.
  • the display screen periodically sends the second Vsync signal to the display driver according to the second refresh rate.
  • the signal period of the second Vsync signal can be switched from T1 to the signal period T2 corresponding to the second refresh rate f2, and a second Vsync signal is reported to the display driver every other T2.
  • the display driver periodically receives the second Vsync signal from the display screen, and reports the received second Vsync signal to SurfaceFlinger.
  • SurfaceFlinger periodically receives the second Vsync signal. If the period of receiving the second Vsync signal (period, that is, the interval between receiving two adjacent second Vsync signals) is T2, SurfaceFlinger confirms that the screen refresh rate switching is completed and turns off Vsync signal calibration. If the period of the second Vsync signal received by SurfaceFlinger is not equal to T2, step S307 is continued.
  • step S306 after SurfaceFlinger confirms that the screen refresh rate switching is completed, it adjusts the signal period of the first Vsync signal to T2, which needs to take effect at the end of the i+2th signal period, that is, That is to say, SurfaceFlinger can periodically generate the first Vsync signal (including the Vsync-APP signal and the Vsync-SF signal) at the second refresh rate and with T2 as the period at the end of the i+2 signal period.
  • the first refresh rate is 10Hz, and the corresponding T1 is 100ms.
  • the second refresh rate is 60Hz, and the corresponding T2 is 16ms.
  • the default refresh rate is 120Hz, and the corresponding preset period is 8ms.
  • the display screen after the display screen receives the first refresh rate switching command, it still needs to perform an image frame refresh display according to the current signal cycle (i+1th signal cycle) before changing the screen refresh rate of the display screen from the first refresh rate to the first refresh rate switching command.
  • the refresh rate is switched to the second refresh rate, that is, the signal period of the second Vsync signal is switched from T1 to T2 (for example, 16 ms), and a second Vsync signal is reported to the display driver every T2.
  • SurfaceFlinger receives the second Vsync signal, and determines whether the signal period of the second Vsync signal is T2 based on the interval between receiving the two second Vsync signals. If so, it can be confirmed that the screen refresh rate switching is completed.
  • the entire screen refresh rate switching process (from SurfaceFlinger receiving the first refresh rate switching instruction to SurfaceFlinger generating the first Vsync signal at the second refresh rate) requires at least two The signal period (the signal period is T1, and the two signal periods are the 2-frame processing time at a low refresh rate) can be completed.
  • the first situation SurfaceFlinger receives the first refresh rate switching instruction when the i-th signal period is about to end, that is, the t1 moment shown in Figure 3 is close to the end of the i-th signal period, x1 ⁇ 0.
  • SurfaceFlinger issues the first refresh rate switching command at the beginning of the i+1th signal cycle.
  • the display screen receives the first refresh rate switching command during the i+1th signal cycle. According to the current signal cycle (ith signal cycle) +1 signal period) after executing an image frame refresh display, the screen refresh rate of the display screen is switched from the first refresh rate to the second refresh rate, and a second Vsync signal is reported to the display driver every T2.
  • SurfaceFlinger receives the second Vsync signal, and determines whether the signal period of the second Vsync signal is T2 based on the interval between receiving the two second Vsync signals. If so, it can be confirmed that the screen refresh rate switch is completed. At this time, it is already in the second Vsync signal. Within i+2 signal periods. Therefore, SurfaceFlinger needs to end at the current signal period (i+2 signal period) (at the t2 moment as shown in Figure 3) to generate the first Vsync signal at the second refresh rate and with T2 as the signal period.
  • the first situation is the situation where the entire screen refresh rate switching process takes the shortest time.
  • the first refresh rate switching instruction is received from SurfaceFlinger to SurfaceFlinger generating the first Vsync signal at the second refresh rate (from t1 time to time t2)
  • the second case SurfaceFlinger receives the first refresh rate switching command at the beginning of the i-th signal cycle, that is, the t1 moment shown in Figure 3 is close to the beginning of the i-th signal cycle, x1 ⁇ 100. but SurfaceFlinger needs to wait until the end of the current signal cycle and issue the first refresh rate switching command at the beginning of the i+1th signal cycle.
  • the display screen receives the first refresh rate switching command within the i+1th signal cycle. It is still necessary to perform an image frame refresh display according to the current signal period (i+1th signal period), and then switch the screen refresh rate of the display screen from the first refresh rate to the second refresh rate, and every T2 Report a second Vsync signal to the display driver.
  • the entire screen refresh rate switching process requires at least 2000ms, or 2s).
  • the screen refresh rate switching process takes less time and will not cause lag problems.
  • the processing mechanism for switching the screen refresh rate of the display from a low refresh rate back to a high refresh rate it takes at least two cycles at a low refresh rate to complete the entire screen refresh rate. switching process. For example, if the initial screen refresh rate of the display is 10Hz, it will take at least 200ms to complete the entire screen refresh rate switching process. For another example, if the initial screen refresh rate of the display is 1Hz, it will take at least 2 seconds to complete the entire screen refresh rate switching process.
  • the screen refresh rate switching process takes a long time and the switching performance is poor. Under such a mechanism, lag may occur when the screen refresh rate of the display screen is switched, seriously affecting the chirality of the electronic device.
  • User operation response delay can be understood as the delay time from "the user performs a click or slide operation on the electronic device" to "the electronic device displays the image corresponding to the click or slide operation and is perceived by the human eye.”
  • the better the tracking performance of the electronic device the better the user experience of controlling the electronic device through clicking or sliding operations, and the smoother it feels.
  • embodiments of the present application provide a screen refresh rate switching method, which can be applied to electronic devices, where the electronic devices include a display screen.
  • the method includes: the SurfaceFlinger of the electronic device receives a first refresh rate switching instruction from an upper layer (such as a frame rate control module of the electronic device).
  • the first refresh rate switching instruction is used to instruct the screen refresh rate of the display screen to switch from the first refresh rate to the second refresh rate.
  • the first refresh rate is less than or equal to the preset threshold
  • the second refresh rate is greater than the preset threshold.
  • SurfaceFlinger sends a first refresh rate switching instruction to the display driver of the electronic device in response to the end of the signal period of the current first Vsync signal.
  • the first Vsync signal is used to trigger SurfaceFlinger for layer synthesis.
  • the signal period of the first Vsync signal is set to a preset period when the screen refresh rate of the display screen is the first refresh rate.
  • the preset period is less than the first The reciprocal of the refresh rate.
  • the display driver switches the screen refresh rate of the display screen from the first refresh rate to the second refresh rate.
  • first refresh rate is less than or equal to the preset threshold, which is a low refresh rate.
  • second refresh rate is greater than the preset threshold, which is a high refresh rate.
  • the display screen of the electronic device displays a static image
  • the screen refresh rate of the display screen is low
  • the user performs a click operation at this time.
  • the electronic device needs to update the display screen of the display screen, and the screen refresh rate of the display screen switches from the first refresh rate to the second refresh rate.
  • the display screen of the electronic device displays a static image
  • the screen refresh rate of the display screen is low
  • the user performs a sliding operation at this time.
  • the electronic device needs to update the display screen of the display screen, and the screen refresh rate of the display screen switches from the first refresh rate to the second refresh rate.
  • the display screen of the electronic device displays a static image, and the screen refresh rate of the display screen is a low refresh rate.
  • the electronic device receives a message notification and the display screen needs to display a pop-up window. That is, it is necessary to update the display screen of the display screen and switch the screen refresh rate of the display screen from the first refresh rate to the second refresh rate.
  • the display screen of the electronic device displays a static image
  • the screen refresh rate of the display screen is a low refresh rate
  • the display screen needs to display animation. That is, it is necessary to update the display screen of the display screen and switch the screen refresh rate of the display screen from the first refresh rate to the second refresh rate.
  • the first Vsync The signal period of the signal is set to the preset period, and SurfaceFlinger runs according to the preset period.
  • SurfaceFlinger can issue the first refresh rate switching command in time, and the display screen can also receive the first refresh rate switching command in time and respond in time.
  • the first refresh rate switching command should be used to switch the screen refresh rate, so that the display can quickly exit the low refresh rate and switch back to the high refresh rate, reducing the screen refresh rate switching time of the display to ensure that the new image frame is pressed
  • Displaying with a high refresh rate can ensure the sliding effect of the display and the smooth display of animation effects, ensuring that users will not feel stuck and ensuring the user experience.
  • the speed with which the electronic device responds to user operations and switches from a low refresh rate back to a high refresh rate can be improved, and the switching performance can be optimized. This can shorten the user operation response delay of the electronic device, improve the tracking performance of the electronic device, and enhance the user experience.
  • the technical solution provided by the embodiment of the present application can make some preparations in advance when the screen refresh rate of the display screen switches to a low refresh rate stage (such as controlling SurfaceFlinger to set its signal period to a preset value at a low refresh rate). cycle), to facilitate the electronic device to switch from a low refresh rate to a high refresh rate, the method (such as S601-S603) in the embodiment of the present application can be executed to solve the corresponding technical problem.
  • embodiments of the present application provide a screen refresh rate switching method for the scenario where the screen refresh rate is switched to a low refresh rate.
  • the method can be applied to electronic devices including display screens.
  • the method includes steps S401-S405.
  • the display screen receives the second refresh rate switching instruction.
  • the second refresh rate switching instruction is used to instruct the screen refresh rate of the display screen to switch to the first refresh rate.
  • the first refresh rate is less than or equal to the preset threshold.
  • the display screen refresh rate of the electronic device can be switched from a high refresh rate to a low refresh rate. refresh rate.
  • the refresh rate of the electronic device can be switched from another refresh rate (such as a third refresh rate) higher than the first refresh rate to the first refresh rate.
  • the screen refresh rate of the display screen can be switched from a high refresh rate to a low refresh rate to reduce power consumption.
  • the electronic device can automatically display the above static image.
  • the upper layer can send a second refresh rate switching instruction to the display screen of the electronic device to instruct the screen refresh rate of the display screen to switch from the third refresh rate to the first refresh rate.
  • the display screen can receive the above-mentioned second refresh rate switching instruction.
  • the electronic device after the electronic device finishes playing the dynamic image (such as a video), it can automatically display the static image.
  • the upper layer can send a second refresh rate switching instruction to the display screen of the electronic device to instruct the screen refresh rate of the display screen to switch from the third refresh rate to the first refresh rate.
  • the display screen can receive the above-mentioned second refresh rate switching instruction.
  • the scenario in which the screen refresh rate of the display screen switches from a high refresh rate to a low refresh rate includes but is not limited to the situation shown in the above example, and other situations will not be described in detail here in the embodiment of the present application.
  • the display screen responds to the second refresh rate switching instruction, switches the screen refresh rate of the display screen to the preset refresh rate, and sends the second Vsync signal to SurfaceFlinger through the display driver according to the preset cycle.
  • the preset period is equal to the reciprocal of the preset refresh rate, and the preset refresh rate is greater than the preset threshold.
  • the second Vsync signal is used to trigger the display screen to refresh the display image frame.
  • S404 SurfaceFlinger determines whether the period of receiving the second Vsync signal from the display driver (ie, the second signal period) is equal to the preset period.
  • step S404 is performed. If the period of receiving the second Vsync signal from the display driver (ie, the second signal period) is not equal to the preset period, step 403 is continued.
  • SurfaceFlinger sets the signal period of the first Vsync signal to the preset period, and stops receiving the second Vsync signal from the display driver. Among them, the first Vsync signal is used to trigger SurfaceFlinger for layer synthesis.
  • the display screen after the display screen receives the second refresh rate switching instruction, in response to the second refresh rate switching instruction, before switching the screen refresh rate of the display screen to a low refresh rate, the display screen first changes the screen refresh rate of the display screen to a low refresh rate. Switch to default refresh rate.
  • the display screen can send the second Vsync signal to SurfaceFlinger according to the preset period (that is, every preset period, a second Vsync signal is reported to SurfaceFlinger through the display driver).
  • the second Vsync signal can be used by SurfaceFlinger to perform Vsync signal calibration to achieve cycle synchronization between the first Vsync signal and the second Vsync signal.
  • the refresh rate switching instruction can be issued in a timely manner.
  • the display screen responds to the second refresh rate switching instruction and switches the screen refresh rate of the display screen to the first refresh rate after a preset period of time.
  • the display screen responds to the second refresh rate switching instruction.
  • SurfaceFlinger has completed the Vsync signal calibration.
  • the screen refresh rate of the display screen can be switched to the first refresh rate, that is, the screen refresh rate can be reduced. How often to refresh display image frames to save power and CPU resources.
  • Vsync signal calibration has been turned off, and SurfaceFlinger continues to run according to the preset cycle.
  • SurfaceFlinger runs according to the preset cycle, if it is to display a static image and the display screen needs to display static content, then the Surface content in the display area is not updated, and SurfaceFlinger does not need to perform a synthesis operation.
  • the APP does not need to perform layer drawing and layer rendering operations. Therefore, SurfaceFlinger runs according to the preset cycle and does not increase the energy consumption of layer composition operations.
  • the preset threshold may be 30 Hz.
  • the preset threshold can be determined based on the screen refresh rate switching performance requirements of the electronic device for the display screen.
  • the preset refresh rate is a screen refresh rate supported by the display screen.
  • the preset refresh rate may be 120 Hz, and the reciprocal of the preset refresh rate, that is, the preset period is 8 ms.
  • the first refresh rate may be 10Hz or 1Hz, and the reciprocal T1 of the first refresh rate is 100ms or 1s.
  • the second refresh rate may be 60Hz, 90Hz or 120Hz, and the reciprocal T2 of the second refresh rate is 16ms, 11ms or 8ms.
  • the second refresh rate switching instruction in the above step S401 is issued to the display screen by SurfaceFlinger.
  • the electronic device such as the frame rate control module of the electronic device
  • it can sequentially send the second refresh rate switching instructions to the display screen (such as the display driver of the display screen) through SurfaceFlinger, HWC, and the display driver. chip).
  • SurfaceFlinger can receive the second refresh rate switching instruction from the upper layer, and in response to the second refresh rate switching instruction, start receiving the second Vsync signal from the lower layer, and issue the second refresh rate switching instruction. to the display.
  • SurfaceFlinger can start receiving the second Vsync signal from the lower layer after receiving the second refresh rate switching command, that is, when SurfaceFlinger determines that the screen refresh rate needs to be switched, Vsync signal calibration is turned on. In this way, SurfaceFlinger can receive the second Vsync signal according to the period (that is, the signal period of the second Vsync signal). Determine whether the screen refresh rate switching is completed, and then complete the Vsync signal calibration, that is, adjust the period during which SurfaceFlinger generates the first Vsync signal (that is, the signal period of the first Vsync signal.
  • the first Vsync signal may include the Vsync-APP signal and the Vsync- SF signal), making the signal period of the first Vsync signal equal to the signal period of the second Vsync signal.
  • SurfaceFlinger can confirm that the screen refresh rate of the display has been switched to the preset refresh rate, and SurfaceFlinger runs according to the preset cycle to synchronize with the screen refresh rate of the display. If a new refresh rate switching command is received later (such as the first refresh rate switching command), SurfaceFlinger can quickly respond to the new refresh rate switching command and issue the new refresh rate switching command after the current preset cycle. This allows the display to quickly switch from a low refresh rate back to a high refresh rate.
  • the screen refresh rate switching process can adopt the screen refresh rate switching method provided in the above embodiment (such as steps S401-S405), and the corresponding signal transmission process between various parts of the electronic device can include S501-S507.
  • SurfaceFlinger receives the second refresh rate switching instruction from the upper layer (such as the frame rate control module) in the i-th signal period.
  • the second refresh rate switching instruction is used to instruct the screen refresh rate of the display screen to change from 60Hz to 60Hz. Switch to 10Hz.
  • the signal period refers to the signal period of the first Vsync signal. In this embodiment, the signal period is 16ms.
  • SurfaceFlinger issues the second refresh rate switching instruction to the display driver through the HWC.
  • the display driver After receiving the second refresh rate switching command, the display driver issues the second refresh rate switching command to the display screen (such as the display driver chip of the display screen).
  • the display screen receives the second refresh rate switching instruction.
  • the display screen first switches the screen refresh rate of the display screen to 120Hz, refreshes and displays the image frames according to the 8ms cycle, and the display screen periodically sends the second Vsync according to the 8ms cycle.
  • the signal is sent to the display driver (that is, a second Vsync signal is reported to the display driver every 8ms).
  • the display driver periodically receives the second Vsync signal from the display screen, and reports the received second Vsync signal to SurfaceFlinger.
  • SurfaceFlinger periodically receives the second Vsync signal, and determines whether the signal period of the second Vsync signal is 8ms based on the period of receiving the second Vsync signal (that is, the interval between receiving two adjacent second Vsync signals). , if so, it can be determined that the screen refresh rate switching is completed and Vsync signal calibration is turned off. If the period of the second Vsync signal is not equal to 8ms, continue to step 507.
  • the display screen responds to the second refresh rate switching instruction and switches the screen refresh rate of the display screen to 10 Hz after a preset period of time.
  • an embodiment of the present application provides a screen refresh rate switching method for the above application scenarios.
  • the method can be applied to electronic devices including display screens.
  • the method includes steps S601-S603.
  • the SurfaceFlinger of the electronic device receives the first refresh rate switching instruction from the upper layer.
  • the first refresh rate switching instruction is used to instruct the screen refresh rate of the display screen to switch from the first refresh rate to the second refresh rate.
  • the first refresh rate is less than or equal to the preset threshold
  • the second refresh rate is greater than the preset threshold.
  • SurfaceFlinger sends a first refresh rate switching instruction to the display driver in response to the end of the signal period of the current first Vsync signal.
  • the first Vsync signal is used to trigger SurfaceFlinger for layer synthesis.
  • the signal period of the first Vsync signal is set to a preset period when the screen refresh rate of the display screen is the first refresh rate. The preset period is less than the reciprocal of the first refresh rate.
  • the display driver switches the screen refresh rate of the display screen from the first refresh rate to the second refresh rate.
  • the electronic device can send the first refresh rate switching instruction to SurfaceFlinger after sensing the above situation.
  • SurfaceFlinger can sequentially send the first refresh rate switching instructions to the display screen (such as the display driver chip of the display screen) through HWC and display driver to instruct the screen refresh rate of the display screen to switch from the first refresh rate to the second refresh rate.
  • the second refresh rate is greater than the first refresh rate.
  • the signal period of the first Vsync signal is set to the preset period.
  • SurfaceFlinger can use the current signal period (preset period) of the first Vsync signal.
  • the first refresh rate switching command is issued. Since the preset period is less than the reciprocal of the first refresh rate, compared to the native mechanism of the Android system, SurfaceFlinger needs to wait until the end of a cycle whose length is the reciprocal of the first refresh rate before it can issue the third refresh rate switching command.
  • the timeliness of SurfaceFlinger's issuance of the first refresh rate switching command is improved, so that the display screen can also receive the first refresh rate switching command in time and respond to the first refresh rate switching command in a timely manner to adjust the screen refresh rate. switching, thus reducing the switching time of the screen refresh rate of the display screen, avoiding lagging, improving the chirality of the electronic device, and improving the user experience.
  • the method further includes: the display driver switches according to the first signal period. , sending a second Vsync signal to SurfaceFlinger to indicate the screen refresh rate of the display to SurfaceFlinger.
  • the second Vsync signal is used to trigger the display screen to refresh the display image frame, and the first signal period is equal to the reciprocal of the second refresh rate.
  • the display driver periodically sends the second Vsync signal to SurfaceFlinger according to the first signal period (that is, the reciprocal of the second refresh rate).
  • the first signal period that is, the reciprocal of the second refresh rate.
  • SurfaceFlinger used for SurfaceFlinger for Vsync signal calibration.
  • SurfaceFlinger can determine that the screen refresh rate of the display screen has switched to the second refresh rate based on the period of receiving the second Vsync signal, and SurfaceFlinger can periodically generate the first Vsync signal according to the reciprocal of the second refresh rate.
  • the first Vsync signal and the second Vsync signal can maintain periodic synchronization.
  • the screen refresh rate switching process can adopt the screen refresh rate switching method provided in the above embodiment (such as steps S601-S603), and the corresponding signal transmission process between various parts of the electronic device can include :
  • SurfaceFlinger receives the first refresh rate switching instruction from the upper layer (such as the frame rate control module of the electronic device) in the j-th signal period, that is, at time t3 as shown in Figure 7.
  • the signal period refers to the signal period of the first Vsync signal. In this embodiment, the signal period is 8ms.
  • S702 SurfaceFlinger responds to the end of the j-th signal period (the start of the j+1-th signal period) and issues the first refresh rate switching instruction to the display driver (for example, sends the second refresh rate switching instruction to the display through HWC). driver), and turn on Vsync signal calibration.
  • the display driver After receiving the first refresh rate switching command, the display driver issues the first refresh rate switching command to the display screen (such as the display driver chip of the display screen).
  • the display screen receives the first refresh rate switching instruction.
  • the display screen drives the display screen to complete the screen refresh rate switching according to the first refresh rate switching instruction, that is, the screen refresh rate of the display screen is switched from the first refresh rate to the second refresh rate, and the image frame is updated according to the second refresh rate.
  • the display is refreshed, and the display screen periodically sends a second Vsync signal to the display driver according to the second refresh rate (a second Vsync signal is reported to the display driver every other first signal period).
  • the display driver periodically receives the second Vsync signal from the display screen, and reports the received second Vsync signal to SurfaceFlinger.
  • SurfaceFlinger periodically receives the second Vsync signal, and determines whether the signal period of the second Vsync signal is 16ms based on the period of receiving the second Vsync signal (that is, the interval between receiving two adjacent second Vsync signals). , if so, it can be determined that the screen refresh rate switching is completed and Vsync signal calibration is turned off. If the period of the second Vsync signal is not equal to 16ms, continue to step 707.
  • the corresponding display screen refreshes the display image frame at the first refresh rate.
  • the reciprocal of the refresh rate T1 and SurfaceFlinger sets the preset refresh rate mode and runs according to the preset refresh rate (such as 120Hz), that is, the signal period of the first Vsync signal is the preset period.
  • the preset period is smaller than the reciprocal T1 of the first refresh rate.
  • SurfaceFlinger receives the second Vsync signal, and determines whether the signal period of the second Vsync signal is based on the interval between receiving the two second Vsync signals. If so, it can be confirmed that the screen refresh rate switching is completed. SurfaceFlinger can generate the first Vsync signal at the frequency of the second refresh rate and the reciprocal T2 of the second refresh rate as the cycle after confirming that the screen refresh rate switching is completed and the current signal cycle is over. Compared with Android's native Vsync mechanism, the switching performance is greatly optimized and the chirality is improved.
  • the first refresh rate is 10 Hz
  • the reciprocal T1 of the first refresh rate is 100 ms.
  • the second refresh rate is 60Hz
  • the reciprocal T2 of the second refresh rate is 16ms.
  • the default refresh rate is 120Hz
  • the reciprocal of the default refresh rate, that is, the default period is 8ms.
  • the first situation SurfaceFlinger receives the first refresh rate switching instruction when the j-th signal period is about to end, that is, the t3 moment shown in Figure 7 is close to the end of the j-th signal period, x2 ⁇ 0.
  • SurfaceFlinger issues the first refresh rate switching command at the beginning of the j+1th signal cycle, and the display screen receives the first refresh rate switching command during the j+1th signal cycle, changing the screen refresh rate of the display screen from The first refresh rate is switched to the second refresh rate, and a second Vsync signal is reported to the display driver every other reciprocal T2 of the second refresh rate.
  • SurfaceFlinger receives the second Vsync signal, and based on the interval between receiving the two second Vsync signals, determines whether the signal period of the second Vsync signal is the reciprocal T2 of the second refresh rate. If so, it can be confirmed that the screen refresh rate switching is completed. At this time, it is already within the j+3 signal period. Therefore, SurfaceFlinger needs to end in the current signal period (j+3 signal period) before it can refresh with the second is the frequency, and the first Vsync signal is generated with the reciprocal T2 of the second refresh rate as the period.
  • the first situation is the situation where the entire screen refresh rate switching process takes the shortest time.
  • the second case SurfaceFlinger receives the first refresh rate switching command at the beginning of the j-th signal period, that is, the t3 moment shown in Figure 7 is close to the beginning of the j-th signal period, x2 ⁇ 8.
  • SurfaceFlinger needs to wait until the end of the current signal cycle and issue the first refresh rate switching command at the beginning of the j+1th signal cycle.
  • the display screen receives the first refresh rate switching command within the j+1th signal cycle. , switching the screen refresh rate of the display screen from the first refresh rate to the second refresh rate, and reporting a second Vsync signal to the display driver every other reciprocal T2 of the second refresh rate.
  • the signal period is the preset period, that is, 8ms, and the two signal periods are 16ms
  • a Vsync signal (from time t3 to time t4) only needs to experience four signal periods (the signal period is the preset period), a total of 32ms.
  • the first refresh rate is a target refresh rate when the display screen displays a static image.
  • the first refresh rate switching instruction is triggered after the electronic device receives a notification or user operation when displaying a static image.
  • notifications or user operations are used to trigger the electronic device to update the interface.
  • the electronic device when it displays a static image, if it receives a notification or user operation, it can trigger the first refresh rate switching instruction, thereby controlling the screen refresh rate of the display screen from the first refresh rate (low refresh rate) Switch to the second refresh rate (high refresh rate).
  • the second refresh rate switching instruction is triggered when the electronic device switches from displaying dynamic images to displaying static images.
  • the electronic device when the electronic device switches from displaying dynamic images to displaying static images, it can trigger the second refresh rate switching instruction to control the screen refresh rate of the display screen to switch to the first refresh rate (low refresh rate) to reduce power consumption. .
  • the screen refresh rate switching method provided by the embodiment of the present application may also include steps S401-S405 before the above step S601.
  • the screen refresh rate switching method provided by the embodiment of the present application can be used to switch the screen refresh rate of the display screen from a certain refresh rate (such as the third refresh rate) to a low refresh rate, and then switch from the low refresh rate to a low refresh rate. to high refresh rates.
  • a certain refresh rate such as the third refresh rate
  • the screen refresh rate of the display screen is the third refresh rate
  • the screen refresh rate of the display screen in response to the electronic device switching from displaying dynamic images to displaying static images, is switched from the third refresh rate to the first refresh rate. rate, and set the signal period of the first Vsync signal to the preset period.
  • the third refresh rate is greater than the first refresh rate
  • the first refresh rate is less than or equal to the preset threshold
  • the preset period is less than the reciprocal of the first refresh rate.
  • the second refresh rate switching instruction in step S401 is used to instruct the screen refresh rate of the display screen to switch from the third refresh rate to the first refresh rate.
  • the above-mentioned third refresh rate may be equal to the second refresh rate.
  • the SurfaceFlinger of the electronic device may receive a first refresh rate switching instruction.
  • the first refresh rate switching instruction is used to instruct the screen refresh rate of the display screen to switch from the first refresh rate to the second refresh rate.
  • the second refresh rate is greater than the preset threshold.
  • SurfaceFlinger sends a first refresh rate switching instruction to the display driver of the electronic device.
  • the first Vsync signal is used to trigger SurfaceFlinger for layer synthesis.
  • the display driver switches the screen refresh rate of the display screen from the first refresh rate to the second refresh rate.
  • FIG. 8B shows the signal transmission process corresponding to steps S401-S405 and steps S601-S603 in the screen refresh rate switching method provided by the above embodiment.
  • the left side of Figure 8B shows the signal transmission process corresponding to switching the screen refresh rate of the display screen from a high refresh rate (such as 60Hz, the corresponding signal period is 16ms) to a low refresh rate (such as 10Hz, the corresponding signal period is 100ms).
  • the specific steps are S801-S807.
  • steps S801-S807 please refer to the above-mentioned steps S501-S507, which will not be described again here.
  • the right side of Figure 8B shows the signal transmission process corresponding to switching the screen refresh rate of the display screen from a low refresh rate (such as 10Hz, the corresponding signal period is 100ms) to a high refresh rate (such as 60Hz, the corresponding signal period is 16ms), specifically
  • the steps are S811-S817.
  • steps S811-S817 please refer to the above-mentioned steps S701-S707, which will not be described again here.
  • the display screen receives the second refresh rate switching instruction, and in response to the second refresh rate switching instruction, switches the screen refresh rate of the display screen to the preset refresh rate, and sends the third refresh rate to SurfaceFlinger according to the preset cycle.
  • two Vsync signals so that SurfaceFlinger can complete the Vsync signal calibration.
  • the period of the first Vsync signal is set to the preset period.
  • the screen refresh rate of the display screen switches to the first refresh rate (such as 10Hz), that is, after a certain delay as shown in Figure 8B, it switches to 100ms. . In this way, the display can display static images at a low refresh rate. status image, saving power and CPU resources.
  • the Android system can still be used Screen refresh rate switching method under native mechanism.
  • the display driver can set a real refresh rate (first refresh rate, such as 10Hz or 1Hz) mode (or gear) and a simulated refresh rate mode.
  • the simulated refresh rate mode corresponds to a simulated refresh rate and a real refresh rate.
  • the simulated refresh rate ie, the preset refresh rate
  • the display driver can report the refresh rate mode it supports to SurfaceFlinger and/or the frame rate control module through HWC.
  • SurfaceFlinger and/or the frame rate control module can determine whether each refresh rate is a real refresh rate or a simulated refresh rate based on the identification (id) attribute of each refresh rate in the refresh rate mode.
  • the frame rate control module can query the display driver through Display.getSupportedModes() to obtain the refresh rate modes it supports.
  • the display driver can respond to the query request and report the refresh rate modes it supports to the frame rate control module through HWC.
  • Figure 9 is a flow chart of interaction between modules in a screen refresh rate switching method provided by an embodiment of the present application.
  • the signal transmission process is shown by the solid arrow in Figure 9 .
  • the display driver sets the simulated refresh rate mode (simulated 120Hz mode), which corresponds to a simulated 120Hz refresh rate and a real 10Hz or 1Hz refresh rate.
  • the display driver can report information that it supports simulated 120Hz mode to SurfaceFlinger through HWC.
  • the signal transmission process is shown by the dotted arrow in Figure 9, which corresponds to the above-mentioned steps S501-S505.
  • the frame rate control module of the electronic device detects that the electronic device switches from displaying dynamic images to displaying static images, it controls the screen refresh rate of the display screen to switch to 10 Hz (or 1 Hz).
  • the process is: the frame rate control module sends an instruction to the SurfaceFlinger to switch the screen refresh rate of the display screen to the simulated 120Hz mode (such as the second refresh rate switching instruction).
  • SurfaceFlinger can send the second refresh rate switching command to the display driver through HWC.
  • the display driver receives the second refresh rate switching instruction, according to the id attribute of the refresh rate in the instruction, it can be known that the simulated 120Hz mode in the second refresh rate switching instruction corresponds to a simulated 120Hz refresh rate and a real 10Hz or 1Hz refresh rate.
  • the display driver receives the second refresh rate switching command, it first switches the screen refresh rate of the display to 120Hz so that SurfaceFlinger can complete the Vsync signal calibration, that is, adjust the signal period of the first Vsync signal to 8ms (i.e. 1/120ms) .
  • the display driver switches the screen refresh rate of the display to 10Hz or 1Hz after a preset period of time to save power and CPU resources.
  • the signal transmission process is shown by the dash-dotted arrow in Figure 9 , which corresponds to the above-mentioned steps S701-S705.
  • the frame rate control module of the electronic device detects that the current display scene is a user clicking or sliding, or a pop-up notification appears, the frame rate control module sends an instruction to SurfaceFlinger to switch the screen refresh rate of the display to 60Hz, 90Hz or 120Hz (such as the first refresh rate switching instruction).
  • SurfaceFlinger sends the first refresh rate switching instruction from the frame rate control module
  • SurfaceFlinger can send the first refresh rate switching instruction to the display driver through HWC.
  • the display driver switches the screen refresh rate of the display screen to 60Hz, 90Hz or 120Hz.
  • the electronic device may include: a display screen, a memory and one or more processors.
  • the display, memory and processor are coupled.
  • the memory is used to store computer program code, which includes computer instructions.
  • the processor executes computer instructions, the electronic device may perform various functions or steps performed by the electronic device in the above method embodiments.
  • the structure of the electronic device may refer to the structure of the electronic device 200 shown in FIG. 2B.
  • the chip system includes at least one processor 1001 and at least one interface circuit 1002 .
  • the processor 1001 and the interface circuit 1002 may be interconnected by wires.
  • interface circuit 1002 may be used to receive signals from other devices, such as memory of an electronic device.
  • the interface circuit 1002 may be used to send signals to other devices, such as the processor 1001 or a touch screen of an electronic device.
  • the interface circuit 1002 can read instructions stored in the memory and send the instructions to the processor 1001. When the instructions are executed by the processor 1001, the electronic device can be caused to perform various steps in the above embodiments.
  • the chip system may also include other discrete devices, which are not specifically limited in the embodiments of this application.
  • Embodiments of the present application also provide a computer storage medium.
  • the computer storage medium includes computer instructions.
  • the electronic device When the computer instructions are run on the above-mentioned electronic device, the electronic device causes the electronic device to perform each function performed by the electronic device in the above method embodiment or step.
  • An embodiment of the present application also provides a computer program product.
  • the computer program product When the computer program product is run on a computer, it causes the computer to perform various functions or steps performed by the electronic device in the above method embodiment.
  • the disclosed devices and methods can be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of modules or units is only a logical function division.
  • there may be other division methods for example, multiple units or components may be The combination can either be integrated into another device, or some features can be omitted, or not implemented.
  • the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, and the indirect coupling or communication connection of the devices or units may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated.
  • the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place, or they may be distributed to multiple different places. . Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional unit in each embodiment of the present application can be integrated into one processing unit, each unit can exist physically alone, or two or more units can be integrated into one unit.
  • the above integrated units can be implemented in the form of hardware or software functional units.
  • the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a readable storage medium.
  • the technical solutions of the embodiments of the present application are essentially or contribute to the existing technology, or all or part of the technical solution can be embodied in the form of a software product, and the software product is stored in a storage medium , including several instructions to cause a device (which can be a microcontroller, a chip, etc.) or a processor to execute all or part of the steps of the methods described in various embodiments of this application.
  • the aforementioned storage media include: U disk, mobile hard disk, read only memory (read only memory)

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Human Computer Interaction (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Control Of Indicators Other Than Cathode Ray Tubes (AREA)

Abstract

The present application relates to the technical field of image processing and display, and provides a screen refresh rate switching method and an electronic device, capable of quickly switching the screen refresh rate of a display screen from a low refresh rate to a high refresh rate. A SurfaceFlinger of an electronic device receives a first refresh rate switching instruction, wherein the first refresh rate switching instruction is used for instructing a screen refresh rate to be switched from a first refresh rate to a second refresh rate, the first refresh rate is less than or equal to a preset threshold, and the second refresh rate is greater than the preset threshold; the SurfaceFlinger sends the first refresh rate switching instruction to a display driver in response to the end of a signal period of a current first Vsync signal, wherein the signal period of the first Vsync signal is set to be a preset period under the condition that the screen refresh rate of the display screen is the first refresh rate, and the preset period is less than the reciprocal of the first refresh rate; the display driver switches the screen refresh rate from the first refresh rate to the second refresh rate in response to the first refresh rate switching instruction.

Description

一种屏幕刷新率切换方法及电子设备Screen refresh rate switching method and electronic device
本申请要求于2022年08月24日提交国家知识产权局、申请号为202211021875.0、发明名称为“一种屏幕刷新率切换方法及电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims priority for the Chinese patent application submitted to the State Intellectual Property Office on August 24, 2022, with application number 202211021875.0 and the invention title "A screen refresh rate switching method and electronic device", the entire content of which is incorporated by reference. in this application.
技术领域Technical field
本申请涉及图像处理及显示技术领域,尤其涉及一种屏幕刷新率切换方法及电子设备。The present application relates to the field of image processing and display technology, and in particular to a screen refresh rate switching method and electronic equipment.
背景技术Background technique
在将显示屏的屏幕刷新率从低刷新率切换回高刷新率的处理机制上,根据Android系统的原生机制,最少需要经过显示屏起始的屏幕刷新率下两个信号周期的时间,比如说如果显示屏起始的屏幕刷新率为10Hz,对应的信号周期为100ms,则最少需要经过200ms才能将显示屏的屏幕刷新率从10Hz这一低刷新率切换回60Hz、90Hz或120Hz这种高刷新率。在这样的机制下,显示屏的屏幕刷新率从低刷新率切换回高刷新率时可能会产生卡顿。In terms of the processing mechanism for switching the screen refresh rate of the display from a low refresh rate back to a high refresh rate, according to the native mechanism of the Android system, at least two signal periods need to pass at the initial screen refresh rate of the display, for example If the initial screen refresh rate of the display screen is 10Hz and the corresponding signal period is 100ms, it will take at least 200ms to switch the screen refresh rate of the display screen from the low refresh rate of 10Hz back to the high refresh rate of 60Hz, 90Hz or 120Hz. Rate. Under such a mechanism, lag may occur when the screen refresh rate of the display is switched from a low refresh rate back to a high refresh rate.
发明内容Contents of the invention
有鉴于此,本申请提供了一种屏幕刷新率切换方法及电子设备,可以使显示屏的屏幕刷新率从低刷新率快速切换到高刷新率,优化切换性能。In view of this, this application provides a screen refresh rate switching method and electronic device, which can quickly switch the screen refresh rate of the display screen from a low refresh rate to a high refresh rate and optimize the switching performance.
第一方面,本申请提供一种屏幕刷新率切换方法,该方法可以应用于电子设备,该电子设备包括显示屏。该方法包括:在显示屏的屏幕刷新率为第三刷新率的情况下,响应于电子设备由显示动态图像切换为显示静态图像,显示屏的屏幕刷新率由第三刷新率切换至第一刷新率,并设置第一Vsync信号的信号周期为预设周期。其中,第三刷新率大于第一刷新率,且第一刷新率小于或等于预设阈值,预设周期小于第一刷新率的倒数。响应于电子设备由显示静态图像切换为显示动态图像,电子设备的SurfaceFlinger接收到第一刷新率切换指令。该第一刷新率切换指令用于指示显示屏的屏幕刷新率由第一刷新率切换为第二刷新率。该第二刷新率大于预设阈值。响应于当前的第一Vsync信号的信号周期结束,SurfaceFlinger向电子设备的显示驱动发送第一刷新率切换指令。其中,第一Vsync信号用于触发SurfaceFlinger进行图层合成。显示驱动响应于第一刷新率切换指令,将显示屏的屏幕刷新率由第一刷新率切换为第二刷新率。In a first aspect, this application provides a screen refresh rate switching method, which method can be applied to electronic equipment, where the electronic equipment includes a display screen. The method includes: when the screen refresh rate of the display screen is a third refresh rate, in response to the electronic device switching from displaying dynamic images to displaying static images, switching the screen refresh rate of the display screen from the third refresh rate to the first refresh rate rate, and set the signal period of the first Vsync signal to the preset period. Wherein, the third refresh rate is greater than the first refresh rate, and the first refresh rate is less than or equal to the preset threshold, and the preset period is less than the reciprocal of the first refresh rate. In response to the electronic device switching from displaying static images to displaying dynamic images, the SurfaceFlinger of the electronic device receives the first refresh rate switching instruction. The first refresh rate switching instruction is used to instruct the screen refresh rate of the display screen to switch from the first refresh rate to the second refresh rate. The second refresh rate is greater than the preset threshold. In response to the current signal period of the first Vsync signal ending, SurfaceFlinger sends a first refresh rate switching instruction to the display driver of the electronic device. Among them, the first Vsync signal is used to trigger SurfaceFlinger for layer synthesis. In response to the first refresh rate switching instruction, the display driver switches the screen refresh rate of the display screen from the first refresh rate to the second refresh rate.
上述技术方案中,在电子设备由显示动态图像切换为显示静态图像的情况下,将显示屏的屏幕刷新率由第三刷新率切换至第一刷新率,由于该第一刷新率小于或等于预设阈值,为低刷新率,因此这样可以降低电子设备显示静态图像时的功耗。并且,设置第一Vsync信号的信号周期为预设周期,这样,在之后电子设备由显示静态图像切换为显示动态图像,需要将显示屏的屏幕刷新率由第一刷新率切换为第二刷新率(高刷新率)的情况下,电子设备可以在当前的第一Vsync信号的信号周期(即预设周期) 结束就下发相应的第一刷新率切换指令,由于预设周期小于第一刷新率的倒数,相对于Android系统的原生机制下SurfaceFlinger需要等到一个长度为第一刷新率的倒数的周期结束才能下发第一刷新率切换指令,SurfaceFlinger下发第一刷新率切换指令的及时性提高了,这样显示屏也可以及时接收并响应该第一刷新率切换指令,快速完成屏幕刷新率切换。In the above technical solution, when the electronic device switches from displaying dynamic images to displaying static images, the screen refresh rate of the display screen is switched from the third refresh rate to the first refresh rate, because the first refresh rate is less than or equal to the preset refresh rate. Set the threshold to a low refresh rate, so this can reduce the power consumption of electronic devices when displaying static images. Moreover, the signal period of the first Vsync signal is set to a preset period. In this way, after the electronic device switches from displaying static images to displaying dynamic images, the screen refresh rate of the display screen needs to be switched from the first refresh rate to the second refresh rate. (High refresh rate), the electronic device can be in the current signal period of the first Vsync signal (i.e., the preset period) At the end, the corresponding first refresh rate switching command is issued. Since the preset period is less than the reciprocal of the first refresh rate, compared to the native mechanism of the Android system, SurfaceFlinger needs to wait until a cycle whose length is the reciprocal of the first refresh rate ends before downloading. By issuing the first refresh rate switching command, the timeliness of SurfaceFlinger's issuance of the first refresh rate switching command is improved, so that the display screen can receive and respond to the first refresh rate switching command in a timely manner and quickly complete the screen refresh rate switching.
第二方面,本申请提供一种屏幕刷新率切换方法,该方法可以应用于电子设备,该电子设备包括显示屏。该方法包括:电子设备的SurfaceFlinger接收来自上层的第一刷新率切换指令。该第一刷新率切换指令用于指示显示屏的屏幕刷新率由第一刷新率切换为第二刷新率。其中,第一刷新率小于或等于预设阈值,第二刷新率大于预设阈值。SurfaceFlinger响应于当前的第一垂直同步Vsync信号的信号周期结束,向电子设备的显示驱动发送第一刷新率切换指令。其中,第一Vsync信号用于触发SurfaceFlinger进行图层合成。第一Vsync信号的信号周期在显示屏的屏幕刷新率为第一刷新率的情况下,被设置为预设周期。该预设周期小于第一刷新率的倒数。显示驱动响应于第一刷新率切换指令,将显示屏的屏幕刷新率由第一刷新率切换为第二刷新率。In a second aspect, this application provides a screen refresh rate switching method, which method can be applied to an electronic device, where the electronic device includes a display screen. The method includes: SurfaceFlinger of the electronic device receives a first refresh rate switching instruction from an upper layer. The first refresh rate switching instruction is used to instruct the screen refresh rate of the display screen to switch from the first refresh rate to the second refresh rate. Wherein, the first refresh rate is less than or equal to the preset threshold, and the second refresh rate is greater than the preset threshold. In response to the end of the signal period of the current first vertical synchronization Vsync signal, SurfaceFlinger sends a first refresh rate switching instruction to the display driver of the electronic device. Among them, the first Vsync signal is used to trigger SurfaceFlinger for layer synthesis. The signal period of the first Vsync signal is set to a preset period when the screen refresh rate of the display screen is the first refresh rate. The preset period is less than the reciprocal of the first refresh rate. In response to the first refresh rate switching instruction, the display driver switches the screen refresh rate of the display screen from the first refresh rate to the second refresh rate.
应理解,上述第一刷新率小于或等于预设阈值,为低刷新率,第二刷新率大于预设阈值,为高刷新率。It should be understood that the above-mentioned first refresh rate is less than or equal to the preset threshold, which is a low refresh rate, and the second refresh rate is greater than the preset threshold, which is a high refresh rate.
上述技术方案中,在电子设备的显示屏的屏幕刷新率为第一刷新率(低刷新率)的情况下,第一Vsync信号的信号周期被设置为预设周期。这样,在需要将显示屏的屏幕刷新率从第一刷新率(低刷新率)切换到第二刷新率(高刷新率)时,SurfaceFlinger可以在当前的第一Vsync信号的信号周期(预设周期)结束就下发第一刷新率切换指令,由于预设周期小于第一刷新率的倒数,相对于Android系统的原生机制下SurfaceFlinger需要等到一个长度为第一刷新率的倒数的周期结束才能下发第一刷新率切换指令,SurfaceFlinger下发第一刷新率切换指令的及时性提高了,这样显示屏也可以及时接收第一刷新率切换指令,并及时响应该第一刷新率切换指令,进行屏幕刷新率切换,由此减少了显示屏的屏幕刷新率的切换时间,避免了卡顿,提升了电子设备的跟手性,提升了用户体验。In the above technical solution, when the screen refresh rate of the display screen of the electronic device is the first refresh rate (low refresh rate), the signal period of the first Vsync signal is set to the preset period. In this way, when it is necessary to switch the screen refresh rate of the display screen from the first refresh rate (low refresh rate) to the second refresh rate (high refresh rate), SurfaceFlinger can switch the signal period of the current first Vsync signal (preset period). ) ends, the first refresh rate switching command is issued. Since the preset period is less than the reciprocal of the first refresh rate, compared to the native mechanism of the Android system, SurfaceFlinger needs to wait until a cycle whose length is the reciprocal of the first refresh rate ends before it can be issued. First refresh rate switching command, the timeliness of SurfaceFlinger issuing the first refresh rate switching command is improved, so that the display screen can also receive the first refresh rate switching command in time, and respond to the first refresh rate switching command in a timely manner to refresh the screen. rate switching, thus reducing the switching time of the screen refresh rate of the display screen, avoiding lagging, improving the chirality of the electronic device, and improving the user experience.
在第二方面的一种可能的实现方式中,在显示驱动响应于第一刷新率切换指令,将显示屏的屏幕刷新率由第一刷新率切换为第二刷新率之后,上述方法还包括:显示驱动按照第一信号周期,向SurfaceFlinger发送第二Vsync信号,以向SurfaceFlinger指示显示屏的屏幕刷新率。其中,第二Vsync信号可以触发显示屏刷新显示图像帧,第一信号周期等于第二刷新率的倒数。In a possible implementation of the second aspect, after the display driver switches the screen refresh rate of the display screen from the first refresh rate to the second refresh rate in response to the first refresh rate switching instruction, the above method further includes: The display driver sends a second Vsync signal to SurfaceFlinger according to the first signal period to indicate the screen refresh rate of the display screen to SurfaceFlinger. Wherein, the second Vsync signal can trigger the display screen to refresh the display image frame, and the first signal period is equal to the reciprocal of the second refresh rate.
也就是说,显示屏的屏幕刷新率由第一刷新率切换为第二刷新率之后,显示驱动按照第一信号周期(即第二刷新率的倒数),周期性地向SurfaceFlinger发送第二Vsync信号,用于SurfaceFlinger进行Vsync信号校准。这样,SurfaceFlinger可以根据接收到第二Vsync信号的周期,来确定显示屏的屏幕刷新率已经切换为了第二刷新率,SurfaceFlinger就可以按照第二刷新率的倒数,周期性地生成第一Vsync信号。由此,可以实现第一Vsync信号与第二Vsync信号保持周期同步。That is to say, after the screen refresh rate of the display screen is switched from the first refresh rate to the second refresh rate, the display driver periodically sends the second Vsync signal to SurfaceFlinger according to the first signal period (that is, the reciprocal of the second refresh rate). , used for SurfaceFlinger for Vsync signal calibration. In this way, SurfaceFlinger can determine that the screen refresh rate of the display screen has switched to the second refresh rate based on the period of receiving the second Vsync signal, and SurfaceFlinger can periodically generate the first Vsync signal according to the reciprocal of the second refresh rate. As a result, the first Vsync signal and the second Vsync signal can maintain periodic synchronization.
在第二方面的另一种可能的实现方式中,在电子设备的SurfaceFlinger接收来自 上层的第一刷新率切换指令之前,上述方法还包括:显示屏接收第二刷新率切换指令。该第二刷新率切换指令用于指示显示屏的屏幕刷新率切换为第一刷新率。显示屏响应于第二刷新率切换指令,将所述显示屏的屏幕刷新率切换为预设刷新率,按照预设周期,通过显示驱动向SurfaceFlinger发送第二Vsync信号。其中,预设周期等于预设刷新率的倒数,预设刷新率大于预设阈值。SurfaceFlinger接收来自显示驱动的第二Vsync信号。如果SurfaceFlinger从显示驱动接收第二Vsync信号的周期(即第二信号周期)等于预设周期,SurfaceFlinger将第一Vsync信号的信号周期设置为预设周期,并停止接收来自显示驱动的第二Vsync信号。In another possible implementation of the second aspect, the SurfaceFlinger of the electronic device receives the Before the first refresh rate switching instruction from the upper layer, the above method further includes: the display screen receives a second refresh rate switching instruction. The second refresh rate switching instruction is used to instruct the screen refresh rate of the display screen to switch to the first refresh rate. In response to the second refresh rate switching instruction, the display screen switches the screen refresh rate of the display screen to a preset refresh rate, and sends a second Vsync signal to SurfaceFlinger through the display driver according to the preset cycle. Wherein, the preset period is equal to the reciprocal of the preset refresh rate, and the preset refresh rate is greater than the preset threshold. SurfaceFlinger receives the second Vsync signal from the display driver. If the period during which SurfaceFlinger receives the second Vsync signal from the display driver (i.e., the second signal period) is equal to the preset period, SurfaceFlinger sets the signal period of the first Vsync signal to the preset period and stops receiving the second Vsync signal from the display driver. .
也就是说,显示屏接收到第二刷新率切换指令后,可以响应于该第二刷新率切换指令,先将显示屏的屏幕刷新率切换为预设刷新率,这样就可以按照预设周期,周期性地向SurfaceFlinger发送第二Vsync信号,用于SurfaceFlinger进行Vsync信号校准。SurfaceFlinger完成Vsync信号校准后,可以将第一Vsync信号的信号周期设置为预设周期,按照预设周期运行。这样,在后续接收到新的刷新率切换指令(如第一刷新率指令时)时,能够及时将新的刷新率切换指令下发。That is to say, after the display screen receives the second refresh rate switching command, it can respond to the second refresh rate switching command by first switching the screen refresh rate of the display screen to the preset refresh rate, so that according to the preset cycle, Periodically send the second Vsync signal to SurfaceFlinger for SurfaceFlinger to perform Vsync signal calibration. After SurfaceFlinger completes the Vsync signal calibration, it can set the signal period of the first Vsync signal to the preset period and run according to the preset period. In this way, when a new refresh rate switching command is subsequently received (such as a first refresh rate command), the new refresh rate switching command can be issued in time.
在第二方面的另一种可能的实现方式中,方法还包括:显示屏响应于第二刷新率切换指令,在预设时长后将显示屏的屏幕刷新率切换为第一刷新率。In another possible implementation of the second aspect, the method further includes: in response to the second refresh rate switching instruction, the display screen switches the screen refresh rate of the display screen to the first refresh rate after a preset period of time.
也就是说,显示屏接收到第二刷新率切换指令后,可以响应于该第二刷新率切换指令,先将显示屏的屏幕刷新率切换为预设刷新率。这样,显示屏可以按照预设周期,周期性地向SurfaceFlinger发送第二Vsync信号,用于SurfaceFlinger进行Vsync信号校准。SurfaceFlinger完成Vsync信号校准后,可以将第一Vsync信号的信号周期设置为预设周期。而显示屏响应于第二刷新率切换指令,在预设时长后可以将显示屏的屏幕刷新率切换为第一刷新率,也就是按照长度为第一刷新率的倒数的周期运行,即按照长度为第一刷新率的倒数的周期刷新显示图像帧,以降低功耗。That is to say, after the display screen receives the second refresh rate switching instruction, it can first switch the screen refresh rate of the display screen to the preset refresh rate in response to the second refresh rate switching instruction. In this way, the display screen can periodically send the second Vsync signal to SurfaceFlinger according to the preset cycle for SurfaceFlinger to perform Vsync signal calibration. After SurfaceFlinger completes the Vsync signal calibration, you can set the signal period of the first Vsync signal to the preset period. In response to the second refresh rate switching instruction, the display screen can switch the screen refresh rate of the display screen to the first refresh rate after a preset period of time, that is, it runs according to a cycle whose length is the reciprocal of the first refresh rate, that is, according to the length The display image frame is refreshed in a reciprocal period of the first refresh rate to reduce power consumption.
在第二方面的另一种可能的实现方式中,预设刷新率是显示屏支持的一个屏幕刷新率。In another possible implementation of the second aspect, the preset refresh rate is a screen refresh rate supported by the display screen.
也就是说,显示屏接收到第二刷新率切换指令后,可以响应于该第二刷新率切换指令,在将显示屏的屏幕刷新率切换为第一刷新率之前,先将显示屏的屏幕刷新率切换为预设刷新率。这样,显示屏可以按照预设周期,向SurfaceFlinger发送第二Vsync信号,用于SurfaceFlinger进行Vsync信号校准。That is to say, after the display screen receives the second refresh rate switching instruction, it can respond to the second refresh rate switching instruction and refresh the screen of the display screen before switching the screen refresh rate of the display screen to the first refresh rate. rate switches to the default refresh rate. In this way, the display screen can send the second Vsync signal to SurfaceFlinger according to the preset period for SurfaceFlinger to perform Vsync signal calibration.
在第二方面的另一种可能的实现方式中,第一刷新率为显示屏显示静态图像时的目标刷新率。In another possible implementation of the second aspect, the first refresh rate is a target refresh rate when the display screen displays a static image.
在显示屏显示静态图像时,可以将显示屏的屏幕刷新率设置为第一刷新率(低刷新率),以降低功耗。When the display screen displays a static image, the screen refresh rate of the display screen can be set to the first refresh rate (low refresh rate) to reduce power consumption.
在第二方面的另一种可能的实现方式中,预设刷新率为120Hz;第一刷新率为10Hz或1Hz;第二刷新率为60Hz、90Hz或120Hz。In another possible implementation of the second aspect, the preset refresh rate is 120Hz; the first refresh rate is 10Hz or 1Hz; and the second refresh rate is 60Hz, 90Hz or 120Hz.
也就是说,显示屏接收到第二刷新率切换指令后,可以响应于该第二刷新率切换指令,先将显示屏的屏幕刷新率切换为预设刷新率120Hz。这样,显示屏可以按照8ms的周期,向SurfaceFlinger发送第二Vsync信号,用于SurfaceFlinger进行Vsync信号校准。SurfaceFlinger完成Vsync信号校准后,就可以将第一Vsync信号的信号 周期设置为8ms,按照8ms的周期运行。而显示屏响应于第二刷新率切换指令,在预设时长后可以将显示屏的屏幕刷新率切换为10Hz或1Hz,也就是按照100ms或1000ms的周期运行,即按照100ms或1000ms的周期刷新显示图像帧,以降低功耗。之后,若SurfaceFlinger接收到第一刷新率切换指令,SurfaceFlinger能够在当前的8ms的周期结束后,就将第一刷新率切换指令下发,以使显示屏及时接收第一刷新率切换指令,并及时响应该第一刷新率切换指令,将屏幕刷新率切换为60Hz、90Hz或120Hz。That is to say, after the display screen receives the second refresh rate switching instruction, it can first switch the screen refresh rate of the display screen to the preset refresh rate of 120 Hz in response to the second refresh rate switching instruction. In this way, the display screen can send the second Vsync signal to SurfaceFlinger according to the 8ms cycle for SurfaceFlinger to perform Vsync signal calibration. After SurfaceFlinger completes the Vsync signal calibration, the first Vsync signal can be The cycle is set to 8ms and runs according to the 8ms cycle. In response to the second refresh rate switching instruction, the display screen can switch the screen refresh rate of the display screen to 10Hz or 1Hz after a preset period of time, that is, it runs according to a cycle of 100ms or 1000ms, that is, it refreshes the display according to a cycle of 100ms or 1000ms. image frames to reduce power consumption. Afterwards, if SurfaceFlinger receives the first refresh rate switching command, SurfaceFlinger can issue the first refresh rate switching command after the current 8ms cycle ends, so that the display screen receives the first refresh rate switching command in time and In response to the first refresh rate switching instruction, the screen refresh rate is switched to 60Hz, 90Hz or 120Hz.
在第二方面的另一种可能的实现方式中,第一刷新率切换指令是电子设备在显示静态图像的情况下,接收到通知或用户操作后触发的。其中,通知或用户操作用于触发电子设备更新界面。In another possible implementation of the second aspect, the first refresh rate switching instruction is triggered by the electronic device after receiving a notification or user operation when displaying a static image. Among them, notifications or user operations are used to trigger the electronic device to update the interface.
也就是说,电子设备在显示静态图像的情况下,若接收到通知或用户操作后,可以触发第一刷新率切换指令,从而控制显示屏的屏幕刷新率从第一刷新率(低刷新率)切换到第二刷新率(高刷新率)。That is to say, when the electronic device displays a static image, if it receives a notification or user operation, it can trigger the first refresh rate switching instruction, thereby controlling the screen refresh rate of the display screen from the first refresh rate (low refresh rate) Switch to the second refresh rate (high refresh rate).
在第二方面的另一种可能的实现方式中,第二刷新率切换指令是电子设备由显示动态图像切换为显示静态图像时触发的。In another possible implementation of the second aspect, the second refresh rate switching instruction is triggered when the electronic device switches from displaying dynamic images to displaying static images.
也就是说,电子设备由显示动态图像切换为显示静态图像时,可以触发第二刷新率切换指令,以控制显示屏的屏幕刷新率切换到第一刷新率(低刷新率),以降低功耗。That is to say, when the electronic device switches from displaying dynamic images to displaying static images, it can trigger the second refresh rate switching instruction to control the screen refresh rate of the display screen to switch to the first refresh rate (low refresh rate) to reduce power consumption. .
第三方面,本申请提供一种电子设备,该电子设备包括显示屏、存储器和一个或多个处理器。该显示屏、存储器和处理器耦合。该存储器用于存储计算机程序代码,计算机程序代码包括计算机指令。当上述处理器执行计算机指令时,电子设备执行如第一方面或第二方面及其任一种可能的设计方式所述的方法。In a third aspect, the present application provides an electronic device, which includes a display screen, a memory, and one or more processors. The display, memory and processor are coupled. The memory is used to store computer program code, which includes computer instructions. When the above processor executes computer instructions, the electronic device executes the method described in the first aspect or the second aspect and any possible design manner thereof.
第四方面,本申请提供一种芯片系统,该芯片系统应用于包括显示屏的电子设备。该芯片系统包括一个或多个接口电路和一个或多个处理器。该接口电路和处理器通过线路互联。该接口电路用于从电子设备的存储器接收信号,并向处理器发送信号,信号包括存储器中存储的计算机指令。当处理器执行计算机指令时,电子设备执行如第一方面或第二方面及其任一种可能的设计方式所述的方法。In a fourth aspect, the present application provides a chip system, which is applied to an electronic device including a display screen. The chip system includes one or more interface circuits and one or more processors. The interface circuit and the processor are interconnected through lines. The interface circuit is used to receive signals from the memory of the electronic device and send signals to the processor, the signals including computer instructions stored in the memory. When the processor executes the computer instructions, the electronic device executes the method described in the first aspect or the second aspect and any possible design manner thereof.
第五方面,本申请提供一种计算机存储介质,该计算机存储介质包括计算机指令,当该计算机指令在电子设备上运行时,使得电子设备执行如第一方面或第二方面及其任一种可能的设计方式所述的方法。In a fifth aspect, the present application provides a computer storage medium that includes computer instructions. When the computer instructions are run on an electronic device, the electronic device causes the electronic device to execute the first aspect or the second aspect and any possibility thereof. The design method described.
第六方面,本申请提供一种计算机程序产品,当该计算机程序产品在计算机上运行时,使得该计算机执行如第一方面或第二方面及其任一种可能的设计方式所述的方法。In a sixth aspect, the present application provides a computer program product. When the computer program product is run on a computer, it causes the computer to execute the method described in the first aspect or the second aspect and any possible design manner thereof.
可以理解地,上述提供的第三方面所述的电子设备,第四方面所述的芯片系统,第五方面所述的计算机存储介质,第六方面所述的计算机程序产品所能达到的有益效果,可参考如第一方面或第二方面及其任一种可能的设计方式中的有益效果,此处不再赘述。It can be understood that the beneficial effects achieved by the electronic device described in the third aspect, the chip system described in the fourth aspect, the computer storage medium described in the fifth aspect, and the computer program product described in the sixth aspect are provided above. , reference may be made to the beneficial effects in the first aspect or the second aspect and any possible design method thereof, which will not be described again here.
附图说明Description of drawings
图1为本申请实施例中的一种Android系统的Vsync机制示意图;Figure 1 is a schematic diagram of the Vsync mechanism of an Android system in an embodiment of the present application;
图2A是本申请实施例提供的一种电子设备软件结构框图; Figure 2A is a block diagram of an electronic device software structure provided by an embodiment of the present application;
图2B为本申请实施例提供的一种电子设备的硬件结构示意图;Figure 2B is a schematic diagram of the hardware structure of an electronic device provided by an embodiment of the present application;
图3为本申请实施例中的一种Android系统原生的刷新率切换流程图;Figure 3 is a flow chart of a native refresh rate switching of the Android system in an embodiment of the present application;
图4为本申请实施例提供的一种刷新率切换流程图;Figure 4 is a refresh rate switching flow chart provided by an embodiment of the present application;
图5为本申请实施例提供的一种刷新率切换原理图;Figure 5 is a schematic diagram of refresh rate switching provided by an embodiment of the present application;
图6为本申请实施例提供的另一种刷新率切换流程图;Figure 6 is another refresh rate switching flow chart provided by an embodiment of the present application;
图7为本申请实施例提供的另一种刷新率切换原理图;Figure 7 is another refresh rate switching schematic diagram provided by an embodiment of the present application;
图8A为本申请实施例提供的另一种刷新率切换流程图;Figure 8A is another refresh rate switching flow chart provided by an embodiment of the present application;
图8B为本申请实施例提供的另一种刷新率切换原理图;Figure 8B is another refresh rate switching schematic diagram provided by an embodiment of the present application;
图9为本申请实施例提供的一种屏幕刷新率切换方法中各模块交互流程图;Figure 9 is a flow chart of interaction between modules in a screen refresh rate switching method provided by an embodiment of the present application;
图10为本申请实施例提供的一种芯片系统的结构示意图。Figure 10 is a schematic structural diagram of a chip system provided by an embodiment of the present application.
具体实施方式Detailed ways
为了更好地理解本申请实施例中的技术方案,以下对本申请实施例中涉及的安卓(Android)终端设备的显示原理及相关术语进行介绍。In order to better understand the technical solutions in the embodiments of the present application, the display principles and related terms of the Android (Android) terminal devices involved in the embodiments of the present application are introduced below.
Android终端设备中应用程序(Application,APP)的显示流程可以分为APP绘制和渲染、图层整合器(SurfaceFlinger)合成、显示屏刷新显示三个阶段。The display process of an application (Application, APP) in an Android terminal device can be divided into three stages: APP drawing and rendering, layer integrator (SurfaceFlinger) synthesis, and display refresh display.
(1)屏幕刷新率(Refresh Rate或Scanning Frequency)(1)Screen refresh rate (Refresh Rate or Scanning Frequency)
屏幕刷新率分为垂直刷新率和水平刷新率,一般提到的屏幕刷新率通常指垂直刷新率。垂直刷新率表示显示屏显示的图像每秒钟刷新的次数,以Hz(赫兹)为单位。例如,60Hz的屏幕意味着一个显示屏在1秒内可以完成60次刷新显示图像帧。屏幕刷新率越高,显示屏1秒内可以完成刷新显示图像帧的次数也就越多。相应地,画面流畅度也就越高。The screen refresh rate is divided into vertical refresh rate and horizontal refresh rate. The generally mentioned screen refresh rate usually refers to the vertical refresh rate. The vertical refresh rate indicates the number of times the image displayed on the display is refreshed per second, measured in Hz (hertz). For example, a 60Hz screen means that a display can refresh and display image frames 60 times in 1 second. The higher the screen refresh rate, the more times the display can refresh and display image frames in 1 second. Correspondingly, the smoothness of the picture will be higher.
(2)帧率(Frame Rate,也称为帧速率)(2) Frame Rate (Frame Rate, also called frame rate)
帧率是指显卡(图形处理器)每秒钟生成的图像的帧数。帧率(Frame rate)=帧数(Frames)/时间(Time),单位为帧每秒(frames per second,即f/s,也可以称为fps)。高的帧率可以得到更流畅、更逼真的动画。帧率(fps)越高,所显示的动作就会越流畅。现在显卡的性能大幅提高,能够实现的帧率越来越高。但如果帧率超过屏幕刷新率,只会浪费图形处理的能力,这样超过刷新率的帧率就浪费掉了。而且因为显示屏不能以同样的速度更新,帧率过高会出现画面撕裂。例如,屏幕刷新率为60Hz,如果显卡的输出大于60fps,两者不同步,画面便会撕裂。Android系统通过垂直同步(Vertical synchronization,简称Vsync,又称场同步)机制解决画面撕裂的问题。Frame rate refers to the number of frames of images generated by the graphics card (graphics processor) per second. Frame rate = number of frames (Frames)/time (Time), the unit is frames per second (frames per second, f/s, also called fps). A high frame rate results in smoother, more realistic animations. The higher the frame rate (fps), the smoother the displayed action will be. Now the performance of graphics cards has improved significantly, and the frame rates that can be achieved are getting higher and higher. But if the frame rate exceeds the screen refresh rate, it will only waste graphics processing power, so the frame rate that exceeds the refresh rate is wasted. And because the display can't update at the same speed, frame rates that are too high can cause screen tearing. For example, if the screen refresh rate is 60Hz, if the output of the graphics card is greater than 60fps, the two will be out of sync, and the screen will tear. The Android system solves the problem of screen tearing through the vertical synchronization (Vertical synchronization, referred to as Vsync, also known as field synchronization) mechanism.
(3)Vsync机制(3)Vsync mechanism
Android系统的显示原理是基于Vsync机制。Vsync机制下,Android系统中有2种Vsync信号:一种是硬件生成的Vsync信号,可以称为硬件Vsync信号(Vsync-HW信号,后称为第二Vsync信号);另一种是软件模拟的Vsync信号,可以称为软件Vsync信号(后称为第一Vsync信号)。该第一Vsync信号可以包括Vsync-APP信号和Vsync-SF信号。The display principle of the Android system is based on the Vsync mechanism. Under the Vsync mechanism, there are two types of Vsync signals in the Android system: one is the Vsync signal generated by hardware, which can be called the hardware Vsync signal (Vsync-HW signal, later called the second Vsync signal); the other is software simulated The Vsync signal can be called a software Vsync signal (hereinafter referred to as the first Vsync signal). The first Vsync signal may include a Vsync-APP signal and a Vsync-SF signal.
SurfaceFlinger可以接收第二Vsync信号,进行Vsync信号校准,即根据第二Vsync信号产生第一Vsync信号,使第一Vsync信号与第二Vsync信号保持周期同步,也就是说,使第一Vsync信号的信号周期随第二Vsync信号的信号周期变化。其中, 第二Vsync信号的信号周期等于显示屏的屏幕刷新率的倒数。例如,在进行屏幕刷新率切换的时候,SurfaceFlinger开启Vsync信号校准。以显示屏的屏幕刷新率从60Hz切换到120Hz为例,显示屏上报第二Vsync信号的频率从60Hz切换到120Hz,即第二Vsync信号的信号周期从16ms切换到8ms。这时,SurfaceFlinger开启Vsync信号校准,接收第二Vsync信号,并根据接收到第二Vsync信号的周期,确定显示屏完成了屏幕刷新率切换,则将第一Vsync信号的信号周期从16ms切换到8ms,以保持第一Vsync信号与第二Vsync信号周期同步。SurfaceFlinger can receive the second Vsync signal and perform Vsync signal calibration, that is, generate the first Vsync signal according to the second Vsync signal, so that the first Vsync signal and the second Vsync signal maintain period synchronization, that is, make the signal of the first Vsync signal The period varies with the signal period of the second Vsync signal. in, The signal period of the second Vsync signal is equal to the reciprocal of the screen refresh rate of the display screen. For example, when switching the screen refresh rate, SurfaceFlinger turns on Vsync signal calibration. Taking the screen refresh rate of the display screen switching from 60Hz to 120Hz as an example, the frequency of the second Vsync signal reported by the display screen switches from 60Hz to 120Hz, that is, the signal period of the second Vsync signal switches from 16ms to 8ms. At this time, SurfaceFlinger turns on Vsync signal calibration, receives the second Vsync signal, and determines that the display has completed the screen refresh rate switch based on the cycle of receiving the second Vsync signal, then switches the signal cycle of the first Vsync signal from 16ms to 8ms. , to maintain periodic synchronization of the first Vsync signal and the second Vsync signal.
SurfaceFlinger可以利用DiscSync::addResyncSample函数判断是否还需要输入第二Vsync信号。如果不需要,SurfaceFlinger可以通过EventControlThread线程关闭第二Vsync信号输入,从而即关闭Vsync信号校准。一段时间后,如果SurfaceFlinger需要再次接收第二Vsync信号来对第一Vsync信号进行校准,可以通过EventControlThread线程再次开启第二Vsync信号输入,从而开启Vsync信号校准。SurfaceFlinger can use the DiscSync::addResyncSample function to determine whether a second Vsync signal needs to be input. If not needed, SurfaceFlinger can turn off the second Vsync signal input through the EventControlThread thread, thus turning off Vsync signal calibration. After a period of time, if SurfaceFlinger needs to receive the second Vsync signal again to calibrate the first Vsync signal, the second Vsync signal input can be enabled again through the EventControlThread thread to enable Vsync signal calibration.
显示屏刷新过程是从左到右(水平刷新,Horizontal Scanning),从上到下(垂直刷新,Vertical Scanning),顺序显示图像上的像素点。当显示屏刷新完毕,即一个垂直刷新周期完成,会有短暂的空白期(即Vertical Blanking Interval,VBI,垂直回扫期),此时显示屏发出第二Vsync信号。所以,Vsync中的V指的是垂直刷新中的垂直(Vertical),显示屏发出第二Vsync信号的周期等于显示屏刷新显示一个图像帧的耗时。The refresh process of the display screen is from left to right (horizontal refresh, Horizontal Scanning) and from top to bottom (vertical refresh, Vertical Scanning), sequentially displaying the pixels on the image. When the display screen is refreshed, that is, a vertical refresh cycle is completed, there will be a short blank period (ie, Vertical Blanking Interval, VBI, vertical retrace period). At this time, the display screen sends out the second Vsync signal. Therefore, the V in Vsync refers to the vertical in vertical refresh. The period during which the display screen sends the second Vsync signal is equal to the time it takes for the display screen to refresh and display an image frame.
示例性地,在Vsync机制下,Android终端设备中APP的显示流程中APP绘制和渲染由Vsync-APP信号触发,SurfaceFlinger合成由Vsync-SF信号触发,显示屏刷新显示由第二Vsync信号触发。APP收到一个Vsync-APP信号后,通过调用中央处理单元(Central Processing Unit,CPU)和图形处理单元(Graphic Processing Unit,GPU),开始进行下一个图像帧的绘制和渲染。SurfaceFlinger收到一个Vsync-SF信号后,开始进行下一个图像帧的合成。显示屏收到一个Vsync-HW信号后,开始进行下一个图像帧的显示。由此,完成APP绘制和渲染、SurfaceFlinger合成、显示屏刷新显示的同步。参见图1,图1示出了一种Android Vsync机制示意图。如图1所示,基于Android系统的Vsync机制,Android终端设备显示流程如下:For example, under the Vsync mechanism, in the display process of APP in Android terminal devices, APP drawing and rendering are triggered by the Vsync-APP signal, SurfaceFlinger synthesis is triggered by the Vsync-SF signal, and display refresh display is triggered by the second Vsync signal. After receiving a Vsync-APP signal, the APP starts drawing and rendering the next image frame by calling the Central Processing Unit (CPU) and Graphic Processing Unit (GPU). After SurfaceFlinger receives a Vsync-SF signal, it starts synthesizing the next image frame. After the display screen receives a Vsync-HW signal, it starts displaying the next image frame. This completes the synchronization of APP drawing and rendering, SurfaceFlinger synthesis, and display refresh display. Refer to Figure 1, which shows a schematic diagram of the Android Vsync mechanism. As shown in Figure 1, based on the Vsync mechanism of the Android system, the Android terminal device display process is as follows:
1)在第i个信号周期,显示屏显示经SurfaceFlinger合成好的图像帧Frame0;SurfaceFlinger合成经APP绘制和渲染好的图像帧Frame1;APP绘制和渲染图像帧Frame2;1) In the i-th signal period, the display screen displays the image frame Frame0 synthesized by SurfaceFlinger; the image frame Frame1 synthesized by SurfaceFlinger and drawn and rendered by APP; the APP draws and renders the image frame Frame2;
2)在第i+1个信号周期,显示屏显示经SurfaceFlinger合成好的图像帧Frame1;SurfaceFlinger合成经APP绘制和渲染好的图像帧Frame2;APP绘制和渲染图像帧Frame3;2) In the i+1 signal period, the display screen displays the image frame Frame1 synthesized by SurfaceFlinger; the image frame Frame2 synthesized by SurfaceFlinger and drawn and rendered by APP; the APP draws and renders the image frame Frame3;
3)在第i+2个信号周期,显示屏显示经SurfaceFlinger合成好的图像帧Frame2;SurfaceFlinger合成经APP绘制和渲染好的图像帧Frame3;APP绘制和渲染图像帧Frame4;3) In the i+2 signal period, the display screen displays the image frame Frame2 synthesized by SurfaceFlinger; the image frame Frame3 synthesized by SurfaceFlinger and drawn and rendered by APP; the APP draws and renders the image frame Frame4;
4)在第i+3个信号周期,显示屏显示经SurfaceFlinger合成好的图像帧Frame3;SurfaceFlinger合成经APP绘制和渲染好的图像帧Frame4;APP绘制和渲染图像帧Frame5,依次类推。 4) In the i+3 signal period, the display screen displays the image frame Frame3 synthesized by SurfaceFlinger; the image frame Frame4 drawn and rendered by the APP is synthesized by SurfaceFlinger; the image frame Frame5 is drawn and rendered by the APP, and so on.
其中,信号周期是指第一Vsync信号和第二Vsync信号的信号周期。第一Vsync信号与第二Vsync信号保持周期同步。The signal period refers to the signal period of the first Vsync signal and the second Vsync signal. The first Vsync signal maintains periodic synchronization with the second Vsync signal.
由此可见,在Vsync机制下,Android终端设备从绘制一个图像帧开始,到该图像帧最终在显示屏上进行显示,会经过2个信号周期,也就是说有2个信号周期的延时。It can be seen that under the Vsync mechanism, the Android terminal device will pass through 2 signal cycles from drawing an image frame to the final display of the image frame on the display screen, which means there is a delay of 2 signal cycles.
电子设备的软件系统可以采用分层架构,事件驱动架构,微核架构,微服务架构,或云架构。本申请实施例以分层架构的Android系统为例,示例性说明电子设备的软件结构。Software systems of electronic devices can adopt layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. The embodiment of this application takes the Android system with a layered architecture as an example to illustrate the software structure of the electronic device.
图2A是本申请实施例的电子设备的软件结构框图。FIG. 2A is a software structure block diagram of an electronic device according to an embodiment of the present application.
分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,将Android系统分为五层,从上至下分别为应用程序层,应用程序框架层,安卓运行时(Android runtime,ART)和原生C/C++库,硬件抽象层(Hardware Abstract Layer,HAL)以及内核层。The layered architecture divides the software into several layers, and each layer has clear roles and division of labor. The layers communicate through software interfaces. In some embodiments, the Android system is divided into five layers, from top to bottom: application layer, application framework layer, Android runtime (Android runtime, ART) and native C/C++ library, hardware abstraction layer (Hardware Abstract Layer, HAL) and the kernel layer.
应用程序层可以包括一系列应用程序包。The application layer can include a series of application packages.
如图2A所示,应用程序包可以包括相机,图库,日历,通话,地图,导航,WLAN,蓝牙,音乐,视频,短信息等应用程序。As shown in Figure 2A, the application package can include camera, gallery, calendar, calling, map, navigation, WLAN, Bluetooth, music, video, short message and other applications.
应用程序框架层为应用程序层的应用程序提供应用编程接口(application programming interface,API)和编程框架。应用程序框架层包括一些预先定义的函数。The application framework layer provides an application programming interface (API) and programming framework for applications in the application layer. The application framework layer includes some predefined functions.
如图2A所示,应用程序框架层可以包括刷新率控制模块、SurfaceFlinger、窗口管理器,内容提供器,视图系统,资源管理器,通知管理器,活动管理器,输入管理器等。As shown in Figure 2A, the application framework layer can include the refresh rate control module, SurfaceFlinger, window manager, content provider, view system, resource manager, notification manager, activity manager, input manager, etc.
其中,刷新率控制模块具有感知外部事件的能力。例如,刷新率控制模块可以通过API从应用程序层的应用程序或硬件抽象层或内核层来检测用户界面(User Interface,UI)事件。该UI事件可以是由用户对电子设备进行点击操作或滑动操作触发的。或者,该UI事件可以是由电子设备自动触发的。例如,电子设备的前台应用自动切换画面时,可以触发上述UI事件。前台应用是电子设备的显示屏当前显示的界面对应的应用。再例如,电子设备接收到消息通知,需要显示弹窗,即触发上述UI事件。基于检测到的UI事件,可以确定适合于当前显示场景的屏幕刷新率,并控制显示屏将屏幕刷新率切换到适合于当前显示场景的屏幕刷新率。Among them, the refresh rate control module has the ability to sense external events. For example, the refresh rate control module can detect user interface (UI) events from the application or hardware abstraction layer or kernel layer of the application layer through APIs. The UI event may be triggered by the user's click operation or sliding operation on the electronic device. Alternatively, the UI event may be automatically triggered by the electronic device. For example, when the foreground application of an electronic device automatically switches screens, the above UI event can be triggered. The foreground application is an application corresponding to the interface currently displayed on the display screen of the electronic device. For another example, the electronic device receives a message notification and needs to display a pop-up window, which triggers the above UI event. Based on the detected UI event, the screen refresh rate suitable for the current display scene can be determined, and the display screen is controlled to switch the screen refresh rate to the screen refresh rate suitable for the current display scene.
而显示屏的屏幕刷新率的切换过程可以包括:刷新率控制模块向SurfaceFlinger发送刷新率切换指令,SurfaceFlinger下发该刷新率切换指令给HWC(hwcomposer,硬件合成模块),HWC再下发该刷新率切换指令给显示驱动,显示驱动在收到刷新率切换指令后,通知显示驱动芯片切换到目标刷新率,显示驱动芯片驱动显示屏(例如OLED或者LCD)完成屏幕刷新率切换,以新的屏幕刷新率进行图像刷新显示,并且显示驱动芯片周期性地发送第二Vsync信号给显示驱动。显示驱动上报第二Vsync信号。SurfaceFlinger接收到第二Vsync信号,根据接收到第二Vsync信号的周期,判断第二Vsync信号的信号周期是否为目标刷新率对应的周期,若是则可以确定完成了屏幕刷新率切换。SurfaceFlinger按照该目标刷新率对应的周期,生成相应的第一Vsync信号。APP和SurfaceFlinger会在接收到该第一Vsync信号后才执行图层绘制、图层 渲染和图层合成操作。这样,便可以把APP和SurfaceFlinger进行图层绘制、图层渲染和图层合成操作的帧率切换为与目标刷新率一致。The switching process of the screen refresh rate of the display screen may include: the refresh rate control module sends a refresh rate switching instruction to SurfaceFlinger, SurfaceFlinger issues the refresh rate switching instruction to HWC (hwcomposer, hardware synthesis module), and HWC then issues the refresh rate The switching instruction is given to the display driver. After receiving the refresh rate switching instruction, the display driver notifies the display driver chip to switch to the target refresh rate. The display driver chip drives the display (such as OLED or LCD) to complete the screen refresh rate switching and refresh the screen with the new one. The image is refreshed and displayed at a certain rate, and the display driver chip periodically sends a second Vsync signal to the display driver. The display driver reports the second Vsync signal. SurfaceFlinger receives the second Vsync signal, and determines whether the signal period of the second Vsync signal is the period corresponding to the target refresh rate based on the received period of the second Vsync signal. If so, it can be determined that the screen refresh rate switching is completed. SurfaceFlinger generates the corresponding first Vsync signal according to the cycle corresponding to the target refresh rate. APP and SurfaceFlinger will perform layer drawing and layer processing only after receiving the first Vsync signal. Rendering and layer compositing operations. In this way, the frame rate of the layer drawing, layer rendering and layer composition operations of the APP and SurfaceFlinger can be switched to be consistent with the target refresh rate.
窗口管理器提供窗口管理服务(Window Manager Service,WMS),WMS可以用于窗口管理、窗口动画管理、surface管理以及作为输入系统的中转站。The window manager provides window management service (Window Manager Service, WMS). WMS can be used for window management, window animation management, surface management, and as a transfer station for the input system.
内容提供器用来存放和获取数据,并使这些数据可以被应用程序访问。该数据可以包括视频,图像,音频,拨打和接听的电话,浏览历史和书签,电话簿等。Content providers are used to store and retrieve data and make this data accessible to applications. This data can include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
视图系统包括可视控件,例如显示文字的控件,显示图片的控件等。视图系统可用于构建应用程序。显示界面可以由一个或多个视图组成的。例如,包括短信通知图标的显示界面,可以包括显示文字的视图以及显示图片的视图。The view system includes visual controls, such as controls that display text, controls that display pictures, etc. A view system can be used to build applications. The display interface can be composed of one or more views. For example, a display interface including a text message notification icon may include a view for displaying text and a view for displaying pictures.
资源管理器为应用程序提供各种资源,比如本地化字符串,图标,图片,布局文件,视频文件等等。The resource manager provides various resources to applications, such as localized strings, icons, pictures, layout files, video files, etc.
通知管理器使应用程序可以在状态栏中显示通知信息,可以用于传达告知类型的消息,可以短暂停留后自动消失,无需用户交互。比如通知管理器被用于告知下载完成,消息提醒等。通知管理器还可以是以图表或者滚动条文本形式出现在系统顶部状态栏的通知,例如后台运行的应用程序的通知,还可以是以对话窗口形式出现在屏幕上的通知。例如在状态栏提示文本信息,发出提示音,电子设备振动,指示灯闪烁等。The notification manager allows applications to display notification information in the status bar, which can be used to convey notification-type messages and can automatically disappear after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be notifications that appear in the status bar at the top of the system in the form of charts or scroll bar text, such as notifications for applications running in the background, or notifications that appear on the screen in the form of conversation windows. For example, text information is prompted in the status bar, a beep sounds, the electronic device vibrates, the indicator light flashes, etc.
活动管理器可以提供活动管理服务(Activity Manager Service,AMS),AMS可以用于系统组件(例如活动、服务、内容提供者、广播接收器)的启动、切换、调度以及应用进程的管理和调度工作。The Activity Manager can provide Activity Management Service (AMS), which can be used for the startup, switching, and scheduling of system components (such as activities, services, content providers, and broadcast receivers) as well as the management and scheduling of application processes. .
输入管理器可以提供输入管理服务(Input Manager Service,IMS),IMS可以用于管理系统的输入,例如触摸屏输入、按键输入、传感器输入等。IMS从输入设备节点取出事件,通过和WMS的交互,将事件分配至合适的窗口。The input manager can provide input management service (Input Manager Service, IMS). IMS can be used to manage system input, such as touch screen input, key input, sensor input, etc. IMS takes out events from the input device node and distributes the events to appropriate windows through interaction with WMS.
安卓运行时包括核心库和安卓运行时。安卓运行时负责将源代码转换为机器码。安卓运行时主要包括采用提前(ahead or time,AOT)编译技术和及时(just intime,JIT)编译技术。The Android runtime includes core libraries and Android runtime. The Android runtime is responsible for converting source code into machine code. The Android runtime mainly includes the use of ahead or time (AOT) compilation technology and just in time (JIT) compilation technology.
核心库主要用于提供基本的Java类库的功能,例如基础数据结构、数学、IO、工具、数据库、网络等库。核心库为用户进行安卓应用开发提供了API。The core library is mainly used to provide basic Java class library functions, such as basic data structures, mathematics, IO, tools, databases, networks and other libraries. The core library provides APIs for users to develop Android applications.
原生C/C++库可以包括多个功能模块。例如:表面管理器(surface manager),媒体框架(Media Framework),libc,OpenGL ES、SQLite、Webkit等。Native C/C++ libraries can include multiple function modules. For example: surface manager (surface manager), media framework (Media Framework), libc, OpenGL ES, SQLite, Webkit, etc.
其中,表面管理器用于对显示子系统进行管理,并且为多个应用程序提供了2D和3D图层的融合。媒体框架支持多种常用的音频,视频格式回放和录制,以及静态图像文件等。媒体库可以支持多种音视频编码格式,例如:MPEG4,H.264,MP3,AAC,AMR,JPG,PNG等。OpenGL ES提供应用程序中2D图形和3D图形的绘制和操作。SQLite为电子设备100的应用程序提供轻量级关系型数据库。Among them, the surface manager is used to manage the display subsystem and provides the integration of 2D and 3D layers for multiple applications. The media framework supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc. OpenGL ES provides the drawing and manipulation of 2D graphics and 3D graphics in applications. SQLite provides a lightweight relational database for electronic device 100 applications.
硬件抽象层运行于用户空间(user space),对内核层驱动进行封装,向上层提供调用接口。硬件抽象层可以包括HWC,HWC具有利用硬件完成图像数据组合并显示的功能或能力,具体图像显示可以由多个类如SurfaceFlinger、HWC、显示屏等协同完成。The hardware abstraction layer runs in user space, encapsulates the kernel layer driver, and provides a calling interface to the upper layer. The hardware abstraction layer can include HWC. HWC has the function or ability to use hardware to complete the combination and display of image data. The specific image display can be completed by multiple classes such as SurfaceFlinger, HWC, display screen, etc.
HWC是Android系统中进行窗口/图层(layer)合成并显示的硬件抽象层的模块, 为SurfaceFlinger服务提供硬件支持。HWC is a module of the hardware abstraction layer that synthesizes and displays windows/layers in the Android system. Provide hardware support for SurfaceFlinger service.
其中,SurfaceFlinger提供所有软图层信息给HWC,并询问HWC处理方式。进一步地,HWC可以根据硬件性能决定是使用HWC底层的硬件(例如,硬件合成器)还是GPU合成;例如,HWC会为每个图层标注合成方式,是通过GPU还是通过HWC合成。一方面,SurfaceFlinger对需要GPU合成的软图层进行处理,并将结果通过HWC提交给显示屏;另一方面,需要硬件合成器合成的软图层由HWC自行处理。Among them, SurfaceFlinger provides all soft layer information to HWC and asks HWC how to process it. Furthermore, HWC can decide whether to use HWC's underlying hardware (for example, hardware synthesizer) or GPU synthesis based on hardware performance; for example, HWC will mark the synthesis method for each layer, whether it is synthesized through GPU or HWC. On the one hand, SurfaceFlinger processes soft layers that require GPU synthesis and submits the results to the display through HWC; on the other hand, soft layers that require hardware compositor synthesis are processed by HWC itself.
SurfaceFlinger可以使用三维图形处理库(例如OpenGL ES)合成图层,这需要占用并消耗GPU资源。大多数GPU都没有针对图层合成进行优化,当SurfaceFlinger通过GPU合成图层时,应用程序无法使用GPU进行自己的渲染。而HWC通过硬件合成器进行图层合成,可以减轻GPU的合成压力。SurfaceFlinger can use 3D graphics processing libraries (such as OpenGL ES) to synthesize layers, which requires and consumes GPU resources. Most GPUs are not optimized for layer compositing, and while SurfaceFlinger composites layers through the GPU, applications cannot use the GPU for their own rendering. HWC performs layer synthesis through a hardware synthesizer, which can reduce the synthesis pressure on the GPU.
内核层是硬件和软件之间的层。内核层至少包含显示驱动,摄像头驱动,音频驱动,传感器驱动。具体到本申请方案,涉及的硬件可以包括显示驱动芯片(例如显示驱动集成芯片,display driver integrated circuit,DDIC)以及显示屏(例如OLED或者LCD)。显示驱动用于驱动DDIC完成显示的处理和实现。The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver. Specific to this application solution, the hardware involved may include display driver chips (such as display driver integrated circuit, DDIC) and display screens (such as OLED or LCD). The display driver is used to drive the DDIC to complete display processing and implementation.
以用户启动应用A为例,在用户启动应用A之后,显示屏将显示应用A的界面。具体的,应用A将待显示的界面的显示参数发送给SurfaceFlinger。SurfaceFlinger负责控制界面(surface)的融合。作为示例,这里的界面可能是状态栏、系统栏、应用本身(应用A待显示的界面)、壁纸、背景等呈现的界面。因此,SurfaceFlinger不仅可以获取到应用A待显示的界面的显示参数,还可以得到其他界面的显示参数。SurfaceFlinger通过接口(例如set Layer Buffer、set Layer Color等)将各个界面的显示参数(例如内存地址、颜色等)发送给HWC进行界面融合。通常,图像的合成(例如,电子设备显示图像时,需要将状态栏、系统栏、应用本身和壁纸背景合成)中,HWC通过HWC底层的硬件(如硬件合成器)根据各个界面的显示参数获得合成后的图像。需要说明,在HWC通过底层的硬件获得合成后的图像后,SurfaceFlinger才会结束本次合成图像的任务。HWC将底层的硬件合成后的图像发送至内核层的显示驱动。内核层的显示驱动将合成后的图像给到硬件层的显示驱动芯片,硬件层的显示驱动芯片对合成后的图像进行二次处理,将二次处理后的图像送到显示屏进行显示。实际应用中,也可以不进行二次处理。若不进行二次处理,则硬件层的显示驱动直接将合成后的图像送到显示屏进行显示。按照上述方式,显示屏可以完成一次刷新显示流程。电子设备可以按照显示屏的屏幕刷新率,以一定的周期执行上述刷新显示流程。例如,显示屏的屏幕刷新率为60Hz,对应的信号周期为16ms,相当于每间隔16ms执行一次上述刷新显示流程。Taking the user starting application A as an example, after the user starts application A, the display screen will display the interface of application A. Specifically, Application A sends the display parameters of the interface to be displayed to SurfaceFlinger. SurfaceFlinger is responsible for controlling the integration of the surface. As an example, the interface here may be the interface presented by the status bar, the system bar, the application itself (the interface to be displayed by application A), wallpaper, background, etc. Therefore, SurfaceFlinger can not only obtain the display parameters of the interface to be displayed by application A, but also obtain the display parameters of other interfaces. SurfaceFlinger sends the display parameters of each interface (such as memory address, color, etc.) to HWC through interfaces (such as set Layer Buffer, set Layer Color, etc.) for interface fusion. Usually, in image synthesis (for example, when an electronic device displays an image, it needs to synthesize the status bar, system bar, application itself and wallpaper background), HWC is obtained through the underlying hardware of HWC (such as hardware synthesizer) according to the display parameters of each interface. The combined image. It should be noted that SurfaceFlinger will not end the task of synthesizing images until HWC obtains the synthesized image through the underlying hardware. HWC sends the underlying hardware-synthesized image to the kernel-layer display driver. The display driver of the kernel layer sends the synthesized image to the display driver chip of the hardware layer. The display driver chip of the hardware layer performs secondary processing on the synthesized image and sends the secondary processed image to the display screen for display. In practical applications, secondary processing may not be performed. If no secondary processing is performed, the display driver at the hardware layer directly sends the synthesized image to the display screen for display. According to the above method, the display screen can complete a refresh display process. The electronic device can execute the above refresh display process in a certain period according to the screen refresh rate of the display screen. For example, the screen refresh rate of the display screen is 60Hz, and the corresponding signal period is 16ms, which is equivalent to executing the above refresh display process every 16ms.
示例性的,本申请实施例中的电子设备可以是手机、平板电脑、桌面型、膝上型、手持计算机、笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本,以及蜂窝电话、个人数字助理(personal digital assistant,PDA)、增强现实(augmented reality,AR)\虚拟现实(virtual reality,VR)设备等包括触摸屏的设备,本申请实施例对该电子设备的具体形态不作特殊限制。For example, the electronic device in the embodiment of the present application 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, and a cellular phone. Telephones, personal digital assistants (PDAs), augmented reality (AR)/virtual reality (VR) devices, and other devices including touch screens. The embodiments of this application do not make special arrangements for the specific form of the electronic devices. limit.
下面将结合附图对本申请实施例的实施方式进行详细描述。The implementation of the embodiments of the present application will be described in detail below with reference to the accompanying drawings.
请参考图2B,为本申请实施例提供的一种电子设备200的结构示意图。如图2B 所示,电子设备200可以包括处理器210,外部存储器接口220,内部存储器221,通用串行总线(universal serial bus,USB)接口230,充电管理模块240,电源管理模块241,电池242,天线1,天线2,移动通信模块250,无线通信模块260,音频模块270,传感器模块280,按键290,马达291,指示器292,摄像头293,显示屏294,以及用户标识模块(subscriber identification module,SIM)卡接口295等。Please refer to FIG. 2B , which is a schematic structural diagram of an electronic device 200 provided by an embodiment of the present application. As shown in Figure 2B As shown, the electronic device 200 may include a processor 210, an external memory interface 220, an internal memory 221, a universal serial bus (USB) interface 230, a charging management module 240, a power management module 241, a battery 242, and an antenna 1 , antenna 2, mobile communication module 250, wireless communication module 260, audio module 270, sensor module 280, button 290, motor 291, indicator 292, camera 293, display screen 294, and subscriber identification module (SIM) Card interface 295, etc.
其中,传感器模块280可以包括触摸传感器。可以理解的是,本实施例示意的结构并不构成对电子设备200的具体限定。在另一些实施例中,电子设备200可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。Among them, the sensor module 280 may include a touch sensor. It can be understood that the structure illustrated in this embodiment does not constitute a specific limitation on the electronic device 200 . In other embodiments, the electronic device 200 may include more or fewer components than illustrated, or some components may be combined, or some components may be separated, or may be arranged differently. The components illustrated may be implemented in hardware, software, or a combination of software and hardware.
处理器210可以包括一个或多个处理单元。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。Processor 210 may include one or more processing units. Among them, different processing units can be independent devices or integrated in one or more processors.
控制器可以是电子设备200的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。The controller may be the nerve center and command center of the electronic device 200 . The controller can generate operation control signals based on the instruction operation code and timing signals to complete the control of fetching and executing instructions.
处理器210中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器210中的存储器为高速缓冲存储器。该存储器可以保存处理器210刚用过或循环使用的指令或数据。如果处理器210需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器210的等待时间,因而提高了系统的效率。The processor 210 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in processor 210 is cache memory. This memory may hold instructions or data that have been recently used or recycled by processor 210 . If the processor 210 needs to use the instructions or data again, it can be called directly from the memory. Repeated access is avoided and the waiting time of the processor 210 is reduced, thus improving the efficiency of the system.
在一些实施例中,处理器210可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。In some embodiments, processor 210 may include one or more interfaces. Interfaces may include integrated circuit (inter-integrated circuit, I2C) interface, integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, pulse code modulation (pulse code modulation, PCM) interface, universal asynchronous receiver and transmitter (universal asynchronous receiver/transmitter (UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, subscriber identity module (SIM) interface, and /or universal serial bus (USB) interface, etc.
可以理解的是,本实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对电子设备200的结构限定。在另一些实施例中,电子设备200也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。It can be understood that the interface connection relationships between the modules illustrated in this embodiment are only schematic illustrations and do not constitute a structural limitation of the electronic device 200 . In other embodiments, the electronic device 200 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
充电管理模块240用于从充电器接收充电输入。充电管理模块240为电池242充电的同时,还可以通过电源管理模块241为电子设备供电。The charge management module 240 is used to receive charging input from the charger. While charging the battery 242, the charging management module 240 can also provide power to the electronic device through the power management module 241.
电源管理模块241用于连接电池242,充电管理模块240与处理器210。电源管理模块241接收电池242和/或充电管理模块240的输入,为处理器210,内部存储器221,外部存储器,显示屏294,摄像头293,和无线通信模块260等供电。在其他一些实施例中,电源管理模块241也可以设置于处理器210中。在另一些实施例中,电源管理模块241和充电管理模块240也可以设置于同一个器件中。The power management module 241 is used to connect the battery 242, the charging management module 240 and the processor 210. The power management module 241 receives input from the battery 242 and/or the charging management module 240 and supplies power to the processor 210, internal memory 221, external memory, display screen 294, camera 293, wireless communication module 260, etc. In some other embodiments, the power management module 241 may also be provided in the processor 210 . In other embodiments, the power management module 241 and the charging management module 240 may also be provided in the same device.
电子设备200的无线通信功能可以通过天线1,天线2,移动通信模块250,无线通信模块260,调制解调处理器以及基带处理器等实现。The wireless communication function of the electronic device 200 can be implemented through the antenna 1, the antenna 2, the mobile communication module 250, the wireless communication module 260, the modem processor and the baseband processor.
天线1和天线2用于发射和接收电磁波信号。电子设备200中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。 Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 200 may be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example: Antenna 1 can be reused as a diversity antenna for a wireless LAN.
移动通信模块250可以提供应用在电子设备200上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块250可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块250可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块250还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。The mobile communication module 250 can provide wireless communication solutions including 2G/3G/4G/5G applied to the electronic device 200 . The mobile communication module 250 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 250 can receive electromagnetic waves from the antenna 1, perform filtering, amplification and other processing on the received electromagnetic waves, and transmit them to the modem processor for demodulation. The mobile communication module 250 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves through the antenna 1 for radiation.
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备输出声音信号,或通过显示屏294显示图像或视频。A 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 sound signals through the audio device, or displays images or videos through the display screen 294.
无线通信模块260可以提供应用在电子设备200上的包括无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块260可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块260经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器210。无线通信模块260还可以从处理器210接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。The wireless communication module 260 can provide applications on the electronic device 200 including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) network), Bluetooth (bluetooth, BT), and global navigation satellites. System (global navigation satellite system, GNSS), frequency modulation (frequency modulation, FM), near field communication technology (near field communication, NFC), infrared technology (infrared, IR) and other wireless communication solutions. The wireless communication module 260 may be one or more devices integrating at least one communication processing module. The wireless communication module 260 receives electromagnetic waves via the antenna 2 , frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 210 . The wireless communication module 260 can also receive the signal to be sent from the processor 210, frequency modulate it, amplify it, and convert it into electromagnetic waves through the antenna 2 for radiation.
在一些实施例中,电子设备200的天线1和移动通信模块250耦合,天线2和无线通信模块260耦合,使得电子设备200可以通过无线通信技术与网络以及其他设备通信。In some embodiments, the antenna 1 of the electronic device 200 is coupled to the mobile communication module 250, and the antenna 2 is coupled to the wireless communication module 260, so that the electronic device 200 can communicate with the network and other devices through wireless communication technology.
电子设备200通过GPU,显示屏294,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏294和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器210可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。The electronic device 200 implements display functions through a GPU, a display screen 294, an application processor, and the like. The GPU is an image processing microprocessor and is connected to the display screen 294 and the application processor. GPUs are used to perform mathematical and geometric calculations for graphics rendering. Processor 210 may include one or more GPUs that execute program instructions to generate or alter display information.
显示屏294用于显示图像,视频等。该显示屏294包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-OLED,量子点发光二极管(quantum dot light emitting diodes,QLED)等。The display screen 294 is used to display images, videos, etc. The display screen 294 includes a display panel. The display panel can use 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 (active-matrix organic light emitting diode). emitting diode (AMOLED), flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-OLED, quantum dot light emitting diode (QLED), etc.
其中,本申请实施例中的显示屏294可以是触摸屏。即该显示屏294中集成了触摸传感器。该触摸传感器也可以称为“触控面板”。也就是说,显示屏294可以包括显示面板和触摸面板,由触摸传感器与显示屏294组成触摸屏,也称“触控屏”。触摸传感器用于检测作用于其上或附近的触摸操作。触摸传感器检测到的触摸操作后,可以由内核层的驱动(如TP驱动)传递给上层,以确定触摸事件类型。可以通过显示屏294提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器也可以设置 于电子设备200的表面,与显示屏294所处的位置不同。Among them, the display screen 294 in the embodiment of the present application may be a touch screen. That is, the display screen 294 integrates a touch sensor. The touch sensor may also be referred to as a "touch panel." That is to say, the display screen 294 may include a display panel and a touch panel. The touch sensor and the display screen 294 form a touch screen, which is also called a "touch screen". Touch sensors are used to detect touches on or near them. After the touch operation detected by the touch sensor, it can be passed to the upper layer by the kernel layer driver (such as TP driver) to determine the touch event type. Visual output related to the touch operation may be provided through display screen 294. In other embodiments, the touch sensor may also be provided The surface of the electronic device 200 is in a different position from the display screen 294 .
电子设备200可以通过ISP,摄像头293,视频编解码器,GPU,显示屏294以及应用处理器等实现拍摄功能。ISP用于处理摄像头293反馈的数据。摄像头293用于捕获静态图像或视频。数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。视频编解码器用于对数字视频压缩或解压缩。电子设备200可以支持一种或多种视频编解码器。这样,电子设备200可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1,MPEG2,MPEG3,MPEG4等。The electronic device 200 can implement the shooting function through an ISP, a camera 293, a video codec, a GPU, a display screen 294, and an application processor. The ISP is used to process the data fed back by the camera 293. Camera 293 is used to capture still images or video. Digital signal processors are used to process digital signals. In addition to digital image signals, they can also process other digital signals. Video codecs are used to compress or decompress digital video. Electronic device 200 may support one or more video codecs. In this way, the electronic device 200 can play or record videos in multiple encoding formats, such as: moving picture experts group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
外部存储器接口220可以用于连接外部存储卡,例如MicroSD卡,实现扩展电子设备200的存储能力。外部存储卡通过外部存储器接口220与处理器210通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。内部存储器221可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。处理器210通过运行存储在内部存储器221的指令,从而执行电子设备200的各种功能应用以及数据处理。例如,在本申请实施例中,处理器210可以通过执行存储在内部存储器221中的指令,内部存储器221可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用程序(比如声音播放功能,图像播放功能等)等。存储数据区可存储电子设备200使用过程中所创建的数据(比如音频数据,电话本等)等。此外,内部存储器221可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。The external memory interface 220 can be used to connect an external memory card, such as a MicroSD card, to expand the storage capacity of the electronic device 200 . The external memory card communicates with the processor 210 through the external memory interface 220 to implement the data storage function. Such as saving music, videos, etc. files in external memory card. Internal memory 221 may be used to store computer executable program code, which includes instructions. The processor 210 executes instructions stored in the internal memory 221 to execute various functional applications and data processing of the electronic device 200 . For example, in this embodiment of the present application, the processor 210 can execute instructions stored in the internal memory 221, and the internal memory 221 can include a program storage area and a data storage area. Among them, the stored program area can store an operating system, at least one application program required for a function (such as a sound playback function, an image playback function, etc.). The storage data area may store data created during use of the electronic device 200 (such as audio data, phone book, etc.). In addition, the internal memory 221 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.
电子设备200可以通过音频模块270,扬声器270A,受话器270B,麦克风170C,耳机接口270D,以及应用处理器等实现音频功能。例如音乐播放,录音等。The electronic device 200 can implement audio functions through the audio module 270, the speaker 270A, the receiver 270B, the microphone 170C, the headphone interface 270D, and the application processor. Such as music playback, recording, etc.
音频模块270用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块270还可以用于对音频信号编码和解码。The audio module 270 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. Audio module 270 may also be used to encode and decode audio signals.
按键290包括开机键,音量键等。按键290可以是机械按键。也可以是触摸式按键。电子设备200可以接收按键输入,产生与电子设备200的用户设置以及功能控制有关的键信号输入。马达291可以产生振动提示。马达291可以用于来电振动提示,也可以用于触摸振动反馈。指示器292可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。SIM卡接口295用于连接SIM卡。SIM卡可以通过插入SIM卡接口295,或从SIM卡接口295拔出,实现和电子设备200的接触和分离。电子设备200可以支持1个或N个SIM卡接口,N为大于1的正整数。SIM卡接口295可以支持Nano SIM卡,Micro SIM卡,SIM卡等。The buttons 290 include a power button, a volume button, etc. Key 290 may be a mechanical key. It can also be a touch button. The electronic device 200 may receive key input and generate key signal input related to user settings and function control of the electronic device 200 . The motor 291 can generate vibration prompts. The motor 291 can be used for vibration prompts for incoming calls and can also be used for touch vibration feedback. The indicator 292 may be an indicator light, which may be used to indicate charging status, power changes, or may be used to indicate messages, missed calls, notifications, etc. The SIM card interface 295 is used to connect a SIM card. The SIM card can be connected to or separated from the electronic device 200 by inserting it into the SIM card interface 295 or pulling it out from the SIM card interface 295 . The electronic device 200 may support 1 or N SIM card interfaces, where N is a positive integer greater than 1. SIM card interface 295 can support Nano SIM card, Micro SIM card, SIM card, etc.
以下实施例中的方法均可以在具有上述硬件结构的电子设备200中实现。The methods in the following embodiments can all be implemented in the electronic device 200 with the above hardware structure.
在一种场景下,如用户未对电子设备进行操作,电子设备也没有收到通知等,没有出现弹窗,电子设备的显示屏显示静态图像时,此时将显示屏的屏幕刷新率从高刷新率切换至低刷新率,可以节省电能和CPU资源。其中,低刷新率是指显示屏的屏幕刷新率小于或等于预设阈值,如屏幕刷新率为10Hz或1Hz。高刷新率是指显示屏的屏幕刷新率大于预设阈值,如屏幕刷新率为60Hz、90Hz或120Hz。但是,在显示屏的屏幕刷新率为低刷新率时,如果用户进行点击操作或滑动操作,或终端接收到消息通知, 显示屏需要显示弹窗,或电子设备显示屏需要显示动画等,则显示屏需要退出低刷新率,切换回高刷新率。In one scenario, if the user does not operate the electronic device, the electronic device does not receive notifications, etc., no pop-up window appears, and the display screen of the electronic device displays a static image, at this time, the screen refresh rate of the display screen is changed from high to high. Switching the refresh rate to a low refresh rate can save power and CPU resources. Among them, low refresh rate means that the screen refresh rate of the display screen is less than or equal to the preset threshold, such as the screen refresh rate is 10Hz or 1Hz. High refresh rate means that the screen refresh rate of the display is greater than the preset threshold, such as the screen refresh rate of 60Hz, 90Hz or 120Hz. However, when the screen refresh rate of the display is low, if the user performs a click operation or sliding operation, or the terminal receives a message notification, If the display screen needs to display pop-up windows, or the electronic device display screen needs to display animations, etc., the display screen needs to exit the low refresh rate and switch back to the high refresh rate.
参见图3,图3示出了在显示屏需要退出低刷新率,切换回高刷新率的场景下,Android系统原生机制下的屏幕刷新率切换流程图。如图3所示,Android系统原生机制下的屏幕刷新率切换流程包括以下步骤:Referring to Figure 3, Figure 3 shows a screen refresh rate switching flow chart under the native mechanism of the Android system in a scenario where the display screen needs to exit a low refresh rate and switch back to a high refresh rate. As shown in Figure 3, the screen refresh rate switching process under the native mechanism of the Android system includes the following steps:
S301、SurfaceFlinger在第i个信号周期(该信号周期为第一刷新率f1对应的信号周期T1,T1等于第一刷新率的倒数,即T1=1/f1,如在f1=10Hz的情况下,T1=100ms)内接收第一刷新率切换指令。该第一刷新率切换指令用于指示显示屏的屏幕刷新率从第一刷新率切换到第二刷新率。其中,第一刷新率小于或等于预设阈值,第二刷新率大于预设阈值。S301, SurfaceFlinger in the i-th signal period (the signal period is the signal period T1 corresponding to the first refresh rate f1, T1 is equal to the reciprocal of the first refresh rate, that is, T1=1/f1, for example, in the case of f1=10Hz, Receive the first refresh rate switching command within T1=100ms). The first refresh rate switching instruction is used to instruct the screen refresh rate of the display screen to switch from the first refresh rate to the second refresh rate. Wherein, the first refresh rate is less than or equal to the preset threshold, and the second refresh rate is greater than the preset threshold.
应理解,若电子设备在第i个信号周期内接收到用户操作(例如点击或滑动操作)或接收到通知需要进行界面更新等,则电子设备的帧率控制模块会在感知到上述情况后向SurfaceFlinger下发第一刷新率切换指令,以指示显示屏的屏幕刷新率从第一刷新率切换到第二刷新率。It should be understood that if the electronic device receives a user operation (such as a click or sliding operation) or receives a notification that an interface update is required during the i-th signal period, the frame rate control module of the electronic device will respond to the above situation after sensing the above situation. SurfaceFlinger issues a first refresh rate switching command to instruct the display screen refresh rate to switch from the first refresh rate to the second refresh rate.
S302、SurfaceFlinger接收第一刷新率切换指令,响应于第i个信号周期结束,即第i+1个信号周期开始,会产生一个第一Vsync信号,用于触发SurfaceFlinger进行新的图层合成,并将第一刷新率切换指令下发到显示驱动;并启动Vsync信号校准。S302. SurfaceFlinger receives the first refresh rate switching instruction. In response to the end of the i-th signal period, that is, the beginning of the i+1th signal period, a first Vsync signal will be generated to trigger SurfaceFlinger to perform new layer synthesis, and Send the first refresh rate switching command to the display driver; and start Vsync signal calibration.
S303、显示驱动接收第一刷新率切换指令,并将第一刷新率切换指令下发至显示屏。S303. The display driver receives the first refresh rate switching command and sends the first refresh rate switching command to the display screen.
S304、显示屏接收第一刷新率切换指令,在第i+1个信号周期内,刷新显示一个图像帧。S304. The display screen receives the first refresh rate switching instruction, and refreshes and displays an image frame in the i+1th signal period.
S305、显示屏刷新显示一个图像帧完成,按照第一刷新率切换指令,将显示屏的屏幕刷新率从第一刷新率切换为第二刷新率,按照第二刷新率进行图像帧的刷新显示,并且显示屏按照第二刷新率,周期性地发送第二Vsync信号给显示驱动。S305. The display screen refreshes and displays one image frame. According to the first refresh rate switching instruction, the screen refresh rate of the display screen is switched from the first refresh rate to the second refresh rate, and the image frame is refreshed and displayed according to the second refresh rate. And the display screen periodically sends the second Vsync signal to the display driver according to the second refresh rate.
通过上述步骤,可以将第二Vsync信号的信号周期从T1切换为第二刷新率f2对应的信号周期T2,每隔一个T2向显示驱动上报一个第二Vsync信号。其中,T2等于第二刷新率的倒数,即T2=1/f2。Through the above steps, the signal period of the second Vsync signal can be switched from T1 to the signal period T2 corresponding to the second refresh rate f2, and a second Vsync signal is reported to the display driver every other T2. Among them, T2 is equal to the reciprocal of the second refresh rate, that is, T2=1/f2.
S306、显示驱动周期性地接收来自于显示屏的第二Vsync信号,并向SurfaceFlinger上报接收到的第二Vsync信号。S306. The display driver periodically receives the second Vsync signal from the display screen, and reports the received second Vsync signal to SurfaceFlinger.
S307、SurfaceFlinger周期性地接收第二Vsync信号。若接收到第二Vsync信号的周期(period,即接收到两个相邻的第二Vsync信号的间隔时间)为T2,则SurfaceFlinger确认完成了屏幕刷新率切换,关闭Vsync信号校准。若SurfaceFlinger接收到第二Vsync信号的周期不等于T2,则继续执行步骤S307。S307. SurfaceFlinger periodically receives the second Vsync signal. If the period of receiving the second Vsync signal (period, that is, the interval between receiving two adjacent second Vsync signals) is T2, SurfaceFlinger confirms that the screen refresh rate switching is completed and turns off Vsync signal calibration. If the period of the second Vsync signal received by SurfaceFlinger is not equal to T2, step S307 is continued.
这样,SurfaceFlinger确定完成了屏幕刷新率切换后,可以响应于当前的信号周期(第i+2个信号周期)结束,按照Vsync信号校准后的信号周期,即T2,周期性地生成第一Vsync信号。也就是说,第一Vsync信号的信号周期调整为T2。In this way, after SurfaceFlinger determines that the screen refresh rate switching is completed, it can respond to the end of the current signal period (i+2 signal period) and periodically generate the first Vsync signal according to the calibrated signal period of the Vsync signal, that is, T2. . That is to say, the signal period of the first Vsync signal is adjusted to T2.
应理解,上述步骤S306中,SurfaceFlinger确认完成了屏幕刷新率切换后,将第一Vsync信号的信号周期调整为T2,这需要在第i+2个信号周期结束才生效,也就 是说,SurfaceFlinger在第i+2个信号周期结束才能够以第二刷新率为频率,以T2为周期,周期性生成第一Vsync信号(包括Vsync-APP信号和Vsync-SF信号)。It should be understood that in the above step S306, after SurfaceFlinger confirms that the screen refresh rate switching is completed, it adjusts the signal period of the first Vsync signal to T2, which needs to take effect at the end of the i+2th signal period, that is, That is to say, SurfaceFlinger can periodically generate the first Vsync signal (including the Vsync-APP signal and the Vsync-SF signal) at the second refresh rate and with T2 as the period at the end of the i+2 signal period.
示例性地,第一刷新率为10Hz,对应的T1为100ms。第二刷新率为60Hz,对应的T2为16ms。预设刷新率为120Hz,对应的预设周期为8ms。For example, the first refresh rate is 10Hz, and the corresponding T1 is 100ms. The second refresh rate is 60Hz, and the corresponding T2 is 16ms. The default refresh rate is 120Hz, and the corresponding preset period is 8ms.
按照上述Android系统原生机制下的屏幕刷新率切换流程,在需要将显示屏的屏幕刷新率从低刷新率(第一刷新率)切换到高刷新率(第二刷新率)时,SurfaceFlinger在接收到第一刷新率切换指令之后,SurfaceFlinger仍需按照当前的信号周期(第i个信号周期)完成当前图像帧的图层合成,在第i个信号周期结束,即第i+1个信号周期开始,会产生一个第一Vsync信号,用于触发新的图层合成,此时才会下发第一刷新率切换指令,并启动Vsync信号校准。而且显示屏接收到该第一刷新率切换指令后,也仍需按照当前的信号周期(第i+1个信号周期)执行一次图像帧刷新显示,才将显示屏的屏幕刷新率从第一刷新率切换为第二刷新率,即将第二Vsync信号的信号周期从T1切换至T2(如16ms),每隔一个T2向显示驱动上报一个第二Vsync信号。SurfaceFlinger接收第二Vsync信号,根据接收到两个第二Vsync信号的间隔时间,判断第二Vsync信号的信号周期是否为T2,若是,则可以确认完成了屏幕刷新率切换。但SurfaceFlinger需要在当前的信号周期(第i+2个信号周期)结束,才能以第二刷新率为频率,以T2为信号周期,生成第一Vsync信号。这样,按照Android系统原生机制下的屏幕刷新率切换流程,整个屏幕刷新率切换过程(从SurfaceFlinger接收到第一刷新率切换指令到SurfaceFlinger按第二刷新率生成第一Vsync信号)至少需要消耗两个信号周期(该信号周期为T1,该两个信号周期即低刷新率下的2帧处理时长)的时间才能完成。According to the screen refresh rate switching process under the native mechanism of the Android system mentioned above, when it is necessary to switch the screen refresh rate of the display from a low refresh rate (first refresh rate) to a high refresh rate (second refresh rate), SurfaceFlinger receives After the first refresh rate switching instruction, SurfaceFlinger still needs to complete the layer synthesis of the current image frame according to the current signal period (i-th signal period). At the end of the i-th signal period, that is, the i+1-th signal period begins. A first Vsync signal will be generated to trigger new layer synthesis. Only then will the first refresh rate switching command be issued and Vsync signal calibration started. Moreover, after the display screen receives the first refresh rate switching command, it still needs to perform an image frame refresh display according to the current signal cycle (i+1th signal cycle) before changing the screen refresh rate of the display screen from the first refresh rate to the first refresh rate switching command. The refresh rate is switched to the second refresh rate, that is, the signal period of the second Vsync signal is switched from T1 to T2 (for example, 16 ms), and a second Vsync signal is reported to the display driver every T2. SurfaceFlinger receives the second Vsync signal, and determines whether the signal period of the second Vsync signal is T2 based on the interval between receiving the two second Vsync signals. If so, it can be confirmed that the screen refresh rate switching is completed. However, SurfaceFlinger needs to end at the current signal period (i+2 signal period) before it can generate the first Vsync signal at the second refresh rate and T2 as the signal period. In this way, according to the screen refresh rate switching process under the native mechanism of the Android system, the entire screen refresh rate switching process (from SurfaceFlinger receiving the first refresh rate switching instruction to SurfaceFlinger generating the first Vsync signal at the second refresh rate) requires at least two The signal period (the signal period is T1, and the two signal periods are the 2-frame processing time at a low refresh rate) can be completed.
例如,第一种情况:SurfaceFlinger在第i个信号周期即将结束时收到第一刷新率切换指令,即图3中所示的t1时刻接近i个信号周期的结束时刻,x1≈0。SurfaceFlinger在第i+1个信号周期一开始就下发第一刷新率切换指令,显示屏在第i+1个信号周期内接收到该第一刷新率切换指令,按照当前的信号周期(第i+1个信号周期)执行完一次图像帧刷新显示,之后将显示屏的屏幕刷新率从第一刷新率切换为第二刷新率,并每隔一个T2向显示驱动上报一个第二Vsync信号。SurfaceFlinger接收第二Vsync信号,根据接收到两个第二Vsync信号的间隔时间,判断第二Vsync信号的信号周期是否为T2,若是,则可以确认完成了屏幕刷新率切换,这时候已经是在第i+2个信号周期内。所以SurfaceFlinger需要在当前的信号周期(第i+2个信号周期)结束(如图3所示的t2时刻),才能以第二刷新率为频率,以T2为信号周期,生成第一Vsync信号。第一种情况是整个屏幕刷新率切换过程需要消耗的时间最短的情况,从SurfaceFlinger接收到第一刷新率切换指令到显示屏的屏幕刷新率从第一刷新率切换为第二刷新率需要经历将近一个信号周期(该信号周期为T1,如T1=100ms,一个信号周期即100ms)的时间,而从SurfaceFlinger接收到第一刷新率切换指令到SurfaceFlinger按第二刷新率生成第一Vsync信号(从t1时刻到t2时刻)需要经历两个信号周期(该信号周期为T1,如T1=100ms,两个信号周期即200ms)的时间。For example, the first situation: SurfaceFlinger receives the first refresh rate switching instruction when the i-th signal period is about to end, that is, the t1 moment shown in Figure 3 is close to the end of the i-th signal period, x1≈0. SurfaceFlinger issues the first refresh rate switching command at the beginning of the i+1th signal cycle. The display screen receives the first refresh rate switching command during the i+1th signal cycle. According to the current signal cycle (ith signal cycle) +1 signal period) after executing an image frame refresh display, the screen refresh rate of the display screen is switched from the first refresh rate to the second refresh rate, and a second Vsync signal is reported to the display driver every T2. SurfaceFlinger receives the second Vsync signal, and determines whether the signal period of the second Vsync signal is T2 based on the interval between receiving the two second Vsync signals. If so, it can be confirmed that the screen refresh rate switch is completed. At this time, it is already in the second Vsync signal. Within i+2 signal periods. Therefore, SurfaceFlinger needs to end at the current signal period (i+2 signal period) (at the t2 moment as shown in Figure 3) to generate the first Vsync signal at the second refresh rate and with T2 as the signal period. The first situation is the situation where the entire screen refresh rate switching process takes the shortest time. It takes nearly One signal period (the signal period is T1, such as T1 = 100ms, one signal period is 100ms), and the first refresh rate switching instruction is received from SurfaceFlinger to SurfaceFlinger generating the first Vsync signal at the second refresh rate (from t1 time to time t2) it takes two signal periods (the signal period is T1, for example, T1=100ms, the two signal periods are 200ms).
再例如,第二种情况:SurfaceFlinger在第i个信号周期刚开始就收到第一刷新率切换指令,即图3中所示的t1时刻接近i个信号周期的开始时刻,x1≈100。但 SurfaceFlinger需要等到当前的信号周期结束,在第i+1个信号周期开始时才下发第一刷新率切换指令,显示屏在第i+1个信号周期内接收到该第一刷新率切换指令,仍需按照当前的信号周期(第i+1个信号周期)执行完一次图像帧刷新显示,之后才将显示屏的屏幕刷新率从第一刷新率切换为第二刷新率,并每隔一个T2向显示驱动上报一个第二Vsync信号。SurfaceFlinger接收第二Vsync信号,判断第二Vsync信号的周期为T2时,可以确认完成了屏幕刷新率切换,这时候已经是在第i+2个信号周期内。所以SurfaceFlinger需要在当前的信号周期(第i+2个信号周期)结束(如图3所示的t2时刻),才能以第二刷新率为频率,以T2为信号周期,生成第一Vsync信号。第二种情况是整个屏幕刷新率切换过程需要消耗的时间最长的情况,从SurfaceFlinger接收到第一刷新率切换指令到显示屏的屏幕刷新率从第一刷新率切换为第二刷新率需要经历将近两个信号周期(该信号周期为T1,如T1=100ms,两个信号周期即200ms)的时间,而从SurfaceFlinger接收到第一刷新率切换指令到SurfaceFlinger按第二刷新率生成第一Vsync信号(从t1时刻到t2时刻)需要经历三个信号周期(该信号周期为T1,如T1=100ms,三个信号周期即300ms)的时间。For another example, the second case: SurfaceFlinger receives the first refresh rate switching command at the beginning of the i-th signal cycle, that is, the t1 moment shown in Figure 3 is close to the beginning of the i-th signal cycle, x1≈100. but SurfaceFlinger needs to wait until the end of the current signal cycle and issue the first refresh rate switching command at the beginning of the i+1th signal cycle. The display screen receives the first refresh rate switching command within the i+1th signal cycle. It is still necessary to perform an image frame refresh display according to the current signal period (i+1th signal period), and then switch the screen refresh rate of the display screen from the first refresh rate to the second refresh rate, and every T2 Report a second Vsync signal to the display driver. When SurfaceFlinger receives the second Vsync signal and determines that the period of the second Vsync signal is T2, it can confirm that the screen refresh rate switching is completed, which is already within the i+2th signal period. Therefore, SurfaceFlinger needs to end at the current signal period (i+2 signal period) (at the t2 moment as shown in Figure 3) to generate the first Vsync signal at the second refresh rate and with T2 as the signal period. The second case is the one that takes the longest time for the entire screen refresh rate switching process. It takes time from SurfaceFlinger receiving the first refresh rate switching instruction to the time the screen refresh rate of the display screen switches from the first refresh rate to the second refresh rate. Nearly two signal periods (the signal period is T1, such as T1 = 100ms, the two signal periods are 200ms), and from when SurfaceFlinger receives the first refresh rate switching command to when SurfaceFlinger generates the first Vsync signal at the second refresh rate It takes three signal periods (from time t1 to time t2) (the signal period is T1, for example, T1=100ms, and the three signal periods are 300ms).
而如果第一刷新率为1Hz,对应的T1为1000ms。则按照Android系统原生机制下的屏幕刷新率切换流程,整个屏幕刷新率切换过程至少需要经历2000ms,即2s)的时间。And if the first refresh rate is 1Hz, the corresponding T1 is 1000ms. According to the screen refresh rate switching process under the native mechanism of the Android system, the entire screen refresh rate switching process requires at least 2000ms, or 2s).
因此,在将显示屏的屏幕刷新率由高刷新率切换到低刷新率时,由于高刷新率对应的信号周期较短,屏幕刷新率切换过程耗时较短,不会产生卡顿的问题。但是,在将显示屏的屏幕刷新率由低刷新率切换回高刷新率的处理机制上,根据Android系统的原生机制,最少需要经过在低刷新率下两个周期的时间才能完成整个屏幕刷新率切换过程。例如,显示屏起始的屏幕刷新率为10Hz,则至少需要经过200ms才能整个屏幕刷新率切换过程。再例如,显示屏起始的屏幕刷新率为1Hz,则至少需要经过2s才能整个屏幕刷新率切换过程。屏幕刷新率切换过程耗时较长,切换性能差。在这样的机制下,显示屏的屏幕刷新率切换时可能会产生卡顿,严重影响电子设备的跟手性。Therefore, when switching the screen refresh rate of the display from a high refresh rate to a low refresh rate, since the signal period corresponding to the high refresh rate is shorter, the screen refresh rate switching process takes less time and will not cause lag problems. However, in terms of the processing mechanism for switching the screen refresh rate of the display from a low refresh rate back to a high refresh rate, according to the native mechanism of the Android system, it takes at least two cycles at a low refresh rate to complete the entire screen refresh rate. switching process. For example, if the initial screen refresh rate of the display is 10Hz, it will take at least 200ms to complete the entire screen refresh rate switching process. For another example, if the initial screen refresh rate of the display is 1Hz, it will take at least 2 seconds to complete the entire screen refresh rate switching process. The screen refresh rate switching process takes a long time and the switching performance is poor. Under such a mechanism, lag may occur when the screen refresh rate of the display screen is switched, seriously affecting the chirality of the electronic device.
其中,电子设备的跟手性能可以体现为用户操作响应延迟的长度。用户操作响应延迟可以理解为从“用户对电子设备进行点击或滑动操作”到“电子设备显示该点击或滑动操作对应的图像被人眼感知”的延迟时间。Among them, the hand-following performance of electronic equipment can be reflected in the length of user operation response delay. User operation response delay can be understood as the delay time from "the user performs a click or slide operation on the electronic device" to "the electronic device displays the image corresponding to the click or slide operation and is perceived by the human eye."
具体的,用户操作响应延迟越长,跟手性能越差;用户操作响应延迟越短,跟手性能越好。其中,电子设备的跟手性能越好,用户通过点击或滑动操作控制电子设备的使用体验越好,感觉越流畅。Specifically, the longer the user operation response delay, the worse the follow-up performance; the shorter the user operation response delay, the better the follow-up performance. Among them, the better the tracking performance of the electronic device, the better the user experience of controlling the electronic device through clicking or sliding operations, and the smoother it feels.
基于此,本申请实施例提供一种屏幕刷新率切换方法,该方法可以应用于电子设备,该电子设备包括显示屏。该方法包括:电子设备的SurfaceFlinger接收来自上层(如电子设备的帧率控制模块)的第一刷新率切换指令。该第一刷新率切换指令用于指示显示屏的屏幕刷新率由第一刷新率切换为第二刷新率。其中,第一刷新率小于或等于预设阈值,第二刷新率大于预设阈值。SurfaceFlinger响应于当前的第一Vsync信号的信号周期结束,向电子设备的显示驱动发送第一刷新率切换指令。其中,第一Vsync信号用于触发SurfaceFlinger进行图层合成。第一Vsync信号的信号周期在显示屏的屏幕刷新率为第一刷新率的情况下,被设置为预设周期。该预设周期小于第一 刷新率的倒数。显示驱动响应于第一刷新率切换指令,将显示屏的屏幕刷新率由第一刷新率切换为第二刷新率。Based on this, embodiments of the present application provide a screen refresh rate switching method, which can be applied to electronic devices, where the electronic devices include a display screen. The method includes: the SurfaceFlinger of the electronic device receives a first refresh rate switching instruction from an upper layer (such as a frame rate control module of the electronic device). The first refresh rate switching instruction is used to instruct the screen refresh rate of the display screen to switch from the first refresh rate to the second refresh rate. Wherein, the first refresh rate is less than or equal to the preset threshold, and the second refresh rate is greater than the preset threshold. SurfaceFlinger sends a first refresh rate switching instruction to the display driver of the electronic device in response to the end of the signal period of the current first Vsync signal. Among them, the first Vsync signal is used to trigger SurfaceFlinger for layer synthesis. The signal period of the first Vsync signal is set to a preset period when the screen refresh rate of the display screen is the first refresh rate. The preset period is less than the first The reciprocal of the refresh rate. In response to the first refresh rate switching instruction, the display driver switches the screen refresh rate of the display screen from the first refresh rate to the second refresh rate.
应理解,上述第一刷新率小于或等于预设阈值,为低刷新率。上述第二刷新率大于预设阈值,为高刷新率。It should be understood that the above-mentioned first refresh rate is less than or equal to the preset threshold, which is a low refresh rate. The above second refresh rate is greater than the preset threshold, which is a high refresh rate.
示例性地,本申请上述实施例提供的技术方案可以应用于以下场景:Illustratively, the technical solutions provided by the above embodiments of this application can be applied to the following scenarios:
在第一种应用场景下,电子设备的显示屏显示静态图像,显示屏的屏幕刷新率为低刷新率,而此时用户进行点击操作。电子设备响应于用户的点击操作,需要更新显示屏的显示画面,显示屏的屏幕刷新率由第一刷新率切换为第二刷新率。In the first application scenario, the display screen of the electronic device displays a static image, the screen refresh rate of the display screen is low, and the user performs a click operation at this time. In response to the user's click operation, the electronic device needs to update the display screen of the display screen, and the screen refresh rate of the display screen switches from the first refresh rate to the second refresh rate.
在第二种应用场景下,电子设备的显示屏显示静态图像,显示屏的屏幕刷新率为低刷新率,而此时用户进行滑动操作。电子设备响应于用户的滑动操作,需要更新显示屏的显示画面,显示屏的屏幕刷新率由第一刷新率切换为第二刷新率。In the second application scenario, the display screen of the electronic device displays a static image, the screen refresh rate of the display screen is low, and the user performs a sliding operation at this time. In response to the user's sliding operation, the electronic device needs to update the display screen of the display screen, and the screen refresh rate of the display screen switches from the first refresh rate to the second refresh rate.
在第三种应用场景下,电子设备的显示屏显示静态图像,显示屏的屏幕刷新率为低刷新率,而此时电子设备接收到消息通知,显示屏需要显示弹窗。即需要更新显示屏的显示画面,显示屏的屏幕刷新率由第一刷新率切换为第二刷新率。In the third application scenario, the display screen of the electronic device displays a static image, and the screen refresh rate of the display screen is a low refresh rate. At this time, the electronic device receives a message notification and the display screen needs to display a pop-up window. That is, it is necessary to update the display screen of the display screen and switch the screen refresh rate of the display screen from the first refresh rate to the second refresh rate.
在第四种应用场景下,电子设备的显示屏显示静态图像,显示屏的屏幕刷新率为低刷新率,而此时显示屏需要显示动画。即需要更新显示屏的显示画面,显示屏的屏幕刷新率由第一刷新率切换为第二刷新率。In the fourth application scenario, the display screen of the electronic device displays a static image, and the screen refresh rate of the display screen is a low refresh rate, and at this time the display screen needs to display animation. That is, it is necessary to update the display screen of the display screen and switch the screen refresh rate of the display screen from the first refresh rate to the second refresh rate.
在上述应用场景及类似场景下,采用本申请上述实施例提供的屏幕刷新率切换方法,由于在电子设备的显示屏显示静态图像时,显示屏的屏幕刷新率为低刷新率时,第一Vsync信号的信号周期被设置为预设周期,SurfaceFlinger按照预设周期运行。这样,在需要将显示屏的屏幕刷新率从低刷新率切换回高刷新率时,SurfaceFlinger可以及时下发第一刷新率切换指令,显示屏也可以及时接收第一刷新率切换指令,并及时响应该第一刷新率切换指令,进行屏幕刷新率切换,因此可以使显示屏快速退出低刷新率,切换回高刷新率,减少了显示屏的屏幕刷新率的切换时间,以保证新的图像帧按高刷新率进行显示,可以保证显示屏滑动效果、动画动效显示流畅等效果,保证用户不会感觉到卡顿,保证用户体验。通过本申请实施例的方法,可以提升电子设备响应用户操作,从低刷新率切换回高刷新率的速度,优化切换性能。从而可以缩短电子设备的用户操作响应延迟,提升电子设备的跟手性能,提升用户体验。In the above application scenarios and similar scenarios, using the screen refresh rate switching method provided by the above embodiments of the present application, when the display screen of the electronic device displays a static image and the screen refresh rate of the display screen is low, the first Vsync The signal period of the signal is set to the preset period, and SurfaceFlinger runs according to the preset period. In this way, when it is necessary to switch the screen refresh rate of the display screen from a low refresh rate back to a high refresh rate, SurfaceFlinger can issue the first refresh rate switching command in time, and the display screen can also receive the first refresh rate switching command in time and respond in time. The first refresh rate switching command should be used to switch the screen refresh rate, so that the display can quickly exit the low refresh rate and switch back to the high refresh rate, reducing the screen refresh rate switching time of the display to ensure that the new image frame is pressed Displaying with a high refresh rate can ensure the sliding effect of the display and the smooth display of animation effects, ensuring that users will not feel stuck and ensuring the user experience. Through the methods of the embodiments of the present application, the speed with which the electronic device responds to user operations and switches from a low refresh rate back to a high refresh rate can be improved, and the switching performance can be optimized. This can shorten the user operation response delay of the electronic device, improve the tracking performance of the electronic device, and enhance the user experience.
电子设备的显示屏在由低刷新率切换回高刷新率之前,是经过了屏幕刷新率切换为低刷新率的阶段。本申请实施例提供的技术方案,可以在显示屏的屏幕刷新率切换为低刷新率的阶段时,就提前做一些准备工作(如在低刷新率下,控制SurfaceFlinger将其信号周期设置为预设周期),以方便电子设备由低刷新率切换到高刷新率时,可以执行本申请实施例的方法(如S601-S603),以解决相应的技术问题。Before the display screen of an electronic device switches from a low refresh rate back to a high refresh rate, it goes through a stage where the screen refresh rate switches to a low refresh rate. The technical solution provided by the embodiment of the present application can make some preparations in advance when the screen refresh rate of the display screen switches to a low refresh rate stage (such as controlling SurfaceFlinger to set its signal period to a preset value at a low refresh rate). cycle), to facilitate the electronic device to switch from a low refresh rate to a high refresh rate, the method (such as S601-S603) in the embodiment of the present application can be executed to solve the corresponding technical problem.
具体地,参见图4,本申请实施例针对屏幕刷新率切换为低刷新率的场景,提供一种屏幕刷新率切换方法。该方法可以应用于电子设备,该电子设备包括显示屏。该方法包括步骤S401-S405。Specifically, referring to FIG. 4 , embodiments of the present application provide a screen refresh rate switching method for the scenario where the screen refresh rate is switched to a low refresh rate. The method can be applied to electronic devices including display screens. The method includes steps S401-S405.
S401、显示屏接收第二刷新率切换指令。该第二刷新率切换指令用于指示显示屏的屏幕刷新率切换为第一刷新率。其中,第一刷新率小于或等于预设阈值。S401. The display screen receives the second refresh rate switching instruction. The second refresh rate switching instruction is used to instruct the screen refresh rate of the display screen to switch to the first refresh rate. Wherein, the first refresh rate is less than or equal to the preset threshold.
示例性地,在一些场景下,电子设备的显示屏幕刷新率可以从高刷新率切换到低 刷新率。如,由电子设备的刷新率可以由高于第一刷新率的其他刷新率(如第三刷新率)切换为第一刷新率。如,在电子设备由显示动态图像切换为显示静态图像后,显示屏的屏幕刷新率则可以从高刷新率切换到低刷新率,以降低功耗。For example, in some scenarios, the display screen refresh rate of the electronic device can be switched from a high refresh rate to a low refresh rate. refresh rate. For example, the refresh rate of the electronic device can be switched from another refresh rate (such as a third refresh rate) higher than the first refresh rate to the first refresh rate. For example, after the electronic device switches from displaying dynamic images to displaying static images, the screen refresh rate of the display screen can be switched from a high refresh rate to a low refresh rate to reduce power consumption.
例如,如果电子设备在一定时长内,没有接收到用户的操作,该电子设备则可以自动显示上述静态图像。此时,上层可以向电子设备的显示屏发送第二刷新率切换指令,以指示显示屏的屏幕刷新率从第三刷新率切换到第一刷新率。此时,显示屏可以接收到上述第二刷新率切换指令。For example, if the electronic device does not receive the user's operation within a certain period of time, the electronic device can automatically display the above static image. At this time, the upper layer can send a second refresh rate switching instruction to the display screen of the electronic device to instruct the screen refresh rate of the display screen to switch from the third refresh rate to the first refresh rate. At this time, the display screen can receive the above-mentioned second refresh rate switching instruction.
又例如,电子设备播放完动态图像(如视频)后,可以自动显示静态图像。此时,上层可以向电子设备的显示屏发送第二刷新率切换指令,以指示显示屏的屏幕刷新率从第三刷新率切换到第一刷新率。显示屏可以接收到上述第二刷新率切换指令。For another example, after the electronic device finishes playing the dynamic image (such as a video), it can automatically display the static image. At this time, the upper layer can send a second refresh rate switching instruction to the display screen of the electronic device to instruct the screen refresh rate of the display screen to switch from the third refresh rate to the first refresh rate. The display screen can receive the above-mentioned second refresh rate switching instruction.
当然,显示屏的屏幕刷新率从高刷新率切换到低刷新率的场景包括但不限于上述示例中示出的情况,其他的情况本申请实施例这里不予赘述。Of course, the scenario in which the screen refresh rate of the display screen switches from a high refresh rate to a low refresh rate includes but is not limited to the situation shown in the above example, and other situations will not be described in detail here in the embodiment of the present application.
S402、显示屏响应于第二刷新率切换指令,将显示屏的屏幕刷新率切换为预设刷新率,按照预设周期,通过显示驱动向SurfaceFlinger发送第二Vsync信号。其中,预设周期等于预设刷新率的倒数,预设刷新率大于预设阈值。第二Vsync信号用于触发显示屏刷新显示图像帧。S402. The display screen responds to the second refresh rate switching instruction, switches the screen refresh rate of the display screen to the preset refresh rate, and sends the second Vsync signal to SurfaceFlinger through the display driver according to the preset cycle. Wherein, the preset period is equal to the reciprocal of the preset refresh rate, and the preset refresh rate is greater than the preset threshold. The second Vsync signal is used to trigger the display screen to refresh the display image frame.
S403、SurfaceFlinger接收来自显示驱动的第二Vsync信号。S403. SurfaceFlinger receives the second Vsync signal from the display driver.
S404、SurfaceFlinger判断从显示驱动接收第二Vsync信号的周期(即第二信号周期)是否等于预设周期。S404: SurfaceFlinger determines whether the period of receiving the second Vsync signal from the display driver (ie, the second signal period) is equal to the preset period.
若从显示驱动接收第二Vsync信号的周期(即第二信号周期)等于预设周期,则执行步骤S404。若从显示驱动接收第二Vsync信号的周期(即第二信号周期)不等于预设周期,则继续执行步骤403。If the period of receiving the second Vsync signal from the display driver (ie, the second signal period) is equal to the preset period, step S404 is performed. If the period of receiving the second Vsync signal from the display driver (ie, the second signal period) is not equal to the preset period, step 403 is continued.
S405、SurfaceFlinger将第一Vsync信号的信号周期设置为预设周期,并停止接收来自显示驱动的第二Vsync信号。其中,第一Vsync信号用于触发SurfaceFlinger进行图层合成。S405. SurfaceFlinger sets the signal period of the first Vsync signal to the preset period, and stops receiving the second Vsync signal from the display driver. Among them, the first Vsync signal is used to trigger SurfaceFlinger for layer synthesis.
也就是说,显示屏接收到该第二刷新率切换指令,可以响应于该第二刷新率切换指令,在将显示屏的屏幕刷新率切换为低刷新率之前,先将显示屏的屏幕刷新率切换为预设刷新率。这样,显示屏可以按照预设周期,向SurfaceFlinger发送第二Vsync信号(即每隔一个预设周期,通过显示驱动上报一个第二Vsync信号给SurfaceFlinger)。该第二Vsync信号可以用于SurfaceFlinger进行Vsync信号校准,用于实现第一Vsync信号与第二Vsync信号保持周期同步。SurfaceFlinger完成Vsync信号校准后,可以按照预设周期运行,即第一Vsync信号的信号周期为预设周期。这样,在后续接收到新的刷新率切换指令(如第一刷新率切换指令)时,能够及时将刷新率切换指令下发。That is to say, after the display screen receives the second refresh rate switching instruction, in response to the second refresh rate switching instruction, before switching the screen refresh rate of the display screen to a low refresh rate, the display screen first changes the screen refresh rate of the display screen to a low refresh rate. Switch to default refresh rate. In this way, the display screen can send the second Vsync signal to SurfaceFlinger according to the preset period (that is, every preset period, a second Vsync signal is reported to SurfaceFlinger through the display driver). The second Vsync signal can be used by SurfaceFlinger to perform Vsync signal calibration to achieve cycle synchronization between the first Vsync signal and the second Vsync signal. After SurfaceFlinger completes the Vsync signal calibration, it can run according to the preset period, that is, the signal period of the first Vsync signal is the preset period. In this way, when a new refresh rate switching instruction (such as a first refresh rate switching instruction) is subsequently received, the refresh rate switching instruction can be issued in a timely manner.
在一些实施例中,显示屏响应于所述第二刷新率切换指令,在预设时长后将显示屏的屏幕刷新率切换为所述第一刷新率。In some embodiments, the display screen responds to the second refresh rate switching instruction and switches the screen refresh rate of the display screen to the first refresh rate after a preset period of time.
应理解,显示屏响应于第二刷新率切换指令,在预设时长后,SurfaceFlinger已经完成了Vsync信号校准,此时可以将显示屏的屏幕刷新率切换为第一刷新率,即减小显示屏刷新显示图像帧的频率,以节省电能和CPU资源。而SurfaceFlinger这时候 已经关闭Vsync信号校准,SurfaceFlinger继续按照预设周期运行。需要说明的是,SurfaceFlinger虽然按照预设周期运行,但是如果是显示静态图像,显示屏需要显示内容是静态的,那么显示区域内的Surface内容没有更新,SurfaceFlinger也不需要进行合成操作。APP也不需要进行图层绘制和图层渲染操作。所以SurfaceFlinger按照预设周期运行,并不会增加图层合成操作的能耗。It should be understood that the display screen responds to the second refresh rate switching instruction. After a preset period of time, SurfaceFlinger has completed the Vsync signal calibration. At this time, the screen refresh rate of the display screen can be switched to the first refresh rate, that is, the screen refresh rate can be reduced. How often to refresh display image frames to save power and CPU resources. And SurfaceFlinger at this time Vsync signal calibration has been turned off, and SurfaceFlinger continues to run according to the preset cycle. It should be noted that although SurfaceFlinger runs according to the preset cycle, if it is to display a static image and the display screen needs to display static content, then the Surface content in the display area is not updated, and SurfaceFlinger does not need to perform a synthesis operation. The APP does not need to perform layer drawing and layer rendering operations. Therefore, SurfaceFlinger runs according to the preset cycle and does not increase the energy consumption of layer composition operations.
在一些实施例中,预设阈值可以是30Hz。该预设阈值可以根据电子设备对于显示屏的屏幕刷新率切换性能要求确定。In some embodiments, the preset threshold may be 30 Hz. The preset threshold can be determined based on the screen refresh rate switching performance requirements of the electronic device for the display screen.
在一些实施例中,预设刷新率是显示屏支持的一个屏幕刷新率。In some embodiments, the preset refresh rate is a screen refresh rate supported by the display screen.
在一些实施例中,预设刷新率可以是120Hz,预设刷新率的倒数即预设周期为8ms。第一刷新率可以是10Hz或1Hz,第一刷新率的倒数T1为100ms或1s。第二刷新率可以是60Hz、90Hz或120Hz,第二刷新率的倒数T2为16ms、11ms或8ms。In some embodiments, the preset refresh rate may be 120 Hz, and the reciprocal of the preset refresh rate, that is, the preset period is 8 ms. The first refresh rate may be 10Hz or 1Hz, and the reciprocal T1 of the first refresh rate is 100ms or 1s. The second refresh rate may be 60Hz, 90Hz or 120Hz, and the reciprocal T2 of the second refresh rate is 16ms, 11ms or 8ms.
应理解,上述步骤S401中的第二刷新率切换指令是由SurfaceFlinger下发至显示屏的。例如,电子设备(如电子设备的帧率控制模块)在判断显示内容没有更新时,可以通过SurfaceFlinger、HWC、显示驱动将第二刷新率切换指令依次下发至显示屏(如显示屏的显示驱动芯片)。It should be understood that the second refresh rate switching instruction in the above step S401 is issued to the display screen by SurfaceFlinger. For example, when the electronic device (such as the frame rate control module of the electronic device) determines that the display content has not been updated, it can sequentially send the second refresh rate switching instructions to the display screen (such as the display driver of the display screen) through SurfaceFlinger, HWC, and the display driver. chip).
在一些实施例中,SurfaceFlinger可以接收来自于上层的第二刷新率切换指令,并响应于第二刷新率切换指令,开始接收来自于下层的第二Vsync信号,并下发第二刷新率切换指令给显示屏。In some embodiments, SurfaceFlinger can receive the second refresh rate switching instruction from the upper layer, and in response to the second refresh rate switching instruction, start receiving the second Vsync signal from the lower layer, and issue the second refresh rate switching instruction. to the display.
也就是说,SurfaceFlinger可以在接收到第二刷新率切换指令后,即SurfaceFlinger在确定需要进行屏幕刷新率切换的时候,开始接收来自于下层的第二Vsync信号,即开启Vsync信号校准。这样,SurfaceFlinger可以根据接收第二Vsync信号的周期(也就是第二Vsync信号的信号周期)。判断是否完成了屏幕刷新率切换,进而完成Vsync信号校准,即调整SurfaceFlinger产生第一Vsync信号的周期(也就是第一Vsync信号的信号周期,该第一Vsync信号可以包括Vsync-APP信号和Vsync-SF信号),使第一Vsync信号的信号周期等于第二Vsync信号的信号周期。SurfaceFlinger完成Vsync信号校准后,可以关闭硬件Vsync校准,即停止接收来自显示驱动的第二Vsync信号。此时,SurfaceFlinger可以按照完成Vsync信号校准后的信号周期,周期性地生成第一Vsync信号,以控制APP进行绘制和渲染,以及SurfaceFlinger进行绘制的周期。这样,SurfaceFlinger可以确认显示屏的屏幕刷新率已经切换为预设刷新率,SurfaceFlinger按照预设周期运行,以与显示屏的屏幕刷新率同步。如果之后再接收到新的刷新率切换指令(如第一刷新率切换指令),SurfaceFlinger可以快速响应该新的刷新率切换指令,在当前的预设周期结束后就将该新的刷新率切换指令下发,由此可以让显示屏快速从低刷新率切换回高刷新率。In other words, SurfaceFlinger can start receiving the second Vsync signal from the lower layer after receiving the second refresh rate switching command, that is, when SurfaceFlinger determines that the screen refresh rate needs to be switched, Vsync signal calibration is turned on. In this way, SurfaceFlinger can receive the second Vsync signal according to the period (that is, the signal period of the second Vsync signal). Determine whether the screen refresh rate switching is completed, and then complete the Vsync signal calibration, that is, adjust the period during which SurfaceFlinger generates the first Vsync signal (that is, the signal period of the first Vsync signal. The first Vsync signal may include the Vsync-APP signal and the Vsync- SF signal), making the signal period of the first Vsync signal equal to the signal period of the second Vsync signal. After SurfaceFlinger completes the Vsync signal calibration, you can turn off the hardware Vsync calibration, that is, stop receiving the second Vsync signal from the display driver. At this time, SurfaceFlinger can periodically generate the first Vsync signal according to the signal cycle after Vsync signal calibration is completed to control the drawing and rendering cycle of the APP and the drawing cycle of SurfaceFlinger. In this way, SurfaceFlinger can confirm that the screen refresh rate of the display has been switched to the preset refresh rate, and SurfaceFlinger runs according to the preset cycle to synchronize with the screen refresh rate of the display. If a new refresh rate switching command is received later (such as the first refresh rate switching command), SurfaceFlinger can quickly respond to the new refresh rate switching command and issue the new refresh rate switching command after the current preset cycle. This allows the display to quickly switch from a low refresh rate back to a high refresh rate.
示例性地,在一应用场景下,在电子设备由显示动态图像切换为显示静态图像后,该显示屏的屏幕刷新率需要从60Hz切换到10Hz。参见图5,如图5所示,该屏幕刷新率切换过程可以采用上述实施例提供的屏幕刷新率切换方法(如步骤S401-S405),对应的电子设备各部分之间的信号传输流程可以包括S501-S507。For example, in an application scenario, after the electronic device switches from displaying dynamic images to displaying static images, the screen refresh rate of the display screen needs to be switched from 60 Hz to 10 Hz. Referring to Figure 5, as shown in Figure 5, the screen refresh rate switching process can adopt the screen refresh rate switching method provided in the above embodiment (such as steps S401-S405), and the corresponding signal transmission process between various parts of the electronic device can include S501-S507.
S501、SurfaceFlinger在第i个信号周期内,接收来自于上层(如帧率控制模块)的第二刷新率切换指令。该第二刷新率切换指令用于指示显示屏的屏幕刷新率从60Hz 切换到10Hz。S501. SurfaceFlinger receives the second refresh rate switching instruction from the upper layer (such as the frame rate control module) in the i-th signal period. The second refresh rate switching instruction is used to instruct the screen refresh rate of the display screen to change from 60Hz to 60Hz. Switch to 10Hz.
其中,信号周期是指第一Vsync信号的信号周期。在本实施例中该信号周期为16ms。The signal period refers to the signal period of the first Vsync signal. In this embodiment, the signal period is 16ms.
S502、SurfaceFlinger响应于第i个信号周期结束(即第i+1个信号周期开始),下发该第二刷新率切换指令给显示驱动,并开启Vsync信号校准。S502. SurfaceFlinger responds to the end of the i-th signal period (that is, the start of the i+1-th signal period), sends the second refresh rate switching instruction to the display driver, and turns on Vsync signal calibration.
例如,SurfaceFlinger响应于第i个信号周期结束,通过HWC下发该第二刷新率切换指令给显示驱动。For example, in response to the end of the i-th signal period, SurfaceFlinger issues the second refresh rate switching instruction to the display driver through the HWC.
S503、显示驱动在收到第二刷新率切换指令后,下发该第二刷新率切换指令给显示屏(如显示屏的显示驱动芯片)。S503. After receiving the second refresh rate switching command, the display driver issues the second refresh rate switching command to the display screen (such as the display driver chip of the display screen).
S504、显示屏接收第二刷新率切换指令。S504. The display screen receives the second refresh rate switching instruction.
S505、显示屏根据第二刷新率切换指令,先将显示屏的屏幕刷新率切换为120Hz,按照8ms的周期进行图像帧的刷新显示,并且显示屏按照8ms的周期,周期性地发送第二Vsync信号给显示驱动(即每隔8ms向显示驱动上报一个第二Vsync信号)。S505. According to the second refresh rate switching instruction, the display screen first switches the screen refresh rate of the display screen to 120Hz, refreshes and displays the image frames according to the 8ms cycle, and the display screen periodically sends the second Vsync according to the 8ms cycle. The signal is sent to the display driver (that is, a second Vsync signal is reported to the display driver every 8ms).
S506、显示驱动周期性地接收来自于显示屏的第二Vsync信号,并向SurfaceFlinger上报接收到的第二Vsync信号。S506. The display driver periodically receives the second Vsync signal from the display screen, and reports the received second Vsync signal to SurfaceFlinger.
S507、SurfaceFlinger周期性地接收第二Vsync信号,根据接收到第二Vsync信号的周期(即接收到两个相邻的第二Vsync信号的间隔时间),判断第二Vsync信号的信号周期是否为8ms,若是则可以确定完成了屏幕刷新率切换,关闭Vsync信号校准。若第二Vsync信号的周期不等于8ms,则继续执行步骤507。S507. SurfaceFlinger periodically receives the second Vsync signal, and determines whether the signal period of the second Vsync signal is 8ms based on the period of receiving the second Vsync signal (that is, the interval between receiving two adjacent second Vsync signals). , if so, it can be determined that the screen refresh rate switching is completed and Vsync signal calibration is turned off. If the period of the second Vsync signal is not equal to 8ms, continue to step 507.
应理解,SurfaceFlinger确定完成了屏幕刷新率切换后,响应于当前的信号周期(16ms)结束,就可以按照Vsync信号校准后的信号周期,即8ms的信号周期,周期性地生成第一Vsync信号。也就是说,第一Vsync信号的信号周期调整为8ms。It should be understood that after SurfaceFlinger determines that the screen refresh rate switching is completed, in response to the end of the current signal period (16ms), it can periodically generate the first Vsync signal according to the calibrated signal period of the Vsync signal, that is, the 8ms signal period. That is to say, the signal period of the first Vsync signal is adjusted to 8ms.
应理解,显示屏响应于第二刷新率切换指令,在预设时长后将显示屏的屏幕刷新率切换为10Hz。It should be understood that the display screen responds to the second refresh rate switching instruction and switches the screen refresh rate of the display screen to 10 Hz after a preset period of time.
在一些应用场景下,显示屏的屏幕刷新率切换到低刷新率后,接收到用户操作(例如点击或滑动操作)或接收到通知等,显示屏的屏幕刷新率需要切换回高刷新率。参见图6,本申请实施例针对上述应用场景,提供一种屏幕刷新率切换方法。该方法可以应用于电子设备,该电子设备包括显示屏。该方法包括步骤S601-S603。In some application scenarios, after the screen refresh rate of the display screen is switched to a low refresh rate, the screen refresh rate of the display screen needs to be switched back to a high refresh rate when user operations (such as clicks or sliding operations) or notifications are received. Referring to Figure 6, an embodiment of the present application provides a screen refresh rate switching method for the above application scenarios. The method can be applied to electronic devices including display screens. The method includes steps S601-S603.
S601、电子设备的SurfaceFlinger接收来自上层的第一刷新率切换指令。该第一刷新率切换指令用于指示显示屏的屏幕刷新率由第一刷新率切换为第二刷新率。其中,第一刷新率小于或等于预设阈值,第二刷新率大于预设阈值。S601. The SurfaceFlinger of the electronic device receives the first refresh rate switching instruction from the upper layer. The first refresh rate switching instruction is used to instruct the screen refresh rate of the display screen to switch from the first refresh rate to the second refresh rate. Wherein, the first refresh rate is less than or equal to the preset threshold, and the second refresh rate is greater than the preset threshold.
S602、SurfaceFlinger响应于当前的第一Vsync信号的信号周期结束,向显示驱动发送第一刷新率切换指令。其中,第一Vsync信号用于触发SurfaceFlinger进行图层合成。第一Vsync信号的信号周期在显示屏的屏幕刷新率为第一刷新率的情况下,被设置为预设周期。该预设周期小于第一刷新率的倒数。S602. SurfaceFlinger sends a first refresh rate switching instruction to the display driver in response to the end of the signal period of the current first Vsync signal. Among them, the first Vsync signal is used to trigger SurfaceFlinger for layer synthesis. The signal period of the first Vsync signal is set to a preset period when the screen refresh rate of the display screen is the first refresh rate. The preset period is less than the reciprocal of the first refresh rate.
S603、显示驱动响应于第一刷新率切换指令,将显示屏的屏幕刷新率由第一刷新率切换为第二刷新率。S603. In response to the first refresh rate switching instruction, the display driver switches the screen refresh rate of the display screen from the first refresh rate to the second refresh rate.
应理解,若电子设备在第j个第一Vsync信号的信号周期内接收到用户操作(例如点击或滑动操作)或接收到通知等需要进行界面更新,电子设备(如电子设备的帧率控制模块)可以在感知到上述情况后,向SurfaceFlinger发送第一刷新率切换指令。 SurfaceFlinger可以通过HWC、显示驱动将第一刷新率切换指令依次下发至显示屏(如显示屏的显示驱动芯片),以指示将显示屏的屏幕刷新率从第一刷新率切换到第二刷新率。该第二刷新率大于第一刷新率。It should be understood that if the electronic device receives a user operation (such as a click or sliding operation) or receives a notification within the signal period of the j-th first Vsync signal and needs to perform an interface update, the electronic device (such as the frame rate control module of the electronic device) ) can send the first refresh rate switching instruction to SurfaceFlinger after sensing the above situation. SurfaceFlinger can sequentially send the first refresh rate switching instructions to the display screen (such as the display driver chip of the display screen) through HWC and display driver to instruct the screen refresh rate of the display screen to switch from the first refresh rate to the second refresh rate. . The second refresh rate is greater than the first refresh rate.
上述技术方案中,在电子设备的显示屏的屏幕刷新率为第一刷新率(低刷新率)的情况下,第一Vsync信号的信号周期被设置为预设周期。这样,在需要将显示屏的屏幕刷新率从第一刷新率(低刷新率)切换到第二刷新率(高刷新率)时,SurfaceFlinger可以当前的第一Vsync信号的信号周期(预设周期)结束就下发第一刷新率切换指令,由于预设周期小于第一刷新率的倒数,相对于Android系统的原生机制下SurfaceFlinger需要等到一个长度为第一刷新率的倒数的周期结束才能下发第一刷新率切换指令,SurfaceFlinger下发第一刷新率切换指令的及时性提高了,这样显示屏也可以及时接收第一刷新率切换指令,并及时响应该第一刷新率切换指令,进行屏幕刷新率切换,由此减少了显示屏的屏幕刷新率的切换时间,避免了卡顿,提升了电子设备的跟手性,提升了用户体验。In the above technical solution, when the screen refresh rate of the display screen of the electronic device is the first refresh rate (low refresh rate), the signal period of the first Vsync signal is set to the preset period. In this way, when it is necessary to switch the screen refresh rate of the display screen from the first refresh rate (low refresh rate) to the second refresh rate (high refresh rate), SurfaceFlinger can use the current signal period (preset period) of the first Vsync signal. At the end, the first refresh rate switching command is issued. Since the preset period is less than the reciprocal of the first refresh rate, compared to the native mechanism of the Android system, SurfaceFlinger needs to wait until the end of a cycle whose length is the reciprocal of the first refresh rate before it can issue the third refresh rate switching command. Once the refresh rate switching command is issued, the timeliness of SurfaceFlinger's issuance of the first refresh rate switching command is improved, so that the display screen can also receive the first refresh rate switching command in time and respond to the first refresh rate switching command in a timely manner to adjust the screen refresh rate. switching, thus reducing the switching time of the screen refresh rate of the display screen, avoiding lagging, improving the chirality of the electronic device, and improving the user experience.
在一些实施例中,在显示驱动响应于第一刷新率切换指令,将显示屏的屏幕刷新率由第一刷新率切换为第二刷新率之后,该方法还包括:显示驱动按照第一信号周期,向SurfaceFlinger发送第二Vsync信号,以向SurfaceFlinger指示显示屏的屏幕刷新率。其中,第二Vsync信号用于触发显示屏刷新显示图像帧,第一信号周期等于第二刷新率的倒数。In some embodiments, after the display driver switches the screen refresh rate of the display screen from the first refresh rate to the second refresh rate in response to the first refresh rate switching instruction, the method further includes: the display driver switches according to the first signal period. , sending a second Vsync signal to SurfaceFlinger to indicate the screen refresh rate of the display to SurfaceFlinger. The second Vsync signal is used to trigger the display screen to refresh the display image frame, and the first signal period is equal to the reciprocal of the second refresh rate.
也就是说,显示屏的屏幕刷新率由第一刷新率切换为第二刷新率之后,显示驱动按照第一信号周期(即第二刷新率的倒数),周期性地向SurfaceFlinger发送第二Vsync信号,用于SurfaceFlinger进行Vsync信号校准。这样,SurfaceFlinger可以根据接收到第二Vsync信号的周期,来确定显示屏的屏幕刷新率已经切换为了第二刷新率,SurfaceFlinger就可以按照第二刷新率的倒数,周期性地生成第一Vsync信号。由此,可以实现第一Vsync信号与第二Vsync信号保持周期同步。That is to say, after the screen refresh rate of the display screen is switched from the first refresh rate to the second refresh rate, the display driver periodically sends the second Vsync signal to SurfaceFlinger according to the first signal period (that is, the reciprocal of the second refresh rate). , used for SurfaceFlinger for Vsync signal calibration. In this way, SurfaceFlinger can determine that the screen refresh rate of the display screen has switched to the second refresh rate based on the period of receiving the second Vsync signal, and SurfaceFlinger can periodically generate the first Vsync signal according to the reciprocal of the second refresh rate. As a result, the first Vsync signal and the second Vsync signal can maintain periodic synchronization.
示例性地,在一应用场景下,显示屏的屏幕刷新率切换到10Hz后,接收到用户操作(例如点击或滑动操作),显示屏的屏幕刷新率需要从10Hz切换回60Hz。参见图7,如图7所示,该屏幕刷新率切换过程可以采用上述实施例提供的屏幕刷新率切换方法(如步骤S601-S603),对应的电子设备各部分之间的信号传输流程可以包括:For example, in an application scenario, after the screen refresh rate of the display screen is switched to 10 Hz, and a user operation (such as a click or sliding operation) is received, the screen refresh rate of the display screen needs to be switched back from 10 Hz to 60 Hz. Referring to Figure 7, as shown in Figure 7, the screen refresh rate switching process can adopt the screen refresh rate switching method provided in the above embodiment (such as steps S601-S603), and the corresponding signal transmission process between various parts of the electronic device can include :
S701、SurfaceFlinger在第j个信号周期内,即如图7所示的t3时刻,接收来自于上层(如电子设备的帧率控制模块)的第一刷新率切换指令。S701. SurfaceFlinger receives the first refresh rate switching instruction from the upper layer (such as the frame rate control module of the electronic device) in the j-th signal period, that is, at time t3 as shown in Figure 7.
其中,信号周期是指第一Vsync信号的信号周期。本实施例中,该信号周期为8ms。The signal period refers to the signal period of the first Vsync signal. In this embodiment, the signal period is 8ms.
S702、SurfaceFlinger响应于第j个信号周期结束(第j+1个信号周期开始),下发该第一刷新率切换指令给显示驱动(例如,通过HWC下发该第二刷新率切换指令给显示驱动),并开启Vsync信号校准。S702. SurfaceFlinger responds to the end of the j-th signal period (the start of the j+1-th signal period) and issues the first refresh rate switching instruction to the display driver (for example, sends the second refresh rate switching instruction to the display through HWC). driver), and turn on Vsync signal calibration.
S703、显示驱动在收到第一刷新率切换指令后,下发该第一刷新率切换指令给显示屏(如显示屏的显示驱动芯片)。S703. After receiving the first refresh rate switching command, the display driver issues the first refresh rate switching command to the display screen (such as the display driver chip of the display screen).
S704、显示屏接收第一刷新率切换指令。S704. The display screen receives the first refresh rate switching instruction.
S705、显示屏根据第一刷新率切换指令,驱动显示屏完成屏幕刷新率切换,即将显示屏的屏幕刷新率从第一刷新率切换为第二刷新率,按照第二刷新率进行图像帧的 刷新显示,并且显示屏按照第二刷新率,周期性地发送第二Vsync信号给显示驱动(每隔一个第一信号周期向显示驱动上报一个第二Vsync信号)。S705. The display screen drives the display screen to complete the screen refresh rate switching according to the first refresh rate switching instruction, that is, the screen refresh rate of the display screen is switched from the first refresh rate to the second refresh rate, and the image frame is updated according to the second refresh rate. The display is refreshed, and the display screen periodically sends a second Vsync signal to the display driver according to the second refresh rate (a second Vsync signal is reported to the display driver every other first signal period).
S706、显示驱动周期性地接收来自于显示屏的第二Vsync信号,并向SurfaceFlinger上报接收到的第二Vsync信号。S706. The display driver periodically receives the second Vsync signal from the display screen, and reports the received second Vsync signal to SurfaceFlinger.
S707、SurfaceFlinger周期性地接收第二Vsync信号,根据接收到第二Vsync信号的周期(即接收到两个相邻的第二Vsync信号的间隔时间),判断第二Vsync信号的信号周期是否为16ms,若是则可以确定完成了屏幕刷新率切换,关闭Vsync信号校准。若第二Vsync信号的周期不等于16ms,则继续执行步骤707。S707. SurfaceFlinger periodically receives the second Vsync signal, and determines whether the signal period of the second Vsync signal is 16ms based on the period of receiving the second Vsync signal (that is, the interval between receiving two adjacent second Vsync signals). , if so, it can be determined that the screen refresh rate switching is completed and Vsync signal calibration is turned off. If the period of the second Vsync signal is not equal to 16ms, continue to step 707.
应理解,SurfaceFlinger确定完成了屏幕刷新率切换后,可以响应于当前的信号周期(8ms)结束,即如图7所示的t4时刻,按照Vsync信号校准后的信号周期,即16ms,周期性地生成第一Vsync信号。也就是说,第一Vsync信号的信号周期调整为16ms。It should be understood that after SurfaceFlinger determines that the screen refresh rate switching is completed, it can respond to the end of the current signal period (8ms), that is, the t4 moment as shown in Figure 7, and periodically follow the calibrated signal period of the Vsync signal, which is 16ms. Generate the first Vsync signal. That is to say, the signal period of the first Vsync signal is adjusted to 16ms.
基于上述实施例提供的技术方案,在电子设备的显示屏显示静态图像,显示屏的屏幕刷新率为第一刷新率(低刷新率)时,对应的显示屏刷新显示图像帧的周期为第一刷新率的倒数T1,而SurfaceFlinger设置预设刷新率模式,按照预设刷新率(如120Hz)运行,即第一Vsync信号的信号周期为预设周期。该预设周期小于第一刷新率的倒数T1。这样,在需要将显示屏的屏幕刷新率由第一刷新率切换到第二刷新率(高刷新率)时,SurfaceFlinger在接收到第一刷新率切换指令之后,可以在当前的信号周期结束就下发第一刷新率切换指令,并启动Vsync信号校准。而且显示屏接收到该第一刷新率切换指令后,就可以立即将显示屏的屏幕刷新率从第一刷新率切换为第二刷新率,由此将第二Vsync信号的周期从第一刷新率的倒数T1切换为第二刷新率的倒数T2,每隔一个第二刷新率的倒数T2向显示驱动上报一个第二Vsync信号。SurfaceFlinger接收第二Vsync信号,根据接收到两个第二Vsync信号的间隔时间,判断第二Vsync信号的信号周期是否为,若是,则可以确认完成了屏幕刷新率切换。SurfaceFlinger可以在确认完成了屏幕刷新率切换,且当前的信号周期结束,就以第二刷新率为频率,以第二刷新率的倒数T2为周期,生成第一Vsync信号。相对于Android原生Vsync机制,大大优化了切换性能,提高了跟手性。Based on the technical solutions provided by the above embodiments, when the display screen of the electronic device displays a static image and the screen refresh rate of the display screen is the first refresh rate (low refresh rate), the corresponding display screen refreshes the display image frame at the first refresh rate. The reciprocal of the refresh rate T1, and SurfaceFlinger sets the preset refresh rate mode and runs according to the preset refresh rate (such as 120Hz), that is, the signal period of the first Vsync signal is the preset period. The preset period is smaller than the reciprocal T1 of the first refresh rate. In this way, when it is necessary to switch the screen refresh rate of the display screen from the first refresh rate to the second refresh rate (high refresh rate), SurfaceFlinger can download the screen at the end of the current signal cycle after receiving the first refresh rate switching command. Send the first refresh rate switching command and start Vsync signal calibration. Moreover, after the display screen receives the first refresh rate switching command, it can immediately switch the screen refresh rate of the display screen from the first refresh rate to the second refresh rate, thereby changing the period of the second Vsync signal from the first refresh rate to the second refresh rate. The reciprocal T1 is switched to the reciprocal T2 of the second refresh rate, and every other reciprocal T2 of the second refresh rate reports a second Vsync signal to the display driver. SurfaceFlinger receives the second Vsync signal, and determines whether the signal period of the second Vsync signal is based on the interval between receiving the two second Vsync signals. If so, it can be confirmed that the screen refresh rate switching is completed. SurfaceFlinger can generate the first Vsync signal at the frequency of the second refresh rate and the reciprocal T2 of the second refresh rate as the cycle after confirming that the screen refresh rate switching is completed and the current signal cycle is over. Compared with Android's native Vsync mechanism, the switching performance is greatly optimized and the chirality is improved.
示例性地,第一刷新率为10Hz,第一刷新率的倒数T1为100ms。第二刷新率为60Hz,第二刷新率的倒数T2为16ms。预设刷新率为120Hz,预设刷新率的倒数即预设周期为8ms。For example, the first refresh rate is 10 Hz, and the reciprocal T1 of the first refresh rate is 100 ms. The second refresh rate is 60Hz, and the reciprocal T2 of the second refresh rate is 16ms. The default refresh rate is 120Hz, and the reciprocal of the default refresh rate, that is, the default period is 8ms.
例如,第一种情况:SurfaceFlinger在第j个信号周期即将结束时收到第一刷新率切换指令,即图7中所示的t3时刻接近j个信号周期的结束时刻,x2≈0。SurfaceFlinger在第j+1个信号周期一开始就下发第一刷新率切换指令,显示屏在第j+1个信号周期内接收到该第一刷新率切换指令,将显示屏的屏幕刷新率从第一刷新率切换为第二刷新率,并每隔一个第二刷新率的倒数T2向显示驱动上报一个第二Vsync信号。SurfaceFlinger接收第二Vsync信号,根据接收到两个第二Vsync信号的间隔时间,判断第二Vsync信号的信号周期是否为第二刷新率的倒数T2,若是,则可以确认完成了屏幕刷新率切换,这时候已经是在第j+3个信号周期内。所以SurfaceFlinger需要在当前的信号周期(第j+3个信号周期)结束,才能以第二刷新 率为频率,以第二刷新率的倒数T2为周期,生成第一Vsync信号。第一种情况是整个屏幕刷新率切换过程需要消耗的时间最短的情况,从SurfaceFlinger接收到第一刷新率切换指令到显示屏的屏幕刷新率从第一刷新率切换为第二刷新率只需要经历不到一个信号周期(该信号周期为预设周期,即8ms)的时间,而从SurfaceFlinger接收到第一刷新率切换指令到SurfaceFlinger按新的刷新率生成第一Vsync信号(从t3时刻到t4时刻)只需要经历三个信号周期(该信号周期为预设周期,即8ms),共24ms的时间。For example, the first situation: SurfaceFlinger receives the first refresh rate switching instruction when the j-th signal period is about to end, that is, the t3 moment shown in Figure 7 is close to the end of the j-th signal period, x2≈0. SurfaceFlinger issues the first refresh rate switching command at the beginning of the j+1th signal cycle, and the display screen receives the first refresh rate switching command during the j+1th signal cycle, changing the screen refresh rate of the display screen from The first refresh rate is switched to the second refresh rate, and a second Vsync signal is reported to the display driver every other reciprocal T2 of the second refresh rate. SurfaceFlinger receives the second Vsync signal, and based on the interval between receiving the two second Vsync signals, determines whether the signal period of the second Vsync signal is the reciprocal T2 of the second refresh rate. If so, it can be confirmed that the screen refresh rate switching is completed. At this time, it is already within the j+3 signal period. Therefore, SurfaceFlinger needs to end in the current signal period (j+3 signal period) before it can refresh with the second is the frequency, and the first Vsync signal is generated with the reciprocal T2 of the second refresh rate as the period. The first situation is the situation where the entire screen refresh rate switching process takes the shortest time. From the time SurfaceFlinger receives the first refresh rate switching instruction to the display screen's screen refresh rate switching from the first refresh rate to the second refresh rate, it only takes It takes less than one signal period (the signal period is the preset period, that is, 8ms), and from when SurfaceFlinger receives the first refresh rate switching instruction to when SurfaceFlinger generates the first Vsync signal at the new refresh rate (from t3 to t4 ) only needs to go through three signal periods (the signal period is the preset period, that is, 8ms), a total of 24ms.
再例如,第二种情况:SurfaceFlinger在第j个信号周期刚开始就收到第一刷新率切换指令,即图7中所示的t3时刻接近j个信号周期的开始时刻,x2≈8。但SurfaceFlinger需要等到当前的信号周期结束,在第j+1个信号周期开始时才下发第一刷新率切换指令,显示屏在第j+1个信号周期内接收到该第一刷新率切换指令,将显示屏的屏幕刷新率从第一刷新率切换为第二刷新率,并每隔一个第二刷新率的倒数T2向显示驱动上报一个第二Vsync信号。SurfaceFlinger接收第二Vsync信号,判断第二Vsync信号的周期为第二刷新率的倒数T2时,可以确认完成了屏幕刷新率切换,这时候已经是在第j+3个信号周期内。所以SurfaceFlinger需要在当前的信号周期(第j+3个信号周期)结束,才能以第二刷新率为频率,以第二刷新率的倒数T2为周期,生成第一Vsync信号。第二种情况是整个屏幕刷新率切换过程需要消耗的时间最长的情况,但从SurfaceFlinger接收到第一刷新率切换指令到显示屏的屏幕刷新率从第一刷新率切换为第二刷新率只需要经历不到两个信号周期(该信号周期为预设周期,即8ms,两个信号周期即16ms)的时间,而从SurfaceFlinger接收到第一刷新率切换指令到SurfaceFlinger按新的刷新率生成第一Vsync信号(从t3时刻到t4时刻)只需要经历四个信号周期(该信号周期为预设周期),共32ms的时间。For another example, the second case: SurfaceFlinger receives the first refresh rate switching command at the beginning of the j-th signal period, that is, the t3 moment shown in Figure 7 is close to the beginning of the j-th signal period, x2≈8. However, SurfaceFlinger needs to wait until the end of the current signal cycle and issue the first refresh rate switching command at the beginning of the j+1th signal cycle. The display screen receives the first refresh rate switching command within the j+1th signal cycle. , switching the screen refresh rate of the display screen from the first refresh rate to the second refresh rate, and reporting a second Vsync signal to the display driver every other reciprocal T2 of the second refresh rate. When SurfaceFlinger receives the second Vsync signal and determines that the period of the second Vsync signal is T2, the reciprocal of the second refresh rate, it can confirm that the screen refresh rate switching is completed, which is already within the j+3 signal period. Therefore, SurfaceFlinger needs to end at the current signal period (j+3 signal period) in order to generate the first Vsync signal at the second refresh rate frequency and the reciprocal T2 of the second refresh rate as the period. The second case is the one where the entire screen refresh rate switching process takes the longest time, but it only takes a few seconds from SurfaceFlinger to receive the first refresh rate switching instruction to when the screen refresh rate of the display screen switches from the first refresh rate to the second refresh rate. It takes less than two signal periods (the signal period is the preset period, that is, 8ms, and the two signal periods are 16ms), and from the time when SurfaceFlinger receives the first refresh rate switching command to when SurfaceFlinger generates the second refresh rate at the new refresh rate. A Vsync signal (from time t3 to time t4) only needs to experience four signal periods (the signal period is the preset period), a total of 32ms.
综上所述,在设置预设刷新率为120Hz的情况下,本申请实施例提供的技术方案相对于Android系统原生机制下的屏幕刷新率切换流程,优化切换耗时的效果如表1所示。To sum up, when the preset refresh rate is set to 120Hz, the technical solution provided by the embodiment of the present application is compared with the screen refresh rate switching process under the native mechanism of the Android system. The effect of optimizing the switching time is as shown in Table 1. .
表1
Table 1
在一些实施例中,第一刷新率为显示屏显示静态图像时的目标刷新率。In some embodiments, the first refresh rate is a target refresh rate when the display screen displays a static image.
在一些实施例中,第一刷新率切换指令是电子设备在显示静态图像的情况下,接收到通知或用户操作后触发的。其中,通知或用户操作用于触发电子设备更新界面。In some embodiments, the first refresh rate switching instruction is triggered after the electronic device receives a notification or user operation when displaying a static image. Among them, notifications or user operations are used to trigger the electronic device to update the interface.
也就是说,电子设备在显示静态图像的情况下,若接收到通知或用户操作后,可以触发第一刷新率切换指令,从而控制显示屏的屏幕刷新率从第一刷新率(低刷新率)切换到第二刷新率(高刷新率)。 That is to say, when the electronic device displays a static image, if it receives a notification or user operation, it can trigger the first refresh rate switching instruction, thereby controlling the screen refresh rate of the display screen from the first refresh rate (low refresh rate) Switch to the second refresh rate (high refresh rate).
在一些实施例中,第二刷新率切换指令是电子设备由显示动态图像切换为显示静态图像时触发的。In some embodiments, the second refresh rate switching instruction is triggered when the electronic device switches from displaying dynamic images to displaying static images.
也就是说,电子设备由显示动态图像切换为显示静态图像时,可以触发第二刷新率切换指令,以控制显示屏的屏幕刷新率切换到第一刷新率(低刷新率),以降低功耗。That is to say, when the electronic device switches from displaying dynamic images to displaying static images, it can trigger the second refresh rate switching instruction to control the screen refresh rate of the display screen to switch to the first refresh rate (low refresh rate) to reduce power consumption. .
参见图8A,如图8A所示,在一些实施例中,本申请实施例提供的屏幕刷新率切换方法,在上述步骤S601之前,还可以包括步骤S401-S405。Referring to Figure 8A, as shown in Figure 8A, in some embodiments, the screen refresh rate switching method provided by the embodiment of the present application may also include steps S401-S405 before the above step S601.
也就是说,可以采用本申请实施例提供的屏幕刷新率切换方法,将显示屏的屏幕刷新率可以从某一刷新率(如第三刷新率)切换为低刷新率,再从低刷新率切换到高刷新率。That is to say, the screen refresh rate switching method provided by the embodiment of the present application can be used to switch the screen refresh rate of the display screen from a certain refresh rate (such as the third refresh rate) to a low refresh rate, and then switch from the low refresh rate to a low refresh rate. to high refresh rates.
示例性地,在显示屏的屏幕刷新率为第三刷新率的情况下,响应于电子设备由显示动态图像切换为显示静态图像,显示屏的屏幕刷新率由第三刷新率切换至第一刷新率,并设置第一Vsync信号的信号周期为预设周期。其中,第三刷新率大于第一刷新率,且第一刷新率小于或等于预设阈值,预设周期小于第一刷新率的倒数。具体实现过程可以参见上述步骤S401-S405,在此不予赘述。应理解,相应地,步骤S401中第二刷新率切换指令用于指示显示屏的屏幕刷新率从第三刷新率切换到第一刷新率。上述第三刷新率可以等于第二刷新率。之后,响应于电子设备由显示静态图像切换为显示动态图像,电子设备的SurfaceFlinger可以接收到第一刷新率切换指令。该第一刷新率切换指令用于指示显示屏的屏幕刷新率由第一刷新率切换为第二刷新率。该第二刷新率大于预设阈值。响应于当前的第一Vsync信号的信号周期结束,SurfaceFlinger向电子设备的显示驱动发送第一刷新率切换指令。其中,第一Vsync信号用于触发SurfaceFlinger进行图层合成。显示驱动响应于第一刷新率切换指令,将显示屏的屏幕刷新率由第一刷新率切换为第二刷新率。具体实现过程可以参见上述步骤S601-S603,在此不予赘述。For example, when the screen refresh rate of the display screen is the third refresh rate, in response to the electronic device switching from displaying dynamic images to displaying static images, the screen refresh rate of the display screen is switched from the third refresh rate to the first refresh rate. rate, and set the signal period of the first Vsync signal to the preset period. Wherein, the third refresh rate is greater than the first refresh rate, and the first refresh rate is less than or equal to the preset threshold, and the preset period is less than the reciprocal of the first refresh rate. For the specific implementation process, please refer to the above-mentioned steps S401-S405, which will not be described again here. It should be understood that, accordingly, the second refresh rate switching instruction in step S401 is used to instruct the screen refresh rate of the display screen to switch from the third refresh rate to the first refresh rate. The above-mentioned third refresh rate may be equal to the second refresh rate. Afterwards, in response to the electronic device switching from displaying static images to displaying dynamic images, the SurfaceFlinger of the electronic device may receive a first refresh rate switching instruction. The first refresh rate switching instruction is used to instruct the screen refresh rate of the display screen to switch from the first refresh rate to the second refresh rate. The second refresh rate is greater than the preset threshold. In response to the current signal period of the first Vsync signal ending, SurfaceFlinger sends a first refresh rate switching instruction to the display driver of the electronic device. Among them, the first Vsync signal is used to trigger SurfaceFlinger for layer synthesis. In response to the first refresh rate switching instruction, the display driver switches the screen refresh rate of the display screen from the first refresh rate to the second refresh rate. For the specific implementation process, please refer to the above-mentioned steps S601-S603, which will not be described again here.
示例性地,参见图8B,图8B示出了上述实施例提供的屏幕刷新率切换方法中步骤S401-S405,以及步骤S601-S603对应的信号传输流程。图8B左边所示为将显示屏的屏幕刷新率从高刷新率(如60Hz,对应的信号周期为16ms)切换至低刷新率(如10Hz,对应的信号周期为100ms)对应的信号传输流程,具体步骤为S801-S807,该步骤S801-S807的具体执行过程参见上述步骤S501-S507,在此不进行赘述。图8B右边所示为将显示屏的屏幕刷新率从低刷新率(如10Hz,对应的信号周期为100ms)切换至高刷新率(如60Hz,对应的信号周期为16ms)对应的信号传输流程,具体步骤为S811-S817,该步骤S811-S817的具体执行过程参见上述步骤S701-S707,在此不进行赘述。Exemplarily, see FIG. 8B , which shows the signal transmission process corresponding to steps S401-S405 and steps S601-S603 in the screen refresh rate switching method provided by the above embodiment. The left side of Figure 8B shows the signal transmission process corresponding to switching the screen refresh rate of the display screen from a high refresh rate (such as 60Hz, the corresponding signal period is 16ms) to a low refresh rate (such as 10Hz, the corresponding signal period is 100ms). The specific steps are S801-S807. For the specific execution process of steps S801-S807, please refer to the above-mentioned steps S501-S507, which will not be described again here. The right side of Figure 8B shows the signal transmission process corresponding to switching the screen refresh rate of the display screen from a low refresh rate (such as 10Hz, the corresponding signal period is 100ms) to a high refresh rate (such as 60Hz, the corresponding signal period is 16ms), specifically The steps are S811-S817. For the specific execution process of steps S811-S817, please refer to the above-mentioned steps S701-S707, which will not be described again here.
应理解,上述步骤S402中,显示屏接收第二刷新率切换指令,并响应于第二刷新率切换指令,将显示屏的屏幕刷新率切换为预设刷新率,按照预设周期向SurfaceFlinger发送第二Vsync信号,以便SurfaceFlinger完成Vsync信号校准,在步骤S405中将第一Vsync信号的周期设置为预设周期。在显示屏响应所述第二刷新率切换指令的预设时长后,显示屏的屏幕刷新率切换为第一刷新率(如10Hz),也就是图8B所示的延迟一定时间后,切换到100ms。这样,显示屏可以以低刷新率显示静 态图像,节省电能和CPU资源。It should be understood that in the above step S402, the display screen receives the second refresh rate switching instruction, and in response to the second refresh rate switching instruction, switches the screen refresh rate of the display screen to the preset refresh rate, and sends the third refresh rate to SurfaceFlinger according to the preset cycle. two Vsync signals so that SurfaceFlinger can complete the Vsync signal calibration. In step S405, the period of the first Vsync signal is set to the preset period. After the display screen responds to the second refresh rate switching instruction for a preset period of time, the screen refresh rate of the display screen switches to the first refresh rate (such as 10Hz), that is, after a certain delay as shown in Figure 8B, it switches to 100ms. . In this way, the display can display static images at a low refresh rate. status image, saving power and CPU resources.
应理解,在需要将显示屏的屏幕刷新率从一个高刷新率切换为另一个高刷新率的场景下,例如从90Hz切换为60Hz,或者从60Hz切换为90Hz的场景下,依然可以采用Android系统原生机制下的屏幕刷新率切换方法。It should be understood that in scenarios where the screen refresh rate of the display needs to be switched from one high refresh rate to another, such as switching from 90Hz to 60Hz, or from 60Hz to 90Hz, the Android system can still be used Screen refresh rate switching method under native mechanism.
在一些实施例中,显示驱动可以设置真实刷新率(第一刷新率,如10Hz或1Hz)模式(或称档位)和模拟刷新率模式。模拟刷新率模式对应一个模拟的刷新率和一个真实的刷新率,其中模拟的刷新率(即预设刷新率)为高刷新率(如120Hz),真实的刷新率为低刷新率(10Hz或1Hz)。显示驱动可以将其支持的刷新率模式通过HWC上报给SurfaceFlinger和/或帧率控制模块。SurfaceFlinger和/或帧率控制模块可以根据刷新率模式中的各刷新率的标识(id)属性,确定各刷新率为真实的刷新率还是模拟的刷新率。例如,帧率控制模块可以通过Display.getSupportedModes()查询显示驱动获取其所支持的刷新率模式,显示驱动可以响应该查询请求,并将其支持的刷新率模式通过HWC上报给帧率控制模块。In some embodiments, the display driver can set a real refresh rate (first refresh rate, such as 10Hz or 1Hz) mode (or gear) and a simulated refresh rate mode. The simulated refresh rate mode corresponds to a simulated refresh rate and a real refresh rate. The simulated refresh rate (ie, the preset refresh rate) is a high refresh rate (such as 120Hz), and the real refresh rate is a low refresh rate (10Hz or 1Hz). ). The display driver can report the refresh rate mode it supports to SurfaceFlinger and/or the frame rate control module through HWC. SurfaceFlinger and/or the frame rate control module can determine whether each refresh rate is a real refresh rate or a simulated refresh rate based on the identification (id) attribute of each refresh rate in the refresh rate mode. For example, the frame rate control module can query the display driver through Display.getSupportedModes() to obtain the refresh rate modes it supports. The display driver can respond to the query request and report the refresh rate modes it supports to the frame rate control module through HWC.
如图9所示,图9为本申请实施例提供的一种屏幕刷新率切换方法中各模块交互流程图。As shown in Figure 9, Figure 9 is a flow chart of interaction between modules in a screen refresh rate switching method provided by an embodiment of the present application.
示例性地,如图9中实线箭头所示的信号传输流程。显示驱动设置模拟刷新率模式(模拟120Hz模式),该模拟120Hz模式对应一个模拟的120Hz刷新率和一个真实的10Hz或1Hz刷新率。显示驱动可以将其支持模拟120Hz模式的信息通过HWC上报给SurfaceFlinger。For example, the signal transmission process is shown by the solid arrow in Figure 9 . The display driver sets the simulated refresh rate mode (simulated 120Hz mode), which corresponds to a simulated 120Hz refresh rate and a real 10Hz or 1Hz refresh rate. The display driver can report information that it supports simulated 120Hz mode to SurfaceFlinger through HWC.
示例性地,如图9中虚线箭头所示的信号传输流程,该信号传输流程对应上述的步骤S501-S505。在电子设备的帧率控制模块检测到电子设备由显示动态图像切换为显示静态图像后,其控制显示屏的屏幕刷新率切换到10Hz(或1Hz)。流程为:帧率控制模块向SurfaceFlinger发送显示屏的屏幕刷新率切换为模拟120Hz模式的指令(如第二刷新率切换指令)。SurfaceFlinger在收到帧率控制模块发送的第二刷新率切换指令后,可以通过HWC向显示驱动下发第二刷新率切换指令。应理解,显示驱动收到第二刷新率切换指令后,根据该指令中的刷新率的id属性,可以知道该第二刷新率切换指令中的模拟120Hz模式对应一个模拟的120Hz刷新率和一个真实的10Hz或1Hz刷新率。这样,显示驱动收到第二刷新率切换指令后,先将显示屏的屏幕刷新率切换为120Hz,以便SurfaceFlinger完成Vsync信号校准,即将第一Vsync信号的信号周期调整为8ms(即1/120ms)。显示驱动在预设时长后再将显示屏的屏幕刷新率切换为10Hz或1Hz,以节省电能和CPU资源。For example, the signal transmission process is shown by the dotted arrow in Figure 9, which corresponds to the above-mentioned steps S501-S505. After the frame rate control module of the electronic device detects that the electronic device switches from displaying dynamic images to displaying static images, it controls the screen refresh rate of the display screen to switch to 10 Hz (or 1 Hz). The process is: the frame rate control module sends an instruction to the SurfaceFlinger to switch the screen refresh rate of the display screen to the simulated 120Hz mode (such as the second refresh rate switching instruction). After receiving the second refresh rate switching command sent by the frame rate control module, SurfaceFlinger can send the second refresh rate switching command to the display driver through HWC. It should be understood that after the display driver receives the second refresh rate switching instruction, according to the id attribute of the refresh rate in the instruction, it can be known that the simulated 120Hz mode in the second refresh rate switching instruction corresponds to a simulated 120Hz refresh rate and a real 10Hz or 1Hz refresh rate. In this way, after the display driver receives the second refresh rate switching command, it first switches the screen refresh rate of the display to 120Hz so that SurfaceFlinger can complete the Vsync signal calibration, that is, adjust the signal period of the first Vsync signal to 8ms (i.e. 1/120ms) . The display driver switches the screen refresh rate of the display to 10Hz or 1Hz after a preset period of time to save power and CPU resources.
示例性地,如图9中点划线箭头所示的信号传输流程,该信号传输流程对应上述的步骤S701-S705。电子设备的帧率控制模块检测到当前显示场景为用户进行点击、滑动操作,或出现弹窗通知时,帧率控制模块向SurfaceFlinger发送切换显示屏的屏幕刷新率为60Hz、90Hz或120Hz的指令(如第一刷新率切换指令)。SurfaceFlinger在帧率控制模块发送的第一刷新率切换指令时,可以通过HWC向显示驱动下发第一刷新率切换指令。显示驱动收到第一刷新率切换指令后,将显示屏的屏幕刷新率切换为60Hz、90Hz或120Hz。For example, the signal transmission process is shown by the dash-dotted arrow in Figure 9 , which corresponds to the above-mentioned steps S701-S705. When the frame rate control module of the electronic device detects that the current display scene is a user clicking or sliding, or a pop-up notification appears, the frame rate control module sends an instruction to SurfaceFlinger to switch the screen refresh rate of the display to 60Hz, 90Hz or 120Hz ( Such as the first refresh rate switching instruction). When SurfaceFlinger sends the first refresh rate switching instruction from the frame rate control module, SurfaceFlinger can send the first refresh rate switching instruction to the display driver through HWC. After receiving the first refresh rate switching instruction, the display driver switches the screen refresh rate of the display screen to 60Hz, 90Hz or 120Hz.
本申请一些实施例提供了一种电子设备,该电子设备可以包括:显示屏、存储器 和一个或多个处理器。该显示屏、存储器和处理器耦合。该存储器用于存储计算机程序代码,该计算机程序代码包括计算机指令。当处理器执行计算机指令时,电子设备可执行上述方法实施例中电子设备执行的各个功能或者步骤。该电子设备的结构可以参考图2B所示的电子设备200的结构。Some embodiments of the present application provide an electronic device. The electronic device may include: a display screen, a memory and one or more processors. The display, memory and processor are coupled. The memory is used to store computer program code, which includes computer instructions. When the processor executes computer instructions, the electronic device may perform various functions or steps performed by the electronic device in the above method embodiments. The structure of the electronic device may refer to the structure of the electronic device 200 shown in FIG. 2B.
本申请实施例还提供一种芯片系统,如图10所示,该芯片系统包括至少一个处理器1001和至少一个接口电路1002。处理器1001和接口电路1002可通过线路互联。例如,接口电路1002可用于从其它装置(例如电子设备的存储器)接收信号。又例如,接口电路1002可用于向其它装置(例如处理器1001或者电子设备的触摸屏)发送信号。示例性的,接口电路1002可读取存储器中存储的指令,并将该指令发送给处理器1001。当所述指令被处理器1001执行时,可使得电子设备执行上述实施例中的各个步骤。当然,该芯片系统还可以包含其他分立器件,本申请实施例对此不作具体限定。An embodiment of the present application also provides a chip system. As shown in FIG. 10 , the chip system includes at least one processor 1001 and at least one interface circuit 1002 . The processor 1001 and the interface circuit 1002 may be interconnected by wires. For example, interface circuit 1002 may be used to receive signals from other devices, such as memory of an electronic device. As another example, the interface circuit 1002 may be used to send signals to other devices, such as the processor 1001 or a touch screen of an electronic device. For example, the interface circuit 1002 can read instructions stored in the memory and send the instructions to the processor 1001. When the instructions are executed by the processor 1001, the electronic device can be caused to perform various steps in the above embodiments. Of course, the chip system may also include other discrete devices, which are not specifically limited in the embodiments of this application.
本申请实施例还提供一种计算机存储介质,该计算机存储介质包括计算机指令,当所述计算机指令在上述电子设备上运行时,使得该电子设备执行上述方法实施例中电子设备执行的各个功能或者步骤。Embodiments of the present application also provide a computer storage medium. The computer storage medium includes computer instructions. When the computer instructions are run on the above-mentioned electronic device, the electronic device causes the electronic device to perform each function performed by the electronic device in the above method embodiment or step.
本申请实施例还提供一种计算机程序产品,当所述计算机程序产品在计算机上运行时,使得所述计算机执行上述方法实施例中电子设备执行的各个功能或者步骤。An embodiment of the present application also provides a computer program product. When the computer program product is run on a computer, it causes the computer to perform various functions or steps performed by the electronic device in the above method embodiment.
通过以上实施方式的描述,所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。Through the description of the above embodiments, those skilled in the art can clearly understand 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 functions can be allocated according to needs. Different functional modules are completed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个装置,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods, for example, multiple units or components may be The combination can either be integrated into another device, or some features can be omitted, or not implemented. On the other hand, the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, and the indirect coupling or communication connection of the devices or units may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是一个物理单元或多个物理单元,即可以位于一个地方,或者也可以分布到多个不同地方。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated. The components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place, or they may be distributed to multiple different places. . Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application can be integrated into one processing unit, each unit can exist physically alone, or two or more units can be integrated into one unit. The above integrated units can be implemented in the form of hardware or software functional units.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该软件产品存储在一个存储介质中,包括若干指令用以使得一个设备(可以是单片机,芯片等)或处理器(processor)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read only  memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a readable storage medium. Based on this understanding, the technical solutions of the embodiments of the present application are essentially or contribute to the existing technology, or all or part of the technical solution can be embodied in the form of a software product, and the software product is stored in a storage medium , including several instructions to cause a device (which can be a microcontroller, a chip, etc.) or a processor to execute all or part of the steps of the methods described in various embodiments of this application. The aforementioned storage media include: U disk, mobile hard disk, read only memory (read only memory) Various media that can store program code, such as memory (ROM), random access memory (random access memory (RAM)), magnetic disks or optical disks.
以上内容,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何在本申请揭露的技术范围内的变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。 The above contents are only specific implementation modes 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 covered by the protection scope of the present application. Therefore, the protection scope of this application should be subject to the protection scope of the claims.

Claims (12)

  1. 一种屏幕刷新率切换方法,其特征在于,应用于电子设备,所述电子设备包括显示屏,所述方法包括:A screen refresh rate switching method, characterized in that it is applied to electronic equipment, the electronic equipment includes a display screen, and the method includes:
    在所述显示屏的屏幕刷新率为第三刷新率的情况下,响应于所述电子设备由显示动态图像切换为显示静态图像,所述显示屏的屏幕刷新率由所述第三刷新率切换至第一刷新率,并设置第一Vsync信号的信号周期为预设周期,其中,所述第三刷新率大于所述第一刷新率,且所述第一刷新率小于或等于预设阈值,所述预设周期小于所述第一刷新率的倒数;In the case where the screen refresh rate of the display screen is a third refresh rate, in response to the electronic device switching from displaying dynamic images to displaying static images, the screen refresh rate of the display screen is switched by the third refresh rate. to the first refresh rate, and set the signal period of the first Vsync signal to the preset period, wherein the third refresh rate is greater than the first refresh rate, and the first refresh rate is less than or equal to the preset threshold, The preset period is less than the reciprocal of the first refresh rate;
    响应于所述电子设备由显示静态图像切换为显示动态图像,所述电子设备的SurfaceFlinger接收到第一刷新率切换指令,其中,所述第一刷新率切换指令用于指示所述显示屏的屏幕刷新率由第一刷新率切换为第二刷新率,所述第二刷新率大于所述预设阈值;In response to the electronic device switching from displaying static images to displaying dynamic images, the SurfaceFlinger of the electronic device receives a first refresh rate switching instruction, wherein the first refresh rate switching instruction is used to indicate the screen of the display screen. The refresh rate is switched from a first refresh rate to a second refresh rate, where the second refresh rate is greater than the preset threshold;
    响应于当前的第一Vsync信号的信号周期结束,所述SurfaceFlinger向所述电子设备的显示驱动发送所述第一刷新率切换指令,其中,所述第一Vsync信号用于触发所述SurfaceFlinger进行图层合成;In response to the end of the signal period of the current first Vsync signal, the SurfaceFlinger sends the first refresh rate switching instruction to the display driver of the electronic device, wherein the first Vsync signal is used to trigger the SurfaceFlinger to perform image processing. layer synthesis;
    所述显示驱动响应于所述第一刷新率切换指令,将所述显示屏的屏幕刷新率由所述第一刷新率切换为所述第二刷新率。The display driver switches the screen refresh rate of the display screen from the first refresh rate to the second refresh rate in response to the first refresh rate switching instruction.
  2. 一种屏幕刷新率切换方法,其特征在于,应用于电子设备,所述电子设备包括显示屏,所述方法包括:A screen refresh rate switching method, characterized in that it is applied to electronic equipment, the electronic equipment includes a display screen, and the method includes:
    所述电子设备的SurfaceFlinger接收来自上层的第一刷新率切换指令;其中,所述第一刷新率切换指令用于指示所述显示屏的屏幕刷新率由第一刷新率切换为第二刷新率,所述第一刷新率小于或等于预设阈值,所述第二刷新率大于所述预设阈值;The SurfaceFlinger of the electronic device receives a first refresh rate switching instruction from the upper layer; wherein the first refresh rate switching instruction is used to instruct the screen refresh rate of the display screen to switch from the first refresh rate to the second refresh rate, The first refresh rate is less than or equal to a preset threshold, and the second refresh rate is greater than the preset threshold;
    所述SurfaceFlinger响应于当前的第一垂直同步Vsync信号的信号周期结束,向所述电子设备的显示驱动发送所述第一刷新率切换指令;其中,所述第一Vsync信号用于触发所述SurfaceFlinger进行图层合成;所述第一Vsync信号的信号周期在所述显示屏的屏幕刷新率为所述第一刷新率的情况下,被设置为预设周期,所述预设周期小于所述第一刷新率的倒数;In response to the end of the signal period of the current first vertical synchronization Vsync signal, the SurfaceFlinger sends the first refresh rate switching instruction to the display driver of the electronic device; wherein the first Vsync signal is used to trigger the SurfaceFlinger Perform layer synthesis; the signal period of the first Vsync signal is set to a preset period when the screen refresh rate of the display screen is the first refresh rate, and the preset period is smaller than the first refresh rate. The reciprocal of the refresh rate;
    所述显示驱动响应于所述第一刷新率切换指令,将所述显示屏的屏幕刷新率由所述第一刷新率切换为所述第二刷新率。The display driver switches the screen refresh rate of the display screen from the first refresh rate to the second refresh rate in response to the first refresh rate switching instruction.
  3. 根据权利要求2所述的方法,其特征在于,在所述显示驱动响应于所述第一刷新率切换指令,将所述显示屏的屏幕刷新率由所述第一刷新率切换为所述第二刷新率之后,所述方法还包括:The method according to claim 2, characterized in that, in response to the first refresh rate switching instruction, the display driver switches the screen refresh rate of the display screen from the first refresh rate to the third refresh rate. After the second refresh rate, the method also includes:
    所述显示驱动按照第一信号周期,向所述SurfaceFlinger发送第二Vsync信号,以向所述SurfaceFlinger指示所述显示屏的屏幕刷新率;其中,所述第二Vsync信号用于触发所述显示屏刷新显示图像帧,所述第一信号周期等于所述第二刷新率的倒数。The display driver sends a second Vsync signal to the SurfaceFlinger according to the first signal period to indicate the screen refresh rate of the display screen to the SurfaceFlinger; wherein the second Vsync signal is used to trigger the display screen The display image frame is refreshed, and the first signal period is equal to the reciprocal of the second refresh rate.
  4. 根据权利要求2或3所述的方法,其特征在于,在所述电子设备的SurfaceFlinger接收来自上层的第一刷新率切换指令之前,所述方法还包括:The method according to claim 2 or 3, characterized in that, before the SurfaceFlinger of the electronic device receives the first refresh rate switching instruction from the upper layer, the method further includes:
    所述显示屏接收第二刷新率切换指令;其中,所述第二刷新率切换指令用于指示所述显示屏的屏幕刷新率切换为所述第一刷新率; The display screen receives a second refresh rate switching instruction; wherein the second refresh rate switching instruction is used to instruct the screen refresh rate of the display screen to switch to the first refresh rate;
    所述显示屏响应于所述第二刷新率切换指令,将所述显示屏的屏幕刷新率切换为预设刷新率,按照所述预设周期,通过所述显示驱动向所述SurfaceFlinger发送所述第二Vsync信号;其中,所述预设周期等于所述预设刷新率的倒数,所述预设刷新率大于所述预设阈值;In response to the second refresh rate switching instruction, the display screen switches the screen refresh rate of the display screen to a preset refresh rate, and sends the display driver to the SurfaceFlinger according to the preset cycle. A second Vsync signal; wherein the preset period is equal to the reciprocal of the preset refresh rate, and the preset refresh rate is greater than the preset threshold;
    所述SurfaceFlinger接收来自所述显示驱动的所述第二Vsync信号;The SurfaceFlinger receives the second Vsync signal from the display driver;
    如果第二信号周期等于所述预设周期,所述SurfaceFlinger将第一Vsync信号的信号周期设置为所述预设周期,并停止接收来自所述显示驱动的所述第二Vsync信号;If the second signal period is equal to the preset period, the SurfaceFlinger sets the signal period of the first Vsync signal to the preset period, and stops receiving the second Vsync signal from the display driver;
    其中,所述第二信号周期是所述SurfaceFlinger从所述显示驱动接收所述第二Vsync信号的周期。Wherein, the second signal period is a period in which the SurfaceFlinger receives the second Vsync signal from the display driver.
  5. 根据权利要求4所述的方法,其特征在于,所述方法还包括:The method of claim 4, further comprising:
    所述显示屏响应于所述第二刷新率切换指令,在预设时长后将所述显示屏的屏幕刷新率切换为所述第一刷新率。The display screen responds to the second refresh rate switching instruction and switches the screen refresh rate of the display screen to the first refresh rate after a preset period of time.
  6. 根据权利要求2-5中任一项所述的方法,其特征在于,所述预设刷新率是所述显示屏支持的一个屏幕刷新率。The method according to any one of claims 2 to 5, characterized in that the preset refresh rate is a screen refresh rate supported by the display screen.
  7. 根据权利要求6所述的方法,其特征在于,所述第一刷新率为所述显示屏显示静态图像时的目标刷新率。The method of claim 6, wherein the first refresh rate is a target refresh rate when the display screen displays a static image.
  8. 根据权利要求4-6中任一项所述的方法,其特征在于,所述预设刷新率为120Hz;所述第一刷新率为10Hz或1Hz;所述第二刷新率为60Hz、90Hz或120Hz中的任一种。The method according to any one of claims 4 to 6, characterized in that the preset refresh rate is 120Hz; the first refresh rate is 10Hz or 1Hz; the second refresh rate is 60Hz, 90Hz or Either of 120Hz.
  9. 根据权利要求2-7中任一项所述的方法,其特征在于,所述第一刷新率切换指令是所述电子设备在显示静态图像的情况下,接收到通知或用户操作后触发的;其中,所述通知或用户操作用于触发所述电子设备更新界面。The method according to any one of claims 2 to 7, characterized in that the first refresh rate switching instruction is triggered after the electronic device receives a notification or user operation when displaying a static image; Wherein, the notification or user operation is used to trigger the electronic device to update the interface.
  10. 根据权利要求4或5所述的方法,其特征在于,所述第二刷新率切换指令是所述电子设备由显示动态图像切换为显示静态图像时触发的。The method according to claim 4 or 5, characterized in that the second refresh rate switching instruction is triggered when the electronic device switches from displaying dynamic images to displaying static images.
  11. 一种电子设备,其特征在于,所述电子设备包括显示屏、存储器和一个或多个处理器;所述显示屏、所述存储器与所述处理器耦合;所述存储器中存储有计算机程序代码,所述计算机程序代码包括计算机指令,当所述计算机指令被所述处理器执行时,使得所述电子设备执行如权利要求1所述的方法,或者,权利要求2-10中任一项所述的方法。An electronic device, characterized in that the electronic device includes a display screen, a memory and one or more processors; the display screen, the memory and the processor are coupled; computer program code is stored in the memory , the computer program code includes computer instructions, which when executed by the processor, cause the electronic device to perform the method of claim 1, or, any one of claims 2-10. method described.
  12. 一种计算机可读存储介质,其特征在于,包括计算机指令,当所述计算机指令在电子设备上运行时,使得所述电子设备执行如权利要求1所述的方法,或者,权利要求2-10中任一项所述的方法。 A computer-readable storage medium, characterized by comprising computer instructions, which when the computer instructions are run on an electronic device, cause the electronic device to perform the method of claim 1, or claims 2-10 any one of the methods.
PCT/CN2023/094624 2022-08-24 2023-05-16 Screen refresh rate switching method and electronic device WO2024041047A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202211021875.0 2022-08-24
CN202211021875.0A CN116052618B (en) 2022-08-24 2022-08-24 Screen refresh rate switching method and electronic equipment

Publications (1)

Publication Number Publication Date
WO2024041047A1 true WO2024041047A1 (en) 2024-02-29

Family

ID=86114080

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/094624 WO2024041047A1 (en) 2022-08-24 2023-05-16 Screen refresh rate switching method and electronic device

Country Status (2)

Country Link
CN (3) CN116052618B (en)
WO (1) WO2024041047A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116052618B (en) * 2022-08-24 2023-11-07 荣耀终端有限公司 Screen refresh rate switching method and electronic equipment
CN116578261B (en) * 2023-07-10 2024-03-29 荣耀终端有限公司 Electronic device and display method thereof
CN117707406A (en) * 2023-07-10 2024-03-15 荣耀终端有限公司 Bright screen display method, electronic equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8334857B1 (en) * 2007-12-14 2012-12-18 Nvidia Corporation Method and system for dynamically controlling a display refresh rate
JP2014102583A (en) * 2012-11-16 2014-06-05 Semiconductor Energy Lab Co Ltd Information processing method and program
CN114495791A (en) * 2022-01-25 2022-05-13 昆山龙腾光电股份有限公司 Display control method and device of display panel and display device
CN114518817A (en) * 2022-01-10 2022-05-20 荣耀终端有限公司 Display method, electronic equipment and storage medium
CN114648951A (en) * 2022-02-28 2022-06-21 荣耀终端有限公司 Method for controlling dynamic change of screen refresh rate and electronic equipment
CN116052618A (en) * 2022-08-24 2023-05-02 荣耀终端有限公司 Screen refresh rate switching method and electronic equipment

Family Cites Families (22)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101496089B (en) * 2006-07-31 2012-07-18 夏普株式会社 Display controller, display device, display system, and control method for display device
US20120017074A1 (en) * 2010-07-16 2012-01-19 International Business Machines Corporation Dynamic system mode switching
CN103593155B (en) * 2013-11-06 2016-09-07 华为终端有限公司 Display frame generating method and terminal device
US9905199B2 (en) * 2014-09-17 2018-02-27 Mediatek Inc. Processor for use in dynamic refresh rate switching and related electronic device and method
US9811388B2 (en) * 2015-05-14 2017-11-07 Qualcomm Innovation Center, Inc. VSync aligned CPU frequency governor sampling
US20190087144A1 (en) * 2017-09-20 2019-03-21 Qualcomm Incorporated Frame-based power efficient timing engine for smart display panels
KR102545078B1 (en) * 2018-10-01 2023-06-19 삼성전자주식회사 Display apparatus, method for controlling thereof and system
CN110764725A (en) * 2019-10-18 2020-02-07 中科创达软件股份有限公司 Vehicle machine system main screen and auxiliary screen display method and device and electronic equipment
CN113160748B (en) * 2020-01-22 2022-03-29 Oppo广东移动通信有限公司 Display screen frequency conversion method, display driving integrated circuit chip and application processor
CN113362783B (en) * 2020-03-06 2022-04-05 华为技术有限公司 Refresh rate switching method and electronic equipment
US11782540B2 (en) * 2020-06-26 2023-10-10 Ati Technologies Ulc Front buffer rendering for variable refresh rate display
CN114205485B (en) * 2020-09-18 2023-03-10 华为技术有限公司 Method and device for sending image data
CN114531519B (en) * 2020-10-31 2024-04-26 华为技术有限公司 Control method based on vertical synchronous signal and electronic equipment
CN113144594A (en) * 2021-04-20 2021-07-23 努比亚技术有限公司 Screen display control method and device, mobile terminal and readable storage medium
CN114089933B (en) * 2021-06-09 2022-09-02 荣耀终端有限公司 Display parameter adjusting method, electronic device, chip and readable storage medium
CN113722030B (en) * 2021-06-10 2022-12-16 荣耀终端有限公司 Display method, electronic equipment and computer storage medium
CN114443269B (en) * 2021-08-27 2023-08-01 荣耀终端有限公司 Frame rate adjusting method and related device
CN113805831B (en) * 2021-09-15 2024-01-30 Oppo广东移动通信有限公司 Image data transmission method, device, terminal and medium
CN114242003B (en) * 2021-12-14 2023-06-02 Tcl华星光电技术有限公司 Display panel and driving method thereof
CN116991354A (en) * 2022-01-30 2023-11-03 荣耀终端有限公司 Data processing method and related device
CN114579075B (en) * 2022-01-30 2023-01-17 荣耀终端有限公司 Data processing method and related device
CN114661263B (en) * 2022-02-25 2023-06-20 荣耀终端有限公司 Display method, electronic equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8334857B1 (en) * 2007-12-14 2012-12-18 Nvidia Corporation Method and system for dynamically controlling a display refresh rate
JP2014102583A (en) * 2012-11-16 2014-06-05 Semiconductor Energy Lab Co Ltd Information processing method and program
CN114518817A (en) * 2022-01-10 2022-05-20 荣耀终端有限公司 Display method, electronic equipment and storage medium
CN114495791A (en) * 2022-01-25 2022-05-13 昆山龙腾光电股份有限公司 Display control method and device of display panel and display device
CN114648951A (en) * 2022-02-28 2022-06-21 荣耀终端有限公司 Method for controlling dynamic change of screen refresh rate and electronic equipment
CN116052618A (en) * 2022-08-24 2023-05-02 荣耀终端有限公司 Screen refresh rate switching method and electronic equipment

Also Published As

Publication number Publication date
CN116052618A (en) 2023-05-02
CN117711356A (en) 2024-03-15
CN116052618B (en) 2023-11-07
CN117711355A (en) 2024-03-15

Similar Documents

Publication Publication Date Title
WO2021057830A1 (en) Information processing method and electronic device
WO2022052772A1 (en) Application interface display method under multi-window mirroring scenario, and electronic device
WO2024041047A1 (en) Screen refresh rate switching method and electronic device
WO2022100315A1 (en) Method for generating application interface, and related apparatus
WO2021129253A1 (en) Method for displaying multiple windows, and electronic device and system
WO2022021895A1 (en) Image processing method and electronic device
WO2023160194A1 (en) Method for controlling dynamic change in screen refresh rate, and electronic device
CN116501210B (en) Display method, electronic equipment and storage medium
WO2022083296A1 (en) Display method and electronic device
CN115097994B (en) Data processing method and related device
WO2023001163A1 (en) Screen refreshing method and device capable of improving dynamic effect performance
WO2022247541A1 (en) Method and apparatus for application animation linking
WO2021052488A1 (en) Information processing method and electronic device
WO2023005751A1 (en) Rendering method and electronic device
WO2023066165A1 (en) Animation effect display method and electronic device
CN116719587B (en) Screen display method, electronic device and computer readable storage medium
WO2024016798A1 (en) Image display method and related apparatus
WO2024046317A1 (en) Content display method and electronic device
WO2023066177A1 (en) Animation effect display method and electronic device
WO2024139934A1 (en) Multi-window presentation method for application programs, and electronic device
WO2023169276A1 (en) Screen projection method, terminal device, and computer-readable storage medium
WO2023185636A1 (en) Image display method, and electronic devices
WO2023185590A1 (en) Media information acquisition method and electronic device
WO2023174322A1 (en) Layer processing method and electronic device
WO2024104131A1 (en) Method for gaining window focus in multi-window scenario, device and system

Legal Events

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

Ref document number: 23856140

Country of ref document: EP

Kind code of ref document: A1