Home

Reviving the Modeline: Batocera Linux and the Sony GDM-C520

June 27, 2026

This is the detailed technical companion to Batocera Linux and the Sony GDM-C520, finding the right 640x480 mode. If you want just the practical answer, start there.

The 21-inch Trinitron Multiscan display featured a flat FD Trinitron CRT. It was Sony’s flagship professional model, it incorporated a high-definition, high-contrast tube with a 0.22 mm aperture grille pitch, delivered exceptional image quality and offered extensive image adjustment capabilities for professional applications.The 21-inch Trinitron Multiscan display featured a flat FD Trinitron CRT. It was Sony’s flagship professional model, it incorporated a high-definition, high-contrast tube with a 0.22 mm aperture grille pitch, delivered exceptional image quality and offered extensive image adjustment capabilities for professional applications.

The modeline was very much a living, practical tool in the not-too-distant past.

In the 1990s and early 2000s, modelines were essential because computer monitors did not have EDID or DDC — the GPU had no way to automatically detect what the monitor could do. X11 (the Linux/Unix display system) required you to manually tell it exactly how to drive your monitor.

Every Linux user with a CRT had to look up or calculate modelines and put them in xorg.conf just to get X11 to start at all. Getting the modeline wrong meant either no picture, or potentially damaging the monitor.

Who used them:

The tool of the era was a program called xvidtune, which let you interactively adjust modeline parameters while watching the effect live on screen — essentially tuning the picture in real time.

Why it became obsolete:

DDC/EDID eliminated the need. By the mid-2000s, monitors told the GPU their capabilities automatically, and X11 configured itself.

Why it’s relevant again today:

CRT gaming enthusiasts need it precisely because modern software doesn’t know how to handle the unusual resolutions and frequencies that make CRTs shine. History, coming full circle.

Reading the EDID

Let’s try reading the EDID data from a Sony CR1 chassis — specifically the Sony GDM-C520K CRT monitor:

[root@BATOCERA ~]# cat /sys/class/drm/card0-DVI-I-1/edid | edid-decode
edid-decode (hex):

00 ff ff ff ff ff ff 00 4d d9 b1 01 01 01 01 01
31 0c 01 03 0e 28 1e 96 2b 0c c1 a0 57 47 9b 27
12 50 54 ff ff 80 e1 4f d1 59 a9 59 81 99 71 59
61 59 45 59 81 4f 86 3d 00 c0 51 00 30 40 40 a0
13 00 84 23 11 00 00 1e 00 00 00 fd 00 30 aa 1e
82 25 00 0a 20 20 20 20 20 20 00 00 00 fc 00 47
44 4d 2d 43 35 32 30 0a 20 20 20 20 00 00 00 ff
00 38 37 30 30 30 39 31 0a 20 20 20 20 20 00 81

----------------

