Search

CN-121998812-A - Cloud desktop image processing method and system for enabling spice protocol image caching mechanism on virtio-gpu

CN121998812ACN 121998812 ACN121998812 ACN 121998812ACN-121998812-A

Abstract

The invention discloses a cloud desktop image processing method and a cloud desktop image processing system for enabling a spice protocol image caching mechanism on virtio-gpu, wherein virtio-gpu virtual graphics cards generate cloud desktop images and send the cloud desktop images to qemu ends, the qemu ends acquire cloud desktop images, compare adjacent frame cloud desktop images in each image area block to obtain difference image area blocks, acquire image data in an area corresponding to each difference image area block in a current cloud desktop image to generate difference block images, calculate unique identification id of each difference block image, and transmit each difference block image and the unique identification id to a spice server end, and the spice server end acquires the unique identification id to enable the caching mechanism. The invention ensures that an image caching mechanism of the spice protocol is enabled on virtio-gpu, and ensures higher image caching hit rate.

Inventors

  • LI WEISHI
  • XIE MING
  • LIU YUN
  • SUN LIMING

Assignees

  • 银河麒麟软件(长沙)有限公司

Dates

Publication Date
20260508
Application Date
20260126

Claims (10)

  1. 1. The cloud desktop image processing method for enabling a spice protocol image caching mechanism on virtio-gpu is characterized by being applied to a cloud desktop system comprising a virtio-gpu virtual display card, a qemu end, a spice server end and a client, and comprises the following steps of: virtio-gpu virtual display card sends the cloud desktop image generated by rendering to qemu end in real time; the qemu end obtains a current cloud desktop image, compares the current cloud desktop image with a previous cloud desktop image in a cloud desktop image cache in each image area block to obtain a difference image area block, obtains image data in an area corresponding to each difference image area block in the current cloud desktop image, generates difference block images corresponding to the difference image area blocks one by one, calculates unique identification id of each difference block image, and transmits each difference block image and the unique identification id to the spice server end; The spice server side matches the obtained unique identification id with the cache region, and sends the unique identification id information to the client side for the difference block image hit by the id, so that the client side restores the image from the cache region according to the unique identification id.
  2. 2. The cloud desktop image processing method of enabling a spice protocol image caching mechanism on virtio-GPU according to claim 1, wherein when comparing a current cloud desktop image with a last frame of cloud desktop image in a cloud desktop image cache in each image area block, specifically dividing the current cloud desktop image and the last frame of cloud desktop image into image area blocks with specified sizes, then performing data comparison on each image area block of the current cloud desktop image and an image area block of the same position of the last frame of cloud desktop image through GPU acceleration, and if data difference occurs during data comparison, taking the image area block of the corresponding position of the current cloud desktop image as a difference image area block.
  3. 3. The cloud desktop image processing method for enabling a spice protocol image caching mechanism on virtio-GPU according to claim 2, wherein when each image area block of a current cloud desktop image and an image area block at the same position of a previous frame of cloud desktop image are subjected to data comparison through GPU acceleration, the method comprises the following steps: directly accessing the memories of the current cloud desktop image and the cloud desktop image of the previous frame through dmabuf mechanism, and loading the two cloud desktop images as texture images; using the texture mixing technology of the GPU to mix the textures of the two loaded texture images, wherein in the mixed textures, the values at the same positions of the pixels of the front frame and the rear frame are set to be 0, and the values at the different positions of the pixels of the front frame and the rear frame are set to be 1; Mapping the mixed texture into a matrix of bytes corresponding to each image area block according to the divided image area blocks, wherein if the image area blocks have pixels with the value of 1, the bytes take the value of 1, otherwise, the bytes take the value of 0; and taking the image area block with the corresponding byte value of 1 in the current cloud desktop image as a difference image area block.
  4. 4. The cloud desktop image processing method of enabling a spice protocol image caching mechanism on virtio-gpu according to claim 1, wherein when calculating a unique identifier id of each difference block image, specifically, binary data of each difference block image is obtained and a hash value is calculated through a hash algorithm to be used as the unique identifier id of each difference block image.
  5. 5. The cloud desktop image processing method of claim 1, wherein after the unique id obtained by the spice server matches the cache, further comprises sending image data to the client and adding the image data to the cache for the difference block image with the missing id.
  6. 6. The cloud desktop image processing method of enabling a spice protocol image caching mechanism on virtio-gpu according to claim 2, wherein after an image area block at a corresponding position of a current cloud desktop image is used as a difference image area block, the difference image area block is numbered and added into a difference block queue, so that after all image area blocks of the current cloud desktop image are subjected to data comparison, a difference block queue ordered according to the number is obtained.
  7. 7. The cloud desktop image processing method of enabling a spice protocol image caching mechanism on virtio-gpu according to claim 6, wherein image data in an area corresponding to each difference image area block in a current cloud desktop image is obtained to generate difference block images corresponding to the difference image area blocks one by one, unique identification id of each difference block image is calculated, when each difference block image and the unique identification id are transmitted to a spice server side, specifically, the difference block queue is traversed, the image data of the currently traversed difference image area block in the current cloud desktop image area is obtained to generate a corresponding difference block image, the unique identification id of the difference block image is calculated through a hash algorithm, and then the difference block image and the unique identification id are transmitted to the spice server side.
  8. 8. The cloud desktop image processing method of enabling a spice protocol image caching mechanism on virtio-gpu according to claim 7, wherein after the difference block queue is traversed, the qemu updates data in the cloud desktop image cache to data of a current cloud desktop image.
  9. 9. A cloud desktop system comprising a processor and a computer readable storage medium storing a computer program for execution by the processor to implement the steps of the cloud desktop image processing method of any of claims 1-8 that enables a spice protocol image caching mechanism on virtio-gpu.
  10. 10. A computer readable storage medium, characterized in that the computer readable storage medium stores a computer program, which when executed by a processor implements the steps of the cloud desktop image processing method of any of claims 1-8, enabling a spice protocol image caching mechanism on virtio-gpu.

