Yeah, i also belive putting the modifying rect in Coerce is better, when i first made the changes i just wanted to modify as little as possible and add things without modifying the already existing code too much, keeping it clean. I also belive i am doing something wrong:
I noticed that in X11DRV_DIB_CopyDIBSection() function created to optimise bitblt(), the sync is done this way:
X11DRV_DIB_DoCopyDIBSection(physBitmap, FALSE, colorMap, nColorMap, physDevDst->drawable, xSrc, ySrc, physDevDst->org.x + xDest, physDevDst->org.y + yDest, width, height);
They take in consideration the (org.x,org.y) in the physical device! I don't understand too well what a physical devise exactly is, and i was wondering if i am not mistaking when i sync like this in X11DRV_DIB_DoUpdateDIBSection():
X11DRV_DIB_DoCopyDIBSection(physBitmap, toDIB, physBitmap->colorMap, physBitmap->nColorMap, physBitmap->pixmap, x, y, x, y, width, height);
and not taking in consideration the origins of the device?
Iulian
From: Robert Shearman rob@codeweavers.com To: Marinescu-Ghetau Iulian giulian2003@hotmail.com CC: wine-devel@winehq.org Subject: Re: BUG (3920) + sync between DIBs and X Server optimisation. (please help) Date: Mon, 12 Dec 2005 11:07:20 -0600
Marinescu-Ghetau Iulian wrote:
I came to the conclusion that the slowness in "Heroes IV" it has to do with sync'ing lage bitmaps between application DIBs and X Server(see the log: http://bugs.winehq.org/attachment.cgi?id=1470&action=view ).
Also, a complete description of the bug is here: http://bugs.winehq.org/show_bug.cgi?id=3902
So i had this ideea that every GDI function could memorise the rectangle that is modifying, so each time a sync between DIB and X Server is needed, only a small part from the bitmap will get copied! I also made some changes to dib.c, bitblt.c and x11drv.h in "wine-0.9.2\dlls\x11drv" folder to implement my ideea, keeping backwards compatibility (if a DIB function doesn't set a valid rectangle for the bitmap that its modifying, the default values are taken - which is the entire bitmap)
and finally, a GDI function calls it like this (for example bitblt):
X11DRV_SetBoundRect(physDevDst->bitmap,xDst,yDst,width,height); X11DRV_CoerceDIBSection( physDevDst, DIB_Status_GdiMod, FALSE ); if (physDevDst != physDevSrc) { X11DRV_SetBoundRect(physDevSrc->bitmap,xSrc,ySrc,width,height); X11DRV_CoerceDIBSection( physDevSrc, DIB_Status_GdiMod, FALSE ); }
I think it would be better to make X11DRV_CoerceDIBSection take the parameters for a bounding rect, otherwise it is possible to forget a call to SetBoundRect and cause the DIB to not be updated.
-- Rob Shearman