Method and device for responding to peripheral messages, storage medium, and electronic device

By prohibiting vertical synchronization and simulating vertical synchronization in the rendering process of the game client, the problem of peripheral message delay is solved, real-time response to peripheral messages and preventing screen tear, saving hardware costs.

CN112328452BActive Publication Date: 2025-08-26BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011231216.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-06
Publication Date
2025-08-26
Estimated Expiration
2040-11-06

AI Technical Summary

Technical Problem

In the prior art, vertical synchronization causes the problem of peripheral message delay, and the method to solve this problem requires replacing a high refresh rate display, resulting in waste of resources.

Method used

By monitoring the picture rendering process of the game client, after the rendering data is submitted to the video memory, the target rendering submission function is called, vertical synchronization is prohibited, and peripheral messages are responded to peripheral messages during its rendering cycle, simulating vertical synchronization to obtain peripheral messages.

Benefits of technology

Without increasing hardware costs, real-time response of peripheral messages is achieved to prevent screen tear, reduce delay and save video code rate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112328452B_ABST
    Figure CN112328452B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and device for responding to peripheral messages, a storage medium, and an electronic device, and belongs to the field of computer technology. The method comprises: monitoring the screen rendering process of a game client; after the screen rendering process submits the rendering data to the video memory, calling a target rendering submission function according to the screen rendering process, wherein the target rendering submission function prohibits the execution of vertical synchronization; and responding to the peripheral messages of the game client within the rendering cycle of the target rendering submission function. The present invention solves the technical problem that the related art can only reduce the peripheral message delay by increasing the display refresh rate, saves the video bit rate, and achieves both locking the game FPS upper limit and preventing screen tearing, and responding to peripheral messages in real time, thereby reducing the delay of peripheral messages.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computers, and in particular to a method and device for responding to a peripheral message, a storage medium, and an electronic device. Background Art

[0002] In related technologies, game interactions require synchronization of screen flow and operation, which involves parameters such as FPS (Frames Per Second), screen tearing, and vertical synchronization (VSYNC). FPS stands for frames per second, which refers to the number of times a game refreshes the screen in one second. If a game requires displaying fast-moving objects, a high FPS is required to render the image; otherwise, players will experience a choppy display. Screen tearing occurs when the game's FPS exceeds the monitor's refresh rate. This can cause the previous frame to be displayed before the next one is finished. As a result, in a single monitor refresh, the top half of the screen may be the previous frame, while the bottom half is the next. This phenomenon of the top and bottom half being incomplete is called screen tearing. To prevent screen tearing, vertical synchronization was developed. It synchronizes the game's screen submission with the monitor's refresh rate. It locks the game's FPS to a value not exceeding the monitor's refresh rate, preventing high-speed motion games from experiencing screen tearing.

[0003] In the related technology, screen rendering and obtaining peripheral messages are implemented in one thread, and peripheral messages and rendering data are processed simultaneously in the thread. In a rendering cycle, after the thread submits rendering data to the video memory, it needs to wait until the next cycle to process the peripheral messages. Therefore, turning on vertical synchronization will cause the peripheral messages to fail to return in time, resulting in the peripheral messages not being obtained and processed in time. While vertical synchronization solves the problem of screen tearing, it also brings about the delay in processing peripheral messages. This problem can be alleviated by setting a high refresh rate display. Players are advised to purchase high refresh rate displays to reduce the interval time between two refreshes of the display, so that they can return from the rendering process more quickly. However, high refresh rate displays are generally expensive, and existing displays need to be eliminated, resulting in a waste of resources.

[0004] Currently, no effective solution has been found for the above-mentioned problems existing in the related technologies. Summary of the Invention

[0005] The embodiments of the present invention provide a method and device for responding to a peripheral device message, a storage medium, and an electronic device.

