Fixes for RPI (#1)

New Raspberry Pi porch and aspect ratio generation. Added code to fix X offset for Raspberry Pi.
This commit is contained in:
alphanu1 2019-10-30 08:34:02 +00:00 committed by GitHub
parent 7dbd46c978
commit 9c0f4c737e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -99,7 +99,7 @@ static void switch_res_crt(unsigned width, unsigned height)
video_display_server_set_resolution(width, height, video_display_server_set_resolution(width, height,
ra_set_core_hz, ra_core_hz, crt_center_adjust, crt_index, crt_center_adjust); ra_set_core_hz, ra_core_hz, crt_center_adjust, crt_index, crt_center_adjust);
#if defined(HAVE_VIDEOCORE) #if defined(HAVE_VIDEOCORE)
crt_rpi_switch(width, height, ra_core_hz); crt_rpi_switch(width, height, ra_core_hz, crt_center_adjust);
video_monitor_set_refresh_rate(ra_core_hz); video_monitor_set_refresh_rate(ra_core_hz);
crt_switch_driver_reinit(); crt_switch_driver_reinit();
#endif #endif
@ -259,7 +259,7 @@ int crt_compute_dynamic_width(int width)
} }
#if defined(HAVE_VIDEOCORE) #if defined(HAVE_VIDEOCORE)
static void crt_rpi_switch(int width, int height, float hz) static void crt_rpi_switch(int width, int height, float hz, int xoffset)
{ {
char buffer[1024]; char buffer[1024];
VCHI_INSTANCE_T vchi_instance; VCHI_INSTANCE_T vchi_instance;
@ -289,27 +289,18 @@ static void crt_rpi_switch(int width, int height, float hz)
video_monitor_set_refresh_rate(hz); video_monitor_set_refresh_rate(hz);
/* following code is the mode line generator */ /* following code is the mode line generator */
hsp = (width * 0.117) - (xoffset*4);
pwidth = width; if (width < 700)
{
if (height < 400 && width > 400) hfp = (width * 0.065);
pwidth = width / 2; hbp = width * 0.35-hsp-hfp;
}else {
roundw = roundf((float)pwidth / (float)height * 100) / 100; hfp = (width * 0.033) + (width / 112);
hbp = (width * 0.225) + (width /58);
if (height > width) xoffset = xoffset*2;
roundw = roundf((float)height / (float)width * 100) / 100; }
if (roundw > 1.35) hmax = hbp;
roundw = 1.25;
if (roundw < 1.20)
roundw = 1.34;
hfp = width * 0.065;
hsp = width * 0.1433-hfp+(crt_center_adjust*4);
hbp = width * 0.3-hsp-hfp;
if (height < 241) if (height < 241)
vmax = 261; vmax = 261;