libgs,video mode and strange behavior.

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
nicp067
Posts: 15
Joined: Tue Jan 20, 2004 3:48 am
Location: Quebec,Canada

libgs,video mode and strange behavior.

Post by nicp067 »

hi, dunno if someone can help me out on this one.

Im trying to draw some stuff on the screen in vga 640x480 mode. Im doing something like:

gsDriver myGsDriver;

myGsDriver.setDisplayMode(640, 480, 68, 35,
GS_PSMCT32, 2, 0x1A, GS_TV_NONINTERLACE,
GS_ENABLE, GS_PSMZ32);

myGsDriver.drawPipe.RectFlat(0, 0, 640, 480, 0, GS_SET_RGBA(0,0xFF,0,0x80));

the thing is on the x axis 1 pixel = 2 pixel on the monitor so everything look 2 time larger. i know that I can specify in DISPLAY1(0x12000080) the horinzontal mag, is that it. and should I do that in gslib?

Thank you
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

Are you telling the PS2 to use NTSC, then telling it to be non-interlaced? If so, it will display only half the lines on the screen since a TV can't do what you ask. You don't usually tell the CRTC how many lines to display so much as tell it what video mode you want, that resolution you specify is for use by the GS to tell it how big a framebuffer to use.

Take a look in a tutorial I have on my site ( http://www.oopo.net/consoledev/files/ps ... buffer.txt ) which explains how to set up different video modes and use them, including VGA (640x480) and HDTV (480p).
nicp067
Posts: 15
Joined: Tue Jan 20, 2004 3:48 am
Location: Quebec,Canada

Post by nicp067 »

fixed my problem. I should have explained more, I was actually trying to use vga 640x480 60 hertz (0x1a) on a Computer monitor.

for a tv screen you have to set magh on DISPLAY1(0x12000080) and DISPLAY2(0x120000a0) to something like 3 but on the computer monitor it should be 0 or maybe 1? anyway setting it at 0 fixed every thing.

now can someone explain the start position you can set also? I know x and y -5 are fine on a tv but how can you find the proper value for other mode.
for now i just try randomly. on my computer screen x 0 and y 0 put 0,0 coordinate almost in the middle of the screen for x and y is amost right.

Thank you ooPo.
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

Those values are typically dictated by the mode specification itself, but since TVs differ you generally have to let the users adjust it on their own. So... trial and error, but what works for you may not work for all so don't hard code some values in if you can help it.

There's free information on those quirky registers available in the kernel source from ps2linux. Take a look on ps2linux.com and see if you can get a copy of ps2gs.c, I know you can browse the source on that site but I don't remember how to get to it. Also, if you already have the kit, take a look in the gs guide. Its not very informative, but at least it puts names to the values.
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

You get the most info on setting the display registers for modes from the kernel code for PS2 Linux. Just download the kernel source and unpack it. It shows how to set a considerable number of modes directly.
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

The ps2linux kernel source will give you magic numbers, but it won't tell you why you're putting them there. There's better places to get info, but not many are as free to read as the kernel source itself.

What I'd like to know is why you felt it necessary to repeat just what I said, but in a less helpful manner. :)
mrbrown
Site Admin
Posts: 1537
Joined: Sat Jan 17, 2004 11:24 am

Post by mrbrown »

The PS2/Linux kernel source is the only place where those magic GS undocumented priveledged registers are used in code. Pro developers are explicitly forbidden from using them directly. There is no other documentation on those registers except inside the secret SCEI laser-guarded defense fortress which may or may not exist.
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

Well AFAIK the reason they don't tell you what those regs mean is cause it is possible to damage TVs and monitors by setting stupid values. In many respects I think this is rubbish but knowing what things like SMODE1 does is probably not very important anyway :)
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

Exactly. If you look at the Linux code, you'll see that the undocumented registers are setting the sync timing which has the potential of frying your monitor. I did that to a Commodore monitor about 5 years back... it came up with the video mode - for about 5 seconds, then POP!!! The picture went away and lots of smoke came out of the monitor. Many new monitors are designed to ignore out of range signals, but if they aren't, you can easily blow the monitor using out of range sync. It's not a wonder Sony doesn't want you messing with it. They have certain "safe" values they use with the modes they set, and don't want you doing anything beyond that.
Post Reply