[0006] According to one aspect of an embodiment of the present application, a method for responding to peripheral messages is provided, including: monitoring a screen rendering process of a game client; after the screen rendering process submits rendering data to a video memory, calling a target rendering submission function according to the screen rendering process, wherein the target rendering submission function prohibits vertical synchronization; and responding to peripheral messages of the game client within a rendering cycle of the target rendering submission function.

[0007] Further, calling the target rendering submission function according to the screen rendering process includes: if the original rendering submission function of the screen rendering process is monitored, calling a preset hook function; accessing the synchronization parameters of the original rendering submission function through the preset hook function, wherein the synchronization parameters are used to indicate whether the game client has enabled vertical synchronization; setting the original rendering submission function as the target rendering submission function based on the synchronization parameters; and executing the target rendering submission function.

[0008] Furthermore, setting the original rendering submission function as the target rendering submission function based on the synchronization parameter includes: setting the synchronization parameter to a first state value, wherein the first state value is used to instruct the game client to prohibit vertical synchronization; and using the first state value to reconfigure the synchronization parameter of the original rendering submission function to obtain the target rendering submission function.

[0009] Furthermore, before setting the original rendering submission function as the target rendering submission function based on the synchronization parameter, the method also includes: obtaining the status value of the synchronization parameter; judging whether the status value is a second status value, wherein the second status value is used to indicate that the game client allows vertical synchronization to be executed; if the status value is the second status value, determining to execute the setting of the original rendering submission function as the target rendering submission function based on the synchronization parameter.

[0010] Furthermore, responding to the peripheral message of the game client within the rendering cycle of the target rendering submission function includes: obtaining the display refresh time of the game client in the current rendering cycle; judging whether the current time reaches the preset time before the display refresh time; if the current time does not reach the preset time, responding to the peripheral message of the game client until the current time reaches the preset time.

[0011] Furthermore, responding to the peripheral message of the game client within the rendering cycle of the target rendering submission function includes: obtaining the display refresh time of the game client in the current rendering cycle; calculating the interval between the current time and the display refresh time; and responding to the peripheral message of the game client within the interval.

[0012] Furthermore, responding to the peripheral message of the game client includes: collecting the peripheral message of the game client; submitting the peripheral message to the game main thread, wherein the game main thread runs on the game client.

[0013] Furthermore, after responding to the peripheral message of the game client within the rendering cycle of the target rendering submission function, the method also includes: after the response time ends, returning the target rendering submission function to the main thread of the game.

[0014] According to another aspect of an embodiment of the present application, a device for responding to peripheral messages is also provided, including: a monitoring module for monitoring the screen rendering process of a game client; a calling module for calling a target rendering submission function according to the screen rendering process after the screen rendering process submits rendering data to the video memory, wherein the target rendering submission function prohibits vertical synchronization; and a response module for responding to the peripheral messages of the game client within the rendering cycle of the target rendering submission function.

[0015] Furthermore, the calling module includes: a calling unit, which is used to call a preset hook function if the original rendering submission function of the screen rendering process is monitored; an access unit, which is used to access the synchronization parameters of the original rendering submission function through the preset hook function, wherein the synchronization parameters are used to indicate whether the game client has enabled vertical synchronization; a setting unit, which is used to set the original rendering submission function as the target rendering submission function based on the synchronization parameters; and an execution unit, which is used to execute the target rendering submission function.

[0016] Furthermore, the setting unit includes: a setting subunit, used to set the synchronization parameter to a first state value, wherein the first state value is used to instruct the game client to prohibit vertical synchronization; a configuration subunit, used to use the first state value to reconfigure the synchronization parameter of the original rendering submission function to obtain the target rendering submission function.

[0017] Furthermore, the calling module also includes: an acquisition unit, used to obtain the status value of the synchronization parameter before the setting unit sets the original rendering submission function as the target rendering submission function based on the synchronization parameter; a judgment unit, used to judge whether the status value is a second status value, wherein the second status value is used to indicate that the game client allows vertical synchronization to be executed; a setting unit, used to set the original rendering submission function to the target rendering submission function based on the synchronization parameter if the status value is the second status value.

