mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
mali_fbdev: fix for yoffset>0 (screen freezing), setterm unavailable and refresh_rate division by 0 (#13450)
-In case yoffset is not set=0 by the driver (which seems to occur randomly on certain configurations), on next set_video_mode call screen freezes and cannot be updated. Condition to set yoffset to 0 if current value is >0 is added as fix. -If setterm is not available, sh error occurs in the shell on gfx_ctx_mali_fbdev_destroy call. Condition based on setterm availability is added to avoid this. -If pixclock from driver is not available (=0), divide by 0 occurs when trying to calculate refresh rate. Condition is added as a fix, if pixclock=0 refresh rate is set as 60.
This commit is contained in:
parent
d13f325216
commit
f43b19db4f
@ -55,7 +55,6 @@ typedef struct
|
||||
|
||||
static void gfx_ctx_mali_fbdev_destroy(void *data)
|
||||
{
|
||||
int fd;
|
||||
mali_ctx_data_t *mali = (mali_ctx_data_t*)data;
|
||||
|
||||
if (mali)
|
||||
@ -69,12 +68,14 @@ static void gfx_ctx_mali_fbdev_destroy(void *data)
|
||||
}
|
||||
|
||||
/* Clear framebuffer and set cursor on again */
|
||||
fd = open("/dev/tty", O_RDWR);
|
||||
ioctl(fd, VT_ACTIVATE, 5);
|
||||
ioctl(fd, VT_ACTIVATE, 1);
|
||||
close(fd);
|
||||
|
||||
system("setterm -cursor on");
|
||||
if (!system(NULL) && !system("which setterm > /dev/null 2>&1"))
|
||||
{
|
||||
int fd = open("/dev/tty", O_RDWR);
|
||||
ioctl(fd, VT_ACTIVATE, 5);
|
||||
ioctl(fd, VT_ACTIVATE, 1);
|
||||
close(fd);
|
||||
system("setterm -cursor on");
|
||||
}
|
||||
}
|
||||
|
||||
static void gfx_ctx_mali_fbdev_get_video_size(void *data,
|
||||
@ -160,6 +161,15 @@ static bool gfx_ctx_mali_fbdev_set_video_mode(void *data,
|
||||
RARCH_ERR("Error obtaining framebuffer info.\n");
|
||||
goto error;
|
||||
}
|
||||
/*Workaround to reset yoffset when returned >0 from driver */
|
||||
if (vinfo.yoffset != 0)
|
||||
{
|
||||
vinfo.yoffset = 0;
|
||||
if (ioctl(fd, FBIOPUT_VSCREENINFO, &vinfo))
|
||||
{
|
||||
RARCH_ERR("Error resetting yoffset to 0.\n");
|
||||
}
|
||||
}
|
||||
|
||||
close(fd);
|
||||
fd = -1;
|
||||
@ -173,9 +183,14 @@ static bool gfx_ctx_mali_fbdev_set_video_mode(void *data,
|
||||
mali->native_window.width = vinfo.xres;
|
||||
mali->native_window.height = vinfo.yres;
|
||||
|
||||
mali->refresh_rate = 1000000.0f / vinfo.pixclock * 1000000.0f /
|
||||
(vinfo.yres + vinfo.upper_margin + vinfo.lower_margin + vinfo.vsync_len) /
|
||||
(vinfo.xres + vinfo.left_margin + vinfo.right_margin + vinfo.hsync_len);
|
||||
if (vinfo.pixclock)
|
||||
{
|
||||
mali->refresh_rate = 1000000.0f / vinfo.pixclock * 1000000.0f /
|
||||
(vinfo.yres + vinfo.upper_margin + vinfo.lower_margin + vinfo.vsync_len) /
|
||||
(vinfo.xres + vinfo.left_margin + vinfo.right_margin + vinfo.hsync_len);
|
||||
}else{
|
||||
mali->refresh_rate = 60;
|
||||
}
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
if (!egl_create_context(&mali->egl, attribs))
|
||||
|
Loading…
x
Reference in New Issue
Block a user