vrend: add vrend_winsys_cleanup

Move winsys cleanup code to the new function.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
macos/master
Chia-I Wu 5 years ago
parent 163f4f120a
commit 1991666171
  1. 20
      src/virglrenderer.c
  2. 22
      src/vrend_winsys.c
  3. 2
      src/vrend_winsys.h

@ -437,25 +437,7 @@ void virgl_renderer_cleanup(UNUSED void *cookie)
{ {
vrend_renderer_fini(); vrend_renderer_fini();
virgl_context_table_cleanup(); virgl_context_table_cleanup();
vrend_winsys_cleanup();
#ifdef HAVE_EPOXY_EGL_H
if (use_context == CONTEXT_EGL) {
virgl_egl_destroy(egl);
egl = NULL;
use_context = CONTEXT_NONE;
if (gbm) {
virgl_gbm_fini(gbm);
gbm = NULL;
}
}
#endif
#ifdef HAVE_EPOXY_GLX_H
if (use_context == CONTEXT_GLX) {
virgl_glx_destroy(glx_info);
glx_info = NULL;
use_context = CONTEXT_NONE;
}
#endif
} }
int virgl_renderer_init(void *cookie, int flags, struct virgl_renderer_callbacks *cbs) int virgl_renderer_init(void *cookie, int flags, struct virgl_renderer_callbacks *cbs)

@ -37,6 +37,28 @@ struct virgl_gbm *gbm = NULL;
struct virgl_glx *glx_info = NULL; struct virgl_glx *glx_info = NULL;
#endif #endif
void vrend_winsys_cleanup(void)
{
#ifdef HAVE_EPOXY_EGL_H
if (use_context == CONTEXT_EGL) {
virgl_egl_destroy(egl);
egl = NULL;
use_context = CONTEXT_NONE;
if (gbm) {
virgl_gbm_fini(gbm);
gbm = NULL;
}
}
#endif
#ifdef HAVE_EPOXY_GLX_H
if (use_context == CONTEXT_GLX) {
virgl_glx_destroy(glx_info);
glx_info = NULL;
use_context = CONTEXT_NONE;
}
#endif
}
virgl_renderer_gl_context vrend_winsys_create_context(struct virgl_gl_ctx_param *param) virgl_renderer_gl_context vrend_winsys_create_context(struct virgl_gl_ctx_param *param)
{ {
#ifdef HAVE_EPOXY_EGL_H #ifdef HAVE_EPOXY_EGL_H

@ -57,6 +57,8 @@ extern struct virgl_gbm *gbm;
extern struct virgl_glx *glx_info; extern struct virgl_glx *glx_info;
#endif #endif
void vrend_winsys_cleanup(void);
virgl_renderer_gl_context vrend_winsys_create_context(struct virgl_gl_ctx_param *param); virgl_renderer_gl_context vrend_winsys_create_context(struct virgl_gl_ctx_param *param);
void vrend_winsys_destroy_context(virgl_renderer_gl_context ctx); void vrend_winsys_destroy_context(virgl_renderer_gl_context ctx);
int vrend_winsys_make_context_current(virgl_renderer_gl_context ctx); int vrend_winsys_make_context_current(virgl_renderer_gl_context ctx);

Loading…
Cancel
Save