diff --git a/gfx/drivers_context/opendingux_fbdev_ctx.c b/gfx/drivers_context/opendingux_fbdev_ctx.c index 6d60a6c536..f12021e778 100644 --- a/gfx/drivers_context/opendingux_fbdev_ctx.c +++ b/gfx/drivers_context/opendingux_fbdev_ctx.c @@ -33,6 +33,7 @@ typedef struct { #ifdef HAVE_EGL egl_ctx_data_t egl; + EGLNativeWindowType native_window; #endif bool resize; unsigned width, height; @@ -42,15 +43,15 @@ static void gfx_ctx_opendingux_destroy(void *data) { opendingux_ctx_data_t *viv = (opendingux_ctx_data_t*)data; - if (!viv) - return; - + if (viv) + { #ifdef HAVE_EGL - egl_destroy(&viv->egl); + egl_destroy(&viv->egl); #endif - viv->resize = false; - free(viv); + viv->resize = false; + free(viv); + } } static void *gfx_ctx_opendingux_init(void *video_driver) @@ -78,8 +79,6 @@ static void *gfx_ctx_opendingux_init(void *video_driver) if (!viv) return NULL; - (void)video_driver; - #ifdef HAVE_EGL frontend_driver_install_signal_handler(); @@ -146,8 +145,6 @@ static void gfx_ctx_opendingux_update_window_title(void *data) char buf_fps[128] = {0}; settings_t *settings = config_get_ptr(); - (void)data; - video_monitor_get_fps(buf, sizeof(buf), buf_fps, sizeof(buf_fps)); if (settings->fps_show) @@ -159,7 +156,6 @@ static bool gfx_ctx_opendingux_set_video_mode(void *data, bool fullscreen) { #ifdef HAVE_EGL - EGLNativeWindowType window; static const EGLint attribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, /* Use version 2, even for GLES3. */ EGL_NONE @@ -183,8 +179,8 @@ static bool gfx_ctx_opendingux_set_video_mode(void *data, goto error; } - window = 0; - if (!egl_create_surface(&viv->egl, window)) + viv->native_window = 0; + if (!egl_create_surface(&viv->egl, viv->native_window)) goto error; #endif diff --git a/gfx/drivers_context/vc_egl_ctx.c b/gfx/drivers_context/vc_egl_ctx.c index e993001e08..62d92921ef 100644 --- a/gfx/drivers_context/vc_egl_ctx.c +++ b/gfx/drivers_context/vc_egl_ctx.c @@ -52,6 +52,8 @@ typedef struct #ifdef HAVE_EGL egl_ctx_data_t egl; #endif + EGL_DISPMANX_WINDOW_T native_window; + bool resize; unsigned fb_width, fb_height; @@ -129,10 +131,12 @@ static void gfx_ctx_vc_get_video_size(void *data, /* Calculate source and destination aspect ratios. */ - float srcAspect = (float)settings->video.fullscreen_x / (float)settings->video.fullscreen_y; + float srcAspect = (float)settings->video.fullscreen_x + / (float)settings->video.fullscreen_y; float dstAspect = (float)vc->fb_width / (float)vc->fb_height; - /* If source and destination aspect ratios are not equal correct source width. */ + /* If source and destination aspect ratios + * are not equal correct source width. */ if (srcAspect != dstAspect) *width = (unsigned)(settings->video.fullscreen_y * dstAspect); else @@ -152,7 +156,6 @@ static void *gfx_ctx_vc_init(void *video_driver) { VC_DISPMANX_ALPHA_T alpha; EGLint n, major, minor; - static EGL_DISPMANX_WINDOW_T nativewindow; DISPMANX_ELEMENT_HANDLE_T dispman_element; DISPMANX_DISPLAY_HANDLE_T dispman_display; @@ -202,7 +205,8 @@ static void *gfx_ctx_vc_init(void *video_driver) goto error; } - if (!egl_create_context(&vc->egl, (vc_api == GFX_CTX_OPENGL_ES_API) ? context_attributes : NULL)) + if (!egl_create_context(&vc->egl, (vc_api == GFX_CTX_OPENGL_ES_API) + ? context_attributes : NULL)) { egl_report_error(); goto error; @@ -257,7 +261,7 @@ static void *gfx_ctx_vc_init(void *video_driver) 0 /*layer*/, &dst_rect, 0 /*src*/, &src_rect, DISPMANX_PROTECTION_NONE, &alpha, 0 /*clamp*/, DISPMANX_NO_ROTATE); - nativewindow.element = dispman_element; + vc->native_window.element = dispman_element; /* Use dispmanx upscaling if fullscreen_x and fullscreen_y are set. */ @@ -269,25 +273,26 @@ static void *gfx_ctx_vc_init(void *video_driver) * can be used to stretch video output. */ /* Calculate source and destination aspect ratios. */ - float srcAspect = (float)settings->video.fullscreen_x / (float)settings->video.fullscreen_y; + float srcAspect = (float)settings->video.fullscreen_x + / (float)settings->video.fullscreen_y; float dstAspect = (float)vc->fb_width / (float)vc->fb_height; /* If source and destination aspect ratios are not equal correct source width. */ if (srcAspect != dstAspect) - nativewindow.width = (unsigned)(settings->video.fullscreen_y * dstAspect); + vc->native_window.width = (unsigned)(settings->video.fullscreen_y * dstAspect); else - nativewindow.width = settings->video.fullscreen_x; - nativewindow.height = settings->video.fullscreen_y; + vc->native_window.width = settings->video.fullscreen_x; + vc->native_window.height = settings->video.fullscreen_y; } else { - nativewindow.width = vc->fb_width; - nativewindow.height = vc->fb_height; + vc->native_window.width = vc->fb_width; + vc->native_window.height = vc->fb_height; } vc_dispmanx_update_submit_sync(dispman_update); #ifdef HAVE_EGL - if (!egl_create_surface(&vc->egl, &nativewindow)) + if (!egl_create_surface(&vc->egl, &vc->native_window)) goto error; #endif