xf86-video-intel: src/sna/sna_dri2.c
Chris Wilson
ickle at kemper.freedesktop.org
Tue Mar 3 03:54:30 PST 2015
src/sna/sna_dri2.c | 42 +++++++++++++++++++++++++++++-------------
1 file changed, 29 insertions(+), 13 deletions(-)
New commits:
commit 78aaba45c9ccc56061597ee9c5e1c822566a0da3
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Tue Mar 3 11:41:36 2015 +0000
sna/dri2: Pre-fill new backbuffers
When we enable buffer-age and Clients start taking advantage of that by
only submitting trimmed flips (SwapBuffersWithDamage) we don't want to
then lose that by randomly injecting new buffers into the mix (thereby
forcing the client to repaint the entire buffer and us to damage all
outputs). As new buffers are relatively rare, especially in a
steady-state game scenario, spend a few cycles to initialise the new
buffer with the current back buffer contents.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_dri2.c b/src/sna/sna_dri2.c
index 32f65ca..d9d2b35 100644
--- a/src/sna/sna_dri2.c
+++ b/src/sna/sna_dri2.c
@@ -138,6 +138,19 @@ struct sna_dri2_event {
int keepalive;
};
+#if DRI2INFOREC_VERSION < 10
+#undef USE_ASYNC_SWAP
+#define USE_ASYNC_SWAP 0
+#endif
+
+#if USE_ASYNC_SWAP
+#define KEEPALIVE 4 /* wait ~50ms before discarding swap caches */
+#define APPLY_DAMAGE 0
+#else
+#define KEEPALIVE 1
+#define APPLY_DAMAGE 1
+#endif
+
static void sna_dri2_flip_event(struct sna_dri2_event *flip);
inline static DRI2BufferPtr dri2_window_get_front(WindowPtr win);
@@ -220,6 +233,22 @@ sna_dri2_get_back(struct sna *sna,
}
flags = 0;
+ if (USE_ASYNC_SWAP) {
+ BoxRec box;
+
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = draw->width;
+ box.y2 = draw->height;
+
+ DBG(("%s: filling new buffer with old back\n", __FUNCTION__));
+ assert(back->flags);
+ if (sna->render.copy_boxes(sna, GXcopy,
+ draw, get_private(back)->bo, 0, 0,
+ draw, bo, 0, 0,
+ &box, 1, 0))
+ flags = back->flags;
+ }
}
assert(bo->active_scanout == 0);
@@ -362,19 +391,6 @@ static bool swap_limit(DrawablePtr draw, int limit)
}
#endif
-#if DRI2INFOREC_VERSION < 10
-#undef USE_ASYNC_SWAP
-#define USE_ASYNC_SWAP 0
-#endif
-
-#if USE_ASYNC_SWAP
-#define KEEPALIVE 4 /* wait ~50ms before discarding swap caches */
-#define APPLY_DAMAGE 0
-#else
-#define KEEPALIVE 1
-#define APPLY_DAMAGE 1
-#endif
-
#define COLOR_PREFER_TILING_Y 0
/* Prefer to enable TILING_Y if this buffer will never be a
More information about the xorg-commit
mailing list