[0018] Furthermore, the response module includes: a first acquisition unit, used to obtain the display refresh time of the game client in the current rendering cycle; a judgment unit, used to judge whether the current time reaches the preset time before the display refresh time; a first response unit, used to respond to the peripheral message of the game client if the current time does not reach the preset time until the current time reaches the preset time.

[0019] Furthermore, the response module includes: a second acquisition unit, used to obtain the display refresh time of the game client in the current rendering cycle; a calculation unit, used to calculate the interval between the current time and the display refresh time; and a second response unit, used to respond to the peripheral message of the game client within the interval.

[0020] Furthermore, when responding to the peripheral message of the game client, the first response unit or the second response unit is specifically used to: collect the peripheral message of the game client; submit the peripheral message to the game main thread, wherein the game main thread runs on the game client.

[0021] Furthermore, the device also includes: a calling module, which is used to return the target rendering submission function to the game main thread after the response module responds to the peripheral message of the game client within the rendering cycle of the target rendering submission function and after the response time ends.

[0022] According to another aspect of an embodiment of the present application, a storage medium is further provided, which includes a stored program, and the above steps are executed when the program is run.

[0023] According to another aspect of an embodiment of the present application, an electronic device is also provided, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; wherein: the memory is used to store computer programs; the processor is used to execute the steps in the above method by running the program stored in the memory.

[0024] An embodiment of the present application also provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the steps in the above method.

[0025] Through the present invention, the screen rendering process of the game client is monitored, and after the screen rendering process submits the rendering data to the video memory, the target rendering submission function is called according to the screen rendering process, and the peripheral messages of the game client are responded to within the rendering cycle of the target rendering submission function. The vertical synchronization is simulated by the target rendering submission function, and the peripheral messages are obtained within the rendering cycle of the vertical synchronization. This solves the technical problem that the related art can only reduce the peripheral message delay by increasing the display refresh rate, saves the video bit rate, and achieves the goals of locking the game FPS upper limit and preventing screen tearing, while responding to peripheral messages in real time and reducing the delay of peripheral messages. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0027] Figure 1 This is a hardware structure block diagram of a computer according to an embodiment of the present invention;

[0028] Figure 2 is a flow chart of a method for responding to a peripheral device message according to an embodiment of the present invention;

[0029] Figure 3 This is a diagram showing the effects of turning vertical synchronization on and off according to an embodiment of the present invention;

[0030] Figure 4 Schematic diagram of the time window of the rendering cycle in an embodiment of the present invention;

[0031] Figure 5 is an implementation flow chart of an embodiment of the present invention;

[0032] Figure 6 This is a structural block diagram of a device for responding to a peripheral message according to an embodiment of the present invention;

[0033] Figure 7 It is a structural block diagram of an electronic device implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0034] In order to enable those skilled in the art to better understand the present application, 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 embodiments of a part of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work should fall within the scope of protection of this application. It should be noted that, in the absence of conflict, the embodiments in the present application and the features in the embodiments can be combined with each other.

[0035] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0036] Example 1

[0037] The method embodiment provided in the first embodiment of the present application can be executed in a server, computer, game terminal, mobile phone, tablet or similar computing device. Taking running on a computer as an example, Figure 1 This is a hardware structure diagram of a computer according to an embodiment of the present invention. Figure 1 As shown, the computer 10 may include one or more ( Figure 1 Only one is shown in the figure) processor 102 (processor 102 may include but is not limited to a microprocessor MCU or a programmable logic device FPGA and other processing devices) and a memory 104 for storing data. Optionally, the above computer may also include a transmission device 106 and an input and output device 108 for communication functions. It will be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above-mentioned computer. For example, the computer 10 may also include Figure 1 More or fewer components than shown, or with Figure 1 Different configurations shown.

