Add "PC SoG/CS coast" compatibility option

tvp_source_setup() disables the TVP7002 internal H-PLL coast for every
PC-type preset. That is right for RGBHV, but with sync-on-green or
composite sync the serration pulses during vsync disturb the H-PLL every
frame; on a NeXTstation Color (1120x832, SoG) this caused continuous
horizontal jitter, jitter in the top third of the picture and a periodic
HDMI re-sync. With the option on, coast is re-enabled after setup when the
sync source is SOG or CSYNC; RGBHV is untouched. Default Off, so existing
behaviour is unchanged. Stored as profile item id 68.

On the NeXT, this option together with the existing settings Analog sync
LPF = 10 MHz, ADC PLL BW = Low and H-PLL Pre/Post-Coast = 4/4 ran 19
minutes without a sync loss, mode re-program or IT6613 video-stable
change. SPARCstation 20 framebuffers (ZX, TurboGX) over composite sync are
stable without it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WiXHy7Jhh5yTdsBaenucgw
This commit is contained in:
Peter YooandClaude Fable 5.1 committed 2026-09-18 22:10:53 +09:00
1 parent f3b2419da8
commit 5fd71e8312
6 files changed
+19 -1

No files matched your search

+7 -1
View File
@@ -392,7 +392,7 @@ status_t get_status(tvp_sync_input_t syncinput)
status = (status < MODE_CHANGE) ? MODE_CHANGE : status;
}
if (memcmp(&tc, &cm.cc, offsetof(avconfig_t, sl_mode)) || (update_cur_vm == 1))
if (memcmp(&tc, &cm.cc, offsetof(avconfig_t, sl_mode)) || (update_cur_vm == 1) || (tc.pc_sog_coast != cm.cc.pc_sog_coast))
status = (status < MODE_CHANGE) ? MODE_CHANGE : status;
cm.totlines = totlines;
@@ -714,6 +714,12 @@ void program_mode()
(alt_u8)h_synclen_px,
(alt_8)(cm.cc.clamp_offset-SIGNED_NUMVAL_ZERO),
vmode_changed);
// tvp_source_setup() disables the internal coast signal for PC-type presets, which is correct for RGBHV but
// leaves the H-PLL exposed to vsync serration pulses on sync-on-green / composite-sync inputs. Keep coast
// enabled for those when the option is set (needed e.g. for 13W3 workstation displays).
if ((target_type & VIDEO_PC) && cm.cc.pc_sog_coast && ((target_tvp_sync <= TVP_SOG3) || (target_tvp_sync >= TVP_CS_A)))
tvp_set_coast_enable(1);
set_lpf(cm.cc.video_lpf);
set_csc(cm.cc.ypbpr_cs);
@@ -180,6 +180,13 @@ inline void tvp_set_hpllcoast(alt_u8 pre, alt_u8 post)
tvp_writereg(TVP_HPLLPOSTCOAST, post);
}
// Enable/disable the internal H-PLL coast signal (MISCCTRL4 bit 2, "Coast Dis")
void tvp_set_coast_enable(alt_u8 enable)
{
alt_u8 val = tvp_readreg(TVP_MISCCTRL4) & 0xFB;
tvp_writereg(TVP_MISCCTRL4, val | (enable ? 0x00 : 0x04));
}
inline void tvp_set_linelen_tol(alt_u8 val) {
tvp_writereg(TVP_LINELENTOL, val);
}
@@ -90,6 +90,8 @@ inline void tvp_powerup();
inline void tvp_set_hpllcoast(alt_u8 pre, alt_u8 post);
void tvp_set_coast_enable(alt_u8 enable);
inline void tvp_set_linelen_tol(alt_u8 val);
inline void tvp_set_ssthold(alt_u8 vsdetect_thold);
+1
View File
@@ -159,6 +159,7 @@ typedef struct {
alt_u8 full_tx_setup;
alt_u8 av3_alt_rgb;
avinput_t link_av;
alt_u8 pc_sog_coast;
} __attribute__((packed)) avconfig_t;
int set_default_profile(int update_cc);
+1
View File
@@ -248,6 +248,7 @@ MENU(menu_compatibility, P99_PROTECT({ \
{ "Default HDMI VIC", OPT_AVCONFIG_NUMVALUE, { .num = { &tc.default_vic, OPT_NOWRAP, 0, HDMI_1080p50, value_disp } } },
{ "Panasonic hack", OPT_AVCONFIG_SELECTION, { .sel = { &tc.panasonic_hack, OPT_WRAP, SETTING_ITEM(off_on_desc) } } },
{ "Disable PR2x", OPT_AVCONFIG_SELECTION, { .sel = { &tc.hdmi_pr2x_disable, OPT_WRAP, SETTING_ITEM(off_on_desc) } } },
{ "PC SoG/CS coast", OPT_AVCONFIG_SELECTION, { .sel = { &tc.pc_sog_coast, OPT_WRAP, SETTING_ITEM(off_on_desc) } } },
}))
MENU(menu_audio, P99_PROTECT({ \
+1
View File
@@ -144,6 +144,7 @@ const ude_item_map ude_profile_items[] = {
UDE_ITEM(67, 120, tc.o480p_pbox),
UDE_ITEM(61, 122, tc.hdmi_ar),
UDE_ITEM(61, 122, tc.hdmi_pr2x_disable),
UDE_ITEM(68, 122, tc.pc_sog_coast),
};
int write_userdata(uint8_t entry) {