CN112306712A - Image data transmission method and device based on virtual monitor - Google Patents

Image data transmission method and device based on virtual monitor Download PDF

Info

Publication number
CN112306712A
CN112306712A CN202011188439.3A CN202011188439A CN112306712A CN 112306712 A CN112306712 A CN 112306712A CN 202011188439 A CN202011188439 A CN 202011188439A CN 112306712 A CN112306712 A CN 112306712A
Authority
CN
China
Prior art keywords
image data
virtual
monitor
virtual monitor
machine
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011188439.3A
Other languages
Chinese (zh)
Inventor
梁慧
郭双拴
王旭
杜宏宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Lenovo Beijing Ltd
Original Assignee
Lenovo Beijing Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Lenovo Beijing Ltd filed Critical Lenovo Beijing Ltd
Priority to CN202011188439.3A priority Critical patent/CN112306712A/en
Publication of CN112306712A publication Critical patent/CN112306712A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/541Interprogram communication via adapters, e.g. between incompatible applications
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/545Gui

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Controls And Circuits For Display Device (AREA)

Abstract

The application provides an image data transmission method and device based on a virtual monitor, after an image data sending command generated by a virtual machine is obtained, the image data sending command is responded, acquiring image data matched with the image data sending instruction from a video memory of a video card through a virtual monitor configured in a virtual machine, and sends image data to the physical machine through the virtual monitor, the display card is arranged in the physical machine for assisting the virtual machine to work, and the communication is pre-established between the display card and the virtual monitor, so that the virtual monitor can access the display card of the physical machine, the image data matched with the image data sending instruction is obtained from the video memory of the video card of the physical machine through the virtual monitor, the process that the virtual machine copies the image data from the video memory to the virtual video card is omitted, time consumption caused by copying is saved in the process of sending the image data to the physical machine, and the image data acquisition efficiency is improved.

Description

