Further monitor power up fixes + fix auto scaling

master
IanSB 2024-02-08 01:26:10 +00:00
rodzic e2e8995ed4
commit 45f18fc141
3 zmienionych plików z 11 dodań i 14 usunięć

Wyświetl plik

@ -977,11 +977,11 @@ int get_hdisplay() {
int h_size = (*PIXELVALVE2_HORZB) & 0xFFFF;
#endif
int v_size = (*PIXELVALVE2_VERTB) & 0xFFFF;
// if (h_size < 640 || h_size > 8192 || v_size < 200 || v_size > 4096) {
// log_info("HDMI readback of screen size invalid (%dx%d) - rebooting", h_size, v_size);
// delay_in_arm_cycles_cpu_adjust(1000000000);
// reboot();
// }
if (h_size == 720 && v_size == 240) {
log_info("HDMI readback of screen size indicates HDMI not connected (%dx%d) - rebooting", h_size, v_size);
delay_in_arm_cycles_cpu_adjust(1000000000);
reboot();
}
//workaround for 640x480 and 800x480 @50Hz using double rate clock so width gets doubled
if (v_size == 480 && h_size == 1280) {
h_size = 640;

Wyświetl plik

@ -7307,14 +7307,6 @@ void osd_init() {
int auto_detected = 0;
if (strcmp(prop, DEFAULT_RESOLUTION) == 0)
{
//if auto detected then check vertical resolution and reboot if 240 as EDID wasn't read by Pi due to monitor power up
int v_size = (*PIXELVALVE2_VERTB) & 0xFFFF;
if (v_size == 240) {
log_info("Resolution = Auto and no HDMI connected (V=%d) - rebooting", v_size);
delay_in_arm_cycles_cpu_adjust(1000000000);
reboot();
}
auto_detected = 1;
if (get_parameter(F_REFRESH) == REFRESH_50) {
force_genlock_range = REFRESH_50_60;

Wyświetl plik

@ -1674,6 +1674,7 @@ static void init_hardware() {
_init_cycle_counter();
RPI_SetGpioPinFunction(MODE7_PIN, FS_OUTPUT);
RPI_SetGpioValue(MODE7_PIN, 1);
get_hdisplay(); //forces early reboot if no hdmi connector fitted
#ifdef RPI4
*EMMC_LEGACY = *EMMC_LEGACY | 2; //bit enables legacy SD controller
@ -2818,6 +2819,7 @@ void set_scaling(int value, int reboot) {
if (value == SCALING_AUTO) {
geometry_set_mode(0);
int width = geometry_get_value(MIN_H_WIDTH);
int height = geometry_get_value(MIN_V_HEIGHT);
int h_size = get_hdisplay() - config_overscan_left - config_overscan_right;
int v_size = get_vdisplay() - config_overscan_top - config_overscan_bottom;
double ratio = (double) h_size / v_size;
@ -2831,7 +2833,10 @@ void set_scaling(int value, int reboot) {
||( video_type != VIDEO_TELETEXT && parameters[F_NORMAL_SCALING] == SCALING_UNEVEN && get_haspect() == 3 && (get_vaspect() == 2 || get_vaspect() == 4))) {
width = width * 4 / 3;
}
if ((width > 340 && h_size43 < 1440 && (h_size43 % width) > (width / 3)) || (parameters[F_AUTO_SWITCH] == AUTOSWITCH_MODE7 && v_size == 1024)) {
if ((width > 340 && h_size43 < 1440 && (h_size43 % width) > (width / 3))
|| (parameters[F_AUTO_SWITCH] == AUTOSWITCH_MODE7 && v_size == 1024)
|| (h_size <= 720 && v_size <= 480 && height > 240)
) {
gscaling = GSCALING_MANUAL43;
filtering = FILTERING_SOFT;
set_auto_name("Auto (Interp. 4:3/Soft)");