[Spice-devel] [spice-protocol PATCH 46/46] qxlhw: add and use qxlhw_pci_get_shadow_rom, remove qxl_screen_t.shadow_rom

Alon Levy alevy at redhat.com
Tue Apr 10 04:50:42 PDT 2012


---
 src/qxl.h              |    1 -
 src/qxlhw_pci.c        |    7 +++++++
 src/qxlhw_pci.h        |    1 +
 src/spiceqxl_display.c |    9 ++++++---
 src/spiceqxl_driver.c  |    3 ++-
 src/spiceqxl_io_port.c |    5 +++--
 6 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/src/qxl.h b/src/qxl.h
index 8ef29ee..5c82a79 100644
--- a/src/qxl.h
+++ b/src/qxl.h
@@ -169,7 +169,6 @@ struct _qxl_screen_t
     
 #ifdef XSPICE
     /* XSpice specific */
-    struct QXLRom		shadow_rom;    /* Parameter RAM */
     SpiceServer *       spice_server;
     QXLWorker *         worker;
     int                 worker_running;
diff --git a/src/qxlhw_pci.c b/src/qxlhw_pci.c
index 0d483fc..4f737f4 100644
--- a/src/qxlhw_pci.c
+++ b/src/qxlhw_pci.c
@@ -1013,4 +1013,11 @@ void *qxlhw_pci_get_ram(struct qxlhw *base)
 
     return hw->ram;
 }
+
+struct QXLRom *qxlhw_pci_get_shadow_rom(struct qxlhw *base)
+{
+    struct qxlhw_pci *hw = (struct qxlhw_pci *)base;
+
+    return &hw->shadow_rom;
+}
 #endif
diff --git a/src/qxlhw_pci.h b/src/qxlhw_pci.h
index 4dbf4aa..51b559d 100644
--- a/src/qxlhw_pci.h
+++ b/src/qxlhw_pci.h
@@ -18,6 +18,7 @@ struct QXLRam *qxlhw_pci_get_ram_header(struct qxlhw *base);
 void *qxlhw_pci_get_ram(struct qxlhw *base);
 void *qxlhw_pci_get_vram(struct qxlhw *base);
 struct QXLRom *qxlhw_pci_get_rom(struct qxlhw *base);
+struct QXLRom *qxlhw_pci_get_shadow_rom(struct qxlhw *base);
 #endif
 
 #endif
diff --git a/src/spiceqxl_display.c b/src/spiceqxl_display.c
index 85088fa..394b89a 100644
--- a/src/spiceqxl_display.c
+++ b/src/spiceqxl_display.c
@@ -103,25 +103,28 @@ static void interface_attach_worker(QXLInstance *sin, QXLWorker *qxl_worker)
 static void interface_set_compression_level(QXLInstance *sin, int level)
 {
     qxl_screen_t *qxl = container_of(sin, qxl_screen_t, display_sin);
+    struct QXLRom *shadow_rom = qxlhw_pci_get_shadow_rom(qxl->hw);
     struct QXLRom *rom = qxlhw_pci_get_rom(qxl->hw);
 
     dprint(qxl, 1, "%s: %d\n", __FUNCTION__, level);
-    qxl->shadow_rom.compression_level = level;
+    shadow_rom->compression_level = level;
     rom->compression_level = level;
 }
 
 static void interface_set_mm_time(QXLInstance *sin, uint32_t mm_time)
 {
     qxl_screen_t *qxl = container_of(sin, qxl_screen_t, display_sin);
+    struct QXLRom *shadow_rom = qxlhw_pci_get_shadow_rom(qxl->hw);
     struct QXLRom *rom = qxlhw_pci_get_rom(qxl->hw);
 
-    qxl->shadow_rom.mm_clock = mm_time;
+    shadow_rom->mm_clock = mm_time;
     rom->mm_clock = mm_time;
 }
 
 static void interface_get_init_info(QXLInstance *sin, QXLDevInitInfo *info)
 {
     qxl_screen_t *qxl = container_of(sin, qxl_screen_t, display_sin);
+    struct QXLRom *shadow_rom = qxlhw_pci_get_shadow_rom(qxl->hw);
 
     dprint(qxl, 1, "%s:\n", __FUNCTION__);
     info->memslot_gen_bits = MEMSLOT_GENERATION_BITS;
@@ -129,7 +132,7 @@ static void interface_get_init_info(QXLInstance *sin, QXLDevInitInfo *info)
     info->num_memslots = NUM_MEMSLOTS;
     info->num_memslots_groups = NUM_MEMSLOTS_GROUPS;
     info->internal_groupslot_id = 0;
-    info->qxl_ram_size = qxl->shadow_rom.num_pages << TARGET_PAGE_BITS;
+    info->qxl_ram_size = shadow_rom->num_pages << TARGET_PAGE_BITS;
     info->n_surfaces = NUM_SURFACES;
 }
 
diff --git a/src/spiceqxl_driver.c b/src/spiceqxl_driver.c
index d657cf0..e7b88fd 100644
--- a/src/spiceqxl_driver.c
+++ b/src/spiceqxl_driver.c
@@ -156,5 +156,6 @@ void init_qxl_rom(qxl_screen_t* qxl, uint32_t rom_size)
     rom->num_pages          = (num_pages);
     rom->ram_header_offset  = (VRAM_SIZE - ram_header_size);
 
-    qxl->shadow_rom = *qxlhw_pci_get_rom(qxl->hw);    // TODO - do we need this?
+    // TODO - do we need this?
+    *qxlhw_pci_get_shadow_rom(qxl->hw) = *qxlhw_pci_get_rom(qxl->hw);
 }
diff --git a/src/spiceqxl_io_port.c b/src/spiceqxl_io_port.c
index db7d715..86c3d6e 100644
--- a/src/spiceqxl_io_port.c
+++ b/src/spiceqxl_io_port.c
@@ -95,12 +95,13 @@ void xspice_init_qxl_ram(qxl_screen_t *qxl)
 static void qxl_reset_state(qxl_screen_t *qxl)
 {
     QXLRam *ram = qxlhw_pci_get_ram_header(qxl->hw);
+    struct QXLRom *shadow_rom = qxlhw_pci_get_shadow_rom(qxl->hw);
     struct QXLRom *rom = qxlhw_pci_get_rom(qxl->hw);
 
     assert(SPICE_RING_IS_EMPTY(&ram->cmd_ring));
     assert(SPICE_RING_IS_EMPTY(&ram->cursor_ring));
-    qxl->shadow_rom.update_id = 0;
-    *rom = qxl->shadow_rom;
+    shadow_rom->update_id = 0;
+    *rom = *shadow_rom;
     xspice_init_qxl_ram(qxl);
     qxl->num_free_res = 0;
     qxl->last_release = NULL;
-- 
1.7.9.3



More information about the Spice-devel mailing list