Image data transmission method and device based on virtual monitor
Technical Field
The application belongs to the technical field of virtual machines, and particularly relates to an image data transmission method and device based on a virtual monitor.
Background
At present, a display card of a physical machine can be transmitted to a virtual machine, the technology is called display card direct connection, and the virtual machine with the display card direct connection can store image data in a display memory of the display card. In the process that the electronic device acquires image data from the virtual machine, the electronic device can only access the virtual display card of the virtual machine, the virtual display card is a storage space allocated by the physical machine in the memory for the virtual machine, the virtual display card and the display card of the physical machine are mutually independent, and the virtual display card cannot access the display memory of the display card, so that if the electronic device acquires the image data from the virtual machine, the virtual machine needs to copy the image data in the display memory of the display card to the virtual display card, and the electronic device can acquire the image data from the virtual machine.
However, in the process of copying the image data from the video memory to the virtual video card by the virtual machine, the time consumed for copying the image data increases with the increase of the data amount of the image data, and particularly, the time consumed for copying the game image data increases rapidly, so that the image data acquisition efficiency is reduced.
Disclosure of Invention
The application provides an image data transmission method and device based on a virtual monitor.
In one aspect, the present application provides a method for transmitting image data based on a virtual monitor, the method comprising:
acquiring an image data sending instruction generated by a virtual machine, wherein the virtual machine is provided with a virtual monitor;
responding to the image data sending instruction, and acquiring image data matched with the image data sending instruction from a video memory of a video card through the virtual monitor, wherein the video card is arranged in a physical machine for assisting the virtual machine to work, and communication is pre-established between the video card and the virtual monitor;
sending, by the virtual monitor, the image data to the physical machine.
Optionally, the method further includes:
configuring the virtual monitor for the virtual machine during the initial configuration process of the virtual machine;
attaching the virtual monitor to the graphics card through proxy middleware of the virtual machine so as to establish communication between the graphics card and the virtual monitor in advance;
if the virtual machine is switched from a power-off state to a power-on state after communication is pre-established between the video card and the virtual monitor, acquiring desktop image data from a video memory of the video card;
and sending the desktop image data to an operating system of the virtual machine so that the operating system of the virtual machine displays a desktop image corresponding to the desktop image data.
Optionally, the attaching the virtual monitor to the graphics card through the proxy middleware of the virtual machine includes:
distributing an extended display identifier to the display card through the proxy middleware;
and determining the expansion display identifier as the identifier of the virtual monitor, and establishing a binding relationship between the graphics card and the virtual monitor through the identifier of the virtual monitor so as to control communication between the graphics card and the virtual monitor through the identifier of the virtual monitor.
Optionally, the method further includes:
determining a front end module of the virtual monitor as a virtual display of the graphics card;
displaying an image corresponding to the image data acquired by the video card from the video memory through the virtual display;
setting a back-end module of the virtual monitor in the physical machine;
the sending, by the virtual monitor, the image data to the physical machine comprises: and sending the image data matched with the image data sending instruction to the physical machine through a back-end module of the virtual monitor.
In another aspect, the present application provides a method for transmitting image data based on a virtual monitor, the method comprising:
receiving image data sent by a virtual monitor of the virtual machine, wherein the image data is obtained from a video memory of a video card through the virtual monitor in the process of responding to an image data sending instruction of the virtual machine, the video card is arranged in a physical machine for assisting the virtual machine to work, and communication is pre-established between the video card and the virtual monitor;
and sending the image data to the electronic equipment.
Optionally, the receiving the image data sent by the virtual monitor of the virtual machine includes:
and receiving image data sent by a back-end module of the virtual monitor, wherein the back-end module of the virtual monitor is arranged in the physical machine.
In still another aspect, the present application provides an image data transmission apparatus based on a virtual monitor, the apparatus including:
the device comprises an acquisition unit, a display unit and a display unit, wherein the acquisition unit is used for acquiring an image data sending instruction generated by a virtual machine, and the virtual machine is provided with a virtual monitor;
the response unit is used for responding to the image data sending instruction, acquiring image data matched with the image data sending instruction from a video memory of a video card through the virtual monitor, wherein the video card is arranged in a physical machine for assisting the virtual machine to work, and communication is pre-established between the video card and the virtual monitor;
a sending unit, configured to send the image data to the physical machine through the virtual monitor.
Optionally, the apparatus further comprises:
a configuration unit, configured to configure the virtual monitor for the virtual machine in an initial configuration process of the virtual machine;
the binding unit is used for attaching the virtual monitor to the display card through the proxy middleware of the virtual machine so as to establish communication between the display card and the virtual monitor in advance;
the acquiring unit is further configured to acquire desktop image data from a video memory of the video card if the virtual machine is switched from a power-off state to a power-on state after communication is pre-established between the video card and the virtual monitor;
the sending unit is further configured to send the desktop image data to an operating system of the virtual machine, so that the operating system of the virtual machine displays a desktop image corresponding to the desktop image data.
Optionally, the binding unit is configured to allocate an extended display identifier to the graphics card through the proxy middleware; and determining the expansion display identifier as the identifier of the virtual monitor, and establishing a binding relationship between the graphics card and the virtual monitor through the identifier of the virtual monitor so as to control communication between the graphics card and the virtual monitor through the identifier of the virtual monitor.
In yet another aspect, the present application provides a virtual machine comprising a virtual monitor and a storage module;
the virtual monitor is used for acquiring an image data sending instruction generated by a virtual machine, responding to the image data sending instruction, and acquiring image data matched with the image data sending instruction from a display memory of a display card, wherein the display card is arranged in a physical machine for assisting the virtual machine to work, communication is pre-established between the display card and the virtual monitor, and the image data is sent to the physical machine;
and the storage module is used for storing the image data matched with the image data sending instruction.
The image data transmission method and device based on the virtual monitor respond to the image data sending command after acquiring the image data sending command generated by the virtual machine, acquiring image data matched with the image data sending instruction from a video memory of a video card through a virtual monitor configured in a virtual machine, and sends image data to the physical machine through the virtual monitor, the display card is arranged in the physical machine for assisting the virtual machine to work, and the communication is pre-established between the display card and the virtual monitor, so that the virtual monitor can access the display card of the physical machine, the image data matched with the image data sending instruction is obtained from the video memory of the video card of the physical machine through the virtual monitor, the process that the virtual machine copies the image data from the video memory to the virtual video card is omitted, time consumption caused by copying is saved in the process of sending the image data to the physical machine, and the image data acquisition efficiency is improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a flowchart of an image data transmission method based on a virtual monitor according to an embodiment of the present application;
FIG. 2 is a flowchart of another virtual monitor-based image data transmission method provided in an embodiment of the present application;
FIG. 3 is a flowchart of another image data transmission method based on a virtual monitor according to an embodiment of the present application;
FIG. 4 is a schematic diagram of an image data transmission method based on a virtual monitor according to an embodiment of the present application;
FIG. 5 is a schematic structural diagram of an image data transmission apparatus based on a virtual monitor according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of another image data transmission device based on a virtual monitor according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Referring to fig. 1, a flowchart of an image data transmission method based on a virtual monitor according to an embodiment of the present application is shown, which may include the following steps:
101: and acquiring an image data sending instruction generated by the virtual machine, wherein the virtual machine is provided with a virtual monitor.
The virtual monitor may configure the virtual machine in the virtual machine initialization configuration process, and may also configure parameters of the virtual monitor in the virtual machine initialization configuration process, and this embodiment does not limit and describe one by one for which parameters of the virtual monitor are configured.
In this embodiment, the virtual monitor configuration can be performed in the initial configuration process of each startup of the virtual machine; or after the virtual machine is simulated on the physical machine in a software simulation mode, the configuration of the virtual monitor is carried out in the initial configuration process of the first startup of the virtual machine, the configured virtual monitor is detected in the subsequent initial configuration process of the virtual machine so as to determine whether the virtual monitor can normally run, if the virtual monitor can normally run, the process of reconfiguring the virtual monitor is omitted, if the virtual monitor runs abnormally, the process of reconfiguring the virtual monitor is started, so that the virtual monitor is reconfigured for the virtual machine again, and the virtual monitor is assisted to work.
The image data sending instruction is used for indicating that the image data in the virtual machine is possible to be updated, so that the image data is sent to the physical machine through the image data sending instruction, and synchronization of the image data in the physical machine and the image data in the virtual machine is achieved. The image data sending instruction can be generated under the condition that the image data of the virtual machine is updated, and the virtual machine periodically or aperiodically generates the image data sending instruction in a way that the image data in the physical machine and the image data in the virtual machine can be synchronized; for example, the virtual machine generates an image data sending instruction under the condition that the image data is monitored to be updated, so that the image data sending instruction can be generated to send the image data when the updated image data exists in the virtual machine, and real-time synchronous updating of the image data is realized. And the image data sending instruction is generated periodically or aperiodically, although the physical machine and the virtual machine cannot be synchronized in real time when the image data in the virtual machine is updated, the updated image data can be acquired after the image data sending instruction is generated, and synchronous updating of the image data between the physical machine and the virtual machine can be realized.
The image data in the virtual machine includes desktop image data and application image data, the desktop image data is related to an operating system of the virtual machine, is image data corresponding to an image displayed on a desktop of the virtual machine during the operating process of the operating system, and is used for restoring the image displayed on the desktop of the virtual machine, the application image data is image data corresponding to a related image in an application program run by the virtual machine, such as a game application program run in the virtual machine, and the related image in the game application program includes but is not limited to: game interface images, game battle images and the like, and image data corresponding to the images can be used as application image data for restoring game application programs.
Since the desktop image data is related to the operating system of the virtual machine and the application image data is related to the application program in the virtual machine, the generation of the image data transmission command corresponding to the desktop image data is determined by the operating system and the generation of the image data transmission command corresponding to the application image data is determined by the application program. If the configuration parameters related to the image data sending instruction are configured in the operating system of the virtual machine, the configuration parameters are used for monitoring the desktop image data to determine whether the desktop image data is updated or not, if the desktop image data is monitored to be updated, the configuration parameters are also used for indicating the sending time of the image data, and the image data sending instruction is generated under the condition that the operation condition of the virtual machine is monitored to meet the sending time so as to indicate the virtual machine to send the image data through the image data sending instruction. For example, the transmission timing may be, but is not limited to, the transmission time of the image data, and if the running time of the virtual machine coincides with/is the same as the transmission time, the image data transmission instruction is generated.
For the application program corresponding to the application image data, a configuration parameter related to the image data sending instruction may be set in the application program, and the implementation manner may refer to the configuration parameter in the operating system, which is not described herein again.
102: and responding to the image data sending instruction, and acquiring image data matched with the image data sending instruction from a video memory of a display card through a virtual monitor, wherein the display card is arranged in a physical machine assisting the virtual machine to work, and communication is established between the display card and the virtual monitor in advance.
For a virtual machine configured with a virtual monitor, a physical machine allocates a virtual graphics card to the virtual machine in a memory, in the related art, an electronic device may access image data in the virtual graphics card, the virtual graphics card may be emptied and deleted in a virtual machine shutdown process, and in a virtual machine startup process, the physical machine may reconfigure the virtual graphics card for the virtual machine, but the virtual graphics card is empty and the space of the virtual graphics card is limited, so that the virtual graphics card cannot store complete image data.
The display card of the physical machine stores the image data through the display memory, and under the condition that the virtual monitor has the authority of accessing the display card of the physical machine, the virtual monitor can acquire the image data matched with the image data sending instruction from the display memory. Because the desktop image data, the application image data and other image data are stored in the video memory, the image data stored in the video memory is complete and comprehensive, the hit probability can be increased by acquiring the image data from the video memory through the virtual monitor, and the acquired image data is complete.
103: the image data is sent to the physical machine through the virtual monitor.
In this embodiment, the virtual monitor is configured in the virtual machine, and data exchange between the virtual machine and the physical machine is not dependent on network connection, so that in the process of sending the image data to the physical machine, even if the network connection of the physical machine is abnormal, the virtual monitor can still normally send the image data to the physical machine. One possible way in which image data is sent to a physical machine through a virtual monitor is as follows:
calling a data adding function through the virtual monitor to add the image data into the sending queue; and calling a notification function through the virtual monitor to send a data reading instruction to the physical machine, wherein the data reading instruction is used for instructing the physical machine to call a data acquisition function to read the image data from the sending queue.
For example, if the data interaction between the virtual machine and the physical machine conforms to the virtio protocol, the process of sending image data to the physical machine through the virtual monitor includes: the virtual monitor calls a function virtue _ add _ buf to add a buffer (buffer) storing image data to virtue (transmission queue), and then calls a virtue _ kill function which calls a virtue _ notify function to notify a physical machine by writing in a register. The physical machine calls the virtuue _ get _ buf function to acquire the image data received by the virtuue queue.
The image data sent by the virtual monitor is obtained from the display memory of the display card, so that the virtual monitor can obtain the desktop image data from the display memory in real time in the starting process and the running process of the virtual machine, and after the desktop image data is sent to the physical machine through the virtual monitor, the physical machine can send the desktop image data to the electronic equipment, so that the electronic equipment can remotely display the desktop image corresponding to the desktop image data of the virtual machine.
The image data transmission method based on the virtual monitor responds to the image data sending instruction after acquiring the image data sending instruction generated by the virtual machine, acquiring image data matched with the image data sending instruction from a video memory of a video card through a virtual monitor configured in a virtual machine, and sends image data to the physical machine through the virtual monitor, the display card is arranged in the physical machine for assisting the virtual machine to work, and the communication is pre-established between the display card and the virtual monitor, so that the virtual monitor can access the display card of the physical machine, the image data matched with the image data sending instruction is obtained from the video memory of the video card of the physical machine through the virtual monitor, the process that the virtual machine copies the image data from the video memory to the virtual video card is omitted, time consumption caused by copying is saved in the process of sending the image data to the physical machine, and the image data acquisition efficiency is improved.
Referring to fig. 2, which shows a flowchart of another virtual monitor-based image data transmission method provided in an embodiment of the present application, a process of establishing communication between a graphics card and a virtual monitor is shown, where the process may include the following steps:
201: and configuring the virtual monitor for the virtual machine in the initial configuration process of the virtual machine. If the virtual machine is configured with the virtual monitor in the process of initial configuration of the virtual machine each time, or after the virtual machine is simulated on the physical machine in a software simulation mode, the virtual monitor is configured in the process of initial configuration of the virtual machine for the first time, the configured virtual monitor is detected in the subsequent process of initial configuration of the virtual machine so as to determine whether the virtual monitor can normally run, if the virtual monitor can normally run, the process of reconfiguring the virtual monitor is omitted, and if the virtual monitor runs abnormally, the process of reconfiguring the virtual monitor is started, so that the virtual monitor is configured again, and the virtual monitor is assisted to work by the virtual monitor.
In the process of initial configuration of the virtual machine, in addition to configuring the virtual monitor, a virtual graphics card may be configured for the virtual machine, and of course, parameters of the virtual monitor and the virtual graphics card may also be configured.
202: and attaching the virtual monitor to the display card through the proxy middleware of the virtual machine so as to establish communication between the display card and the virtual monitor in advance.
The purpose of attaching the virtual monitor to the display card is to establish a binding relationship between the virtual monitor and the display card, so that the virtual monitor and the display card have the right to access each other, thereby establishing communication between the display card and the virtual monitor in advance, so that either one of the display card and the virtual monitor can access the other one. One possible way to attach the virtual monitor to the graphics card via the proxy middleware of the virtual machine is as follows:
distributing an Extended Display Identification (EDID) to the Display card through the proxy middleware; and determining the extended display identifier as the identifier of the virtual monitor, and establishing a binding relationship between the display card and the virtual monitor through the identifier of the virtual monitor so as to control the communication between the display card and the virtual monitor through the identifier of the virtual monitor.
After the display card and the virtual monitor establish a binding relationship, the display card can send image data to the virtual monitor based on the EDID of the virtual monitor. In the process of sending the image data to the virtual monitor based on the EDID of the virtual monitor, the display card verifies the EDID of the virtual monitor to determine whether the EDID of the virtual monitor is valid and whether a binding relationship is established with the display card, and if the EDID of the virtual monitor is valid and the binding relationship is established with the display card, the display card sends the image data to the virtual monitor with the EDID.
203: and if the virtual machine is switched from the power-off state to the power-on state after the communication is pre-established between the video card and the virtual monitor, acquiring desktop image data from the video memory of the video card.
If the virtual machine is switched from the power-off state to the power-on state after communication is pre-established between the video card and the virtual monitor, the video card of the physical machine is used as first starting video card equipment of the virtual machine, and desktop image data are obtained from the video memory through the video card.
The reason why the display card is used as the first starting display card device of the virtual machine is that in the process of turning on the virtual machine, the virtual display card of the virtual machine is deleted, and the virtual display card is reconfigured for the virtual machine in the process of turning on the virtual machine again, so that the data in the virtual display card is null in the reconfiguration process, if the virtual display card is used as the first starting display card device of the virtual machine, when the virtual machine is switched from the power-off state to the power-on state, the desktop image data acquired by the virtual machine from the virtual display card is null, and therefore the desktop image cannot be rendered by an operating system of the virtual machine in the process of turning on the virtual machine. In the process of switching the virtual machine from the shutdown state to the startup state, the display memory of the display card still stores desktop image data corresponding to the operating system of the virtual machine, so that the display card is used as a first starting display card device in the process, the operating system of the virtual machine can acquire the desktop image data, and then the desktop image can be rendered based on the desktop image data.
204: and sending the desktop image data to an operating system of the virtual machine so that the operating system of the virtual machine displays a desktop image corresponding to the desktop image data.
205: and acquiring an image data sending instruction generated by the virtual machine, wherein the virtual machine is provided with a virtual monitor.
206: and responding to the image data sending instruction, and acquiring image data matched with the image data sending instruction from a video memory of a display card through a virtual monitor, wherein the display card is arranged in a physical machine assisting the virtual machine to work, and communication is established between the display card and the virtual monitor in advance.
207: the image data is sent to the physical machine through the virtual monitor.
In this embodiment, steps 205 to 207 are the same as steps 101 to 103 described above, and will not be described again here.
According to the image data transmission method based on the virtual monitor, the virtual monitor is configured for the virtual machine in the process of initializing and configuring the virtual machine; attaching a virtual monitor to a display card through proxy middleware of a virtual machine so as to establish communication between the display card and the virtual monitor in advance; if the virtual machine is switched from the power-off state to the power-on state after communication is pre-established between the video card and the virtual monitor, acquiring desktop image data from a video memory of the video card; the desktop image data is sent to an operating system of the virtual machine, so that the operating system of the virtual machine displays a desktop image corresponding to the desktop image data, the virtual machine is switched from a power-off state to a power-on state after communication is pre-established between the video card and the virtual monitor, the video card of the physical machine serves as first starting video card equipment of the virtual machine, the desktop image data is obtained from the video memory through the video card, and in the process from power-off to power-on of the virtual machine, the operating system of the virtual machine can obtain the desktop image data so as to normally display the desktop image in the process of power-on.
In this embodiment, the virtual monitor includes a front end module and a back end module, where the front end module is determined as a virtual display of the graphics card, and the graphics card sends image data stored in the graphics memory to the virtual display, so as to display an image corresponding to the image data sent by the graphics card through the virtual display; and the back end module of the virtual monitor is arranged in the physical machine and is used for sending the image data matched with the image data sending instruction to the physical machine. The corresponding image data transmission method based on the virtual monitor further comprises the following steps:
determining a front end module of a virtual monitor as a virtual display of a display card; displaying an image corresponding to the image data acquired by the video card from the video memory through a virtual display; setting a back-end module of a virtual monitor in a physical machine; sending the image data to the physical machine through the virtual monitor includes: and sending the image data matched with the image data sending instruction to the physical machine through a back-end module of the virtual monitor.
The method comprises the steps that a front-end module of a virtual monitor is determined as a virtual display of a display card, the virtual monitor can be attached to the display card through the virtual monitor, the attachment process is executed through a proxy middleware of the virtual machine, the proxy middleware distributes an extended display identifier for the virtual monitor in the attachment process, the extended display identifier can serve as an identifier of the front-end module, a binding relation is established between the front-end module with the display function and the display card, therefore, the display card can send image data in a display memory to the virtual display in real time, and images corresponding to the image data are displayed through the virtual display.
The back-end module with the image data sending function in the virtual monitor is arranged in the physical machine, so that data interaction between the back-end module and the physical machine does not need to be connected through a network, for example, data interaction can be performed in the sending queue mode, which is not described in this embodiment.
Referring to fig. 3, a flowchart of another virtual monitor-based image data transmission method provided in an embodiment of the present application is shown, which may include the following steps:
301: receiving image data sent by a virtual monitor of a virtual machine, wherein the image data is obtained from a display memory of a display card through the virtual monitor in a process of responding to an image data sending instruction of the virtual machine, the display card is arranged in a physical machine assisting the virtual machine to work, communication is established between the display card and the virtual monitor in advance, and for the process of obtaining the image data by the virtual monitor, please refer to the above embodiment.
One possible way in which to receive image data sent by the virtual monitor of a virtual machine is: receiving a data reading instruction sent to a physical machine by a virtual monitor calling notification function; and calling a data acquisition function to read the image data from the sending queue, and calling a data adding function by the virtual monitor to add the image data into the sending queue.
For example, if the data interaction between the virtual machine and the physical machine conforms to the virtio protocol, the process of receiving the image data by the physical machine includes: the virtual monitor calls a virtue _ kit function, the virtue _ kit function calls a virtue _ notify function, the virtue _ notify function is notified to the physical machine in a register writing mode, and the physical machine calls the virtue _ get _ buf function to acquire image data received by the virtue queue. The virtual monitor calls the function virtuue _ add _ buf to add a buffer (buffer) storing image data to virtuue (send queue).
In this embodiment, the virtual monitor includes a front-end module and a back-end module, and the back-end module has a function of sending image data, and the receiving of the image data sent by the virtual monitor of the virtual machine includes: the image data sent by the back-end module of the virtual monitor is received, and the back-end module of the virtual monitor is arranged in the physical machine, so that the virtual monitor interacts with the physical machine through the back-end module, which can be referred to the above description.
302: and sending the image data to the electronic equipment. And the physical machine transmits the image data to the electronic equipment in a network transmission mode by means of network connection between the physical machine and the electronic equipment in the process of transmitting the image data to the electronic equipment. For example, the physical machine and the electronic device perform data interaction according to a Simple Protocol for Independent Computing Environment (Spice) Protocol or a Virtual Network Controller (VNC) Protocol.
As shown in fig. 4, it shows a process that image data is sent from a graphics card to a virtual monitor, then from the virtual monitor to a physical machine, and then sent to an electronic device by the physical machine, where the model of the graphics card may be, but is not limited to, at least one of NVIDIA and AMD, a virtual monitor is configured in an initialization configuration process of the virtual machine, the graphics card in the physical machine is passed through to the virtual machine, and a binding relationship is established between the virtual monitor and the graphics card, so that the graphics card can send the image data in the graphics memory to the virtual monitor, display the image data through a front-end module of the virtual monitor, and send the image data to the physical machine through a back-end module of the virtual monitor, and send the image data to the electronic device through a network transmission manner. Besides displaying the image corresponding to the image data through the front end module of the virtual monitor, the display card can drive the display device in the physical machine, and the image corresponding to the image data is displayed through the display device in the physical machine.
While, for purposes of simplicity of explanation, the foregoing method embodiments have been described as a series of acts or combination of acts, it will be appreciated by those skilled in the art that the present application is not limited by the order of acts or acts described, as some steps may occur in other orders or concurrently with other steps in accordance with the application. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required in this application.
Corresponding to the above method embodiment, an embodiment of the present application further provides an image data transmission apparatus based on a virtual monitor, which has a structure as shown in fig. 5, and may include: an acquisition unit 10, a response unit 20 and a transmission unit 30.
An obtaining unit 10, configured to obtain an image data sending instruction generated by a virtual machine, where the virtual machine is configured with a virtual monitor. The virtual monitor may configure the virtual machine in the virtual machine initialization configuration process, and may also configure parameters of the virtual monitor in the virtual machine initialization configuration process, and this embodiment does not limit and describe one by one regarding which parameters of the virtual monitor are configured and whether the parameters are configured in the initialization configuration process each time.
The image data sending instruction is used for indicating that the image data in the virtual machine is possible to be updated, so that the image data is sent to the physical machine through the image data sending instruction, and synchronization of the image data in the physical machine and the virtual machine is achieved. The image data sending instruction may be generated when the image data of the virtual machine is updated, or the virtual machine periodically or aperiodically generates the image data sending instruction, and these generation manners can synchronize the image data in the physical machine and the image data in the virtual machine, for a detailed description, refer to the method embodiment.
And the response unit 20 is configured to respond to the image data sending instruction, acquire, by the virtual monitor, image data matched with the image data sending instruction from a video memory of the video card, where the video card is disposed in a physical machine that assists the virtual machine to work, and communication is established between the video card and the virtual monitor in advance.
For a virtual machine configured with a virtual monitor, a physical machine allocates a virtual graphics card to the virtual machine in a memory, in the related art, an electronic device may access image data in the virtual graphics card, the virtual graphics card may be emptied and deleted in a virtual machine shutdown process, and in a virtual machine startup process, the physical machine may reconfigure the virtual graphics card for the virtual machine, but the virtual graphics card is empty and the space of the virtual graphics card is limited, so that the virtual graphics card cannot store complete image data.
The display card of the physical machine stores the image data through the display memory, and under the condition that the virtual monitor has the authority of accessing the display card of the physical machine, the virtual monitor can acquire the image data matched with the image data sending instruction from the display memory. Because the desktop image data, the application image data and other image data are stored in the video memory, the image data stored in the video memory is complete and comprehensive, the hit probability can be increased by acquiring the image data from the video memory through the virtual monitor, and the acquired image data is complete.
And a transmitting unit 30 for transmitting the image data to the physical machine through the virtual monitor.
In this embodiment, the virtual monitor is configured in the virtual machine, and data exchange between the virtual machine and the physical machine is not dependent on network connection, so that in the process of sending the image data to the physical machine, even if the network connection of the physical machine is abnormal, the virtual monitor can still normally send the image data to the physical machine. See method embodiments for a process in which image data is sent to a physical machine through a virtual monitor.
The image data transmission device based on the virtual monitor responds to the image data transmission command after acquiring the image data transmission command generated by the virtual machine, acquiring image data matched with the image data sending instruction from a video memory of a video card through a virtual monitor configured in a virtual machine, and sends image data to the physical machine through the virtual monitor, the display card is arranged in the physical machine for assisting the virtual machine to work, and the communication is pre-established between the display card and the virtual monitor, so that the virtual monitor can access the display card of the physical machine, the image data matched with the image data sending instruction is obtained from the video memory of the video card of the physical machine through the virtual monitor, the process that the virtual machine copies the image data from the video memory to the virtual video card is omitted, time consumption caused by copying is saved in the process of sending the image data to the physical machine, and the image data acquisition efficiency is improved.
Referring to fig. 6, which shows an alternative structure of another image data transmission apparatus based on a virtual monitor according to an embodiment of the present application, the image data transmission apparatus may further include: a configuration unit 40 and a binding unit 50.
And a configuration unit 40, configured to configure a virtual monitor for the virtual machine in an initial configuration process of the virtual machine. If the virtual machine is configured with the virtual monitor in the process of initial configuration of the virtual machine each time, or after the virtual machine is simulated on the physical machine in a software simulation mode, the virtual monitor is configured in the process of initial configuration of the virtual machine for the first time, the configured virtual monitor is detected in the subsequent process of initial configuration of the virtual machine so as to determine whether the virtual monitor can normally run, if the virtual monitor can normally run, the process of reconfiguring the virtual monitor is omitted, and if the virtual monitor runs abnormally, the process of reconfiguring the virtual monitor is started, so that the virtual monitor is configured again, and the virtual monitor is assisted to work by the virtual monitor.
And the binding unit 50 is used for attaching the virtual monitor to the display card through the proxy middleware of the virtual machine so as to establish communication between the display card and the virtual monitor in advance.
The purpose of attaching the virtual monitor to the display card is to establish a binding relationship between the virtual monitor and the display card, so that the virtual monitor and the display card have the right to access each other, thereby establishing communication between the display card and the virtual monitor in advance, so that either one of the display card and the virtual monitor can access the other one. One possible way to attach the virtual monitor to the graphics card via the proxy middleware of the virtual machine is as follows:
distributing an extended display identifier to the display card through the proxy middleware; and determining the extended display identifier as the identifier of the virtual monitor, and establishing a binding relationship between the display card and the virtual monitor through the identifier of the virtual monitor so as to control the communication between the display card and the virtual monitor through the identifier of the virtual monitor.
After the display card and the virtual monitor establish a binding relationship, the display card can send image data to the virtual monitor based on the EDID of the virtual monitor. In the process of sending the image data to the virtual monitor based on the EDID of the virtual monitor, the display card verifies the EDID of the virtual monitor to determine whether the EDID of the virtual monitor is valid and whether a binding relationship is established with the display card, and if the EDID of the virtual monitor is valid and the binding relationship is established with the display card, the display card sends the image data to the virtual monitor with the EDID.
The obtaining unit 10 is further configured to obtain desktop image data from a video memory of the video card if the virtual machine is switched from the power-off state to the power-on state after communication is established between the video card and the virtual monitor in advance. The description that the video card of the physical machine is used as the first start video card device of the virtual machine, the video card is used to acquire the desktop image data from the video memory, and the video card of the physical machine is used as the first start video card device of the virtual machine refers to the above method embodiment.
The sending unit 30 is further configured to send the desktop image data to the operating system of the virtual machine, so that the operating system of the virtual machine displays a desktop image corresponding to the desktop image data.
The virtual monitor comprises a front-end module and a rear-end module, wherein the front-end module is determined as a virtual display of the video card, and the video card sends image data stored in the video memory to the virtual display so as to display an image corresponding to the image data sent by the video card through the virtual display; the back end module of the virtual monitor is disposed in the physical machine, and the back end module is configured to send the image data matched with the image data sending instruction to the physical machine, and for the description of the front end module and the back end module, please refer to the above embodiment.
The embodiment of the present application further provides an image data transmission apparatus based on a virtual monitor, which is applied to a physical machine, and the apparatus may include: a receiving unit and a transmitting unit.
The receiving unit is used for receiving image data sent by a virtual monitor of the virtual machine, the image data is obtained from a display memory of a display card through the virtual monitor in the process of responding to an image data sending instruction of the virtual machine, the display card is arranged in a physical machine assisting the virtual machine to work, and communication is established between the display card and the virtual monitor in advance. A transmitting unit for transmitting the image data to the electronic device.
The receiving unit receives image data sent by a back-end module of the virtual monitor, the back-end module of the virtual monitor is arranged in the physical machine, and for a feasible way that the virtual monitor interacts with the physical machine through the back-end module, reference may be made to the above description.
The embodiment of the application also provides a virtual machine, which comprises a virtual monitor and a storage module;
the virtual monitor is used for acquiring an image data sending instruction generated by the virtual machine, responding to the image data sending instruction, and acquiring image data matched with the image data sending instruction from a display memory of a display card, wherein the display card is arranged in a physical machine assisting the virtual machine to work, communication is pre-established between the display card and the virtual monitor, and the display card sends the image data to the physical machine; and the storage module is used for storing the image data matched with the image data sending instruction.
The embodiment of the application further provides a physical machine, which comprises a processor and a communication module, wherein the processor is used for receiving image data sent by a virtual monitor of the virtual machine, the image data is obtained from a video memory of a video card through the virtual monitor in the process of responding to an image data sending instruction of the virtual machine, the video card is arranged in the physical machine assisting the virtual machine to work, communication is pre-established between the video card and the virtual monitor, and the image data is sent to the electronic device through the communication module.
The embodiment of the application also provides a storage medium, wherein a computer program code is stored in the storage medium, and when the computer program code is executed, the image data transmission method based on the virtual monitor is realized.
It should be noted that, various embodiments in this specification may be described in a progressive manner, and features described in various embodiments in this specification may be replaced with or combined with each other, each embodiment focuses on differences from other embodiments, and similar parts between various embodiments may be referred to each other. For the device-like embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
The foregoing is only a preferred embodiment of the present application and it should be noted that those skilled in the art can make several improvements and modifications without departing from the principle of the present application, and these improvements and modifications should also be considered as the protection scope of the present application.

