present: Add cleanups for window flip mode
Make sure that vblanks and windows get cleaned up correctly in window flip mode. Signed-off-by: Roman Gilg <subdiff@gmail.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
		
							parent
							
								
									66a5c0bccb
								
							
						
					
					
						commit
						a337949f99
					
				|  | @ -109,6 +109,32 @@ present_clear_window_flip(WindowPtr window) | |||
|     } | ||||
| } | ||||
| 
 | ||||
| static void | ||||
| present_wnmd_clear_window_flip(WindowPtr window) | ||||
| { | ||||
|     present_window_priv_ptr     window_priv = present_window_priv(window); | ||||
|     present_vblank_ptr          vblank, tmp; | ||||
| 
 | ||||
|     if (window_priv->flip_pending) { | ||||
|         present_wnmd_set_abort_flip(window); | ||||
|         window_priv->flip_pending->window = NULL; | ||||
|     } | ||||
| 
 | ||||
|     xorg_list_for_each_entry_safe(vblank, tmp, &window_priv->idle_queue, event_queue) { | ||||
|         present_pixmap_idle(vblank->pixmap, vblank->window, vblank->serial, vblank->idle_fence); | ||||
|         /* The pixmap will be destroyed by freeing the window resources. */ | ||||
|         vblank->pixmap = NULL; | ||||
|         present_vblank_destroy(vblank); | ||||
|     } | ||||
| 
 | ||||
|     vblank = window_priv->flip_active; | ||||
|     if (vblank) { | ||||
|         present_pixmap_idle(vblank->pixmap, vblank->window, vblank->serial, vblank->idle_fence); | ||||
|         present_vblank_destroy(vblank); | ||||
|     } | ||||
|     window_priv->flip_active = NULL; | ||||
| } | ||||
| 
 | ||||
| /*
 | ||||
|  * Hook the close window function to clean up our window private | ||||
|  */ | ||||
|  | @ -124,7 +150,12 @@ present_destroy_window(WindowPtr window) | |||
|         present_clear_window_notifies(window); | ||||
|         present_free_events(window); | ||||
|         present_free_window_vblank(window); | ||||
| 
 | ||||
|         if (screen_priv->wnmd_info) | ||||
|             present_wnmd_clear_window_flip(window); | ||||
|         else | ||||
|             present_clear_window_flip(window); | ||||
| 
 | ||||
|         free(window_priv); | ||||
|     } | ||||
|     unwrap(screen_priv, screen, DestroyWindow); | ||||
|  |  | |||
|  | @ -172,6 +172,8 @@ present_vblank_destroy(present_vblank_ptr vblank) | |||
| { | ||||
|     /* Remove vblank from window and screen lists */ | ||||
|     xorg_list_del(&vblank->window_list); | ||||
|     /* Also make sure vblank is removed from event queue (wnmd) */ | ||||
|     xorg_list_del(&vblank->event_queue); | ||||
| 
 | ||||
|     DebugPresent(("\td %lld %p %8lld: %08lx -> %08lx\n", | ||||
|                   vblank->event_id, vblank, vblank->target_msc, | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue