mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-11 03:24:58 -06:00
virtio-gpu: Update cursor data using blob
If a blob is available for the cursor, copy the data from the blob. Based-on-patch-by: Gerd Hoffmann <kraxel@redhat.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com> Message-Id: <20210526231429.1045476-15-vivek.kasireddy@intel.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
32db3c63ae
commit
bdd53f7392
1 changed files with 14 additions and 5 deletions
|
@ -49,6 +49,7 @@ void virtio_gpu_update_cursor_data(VirtIOGPU *g,
|
||||||
{
|
{
|
||||||
struct virtio_gpu_simple_resource *res;
|
struct virtio_gpu_simple_resource *res;
|
||||||
uint32_t pixels;
|
uint32_t pixels;
|
||||||
|
void *data;
|
||||||
|
|
||||||
res = virtio_gpu_find_check_resource(g, resource_id, false,
|
res = virtio_gpu_find_check_resource(g, resource_id, false,
|
||||||
__func__, NULL);
|
__func__, NULL);
|
||||||
|
@ -56,14 +57,22 @@ void virtio_gpu_update_cursor_data(VirtIOGPU *g,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (res->blob_size) {
|
||||||
|
if (res->blob_size < (s->current_cursor->width *
|
||||||
|
s->current_cursor->height * 4)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
data = res->blob;
|
||||||
|
} else {
|
||||||
if (pixman_image_get_width(res->image) != s->current_cursor->width ||
|
if (pixman_image_get_width(res->image) != s->current_cursor->width ||
|
||||||
pixman_image_get_height(res->image) != s->current_cursor->height) {
|
pixman_image_get_height(res->image) != s->current_cursor->height) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
data = pixman_image_get_data(res->image);
|
||||||
|
}
|
||||||
|
|
||||||
pixels = s->current_cursor->width * s->current_cursor->height;
|
pixels = s->current_cursor->width * s->current_cursor->height;
|
||||||
memcpy(s->current_cursor->data,
|
memcpy(s->current_cursor->data, data,
|
||||||
pixman_image_get_data(res->image),
|
|
||||||
pixels * sizeof(uint32_t));
|
pixels * sizeof(uint32_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue