Page 1 of 1

High resolution interlaced output, possible?

Posted: Mon Oct 16, 2006 2:36 pm
by DracoLacertae
Hi, I am trying to find a way to make the GS's CRTC to output a custom resolution: 640x960 interlaced.

I've heard of a product which overrides GS settings, allowing games that internally use a 480 line buffer to output in progressive scan even though the game doesn't specifically support 480p. (There are more game than you think that render with full height framebuffers they never fully exploit!)

I'm attempting to duplicate it's functionality myself, but further than just 480p. I am trying to get the GS to render 960 lines interlaced: Use field rendering with 480 odd, follwed by 480 even lines. The framebuffer memory usage and rendering speed wouldn't change, but the resolution will be a bit higher.

Right now, I have Soul Calibur II running, with it's progressive scan feature turned on. Except, now GS's SMODE2 is overridden to output all lines, in interlaced mode. This actually renders almost correctly, except for two problems:

-Only the top half of the screen is shown: It is being drawn interlaced, and odd/even seems to work, but only half the framebuffer is being drawn, and is stretched to fill the whole screen. The good news, is there appears to be 480 lines drawn (240 even, 240 odd), with a full 480i resolution being output only using half the framebuffer! If I can get the CRTC timing right, then the whole framebuffer should be output at 960i.

-In the menus, things are fast, but in 3D (battles), there is horrible slowdown, around 2 or 3 seconds per frame! My guess is since only half the buffer is being sent out, it's messing up the game's timing; kind of like waiting for a vsync that never quite happens at the expected time?

I guess the short version is: Is it possible for the GS to output 960 interlaced lines, with a 480 line framebuffer? And if possible, what registers need to be set? Thanks for any infomation and help you might offer!

Posted: Thu Oct 19, 2006 1:11 pm
by ooPo
I believe its possible to set whatever mode you want - the trick is finding out what registers to poke. That part I'm not too sure about though. :)

Do a search for SMODE1 on the forums, there's a bunch of 'secret' GS registers. You can find more info in the ps2linux kernel (ps2gs.c). I haven't had much luck with trial-and-error but you may be able to turn up something.

Posted: Fri Oct 20, 2006 6:38 am
by DracoLacertae
Thanks, I'll give it a try.

I was actually able to get very close to the mode I want while in Linux using the setcrtmode command.

Are the GS registers read/write? That is, on ps2 linux, if I use setcrtmode to get a mode I want, can I then run a small console app that reads SMODE1 and SMODE2?

Posted: Fri Oct 20, 2006 10:20 am
by jbit
DracoLacertae wrote:That is, on ps2 linux, if I use setcrtmode to get a mode I want, can I then run a small console app that reads SMODE1 and SMODE2?
No, but the ps2linux kernel source has the values you need for the secret registers, just look in the GS console driver. Also the EE kernel has built in values for most standard modes (PAL, NTSC, 480p, 720p, 1080i, most VESA modes, etc), in fact i think every mode in ps2linux has an EE kernel equivalent.

Posted: Fri Oct 20, 2006 3:02 pm
by DracoLacertae
Thanks, I'll take a look at the gs driver source.

The mode I'm looking for though isn't exactly standard. I want 640 by 960, which I can actually get from linux, but I don't want a 960-height framebuffer. I want to do field rendering with a 960-height screen using a 480 height framebuffer, the same way that most NTSC games render a 480-height picture using a 240-height framebuffer. (Not all games do this though; some render to a 480 height frame buffer but set SMODE2 to just draw every other line; kinda wasteful)

I think this is close to the bit settings I want:
-Set to scan at 640x960 picture rate. (Using gs driver's 'magic' values.)
AND
-Set SMODE2 to FRAME mode (draw every line from framebuffer) and interlaced.

Is there anything else I need to take care of to get this to work?

Posted: Sat Oct 21, 2006 12:19 am
by jbit
You probably want to setup MAGV in the output circuit regs.
Beware, if you are doing custom modes, you do have a chance of harming either your monitor or the GS. (unlikely, but the chance is there)
And the magic sync registers aren't documented at all.
The closest thing to documentation is the field names in the #defines from ps2linux...
Also, the magic registers vary from GS to GS... well RAMDAC to RAMDAC... which is why they're magic and not in the GS manuals.

BTW, you are aware this is going to look terrible? Since you're effectively line doubling... I personally think 640x480p would look better than 640x480 spread out on 640x960i...

But anyway... have fun :)

Posted: Sat Oct 21, 2006 6:00 am
by DracoLacertae
Actually isn't it better than line doubling because it will alternate odd/even rendering? When I take a 480i game and play it through my TV card, the odd and even lines are different. When I play SC2 (soul calibur 2) through Dscaler, on 'odd only' or 'even only' deinterlace modes I have a 240 line picture that looks horrible. On a relatively still image, when I switch to 'simple weave', I get a 480 line picture. The odd lines sent out fill in between the even lines of the previous frame, giving more vertical detail.

It's like drawing all your polygons at 240 lines, and then drawing the next frame, but will all polygons shifted up or down half a pixel. If the content of the two frame hasn't changed much, each pair of frames fills in the missing vertical detail of each other.

I know SC2 has to use a 240 line framebuffer when in 480i mode because when I set SMODE2 to 'interlace, draw all lines,' I get a normal picture. In interlace mode, drawing all lines means drawing 240 lines per frame.

When I get SMODE2 to 'interlace, draw every other line', I get a half height image. (because each frame is drawing half of 120 lines, which covers half a tv screen.) (Interesting enough, the bottom half of the scren is now the depth buffer, which actually looks pretty cool!)

In SC2, when I set SMODE2 to 'draw every line, no interlace', I get only a 240 line picture rendered, where odd lines do not add detail to the picture at all; effectively line doubled like you were saying.

The idea is to interlace in the way that adds detail, not in the way that line doubles.

But you're right, it is a bit of a silly idea. There's a few other projects I should devote my time to instead, lol.