Hey all,
I've been experiencing an odd behavior in Baldur's Gate 2; when "VideoMemorySize" registry key for wined3d is set to anything greater than 64MB (69MB, actually), it stops before playing intro movie, printing following line: err:clipping:CLIPPING_UpdateGCRegion hVisRgn is zero. Please report this.
Tracing the source of issue by inserting custom traces I got the following: IDirectDrawImpl_CreateNewSurface -> IWineD3DDeviceImpl_CreateSurface (decides to use GDI surface) -> IWineGDISurfaceImpl_PrivateSetup -> IWineD3DSurfaceImpl_GetDC -> CreateCompatibleDC -> CreateRectRgn -> REGION_CreateRegion -> GDI_AllocObject -> alloc_large_heap
alloc_large_heap fails because it can't find next large handle and returns NULL, which is passed up the chain, where CreateCompatibleDC puts it in dc->hVisRgn. Then DC_InitDC is called with that dc, which calls CLIPPING_UpdateGCRegion, and that one finally chokes on it, printing afore-mentioned line and calling exit(1).
Now, when the game is run with 64MB of VideoMemorySize, upon reaching the same point, IDirectDrawImpl_CreateNewSurface returns WINED3DERR_OUTOFVIDEOMEMORY (because of "IWineD3DDevice_GetAvailableTextureMem(iface) <= _size" check in D3DCREATERESOURCEOBJECTINSTANCE macro) and intro movie starts playing. So it seems Baldur's Gate 2 is trying to create as many surfaces as possible before running out of memory. And the problem arises when specified memory size is large enough to take up all GDI's heap...
Sorry for the long-winded description of the problem, but I'm not sure where and how this should be fixed (is it wined3d issue or should GDI have its heap enlarged?), otherwise I'd do it myself...
Regards, Rok -=-=-=-=-=- Never say "Never" unless it is to say "Never Give Up." -=-=-=-=-=--=-=-=-=-=- * Generated by TagZilla 0.066 * http://tagzilla.mozdev.org *
Submit proper bug report to Wine bugzilla. The memory size setting is only in registry because you should not touch it in the first place. For any user support problems - use wine-users mailing list.
Vitaliy
Rok Mandeljc wrote:
Hey all,
I've been experiencing an odd behavior in Baldur's Gate 2; when "VideoMemorySize" registry key for wined3d is set to anything greater than 64MB (69MB, actually), it stops before playing intro movie, printing following line: err:clipping:CLIPPING_UpdateGCRegion hVisRgn is zero. Please report this.
Tracing the source of issue by inserting custom traces I got the following: IDirectDrawImpl_CreateNewSurface -> IWineD3DDeviceImpl_CreateSurface (decides to use GDI surface) -> IWineGDISurfaceImpl_PrivateSetup -> IWineD3DSurfaceImpl_GetDC -> CreateCompatibleDC -> CreateRectRgn -> REGION_CreateRegion -> GDI_AllocObject -> alloc_large_heap
alloc_large_heap fails because it can't find next large handle and returns NULL, which is passed up the chain, where CreateCompatibleDC puts it in dc->hVisRgn. Then DC_InitDC is called with that dc, which calls CLIPPING_UpdateGCRegion, and that one finally chokes on it, printing afore-mentioned line and calling exit(1).
Now, when the game is run with 64MB of VideoMemorySize, upon reaching the same point, IDirectDrawImpl_CreateNewSurface returns WINED3DERR_OUTOFVIDEOMEMORY (because of "IWineD3DDevice_GetAvailableTextureMem(iface) <= _size" check in D3DCREATERESOURCEOBJECTINSTANCE macro) and intro movie starts playing. So it seems Baldur's Gate 2 is trying to create as many surfaces as possible before running out of memory. And the problem arises when specified memory size is large enough to take up all GDI's heap...
Sorry for the long-winded description of the problem, but I'm not sure where and how this should be fixed (is it wined3d issue or should GDI have its heap enlarged?), otherwise I'd do it myself...
Regards, Rok -=-=-=-=-=- Never say "Never" unless it is to say "Never Give Up." -=-=-=-=-=--=-=-=-=-=-
- Generated by TagZilla 0.066 * http://tagzilla.mozdev.org *
On Sunday 25 February 2007 03:36:02 pm Vitaliy Margolen wrote:
The memory size setting is only in registry because you should not touch it in the first place.
I thought it was added to the registry because Wine can't figure out the video memory amount itself from OpenGL or X, and that allows the user to make it report the proper amount (or at least, more proper). Before it was hard-coded to 64MB.
On 27/02/07, Chris Robinson chris.kcat@gmail.com wrote:
I thought it was added to the registry because Wine can't figure out the video memory amount itself from OpenGL or X, and that allows the user to make it report the proper amount (or at least, more proper). Before it was hard-coded to 64MB.
Pretty much.
Am Sonntag 25 Februar 2007 21:57 schrieb Rok Mandeljc:
Hey all,
Now, when the game is run with 64MB of VideoMemorySize, upon reaching the same point, IDirectDrawImpl_CreateNewSurface returns WINED3DERR_OUTOFVIDEOMEMORY (because of "IWineD3DDevice_GetAvailableTextureMem(iface) <= _size" check in D3DCREATERESOURCEOBJECTINSTANCE macro) and intro movie starts playing. So it seems Baldur's Gate 2 is trying to create as many surfaces as possible before running out of memory. And the problem arises when specified memory size is large enough to take up all GDI's heap...
Now that seems interesting. Actually, I have never had a 2D application creating that much surfaces, and the old ddraw code only advertised 8 mb of mem. It might be an out of memory somewhere, but not sure how and why.
You could try opengl surfaces. Those do not have a DIB section, unless the app calls GetDC on the surface
Rok Mandeljc wrote:
Hey all,
I've been experiencing an odd behavior in Baldur's Gate 2; when "VideoMemorySize" registry key for wined3d is set to anything greater than 64MB (69MB, actually), it stops before playing intro movie, printing following line: err:clipping:CLIPPING_UpdateGCRegion hVisRgn is zero. Please report this.
Tracing the source of issue by inserting custom traces I got the following: IDirectDrawImpl_CreateNewSurface -> IWineD3DDeviceImpl_CreateSurface (decides to use GDI surface) -> IWineGDISurfaceImpl_PrivateSetup -> IWineD3DSurfaceImpl_GetDC -> CreateCompatibleDC -> CreateRectRgn -> REGION_CreateRegion -> GDI_AllocObject -> alloc_large_heap
alloc_large_heap fails because it can't find next large handle and returns NULL, which is passed up the chain, where CreateCompatibleDC puts it in dc->hVisRgn. Then DC_InitDC is called with that dc, which calls CLIPPING_UpdateGCRegion, and that one finally chokes on it, printing afore-mentioned line and calling exit(1).
Now, when the game is run with 64MB of VideoMemorySize, upon reaching the same point, IDirectDrawImpl_CreateNewSurface returns WINED3DERR_OUTOFVIDEOMEMORY (because of "IWineD3DDevice_GetAvailableTextureMem(iface) <= _size" check in D3DCREATERESOURCEOBJECTINSTANCE macro) and intro movie starts playing. So it seems Baldur's Gate 2 is trying to create as many surfaces as possible before running out of memory. And the problem arises when specified memory size is large enough to take up all GDI's heap...
Sorry for the long-winded description of the problem, but I'm not sure where and how this should be fixed (is it wined3d issue or should GDI have its heap enlarged?), otherwise I'd do it myself...
CreateCompatibleDC should be made to fail if the CreateRectRgn call fails.
Robert Shearman rob@codeweavers.com writes:
CreateCompatibleDC should be made to fail if the CreateRectRgn call fails.
Yes, I committed a fix for that.