DIB Engine

Roderick Colenbrander thunderbird2k at gmx.net
Thu Aug 24 06:30:32 CDT 2006


> Hi,
> 
> I've recently tried to play Heroes of Might and Magic IV under Wine,
> which has very poor performance and this message it printed out many,
> many times after the game is started:
> 
> fixme:bitblt:X11DRV_BitBlt potential optimization - client-side DIB
> copy
> 
> After doing some digging it appears the problem is the current DIB
> engine or lack thereof (the DIBEngine page on the Wine wiki and the
> bugzilla bug it links to are very useful).  From what I can tell this
> has been a known shortcoming in Wine for at least 4.5 - 5 years, with a
> few partial patches created three or four years ago.  Is (or has) there
> any recent (less than a year old) work being done on creating a more
> efficient DIB engine for Wine?  If not, has anyone looked into using a
> library like EVAS or Cairo as a foundation for implementing it?
> 
> Before anyone asks, yes I'm a newbie in terms of hacking on Wine or
> working with device independent bitmaps under Windows, and yes I am
> volunteering to help work on an improved DIB engine.  :)
> 
> Thanks,
> Brian

When you look in the mailinglist archives you will find lots of topics regarding a DIB engine. A usefull post is this one written by Transgaming: http://www.winehq.com/hypermail/wine-patches/2002/09/0251.html.

So lets say you are using powerpoint and it uses 16bit DIBs for drawing while your Xserver runs at 24bit. This works fine on windows but X has limitations like that allows you to render only at the same depth as the Xserver is using. Further DIBs allows programs to directly draw into its memory and also allow you to use GDI functionality. Wine does a lot of magic to allow this functionality and it also takes into account depth conversion. The syncing between the 'X image' and the 'application' image is not that efficient because it requires Xserver calls and it is even worse when depth conversion is needed.

In case of games there are two reasons why DIB-stuff is used. In plain directdraw we use DIBs for color conversion e.g. when the game uses 16bit and X uses 24bit they are used only for this version.
The other case is when a game uses GetDC to mix ddraw rendering with GDI rendering. This is for instance what Age of Empires2 uses and to make it worse it uses 8bit palleted mode aswell.

In theory a DIB engine would help both types of games. The first class of games (if they don't use GetDC and friends) was accelerated in the past using DGA and those games were very fast. These days we also have a directdraw->opengl renderer in Wine (set Direct3D\DirectDrawRenderer to opengl instead of the default gdi). Then opengl does the color conversion for us, it isn't limited by X depth limitations. Our opengl renderer doesn't work for all types of games yet in some games multithreading issues appear which we don't handle correct yet. In some cases when the format isn't supported by opengl we still need to do depth conversion in software.

I would check what type of rendering your game uses as perhaps fixing the ddraw->opengl renderer can be enough already if the game uses a sane color depth format like 16bit.

If the game really needs a DIB engine a good discussion here is needed on how to proceed. Writing the DIB engine itself (all the drawing code) is not that hard the most difficult thing is how to properly integrate this all with gdi and wine's x11drv. I don't think wine wants to depend on other libraries like cairo and second integrating those with wine could be tricky aswell. Further Wine might need a gdiplus.dll in the future which offers similar functionality as cairo and friends.

Regards,
Roderick

-- 


Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer



More information about the wine-devel mailing list