Method for setting refresh rate, and electronic device
By setting the refresh rate when the cursor is stationary, the problem of users perceiving screen freezes during the refresh rate setting process is solved, and seamless refresh rate adjustment is achieved, improving the user experience.
Patent Information
- Application Number
- PCT/CN2024/085971
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2024-04-03
- Publication Date
- 2025-10-09
AI Technical Summary
During the refresh rate setting process of electronic devices, users can clearly feel the freeze of the screen, resulting in a poor user experience.
The electronic device sets the refresh rate only when the cursor is stationary, avoiding refreshing rate adjustment when the cursor is moving. By setting the refresh rate when the cursor is stationary, the user is ensured to have no perception of the refresh rate adjustment process.
Improves user experience, reduces brief moments of screen freezing, and ensures seamless and smooth refresh rate setting process.
Smart Images

Figure CN2024085971_09102025_PF_FP_ABST
Abstract
Description
Method for setting refresh rate and electronic device Technical Field
[0001] The present application relates to the field of terminal technology, and in particular to a method for setting a refresh rate and an electronic device. Background Art
[0002] To ensure a smooth user experience in different scenarios, electronic devices need to adapt their refresh rates to different applications. For example, for gaming scenarios requiring a higher refresh rate, electronic devices need to set a higher refresh rate to ensure a smoother visual experience and smoother user operations. For file or web page scenarios, a low refresh rate will not affect the user's browsing and operation experience. To save energy, a lower refresh rate can be selected.
[0003] However, during the refresh rate setting process, the screen image of the electronic device jumps, and the user can clearly feel the freeze of the image, resulting in a poor user experience.
[0004] Summary of the Invention
[0005] The embodiments of the present application provide a method for setting a refresh rate and an electronic device. The method allows the user to be unaware of the process of setting the refresh rate, thereby improving the user experience.
[0006] In a first aspect, an embodiment of the present application provides a method for setting a refresh rate, which is applied to an electronic device, comprising: at a first moment, the electronic device displays a first window, at the first moment, the first window is a focus window, the screen refresh rate of the electronic device is a first refresh rate, and a first cursor is displayed in the first window; at a second moment, in response to a first user operation, the electronic device displays a second window, after the second moment, the second window is the focus window, and a second cursor is displayed in the second window; starting from the second moment, after a first time period, the electronic device sets the screen refresh rate to a second refresh rate, wherein, within the first time period, the position of the second cursor is not stationary, and the screen refresh rate is the first refresh rate; after the first time period, the position of the second cursor is stationary.
[0007] Among them, the position of the second cursor is static, which means that the cursor displayed on the screen has not been moved and is stationary, and the window display content does not change relative to the cursor, specifically the case where the mouse is in a changing state in S909 in Figure 9. The position of the second cursor is not static, which means that the cursor is moved, that is, the position coordinates of the cursor or the cursor relative to the display content of the window changes, specifically the case where the mouse is in a static state in S909 in Figure 9. The focus window of the first window and the second window changes, and the first operation can refer to the description of the three cases in Figures 4A to 4D, and is not limited to any one of them. The first refresh rate is not equal to the second refresh rate. In this setting, the first refresh rate is the current refresh rate in Figure 9, and the second refresh rate is the target refresh rate.
[0008] In an embodiment of the present application, the electronic device receives a user operation, the focus window changes, and the refresh rate is set according to the changed second window. During the refresh rate setting process, if the cursor is not stationary, the electronic device does not set the refresh rate, and waits until the cursor is stationary to set the refresh rate. Setting the refresh rate when the cursor is stationary prevents the user from noticing the brief moment when the window freezes while the refresh rate is being set, allowing the refresh rate setting process to be completed seamlessly, improving the user experience during the refresh rate setting process.
[0009] In one possible implementation, the method further includes: after setting the screen refresh rate to the second refresh rate, at a third moment, in response to a second user operation, the electronic device displays the first window, after the third moment, the first window is the focus window, and the first cursor is displayed in the first window; starting from the third moment, within a second time period, the electronic device sets the screen refresh rate to the first refresh rate, within the second time period, the position of the first cursor is stationary, and the duration of the first time period is greater than or equal to the duration of the second time period. In this way, when the cursor is stationary, there is no need to wait and it can be directly set to the first refresh rate, so that the user will not perceive the brief moment when the window screen is frozen when setting the refresh rate screen, thereby improving the user experience.
[0010] Among them, in this setting, the first refresh rate is the target refresh rate, and the second refresh rate is the current refresh rate.
[0011] In one possible implementation, the method also includes: after the second time period, at a fourth moment, in response to a third user operation, the electronic device displays a third window, after the fourth moment, the third window is the focus window, and a third cursor is displayed in the third window; starting from the fourth moment, within the third time period, the electronic device sets the screen refresh rate to a third refresh rate, within the third time period, the position of the third cursor is not stationary, the duration of the first time period is greater than or equal to the duration of the third time period, the third refresh rate is greater than the first refresh rate, and the third refresh rate is greater than the second refresh rate.
[0012] The third refresh rate is greater than the first refresh rate, and the third refresh rate is greater than the second refresh rate, indicating that the third window has a higher refresh rate requirement and can be understood as having a higher priority. In scenarios where the refresh rate requirement is high, the refresh rate is set first when the cursor is not stationary. In this setting, the first refresh rate is the current refresh rate, and the second refresh rate is the target refresh rate.
[0013] In this way, for scenarios where the cursor is not sensitive to changes but the refresh rate setting is high (high priority), the electronic device can set the refresh rate when the cursor is not stationary or when the cursor is stationary, and the displayed cursor position remains unchanged during the setting process. This ensures that the refresh rate setting meets the user's needs, and the refresh setting speed is fast. The image is less affected by the stationary cursor on the screen, which can quickly adapt to the current scenario needs and improve the user experience.
[0014] In one possible implementation, after the second time period and before the fourth moment, the method further includes: at a fifth moment, in response to a fourth user operation, the electronic device displays the second window, after the fifth moment, the second window is the focus window, and the second cursor is displayed in the second window; in a fourth time period from the fifth moment to the fourth moment, the screen refresh rate is the first refresh rate, and in the fourth time period, the position of the second cursor is not stationary.
[0015] In the fourth period between the fifth moment and the fourth moment, the first refresh rate is the current refresh rate, the second refresh rate is the target refresh rate, and the electronic device does not switch the screen refresh rate to the target refresh rate. For details, please refer to the execution process when the global variable is canceled in S1104 and S1111 in Figure 11.
[0016] In this way, the third refresh rate is greater than the second refresh rate. In comparison, in the second window, users are sensitive to cursor changes but the refresh rate setting requirements are not high; in the third window, users are not sensitive to cursor changes but the refresh rate setting requirements are high. In the fourth period, because the main consideration is that the user does not perceive the switch, the position of the second cursor is not static, resulting in the inability to complete the setting within this period. At the fourth moment thereafter, the third user operation causes the target refresh rate to still change, and the refresh rate setting requirement for the third window is relatively high, so the second refresh rate is directly abandoned and the screen refresh rate is set to the third refresh rate. Therefore, the electronic device can improve the timeliness of the refresh rate, and ensure that users have different considerations for different needs, balance the priority of setting the refresh rate and user perception, and improve the user experience of the refresh rate setting process based on the actual needs and effects of the user as much as possible.
[0017] In one possible implementation, the method further includes: during the first period, based on the second cursor being in a stationary position, the electronic device not adjusting the screen refresh rate; and setting the screen refresh rate to a second refresh rate by the electronic device, including: after the first period, based on the second cursor being in a stationary position, the electronic device setting the screen refresh rate to the second refresh rate. In this way, when the cursor moves, the screen refresh rate remains unchanged; when the cursor is stationary, the screen refresh rate is set. This prevents the user from experiencing the brief moment of screen freezing caused by setting the screen refresh rate, thereby improving the user experience.
[0018] In one possible implementation, the electronic device sets the screen refresh rate to the first refresh rate, including: during the second time period, based on the first cursor being stationary, the electronic device sets the screen refresh rate to the first refresh rate. This can reduce the impact of screen freezing during the refresh rate setting process, reduce the user's perception of screen freezes, and improve the user experience.
[0019] In one possible implementation, the electronic device sets the screen refresh rate to a third refresh rate, including: within the third time period, based on the third window corresponding to the first priority and the third cursor being at a non-stationary position, the electronic device sets the screen refresh rate to the third refresh rate. In this way, the electronic device immediately sets the refresh rate for scenarios requiring a higher refresh rate, thereby improving the user's visual and operational experience.
[0020] Among them, the first priority is the high priority.
[0021] In one possible implementation, the electronic device not adjusting the screen refresh rate based on the second cursor being in a non-stationary position includes: within the first time period, the electronic device not adjusting the screen refresh rate based on the second window corresponding to the second priority and the second cursor being in a non-stationary position. This can reduce the impact of screen freezing during refresh rate setting, reduce user perception of screen freezes, and improve user experience.
[0022] Among them, the second priority is a low priority.
[0023] In one possible implementation, the method further includes: within the fourth time period, the electronic device does not adjust the screen refresh rate based on the second window corresponding to the second priority and the second cursor is not stationary; and the electronic device sets the screen refresh rate to a third refresh rate, including: within the third time period, the electronic device sets the screen refresh rate from the first refresh rate to the third refresh rate based on the third window corresponding to the first priority and the third cursor is not stationary. In this way, at the screen refresh rate, the current task can be canceled, the old task can be discarded, and the new task can be directly processed, thereby ensuring the timeliness of task execution.
[0024] In one possible implementation, starting from the second moment, the electronic device obtains first task information; the task information includes a target refresh rate and a priority, the target refresh rate is the second refresh rate; the priority of the first task information is the second priority; the electronic device does not adjust the screen refresh rate based on the second window corresponding to the second priority and the second cursor position is not stationary, and further includes: within the first time period, the electronic device adds the first task information to the buffer and waits for a first time period based on the number of attempts when the second cursor position is not stationary exceeding the threshold number and the first priority is the second priority; after the second time period, the electronic device obtains the first task information again. In this way, the impact of screen freezing during the refresh rate setting process can be reduced, the user's perception of screen freezes can be reduced, and the user experience can be improved.
[0025] In one possible implementation, starting from the fourth moment, the electronic device obtains the third task information from the buffer; the task information includes a target refresh rate and a priority, and the target refresh rate is the third refresh rate; the third task information includes a first priority; the electronic device sets the screen refresh rate to the third refresh rate based on the third window corresponding to the first priority and the position of the third cursor is not stationary, including: within the third time period, the electronic device sets the screen refresh rate to the first refresh rate based on the number of attempts exceeding the threshold number when the position of the third cursor is not stationary and the priority of the third task information is the first priority. In this way, a high priority can correspond to a scenario with a higher refresh rate requirement, and the refresh rate is immediately set even if the cursor is not stationary, thereby improving the user's visual and operational experience.
[0026] In one possible implementation, setting the screen refresh rate to the second refresh rate includes: the electronic device displays a full-screen window, the full-screen window includes the content of the second window, and the full-screen window overlays the second window; the electronic device sets the screen refresh rate to the second refresh rate; and the electronic device displays a first user interface without displaying the full-screen window, the first user interface including the second window. Thus, during the refresh rate setting process, the user's mouse position on the displayed screen remains unchanged before and after the refresh rate is set, and the user is unaware of the refresh rate setting process, which can improve the user experience.
[0027] In one possible implementation, the method further includes: when the focus window corresponds to the second priority, if the time difference between the current time and the time when the refresh rate was last set is less than or equal to a preset time length, the electronic device waits for a first time length; the electronic device sets the screen refresh rate to a second refresh rate, including: after the first time length, the electronic device sets the screen refresh rate to the second refresh rate, and the time difference between the time when the screen refresh rate is set to the second refresh rate and the time when the refresh rate was last set is greater than the preset time length. In this way, the speed of setting the refresh rate can be regulated to avoid switching too frequently, reduce excessive occupation of processing resources and energy consumption, and improve the user experience.
[0028] The judgment process may refer to the specific judgment process in S906 in FIG. 9 , and the waiting for the first duration may refer to the relevant processing of setting a timeout or timer in S901 , which will not be described in detail.
[0029] In one possible implementation, the method further includes: in response to the first user operation, the electronic device obtains first task information based on the second window, the first task information includes a target refresh rate and a second priority corresponding to the second window, and the target refresh rate is the second refresh rate corresponding to the second window; if the setting conditions are met, the electronic device adds the first task information to a buffer; the buffer includes at most one task information at a time; the electronic device sets the screen refresh rate to the second refresh rate, including: the electronic device obtains the first task information from the buffer; the electronic device sets the screen refresh rate to the second refresh rate based on the first task information. In this way, the electronic device can obtain task information based on user operations when the focus window changes, providing an accurate basis for subsequent processing of task information and setting the refresh rate.
[0030] In one possible implementation, the setting conditions include: the refresh rate setting function is enabled, the current display resolution is a preset resolution, the active signal refresh rate is a preset refresh rate, and the application in the focus window is a preset application. This ensures that the refresh rate setting can be executed, improving the success rate and reliability of subsequent execution.
[0031] Among them, the conditions that the above-mentioned refresh rate setting function is turned on, the current display resolution is the preset resolution, the active signal refresh rate is the preset refresh rate, and the application where the focus window is located is the preset application can be referred to the specific description of conditions 1 to 4 in S802 in Figure 8A.
[0032] In one possible implementation, the method further includes: the electronic device obtaining mouse information and determining whether the cursor position is stationary; the mouse information includes a first mouse position and a second mouse position within a preset time period, and / or a peripheral event within the preset time period; when the first mouse position and the second mouse position are different or the peripheral event changes, the cursor position is not stationary; otherwise, the cursor position is stationary; wherein the peripheral event is an operation event on a peripheral device, and the peripheral device includes a mouse. In this way, the cursor is not stationary during the user operation, avoiding the need to set the refresh rate and the user's perception of the process of setting the refresh rate, thereby improving the user experience.
[0033] For determining whether the cursor position is stationary, reference may be made to the relevant descriptions of S908 and S909 .
[0034] In one possible implementation, the method further includes: the electronic device determining that the global variable does not meet the conditions for completion and cancellation; if the global variable does not meet the conditions for completion and cancellation, the electronic device obtains the first task information from the buffer and clears the buffer. In this way, the state of the global variable can ensure the timeliness and feasibility of task processing, and can also ensure stable program operation.
[0035] For the judgment of whether the global variable is ended, refer to the description of S902 and S1102 , and for the judgment of whether the global variable is canceled, refer to the description of S1104 and S1111 .
[0036] In one possible implementation, in response to the fourth user operation, the method further includes: the electronic device generating fourth task information; and adding the fourth task information to a buffer; the electronic device obtaining the fourth task information from the buffer, clearing the buffer, and setting a global variable to "run"; in response to a third user operation, the electronic device generating third task information; and adding the third task information to the buffer; the third task information including the first priority corresponding to the third window; the target refresh rate of the third task information being the third refresh rate corresponding to the third window; and the electronic device setting the screen refresh rate from the first refresh rate to a third refresh rate based on the first priority corresponding to the third window, including: the electronic device setting the global variable to "cancel" based on the first priority and the global variable being "run"; if the global variable is "cancel", the electronic device discarding the fourth task information; the electronic device obtaining the third task information from the buffer, clearing the buffer, and setting the global variable to "run"; and the electronic device setting the screen refresh rate to the third refresh rate based on the third task information. In this way, in the case of task cancellation, the current task can be canceled, the old task can be discarded, and the new task can be directly processed, thereby ensuring the timeliness of task execution.
[0037] For the above process, please refer to the relevant descriptions in Figures 11 and 12.
[0038] In a second aspect, an embodiment of the present application provides another method for setting a refresh rate, which is applied to an electronic device and includes:
[0039] In response to a first operation, the focus window changes from the first window to the second window, and the electronic device obtains first task information; the first task information includes a first refresh rate and a target priority; when a first condition is met, when the cursor position is stationary, the electronic device sets the screen refresh rate to the first refresh rate; when the cursor position is not stationary, the electronic device does not adjust the screen refresh rate based on the second priority; when the cursor position is not stationary, the electronic device sets the screen refresh rate to the first refresh rate based on the first priority.
[0040] Among them, the change of the focus window can refer to the three situations of Figures 4A to 4D. The first refresh rate is the target refresh rate corresponding to the second window; the first priority is the priority corresponding to the second window, and the first refresh rate is different from the target refresh rate corresponding to the first window. The position of the second cursor is stationary, which means that the cursor displayed on the screen has not been moved and is stationary, and the window display content does not change relative to the cursor, specifically the case where the mouse is in a changing state in S909 in Figure 9. The position of the second cursor is not stationary, which means that the cursor is moved, that is, the position coordinates of the cursor or the cursor relative to the display content of the window changes, specifically the case where the mouse is in a stationary state in S909 in Figure 9. The first priority is a high priority, and the second priority is a low priority.
[0041] In an embodiment of the present application, the electronic device receives a user operation, the focus window changes, and the refresh rate is set according to the changed second window. During the refresh rate setting process, if the cursor is not stationary, the electronic device does not set the refresh rate, and waits until the cursor is stationary to set the refresh rate. Setting the refresh rate when the cursor is stationary prevents the user from noticing the brief moment when the window freezes while the refresh rate is being set, allowing the refresh rate setting process to be completed seamlessly, improving the user experience during the refresh rate setting process.
[0042] In one possible implementation, when the cursor is not stationary, the electronic device does not adjust the screen refresh rate based on the second priority, including: based on the number of attempts when the second cursor is not stationary exceeding a threshold and the target priority being the second priority, the electronic device adds the first task information to the buffer and waits for a second duration; after the second duration, the electronic device reacquires the first task information. This can reduce the impact of screen freezing during refresh rate setting, reduce the user's perception of screen freezes, and improve the user experience.
[0043] In one possible implementation, when the position of the cursor is not stationary, the electronic device sets the screen refresh rate to the first refresh rate based on the first priority, including: the electronic device sets the screen refresh rate to the first refresh rate based on the number of attempts when the position of the cursor is not stationary exceeding the threshold number, and the target priority is the first priority. In this way, it can be divided into two scenarios: the user is sensitive to cursor changes but the refresh rate setting demand is not high; and the cursor is not sensitive to changes but the refresh rate setting demand is high. Since the main consideration is that the user does not perceive the switching, the position of the cursor is not stationary, resulting in the inability to complete the setting within this period, but the high-priority refresh rate continues to be set. Ensure that users have different considerations for different needs, balance the refresh rate setting and user perception, and base it on the actual needs and effects of the user as much as possible to improve the user experience of the refresh rate setting process.
[0044] In one possible implementation, the first condition includes whether the time difference between the current time and the time when the refresh rate was last set is less than or equal to a preset duration, and the first priority is a low priority condition. In this way, the speed of setting the refresh rate can be regulated to avoid excessive switching, reduce excessive use of processing resources and energy consumption, and improve the user experience.
[0045] The judgment process may refer to the specific judgment process in S906 in FIG. 9 , and the waiting for the second time period may refer to the relevant processing of setting a timeout or timer in S901 , which will not be described in detail.
[0046] In one possible implementation, before the electronic device obtains the first task information, the method further includes: in response to the second operation, the focus window changes from the third window to the first window, and the electronic device obtains the second task information; the second task information includes a second refresh rate and a second priority; the electronic device adds the second task information to a buffer and clears the second task information; the electronic device obtains the second task information from the buffer; the electronic device determines whether the time difference between the current time and the time when the refresh rate was last set is greater than a preset duration, or the second task information includes a second priority; the electronic device adds the second task information to the buffer again and waits for a second duration; after the second duration, the electronic device obtains the second task information from the buffer. In this way, the speed of setting the refresh rate can be regulated to avoid switching too frequently, reduce excessive occupation of processing resources and energy consumption, and improve the user experience.
[0047] The judgment process may refer to the specific judgment process in S906 in FIG. 9 , and the waiting for the second time period may refer to the relevant processing of setting a timeout or timer in S901 , which will not be described in detail.
[0048] In one possible implementation, the first condition includes that the first refresh rate is not equal to the current screen refresh rate, thereby ensuring the validity of the setting.
[0049] In a possible implementation, the first condition includes a global variable that is not a termination condition. In this way, the state of the global variable can ensure the timeliness of the task and the feasibility of the processing, and can also ensure the stability of the program operation.
[0050] For the judgment of whether the global variable is ended, refer to the description of S902 and S1102.
[0051] In a possible implementation, the first condition includes a condition that the global variable is not cancelled. In this way, the state of the global variable can ensure the timeliness of the task and the feasibility of the processing, and can also ensure the stability of the program operation.
[0052] For the judgment of whether the global variable is cancelled, refer to the description of S1104 and S1111.
[0053] In one possible implementation, before the electronic device obtains the first task information, the method further includes: in response to a third operation, the focus window changes from the fourth window to the first window; the electronic device obtains the third task information; the third task information includes a third refresh rate and a first priority; the electronic device adds the third task information to a buffer; the electronic device obtains the third task information from the buffer, clears the third task information, and sets a global variable to run; after the electronic device obtains the first task information, the method further includes: the electronic device adds the third task information to the buffer; the electronic device determines that the third task information includes the first priority and the global variable is set to run, and sets the global variable to cancel; if the global variable is canceled, the electronic device discards the third task information. In this way, in the case of task cancellation processing, the current task can be canceled, the old task can be discarded, and the new task can be processed directly, thereby ensuring the timeliness of task execution.
[0054] For the above process, please refer to the relevant descriptions in Figures 11 and 12.
[0055] In one possible implementation, the method further includes: the electronic device acquiring mouse information and determining whether the cursor position is stationary based on the mouse information. In this way, the cursor is not stationary during user operation, thereby avoiding the need to set the refresh rate and the user being aware of the process of setting the refresh rate, thereby improving the user experience.
[0056] In one possible implementation, the mouse information includes a mouse position and a peripheral event, and the electronic device determines whether the cursor position is stationary based on the mouse information, including: the electronic device obtains the mouse information within a preset time period; the mouse information includes a first mouse position and a second mouse position within the preset time period, and / or a peripheral event within the preset time period; the peripheral event is an operation event on a peripheral device, and the peripheral device includes a mouse device; when the first mouse position and the second mouse position are different or the peripheral event changes within the preset time period, the electronic device determines that the cursor position is not stationary; otherwise, the cursor position is stationary. In this way, the cursor is not stationary during the user operation, avoiding the need to set the refresh rate and the user's perception of the process of setting the refresh rate, thereby improving the user experience.
[0057] For determining whether the cursor position is stationary, reference may be made to the relevant descriptions of S908 and S909 .
[0058] In one possible implementation, the electronic device obtains the first task information, including: generating the first task information based on the second window and, if a set condition is met, adding the first task information to a buffer; obtaining the first task information from the buffer and clearing the buffer; and the buffer containing at most one task information at a time. In this way, the electronic device can obtain task information based on user operations when the focus window changes, providing an accurate basis for subsequent processing of the task information and setting the refresh rate. This ensures the timeliness of the task information.
[0059] In one possible implementation, the setting conditions include: the refresh rate setting function is enabled, the current display resolution is a preset resolution, the active signal refresh rate is a preset refresh rate, and the application in the focus window is a preset application. This ensures that the refresh rate setting can be executed, improving the success rate and reliability of subsequent execution.
[0060] Among them, the conditions that the above-mentioned refresh rate setting function is turned on, the current display resolution is the preset resolution, the active signal refresh rate is the preset refresh rate, and the application where the focus window is located is the preset application can be referred to the specific description of conditions 1 to 4 in S802 in Figure 8A.
[0061] In one possible implementation, setting the screen refresh rate to the first refresh rate includes: the electronic device displays a full-screen window, the full-screen window includes the focus window and the cursor content, and the full-screen window overlays the second window; the electronic device sets the screen refresh rate to the first refresh rate; and the electronic device displays a first user interface without displaying the full-screen window, the first user interface including the second window. Thus, during the refresh rate setting process, the user does not see a change in the mouse position on the displayed screen before and after the refresh rate is set, and the user is unaware of the refresh rate setting process, thereby improving the user experience.
[0062] In a third aspect, an embodiment of the present application provides an electronic device, comprising: one or more processors, a display screen, and a memory; the memory is coupled to the one or more processors, the memory being used to store computer program code, the computer program code comprising computer instructions, the one or more processors calling the computer instructions to enable the electronic device to execute the method for setting the refresh rate as described in any possible implementation manner of the first aspect or the second aspect.
[0063] In a fourth 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 of setting the refresh rate as described in any possible implementation method of the first aspect or the second aspect.
[0064] In a fifth aspect, an embodiment of the present application provides a computer program product comprising instructions, which, when run on an electronic device, enables the electronic device to execute a method for setting a refresh rate as described in any possible implementation of the first aspect or the second aspect.
[0065] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium comprising instructions, which, when executed on an electronic device, enables the electronic device to execute a method for setting a refresh rate as described in any possible implementation of the first aspect or the second aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] FIG1 is a schematic diagram of a scanning process of a screen refresh image frame provided by an embodiment of the present application;
[0067] FIG2 is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;
[0068] FIG3 is a software structure block diagram of an electronic device provided in an embodiment of the present application;
[0069] 4A to 4D are schematic diagrams of a user interface for changing a focus window provided in an embodiment of the present application;
[0070] FIG5A is a flow chart of a method for obtaining a focus window provided in an embodiment of the present application;
[0071] FIG5B is a flow chart of a method for obtaining a mouse status according to an embodiment of the present application;
[0072] FIG6A and FIG6B are user interfaces of a group of electronic devices provided in an embodiment of the present application;
[0073] FIG7 is a flow chart of a method for setting a refresh rate according to an embodiment of the present application;
[0074] FIG8A is a flow chart of a method for obtaining a task provided in an embodiment of the present application;
[0075] FIG8B is a schematic diagram of an interface of a graphics card control panel provided in an embodiment of the present application;
[0076] FIG9 is a flow chart of a method for setting a refresh rate according to an embodiment of the present application;
[0077] 10A and 10B are schematic diagrams of a set of task processing processes provided by an embodiment of the present application;
[0078] FIG11 is a flow chart of another method for setting a refresh rate provided in an embodiment of the present application;
[0079] FIG12 is a schematic diagram of a task processing process provided in an embodiment of the present application;
[0080] FIG13 is a schematic diagram of a change process of a global variable provided in an embodiment of the present application;
[0081] FIG14 is a flow chart of another method for setting a refresh rate provided in an embodiment of the present application;
[0082] FIG15 is a flow chart of another method for setting a refresh rate provided in an embodiment of the present application;
[0083] FIG16 is a flow chart of another method for setting the refresh rate provided in an embodiment of the present application. DETAILED DESCRIPTION
[0084] 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 the embodiments. Mentioning "embodiment" in this article means that the specific features, structures or characteristics described in conjunction with the embodiment can be included in at least one embodiment of the present embodiment application. The appearance of this phrase in various places in the specification does not necessarily mean that they are all the same embodiments, nor are they independent or alternative embodiments that are mutually exclusive with other embodiments. It can be understood explicitly and implicitly by those skilled in the art that the embodiments described herein can be combined with other embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without making creative work are within the scope of protection of this application.
[0085] In the specification, claims, and accompanying drawings of this application, the terms "first," "second," "third," and the like are used to distinguish different objects and are not used to describe a particular order. Furthermore, the terms "including," "comprising," "having," and any variations thereof are intended to cover non-exclusive inclusions. For example, a list of steps or elements may be included, or alternatively, steps or elements not listed may be included, or other steps or elements may be included that are inherent to the process, method, product, or apparatus.
[0086] Only part relevant to the present application, rather than 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 each operation (or step) as sequential processing, many operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of each operation can be rearranged. When its operation is completed, the processing can be terminated, but can also have additional steps not included in the accompanying drawings.
[0087] Introduction to relevant technical concepts:
[0088] 1. Physical refresh rate and virtual refresh rate
[0089] Refreshing a frame on the screen of an electronic device is a scanning of every pixel in the image. Figure 1 is a schematic diagram of the scanning process of a screen refreshing an image frame disclosed in an exemplary embodiment of the present application. As shown in Figure 1, a progressive scan is performed in the vertical screen direction, that is, the pixels of each row are scanned one by one, and after scanning one row, the next row is scanned. When the first pixel of the first row is scanned to the last pixel of the last row, the refresh of one frame of the image is completed.
[0090] Electronic devices need to perform pixel scanning according to the pixel clock signal (VCLK), that is, the pixel clock signal has a corresponding pixel clock frequency (or pixel clock cycle), and scan pixels one by one according to the pixel clock frequency. That is, the pixel clock cycle is the time unit required to update a pixel on the screen. The signal that completes a frame refresh scan is the vertical synchronization signal (Vertical synchronization, Vsync), and the pulse of the vertical synchronization signal indicates the end of the previous frame and the beginning of a new frame. It can be understood that the vertical synchronization signal cycle is the product of the number of pixels in a frame image and the pixel clock cycle. The horizontal synchronization signal (Horizon synchronization, Hsync) can control the scanning period of each row, that is, the pulse of the horizontal synchronization signal means the end of the previous row of pixel scanning and the beginning of a new row of pixel scanning.
[0091] Data enable (DE) refers to valid color data within the data-enabled area. The data in the inactive area is displayed as black (the screen does not display data in the inactive area). As shown in Figure 1, the gray area is the active area. Data in the gray area is enabled data for screen display. The white area is the inactive area; data in the white area is not enabled. After the vertical sync signal is issued, data cannot be enabled immediately; some time is required to allow for the electron gun retrace (corresponding to vertical blanking and horizontal blanking).
[0092] Horizontal blanking (HBlank): The electron gun draws pixels from left to right, drawing only one scan line at a time. Before drawing the next line, it must return to the left to prepare for the next scan line. This period is called horizontal blanking. Vertical blanking (VBlank): After drawing all scan lines, the electron gun returns to the upper left corner of the screen to prepare for the next frame. The period in between is called vertical blanking. As shown in Figure 1, taking row scanning as an example, the period from the end of HSYNC to the start of DE is the horizontal back porch (HBP) of the row scan; the period from the end of DE to the start of HSYNC is the horizontal front porch (HFP). As shown in Figure 1, taking column scanning as an example, the period from the first HSYNC of the frame to the end of the line before the start of DE is the vertical back porch (VBP); the period from the line after the end of DE to the end of the last HSYNC of the frame is the vertical front porch (VFP).
[0093] Therefore, the screen refresh rate of an electronic device is the frequency of the vertical synchronization signal, that is, the ratio of the pixel clock frequency to the number of pixel clock cycles required to refresh a frame of image. The number of pixel clock cycles required to refresh a frame of image is the product of the number of pixel rows and columns in the image area of a frame. The number of pixel rows is the sum of the horizontal signal, VBP, the number of screen rows, and VFP; the number of pixel columns is the sum of the vertical signal, HBP, the number of screen columns, and HFP. The formula for the refresh rate can be expressed as:
[0094] As shown in Figure 1, the number of screen rows and columns represents the number of pixel rows and columns in the active area, respectively. The vertical back porch (VBP) represents the number of pixel rows at the top of the active area, while the vertical front porch (VFP) represents the number of pixel rows at the bottom of the active area. The horizontal back porch (HBP) represents the number of pixel columns to the left of the active area, while the horizontal front porch (HFP) represents the number of pixel columns to the right of the active area. The horizontal signal controls the start and end of each row scan, while the vertical signal controls the start and end of each frame scan.
[0095] The physical refresh rate is the refresh rate of the electronic device when the VBP and VFP are fixed. The virtual refresh rate is the refresh rate of the electronic device when the VBP and / or VFP are dynamically adjusted. In the embodiment of the present application, the refresh rate of the electronic device can be adjusted by changing the VBP and / or VFP (i.e., adjusting the virtual refresh rate).
[0096] 2. Focus window
[0097] The focused window is the window with focus. The focused window is the window that receives keyboard input. The determination of the focused window is tied to the system's focus mode. The topmost window of the focused window is called the active window. Optionally, only one window can be active at a time; that is, at any given moment, there is only one focused window. The focused window is most likely the window the user is currently working on.
[0098] A process consists of multiple threads, and windows can be created through threads. The focus process is the process to which the thread that created the focus window belongs. It can also be understood that the focus process is the process corresponding to the focus window.
[0099] The electronic device in the embodiments of the present application can be a laptop computer, a desktop computer, a mobile phone, a tablet computer, a desktop computer, a handheld computer, a smart bracelet, a super mobile personal computer, a netbook, a personal phone, a personal data assistant, an augmented reality (AR) / virtual reality (VR) and other touch screen devices. The present application does not limit the specific form of the electronic device.
[0100] The following describes the device involved in the embodiments of the present application.
[0101] FIG2 is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application.
[0102] The electronic device may include a processor 210, an external memory interface 220, an internal memory 221, a universal serial bus (USB) interface 230, a charging management module 240, a power management module 241, a battery 242, a wireless communication module 250, a display screen 260, etc.
[0103] It is understood that the structures illustrated in the embodiments of the present application do not constitute specific limitations on the electronic device. In other embodiments of the present application, the electronic device may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0104] The processor 210 may include one or more processing units. For example, the processor 210 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). Different processing units may be independent devices or integrated into one or more processors.
[0105] Processor 210 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 210 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 210. If processor 210 needs to use the same instruction or data again, it can directly access the memory. This avoids duplicate accesses, reduces processor 210 latency, and thus improves system efficiency.
[0106] In some embodiments, the processor 210 may include one or more interfaces. The interfaces may include a two-wire serial bus (inter-integrated circuit, I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, and / or a USB interface.
[0107] The external memory interface 220 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device. The external memory card communicates with the processor 210 via the external memory interface 220 to implement data storage functions. For example, files such as music and videos can be stored on the external memory card.
[0108] The internal memory 221 can be used to store computer executable program codes, which include instructions. The processor 210 executes various functional applications and data processing of the electronic device by running the instructions stored in the internal memory 221. The internal memory 221 can include a program storage area and a data storage area.
[0109] The program storage area may store an operating system, at least one application required for a function (such as a video playback function, an audio playback function, etc.), etc. The data storage area may store data created during the use of the electronic device (such as audio data, image frames, etc.), etc. In addition, the internal memory 221 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0110] It is understood that the interface connection relationship between the modules illustrated in the embodiments of the present application is only for illustrative purposes and does not constitute a structural limitation on the electronic device. In other embodiments of the present application, the electronic device may also adopt different interface connection methods from the above embodiments, or a combination of multiple interface connection methods.
[0111] The charging management module 240 is configured to receive charging input from a charger. The charger can be either a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 240 can receive charging input from the wired charger via the USB interface 230. In some wireless charging embodiments, the charging management module 240 can receive wireless charging input via the electronic device's wireless charging coil. While charging the battery 242, the charging management module 240 can also power the electronic device through the power management module 241.
[0112] The power management module 241 is used to connect the battery 242, the charging management module 240, and the processor 210. The power management module 241 receives input from the battery 242 and / or the charging management module 240 and provides power to the processor 210, the internal memory 221, the external memory, the display 260, and the like. The power management module 241 can also be used to monitor parameters such as battery capacity, battery cycle count, and battery health status (leakage, impedance). In some other embodiments, the power management module 241 can also be provided in the processor 210. In other embodiments, the power management module 241 and the charging management module 240 can also be provided in the same device.
[0113] The wireless communication module 250 can provide wireless communication solutions including wireless local area network (WLAN), Bluetooth, global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to electronic devices. The wireless communication module 250 can be one or more devices integrating at least one communication processing module. The wireless communication module 250 receives electromagnetic waves via the antenna 2, frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 210. The wireless communication module 250 can also receive the signal to be sent from the processor 210, frequency modulate it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0114] The electronic device implements its display functionality through a GPU, display screen 260, and an application processor. A GPU is a microprocessor for image processing that connects display screen 260 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 210 may include one or more GPUs that execute program instructions to generate or modify display information.
[0115] Display screen 260 is used to display images, videos, and the like. Display screen 260 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 (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLED, a Micro-oLed, or a quantum dot light-emitting diode (QLED). In some embodiments, the electronic device can include one or N display screens 260, where N is a positive integer greater than one.
[0116] FIG3 is a schematic diagram of the system structure of an electronic device according to an embodiment of the present application.
[0117] An operating system runs on the aforementioned hardware devices, such as the Windows operating system, the Android operating system, and the iOS operating system. Application programs can be installed and run on the operating system.
[0118] A layered architecture divides software into several layers, each with distinct roles and divisions of labor. Layers communicate with each other through software interfaces. In some embodiments, the Windows operating system can be divided into user mode and kernel mode. User mode includes the application layer and subsystem dynamic link libraries, while kernel mode includes the executive, operating system (OS) layer, device drivers, and hardware layer.
[0119] As shown in Figure 3, the application layer includes applications such as video, office software (e.g., conference, document applications, email, etc.), XX games, browsers, and computer managers. It should be noted that Figure 3 only shows some of the applications, and the application layer can also include more applications, which is not limited in the embodiments of this application.
[0120] Among them, the computer manager executes the refresh rate setting process in the embodiment of the present application. The computer manager may include a focus recognition module, a seamless setting module, an overload control module and a mouse hold module, etc. Focus recognition can determine the current focus window based on the focus recognition module, determine whether the focus window has changed, and identify the current scene type, and determine task information based on the current scene, etc. The seamless setting module can set the screen refresh rate from one refresh rate to another refresh rate. Optionally, the seamless setting module can also determine the mouse status. The overload control module can control the timing of the refresh rate setting to ensure that the refresh rate setting is not too frequent. The mouse hold module can keep the mouse still before and after the refresh rate setting.
[0121] The subsystem dynamic link library includes an API module, which can provide system call entry and internal function support for the application.
[0122] The executive includes the process manager, Windows Management Instrumentation (WMI), and the operating system event driver (OsEventDriver) node. The process manager is used to create and terminate processes and threads. The system event driver node can interact with the kernel and driver layer.
[0123] The operating system layer may include a user mode driver (UMD) and a dynamic link library, etc. The dynamic link library may include User32 and GDI32, etc.
[0124] The graphics scheduler can manage the queue of rendering instructions. In an optional design, the graphics scheduler can be implemented by the DirectX graphics kernel (DXG kernel).
[0125] The UMD can be used to receive graphics commands, construct a hardware context and command buffer in response to the graphics commands, and pass the command buffer to the kernel mode driver (KMD) at the OS layer for further processing. Specifically, the UMD can convert graphics commands issued by the API runtime into hardware-specific commands (i.e., GPU-specific commands). During the conversion process, the UMD can retain the appropriate hardware context for the GPU. The application programming interface runtime (API runtime) in the graphics runtime.
[0126] User32 is primarily responsible for handling the graphical user interface and is an application programming interface related to the Windows user interface. The GDI32 dynamic link library implements the Graphics Device Interface (GDI) functionality. GDI is a graphics interface responsible for handling graphics and font operations in Windows systems, such as drawing graphics, displaying text, and printing.
[0127] Device drivers run in kernel mode and serve as interfaces between the I / O system and related hardware. Device drivers may include graphics card drivers, mouse drivers, keyboard drivers, and the like. For example, a graphics card driver may drive the GPU. Device drivers may also include a graphics kernel (DirectX graphics kernel, DXG krnl), a kernel mode driver (KMD), and a graphics scheduler that may queue and manage rendering instructions. In an optional design, the graphics scheduler may be implemented through the DirectX graphics kernel. The UMD may be used to receive graphics instructions, construct a hardware context and command buffer in response to the graphics instructions, and pass the command buffer to the kernel mode driver (KMD) at the OS layer for further processing.
[0128] The hardware layer may include a CPU, GPU, display, mouse, keyboard, etc., which is not limited in this application.
[0129] Figures 4A to 4D are user interface diagrams of a set of focus window changes disclosed in an embodiment of the present application. The focus window change may occur in the following situations:
[0130] Case 1. Open a new window
[0131] When a user turns on an electronic device, the electronic device's display shows the desktop. Figure 4A is a schematic diagram of a user's desktop on an electronic device. As shown in Figure 4A, the electronic device may display icons for applications such as slideshows, videos, a browser, music, a game (XX), and email. The user may double-click the application icon for the game (XX). In response to double-clicking the game icon, the electronic device may launch the game window. As shown in Figure 4B, the electronic device may display the game window. At this point, the window that becomes focused after the new window is opened is the game window.
[0132] Case 2. Settings window
[0133] As shown in Figure 4C, the user interface of the electronic device may include an application window 432 of the browser and a taskbar 431. Among them, the taskbar 431 can display all currently opened window icons, and the taskbar 431 can include window icons of word, Excel, browser and XX game. At this time, the focus window is the browser window (the browser window is displayed as selected). As shown in Figure 4C, the user can click the window icon of XX game in the taskbar 431. In response to the operation of clicking the window icon of XX game, the electronic device can display the window screen of XX game (as shown in Figure 4B). The focus window changes from the browser window to the window of XX game.
[0134] Case 3. Exit the current window
[0135] In the case where the electronic device has open windows including Word, Excel, a browser, and an XX game window, as shown in FIG4B , the user interface of the electronic device displays the XX game window, and the focus window is the XX game window. The user can click the exit control 421. In response to the operation of clicking the exit control 421, the electronic device does not display the XX game window. As shown in FIG4D , the electronic device can display the browser window 442. The taskbar 441 does not include the XX game window icon. The focus window changes to the browser window 442.
[0136] The user clicks on a control to exit an application (or minimizes a window). In response to the operation of exiting the control of an application, the electronic device can select a new window as the focus window, and the result of the selection is not limited.
[0137] In combination with the relevant descriptions of FIG. 4A to FIG. 4D , FIG. 5A illustrates the process of obtaining the focus window.
[0138] FIG5A is a flow chart of a method for obtaining a focus window disclosed in an embodiment of the present application. As shown in FIG5A , the method for obtaining a focus window may include but is not limited to the following steps:
[0139] In conjunction with the focus recognition module of the electronic device in Figure 3, the focus recognition module may include a system probe module and a scene recognition module. Among them, the system probe module can obtain the probe state by subscribing to various events of the electronic device in the kernel state, and then determining the operating state of the electronic device according to the callback function fed back by the kernel state. After obtaining the probe state, the system probe module can feed back the probe state to the scene recognition module. After receiving the probe state, the scene recognition module can determine the user scenario of the electronic device according to the probe state. The usage scenario may include a game scenario and an office scenario, etc. The user scenario can reflect the user's current usage needs. For example, when the scene recognition engine identifies that the focus window is a window of an office application, the electronic device can be determined to be in an office scene. For another example, when the scene recognition engine identifies that the focus window is a window of XX game, the electronic device can be determined to be in a game scene.
[0140] The electronic device may further include a first application, an API module, a system event-driven node, and a process manager. The first application may be a video, office software (e.g., email, slideshow, etc.), a game, a browser, etc., which is not limited in this application. For the above modules, please refer to the relevant description in FIG3 and will not be repeated here.
[0141] S501: The system probe module sends a request for subscribing to a process creation event to the system event-driven node.
[0142] S502: The system event-driven node sends a request to the process manager to subscribe to a process creation event.
[0143] S503: The system probe module sends a request to subscribe to the focus window change event to the API module.
[0144] S504: In response to receiving the user's operation of starting the first application, the first application sends a request to the process manager to create a first application process.
[0145] The request to create the first application process may include the storage address of the first application program. The first application may be a game, a text window, a browser, a video, music, etc. The specific application type of the first application is not limited in this application.
[0146] The operation of opening the first application can be an operation of clicking the first application icon, for example, the operation of double-clicking the XX game icon in Figure 4A. For details, please refer to the relevant operation description in Case 1 and will not be repeated here. The operation of opening the first application can also be other operation methods, which are not limited by this application.
[0147] S505: The process manager creates a first application process.
[0148] Specifically, the process manager can query the binary file of the first application through the storage address, and by loading the binary file of the first application, it can create an environment for process execution and start the first application process. In addition, the first application process includes thread 1, which can be used to create the main window of the first application.
[0149] S506: The process manager sends a process creation event to the system event driver node.
[0150] S507: The system event driving node sends a process creation event to the system probe module.
[0151] S508: The system probe module sends a process creation event to the scene recognition module.
[0152] In S506 to S508 , the reported process creation event is an event of creating the first application process, and the process creation event carries the name of the first application process.
[0153] S509: In response to the calling request of thread 1, the API module creates window 1.
[0154] Among them, window 1 is the window of the first application.
[0155] In conjunction with situation 1 in FIG. 4A and FIG. 4B , in response to the operation of opening the first application, the electronic device may display a window of the XX game, ie, the created window 1 .
[0156] S510: The API module sends a focus window event to the system probe module.
[0157] The focus window event may carry the name of the first application process (focus process).
[0158] S511: The system probe module sends a focus window event to the scene recognition module.
[0159] S512: The scene recognition module determines that the scene type of the electronic device is the first type based on the focus window event.
[0160] The scene recognition module can determine the scene type of the electronic device based on the name of the first application process. For example, if the name of the first process is game.exe, the first process type can be determined to be a game. For another example, if the name of the first process is word.exe, the first process type can be determined to be an office application.
[0161] The method embodiment of FIG5A above illustrates the specific execution process for Case 1 of a focus window change. For Cases 2 and 3, the electronic device will similarly perform window setting processing based on user-related operations. The electronic device's API can also send a focus window event to the focus identification module based on the set focus window. The focus identification module can then determine the corresponding process type, which will not be further described.
[0162] In the above implementation, the focus identification module of the electronic device can determine the changed focus window by subscribing to the probe status of the kernel layer, and determine the scene type of the electronic device based on the focus window.
[0163] FIG5B is a flow chart of a method for obtaining peripheral device events disclosed in an exemplary embodiment of the present application. As shown in FIG5B , the method for obtaining peripheral device events may include but is not limited to the following steps:
[0164] In conjunction with Figures 3 and 5A, the focus recognition module may further include a peripheral status probe. The peripheral status probe may subscribe to peripheral events of the electronic device in kernel mode and then determine the peripheral event based on a callback function fed back from kernel mode. After receiving the peripheral event, the peripheral status probe may feed the peripheral event back to the scene recognition module. The scene recognition module may then receive the peripheral event.
[0165] The electronic device may further include peripheral drivers and peripheral devices. The peripheral drivers may include a mouse driver, etc., and the peripheral devices may include a mouse, etc. For a detailed description of each module included in the electronic device, reference may also be made to the relevant contents in FIG. 3 and FIG. 5A , which will not be repeated here.
[0166] S521: The peripheral status probe sends a request to subscribe to peripheral events to the system event-driven node.
[0167] S522: The system event driver node sends a request to subscribe to peripheral events to the peripheral driver.
[0168] S523: In response to the user's first operation on the peripheral device, the peripheral driver obtains a peripheral event.
[0169] Among them, peripheral events may include mouse drag events and mouse wheel sliding events.
[0170] For example, when a mouse selects a file or option and moves it, the peripheral driver can detect a mouse drag event. For example, when a user slides the mouse wheel to scroll up or down a page, the peripheral driver can obtain a mouse wheel sliding event in response to the scroll wheel operation.
[0171] It should be noted that the specific needs of electronic devices are different, and the types of events subscribed to are different. The above is only an exemplary description and does not limit the specific event type. The peripheral status probe subscribes to more or fewer peripheral events of electronic devices to the kernel state.
[0172] S524: The peripheral driver reports the peripheral event to the system event driver node.
[0173] S525: The system event drives the node to send a peripheral event to the peripheral status probe.
[0174] S526: The peripheral status probe sends a peripheral event to the scene recognition module.
[0175] At this point, the electronic device can subscribe to the peripheral events in the kernel state, thereby obtaining the peripheral events for subsequent use in FIG. 9 and FIG. 11 .
[0176] In the above implementation, the electronic device can obtain peripheral events by subscription, which supports the subsequent determination of whether the mouse is in a changed state in S908 and S909, thereby ensuring the timeliness of the peripheral events.
[0177] Electronic devices can set their screen refresh rates using either hardware or software. Hardware-based refresh rate settings change the pixel clock frequency. Software-based refresh rate settings adjust the vertical blanking (VBlank) by adjusting the size of the VFP and VBP (Figure 1). When setting the refresh rate via software, the refresh rate setting function centers the mouse cursor within the window interface, causing the mouse position to change before and after the refresh rate is set.
[0178] Figures 6A and 6B illustrate user interfaces of a group of electronic devices disclosed in accordance with an exemplary embodiment of the present application. As shown in Figure 6A, user interface 610 includes a taskbar 613, window A 611, and window B 612. Taskbar 613 includes icons corresponding to multiple windows, such as window A 611 and window B 612. Each window may include a title bar and a preview window. The icon for window B in taskbar 613 is selected, and the cursor is located at first position 614 of the currently focused window (window B 612). Assume that in window B 612, the user is selecting text, scrolling down a page, or viewing content (the cursor is not moving). After the electronic device starts setting the refresh rate, the electronic device may display user interface 620 shown in Figure 6B. At this point, the cursor position of the electronic device changes from first position 614 of window B 612 to second position 624 of window B 622 in Figure 6B. Second position 624 is the center position of the entire user interface 620. The cursor position changes, and the user can clearly perceive the page jump.
[0179] When the user is focusing on the window content, if the electronic device adjusts the cursor position without the user's control, the user can clearly feel the jump of the cursor position, which is a poor user experience. Therefore, how to allow the user to set the refresh rate of the software without noticing is an urgent problem to be solved in the embodiments of the present application.
[0180] In response to the problem that the cursor or mouse position jumps during the refresh rate setting process of the above-mentioned electronic device, the present application proposes an embodiment of Figure 7. Figure 7 is a flow chart of a method for setting the refresh rate disclosed in an exemplary embodiment of the present application. When the first interface is displayed, the refresh rate setting is triggered, and the method shown in Figure 7 is executed. In order to achieve the cursor not moving in the display screen, before the refresh rate is set, the first image is displayed, and the first image is covered on the full screen of the electronic device; during the refresh rate setting process, the cursor is not displayed; after the refresh rate is switched, the first image is not displayed, and the cursor is displayed. As shown in Figure 7, the method for setting the refresh rate may include but is not limited to the following steps:
[0181] S701: The electronic device displays a full-screen window.
[0182] Optionally, a full screen window is generated and displayed.
[0183] The electronic device obtains the mouse position information, covers the first interface with a full-screen window, and does not display the mouse. The first interface is invisible to the user. The mouse position information is the mouse coordinate position most recently obtained before the refresh rate is set. The full-screen window is a window that displays the entire screen of the electronic device. The display of the full-screen window is the full-screen image obtained before the refresh rate is set, which can be understood as a screenshot of the entire screen. The display of the full-screen window includes the mouse pattern. The mouse position information can be the coordinate position of the mouse pattern included in the display of the full-screen window.
[0184] Exemplarily, the first interface may be the interface shown in FIG. 6A .
[0185] The full-screen window's transparency is set to 1, meaning the full-screen window is opaque, and the user cannot see the primary interface through the full-screen window. For example, the full-screen window's opacity parameter ranges from 0 to 255, with 0 representing complete transparency and 255 representing complete opacity. You can set the opacity parameter to 255. This allows you to hide the cursor, meaning it won't be displayed. Setting the full-screen window to opaque ensures that the mouse cursor remains in the same position on the display.
[0186] Optionally, a second application of the electronic device can generate and display a full-screen window. The second application can be the computer manager in Figure 3.
[0187] Optionally, the mouse holding module generates and displays the first image. In conjunction with the mouse holding module in the computer manager in FIG3 , the processing of the electronic device in S701 can be implemented by the mouse holding module.
[0188] S702: The electronic device sets the screen refresh rate to a target refresh rate.
[0189] The electronic device can set the virtual refresh rate to the target refresh rate by setting VBP and VFP in Figure 1. During the execution of S702, the mouse position may jump. For details, please refer to the description in Figures 6A and 6B. Since the full-screen window is displayed and the mouse is not displayed, the jumping screen is not visible to the user.
[0190] Optionally, in conjunction with the mouse hold module and seamless setup module in the PC Manager shown in FIG3 , after the mouse hold module generates and displays a full-screen window, it may send a first setup instruction to the seamless setup module. Upon receiving the first setup instruction, the seamless setup module may set the screen refresh rate to a target refresh rate. For details on the setup method, see the execution of S702 . The first setup instruction may be used to instruct the seamless setup module to set the screen refresh rate to the target refresh rate, and the first setup instruction may include the target refresh rate.
[0191] In S701 and S702, the full-screen window is displayed as the entire interface of the electronic device, including the mouse icon, but the mouse is not displayed. This means that the mouse position remains unchanged for the user. Even if the mouse device is moved, the mouse position on the screen does not change. In other words, for the user, the screen is frozen and the mouse display does not follow the hand.
[0192] S703: The electronic device displays the first interface, but does not display a full-screen window.
[0193] After the screen refresh rate is set to the target refresh rate, the electronic device displays the first interface and does not display the full-screen window, that is, the first interface is visible to the user and the full-screen window is invisible to the user. The electronic device displays the mouse based on the mouse position information. The electronic device can start displaying the mouse from the mouse position information, and the mouse display can follow the hand thereafter.
[0194] Optionally, in conjunction with the computer manager in Figure 3, after the seamless setting module sets the screen refresh rate to the target refresh rate, it can send a setting completion notification to the mouse holding module. After receiving the setting completion notification, the mouse holding module can execute the processing process of S703.
[0195] In the embodiment of FIG7 , the electronic device can overlay an opaque full-screen window on the first interface. During the refresh rate setting process, the mouse is not displayed. After the refresh rate setting process is completed, the first interface is displayed without the full-screen window, and the mouse is displayed based on the mouse position in the full-screen window. In this way, during the refresh rate setting process, the user will not be aware of the refresh rate setting process, which can improve the user experience.
[0196] During the implementation of the solution in Figure 7, if the user moves the mouse while covering the first interface, the frozen screen of the full-screen window will cause the mouse position to be inconsistent, which is a poor user experience. To solve this problem, the embodiments of the present application propose the embodiments of Figures 8A and 9.
[0197] In an embodiment of the present application, a method for setting a refresh rate and an electronic device are provided. At a first moment, the electronic device displays a first window. At the first moment, the first window is the focus window, the screen refresh rate of the electronic device is the first refresh rate, and a first cursor is displayed in the first window. At a second moment, in response to a first user operation, the electronic device displays a second window. After the second moment, the second window is the focus window, and a second cursor is displayed in the second window. Starting from the second moment, after a first period of time, the electronic device sets the screen refresh rate to the second refresh rate. During the first period of time, the position of the second cursor is not static, and the screen refresh rate is the first refresh rate. After the first period of time, the position of the second cursor is static. After the screen refresh rate is set to the second refresh rate, at a third moment, in response to a second user operation, the electronic device displays the first window. After the third moment, the first window is the focus window, and the first cursor is displayed in the first window. Starting from the third moment, during the second period of time, the electronic device sets the screen refresh rate to the first refresh rate. During the second period of time, the position of the first cursor is static, and the duration of the first period of time is greater than or equal to the duration of the second period of time. In this way, the electronic device can maintain the display position of the cursor unchanged during the refresh rate setting process, thereby reducing screen jumps and improving the user experience.
[0198] After the second period, at a fourth moment, in response to a third user operation, the electronic device displays a third window. After the fourth moment, the third window is the focus window, and the third cursor is displayed in the third window. Starting from the fourth moment, within the third period, the electronic device sets the screen refresh rate to the third refresh rate. Within the third period, the position of the third cursor is not static, the duration of the first period is greater than or equal to the duration of the third period, the third refresh rate is greater than the first refresh rate, and the third refresh rate is greater than the second refresh rate. In this way, for scenarios where the cursor is sensitive to changes but the refresh rate setting requirement is not high (low priority), the electronic device can not set the refresh rate when the cursor is moving; wait until the cursor is stationary, then set the refresh rate, and the cursor position displayed during the setting process remains unchanged. This ensures that the user does not perceive the screen jump caused by setting the refresh rate and the situation that the cursor is out of control, and can quickly set it at the right time to adapt to the needs of the current scene, and can also reduce refresh energy consumption. For scenarios where the cursor is not sensitive to changes but the refresh rate setting requirement is high (high priority), the electronic device can set the refresh rate when the cursor is moving or when the cursor is stationary, and the cursor position displayed during the setting process remains unchanged. This ensures that the refresh rate setting improves user needs, and the refresh setting speed is fast, and the static cursor in the screen has less impact on the screen, which can quickly adapt to the needs of the current scene and improve user experience.
[0199] In order to solve the problem of the mouse not following the hand and the screen being stuck during the refresh rate setting process in Figure 7, this application proposes the refresh rate setting method shown in Figures 8A and 9. Among them, Figure 8A is the process of obtaining the refresh task, and the method in Figure 9 is the process of processing the task obtained in Figure 8A.
[0200] FIG8A is a flowchart of a method for obtaining a task disclosed in an exemplary embodiment of the present application. When the focus window changes, executing the method shown in FIG8A can obtain the refresh rate setting task in a timely manner, ensuring the timeliness and reliability of the processing. As shown in FIG8A, the task acquisition method may include but is not limited to the following steps:
[0201] S801: When the focus window changes, the electronic device performs scene recognition to determine a first scene.
[0202] The electronic device subscribes to the focus window event and can determine whether the current focus window has changed based on the focus window event. In the event that the focus window changes, the electronic device performs a scene recognition process to determine that the current scene is the first scene X. The process of the electronic device obtaining the focus window event can be referred to the relevant description in Figure 5A and is not repeated here.
[0203] When the focus recognition module of the electronic device obtains a focus window event, it can determine that the focus window has changed; when the focus window event is not obtained, it can be determined that it is the most recently obtained focus window, that is, the focus window has not changed. The electronic device can then determine the process name of the current focus window based on the focus window event, and thus determine the corresponding first scene X. For example, if the process name is word.exe, the first scene X can be determined to be an office scene. If the process name is game.exe, the first scene X can be determined to be a game scene. The types of scenes can include office scenes, game scenes, video scenes, etc., without specific limitation.
[0204] When the electronic device obtains a focus window event, it may request to start a first thread, and the first thread may execute the method flow in FIG8A .
[0205] S802: The electronic device determines whether a setting condition is satisfied. If the setting condition is satisfied, S803 is executed; if the setting condition is not satisfied, S803 is not executed.
[0206] Optionally, the electronic device may determine whether a set start condition is satisfied. The set start condition includes at least one of the following conditions. If the set start condition includes multiple conditions, the electronic device satisfies all of the conditions to satisfy the set start condition.
[0207] The following describes the possible conditions for setting the startup conditions:
[0208] Condition 1: The refresh rate setting function has been enabled.
[0209] Among them, the electronic device obtains the first mark of the refresh rate setting function. When the first mark indicates that the refresh rate setting function has been turned on, it is determined that condition 1 is met; when the first mark indicates that the refresh rate setting function has not been turned on, it can be determined that condition 1 is not met.
[0210] The refresh rate setting function can be turned on or off by the user. Exemplarily, the electronic device is provided with a switch control for the refresh rate setting function in the function management interface provided to the user. In the case where the switch control for the refresh rate setting function has been turned on, the first mark is "1", the user clicks the switch control, and in response to the above operation, the electronic device sets the first mark to "0", and the refresh rate setting function is turned off. In the case where the switch control for the refresh rate setting function has been turned off, the first mark is "0", the user clicks the switch control, and in response to the above operation, the electronic device sets the first mark to "1", and the refresh rate setting function is turned on. In this way, a switch channel for the refresh rate setting function can be provided to the user, ensuring the flexibility of user use.
[0211] For example, FIG8B is a schematic diagram of an interface of a graphics card control panel disclosed in an exemplary embodiment of the present application. As shown in FIG8B , the electronic device can display a window interface of the graphics card control panel. The window interface of the graphics card control panel can include a display settings window 821, which displays "Enable" and "Disable" options for the "Screen Refresh Rate Switching" function. Currently, "Screen Refresh Rate Switching" has been "Enabled," satisfying the aforementioned condition 1.
[0212] Condition 2: The first resolution is a preset resolution.
[0213] The electronic device stores the preset resolution list. The preset resolution list is a list of supported resolutions driven by a graphics card. The first resolution is the resolution of the current electronic device display screen.
[0214] Whether the first resolution is a resolution in the preset resolution list. If the preset resolution list includes the first resolution, the electronic device may determine that the preset resolution condition is met, that is, condition 2 is met; if the preset resolution list does not include the first resolution, the electronic device may determine that the preset resolution condition is not met, that is, condition 2 is not met.
[0215] During the virtual refresh rate switching process in some operating systems, under certain resolution conditions, switching the virtual refresh rate will also cause the resolution to change. In condition 2, to ensure that the virtual refresh rate change does not affect the resolution, you can filter the current resolution according to the preset resolution list to improve the user experience when switching the virtual refresh rate.
[0216] Condition 3: The active signal refresh rate is the preset refresh rate.
[0217] The electronic device can determine whether the active signal refresh rate is the preset refresh rate. When the active signal refresh rate is the preset refresh rate, condition 3 is met; when the active signal refresh rate is not the preset refresh rate, condition 3 is not met.
[0218] The active signal refresh rate can be understood as the refresh rate of the graphics card. The preset refresh rate is the preset baseline refresh rate of the electronic device. The threshold preset refresh rate of different device types may be different, for example, 165Hz, which is not limited in this application.
[0219] When the active signal refresh rate is a preset refresh rate, the electronic device can support the setting of the software refresh rate to ensure the reliability of subsequent settings.
[0220] When an electronic device switches its virtual refresh rate, both VBP and VFP in Figure 1 need to be set based on the active signal refresh rate. If the active signal refresh rate is not the preset refresh rate, the electronic device needs to reset the graphics card to set the relevant parameters of the virtual refresh rate based on the current active signal refresh rate. During the process of resetting the graphics card parameters, the electronic device will go black, resulting in a poor user experience. Therefore, in order to avoid the black screen problem that occurs before switching the virtual refresh rate, this application can eliminate the above situation in advance to improve the user experience.
[0221] Condition 4: The first application is a preset application.
[0222] The electronic device can determine whether the first application belongs to a preset application by filtering the first application in a blacklist and / or filtering the first application in a whitelist. The blacklist and the whitelist are application lists. The first application is the application corresponding to the focus window.
[0223] Optionally, the electronic device is pre-installed with a blacklist. When the blacklist includes the first application, the electronic device determines that it does not belong to the preset application, that is, condition 4 is not met; when the blacklist does not include the first application, the electronic device determines that it belongs to the preset application, that is, condition 4 is met.
[0224] Optionally, the electronic device is pre-installed with a whitelist. If the whitelist includes the first application, the electronic device belongs to the preset application, that is, condition 4 is met; if the whitelist does not include the first application, the electronic device is determined not to belong to the preset application, that is, condition 4 is not met.
[0225] Since some applications have settings that change the refresh rate settings, the setting processing process in the embodiment is not required. Therefore, applications that set the refresh rate are filtered out in advance and the settings are not repeated, thereby improving the effectiveness and efficiency of the settings.
[0226] Among them, if there is a setting start condition, the setting start condition can include at least one of the above four conditions. The specific conditions included in the setting start condition are not limited, and the order of execution of each condition is not limited.
[0227] If the above setting conditions are not met, the electronic device does not set the refresh rate.
[0228] S803: The electronic device adds the first task information to the buffer.
[0229] The first task information can be generated based on the first scenario X and used to set the refresh rate in Figure 9. The task information can include a refresh rate, priority, and timestamp. The refresh rate refers to the target refresh rate for the current task; the priority can be low or high; and the timestamp indicates when the task was generated. The buffer is used to cache the task information used to set the refresh rate. The buffer can contain at most one task information at a time.
[0230] The electronic device may determine a target refresh rate based on the first scene X. The target refresh rate is the target refresh rate that the electronic device needs to be set to in the first scene X, that is, the refresh rate corresponding to the current scene. Specifically, the electronic device may store a mapping relationship between scene types and refresh rates, and the electronic device may determine the target refresh rate corresponding to the first scene X based on the mapping relationship. For example, the refresh rate corresponding to the gaming scene is 144Hz, the refresh rate corresponding to the office scene is 60Hz, and so on. This application does not limit the above mapping relationship.
[0231] The electronic device may determine a first priority based on the first scene X. The electronic device may classify different scenes into low priority and high priority based on a mapping relationship between scene types and priorities. For example, a gaming scene may be a high priority, while an office scene may be a low priority.
[0232] Optionally, after obtaining the first task information, the electronic device may further determine whether the first task meets the addition condition. If the first task meets the addition condition, the electronic device adds the first task information to the buffer and wakes up the second thread. If the first task does not meet the submission condition, the electronic device discards the first task information, i.e., does not add the first task.
[0233] The following describes two possible implementations of determining whether the first task meets the addition condition:
[0234] In one possible implementation, if the buffer does not contain any task information, it is determined that the addition condition is met and the first task information can be added to the buffer. If the buffer contains any task information, the task information in the first buffer is cleared and it is determined that the addition condition is met and the first task information is submitted to the buffer.
[0235] In the above implementation, the electronic device takes the most recent task as the basis, so that the tasks in the buffer can be executed, the old tasks can be eliminated, and the most recent tasks can be executed, ensuring that the refresh rate is set based on the user's most recent operation, simplifying the processing process and improving the user experience.
[0236] In another possible implementation, when there is no task in the buffer, it is determined that the submission condition is met and the first task information is added to the buffer. When there is a task in the buffer, the electronic device determines whether the priority of the task in the buffer is higher than the priority of the first task. When the priority of the second task is higher than the priority of the first task (the priority of the second task is high priority and the priority of the first task is low priority), it is determined that the addition condition is not met and the first task information is discarded. When the priority of the second task is not lower than the priority of the first task, the timestamp of the first task is closer to the current time, and it is determined that the addition condition is met.
[0237] In the above implementation, the electronic device may retain tasks with higher priorities, execute tasks according to their importance, and screen tasks to ensure the effectiveness of task processing.
[0238] When the first task is of high priority, the electronic device needs to further determine whether a global variable needs to be set. If it is determined that a global variable needs to be set, the electronic device may further set the global variable.
[0239] The global variable indicates the processing status of the refresh rate setting task, which can also be understood as the life cycle of the second thread corresponding to Figures 9 and 11. Global variables can include running, wait, cancel, and stop. Running indicates that the second thread is processing the task; stop indicates that the second thread has finished; wait indicates that the second thread is waiting for the task; and cancel indicates that the second thread has canceled the task.
[0240] After acquiring the first task, the electronic device may determine whether it meets the requirement to set the global variable. If the first task is of high priority and the global variable is "running," the electronic device may set the global variable to "cancel." In other words, if the electronic device determines that the first task is of low priority or the global variable is not "running," the electronic device may determine that the global variable does not need to be set, does not process the global variable, and leaves the global variable unchanged.
[0241] In the embodiment of FIG8A above, the electronic device can start the first thread, obtain the first scene, and generate the set task information based on the first scene when the focus window changes. Therefore, the timeliness and reliability of the refresh rate task acquisition can be guaranteed. In addition, it is necessary to determine whether the setting conditions are met before generating the task, which can ensure the setting premise and improve the feasibility of setting the refresh rate. The acquisition of task information can provide a reliable basis for the specific processing of the refresh rate setting in the subsequent FIG9, ensuring the efficiency of subsequent execution.
[0242] With reference to S803 in FIG. 8A , after the first thread puts the task information into the buffer, the second thread executes the task in the buffer. The specific execution process is the method for setting the refresh rate as shown in FIG. 9 .
[0243] FIG9 is a flow chart of a method for setting a refresh rate disclosed in an exemplary embodiment of the present application. As shown in FIG9 , the method for setting a refresh rate may include but is not limited to the following steps:
[0244] S901: The electronic device wakes up the second thread.
[0245] In conjunction with the contents of the global variable in S803 in FIG8A , when the global variable of the second thread is in the wait state, there is no task information in the buffer for processing. If task information is added to the buffer, the electronic device can wake up the second thread and then process the task information. It should be understood that when the second thread is not woken up, the second thread is usually in the wait state.
[0246] The process of the electronic device waking up the second thread may include the following two situations:
[0247] Case 1: Wake up the second thread based on timeout.
[0248] The electronic device determines whether to set a timeout mark based on the first cycle duration, and if the timeout mark is set, the electronic device waits for the first preset time duration and then wakes up the second thread. If the timeout mark is not set, the electronic device does not wake up the second thread and continues waiting.
[0249] Optionally, the electronic device determines whether there is a timer timeout according to whether the timer has timed out. If the timer has timed out, the electronic device wakes up the second thread; if the timer has not timed out or there is no timer, the electronic device does not wake up the second thread and continues to wait. In combination with the case of setting the timer in S907, the electronic device can determine whether there is a timer timeout every first period. If there is a timer, the electronic device can determine whether the time of the timer is greater than or equal to (greater than) the first threshold time (which can be the first time). If it is greater than or equal to (greater than) the first threshold time, the electronic device can determine that the timer has timed out; if it is less than (less than or equal to) the first threshold time, the electronic device can determine that the timer has not timed out.
[0250] In case 1, if the task is suspended, it is necessary to add the task information to the buffer again through S907. At this time, it is necessary to wait for a period of time to wake up again and take care that the task is executed again. Combined with the execution logic of S906 to S911, for low-priority tasks, the frequency of setting the refresh rate task can be effectively controlled, and the refresh rate can be set when waiting for the mouse to be stationary.
[0251] Case 2: The wake-up request of the first thread wakes up the second thread.
[0252] If the electronic device receives a wake-up request from the first thread, it wakes up the second thread. If it does not receive a wake-up request, it does not wake up the second thread and continues waiting. In S803, after adding the task information to the buffer, the first thread may send a wake-up request to the second thread, and the wake-up request may wake up the second thread.
[0253] In case 2, the new task information is added to the buffer in S803, which can remind the second thread that it can execute the task.
[0254] S902: The electronic device determines whether the global variable is ended.
[0255] In conjunction with the content of the global variable in S803 in FIG8A , the global variable may include "stop." The electronic device determines whether the global variable of the second thread is "stop." If the global variable is "stop," the electronic device may determine to terminate the second thread, i.e., execute S903. If the global variable is not "stop," the electronic device may determine to continue running the second thread, execute S904, and set the global variable to "running."
[0256] The following describes several different possible situations in which the second thread is stopped:
[0257] Case A: When PC Manager is enabled in Figure 3, the electronic device can execute the second thread. Upon exiting PC Manager, the electronic device determines that the second thread needs to be terminated and sets the global variable to "stop." For example, if the user clicks "Exit PC Manager," the electronic device may receive a request to close PC Manager. In response to this request, the electronic device may set the global variable to "stop."
[0258] Case b: When the electronic device is shut down, the electronic device needs to end the second thread, and the electronic device can set the global variable to stop. For example, when the electronic device receives a shutdown request, the electronic device sets the global variable to stop.
[0259] During the processing of S902, the current state of the global variable can be queried during the thread processing. When the electronic device needs to end the second thread, it can perform a soft exit according to the thread execution logic instead of forcibly terminating the thread. Resources can be released according to normal logic, avoiding errors caused by forced termination and ensuring program security.
[0260] S903: The electronic device ends the second thread.
[0261] When the electronic device determines in S902 that the global variable is stop, it may exit the second thread.
[0262] S904: The electronic device obtains first task information from the buffer and clears the buffer.
[0263] The first task information may include the priority, target refresh rate, and timestamp of the first task.
[0264] Optionally, after the electronic device obtains the first task information from the buffer, it may set the global variable to running.
[0265] Optionally, before executing S904 and setting the global variable to running, the electronic device may determine whether the global variable is cancel. If the global variable is cancel, execute S901 and set the global variable to wait state; if the global variable is not cancel, continue processing S904.
[0266] After the buffer is cleared, there are no tasks stored in the buffer, which ensures that the buffer can store at most one task at a time. Setting a maximum of one task ensures that the setting is the user's most recent operation and the user scenario needs. In addition, the number of tasks can be controlled, the number of settings can be reduced, and the refresh rate setting can be prevented from excessively occupying processing resources, thus optimizing the user experience.
[0267] S905: The electronic device determines whether the target refresh rate is equal to the current refresh rate. If the target refresh rate is not equal to the current refresh rate, execute S906. Otherwise, execute S901.
[0268] In the execution logic of S905 , when the target refresh rate is equal to the current refresh rate, the execution of the current task may be canceled and the global variable may be set to the wait state.
[0269] S906: The electronic device determines whether the time difference between the current time and the last set time is less than or equal to (less than) a preset minimum period, and the first task is of low priority. If yes, execute S907; otherwise, execute S908.
[0270] If the time difference between the current time and the last time the refresh rate was set is less than or equal to (less than) the preset minimum period, it can be determined that the setting speed is too fast or the number of settings is too frequent. If the first task has a low priority, S907 is executed. Otherwise, if the setting speed is not too fast or the first task has a high priority, S908 is executed.
[0271] The electronic device may determine whether the difference between the current time and the last time the refresh rate was set is greater than a preset minimum period. If the time difference between the current time and the last time the refresh rate was set is greater than or equal to (greater than) the preset minimum period, the refresh rate is determined to be set too fast, and S907 is executed. If the time difference between the current time and the last time the refresh rate was set is less than (less than or equal to) the preset minimum period, the refresh rate is determined to be set too fast. The minimum period may be a time length set in advance by the device and is not limited.
[0272] Electronic devices can control the screen refresh rate so that the setting frequency is not too frequent. Electronic devices can avoid frequent settings that occupy the processing resources of the electronic device, causing the electronic device to process other tasks slowly, thereby preventing the device from freezing and improving the user experience of the electronic device.
[0273] S907: The electronic device adds the first task information to the buffer.
[0274] The electronic device may add the first task information to the buffer again and set a timeout mark or timer. After setting the timeout mark or timer, the electronic device may execute the process of waking up the second thread based on waiting timeout in case 1 in S901, which will not be described in detail.
[0275] After the electronic device sets the timeout mark or sets the timer, the global variable can be set to the wait state, so as to wait for the subsequent process S901 to be re-awakened.
[0276] S908: The electronic device obtains mouse information.
[0277] The electronic device may wait for a second preset time period and obtain the mouse information within the second preset time period. After the second preset time period, step S909 is executed.
[0278] Among them, the second preset duration is the duration set by the electronic device, which is not limited in this application.
[0279] The mouse information may include one or more of the mouse position and peripheral events, without limitation.
[0280] In a possible implementation, the electronic device obtains the mouse position within a second preset time period.
[0281] The mouse position can be understood as the coordinate information of the mouse on the screen. The electronic device can obtain the mouse position at different times within a period of time. For example, the electronic device can obtain a first mouse position and a second mouse position within a second preset time period. The first mouse position can be the mouse position obtained at the beginning of the second time period, and the second mouse position can be the mouse position obtained at the end of the second time period. The number of mouse positions can be two or more, without limitation.
[0282] In another possible implementation, the electronic device obtains the peripheral device event within a second preset time period.
[0283] In one case, when the electronic device obtains a peripheral device event, it reports the peripheral device event.
[0284] 5B , within the second preset duration, when the peripheral driver obtains a peripheral event, the electronic device proactively reports the peripheral event to the focus recognition module. At this time, the peripheral event may include an event type. The event type may include at least a mouse wheel sliding event and a mouse dragging event.
[0285] In another case, the electronic device may periodically obtain peripheral events.
[0286] In conjunction with Figure 5B, within the second preset duration, the electronic device can periodically obtain peripheral events. The focus identification module can periodically inquire the system event-driven node about peripheral events. In the case that the system event-driven node obtains a peripheral event since the last report, the event type can be reported to the focus identification module. In the case that no peripheral event is obtained since the last report, an indication information that there is no peripheral event can be reported to the focus identification module (or no report, indicating that there is no peripheral event). The electronic device can obtain a specific peripheral event type or information about the absence of a peripheral event. Among them, the periodic duration of the periodic acquisition can be in the range of 50ms to 900ms.
[0287] S909: The electronic device determines whether the mouse is in a changing state. If the mouse is in a changing state, execute S910. If the mouse is in a static state, execute S912.
[0288] When the mouse is in a changed state, the electronic device can count the number of attempts, that is, add 1 to the number of attempts. The first counted number of attempts is 1.
[0289] The electronic device can determine whether the mouse is in a changed state based on the mouse information.
[0290] In the case where the mouse information includes the mouse position, the electronic device may determine whether the mouse is in a changed state based on the mouse position, as described below in conjunction with S908:
[0291] When the mouse information includes multiple mouse positions, if the multiple mouse positions are at the same coordinate position, the electronic device can determine that the mouse is in a stationary state. If the multiple mouse positions are at different coordinate positions, the electronic device can determine that the mouse is in a changing state.
[0292] Exemplarily, when the mouse position includes a first mouse position and a second mouse position, if the first mouse position and the second mouse position are the same, the mouse is in a stationary state; if the first mouse position and the second mouse position are different, the mouse is in a changing state.
[0293] In the case where the mouse information includes a peripheral event, the electronic device may determine whether the mouse is in a changed state based on the peripheral event, as described below in conjunction with S908:
[0294] If the peripheral event changes within the second preset time period (i.e., the number of peripheral events acquired within the second preset time period is greater than or equal to 2), the electronic device may determine that the mouse is in a changing state. If the peripheral event remains unchanged within the second preset time period (i.e., the number of peripheral events acquired within the second preset time period is less than 2), the electronic device may determine that the mouse is in a stationary state.
[0295] When the mouse information includes the mouse position and the peripheral event, the above-mentioned embodiments can be used to determine each of them. If one of the determination results is a changing state, it can be determined that the current mouse state is changing. If both determination results are a static state, it can be determined that the current mouse state is static.
[0296] S910: The electronic device determines whether the number of attempts exceeds a threshold number. If the number of attempts exceeds the threshold number, the electronic device executes S911. Otherwise, the electronic device executes S908.
[0297] During the above-mentioned processing of S908 to S911, the electronic device can determine whether to set it directly based on the mouse state. If the mouse is in a stationary state, the setting process will not affect the user experience and the setting can be started immediately; if the mouse is in a changing state, you can wait for a while before setting it, to ensure that the mouse is stationary as much as possible and improve the user experience.
[0298] S911: The electronic device determines whether the first task has a high priority. If the first task has a high priority, the electronic device executes S912. If the first task has a low priority, the electronic device executes S907.
[0299] During the above process, the electronic device can determine whether the task is high priority. If the task is high priority, the setting can be performed directly without prioritizing whether the mouse is stationary. If the task is low priority, it is necessary to determine whether to enter the setting process (whether to execute S815) based on the mouse status. In this way, for applications and scene types that are more seriously affected by mouse pause or movement, more stringent screening can be carried out to ensure that scenes that are sensitive to mouse changes can prioritize user experience. For scenes that are not sensitive to mouse movement, the setting can be performed directly to ensure that the user will not perceive the mouse changes during the refresh rate setting process.
[0300] S912: The electronic device sets the screen refresh rate to the target refresh rate.
[0301] Among them, the electronic device can set the virtual refresh rate to the target refresh rate, that is, the electronic device can set the screen refresh rate to the target refresh rate by changing VBP and VFP in Figure 1.
[0302] The specific execution process of S912 may refer to the relevant contents of S701 to S703 in FIG. 7 , which will not be described in detail.
[0303] In S912, the process of setting the refresh rate without perception is executed, and the mouse position visible to the user remains unchanged. After S912 is executed, the electronic device can set the global variable to the wait state and can continue to execute S901.
[0304] In the embodiment of Figure 9 above, the electronic device can control the execution of low-priority refresh rate setting tasks during periods when the mouse is stationary, while setting the refresh rate for high-priority tasks directly. This categorized processing allows for the timing of setting the refresh rate for scenarios that have a significant impact on the user, minimizing user perception. For scenarios with higher refresh rate requirements, the refresh rate can be set immediately, improving the user's visual and operational experience. This can reduce the impact of screen freezing during refresh rate setting, reduce user perception of screen freezes, and enhance the user experience.
[0305] 9 , FIG10A and FIG10B illustrate different situations in the process of processing the task of setting the refresh rate. FIG10A and FIG10B are schematic diagrams of a set of task processing processes disclosed in an exemplary embodiment of the present application.
[0306] In Figures 10A and 10B , the first thread can process the method in Figure 7 to generate a task for setting a refresh rate, and the second thread can process the method in Figure 8A to process a task for setting a refresh rate.
[0307] Figure 10A illustrates the process of directly executing the screen refresh rate setting process when S902, S905, and S906 in Figure 9 are met and the mouse is stationary. As shown in Figure 10A, when the focus window changes, the first thread can obtain new task information and generate task 1 (first task information). The first thread can submit task information 1 to the buffer. The first thread can then wake up the second thread. The second thread starts to obtain task information 1 from the buffer and clears the buffer. When the relevant conditions for the refresh rate setting are met (refer to Figure 9 for details), the screen refresh rate can be set to the target refresh rate (S912). At this point, task 1 processing is completed.
[0308] Figure 10B illustrates the process of re-adding task information to the buffer when the low-priority task is set too quickly in S906 of Figure 9, or when the number of attempts during mouse changes exceeds a threshold in S908-S911. As shown in Figure 10B, the first thread also generates Task 2 when the focus window changes, and submits Task 2 to the buffer. The first thread can then wake up the second thread. After waking up, the second thread begins to retrieve Task 2 from the buffer and clears the buffer. The second thread determines that Task 2 is low-priority and set too quickly (S906), or that Task 2 is low-priority and the number of attempts during mouse changes exceeds a threshold (S908-S911). It then re-submits Task 2 to the buffer and sets a timeout (S907). If the timeout expires, the second thread can wake up automatically and continue to retrieve Task 2 from the buffer, clear the buffer, and continue to attempt to set the task. The process of continuing to attempt to set the task can be referred to the process in Figure 9 and will not be described in detail. Low-priority tasks need to control the set speed and ensure that the mouse is in a stationary state. If the set conditions are not met, the task needs to be processed again.
[0309] The task processing results of Figures 10A and 10B above may exist in the following two situations: task processing is completed and the task is added to the buffer again waiting to be reprocessed. Multiple task processing results can correspond to multiple situations. Prioritize high-priority tasks to ensure the processing speed and meet the needs of user scenarios. When the current refresh rate and the target refresh rate are inconsistent, settings are made to ensure the necessity and accuracy of the settings and reduce unnecessary processing processes. According to the setting frequency limit, avoid setting too frequently, reduce excessive occupation of device processing resources, and improve user experience. The above-mentioned setting speed, setting timing and setting results can make the refresh rate setting a better experience for users using the device.
[0310] In conjunction with the method shown in FIG8A , when adding a new task, the electronic device can set the global variable to cancel when the new task is of high priority and the global variable is in the running state. FIG11 , based on FIG9 , can further determine whether the second thread cancels the processing of the current task based on the setting of the cancel state of the global variable.
[0311] FIG11 is a flowchart of another method for setting the refresh rate disclosed in an embodiment of the present application. As shown in FIG11 , the method for setting the refresh rate may include but is not limited to the following steps:
[0312] S1101: The electronic device wakes up the second thread.
[0313] S1102: The electronic device determines whether the global variable is ended. If the global variable is ended, S1103 is executed; if the global variable is not ended, S1104 is executed.
[0314] S1103: The electronic device ends the second thread.
[0315] Among them, S1101 to S1103 can refer to the relevant content in S901 to S903 and will not be repeated here.
[0316] S1104: The electronic device determines whether the global variable is canceled. If the global variable is canceled, S1101 is executed; if the global variable is not canceled, S1105 is executed.
[0317] The electronic device can determine whether the global variable is canceled. If the global variable is canceled, the task currently being processed by the second thread can be canceled. If the global variable is not canceled, it can be understood that there are no new tasks and the current task needs to continue processing. In conjunction with S803 of Figure 8A, the first thread adds a new high-priority task. If the second thread is running, the old task can be canceled and the global variable is set to cancel. In S1104, the second thread determines that the global variable is canceled, directly abandons the old task, and executes the new task. This ensures the timeliness and efficiency of task processing.
[0318] Optionally, in combination with S1102 and S1104, in another implementation, when the global variable is "End", the electronic device executes S1103 to terminate the second thread. When the global variable is "Cancel", S1101 is executed and the current task is not processed. It should be noted that the order of processing tasks S1102 and S1104 is not limited.
[0319] After S1102 and S1104 , the electronic device may set the global variable to running.
[0320] S1105: The electronic device obtains first task information from the buffer and clears the buffer.
[0321] S1106: The electronic device determines whether the target refresh rate is equal to the current refresh rate. If the target refresh rate is not equal to the current refresh rate, execute S1107. Otherwise, execute S1101.
[0322] S1107: The electronic device determines whether the time difference between the current time and the last switching time is less than or equal to (less than) a preset minimum period, and the first task is of low priority. If yes, execute S1108; otherwise, execute S1109.
[0323] S1108: The electronic device adds the first task information to the buffer.
[0324] S1109: The electronic device obtains mouse information.
[0325] S1110: The electronic device determines whether the mouse is in a changing state. If the mouse is in a changing state, execute S1111. If the mouse is in a static state, execute S1113.
[0326] Among them, S1105 to S1110 can refer to the relevant content of S904 to S909 in Figure 9, and will not be repeated here.
[0327] S1111: The electronic device determines whether the global variable is canceled. If the global variable is canceled, S1101 is executed; if the global variable is not canceled, S1112 is executed.
[0328] The processing process of S1111 may refer to the relevant content of S1104 and will not be described in detail.
[0329] It should be noted that the process of determining whether the global variable is canceled can also be performed at other times, such as before waking up the second thread, which is not limited in this application.
[0330] S1112: The electronic device determines whether the number of attempts exceeds a threshold number. If the number of attempts exceeds the threshold number, the electronic device executes S1113. Otherwise, the electronic device executes S1109.
[0331] S1113: The electronic device determines whether the first task has a high priority. If the first task has a high priority, the electronic device executes S1114. If the first task has a low priority, the electronic device executes S1108.
[0332] S1114: The electronic device sets the screen refresh rate to the target refresh rate.
[0333] Among them, the relevant descriptions of S1112 to S1114 can refer to the relevant contents of S910 to S912 and are not repeated here.
[0334] Figures 11 and 12 illustrate how to cancel a task when the second thread determines that the global variable is cancel. Figure 12 is a schematic diagram of a task processing process disclosed in an exemplary embodiment of the present application. Figure 12 illustrates another parallel task processing scenario when Figures 10A and 10B are combined.
[0335] As shown in Figure 12, if task information 3 exists in the buffer, the second thread obtains task information 3 from the buffer and clears the buffer (the process of obtaining task 2 can be referred to Figures 10A and 10B and will not be described in detail). In the second thread, if the global variable is determined to be canceled (S1104 and S1111) or the target refresh rate is equal to the current refresh rate (S1106), the electronic device executes S1101, which can be understood as canceling the processing of task 3.
[0336] The task processing result in Figure 12 shows the situation of task cancellation. Canceling the current task can discard the old task and directly process the new task, ensuring the timeliness of task execution.
[0337] 11 , the processing of the second thread for different global variables has been described. FIG13 , in conjunction with the first thread and the second thread, specifically illustrates the process of global variable changes and related processing.
[0338] Figure 13 is a schematic diagram of the change process of a global variable disclosed in an exemplary embodiment of the present application. As shown in Figure 13, at time T1, in S1101, the second thread has not yet woken up and the global variable is set to wait. At time T2, the second thread executes S1101 to wake up the second thread, and then the global flag bit of the task status can be set to running. During the period from time T1 to time T2, the buffer stores task A. At time T3, the second thread obtains task A from the buffer and clears the buffer. At time T4, the first thread obtains a new task B and adds the task information of task B to the buffer (task B is a high priority). At time T5, the first thread determines that task B is a high priority and the global variable is in the running state, and sets the global variable to cancel. At time T6, while the second thread is processing task A, it determines that the global variable is in the cancel state and cancels the execution of task A. After task A is canceled, at time T7, the second thread sets the global variable to the wait state. At time T8, the second thread wakes up and sets the global variable to running. At time T9, the second task obtains the task information of task B in the buffer and clears the buffer. At time T10, the second thread determines that it is not in the cancel state and continues to execute task A. At time T11, the second thread sets the processing based on task B, and sets the global variable to the wait state. The changes in the global variables can refer to the relevant descriptions in Figures 8A, 9 and 11, which are not repeated here. In the above-mentioned embodiment, the electronic device can determine whether there is a new task with high priority by controlling the global variable, and can stop processing the old task in time, reduce unnecessary setting processing, and ensure the timeliness and efficiency of the setting.
[0339] In conjunction with FIG9 and FIG11 , several optional implementation methods are proposed in the embodiment of the present application:
[0340] Implementation 1: In S908-S912, the electronic device can first determine the priority and then execute the loop logic. That is, the second thread can first determine whether the first task has a high priority. If the first task has a high priority, it will directly execute S912. If the first task has a low priority, it will execute S908-S911. If the mouse state is changing, the loop will continue until the number of waiting attempts does not exceed a threshold number. If the number of waiting attempts exceeds the threshold number, it will execute S907.
[0341] In the above-mentioned embodiment 1, the process of determining whether the first task is a high-priority task can be advanced. Compared with the processing flow of Figure 9, if the first task is a high-priority task, the processing process of S908 to S911 is reduced, and the setting process is directly entered, reducing the number of loops, improving the processing speed, and simplifying the processing flow. In the embodiment of Figure 9, if the first task is a high-priority task, a certain number of attempts are also given. If possible, the setting is performed when the cursor is stationary, which provides a better user-unaware setting experience.
[0342] Similarly, in the implementation in FIG11 , S1114 may also be executed before S1109 , which will not be described in detail.
[0343] Implementation 2: The electronic device may also execute step S912 before S906. If the priority is high, S912 is executed; if not, S906 is executed to determine whether the speed is set too fast (no priority determination is performed). If the speed is set too fast, S907 is executed; if not, S908 to S911 are executed. This is not described in detail here.
[0344] In the above embodiment 2, the classification of high and low priorities can be advanced to ensure that the high priority is set faster, and the subsequent judgment process can be simplified to improve execution efficiency.
[0345] Implementation 3: When the second thread obtains task information from the buffer, it does not need to clear the buffer. The buffer is cleared after the task is canceled in S1104 or S1111, the second thread ends in S902, or the refresh rate is set in S912. The second thread does not need to perform the process of adding the first task information to the buffer in S907.
[0346] In the third embodiment described above, the electronic device may not clear the buffer after acquiring the first task information. If the current task is subsequently canceled or completed, the current task in the buffer is cleared. Clearing the buffer is not required when the task is retrieved for execution again. This reduces the need to resubmit the first task information, ensuring efficient and timely processing.
[0347] 8A and 3, Figures 14 to 16 respectively illustrate the execution of various modules of the computer manager of the electronic device when the mouse is stationary or moving under different priority tasks. The various modules of the computer manager can refer to the relevant description of Figure 3 above and will not be repeated here.
[0348] FIG14 is a flow chart of another method for setting the refresh rate disclosed in an exemplary embodiment of the present application. As shown in FIG14 , when the first task is of low priority and the number of waiting attempts of the changed mouse has not exceeded the threshold number, the task of setting the refresh rate is executed after the mouse changes from the changed state to the stationary state. The method for setting the refresh rate may include, but is not limited to, the following steps:
[0349] The computer manager of the electronic device may include a focus recognition module, an overload control module, a seamless setting module and a mouse hold module. For the above four modules, reference may be made to the relevant description in FIG3 and no further details are given.
[0350] S1401: When the focus window changes, the focus recognition module performs scene recognition to determine a first scene.
[0351] S1402: The focus recognition module adds the first task information to the buffer when the setting conditions are met.
[0352] Among them, S1401 to S1402 can refer to the relevant content of S801 to S803 in Figure 7, and will not be repeated here.
[0353] S1403: The overload control module determines whether a timeout is set.
[0354] Among them, S1403 can refer to the relevant content of situation 2 in S901 and will not be repeated here.
[0355] S1404: The overload control module waits for a wake-up request.
[0356] Among them, S1404 can refer to the relevant content of S901 case 2, which is not repeated here. At this time, no wake-up request is received, and the waiting continues.
[0357] S1405: The focus identification module sends a wake-up request to the overload control module.
[0358] After executing S1402, the focus identification module may send a wakeup request to the overload control module. After receiving the wakeup request, the overload control module may execute S1406. For details, please refer to S803, where the first thread generates the wakeup request and then wakes up the second thread. For details, please refer to S901, where the second thread is woken up.
[0359] S1406: The overload control module wakes up the second thread based on the wake-up request.
[0360] After receiving the wake-up request, the overload control module may wake up the second thread based on the wake-up request.
[0361] S1407: The overload control module determines whether the global variable is ended. The current global variable is not stop.
[0362] S1408: The overload control module obtains the first task information from the buffer and clears the buffer.
[0363] S1409: The overload control module determines whether the target refresh rate is equal to the current refresh rate. If the target refresh rate is not equal to the current refresh rate, the overload control module determines whether the target refresh rate is equal to the current refresh rate.
[0364] S1410: The overload control module determines whether the time difference between the current time and the last switching time is less than or equal to the preset minimum period, and the first task is of low priority. The overload control module determines that the set speed is not too fast (the current first task is of low priority).
[0365] Among them, S1407 to S1409 can refer to the relevant contents of S902 to S906 in Figure 9 and will not be repeated here.
[0366] S1411: The overload control module sends a first mouse information request to the seamless setting module.
[0367] If the overload control module determines that the setting speed is not too fast or the first task is of high priority, it sends a first mouse information request to the seamless setting module. Correspondingly, the seamless setting module receives the first mouse information request from the overload control module. The first mouse information request is used to request to obtain cursor status information.
[0368] S1412: The seamless setting module waits for a second preset time period and obtains first mouse information.
[0369] After receiving the first mouse information request from the overload control module, the seamless setting module may wait for a second preset time period and obtain the first mouse information. The execution process of S1412 may refer to the relevant description of S908 and will not be repeated here.
[0370] S1413: The seamless setting module sends the first mouse information to the overload control module.
[0371] After acquiring the first mouse information, the seamless setting module may send the first mouse information to the overload control module. Correspondingly, the overload control module may receive the first mouse information from the seamless setting module.
[0372] S1414: The overload control module determines whether the mouse is in a changed state. It is determined that the mouse is in a changed state.
[0373] The overload control module determines whether the mouse is in a changed state based on the first mouse information and determines that the mouse is currently in a changed state.
[0374] S1415: The overload control module determines whether the number of attempts exceeds a threshold number. It is determined that the number of attempts does not exceed the threshold number.
[0375] It should be noted that the number of cycles of S1411 may be more than one, and this application only describes one cycle.
[0376] S1416: The overload control module sends a second mouse information request to the seamless setting module.
[0377] S1417: The overload control module waits for a second preset time period and obtains second mouse information.
[0378] S1418: The seamless setting module sends the second mouse information to the overload control module.
[0379] S1419: The overload control module determines whether the mouse is in a changing state. The mouse is determined to be in a stationary state.
[0380] Among them, the processing process of S1416~S1419 can refer to the processing process of S1411~S1414, and will not be repeated.
[0381] S1420: The overload control module sends a first start request to the mouse holding module.
[0382] When the cursor is in a stationary state, the overload control module sends a first start request to the mouse holding module. Correspondingly, the mouse holding module receives the first start request from the overload control module. The first start request is used to request to start a specific refresh rate setting process, and S1421 to S1425 are executed.
[0383] S1421: The mouse holding module generates and displays a first window.
[0384] S1422: The mouse holding module sends a first setting instruction to the seamless setting module.
[0385] S1423: The seamless setting module sets the screen refresh rate to the target refresh rate.
[0386] S1424: The seamless setting module sends a setting completion notification to the mouse holding module.
[0387] S1425: The mouse holding module displays the first interface but does not display the first window.
[0388] The processing of S1421 to S1425 may refer to the relevant contents of S701 to S703 in FIG. 7 , and will not be described in detail.
[0389] In the embodiment of FIG14 , the first task is a low-priority task, and the mouse is in a changing state for a period of time, and then in a stationary state. The refresh rate is not set when the electronic device changes state. Setting the refresh rate when the mouse is stationary improves the user experience.
[0390] FIG15 is a flow chart of another method for setting the refresh rate disclosed in an exemplary embodiment of the present application. As shown in FIG15 , when the first task is of high priority and the number of waiting attempts of the changed mouse exceeds a threshold number, the mouse changes state and directly executes the task of setting the refresh rate. The method for setting the refresh rate may include, but is not limited to, the following steps:
[0391] The processing of S1501 to S1515 can refer to the relevant contents of S1401 to S1415 in FIG14 , which will not be described in detail.
[0392] S1516: The overload control module determines whether the first task has a high priority. It is determined that the first task has a high priority.
[0393] S1517: The overload control module sends a second start request to the mouse holding module.
[0394] Among them, the processing process of S1517 can refer to the relevant content of S1420 and is not repeated here.
[0395] S1518: The mouse holding module and the seamless setting module set the screen refresh rate to the target refresh rate.
[0396] Among them, S1518 can refer to the relevant descriptions of S1421 to S1425 in Figure 7 and Figure 14, and will not be repeated here.
[0397] In the embodiment of Figure 15 , the first task is a high-priority task, and the cursor is constantly changing. After the number of attempts by the electronic device exceeds a threshold, the refresh rate is forcibly set. Prioritizing the setting ensures the required refresh rate and improves the user experience.
[0398] FIG16 is a flow chart of another method for setting the refresh rate disclosed in an exemplary embodiment of the present application. As shown in FIG16 , when the first task is of low priority and the number of waiting attempts for the changed mouse has not exceeded the threshold number, the task is re-added to the buffer for processing. The method for setting the refresh rate may include, but is not limited to, the following steps:
[0399] The processing of S1601 to S1615 can refer to the relevant contents of S1401 to S1415 in FIG14 , which will not be described in detail.
[0400] S1616: The overload control module determines whether the first task has a high priority. If the first task has a low priority, the overload control module determines whether the first task has a high priority.
[0401] S1617: The overload control module submits the first task information to the buffer and sets a timeout.
[0402] Among them, the relevant description of S1617 can refer to the relevant description of S907 and is not repeated here.
[0403] S1618: The overload control module determines whether a timeout has been set. If a timeout has been set, the overload control module determines whether a timeout has been set.
[0404] S1619: The overload control module wakes up the second thread.
[0405] Among them, the relevant descriptions of S1618 to S1619 can refer to the relevant descriptions of Case 1 in S901 and are not repeated here.
[0406] Among them, after executing S1619, each module of the electronic device can continue to execute the relevant processing in Figures 8A, 11, 14 and 15, which will not be repeated.
[0407] In the embodiment of FIG. 16 , the first task is of low priority, and when the mouse is in a changed state, the task is resubmitted to the buffer and waits for further processing.
[0408] It should be understood that the method flows of Figures 14 to 16 are only several possible situations in Figures 8A and 11. There are other possible situations, which are not listed one by one in this application. The scope of this application should include embodiments of various situations in Figures 8A and 11.
[0409] It should be noted that, for the above method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the order of the actions described. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the present invention. The embodiments of the present application can be combined arbitrarily to achieve different technical effects.
[0410] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware, or any combination thereof. When implemented using software, all or part of the embodiments may be implemented 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, all or part of the processes or functions described herein are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium may 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 integrated therein. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive).
[0411] Those skilled in the art will appreciate that all or part of the processes in the above-described method embodiments can be implemented by a computer program instructing the relevant hardware. The program can be stored in a computer-readable storage medium. When executed, the program can include the processes in the above-described method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM or random access memory (RAM), magnetic disks, or optical disks.
[0412] In short, the above description is only an embodiment of the technical solution of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent replacements, improvements, etc. made based on the disclosure of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for setting a refresh rate, characterized in that: The method is applied to an electronic device, and includes: At a first moment, the electronic device displays a first window, at the first moment, the first window is a focus window, a screen refresh rate of the electronic device is a first refresh rate, and a first cursor is displayed in the first window; At a second moment, in response to the first user operation, the electronic device displays a second window. After the second moment, the second window becomes the focus window, and a second cursor is displayed in the second window. Starting from the second moment, after the first time period, the electronic device sets the screen refresh rate to a second refresh rate, wherein, during the first time period, the position of the second cursor is not stationary, and the screen refresh rate is the first refresh rate; after the first time period, the position of the second cursor is stationary.
2. The method according to claim 1, characterized in that The method further comprises: After the screen refresh rate is set to the second refresh rate, at a third moment, in response to a second user operation, the electronic device displays the first window, and after the third moment, the first window becomes the focus window, and the first cursor is displayed in the first window; Starting from the third moment, within a second time period, the electronic device sets the screen refresh rate to the first refresh rate, within the second time period, the position of the first cursor is stationary, and the duration of the first time period is greater than or equal to the duration of the second time period.
3. The method according to claim 2, characterized in that The method further comprises: After the second period, at a fourth moment, in response to a third user operation, the electronic device displays a third window; after the fourth moment, the third window is the focus window, and a third cursor is displayed in the third window; Starting from the fourth moment, within the third time period, the electronic device sets the screen refresh rate to the third refresh rate, within the third time period, the position of the third cursor is not static, the duration of the first time period is greater than or equal to the duration of the third time period, the third refresh rate is greater than the first refresh rate, and the third refresh rate is greater than the second refresh rate.
4. The method according to claim 3, characterized in that After the second period and before the fourth moment, the method further includes: At a fifth moment, in response to a fourth user operation, the electronic device displays the second window. After the fifth moment, the second window is the focus window, and the second cursor is displayed in the second window. During a fourth period from the fifth moment to the fourth moment, the screen refresh rate is the first refresh rate, and during the fourth period, the position of the second cursor is not stationary.
5. The method according to claim 1, wherein The method further comprises: During the first time period, the electronic device does not adjust the screen refresh rate based on that the position of the second cursor is not static; The electronic device setting the screen refresh rate to a second refresh rate includes: After the first period, the electronic device sets the screen refresh rate to a second refresh rate based on that the position of the second cursor is stationary.
6. The method according to claim 2, characterized in that The electronic device setting the screen refresh rate to the first refresh rate includes: During the second time period, the electronic device sets the screen refresh rate to the first refresh rate based on that the position of the first cursor is stationary.
7. The method according to claim 3, characterized in that The electronic device setting the screen refresh rate to a third refresh rate includes: During the third time period, the electronic device sets the screen refresh rate to a third refresh rate based on that the third window corresponds to the first priority and the position of the third cursor is not static.
8. The method according to claim 5, characterized in that The electronic device not adjusting the screen refresh rate based on the second cursor being at a non-stationary position includes: During the first time period, the electronic device does not adjust the screen refresh rate based on that the second window corresponds to the second priority and the position of the second cursor is not static.
9. The method according to claim 4, characterized in that The method further comprises: During the fourth time period, the electronic device does not adjust the screen refresh rate based on that the second window corresponds to the second priority and the position of the second cursor is not static; The electronic device setting the screen refresh rate to a third refresh rate includes: During the third time period, the electronic device sets the screen refresh rate from the first refresh rate to a third refresh rate based on that the third window corresponds to the first priority and the position of the third cursor is not static.
10. The method according to any one of claims 1 to 9, characterized in that The method further comprises: When the focus window corresponds to the second priority, if the time difference between the current time and the time when the refresh rate was last set is less than or equal to the preset time, the electronic device waits for the first time; The electronic device setting the screen refresh rate to a second refresh rate includes: After the first duration, the electronic device sets the screen refresh rate to the second refresh rate, and the time difference between the time when the screen refresh rate is set to the second refresh rate and the time when the refresh rate was last set is greater than the preset duration.
11. The method according to any one of claims 1 to 9, characterized in that The method further comprises: In response to the first user operation, the electronic device obtains first task information based on the second window, where the first task information includes a target refresh rate and a second priority corresponding to the second window, and the target refresh rate is the second refresh rate corresponding to the second window; When the setting condition is met, the electronic device adds the first task information to a buffer; the buffer can contain at most one task information at a time; The electronic device setting the screen refresh rate to a second refresh rate includes: The electronic device obtains the first task information from the buffer; The electronic device sets the screen refresh rate to a second refresh rate based on the first task information.
12. The method according to claim 11, characterized in that The setting conditions include: the refresh rate setting function is turned on, the current display screen resolution is a preset resolution, the active signal refresh rate is a preset refresh rate, and the application where the focus window is located is one or more of the preset applications.
13. The method according to any one of claims 1 to 9, characterized in that The method further comprises: The electronic device obtains mouse information and determines whether the cursor position is stationary; The mouse information includes a first mouse position and a second mouse position within a preset time period, and / or a peripheral device event within the preset time period; when the first mouse position and the second mouse position are different or the peripheral device event changes, the cursor position is not stationary; otherwise, the cursor position is stationary; The peripheral device event is an operation event on a peripheral device, and the peripheral device includes a mouse device.
14. The method according to claim 11, characterized in that The method further comprises: The electronic device determines that the global variable is not a condition for ending and not a condition for canceling; When the global variable is neither ended nor cancelled, the electronic device obtains the first task information from the buffer and clears the buffer.
15. The method according to claim 9, characterized in that In response to the fourth user operation, the method further includes: The electronic device generates fourth task information; and adds the fourth task information to a buffer; The electronic device obtains fourth task information from the buffer, clears the buffer, and sets a global variable to run; In response to a third user operation, the electronic device generates third task information; adds the third task information to the buffer; the third task information includes the first priority corresponding to the third window; and the target refresh rate of the third task information is the third refresh rate corresponding to the third window; The electronic device setting the screen refresh rate from the first refresh rate to a third refresh rate based on the third window corresponding to the first priority includes: The electronic device sets the global variable to cancel based on the first priority and the fact that the global variable is running; In a case where the global variable is canceled, the electronic device discards the fourth task information; The electronic device obtains the third task information from the buffer, clears the buffer, and sets the global variable to run; The electronic device sets the screen refresh rate to the third refresh rate based on the third task information.
16. An electronic device, characterized in that: include: A display screen, one or more processors and one or more memories; the one or more memories are used to store computer program code, the computer program code includes computer instructions, and when the one or more processors execute the computer instructions, the electronic device executes the method according to any one of claims 1 to 15.
17. A computer-readable storage medium comprising instructions, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 15 is implemented.
18. A computer program product comprising instructions, characterized in that When the computer program product is run on a computer, the computer is caused to perform the method according to any one of claims 1 to 15.
Citation Information
Patent Citations
Refreshing frequency switching method and device, readable medium and communication terminal
CN111399625A
Application display method, device and equipment and readable storage medium
CN111857902A
Picture-in-picture display method, terminal and storage medium
CN113949918A
Display method, electronic equipment and storage medium
CN114518817A
Working mode switching method and device, electronic equipment and storage medium
CN117041385A