Block 0, Base EDID:
  EDID Structure Version & Revision: 1.3
  Vendor & Product Identification:
    Manufacturer: SNY
    Model: 433
    Serial Number: 16843009 (0x01010101)
    Made in: week 49 of 2002
  Basic Display Parameters & Features:
    Analog display
    Signal Level Standard: 0.700 : 0.300 : 1.000 V p-p
    Blank level equals black level
    Sync: Separate Composite SyncOnGreen
    Maximum image size: 40 cm x 30 cm
    Gamma: 2.50
    DPMS levels: Off
    RGB color display
    First detailed timing is the preferred timing
    Supports GTF timings within operating range
  Color Characteristics:
    Red  : 0.6250, 0.3398
    Green: 0.2802, 0.6054
    Blue : 0.1552, 0.0703
    White: 0.3125, 0.3291
  Established Timings I & II:
    IBM     :   720x400    70.081663 Hz   9:5     31.467 kHz     28.320000 MHz
    IBM     :   720x400    87.849542 Hz   9:5     39.444 kHz     35.500000 MHz
    DMT 0x04:   640x480    59.940476 Hz   4:3     31.469 kHz     25.175000 MHz
    Apple   :   640x480    66.666667 Hz   4:3     35.000 kHz     30.240000 MHz
    DMT 0x05:   640x480    72.808802 Hz   4:3     37.861 kHz     31.500000 MHz
    DMT 0x06:   640x480    75.000000 Hz   4:3     37.500 kHz     31.500000 MHz
    DMT 0x08:   800x600    56.250000 Hz   4:3     35.156 kHz     36.000000 MHz
    DMT 0x09:   800x600    60.316541 Hz   4:3     37.879 kHz     40.000000 MHz
    DMT 0x0a:   800x600    72.187572 Hz   4:3     48.077 kHz     50.000000 MHz
    DMT 0x0b:   800x600    75.000000 Hz   4:3     46.875 kHz     49.500000 MHz
    Apple   :   832x624    74.551266 Hz   4:3     49.726 kHz     57.284000 MHz
    DMT 0x0f:  1024x768i   86.957532 Hz   4:3     35.522 kHz     44.900000 MHz
    DMT 0x10:  1024x768    60.003840 Hz   4:3     48.363 kHz     65.000000 MHz
    DMT 0x11:  1024x768    70.069359 Hz   4:3     56.476 kHz     75.000000 MHz
    DMT 0x12:  1024x768    75.028582 Hz   4:3     60.023 kHz     78.750000 MHz
    DMT 0x24:  1280x1024   75.024675 Hz   5:4     79.976 kHz    135.000000 MHz
    Apple   :  1152x870    75.061550 Hz 192:145   68.681 kHz    100.000000 MHz
  Standard Timings:
    GTF     :  2048x1536   74.999956 Hz   4:3    120.225 kHz    340.477000 MHz
    GTF     :  1920x1440   84.999970 Hz   4:3    128.520 kHz    341.349000 MHz
    DMT 0x37:  1600x1200   85.000000 Hz   4:3    106.250 kHz    229.500000 MHz
    DMT 0x25:  1280x1024   85.024098 Hz   5:4     91.146 kHz    157.500000 MHz
    GTF     :  1152x864    84.999687 Hz   4:3     77.095 kHz    119.651000 MHz
    DMT 0x13:  1024x768    84.996690 Hz   4:3     68.677 kHz     94.500000 MHz
    DMT 0x0c:   800x600    85.061274 Hz   4:3     53.674 kHz     56.250000 MHz
    GTF     :  1280x960    74.999884 Hz   4:3     75.150 kHz    129.859000 MHz
  Detailed Timing Descriptors:
    DTD 1:  1280x1024   85.024098 Hz   5:4     91.146 kHz    157.500000 MHz (388 mm x 291 mm)
                 Hfront   64 Hsync 160 Hback  224 Hpol P
                 Vfront    1 Vsync   3 Vback   44 Vpol P
    Display Range Limits:
      Monitor ranges (GTF): 48-170 Hz V, 30-130 kHz H, max dotclock 370 MHz
    Display Product Name: 'GDM-C520'
    Display Product Serial Number: '8700091'
Checksum: 0x81
[root@BATOCERA ~]#

We now have the complete EDID data straight from the monitor — far more valuable than the service manual alone, since it confirms what the hardware itself is reporting.

Key findings for the GDM-C520:

Critically, the monitor explicitly lists 1024x768i (interlaced) as a supported mode, confirming it can handle interlaced signals.

For the standard progressive modeline, the EDID confirms we can safely use:

ModeLine "640x480" 25.175 640 656 752 800 480 490 492 525 -hsync -vsync

This is derived directly from the established timing DMT 0x04 that the monitor’s own EDID advertises. No guesswork needed.

Cross-Referencing the Hardware

Before implementing anything, let’s look at the consolemods.org page on the Sony GDM-C520K. It has an information and links section for the GDM-C520K, also captured in the Sony Artisan marketing brochure.

Property Value
Manufacturer Sony
Type PC
Tube Series FD Trinitron
Size 21”
Viewable Size 19.8”
Dot Pitch 0.24mm
Mask Aperture Grille
Free-Scan ** Yes
Horizontal Scan 30 - 130kHz
Vertical Scan 48 - 170Hz
Unlocked Ranges *** Yes
Unlocked H. Scan 30 - 150.6kHz
Unlocked V. Scan 48 - 254Hz
OSD Color Bias + Gain
OSD Conv. Yes
Dynamic Conv. Yes (45 points)
Service Method PC (WinDAS)
Service Port TTL serial
VGA 2x
Width 49.7 cm
Depth 48.7 cm
Height 49.9 cm
Weight 66 lbs
Chassis CR1

** Free-Scan is not Sony-specific — it’s a general term used across the CRT monitor industry to describe a monitor that can synchronize to a continuous range of frequencies rather than being locked to a fixed set of preset modes. Some less expensive monitors could only display a handful of specific resolutions, while a Free-Scan monitor can accept virtually any signal within its stated range and lock onto it automatically. It’s sometimes also called multisync, a term popularized by NEC.

