Move g_use_hw_ctx to egl_common.c
This commit is contained in:
parent
9705dc8d04
commit
6dee1fcc92
|
@ -26,6 +26,7 @@ EGLContext g_egl_hw_ctx;
|
|||
EGLSurface g_egl_surf;
|
||||
EGLDisplay g_egl_dpy;
|
||||
EGLConfig g_egl_config;
|
||||
bool g_use_hw_ctx;
|
||||
|
||||
void egl_report_error(void)
|
||||
{
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
#include "../video_context_driver.h"
|
||||
|
||||
extern EGLContext g_egl_ctx;
|
||||
|
@ -26,6 +28,7 @@ extern EGLContext g_egl_hw_ctx;
|
|||
extern EGLSurface g_egl_surf;
|
||||
extern EGLDisplay g_egl_dpy;
|
||||
extern EGLConfig g_egl_config;
|
||||
extern bool g_use_hw_ctx;
|
||||
|
||||
void egl_report_error(void);
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ int system_property_get(const char *cmd, const char *args, char *value);
|
|||
|
||||
typedef struct gfx_ctx_android_data
|
||||
{
|
||||
bool g_use_hw_ctx;
|
||||
void *empty;
|
||||
} gfx_ctx_android_data_t;
|
||||
|
||||
static bool g_es3;
|
||||
|
@ -158,7 +158,7 @@ static bool android_gfx_ctx_init(void *data)
|
|||
if (g_egl_ctx == EGL_NO_CONTEXT)
|
||||
goto error;
|
||||
|
||||
if (android->g_use_hw_ctx)
|
||||
if (g_use_hw_ctx)
|
||||
{
|
||||
g_egl_hw_ctx = eglCreateContext(g_egl_dpy,
|
||||
g_egl_config, g_egl_ctx,
|
||||
|
@ -308,17 +308,7 @@ static bool android_gfx_ctx_has_windowed(void *data)
|
|||
|
||||
static void android_gfx_ctx_bind_hw_render(void *data, bool enable)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
gfx_ctx_android_data_t *android = NULL;
|
||||
|
||||
android = (gfx_ctx_android_data_t*)driver->video_context_data;
|
||||
|
||||
(void)data;
|
||||
|
||||
if (!android)
|
||||
return;
|
||||
|
||||
android->g_use_hw_ctx = enable;
|
||||
g_use_hw_ctx = enable;
|
||||
|
||||
if (!g_egl_dpy)
|
||||
return;
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
|
||||
#define WINDOW_BUFFERS 2
|
||||
|
||||
static bool g_use_hw_ctx;
|
||||
static bool g_resize;
|
||||
|
||||
screen_context_t screen_ctx;
|
||||
|
@ -387,13 +386,9 @@ static bool gfx_ctx_qnx_has_windowed(void *data)
|
|||
|
||||
static void gfx_qnx_ctx_bind_hw_render(void *data, bool enable)
|
||||
{
|
||||
(void)data;
|
||||
|
||||
g_use_hw_ctx = enable;
|
||||
|
||||
if (!g_egl_dpy)
|
||||
return;
|
||||
if (!g_egl_surf)
|
||||
if (!g_egl_dpy || !g_egl_surf)
|
||||
return;
|
||||
|
||||
eglMakeCurrent(g_egl_dpy, g_egl_surf,
|
||||
|
|
|
@ -54,7 +54,6 @@
|
|||
|
||||
typedef struct gfx_ctx_drm_egl_data
|
||||
{
|
||||
bool g_use_hw_ctx;
|
||||
RFILE *g_drm;
|
||||
int g_drm_fd;
|
||||
uint32_t g_crtc_id;
|
||||
|
@ -783,7 +782,7 @@ static bool gfx_ctx_drm_egl_set_video_mode(void *data,
|
|||
if (g_egl_ctx == EGL_NO_CONTEXT)
|
||||
goto error;
|
||||
|
||||
if (drm->g_use_hw_ctx)
|
||||
if (g_use_hw_ctx)
|
||||
{
|
||||
g_egl_hw_ctx = eglCreateContext(g_egl_dpy, g_egl_config, g_egl_ctx,
|
||||
attr != egl_attribs ? egl_attribs : NULL);
|
||||
|
@ -910,20 +909,9 @@ static bool gfx_ctx_drm_egl_bind_api(void *data,
|
|||
|
||||
static void gfx_ctx_drm_egl_bind_hw_render(void *data, bool enable)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
gfx_ctx_drm_egl_data_t *drm = (gfx_ctx_drm_egl_data_t*)
|
||||
driver->video_context_data;
|
||||
g_use_hw_ctx = enable;
|
||||
|
||||
if (!drm)
|
||||
return;
|
||||
|
||||
(void)data;
|
||||
|
||||
drm->g_use_hw_ctx = enable;
|
||||
|
||||
if (!g_egl_dpy)
|
||||
return;
|
||||
if (!g_egl_surf)
|
||||
if (!g_egl_dpy || !g_egl_surf)
|
||||
return;
|
||||
|
||||
eglMakeCurrent(g_egl_dpy, g_egl_surf,
|
||||
|
|
|
@ -38,8 +38,6 @@
|
|||
#include "../../config.h"
|
||||
#endif
|
||||
|
||||
static bool g_use_hw_ctx;
|
||||
|
||||
static volatile sig_atomic_t g_quit;
|
||||
static bool g_inited;
|
||||
static unsigned g_interval;
|
||||
|
@ -613,13 +611,9 @@ static bool gfx_ctx_vc_image_buffer_write(void *data, const void *frame, unsigne
|
|||
|
||||
static void gfx_ctx_vc_bind_hw_render(void *data, bool enable)
|
||||
{
|
||||
(void)data;
|
||||
|
||||
g_use_hw_ctx = enable;
|
||||
|
||||
if (!g_egl_dpy)
|
||||
return;
|
||||
if (!g_egl_surf)
|
||||
if (!g_egl_dpy || !g_egl_surf)
|
||||
return;
|
||||
|
||||
eglMakeCurrent(g_egl_dpy, g_egl_surf,
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
typedef struct gfx_ctx_wayland_data
|
||||
{
|
||||
bool g_resize;
|
||||
bool g_use_hw_ctx;
|
||||
int g_fd;
|
||||
unsigned g_width;
|
||||
unsigned g_height;
|
||||
|
@ -571,7 +570,7 @@ static bool gfx_ctx_wl_set_video_mode(void *data,
|
|||
if (g_egl_ctx == EGL_NO_CONTEXT)
|
||||
goto error;
|
||||
|
||||
if (wl->g_use_hw_ctx)
|
||||
if (g_use_hw_ctx)
|
||||
{
|
||||
g_egl_hw_ctx = eglCreateContext(g_egl_dpy, g_egl_config, g_egl_ctx,
|
||||
attr != egl_attribs ? egl_attribs : NULL);
|
||||
|
@ -670,13 +669,7 @@ static bool gfx_ctx_wl_bind_api(void *data,
|
|||
|
||||
static void gfx_ctx_wl_bind_hw_render(void *data, bool enable)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)
|
||||
driver->video_context_data;
|
||||
|
||||
(void)data;
|
||||
|
||||
wl->g_use_hw_ctx = enable;
|
||||
g_use_hw_ctx = enable;
|
||||
|
||||
if (!g_egl_dpy || !g_egl_surf)
|
||||
return;
|
||||
|
|
|
@ -30,8 +30,6 @@
|
|||
|
||||
static unsigned g_screen;
|
||||
|
||||
static bool g_use_hw_ctx;
|
||||
|
||||
static XF86VidModeModeInfo g_desktop_mode;
|
||||
static bool g_should_reset_mode;
|
||||
|
||||
|
@ -563,12 +561,9 @@ static void gfx_ctx_xegl_show_mouse(void *data, bool state)
|
|||
|
||||
static void gfx_ctx_xegl_bind_hw_render(void *data, bool enable)
|
||||
{
|
||||
(void)data;
|
||||
g_use_hw_ctx = enable;
|
||||
|
||||
if (!g_egl_dpy)
|
||||
return;
|
||||
if (!g_egl_surf)
|
||||
if (!g_egl_dpy || !g_egl_surf)
|
||||
return;
|
||||
|
||||
eglMakeCurrent(g_egl_dpy, g_egl_surf,
|
||||
|
|
Loading…
Reference in New Issue