diff --git a/gfx/common/egl_common.c b/gfx/common/egl_common.c index e0a0840318..c7e762ffa6 100644 --- a/gfx/common/egl_common.c +++ b/gfx/common/egl_common.c @@ -106,3 +106,15 @@ void egl_destroy(void) g_egl_dpy = EGL_NO_DISPLAY; g_egl_config = 0; } + +void egl_bind_hw_render(void *data, bool enable) +{ + g_use_hw_ctx = enable; + + if (!g_egl_dpy || !g_egl_surf) + return; + + eglMakeCurrent(g_egl_dpy, g_egl_surf, + g_egl_surf, + enable ? g_egl_hw_ctx : g_egl_ctx); +} diff --git a/gfx/common/egl_common.h b/gfx/common/egl_common.h index 6298fad774..f1ea57a9f1 100644 --- a/gfx/common/egl_common.h +++ b/gfx/common/egl_common.h @@ -36,4 +36,6 @@ void egl_destroy(void); gfx_ctx_proc_t egl_get_proc_address(const char *symbol); +void egl_bind_hw_render(void *data, bool enable); + #endif diff --git a/gfx/drivers_context/androidegl_ctx.c b/gfx/drivers_context/androidegl_ctx.c index 211c031b7b..0ad6b418e4 100644 --- a/gfx/drivers_context/androidegl_ctx.c +++ b/gfx/drivers_context/androidegl_ctx.c @@ -306,20 +306,6 @@ static bool android_gfx_ctx_has_windowed(void *data) return false; } -static void android_gfx_ctx_bind_hw_render(void *data, bool enable) -{ - g_use_hw_ctx = enable; - - if (!g_egl_dpy) - return; - if (!g_egl_surf) - return; - - eglMakeCurrent(g_egl_dpy, g_egl_surf, - g_egl_surf, enable ? - g_egl_hw_ctx : g_egl_ctx); -} - static void dpi_get_density(char *s, size_t len) { system_property_get("getprop", "ro.sf.lcd_density", s); @@ -384,5 +370,5 @@ const gfx_ctx_driver_t gfx_ctx_android = { NULL, NULL, "android", - android_gfx_ctx_bind_hw_render, + egl_bind_hw_render, }; diff --git a/gfx/drivers_context/bbqnx_ctx.c b/gfx/drivers_context/bbqnx_ctx.c index 50c3f72e1f..ceecc97836 100644 --- a/gfx/drivers_context/bbqnx_ctx.c +++ b/gfx/drivers_context/bbqnx_ctx.c @@ -384,17 +384,6 @@ static bool gfx_ctx_qnx_has_windowed(void *data) return false; } -static void gfx_qnx_ctx_bind_hw_render(void *data, bool enable) -{ - g_use_hw_ctx = enable; - - if (!g_egl_dpy || !g_egl_surf) - return; - - eglMakeCurrent(g_egl_dpy, g_egl_surf, - g_egl_surf, enable ? g_egl_hw_ctx : g_egl_ctx); -} - const gfx_ctx_driver_t gfx_ctx_bbqnx = { gfx_ctx_qnx_init, gfx_ctx_qnx_destroy, @@ -420,5 +409,5 @@ const gfx_ctx_driver_t gfx_ctx_bbqnx = { NULL, NULL, "blackberry_qnx", - gfx_qnx_ctx_bind_hw_render, + egl_bind_hw_render, }; diff --git a/gfx/drivers_context/drm_egl_ctx.c b/gfx/drivers_context/drm_egl_ctx.c index be53b32549..943ecebc17 100644 --- a/gfx/drivers_context/drm_egl_ctx.c +++ b/gfx/drivers_context/drm_egl_ctx.c @@ -907,17 +907,6 @@ static bool gfx_ctx_drm_egl_bind_api(void *data, return false; } -static void gfx_ctx_drm_egl_bind_hw_render(void *data, bool enable) -{ - g_use_hw_ctx = enable; - - if (!g_egl_dpy || !g_egl_surf) - return; - - eglMakeCurrent(g_egl_dpy, g_egl_surf, - g_egl_surf, - enable ? g_egl_hw_ctx : g_egl_ctx); -} const gfx_ctx_driver_t gfx_ctx_drm_egl = { gfx_ctx_drm_egl_init, @@ -944,5 +933,5 @@ const gfx_ctx_driver_t gfx_ctx_drm_egl = { NULL, NULL, "kms-egl", - gfx_ctx_drm_egl_bind_hw_render, + egl_bind_hw_render, }; diff --git a/gfx/drivers_context/emscriptenegl_ctx.c b/gfx/drivers_context/emscriptenegl_ctx.c index d194b7b526..53560791bc 100644 --- a/gfx/drivers_context/emscriptenegl_ctx.c +++ b/gfx/drivers_context/emscriptenegl_ctx.c @@ -298,4 +298,5 @@ const gfx_ctx_driver_t gfx_ctx_emscripten = { gfx_ctx_emscripten_write_egl_image, NULL, "emscripten", + egl_bind_hw_render, }; diff --git a/gfx/drivers_context/vc_egl_ctx.c b/gfx/drivers_context/vc_egl_ctx.c index fd1337160a..21c2f3eea3 100644 --- a/gfx/drivers_context/vc_egl_ctx.c +++ b/gfx/drivers_context/vc_egl_ctx.c @@ -609,17 +609,6 @@ static bool gfx_ctx_vc_image_buffer_write(void *data, const void *frame, unsigne return ret; } -static void gfx_ctx_vc_bind_hw_render(void *data, bool enable) -{ - g_use_hw_ctx = enable; - - if (!g_egl_dpy || !g_egl_surf) - return; - - eglMakeCurrent(g_egl_dpy, g_egl_surf, - g_egl_surf, enable ? g_egl_hw_ctx : g_egl_ctx); -} - const gfx_ctx_driver_t gfx_ctx_videocore = { gfx_ctx_vc_init, gfx_ctx_vc_destroy, @@ -645,5 +634,5 @@ const gfx_ctx_driver_t gfx_ctx_videocore = { gfx_ctx_vc_image_buffer_write, NULL, "videocore", - gfx_ctx_vc_bind_hw_render, + egl_bind_hw_render, }; diff --git a/gfx/drivers_context/wayland_ctx.c b/gfx/drivers_context/wayland_ctx.c index 9e597016f1..9b43397545 100644 --- a/gfx/drivers_context/wayland_ctx.c +++ b/gfx/drivers_context/wayland_ctx.c @@ -667,17 +667,6 @@ static bool gfx_ctx_wl_bind_api(void *data, return false; } -static void gfx_ctx_wl_bind_hw_render(void *data, bool enable) -{ - g_use_hw_ctx = enable; - - if (!g_egl_dpy || !g_egl_surf) - return; - - eglMakeCurrent(g_egl_dpy, g_egl_surf, g_egl_surf, - enable ? g_egl_hw_ctx : g_egl_ctx); -} - static void keyboard_handle_keymap(void* data, struct wl_keyboard* keyboard, uint32_t format, @@ -847,5 +836,5 @@ const gfx_ctx_driver_t gfx_ctx_wayland = { NULL, NULL, "wayland", - gfx_ctx_wl_bind_hw_render, + egl_bind_hw_render, }; diff --git a/gfx/drivers_context/xegl_ctx.c b/gfx/drivers_context/xegl_ctx.c index e83f911688..2a1eab2236 100644 --- a/gfx/drivers_context/xegl_ctx.c +++ b/gfx/drivers_context/xegl_ctx.c @@ -559,17 +559,6 @@ static void gfx_ctx_xegl_show_mouse(void *data, bool state) x11_show_mouse(g_x11_dpy, g_x11_win, state); } -static void gfx_ctx_xegl_bind_hw_render(void *data, bool enable) -{ - g_use_hw_ctx = enable; - - if (!g_egl_dpy || !g_egl_surf) - return; - - eglMakeCurrent(g_egl_dpy, g_egl_surf, - g_egl_surf, enable ? g_egl_hw_ctx : g_egl_ctx); -} - const gfx_ctx_driver_t gfx_ctx_x_egl = { gfx_ctx_xegl_init, @@ -596,5 +585,5 @@ const gfx_ctx_driver_t gfx_ctx_x_egl = NULL, gfx_ctx_xegl_show_mouse, "x-egl", - gfx_ctx_xegl_bind_hw_render, + egl_bind_hw_render, };