[Pixman] Slow scrolling with Firefox (Xvnc)

Peter Åstrand astrand at cendio.se
Thu Feb 17 07:20:24 PST 2011


I've noticed that vertical scrolling with Firefox and many other 
applications are quite slow, especially when you have a limited bandwidth. 
The reason for this is that Xvnc fails to detect the framebuffer update as 
a copy, which can be sent as a CopyRect RFB operation. Instead, the entire 
screen is resent.

The code in question is here (function vncHooksCopyArea):
http://tigervnc.svn.sourceforge.net/viewvc/tigervnc/trunk/unix/xserver/hw/vnc/vncHooks.cc?view=markup

We have:

REGION_INTERSECT(pScreen, src.reg, src.reg, &((WindowPtr)pSrc)->clipList);

However, when scrolling in Firefox, the clipList region have x1 == x2 and 
y1 == y2. (We have a data pointer, but size and numRects are zero.) The 
intersection result is empty, and no CopyRects are sent. The problem can 
be solved with this patch:

-    REGION_INTERSECT(pScreen, src.reg, src.reg, &((WindowPtr)pSrc)->clipList);
+    if (REGION_NOTEMPTY(pScreen, &((WindowPtr)pSrc)->clipList)) {
+	REGION_INTERSECT(pScreen, src.reg, src.reg, &((WindowPtr)pSrc)->clipList);
+    }


But why is clipList so strange? I've tracked it down to 
pixman_set_extents:

     if (!region->data)
 	return;

     if (!region->data->size)
     {
         region->extents.x2 = region->extents.x1;
         region->extents.y2 = region->extents.y1;
         return;
     }

This code is called every now and then. (In our case, it seems to be an 
INTERSECT call which calls pixman_set_extents.) Apparently, the idea seems 
to be that if the region has a data pointer, then it must have a size as 
well, or it should be considered empty/NIL. Then, the question is, what on 
earth is setting clipList to such a broken region? It cannot be 
miRegionEmpty/REGION_EMPTY because those are directly setting x1 == x2 and 
y1 == y2.


Using pixman 0.20.0 and xorg-server 1.5.3. However, the problem seems to 
be present even with the Fedora 14 version of Xvnc, which uses more modern 
versions. Comments appreciated...

Rgds, 
---
Peter Åstrand		ThinLinc Chief Developer
Cendio AB		http://www.cendio.com
Wallenbergs gata 4
583 30 Linköping	Phone: +46-13-21 46 00


More information about the Pixman mailing list