[Spice-devel,19/19] qxl_switch_mode: don't evacuate, just recreate primary surface

Submitted by Alon Levy on May 31, 2012, 10:24 a.m.

Details

Message ID 1338459893-1980-20-git-send-email-alevy@redhat.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Alon Levy May 31, 2012, 10:24 a.m.
In summary, on vt enter we still:
 reset
 recreate memory slots
 clear our mspace allocators
 and then do what switch mode below says

On vt leave we still:
 reset (this is redundant since the first VGA access will trigger a
 reset on the device side)

On switch mode however we only:
 destroy primary surface
 create primary surface (different size)
---
 src/qxl_driver.c |   32 +++++++++++++-------------------
 1 file changed, 13 insertions(+), 19 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/qxl_driver.c b/src/qxl_driver.c
index 809be5e..25e2566 100644
--- a/src/qxl_driver.c
+++ b/src/qxl_driver.c
@@ -719,19 +719,14 @@  qxl_switch_mode(int scrnIndex, DisplayModePtr p, int flags)
     int mode_index = (int)(unsigned long)p->Private;
     struct QXLMode *m = qxl->modes + mode_index;
     ScreenPtr pScreen;
-    void *evacuated;
-
-    evacuated = qxl_surface_cache_evacuate_all (qxl->surface_cache);
 
     if (qxl->primary)
     {
 	qxl_surface_kill (qxl->primary);
 	qxl_surface_cache_sanity_check (qxl->surface_cache);
     }
-	
-    qxl_reset_and_create_mem_slots (qxl);
-    
-    ErrorF ("done reset\n");
+
+    qxl_io_destroy_primary(qxl);
 
     qxl->primary = qxl_surface_cache_create_primary (qxl->surface_cache, m);
     qxl->current_mode = m;
@@ -748,19 +743,7 @@  qxl_switch_mode(int scrnIndex, DisplayModePtr p, int flags)
 	
 	set_surface (root, qxl->primary);
     }
-    
-    ErrorF ("primary is %p\n", qxl->primary);
-    if (qxl->mem)
-    {
-       qxl_mem_free_all (qxl->mem);
-       qxl_drop_image_cache (qxl);
-    }
 
-    if (qxl->surf_mem)
-	qxl_mem_free_all (qxl->surf_mem);
-
-    qxl_surface_cache_replace_all (qxl->surface_cache, evacuated);
-    
     return TRUE;
 }
 
@@ -1279,8 +1262,19 @@  qxl_enter_vt(int scrnIndex, int flags)
     qxl_screen_t *qxl = pScrn->driverPrivate;
 
     qxl_save_state(pScrn);
+
+    qxl_reset_and_create_mem_slots (qxl);
+
     qxl_switch_mode(scrnIndex, pScrn->currentMode, 0);
 
+    if (qxl->mem) {
+       qxl_mem_free_all (qxl->mem);
+       qxl_drop_image_cache (qxl);
+    }
+
+    if (qxl->surf_mem)
+       qxl_mem_free_all (qxl->surf_mem);
+
     if (qxl->vt_surfaces)
     {
 	qxl_surface_cache_replace_all (qxl->surface_cache, qxl->vt_surfaces);