WO2022222721A1 - Computational resource scheduling method and apparatus - Google Patents

Computational resource scheduling method and apparatus Download PDF

Info

Publication number
WO2022222721A1
WO2022222721A1 PCT/CN2022/084179 CN2022084179W WO2022222721A1 WO 2022222721 A1 WO2022222721 A1 WO 2022222721A1 CN 2022084179 W CN2022084179 W CN 2022084179W WO 2022222721 A1 WO2022222721 A1 WO 2022222721A1
Authority
WO
WIPO (PCT)
Prior art keywords
frame rate
gpu
terminal
rate range
cpu
Prior art date
Application number
PCT/CN2022/084179
Other languages
French (fr)
Chinese (zh)
Inventor
辛高鹏
曾广珠
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2022222721A1 publication Critical patent/WO2022222721A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the present application relates to the field of communication technologies, and in particular, to a computing resource scheduling method and apparatus.
  • the current mainstream smart terminal operating systems include the Android operating system (android operation system,
  • Android OS (hereinafter referred to as the Android system), in this system, in the application (also known as application) startup, application exit, gesture navigation and other scenarios, there will be various situations where the interface refreshes quickly or slowly. This situation may lead to frame loss and freeze, reducing user experience. Especially in high frame rate scenes, the phenomenon of frame loss and freeze is more serious.
  • Embodiments of the present application provide a computing resource scheduling method and apparatus, which are used to solve the problem of frame loss and freeze in scenarios such as application startup, exit, and gesture navigation.
  • a computing resource scheduling method including: a terminal creates a thread group including threads related to graphics synthesis, and adjusts the CPU processing resources and/or GPU frequency corresponding to the thread group according to target image quality.
  • the method provided in the first aspect can reduce the occurrence of frame dropping and stuck phenomenon in applications such as startup, exit, gesture navigation, etc., and provide corresponding graphics synthesis resources according to user needs, reduce the power consumption of the terminal, and improve the user experience.
  • the terminal adjusts the processing resources of the CPU corresponding to the thread group and/or adjusts the GPU frequency according to the target image quality, including: the terminal adjusts the processing resources of the CPU corresponding to the thread group according to the target frame rate of the image; and or, the terminal adjusts the GPU frequency according to the GPU synthesis duration of the single-frame image of the image.
  • the processing resources of the CPU are adjusted according to the target frame rate and/or the frequency of the GPU is adjusted according to the GPU synthesis duration of a single frame image, so that the image synthesis resources can be scheduled in time to ensure the timeliness of image display.
  • the terminal adjusts the processing resources of the CPU corresponding to the thread group according to the target frame rate of the image, including: the terminal determines that the frame rate range in which the target frame rate is located is the first frame rate range; The threshold value corresponding to the frame rate range adjusts the processing resources of the CPU corresponding to the thread group, and the threshold value is greater than 0 and less than 1.
  • the processing resources of the CPU to be adjusted are directly determined according to the first frame rate range in which the target frame rate is located.
  • the CPU can be determined by judging the frame rate range in which the target frame rate is located.
  • the threshold value of the resource is processed, thereby solving the problem in the prior art that the resource cannot be configured according to the real-time requirement of the user for the frame rate.
  • the terminal adjusts the processing resources of the CPU corresponding to the thread group according to the threshold value corresponding to the first frame rate range, including: the terminal determines the adjustment value of the processing resources of the CPU, and the adjustment value is the first frame rate The product of the threshold value corresponding to the range and the remaining resources of the CPU; the terminal increases the processing resources of the CPU for the thread group according to the adjustment value.
  • This possible implementation provides a specific calculation method for calculating the adjustment amount of the processing resources of the CPU corresponding to the thread group according to the threshold value corresponding to the first frame rate range, and the terminal calculates the CPU corresponding to the target frame rate according to this formula. The processing resources are adjusted accordingly.
  • the terminal adjusts the GPU frequency according to the GPU synthesis duration of the single-frame image of the image, including: the terminal determines that the frame rate range in which the target frame rate is located is the second frame rate range and the range corresponding to the second frame rate range. GPU frequency; when it is determined that under the GPU frequency corresponding to the second frame rate range, the GPU synthesis duration of a single frame image is greater than or equal to the first threshold, adjust the GPU frequency to the GPU frequency corresponding to the maximum value of the second frame rate range.
  • a threshold is the GPU synthesis duration of the single-frame image corresponding to the maximum value of the second frame rate range, and the GPU frequency corresponding to the maximum value of the second frame rate range is greater than the GPU frequency corresponding to the second frame rate range.
  • the corresponding GPU frequency is determined according to the second frame rate range in which the target frame rate is located.
  • the GPU performs image synthesis at this frequency, and simultaneously detects the GPU synthesis duration of a single frame image.
  • the relationship of a threshold determines the adjustment method of the corresponding GPU frequency, so that when it is judged that the GPU synthesis time of a single frame image cannot meet the user's needs, the GPU frequency can be adjusted in time to reduce the phenomenon of frame loss and freeze.
  • the method further includes: the terminal monitors the change of the frame rate in real time; and/or the terminal monitors the GPU synthesis duration of the single frame image in real time.
  • the terminal adjusts the processing resources of the CPU and/or the frequency of the GPU by monitoring the change of the frame rate and/or the GPU synthesis time of a single frame image in real time, so as to realize the real-time adjustment of the graphics synthesis resources according to the needs of the user, and improve the user experience.
  • the graphics synthesis related threads include threads in one or more of the SF process, the memory allocation process, the display sending process, and the working process.
  • the method further includes: the terminal increases the scheduling priority of threads related to graphics synthesis.
  • the terminal increases the scheduling priority of threads related to graphics synthesis.
  • the priority of the thread group where the graphics synthesis related threads are located can be improved, so that the graphics synthesis related threads can run in time to meet the user's image quality requirements.
  • a terminal device including: functional units for executing any one of the methods provided in the first aspect, and actions performed by each functional unit are implemented by hardware or by executing corresponding software by hardware.
  • the terminal device may include: a creation unit and an adjustment unit; a creation unit for creating a thread group, where the thread group includes threads related to graphics synthesis; an adjustment unit for adjusting the processing resources of the CPU corresponding to the thread group and/or according to the target image quality Or adjust the GPU frequency.
  • the terminal device may exist in the form of a chip product.
  • a terminal device including: a processor.
  • the processor is connected to the memory, the memory is used for storing computer-executed instructions, and the processor executes the computer-executed instructions stored in the memory, thereby implementing any one of the methods provided in the first aspect.
  • the memory and the processor can be integrated together or can be independent devices. In the latter case, the memory may be located in the communication device or outside the communication device.
  • a terminal device in a fourth aspect, includes: a processor and an interface circuit; the interface circuit is used to receive code instructions and transmit them to the processor; the processor is used to run the code instructions to execute the code instructions provided in the first aspect any of the methods.
  • a computer-readable storage medium including computer-executable instructions, which, when the computer-executable instructions are run on a computer, cause the computer to perform any one of the methods provided in the first aspect.
  • a computer program product including computer-executable instructions, which, when the computer-executable instructions are run on the computer, cause the computer to perform any one of the methods provided in the first aspect.
  • FIG. 1 is a schematic diagram of a hardware structure of a terminal according to an embodiment of the present application
  • FIG. 2 is a schematic diagram of the composition of software modules of a terminal according to an embodiment of the present application
  • FIG. 3 is a schematic diagram of the composition of a combination of software and hardware provided by an embodiment of the present application.
  • FIG. 4 is a schematic diagram of a method for detecting the duration of a single-frame image GPU synthesis provided by an embodiment of the present application
  • FIG. 5 is a flowchart of a computing resource scheduling method provided by an embodiment of the present application.
  • FIG. 6 is a flowchart of a method for creating a thread group provided by an embodiment of the present application.
  • FIG. 7 is a schematic diagram of adjusting a GPU frequency according to an embodiment of the present application.
  • FIG. 8 is a flowchart of a computing resource scheduling method provided by an embodiment of the present application.
  • FIG. 9 is a flowchart of a strategy configuration and execution module execution strategy provided by an embodiment of the present application.
  • FIG. 10 is a schematic diagram of the composition of a terminal device according to an embodiment of the present application.
  • FIG. 11 is a schematic diagram of a hardware structure of a terminal device according to an embodiment of the present application.
  • the embodiment of the present application provides a computing resource scheduling method, which can be applied to a terminal, where the terminal is used to provide one or more of a voice service and a data connectivity service to a user.
  • a terminal may also be referred to as user equipment (UE), terminal equipment, access terminal, subscriber unit, subscriber station, mobile station, remote station, remote terminal, mobile device, user terminal, wireless communication device, user agent, or user device.
  • the terminal can be a mobile phone, an augmented reality (AR) device, a virtual reality (VR) device, a tablet computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (personal digital assistant, PDA) etc., the specific form of the terminal is not limited in the following embodiments.
  • the operating system of the terminal in the embodiments of the present application may be an Android system, an Internet operating system (iOS) system, Linux, or other operating systems.
  • iOS Internet operating system
  • FIG. 1 An exemplary hardware structure of the terminal in the embodiment of the present application can be seen in FIG. 1, including: a CPU, a display screen, a GPU, and a memory, and the terminal may also include other devices, such as a radio frequency (RF) circuit, a Bluetooth device, a or more components such as sensors, touchpads, pointing devices, audio circuits, peripheral interfaces, and power systems, which can communicate through one or more communication buses or signal lines (not shown in Figure 1).
  • RF radio frequency
  • Bluetooth device a or more components
  • sensors touchpads
  • pointing devices audio circuits
  • peripheral interfaces peripheral interfaces
  • power systems which can communicate through one or more communication buses or signal lines (not shown in Figure 1).
  • FIG. 1 does not constitute a limitation on the terminal, and the terminal may include more or less components than the one shown, or combine some components, or arrange different components.
  • the CPU is the control center of the terminal, and uses various interfaces and lines to connect various parts of the terminal.
  • the display screen is used to display information input by the user or information provided to the user and various menus of the terminal.
  • GPU is a kind of microprocessor specialized in image computing work on the terminal. It can convert and drive the information that the terminal needs to display, and provide a line scan signal to the display screen to control the correct display of the display screen.
  • the memory is used to store applications and data, and the CPU and GPU execute various functions of the terminal by running the applications and data stored in the memory.
  • the CPU can process the input events, and finally display the information to be displayed on the display screen through the GPU.
  • a schematic diagram of another exemplary software module composition of the terminal in the embodiment of the present application includes: a resource management service (resource management service, RMS) real-time processing module and a policy configuration and execution module.
  • RMS resource management service
  • the RMS real-time processing module is used to obtain the real-time frame rate of the system, and send the corresponding policy to the policy configuration and execution module according to the real-time frame rate.
  • the policy configuration and execution module is used for receiving the policy sent by the RMS real-time processing module, and takes effect through the module processing the policy in the policy configuration and execution module.
  • the terminal receives input events such as application startup, application exit, and gesture navigation, obtains the system real-time frame rate through the RMS real-time processing module, generates a corresponding policy according to the real-time frame rate, and sends the policy to the policy configuration and execution module.
  • the execution module takes effect of the strategy, and finally completes the output and display to the user through the display screen.
  • the input event of the terminal may be triggered by a user's operation on the terminal (for example, an action of the user interacting with an application of the terminal).
  • a schematic diagram of another exemplary combination of software and hardware of the terminal in the embodiment of the present application includes a frame rate module, an RMS real-time processing module, a policy configuration and execution module, a kernel, a CPU, and a GPU. It includes an energy aware scheduling (EAS) scheduler and a GPU driver.
  • EAS energy aware scheduling
  • the connection relationship of each module can be seen in Figure 3.
  • the frame rate module is used to perceive the frame rate change and notify other modules (for example, the RMS real-time processing module).
  • the kernel is the most basic part of the operating system. It is a part of software that provides secure access to computer hardware for many applications. As shown in Figure 3, the kernel can include programs such as EAS scheduler and GPU driver that communicate with CPU and GPU hardware.
  • the EAS scheduler is used to create a new thread group (also called a scheduling group).
  • Other modules in the kernel can add threads to the thread group based on the process granularity, that is to say, generally one or more processes are added to the thread group. At this time, all the threads in the one or more processes form a thread group .
  • Threads related to graphics synthesis can also be called graphics synthesis engines, which refer to threads that participate in interface synthesis (surface flinger, SF) and other threads that are depended on by these threads.
  • graphics synthesis engines can include SF process, memory allocation (allocator buffer thread for SF using, ALLOCATOR) process, sending display process (with the function of using hardware to complete image data combination and display), work (kworker) process, etc. and its sub-threads.
  • the above-mentioned related threads have direct or indirect dependencies on each other.
  • the SF process depends on the display process
  • the display process depends on the kworker process.
  • SF processes and kworker processes can be called indirect dependencies.
  • the frame rate refers to the number of image frames displayed in a unit time, where the unit time can be 1 second (s) or other time units.
  • the duration of single-frame image synthesis refers to the duration of processing one frame of image, and the duration of single-frame image synthesis includes the duration of GPU synthesis of single-frame images and the duration of synthesis by other processors.
  • the system frame rate can be 60 Hz, 90 Hz or 120 Hz
  • the corresponding single-frame image synthesis time is 16.66 milliseconds (ms), 11 ms or 8 ms
  • the single-frame image GPU synthesis duration can be The ratio of the frame image GPU synthesis duration to the single frame image synthesis duration and the single frame image synthesis duration are calculated.
  • the GPU synthesis time of a single-frame image is 1/2 of the single-frame image synthesis time
  • the single-frame image GPU synthesis time is 1/2 of the single-frame image synthesis time.
  • the terminal can perform instrumentation in the SF process in the GPU synthesis process, so as to monitor the GPU synthesis duration of a single frame image.
  • the terminal may perform instrumentation respectively at the start of GPU synthesis of each frame of image and at the end of GPU synthesis, and calculate the GPU synthesis duration of a single frame of image according to the time points of the two insertions.
  • the terminal has the following problems:
  • the present application provides a computing resource scheduling method.
  • the terminal adjusts resources such as CPU and GPU according to the target image quality, so as to ensure the smoothness and timeliness of the application running.
  • the method includes:
  • the terminal creates a thread group, where the thread group includes threads related to graphics synthesis.
  • the thread group in this application includes graphics synthesis related threads. Therefore, dependency blocking among threads related to graph synthesis can be avoided.
  • the thread group may only include graphics synthesis related threads. In this case, the problem that graphics synthesis threads cannot be completed in time due to other unrelated threads included in the same group can be avoided, and the graphics synthesis efficiency can be significantly improved.
  • step 501 When step 501 is specifically implemented, it can be implemented through steps 601 to 603 as shown in FIG. 6 .
  • the terminal is initialized (that is, the terminal is powered on and started).
  • the EAS scheduler creates a new thread group.
  • the RMS real-time processing module adds graphics synthesis-related threads to the thread group, where the graphics synthesis-related threads may include SF process, ALLOCATOR process, display sending process, Kworker process, and the like.
  • the terminal adjusts the processing resources of the CPU corresponding to the thread group and/or adjusts the frequency of the GPU according to the target image quality.
  • the target image quality refers to the image quality of the image to be displayed or to be displayed on the terminal
  • the target image quality needs to meet the requirements of the target frame rate
  • the target frame rate refers to the image to be displayed or to be displayed due to the user's trigger
  • the frame rate of the image For example, when the user triggers application startup, application exit, and gesture navigation, the frame rate of the image to be displayed by the terminal is the target frame rate.
  • the target frame rate may be higher than the frame rate of the currently displayed image, may also be lower than the frame rate of the currently displayed image, or may be the same as the frame rate of the currently displayed image, which is not limited in this application.
  • the terminal can monitor the change of the frame rate in real time.
  • the RMS real-time processing module can perform callback registration with the frame rate module during the terminal initialization phase, and the callback registration is used to instruct the frame rate module to notify the RMS real-time processing module when the frame rate changes, and the RMS real-time processing module can obtain the latest frame rate. .
  • the target frame rate can be the latest frame rate obtained by the RMS real-time processing module based on the current time.
  • the target frame rate can be the frame rate (that is, the initial frame rate) obtained by the RMS real-time processing module from the frame rate module for the first time after the terminal is initialized (that is, after the callback is registered).
  • the target frame rate may be the frame rate newly obtained by the RMS real-time processing module from the frame rate module in the subsequent process.
  • the terminal may adjust the processing resources of the CPU corresponding to the thread group and/or adjust the GPU frequency based on the target frame rate of the image.
  • the above step 502 may include the following action 1 and/or action 2 when specifically implemented:
  • Action 1 The terminal adjusts the processing resources of the CPU corresponding to the thread group according to the target frame rate of the image.
  • the terminal adjusts the GPU frequency according to the GPU synthesis duration of the single-frame image of the image.
  • action 1 may include: the terminal determines that the frame rate range in which the target frame rate is located is the first frame rate range; the terminal adjusts the processing of the CPU corresponding to the thread group according to the threshold value (Threshold) corresponding to the first frame rate range Resource, the threshold value is greater than 0 and less than 1.
  • the threshold value is greater than 0 and less than 1.
  • the correspondence between at least one frame rate range (it is assumed to be N frame rate ranges) and the threshold value (referred to as the first correspondence) can be pre-configured, and the first correspondence includes the Threshold value.
  • the threshold value corresponding to each frame rate range is greater than 0 and less than 1.
  • the threshold value in the first corresponding relationship may also be referred to as a load threshold value.
  • N is an integer greater than 0. Any two frame rate ranges in the N frame rate ranges do not overlap, and as the frame rate range increases, the threshold value increases correspondingly.
  • the first corresponding relationship may remain unchanged or may be changed periodically or according to a certain time rule.
  • the N frame rate ranges may be preset according to the version of the operating system of the terminal, the capability of the terminal, and the like, and the method for possessing them is not limited in this application.
  • Table 1 shows a possible first correspondence.
  • the threshold value 10 corresponding to [0, 60) Hz is used to adjust the corresponding thread group CPU processing resources; if the target frame rate is greater than or equal to 60Hz and less than 90Hz, at this time, the first frame rate range is [60, 90) Hz, then the threshold value 20 corresponding to [60, 90) Hz is used to adjust the thread group
  • the processing resources of the corresponding CPU if the target frame rate is greater than or equal to 90Hz and less than 120Hz, at this time, the first frame rate range is [90, 120) Hz, then the threshold value 30 corresponding to [90, 120) Hz is used to adjust The processing resources of the CPU corresponding to the thread group; if the target frame rate is greater than or equal to 120Hz and less than or equal to Y, at this time, the first frame rate range is [120, Y] Hz, and the gate corresponding to [
  • the terminal adjusts the processing resources of the CPU corresponding to the thread group according to the threshold value corresponding to the first frame rate range, including: the terminal determines the adjustment value of the processing resources of the CPU, and the adjustment value corresponds to the first frame rate range.
  • the product of the threshold value and the remaining resources of the CPU; the terminal increases the processing resources of the CPU for the thread group according to the adjustment value.
  • the target frame rate obtained by the RMS real-time processing module is 70 Hz
  • the target frame rate is at [60, 90) Hz
  • the threshold corresponding to [60, 90) Hz is 20.
  • the processing resource of the CPU allocated to the thread group is denoted as a, and the total processing resource of the CPU is denoted as b, then the adjustment value is (b-a) ⁇ 20%, and the obtained adjustment value is taken as the increment of the allocated resource a to realize the The adjustment of the processing resources of the CPU.
  • the form of the first correspondence may not be the correspondence between the frame rate range and the threshold, but the correspondence between the frame rate and the threshold.
  • the first correspondence includes N frame rates.
  • the corresponding relationship with the threshold value when the target frame rate is less than the minimum frame rate among the N frame rates, the processing resources of the CPU corresponding to the thread group can be adjusted according to the threshold value corresponding to the minimum frame rate.
  • the processing resources of the CPU corresponding to the thread group are adjusted according to the threshold value corresponding to the larger frame rate among the two consecutive frame rates .
  • the processing resources of the CPU corresponding to the thread group may be adjusted according to the threshold value corresponding to the maximum frame rate.
  • An example of the first correspondence can be found in Table 2.
  • the threshold value 10 corresponding to 60Hz is used to adjust the processing resources of the CPU corresponding to the thread group;
  • the threshold value of 20 adjusts the processing resources of the CPU corresponding to the thread group; if the target frame rate is greater than or equal to 90Hz and less than 120Hz, the threshold value 30 corresponding to 120Hz is used to adjust the processing resources of the CPU corresponding to the thread group; if the target frame rate If it is greater than or equal to 120 Hz, the threshold value 40 corresponding to Y is used to adjust the processing resources of the CPU corresponding to the thread group.
  • the process of adjusting the processing resources of the CPU after the threshold value is determined may be referred to above, and will not be repeated here.
  • the above-mentioned action 1 may include: the RMS real-time processing module obtains the target frame rate from the frame rate module, and determines a policy ID according to the target frame rate, where the policy ID is used to indicate the first frame rate range and the threshold value corresponding to the first frame rate range, the RMS real-time processing module sends the policy ID to the policy configuration and execution module, and the policy configuration and execution module parses the policy ID to obtain the threshold value, and sends the threshold value to The kernel obtains the adjustment value through calculation, sends the adjustment value to the CPU, and the CPU adjusts the processing resources according to the adjustment value.
  • the CPU of the terminal consists of multiple cores, and the processing resources of the CPU can be further divided into large, medium and small cores, and the large, medium and small cores are further divided into multiple clock frequencies ranging from high, medium and low.
  • the clock frequency corresponding to the core is higher, and the clock frequency corresponding to the small core is lower.
  • a small core has a higher energy efficiency ratio (ratio of power consumption and performance) and a longer duration than a large core; low frequency is more energy efficient than high frequency, and the duration is also longer.
  • ratio of power consumption and performance ratio of power consumption and performance
  • sufficient processing resources of the CPU can be allocated for displaying the image after the interaction to ensure the smoothness of the image.
  • the adjustment value of CPU processing resources is determined and adjusted based on the target frame rate, if the adjusted CPU processing resources reach the CPU core migration threshold, core migration can be performed to ensure smooth images and improve user experience. It can be seen from this that, by adjusting the processing resources of the CPU, the core of the CPU that processes the threads related to graphics synthesis can also be indirectly adjusted, so as to ensure the timeliness of image synthesis.
  • action 2 may include: the terminal determines that the frame rate range in which the target frame rate is located is the second frame rate range; the terminal determines the GPU frequency corresponding to the second frame rate range; when determining the GPU frequency corresponding to the second frame rate range
  • the terminal adjusts the GPU frequency to the GPU frequency corresponding to the maximum value of the second frame rate range
  • the first threshold is the single frame corresponding to the maximum value of the second frame rate range.
  • Image GPU synthesis duration the GPU frequency corresponding to the maximum value of the second frame rate range is greater than the GPU frequency corresponding to the second frame rate range.
  • the GPU frequency corresponding to the maximum value of the second frame rate range is recorded as the target GPU frequency.
  • the correspondence between the frame rate range and the GPU frequency may be preset, and the correspondence may include M correspondences between the frame rate range and the GPU frequency (referred to as the second correspondence), each frame rate
  • the maximum value of the range may also correspond to a GPU frequency, and the GPU frequency corresponding to the maximum value of a frame rate range is greater than the GPU frequency corresponding to the frame rate range.
  • M is an integer greater than 1.
  • the terminal can run at the GPU frequency corresponding to the second frame rate range.
  • the GPU frequency corresponding to the second frame rate range is determined, a single frame
  • the image GPU synthesis duration is greater than or equal to the first threshold, it means that the current GPU frequency cannot meet the requirement of the image GPU synthesis duration when the frame rate is the maximum value of the second frame rate range.
  • the GPU frequency can be adjusted to The target GPU frequency. Since the target GPU frequency is greater than the GPU frequency corresponding to the second frame rate range, the synthesis efficiency of images can be improved and frame loss can be avoided.
  • Table 3 exemplarily shows a second correspondence relationship
  • Table 4 exemplarily shows the GPU frequency corresponding to the maximum value of each frame rate range in the second correspondence relationship.
  • the terminal adopts the GPU frequency 200MHz corresponding to [0,60) Hz to perform GPU synthesis.
  • the terminal If the detection result of the terminal in the first frame is 8.13ms, since 8.13ms is less than 8.33ms, the terminal can not adjust the GPU Frequency; if the detection result of the terminal in the second frame is 8.66ms, since 8.66ms is greater than 8.33ms, it means that the current GPU frequency cannot meet the requirements of the target image quality. Therefore, the terminal increases the GPU frequency before the GPU synthesis in the third frame. Increase to the corresponding GPU frequency of 60Hz (ie 250MHz).
  • the terminal can monitor the GPU synthesis duration of a single-frame image in real time, so as to adjust the GPU frequency at any time to avoid frame loss and freeze.
  • the above-mentioned action 2 may include: in the SF process, determining whether the GPU synthesis duration of a single-frame image exceeds a first threshold, and if so, the CPU sends indication information to the RMS real-time processing module in the SF process , the instruction information is used to indicate that the single-frame image GPU synthesis duration exceeds the first threshold, the RMS real-time processing module determines the target GPU frequency, and sends the strategy ID to the strategy configuration and execution module, and the strategy corresponding to the strategy ID is used to indicate the target GPU frequency,
  • the policy configuration and execution module obtains the target GPU frequency by parsing the policy ID, and sends the target GPU frequency to the GPU driver in the kernel, and the GPU driver controls the GPU to adjust the GPU frequency to the target GPU frequency.
  • GPU frequency due to the adjustment of the GPU frequency, other GPU resources related to the GPU frequency, such as memory resources (for example, double data rate, DDR) used for GPU synthesis, will also be adjusted accordingly. Specifically, some methods well known to those skilled in the art may be adopted, which will not be described in detail in this application.
  • memory resources for example, double data rate, DDR
  • the overall flow of the method provided by the above embodiment may include:
  • the frame rate module detects the input event and determines the target frame rate.
  • the input events may be events such as application startup, application exit, gesture navigation, etc. received by the terminal.
  • the frame rate module sends the target frame rate to the RMS real-time processing module and the CPU.
  • the CPU determines the target GPU frequency according to the target frame rate, and sends the instruction information to the RMS real-time processing module.
  • the indication information is used to indicate that the GPU synthesis duration of the single-frame image exceeds the first threshold.
  • the RMS real-time processing module determines the policy ID, and the policy ID is used to adjust the processing resources of the CPU or adjust the frequency of the GPU. If the policy ID is used to adjust the processing resources of the CPU corresponding to the thread group, the policy ID is determined according to the target frame rate. If the policy ID is used to adjust the GPU frequency, the policy ID is determined according to the indication information.
  • the specific implementation of step 14) can refer to the above.
  • the policy ID can indicate the type of the policy
  • the types of the policy include: the type used to adjust the processing resources of the CPU corresponding to the thread group (denoted as the first type policy), the type used to adjust the GPU frequency (denoted as the second type of policy) type policy).
  • policies corresponding to policies 1001 and 1002 are policies of the first type
  • policies corresponding to policies 2001 and 2002 are policies of the second type.
  • the first type of strategy includes frame rate range and threshold value
  • the second type of strategy includes target GPU frequency
  • the RMS real-time processing module sends the policy ID to the policy configuration and execution module.
  • the policy configuration and execution module adjusts the processing resources of the CPU or the frequency of the GPU according to the policy ID.
  • step 16) can include:
  • the policy configuration and execution module receives the policy ID from the RMS real-time processing module.
  • the policy configuration and execution module determines whether a policy corresponding to the policy ID exists in the extensible markup language (extensible markup language, xml) configuration file.
  • step 903 If there is, go to step 903, if not, end.
  • the policy configuration and execution module adjusts the processing resources of the CPU or the frequency of the GPU according to the policy ID.
  • the xml configuration file may be pre-stored in the terminal for policy configuration and the policy corresponding to the query policy ID of the execution module.
  • the policy ID is policy 1001
  • parse the policy 1001 to obtain the frame rate range (ie [0, 60) Hz) and its corresponding threshold value (ie 10), and use the threshold
  • the value is sent to the kernel, the kernel obtains the adjustment value through calculation, and sends the adjustment value to the CPU, and the CPU adjusts the processing resources of the CPU according to the adjustment value.
  • the strategy ID is strategy 2001
  • the GPU driver controls the GPU to adjust the GPU frequency to the target GPU frequency.
  • the above method further includes: the terminal increases the scheduling priority of threads related to graphics synthesis, or the terminal increases the scheduling priority of the thread group in the present application.
  • one or two most important threads can be added to a thread group (in this case, the thread group can be called a critical group), and the priority of the critical group is higher than that of the non-critical group to ensure performance Experience first.
  • This method does not add related threads with dependencies to the same thread group, but the threads in a thread group are coordinated and scheduled uniformly.
  • the scheduling strategy is also different, which leads to some threads in the related threads migrate early, and some threads migrate late, resulting in dependent blocking between threads.
  • a thread group can be created that includes threads related to graphics synthesis, and the priority of all threads in the thread group can be increased. The priority of all threads in the thread group is higher than that of threads in other groups.
  • the priority of the thread group is higher than that of other groups. Due to the higher priority of the thread group, priority processing can be achieved, so that in the process of image synthesis, the smoothness and timeliness of the thread processing process are ensured, and frame loss is further avoided. The occurrence of the stuttering phenomenon improves the user experience.
  • the processing resources of the CPU and the frequency of the GPU can be adjusted to the maximum, that is, the presence of graphics All threads in the thread group that synthesize related threads are allocated sufficient CPU processing resources and GPU frequencies, so that although the user's needs can be met, resource waste is serious and power consumption is relatively high.
  • the user since an independent thread group related to graphics synthesis is established, the user can adjust the processing resources and GPU frequency of the GPU for the thread group according to the actual image quality requirements, so as to avoid resource waste and reduce the power consumption of the terminal.
  • the present application can create independent thread groups for graphics synthesis related threads, and allocate resources to the thread groups in the application as needed. Compared with placing graphics synthesis related threads in different thread groups, waste of resources can be avoided. , reduce the power consumption of the terminal.
  • the method provided by this embodiment of the present application reasonably adjusts the processing resources of the CPU corresponding to the thread group by judging the level of the target frame rate of the image (or can also be described as the length of the target frame interval of the image), and by monitoring the GPU of a single frame image Synthesis time, reasonable adjustment of GPU frequency, can allocate resources to thread groups as needed, thereby avoiding waste of resources and reducing power consumption of terminals.
  • step 501 and step 502 may be independent solutions, when only step 501 is executed, the above problem 1 can be solved, and only step 502 is executed (in this case, the thread group may not be the thread group in the present application, Instead of the thread group in the prior art), the above problem 2 can be solved.
  • each module for example, in order to implement the above-mentioned functions, the terminal includes at least one of a hardware structure and a software module corresponding to executing each function.
  • the present application can be implemented in hardware or in the form of a combination of hardware and computer software, in conjunction with the units and algorithm steps of each example described in the embodiments disclosed herein. Whether a function is performed by hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each particular application, but such implementations should not be considered beyond the scope of this application.
  • the terminal may be divided into functional units according to the foregoing method examples.
  • each functional unit may be divided corresponding to each function, or two or more functions may be integrated into one processing unit.
  • the above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units. It should be noted that the division of units in the embodiments of the present application is illustrative, and is only a logical function division, and other division methods may be used in actual implementation.
  • FIG. 10 shows a possible schematic structural diagram of a terminal device (referred to as a terminal device 100 ) involved in the above-mentioned embodiment, where the terminal device 100 includes a creation unit 1001 and an adjustment unit 1002 .
  • a creation unit 1001 is used to create a thread group, where the thread group includes graphics synthesis related threads;
  • the adjustment unit 1002 is configured to adjust the processing resources of the central processing unit CPU corresponding to the thread group and/or adjust the frequency of the graphics processor GPU according to the target image quality.
  • the adjustment unit 1002 is specifically configured to: adjust the processing resources of the CPU corresponding to the thread group according to the target frame rate of the image; and/or adjust the GPU frequency according to the GPU synthesis duration of a single frame of the image.
  • the adjusting unit 1002 is specifically configured to: determine the frame rate range where the target frame rate is located as the first frame rate range; adjust the processing resources of the CPU corresponding to the thread group according to the threshold value corresponding to the first frame rate range, The limit is greater than 0 and less than 1.
  • the adjustment unit 1002 is specifically configured to: determine the adjustment value of the processing resources of the CPU, where the adjustment value is the product of the threshold value corresponding to the first frame rate range and the remaining resources of the CPU; Process resources.
  • the adjustment unit 1002 is specifically configured to: determine the frame rate range in which the target frame rate is located as the second frame rate range; determine the GPU frequency corresponding to the second frame rate range; when determining the GPU frequency corresponding to the second frame rate range; Under the frequency, when the GPU synthesis time of a single frame image is greater than or equal to the first threshold, adjust the GPU frequency to the GPU frequency corresponding to the maximum value of the second frame rate range, and the first threshold is the single frame corresponding to the maximum value of the second frame rate range.
  • Image GPU synthesis duration the GPU frequency corresponding to the maximum value of the second frame rate range is greater than the GPU frequency corresponding to the second frame rate range.
  • the terminal device further includes a monitoring unit 1003, and the monitoring unit 1003 is configured to: monitor the change of the frame rate in real time; and/or monitor the GPU synthesis duration of the single frame image in real time.
  • the graphics synthesis related threads include threads in one or more of the SF process, the memory allocation process, the sending and display process, and the worker process.
  • the terminal device further includes a priority configuration unit 1004; the priority configuration unit 1004 is configured to improve the scheduling priority of graphics synthesis related threads.
  • the terminal device 100 further includes a storage unit 1005 .
  • the storage unit 1005 is used for storing computer-executed instructions, and other units in the terminal device can perform corresponding actions according to the computer-executed instructions stored in the storage unit 1005 .
  • the actions performed by the creation unit 1001 may also be performed by the above-mentioned RMS real-time processing module and the kernel; the actions performed by the adjustment unit 1002 may also be performed by the above-mentioned policy configuration and execution modules; the actions performed by the monitoring unit 1003 may also be performed by the above-mentioned frames.
  • the rate module and the kernel are executed; the actions executed by the priority configuration unit 1004 can also be executed by the above-mentioned kernel.
  • the terminal device 100 may be a device or a chip or a chip system.
  • the integrated unit in FIG. 10 may be stored in a computer-readable storage medium if it is implemented in the form of software functional modules and sold or used as a stand-alone product.
  • the medium includes several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (processor) to execute all or part of the steps of the methods of the various embodiments of the present application.
  • Storage media for storing computer software products include: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or CD, etc. that can store program codes medium.
  • the terminal device includes a processor 1101 and, optionally, a memory 1102 connected to the processor 1101 .
  • the processor 1101 and the memory 1102 are connected by a bus.
  • the processor 1101 may include a CPU, a GPU, a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the programs of the present application.
  • the processor 1101 may also include multiple CPUs, and the processor 1101 may be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor.
  • a processor herein may refer to one or more devices, circuits, or processing cores for processing data (eg, computer program instructions).
  • the memory 1102 can be a ROM or other type of static storage device that can store static information and instructions, a RAM or other type of dynamic storage device that can store information and instructions, or an electrically erasable programmable read-only memory.
  • read-only memory EEPROM
  • compact disc read-only memory CD-ROM
  • optical disc storage including compact disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.
  • magnetic disk A storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program codes in the form of instructions or data structures and that can be accessed by a computer, is not limited in this embodiment of the present application.
  • the memory 1102 may exist independently, or may be integrated with the processor 1101 . Among them, the memory 1102 may contain computer program code.
  • the processor 1101 is configured to execute the computer program codes stored in the memory 1102, so as to implement the methods provided by the embodiments of the present application.
  • the processor 1101 is configured to control and manage actions of the terminal.
  • the processor 1101 is configured to execute actions 501 to 502 in FIG. 5 and/or actions performed by the terminal in other processes described in the embodiments of this application.
  • the memory 1102 is used to store program codes and data of the terminal.
  • each step in the method provided in this embodiment may be completed by an integrated logic circuit of hardware in a processor or an instruction in the form of software.
  • the steps of the method disclosed in conjunction with the embodiments of the present application may be directly embodied as executed by a hardware processor, or executed by a combination of hardware and software modules in the processor.
  • Embodiments of the present application further provide a computer-readable storage medium, including instructions, which, when executed on a computer, cause the computer to execute any of the foregoing methods.
  • Embodiments of the present application also provide a computer program product containing instructions, which, when run on a computer, cause the computer to execute any of the above methods.
  • the computer program product includes one or more computer instructions.
  • the computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable device.
  • Computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server, or data center over a wire (e.g.
  • coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (eg infrared, wireless, microwave, etc.) means to transmit to another website site, computer, server or data center.
  • Computer-readable storage media can be any available media that can be accessed by a computer or data storage devices including one or more servers, data centers, etc., that can be integrated with the media.
  • Useful media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, DVDs), or semiconductor media (eg, solid state disks (SSDs)), and the like.