*** Unlocked ranges are a different thing entirely. They refer to ranges accessible only through the service menu, beyond what Sony officially specified. The figures of 30–150.6 kHz H and 48–254 Hz V are the hardware limits of the actual circuitry inside the monitor, beyond the conservative official spec. These ranges are not something Sony documented or supported outside the service manual found on manualslib.com. The CRT community may have discovered them through experimentation and/or service menu access, but this is simply a guess.

The Service Manual Timing Table

The timing specification table below is from the service manual, found on page 5.

Note: the V. FP (vertical front porch) row below is transcribed directly from the manual scan. During the derivation later in this article, Mode 1 uses a value of 10 lines for V. FP rather than 1, based on a closer re-check of the source. If you’re following along with your own scan, double check this cell against your copy of the manual before relying on it.

MODE AT PRODUCTION MODE 1 MODE 2 MODE 3 MODE 4
RESOLUTION 640 X 480 1600 X 1200 1920 X 1440 1920 X 1440
CLOCK 25.175 MHz 229.500 MHz 341.000 MHz 297.000 MHz
HORIZONTAL
H. FREQ 31.469 kHz 106.250 kHz 128.485 kHz 112.500 kHz
H. TOTAL usec 31.778 9.412 7.783 8.889
H. BLK usec 6.356 2.440 2.152 2.424
H. FP usec 0.636 0.279 0.457 0.485
H. SYNC usec 3.813 0.837 0.622 0.754
H. BP usec 1.907 1.325 1.073 1.185
H. ACTIV usec 25.422 6.972 5.630 6.465
VERTICAL
V. FREQ Hz 59.940 85.000 84.977 75.000
V. TOTAL lines 525 1250 1512 1500
V. BLK lines 45 50 72 60
V. FP lines 10 1 1 1
V. SYNC lines 2 3 3 3
V. BP lines 33 46 68 56
V. ACTIV lines 480 1200 1440 1440
SYNC
INT (G) NO NO NO NO
EXT (H/V) / POLARITY YES N/N YES P/P YES P/P YES N/P
EXT (CS) / POLARITY NO NO NO NO
INT/NON INT NON INT NON INT NON INT NON INT

This table is very valuable for our purposes. Looking at Mode 1 (640x480) specifically, we can derive the exact modeline for the GDM-C520 directly from the official Sony service manual timing values:

This gives us the official Sony modeline:

ModeLine "640x480" 25.175 640 656 752 800 480 490 492 525 -hsync -vsync

This is derived entirely from Sony’s own service manual for this exact monitor. It doesn’t get more authoritative than that.

Two Independent Sources, One Answer

Both sources confirm the exact same values:

Both lead to the same modeline, which can be derived mathematically from the Sony service manual timing table using this process.

The modeline format is:

ModeLine "name" clock hdisp hsyncstart hsyncend htotal vdisp vsyncstart vsyncend vtotal [flags]

From the horizontal timing values:

From the vertical timing values:

Sync polarity from EXT (H/V) POLARITY = N/N → -hsync -vsync

So the service manual alone would have gotten us to exactly the same modeline. The EDID simply confirmed it independently.

One Modeline, One Resolution

This modeline is specific to 640x480 at 59.94Hz only. Each resolution and refresh rate combination requires its own modeline. From the service manual table we actually have enough data to derive modelines for all four documented modes:

However, for Batocera CRT gaming purposes, 640x480 is the only one actually needed, since that’s the target resolution for the entire system. The higher resolutions are there for when the monitor was used as a professional graphics workstation — which was its original intended purpose.

A Professional Monitor, Repurposed

As an exercise, let’s derive the remaining modelines. The GDM-C520 was not a gaming monitor — it was a professional color reference monitor primarily used by:

The Sony marketing sheet makes this very clear — it was sold as the Artisan™ Color Reference System and came bundled with a calibration sensor and color profiling software.

So those high resolutions make perfect sense in that context:

These were the resolutions a graphic designer or photographer would run all day while doing color-critical work. In fact, my monitor was purchased from a professional photographer in Warsaw for only 50 Polish złoty (roughly 12 USD), about ten years ago. The monitor was essentially Sony’s answer to the need for an absolutely accurate, calibrated display in a professional creative workflow.

Which makes it a rather wonderful coincidence that such a monitor ended up being used for retro gaming — it’s arguably overkill in the best possible way.

So let’s go through each modeline professionals would have used:

MODE 2: 1600x1200 @ 85Hz

ModeLine "1600x1200" 229.500 1600 1664 1856 2160 1200 1201 1204 1250 +hsync +vsync

MODE 3: 1920x1440 @ 84.977Hz

ModeLine "1920x1440" 341.000 1920 2076 2288 2654 1440 1441 1444 1512 +hsync +vsync

