Module: Mesa
Branch: main
Commit: 250bdcbfbee2ac086931db89954d9e0c6eacbaee
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=250bdcbfbee2ac086931db89954d9e0c6eacbaee

Author: Jesse Natalie <[email protected]>
Date:   Tue Sep 21 08:45:04 2021 -0700

wgl: Pass smapi explicitly to framebuffer creation

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               | 6 ++++--
 src/gallium/frontends/wgl/stw_context.c     | 2 +-
 src/gallium/frontends/wgl/stw_ext_pbuffer.c | 6 +++---
 src/gallium/frontends/wgl/stw_framebuffer.c | 7 ++++---
 src/gallium/frontends/wgl/stw_framebuffer.h | 6 ++++--
 src/gallium/frontends/wgl/stw_st.c          | 4 ++--
 src/gallium/frontends/wgl/stw_st.h          | 2 +-
 7 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/src/egl/drivers/wgl/egl_wgl.c b/src/egl/drivers/wgl/egl_wgl.c
index 24a3f9be831..36379ecb293 100644
--- a/src/egl/drivers/wgl/egl_wgl.c
+++ b/src/egl/drivers/wgl/egl_wgl.c
@@ -665,6 +665,7 @@ static _EGLSurface*
 wgl_create_window_surface(_EGLDisplay *disp, _EGLConfig *conf,
                           void *native_window, const EGLint *attrib_list)
 {
+   struct wgl_egl_display *wgl_dpy = wgl_egl_display(disp);
    struct wgl_egl_config *wgl_conf = wgl_egl_config(conf);
 
    struct wgl_egl_surface *wgl_surf = calloc(1, sizeof(*wgl_surf));
@@ -678,7 +679,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_surf->fb = stw_framebuffer_create(native_window, 
stw_conf->iPixelFormat, STW_FRAMEBUFFER_EGL_WINDOW, wgl_dpy->smapi);
    if (!wgl_surf->fb) {
       free(wgl_surf);
       return NULL;
@@ -694,6 +695,7 @@ static _EGLSurface*
 wgl_create_pbuffer_surface(_EGLDisplay *disp, _EGLConfig *conf,
                            const EGLint *attrib_list)
 {
+   struct wgl_egl_display *wgl_dpy = wgl_egl_display(disp);
    struct wgl_egl_config *wgl_conf = wgl_egl_config(conf);
 
    struct wgl_egl_surface *wgl_surf = calloc(1, sizeof(*wgl_surf));
@@ -707,7 +709,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_surf->fb = stw_pbuffer_create(stw_conf->iPixelFormat, 
wgl_surf->base.Width, wgl_surf->base.Height, wgl_dpy->smapi);
    if (!wgl_surf->fb) {
       free(wgl_surf);
       return NULL;
diff --git a/src/gallium/frontends/wgl/stw_context.c 
b/src/gallium/frontends/wgl/stw_context.c
index 7ca1029f6c5..a622bf3ad64 100644
--- a/src/gallium/frontends/wgl/stw_context.c
+++ b/src/gallium/frontends/wgl/stw_context.c
@@ -580,7 +580,7 @@ get_unlocked_refd_framebuffer_from_dc(HDC hDC)
        */
       int iPixelFormat = get_matching_pixel_format(hDC);
       if (iPixelFormat)
-         fb = stw_framebuffer_create(WindowFromDC(hDC), iPixelFormat, 
STW_FRAMEBUFFER_WGL_WINDOW);
+         fb = stw_framebuffer_create(WindowFromDC(hDC), iPixelFormat, 
STW_FRAMEBUFFER_WGL_WINDOW, stw_dev->smapi);
       if (!fb)
          return NULL;
    }
diff --git a/src/gallium/frontends/wgl/stw_ext_pbuffer.c 
b/src/gallium/frontends/wgl/stw_ext_pbuffer.c
index 824ce000ce8..f0613913022 100644
--- a/src/gallium/frontends/wgl/stw_ext_pbuffer.c
+++ b/src/gallium/frontends/wgl/stw_ext_pbuffer.c
@@ -66,7 +66,7 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 }
 
 struct stw_framebuffer *
-stw_pbuffer_create(int iPixelFormat, int iWidth, int iHeight)
+stw_pbuffer_create(int iPixelFormat, int iWidth, int iHeight, struct 
st_manager *smapi)
 {
    static boolean first = TRUE;
 
@@ -143,7 +143,7 @@ stw_pbuffer_create(int iPixelFormat, int iWidth, int 
iHeight)
    assert(rect.bottom - rect.top == iHeight);
 #endif
 
-   return stw_framebuffer_create(hWnd, iPixelFormat, STW_FRAMEBUFFER_PBUFFER);
+   return stw_framebuffer_create(hWnd, iPixelFormat, STW_FRAMEBUFFER_PBUFFER, 
smapi);
 }
 
 
@@ -241,7 +241,7 @@ wglCreatePbufferARB(HDC hCurrentDC,
     * We can't pass non-displayable pixel formats to GDI, which is why we
     * create the framebuffer object before calling SetPixelFormat().
     */
-   fb = stw_pbuffer_create(iPixelFormat, iWidth, iHeight);
+   fb = stw_pbuffer_create(iPixelFormat, iWidth, iHeight, stw_dev->smapi);
    if (!fb) {
       SetLastError(ERROR_NO_SYSTEM_RESOURCES);
       return NULL;
diff --git a/src/gallium/frontends/wgl/stw_framebuffer.c 
b/src/gallium/frontends/wgl/stw_framebuffer.c
index 762164b40d0..768f2fa7e1f 100644
--- a/src/gallium/frontends/wgl/stw_framebuffer.c
+++ b/src/gallium/frontends/wgl/stw_framebuffer.c
@@ -269,7 +269,8 @@ stw_call_window_proc(int nCode, WPARAM wParam, LPARAM 
lParam)
  * with its mutex locked.
  */
 struct stw_framebuffer *
-stw_framebuffer_create(HWND hWnd, int iPixelFormat, enum stw_framebuffer_owner 
owner)
+stw_framebuffer_create(HWND hWnd, int iPixelFormat, enum stw_framebuffer_owner 
owner,
+                       struct st_manager *smapi)
 {
    struct stw_framebuffer *fb;
    const struct stw_pixelformat_info *pfi;
@@ -294,7 +295,7 @@ stw_framebuffer_create(HWND hWnd, int iPixelFormat, enum 
stw_framebuffer_owner o
    fb->owner = owner;
 
    fb->pfi = pfi = stw_pixelformat_get_info( iPixelFormat );
-   fb->stfb = stw_st_create_framebuffer( fb );
+   fb->stfb = stw_st_create_framebuffer( fb, smapi );
    if (!fb->stfb) {
       FREE( fb );
       return NULL;
@@ -498,7 +499,7 @@ DrvSetPixelFormat(HDC hdc, LONG iPixelFormat)
       return bPbuffer;
    }
 
-   fb = stw_framebuffer_create(WindowFromDC(hdc), iPixelFormat, 
STW_FRAMEBUFFER_WGL_WINDOW);
+   fb = stw_framebuffer_create(WindowFromDC(hdc), iPixelFormat, 
STW_FRAMEBUFFER_WGL_WINDOW, stw_dev->smapi);
    if (!fb) {
       return FALSE;
    }
diff --git a/src/gallium/frontends/wgl/stw_framebuffer.h 
b/src/gallium/frontends/wgl/stw_framebuffer.h
index 0d120f00b5d..de45f340fee 100644
--- a/src/gallium/frontends/wgl/stw_framebuffer.h
+++ b/src/gallium/frontends/wgl/stw_framebuffer.h
@@ -40,6 +40,7 @@
 struct pipe_resource;
 struct st_framebuffer_iface;
 struct stw_pixelformat_info;
+struct st_manager;
 
 enum stw_framebuffer_owner
 {
@@ -153,10 +154,11 @@ struct stw_framebuffer
  * must be called when done 
  */
 struct stw_framebuffer *
-stw_framebuffer_create(HWND hwnd, int iPixelFormat, enum stw_framebuffer_owner 
owner);
+stw_framebuffer_create(HWND hwnd, int iPixelFormat, enum stw_framebuffer_owner 
owner,
+                       struct st_manager *smapi);
 
 struct stw_framebuffer *
-stw_pbuffer_create(int iPixelFormat, int iWidth, int iHeight);
+stw_pbuffer_create(int iPixelFormat, int iWidth, int iHeight, struct 
st_manager *smapi);
 
 
 /**
diff --git a/src/gallium/frontends/wgl/stw_st.c 
b/src/gallium/frontends/wgl/stw_st.c
index 7050a4e24b9..bd510a8f7ac 100644
--- a/src/gallium/frontends/wgl/stw_st.c
+++ b/src/gallium/frontends/wgl/stw_st.c
@@ -494,7 +494,7 @@ stw_st_framebuffer_flush_front(struct st_context_iface 
*stctx,
  * Create a framebuffer interface.
  */
 struct st_framebuffer_iface *
-stw_st_create_framebuffer(struct stw_framebuffer *fb)
+stw_st_create_framebuffer(struct stw_framebuffer *fb, struct st_manager *smapi)
 {
    struct stw_st_framebuffer *stwfb;
 
@@ -505,7 +505,7 @@ stw_st_create_framebuffer(struct stw_framebuffer *fb)
    stwfb->fb = fb;
    stwfb->stvis = fb->pfi->stvis;
    stwfb->base.ID = p_atomic_inc_return(&stwfb_ID);
-   stwfb->base.state_manager = stw_dev->smapi;
+   stwfb->base.state_manager = smapi;
 
    stwfb->base.visual = &stwfb->stvis;
    p_atomic_set(&stwfb->base.stamp, 1);
diff --git a/src/gallium/frontends/wgl/stw_st.h 
b/src/gallium/frontends/wgl/stw_st.h
index c4d735663e6..7a2b72ed8e2 100644
--- a/src/gallium/frontends/wgl/stw_st.h
+++ b/src/gallium/frontends/wgl/stw_st.h
@@ -41,7 +41,7 @@ struct st_api *
 stw_st_create_api(void);
 
 struct st_framebuffer_iface *
-stw_st_create_framebuffer(struct stw_framebuffer *fb);
+stw_st_create_framebuffer(struct stw_framebuffer *fb, struct st_manager 
*smapi);
 
 void
 stw_st_destroy_framebuffer_locked(struct st_framebuffer_iface *stfb);

Reply via email to