peterdelevoryas / rpms / qemu

Forked from rpms/qemu 2 years ago
Clone

Blame 0430-ui-spice-display-use-uintptr_t-when-casting-qxl-phys.patch

56753f
From 626eb7b96445815945600895a411ee14c10b9056 Mon Sep 17 00:00:00 2001
56753f
From: Alon Levy <alevy@redhat.com>
56753f
Date: Wed, 21 Mar 2012 18:17:18 +0200
56753f
Subject: [PATCH 430/434] ui/spice-display: use uintptr_t when casting qxl
56753f
 physical addresses
56753f
56753f
The current intptr_t casts are a problem when the address's highest
56753f
bit is 1, and it is cast to a intptr_t and then to uint64_t, such
56753f
as at:
56753f
     surface.mem        = (intptr_t)ssd->buf;
56753f
56753f
This causes the sign bit to be extended which causes a wrong address to
56753f
be passed on to spice, which then complains when it gets the wrong
56753f
slot_id number, since the slot_id is taken from the higher bits.
56753f
56753f
The assertion happens early - during the first primary surface creation.
56753f
56753f
This fixes running "-vga qxl -spice" with 32 bit compiled
56753f
qemu-system-i386.
56753f
56753f
Signed-off-by: Alon Levy <alevy@redhat.com>
56753f
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
56753f
---
56753f
 ui/spice-display.c |   10 +++++-----
56753f
 1 file changed, 5 insertions(+), 5 deletions(-)
56753f
56753f
diff --git a/ui/spice-display.c b/ui/spice-display.c
56753f
index 6d7563f..cb8a7ad 100644
56753f
--- a/ui/spice-display.c
56753f
+++ b/ui/spice-display.c
56753f
@@ -168,7 +168,7 @@ static SimpleSpiceUpdate *qemu_spice_create_update(SimpleSpiceDisplay *ssd)
56753f
     drawable->bbox            = ssd->dirty;
56753f
     drawable->clip.type       = SPICE_CLIP_TYPE_NONE;
56753f
     drawable->effect          = QXL_EFFECT_OPAQUE;
56753f
-    drawable->release_info.id = (intptr_t)update;
56753f
+    drawable->release_info.id = (uintptr_t)update;
56753f
     drawable->type            = QXL_DRAW_COPY;
56753f
     drawable->surfaces_dest[0] = -1;
56753f
     drawable->surfaces_dest[1] = -1;
56753f
@@ -179,7 +179,7 @@ static SimpleSpiceUpdate *qemu_spice_create_update(SimpleSpiceDisplay *ssd)
56753f
                       + time_space.tv_nsec / 1000 / 1000;
56753f
 
56753f
     drawable->u.copy.rop_descriptor  = SPICE_ROPD_OP_PUT;
56753f
-    drawable->u.copy.src_bitmap      = (intptr_t)image;
56753f
+    drawable->u.copy.src_bitmap      = (uintptr_t)image;
56753f
     drawable->u.copy.src_area.right  = bw;
56753f
     drawable->u.copy.src_area.bottom = bh;
56753f
 
56753f
@@ -189,7 +189,7 @@ static SimpleSpiceUpdate *qemu_spice_create_update(SimpleSpiceDisplay *ssd)
56753f
     image->bitmap.stride     = bw * 4;
56753f
     image->descriptor.width  = image->bitmap.x = bw;
56753f
     image->descriptor.height = image->bitmap.y = bh;
56753f
-    image->bitmap.data = (intptr_t)(update->bitmap);
56753f
+    image->bitmap.data = (uintptr_t)(update->bitmap);
56753f
     image->bitmap.palette = 0;
56753f
     image->bitmap.format = SPICE_BITMAP_FMT_32BIT;
56753f
 
56753f
@@ -210,7 +210,7 @@ static SimpleSpiceUpdate *qemu_spice_create_update(SimpleSpiceDisplay *ssd)
56753f
     }
56753f
 
56753f
     cmd->type = QXL_CMD_DRAW;
56753f
-    cmd->data = (intptr_t)drawable;
56753f
+    cmd->data = (uintptr_t)drawable;
56753f
 
56753f
     memset(&ssd->dirty, 0, sizeof(ssd->dirty));
56753f
     return update;
56753f
@@ -254,7 +254,7 @@ void qemu_spice_create_host_primary(SimpleSpiceDisplay *ssd)
56753f
     surface.mouse_mode = true;
56753f
     surface.flags      = 0;
56753f
     surface.type       = 0;
56753f
-    surface.mem        = (intptr_t)ssd->buf;
56753f
+    surface.mem        = (uintptr_t)ssd->buf;
56753f
     surface.group_id   = MEMSLOT_GROUP_HOST;
56753f
 
56753f
     qemu_spice_create_primary_surface(ssd, 0, &surface, QXL_SYNC);
56753f
-- 
56753f
1.7.10
56753f