A control method and device
By analyzing the processor's historical rendering time and operating frequency, determining the status statistics to control the target operating frequency, solving the problem of mismatch between the operating frequency and the actual load in the prior art, and achieving more efficient power consumption management.
Patent Information
- Application Number
- CN202411546501.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-03-21
- Estimated Expiration
- 2044-10-31
AI Technical Summary
In the prior art, adjusting the operating frequency according to the utilization rate of the processor is prone to mismatch between the operating frequency and the actual load.
By obtaining the rendering time and running frequency of multiple historical image frames, the status statistics of the processor are determined, including the expected rendering time at different operating frequencies, and the target running frequency when the processor renders the target image frame based on this information.
It achieves a better match between the processor's operating frequency and the actual load, reduces power consumption, and avoids inconsistent operation frequency and actual load.
Smart Images

Figure CN119067832B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of control technology, and in particular to a control method and device. Background Art
[0002] In order to reduce device power consumption, some electronic devices can adjust the operating frequency of the processor. In related technologies, electronic devices can adjust the operating frequency of the processor according to the utilization rate of the processor in the past period of time. For example, if the utilization rate of the graphics processor is high, its operating frequency is increased, and if the utilization rate is low, its operating frequency is reduced.
[0003] The problem with this method is that the utilization rate cannot reflect the actual rendering load. Therefore, adjusting the operating frequency based on the utilization rate can easily result in a mismatch between the operating frequency and the actual load of the processor. For example, the operating frequency will be reduced when the processor is under a high load, and the operating frequency will be increased when the processor is under a low load. Summary of the invention
[0004] To this end, this application discloses the following technical solutions:
[0005] The first aspect of the present application provides a control method, comprising:
[0006] Obtaining a historical rendering time and a corresponding historical operating frequency spent by the first processor in rendering a plurality of historical image frames;
[0007] Determine state statistical information of the first processor according to the historical rendering duration and the historical operating frequency, wherein the state statistical information includes expected rendering durations of the first processor at different historical operating frequencies;
[0008] The target operating frequency of the first processor when rendering a target image frame to be rendered is controlled based on the state statistical information.
[0009] Optionally, determining the state statistical information of the first processor according to the historical rendering duration and the historical operating frequency includes:
[0010] Determine a historical rendering duration of at least one historical image frame corresponding to each of the historical operating frequencies;
[0011] Based on the at least one historical rendering duration, an expected rendering duration of the first processor at each historical operating frequency is determined.
[0012] Optionally, determining the expected rendering duration of the first processor at each historical operating frequency based on the at least one historical rendering duration includes:
[0013] For each of the historical operating frequencies, determining the duration weights of the respective historical rendering durations corresponding to the historical operating frequency according to the rendering moments of the plurality of historical image frames corresponding to the historical operating frequency by the first processor;
[0014] An expected rendering duration of the first processor at the historical operating frequency is determined according to the multiple historical rendering durations and the duration weights corresponding to the historical rendering durations.
[0015] Optionally, the state statistics information includes a plurality of state entries, each of which includes a historical operating frequency and an expected rendering duration corresponding to the historical operating frequency;
[0016] The controlling the target operating frequency of the first processor when rendering the target image frame to be rendered based on the state statistical information includes:
[0017] Get the target rendering duration for rendering the target image frame;
[0018] The target operating frequency of the first processor when rendering the target image frame is determined according to the target rendering duration and the state entries contained in the state statistical information.
[0019] Optionally, obtaining a target rendering duration for rendering a target image frame includes:
[0020] Obtaining a historical preparation time used by a second processor to provide a historical rendering task corresponding to the historical image frame, wherein the second processor is used to provide a rendering task to the first processor to trigger the first processor to render an image frame based on the rendering task;
[0021] A target rendering duration for rendering the target image frame is determined according to the historical preparation duration.
[0022] Optionally, obtaining a target rendering duration for rendering a target image frame includes:
[0023] Obtaining configuration parameters corresponding to the target image frame;
[0024] A target rendering duration for rendering a target image frame is determined according to the configuration parameters.
[0025] Optionally, determining the target operating frequency of the first processor when rendering the target image frame according to the target rendering duration and the state items included in the state statistical information includes:
[0026] For each of the state entries and the target rendering duration, determining an alternative running frequency corresponding to each of the state entries;
[0027] The target operating frequency of the first processor when rendering the target image frame is determined according to the candidate operating frequencies corresponding to the plurality of status entries.
[0028] Optionally, determining the target operating frequency of the first processor when rendering the target image frame according to the candidate operating frequencies corresponding to the plurality of status entries includes:
[0029] Obtaining a state parameter corresponding to each of the state entries;
[0030] The target operating frequency of the first processor when rendering the target image frame is determined according to the state parameters of the plurality of state entries and the candidate operating frequencies.
[0031] Optionally, obtaining the historical rendering duration and the corresponding historical operating frequency spent by the first processor on rendering the plurality of historical image frames includes:
[0032] In response to detecting the trigger condition, obtaining a historical rendering time spent by the first processor on rendering a plurality of historical image frames and a corresponding historical operating frequency;
[0033] The trigger condition detected includes at least one of the following:
[0034] detecting a frequency control instruction for controlling the operating frequency of the first processor;
[0035] Detecting that the electronic device to which the first processor belongs starts a target application;
[0036] Detecting that the power level of the electronic device is lower than a power threshold;
[0037] It is detected that the electronic device is in a target operating state.
[0038] A second aspect of the present application provides a control device, comprising:
[0039] An obtaining unit, configured to obtain a historical rendering time and a corresponding historical operating frequency spent by the first processor in rendering a plurality of historical image frames;
[0040] a determining unit, configured to determine state statistical information of the first processor according to the historical rendering duration and the historical operating frequency, wherein the state statistical information includes expected rendering durations of the first processor at different historical operating frequencies;
[0041] A control unit is used to control a target operating frequency of the first processor when rendering a target image frame to be rendered based on the state statistical information. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0043] Figure 1 is a flow chart of a control method provided by an embodiment of the present application;
[0044] Figure 2 It is a schematic diagram of a principle for determining a target operating frequency provided by an embodiment of the present application;
[0045] Figure 3 This is a schematic diagram of determining a target rendering duration provided by an embodiment of the present application;
[0046] Figure 4 It is a structural schematic diagram of a control device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0047] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0048] This embodiment provides a control method, see Figure 1 , is a flow chart of the method, and the method may include the following steps.
[0049] S101, obtaining a historical rendering time and a corresponding historical operating frequency spent by a first processor on rendering a plurality of historical image frames.
[0050] The first processor may be a processor in an electronic device for rendering image frames, for example, a graphics processing unit (GPU). In this embodiment, each time the first processor completes the rendering process of an image frame, the rendering time spent by the first processor in rendering the image frame and the operating frequency of the first processor during the rendering of the image frame may be recorded, thereby obtaining a historical rendering time and a corresponding historical operating frequency of a historical image frame. In other words, each historical image frame corresponds to a historical rendering time and a historical operating frequency, the historical rendering time is the actual time spent by the first processor in rendering the historical image frame, and the historical operating frequency is the operating frequency of the first processor when rendering the historical image frame.
[0051] The above-mentioned multiple historical image frames may include historical image frames rendered by the first processor within a certain period of time up to the current moment, for example, may include historical image frames rendered by the first processor within the last 20 seconds, or may include a preset number of historical image frames rendered by the first processor closest to the current moment, for example, may include 60 historical image frames rendered by the first processor closest to the current moment.
[0052] S102: Determine state statistical information of the first processor according to historical rendering durations and historical operating frequencies, where the state statistical information includes expected rendering durations of the first processor at different historical operating frequencies.
[0053] The expected rendering duration corresponding to each historical operating frequency may represent the duration expected to be taken by the first processor to render an image frame according to the historical operating frequency at the current moment.
[0054] Exemplarily, the historical operating frequencies obtained by S101 may include 728 MHz and 598 MHz, and the determined state statistical information may include that the expected rendering time corresponding to 728 MHz may be 10 milliseconds, and the expected rendering time corresponding to 598 MHz may be 15 milliseconds, indicating that at the current moment, if the first processor renders a frame of image at an operating frequency of 728 MHz, it is expected to take 10 milliseconds, and if it renders a frame of image at an operating frequency of 598 MHz, it is expected to take 15 milliseconds.
[0055] S103: Controlling a target operating frequency of the first processor when rendering a target image frame to be rendered based on the state statistical information.
[0056] Generally, ignoring the influence of other factors, it can be considered that the time it takes for a processor to render a frame of image is negatively correlated with the operating frequency of the processor when rendering the frame of image, that is, the higher the operating frequency, the faster the rendering and the shorter the time it takes, and the lower the operating frequency, the slower the rendering and the longer the time it takes. In addition, the higher the operating frequency, the higher the power consumption of the processor, and the lower the operating frequency, the lower the power consumption of the processor.
[0057] Based on the above principles, in step S103, the expected rendering time under different historical operating frequencies in the state statistical information can be combined to estimate the proportional relationship between the operating frequency of the first processor in the current state and the time taken to render a frame of image, and then based on the proportional relationship and the rendering time requirement of the target image frame, a target operating frequency that can just meet the rendering time requirement of the target image frame is determined, thereby controlling the first processor to render the target image frame at this target operating frequency.
[0058] The method provided in this embodiment can be executed before the first processor starts rendering an image frame each time, that is, the target operating frequency 1 can be determined first, and the first processor can be controlled to render the target image frame 1 according to the target operating frequency 1, and then the target operating frequency 2 can be determined, and the first processor can be controlled to render the target image frame 2 according to the target operating frequency 2, and so on.
[0059] Alternatively, the method provided in this embodiment can be executed periodically according to a certain target period during the period when the first processor renders multiple image frames, that is, the target operating frequency 1 can be determined first, and the first processor can be controlled to render multiple target image frames according to the target operating frequency 1 in a subsequent target period, and then the target operating frequency 2 can be determined, and the first processor can be controlled to render multiple target image frames according to the target operating frequency 2 in a second target period, and so on. The target period can be set as needed, such as 1 second, 500 milliseconds, 100 milliseconds, etc., without limitation.
[0060] The beneficial effects of this embodiment are:
[0061] Compared with the method of adjusting the operating frequency according to the utilization rate in the related art, the historical rendering time of multiple historical image frames and the corresponding historical operating frequency in this scheme can obviously better reflect the actual load situation of the first processor. Therefore, controlling the operating frequency of the first processor according to the method of this embodiment can not only reduce the power consumption of the first processor, but also make the adjusted operating frequency more in line with the load situation of the first processor, thereby avoiding the inconsistency between the operating frequency and the actual load to a certain extent.
[0062] In some optional embodiments, the method of determining the state statistical information of the first processor according to the historical rendering duration and the historical running frequency may include:
[0063] Determine a historical rendering duration of at least one historical image frame corresponding to each historical operating frequency;
[0064] Based on at least one historical rendering duration, an expected rendering duration of the first processor at each historical operating frequency is determined.
[0065] In this embodiment, for each historical operating frequency, each historical image frame rendered according to this historical operating frequency can be determined, and the historical rendering durations corresponding to these historical image frames are merged to obtain the expected rendering duration corresponding to the historical operating frequency.
[0066] For example, among the multiple historical image frames, 5 historical image frames are rendered by the first processor at frequency 1, then the 5 historical rendering durations corresponding to these 5 historical image frames can be merged to obtain the expected rendering duration corresponding to frequency 1.
[0067] The advantage of determining the expected rendering time in the above manner is that it can determine the expected rendering time in combination with the time spent by the first processor when performing rendering multiple times based on the historical operating frequency. This can eliminate the influence of various random factors on the historical rendering time during each rendering to a certain extent, and more accurately evaluate the processing capacity of the first processor at the historical operating frequency.
[0068] Alternatively, for each historical operating frequency, a historical image frame that was most recently rendered by the first processor at this historical operating frequency among multiple historical image frames can be determined, and the historical rendering duration corresponding to the historical image frame can be determined as the expected rendering duration corresponding to the historical operating frequency.
[0069] For example, among the multiple historical image frames, 5 historical image frames are rendered by the first processor at frequency 1, and the image frame whose rendering time is closest to the current time is image frame 5. Then the historical rendering duration of image frame 5 can be determined as the expected rendering duration of frequency 1. The rendering time can be the time when the first processor starts to render an image frame.
[0070] The benefit of determining the expected rendering time in the above manner is that, in this embodiment, the role of determining the expected rendering time is to predict the processing power of the first processor when rendering the target image frame in combination with the historical operating frequency and the corresponding expected rendering time. It can be understood that the farther the historical rendering time is from the current moment, the weaker the role of predicting the processing power of the first processor when rendering the target image frame. Predictions based on historical rendering times far away from the current moment may lead to inaccurate prediction results. According to the above method, the historical rendering time closest to the current moment is directly used as the expected rendering time, which can avoid the interference of historical rendering times far away from the current moment, and better predict the processing power of the first processor when rendering the target image frame based on the recent expected rendering time.
[0071] As an example, see Figure 2 , assuming that the historical rendering durations and historical running frequencies of 15 historical image frames are obtained in S101, the 15 historical image frames are recorded as image frames 1 to 15 in the order of rendering, wherein the rendering time of image frame 1 is farthest from the current time, and the rendering time of image frame 15 is closest to the current time. The historical rendering duration of each image frame is represented by T, that is, T1 is the historical rendering duration of image frame 1, T2 is the historical rendering duration of image frame 2, and so on.
[0072] In this example, Figure 2 As shown in (1), it is assumed that the historical operating frequency corresponding to image frame 1, image frame 5, image frame 7, image frame 10 and image frame 14 is 728 MHz, that is, 728 MHz corresponds to the historical rendering durations T1, T5, T7, T10 and T14;
[0073] The historical operating frequency corresponding to the image frame 2, the image frame 8 and the image frame 11 is 650 MHz, that is, 650 MHz corresponds to the historical rendering durations T2, T8 and T11;
[0074] The historical operating frequency corresponding to image frames 3, 9 and 13 is 598 MHz, that is, 598 MHz corresponds to the historical rendering durations T3, T9 and T13;
[0075] The historical operating frequency corresponding to image frame 4, image frame 6, image frame 12 and image frame 15 is 520 MHz, that is, 520 MHz corresponds to the historical rendering durations T4, T6, T12 and T15.
[0076] like Figure 2 As shown in (1), when determining the state statistics information, T1, T5, T7, T10 and T14 can be fused to obtain the expected rendering time T(728) corresponding to 728MHz, T2, T8 and T11 can be fused to obtain the expected rendering time T(650) corresponding to 650MHz, T3, T9 and T13 can be fused to obtain the expected rendering time T(598) corresponding to 598MHz, and T4, T6, T12 and T15 can be fused to obtain the expected rendering time T(520) corresponding to 520MHz.
[0077] The method of fusing multiple historical rendering times to obtain the expected rendering time may be to calculate the average of multiple historical rendering times and use the result as the expected rendering time. In combination with the above example, the average of T2, T8 and T11 can be determined as the expected rendering time corresponding to 650MHz, that is, T(650)=(T2+T8+T11) / 3.
[0078] Optionally, the method of fusing multiple historical rendering times to obtain the expected rendering time can also be:
[0079] For each historical operating frequency, determining the duration weight of each historical rendering duration corresponding to the historical operating frequency according to the rendering moments of multiple historical image frames corresponding to the historical operating frequency by the first processor;
[0080] An expected rendering duration of the first processor at the historical operating frequency is determined according to multiple historical rendering durations and duration weights corresponding to the historical rendering durations.
[0081] In the above embodiments, each historical image frame corresponds to a rendering time, and the rendering time may be the time when the first processor starts to render the historical image.
[0082] When determining the duration weight, for each historical rendering duration, the duration weight of the historical rendering duration can be determined based on the distance from the rendering time of the historical image frame corresponding to the historical rendering time to the current time. The longer the distance from the rendering time to the current time, the smaller the corresponding duration weight; the closer the distance from the rendering time to the current time, the larger the corresponding duration weight.
[0083] There are many ways to determine the duration weight, which is not limited in this embodiment.
[0084] For example, the time from the rendering moment to the current moment can be divided by a preset value, and the obtained ratio can be subtracted from 1, and the result is used as the duration weight. Exemplarily, the time from the rendering moment to the current moment corresponding to a historical rendering duration is 160 milliseconds, and the duration weight of the historical rendering duration can be 1-160 milliseconds / 200 milliseconds.
[0085] For example, based on the condition that the farther the distance from the rendering moment to the current moment is, the smaller the corresponding duration weight is, the duration weights of various historical rendering times can be determined in proportion, while ensuring that the sum of the weights of various historical rendering times corresponding to the same historical running frequency is equal to 1.
[0086] For example, the distances corresponding to each historical rendering duration (i.e., the distance from the corresponding rendering moment to the current moment) can be summed up to obtain the total distance. For each historical rendering duration, the distance corresponding to the historical rendering duration is divided by the total distance, and the obtained ratio is used as the duration weight of the historical rendering duration.
[0087] After determining the duration weight, for each historical running frequency, multiple historical rendering durations corresponding to the historical running frequency may be weighted and summed according to their respective duration weights, and the result obtained is used as the expected rendering duration corresponding to the historical running frequency.
[0088] Combination Figure 2 For example, among the three historical image frames corresponding to 598 MHz, the rendering time of image frame 3 is the farthest from the current time, the rendering time of image frame 9 is the second farthest from the current time, and the rendering time of image frame 13 is the closest to the current time. Therefore, it can be determined that the duration weight of historical rendering duration T3 is 1 / 6, the duration weight of historical rendering duration T9 is 2 / 6, and the duration weight of historical rendering duration T13 is 3 / 6. The expected rendering duration of 598 MHz can be calculated according to the following formula.
[0089] T(598)=1 / 6*T3+2 / 6*T9+3 / 6*T13.
[0090] The advantage of fusing historical rendering durations in the above manner is that, in general, it can be considered that the closer the historical image frames are to the current moment, the closer the load condition of the first processor reflected by their historical operating frequencies and historical rendering durations are to the actual load condition of the first processor at the current moment; and the farther the historical image frames are from the current moment, the more the load condition of the first processor reflected by the duration and frequency are deviated from the actual load condition of the first processor at the current moment. This embodiment weights different historical rendering times according to the distance between the rendering times and the current moment, so that the obtained historical operating frequencies and their corresponding expected rendering times are more in line with the actual load condition of the first processor at the current moment, thereby obtaining a more accurate target operating frequency.
[0091] Optional, such as Figure 2 As shown in (2), the state statistics information may include a plurality of state entries, each state entry including a historical running frequency and an expected rendering time corresponding to the historical running frequency.
[0092] Each status entry reflects the processing capability of the first processor at the frequency of the entry. The size of the processing capability can be represented by the product of the historical operating frequency and the expected rendering time in the entry. The larger the product, the stronger the processing capability, and the smaller the product, the weaker the processing capability.
[0093] Generally, the processing capability of the first processor can be considered to be substantially unchanged in a short period of time, and, under the premise that the processing capability remains unchanged, the operating frequency of the first processor is negatively correlated with the time taken to render a frame of image.
[0094] In this embodiment, the target operating frequency may be determined according to the state statistical information in the following manner:
[0095] Get the target rendering duration for rendering the target image frame;
[0096] The target operating frequency of the first processor when rendering the target image frame is determined according to the target rendering duration and the state entries included in the state statistics information.
[0097] The target rendering duration indicates how long it takes for the first processor to render a target image frame. For example, if the target rendering duration is 10 milliseconds, it means that the first processor needs to render a target image frame within 10 milliseconds.
[0098] In this embodiment, the operating frequency required for the first processor to render a target image frame within the target rendering duration under the corresponding processing capacity, that is, the target operating frequency, can be determined based on the processing capacity and target rendering duration reflected by each status entry.
[0099] See also Figure 3 , an optional way to get the target rendering time is:
[0100] Obtaining a historical preparation time used by the second processor to provide a historical rendering task corresponding to a historical image frame, the second processor being used to provide the rendering task to the first processor to trigger the first processor to render the image frame based on the rendering task;
[0101] A target rendering time for rendering a target image frame is determined according to the historical preparation time.
[0102] The second processor may be another processor in the electronic device that is different from the first processor. For example, the second processor may be a central processing unit (CPU) of the electronic device.
[0103] The second processor can control the first processor to render an image frame. The second processor can obtain various input data required for rendering an image frame by running a program, such as obtaining the materials required for rendering, relevant parameters for rendering, etc., and package these input data into a rendering task. The second processor can then provide these rendering tasks to the first processor, thereby triggering the first processor to render an image frame using the input data contained in the rendering task.
[0104] The time it takes for the second processor to obtain a rendering task and provide it to the first processor is called the preparation time of the rendering task. For each historical image frame, the time it takes for the second processor to obtain its corresponding historical rendering task and provide it to the first processor is the historical preparation time of the historical rendering task.
[0105] After obtaining multiple historical preparation times, the preparation time corresponding to the next rendering task can be predicted according to the multiple historical preparation times, and the predicted preparation time of the next rendering task is determined as the target rendering time of the target image frame.
[0106] In this embodiment, the rendering task corresponding to the target image frame can be recorded as a target rendering task. The latter rendering task can include the next rendering task that the second processor is preparing to output to the first processor after outputting the target rendering task.
[0107] Using the predicted preparation time as the target rendering time can enable the first processor to render the target image frame corresponding to the target rendering task as well as possible before receiving a new rendering task (i.e., the next rendering task), thereby avoiding the rendering process being stuck due to the time taken by the first processor to render the target image frame.
[0108] The method of predicting the preparation time corresponding to the next rendering task based on the historical preparation time can be to calculate the average of multiple historical preparation times as the predicted preparation time, or to determine the corresponding weights of multiple historical preparation times according to the rendering time, and obtain the predicted preparation time based on weighted summation.
[0109] Another optional way to get the target rendering time could be:
[0110] Obtain configuration parameters corresponding to the target image frame;
[0111] A target rendering duration for rendering a target image frame is determined according to configuration parameters.
[0112] The configuration parameters corresponding to the target image frame may include configuration parameters specified by the application program that generates the target rendering task corresponding to the target image frame, or may include configuration parameters configured by the electronic device when rendering the target image frame. The configuration parameters of this embodiment may be used to control how many frames of images the electronic device displays in sequence per unit time, and for example, the configuration parameters may include a frame rate, a refresh rate, or other similar parameters.
[0113] As an example, when a user uses a game application installed on an electronic device, the GPU renders multiple image frames one by one based on the rendering tasks of the game application provided by the CPU and provides them to the display screen for frame-by-frame display. In this example, if the game application specifies a frame rate of 90fps (frames per second), the configuration parameters corresponding to the target image frame may include the 90fps frame rate specified by the game application.
[0114] As another example, when the GPU is rendering an image frame, the electronic device is in a power saving mode. At this time, the electronic device can limit the frame rate of the display screen to 30fps, and the configuration parameters corresponding to the target image frame may include the 30fps frame rate of the screen.
[0115] In this embodiment, the target rendering time required to meet the configuration parameters can be calculated according to the configuration parameters. Taking the configuration parameters including the frame rate as an example, if the frame rate is 60fps, it can be determined that to meet the frame rate, the average time spent on rendering one frame of the image should not exceed 1 / 60 second, so the target time can be determined to be 1 / 60 second. Similarly, if the configuration parameters include a 90fps frame rate, the target rendering time can be 1 / 90 second.
[0116] See also Figure 2 (2) After obtaining the target rendering duration, the target running frequency can be determined according to the target rendering duration and the status entry:
[0117] For each state entry and target rendering duration, determine the alternative running frequency corresponding to each state entry;
[0118] A target operating frequency of the first processor when rendering a target image frame is determined according to the candidate operating frequencies corresponding to the multiple state entries.
[0119] For each state entry, the alternative operating frequency determined based on the state entry and the target rendering duration can be understood as the minimum frequency required for the first processor to render the target image frame within the target rendering duration under the processing capacity represented by the state entry.
[0120] In this embodiment, for each state entry, the corresponding candidate operating frequency may be determined in the following manner:
[0121] Multiply the historical running frequency of the state entry by the expected rendering time, divide the product by the target rendering time, and use the result as the alternative running frequency corresponding to the state entry. That is, alternative running frequency = historical running frequency × expected rendering time ÷ target rendering time.
[0122] Combination Figure 2 For example (2), for state entry 1 corresponding to 728 MHz, its alternative operating frequency F(728) can be calculated using the formula: F(728) = 728 MHz × T(728) ÷ T target . T target Indicates the target rendering duration.
[0123] The target operating frequency may be determined according to a plurality of candidate operating frequencies by determining an average value of the plurality of candidate operating frequencies as the target operating frequency.
[0124] The method of determining the target operating frequency according to multiple alternative operating frequencies may also be:
[0125] Get the state parameters corresponding to each state entry;
[0126] A target operating frequency of the first processor when rendering a target image frame is determined according to the state parameters of the plurality of state entries and the candidate operating frequencies.
[0127] The state parameter may include at least one of a time parameter, a load parameter and a frequency parameter.
[0128] In the above embodiment, for each state entry, the weight of the state entry can be determined based on the state parameter of the state entry, and the candidate operating frequencies of each state entry are weighted and summed based on the weight of each state entry, and the result is used as the target operating frequency.
[0129] As an example, the time parameter of a state entry can be determined as follows: the rendering time of multiple historical image frames rendered according to the frequency contained in the state entry is obtained, and the distance from the rendering time closest to the current time to the current time (i.e., the duration between the two times) is used to determine the time parameter of the state entry. Figure 2For example, for state entry 1, among the image frames rendered according to the frequency contained in the entry, the rendering time of image frame 14 is closest to the current time, so the distance from the rendering time of image frame 14 to the current time can be determined as the time parameter of state entry 1.
[0130] When determining the state parameter in the manner of this example, the state parameter may be negatively correlated with the weight, that is, the larger the state parameter of the state entry, the smaller the corresponding weight, and the smaller the state parameter of the state entry, the larger the corresponding weight.
[0131] As an example, a method for determining the load parameter of a state entry may be to determine the actual frame rate of the first processor when the first processor renders historical image frames at the frequency contained in the state entry, or to obtain the average frame rate when rendering multiple historical image frames at the frequency contained in the state entry, and to determine the absolute value of the difference between the actual frame rate (or average frame rate) and the actual frame rate of the first processor at the current moment as the load parameter of the state entry.
[0132] Combination Figure 2 For example, for state entry 2, the actual frame rate of the first processor when rendering image frame 2, the actual frame rate when rendering image frame 8, and the actual frame rate when rendering image frame 11 can be obtained, and the average of the three can be calculated to obtain the average frame rate corresponding to state entry 2. The average frame rate is subtracted from the actual frame rate of the first processor at the current moment, and the absolute value of the difference is used as the load parameter of state entry 2.
[0133] The load parameter determined in this way can reflect the degree of deviation between the load situation when the first processor renders the historical image frames according to the frequency contained in the state entry and the load situation at the current moment. If the load parameter is small, it means that the degree of deviation is small, and it can be considered that the processing capacity represented by the state entry is not much different from the actual processing capacity of the first processor at the current moment. Therefore, a larger weight can be set for the state entry. If the load parameter is large, it can be considered that the processing capacity represented by the state entry is very different from the actual processing capacity of the first processor at the current moment. Therefore, a smaller weight can be set for the state entry.
[0134] As an example, a frequency parameter of a state entry may be determined by subtracting a historical operating frequency contained in the state entry from a current operating frequency of the first processor, and using an absolute value of the difference as the frequency parameter corresponding to the state entry.
[0135] Generally, the status entry can more accurately represent the current processing capability of the first processor when the corresponding historical operating frequency is close to the current operating frequency of the first processor. When the corresponding historical operating frequency is significantly different from the current operating frequency, the accuracy of using the status entry to represent the current processing capability of the first processor decreases.
[0136] Therefore, when the frequency parameter of a status entry is large, the processing capacity represented by the status entry deviates greatly from the current actual processing capacity of the first processor, and a smaller weight can be set for the status entry; when the frequency parameter of a status entry is small, the processing capacity represented by the status entry deviates slightly from the current actual processing capacity of the first processor, and a larger weight can be set for the status entry.
[0137] Optionally, in this embodiment, the electronic device may execute the method of this embodiment when a specific trigger condition is met, that is, step S101 may include:
[0138] In response to detecting the trigger condition, a historical rendering duration and a corresponding historical operating frequency spent by the first processor in rendering a plurality of historical image frames are obtained.
[0139] The trigger condition may include at least one of the following:
[0140] 1. detecting a frequency control instruction for controlling the operating frequency of the first processor;
[0141] 2. It is detected that the electronic device to which the first processor belongs starts the target application;
[0142] 3. It is detected that the power of the electronic device is lower than the power threshold;
[0143] Fourth, the electronic device is detected to be in the target operating state.
[0144] In the first trigger condition, the electronic device can obtain a frequency control instruction based on the user's operation. For example, when the user finds that the electronic device is overheating, the screen is stuck, or other abnormal conditions occur, the user can use a physical button or a related system operation interface to perform an operation to adjust the operating frequency of the first processor. The electronic device obtains a frequency control instruction based on the operation, and then controls the operating frequency of the first processor according to the method of this embodiment.
[0145] In the second trigger condition, the electronic device can determine one or more target applications based on the application type, user usage habits, configuration parameters and other attributes of different applications. For example, game applications and video applications can be determined as target applications, applications with high user usage frequency can be determined as target applications, and applications with high runtime image frame rates can be determined as target applications. Alternatively, the electronic device can also determine one or more applications specified by the user as target applications. Thus, when it is detected that any target application is started, the electronic device can control the operating frequency of the first processor according to the method of this embodiment.
[0146] In the third trigger condition, the electronic device can determine a power threshold based on user settings or factory settings or user usage habits. When the power is lower than the power threshold, the electronic device controls the operating frequency of the first processor according to the method of this embodiment to minimize the power consumption of the device.
[0147] In the fourth trigger condition, the electronic device may have multiple operating states, such as a high-performance state, a normal state, a power-saving state, etc. In the high-performance state, the screen of the electronic device may display images at a higher refresh rate.
[0148] The target operating state may include a high-performance state. The electronic device may execute the method of this embodiment when detecting that it is in the high-performance state, so as to maximize the performance of the first processor to meet the requirements of the high-performance state.
[0149] The target operating state may also include a power saving state. The electronic device may execute the method of this embodiment when detecting that it is in the power saving state, and reduce power consumption by dynamically controlling the operating frequency.
[0150] The present application also provides a control device, see Figure 4 , is a schematic diagram of the structure of the device, and the device may include the following units.
[0151] An obtaining unit 401 is used to obtain a historical rendering time spent by the first processor on rendering a plurality of historical image frames and a corresponding historical operating frequency;
[0152] A determining unit 402 is configured to determine state statistical information of the first processor according to a historical rendering duration and a historical operating frequency, wherein the state statistical information includes an expected rendering duration of the first processor at different historical operating frequencies;
[0153] The control unit 403 controls the target operating frequency of the first processor when rendering the target image frame to be rendered based on the state statistical information.
[0154] Optionally, when the determining unit 402 determines the state statistical information of the first processor according to the historical rendering duration and the historical operating frequency, it can be used to:
[0155] Determine a historical rendering duration of at least one historical image frame corresponding to each historical operating frequency;
[0156] Based on at least one historical rendering duration, an expected rendering duration of the first processor at each historical operating frequency is determined.
[0157] Optionally, when the determining unit 402 determines the expected rendering duration of the first processor at each historical operating frequency based on at least one historical rendering duration, it may be used to:
[0158] For each historical operating frequency, determining the duration weight of each historical rendering duration corresponding to the historical operating frequency according to the rendering moments of multiple historical image frames corresponding to the historical operating frequency by the first processor;
[0159] An expected rendering duration of the first processor at the historical operating frequency is determined according to multiple historical rendering durations and duration weights corresponding to the historical rendering durations.
[0160] Optionally, the state statistics information includes a plurality of state entries, each state entry includes a historical running frequency and an expected rendering time corresponding to the historical running frequency;
[0161] When the control unit 403 controls the target operating frequency of the first processor when rendering the target image frame to be rendered based on the state statistical information, it can be used to:
[0162] Get the target rendering duration for rendering the target image frame;
[0163] The target operating frequency of the first processor when rendering the target image frame is determined according to the target rendering duration and the state entries included in the state statistics information.
[0164] Optionally, when the control unit 403 obtains the target rendering duration for rendering the target image frame, it can be used to:
[0165] Obtaining a historical preparation time used by the second processor to provide a historical rendering task corresponding to a historical image frame, the second processor being used to provide the rendering task to the first processor to trigger the first processor to render the image frame based on the rendering task;
[0166] A target rendering time for rendering a target image frame is determined according to the historical preparation time.
[0167] Optionally, when the control unit 403 obtains the target rendering duration for rendering the target image frame, it can be used to:
[0168] Obtain configuration parameters corresponding to the target image frame;
[0169] A target rendering duration for rendering a target image frame is determined according to configuration parameters.
[0170] Optionally, when the control unit 403 determines the target operating frequency of the first processor when rendering the target image frame according to the target rendering duration and the state items included in the state statistics information, it can be used to:
[0171] For each state entry and target rendering duration, determine the alternative running frequency corresponding to each state entry;
[0172] A target operating frequency of the first processor when rendering a target image frame is determined according to the candidate operating frequencies corresponding to the multiple state entries.
[0173] Optionally, when the control unit 403 determines the target operating frequency of the first processor when rendering the target image frame according to the candidate operating frequencies corresponding to the multiple state entries, it can be used to:
[0174] Get the state parameters corresponding to each state entry;
[0175] A target operating frequency of the first processor when rendering a target image frame is determined according to the state parameters of the plurality of state entries and the candidate operating frequencies.
[0176] Optionally, when the obtaining unit 401 obtains the historical rendering duration and the corresponding historical operating frequency spent by the first processor in rendering multiple historical image frames, it can be used to:
[0177] In response to detecting the trigger condition, obtaining a historical rendering time spent by the first processor on rendering a plurality of historical image frames and a corresponding historical operating frequency;
[0178] The trigger condition is detected to include at least one of the following:
[0179] detecting a frequency control instruction for controlling an operating frequency of the first processor;
[0180] It is detected that the electronic device to which the first processor belongs starts the target application;
[0181] It is detected that the power level of the electronic device is lower than the power threshold;
[0182] The electronic device is detected to be in a target operating state.
[0183] The working principle of the control device provided in this embodiment can be found in the relevant steps of the control method of the aforementioned embodiment, and will not be described in detail.
[0184] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0185] For the convenience of description, the above system or device is described by dividing it into various modules or units according to its functions. Of course, when implementing the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0186] It can be known from the description of the above implementation methods that those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product can be stored in a storage medium such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments of the present application or certain parts of the embodiments.
[0187] Finally, it should be noted that, in this article, relational terms such as first, second, third and fourth are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0188] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A control method, comprising: Obtaining a historical rendering time and a corresponding historical operating frequency spent by the first processor in rendering a plurality of historical image frames; Determine state statistical information of the first processor according to the historical rendering duration and the historical operating frequency, the state statistical information including different historical operating frequencies and expected rendering durations of the first processor at different historical operating frequencies, the expected rendering durations of the historical operating frequencies being obtained by fusing the historical rendering durations of the historical image frames rendered at the historical operating frequencies; The target operating frequency of the first processor when rendering the target image frame to be rendered is controlled based on the state statistical information and the target rendering duration, wherein the target rendering duration is the duration used to render the target image frame.
2. The method according to claim 1, wherein determining the state statistical information of the first processor according to the historical rendering duration and the historical operating frequency comprises: Determine a historical rendering duration of at least one historical image frame corresponding to each of the historical operating frequencies; Based on the at least one historical rendering duration, an expected rendering duration of the first processor at each historical operating frequency is determined.
3. The method according to claim 2, wherein determining the expected rendering duration of the first processor at each historical operating frequency based on the at least one historical rendering duration comprises: For each of the historical operating frequencies, determining the duration weights of the respective historical rendering durations corresponding to the historical operating frequency according to the rendering moments of the plurality of historical image frames corresponding to the historical operating frequency by the first processor; An expected rendering duration of the first processor at the historical operating frequency is determined according to the multiple historical rendering durations and the duration weights corresponding to the historical rendering durations.
4. The method according to claim 1, wherein the state statistical information comprises a plurality of state entries, each of which comprises a historical running frequency and an expected rendering duration corresponding to the historical running frequency; The controlling the target operating frequency of the first processor when rendering the target image frame to be rendered based on the state statistical information and the target rendering duration includes: Get the target rendering duration for rendering the target image frame; The target operating frequency of the first processor when rendering the target image frame is determined according to the target rendering duration and the state entries contained in the state statistical information.
5. The method according to claim 4, wherein obtaining a target rendering duration for rendering a target image frame comprises: Obtaining a historical preparation time used by a second processor to provide a historical rendering task corresponding to the historical image frame, wherein the second processor is used to provide a rendering task to the first processor to trigger the first processor to render an image frame based on the rendering task; A target rendering duration for rendering the target image frame is determined according to the historical preparation duration.
6. The method according to claim 4, wherein obtaining a target rendering duration for rendering a target image frame comprises: Obtaining configuration parameters corresponding to the target image frame; A target rendering duration for rendering a target image frame is determined according to the configuration parameters.
7. The method according to claim 4, wherein determining the target operating frequency of the first processor when rendering the target image frame according to the target rendering duration and the state items contained in the state statistics information comprises: For each of the state entries and the target rendering duration, determining an alternative running frequency corresponding to each of the state entries; The target operating frequency of the first processor when rendering the target image frame is determined according to the candidate operating frequencies corresponding to the plurality of status entries.
8. The method according to claim 7, wherein determining the target operating frequency of the first processor when rendering the target image frame according to the candidate operating frequencies corresponding to the plurality of status entries comprises: Obtaining a state parameter corresponding to each of the state entries; The target operating frequency of the first processor when rendering the target image frame is determined according to the state parameters of the plurality of state entries and the candidate operating frequencies.
9. According to the method of claim 1, obtaining the historical rendering time and the corresponding historical running frequency spent by the first processor on rendering a plurality of historical image frames comprises: In response to detecting the trigger condition, obtaining a historical rendering time spent by the first processor on rendering a plurality of historical image frames and a corresponding historical operating frequency; The trigger condition detected includes at least one of the following: detecting a frequency control instruction for controlling the operating frequency of the first processor; Detecting that the electronic device to which the first processor belongs starts a target application; Detecting that the power level of the electronic device is lower than a power threshold; It is detected that the electronic device is in a target operating state.
10. A control device comprising: An obtaining unit, configured to obtain a historical rendering time and a corresponding historical operating frequency spent by the first processor in rendering a plurality of historical image frames; a determining unit, configured to determine state statistical information of the first processor according to the historical rendering duration and the historical operating frequency, the state statistical information including different historical operating frequencies and expected rendering durations of the first processor at different historical operating frequencies, the expected rendering durations of the historical operating frequencies being obtained by fusing historical rendering durations of the historical image frames rendered at the historical operating frequencies; A control unit is used to control a target operating frequency when the first processor renders a target image frame to be rendered based on the state statistical information and a target rendering duration, wherein the target rendering duration is a duration used to render the target image frame.
Citation Information
Patent Citations
Operation frequency adjustment method and device of processor and storage medium
CN114442792A
Control method, device, equipment and medium
CN118467084A