MODE 4: 1920x1440 @ 75Hz

ModeLine "1920x1440" 297.000 1920 2064 2288 2640 1440 1441 1444 1500 -hsync +vsync

All four modelines together:

ModeLine "640x480"   25.175  640  656  752  800  480  490  492  525 -hsync -vsync
ModeLine "1600x1200" 229.500 1600 1664 1856 2160 1200 1201 1204 1250 +hsync +vsync
ModeLine "1920x1440" 341.000 1920 2076 2288 2654 1440 1441 1444 1512 +hsync +vsync
ModeLine "1920x1440" 297.000 1920 2064 2288 2640 1440 1441 1444 1500 -hsync +vsync

With the math checked against two independent sources — the monitor’s own EDID and Sony’s official service manual — the next step was putting this modeline to work inside Batocera itself.

A Simpler Path Than Expected

With the modeline math verified, the natural next step seemed to be implementing it through xinitrc and a custom xrandr modeline — the classic approach used throughout the 2000s, and the one referenced in older Batocera CRT documentation.

However, a closer look at the current Batocera wiki and the Batocera-CRT-Script project revealed something important: the custom modeline route exists primarily to solve two specific problems — driving CRTs at 15kHz (consumer/arcade CRTs, not PC monitors), and forcing resolutions that aren’t already present in a monitor’s own EDID.

Neither applies here. The GDM-C520 is a 31kHz+ PC monitor, and its own EDID already advertises natively — the exact mode this whole investigation was built around.

So instead of hand-rolling an xrandr modeline through xinitrc, the actual fix was the simplest one available: setting

es.resolution=640x480

directly in /boot/batocera-boot.conf, the same straightforward method already used earlier in this project to set the UI to 1280x960. Batocera read the monitor’s EDID, found 640x480 already listed as a supported mode, and used it — no custom timing required.

The modeline derivation wasn’t wasted effort, though. It confirmed, independently and from three separate sources — the EDID, the Sony service manual, and the VESA standard — that was both safe and correct for this monitor. That confidence is what made trusting the simple es.resolution setting reasonable in the first place, rather than a guess.

An Unexpected 85Hz

After setting es.resolution=640x480 in both batocera.conf and letting it sync down into batocera-boot.conf, a reboot confirmed the change had taken effect — checked the honest way, by reading Batocera’s own SSH welcome banner rather than assuming:

Display Output: DVI-I-0
Display Resolution: 640x480
Display Refresh Rate: 85.01Hz

640x480, exactly as intended. But the refresh rate was a surprise: 85.01Hz, not the 59.94Hz the modeline derivation had spent so much time confirming.

The explanation turned out to be GTF — the Generalized Timing Formula, a VESA standard that lets a GPU mathematically calculate valid timings for a resolution/refresh combination on the fly, rather than requiring the monitor to explicitly list every mode it supports in its EDID. The GDM-C520’s EDID doesn’t hide this — it says so directly: “Supports GTF timings within operating range.” Given that declaration, Xorg appears to have calculated its own preferred 640x480 timing at 85Hz rather than defaulting to the lower, explicitly-listed 59.94Hz DMT 0x04 mode.

Is this a problem? No. 85Hz at 640x480 sits comfortably within the monitor’s documented 30–130kHz horizontal and 48–170Hz vertical range — nowhere close to the edges. If anything, it’s a nice reminder of what “Free-Scan” actually buys you: the system reached for a smoother refresh rate than requested, and the monitor simply handled it without complaint.

It’s also a good illustration of the difference between asking for a resolution and dictating an exact timing. Setting es.resolution=640x480 asks Batocera for a resolution; it does not pin the precise pixel clock, blanking intervals, or refresh rate the way a hand-written modeline would. Most of the time that’s a feature, not a bug — but it’s worth knowing about if a specific refresh rate matters for a particular use case down the line.

For now, the picture looks excellent — full natural scanlines, stable, and exactly the kind of low-resolution CRT image this whole investigation was chasing. Whether to pin it precisely to the derived 59.94Hz modeline, or leave Xorg to its own (perfectly safe) judgment at 85Hz, is a question for another day.

Pinning the Exact Mode

That “question for another day” didn’t stay unanswered for long.

The first attempt to fix the refresh rate ran into a small but instructive snag: the change was made in /boot/batocera-boot.conf, the same file edited earlier in this project to set the UI resolution to 1280x960. That edit appeared to save correctly, and the file confirmed it — but a reboot left the refresh rate unchanged. The cause turned out to be a comment buried at the bottom of batocera-boot.conf itself, easy to miss on a first read:

