From ac0cfc8b0fe7b01c1a92f2d29d1e9e0f2abb3c6f Mon Sep 17 00:00:00 2001 From: vanfanel Date: Fri, 21 Nov 2014 12:51:26 +0000 Subject: [PATCH 1/2] Added fbdev resolution detection and term cursor blinking disabling to mali_fbdev driver --- gfx/context/mali_fbdev_ctx.c | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/gfx/context/mali_fbdev_ctx.c b/gfx/context/mali_fbdev_ctx.c index c99d5cc935..35ad996d2d 100644 --- a/gfx/context/mali_fbdev_ctx.c +++ b/gfx/context/mali_fbdev_ctx.c @@ -19,8 +19,16 @@ #include "../gl_common.h" #include +#include #include +//Includes and defines for framebuffer size retrieval +#include +#include +#include +#include +#include + static EGLContext g_egl_ctx; static EGLSurface g_egl_surf; static EGLDisplay g_egl_dpy; @@ -69,6 +77,14 @@ static void gfx_ctx_mali_fbdev_destroy(void *data) g_config = 0; g_quit = 0; g_resize = false; + + //Clear framebuffer and set cursor on again + 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, @@ -110,7 +126,11 @@ static bool gfx_ctx_mali_fbdev_init(void *data) EGLint num_config; EGLint egl_version_major, egl_version_minor; EGLint format; + + //Disable cursor blinking so it's not visible in RetroArch + system("setterm -cursor off"); + RARCH_LOG("[Mali fbdev]: Initializing context\n"); if ((g_egl_dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY)) == EGL_NO_DISPLAY) @@ -188,11 +208,17 @@ static bool gfx_ctx_mali_fbdev_set_video_mode(void *data, unsigned width, unsigned height, bool fullscreen) { - /* Pick some arbitrary default. */ - if (!width || !fullscreen) - width = 1280; - if (!height || !fullscreen) - height = 720; + struct fb_var_screeninfo vinfo; + int fb = open("/dev/fb0", O_RDWR, 0); + if (ioctl(fb, FBIOGET_VSCREENINFO, &vinfo) < 0) + { + RARCH_ERR("Error obtainig framebuffer info.\n"); + goto error; + } + close (fb); + + width = vinfo.xres; + height = vinfo.yres; g_width = width; g_height = height; From 4bedc9f0a9cdceb77ecf188e255439bed9db7692 Mon Sep 17 00:00:00 2001 From: vanfanel Date: Sat, 22 Nov 2014 08:20:33 +0000 Subject: [PATCH 2/2] Changed native window declaration to fix vsync --- gfx/context/mali_fbdev_ctx.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gfx/context/mali_fbdev_ctx.c b/gfx/context/mali_fbdev_ctx.c index 35ad996d2d..36aa6d61bf 100644 --- a/gfx/context/mali_fbdev_ctx.c +++ b/gfx/context/mali_fbdev_ctx.c @@ -29,6 +29,7 @@ #include #include +struct fbdev_window native_window; static EGLContext g_egl_ctx; static EGLSurface g_egl_surf; static EGLDisplay g_egl_dpy; @@ -223,13 +224,15 @@ static bool gfx_ctx_mali_fbdev_set_video_mode(void *data, g_width = width; g_height = height; + native_window.width = vinfo.xres; + native_window.height = vinfo.yres; + static const EGLint attribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, /* Use version 2, even for GLES3. */ EGL_NONE }; - struct fbdev_window window = { width, height }; - if ((g_egl_surf = eglCreateWindowSurface(g_egl_dpy, g_config, &window, 0)) == EGL_NO_SURFACE) + if ((g_egl_surf = eglCreateWindowSurface(g_egl_dpy, g_config, &native_window, 0)) == EGL_NO_SURFACE) { RARCH_ERR("eglCreateWindowSurface failed.\n"); goto error;