xf86-video-intel: src/sna/sna_accel.c

Chris Wilson ickle at kemper.freedesktop.org
Tue Mar 6 04:28:31 PST 2012


 src/sna/sna_accel.c |   32 +++++++++-----------------------
 1 file changed, 9 insertions(+), 23 deletions(-)

New commits:
commit 232972c0e5bd833c1d0b33432fa8092c601fd0e5
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Mar 6 12:17:03 2012 +0000

    sna: Remove the 2-step damage flush
    
    The idea was to reduce the number of unnecessary flushes by checking for
    outgoing damage (could be refined further by inspecting the reply/event
    callback for a XDamageNotifyEvent). However, it does not flush
    sufficiently for the compositors' liking. As it doesn't appear to restore
    performance to near uncomposited levels anyway, remove the complication.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index a8737b5..ce3afae 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -11459,31 +11459,20 @@ static Bool sna_change_window_attributes(WindowPtr win, unsigned long mask)
 }
 
 static void
-sna_accel_reply_callback(CallbackListPtr *list,
-			 pointer user_data, pointer call_data)
-{
-	struct sna *sna = user_data;
-
-	if (sna->flush)
-		return;
-
-	/* Assume each callback corresponds to a new request. The use
-	 * of continuation WriteToClients in the server is relatively rare,
-	 * and we err on the side of safety.
-	 */
-	sna->flush = (sna->kgem.flush || sna->kgem.sync ||
-		      !list_is_empty(&sna->dirty_pixmaps));
-}
-
-static void
 sna_accel_flush_callback(CallbackListPtr *list,
 			 pointer user_data, pointer call_data)
 {
 	struct sna *sna = user_data;
 	struct list preserve;
 
-	if (!sna->flush)
-		return;
+	/* XXX we should be able to reduce the frequency of flushes further
+	 * by checking for outgoing damage events or sync replies. Tricky,
+	 * and doesn't appear to mitigate the performance loss.
+	 */
+	if (!(sna->kgem.flush ||
+	      sna->kgem.sync ||
+	      !list_is_empty(&sna->dirty_pixmaps)))
+	    return;
 
 	DBG(("%s: need_sync=%d, need_flush=%d, dirty? %d\n", __FUNCTION__,
 	     sna->kgem.sync!=NULL, sna->kgem.flush, !list_is_empty(&sna->dirty_pixmaps)));
@@ -11934,8 +11923,7 @@ void sna_accel_watch_flush(struct sna *sna, int enable)
 	if (sna->watch_flush == 0) {
 		DBG(("%s: installing watchers\n", __FUNCTION__));
 		assert(enable > 0);
-		if (!AddCallback(&ReplyCallback, sna_accel_reply_callback, sna) ||
-		    !AddCallback(&FlushCallback, sna_accel_flush_callback, sna)) {
+		if (!AddCallback(&FlushCallback, sna_accel_flush_callback, sna)) {
 			xf86DrvMsg(sna->scrn->scrnIndex, X_Error,
 				   "Failed to attach ourselves to the flush callbacks, expect missing synchronisation with DRI clients (e.g a compositor)\n");
 		}
@@ -11959,7 +11947,6 @@ void sna_accel_close(struct sna *sna)
 	sna_glyphs_close(sna);
 
 	DeleteCallback(&FlushCallback, sna_accel_flush_callback, sna);
-	DeleteCallback(&ReplyCallback, sna_accel_reply_callback, sna);
 
 	kgem_cleanup_cache(&sna->kgem);
 }
@@ -11989,7 +11976,6 @@ void sna_accel_block_handler(struct sna *sna)
 
 	if (sna->flush == 0 && sna->watch_flush == 1) {
 		DBG(("%s: removing watchers\n", __FUNCTION__));
-		DeleteCallback(&ReplyCallback, sna_accel_reply_callback, sna);
 		DeleteCallback(&FlushCallback, sna_accel_flush_callback, sna);
 		sna->watch_flush = 0;
 	}


More information about the xorg-commit mailing list