[0038] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as a computer program corresponding to a method for responding to a peripheral message in an embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, implementing the above-mentioned method. The memory 104 may include a high-speed random access memory and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely located relative to the processor 102, and these remote memories may be connected to the computer 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0039] Transmission device 106 is used to receive or send data via a network. A specific example of the aforementioned network may include a wireless network provided by the communications provider of computer 10. In one embodiment, transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0040] In this embodiment, a method for responding to a peripheral message is provided. Figure 2 FIG. 1 is a flow chart of a method for responding to a peripheral message according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:

[0041] Step S202, monitoring the screen rendering process of the game client;

[0042] The screen rendering process of this embodiment is used to submit rendering data to the video memory according to the rendering cycle to achieve dynamic refresh of the game screen, and synchronously respond to peripheral messages when submitting rendering data. When vertical synchronization is turned on in the game client, only one peripheral message can be responded to within a rendering cycle.

[0043] Step S204: after the screen rendering process submits the rendering data to the video memory, calling the target rendering submission function according to the screen rendering process, wherein the target rendering submission function prohibits vertical synchronization;

[0044] Optionally, the target rendering submission function may be called directly in the screen rendering process, or the original rendering submission function of the screen rendering process may be replaced by a hook function or the like, and then the replaced target rendering submission function may be executed.

[0045] Step S206: respond to the peripheral message of the game client within the rendering cycle of the target rendering submission function.

[0046] The peripheral message in this embodiment refers to a notification message generated by an external input device of the game client, such as a mouse, keyboard, controller, touch screen, etc., which is used to achieve human-computer interaction.

[0047] Since the currently running render submission function doesn't have vertical synchronization enabled, it can jump out of the current thread to process peripheral messages from the game client. Since the rendering data has already been submitted during the current rendering cycle, it does not affect normal screen rendering. Because screen rendering and peripheral message processing are in the same thread, the rendering cycle is the refresh cycle of the game client display.

[0048] Through the above steps, the screen rendering process of the game client is monitored. After the screen rendering process submits the rendering data to the video memory, the target rendering submission function is called according to the screen rendering process. The peripheral messages of the game client are responded to within the rendering cycle of the target rendering submission function. Vertical synchronization is simulated through the target rendering submission function, and peripheral messages are obtained within the rendering cycle of vertical synchronization. This solves the technical problem that related technologies can only reduce the peripheral message delay by increasing the display refresh rate, saves the video bit rate, and achieves both locking the game FPS upper limit and preventing screen tearing, and responding to peripheral messages in real time, reducing the delay of peripheral messages.

[0049] The solution of this embodiment can be applied in various scenarios, including Scenario 1: with game developers, directly use the target rendering submission function in the game main thread. Scenario 2: for an already developed game, after running the game main thread, hook the original rendering submission function and let the game use the target rendering submission function.

[0050] In one implementation of scenario 2 of this embodiment, calling the target rendering submission function according to the screen rendering process includes:

[0051] S11, if the original rendering submission function of the screen rendering process is detected, calling a preset hook function;

[0052] The preset hook function (Hook Function) of this embodiment is pre-hooked with the rendering submission function (Present) of the game main thread. Online game applications can set up subroutines on it to monitor certain events or processes in a specified window. When the monitored object arrives, it is processed before the target window processing function. The hook mechanism allows the application to intercept the processing process function or specific events. The preset hook function of this embodiment is a program segment of the processing process, which is hooked into the system through a system call. Whenever a screen rendering process appears, before it reaches the target window, the hook program first captures the screen rendering process, that is, the hook function first obtains control. At this time, the hook function can process (change) the screen rendering process and set the original rendering submission function as the target rendering submission function.

[0053] Since the preset hook function is pre-hooked with the original rendering submission function of the screen rendering process, when the original rendering submission function of the screen rendering process is monitored, the preset hook function can be triggered to be called. The preset hook function obtains control authority and can further process the original rendering submission function.

[0054] S12, accessing the synchronization parameters of the original rendering submission function through a preset hook function, wherein the synchronization parameters are used to indicate whether vertical synchronization is enabled on the game client;

[0055] In this embodiment, the synchronization parameter of the original rendering submission function can be assigned a first state value and a second state value. Normally, the default is the second state value, that is, vertical synchronization is turned on. In this case, if the original rendering submission function is run normally, the main thread of the game needs to wait until the current rendering cycle ends before processing other sub-threads or events, such as responding to peripheral messages.

[0056] S13, setting the original rendering submission function as the target rendering submission function based on the synchronization parameter;

[0057] In one example, setting the original rendering submission function to the target rendering submission function based on the synchronization parameter includes: setting the synchronization parameter to a first state value, wherein the first state value is used to instruct the game client to prohibit vertical synchronization; using the first state value to reconfigure the synchronization parameter of the original rendering submission function to obtain the target rendering submission function, wherein the difference between the original rendering submission function and the target rendering submission function is that the state value of the synchronization parameter is different.

[0058] By adopting Hook technology, the original process of the game calling the original rendering submission function is replaced with the target rendering submission function. The hook changes the Present function and jumps to the target rendering submission function after adding it at the beginning. Because the game originally calls the original rendering submission function, by hooking the original rendering submission function, the vertical synchronization is turned off, and then the peripheral messages are obtained during the rendering cycle of simulated vertical synchronization, which reduces the delay of peripheral messages while preventing screen tearing.

[0059] Figure 3 This is a diagram showing the effects of turning vertical synchronization on and off in an embodiment of the present invention. When vertical synchronization is on, after the original rendering submission function submits data to the video memory, it needs to wait until the next display refresh in order to synchronize with the refresh time of the display. During the waiting period, the main game thread cannot process other events. After turning vertical synchronization off, the main game thread can process other events during the waiting period, such as responding to and processing peripheral messages.

[0060] By using a preset hook function to configure the synchronization parameters of the rendering submission function and setting vertical synchronization to be prohibited, the waiting time of the rendering submission function can be changed, and the process of responding to peripheral messages replaces the waiting time of vertical synchronization, which can reduce interaction delays and freezes.

[0061] In other embodiments, before setting the original rendering submission function as the target rendering submission function based on the synchronization parameter, it also includes: obtaining the status value of the synchronization parameter; judging whether the status value is a second status value, wherein the second status value is used to indicate that the game client allows vertical synchronization to be executed; if the status value is the second status value, determining to set the original rendering submission function as the target rendering submission function based on the synchronization parameter.

[0062] S14, executing the target rendering submission function.

[0063] In one implementation of this embodiment, responding to the peripheral message of the game client within the rendering cycle of the target rendering submission function includes: obtaining the display refresh time of the game client in the current rendering cycle; determining whether the current time reaches the preset time before the display refresh time; if the current time does not reach the preset time, responding to the peripheral message of the game client until the current time reaches the preset time.

[0064] Optionally, based on the above embodiment, before determining whether the current time reaches the preset time before the display refresh time, it also includes: setting the preset time. On the one hand, the preset time is set to a constant, such as 1ms, 2ms, etc. On the other hand, the preset time can be set based on the cycle length of the rendering cycle, such as preset time = cycle length * 1 / n, such as 1 / 10 or 1 / 5 of the cycle length is the preset time, or the preset time is set based on the error range of the synchronization clock, and the preset time is set to the maximum clock error of the synchronization clock. It can also be combined with the cycle length of the rendering cycle and the error range of the synchronization clock, and the larger value between the cycle length * 1 / n and the maximum clock error is taken as the preset time.

[0065] In one example, the game client uses a 60HZ screen. In order to avoid screen tearing, the rendering cycle and the display refresh cycle are the same, and the display refresh cycle is 16ms (1000ms / 60=16.6644ms). Taking the current time as 01ms as an example, at 01ms, the screen rendering process has submitted the rendering data to the video memory, and the refresh time of the previous rendering cycle of the display screen is 00ms. The display refresh time of the current rendering cycle is 16ms. A preset time is set based on the cycle length of the rendering cycle to prevent environmental factors such as time synchronization errors. The preset time is 1ms. Before the 15ms is reached, the response time period is from 01ms to 15ms, and the peripheral messages of the game client can be responded to. Figure 4 Schematic diagram of the time window of the rendering cycle in an embodiment of the present invention.

