DIB Engine

Roderick Colenbrander thunderbird2k at gmx.net
Thu Nov 13 04:58:31 CST 2008


> Sergey Novosyolov ha scritto:
> > 
> > I've already started working on it about 3 months ago and released some 
> > functions inside DIB Engine. But now we're thinking about release DIB
> inside 
> > GDI32 as Detlef Riekenberg proposed:
> > On 9/29/08, Sergey Novosyolov <chi at etersoft.ru> wrote:
> > 
> >>> The first thing, i like to see is a Design in the correct way:
> >>> Inside gdi32 while using Eng* and friends.
> >>> (Needed by Printer drivers, and any Display driver including mirror /
> >>> remote display drivers)
> >>>
> >> why can't we release DIB-Engine as own driver? GDI32 functions are main
> and
> >> GDI32 calls driver functions in dependence of which type of DC we have
> >> (printer DC, Xwindow HDC or DIB DC)
> > 
> >> Any Driver can call the Graphic Rendering Engine (GRE)
> >> to do parts (or all) of the rendering (and native driver do that):
> >> 1: DDB (Driver managed: using any driver specific format)
> >  >  (The Driver should do Everything. When the driver call the GRE,
> >  >   the DDB is converted to a DIB, GDI renders into the DIB and then
> >  >   the DIB is converted back to a DDB)
> >   > => like our winex11.drv and wineps.drv
> > 
> >> 2: DDB (GDI managed: using DIB format)
> >>    (The driver render, what the driver want to render with hw-support
> >>     and can call the GRE for all the other rendering without
> converting)
> >>    => Needed for native printer drivers / mirror drivers or
> >>       OpenGL accelerated rendering (stefan did some experiments)
> > 
> >> 3: DIB
> >>    (GDI renders everything)
> >>  => The current Code is using a X11-DDB (Driver Managed) with
> >> converting
> >>       issues.
> > 
> > So the conception of new strusture of DIB ENgine inside GDI is needed
> > 
> > 
> The question is if we should support native drivers or not, other than 
> winex11 or wineps. For winex11, we're using native rendering functions, 
> for wineps we're just translating GRE calls to ps code directly, no need 
> to convert forth and back. Other stuff would be raw printing, for 
> example, using native drivers.... but are they really needed ?
> 
> AFAIK the bottleneck now is the double conversion of DIB-X11 DDB-DIB, in 
> order to be able to use X11 rendering functions, so the point 3.
> I don't understand your point 1; why convert DDB to DIB ? Driver should 
> render directly into DDB. GDI calls can be directed to native ones.
> 
> I see it this way (but I could be wrong) :
> 
> 1) Application uses a DIB format, rendering should be done by DIB 
> driver, conversion is needed only to display it. This is what by now is 
> done with 2 conversions between DIB-X11-DIB formats.
> 
> 2) Application uses accelerated opengl, for example; it must (afaik) use 
> native format and functions to render it. No need to convert anything.
> 
> 3) Printer drivers. For ps, they're rendered translating GDI calls into 
> postscript code, for other format the driver should do the rendering. 
> Again, no conversion needed.
> 
> So, I don't understand why to have DIB engine INSIDE GDI. Function 
> pointers could handle the correct driver calls depending on DIB (or DDB) 
> format.
> 
> Max
> 
> 

Under the hood Windows uses Eng* functions in the win2k/winxp driver model (perhaps even Vista, don't know). It is a different architecture than what Wine uses we are close to a win3.1 design. The use of the real win32 functions would offer the possibility of using native printer drivers again (not sure if this is something we really want). Doing stuff the microsoft way might have advantages for properly integrating ddraw and other things. On the other hand it could be a lot of work to get right.

Here's my view on DirectDraw / D3D and the DIB engine. There are two cases. First of all you have plain 'software rendering' in which we do 2d ddraw using GDI and DIB. The use of a DIB engine would save us some roundtrips to X and make color conversion more efficient. Depending on the situation it could boost performance quite a bit.

Second ddraw/d3d apps can use GetDC / ReleaseDC in order to get a HDC which they can use to draw to the ddraw surface. In case of D3D or 'hw accelerated' ddraw (DirectDrawRenderer=opengl) we need to read the image back from the videocard. Then the app works on it using GDI calls which at this point require evil color conversion and roundtrips to X. In the end the image is returned to wined3d and it is uploaded to the card. Various games use this method to draw text. Stefan's idea was to write a opengl dib engine for this. My own idea which matches a bit what Windows does is to use GLX_EXT_texture_from_pixmap which all drivers are starting to support. The idea would be that WineD3D downloads the image from the videocard. The dib engine would render in software to the dib and then GLX_EXT_texture_from_pixmap is used to reupload the corresponding pixmap to the videocard (the pixmap needs to be in the same depth as X). This could be done in different ways. I can imagine that a game uses 8bit (but using opengl we render it at 24bit) and that the dib engine just keeps working at 24bit (it would need to convert all 8bit operations to 24bit), to prevent a lot of depth conversion. Windows also has functionality to improve ddraw and gdi interaction. It works in about the same way. Going this way could make ddraw-gl finally hw accelerated in all areas.

Roderick
-- 
"Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail



More information about the wine-devel mailing list