[Spice-devel] [PATCH xf86-video-qxl master 2/2] Don't try to switch back from vga mode when our vt is not focussed

Hans de Goede hdegoede at redhat.com
Sun Oct 10 05:00:25 PDT 2010


Trying to do so causes the X-server to segfault, which is, erm, undesirable :)
---
 src/qxl.h        |    2 ++
 src/qxl_driver.c |    8 ++++++++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/qxl.h b/src/qxl.h
index 17fa5b4..138abbb 100644
--- a/src/qxl.h
+++ b/src/qxl.h
@@ -527,6 +527,8 @@ struct _qxl_screen_t
     int16_t			hot_y;
     
     ScrnInfoPtr			pScrn;
+    
+    int				vt_focussed;
 };
 
 static inline uint64_t
diff --git a/src/qxl_driver.c b/src/qxl_driver.c
index 9b89d02..2e9a4b1 100644
--- a/src/qxl_driver.c
+++ b/src/qxl_driver.c
@@ -583,6 +583,9 @@ qxl_block_handler (pointer data, OSTimePtr pTimeout, pointer pRead)
 {
     qxl_screen_t *qxl = (qxl_screen_t *) data;
 
+    if (!qxl->vt_focussed)
+        return;
+
     qxl_sanity_check(qxl);
 
     accept_damage (qxl);
@@ -971,6 +974,7 @@ qxl_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
     CHECK_POINT();
 
     qxl->pScrn = pScrn;
+    qxl->vt_focussed = TRUE;
     
     if (!qxl_map_memory(qxl, scrnIndex))
 	return FALSE;
@@ -1089,9 +1093,11 @@ static Bool
 qxl_enter_vt(int scrnIndex, int flags)
 {
     ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+    qxl_screen_t *qxl = pScrn->driverPrivate;
 
     qxl_save_state(pScrn);
     qxl_switch_mode(scrnIndex, pScrn->currentMode, 0);
+    qxl->vt_focussed = TRUE;
 
     return TRUE;
 }
@@ -1100,7 +1106,9 @@ static void
 qxl_leave_vt(int scrnIndex, int flags)
 {
     ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+    qxl_screen_t *qxl = pScrn->driverPrivate;
 
+    qxl->vt_focussed = FALSE;
     qxl_restore_state(pScrn);
 }
 
-- 
1.7.1



More information about the Spice-devel mailing list