“Below are copied values from batocera.conf to make them available in an early boot stage. Change them in batocera.conf or the menu, not here.”

batocera-boot.conf mirrors certain values from batocera.conf at every boot — it isn’t the source of truth, it’s a copy. Editing the mirror directly works only until the next boot, at which point the real source overwrites it again. The fix was simple once that was clear: make the edit in /userdata/system/batocera.conf instead, the file EmulationStation actually treats as authoritative.

With that sorted, the next step was choosing the right refresh rate string. Setting es.resolution=640x480 alone had let Xorg pick its own GTF-calculated 85Hz timing — safe, but not the one this whole investigation had been built around. Batocera’s resolution syntax can pin a specific refresh rate by appending it to the resolution, but the string has to match exactly what Xorg itself reports. Running xrandr confirmed the available 640x480 modes on this exact machine:

640x480       85.01*   75.00    72.81    72.81    59.94

The desired mode was right there, labeled 59.94 — not 60.00, which doesn’t even appear as an option for 640x480 on this card and monitor combination, and not 59.940, which is more precise than the string Xorg actually uses. The correct line in batocera.conf turned out to be:

es.resolution=640x480.59.94

After saving and rebooting, the SSH welcome banner confirmed it:

Display Output: DVI-I-0
Display Resolution: 640x480
Display Refresh Rate: 59.94Hz

What makes this figure worth pausing on isn’t just that it worked — it’s how thoroughly it had already been corroborated, well before this final config edit. The same 59.94 appears, independently, in three separate places:

  1. The EDID, read directly from the monitor: DMT 0x04: 640x480 59.940476 Hz
  2. The Sony service manual’s timing specification table, under Mode 1: V. FREQ (HZ): 59.940 Hz
  3. Xorg’s own mode list on this exact machine, reporting the same mode as 59.94

Setting es.resolution=640x480.59.94 wasn’t a guess dressed up as a setting — it was the deliberate selection of the one timing that the monitor’s own firmware, Sony’s original engineering documentation, and the running X server all agreed on independently. That’s about as close to “by the book” as a thirty-year-old CRT and a modern Linux frontend are ever going to get.

Not Quite Perfect — Yet

Getting the resolution right was the foundation, but it didn’t mean every game looked correct. Some arcade games running through MAME 2003 Plus displayed an unsettling artifact: graphic elements that should have been perfectly square appeared slightly rectangular. A block that should have been four pixels wide was rendering as three pixels wide on some rows and four on others — a subtle but immediately noticeable.

Integer scaling applied to X axis only, set via Retroarch. Notice how the area of interest identifies clipping of the copyright symbol. If you have a sharp eye you will notice the S is also clipped.Integer scaling applied to X axis only, set via Retroarch. Notice how the area of interest identifies clipping of the copyright symbol. If you have a sharp eye you will notice the S is also clipped. Integer scaling applied to both the X and Y axis resolves the trimming for true pixel perfection.Integer scaling applied to both the X and Y axis resolves the trimming for true pixel perfection.

The cause turned out to be something that isn’t well documented: RetroArch’s integer scaling was being applied to the Y axis only by default. Integer scaling on Y alone enforces whole-number vertical scaling — so no row of pixels gets squashed or stretched — but it leaves horizontal scaling unconstrained, allowing non-integer widths that produce exactly the kind of uneven pixel geometry that was showing up in-game.

The fix was found inside the RetroArch Quick Menu, accessible while the game is running via Shift+F1:

Settings → Video → Output → Integer Scale Axis

The default value was Y. Changing it to Y + X enforces integer scaling on both axes simultaneously — every pixel must be a whole-number multiple in both directions, guaranteeing square geometry.

The result was immediately and dramatically better. With both axes locked, the pixels rendered as true squares and the image snapped into the kind of geometric precision that makes a high-quality CRT like the GDM-C520 genuinely shine. The combination of real phosphor rendering at 640x480 with correct integer scaling on both axes produced something that’s difficult to describe in words — it simply has to be seen.

To make the setting permanent for all MAME 2003 Plus games:

Quick Menu → Overrides → Save Core Override

That writes the setting to RetroArch’s core override file, which Batocera preserves across reboots and game launches. One change, applied once, fixes every game on that core.

It’s worth noting that this fix was discovered through hands-on testing rather than documentation — it isn’t prominently mentioned in Batocera’s wiki or the RetroArch documentation for CRT setups. The lesson is the same one that runs through this whole project: the tools are powerful, the defaults are reasonable, but the final few percent of quality comes from careful observation and a willingness to dig into settings that aren’t immediately obvious.