Module: Mesa Branch: main Commit: c512b68816bfe525828f65035b4ff6053f3df373 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c512b68816bfe525828f65035b4ff6053f3df373
Author: Jesse Natalie <[email protected]> Date: Tue Sep 21 09:00:29 2021 -0700 egl/wgl: Use a per-display st_manager Acked-by: Daniel Stone <[email protected]> Acked-by: Mike Blumenkrantz <[email protected]> Acked-by: Sidney Just <[email protected]> Acked-by: Jason Ekstrand <[email protected]> Tested-by: Yonggang Luo <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12964> --- src/egl/drivers/wgl/egl_wgl.c | 23 ++++++++++++++++++----- src/egl/drivers/wgl/egl_wgl.h | 3 ++- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/egl/drivers/wgl/egl_wgl.c b/src/egl/drivers/wgl/egl_wgl.c index 36379ecb293..e04b037bf84 100644 --- a/src/egl/drivers/wgl/egl_wgl.c +++ b/src/egl/drivers/wgl/egl_wgl.c @@ -198,7 +198,17 @@ wgl_add_configs(_EGLDisplay *disp) static void wgl_display_destroy(_EGLDisplay *disp) { - free(disp); + struct wgl_egl_display *wgl_dpy = wgl_egl_display(disp); + if (wgl_dpy->base.destroy) + wgl_dpy->base.destroy(&wgl_dpy->base); + free(wgl_dpy); +} + +static int +wgl_egl_st_get_param(struct st_manager *smapi, enum st_manager_param param) +{ + /* no-op */ + return 0; } static EGLBoolean @@ -212,6 +222,7 @@ wgl_initialize_impl(_EGLDisplay *disp, HDC hdc) return _eglError(EGL_BAD_ALLOC, "eglInitialize"); disp->DriverData = (void *)wgl_dpy; + wgl_dpy->parent = disp; if (!stw_init_screen(hdc)) { err = "wgl: failed to initialize screen"; @@ -220,7 +231,9 @@ wgl_initialize_impl(_EGLDisplay *disp, HDC hdc) struct stw_device *stw_dev = stw_get_device(); wgl_dpy->screen = stw_dev->screen; - wgl_dpy->smapi = stw_dev->smapi; + + wgl_dpy->base.screen = stw_dev->screen; + wgl_dpy->base.get_param = wgl_egl_st_get_param; disp->ClientAPIs = 0; if (_eglIsApiValid(EGL_OPENGL_API)) @@ -445,7 +458,7 @@ wgl_create_context(_EGLDisplay *disp, _EGLConfig *conf, if (wgl_ctx->base.ResetNotificationStrategy != EGL_NO_RESET_NOTIFICATION) resetStrategy = WGL_LOSE_CONTEXT_ON_RESET_ARB; wgl_ctx->ctx = stw_create_context_attribs(disp->PlatformDisplay, 0, shared, - wgl_dpy->smapi, + &wgl_dpy->base, wgl_ctx->base.ClientMajorVersion, wgl_ctx->base.ClientMinorVersion, flags, @@ -679,7 +692,7 @@ wgl_create_window_surface(_EGLDisplay *disp, _EGLConfig *conf, const struct stw_pixelformat_info *stw_conf = wgl_conf->stw_config[1] ? wgl_conf->stw_config[1] : wgl_conf->stw_config[0]; - wgl_surf->fb = stw_framebuffer_create(native_window, stw_conf->iPixelFormat, STW_FRAMEBUFFER_EGL_WINDOW, wgl_dpy->smapi); + wgl_surf->fb = stw_framebuffer_create(native_window, stw_conf->iPixelFormat, STW_FRAMEBUFFER_EGL_WINDOW, &wgl_dpy->base); if (!wgl_surf->fb) { free(wgl_surf); return NULL; @@ -709,7 +722,7 @@ wgl_create_pbuffer_surface(_EGLDisplay *disp, _EGLConfig *conf, const struct stw_pixelformat_info *stw_conf = wgl_conf->stw_config[1] ? wgl_conf->stw_config[1] : wgl_conf->stw_config[0]; - wgl_surf->fb = stw_pbuffer_create(stw_conf->iPixelFormat, wgl_surf->base.Width, wgl_surf->base.Height, wgl_dpy->smapi); + wgl_surf->fb = stw_pbuffer_create(stw_conf->iPixelFormat, wgl_surf->base.Width, wgl_surf->base.Height, &wgl_dpy->base); if (!wgl_surf->fb) { free(wgl_surf); return NULL; diff --git a/src/egl/drivers/wgl/egl_wgl.h b/src/egl/drivers/wgl/egl_wgl.h index 8c572b61353..b609fd95395 100644 --- a/src/egl/drivers/wgl/egl_wgl.h +++ b/src/egl/drivers/wgl/egl_wgl.h @@ -33,9 +33,10 @@ struct wgl_egl_display { + struct st_manager base; + _EGLDisplay *parent; int ref_count; struct pipe_screen *screen; - struct st_manager *smapi; }; struct wgl_egl_config
