Port-luna68k archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Xorg 1.20 1bpp server performance regression and possible fixes

On testing Xsun server on sun3/60, I noticed Xorg 1.20 1bpp
(i.e. mono) server was much slower than Xorg 1.10 server,
especially on filling /usr/X11R7/include/X11/bitmap/root_weave
4x4 bitmap onto the root window, when "noblank" screen saver was
activated etc.

Xorg 1.10 based Xsun server on Sun3/60 bwtwo:
  -> Drawing time is not measurable by eyes.

Xorg 1.20 based Xsun server on Sun3/60 bwtwo:
  -> It takes >10 seconds to fill root window.

Xorg 1.18 based Xsun server (not in the tree) on Sun3/60 bwtwo:
  -> Same as 1.20.

Xorg 1.20 server + xf86-video-wsfb driver on LUNA using single plane:
  -> Also >10 seconds even on the genuine(?) xf86-video-wsfb driver.

Note this cannot be observed on TME sun3 and bwtwo emulation.

With several investigation, it turns out the following
xorg-server upstream changes to fb/fbtile.c cause this
>> fb: Remove even/odd tile slow-pathing
>> Again, clearly meant to be a fast path, but this turns out not to be the
>> case.

I'm not sure how the "not to be the case" in the log was concluded,
but the "fast path" of the removed fbEvenTile() function was
only called if "FbEvenTile(tileWidth)" was true:
fbTile(FbBits * dst,
       FbStride dstStride,
       int dstX,
       int width,
       int height,
       FbBits * tile,
       FbStride tileStride,
       int tileWidth,
       int tileHeight, int alu, FbBits pm, int bpp, int xRot, int yRot)
    if (FbEvenTile(tileWidth))
        fbEvenTile(dst, dstStride, dstX, width, height,
                   tile, tileStride, tileHeight, alu, pm, xRot, yRot);

FbEvenTile() is defined in fb/fb.h:
 * Accelerated tiles are power of 2 width <= FB_UNIT
#define FbEvenTile(w)       ((w) <= FB_UNIT && FbPowerOfTwo(w))


FB_UNIT is 32 here, so the "fast path" is activiated only if
"tileWidth" arg is 32 or smaller (i.e. 1, 2, 4, 8, or 16).

The main caller of fbTile() is fbFill() with "FillTiled" op in
        fbTile(dst + (y + dstYoff) * dstStride,
               (x + dstXoff) * dstBpp,
               width * dstBpp, height,
               tileWidth * tileBpp,
               (pGC->patOrg.x + pDrawable->x + dstXoff) * dstBpp,
               pGC->patOrg.y + pDrawable->y - y);

The argument "tileWidth" of fbTile() includes bpp, so
the "fast path" fbEvenTile() won't called on 32bpp servers.

On the other hand, 1bpp server uses it for 32x32 and smaller bitmaps.

Reverting the above "fb: Remove even/odd tile slow-pathing" change
significantly improves speed of filling the root_weave and other
pattern of Xorg 1bpp server as before:

Patched Xsun server on Sun3/60 bwtwo:

Patched Xorg + xf86-video-wsfb server on LUNA:

I would like to commit changes to revert this fbtile.c removal
into the NetBSD xsrc/external/mit/xorg tree, but I wonder how
they should be applied.

1) Revert the whole commit as is (and put back fbtile.c to SRCS.fb
   in src/external/mit/xorg/server/xorg-server/fb/Makefile.fb)

2) Put back the "fbEvenTile" and old "fbTile" to switch
   "fbOddTile" (which is same as current fbTile) or "fbEvenTile"
   into existing fb/fbfill.c as inline functions, to make
   future import/merge less confusing

3) Ask xorg upstream to revert the change

Of course the best way is 3) and 1), but I'm afread most people
don't think it's worth to keep and maintain extra code for obsolete
monochrome (and some 8bpp) servers and retro-computing geeks.


Izumi Tsutsui

Home | Main Index | Thread Index | Old Index