http://bugs.winehq.org/show_bug.cgi?id=3902
------- Additional Comments From giulian2003@hotmail.com 2005-30-11 09:48 ------- 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 above log). This happens when a GDI call tries to get a DIB from 'DIB_Status_AppMod' stat into 'DIB_Status_GdiMod' stat. Eventually X11DRV_DIB_DoUpdateDIBSection() will be called, which will try to sync the entire bitmap, even though maybe only a small part of the bitmap has been modified by the program:
static void X11DRV_DIB_DoUpdateDIBSection(X_PHYSBITMAP *physBitmap, BOOL toDIB) { BITMAP bitmap;
GetObjectW( physBitmap->hbitmap, sizeof(bitmap), &bitmap ); X11DRV_DIB_DoCopyDIBSection(physBitmap, toDIB, physBitmap->colorMap, physBitmap->nColorMap, physBitmap->pixmap, 0, 0, 0, 0, bitmap.bmWidth, bitmap.bmHeight); }
I think this can be improved in the following way:
1. Add a new member to X_PHYSBITMAP structure (RECT LastModRect) which will memorise the acctual rectangle that needs to be sync'ed by X11DRV_DIB_DoCopyDIBSection() function.
2. Modify all or a number or GDI function to set physBitmap->LastModRect accordingly, before calling X11DRV_DIB_Coerce(physBitmap, DIB_Status_GdiMod, FALSE).
3. Modify X11DRV_DIB_DoUpdateDIBSection() to take in consideration LastModRect and if its valid, try sync only that part of the bitmap and afterwords invalidate LastModRect. If LastModRect doesn't contain valid values, X11DRV_DIB_DoUpdateDIBSection() will try to sync the entire bitmap as it did untill now, this way, if a GDI function doesn't set LastModRect accordingly, everything will still work.
If anybody else has any other ideea how to improve performance, please share it :)