Claims (10)

1. A virtual monitor-based image data transmission method, the method comprising:
acquiring an image data sending instruction generated by a virtual machine, wherein the virtual machine is provided with a virtual monitor;
responding to the image data sending instruction, and acquiring image data matched with the image data sending instruction from a video memory of a video card through the virtual monitor, wherein the video card is arranged in a physical machine for assisting the virtual machine to work, and communication is pre-established between the video card and the virtual monitor;
sending, by the virtual monitor, the image data to the physical machine.
2. The method of claim 1, further comprising:
configuring the virtual monitor for the virtual machine during the initial configuration process of the virtual machine;
attaching the virtual monitor to the graphics card through proxy middleware of the virtual machine so as to establish communication between the graphics card and the virtual monitor in advance;
if the virtual machine is switched from a power-off state to a power-on state after communication is pre-established between the video card and the virtual monitor, acquiring desktop image data from a video memory of the video card;
and sending the desktop image data to an operating system of the virtual machine so that the operating system of the virtual machine displays a desktop image corresponding to the desktop image data.
3. The method of claim 2, the attaching, by proxy middleware of the virtual machine, the virtual monitor on the graphics card comprising:
distributing an extended display identifier to the display card through the proxy middleware;
and determining the expansion display identifier as the identifier of the virtual monitor, and establishing a binding relationship between the graphics card and the virtual monitor through the identifier of the virtual monitor so as to control communication between the graphics card and the virtual monitor through the identifier of the virtual monitor.
4. The method of claim 1, further comprising:
determining a front end module of the virtual monitor as a virtual display of the graphics card;
displaying an image corresponding to the image data acquired by the video card from the video memory through the virtual display;
setting a back-end module of the virtual monitor in the physical machine;
the sending, by the virtual monitor, the image data to the physical machine comprises: and sending the image data matched with the image data sending instruction to the physical machine through a back-end module of the virtual monitor.
5. A virtual monitor-based image data transmission method, the method comprising:
receiving image data sent by a virtual monitor of the virtual machine, wherein the image data is obtained from a video memory of a video card through the virtual monitor in the process of responding to an image data sending instruction of the virtual machine, the video card is arranged in a physical machine for assisting the virtual machine to work, and communication is pre-established between the video card and the virtual monitor;
and sending the image data to the electronic equipment.
6. The method of claim 5, the receiving image data sent by a virtual monitor of the virtual machine comprising:
and receiving image data sent by a back-end module of the virtual monitor, wherein the back-end module of the virtual monitor is arranged in the physical machine.
7. An image data transmission apparatus based on a virtual monitor, the apparatus comprising:
the device comprises an acquisition unit, a display unit and a display unit, wherein the acquisition unit is used for acquiring an image data sending instruction generated by a virtual machine, and the virtual machine is provided with a virtual monitor;
the response unit is used for responding to the image data sending instruction, acquiring image data matched with the image data sending instruction from a video memory of a video card through the virtual monitor, wherein the video card is arranged in a physical machine for assisting the virtual machine to work, and communication is pre-established between the video card and the virtual monitor;
a sending unit, configured to send the image data to the physical machine through the virtual monitor.
8. The apparatus of claim 7, further comprising:
a configuration unit, configured to configure the virtual monitor for the virtual machine in an initial configuration process of the virtual machine;
the binding unit is used for attaching the virtual monitor to the display card through the proxy middleware of the virtual machine so as to establish communication between the display card and the virtual monitor in advance;
the acquiring unit is further configured to acquire desktop image data from a video memory of the video card if the virtual machine is switched from a power-off state to a power-on state after communication is pre-established between the video card and the virtual monitor;
the sending unit is further configured to send the desktop image data to an operating system of the virtual machine, so that the operating system of the virtual machine displays a desktop image corresponding to the desktop image data.
9. The apparatus of claim 8, the binding unit configured to assign an extended display identifier to the graphics card through the proxy middleware; and determining the expansion display identifier as the identifier of the virtual monitor, and establishing a binding relationship between the graphics card and the virtual monitor through the identifier of the virtual monitor so as to control communication between the graphics card and the virtual monitor through the identifier of the virtual monitor.
10. A virtual machine comprising a virtual monitor and a storage module;
the virtual monitor is used for acquiring an image data sending instruction generated by a virtual machine, responding to the image data sending instruction, and acquiring image data matched with the image data sending instruction from a display memory of a display card, wherein the display card is arranged in a physical machine for assisting the virtual machine to work, communication is pre-established between the display card and the virtual monitor, and the image data is sent to the physical machine;
and the storage module is used for storing the image data matched with the image data sending instruction.
CN202011188439.3A 2020-10-30 2020-10-30 Image data transmission method and device based on virtual monitor Pending CN112306712A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011188439.3A CN112306712A (en) 2020-10-30 2020-10-30 Image data transmission method and device based on virtual monitor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011188439.3A CN112306712A (en) 2020-10-30 2020-10-30 Image data transmission method and device based on virtual monitor