[0066] In another implementation of this embodiment, responding to the peripheral message of the game client within the rendering cycle of the target rendering submission function includes: obtaining the display refresh time of the game client in the current rendering cycle; calculating the interval between the current time and the display refresh time; and responding to the peripheral message of the game client within the interval.

[0067] This implementation does not set a preset time for the pre-shake. By calculating the interval duration as the response duration of the peripheral message, the number of peripheral messages collected can be further increased and the peripheral message delay can be reduced.

[0068] Based on the above implementation, responding to the peripheral message of the game client includes: collecting the peripheral message of the game client; submitting the peripheral message to the game main thread, wherein the game main thread runs on the game client.

[0069] Optionally, after responding to the peripheral message of the game client within the rendering cycle of the target rendering submission function, it also includes: after the response time ends, returning the target rendering submission function to the main thread of the game.

[0070] Figure 5 This is a flowchart of an implementation of an embodiment of the present invention. In a specific implementation, the process includes:

[0071] Hook the rendering submission function (Present) of the game process;

[0072] Get vertical synchronization information from the system and set a minimum time difference delta, for example delta = 1ms;

[0073] When the game submits the rendering, the hook enters the set new Present function, i.e. MyPresent, and checks whether the parameters of the rendering submission function are enabled for vertical synchronization. If enabled, the vertical synchronization state is changed to off, and then the original Present function is called again (due to the change in the function parameters, it is equivalent to the target rendering submission function in the above embodiment) to prevent the game from enabling vertical synchronization. Therefore, the original Present function will return quickly;

[0074] Use the high-precision timing interface to calculate the interval between the current time point and the next display refresh time. If the interval is greater than delta, enter the loop of obtaining peripheral messages: call the peripheral message obtaining interface and dispatch the message;

[0075] Check whether the current time has reached: the next display refresh time - delta. If it has, return to the main game thread from MyPresent to process the display refresh and screen rendering. Otherwise, repeat the previous step.

[0076] This embodiment replaces the waiting time for vertical synchronization with the time it takes to obtain and process peripheral messages, providing a more cost-effective technical solution that does not require software changes and reduces peripheral latency, saving hardware costs within a usable range. By hooking the rendering submission function, vertical synchronization is disabled, and then simulating vertical synchronization while obtaining peripheral messages, achieving the effect of locking the game's FPS cap and preventing screen tearing without delaying the acquisition of peripheral messages. This embodiment is applicable to scenarios such as gaming platforms, especially gaming platforms in cloud gaming scenarios.

[0077] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present invention.

[0078] Example 2

[0079] In this embodiment, a device for responding to peripheral messages is also provided to implement the above-mentioned embodiments and preferred embodiments. Details already described will not be repeated here. As used below, the term "module" may refer to a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation using hardware, or a combination of software and hardware, is also possible and contemplated.

[0080] Figure 6 is a structural block diagram of a device for responding to a peripheral message according to an embodiment of the present invention, such as Figure 6 As shown, the device includes: a monitoring module 60, a calling module 62, and a response module 64, wherein:

[0081] Monitoring module 60, used to monitor the screen rendering process of the game client;

[0082] A calling module 62 is configured to call a target rendering submission function according to the picture rendering process after the picture rendering process submits the rendering data to the video memory, wherein the target rendering submission function prohibits vertical synchronization;

[0083] The response module 64 is used to respond to the peripheral message of the game client within the rendering cycle of the target rendering submission function.

