Internal-wm/rootless observations

Torrey Lyons
Wed Dec 1 16:53:00 GMT 2004

I have been away on a long Thanksgiving vacation so I've been slow to 
respond. In any case, the 16 bpp modes are problematic but I believe 
we solved issues with them in the rootless code awhile back. The 
fundamental problem is that fb assumes screens are always 32-bit 
aligned. Thus you if a window's pixmap is not 32-bit aligned, fb 
assumes it can still access the word before the start of a drawable's 
data. In rootless mode, where windows are located higgledy-piggledy 
in memory, this is not true.

Rootless solves (or attempts to solve) this problem with the 
SetPixmapBaseToScreen() macro in rootlessCommon.h. The idea is that 
the unaligned window's pixmap is moved backwards in memory to align 
it and then a positive offset it given to fb to indicate where the 
window resides in the pixmap.

If there is an edge case where rootless does not work in 16-bits it 
would be good to track down. This mode is sometimes used on Mac OS X.

Hopefully that is helpful. I've got a review today but I can look at 
this in more detail tomorrow.


At 4:45 PM +0100 11/30/04, Alexander Gottwald wrote:
>Hi all,
>After many days of debugging the internalwm code i finally found
>the actual problem.
>The rootless code wants the pixmap buffer aligned to 32bit boundaries.
>If the window width is odd and the xserver is run in 16bpp mode then
>this is no guaranteed and this leads the strange errors.
>Internalwm is only usable in 32bit mode.
>This is not an actual problem. The goal should be anyway to work
>with 32 bit visuals only and have real transparancy. I'm still
>searching for a clean method to blit 32 bit bitmaps to 16 bit ones.
>The simple aproach of allocating the bitmap with
>bitmap->width = width
>bitmap->height = height
>bitmap->bpp = dbBPP
>BitBlt(windowdc, ..., shadowdc, ...)
>was not working properly. Is CreateCompatibleBitmap reusing the
>DC from the screen? How can I create a 32bit bitmap if the desktop
>is running in 16bit?
>Anyway. Setting the bitmap depth to 32bit fixed the crashes I had
>the last weeks with rootless but garbled the output. So the goal is
>to have everything inside the server running at 32bit and let GDI do
>the colorspace translation from 32 to 16 or 24 bit.
>@zakki: I've found this in the code
>   if (winIsInternalWMRunning(pScreenInfo))
>     winAdjustXWindow (pWin, hwnd);
>   winMWExtWMMoveResizeXWindow (pWin,
>shouldn't that be
>   if (winIsInternalWMRunning(pScreenInfo))
>     winAdjustXWindow (pWin, hwnd);
>   else
>     winMWExtWMMoveResizeXWindow (pWin,
>	ago
>           ICQ: 126018723

More information about the Cygwin-xfree mailing list