Input response optimization method and related electronic equipment
By detecting the application type and distributing input events on the rising or falling edge of the vertical synchronization signal, the input response delay problem in touch manipulation in the prior art is solved, the gaming experience and picture stability are optimized, and faster inputs are achieved Responsive and smoother gaming experience.
Patent Information
- Application Number
- CN202310786817.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-29
- Publication Date
- 2024-12-31
AI Technical Summary
In the prior art, the input response delay problem in touch manipulation leads to poor gaming experience, especially in competitive games, which affects touch sensitivity and user experience.
By detecting the application type, preset game applications and non-game applications distribute input events when the rising or falling edge of the vertical synchronization signal occurs, the game applications can be directly distributed instead of the game applications need to wait for the signal, combining direct distribution and VSync distribution methods , optimize input response.
It reduces the delay in input responses such as touch, improves user gaming experience, and takes into account the input response of game applications and the picture stability of non-game applications.
Smart Images

Figure CN119215398A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of terminal technology, and in particular to an input response optimization method and related electronic equipment. Background Art
[0002] Touch controllability plays a very important role in the gaming experience. Touch controllability refers to the performance of touching the touch panel (TP) to achieve corresponding operation control. Touch controllability covers many performance indicators such as touch sensitivity, continuity, hand tracking and false touch. Sensitivity, as an important performance indicator of touch controllability, directly affects the gaming experience. Therefore, how to optimize the sensitivity of touch input response is a technical problem that technicians in this field urgently need to solve. Summary of the invention
[0003] The present application provides an input response optimization method and related electronic devices, which can reduce the delay of input responses such as touch, optimize the sensitivity of input responses such as touch, and improve the user's gaming experience.
[0004] In a first aspect, an embodiment of the present application provides an input response optimization method, which is applied to an electronic device, and the method includes:
[0005] A first input event of a user on a first interface is detected, where the first interface is an interface of a first application;
[0006] When the first application is a preset game application, before a rising edge or a falling edge of a vertical synchronization signal occurs, the first input event is distributed; and a picture is rendered in response to the first input event;
[0007] A second input event of the user on a second interface is detected, where the second interface is an interface of a second application;
[0008] When the second application does not belong to the preset game application, after the rising edge or the falling edge of the vertical synchronization signal occurs, the second input event is distributed, and the picture is rendered in response to the second input event.
[0009] Optionally, distributing the second input event and rendering a screen in response to the second input event includes: distributing the second input event to a native rendering module of the electronic device; and rendering a screen in response to the second input event through the rendering module.
[0010] In the above scheme, if the application is a preset game application, then after the electronic device receives the input event acting on the application, it can distribute the input event for rendering the screen without waiting for the arrival of the vertical synchronization signal, thereby reducing the response delay of the input event. If the application is not a preset game application, it still waits for the arrival of the vertical synchronization signal before distributing the input event to reduce the occurrence of unstable screens (such as "tearing"). That is, this scheme can take into account the optimization of the input response of game applications and the screen stability of non-game applications, greatly improving the user experience.
[0011] In a possible implementation, the above-mentioned distributing the first input event; and rendering the picture in response to the first input event, include: distributing the first input event to a game engine; and rendering the picture in response to the first input event through the game engine.
[0012] In the above solution, the game application renders the screen through the game engine, so it is not restricted by the vertical synchronization signal, so that input events can be distributed in time for rendering, reducing the delay of input response such as touch.
[0013] In a possible implementation, before detecting the first input event of the user on the first interface, the method further includes: acquiring identification information of the first application; and knowing that the first application belongs to the preset game application based on the identification information of the first application.
[0014] In a possible implementation, the knowing that the first application belongs to the preset game application based on the identification information of the first application includes: comparing the identification information of the first application with the identification information of applications included in a preset whitelist; the preset whitelist includes the identification information of the preset game application; and knowing that the first application belongs to the preset game application when the identification information of the first application is included in the preset whitelist. Optionally, the preset whitelist is stored in a configuration file.
[0015] In the above scheme, the corresponding application is first identified as a preset game application, and then the corresponding input event distribution method is determined to avoid the problem of screen tearing caused by non-game applications using a direct distribution method (i.e., an input event distribution method that is not limited by the vertical synchronization signal frequency).
[0016] In a possible implementation, the first input event includes a touch event; after the first application is learned based on the identification information of the first application that the first application is a game application in a preset whitelist, the method further includes:
[0017] Obtaining the frame rate of the first application and the TP reporting rate of the touch screen of the electronic device;
[0018] When the TP reporting rate is an integer multiple of the frame rate, it indicates that a direct distribution method is adopted; the direct distribution method is an input event distribution method independent of the frequency limit of the vertical synchronization signal.
[0019] In the above scheme, direct distribution is indicated only when the TP reporting rate is an integer multiple of the frame rate, thereby reducing the risk of unstable input response caused by the mismatch between the TP reporting rate and the frame rate of the game.
[0020] In a possible implementation, the TP reporting rate is less than or equal to a preset threshold.
[0021] In the above solution, the risk of excessive power consumption can be prevented by limiting the TP reporting rate.
[0022] In a possible implementation, after the indication is directly distributed, the following further includes:
[0023] Notifying the process of the first application of indication information of adopting the direct distribution method through a status callback;
[0024] The method of distributing the first input event to the game engine before the rising edge or the falling edge of the vertical synchronization signal occurs includes:
[0025] Before a rising edge or a falling edge of the vertical synchronization signal occurs, the first input event is distributed to the game engine through the process of the first application.
[0026] In the above scheme, the input event distribution method adopted by the application process is notified by means of state callback, which is easy to implement.
[0027] In a possible implementation, after the first application is learned, based on the identification information of the first application, that the first application is a game application in a preset whitelist, the method further includes:
[0028] A status callback function is registered; the status callback function is used to notify the process of the first application of indication information of the input event distribution method used.
[0029] In the above solution, the corresponding application is first identified as a preset game application, and then the callback function is registered, so as to avoid registration and notification of a large number of irrelevant applications in the system, thereby reducing resource usage.
[0030] In a possible implementation, the first application process includes a plurality of input event consumption threads, and the plurality of input event consumption threads are used to jointly execute the distribution of input events acting on the first application;
[0031] The multiple input event consumption threads share the indication information of the adopted input event distribution mode.
[0032] In the above solution, when the first application process includes multiple input event consuming threads, the state callback information can be shared to reduce the overhead of multiple registrations of the callback function.
[0033] In a possible implementation, after the indication adopts the direct distribution method, the method further includes: associating and saving the identification information of the first application with the identification information of the direct distribution method;
[0034] The method further includes:
[0035] Exit the running of the first application;
[0036] When the first application is run again, querying the input event distribution method adopted by the first application based on the identification information of the first application to obtain the identification information of the direct distribution method;
[0037] The input event for the first application is distributed using the direct distribution method based on an indication of the identification information of the direct distribution method.
[0038] In the above scheme, after determining the input event distribution method corresponding to the application, the corresponding information can be saved. When the application is run later, there is no need to repeat the judgment, thus saving resources.
[0039] In a second aspect, an embodiment of the present application provides an electronic device, the electronic device comprising: a touch screen, one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store a computer program code, the computer program code includes a computer instruction, and the one or more processors call the computer instruction to enable the electronic device to perform the following operations:
[0040] A first input event of a user on a first interface is detected, where the first interface is an interface of a first application;
[0041] When the first application is a preset game application, before a rising edge or a falling edge of a vertical synchronization signal occurs, the first input event is distributed; and a picture is rendered in response to the first input event;
[0042] A second input event of the user on a second interface is detected, where the second interface is an interface of a second application;
[0043] When the second application does not belong to the preset game application, after the rising edge or the falling edge of the vertical synchronization signal occurs, the second input event is distributed, and the picture is rendered in response to the second input event.
[0044] Optionally, the one or more processors are used to call the computer instructions to enable the electronic device to specifically perform the following operations: distribute the second input event to a native rendering module of the electronic device; and render a screen in response to the second input event through the rendering module.
[0045] In one possible implementation, the one or more processors are used to call the computer instructions to enable the electronic device to specifically perform the following operations: distribute the first input event to a game engine; and render a picture in response to the first input event through the game engine.
[0046] In one possible implementation, before detecting the first input event of the user on the first interface, the one or more processors are also used to call the computer instructions to enable the electronic device to perform the following operations: obtain identification information of the first application; and determine, based on the identification information of the first application, that the first application belongs to the preset game application.
[0047] In a possible implementation, the one or more processors are used to call the computer instructions to enable the electronic device to specifically perform the following operations: compare the identification information of the first application with the identification information of applications included in a preset whitelist; the preset whitelist includes the identification information of the preset game application; when the preset whitelist includes the identification information of the first application, it is learned that the first application belongs to the preset game application. Optionally, the preset whitelist is stored in a configuration file.
[0048] In a possible implementation, the first input event includes a touch event; after the first application is learned, based on the identification information of the first application, that the first application is a game application in a preset whitelist, the one or more processors are further configured to call the computer instruction to enable the electronic device to perform the following operations:
[0049] Obtaining the frame rate of the first application and the TP reporting rate of the touch screen of the electronic device;
[0050] When the TP reporting rate is an integer multiple of the frame rate, it indicates that a direct distribution method is adopted; the direct distribution method is an input event distribution method independent of the frequency limit of the vertical synchronization signal.
[0051] In a possible implementation, the TP reporting rate is less than or equal to a preset threshold.
[0052] In a possible implementation, after the indication is directly distributed, the one or more processors are further configured to call the computer instruction to enable the electronic device to perform the following operations:
[0053] Notifying the process of the first application of indication information of adopting the direct distribution method through a status callback;
[0054] The method of distributing the first input event to the game engine before the rising edge or the falling edge of the vertical synchronization signal occurs includes:
[0055] Before a rising edge or a falling edge of the vertical synchronization signal occurs, the first input event is distributed to the game engine through the process of the first application.
[0056] In a possible implementation, after it is learned based on the identification information of the first application that the first application is a game application in a preset whitelist, the one or more processors are further configured to call the computer instruction to enable the electronic device to perform the following operations:
[0057] A status callback function is registered; the status callback function is used to notify the process of the first application of indication information of the input event distribution method used.
[0058] In a possible implementation, the first application process includes multiple input event consumer threads, and the multiple input event consumer threads are used to jointly execute the distribution of input events acting on the first application; the multiple input event consumer threads share the indication information of the adopted input event distribution method.
[0059] In a possible implementation, after the indication adopts the direct distribution method, the one or more processors are further used to call the computer instruction to enable the electronic device to perform the following operations: associate the identification information of the first application with the identification information of the direct distribution method and save it;
[0060] The one or more processors are further configured to call the computer instruction to enable the electronic device to perform the following operations:
[0061] Exit the running of the first application;
[0062] When the first application is run again, querying the input event distribution method adopted by the first application based on the identification information of the first application to obtain the identification information of the direct distribution method;
[0063] The input event for the first application is distributed using the direct distribution method based on an indication of the identification information of the direct distribution method.
[0064] In a third aspect, an embodiment of the present application provides a chip system, which is applied to an electronic device, and the chip system includes one or more processors, which are used to call computer instructions to enable the electronic device to execute the method described in the first aspect or any possible implementation method of the first aspect.
[0065] In a fourth aspect, an embodiment of the present application provides a computer program product comprising instructions, which, when executed on an electronic device, enables the electronic device to execute the method described in the first aspect or any possible implementation of the first aspect.
[0066] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, comprising instructions, which, when executed on an electronic device, causes the electronic device to execute the method described in the first aspect or any possible implementation of the first aspect.
[0067] The second to fifth aspects are used to cooperate with the method of implementing any one of the first aspect and its possible implementation methods, and therefore have corresponding beneficial effects to the first aspect and its possible implementation methods, which will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] Figure 1A A schematic diagram of a touch service link provided in an embodiment of the present application;
[0069] Figure 1B A schematic diagram of touch event distribution provided in an embodiment of the present application;
[0070] Figure 2 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;
[0071] Figure 3 A schematic diagram of the software framework of an electronic device provided in an embodiment of the present application;
[0072] Figure 4 A schematic diagram of the touch event distribution effect provided in an embodiment of the present application;
[0073] Figure 5 and Figure 6 A schematic diagram of a method flow chart provided in an embodiment of the present application;
[0074] Figure 7 A schematic diagram of data flow provided in an embodiment of the present application;
[0075] Figure 8 and Fig. 9 A schematic diagram of a method flow chart provided in an embodiment of the present application;
[0076] Fig.10 and Fig.11 A schematic diagram of the input event distribution effect provided in an embodiment of the present application. DETAILED DESCRIPTION
[0077] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. Mentioning "embodiment" in this article means that the specific features, structures or characteristics described in conjunction with the embodiments may be included in at least one embodiment of the present embodiment application. The appearance of this phrase in various positions in the specification is not necessarily the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It can be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0078] The terms "first", "second", "third", etc. in the specification and claims of the present application and the drawings are used to distinguish different objects rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a series of steps or units are included, or optionally, steps or units not listed are included, or optionally, other steps or units inherent to these processes, methods, products or devices are included.
[0079] Only the part relevant to the present application but not all content is shown in the accompanying drawings.Before discussing exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processing or methods described as flow charts.Although flow charts describe various operations (or steps) as sequential processing, many operations therein can be implemented in parallel, concurrently or simultaneously.In addition, the order of various operations can be rearranged.Described processing can be terminated when its operation is completed, but can also have additional steps not included in the accompanying drawings.Described processing can correspond to method, function, procedure, subroutine, subprogram etc.
[0080] As used in this specification, the terms "component", "module", "system", "unit", etc. are used to represent computer-related entities, hardware, firmware, a combination of hardware and software, software, or software in execution. For example, a unit can be, but is not limited to, a process running on a processor, a processor, an object, an executable file, an execution thread, a program, and / or distributed between two or more computers. In addition, these units can be executed from various computer-readable media having various data structures stored thereon. Units can communicate through local and / or remote processes, for example, based on signals having one or more data packets (e.g., data from a second unit interacting with another unit in a local system, a distributed system, and / or a network. For example, the Internet interacts with other systems via signals).
[0081] First, the technical terms involved in the embodiments of the present application are introduced.
[0082] 1. Frames per second (FPS).
[0083] FPS, also known as frame rate, is the rate or frequency at which new frames are displayed. The frame rate determines the number of frames drawn per second, that is, the frame rate represents the ability to draw frames per second. Essentially, the higher the frame rate, the more frames are displayed per second, resulting in smoother and more realistic motion. The frame rate is determined by a combination of the software used, the central processing unit (CPU), and the graphics card.
[0084] 2. Refresh rate.
[0085] Refresh rate refers to the refresh rate of the display, which refers to the number of times the electron beam repeatedly scans the image on the display screen, that is, it describes the number of times the display refreshes, and the unit is Hertz (Hz). The refresh rate determines the number of new picture frames that can be seen per second.
[0086] 3. Touch panel (TP) reporting rate.
[0087] The TP reporting rate refers to the number of times the touch chip (integrated circuit, IC) reports the touch position (coordinates) per unit time.
[0088] 4. Game engine.
[0089] Game engines refer to the core components of some pre-written editable game systems or some interactive real-time image applications. For example, game engines can include the following software modules: rendering engine (i.e., "renderer", including 2D image engine and 3D image engine), physics engine, collision detection system, sound effect, script engine, computer animation, artificial intelligence, network engine, and scene management, etc. That is, the game engine can realize the rendering of game screen, sound effect, animation, etc.
[0090] In the gaming experience, picture smoothness, touch screen controllability, game display effect, game heat dissipation capacity, network stability and game audio effect play a very important role. Among them, touch screen controllability covers many performance indicators such as touch sensitivity, continuity, hand tracking and false touch, which are related to the user's gaming touch experience. Among them, touch sensitivity is an important performance indicator of touch controllability and directly affects the gaming experience.
[0091] In specific implementations, touch delay affects touch sensitivity, especially in competitive games, where a millisecond-level touch delay difference may determine the outcome of a game. Touch delay is an end-to-end experience, so if you want to shorten touch delay, you must analyze the internal structure of the touch service link throughout the entire process and find optimization points from it.
[0092] For example, see Figure 1A , showing a schematic diagram of the touch service link. It can be seen that the touch service link includes a touch panel (TP), a touch screen driver, an input management service (IMS) reader, an IMS dispatcher, a view system (view), a rendering module, a graphics synthesis module and a display module. Exemplarily, the touch screen receives a touch operation and transmits it to the IMS module via the touch screen driver. The IMS reader reads the touch event (Move). The touch event is dispatched to the view system via the IMS dispatcher. The view system then distributes the touch event to the rendering module for rendering through the user interface (UI) thread. The UI thread is the main thread of the application process.
[0093] Exemplarily, if the touch event is an input event obtained through the user interface of a game application, the rendering module is a game engine. That is, the user interface of the game application is rendered by the game engine. Exemplarily, if the touch event is an input event obtained through the user interface of an application other than a game application, the rendering module is a rendering module native to the electronic device (e.g., a three-dimensional graphics processing library).
[0094] After the rendering module completes rendering, the graphics synthesis module synthesizes the rendered content into graphics, and sends the synthesized graphics to the display module for display.
[0095] During the service processing, a delay is generated in the processing of the touch screen and the touch screen driver, which can be referred to as the peripheral delay. A delay is generated in the processing of the IMS reader and the IMS scheduler, which can be referred to as the system transmission delay. A delay is generated in the processing of the view system, which can be referred to as the application transmission delay. A delay is generated in the processing of the rendering module, which can be referred to as the rendering delay. A delay is generated in the processing of the graphics synthesis module, which can be referred to as the synthesis delay. A delay is generated in the processing of the display module, which can be referred to as the display delay.
[0096] Based on an in-depth analysis of the above touch service link and its related delay, it is found that during the processing of the above view system, the distribution of touch events is limited by the frequency of vertical synchronization (VSync).
[0097] The basic idea of VSync is to synchronize the FPS and the refresh rate of the monitor through the vertical synchronization signal (VSync signal for short) to avoid the phenomenon of screen "tearing". If there is no VSync signal, when the rendering frame data is relatively fast, the monitor cannot keep up, and it may appear that a certain frame is currently being displayed, and another frame is triggered to be displayed on the monitor, which will cause the phenomenon of screen "tearing".
[0098] Specifically, in the process of distributing touch events based on VSync, before the display is refreshed, the touch events are cached in the cache queue, and the touch events are distributed to the rendering module when the VSync signal arrives. Finally, the rendering module generates the corresponding picture according to the obtained touch events. For ease of understanding, you can refer to the example Figure 1B .
[0099] Figure 1B Take the touch control in the game experience process as an example. It can be seen that when the game thread (gamethread) is displaying game frame 1, the UI thread in the view system can receive touch event 1 and touch event 2. Exemplarily, the game thread can call the game engine to implement rendering and other operations. Although the UI thread has received touch event 1 and touch event 2, based on the frequency of VSync, the VSync signal has not yet arrived, so the UI thread caches the received touch events. After receiving the VSync signal, touch event 1 and touch event 2 are distributed to the rendering module for rendering. Similarly, when the game thread is displaying game frame 2, the UI thread can receive touch event 3 and touch event 4. Although the UI thread has received touch event 3 and touch event 4, based on the frequency of VSync, the VSync signal has not yet arrived, so the UI thread caches the received touch events. After receiving the next VSync signal, touch event 3 and touch event 4 are distributed to the rendering module for rendering. In addition, it can be seen that touch events 1 and 2 are distributed when game frame 2 is displayed, but since rendering, synthesis, and display after distribution are delayed, the corresponding interface display is not made in response to touch events 1 and 2 until game frame 3, resulting in serious touch delay.
[0100] Exemplarily, the arrival of the VSync signal in the embodiment of the present application refers to the occurrence of the rising edge or falling edge of the VSync signal. For example, when the VSync signal changes from a low level "0" to a high level "1", it is a rising edge. When the VSync signal changes from a high level "1" to a low level "0", it is a falling edge.
[0101] Based on the above description, although VSync effectively limits the FPS to the refresh rate of the display so that it does not cause "tearing", in scenarios such as games, it leads to a mismatch between the UI thread in the system receiving touch events and distributing the events, introducing unnecessary delays and increasing touch delays.
[0102] Above Figure 1A The design of the touch service link shown is biased towards universality, but the game application scenario has its own particularity. That is, the application interface in the game application is rendered by the game engine. The screen rendering of the game engine can be rendered in real time, and the rendering is not controlled by VSync. If the game application scenario continues to use the above-mentioned solution of distributing touch events based on VSync signals, it will cause touch response delays and fail to meet user needs for quick response to touch events. Based on this, the embodiment of the present application proposes an input response optimization method and related electronic devices to break the limitations of existing touch event distribution, so that the game thread can receive touch events faster and at a higher frequency, thereby reducing touch delays, optimizing the sensitivity of touch and other input responses, and improving the user's gaming experience. An exemplary introduction is given below.
[0103] First, the structure of the electronic device provided in the embodiment of the present application is introduced as an example. Figure 2 , Figure 2 It is a schematic diagram of the hardware structure of the electronic device 100 provided in an embodiment of the present application.
[0104] The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc.
[0105] Among them, the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0106] It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or separate some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0107] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0108] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0109] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0110] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3F / 4G / 5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.
[0111] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as Wi-Fi networks), Bluetooth (BT), BLE broadcast, global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0112] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0113] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, Microled, Micro-oled, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
[0114] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.
[0115] ISP is used to process the data fed back by camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, ISP can be set in camera 193.
[0116] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
[0117] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.
[0118] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.
[0119] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.
[0120] The speaker 170A, also called a "speaker", is used to convert an audio electrical signal into a sound signal. The electronic device 100 can listen to music or listen to a hands-free call through the speaker 170A.
[0121] The receiver 170B, also called a "earpiece", is used to convert audio electrical signals into sound signals. When the electronic device 100 receives a call or voice message, the voice can be received by placing the receiver 170B close to the human ear.
[0122] Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting his mouth close to microphone 170C to input the sound signal into microphone 170C. The electronic device 100 can be provided with at least one microphone 170C. In other embodiments, the electronic device 100 can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C to realize the collection of sound signals, noise reduction, identification of sound sources, and directional recording functions.
[0123] based on Figure 2 The hardware structure diagram of the electronic device 100 according to the embodiment of the present application is shown below, and the software structure block diagram of the electronic device 100 according to the embodiment of the present application is exemplarily introduced below.
[0124] The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the Android system of the layered architecture as an example to exemplify the software structure of the electronic device 100.
[0125] For example, see Figure 3 The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: application layer, application framework layer, Android runtime (Android runtime) and system (native) library, and kernel layer.
[0126] The application layer can include a series of application packages. Figure 3 As shown, the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music or game.
[0127] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.
[0128] like Figure 3 As shown, the application framework layer may include a window manager, a content provider, a phone manager, a resource manager, a notification manager, a view system, an activity manager service (AMS), a display manager service (DMS), a game manager module (GM), and an input manager service (IMS), etc.
[0129] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.
[0130] Content providers are used to store and retrieve data and make it accessible to applications. The data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
[0131] The phone manager is used to provide communication functions of the electronic device 100, such as management of call status (including connecting, hanging up, etc.).
[0132] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.
[0133] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically 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 a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.
[0134] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.
[0135] The application activity management service is responsible for the scheduling of the foreground and background of the application. In the embodiment of the present application, the application activity management service can provide the identification information of the application to the game management module.
[0136] The display management service is used to manage information such as display brightness and display frame rate, etc. In an embodiment of the present application, the display management service can provide the game management module with information such as the frame rate of the application.
[0137] The game management module is responsible for collecting and optimizing information about game applications, including frame rate, clarity, game scenes, etc., and provides the best system configuration by combining the information obtained with system capabilities. In the embodiment of the present application, the game management module has added a game application scene identification module, which is used to identify the game application scene and indicate the input event distribution method to be used. The specific implementation is described below and will not be described in detail here.
[0138] The input management service is used to distribute input events to application processes and to implement TP reporting rate management, etc. The input events include touch events, mouse events, keyboard events, etc. In an embodiment of the present application, the input management service can provide the game management module with information such as TP reporting rate.
[0139] Exemplarily, the above-mentioned functional modules such as application activity management service, display management service, game management module or input management service can be set in the application framework layer in the form of independent modules; or, they can be set in the application framework layer in combination with other functional modules. The embodiments of the present application do not limit the specific setting form of these functional modules. In addition, it can be understood that these functional modules can also be called by other names, not limited to the names shown in the embodiments of the present application. As long as they can realize the functions described in the embodiments of the present application, they belong to the functional modules described in the embodiments of the present application.
[0140] Android Runtime includes core libraries and virtual machines. Android runtime is responsible for scheduling and management of the Android system.
[0141] The core library consists of two parts: one part is the function that needs to be called by the Java language, and the other part is the Android core library.
[0142] The application layer and the application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
[0143] The system library may include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL) and input consumer module.
[0144] The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.
[0145] The media library 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.
[0146] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
[0147] A 2D graphics engine is a drawing engine for 2D drawings.
[0148] The input consumption module is used to distribute the input events received by the application process to the corresponding application display window. In the embodiment of the present application, an input event distribution switching module is newly added to the input consumption module, which is used to distribute the received input events according to the indicated input event distribution. The specific implementation is described below and will not be described in detail here.
[0149] 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.
[0150] Based on the electronic device exemplarily introduced above, an input response optimization method provided by an embodiment of the present application is exemplarily introduced below.
[0151] Based on the above introduction, it can be known that the application interface displayed in the game application can be obtained by rendering the game engine. Moreover, the rendering of the game engine is not controlled by VSync in the electronic device. Therefore, during the rendering process of the game engine, the corresponding screen can be rendered in response to the touch event, without waiting for the VSync signal to arrive before distributing the touch event for rendering, thereby reducing the touch delay. For ease of understanding, please refer to the example Figure 4 .
[0152] Figure 4 A schematic diagram showing the effect achieved by the input response optimization method provided in an embodiment of the present application is shown. It can be seen that while the game thread is displaying game frame 1, the UI thread can receive touch event 1 and touch event 2. Then, the UI thread distributes touch event 1 and touch event 2 to the game engine for rendering without waiting for the VSync signal to arrive. Similarly, while the game thread is displaying game frame 2, the UI thread can receive touch event 3 and touch event 4. Then, the UI thread distributes touch event 3 and touch event 4 to the game engine for rendering without waiting for the VSync signal to arrive. In addition, it can be seen that since touch event 1 and touch event 2 are distributed when game frame 1 is displayed, game frame 2 can respond to touch event 1 and touch event 2 to make a corresponding interface display. Similarly, since touch event 3 and touch event 4 are distributed when game frame 2 is displayed, game frame 3 can respond to touch event 3 and touch event 4 to make a corresponding interface display. Compared to the above Figure 1B In the example, the corresponding interface display is not made until the game frame 3 in response to touch event 1 and touch event 2. The input response optimization method provided in the embodiment of the present application can respond to touch events faster and reduce touch delay. It can be understood that Figure 4 It is only a schematic diagram of the effect and does not constitute a limitation to the embodiments of the present application.
[0153] In addition, the above Figure 4 The distribution of touch events is mainly used as an example. In a specific implementation, it may not be limited to the distribution of touch events, but may also be the distribution of other input events such as mouse events or keyboard events. The embodiments of the present application may be applied to the distribution of various input events, without limiting the specific input events.
[0154] In order to achieve the above effect, the following Figure 5 The implementation process of the input response optimization method provided in the embodiment of the present application is introduced by way of example.
[0155] S501: The electronic device recognizes that a first application is a preset game application.
[0156] Exemplarily, in a specific implementation, a variety of applications can be run in an electronic device. For example, various applications such as gallery, calendar, and game can be run. It is understandable that the running application described in the embodiment of the present application refers to the application running in the foreground of the electronic device, that is, the user interface of the application is displayed on the display screen of the electronic device. The input response optimization method provided in the embodiment of the present application is designed using the particularity of the game application, so the electronic device first needs to identify the scene of the game application.
[0157] In one possible implementation, the electronic device can identify whether the first application is a preset game application by obtaining the identification information of the running first application. Exemplarily, the identification information of an application can be, for example, the package name of the application or the universally unique identifier (UUID) of the application. It is understandable that the embodiment of the present application does not limit the identification information of the application, and the introduction here is only an example.
[0158] Exemplarily, the electronic device can obtain the identification information of the running first application through the application activity management service AMS. For the convenience of subsequent description, the identification information of the first application is referred to as target identification information. After the electronic device obtains the target identification information, it can compare the target identification information with the preset application identification information to know whether the target identification information belongs to the preset application identification information.
[0159] Exemplarily, the preset application identification information may be, for example, a preset game application whitelist. The preset game application whitelist may include identification information of one or more preset game applications. The game applications in the whitelist may optimize the input response delay by the input response optimization method provided in the embodiment of the present application. For example, assuming that the above-mentioned target identification information is the package name of the first application, the preset game application whitelist includes the package names of one or more preset game applications. Then, the package name of the first application can be compared with the preset game application whitelist. If the package name of the first application is not on the preset game application whitelist, the first application does not belong to the preset game application. If the package name of the first application is on the preset game application whitelist, it can be known that the first application belongs to the preset game application.
[0160] Exemplarily, the preset application identification information may be present in a configuration file. The configuration file may be, for example, a configuration file implemented based on an extensible markup language (XML), referred to as an XML configuration file. The electronic device may obtain the preset application identification information by obtaining the configuration file. The configuration file may be, for example, pre-stored in the electronic device, or may be downloaded from a corresponding server, etc., which is not limited in the embodiments of the present application.
[0161] S502: The electronic device indicates to adopt a direct delivery method based on the above identification result.
[0162] For example, in a specific implementation, since other applications other than game applications do not have the particularity of game applications, that is, there is no game engine rendering the screen display in real time. Therefore, the electronic device retains a method of distributing input events based on VSync signals (referred to as VSync distribution method) for distributing input events corresponding to other applications other than game applications. The VSync distribution method can be exemplified in the aforementioned Figure 1B The relevant introduction of the present invention will not be repeated here. On this basis, the embodiment of the present application also adds a direct distribution method for distributing input events corresponding to the preset game application. The direct distribution method refers to a method in which rendering can be distributed after receiving the input event without waiting for the arrival of the VSync signal, that is, the direct distribution method is an input event distribution method independent of the vertical synchronization signal frequency limit. For example, see the aforementioned Figure 4 The relevant introduction will not be repeated here.
[0163] Based on the above description, after the electronic device recognizes that the first application is a preset game application, it can instruct to use a direct distribution method to implement the distribution of the input event of the first application.
[0164] S503: The electronic device distributes the input event based on a direct distribution method.
[0165] Exemplarily, in a specific implementation, after the electronic device indicates that a direct distribution method is used to implement the distribution of the input events of the above-mentioned first application, the input events corresponding to the first application can be distributed through the direct distribution method. For example, if the electronic device receives an input event corresponding to the first application, for example, when the electronic device displays the user interface of the first application, the user interface can receive a touch operation from the user to generate an input event input. Then, there is no need to cache the input event, and there is no need to wait for the arrival of the VSync signal. Instead, the input event can be distributed to the game engine for corresponding rendering and display after receiving it.
[0166] In order to better understand the embodiments of the present application, please refer to Figure 6 Flow chart shown. Exemplarily, after the electronic device starts running the first application, it can determine whether the first application is a preset game application. If so, the input event is distributed in a direct distribution manner. If not, the input event is distributed in a VSync distribution manner. For specific implementation, please refer to the relevant introduction of the aforementioned steps S501 to S503, which will not be repeated here.
[0167] In a possible implementation, after indicating the input event distribution method used by the first application, the information of the input event distribution method used by the first application can be saved, so that when the first application is run again next time, there is no need to determine the input event distribution method used by the first application again. Exemplarily, the electronic device can associate the identification information of the first application with the identification information indicating the input event distribution method used by the first application and save it, so that the corresponding input event distribution method can be queried through the identification information of the first application.
[0168] Exemplarily, based on the above description, when the electronic device switches the first application running in the foreground to the background, and then switches from the background to the foreground, or when the electronic device is not running the first application for the first time, the electronic device can first query the input event distribution method used by the first application. If the input event distribution method is found to be the VSync distribution method or the direct distribution method, the input event is distributed according to the corresponding distribution method. If no result is found, the input event distribution method used by the first application is indicated according to the description of the above steps S501 and S502.
[0169] This implementation can reduce the computational overhead of re-indicating the distribution method each time the application is run, thereby optimizing system performance.
[0170] Based on the above description, it can be seen that the direct distribution method skips or blocks the cache mechanism and VSync signal trigger mechanism of the VSync distribution method, so that the distribution frequency of input events is increased, and input events can be distributed faster, so that responses can be made based on input events faster, reducing input response delays.
[0171] In a possible implementation, after the electronic device identifies that the first application is a preset game application, before indicating that the input event distribution method is a direct distribution method based on the identification result, it can also obtain the target frame rate of the first game application and the TP reporting rate.
[0172] Exemplarily, the target frame rate is the expected frame rate of the first application, or the actual output frame rate of the first application. The frame rate is the number of frames per second (FPS). Exemplarily, the electronic device can obtain the target frame rate of the first application through the display management service DMS in the application framework layer.
[0173] In addition, after the electronic device recognizes the first application, it can also obtain the current TP reporting rate of the electronic device. For example, the electronic device can obtain the TP reporting rate through the input management service IMS in the system library.
[0174] After obtaining the above target frame rate and TP reporting rate, the electronic device can determine whether the TP reporting rate is an integer multiple of the target frame rate. If so, it indicates that the input event distribution mode is a direct distribution mode. If not, it can indicate that the input event distribution mode is a VSync distribution mode.
[0175] In this implementation, when the TP reporting rate is an integer multiple of the target frame rate, the input event corresponding to the first application is distributed in a direct distribution manner, thereby reducing the risk of unstable input response caused by the mismatch between the TP reporting rate and the frame rate of the game. For ease of understanding, further exemplary description is given below.
[0176] For example, if the TP reporting rate is not an integer multiple of the target frame rate, the number of input events received between different frames will vary greatly, which will lead to uneven dynamic changes of objects between frames. Figure 4 For example, if the TP reporting rate is not an integer multiple of the target frame rate, then when displaying game frame 2, two touch events are received and the two events are responded to in game frame 3. The two touch events, for example, indicate the movement of an object. When displaying game frame 3, five touch events indicating the movement of the object may be received and the five events may be responded to in game frame 4 ( Figure 4 This will cause the object to move slowly in game frame 3 and quickly in game frame 4, resulting in an unstable and unsmooth movement.
[0177] If the TP reporting rate is an integer multiple of the target frame rate, the difference in the number of input events received between different frames is small or even the same, making the dynamic changes of objects from frame to frame smooth and stable. Figure 4 For example, if the TP reporting rate is an integer multiple of the target frame rate, then when displaying game frame 2, two touch events are received and the two events are responded to in game frame 3. Similarly, the two touch events are, for example, instructions to move an object. When displaying game frame 3, two touch events indicating the movement of the object are also received and the two events are responded to in game frame 4 ( Figure 4 Then, the moving speed of the object in game frame 3 and in game frame 4 remains unchanged, so that the object can move smoothly and stably. That is, the risk of unstable input response caused by the mismatch between the TP reporting rate and the game frame rate is reduced.
[0178] In another possible implementation, if the input event distribution method is indicated as a direct distribution method, the TP reporting rate obtained above must also meet a preset upper limit threshold. That is, if the TP reporting rate is less than or equal to the threshold, and the TP reporting rate is an integer multiple of the above target frame rate, then the input event distribution method can be indicated as a direct distribution method. If the TP reporting rate is greater than the threshold, the VSync distribution method is still used to distribute input events. This implementation can prevent the risk of excessive power consumption. Since the direct distribution method distributes an input event for each input event received, the frequency of distribution increases, and the corresponding power consumption increases. If the TP reporting rate is greater than the threshold, it indicates that the input events received may also increase significantly. In this case, if the direct distribution method is adopted, it may cause excessive power consumption and affect the overall system performance of the electronic device. Therefore, in this implementation, if the TP reporting rate is greater than the threshold, it is indicated that the VSync distribution method is used to distribute input events to prevent the risk of excessive power consumption.
[0179] For example, in order to facilitate understanding of the implementation process of the above implementation, it can be seen that Figure 7 and Figure 8 . Figure 7 The flow of data in the software module during the implementation of the above solution by the electronic device is exemplified. Figure 8 The interactive process between these software modules is shown as an example. Figure 7 and Figure 8 As shown, the embodiment of the present application adds a game application scenario identification module in the game management module and adds an input event distribution switching module in the input consumption module.
[0180] Exemplarily, after the above-mentioned first application is started, the game application scenario identification module can obtain the identification information of the above-mentioned first application from the application activity management service AMS. Then, based on the identification information of the first application, it is identified that the first application belongs to a preset game application. Then, the target frame rate of the above-mentioned first application is obtained from the display management service DMS, and the above-mentioned TP reporting rate is obtained from the input management service IMS. Then, the game application scenario identification module indicates the input event distribution method to be adopted based on the obtained target frame rate and TP reporting rate. And the indication information indicating the input event distribution method to be adopted is sent to the input event distribution switching module in the input consumption module. The input event distribution switching module obtains the input event distribution method to be adopted based on the indication information, and then distributes the input event to the process of the first application according to the input event distribution method adopted by the indication, so that the game engine in the process can respond to the input event for corresponding rendering and display. For a more detailed implementation description, please refer to the above introduction, which will not be repeated here. It can be understood that Figure 7 and Figure 8What is shown is only an example and does not constitute a limitation to the embodiments of the present application.
[0181] In a possible implementation, the input event distribution switching module can obtain the indication information of the input event distribution method adopted by the game management module through the state callback. Fig. 9 . The electronic device starts the first application and runs the process of the first application. Then, the first application process registers a state callback function with the game management process. The game management process can call the above-mentioned game management module to perform the corresponding operation. Exemplarily, the first application process can, for example, call the callback registration module native to the electronic device system to realize the registration of the state callback function. Then, the game management process receives the identification information of the first application / the target frame rate / TP reporting rate of the first application and other information from the application activity management service AMS / display management service DMS / input management service IMS. The game management process calls the above-mentioned game application scene recognition module to indicate the input event distribution method adopted based on the identification information of the first application, the target frame rate and the TP reporting rate of the first application. Then, the game management process calls the callback function to return the indication information indicating the input event distribution method adopted to the first application process. The process of the first application calls the above-mentioned input event distribution switching module to indicate the input event distribution method adopted based on the indication information, and distributes input events based on the distribution method.
[0182] In a possible implementation, the operations of registering the above-mentioned state callback function, receiving the above-mentioned callback indication information, and calling the above-mentioned input event distribution switching module to implement the distribution of input events can be performed by the input event consumer thread in the first application process. In a possible implementation, the first application process includes multiple input event consumer threads. For example, when the user interface of the first application is displayed, in the scenario where a prompt box such as a message notification or prompt is also displayed, the user interface corresponds to an input event consumer thread, and the prompt box can also correspond to an input event consumer thread. Each of the multiple input event consumer threads can call the above-mentioned input event distribution switching module to distribute input events. Then, the multiple input event consumer threads can reuse the same state callback function. That is, the indication information indicating the input event distribution method adopted by the above-mentioned game management process calling the callback function to return to the first application process can be shared by the multiple input event consumer threads. Thereby, the overhead of multiple registrations of the callback function can be reduced.
[0183] In a possible implementation, after the electronic device identifies the first application as the preset game application, the first application process registers the state callback function with the game management process. Exemplarily, after the electronic device starts the first application and runs the process of the first application, it can first identify whether the first application is a preset game application through the game management module. The specific implementation can refer to the corresponding introduction above, which is not repeated here. Then, the first application process can query the game management module whether the first application is a preset game application. If the first application belongs to the preset game application, then the first application process can register the state callback function with the game management process and perform subsequent operations such as listening to the input event distribution method. If the first application does not belong to the preset game application, then the first application process does not register the state callback function with the game management process, nor does it perform subsequent operations such as listening to the input event distribution method. This implementation method can avoid the registration and notification of a large number of irrelevant applications in the system, thereby reducing resource occupation.
[0184] In summary, in the input response optimization method provided by the embodiment of the present application, the application process of the game application can directly distribute input events to the game engine for rendering without waiting for the arrival of the VSync signal. This achieves a fast response to input events and reduces input response latency. Fig.10 and Fig.11 .
[0185] first, Fig.10 Examples (a) and (b) in FIG. 1 show schematic diagrams of triggering input event distribution based on VSync signals in two existing implementation schemes. As can be seen, an input event buffer queue can be used to indicate the number of buffered input events. The rising edge or falling edge of the VSync signal can trigger the distribution of input events. For example, in Fig.10 In (a) and (b), time t1 and time t5 are the times when the falling edge of the VSync signal arrives, and time t3 is the time when the rising edge of the VSync signal arrives.
[0186] Exemplarily, before the falling edge of the VSync signal arrives at time t1, the input events in the input event cache queue continue to accumulate. Then, at time t1, the falling edge of the VSync signal arrives, and the input events are distributed based on the trigger of the falling edge. Since there is a certain delay in the distribution process, you can see that the input events in the input event cache queue are reduced at time t2. After this distribution is completed, the input events in the input event cache queue begin to accumulate again. Then, at time t3, the rising edge of the VSync signal arrives, and the input events are distributed based on the trigger of the rising edge. Since there is a certain delay in the distribution process, you can see that the input events in the input event cache queue are reduced at time t4. The description of times t5 and t6 refers to times t1 and t2, and will not be repeated. It can be seen that in the existing implementation scheme, due to the limitation of the VSync frequency, input events accumulate and cannot be distributed in time.
[0187] For example, see Fig.11 . Fig.11 A schematic diagram of distributing input events by direct distribution in an embodiment of the present application is shown. It can be seen that the number of cached input events can also be indicated by an input event cache queue. The difference is that in the implementation process of distributing input events by direct distribution, each input event received can be distributed, without being restricted by the VSync signal, so that input events will not accumulate. This achieves a fast response to input events and reduces input response latency.
[0188] It is understandable that the above Fig.10 and Fig.11 What is shown is only an example and does not constitute a limitation to the embodiments of the present application.
[0189] An embodiment of the present application also provides an electronic device, which includes one or more processors and one or more memories; wherein the one or more memories are coupled to the one or more processors, and the one or more memories are used to store computer program codes, and the computer program codes include computer instructions, and when the one or more processors execute the computer instructions, the electronic device executes the method described in the above embodiment.
[0190] An embodiment of the present application also provides a chip system, which is applied to an electronic device. The chip system includes one or more processors, and the processor is used to call computer instructions so that the electronic device executes the method described in the above embodiment.
[0191] The embodiments of the present application also provide a computer program product including instructions. When the computer program product is executed on an electronic device, the electronic device executes the method described in the above embodiments.
[0192] An embodiment of the present application also provides a computer-readable storage medium, including instructions, which, when executed on an electronic device, enable the electronic device to execute the method described in the above embodiment.
[0193] It can be understood that the various embodiments of the present application can be combined arbitrarily to achieve different technical effects.
[0194] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in this application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integration. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk), etc.
[0195] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by computer programs to instruct related hardware, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the above-mentioned method embodiments. The aforementioned storage medium includes: ROM or random access memory RAM, magnetic disk or optical disk and other media that can store program codes.
[0196] In short, the above description is only an embodiment of the technical solution of the present invention, and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made according to the disclosure of the present invention shall be included in the protection scope of the present invention.
Claims
1. An input response optimization method, characterized in that: The method is applied to an electronic device, and the method comprises: Detecting a first input event of a user on a first interface, where the first interface is an interface of a first application; When the first application is a preset game application, before a rising edge or a falling edge of a vertical synchronization signal occurs, the first input event is distributed; and a picture is rendered in response to the first input event; Detecting a second input event of the user on a second interface, where the second interface is an interface of a second application; When the second application does not belong to the preset game application, after the rising edge or the falling edge of the vertical synchronization signal occurs, the second input event is distributed, and a picture is rendered in response to the second input event.
2. The method according to claim 1, characterized in that said distributing said first input event; And rendering a picture in response to the first input event includes: The first input event is distributed to a game engine; and a picture is rendered by the game engine in response to the first input event.
3. The method according to claim 1 or 2, characterized in that: Before detecting a first input event of a user on the first interface, the method further includes: Obtaining identification information of the first application; Based on the identification information of the first application, it is known that the first application belongs to the preset game application.
4. The method according to claim 3, characterized in that The first input event includes a touch event; after the first application is learned based on the identification information of the first application that the first application is a game application in a preset whitelist, the method further includes: Obtaining a frame rate of the first application and a TP reporting rate of a touch screen of the electronic device; When the TP reporting rate is an integer multiple of the frame rate, it indicates that a direct distribution method is adopted; the direct distribution method is an input event distribution method independent of the frequency limit of the vertical synchronization signal.
5. The method according to claim 4, characterized in that The TP reporting rate is less than or equal to a preset threshold.
6. The method according to claim 4 or 5, characterized in that: After the direct distribution method is adopted, the instructions also include: Notifying the process of the first application of indication information of adopting the direct distribution method through a status callback; The step of distributing the first input event to the game engine before the rising edge or the falling edge of the vertical synchronization signal occurs comprises: Before a rising edge or a falling edge of the vertical synchronization signal occurs, the first input event is distributed to the game engine through the process of the first application.
7. The method according to any one of claims 3 to 6, characterized in that: After the first application is learned, based on the identification information of the first application, that the first application is a game application in a preset whitelist, the method further includes: A status callback function is registered; the status callback function is used to notify the process of the first application of indication information of the input event distribution method used.
8. The method according to claim 7, characterized in that The first application process includes a plurality of input event consumption threads, and the plurality of input event consumption threads are used to jointly execute the distribution of input events acting on the first application; The multiple input event consumption threads share the indication information of the adopted input event distribution mode.
9. The method according to any one of claims 4 to 8, characterized in that: After the indication adopts the direct distribution method, the method further includes: associating and saving the identification information of the first application and the identification information of the direct distribution method; The method further comprises: Exiting the first application; When the first application is run again, querying the input event distribution method adopted by the first application based on the identification information of the first application to obtain the identification information of the direct distribution method; The input event for the first application is distributed using the direct distribution method based on an indication of the identification information of the direct distribution method.
10. The method according to any one of claims 3 to 9, characterized in that: The step of obtaining, based on the identification information of the first application, that the first application belongs to the preset game application includes: Comparing the identification information of the first application with the identification information of applications included in a preset whitelist; the preset whitelist includes the identification information of the preset game application; When the preset whitelist includes the identification information of the first application, it is known that the first application belongs to the preset game application.
11. The method according to claim 10, characterized in that The preset whitelist is stored in a configuration file.
12. The method according to any one of claims 1 to 11, characterized in that: The distributing the second input event and rendering a picture in response to the second input event includes: The second input event is distributed to a native rendering module of the electronic device; and a picture is rendered by the rendering module in response to the second input event.
13. An electronic device, characterized in that: include: A touch screen, one or more processors, and one or more memories; the one or more processors are coupled to the touch screen and the one or more memories; the one or more memories are used to store computer program codes, the computer program codes include computer instructions, and when the one or more processors execute the computer instructions, the electronic device executes the method as described in any one of claims 1-12.
14. A computer-readable storage medium comprising instructions, characterized in that: When the instructions are executed on an electronic device, the electronic device is caused to execute the method as claimed in any one of claims 1 to 12.
15. A computer program product comprising instructions, characterized in that When the computer program product is executed on an electronic device, the electronic device is enabled to execute the method according to any one of claims 1 to 12.
Citation Information
Cited By
Input response optimization method and related electronic device
EP4592839A1
Input response optimization method and related electronic device
WO2025001232A1