[0084] Optionally, the calling module includes: a calling unit, used to call a preset hook function if the original rendering submission function of the screen rendering process is monitored; an access unit, used to access the synchronization parameters of the original rendering submission function through the preset hook function, wherein the synchronization parameters are used to indicate whether the game client has enabled vertical synchronization; a setting unit, used to set the original rendering submission function as the target rendering submission function based on the synchronization parameters; and an execution unit, used to execute the target rendering submission function.

[0085] Optionally, the setting unit includes: a setting subunit, used to set the synchronization parameter to a first state value, wherein the first state value is used to instruct the game client to prohibit vertical synchronization; and a configuration subunit, used to use the first state value to reconfigure the synchronization parameter of the original rendering submission function to obtain the target rendering submission function.

[0086] Optionally, the calling module also includes: an acquisition unit, used to obtain the status value of the synchronization parameter before the setting unit sets the original rendering submission function as the target rendering submission function based on the synchronization parameter; a judgment unit, used to judge whether the status value is a second status value, wherein the second status value is used to indicate that the game client allows vertical synchronization; and a setting unit, used to set the original rendering submission function to the target rendering submission function based on the synchronization parameter if the status value is the second status value.

[0087] Optionally, the response module includes: a first acquisition unit, used to obtain the display refresh time of the game client in the current rendering cycle; a judgment unit, used to judge whether the current time reaches the preset time before the display refresh time; and a first response unit, used to respond to the peripheral message of the game client if the current time does not reach the preset time until the current time reaches the preset time.

[0088] Optionally, the response module includes: a second acquisition unit, used to obtain the display refresh time of the game client in the current rendering cycle; a calculation unit, used to calculate the interval between the current time and the display refresh time; and a second response unit, used to respond to the peripheral message of the game client within the interval.

[0089] Optionally, when responding to the peripheral message of the game client, the first response unit or the second response unit is specifically used to: collect the peripheral message of the game client; submit the peripheral message to the game main thread, wherein the game main thread runs on the game client.

[0090] Optionally, the device also includes: a calling module, configured to return the target rendering submission function to the game main thread after the response module responds to the peripheral message of the game client within the rendering cycle of the target rendering submission function and after the response time ends.

[0091] It should be noted that the above modules can be implemented through software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.

[0092] Example 3

[0093] An embodiment of the present invention further provides a storage medium storing a computer program, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.

[0094] Optionally, in this embodiment, the storage medium may be configured to store a computer program for performing the following steps:

[0095] S1, monitors the screen rendering process of the game client;

[0096] S2, after the picture rendering process submits the rendering data to the video memory, calling a target rendering submission function according to the picture rendering process, wherein the target rendering submission function prohibits vertical synchronization;

[0097] S3, responding to the peripheral message of the game client within the rendering cycle of the target rendering submission function.

[0098] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.

[0099] An embodiment of the present invention further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0100] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0101] Optionally, in this embodiment, the processor may be configured to execute the following steps through a computer program:

[0102] S1, monitors the screen rendering process of the game client;

[0103] S2, after the picture rendering process submits the rendering data to the video memory, calling a target rendering submission function according to the picture rendering process, wherein the target rendering submission function prohibits vertical synchronization;

[0104] S3, responding to the peripheral message of the game client within the rendering cycle of the target rendering submission function.

[0105] Optionally, specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.

[0106] Figure 7 FIG. 1 is a block diagram of an electronic device implementing an embodiment of the present invention. Figure 7 As shown, it includes a processor 41 and a memory 42 for storing data, which are connected via a communication bus 44, and also includes a communication interface 43 connected to the communication bus 44 for adaptive connection with other components or external devices.

