diff --git a/src/virglrenderer.c b/src/virglrenderer.c index 32f91f1..1447f33 100644 --- a/src/virglrenderer.c +++ b/src/virglrenderer.c @@ -42,7 +42,6 @@ #include "virgl_gbm.h" #include "virgl_egl.h" struct virgl_gbm *gbm = NULL; -struct virgl_egl *egl = NULL; #endif #ifdef HAVE_EPOXY_GLX_H @@ -50,14 +49,6 @@ struct virgl_egl *egl = NULL; static struct virgl_glx *glx_info; #endif -enum { - CONTEXT_NONE, - CONTEXT_EGL, - CONTEXT_GLX -}; - -static int use_context = CONTEXT_NONE; - /* new API - just wrap internal API for now */ int virgl_renderer_resource_create(struct virgl_renderer_resource_create_args *args, struct iovec *iov, uint32_t num_iovs) @@ -207,18 +198,6 @@ int virgl_renderer_resource_get_info(int res_handle, return ret; } -int virgl_has_gl_colorspace(void) -{ - bool egl_colorspace = false; -#ifdef HAVE_EPOXY_EGL_H - if (egl) - egl_colorspace = virgl_has_egl_khr_gl_colorspace(egl); -#endif - return use_context == CONTEXT_NONE || - use_context == CONTEXT_GLX || - (use_context == CONTEXT_EGL && egl_colorspace); -} - void virgl_renderer_get_cap_set(uint32_t cap_set, uint32_t *max_ver, uint32_t *max_size) { diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 21bdb1f..0c6b5ef 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -68,6 +68,8 @@ extern struct virgl_egl *egl; /* debugging via KHR_debug extension */ int vrend_use_debug_cb = 0; +int use_context = CONTEXT_NONE; + static const uint32_t fake_occlusion_query_samples_passed_default = 1024; struct vrend_if_cbs *vrend_clicbs; @@ -9913,6 +9915,23 @@ void vrend_print_context_name(struct vrend_context *ctx) vrend_printf("HOST: "); } +#ifdef HAVE_EPOXY_EGL_H +struct virgl_egl *egl = NULL; +#endif + +int virgl_has_gl_colorspace(void) +{ + bool egl_colorspace = false; +#ifdef HAVE_EPOXY_EGL_H + if (egl) + egl_colorspace = virgl_has_egl_khr_gl_colorspace(egl); +#endif + return use_context == CONTEXT_NONE || + use_context == CONTEXT_GLX || + (use_context == CONTEXT_EGL && egl_colorspace); +} + + void vrend_renderer_destroy_sub_ctx(struct vrend_context *ctx, int sub_ctx_id) { struct vrend_sub_context *sub, *tofree = NULL; diff --git a/src/vrend_renderer.h b/src/vrend_renderer.h index f7c94c8..d73b1ab 100644 --- a/src/vrend_renderer.h +++ b/src/vrend_renderer.h @@ -61,6 +61,18 @@ enum vrend_resource_storage_type { VREND_RESOURCE_STORAGE_GBM_ONLY, }; +enum { + CONTEXT_NONE, + CONTEXT_EGL, + CONTEXT_GLX +}; + +extern int use_context; +#ifdef HAVE_EPOXY_EGL_H +extern struct virgl_egl *egl; +#endif + + struct vrend_resource { struct pipe_resource base; GLuint id;