34b321
From e7fe5cf70d63552006e8c9eb660db95279f2a3a9 Mon Sep 17 00:00:00 2001
34b321
From: Gerd Hoffmann <kraxel@redhat.com>
34b321
Date: Fri, 22 Jul 2016 09:34:41 +0200
34b321
Subject: [PATCH 4/4] qxl: fix qxl_set_dirty call in qxl_dirty_one_surface
34b321
34b321
RH-Author: Gerd Hoffmann <kraxel@redhat.com>
34b321
Message-id: <1469180081-28522-5-git-send-email-kraxel@redhat.com>
34b321
Patchwork-id: 71316
34b321
O-Subject: [RHEL-7.3 qemu-kvm PATCH v2 4/4] qxl: fix qxl_set_dirty call in qxl_dirty_one_surface
34b321
Bugzilla: 1355730
34b321
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
34b321
RH-Acked-by: John Snow <jsnow@redhat.com>
34b321
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
34b321
34b321
qxl_set_dirty() expects start and end as range specification.
34b321
qxl_dirty_one_surface passes 'size' instead of 'offset + size' as end
34b321
parameter.  Fix that.  Also use uint64_t everywhere while being at it.
34b321
34b321
Bug was added by "e25139b qxl: set only off-screen surfaces dirty instead
34b321
of the whole vram" and carried forward unnoticed by "5cdc402 qxl: fix
34b321
surface migration".
34b321
34b321
Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
34b321
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
34b321
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
34b321
Message-id: 1468413187-22071-1-git-send-email-kraxel@redhat.com
34b321
(cherry picked from commit e0127d2eec9cd5676ea9f3c47c2a7579a02c0466)
34b321
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
34b321
34b321
Conflicts:
34b321
	hw/display/trace-events
34b321
---
34b321
 hw/display/qxl.c | 11 ++++++-----
34b321
 trace-events     |  2 +-
34b321
 2 files changed, 7 insertions(+), 6 deletions(-)
34b321
34b321
diff --git a/hw/display/qxl.c b/hw/display/qxl.c
34b321
index d65c830..f762439 100644
34b321
--- a/hw/display/qxl.c
34b321
+++ b/hw/display/qxl.c
34b321
@@ -1825,16 +1825,17 @@ static void qxl_hw_text_update(void *opaque, console_ch_t *chardata)
34b321
 static void qxl_dirty_one_surface(PCIQXLDevice *qxl, QXLPHYSICAL pqxl,
34b321
                                   uint32_t height, int32_t stride)
34b321
 {
34b321
-    uint64_t offset;
34b321
-    uint32_t slot, size;
34b321
+    uint64_t offset, size;
34b321
+    uint32_t slot;
34b321
     bool rc;
34b321
 
34b321
     rc = qxl_get_check_slot_offset(qxl, pqxl, &slot, &offset);
34b321
     assert(rc == true);
34b321
-    size = height * abs(stride);
34b321
-    trace_qxl_surfaces_dirty(qxl->id, (int)offset, size);
34b321
+    size = (uint64_t)height * abs(stride);
34b321
+    trace_qxl_surfaces_dirty(qxl->id, offset, size);
34b321
     qxl_set_dirty(qxl->guest_slots[slot].mr,
34b321
-                  qxl->guest_slots[slot].offset + offset, size);
34b321
+                  qxl->guest_slots[slot].offset + offset,
34b321
+                  qxl->guest_slots[slot].offset + offset + size);
34b321
 }
34b321
 
34b321
 static void qxl_dirty_surfaces(PCIQXLDevice *qxl)
34b321
diff --git a/trace-events b/trace-events
34b321
index 4da84b2..af5147a 100644
34b321
--- a/trace-events
34b321
+++ b/trace-events
34b321
@@ -1078,7 +1078,7 @@ qxl_spice_reset_image_cache(int qid) "%d"
34b321
 qxl_spice_reset_memslots(int qid) "%d"
34b321
 qxl_spice_update_area(int qid, uint32_t surface_id, uint32_t left, uint32_t right, uint32_t top, uint32_t bottom) "%d sid=%d [%d,%d,%d,%d]"
34b321
 qxl_spice_update_area_rest(int qid, uint32_t num_dirty_rects, uint32_t clear_dirty_region) "%d #d=%d clear=%d"
34b321
-qxl_surfaces_dirty(int qid, int offset, int size) "%d offset=%d size=%d"
34b321
+qxl_surfaces_dirty(int qid, uint64_t offset, uint64_t size) "%d offset=0x%"PRIx64" size=0x%"PRIx64
34b321
 qxl_send_events(int qid, uint32_t events) "%d %d"
34b321
 qxl_send_events_vm_stopped(int qid, uint32_t events) "%d %d"
34b321
 qxl_set_guest_bug(int qid) "%d"
34b321
-- 
34b321
1.8.3.1
34b321