[0107] The serial numbers of the above embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0108] In the above embodiments of the present application, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0109] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0110] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0111] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0112] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0113] The above is only a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A method for responding to a peripheral message, characterized in that: include: Monitor the screen rendering process of the game client; After the screen rendering process submits the rendering data to the video memory in a vertical synchronization enabled state, calling a target rendering submission function according to the screen rendering process, wherein the target rendering submission function prohibits execution of vertical synchronization; Responding to a peripheral message of the game client within a rendering cycle of the target rendering submission function, wherein the peripheral message is a notification message generated by an external input device of the game client, and is used to implement human-computer interaction; Calling the target rendering submission function according to the screen rendering process includes: If the original rendering submission function of the screen rendering process is detected, the preset hook function is called; Accessing the synchronization parameter of the original rendering submission function through the preset hook function, wherein the synchronization parameter is used to indicate whether the game client has enabled vertical synchronization; Setting the original rendering submission function as a target rendering submission function based on the synchronization parameter; Execute the target rendering submission function.

2. The method according to claim 1, characterized in that Setting the original rendering submission function as the target rendering submission function based on the synchronization parameter includes: Setting the synchronization parameter to a first state value, wherein the first state value is used to instruct the game client to prohibit vertical synchronization; The first state value is used to reconfigure the synchronization parameters of the original rendering submission function to obtain the target rendering submission function.

3. The method according to claim 1, characterized in that Before setting the original rendering submission function as the target rendering submission function based on the synchronization parameter, the method further includes: Obtaining the status value of the synchronization parameter; Determining whether the state value is a second state value, wherein the second state value is used to indicate that the game client allows vertical synchronization; If the state value is the second state value, determining to execute the step of setting the original rendering submission function as the target rendering submission function based on the synchronization parameter.

4. The method according to claim 1, wherein Responding to the peripheral device message of the game client within the rendering cycle of the target rendering submission function includes: Obtaining the display refresh time of the game client in the current rendering cycle; Determine whether the current time reaches the preset time before the display refresh time; If the current time does not reach the preset time, respond to the peripheral message of the game client until the current time reaches the preset time.

5. The method according to claim 1, wherein Responding to the peripheral device message of the game client within the rendering cycle of the target rendering submission function includes: Obtaining the display refresh time of the game client in the current rendering cycle; Calculate the interval between the current time and the display refresh time; Respond to the peripheral device message of the game client within the interval.

6. The method according to claim 4 or 5, characterized in that The peripheral device message responding to the game client includes: Collecting peripheral messages of the game client; Submit the peripheral message to a game main thread, wherein the game main thread runs on the game client.

7. The method according to claim 1, characterized in that After responding to the peripheral device message of the game client within the rendering cycle of the target rendering submission function, the method further includes: After the response time ends, the target rendering submission function is returned to the main game thread.

8. A device for responding to a peripheral message, characterized in that: include: Monitoring module, used to monitor the screen rendering process of the game client; A calling module, configured to call a target rendering submission function according to the picture rendering process after the picture rendering process submits rendering data to the video memory in a vertical synchronization enabled state, wherein the target rendering submission function prohibits execution of vertical synchronization; a response module, configured to respond to a peripheral message of the game client within a rendering cycle of the target rendering submission function, wherein the peripheral message is a notification message generated by an external input device of the game client, and is used to implement human-computer interaction; The calling module includes: a calling unit, which is used to call a preset hook function if the original rendering submission function of the screen rendering process is monitored; an access unit, which is used to access the synchronization parameters of the original rendering submission function through the preset hook function, wherein the synchronization parameters are used to indicate whether the game client has enabled vertical synchronization; a setting unit, which is used to set the original rendering submission function as the target rendering submission function based on the synchronization parameters; and an execution unit, which is used to execute the target rendering submission function.

9. A storage medium, characterized in that: The storage medium includes a stored program, wherein the program executes the method steps of any one of claims 1 to 7 when running.

10. An electronic device comprising a processor, a communication interface, a memory and a communication bus, wherein: The processor, communication interface, and memory communicate with each other via a communication bus; wherein: Memory for storing computer programs; A processor, configured to execute the method steps according to any one of claims 1 to 7 by running a program stored in a memory.

Citation Information

Patent Citations

  • Graphics render matching for displays

    US20130150161A1

  • Reducing video image defects by adjusting frame buffer processes

    US20200135075A1