[Libva] CPU usage regression

gimli gimli at dark-green.com
Wed Jun 8 03:00:11 PDT 2011


I was hitting a performance regression in libva on ILK and SNA.
Did a bisect of the git changes and found the root cause.
In commit 0d97d088493f2b62dd1b55df26f26775eb20d85c

diff --git a/va/x11/va_dri2.c b/va/x11/va_dri2.c
index 4915651..8e9f304 100644
--- a/va/x11/va_dri2.c
+++ b/va/x11/va_dri2.c
@@ -340,9 +340,9 @@ void VA_DRI2SwapBuffers(Display *dpy, XID drawable,
CARD64 target_msc,
req->drawable = drawable;
load_swap_req(req, target_msc, divisor, remainder);

-    _XReply(dpy, (xReply *)&rep, 0, xFalse);
+    _XSend(dpy, NULL, 0);

-    *count = vals_to_card64(rep.swap_lo, rep.swap_hi);
+    *count = 0;

UnlockDisplay(dpy);
SyncHandle();

This is causing in a running application a permanent growing of the CPU
usage.
The attached patch revert this to the old behavior where the CPU usage
remains constant.

Signed-off-by: Edgar Hucek <gimli at dark-green.com>
-------------- next part --------------
diff -uNr libva/va/x11/va_dri2.c libva-patched/va/x11/va_dri2.c
--- libva/va/x11/va_dri2.c	2011-06-08 11:53:28.000000000 +0200
+++ libva-patched/va/x11/va_dri2.c	2011-06-08 11:53:48.000000000 +0200
@@ -340,9 +340,9 @@
     req->drawable = drawable;
     load_swap_req(req, target_msc, divisor, remainder);
 
-    _XSend(dpy, NULL, 0);
+    _XReply(dpy, (xReply *)&rep, 0, xFalse);
 
-    *count = 0;
+    *count = vals_to_card64(rep.swap_lo, rep.swap_hi);
 
     UnlockDisplay(dpy);
     SyncHandle();


More information about the Libva mailing list