[PATCH] iofix
Gerd Hoffmann
kraxel at redhat.com
Fri Jun 17 08:13:55 PDT 2011
Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>
---
src/qxl.h | 5 +++++
src/qxl_driver.c | 23 ++++++++++++++++++++++-
src/qxl_surface.c | 2 +-
3 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/src/qxl.h b/src/qxl.h
index a2daa8b..6f2c93d 100644
--- a/src/qxl.h
+++ b/src/qxl.h
@@ -335,4 +335,9 @@ void * qxl_allocnf (qxl_screen_t *qxl,
unsigned long size);
int qxl_garbage_collect (qxl_screen_t *qxl);
+/*
+ * I/O port commands
+ */
+void qxl_update_area(qxl_screen_t *qxl);
+
#endif // QXL_H
diff --git a/src/qxl_driver.c b/src/qxl_driver.c
index 08bf2d8..c06642e 100644
--- a/src/qxl_driver.c
+++ b/src/qxl_driver.c
@@ -143,6 +143,27 @@ qxl_handle_oom (qxl_screen_t *qxl)
return qxl_garbage_collect (qxl);
}
+static void qxl_wait_for_io_command(qxl_screen_t *qxl)
+{
+ struct QXLRam *ram_header = (void *)(
+ (unsigned long)qxl->ram + qxl->rom->ram_header_offset);
+
+ while (!(ram_header->int_pending & QXL_INTERRUPT_IO_CMD)) {
+ usleep(1000);
+ }
+ ram_header->int_pending &= QXL_INTERRUPT_IO_CMD;
+}
+
+void qxl_update_area(qxl_screen_t *qxl)
+{
+ if (qxl->pci->revision >= 3) {
+ outb (qxl->io_base + QXL_IO_UPDATE_AREA_ASYNC, 0);
+ qxl_wait_for_io_command(qxl);
+ } else {
+ outb (qxl->io_base + QXL_IO_UPDATE_AREA, 0);
+ }
+}
+
void *
qxl_allocnf (qxl_screen_t *qxl, unsigned long size)
{
@@ -168,7 +189,7 @@ qxl_allocnf (qxl_screen_t *qxl, unsigned long size)
ram_header->update_area.right = qxl->virtual_x;
ram_header->update_surface = 0; /* Only primary for now */
- outb (qxl->io_base + QXL_IO_UPDATE_AREA, 0);
+ qxl_update_area(qxl);
#if 0
ErrorF ("eliminated memory (%d)\n", nth_oom++);
diff --git a/src/qxl_surface.c b/src/qxl_surface.c
index bf91483..433ef97 100644
--- a/src/qxl_surface.c
+++ b/src/qxl_surface.c
@@ -920,7 +920,7 @@ download_box (qxl_surface_t *surface, int x1, int y1, int x2, int y2)
ErrorF ("Issuing update command for %d\n", surface->id);
#endif
- outb (surface->cache->qxl->io_base + QXL_IO_UPDATE_AREA, 0);
+ qxl_update_area(surface->cache->qxl);
pixman_image_composite (PIXMAN_OP_SRC,
surface->dev_image,
--
1.7.1
--------------090205080200090600010605--
More information about the Spice-devel
mailing list