Image processing method and computer system
By deploying user-mode graphics drivers and kernel-mode graphics drivers on the cloud server, the instruction conversion layer is avoided, commands are directly submitted to the GPU for execution, and an on-demand image synthesis strategy is adopted to solve the problem of high server CPU overhead in traditional methods. , improving image processing efficiency and concurrency.
Patent Information
- Application Number
- CN201910260921.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-03-30
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2039-03-30
AI Technical Summary
When multiple mobile operating systems are run concurrently on a cloud server, the existence of the graphics instruction interception layer and instruction conversion layer in traditional methods results in high server CPU overhead and affects image processing efficiency.
The user-mode graphics driver is deployed on the guest operating system, and the kernel-mode graphics driver is deployed on the host operating system. This avoids using the instruction conversion layer and directly submits the commands generated by the user-mode graphics driver to the GPU for execution, and uses on-demand image synthesis. Strategies to reduce unnecessary image synthesis tasks.
It significantly saves server overhead, simplifies the image processing process, improves image processing efficiency, supports the deployment of more guest operating systems, and improves server concurrency and overall performance.
Smart Images

Figure CN111768330B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to an image processing method and a computer system. Background Art
[0002] Providing simulation of the software and hardware systems of mobile phones on the cloud makes it possible to conduct simulation, scale testing, collaborative development of mobile applications, mobile office, cross-platform trial and promotion of mobile games based on the cloud platform. This model has broad application prospects. In the traditional implementation method, a mobile phone runs an independent operating system (such as the Android system). To provide the same functions as a mobile phone on the cloud, it is necessary to be able to run the mobile phone operating system on the server. Since the server has high performance, in order to efficiently utilize the server resources, multiple mobile phone operating systems can be run concurrently on a server. Figure 1 The schematic diagram of the architecture of a server is shown, and the server is installed with a host operating system (host system) 101, and multiple Android systems 1011 ( Figure 1 Taking two as examples), instruction translation layer 1012, graphic instruction layer 1013, user mode graphic driver 1014, kernel mode driver 1015, image capture program 1016 and graphics processing unit (gpu) 102, wherein the android system 1011 deploys application (application, app) 1017, graphic instruction interception layer 1018, android display system (surface flinger) 1019 and synthesizer (composer) 1010. The following describes how the server performs image processing tasks for each android system based on the above modules.
[0003] 1. The application 1017 is used to generate graphics rendering parameters and initiate a first application programming interface (API) instruction to the graphics instruction interception layer 1018, where the first API instruction is used to request graphics rendering to be performed according to the graphics rendering parameters.
[0004] 2. The graphics instruction interception layer 1018 intercepts the graphics rendering parameters and the first API instruction, and passes the graphics rendering parameters and the first API instruction to the instruction conversion layer 1012 through a communication pipe (PIPE).
[0005] 3. The instruction conversion layer 1012 converts the first API instruction into a second API instruction that can be recognized by the graphics instruction layer 1013 in the host operating system.
[0006] 4. The user-mode graphics driver 1014 obtains the graphics rendering parameters and the second API instruction sent by the graphics instruction layer 1013, and generates a command recognizable by the GPU according to the graphics rendering parameters and the second API instruction.
[0007] 5. The kernel-mode graphics driver 1015 controls the GPU to perform image rendering according to the command issued by the user-mode graphics driver 1014.
[0008] 6. The Android display system 1019 controls the synthesizer 1010 to synthesize multiple layers generated by the GPU performing image rendering. During the synthesis process, the synthesizer 1010 will generate instructions, which will still be intercepted by the graphics instruction interception layer 1018, and will be successively passed through the instruction conversion layer 1012, the graphics instruction layer 1013, the user-mode graphics driver 1014, and the kernel-mode graphics driver 1015. Finally, the synthesis operation is completed by GPU102, and the image data generated by the synthesis is stored in the dual graphics buffer.
[0009] 7. The image capture program 1016, in cooperation with the graphics instruction layer 1013 and the user-mode graphics driver 1014, captures image data from the dual graphics buffer and sends the captured image data to a remote end for display, such as to a mobile phone for display.
[0010] Based on the above architecture, the cloud server can provide image processing tasks for multiple Android systems. However, each instruction related to image rendering, synthesis, display, etc. generated in the Android system needs to be intercepted by the graphics instruction interception layer 1018 and converted by the instruction conversion layer 1012, resulting in a very large CPU overhead for the server. Summary of the invention
[0011] The solutions provided in the present application are described below through different aspects. It can be understood that the implementation methods and beneficial effects of different aspects can be referenced to each other.
[0012] The embodiment of the present invention discloses an image processing method and a computer system. The solution of the embodiment of the present invention can reduce processor overhead and improve image processing efficiency.
[0013] In a first aspect, an embodiment of the present application provides an image processing method, which is applied to a computer system, such as a server, wherein the server includes a host operating system and a first client operating system, wherein the host operating system is installed with a kernel-mode graphics driver, and each of the client operating systems is installed with an application and a user-mode graphics driver; the method includes: an application with image processing requirements in the first client operating system initiates a first API application programming interface (API) call request through a graphics instruction layer, wherein the first API call request is used to request execution of an image rendering operation; wherein the first client operating system can be any one of a plurality of client operating systems deployed on the server; the user-mode graphics driver in the first client operating system generates a first instruction recognizable by the graphics processor according to the first API call request, and sends the first instruction to the kernel-mode graphics driver; the kernel-mode graphics driver controls the graphics processor to execute image rendering according to the first instruction.
[0014] It should be noted that in some virtualized computer architectures, the client operating system can also be understood as being deployed inside the host operating system.
[0015] By adopting the above method, the user-mode graphics driver is deployed on the client operating system, and the kernel-mode graphics driver is deployed on the host operating system outside the client operating system. Since the commands generated by the user-mode graphics driver can be directly submitted to the GPU for execution by the kernel-mode graphics driver, there is no need to deploy an additional instruction conversion layer for converting commands between the client operating system and the host operating system. Therefore, there is no need for the instruction conversion layer to perform instruction conversion operations, which significantly saves server overhead, simplifies the image processing (such as rendering) process as a whole, and improves image processing efficiency.
[0016] Even if the client operating system on the server is updated, the commands generated by the user-mode graphics driver on the client operating system can still be directly recognized by the kernel-mode graphics driver on the host operating system. Therefore, compared with traditional practices, it can save the update and maintenance of the instruction conversion layer, further saving server costs. It is understandable that the saved costs can support the deployment of more client operating systems on the server, thereby increasing the concurrency of the server.
[0017] In combination with the first aspect, in a first possible implementation of the first aspect, each client operating system also includes an image synthesizer (also referred to as a synthesizer for short) and an image capture program, and the method also includes: if the image capture program is in an enabled state, the image synthesizer performs image synthesis operations on the multiple layers rendered by the graphics processor; if the image capture program is in a disabled state, the image synthesizer does not perform image synthesis operations on the multiple layers.
[0018] It can be seen that through the above on-demand execution of image synthesis strategy, the image synthesis task is not executed when the image capture program is in a disabled state, which significantly reduces the server overhead and enables the server to apply more computing power to other Android operating systems in need, thereby improving the overall performance of the cloud server.
[0019] In combination with the first aspect, or any of the above possible implementations of the first aspect, in a second possible implementation of the first aspect, if the image capture program is in an enabled state, the rate at which the image synthesizer performs image synthesis is the same as the rate at which the image capture program performs image capture.
[0020] In this way, the image synthesis task is reduced as much as possible while ensuring the needs of the image capture program, thereby minimizing the server overhead and allowing the server to apply more computing power to other Android operating systems in need, thereby improving the overall performance of the cloud server.
[0021] In combination with the first aspect, or any of the above possible implementations of the first aspect, in a third possible implementation of the first aspect, if the image grabbing program is in an enabled state, the method also includes: the image grabbing program grabbing the composite image synthesized by the image synthesizer; the image grabbing program encoding and compressing the composite image; the image grabbing program sending the image data obtained by encoding and compression to a remote end.
[0022] In combination with the first aspect, or any of the above possible implementations of the first aspect, in a fourth possible implementation of the first aspect, the server also includes an image encoder; if the image capture program is in an enabled state, the method also includes: the image encoder encodes and compresses the composite image synthesized by the image synthesizer; the image capture program captures the encoded and compressed image data; and the image capture program sends the image data to a remote end.
[0023] In combination with the first aspect, or any of the above possible implementations of the first aspect, in a fifth possible implementation of the first aspect, the image synthesizer performs an image synthesis operation on the multiple layers rendered by the graphics processor, including: the image synthesizer reads the multiple layers rendered by the graphics processor; the image synthesizer general buffer manager sends an image synthesis instruction to the user-state graphics driver, and the image synthesis instruction is used to request to perform an image synthesis operation on the multiple layers; the user-state graphics driver generates a second instruction recognizable by the graphics processor according to the image synthesis instruction, and sends it to the kernel-state graphics driver; the kernel-state graphics driver controls the graphics processor to perform image synthesis operations on the multiple layers according to the second instruction.
[0024] In a second aspect, an embodiment of the present application provides an image processing method, which is applied to a computer system, wherein the computer system includes a host operating system and a first client operating system, wherein the host operating system has a kernel-mode graphics driver installed, and the first client operating system has an application and a user-mode graphics driver deployed; the method includes: initiating a first API call request through the application, wherein the first API call request is used to request execution of an image rendering operation; generating, through the user-mode graphics driver, a first instruction recognizable by the graphics processor according to the first API call request, and sending the first instruction to the kernel-mode graphics driver; and controlling, through the kernel-mode graphics driver, the graphics processor to execute image rendering according to the first instruction.
[0025] On a host operating system other than a client operating system, since the commands generated by the user-mode graphics driver can be directly submitted to the GPU for execution by the kernel-mode graphics driver, there is no need to deploy an additional instruction conversion layer for converting commands between the client operating system and the host operating system. Therefore, there is no need for an instruction conversion layer to perform instruction conversion operations, which significantly saves server overhead and simplifies the image processing (such as rendering) process as a whole, improving image processing efficiency.
[0026] Even if the client operating system on the server is updated, the commands generated by the user-mode graphics driver on the client operating system can still be directly recognized by the kernel-mode graphics driver on the host operating system. Therefore, compared with traditional practices, it can save the update and maintenance of the instruction conversion layer, further saving server costs. It is understandable that the saved costs can support the deployment of more client operating systems on the server, thereby increasing the concurrency of the server.
[0027] In combination with the second aspect, in a first possible implementation of the second aspect, the first client operating system also includes an image synthesizer and an image capture program, and the method also includes: determining through the image synthesizer that the image capture program is in an enabled state, and performing image synthesis operations on multiple layers rendered by the graphics processor through the image synthesizer.
[0028] In combination with the second aspect, in a first possible implementation manner of the second aspect, the image synthesizer determines that the image capture program is in a disabled state, and the image synthesizer does not perform image synthesis operations on the multiple layers.
[0029] It can be seen that through the above on-demand execution of image synthesis strategy, the image synthesis task is not executed when the image capture program is in a disabled state, which significantly reduces the server overhead and enables the server to apply more computing power to other Android operating systems in need, thereby improving the overall performance of the cloud server.
[0030] In combination with the second aspect, or any possible implementation of the second aspect mentioned above, in the second possible implementation of the second aspect, before determining the status of the image grabbing program through the image synthesizer, it also includes: registering status information to the synthesizer through the image grabbing program, and the status information is used to characterize whether the image grabbing program is in an enabled state or in a disabled state.
[0031] In combination with the second aspect, or any one of the above possible implementations of the second aspect, in a third possible implementation of the second aspect, if the image capture program is in an enabled state, a rate at which image synthesis is performed by the image synthesizer is the same as a rate at which image capture is performed by the image capture program.
[0032] In this way, the image synthesis task is reduced as much as possible while ensuring the needs of the image capture program, thereby minimizing the server overhead and allowing the server to apply more computing power to other Android operating systems in need, thereby improving the overall performance of the cloud server.
[0033] In combination with the second aspect, or any one of the above possible implementations of the second aspect, in a fourth possible implementation of the second aspect, if the image capture program is in an enabled state, the method further includes: capturing the composite image synthesized by the image synthesizer through the image capture program; encoding and compressing the composite image through the image capture program; and sending the image data obtained by encoding and compression to a remote end through the image capture program.
[0034] In combination with the second aspect, or any one of the above possible implementations of the second aspect, in a fifth possible implementation of the second aspect, the computer system also includes an image encoder; if the image capture program is in an enabled state, the method also includes: encoding and compressing the composite image synthesized by the image synthesizer through the image encoder; capturing the encoded and compressed image data through the image capture program; and sending the image data to a remote end through the image capture program.
[0035] In combination with the second aspect, or any one of the above-mentioned possible implementations of the second aspect, in a sixth possible implementation of the second aspect, the image synthesis operation is performed on the multiple layers rendered by the graphics processor by the image synthesizer, including: reading the multiple layers rendered by the graphics processor by the image synthesizer; sending an image synthesis instruction to a user-state graphics driver through the image synthesizer general buffer manager, wherein the image synthesis instruction is used to request to perform an image synthesis operation on the multiple layers; generating a second instruction recognizable by the graphics processor according to the image synthesis instruction by the user-state graphics driver, and sending it to the kernel-state graphics driver; and controlling the graphics processor to perform an image synthesis operation on the multiple layers according to the second instruction by the kernel-state graphics driver.
[0036] In a third aspect, an embodiment of the present application provides a computer system, characterized in that a host operating system is deployed on the computer system, a kernel-mode graphics driver and a first client operating system are deployed in the host operating system, and an application and a user-mode graphics driver are deployed in the first client operating system, wherein: the user-mode graphics driver is used to: receive a first API call request from the application, the first API call request is used to request to perform an image rendering operation; generate a first instruction recognizable by the graphics processor according to the first API call request, and send it to the kernel-mode graphics driver; the kernel-mode graphics driver is used to: control the graphics processor to perform an image rendering operation according to the first instruction. .
[0037] In the above-mentioned server, the user-mode graphics driver is deployed on the client operating system, and the kernel-mode graphics driver is deployed on the host operating system outside the client operating system. Since the commands generated by the user-mode graphics driver can be directly submitted to the GPU for execution by the kernel-mode graphics driver, there is no need to deploy an additional instruction conversion layer for converting commands between the client operating system and the host operating system. Therefore, there is no need for the instruction conversion layer to perform instruction conversion operations, which significantly saves server overhead and simplifies the image processing (such as rendering) process as a whole, thereby improving image processing efficiency. At the same time, even if the client operating system on the server is updated, the commands generated by the user-mode graphics driver on the client operating system can still be directly recognized by the kernel-mode graphics driver on the host operating system. Therefore, compared with traditional practices, the update and maintenance of the instruction conversion layer can be omitted, further saving server overhead. It can be understood that the saved overhead can support the server to deploy more client operating systems, thereby increasing the concurrency of the server.
[0038] In combination with the third aspect, in a first possible implementation of the third aspect, the first client operating system also includes an image synthesizer and an image grabbing program, wherein: the image synthesizer is used to determine the status of the image grabbing program; the image synthesizer is used to perform image synthesis operations on the multiple layers rendered by the graphics processor when the image grabbing program is in an enabled state; the image synthesizer is used to not perform image synthesis operations on the multiple layers when the image grabbing program is in a disabled state.
[0039] It can be seen that through the above on-demand execution of image synthesis strategy, the image synthesis task is not executed when the image capture program is in a disabled state, which significantly reduces the server overhead and enables the server to apply more computing power to other Android operating systems in need, thereby improving the overall performance of the cloud server.
[0040] In combination with the third aspect, or any possible implementation of the third aspect mentioned above, in a second possible implementation of the third aspect, the image grabbing program is used to register status information with the image synthesizer before the image synthesizer determines the status of the image grabbing program, and the status information is used to characterize whether the image grabbing program is in an enabled state or a disabled state.
[0041] In combination with the third aspect, or any possible implementation of the third aspect mentioned above, in a third possible implementation of the third aspect, if the image capture program is in an enabled state, the rate at which the image synthesizer performs image synthesis is the same as the rate at which the image capture program performs image capture.
[0042] In this way, the image synthesis task is reduced as much as possible while ensuring the needs of the image capture program, thereby minimizing the server overhead and allowing the server to apply more computing power to other Android operating systems in need, thereby improving the overall performance of the cloud server.
[0043] In combination with the third aspect, or any of the above-mentioned possible implementations of the third aspect, in a fourth possible implementation of the third aspect, the image grabbing program is used to grab the composite image synthesized by the image synthesizer when the image grabbing program is in an enabled state, encode and compress the composite image, and send the image data obtained by encoding and compression to a remote end.
[0044] In combination with the third aspect, or any of the above possible implementations of the third aspect, in a fifth possible implementation of the third aspect, the server also includes an image encoder: the image encoder is used to encode and compress the composite image synthesized by the image synthesizer when the image capture program is in an enabled state; the image capture program is used to capture the encoded and compressed image data, and send the image data to a remote end.
[0045] In combination with the third aspect, or any of the foregoing possible implementations of the third aspect, in a sixth possible implementation of the third aspect, the image synthesizer is used to perform an image synthesis operation on the multiple layers layer rendered by the graphics processor when the image capture program is in an enabled state, specifically:
[0046] The image synthesizer is used to read the multiple layers rendered by the graphics processor when the image capture program is enabled; the image synthesizer is used for the general buffer manager to send an image synthesis instruction to the user-state graphics driver, and the image synthesis instruction is used to request to perform an image synthesis operation on the multiple layers; the user-state graphics driver is used to generate a second instruction recognizable by the graphics processor according to the image synthesis instruction, and send it to the kernel-state graphics driver; the kernel-state graphics driver is used to control the graphics processor to perform an image synthesis operation on the multiple layers according to the second instruction.
[0047] In a fourth aspect, an embodiment of the present application provides a server, comprising a first processor, a memory, and a graphics processor, wherein: the memory is used to store program codes and data required when a host operating system is running, and the processor is used to run the host operating system to control the graphics processor to implement the method described in the first aspect or any possible implementation of the first aspect.
[0048] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, which is used to store program code (or computer-readable instructions). When the program code runs on one or more processors, it implements the method described in any of the foregoing aspects.
[0049] In a sixth aspect, an embodiment of the present application provides a computer program product (or computer program), which is used to store program code (or computer-readable instructions), and when the program code runs on one or more processors, it implements the method described in any of the foregoing aspects.
[0050] By implementing the embodiments of the present invention, the user-mode graphics driver is deployed on the client operating system, and the kernel-mode graphics driver is deployed on the host operating system outside the client operating system. Since the commands generated by the user-mode graphics driver can be directly submitted to the GPU for execution by the kernel-mode graphics driver, there is no need to deploy an additional instruction conversion layer for converting commands between the client operating system and the host operating system. Therefore, there is no need for the instruction conversion layer to perform instruction conversion operations, which significantly saves server overhead and simplifies the image processing (such as rendering) process as a whole, thereby improving image processing efficiency. At the same time, even if the client operating system on the server is updated, the commands generated by the user-mode graphics driver on the client operating system can still be directly recognized by the kernel-mode graphics driver on the host operating system. Therefore, compared with traditional practices, the update and maintenance of the instruction conversion layer can be omitted, further saving server overhead. It can be understood that the saved overhead can support the deployment of more client operating systems on the server, thereby improving the concurrency of the server. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 It is a schematic diagram of the architecture of a server in the prior art;
[0052] Figure 2 This is a schematic diagram of a cloud server operation scenario provided by an embodiment of the present invention;
[0053] Figure 3 It is a schematic diagram of the architecture of a server provided by an embodiment of the present invention;
[0054] Figure 4 is a flowchart of an image processing method provided by an embodiment of the present invention;
[0055] Figure 5 is a schematic diagram of a process of image synthesis and capture provided by an embodiment of the present invention;
[0056] Figure 6 is another schematic diagram of a process of image synthesis and capture provided by an embodiment of the present invention;
[0057] Figure 7 is a schematic diagram of an application scenario of a captured image provided by an embodiment of the present invention;
[0058] Figure 8 It is a schematic diagram of another application scenario of a captured image provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0059] The technical solutions in the embodiments of the present invention will be described below with reference to the accompanying drawings.
[0060] See also Figure 2 , Figure 2 is a schematic diagram of a computer system operation scenario provided by an embodiment of the present application, Figure 2 The computer system 200 in the embodiment can provide services for multiple user terminals 201 at the same time. Specifically, a host operating system 204 is installed on the computer system 200, and multiple client operating systems 203 are installed on the host operating system, and an application 202 is installed on each client operating system. The host operating system 204 can allocate hardware resources such as a first processor 205, a memory 206, and a graphics processor 207 to each client operating system 203, so that each client operating system 203 runs relatively independently, which is equivalent to each client operating system 203 running on different hardware devices. Each client operating system 203 on the computer system 200 can provide services for different user terminals 201 respectively, and each user terminal 201 can be installed with a client operating system 203 (or other operating systems different from the client operating system 203), or may not be installed with a client operating system 203. Since the computer system 200 provides the user terminal 201 with the interface and functions of the client operating system 203, from the user's perspective, the user terminal 201 is a terminal that can implement the functions of the client operating system. For example, when the client operating system 203 is an Android system, from the user's perspective, the user terminal 201 is equivalent to a terminal that can realize the functions of an Android phone. When the terminal is a mobile phone, the terminal can also be called a cloud phone.
[0061] The terminal mentioned in this embodiment may be, but is not limited to, a laptop computer, a desktop computer, a mobile phone, a smart phone, a tablet computer, a multimedia player, an e-reader, a smart vehicle device, a smart home appliance, an artificial intelligence device, a wearable device, an Internet of Things device, or a virtual reality / augmented reality / mixed reality device, etc.
[0062] The computer system 200 may be a server, a server cluster consisting of multiple servers, or other hardware devices with computing capabilities. The server may be an ARM (Advanced RISC Machine) architecture server, or a server of other architecture types. Figure 3 The computer system 200 is described in detail. The hardware layer of the computer system 200 includes a first processor 205, a memory 206, a graphics processor 207, and a communication interface 208. The software layer of the computer system 200 includes a host operating system 204, wherein:
[0063] The memory 206 includes, but is not limited to, random access memory (RAM), read-only memory (ROM), erasable programmable read only memory (EPROM), or portable read only memory (CD-ROM). The memory 206 is used to store relevant program instructions and data for the first processor 205 and / or the graphics processing unit (GPU) 207 to read, and to store (or cache) data generated by the operation of the first processor 205 and / or the graphics processor; it may also store data in other ways.
[0064] The first processor 205 may be one or more central processing units (CPUs). When the first processor 205 is a CPU, the first processor 205 may be a single-core processor or a multi-core processor. Of course, the first processor 205 may also be other circuits or chips with computing capabilities. The first processor 205 is capable of running a host operating system and processing various tasks (or events) generated on the host operating system, including processing tasks requested by a client operating system on the host operating system, such as the execution of image-related processing strategies.
[0065] There may be one or more graphics processors 207. When there is one graphics processor 207, the graphics processor 207 may be a single-core processor or a multi-core processor. The graphics processor 207 can process some tasks (or events) related to image processing generated on the host operating system, including image processing tasks requested by the client operating system 203 (specifically, image processing tasks generated by the application 202), such as image rendering, image synthesis, migration of synthesized image data, etc.
[0066] It should be noted that a host operating system runs on the first processor, and a client operating system runs on the host operating system. The client operating system can also be understood as an application program on the host operating system.
[0067] The communication interface 208 is used to receive data sent by devices outside the computer system 200, for example, receiving a call instruction from the user terminal 201 to the client operating system 203; the communication interface 208 is also used to send data to devices outside the computer system 200, for example, after the computer system 200 completes image processing, it sends the processed data to the user terminal 201. Optionally, the communication interface 208 receives and sends data under the control of the first processor 205. The communication mode of the communication interface 208 can be wired communication or wireless communication (for example, communication through wireless fidelity WI-FI, Bluetooth, etc.).
[0068] The host operating system 204 can be a Linux system, or other operating systems. The host operating system 204 installs a kernel mode graphics driver 209 (such as a kernel mode graphic driver) and multiple client operating systems 203. In an embodiment of the present application, the client operating system can be an Android system, or it can be other types of Linux systems, or other operating systems. For ease of understanding, the subsequent examples are uniformly explained using the Android system as an example. Among them, each client operating system 203 installs an application 202 with image processing requirements (such as game applications, video production applications, etc.), a graphics instruction layer 212 (such as Android graphic API), a user mode graphics driver 213 (such as Android usermode graphic driver), a display system 211 (such as Surface Flinger (Android display system)), a synthesizer (composition) 214 and an image capture program 215 (such as Image Capture).
[0069] It can be seen that, unlike the conventional method of deploying both the user-mode graphics driver 213 and the kernel-mode graphics driver 209 on the client operating system 203, or deploying both the user-mode graphics driver 213 and the kernel-mode graphics driver 209 on the host operating system 204, the embodiment of the present application deploys the user-mode graphics driver 213 on the client operating system 203, and deploys the kernel-mode graphics driver 209 on the host operating system 204. Since the commands (or instructions) generated by the user-mode graphics driver 213 can be directly submitted to the graphics processor GPU for execution by the kernel-mode graphics driver 209, there is no need to deploy an additional instruction conversion layer for converting commands between the client operating system 203 and the host operating system, and therefore, there is no need for the instruction conversion layer to perform instruction conversion operations, which significantly saves the overhead of the first processor in the computer system 200, simplifies the image processing (such as rendering) process as a whole, and improves the image processing efficiency. At the same time, even if the client operating system 203 on the computer system 200 is updated, the commands generated by the user-mode graphics driver 213 on the client operating system 203 can still be directly recognized by the kernel-mode graphics driver 209 on the host operating system 204. Therefore, compared with traditional practices, it is possible to save the update and maintenance of the instruction conversion layer, further saving the overhead of the first processor in the computer system 200; it can be understood that the saved overhead can support the computer system 200 to deploy more client operating systems, that is, improve the concurrency of the computer system.
[0070] In addition, unlike the traditional method of deploying the image grabber program 215 on the host operating system 204, the embodiment of the present application deploys the image grabber program on the client operating system 203, so that the image grabber program 215 can be directly connected to the synthesizer 214, so that the synthesizer can perform image synthesis operations on demand according to the image data capture capability of the image grabber program 215, thereby reducing unnecessary computing operations and reducing the image processing pressure of the graphics processor 207.
[0071] The above is an overall introduction to the application scenario and computer system architecture of the embodiment of the present application. The following describes how the computer system performs image processing based on the application scenario and architecture. Figure 4 The embodiment shown, Figure 4 It is a flowchart of an image method provided by an embodiment of the present invention, and the method includes but is not limited to the following steps.
[0072] Step S401: an application program in a first client operating system initiates a first API call request.
[0073] Specifically, the first client operating system is any one of the multiple client operating systems, that is, any one of the multiple client operating systems has the characteristics of the first client operating system here. The application is an application with image processing requirements, such as a game application, a video production application, and the like. The application, if the application wants to achieve a certain image rendering target, can generate corresponding image rendering parameters, and initiate a first API call request through the graphics instruction layer, and the first API call request is used to request to perform an image rendering operation. The understanding of the first API call request can be expanded, for example, it is considered that the first API call request contains image rendering parameters.
[0074] Step S402: the user-mode graphics driver in the first client operating system generates a first instruction recognizable by the graphics processor according to the first API call request, and sends the first instruction to the kernel-mode graphics driver.
[0075] Specifically, the user-mode graphics driver can be implemented in a variety of ways, such as AMD (Advanced MicroDevices), Intel (Intel), and Nvidia, and is mainly responsible for converting and packaging data, status, instructions (or commands), etc. into instructions that can be recognized by the hardware. In the embodiment of the present application, after the user-mode graphics driver obtains the first API call request and the above-mentioned image rendering parameters, it generates instructions that can be recognized by the graphics processor according to the first API and the image rendering parameters, and packages and sends them to the kernel-mode graphics driver.
[0076] Step S403: the kernel-mode graphics driver controls the graphics processor to perform an image rendering operation according to the first instruction.
[0077] Specifically, since the first instruction is an instruction that complies with the graphics processor operating specification, the kernel-mode graphics driver can control the graphics processor according to the first instruction. Accordingly, the graphics processor performs image rendering operations under the control of the kernel-mode graphics driver, thereby achieving the image rendering goal of the above-mentioned application. It should be noted that after the graphics processor performs the image rendering operation, multiple layers will be obtained, and these multiple layers can be stored (for example, stored in a cache) for subsequent calls. It can be understood that the kernel-mode graphics driver can be configured with multiple logical interfaces, which are used to connect to user-mode graphics drivers on different client operating systems.
[0078] Step S404: If the image capture program is in an enabled state, the synthesizer performs an image synthesis operation on the multiple layers rendered by the graphics processor.
[0079] Specifically, the image grabber program is pre-registered on the image synthesizer, so the image synthesizer can determine whether the image grabber program is in an enabled state based on the registration information of the image grabber program. For example, the image grabber program sets a flag through the interface provided by the image synthesizer. When the value of the flag is set to 1, it indicates that the image grabber program is in an enabled state. When the value of the flag is set to 0, it indicates that the image grabber program is in a disabled state.
[0080] If the image capture program is in an enabled state, the image synthesizer performs an image synthesis operation on the multiple layers rendered by the graphics processor, which is described below with two examples.
[0081] Case 1: Image synthesis Figure 5 As shown, it may specifically include:
[0082] 1. The display system (such as Surface Flinger) triggers the image synthesizer (composition) to perform main screen synthesis according to the frequency of vertical synchronization (VSYNC) that the image capture program wants to obtain. For example, if VSYNC is set to 30 frames per second, the image synthesizer needs to perform 30 synthesis operations per second. Optionally, the image synthesizer performs image synthesis at the same rate as the image capture program performs image capture.
[0083] 2. The compositor (e.g., through the function module hwc_prepare) performs preprocessing on the above multiple layers. The preprocessing process determines which layers need to be synthesized by the GPU and marks these layers as being to be synthesized. The hwc in hwc_prepare in the example is the abbreviation of hardware composer.
[0084] 3. The synthesizer (such as through the functional module hwc_set) synthesizes the multiple layers after preprocessing into a buffer (framebuffer, FB) through the graphics processor GPU, for example, into a dual FB, or more precisely, synthesizes the layers marked to be synthesized into the FB. Specifically, the image synthesizer sends an image synthesis instruction through an embedded system OpenGL (OpenGL for Embedded Systems, GLES) interface in a graphics instruction layer (graphic API) to request to perform an image synthesis operation; accordingly, the user-state graphics driver converts the image synthesis instruction into a second instruction recognizable by the graphics processor, and the kernel-state graphics driver controls the graphics processor to perform an image synthesis operation on the multiple layers according to the second instruction, and the graphics processor caches the image synthesis result into a dual graphics buffer FB.
[0085] 4. The synthesizer obtains the lock of the buffer buffer. If the lock is successfully obtained, the image synthesis result data in the lock of the dual graphics buffer FB is copied to the buffer buffer of the memory through direct memory access (DMA). This process is actually completed by the cooperation of the GPU, and specifically includes the following operations: the synthesizer sends a data migration instruction through the generic buffer manager (gbm) interface in the graphics instruction layer (graphic API) to request that the image synthesis data in the GPU's video memory be migrated to the memory; accordingly, the user-state graphics driver converts the data migration instruction into a third instruction that the GPU can recognize, and the kernel-state graphics driver controls the graphics processor to migrate the image synthesis data in the graphics processor's video memory to the memory according to the third instruction.
[0086] Correspondingly, after the synthesizer completes the image synthesis with the cooperation of the graphics processor and migrates the image synthesis data to the memory, it sends a notification event to the image capture program to inform that the image synthesis is completed and the image synthesis data is migrated to the memory.
[0087] 5. After receiving the notification event, the image grabber acquires the buffer lock, reads the image synthesis data in the buffer (i.e., grabs the synthesized image synthesized by the image synthesizer), encodes and compresses the image synthesis data (i.e., the synthesized image), and then sends the encoded and compressed image data to the remote end, for example, to Figure 2 The user terminal 201 is shown. It can be understood that the coding compression performed by the image capture program belongs to the software implementation mode. Of course, the image capture program may not perform the coding compression operation, but directly send the captured image synthesis data to the remote end.
[0088] Case 2: Image synthesis Figure 6 As shown, it may specifically include:
[0089] 1. The display system (such as Surface Flinger) triggers the image synthesizer (composition) to perform main screen synthesis according to the frequency of vertical synchronization (VSYNC) that the image capture program wants to obtain. For example, if VSYNC is set to 30 frames per second, the image synthesizer needs to perform 30 synthesis operations per second. Optionally, the image synthesizer performs image synthesis at the same rate as the image capture program performs image capture.
[0090] 2. The synthesizer (e.g., through the function module hwc_prepare) performs preprocessing on the above multiple layers. The preprocessing process determines which layers need to be synthesized by the GPU and marks these determined layers as to be synthesized.
[0091] 3. The synthesizer (such as through the functional module hwc_set) synthesizes the multiple layers after preprocessing into the dual graphics buffer (framebuffer, FB) through the graphics processor GPU, more precisely, the layers marked to be synthesized are synthesized into FB. Specifically, the image synthesizer sends an image synthesis instruction through the GLES interface in the graphics instruction layer (graphic API) to request to perform an image synthesis operation; accordingly, the user-state graphics driver converts the image synthesis instruction into a second instruction recognizable by the graphics processor, and the kernel-state graphics driver controls the graphics processor to perform the image synthesis operation on the multiple layers according to the second instruction, and the graphics processor caches the image synthesis result into the dual graphics buffer FB.
[0092] 4. The synthesizer acquires the lock of the buffer buffer. If the lock is acquired successfully, the image synthesis result data in the lock of the dual graphics buffer FB is encoded and compressed by an encoder (for example, an H264 encoder, an H265 encoder, etc.).
[0093] 5. The encoder stores the image data obtained by encoding and compression in the buffer of the memory, releases the buffer lock after the encoding and compression is completed, and issues a notification event to inform that the synthesized, encoded and compressed data of the image has been migrated to the memory.
[0094] 6. After receiving the notification event, the image capture program acquires the buffer lock, reads the synthesized, encoded and compressed data in the buffer (i.e., captures the synthesized image synthesized by the image synthesizer), and sends the captured image data to the remote end, for example, to Figure 2 In order to better understand the present embodiment, a possible scenario is provided below to describe the process of sending the captured image data to the remote user terminal 201. Figure 7 As shown, the access gateway is used to authenticate and authorize the user terminal, and the user terminal is used to cooperate with the access gateway for authentication and authorization through the software development kit (Software Development Kit, SDK), and after the authentication and authorization are passed, the SDK is used to establish a connection with the elastic IP address (elastic IP, EIP) on the cloud, and is also used to decode the video stream from the computer system through the SDK. In addition, the user terminal is also used to decode the audio stream through the SDK, and to send operation instructions (such as touch, mouse movement, etc.) to the client operating system through the SDK (optionally, the client operating system deployed on the computer system can be regarded as a cloud phone). In an embodiment of the present application, after the image capture program in the client operating system in the computer system captures the image data, the image data is sent to the VPC internal network through the open virtual switch (open virtual switch, OVS) and 10GE (belonging to the physical network card), and the network address translation (Network Address Translation, NAT) gateway in the same VPC network sends the image data to the user terminal through the EIP, and the user terminal decodes it.
[0095] For the above step 5, the computer system may not have an encoder. In this case, the image data sent to the user terminal 201 through step 6 is unencoded image data. In view of this situation, a possible scenario is provided below to describe the process of sending the captured image data to the remote user terminal 201. Figure 8As shown, the access gateway is used to authenticate and authorize the user terminal, and the user terminal is used to cooperate with the access gateway for authentication and authorization through the software development kit (Software Development Kit, SDK). After the authentication and authorization are passed, the SDK is used to establish a connection with the elastic IP address (elastic IP, EIP), and is also used to decode the video stream from the computer system through the SDK. In addition, the user terminal is also used to decode the audio stream through the SDK, and to send operation instructions (such as touch, mouse movement, etc.) to the client operating system through the SDK (optionally, the client operating system deployed on the computer system can be regarded as a cloud phone). In an embodiment of the present application, after the image capture program in the client operating system in the computer system captures the image data, the image data is sent to the VPC internal network through OVS and 10GE (belonging to the physical network card). The ECS computer system in the same VPC network is deployed with a coding engine, which can encode the image data sent by the computer system and send the encoded image data to the user terminal through EIP, and the user terminal decodes it.
[0096] Step S405: If the image capture program is in a disabled state, the image synthesizer does not perform image synthesis operations on the multiple layers. For example, VYSNC uses a default value setting and does not perform Figure 5 , 7 Steps shown.
[0097] Through the above-mentioned strategy of executing image synthesis on demand, the image synthesis task is not executed when the image capture program is in a disabled state, which significantly reduces the overhead of the graphics processor and the first processor, allowing the graphics processor and the first processor to apply more computing power to other Android operating systems in need, thereby improving the overall performance of the cloud computer system.
[0098] As shown in Table 1, Table 1 illustrates the comparison between the number of client operating systems supported by the cloud computer system provided by an embodiment of the present invention and the number of client operating systems supported by the cloud computer system of the traditional solution when the client operating system (taking the Android system as an example) runs the same application program in actual tests.
[0099] Table 1
[0100] Traditional Solution Embodiments of the present invention Running "My Name is MT4" on Android Route 30 60+Road Running "Wendao" on Android system Route 90 120+Roads
[0101] It can be seen from Table 1 that when the application running on the Android system is "My Name is MT4", the cloud computer system of the traditional solution can support 30 Android systems in parallel, while the embodiment of the present application can support more than 60 Android systems in parallel; when the application running on the Android system is "Wendao", the cloud computer system of the traditional solution can support 90 Android systems in parallel, while the embodiment of the present application can support more than 120 Android systems in parallel.
[0102] exist Figure 4 In the described method, a user-mode graphics driver is deployed on a client operating system, and a kernel-mode graphics driver is deployed on a host operating system outside the client operating system. Since the commands generated by the user-mode graphics driver can be directly submitted to the GPU for execution by the kernel-mode graphics driver, there is no need to deploy an additional instruction conversion layer for converting commands between the client operating system and the host operating system. Therefore, there is no need for the instruction conversion layer to perform instruction conversion operations, which significantly saves the overhead of the first processor in the computer system, simplifies the image processing (such as rendering) process as a whole, and improves the image processing efficiency; at the same time, even if the client operating system on the computer system is updated, the commands generated by the user-mode graphics driver on the client operating system can still be directly recognized by the kernel-mode graphics driver on the host operating system. Therefore, compared with traditional practices, the update and maintenance of the instruction conversion layer can be omitted, further saving the overhead of the first processor; it can be understood that the saved overhead can support the computer system to deploy more client operating systems, thereby improving the concurrency of the computer system.
[0103] An embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, and when the computer-readable storage medium is executed on a first processor, the process shown in any of the aforementioned methods is implemented.
[0104] An embodiment of the present invention further provides a computer program product, which implements the process shown in any of the above methods when the computer program product is run on a first processor.
[0105] Those skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by computer programs to instruct related hardware, and the programs can be stored in computer-readable storage media. When the programs are executed, they can include the processes of the above-mentioned method embodiments. The aforementioned storage media include: ROM or random access memory RAM, magnetic disk or optical disk and other media that can store program codes.
Claims
1. An image processing method, characterized in that: The method is applied to a computer system, the computer system includes a host operating system, the host operating system is installed with a kernel-mode graphics driver and a first client operating system, the first client operating system is deployed with a user-mode graphics driver; the method includes: Generate, by a user-state graphics driver, a first instruction recognizable by a graphics processor according to a first application programming interface API call request, and send the first instruction to the kernel-state graphics driver, wherein the first API call request is used to request execution of an image rendering operation; The graphics processor is controlled to perform image rendering according to the first instruction through the kernel-mode graphics driver.
2. The method according to claim 1, characterized in that The first client operating system further includes an image synthesizer and an image grabber program, and the method further includes: The state of the image grabbing program is determined by an image synthesizer; if the image grabbing program is in a disabled state, the image synthesis operation is not performed on the multiple layers.
3. The method according to claim 2, characterized in that Before determining the state of the image grabbing program by the image synthesizer, the method further includes: The state information is registered with the synthesizer through the image grabbing program, and the state information is used to indicate whether the image grabbing program is in an enabled state or a disabled state.
4. The method according to claim 2 or 3, characterized in that: If the image capture program is in an enabled state, the rate at which image synthesis is performed by the image synthesizer is the same as the rate at which image capture is performed by the image capture program.
5. The method according to claim 2 or 3, characterized in that: If the image capture program is in an enabled state, the method further includes: Capturing the composite image synthesized by the image synthesizer through the image capture program; Encoding and compressing the composite image by the image grabbing program; The image data obtained by encoding and compressing is sent to a remote end through the image grabbing program.
6. The method according to claim 2 or 3, characterized in that: The computer system further includes an image encoder; if the image capture program is in an enabled state, the method further includes: Encoding and compressing the synthesized image synthesized by the image synthesizer by the image encoder; Capture the encoded and compressed image data through the image capture program; The image data is sent to a remote end through the image grabbing program.
7. The method according to claim 2 or 3, characterized in that: The performing of an image synthesis operation on the multiple layers rendered by the graphics processor by the image synthesizer includes: Reading multiple layers rendered by the graphics processor through the image synthesizer; Sending an image synthesis instruction to a user-mode graphics driver through the image synthesizer general buffer manager, wherein the image synthesis instruction is used to request to perform an image synthesis operation on the multiple layers; generating, by the user-state graphics driver, a second instruction recognizable by the graphics processor according to the image synthesis instruction, and sending the second instruction to the kernel-state graphics driver; The graphics processor is controlled by the kernel-state graphics driver according to the second instruction to perform image synthesis operations on the multiple layers.
8. A computer system, characterized in that: A host operating system is deployed on the computer system, a kernel-mode graphics driver and a first client operating system are deployed in the host operating system, and a user-mode graphics driver is deployed in the first client operating system, wherein; The user-state graphics driver is used to: receive a first application programming interface API call request, where the first API call request is used to request to perform an image rendering operation; generate a first instruction recognizable by a graphics processor according to the first API call request, and send the first instruction to the kernel-state graphics driver; The kernel-mode graphics driver is used to control the graphics processor to perform image rendering according to the first instruction.
9. The computer system according to claim 8, characterized in that: The first client operating system also includes an image synthesizer and an image grabber, wherein: The image synthesizer is used to determine the status of the image capture program; The image synthesizer is used for not performing image synthesis operation on multiple layers when the image capture program is in a disabled state.
10. The computer system according to claim 9, characterized in that: The image grabbing program is used to register state information with the image synthesizer before the image synthesizer determines the state of the image grabbing program, and the state information is used to indicate whether the image grabbing program is in an enabled state or a disabled state.
11. The computer system according to claim 9 or 10, characterized in that: If the image capture program is in an enabled state, the rate at which the image synthesizer performs image synthesis is the same as the rate at which the image capture program performs image capture.
12. The computer system according to claim 9 or 10, characterized in that: The image grabbing program is used to grab the composite image synthesized by the image synthesizer, encode and compress the composite image, and send the image data obtained by encoding and compressing to a remote end when the image grabbing program is in an enabled state.
13. The computer system according to claim 9 or 10, characterized in that: The computer system also includes an image encoder: The image encoder is used to encode and compress the synthesized image synthesized by the image synthesizer when the image capture program is in an enabled state; The image capture program is used to capture the encoded and compressed image data and send the image data to a remote end.
14. The computer system according to claim 9 or 10, characterized in that: The image synthesizer is used to perform an image synthesis operation on the multiple layers rendered by the graphics processor when the image capture program is in an enabled state, specifically including: The image synthesizer is used to read the multiple layers rendered by the graphics processor when the image capture program is enabled; The image synthesizer is used for the general buffer manager to send an image synthesis instruction to the user-mode graphics driver, wherein the image synthesis instruction is used to request to perform an image synthesis operation on the multiple layers; The user-state graphics driver is used to generate a second instruction recognizable by the graphics processor according to the image synthesis instruction, and send the second instruction to the kernel-state graphics driver; The kernel-mode graphics driver is used to control the graphics processor to perform image synthesis operations on the multiple layers according to the second instruction.
15. A computer system, characterized in that: The computer system comprises a first processor, a memory and a graphics processor, wherein: The memory is used to store computer-readable instructions; The first processor is used to execute the computer-readable instructions to implement the image processing method according to any one of claims 1 to 7; The graphics processor is used to perform image rendering under the control of the first processor.
16. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store computer-readable instructions. When the computer-readable instructions are executed on one or more processors, the image processing method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Server and image processing method thereof
CN102446341A
Para-virtualized asymmetric gpu processors
CN104094224A
Graphics processing unit virtualization method and device
CN108804199A
Apparatus and method for remote display and content protection in a virtualized graphics processing environment
EP3385838A1
Extension To A Hypervisor That Utilizes Graphics Hardware On A Host
US20110050712A1
