Fix HDMI not working on bootup with some SD cards

pull/150/head
IanSB 2020-04-09 17:32:28 +01:00
rodzic 56d2997b71
commit 9ec543684d
2 zmienionych plików z 21 dodań i 10 usunięć

Wyświetl plik

@ -640,7 +640,7 @@ void geometry_get_fb_params(capture_info_t *capinfo) {
capinfo->height &= 0xfffffffe;
if (capinfo->chars_per_line > ((capinfo->width + 7) >> 3)) {
//log_info("Clipping capture width: %d, %d, %d", capinfo->width, capinfo->width >> 3, capinfo->nlines);
//log_info("Clipping capture width: %d, %d, %d", capinfo->width, capinfo->width >> 3, capinfo->nlines);
capinfo->chars_per_line = ((capinfo->width + 7) >> 3);
}
@ -690,9 +690,17 @@ int get_vaspect() {
}
int get_hdisplay() {
#if defined(RPI4)
int h_size = 1920;
#else
int h_size = (*PIXELVALVE2_HORZB) & 0xFFFF;
//workaround for 640x480 and 800x480 @50Hz using double rate clock so width gets doubled
int v_size = (*PIXELVALVE2_VERTB) & 0xFFFF;
if (h_size < 640 || h_size > 8192 || v_size < 480 || 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();
}
//workaround for 640x480 and 800x480 @50Hz using double rate clock so width gets doubled
if (v_size == 480 && h_size == 1280) {
h_size = 640;
} else {
@ -700,16 +708,19 @@ int get_hdisplay() {
h_size = 800;
}
}
if (h_size < 320) h_size = 1920;
#endif
return h_size;
}
int get_vdisplay() {
#if defined(RPI4)
int v_size = 1080;
#else
int v_size = (*PIXELVALVE2_VERTB) & 0xFFFF;
if (v_size < 200) v_size = 1080;
#endif
return v_size;
}
void geometry_get_clk_params(clk_info_t *clkinfo) {
clkinfo->clock = geometry->clock;
clkinfo->line_len = geometry->line_len;

Wyświetl plik

@ -420,14 +420,14 @@ static int last_height = -1;
// FIXME: A small delay (like the log) is neccessary here
// or the RPI_PropertyGet seems to return garbage
delay_in_arm_cycles_cpu_adjust(8000000);
delay_in_arm_cycles_cpu_adjust(4000000);
log_info("Initialised Framebuffer");
if ((mp = RPI_PropertyGet(TAG_GET_PHYSICAL_SIZE))) {
int width = mp->data.buffer_32[0];
int height = mp->data.buffer_32[1];
log_info("Size: %dx%d ", width, height);
if (width == 1920 && height == 8192) {
log_info("Size: %dx%d (requested %dx%d)", width, height, capinfo->width, capinfo->height);
if (width != capinfo->width || height != capinfo->height) {
log_info("Invalid frame buffer dimensions - maybe HDMI not connected - rebooting");
delay_in_arm_cycles_cpu_adjust(1000000000);
reboot();
@ -1232,8 +1232,6 @@ static void init_hardware() {
// Initialize the cpld after the gpclk generator has been started
cpld_init();
delay_in_arm_cycles_cpu_adjust(500000000);
// Initialize the On-Screen Display
osd_init();
@ -2166,6 +2164,8 @@ void setup_profile(int profile_changed) {
cpld->set_mode(mode7);
log_debug("Done loading sample points");
log_info("Detected screen size = %dx%d",get_hdisplay(), get_vdisplay());
geometry_get_fb_params(capinfo);
if (autoswitch == AUTOSWITCH_MODE7) {