Open frno7 opened 2 years ago
There exist 2 EEPROM layouts: pre-Dragon and Dragon (SCPH-5xxxx and up). For Dragon models PAL/NTSC modes are also stored in EEPROM at offset 0x295, if the value is 0x10 - then the video mode is PAL if 0x00 - NTSC (actually only the first bit is checked). YCbCr is also stored in EEPROM at an offset 0x2C0 bit 3 More information I documented here.
On pre-dragon units, all these values also exist but are at different offsets.
Also, EEPROM can be empty or absent (on PS2TOOL, Namco Arcade machines, or PS3), so there should be a fallback to the default values.
Oh, this kind of documentation is very helpful. Thank you, @AKuHAK. How much effort, would you say, is it to set the video mode in the same manner as the Sony BIOS? That is, using the same settings in EEPROM?
Currently, there are 2 customizable settings regarding the video: RGB/YCbCr and screen ratio (full, 16:9, 4:3). Both are controlled by EEPROM bit flags. There is also 1 EEPROM flag for controlling the PAL/NTSC setting. Not customizable on retail models. On slim DTL/TEST units, however, it is possible to change it by holding a special button combination on console start. As I know PS2 OSDSYS is setting video mode according to that flag just by applying a set of hardcoded values that is stored in BIOS. I suppose that these are the same values that you are using for setting PAL or NTSC video modes in the current Github Action workflow. Later on, user can play with gcont.smode1 and aspect ratio (dont remember what was used for AspectRation in GS registers).
As I know PS2 OSDSYS is setting video mode according to that flag just by applying a set of hardcoded values that is stored in BIOS. I suppose that these are the same values that you are using for setting PAL or NTSC video modes in the current Github Action workflow.
Yes, I've verified that for the preset standard PAL/NTSC/VESA/DTV modes Linux calculates, and matches exactly, the hard-coded register values and modes listed by Sony on page 84, section 5.1.2 Corresponding Video Signal, in the GS User's manual.
Since video modes aren't hard-coded in Linux, it's easy to apply various custom adjustments, for example moving the screen left, right, up, or down, if it's slightly off in some direction. The PS2 HDMI adapters, for instance, often cut off pixels at one of the edges. With a minor adjustment, one can get those pixels back on the screen, to have a pixel-perfect full screen. The mode_margin
option to the ps2fb
driver is made for this purpose.
When
drivers/video/fbdev/ps2fb.c
isn’t given amode_option
parameter, set a default video mode such thatgcont
field of/sys/devices/platform/gs/registers/smode1
is set to eitherrgbyc
orycrcb
, according to System Configuration preference stored in NVRAM.More details in https://github.com/frno7/linux/issues/10#issuecomment-1126938191 and following comments, and https://github.com/frno7/linux/issues/29#issuecomment-529134933, https://github.com/frno7/linux/issues/12#issuecomment-507028783, and https://github.com/frno7/linux/issues/12#issuecomment-778748296.
This will enable a single downloadable Linux file for all kinds of systems.