Description

Cloud desktop image processing method and system for enabling spice protocol image caching mechanism on virtio-gpu Technical Field The invention relates to the field of cloud computing, in particular to a cloud desktop image processing method and system for enabling a spice protocol image caching mechanism on virtio-gpu. Background As a technology for virtualizing a traditional desktop operating system and an application program to a cloud host, the cloud desktop has the advantages of high-efficiency centralized management, work efficiency improvement, data security guarantee, resource sharing, convenience in collaboration, cost reduction and the like. However, limited by the technology implementation, cloud desktops are highly dependent on the network, and network instability or insufficient bandwidth may affect the use experience. Problems such as network delay and packet loss can also cause slow response speed, and reduce the use experience of users. In order to reduce the occupation of the network bandwidth of the cloud desktop, the spice transmission protocol is optimized in aspects of image processing, data transmission, caching mechanism and the like. Taking an image caching mechanism as an example, a spice server side and a client side respectively open up a main image caching area and a slave image caching area, wherein the caching area is managed by the spice server side, and the consistency of data of the main image caching area and the slave image caching area is ensured through a synchronization mechanism. When the image to be sent is in the buffer area, the spice server can only send the unique identification of the image, thereby avoiding repeated sending of the same image data and greatly reducing the data quantity sent through a network. Currently, the image caching mechanism in the spice protocol is activated only when the virtual machine display card is qxl display cards. qxl the graphics card and the spice protocol are depth collaborative virtualized graphics solutions, and a front end driver of the qxl graphics card in the virtual machine is responsible for graphic rendering and sends the rendered image to the spice server through a qxl graphics card realized in qemu. And qxl, the front-end driver of the display card creates a unique identification id of the image at the same time when generating the rendered image, and the spice server judges whether the image is cached in the cache region or not through the unique identification id. However, when the virtual machine graphics card is switched to virtio-gpu graphics card, the virtio-gpu graphics card driver generates the unique id of the rendered image in an incremental operation, which results in that even if the front and back images are the same, the unique ids are not the same, so that the image caching mechanism in the spice protocol cannot be triggered. In addition, when virtio-gpu graphics cards are adopted, the images sent to the spice server end by qemu of each frame are a large number of fragmented difference images, which also results in low cache hit rate even if an image cache mechanism in the spice protocol is enabled. For the above reasons, the current spice protocol directly closes the image caching mechanism under virtio-gpu display card. Considering that virtio-gpu graphics cards can greatly improve the 3d rendering capability of the virtual machine, and the virtual machine is not supported to use qxl graphics cards on most arm servers, it is necessary to enable an image caching mechanism in a spice protocol on virtio-gpu and improve the cache hit rate, so that the network bandwidth occupation of a cloud desktop adopting virtio-gpu is effectively reduced. Disclosure of Invention Aiming at the problems in the prior art, the invention provides a cloud desktop image processing method and a cloud desktop image processing system for enabling a spice protocol image caching mechanism on virtio-gpu, which optimize the processing flow of cloud desktop images generated by virtio-gpu rendering on the qemu side, ensure that virtio-gpu can also enable the spice protocol image caching mechanism, and ensure higher image cache hit rate. In order to solve the technical problems, the invention adopts the following technical scheme: a cloud desktop image processing method for enabling a spice protocol image caching mechanism on virtio-gpu, the method being applied to a cloud desktop system comprising a virtio-gpu virtual graphics card, a qemu end, a spice server end and a client, the method comprising the steps of: virtio-gpu virtual display card sends the cloud desktop image generated by rendering to qemu end in real time; the qemu end obtains a current cloud desktop image, compares the current cloud desktop image with a previous cloud desktop image in a cloud desktop image cache in each image area block to obtain a difference image area block, obtains image data in an area corresponding to each difference image area block in the curren