diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-03-06 12:17:03 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-03-06 12:25:55 +0000 |
commit | 232972c0e5bd833c1d0b33432fa8092c601fd0e5 (patch) | |
tree | 89b6de6f88f2d05ac7fbd1b889282453c61dd03b | |
parent | eb10ade0fc8e21cd01c0d8acba7891fd7f2aa222 (diff) |
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@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_accel.c | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index a8737b5f..ce3afaef 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; } |