[Spice-devel] [spice-protocol PATCH 08/46] qxl->qxlhw: move save/restore_state
Alon Levy
alevy at redhat.com
Tue Apr 10 04:50:04 PDT 2012
---
src/qxl_driver.c | 38 ++++----------------------------------
src/qxlhw.c | 10 ++++++++++
src/qxlhw.h | 5 +++++
src/qxlhw_pci.c | 24 ++++++++++++++++++++++++
4 files changed, 43 insertions(+), 34 deletions(-)
diff --git a/src/qxl_driver.c b/src/qxl_driver.c
index a39d8c7..6ffbfa9 100644
--- a/src/qxl_driver.c
+++ b/src/qxl_driver.c
@@ -318,36 +318,6 @@ qxl_blank_screen(ScreenPtr pScreen, int mode)
return TRUE;
}
-#ifdef XSPICE
-static void
-qxl_save_state(ScrnInfoPtr pScrn)
-{
-}
-
-static void
-qxl_restore_state(ScrnInfoPtr pScrn)
-{
-}
-#else /* QXL */
-static void
-qxl_save_state(ScrnInfoPtr pScrn)
-{
- qxl_screen_t *qxl = pScrn->driverPrivate;
-
- if (xf86IsPrimaryPci (qxl->pci))
- vgaHWSaveFonts(pScrn, &qxl->vgaRegs);
-}
-
-static void
-qxl_restore_state(ScrnInfoPtr pScrn)
-{
- qxl_screen_t *qxl = pScrn->driverPrivate;
-
- if (xf86IsPrimaryPci (qxl->pci))
- vgaHWRestoreFonts(pScrn, &qxl->vgaRegs);
-}
-#endif /* XSPICE */
-
static Bool
qxl_close_screen(int scrnIndex, ScreenPtr pScreen)
{
@@ -371,7 +341,7 @@ qxl_close_screen(int scrnIndex, ScreenPtr pScreen)
if (pScrn->vtSema)
{
- qxl_restore_state(pScrn);
+ qxlhw_restore_state(qxl->hw, pScrn);
qxlhw_unmap_memory(qxl->hw, scrnIndex);
}
pScrn->vtSema = FALSE;
@@ -846,7 +816,7 @@ qxl_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
printf ("ram_header at %d\n", rom->ram_header_offset);
printf ("surf0 size: %d\n", rom->surface0_area_size);
- qxl_save_state(pScrn);
+ qxlhw_save_state(qxl->hw, pScrn);
qxl_blank_screen(pScreen, SCREEN_SAVER_ON);
miClearVisualTypes();
@@ -955,7 +925,7 @@ qxl_enter_vt(int scrnIndex, int flags)
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
qxl_screen_t *qxl = pScrn->driverPrivate;
- qxl_save_state(pScrn);
+ qxlhw_save_state(qxl->hw, pScrn);
qxl_switch_mode(scrnIndex, pScrn->currentMode, 0);
if (qxl->vt_surfaces)
@@ -982,7 +952,7 @@ qxl_leave_vt(int scrnIndex, int flags)
outb(qxl->io_base + QXL_IO_RESET, 0);
- qxl_restore_state(pScrn);
+ qxlhw_restore_state(qxl->hw, pScrn);
}
static Bool
diff --git a/src/qxlhw.c b/src/qxlhw.c
index d9617e7..42ca0db 100644
--- a/src/qxlhw.c
+++ b/src/qxlhw.c
@@ -28,6 +28,16 @@ void qxlhw_reset(struct qxlhw *base)
base->reset(base);
}
+void qxlhw_save_state(struct qxlhw *base, ScrnInfoPtr pScrn)
+{
+ base->save_state(base, pScrn);
+}
+
+void qxlhw_restore_state(struct qxlhw *base, ScrnInfoPtr pScrn)
+{
+ base->restore_state(base, pScrn);
+}
+
Bool qxlhw_map_memory(struct qxlhw *base, int scrnIndex)
{
return base->map_memory(base, scrnIndex);
diff --git a/src/qxlhw.h b/src/qxlhw.h
index 28a1e70..67e7edd 100644
--- a/src/qxlhw.h
+++ b/src/qxlhw.h
@@ -11,6 +11,8 @@ struct qxlhw {
/* device callbacks */
void (*device_reset)(struct qxlhw *base);
void (*reset)(struct qxlhw *base);
+ void (*save_state)(struct qxlhw *base, ScrnInfoPtr pScrn);
+ void (*restore_state)(struct qxlhw *base, ScrnInfoPtr pScrn);
Bool (*map_memory)(struct qxlhw *base, int scrnIndex);
void (*unmap_memory)(struct qxlhw *base, int scrnIndex);
@@ -31,6 +33,9 @@ void qxlhw_update_area(struct qxlhw *base, int surface_id, struct QXLRect rect);
void qxlhw_device_reset(struct qxlhw *base);
void qxlhw_reset(struct qxlhw *base);
+void qxlhw_save_state(struct qxlhw *base, ScrnInfoPtr pScrn);
+void qxlhw_restore_state(struct qxlhw *base, ScrnInfoPtr pScrn);
+
Bool qxlhw_map_memory(struct qxlhw *base, int scrnIndex);
void qxlhw_unmap_memory(struct qxlhw *base, int scrnIndex);
diff --git a/src/qxlhw_pci.c b/src/qxlhw_pci.c
index f25b792..d6a0b63 100644
--- a/src/qxlhw_pci.c
+++ b/src/qxlhw_pci.c
@@ -367,6 +367,28 @@ static void qxlhw_pci_reset(struct qxlhw *base)
base->qxl->vram_mem_slot = hw->vram_mem_slot;
}
+static void qxlhw_pci_save_state(struct qxlhw *base, ScrnInfoPtr pScrn)
+{
+#ifndef XSPICE
+ struct qxlhw_pci *hw = (struct qxlhw_pci *)base;
+ qxl_screen_t *qxl = base->qxl;
+
+ if (xf86IsPrimaryPci (qxl->pci))
+ vgaHWSaveFonts(pScrn, &hw->vgaRegs);
+#endif
+}
+
+static void qxlhw_pci_restore_state(struct qxlhw *base, ScrnInfoPtr pScrn)
+{
+#ifndef XSPICE
+ struct qxlhw_pci *hw = (struct qxlhw_pci *)base;
+ qxl_screen_t *qxl = base->qxl;
+
+ if (xf86IsPrimaryPci (qxl->pci))
+ vgaHWRestoreFonts(pScrn, &hw->vgaRegs);
+#endif
+}
+
static void qxlhw_pci_update_area(struct qxlhw *base, int surface_id, struct QXLRect rect)
{
struct qxlhw_pci *hw = (struct qxlhw_pci *)base;
@@ -398,6 +420,8 @@ struct qxlhw *create_qxlhw_pci(qxl_screen_t *qxl, ScrnInfoPtr pScrn)
qxlhw_init(base, qxl);
base->device_reset = qxlhw_pci_device_reset;
base->reset = qxlhw_pci_reset;
+ base->save_state = qxlhw_pci_save_state;
+ base->restore_state = qxlhw_pci_restore_state;
base->map_memory = qxlhw_pci_map_memory;
base->unmap_memory = qxlhw_pci_unmap_memory;
base->update_area = qxlhw_pci_update_area;
--
1.7.9.3
More information about the Spice-devel
mailing list