On Fri, Jun 3, 2011 at 6:34 PM, Soeren Sandmann <sandm...@cs.au.dk> wrote:
> Cyril Brulebois <k...@debian.org> writes:
>
> Isn't there still a problem here, where "srcLine-dstLine" is number of
> uint32_t's, whereas "width * (bpp / 8)" is number of bytes?

It looks to me even more extreme than that; both sides are off in
opposite directions. As you can see just below, (width >> 3) is the
number of bytes. I would use:

careful = (width >> 3) > (abs(srcLine-dstLine) << (FB_SHIFT - 3));

This way, we have the number of bytes on both sides of the comparison.

I'm not exactly sure what the (bpp % 8) was there for. In the current
code, the memcpy would be executed regardless of the value of bpp. If
the condition was there for some other reason than preventing
overlapping memcpy, I guess it could be added along with the other
conditions like this:

@@ -76,8 +77,10 @@ fbBlt (FbBits   *srcLine,
     }
 #endif

-    if (alu == GXcopy && pm == FB_ALLONES && !reverse &&
-            !(srcX & 7) && !(dstX & 7) && !(width & 7)) {
+    careful = (width >> 3) > (abs(srcLine-dstLine) << (FB_SHIFT - 3));
+
+    if (alu == GXcopy && pm == FB_ALLONES && !careful &&
+            !(srcX & 7) && !(dstX & 7) && !(width & 7) && !(bpp & 7)) {
         int i;
         CARD8 *src = (CARD8 *) srcLine;
         CARD8 *dst = (CARD8 *) dstLine;

Stefan
_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to