Abstract

The present application relates to the technical field of communications, and provides a computational resource scheduling method and apparatus. The method comprises: a terminal creates a thread group comprising graphic synthesis related threads, and adjusts, according to target image quality, a processing resource of a CPU corresponding to the thread group and/or a GPU frequency. By means of the method, frame loss and stuttering phenomena appearing in applications in scenarios of starting, exiting, and gesture navigation and the like can be reduced, a corresponding graphic synthesis resource is provided according to user requirements, the power consumption of the terminal is reduced, and the user experience is improved.

Description

计算资源调度方法及装置Computing resource scheduling method and device
本申请要求于2021年04月22日提交国家知识产权局、申请号为202110438616.7、申请名称为“计算资源调度方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application with the application number 202110438616.7 and the application name "Computing Resource Scheduling Method and Device", which was submitted to the State Intellectual Property Office on April 22, 2021, the entire contents of which are incorporated into this application by reference .
技术领域technical field
本申请涉及通信技术领域,尤其涉及一种计算资源调度方法及装置。The present application relates to the field of communication technologies, and in particular, to a computing resource scheduling method and apparatus.
背景技术Background technique
当前主流的智能终端操作系统包括安卓操作系统(android operation system,The current mainstream smart terminal operating systems include the Android operating system (android operation system,
Android OS)(以下简称为安卓系统),该系统中,在应用(也可以称为应用程序)启动、应用退出、手势导航等场景,会有各种界面刷新忽快忽慢的情况,这种情况可能会导致丢帧卡顿的现象,降低用户体验。尤其是高帧率场景,丢帧卡顿的现象更加严重。Android OS) (hereinafter referred to as the Android system), in this system, in the application (also known as application) startup, application exit, gesture navigation and other scenarios, there will be various situations where the interface refreshes quickly or slowly. This situation may lead to frame loss and freeze, reducing user experience. Especially in high frame rate scenes, the phenomenon of frame loss and freeze is more serious.
发明内容SUMMARY OF THE INVENTION
本申请实施例提供了一种计算资源调度方法及装置,用于解决应用在启动、退出、手势导航等场景出现的丢帧卡顿的问题。Embodiments of the present application provide a computing resource scheduling method and apparatus, which are used to solve the problem of frame loss and freeze in scenarios such as application startup, exit, and gesture navigation.
为达到上述目的,本申请实施例提供如下技术方案:To achieve the above purpose, the embodiments of the present application provide the following technical solutions:
第一方面,提供了一种计算资源调度方法,包括:终端创建包括图形合成相关线程的线程组,根据目标图像质量调整线程组对应的CPU的处理资源和/或GPU频率。第一方面提供的方法,可减少应用在启动、退出、手势导航等场景出现丢帧卡顿现象的产生,根据用户需求提供相应的图形合成资源,降低终端的功耗,提升用户体验感。In a first aspect, a computing resource scheduling method is provided, including: a terminal creates a thread group including threads related to graphics synthesis, and adjusts the CPU processing resources and/or GPU frequency corresponding to the thread group according to target image quality. The method provided in the first aspect can reduce the occurrence of frame dropping and stuck phenomenon in applications such as startup, exit, gesture navigation, etc., and provide corresponding graphics synthesis resources according to user needs, reduce the power consumption of the terminal, and improve the user experience.
在一种可能的实现方式中,终端根据目标图像质量调整线程组对应的CPU的处理资源和/或调整GPU频率,包括:终端根据图像的目标帧率调整线程组对应的CPU的处理资源;和/或,终端根据图像的单帧图像GPU合成时长调整GPU频率。该种可能的实现方式,根据目标帧率调整CPU的处理资源和/或根据单帧图像GPU合成时长调整GPU频率,可以及时调度图像合成资源,保证图像显示的及时性。In a possible implementation, the terminal adjusts the processing resources of the CPU corresponding to the thread group and/or adjusts the GPU frequency according to the target image quality, including: the terminal adjusts the processing resources of the CPU corresponding to the thread group according to the target frame rate of the image; and or, the terminal adjusts the GPU frequency according to the GPU synthesis duration of the single-frame image of the image. In this possible implementation, the processing resources of the CPU are adjusted according to the target frame rate and/or the frequency of the GPU is adjusted according to the GPU synthesis duration of a single frame image, so that the image synthesis resources can be scheduled in time to ensure the timeliness of image display.
在一种可能的实现方式中,终端根据图像的目标帧率调整线程组对应的CPU的处理资源,包括:终端确定目标帧率所处的帧率范围为第一帧率范围;终端根据第一帧率范围对应的门限值调整线程组对应的CPU的处理资源,门限值大于0且小于1。该种可能的实现方式,根据目标帧率所处的第一帧率范围直接确定需要调整的CPU的处理资源,对于帧率范围的划分,能够通过判断目标帧率所处帧率范围确定CPU的处理资源的门限值,从而解决现有技术中无法根据用户对于帧率的实时需求进行资源配置的问题。In a possible implementation manner, the terminal adjusts the processing resources of the CPU corresponding to the thread group according to the target frame rate of the image, including: the terminal determines that the frame rate range in which the target frame rate is located is the first frame rate range; The threshold value corresponding to the frame rate range adjusts the processing resources of the CPU corresponding to the thread group, and the threshold value is greater than 0 and less than 1. In this possible implementation, the processing resources of the CPU to be adjusted are directly determined according to the first frame rate range in which the target frame rate is located. For the division of the frame rate range, the CPU can be determined by judging the frame rate range in which the target frame rate is located. The threshold value of the resource is processed, thereby solving the problem in the prior art that the resource cannot be configured according to the real-time requirement of the user for the frame rate.
在一种可能的实现方式中,终端根据第一帧率范围对应的门限值调整线程组对应的CPU的处理资源,包括:终端确定CPU的处理资源的调整值,调整值为第一帧率范围对应的门限值与CPU的剩余资源的乘积;终端根据调整值为线程组增加CPU的处理资源。该种可能的实现方式,提供了根据第一帧率范围对应的门限值计算线程组对应的CPU的处理资源的调整量的具体计算方式,终端根据此公式从而计算得到目标 帧率对应的CPU的处理资源,实现相应的调整。In a possible implementation manner, the terminal adjusts the processing resources of the CPU corresponding to the thread group according to the threshold value corresponding to the first frame rate range, including: the terminal determines the adjustment value of the processing resources of the CPU, and the adjustment value is the first frame rate The product of the threshold value corresponding to the range and the remaining resources of the CPU; the terminal increases the processing resources of the CPU for the thread group according to the adjustment value. This possible implementation provides a specific calculation method for calculating the adjustment amount of the processing resources of the CPU corresponding to the thread group according to the threshold value corresponding to the first frame rate range, and the terminal calculates the CPU corresponding to the target frame rate according to this formula. The processing resources are adjusted accordingly.
在一种可能的实现方式中,终端根据图像的单帧图像GPU合成时长调整GPU频率,包括:终端确定目标帧率所处的帧率范围为第二帧率范围以及第二帧率范围对应的GPU频率;当确定在第二帧率范围对应的GPU频率下,单帧图像GPU合成时长大于或等于第一阈值时,调整GPU频率至第二帧率范围的最大值对应的GPU频率,该第一阈值为第二帧率范围的最大值对应的单帧图像GPU合成时长,该第二帧率范围的最大值对应的GPU频率大于第二帧率范围对应的GPU频率。该种可能的实现方式,根据目标帧率所处的第二帧率范围确定其对应的GPU频率,GPU在该频率下进行图像合成,并同时检测单帧图像GPU合成时长,通过判断其与第一阈值的关系确定对应GPU频率的调整方式,从而在判断单帧图像GPU合成时长无法满足用户需求时,能够及时调整GPU频率,减少丢帧卡顿的现象产生。In a possible implementation manner, the terminal adjusts the GPU frequency according to the GPU synthesis duration of the single-frame image of the image, including: the terminal determines that the frame rate range in which the target frame rate is located is the second frame rate range and the range corresponding to the second frame rate range. GPU frequency; when it is determined that under the GPU frequency corresponding to the second frame rate range, the GPU synthesis duration of a single frame image is greater than or equal to the first threshold, adjust the GPU frequency to the GPU frequency corresponding to the maximum value of the second frame rate range. A threshold is the GPU synthesis duration of the single-frame image corresponding to the maximum value of the second frame rate range, and the GPU frequency corresponding to the maximum value of the second frame rate range is greater than the GPU frequency corresponding to the second frame rate range. In this possible implementation, the corresponding GPU frequency is determined according to the second frame rate range in which the target frame rate is located. The GPU performs image synthesis at this frequency, and simultaneously detects the GPU synthesis duration of a single frame image. The relationship of a threshold determines the adjustment method of the corresponding GPU frequency, so that when it is judged that the GPU synthesis time of a single frame image cannot meet the user's needs, the GPU frequency can be adjusted in time to reduce the phenomenon of frame loss and freeze.
在一种可能的实现方式中,该方法还包括:终端实时监控帧率的变化;和/或,终端实时监控单帧图像GPU合成时长。该种可能的实现方式,终端通过实时监控帧率的变化和/或单帧图像GPU合成时长,进行CPU的处理资源和/或GPU频率的调整,从而实现根据用户需求实时调整图形合成资源,提升用户体验。In a possible implementation manner, the method further includes: the terminal monitors the change of the frame rate in real time; and/or the terminal monitors the GPU synthesis duration of the single frame image in real time. In this possible implementation, the terminal adjusts the processing resources of the CPU and/or the frequency of the GPU by monitoring the change of the frame rate and/or the GPU synthesis time of a single frame image in real time, so as to realize the real-time adjustment of the graphics synthesis resources according to the needs of the user, and improve the user experience.
在一种可能的实现方式中,图形合成相关线程包括SF进程、内存分配进程、送显进程、工作进程中的一个或多个进程中的线程。In a possible implementation manner, the graphics synthesis related threads include threads in one or more of the SF process, the memory allocation process, the display sending process, and the working process.
在一种可能的实现方式中,该方法还包括:终端提高图形合成相关线程的调度优先级。该种可能的实现方式,通过提高图形合成相关线程的调度优先级,能够实现提高图形合成相关线程所在线程组的优先级,从而使得图形合成相关线程能够及时运行,满足用户图像质量需求。In a possible implementation manner, the method further includes: the terminal increases the scheduling priority of threads related to graphics synthesis. In this possible implementation, by increasing the scheduling priority of the graphics synthesis related threads, the priority of the thread group where the graphics synthesis related threads are located can be improved, so that the graphics synthesis related threads can run in time to meet the user's image quality requirements.
第二方面,提供了一种终端装置,包括:用于执行第一方面提供的任意一种方法的功能单元,各个功能单元所执行的动作通过硬件实现或通过硬件执行相应的软件实现。例如,终端装置可以包括:创建单元和调整单元;创建单元,用于创建线程组,线程组包括图形合成相关线程;调整单元,用于根据目标图像质量调整线程组对应的CPU的处理资源和/或调整GPU频率。示例性的,该终端装置可以以芯片的产品形态存在。In a second aspect, a terminal device is provided, including: functional units for executing any one of the methods provided in the first aspect, and actions performed by each functional unit are implemented by hardware or by executing corresponding software by hardware. For example, the terminal device may include: a creation unit and an adjustment unit; a creation unit for creating a thread group, where the thread group includes threads related to graphics synthesis; an adjustment unit for adjusting the processing resources of the CPU corresponding to the thread group and/or according to the target image quality Or adjust the GPU frequency. Exemplarily, the terminal device may exist in the form of a chip product.
第三方面,提供了一种终端装置,包括:处理器。处理器与存储器连接,存储器用于存储计算机执行指令,处理器执行存储器存储的计算机执行指令,从而实现第一方面提供的任意一种方法。其中,存储器和处理器可以集成在一起,也可以为独立的器件。若为后者,存储器可以位于通信装置内,也可以位于通信装置外。In a third aspect, a terminal device is provided, including: a processor. The processor is connected to the memory, the memory is used for storing computer-executed instructions, and the processor executes the computer-executed instructions stored in the memory, thereby implementing any one of the methods provided in the first aspect. Among them, the memory and the processor can be integrated together or can be independent devices. In the latter case, the memory may be located in the communication device or outside the communication device.
第四方面,提供了一种终端装置,该终端装置包括:处理器和接口电路;接口电路,用于接收代码指令并传输至处理器;处理器,用于运行代码指令以执行第一方面提供的任意一种方法。In a fourth aspect, a terminal device is provided, the terminal device includes: a processor and an interface circuit; the interface circuit is used to receive code instructions and transmit them to the processor; the processor is used to run the code instructions to execute the code instructions provided in the first aspect any of the methods.
第五方面,提供了一种计算机可读存储介质,包括计算机执行指令,当计算机执行指令在计算机上运行时,使得计算机执行第一方面提供的任意一种方法。In a fifth aspect, a computer-readable storage medium is provided, including computer-executable instructions, which, when the computer-executable instructions are run on a computer, cause the computer to perform any one of the methods provided in the first aspect.
第六方面,提供了一种计算机程序产品,包括计算机执行指令,当计算机执行指令在计算机上运行时,使得计算机执行第一方面提供的任意一种方法。In a sixth aspect, a computer program product is provided, including computer-executable instructions, which, when the computer-executable instructions are run on the computer, cause the computer to perform any one of the methods provided in the first aspect.
第二方面至第六方面中的任一种实现方式所带来的技术效果可参见第一方面中对 应实现方式所带来的技术效果,此处不再赘述。For the technical effect brought by any one of the implementations in the second aspect to the sixth aspect, reference may be made to the technical effects brought by the corresponding implementation in the first aspect, and details are not repeated here.
附图说明Description of drawings
图1为本申请实施例提供的一种终端的硬件结构示意图;FIG. 1 is a schematic diagram of a hardware structure of a terminal according to an embodiment of the present application;
图2为本申请实施例提供的一种终端的软件模块组成示意图;FIG. 2 is a schematic diagram of the composition of software modules of a terminal according to an embodiment of the present application;
图3为本申请实施例提供的一种软硬件结合的组成示意图;3 is a schematic diagram of the composition of a combination of software and hardware provided by an embodiment of the present application;
图4为本申请实施例提供的一种单帧图像GPU合成时长检测方法示意图;4 is a schematic diagram of a method for detecting the duration of a single-frame image GPU synthesis provided by an embodiment of the present application;
图5为本申请实施例提供的一种计算资源调度方法的流程图;FIG. 5 is a flowchart of a computing resource scheduling method provided by an embodiment of the present application;
图6为本申请实施例提供的一种创建线程组的方法流程图;6 is a flowchart of a method for creating a thread group provided by an embodiment of the present application;
图7为本申请实施例提供的一种调整GPU频率的示意图;7 is a schematic diagram of adjusting a GPU frequency according to an embodiment of the present application;
图8为本申请实施例提供的一种计算资源调度方法的流程图;FIG. 8 is a flowchart of a computing resource scheduling method provided by an embodiment of the present application;
图9为本申请实施例提供的一种策略配置与执行模块执行策略的流程图;FIG. 9 is a flowchart of a strategy configuration and execution module execution strategy provided by an embodiment of the present application;
图10为本申请实施例提供的一种终端装置的组成示意图;FIG. 10 is a schematic diagram of the composition of a terminal device according to an embodiment of the present application;
图11为本申请实施例提供的一种终端装置的硬件结构示意图。FIG. 11 is a schematic diagram of a hardware structure of a terminal device according to an embodiment of the present application.
具体实施方式Detailed ways
在本申请的描述中,除非另有说明,“/”表示“或”的意思,例如,A/B可以表示A或B。本文中的“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。此外,“至少一个”是指一个或多个,“多个”是指两个或两个以上。“第一”、“第二”等字样并不对数量和执行次序进行限定,并且“第一”、“第二”等字样也并不限定一定不同。In the description of this application, unless otherwise stated, "/" means "or", for example, A/B can mean A or B. In this article, "and/or" is only an association relationship to describe the associated objects, which means that there can be three kinds of relationships, for example, A and/or B, which can mean that A exists alone, A and B exist at the same time, and B exists alone these three situations. Further, "at least one" means one or more, and "plurality" means two or more. The words "first" and "second" do not limit the quantity and execution order, and the words "first", "second" and the like do not limit certain differences.
需要说明的是,本申请中,“示例性的”或者“例如”等词用于表示作例子、例证或说明。本申请中被描述为“示例性的”或者“例如”的任何实施例或设计方案不应被解释为比其他实施例或设计方案更优选或更具优势。确切而言,使用“示例性的”或者“例如”等词旨在以具体方式呈现相关概念。It should be noted that, in this application, words such as "exemplary" or "for example" are used to represent examples, illustrations or illustrations. Any embodiment or design described in this application as "exemplary" or "such as" should not be construed as preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "such as" is intended to present the related concepts in a specific manner.
本申请实施例提供了一种计算资源调度方法,可应用于终端,终端用于向用户提供语音服务和数据连通性服务中的一种或多种。终端还可以称为用户设备(user equipment,UE)、终端设备、接入终端、用户单元、用户站、移动站、远方站、远程终端、移动设备、用户终端、无线通信设备、用户代理或用户装置。终端可以是手机、增强现实(augmented reality,AR)设备、虚拟现实(virtual reality,VR)设备、平板电脑、笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本、个人数字助理(personal digital assistant,PDA)等,以下实施例中对终端的具体形式不作任何限制。The embodiment of the present application provides a computing resource scheduling method, which can be applied to a terminal, where the terminal is used to provide one or more of a voice service and a data connectivity service to a user. A terminal may also be referred to as user equipment (UE), terminal equipment, access terminal, subscriber unit, subscriber station, mobile station, remote station, remote terminal, mobile device, user terminal, wireless communication device, user agent, or user device. The terminal can be a mobile phone, an augmented reality (AR) device, a virtual reality (VR) device, a tablet computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (personal digital assistant, PDA) etc., the specific form of the terminal is not limited in the following embodiments.
本申请实施例中的终端的操作系统可以为安卓系统、互联网操作系统(internetworking operating system,iOS)系统、Linux,也可以为其他操作系统。The operating system of the terminal in the embodiments of the present application may be an Android system, an Internet operating system (iOS) system, Linux, or other operating systems.
本申请实施例中的终端的一种示例性的硬件结构可参见图1,包括:CPU、显示屏、GPU和存储器,终端还可以包括其他器件,例如,射频(RF)电路、蓝牙装置、一个或多个传感器、触控板、定位装置、音频电路、外设接口以及电源系统等部件,这些部件可通过一根或多根通信总线或信号线(图1中未示出)进行通信。本领域技术人员可以理解,图1中示出的硬件结构并不构成对终端的限定,终端可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。An exemplary hardware structure of the terminal in the embodiment of the present application can be seen in FIG. 1, including: a CPU, a display screen, a GPU, and a memory, and the terminal may also include other devices, such as a radio frequency (RF) circuit, a Bluetooth device, a or more components such as sensors, touchpads, pointing devices, audio circuits, peripheral interfaces, and power systems, which can communicate through one or more communication buses or signal lines (not shown in Figure 1). Those skilled in the art can understand that the hardware structure shown in FIG. 1 does not constitute a limitation on the terminal, and the terminal may include more or less components than the one shown, or combine some components, or arrange different components.
其中,CPU是终端的控制中心,利用各种接口和线路连接终端的各个部分。显示屏用于显示由用户输入的信息或提供给用户的信息以及终端的各种菜单。GPU是一种专门在终端上进行图像运算工作的微处理器。它可将终端所需要显示的信息进行转换驱动,并向显示屏提供行扫描信号,控制显示屏的正确显示。存储器用于存储应用以及数据,CPU、GPU通过运行存储在存储器中的应用以及数据,执行终端的各种功能。在本申请实施例中,当终端接收到应用启动、应用退出、手势导航等输入事件后,CPU可以对对输入事件进行处理,最终通过GPU将所需要显示的信息显示在显示屏上。Among them, the CPU is the control center of the terminal, and uses various interfaces and lines to connect various parts of the terminal. The display screen is used to display information input by the user or information provided to the user and various menus of the terminal. GPU is a kind of microprocessor specialized in image computing work on the terminal. It can convert and drive the information that the terminal needs to display, and provide a line scan signal to the display screen to control the correct display of the display screen. The memory is used to store applications and data, and the CPU and GPU execute various functions of the terminal by running the applications and data stored in the memory. In the embodiment of the present application, after the terminal receives input events such as application startup, application exit, gesture navigation, etc., the CPU can process the input events, and finally display the information to be displayed on the display screen through the GPU.
本申请实施例中的终端的另一种示例性的软件模块组成示意图可参见图2,包括:资源管理服务(resource management service,RMS)实时处理模块和策略配置与执行模块。其中,RMS实时处理模块用于获取系统实时帧率,根据实时帧率向策略配置与执行模块发送相应的策略。策略配置与执行模块用于接收RMS实时处理模块发送的策略,并通过策略配置与执行模块中处理该策略的模块生效。示例性的,终端接收到应用启动、应用退出、手势导航等输入事件,通过RMS实时处理模块获取系统实时帧率,根据实时帧率生成相应策略并发送策略至策略配置与执行模块,策略配置与执行模块生效该策略,最终通过显示屏完成向用户的输出与显示。其中,终端的输入事件可以是用户对终端的操作(例如,用户与终端的应用交互的动作)触发的。Referring to FIG. 2, a schematic diagram of another exemplary software module composition of the terminal in the embodiment of the present application includes: a resource management service (resource management service, RMS) real-time processing module and a policy configuration and execution module. Among them, the RMS real-time processing module is used to obtain the real-time frame rate of the system, and send the corresponding policy to the policy configuration and execution module according to the real-time frame rate. The policy configuration and execution module is used for receiving the policy sent by the RMS real-time processing module, and takes effect through the module processing the policy in the policy configuration and execution module. Exemplarily, the terminal receives input events such as application startup, application exit, and gesture navigation, obtains the system real-time frame rate through the RMS real-time processing module, generates a corresponding policy according to the real-time frame rate, and sends the policy to the policy configuration and execution module. The execution module takes effect of the strategy, and finally completes the output and display to the user through the display screen. The input event of the terminal may be triggered by a user's operation on the terminal (for example, an action of the user interacting with an application of the terminal).
本申请实施例中的终端的另一种示例性的软硬件结合的组成示意图可以参见图3,包括帧率模块、RMS实时处理模块、策略配置与执行模块、内核、CPU以及GPU,内核中又包括效能感知调度(energy aware scheduling,EAS)调度器和GPU驱动,各个模块的连接关系可参见图3。其中,帧率模块用于感知帧率变化并通知给其他模块(例如,RMS实时处理模块)。内核是操作系统最基本的部分,它是为众多应用提供安全访问计算机硬件的一部分软件,如图3,内核中可以包括EAS调度器、GPU驱动等与CPU、GPU硬件进行通信的程序。EAS调度器用于新建线程组(也可以称为调度组)。内核中的其他模块可以基于进程粒度向线程组中添加线程,也就是说,一般是将一个或多个进程加入到线程组,此时,该一个或多个进程中的全部线程组成一个线程组。Referring to FIG. 3 , a schematic diagram of another exemplary combination of software and hardware of the terminal in the embodiment of the present application includes a frame rate module, an RMS real-time processing module, a policy configuration and execution module, a kernel, a CPU, and a GPU. It includes an energy aware scheduling (EAS) scheduler and a GPU driver. The connection relationship of each module can be seen in Figure 3. Among them, the frame rate module is used to perceive the frame rate change and notify other modules (for example, the RMS real-time processing module). The kernel is the most basic part of the operating system. It is a part of software that provides secure access to computer hardware for many applications. As shown in Figure 3, the kernel can include programs such as EAS scheduler and GPU driver that communicate with CPU and GPU hardware. The EAS scheduler is used to create a new thread group (also called a scheduling group). Other modules in the kernel can add threads to the thread group based on the process granularity, that is to say, generally one or more processes are added to the thread group. At this time, all the threads in the one or more processes form a thread group .
为了使得本申请实施例更加的清楚,以下对与本申请实施例相关的概念和部分内容作简单介绍。In order to make the embodiments of the present application more clear, the following briefly introduces concepts and some contents related to the embodiments of the present application.
1、图形合成相关线程1. Graphic synthesis related threads
图形合成相关线程也可以称为图形合成引擎,是指参与界面合成(surface flinger,SF)的线程,以及被这些线程所依赖的其他线程。其中,可以包括SF进程、内存分配(allocator buffer thread for SF using,ALLOCATOR)进程、送显进程(具有利用硬件完成图像数据组合并显示的功能)、工作(kworker)进程等及其子线程。Threads related to graphics synthesis can also be called graphics synthesis engines, which refer to threads that participate in interface synthesis (surface flinger, SF) and other threads that are depended on by these threads. Among them, it can include SF process, memory allocation (allocator buffer thread for SF using, ALLOCATOR) process, sending display process (with the function of using hardware to complete image data combination and display), work (kworker) process, etc. and its sub-threads.
其中,上述相关线程之间互相具有直接或间接的依赖关系,例如,SF进程依赖于送显进程,送显进程依赖于kworker进程,则SF进程和送显进程之间,以及送显进程和kworker进程之间可以称为直接依赖,SF进程和kworker进程之间可以称为间接依赖。Among them, the above-mentioned related threads have direct or indirect dependencies on each other. For example, the SF process depends on the display process, and the display process depends on the kworker process. Then the SF process and the display process, and the display process and kworker. Processes can be called direct dependencies, and SF processes and kworker processes can be called indirect dependencies.
2、帧率(Frame per-second,FPS)2. Frame rate (Frame per-second, FPS)
帧率是指单位时间内显示的图像帧的个数,其中,单位时间可以为1秒(s)或其 他时间单位。The frame rate refers to the number of image frames displayed in a unit time, where the unit time can be 1 second (s) or other time units.
3、单帧图像合成时长3. Duration of single-frame image synthesis
单帧图像合成时长是指处理一帧图像的时长,单帧图像合成时长包括单帧图像GPU合成时长以及其他处理器合成的时长。The duration of single-frame image synthesis refers to the duration of processing one frame of image, and the duration of single-frame image synthesis includes the duration of GPU synthesis of single-frame images and the duration of synthesis by other processors.
以安卓系统为例,系统帧率可以为60赫兹(Hz)、90Hz或者120Hz,分别对应的单帧图像合成时长为16.66毫秒(ms)、11ms或者8ms,而单帧图像GPU合成时长可以根据单帧图像GPU合成时长与单帧图像合成时长的比值和单帧图像合成时长计算得到。具体的,当系统帧率为60Hz时,单帧图像GPU合成时长为单帧图像合成时长的1/2,当系统帧率为90Hz时,单帧图像GPU合成时长为单帧图像合成时长的1/3,当系统帧率为120Hz时,单帧图像GPU合成时长为单帧图像合成时长的1/4。具体地,终端可以在GPU合成过程中的SF进程中进行插桩,从而监测单帧图像GPU合成时长。参见图4,终端可以在每帧图像的GPU合成开始时以及GPU合成结束时分别进行插桩,根据两次插桩的时间点计算单帧图像GPU合成时长。Taking the Android system as an example, the system frame rate can be 60 Hz, 90 Hz or 120 Hz, and the corresponding single-frame image synthesis time is 16.66 milliseconds (ms), 11 ms or 8 ms, and the single-frame image GPU synthesis duration can be The ratio of the frame image GPU synthesis duration to the single frame image synthesis duration and the single frame image synthesis duration are calculated. Specifically, when the system frame rate is 60 Hz, the GPU synthesis time of a single-frame image is 1/2 of the single-frame image synthesis time; when the system frame rate is 90 Hz, the single-frame image GPU synthesis time is 1/2 of the single-frame image synthesis time. /3, when the system frame rate is 120Hz, the GPU synthesis time of a single frame image is 1/4 of the single frame image synthesis time. Specifically, the terminal can perform instrumentation in the SF process in the GPU synthesis process, so as to monitor the GPU synthesis duration of a single frame image. Referring to FIG. 4 , the terminal may perform instrumentation respectively at the start of GPU synthesis of each frame of image and at the end of GPU synthesis, and calculate the GPU synthesis duration of a single frame of image according to the time points of the two insertions.
以上为对本申请涉及到的部分概念所作的简单介绍。The above is a brief introduction to some concepts involved in this application.
针对目前的现有技术,终端存在以下问题:For the current prior art, the terminal has the following problems:
问题1、没有独立针对与用户体验紧密相关的图形合成相关线程的分组调度,容易引起图形合成相关线程间的依赖式阻塞。Problem 1. There is no independent group scheduling for graphics synthesis-related threads closely related to user experience, which is likely to cause dependency blocking among graphics synthesis-related threads.
其中,若存在依赖关系的线程被划分到不同的线程组中,由于不同线程组的调度策略不同,因此可能出现以下情况:存在于某个线程组的某个图形合成线程已完成处理,但处于另一个线程组的与该图形合成线程相关的线程仍然处于等待处理状态,这会导致图形合成无法完成,这种现象称为线程间的依赖式阻塞。Among them, if threads with dependencies are divided into different thread groups, due to the different scheduling policies of different thread groups, the following situations may occur: a graphics synthesis thread existing in a thread group has completed processing, but is in Threads of another thread group related to the graphics compositing thread are still in a waiting state, which will cause the graphics compositing to fail to complete. This phenomenon is called inter-thread dependency blocking.
问题2、目前线程组对应的资源无法根据实时帧率进行变更,会导致在帧率突变的情况下无法及时应对,从而出现丢帧卡顿的现象。Question 2. Currently, the resources corresponding to the thread group cannot be changed according to the real-time frame rate, which will lead to the inability to respond in time when the frame rate suddenly changes, resulting in the phenomenon of frame loss and freeze.
问题3、若终端中GPU频率太低,会导致单帧图像GPU合成时长过长,从而会引起SF阻塞(即SF进程超时),导致丢帧卡顿的现象产生。Question 3. If the GPU frequency in the terminal is too low, the GPU synthesis time of a single frame image will be too long, which will cause SF blocking (ie, the SF process times out), resulting in the phenomenon of frame dropping and freezing.
为了解决上述问题,本申请提供了一种计算资源调度方法,该方法中,终端通过目标图像质量调整CPU、GPU等资源,以保障应用运行时的流畅性、及时性。如图5所示,该方法包括:In order to solve the above problem, the present application provides a computing resource scheduling method. In the method, the terminal adjusts resources such as CPU and GPU according to the target image quality, so as to ensure the smoothness and timeliness of the application running. As shown in Figure 5, the method includes:
501、终端创建线程组,线程组包括图形合成相关线程。501. The terminal creates a thread group, where the thread group includes threads related to graphics synthesis.
关于图形合成相关线程的描述参见上文。其中,本申请中的线程组中,包括图形合成相关线程。因此,可以避免图形合成相关线程间的依赖式阻塞。该线程组可以仅包括图形合成相关线程,此时,可以避免由于同一组中还包括其他不相关线程而导致的图形合成的线程无法及时完成的问题,显著提升图形合成的效率。See above for a description of graphics compositing related threads. Among them, the thread group in this application includes graphics synthesis related threads. Therefore, dependency blocking among threads related to graph synthesis can be avoided. The thread group may only include graphics synthesis related threads. In this case, the problem that graphics synthesis threads cannot be completed in time due to other unrelated threads included in the same group can be avoided, and the graphics synthesis efficiency can be significantly improved.
步骤501在具体实现时,可以通过如图6所示的步骤601-步骤603实现。When step 501 is specifically implemented, it can be implemented through steps 601 to 603 as shown in FIG. 6 .
601、终端初始化(即终端开机启动)。601. The terminal is initialized (that is, the terminal is powered on and started).
602、EAS调度器新建线程组。602. The EAS scheduler creates a new thread group.
603、RMS实时处理模块将图形合成相关线程加入到线程组中,其中,图形合成相关线程可以包括SF进程、ALLOCATOR进程、送显进程、Kworker进程等。603. The RMS real-time processing module adds graphics synthesis-related threads to the thread group, where the graphics synthesis-related threads may include SF process, ALLOCATOR process, display sending process, Kworker process, and the like.
502、终端根据目标图像质量调整线程组对应的CPU的处理资源和/或调整GPU 频率。502. The terminal adjusts the processing resources of the CPU corresponding to the thread group and/or adjusts the frequency of the GPU according to the target image quality.
需要说明的是,由于GPU是专门在终端上进行图像运算工作的微处理器,因此,调整GPU频率必然针对的是图形合成相关线程,因此,本申请中直接描述为调整GPU频率。It should be noted that since the GPU is a microprocessor specialized in image computing on the terminal, adjusting the GPU frequency must be aimed at graphics synthesis related threads. Therefore, this application is directly described as adjusting the GPU frequency.
其中,目标图像质量是指终端即将显示的或者待显示的图像的图像质量,目标图像质量需要满足目标帧率的要求,目标帧率是指由于用户的触发所导致的即将显示的或者待显示的图像的帧率。例如,当用户触发应用启动、应用退出、手势导航时,终端将要显示的图像的帧率即目标帧率。目标帧率可以比当前显示的图像的帧率大,也可以比当前显示的图像的帧率小,还可以与当前显示的图像的帧率相同,本申请不作限制。The target image quality refers to the image quality of the image to be displayed or to be displayed on the terminal, the target image quality needs to meet the requirements of the target frame rate, and the target frame rate refers to the image to be displayed or to be displayed due to the user's trigger The frame rate of the image. For example, when the user triggers application startup, application exit, and gesture navigation, the frame rate of the image to be displayed by the terminal is the target frame rate. The target frame rate may be higher than the frame rate of the currently displayed image, may also be lower than the frame rate of the currently displayed image, or may be the same as the frame rate of the currently displayed image, which is not limited in this application.
其中,终端可以实时监控帧率的变化。具体的,RMS实时处理模块可以在终端初始化阶段向帧率模块进行回调注册,回调注册用于指示帧率模块在帧率变更时通知RMS实时处理模块,RMS实时处理模块即可获取最新的帧率。Among them, the terminal can monitor the change of the frame rate in real time. Specifically, the RMS real-time processing module can perform callback registration with the frame rate module during the terminal initialization phase, and the callback registration is used to instruct the frame rate module to notify the RMS real-time processing module when the frame rate changes, and the RMS real-time processing module can obtain the latest frame rate. .
目标帧率可以为以当前时间为基准,RMS实时处理模块最新获取的帧率。例如,若当前终端还未开机,则目标帧率可以为终端在初始化之后(即回调注册完毕后),RMS实时处理模块第一次从帧率模块获取到的帧率(即初始帧率),终端开机之后,目标帧率可以为后续过程中RMS实时处理模块从帧率模块最新获取到的帧率。The target frame rate can be the latest frame rate obtained by the RMS real-time processing module based on the current time. For example, if the current terminal has not been powered on, the target frame rate can be the frame rate (that is, the initial frame rate) obtained by the RMS real-time processing module from the frame rate module for the first time after the terminal is initialized (that is, after the callback is registered). After the terminal is powered on, the target frame rate may be the frame rate newly obtained by the RMS real-time processing module from the frame rate module in the subsequent process.
步骤502在具体实现时,终端可以基于图像的目标帧率调整线程组对应的CPU的处理资源和/或调整GPU频率。When step 502 is specifically implemented, the terminal may adjust the processing resources of the CPU corresponding to the thread group and/or adjust the GPU frequency based on the target frame rate of the image.
上述步骤502在具体实现时可以包括以下动作1和/或动作2:The above step 502 may include the following action 1 and/or action 2 when specifically implemented:
动作1、终端根据图像的目标帧率调整线程组对应的CPU的处理资源。Action 1. The terminal adjusts the processing resources of the CPU corresponding to the thread group according to the target frame rate of the image.
动作2、终端根据图像的单帧图像GPU合成时长调整GPU频率。Action 2. The terminal adjusts the GPU frequency according to the GPU synthesis duration of the single-frame image of the image.
动作1在具体实现时可以包括:终端确定目标帧率所处的帧率范围为第一帧率范围;终端根据第一帧率范围对应的门限值(Threshold)调整线程组对应的CPU的处理资源,门限值大于0且小于1。When specifically implemented, action 1 may include: the terminal determines that the frame rate range in which the target frame rate is located is the first frame rate range; the terminal adjusts the processing of the CPU corresponding to the thread group according to the threshold value (Threshold) corresponding to the first frame rate range Resource, the threshold value is greater than 0 and less than 1.
其中,可以预先配置至少一个帧率范围(假设为N个帧率范围)与门限值之间的对应关系(记为第一对应关系),第一对应关系中包括第一帧率范围对应的门限值。每个帧率范围对应的门限值均大于0且小于1。第一对应关系中的门限值也可以称为负载门限值。N为大于0的整数。N个帧率范围中的任意两个帧率范围之间不重叠,随着帧率范围的增加,门限值对应增大。第一对应关系在预设好之后可以一直不变也可以周期性或按照一定的时间规律改变。其中,N个帧率范围可以根据终端的操作系统的版本、终端的能力等预先设置,具备方法本申请不作限制。The correspondence between at least one frame rate range (it is assumed to be N frame rate ranges) and the threshold value (referred to as the first correspondence) can be pre-configured, and the first correspondence includes the Threshold value. The threshold value corresponding to each frame rate range is greater than 0 and less than 1. The threshold value in the first corresponding relationship may also be referred to as a load threshold value. N is an integer greater than 0. Any two frame rate ranges in the N frame rate ranges do not overlap, and as the frame rate range increases, the threshold value increases correspondingly. After being preset, the first corresponding relationship may remain unchanged or may be changed periodically or according to a certain time rule. Wherein, the N frame rate ranges may be preset according to the version of the operating system of the terminal, the capability of the terminal, and the like, and the method for possessing them is not limited in this application.
示例性的,表1示出了一种可能的第一对应关系。Exemplarily, Table 1 shows a possible first correspondence.
表1Table 1
帧率范围Frame rate range [0,60)Hz[0,60)Hz [60,90)Hz[60,90)Hz [90,120)Hz[90, 120) Hz [120,Y]Hz[120, Y] Hz
门限值(%)Threshold value (%) 1010 2020 3030 4040
基于表1所示的示例,若目标帧率小于60Hz,此时,第一帧率范围为[0,60)Hz,则采用[0,60)Hz对应的门限值10调整线程组对应的CPU的处理资源;若目标帧率大于或等于60Hz,小于90Hz,此时,第一帧率范围为[60,90)Hz,则采用[60,90) Hz对应的门限值20调整线程组对应的CPU的处理资源;若目标帧率大于或等于90Hz,小于120Hz,此时,第一帧率范围为[90,120)Hz,则采用[90,120)Hz对应的门限值30调整线程组对应的CPU的处理资源;若目标帧率大于或等于120Hz,小于或等于Y,此时,第一帧率范围为[120,Y]Hz,则采用[120,Y]Hz对应的门限值40调整线程组对应的CPU的处理资源。其中,本申请中的Y为终端所能支持的最大的帧率,也即终端所能显示的图像的最大的帧率。Based on the example shown in Table 1, if the target frame rate is less than 60 Hz, at this time, the first frame rate range is [0, 60) Hz, then the threshold value 10 corresponding to [0, 60) Hz is used to adjust the corresponding thread group CPU processing resources; if the target frame rate is greater than or equal to 60Hz and less than 90Hz, at this time, the first frame rate range is [60, 90) Hz, then the threshold value 20 corresponding to [60, 90) Hz is used to adjust the thread group The processing resources of the corresponding CPU; if the target frame rate is greater than or equal to 90Hz and less than 120Hz, at this time, the first frame rate range is [90, 120) Hz, then the threshold value 30 corresponding to [90, 120) Hz is used to adjust The processing resources of the CPU corresponding to the thread group; if the target frame rate is greater than or equal to 120Hz and less than or equal to Y, at this time, the first frame rate range is [120, Y] Hz, and the gate corresponding to [120, Y] Hz is used The limit value of 40 adjusts the processing resources of the CPU corresponding to the thread group. Wherein, Y in this application is the maximum frame rate that the terminal can support, that is, the maximum frame rate of the image that the terminal can display.
在上述动作1中,终端根据第一帧率范围对应的门限值调整线程组对应的CPU的处理资源,包括:终端确定CPU的处理资源的调整值,调整值为第一帧率范围对应的门限值与CPU的剩余资源的乘积;终端根据调整值为线程组增加CPU的处理资源。例如,基于表1所示的示例,假设RMS实时处理模块获取的目标帧率为70Hz,目标帧率处于[60,90)Hz,[60,90)Hz对应的门限值为20,将目前为线程组分配的CPU的处理资源记为a,CPU的总的处理资源记为b,则调整值为(b-a)×20%,将得到的调整值作为已分配资源a的增量,实现对CPU的处理资源的调整。In the above action 1, the terminal adjusts the processing resources of the CPU corresponding to the thread group according to the threshold value corresponding to the first frame rate range, including: the terminal determines the adjustment value of the processing resources of the CPU, and the adjustment value corresponds to the first frame rate range. The product of the threshold value and the remaining resources of the CPU; the terminal increases the processing resources of the CPU for the thread group according to the adjustment value. For example, based on the example shown in Table 1, it is assumed that the target frame rate obtained by the RMS real-time processing module is 70 Hz, the target frame rate is at [60, 90) Hz, and the threshold corresponding to [60, 90) Hz is 20. The processing resource of the CPU allocated to the thread group is denoted as a, and the total processing resource of the CPU is denoted as b, then the adjustment value is (b-a) × 20%, and the obtained adjustment value is taken as the increment of the allocated resource a to realize the The adjustment of the processing resources of the CPU.
需要说明的是,第一对应关系的形式也可以不是帧率范围与门限值的对应关系,而是帧率与门限值的对应关系,此时,第一对应关系中包括N个帧率与门限值之间的对应关系,当目标帧率小于N个帧率中的最小的帧率时,可以按照该最小的帧率对应的门限值调整线程组对应的CPU的处理资源。当目标帧率位于N个帧率中的两个连续的帧率之间时,按照这两个连续的帧率中的较大的帧率对应的门限值调整线程组对应的CPU的处理资源。当目标帧率大于N个帧率中的最大的帧率时,可以按照该最大的帧率对应的门限值调整线程组对应的CPU的处理资源。第一对应关系的一种示例可参见表2。It should be noted that the form of the first correspondence may not be the correspondence between the frame rate range and the threshold, but the correspondence between the frame rate and the threshold. In this case, the first correspondence includes N frame rates. The corresponding relationship with the threshold value, when the target frame rate is less than the minimum frame rate among the N frame rates, the processing resources of the CPU corresponding to the thread group can be adjusted according to the threshold value corresponding to the minimum frame rate. When the target frame rate is between two consecutive frame rates among the N frame rates, the processing resources of the CPU corresponding to the thread group are adjusted according to the threshold value corresponding to the larger frame rate among the two consecutive frame rates . When the target frame rate is greater than the maximum frame rate among the N frame rates, the processing resources of the CPU corresponding to the thread group may be adjusted according to the threshold value corresponding to the maximum frame rate. An example of the first correspondence can be found in Table 2.
表2Table 2
帧率frame rate 60Hz60Hz 90Hz90Hz 120Hz120Hz YY
门限值(%)Threshold value (%) 1010 2020 3030 4040
基于表2所示的示例,若目标帧率小于60Hz,则采用60Hz对应的门限值10调整线程组对应的CPU的处理资源;若目标帧率大于或等于60Hz,小于90Hz,则采用90Hz对应的门限值20调整线程组对应的CPU的处理资源;若目标帧率大于或等于90Hz,小于120Hz,则采用120Hz对应的门限值30调整线程组对应的CPU的处理资源;若目标帧率大于或等于120Hz,则采用Y对应的门限值40调整线程组对应的CPU的处理资源。确定门限值之后调整CPU的处理资源的过程可参见上文,不再赘述。Based on the examples shown in Table 2, if the target frame rate is less than 60Hz, the threshold value 10 corresponding to 60Hz is used to adjust the processing resources of the CPU corresponding to the thread group; The threshold value of 20 adjusts the processing resources of the CPU corresponding to the thread group; if the target frame rate is greater than or equal to 90Hz and less than 120Hz, the threshold value 30 corresponding to 120Hz is used to adjust the processing resources of the CPU corresponding to the thread group; if the target frame rate If it is greater than or equal to 120 Hz, the threshold value 40 corresponding to Y is used to adjust the processing resources of the CPU corresponding to the thread group. The process of adjusting the processing resources of the CPU after the threshold value is determined may be referred to above, and will not be repeated here.
基于图3所示的终端架构,上述动作1在具体实现时可以包括:RMS实时处理模块从帧率模块获取目标帧率,根据目标帧率确定策略ID,该策略ID用于指示第一帧率范围以及第一帧率范围对应的门限值,RMS实时处理模块将该策略ID发送给策略配置与执行模块,策略配置与执行模块解析策略ID得到门限值,并将该门限值发送至内核,内核通过计算得到调整值,将该调整值发送给CPU,CPU根据调整值调整处理资源。Based on the terminal architecture shown in FIG. 3 , the above-mentioned action 1 may include: the RMS real-time processing module obtains the target frame rate from the frame rate module, and determines a policy ID according to the target frame rate, where the policy ID is used to indicate the first frame rate range and the threshold value corresponding to the first frame rate range, the RMS real-time processing module sends the policy ID to the policy configuration and execution module, and the policy configuration and execution module parses the policy ID to obtain the threshold value, and sends the threshold value to The kernel obtains the adjustment value through calculation, sends the adjustment value to the CPU, and the CPU adjusts the processing resources according to the adjustment value.
终端的CPU由多个核组成,CPU的处理资源也可以进一步划分为大、中、小核,而大、中、小核又进一步分成高中低不等的多个时钟频率,一般来说,大核对应的时钟频率较高,小核对应的时钟频率较低。通常完成相同的事务,小核比大核能效比(功 耗和效能的比值)更高,时长也更长;低频比高频能效比更高,时长也更长。为了性能和功耗的平衡,针对用户与应用交互的场景,可以尽量用较短时间来处理应用的事务,而对前台用户不感知的事务,尽量用较低的功耗。因此,本申请中针对用户与应用交互的场景,可以分配足够的CPU的处理资源用于交互后图像的显示以保证图像的流畅。当通过目标帧率确定CPU处理资源的调整值并进行调整后,若调整后的CPU的处理资源达到了CPU的迁核门限,则可以进行迁核,从而保证图像的流畅,提高用户体验。由此可知,通过调整CPU的处理资源,也可以间接调整处理图形合成相关线程的CPU的核,以保证图像合成的及时性。The CPU of the terminal consists of multiple cores, and the processing resources of the CPU can be further divided into large, medium and small cores, and the large, medium and small cores are further divided into multiple clock frequencies ranging from high, medium and low. The clock frequency corresponding to the core is higher, and the clock frequency corresponding to the small core is lower. Usually to complete the same transaction, a small core has a higher energy efficiency ratio (ratio of power consumption and performance) and a longer duration than a large core; low frequency is more energy efficient than high frequency, and the duration is also longer. In order to balance performance and power consumption, for scenarios where the user interacts with the application, it is possible to process application transactions in a short time, while for transactions that are not perceived by foreground users, use lower power consumption as much as possible. Therefore, in the present application, for the scenario where the user interacts with the application, sufficient processing resources of the CPU can be allocated for displaying the image after the interaction to ensure the smoothness of the image. After the adjustment value of CPU processing resources is determined and adjusted based on the target frame rate, if the adjusted CPU processing resources reach the CPU core migration threshold, core migration can be performed to ensure smooth images and improve user experience. It can be seen from this that, by adjusting the processing resources of the CPU, the core of the CPU that processes the threads related to graphics synthesis can also be indirectly adjusted, so as to ensure the timeliness of image synthesis.
动作2在具体实现时可以包括:终端确定目标帧率所处的帧率范围为第二帧率范围;终端确定第二帧率范围对应的GPU频率;当确定第二帧率范围对应的GPU频率下,单帧图像GPU合成时长大于或等于第一阈值时,终端调整GPU频率至第二帧率范围的最大值对应的GPU频率,第一阈值为第二帧率范围的最大值对应的单帧图像GPU合成时长,第二帧率范围的最大值对应的GPU频率大于第二帧率范围对应的GPU频率。下文中将第二帧率范围的最大值对应的GPU频率记为目标GPU频率。When specifically implemented, action 2 may include: the terminal determines that the frame rate range in which the target frame rate is located is the second frame rate range; the terminal determines the GPU frequency corresponding to the second frame rate range; when determining the GPU frequency corresponding to the second frame rate range When the GPU synthesis duration of a single frame image is greater than or equal to the first threshold, the terminal adjusts the GPU frequency to the GPU frequency corresponding to the maximum value of the second frame rate range, and the first threshold is the single frame corresponding to the maximum value of the second frame rate range. Image GPU synthesis duration, the GPU frequency corresponding to the maximum value of the second frame rate range is greater than the GPU frequency corresponding to the second frame rate range. Hereinafter, the GPU frequency corresponding to the maximum value of the second frame rate range is recorded as the target GPU frequency.
需要说明的是,帧率范围与GPU频率的对应关系可以是预设的,该对应关系中可以包括M个帧率范围和GPU频率的对应关系(记为第二对应关系),每个帧率范围的最大值还可以对应一个GPU频率,一个帧率范围的最大值对应的GPU频率大于该帧率范围对应的GPU频率。M为大于1的整数。It should be noted that the correspondence between the frame rate range and the GPU frequency may be preset, and the correspondence may include M correspondences between the frame rate range and the GPU frequency (referred to as the second correspondence), each frame rate The maximum value of the range may also correspond to a GPU frequency, and the GPU frequency corresponding to the maximum value of a frame rate range is greater than the GPU frequency corresponding to the frame rate range. M is an integer greater than 1.
动作2在具体实现时,在终端确定第二帧率范围对应的GPU频率之后,终端可以以第二帧率范围对应的GPU频率运行,当确定第二帧率范围对应的GPU频率下,单帧图像GPU合成时长大于或等于第一阈值时,说明当前的GPU频率无法满足帧率为第二帧率范围的最大值时图像的GPU的合成时长的要求,该情况下,可以将GPU频率调整至目标GPU频率,由于目标GPU频率大于第二帧率范围对应的GPU频率,因此,可以提高图像的合成效率,避免丢帧卡顿。When action 2 is specifically implemented, after the terminal determines the GPU frequency corresponding to the second frame rate range, the terminal can run at the GPU frequency corresponding to the second frame rate range. When the GPU frequency corresponding to the second frame rate range is determined, a single frame When the image GPU synthesis duration is greater than or equal to the first threshold, it means that the current GPU frequency cannot meet the requirement of the image GPU synthesis duration when the frame rate is the maximum value of the second frame rate range. In this case, the GPU frequency can be adjusted to The target GPU frequency. Since the target GPU frequency is greater than the GPU frequency corresponding to the second frame rate range, the synthesis efficiency of images can be improved and frame loss can be avoided.
示例性的,表3示例性的示出了一种第二对应关系,表4示例性的示出了一种第二对应关系中的每个帧率范围的最大值对应的GPU频率。Exemplarily, Table 3 exemplarily shows a second correspondence relationship, and Table 4 exemplarily shows the GPU frequency corresponding to the maximum value of each frame rate range in the second correspondence relationship.
表3table 3
帧率范围Frame rate range [0,60)Hz[0,60)Hz [60,90)Hz[60,90)Hz [90,120)Hz[90, 120) Hz [120,Y]Hz[120, Y] Hz
GPU频率GPU frequency 200MHz200MHz 300MHz300MHz 400MHz400MHz 500MHz500MHz
表4Table 4
帧率frame rate 60Hz60Hz 90Hz90Hz 120Hz120Hz YY
GPU频率GPU frequency 250MHz250MHz 360MHz360MHz 480MHz480MHz 600MHz600MHz
基于表3和表4所示的示例,若RMS实时处理模块获取的目标帧率为50HZ,此时,目标帧率处于[0,60)Hz中,则第二帧率范围为[0,60)Hz,则终端采用[0,60)Hz对应的GPU频率200MHz进行GPU合成,在GPU合成过程中,对单帧图像GPU合成时长进行检测,比较单帧图像GPU合成时长和第一阈值(即60Hz对应的单帧图像GPU合成时长,即16.66/2=8.33ms)的大小,参见图7,若终端在第一帧检测结果为8.13ms,由于8.13ms小于8.33ms,则终端可以不调整GPU频率;若终端在第二帧检测结果为8.66ms,由于8.66ms大于8.33ms,说明当前GPU频率无法满足目标图像 质量的要求,因此,终端在第三帧中的GPU合成之前提高GPU频率,具体提高至60Hz对应的GPU频率(即250MHz)。Based on the examples shown in Tables 3 and 4, if the target frame rate obtained by the RMS real-time processing module is 50 Hz, and the target frame rate is in [0, 60) Hz, the second frame rate range is [0, 60 Hz ) Hz, then the terminal adopts the GPU frequency 200MHz corresponding to [0,60) Hz to perform GPU synthesis. During the GPU synthesis process, the GPU synthesis duration of the single-frame image is detected, and the GPU synthesis duration of the single-frame image is compared with the first threshold (i.e. The GPU synthesis time of a single frame image corresponding to 60Hz, that is, the size of 16.66/2=8.33ms), see Figure 7. If the detection result of the terminal in the first frame is 8.13ms, since 8.13ms is less than 8.33ms, the terminal can not adjust the GPU Frequency; if the detection result of the terminal in the second frame is 8.66ms, since 8.66ms is greater than 8.33ms, it means that the current GPU frequency cannot meet the requirements of the target image quality. Therefore, the terminal increases the GPU frequency before the GPU synthesis in the third frame. Increase to the corresponding GPU frequency of 60Hz (ie 250MHz).
需要说明的是,终端可以实时监控单帧图像GPU合成时长,以便随时调整GPU频率,避免丢帧卡顿。It should be noted that the terminal can monitor the GPU synthesis duration of a single-frame image in real time, so as to adjust the GPU frequency at any time to avoid frame loss and freeze.
基于图3所示的终端架构,上述动作2在具体实现时可以包括:SF进程中确定单帧图像GPU合成时长是否超过第一阈值,若是,CPU在SF进程中向RMS实时处理模块发送指示信息,该指示信息用于指示单帧图像GPU合成时长超过第一阈值,RMS实时处理模块确定目标GPU频率,向策略配置与执行模块发送策略ID,该策略ID对应的策略用于指示目标GPU频率,策略配置与执行模块通过解析策略ID得到目标GPU频率,并将目标GPU频率发送至内核中的GPU驱动,GPU驱动控制GPU将GPU频率调整为目标GPU频率。Based on the terminal architecture shown in FIG. 3 , the above-mentioned action 2 may include: in the SF process, determining whether the GPU synthesis duration of a single-frame image exceeds a first threshold, and if so, the CPU sends indication information to the RMS real-time processing module in the SF process , the instruction information is used to indicate that the single-frame image GPU synthesis duration exceeds the first threshold, the RMS real-time processing module determines the target GPU frequency, and sends the strategy ID to the strategy configuration and execution module, and the strategy corresponding to the strategy ID is used to indicate the target GPU frequency, The policy configuration and execution module obtains the target GPU frequency by parsing the policy ID, and sends the target GPU frequency to the GPU driver in the kernel, and the GPU driver controls the GPU to adjust the GPU frequency to the target GPU frequency.
需要说明的是,由于GPU频率的调整,与GPU频率相关的GPU的其他资源,如用于GPU合成的内存资源(例如,双倍速率(double data rate,DDR))也会相应的进行调整,具体可采用本领域技术人员熟知的一些方式,本申请不再详细描述。It should be noted that due to the adjustment of the GPU frequency, other GPU resources related to the GPU frequency, such as memory resources (for example, double data rate, DDR) used for GPU synthesis, will also be adjusted accordingly. Specifically, some methods well known to those skilled in the art may be adopted, which will not be described in detail in this application.
上述动作1和动作2在实现时互不干扰,可以仅执行其中的一个,也可以都执行。The above actions 1 and 2 do not interfere with each other during implementation, and only one of them may be performed, or both may be performed.
参见图8,上述实施例提供的方法的整体流程可以包括:Referring to FIG. 8 , the overall flow of the method provided by the above embodiment may include:
11)帧率模块检测输入事件,确定目标帧率。其中,输入事件可以为终端接收的应用启动、应用退出、手势导航等事件。11) The frame rate module detects the input event and determines the target frame rate. The input events may be events such as application startup, application exit, gesture navigation, etc. received by the terminal.
12)帧率模块将目标帧率发送给RMS实时处理模块和CPU。12) The frame rate module sends the target frame rate to the RMS real-time processing module and the CPU.
13)CPU根据目标帧率确定目标GPU频率,并发送指示信息给RMS实时处理模块。其中,指示信息用于指示单帧图像GPU合成时长超过第一阈值。13) The CPU determines the target GPU frequency according to the target frame rate, and sends the instruction information to the RMS real-time processing module. The indication information is used to indicate that the GPU synthesis duration of the single-frame image exceeds the first threshold.
14)RMS实时处理模块确定策略ID,策略ID用于调整CPU的处理资源或调整GPU频率。若策略ID用于调整线程组对应的CPU的处理资源,则策略ID根据目标帧率确定。若策略ID用于调整GPU频率,则策略ID根据指示信息确定。步骤14)的具体实现可参见上文。14) The RMS real-time processing module determines the policy ID, and the policy ID is used to adjust the processing resources of the CPU or adjust the frequency of the GPU. If the policy ID is used to adjust the processing resources of the CPU corresponding to the thread group, the policy ID is determined according to the target frame rate. If the policy ID is used to adjust the GPU frequency, the policy ID is determined according to the indication information. The specific implementation of step 14) can refer to the above.
其中,策略ID可以表明该策略的类型,策略的类型包括:用于调整线程组对应的CPU的处理资源的类型(记为第一类型策略),用于调整GPU频率的类型(记为第二类型策略)。例如,参见图8,策略1001和策略1002对应的策略为第一类型策略,策略2001和策略2002对应的策略为第二类型策略。Wherein, the policy ID can indicate the type of the policy, and the types of the policy include: the type used to adjust the processing resources of the CPU corresponding to the thread group (denoted as the first type policy), the type used to adjust the GPU frequency (denoted as the second type of policy) type policy). For example, referring to FIG. 8 , policies corresponding to policies 1001 and 1002 are policies of the first type, and policies corresponding to policies 2001 and 2002 are policies of the second type.
其中,第一类型策略包括帧率范围和门限值,第二类型策略包括目标GPU频率。Wherein, the first type of strategy includes frame rate range and threshold value, and the second type of strategy includes target GPU frequency.
15)RMS实时处理模块将策略ID发送给策略配置与执行模块。15) The RMS real-time processing module sends the policy ID to the policy configuration and execution module.
16)策略配置与执行模块根据策略ID调整CPU的处理资源或GPU频率。16) The policy configuration and execution module adjusts the processing resources of the CPU or the frequency of the GPU according to the policy ID.
其中,参见图9,步骤16)在具体实现时可以包括:Wherein, referring to Figure 9, step 16) can include:
901、策略配置与执行模块接收来自于RMS实时处理模块的策略ID。901. The policy configuration and execution module receives the policy ID from the RMS real-time processing module.
902、策略配置与执行模块确定可扩展标记语言(extensible markup language,xml)配置文件中是否存在策略ID对应的策略。902. The policy configuration and execution module determines whether a policy corresponding to the policy ID exists in the extensible markup language (extensible markup language, xml) configuration file.
若存在,执行步骤903,若不存在则结束。If there is, go to step 903, if not, end.
903、策略配置与执行模块根据策略ID调整CPU的处理资源或GPU频率。903. The policy configuration and execution module adjusts the processing resources of the CPU or the frequency of the GPU according to the policy ID.
其中,xml配置文件可以预先存储在终端中,用于策略配置与执行模块查询策略 ID对应的策略。如图9所示,示例性的,若策略ID为策略1001,解析策略1001得到帧率范围(即[0,60)Hz)及其对应的门限值(即10),并将该门限值发送至内核,内核通过计算得到调整值,将该调整值发送给CPU,CPU根据调整值调整CPU的处理资源。示例性的,若策略ID为策略2001,解析策略2001得到60Hz对应的目标帧率(即250MHz),将目标GPU频率发送至内核中的GPU驱动,GPU驱动控制GPU将GPU频率调整为目标GPU频率。Wherein, the xml configuration file may be pre-stored in the terminal for policy configuration and the policy corresponding to the query policy ID of the execution module. As shown in FIG. 9, exemplarily, if the policy ID is policy 1001, parse the policy 1001 to obtain the frame rate range (ie [0, 60) Hz) and its corresponding threshold value (ie 10), and use the threshold The value is sent to the kernel, the kernel obtains the adjustment value through calculation, and sends the adjustment value to the CPU, and the CPU adjusts the processing resources of the CPU according to the adjustment value. Exemplarily, if the strategy ID is strategy 2001, parse the strategy 2001 to obtain the target frame rate corresponding to 60Hz (that is, 250MHz), send the target GPU frequency to the GPU driver in the kernel, and the GPU driver controls the GPU to adjust the GPU frequency to the target GPU frequency. .
本申请上述实施例中的第一对应关系和第二对应关系仅为示例,在实际实现时可以是其他的形式,不作限制。The first correspondence and the second correspondence in the foregoing embodiments of the present application are only examples, and may be other forms in actual implementation, which are not limited.
可选的,上述方法还包括:终端提高图形合成相关线程的调度优先级或者说终端提高本申请中的线程组的调度优先级。Optionally, the above method further includes: the terminal increases the scheduling priority of threads related to graphics synthesis, or the terminal increases the scheduling priority of the thread group in the present application.
在现有技术中,可以将最重要的一两个线程加入到线程组(此时,该线程组可以称为关键组),关键组的优先级高于非关键组的优先级,以保障性能体验优先。该方式没有将具有依赖关系的相关线程加入到同一线程组中,而一个线程组中的线程统一协调和调度,假设要对线程组中的线程进行迁核,则由于相关线程不在同一个线程组中,调度策略也不同,从而导致相关线程中有些线程迁核早,有些线程迁核晚,导致线程间依赖式阻塞。而在本申请中能够创建一个包含图形合成相关线程的线程组,针对该线程组可以提高其中所有线程的优先级,该线程组的所有线程的优先级都高于其他分组中线程的优先级,从而使得该线程组的优先级高于其他分组,由于该线程组优先级较高,能够实现优先处理,从而在图像合成过程中,保证线程处理过程中的流畅性和及时性,进一步避免丢帧卡顿现象的产生,提升用户体验感。In the prior art, one or two most important threads can be added to a thread group (in this case, the thread group can be called a critical group), and the priority of the critical group is higher than that of the non-critical group to ensure performance Experience first. This method does not add related threads with dependencies to the same thread group, but the threads in a thread group are coordinated and scheduled uniformly. The scheduling strategy is also different, which leads to some threads in the related threads migrate early, and some threads migrate late, resulting in dependent blocking between threads. In the present application, a thread group can be created that includes threads related to graphics synthesis, and the priority of all threads in the thread group can be increased. The priority of all threads in the thread group is higher than that of threads in other groups. Therefore, the priority of the thread group is higher than that of other groups. Due to the higher priority of the thread group, priority processing can be achieved, so that in the process of image synthesis, the smoothness and timeliness of the thread processing process are ensured, and frame loss is further avoided. The occurrence of the stuttering phenomenon improves the user experience.
目前,针对游戏应用,由于用户对于图像的流畅性要求较高,因此,在用户触发更高的图像质量的需求的情况下,可以将CPU的处理资源和GPU频率调整到最大,即为存在图形合成相关线程的线程组中的所有线程分配充足的CPU的处理资源和GPU频率,这样虽然可以满足用户的需求,但资源浪费比较严重,功耗也比较高。在本申请中,由于建立了独立的图形合成相关线程组,用户可以根据实际的图像质量的需求针对该线程组调整GPU的处理资源和GPU频率,使得在满足用户需求的情况下,避免造成资源浪费,降低终端的功耗。也就是说,本申请可以为图形合成相关线程创建独立的线程组,并按需为本申请中的线程组分配资源,相对于将图形合成相关线程置于不同的线程组中,可以避免资源浪费,降低终端的功耗。At present, for game applications, since the user has high requirements for the smoothness of the image, when the user triggers the demand for higher image quality, the processing resources of the CPU and the frequency of the GPU can be adjusted to the maximum, that is, the presence of graphics All threads in the thread group that synthesize related threads are allocated sufficient CPU processing resources and GPU frequencies, so that although the user's needs can be met, resource waste is serious and power consumption is relatively high. In this application, since an independent thread group related to graphics synthesis is established, the user can adjust the processing resources and GPU frequency of the GPU for the thread group according to the actual image quality requirements, so as to avoid resource waste and reduce the power consumption of the terminal. That is to say, the present application can create independent thread groups for graphics synthesis related threads, and allocate resources to the thread groups in the application as needed. Compared with placing graphics synthesis related threads in different thread groups, waste of resources can be avoided. , reduce the power consumption of the terminal.
本申请实施例提供的方法,通过判断图像的目标帧率的高低(或者也可以描述为图像的目标帧间隔的长短),合理的调整线程组对应的CPU的处理资源,通过监测单帧图像GPU合成时长,合理的调整GPU频率,可以按需为线程组分配资源,从而避免造成资源浪费,降低终端的功耗。The method provided by this embodiment of the present application reasonably adjusts the processing resources of the CPU corresponding to the thread group by judging the level of the target frame rate of the image (or can also be described as the length of the target frame interval of the image), and by monitoring the GPU of a single frame image Synthesis time, reasonable adjustment of GPU frequency, can allocate resources to thread groups as needed, thereby avoiding waste of resources and reducing power consumption of terminals.
本申请上述实施例中,步骤501和步骤502可以为独立的方案,仅执行步骤501时,即可解决上述问题1,仅执行步骤502(此时,线程组可以不是本申请中的线程组,而是现有技术中的线程组)时,即可解决上述问题2。In the above-mentioned embodiment of the present application, step 501 and step 502 may be independent solutions, when only step 501 is executed, the above problem 1 can be solved, and only step 502 is executed (in this case, the thread group may not be the thread group in the present application, Instead of the thread group in the prior art), the above problem 2 can be solved.
上述主要从方法的角度对本申请实施例的方案进行了介绍。可以理解的是,各个模块,例如,终端为了实现上述功能,其包含了执行各个功能相应的硬件结构和软件模块中的至少一个。本领域技术人员应该很容易意识到,结合本文中所公开的实施例 描述的各示例的单元及算法步骤,本申请能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。The solutions of the embodiments of the present application have been introduced above mainly from the perspective of methods. It can be understood that each module, for example, in order to implement the above-mentioned functions, the terminal includes at least one of a hardware structure and a software module corresponding to executing each function. Those skilled in the art should easily realize that the present application can be implemented in hardware or in the form of a combination of hardware and computer software, in conjunction with the units and algorithm steps of each example described in the embodiments disclosed herein. Whether a function is performed by hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each particular application, but such implementations should not be considered beyond the scope of this application.
本申请实施例可以根据上述方法示例对终端进行功能单元的划分,例如,可以对应各个功能划分各个功能单元,也可以将两个或两个以上的功能集成在一个处理单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。需要说明的是,本申请实施例中对单元的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。In this embodiment of the present application, the terminal may be divided into functional units according to the foregoing method examples. For example, each functional unit may be divided corresponding to each function, or two or more functions may be integrated into one processing unit. The above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units. It should be noted that the division of units in the embodiments of the present application is illustrative, and is only a logical function division, and other division methods may be used in actual implementation.
示例性的,图10示出了上述实施例中所涉及的终端装置(记为终端装置100)的一种可能的结构示意图,该终端装置100包括创建单元1001和调整单元1002。Exemplarily, FIG. 10 shows a possible schematic structural diagram of a terminal device (referred to as a terminal device 100 ) involved in the above-mentioned embodiment, where the terminal device 100 includes a creation unit 1001 and an adjustment unit 1002 .
创建单元1001,用于创建线程组,线程组包括图形合成相关线程;A creation unit 1001 is used to create a thread group, where the thread group includes graphics synthesis related threads;
调整单元1002,用于根据目标图像质量调整线程组对应的中央处理器CPU的处理资源和/或调整图形处理器GPU频率。The adjustment unit 1002 is configured to adjust the processing resources of the central processing unit CPU corresponding to the thread group and/or adjust the frequency of the graphics processor GPU according to the target image quality.
可选的,调整单元1002具体用于:根据图像的目标帧率调整线程组对应的CPU的处理资源;和/或,根据图像的单帧图像GPU合成时长调整GPU频率。Optionally, the adjustment unit 1002 is specifically configured to: adjust the processing resources of the CPU corresponding to the thread group according to the target frame rate of the image; and/or adjust the GPU frequency according to the GPU synthesis duration of a single frame of the image.
可选的,调整单元1002具体用于:确定目标帧率所处的帧率范围为第一帧率范围;根据第一帧率范围对应的门限值调整线程组对应的CPU的处理资源,门限值大于0且小于1。Optionally, the adjusting unit 1002 is specifically configured to: determine the frame rate range where the target frame rate is located as the first frame rate range; adjust the processing resources of the CPU corresponding to the thread group according to the threshold value corresponding to the first frame rate range, The limit is greater than 0 and less than 1.
可选的,调整单元1002具体用于:确定CPU的处理资源的调整值,调整值为第一帧率范围对应的门限值与CPU的剩余资源的乘积;根据调整值为线程组增加CPU的处理资源。Optionally, the adjustment unit 1002 is specifically configured to: determine the adjustment value of the processing resources of the CPU, where the adjustment value is the product of the threshold value corresponding to the first frame rate range and the remaining resources of the CPU; Process resources.
可选的,调整单元1002具体用于:确定目标帧率所处的帧率范围为第二帧率范围;确定第二帧率范围对应的GPU频率;当确定在第二帧率范围对应的GPU频率下,单帧图像GPU合成时长大于或等于第一阈值时,调整GPU频率至第二帧率范围的最大值对应的GPU频率,第一阈值为第二帧率范围的最大值对应的单帧图像GPU合成时长,第二帧率范围的最大值对应的GPU频率大于第二帧率范围对应的GPU频率。Optionally, the adjustment unit 1002 is specifically configured to: determine the frame rate range in which the target frame rate is located as the second frame rate range; determine the GPU frequency corresponding to the second frame rate range; when determining the GPU frequency corresponding to the second frame rate range; Under the frequency, when the GPU synthesis time of a single frame image is greater than or equal to the first threshold, adjust the GPU frequency to the GPU frequency corresponding to the maximum value of the second frame rate range, and the first threshold is the single frame corresponding to the maximum value of the second frame rate range. Image GPU synthesis duration, the GPU frequency corresponding to the maximum value of the second frame rate range is greater than the GPU frequency corresponding to the second frame rate range.
可选的,终端装置还包括监控单元1003,监控单元1003用于:实时监控帧率的变化;和/或,实时监控单帧图像GPU合成时长。Optionally, the terminal device further includes a monitoring unit 1003, and the monitoring unit 1003 is configured to: monitor the change of the frame rate in real time; and/or monitor the GPU synthesis duration of the single frame image in real time.
可选的,图形合成相关线程包括SF进程、内存分配进程、送显进程、工作进程中的一个或多个进程中的线程。Optionally, the graphics synthesis related threads include threads in one or more of the SF process, the memory allocation process, the sending and display process, and the worker process.
可选的,终端装置还包括优先级配置单元1004;优先级配置单元1004,用于提高图形合成相关线程的调度优先级。Optionally, the terminal device further includes a priority configuration unit 1004; the priority configuration unit 1004 is configured to improve the scheduling priority of graphics synthesis related threads.
可选的,终端装置100中还包括存储单元1005。存储单元1005用于存储计算机执行指令,终端装置中的其他单元可以根据存储单元1005中存储的计算机执行指令执行相应的动作。Optionally, the terminal device 100 further includes a storage unit 1005 . The storage unit 1005 is used for storing computer-executed instructions, and other units in the terminal device can perform corresponding actions according to the computer-executed instructions stored in the storage unit 1005 .
示例性的,创建单元1001执行的动作也可以通过上述RMS实时处理模块以及内核执行;调整单元1002执行的动作也可以通过上述策略配置与执行模块执行;监控单元1003执行的动作也可以通过上述帧率模块以及内核执行;优先级配置单元1004执 行的动作也可以通过上述内核执行。其中,上述方法实施例涉及的各步骤的所有相关内容均可以援引到对应功能模块的功能描述,在此不再赘述。Exemplarily, the actions performed by the creation unit 1001 may also be performed by the above-mentioned RMS real-time processing module and the kernel; the actions performed by the adjustment unit 1002 may also be performed by the above-mentioned policy configuration and execution modules; the actions performed by the monitoring unit 1003 may also be performed by the above-mentioned frames. The rate module and the kernel are executed; the actions executed by the priority configuration unit 1004 can also be executed by the above-mentioned kernel. Wherein, all relevant contents of the steps involved in the above method embodiments can be cited in the functional descriptions of the corresponding functional modules, which will not be repeated here.
其中,终端装置100可以为一个设备也可以为芯片或芯片系统。The terminal device 100 may be a device or a chip or a chip system.
图10中的集成的单元如果以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或处理器(processor)执行本申请各个实施例方法的全部或部分步骤。存储计算机软件产品的存储介质包括:U盘、移动硬盘、只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。The integrated unit in FIG. 10 may be stored in a computer-readable storage medium if it is implemented in the form of software functional modules and sold or used as a stand-alone product. Based on this understanding, the technical solutions of the embodiments of the present application can be embodied in the form of software products in essence, or the parts that contribute to the prior art, or all or part of the technical solutions, and the computer software products are stored in a storage The medium includes several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (processor) to execute all or part of the steps of the methods of the various embodiments of the present application. Storage media for storing computer software products include: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or CD, etc. that can store program codes medium.
本申请实施例还提供了一种终端装置的硬件结构示意图,参见图11,该终端装置包括处理器1101,可选的,还包括与处理器1101连接的存储器1102。处理器1101和存储器1102通过总线相连接。An embodiment of the present application further provides a schematic diagram of a hardware structure of a terminal device. Referring to FIG. 11 , the terminal device includes a processor 1101 and, optionally, a memory 1102 connected to the processor 1101 . The processor 1101 and the memory 1102 are connected by a bus.
处理器1101可以包括CPU、GPU、微处理器、特定应用集成电路(application-specific integrated circuit,ASIC),或者一个或多个用于控制本申请方案程序执行的集成电路。处理器1101也可以包括多个CPU,并且处理器1101可以是一个单核(single-CPU)处理器,也可以是多核(multi-CPU)处理器。这里的处理器可以指一个或多个设备、电路或用于处理数据(例如计算机程序指令)的处理核。The processor 1101 may include a CPU, a GPU, a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the programs of the present application. The processor 1101 may also include multiple CPUs, and the processor 1101 may be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor. A processor herein may refer to one or more devices, circuits, or processing cores for processing data (eg, computer program instructions).
存储器1102可以是ROM或可存储静态信息和指令的其他类型的静态存储设备、RAM或者可存储信息和指令的其他类型的动态存储设备,也可以是电可擦可编程只读存储器(electrically erasable programmable read-only memory,EEPROM)、只读光盘(compact disc read-only memory,CD-ROM)或其他光盘存储、光碟存储(包括压缩光碟、激光碟、光碟、数字通用光碟、蓝光光碟等)、磁盘存储介质或者其他磁存储设备、或者能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,本申请实施例对此不作任何限制。存储器1102可以是独立存在,也可以和处理器1101集成在一起。其中,存储器1102中可以包含计算机程序代码。处理器1101用于执行存储器1102中存储的计算机程序代码,从而实现本申请实施例提供的方法。The memory 1102 can be a ROM or other type of static storage device that can store static information and instructions, a RAM or other type of dynamic storage device that can store information and instructions, or an electrically erasable programmable read-only memory. read-only memory, EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compact disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), magnetic disk A storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program codes in the form of instructions or data structures and that can be accessed by a computer, is not limited in this embodiment of the present application. The memory 1102 may exist independently, or may be integrated with the processor 1101 . Among them, the memory 1102 may contain computer program code. The processor 1101 is configured to execute the computer program codes stored in the memory 1102, so as to implement the methods provided by the embodiments of the present application.
处理器1101用于对终端的动作进行控制管理,例如,处理器1101用于执行图5中的501至502,和/或本申请实施例中所描述的其他过程中的终端执行的动作。存储器1102用于存储终端的程序代码和数据。The processor 1101 is configured to control and manage actions of the terminal. For example, the processor 1101 is configured to execute actions 501 to 502 in FIG. 5 and/or actions performed by the terminal in other processes described in the embodiments of this application. The memory 1102 is used to store program codes and data of the terminal.
在实现过程中,本实施例提供的方法中的各步骤可以通过处理器中的硬件的集成逻辑电路或者软件形式的指令完成。结合本申请实施例所公开的方法的步骤可以直接体现为硬件处理器执行完成,或者用处理器中的硬件及软件模块组合执行完成。In the implementation process, each step in the method provided in this embodiment may be completed by an integrated logic circuit of hardware in a processor or an instruction in the form of software. The steps of the method disclosed in conjunction with the embodiments of the present application may be directly embodied as executed by a hardware processor, or executed by a combination of hardware and software modules in the processor.
本申请实施例还提供了一种计算机可读存储介质,包括指令,当其在计算机上运行时,使得计算机执行上述任一方法。Embodiments of the present application further provide a computer-readable storage medium, including instructions, which, when executed on a computer, cause the computer to execute any of the foregoing methods.
本申请实施例还提供了一种包含指令的计算机程序产品,当其在计算机上运行时, 使得计算机执行上述任一方法。Embodiments of the present application also provide a computer program product containing instructions, which, when run on a computer, cause the computer to execute any of the above methods.
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件程序实现时,可以全部或部分地以计算机程序产品的形式来实现。该计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行计算机程序指令时,全部或部分地产生按照本申请实施例的流程或功能。计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,计算机指令可以从一个网站站点、计算机、服务器或者数据中心通过有线(例如同轴电缆、光纤、数字用户线(digital subscriber line,DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可以用介质集成的服务器、数据中心等数据存储设备。可用介质可以是磁性介质(例如,软盘、硬盘、磁带),光介质(例如,DVD)、或者半导体介质(例如固态硬盘(solid state disk,SSD))等。In the above-mentioned embodiments, it may be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using a software program, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the procedures or functions according to the embodiments of the present application are generated in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable device. Computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server, or data center over a wire (e.g. coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (eg infrared, wireless, microwave, etc.) means to transmit to another website site, computer, server or data center. Computer-readable storage media can be any available media that can be accessed by a computer or data storage devices including one or more servers, data centers, etc., that can be integrated with the media. Useful media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, DVDs), or semiconductor media (eg, solid state disks (SSDs)), and the like.
尽管在此结合各实施例对本申请进行了描述,然而,在实施所要求保护的本申请过程中,本领域技术人员通过查看附图、公开内容、以及所附权利要求书,可理解并实现公开实施例的其他变化。在权利要求中,“包括”(comprising)一词不排除其他组成部分或步骤,“一”或“一个”不排除多个的情况。单个处理器或其他单元可以实现权利要求中列举的若干项功能。相互不同的从属权利要求中记载了某些措施,但这并不表示这些措施不能组合起来产生良好的效果。Although the application is described herein in conjunction with various embodiments, in practicing the claimed application, those skilled in the art can understand and implement the disclosure by reviewing the drawings, the disclosure, and the appended claims Other variations of the embodiment. In the claims, the word "comprising" does not exclude other components or steps, and "a" or "an" does not exclude a plurality. A single processor or other unit may fulfill the functions of several items recited in the claims. The mere fact that certain measures are recited in mutually different dependent claims does not indicate that these measures cannot be combined to advantage.
尽管结合具体特征及其实施例对本申请进行了描述,显而易见的,在不脱离本申请的精神和范围的情况下,可对其进行各种修改和组合。相应地,本说明书和附图仅仅是所附权利要求所界定的本申请的示例性说明,且视为已覆盖本申请范围内的任意和所有修改、变化、组合或等同物。显然,本领域的技术人员可以对本申请进行各种改动和变型而不脱离本申请的精神和范围。这样,倘若本申请的这些修改和变型属于本申请权利要求及其等同技术的范围之内,则本申请也意图包含这些改动和变型在内。Although the application has been described in conjunction with specific features and embodiments thereof, it will be apparent that various modifications and combinations can be made therein without departing from the spirit and scope of the application. Accordingly, this specification and drawings are merely exemplary illustrations of the application as defined by the appended claims, and are deemed to cover any and all modifications, variations, combinations or equivalents within the scope of this application. Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims (19)

  1. 一种计算资源调度方法,其特征在于,包括:A computing resource scheduling method, comprising:
    终端创建线程组,所述线程组包括图形合成相关线程;The terminal creates a thread group, and the thread group includes graphics synthesis related threads;
    所述终端根据目标图像质量调整所述线程组对应的中央处理器CPU的处理资源和/或调整图形处理器GPU频率。The terminal adjusts the processing resources of the central processing unit CPU corresponding to the thread group and/or adjusts the frequency of the graphics processor GPU according to the target image quality.
  2. 根据权利要求1所述的方法,其特征在于,所述终端根据目标图像质量调整所述线程组对应的CPU的处理资源和/或调整GPU频率,包括:The method according to claim 1, wherein the terminal adjusts the processing resources of the CPU corresponding to the thread group and/or adjusts the GPU frequency according to the target image quality, comprising:
    所述终端根据所述图像的目标帧率调整所述线程组对应的CPU的处理资源;和/或,The terminal adjusts the processing resources of the CPU corresponding to the thread group according to the target frame rate of the image; and/or,
    所述终端根据所述图像的单帧图像GPU合成时长调整所述GPU频率。The terminal adjusts the GPU frequency according to the GPU synthesis duration of a single frame of the image.
  3. 根据权利要求2所述的方法,其特征在于,所述终端根据所述图像的目标帧率调整所述线程组对应的CPU的处理资源,包括:The method according to claim 2, wherein the terminal adjusts the processing resources of the CPU corresponding to the thread group according to the target frame rate of the image, comprising:
    所述终端确定所述目标帧率所处的帧率范围为第一帧率范围;The terminal determines that the frame rate range in which the target frame rate is located is the first frame rate range;
    所述终端根据所述第一帧率范围对应的门限值调整所述线程组对应的CPU的处理资源,所述门限值大于0且小于1。The terminal adjusts the processing resources of the CPU corresponding to the thread group according to a threshold value corresponding to the first frame rate range, where the threshold value is greater than 0 and less than 1.
  4. 根据权利要求3所述的方法,其特征在于,所述终端根据所述第一帧率范围对应的门限值调整所述线程组对应的CPU的处理资源,包括:The method according to claim 3, wherein the terminal adjusts the processing resources of the CPU corresponding to the thread group according to the threshold value corresponding to the first frame rate range, comprising:
    所述终端确定所述CPU的处理资源的调整值,所述调整值为所述第一帧率范围对应的门限值与所述CPU的剩余资源的乘积;determining, by the terminal, an adjustment value of the processing resources of the CPU, where the adjustment value is the product of the threshold value corresponding to the first frame rate range and the remaining resources of the CPU;
    所述终端根据所述调整值为所述线程组增加所述CPU的处理资源。The terminal increases the processing resources of the CPU for the thread group according to the adjustment value.
  5. 根据权利要求2所述的方法,其特征在于,所述终端根据所述图像的单帧图像GPU合成时长调整所述GPU频率,包括:The method according to claim 2, wherein the terminal adjusts the GPU frequency according to the GPU synthesis duration of the single-frame image of the image, comprising:
    所述终端确定所述目标帧率所处的帧率范围为第二帧率范围;The terminal determines that the frame rate range in which the target frame rate is located is the second frame rate range;
    所述终端确定所述第二帧率范围对应的GPU频率;The terminal determines the GPU frequency corresponding to the second frame rate range;
    当确定在所述第二帧率范围对应的GPU频率下,单帧图像GPU合成时长大于或等于第一阈值时,所述终端调整所述GPU频率至所述第二帧率范围的最大值对应的GPU频率,所述第一阈值为所述第二帧率范围的最大值对应的单帧图像GPU合成时长,所述第二帧率范围的最大值对应的GPU频率大于所述第二帧率范围对应的GPU频率。When it is determined that under the GPU frequency corresponding to the second frame rate range, the GPU synthesis duration of a single frame image is greater than or equal to the first threshold, the terminal adjusts the GPU frequency to correspond to the maximum value of the second frame rate range the GPU frequency, the first threshold is the single-frame image GPU synthesis duration corresponding to the maximum value of the second frame rate range, and the GPU frequency corresponding to the maximum value of the second frame rate range is greater than the second frame rate The GPU frequency corresponding to the range.
  6. 根据权利要求1-5任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1-5, wherein the method further comprises:
    所述终端实时监控帧率的变化;和/或,The terminal monitors changes in the frame rate in real time; and/or,
    所述终端实时监控单帧图像GPU合成时长。The terminal monitors the GPU synthesis duration of a single frame image in real time.
  7. 根据权利要求1-6任一项所述的方法,其特征在于,所述图形合成相关线程包括界面合成SF进程、内存分配进程、送显进程、工作进程中的一个或多个进程中的线程。The method according to any one of claims 1-6, wherein the graphics synthesis related threads include threads in one or more of an interface synthesis SF process, a memory allocation process, a display sending process, and a work process. .
  8. 根据权利要求1-7任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1-7, wherein the method further comprises:
    所述终端提高所述图形合成相关线程的调度优先级。The terminal increases the scheduling priority of the graphics synthesis related thread.
  9. 一种终端装置,其特征在于,包括:A terminal device, characterized in that it includes:
    创建单元,用于创建线程组,所述线程组包括图形合成相关线程;A creation unit for creating a thread group, the thread group including graphics synthesis related threads;
    调整单元,用于根据目标图像质量调整所述线程组对应的中央处理器CPU的处理 资源和/或调整图形处理器GPU频率。An adjustment unit, configured to adjust the processing resources of the central processing unit CPU corresponding to the thread group and/or adjust the frequency of the graphics processor GPU according to the target image quality.
  10. 根据权利要求9所述的终端装置,其特征在于,所述调整单元具体用于:The terminal device according to claim 9, wherein the adjustment unit is specifically configured to:
    根据所述图像的目标帧率调整所述线程组对应的CPU的处理资源;和/或,Adjust the processing resources of the CPU corresponding to the thread group according to the target frame rate of the image; and/or,
    根据所述图像的单帧图像GPU合成时长调整所述GPU频率。The GPU frequency is adjusted according to the GPU synthesis duration of the single-frame image of the image.
  11. 根据权利要求10所述的终端装置,其特征在于,所述调整单元具体用于:The terminal device according to claim 10, wherein the adjustment unit is specifically configured to:
    确定所述目标帧率所处的帧率范围为第一帧率范围;determining that the frame rate range in which the target frame rate is located is the first frame rate range;
    根据所述第一帧率范围对应的门限值调整所述线程组对应的CPU的处理资源,所述门限值大于0且小于1。The processing resources of the CPU corresponding to the thread group are adjusted according to a threshold value corresponding to the first frame rate range, where the threshold value is greater than 0 and less than 1.
  12. 根据权利要求11所述的终端装置,其特征在于,所述调整单元具体用于:The terminal device according to claim 11, wherein the adjustment unit is specifically configured to:
    确定所述CPU的处理资源的调整值,所述调整值为所述第一帧率范围对应的门限值与所述CPU的剩余资源的乘积;determining an adjustment value of the processing resources of the CPU, where the adjustment value is the product of the threshold value corresponding to the first frame rate range and the remaining resources of the CPU;
    根据所述调整值为所述线程组增加所述CPU的处理资源。The processing resources of the CPU are increased for the thread group according to the adjustment value.
  13. 根据权利要求10所述的终端装置,其特征在于,所述调整单元具体用于:The terminal device according to claim 10, wherein the adjustment unit is specifically configured to:
    确定所述目标帧率所处的帧率范围为第二帧率范围;determining that the frame rate range in which the target frame rate is located is the second frame rate range;
    确定所述第二帧率范围对应的GPU频率;determining the GPU frequency corresponding to the second frame rate range;
    当确定在所述第二帧率范围对应的GPU频率下,单帧图像GPU合成时长大于或等于第一阈值时,调整所述GPU频率至所述第二帧率范围的最大值对应的GPU频率,所述第一阈值为所述第二帧率范围的最大值对应的单帧图像GPU合成时长,所述第二帧率范围的最大值对应的GPU频率大于所述第二帧率范围对应的GPU频率。When it is determined that under the GPU frequency corresponding to the second frame rate range, the GPU synthesis duration of a single frame image is greater than or equal to the first threshold, adjust the GPU frequency to the GPU frequency corresponding to the maximum value of the second frame rate range , the first threshold is the single-frame image GPU synthesis duration corresponding to the maximum value of the second frame rate range, and the GPU frequency corresponding to the maximum value of the second frame rate range is greater than the GPU frequency corresponding to the second frame rate range. GPU frequency.
  14. 根据权利要求9-13任一项所述的终端装置,其特征在于,所述终端装置还包括监控单元,所述监控单元用于:The terminal device according to any one of claims 9-13, wherein the terminal device further comprises a monitoring unit, and the monitoring unit is configured to:
    实时监控帧率的变化;和/或,monitor frame rate changes in real time; and/or,
    实时监控单帧图像GPU合成时长。Real-time monitoring of single-frame image GPU synthesis time.
  15. 根据权利要求9-14任一项所述的终端装置,其特征在于,所述图形合成相关线程包括界面合成SF进程、内存分配进程、送显进程、工作进程中的一个或多个进程中的线程。The terminal device according to any one of claims 9-14, wherein the graphics synthesis related thread comprises one or more of an interface synthesis SF process, a memory allocation process, a display sending process, and a work process. thread.
  16. 根据权利要求9-15任一项所述的终端装置,其特征在于,所述终端装置还包括优先级配置单元;The terminal device according to any one of claims 9-15, wherein the terminal device further comprises a priority configuration unit;
    所述优先级配置单元,用于提高所述图形合成相关线程的调度优先级。The priority configuration unit is configured to improve the scheduling priority of the graphics synthesis related thread.
  17. 一种终端装置,其特征在于,包括:处理器;A terminal device, comprising: a processor;
    所述处理器与存储器连接,所述存储器用于存储计算机执行指令,所述处理器执行所述存储器存储的所述计算机执行指令,以使所述终端装置实现如权利要求1-8任一项所述的方法。The processor is connected to a memory, the memory is used to store computer-executed instructions, and the processor executes the computer-executed instructions stored in the memory, so that the terminal device implements any one of claims 1-8 the method described.
  18. 一种计算机可读存储介质,其特征在于,用于存储计算机指令,当所述计算机指令在计算机上运行时,使得所述计算机执行权利要求1-8中任一项所述的方法。A computer-readable storage medium, characterized in that it is used for storing computer instructions, which, when the computer instructions are executed on a computer, cause the computer to perform the method of any one of claims 1-8.
  19. 一种计算机程序产品,其特征在于,包含计算机指令,当所述计算机指令在计算机上运行时,使得计算机执行如权利要求1-8中任一项所述的方法。A computer program product, characterized by comprising computer instructions which, when executed on a computer, cause the computer to perform the method of any one of claims 1-8.
PCT/CN2022/084179 2021-04-22 2022-03-30 Computational resource scheduling method and apparatus WO2022222721A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110438616.7 2021-04-22
CN202110438616.7A CN115237583A (en) 2021-04-22 2021-04-22 Computing resource scheduling method and device

Publications (1)

Publication Number Publication Date
WO2022222721A1 true WO2022222721A1 (en) 2022-10-27

Family

ID=83665869

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/084179 WO2022222721A1 (en) 2021-04-22 2022-03-30 Computational resource scheduling method and apparatus

Country Status (2)

Country Link
CN (1) CN115237583A (en)
WO (1) WO2022222721A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117971448A (en) * 2022-10-26 2024-05-03 荣耀终端有限公司 Application starting method and electronic equipment
CN116416115B (en) * 2022-12-23 2024-01-30 摩尔线程智能科技(北京)有限责任公司 GPU control method, device, equipment, storage medium and program product
CN117149409A (en) * 2023-05-16 2023-12-01 荣耀终端有限公司 Method for adjusting CPU frequency and terminal equipment

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109165103A (en) * 2018-10-15 2019-01-08 Oppo广东移动通信有限公司 Frame rate control method, device, terminal and storage medium
CN110489228A (en) * 2019-07-16 2019-11-22 华为技术有限公司 A kind of method and electronic equipment of scheduling of resource
CN110532100A (en) * 2019-09-02 2019-12-03 Oppo广东移动通信有限公司 Dispatch method, apparatus, terminal and the storage medium of resource
CN110681155A (en) * 2019-09-29 2020-01-14 Oppo广东移动通信有限公司 Game optimization method, game optimization device and mobile terminal
US20200118514A1 (en) * 2018-10-16 2020-04-16 Red Hat Israel, Ltd. Adjusting virtual machine gpu refresh rate to remote desktop stream frame rate
CN111045814A (en) * 2018-10-11 2020-04-21 华为技术有限公司 Resource scheduling method and terminal equipment
CN111480336A (en) * 2018-03-26 2020-07-31 华为技术有限公司 Frame rate adjusting method and terminal

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111480336A (en) * 2018-03-26 2020-07-31 华为技术有限公司 Frame rate adjusting method and terminal
CN111045814A (en) * 2018-10-11 2020-04-21 华为技术有限公司 Resource scheduling method and terminal equipment
CN109165103A (en) * 2018-10-15 2019-01-08 Oppo广东移动通信有限公司 Frame rate control method, device, terminal and storage medium
US20200118514A1 (en) * 2018-10-16 2020-04-16 Red Hat Israel, Ltd. Adjusting virtual machine gpu refresh rate to remote desktop stream frame rate
CN110489228A (en) * 2019-07-16 2019-11-22 华为技术有限公司 A kind of method and electronic equipment of scheduling of resource
CN110532100A (en) * 2019-09-02 2019-12-03 Oppo广东移动通信有限公司 Dispatch method, apparatus, terminal and the storage medium of resource
CN110681155A (en) * 2019-09-29 2020-01-14 Oppo广东移动通信有限公司 Game optimization method, game optimization device and mobile terminal

Also Published As

Publication number Publication date
CN115237583A (en) 2022-10-25

Similar Documents

Publication Publication Date Title
WO2022222721A1 (en) Computational resource scheduling method and apparatus
WO2021008543A1 (en) Resource scheduling method and electronic device
US11409547B2 (en) Method for rendering user interface and terminal
TWI260543B (en) Performance scheduling method and system, and computer readable medium
EP3535641B1 (en) Thread importance based processor core partitioning
US9274845B2 (en) Job scheduling apparatus and job scheduling method thereof to assign jobs to a core
CN109542614B (en) Resource allocation method, device, terminal and storage medium
EP4002112A1 (en) Data processing method and apparatus, and electronic device
WO2019228340A1 (en) Program optimization method and apparatus, terminal, and storage medium
US20180120920A1 (en) Thread Importance Based Processor Core Parking And Frequency Selection
EP3886385A1 (en) Device, system and method to dynamically prioritize a data flow based on user interest in a task
US9189293B2 (en) Computer, virtualization mechanism, and scheduling method
US20140164662A1 (en) Methods and apparatus for interleaving priorities of a plurality of virtual processors
US20150012973A1 (en) Methods and apparatus for sharing a service between multiple virtual machines
WO2021208786A1 (en) Thread management method and apparatus
KR102257737B1 (en) Apparatus and method for controlling a throughput in an electronic device
CN112799824A (en) Current limiting method, device, equipment and storage medium
CN114217759A (en) Screen projection method and device, storage medium and electronic equipment
US20140229940A1 (en) Methods and apparatus for synchronizing multiple processors of a virtual machine
US20230221969A1 (en) Encoding scheduling method, server, client, and system for acquiring remote desktop
WO2023155695A1 (en) Processor, control method, device, and medium
US20150012654A1 (en) Methods and apparatus for sharing a physical device between multiple physical machines
US20150012918A1 (en) Methods and apparatus for sharing a physical device between multiple virtual machines
KR20060063904A (en) Method for sharing a graphics display as a resource in an embedded system
CN112675535A (en) Display interface adjusting method and device, network equipment and storage medium

Legal Events

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

Ref document number: 22790830

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 22790830

Country of ref document: EP

Kind code of ref document: A1