Software Support > GroovyMAME
DirectDraw interlace screenmode switching on Win 7
Dr.Venom:
Carrying on from our discussion in the other thread (http://forum.arcadecontrols.com/index.php/topic,129025.msg1326033.html#new), about mainline MAME / GM not being able to switch from/to interlace screens with DirectDraw on Windows 7.
--- Quote ---I've been having a look at WinUAE's source, and at first sight I can't see he's doing anything special for setting up DDraw, if you know something about any change that was required in order to allow progressive/interlaced mode switching under W7 please point me in the right direction.
--- End quote ---
I've been trying to recall some of the stuff related to the problem, they are I guess only pieces of the puzzle and some might be appropriate for D3D only, but here goes:
- A flag needs to be set that says screenmode is interlaced when enumerating modes. I.e. "i" after resolution string.
- D3DSCANLINEORDERING enumeration needs to set D3DSCANLINEORDERING_INTERLACED properly as documented here: http://msdn.microsoft.com/en-us/library/windows/desktop/bb172604%28v=vs.85%29.aspx. Note that this enumeration is available in Direct3D 9Ex only.
--- Code: ---D3DSCANLINEORDERING_INTERLACED
The image is created using the interlaced method in which odd-numbered lines are drawn on odd-numbered passes and even lines are drawn on even-numbered passes.
--- End code ---
- Syncing odd and even fields between source and output. When D3DSCANLINEORDERING_INTERLACED is set, frames with the uneven lines (odd field) and frames with even lines (even field) are alternating. So for a typical 60hz refresh (30Hz interlaced) there will be 30 odd fields and 30 even fields alternating, having a total of 60 "progressive" fields per second. To be able to match source and output odd and even fields, one needs to know whether the output (monitor) is currently displaying the even or odd field. Use the D3DRASTER_STATUS structure (http://msdn.microsoft.com/en-us/library/windows/desktop/bb172596%28v=vs.85%29.aspx) to get the actual scanline status. If the field is even it will report: ... <vblank>46 48 .. 616 618 <vblank>, if the field is odd it will report <vblank>47 49.. 617 619 <vblank> ..., thus knowing whether the next field will be odd or even.
- For some screenmodes (like 640x480) both 30Hz interlaced and 59Hz and 60Hz progressive may be available. Calling it with the "default" refresh rate may result in unpredictable behaviour, because default refresh may not match with the interlace/progressive screenmode flag. Thus preferably interlaced screens are opened while explicitly specifying the target refresh rate, e.g. "30i".
I'm not sure if it would help re looking at the WinUAE source code (not sure if it is possible to look at revision), but in any case the changes for interlace seem to have been around the time of winuae_2400b15:
--- Quote ---Beta 15:
- Append "i" to PC resolutions that are interlaced. (TV Out, VGA + Soft15Khz hacks etc..)
- Low latency Amiga interlace mode odd/even fields are now in sync with output's odd/even fields, if output resolution is also interlaced.
--- End quote ---
Not that it will be of much help I guess, but even in case there would be a tiny clue in it, as example (part of) the log of WinUAE's display mode enumeration looks like:
--- Quote ---26: !640x480, 16-bit (!59,!60)
27: !640x480, 32-bit (!59,!60)
28: 640x496i, 16-bit (30i)
29: 640x496i, 32-bit (30i)
38: !720x480i, 16-bit (!29i,!30i,!59,!60)
39: !720x480i, 32-bit (!29i,!30i,!59,!60)
40: !720x576, 16-bit (!50)
41: !720x576, 32-bit (!50)
42: 744x287, 16-bit (50)
43: 744x287, 32-bit (50)
44: 744x574i, 16-bit (25i)
45: 744x574i, 32-bit (25i)
--- End quote ---
Where basicly the ones with the exclamation marks are system modes. As an example in the GUI the 744x574i mode has a refresh panel where it says "25Hz PAL (50i)" (see attached snapshot).
Hopefully in any the above there is some information/lead as to why DirectDraw interlace switching isn't working in MAME on Windows 7.
Calamity:
Hi Dr.Venom,
Thanks for the information above. Before we go on, it would be of great help to know which exact DirectDraw function is failing. Unfortunately the log you passed me on the other thread of DDraw crashing on interlaced mode switching does not provide much information regarding this, that's a bit strange as the ddraw.c module is supposed to log errors. Anyway it would be good to get a new log with the -multithreading option disabled in order to get a more sequential result.
I've done a test build of Arcade_OSD with a debug window, hopefully it will tell us which function is failing. Please test an interlaced mode and check the window for errors.
Dr.Venom:
I have recreated the log for the psj driver without multithreading (see attached). Upon attempt to switch to interlace it logs the following:
--- Code: ---Video: Monitor 00010001 = "\\.\DISPLAY1" (primary)
Video: Monitor 00010003 = "\\.\DISPLAY7"
DirectDraw: Using DirectDraw 7
window_proc: WM_NCACTIVATE
blit_lock = TRUE
DirectDraw: Configuring device ATI Radeon HD 4800 Series
DirectDraw: Error 80004001 attempting to set video mode 648x484@58 call
window_proc: WM_NCACTIVATE
window_proc: WM_DESTROY
blit_lock = TRUE
Switchres: restoring DALDTMCRTBCD648x484x0x58 - Modeline "648x484_58 15.98KHz 59.95Hz" 13.55 648 680 744 848 484 487 492 533 interlace -hsync -vsync
Unable to initialize DirectDraw.
002827D8: 01C74115 (not found)
002828D8: 01C71C88 (not found)
00282A48: 01C6E70E (not found)
00282BB8: 024D43F3 (not found)
00282C68: 024D5467 (not found)
0028F8B8: 0240B98B (not found)
0028FB38: 02777258 (not found)
0028FE88: 01C70490 (not found)
00351708: 02A71C50 (not found)
00351728: 00359FC0 (not found)
Unable to complete window creation
--- End code ---
The arcade_osd_test_00 logs the following two lines when switching to interlace:
SetDisplayMode error
ActivateMode: DDrawInit error
Hope this helps. Let me know if I can test anything else..
Calamity:
Interesting, both errors are on the SetDisplayMode function, that narrows it quite a lot. The error 80004001 means NOT IMPLEMENTED. That's rather strange.
Just to clarify, I guess Arcade_OSD is reporting the interlaced refresh rates as halved, does it? On the other hand GM is requesting the "full" refresh, as you had patched it for that.
This is interesting:
Switchres: [ 17] 648x 484 @ 58: DALDTMCRTBCD648x484x0x58 - Modeline "648x484_58 15.98KHz 59.95Hz" 13.55 648 680 744 848 484 487 492 533 interlace -hsync -vsync
Switchres: [ 18] 648x 484 @ 60: system mode
What happens if you try the second one on Arcade_OSD?
Dr.Venom:
--- Quote from: Calamity on January 10, 2013, 03:20:52 pm ---Just to clarify, I guess Arcade_OSD is reporting the interlaced refresh rates as halved, does it?
--- End quote ---
Yes it reports them as halved, see attached picture.
--- Quote ---On the other hand GM is requesting the "full" refresh, as you had patched it for that.
--- End quote ---
Yes, indeed.
--- Quote ---This is interesting:
Switchres: [ 17] 648x 484 @ 58: DALDTMCRTBCD648x484x0x58 - Modeline "648x484_58 15.98KHz 59.95Hz" 13.55 648 680 744 848 484 487 492 533 interlace -hsync -vsync
Switchres: [ 18] 648x 484 @ 60: system mode
What happens if you try the second one on Arcade_OSD?
--- End quote ---
Well Arcade_OSD doesn't show any 648x484 @ 60, but it does show 648x484@30 (see attached picture again). If I select the @30 then it results in the same two lines be logged as before.
Just to be sure, both 648x484i modes are opened correctly when called by WinUAE in DDraw mode.
Navigation
[0] Message Index
[#] Next page
Go to full version