Virtual machine image rendering method and device, electronic equipment and storage medium
By obtaining the address of the function to be called on the host machine, the image rendering process is updated and the image is processed directly in the guest machine, which solves the problem of low image rendering efficiency in virtual machines and achieves more efficient image rendering.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- DALIAN JIUZHENG TECH CO LTD
- Filing Date
- 2022-09-14
- Publication Date
- 2026-04-21
AI Technical Summary
In existing technologies, virtual machine image rendering requires asynchronous communication between the client and the host machine, resulting in low rendering efficiency.
By obtaining the address of the function to be called on the host machine, the image rendering process is updated directly on the client machine, and the image to be rendered is processed by running the image rendering process. The target image is then sent directly to the host machine for rendering, reducing the switching frequency between the client machine and the host machine.
It improves the efficiency of virtual machine image rendering and reduces the problem of low rendering efficiency caused by asynchronous communication.
Smart Images

Figure CN115437747B_ABST
Abstract
Description
Technical Field
[0001] This application relates to computer technology, and more particularly to a virtual machine image rendering method, apparatus, electronic device, and storage medium. Background Technology
[0002] A virtual machine is an application that runs on a mobile phone. Inside the application, an independent Android system (guest) is launched, which can achieve resource isolation between the real Android system (host) and the mobile phone.
[0003] In the prior art, when a client uses the interface of an image rendering application program, the data of the image to be rendered needs to be converted through a conversion protocol and then sent to the host machine through a pre-established channel for processing and rendering.
[0004] However, existing technologies require asynchronous communication between the client and the host machine, resulting in low rendering efficiency. Summary of the Invention
[0005] This application provides a virtual machine image rendering method, apparatus, electronic device, and storage medium to improve virtual machine image rendering efficiency.
[0006] In a first aspect, embodiments of this application provide a virtual machine image rendering method, which includes:
[0007] Obtain the address of the function to be called in the host machine;
[0008] Update the image rendering process based on the address of the function to be called;
[0009] By running an image rendering process, the image to be rendered is processed to obtain the target image, which in turn instructs the host machine to render the target image.
[0010] Secondly, embodiments of this application also provide a virtual machine image rendering apparatus, which includes:
[0011] The module for obtaining the address of the function to be called retrieves the address of the function to be called in the host machine.
[0012] The image rendering process update module is used to update the image rendering process based on the address of the function to be called.
[0013] The target image acquisition module is used to process the image to be rendered by running the image rendering process to obtain the target image, so as to instruct the host machine to render the target image.
[0014] Thirdly, embodiments of this application also provide an electronic device, which includes:
[0015] One or more processors;
[0016] Storage device for storing one or more programs;
[0017] When one or more programs are executed by one or more processors, the one or more processors implement any virtual machine image rendering method provided in the embodiments of this application.
[0018] Fourthly, embodiments of this application also provide a storage medium including computer-executable instructions, which, when executed by a computer processor, are used to perform any of the virtual machine image rendering methods provided in embodiments of this application.
[0019] This application obtains the address of the function to be called in the host machine, retrieves the function to be called from the host machine based on the address, and updates the image rendering process accordingly. The client machine can directly call the function to be called in the host machine. By running the image rendering process, the image to be rendered is processed to obtain the target image, which is then sent to the host machine for rendering. The processing of the image to be rendered is implemented in the client machine, and the target image is directly sent to the host machine. The host machine only needs to render the target image, reducing the switching frequency between the client and host machines. Therefore, the technical solution of this application solves the problem of low rendering efficiency caused by asynchronous communication between the client and host machines in existing technologies, achieving the effect of improving image rendering efficiency. Attached Figure Description
[0020] Figure 1 This is a flowchart of a virtual machine image rendering method according to Embodiment 1 of this application;
[0021] Figure 2 This is a flowchart of a virtual machine image rendering method according to Embodiment 2 of this application;
[0022] Figure 3 This is a schematic diagram of the calling flow of a virtual machine function to be called in Embodiment 2 of this application;
[0023] Figure 4 This is a schematic diagram of the structure of a virtual machine image rendering device according to Embodiment 3 of this application;
[0024] Figure 5 This is a schematic diagram of the structure of an electronic device according to Embodiment 4 of this application. Detailed Implementation
[0025] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0026] It should be noted that the terms "first" and "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0027] Example 1
[0028] Figure 1 This is a flowchart of a virtual machine image rendering method provided in Embodiment 1 of this application. This embodiment can be applied to the rendering of images of virtual machines. The method can be executed by a virtual machine image rendering device, which can be implemented in software and / or hardware and specifically configured in an electronic device, such as a mobile phone.
[0029] See Figure 1 The virtual machine image rendering method shown includes the following steps:
[0030] S110. Obtain the address of the function to be called in the host machine.
[0031] A virtual machine is an application software that runs on a mobile phone. Inside the application software, an independent Android system (guest) is launched. This system can achieve resource isolation between itself and the real system of the mobile phone (host).
[0032] The host machine is the Android system of the electronic device where the virtual machine resides. The host provides different types of interfaces for communication based on the different features of the virtual machine's various functions. For example, the virtual machine and the host communicate through different interfaces, such as obtaining function addresses from the host machine to call those functions, and transmitting touch screen commands received by the host to the virtual machine.
[0033] S120. Update the image rendering process based on the address of the function to be called.
[0034] The function to be called is a function that a specific image rendering process on the client machine needs to invoke to render the image. Within an image rendering process, multiple functions need to be called to process the image and achieve rendering. For example, the function to be called could be a page brightness adjustment function, a page control layout function, or a page control function. For example, the image rendering process can be updated by saving the function to be called to the corresponding image rendering process. The function to be called can be retrieved based on its address, and the image rendering process can be updated for subsequent rendering processing of the image based on the function.
[0035] S130. By running the image rendering process, the image to be rendered is processed to obtain the target image, so as to instruct the host machine to render the target image.
[0036] Running the updated image rendering process allows you to process the image to be rendered according to the functions to be called within the updated process, obtaining the target image. The target image is the image rendered by the image rendering process and is used to display in the host machine's user interface. For example, when the image rendering process involves page navigation, the target image is the page after the navigation. After obtaining the target image, it is sent to the host machine, instructing the host machine to render the target image; that is, the host machine's screen displays the target image to the user.
[0037] In existing technologies, the EGL / GLES (OpenGL ES library, a proper noun, a library in the Android system) in the client environment does not perform specific graphics processing functions. It merely performs protocol conversion on the parameters of the upper-layer calls to the ABI (Application Binary Interface) functions and sends them to the host system through a pipeline of the virtual operating system emulator (Quick EMUlator, QEMU). The host machine reads the protocol from the QEMU pipeline, restores it to the specific parameters, and then calls the corresponding ABI function on the host machine.
[0038] The Android system uses the EGL / GLES API to render graphics. Simultaneously, the Android system uses the EGL / GLES library to create an EGL / GLES context and provides a windowing system for EGL / GLES rendering. That is, EGL / GLES calls are used to render the texture of the image to be rendered, and EGL calls are used to display the rendering on the screen. In existing virtual machine technology, both the guest and host machines run Android, and the EGL / GLES ABIs that the virtual machine needs to call exist on the host machine. Therefore, the guest machine can directly call the EGL / GLES-related functions on the host machine, avoiding asynchronous communication between the guest and host machines.
[0039] The technical solution of this embodiment obtains the address of the function to be called in the host machine, retrieves the function to be called from the host machine based on the address, and updates the image rendering process according to the function to be called. The client machine can directly call the function to be called in the host machine. By running the image rendering process, the image to be rendered is processed to obtain the target image, which instructs the host machine to render the target image. The processing of the image to be rendered is implemented in the client machine to obtain the target image, and the target image is directly sent to the host machine. The host machine only needs to render the target image, reducing the switching frequency between the client machine and the host machine. Therefore, the technical solution of this application solves the problem of low rendering efficiency caused by asynchronous communication between the client machine and the host machine in the prior art, and achieves the effect of improving image rendering efficiency.
[0040] Example 2
[0041] Figure 2 This is a flowchart of a virtual machine image rendering method provided in Embodiment 2 of this application. The technical solution of this embodiment is further refined based on the above technical solution.
[0042] Furthermore, "obtaining the address of the function to be called in the host machine" is refined to: "determining the address of the function to be called by traversing the address list of functions in the EGL / GLES shared library in the host machine based on the identification information of the function to be called";
[0043] The phrase "update the image rendering process based on the address of the function to be called" is further refined to "save the address of the function to be called to the image rendering process to update the image rendering process".
[0044] See Figure 2 The virtual machine image rendering method shown includes:
[0045] S210. Based on the identifier information of the function to be called, determine the address of the function to be called by traversing the address list of functions in the EGL / GLES shared library in the host machine.
[0046] The identifier of the function to be called is a unique identifier used to obtain the address of the function. The EGL / GLES shared library can be a function library that can be shared on the host machine, allowing different processes to call it. The address of the function to be called can be used to invoke the corresponding function. The list of function addresses can be a list of all functions contained in the EGL / GLES shared library on the host machine, which can be used to look up function addresses. For example, the list of function addresses may include the function's identifier information, such as the function name, and the function address corresponding to the identifier.
[0047] Specifically, the client's user-kernel (user-space, kernel-space) loads the EGL / GLES shared library into the corresponding process space using dlopen (the name of a computer function used to open the function library); and then looks up the address of the function to be called in the host machine's EGL / GLES shared library by the name of the function in the EGL / GLES shared library.
[0048] S220. Save the address of the function to be called to the image rendering process to update the image rendering process.
[0049] The address of the function to be called is saved to the image rendering process, allowing direct invocation of the function within the image rendering process and enabling updates to the process. For example, a mapping between the function to be called and its corresponding address can be established, and the address of the function to be called can be saved to the image rendering process to update it. Specifically, the address of the function to be called can be used as a variable in the image rendering process, establishing a mapping between the function's identifier and its corresponding address.
[0050] The kernel space stores the code and data of kernel programs, while the user space of a process stores the code and data of user programs. Both kernel space and user space reside in virtual spaces and are mappings to physical addresses. For example, when processes A and B communicate across processes, A's user space sends data to A's kernel space; then A's kernel space sends data to B's kernel space, and finally sends the data to B's user space. Saving the address of the function to be called to the image rendering process allows the updated process to directly process the image without frequently switching between the kernel space and user space of the client and host machines, saving computing resources and improving rendering speed.
[0051] In an optional embodiment, saving the address of the function to be called to the image rendering process to update the image rendering process includes: saving the address of the function to be called as a global variable to the image rendering process.
[0052] Global variables are variables that can be accessed throughout the image rendering process and can be called from any point in the entire process. By storing the address of the function to be called as a global variable in the image rendering process, the function can be called from any point in the process using that address.
[0053] By saving the address of the function to be called as a global variable to the image rendering process, the entire image rendering process can call the address of the function to be called, thus improving programming efficiency.
[0054] See Figure 3 The diagram illustrates the call flow of a virtual machine function, including the following specific steps:
[0055] 1) Implement a virtual device in the user-kernel that can call basic functions such as open, close, and ioctl.
[0056] 2) The user-kernel driver's ioctl function receives instructions sent by the client process, obtains the address of the corresponding function to be called in the host EGL / GLES library through functions such as dlopen or dlsym, and returns the address of the function to be called to the client process.
[0057] 3) Implement a custom EGL / GLES related shared library in the client machine. When the shared library is initialized, open the virtual device in step 1) and use the ioctl function to obtain the address of the function to be called in the host machine's EGL / GLES and store it in a global variable. The address can be obtained in any process in the virtual machine's init process, system service in the virtual machine, or APP in the virtual machine.
[0058] 4) When the client rendering process needs to call rendering-related functions, it can directly obtain the address of the relevant function from the global variable and call it to achieve image rendering.
[0059] S230. By running the image rendering process, the image to be rendered is processed to obtain the target image, so as to instruct the host to render the target image.
[0060] In one optional embodiment, the image to be rendered is processed by running an image rendering process to obtain a target image, which instructs the host machine to render the target image. This includes: running the image rendering process, calling a function to be called to process the image to be rendered to obtain the target image; and saving and sending the target image to the host machine to instruct the host machine to render the target image.
[0061] After the address of the function to be called is saved to the image rendering process, the image rendering process is run. At the location where the function to be called exists, the function to be called is called through the address of the function to be called. The function to be called processes the image to be rendered and obtains the target image.
[0062] The client saves and sends the target image to the host machine, which then renders it. In other words, the host machine displays the target image on its screen, thus refreshing the page on the user's electronic device screen.
[0063] By running an image rendering process, the function to be called is invoked to process the image to be rendered, obtaining the target image. This allows the client to execute the function to be called and obtain the target image. The target image is then saved and sent to the host machine, where it is rendered and displayed. This refreshes the page on the host machine's screen, enabling interaction between the electronic device and the user.
[0064] In an optional embodiment, before saving and sending the target image to the host machine, the method further includes: converting the target image according to the QEMU protocol to update the target image.
[0065] The QEMU protocol can convert target images for rendering the client's target image buffer. For example, the QEMU protocol can convert the target image into integer data, reducing the amount of data transmitted and increasing the transmission rate.
[0066] By converting the target image according to the QEMU protocol, zero-copying of the target image can be achieved. Specifically, according to the Android official documentation, AHardwareBuffer_sendHandleToUnixSocket operates on the AHardwareBuffer parameter as a zero-copy operation. Therefore, the target image buffer can be sent to the rendering process for rendering using the AHardwareBuffer_sendHandleToUnixSocket function.
[0067] By converting the target image according to the QEMU protocol, zero-copy rendering of the target image is achieved, reducing the amount of data transmitted, increasing the transmission rate, and improving the refresh rate of the target image.
[0068] The technical solution of this embodiment improves the accuracy of function invocation by accurately obtaining the corresponding address of the function to be called on the host machine by querying the address of the function to be called in the host machine's shared function library based on the identifier information of the function to be called. Saving the address of the function to be called to the image rendering process allows the client machine's image rendering process to directly call the function to process the image to be rendered and obtain the target image, thus improving the efficiency of image rendering.
[0069] Example 3
[0070] Figure 4 The diagram shown is a schematic representation of a virtual machine image rendering apparatus according to Embodiment 3 of this application. This embodiment is applicable to rendering images of virtual machines. The method can be executed by the virtual machine image rendering apparatus, the specific structure of which is as follows:
[0071] The module 310 for obtaining the address of the function to be called in the host machine obtains the address of the function to be called in the host machine.
[0072] The image rendering process update module 320 is used to update the image rendering process according to the address of the function to be called;
[0073] The target image acquisition module 330 is used to process the image to be rendered by running the image rendering process to obtain the target image, so as to instruct the host machine to render the target image.
[0074] The technical solution of this embodiment obtains the address of the function to be called in the host machine through a function address acquisition module, and retrieves the function to be called from the host machine based on the function address through an image rendering process update module, and updates the image rendering process according to the function to be called. The client machine can directly call the function to be called in the host machine. The target image acquisition module runs the image rendering process, processes the image to be rendered, obtains the target image, and instructs the host machine to render the target image. The processing of the image to be rendered is implemented in the client machine, and the target image is directly sent to the host machine. The host machine only needs to render the target image, reducing the switching frequency between the client machine and the host machine. Therefore, the technical solution of this application solves the problem of low rendering efficiency caused by asynchronous communication between the client machine and the host machine in the prior art, and achieves the effect of improving image rendering efficiency.
[0075] Optionally, the image rendering process update module 320 includes:
[0076] The function address storage unit is used to save the address of the function to be called to the image rendering process in order to update the image rendering process.
[0077] Optionally, the function address storage unit includes:
[0078] The global variable storage sub-unit is used to save the address of the function to be called as a global variable to the image rendering process.
[0079] Optionally, the module 310 for obtaining the address of the function to be called includes:
[0080] The function address list traversal unit is used to determine the address of the function to be called by traversing the function address list in the EGL / GLES shared library in the host machine based on the identification information of the function to be called.
[0081] Optionally, the target image acquisition module 330 includes:
[0082] The image processing unit is used to process the image to be rendered by running the image rendering process and calling the function to be called, so as to obtain the target image.
[0083] The target image sending unit is used to send the target image to the host machine to instruct the host machine to render the target image.
[0084] Optionally, the target image transmitting unit includes:
[0085] The target image update subunit is used to transform the target image according to the QEMU protocol in order to update the target image.
[0086] The virtual machine image rendering apparatus provided in this application embodiment can execute the virtual machine image rendering method provided in any embodiment of this application, and has the corresponding functional modules and beneficial effects for executing the virtual machine image rendering method.
[0087] Example 4
[0088] Figure 5 This is a schematic diagram of the structure of an electronic device provided in Embodiment 4 of this application, as shown below. Figure 5 As shown, the electronic device includes a processor 410, a memory 420, an input device 430, and an output device 440; the number of processors 410 in the electronic device can be one or more. Figure 5 Taking a processor 410 as an example; the processor 410, memory 420, input device 430, and output device 440 in the electronic device can be connected via a bus or other means. Figure 5 Taking the example of a connection between China and Israel via a bus.
[0089] The memory 420, as a computer-readable storage medium, can be used to store software programs, computer-executable programs, and modules, such as the program instructions / modules corresponding to the virtual machine image rendering method in this embodiment (e.g., the function address acquisition module 310, the image rendering process update module 320, and the target image acquisition module 330). The processor 410 executes various functional applications and data processing of the electronic device by running the software programs, instructions, and modules stored in the memory 420, thereby implementing the virtual machine image rendering method described above.
[0090] The memory 420 may primarily include a program storage area and a data storage area. The program storage area may store the operating system and at least one application program required for a given function; the data storage area may store data created based on terminal usage. Furthermore, the memory 420 may include high-speed random access memory and non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 420 may further include memory remotely located relative to the processor 410, which can be connected to the electronic device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0091] Input device 430 can be used to receive input character information and generate key signal inputs related to user settings and function control of the electronic device. Output device 440 may include display devices such as a display screen.
[0092] Example 5
[0093] Embodiment 5 of this application also provides a storage medium containing computer-executable instructions. When executed by a computer processor, the computer-executable instructions are used to execute a virtual machine image rendering method. The method includes: obtaining the address of the function to be called in the host machine; updating the image rendering process according to the address of the function to be called; and processing the image to be rendered by running the image rendering process to obtain a target image, so as to instruct the host machine to render the target image.
[0094] Of course, the computer-executable instructions provided in the embodiments of this application are not limited to the method operations described above, but can also execute related operations in the virtual machine image rendering method provided in any embodiment of this application.
[0095] Based on the above description of the implementation methods, those skilled in the art can clearly understand that this application can be implemented using software and necessary general-purpose hardware, and of course, it can also be implemented using hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk, or optical disk, etc., including several instructions to cause an electronic device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0096] It is worth noting that in the embodiments of the search device described above, the various units and modules included are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the scope of protection of this application.
[0097] Note that the above are merely preferred embodiments and the technical principles employed in this application. Those skilled in the art will understand that this application is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of this application. Therefore, although this application has been described in detail through the above embodiments, this application is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of this application, the scope of which is determined by the scope of the appended claims.
Claims
1. A virtual machine image rendering method, characterized in that, include: Obtain the address of the function to be called in the host machine; Update the image rendering process based on the address of the function to be called; By running the image rendering process, the image to be rendered is processed to obtain the target image, which instructs the host machine to render the target image. The step of obtaining the address of the function to be called in the host machine includes: Based on the identification information of the function to be called, the address of the function to be called is determined by traversing the function address list in the EGL / GLES shared library in the host machine; The step of processing the image to be rendered by running the image rendering process to obtain the target image, and instructing the host machine to render the target image, includes: By running the image rendering process and calling the function to be called, the image to be rendered is processed to obtain the target image; The target image is saved and sent to the host machine to instruct the host machine to render the target image.
2. The method according to claim 1, characterized in that, The step of updating the image rendering process based on the address of the function to be called includes: The address of the function to be called is saved to the image rendering process to update the image rendering process.
3. The method according to claim 2, characterized in that, Saving the address of the function to be called to the image rendering process includes: The address of the function to be called is saved as a global variable in the image rendering process.
4. A virtual machine image rendering apparatus, characterized in that, include: The module for obtaining the address of the function to be called is used to obtain the address of the function to be called in the host machine. The image rendering process update module is used to update the image rendering process according to the address of the function to be called; The target image acquisition module is used to process the image to be rendered by running the image rendering process to obtain the target image, so as to instruct the host machine to render the target image; The module for obtaining the address of the function to be called includes: The function address list traversal unit is used to determine the address of the function to be called by traversing the function address list in the EGL / GLES shared library in the host machine based on the identification information of the function to be called. The target image acquisition module includes: The image processing unit is used to process the image to be rendered by running the image rendering process and calling the function to be called to obtain the target image; The target image sending unit is used to save and send the target image to the host machine to instruct the host machine to render the target image.
5. The apparatus according to claim 4, characterized in that, The image rendering process update module includes: The function address storage unit is used to save the address of the function to be called to the image rendering process in order to update the image rendering process.
6. The apparatus according to claim 5, characterized in that, The function address storage unit includes: The global variable storage subunit is used to save the address of the function to be called as a global variable to the image rendering process.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the virtual machine image rendering method as described in any one of claims 1-3.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements a virtual machine image rendering method as described in any one of claims 1-3.
Citation Information
Patent Citations
Cloud rendering system, server and method
CN105786589A
Abnormal event monitoring method and system for virtual machine operating system
CN112463286A