Publications (1)

Publication Number Publication Date
CN112306712A true CN112306712A (en) 2021-02-02

Family

ID=74332598

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011188439.3A Pending CN112306712A (en) 2020-10-30 2020-10-30 Image data transmission method and device based on virtual monitor

Country Status (1)

Country Link
CN (1) CN112306712A (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101154166A (en) * 2006-09-25 2008-04-02 联想(北京)有限公司 Virtual machine system and its graphics card access method
CN102097080A (en) * 2010-12-27 2011-06-15 华为技术有限公司 Display drive processing method, device and system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101154166A (en) * 2006-09-25 2008-04-02 联想(北京)有限公司 Virtual machine system and its graphics card access method
CN102097080A (en) * 2010-12-27 2011-06-15 华为技术有限公司 Display drive processing method, device and system

Similar Documents

Publication Publication Date Title
JP7069672B2 (en) Application update method and program
US8707109B2 (en) Computer apparatus, non-transitory computer-readable medium storing an error recovery control program, and error recovery control method
CN100472468C (en) Computer system, computer network and method
CN102103474B (en) Information processor and method
US20170033980A1 (en) Agent manager for distributed transaction monitoring system
CN113590146B (en) Server and container upgrading method
CN110557624A (en) Data transmission method and device and server
CN111917833B (en) Application method, device and system of client program in cloud environment
CN115080479B (en) Transmission method, server, device, bare metal instance and baseboard management controller
CN111506331A (en) Server BMC refreshing method, system, terminal and storage medium
CN103797461A (en) Network system and method for controlling same
CN110545415A (en) Data transmission method and device and server
JP2012203442A (en) Enclosure manager, firmware management system, firmware management method and program
CN112306712A (en) Image data transmission method and device based on virtual monitor
JP2010128707A (en) Electronic apparatus, server, and method of controlling the same
CN109039765B (en) Network configuration method and device
JPH09146859A (en) Network system with terminal managing function
CN110928707A (en) Data exchange method and related device for host machine and virtual machine
JP2007310897A (en) Computer system and computer control method, and storage medium stored with control program
CN111045789A (en) Virtual machine starting method and device, electronic equipment and storage medium
JP2013000941A (en) Information processor, information processing method, and program
CN114866517A (en) Installation file execution method and device and storage medium
EP1645969B1 (en) Remote configuration management for data processing units
CN107678764B (en) Method and device for upgrading VSM system based on ISSU
CN113064615B (en) Software updating method and device, storage medium and electronic device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination