Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-configure default frame buffer video mode #80

Open
2 tasks
frno7 opened this issue May 15, 2022 · 4 comments
Open
2 tasks

Auto-configure default frame buffer video mode #80

frno7 opened this issue May 15, 2022 · 4 comments

Comments

@frno7
Copy link
Owner

frno7 commented May 15, 2022

When drivers/video/fbdev/ps2fb.c isn’t given a mode_option parameter, set a default video mode such that

  • either PAL or NTSC is set, according system region preference;
  • the gcont field of /sys/devices/platform/gs/registers/smode1 is set to either rgbyc or ycrcb, according to System Configuration preference stored in NVRAM.

More details in #10 (comment) and following comments, and #29 (comment), #12 (comment), and #12 (comment).

This will enable a single downloadable Linux file for all kinds of systems.

@AKuHAK
Copy link

AKuHAK commented May 15, 2022

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.

@frno7
Copy link
Owner Author

frno7 commented May 16, 2022

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?

@AKuHAK
Copy link

AKuHAK commented May 16, 2022

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).

@frno7
Copy link
Owner Author

frno7 commented May 16, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants