ddraw / wined3d fighting over the resolution!

Peter Dons Tychsen donpedro at tdcadsl.dk
Thu Feb 14 21:00:20 CST 2008


On Thu, 2008-02-14 at 09:18 +0100, Stefan Dösinger wrote:
> Am Donnerstag, 14. Februar 2008 04:22:16 schrieb Peter Dons Tychsen:
> > Why does the SwapChain-destroy function play around with the resolution
> > at all. Is that really necessary? I think it should not do it if the
> > caller is ddraw at least.
> I thought I'm filtering this out in the case of ddraw, but maybe that got 
> lost. The reason why the swapchain restores the resolution is the different 
> way ddraw/d3d8 and d3d8/d3d9 set up the screen.
> 
> In ddraw the app calls IDirectDraw7::SetDisplayMode. This sets the mode. Then 
> it creates a DDSCAPS_PRIMARYSURFACE surface, which creates the swapchain.
> 
> In d3d8/d3d9 the swapchain controls the video mode
> 
> I think the problem is that RestoreDisplayMode is called before the primary 
> surface is destroyed. The question is why this happens. I can think of the 
> following reasons:
> 
> -> Refcounting problem, or the app just doesn't release the surfaces. Then 
> ddraw.dll destroys the objects on DLL_PROCESS_DETACH
> 
> -> The app calls it that way. This needs a test, but I think it is not allowed 
> to call SetDisplayMode / RestoreDisplayMode while a primary surface is around

OK, i have now eaten enough wine-gums to comprehend this....

I think there is a general problem in swapchain->release. The swapchain
should only change the resolution back to the original *if* the current
resolution is still the same as the swapchain enforced. If someone else
has intervened, it should let it be. This fixes the problem at hand,
but would also fix other silly problems. Some could for example have
called Release() while the "window" is not even visible (tabbed to
desktop for example).

Please review my patch and let med know if it is submittable.
If you hate it, i will eat more wine-gums. :-)

/pedro 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix_for_resolution_battle.diff
Type: text/x-patch
Size: 1232 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20080215/3104338b/attachment-0001.bin 


More information about the wine-devel mailing list