wgl: Pass smapi explicitly to framebuffer creation

Acked-by: Daniel Stone <daniels@collabora.com>
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Acked-by: Sidney Just <justsid@x-plane.com>
Acked-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Tested-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12964>
This commit is contained in:
Jesse Natalie
2021-09-21 08:45:04 -07:00
committed by Marge Bot
parent f5b1824ce3
commit 250bdcbfbe
7 changed files with 19 additions and 14 deletions
+4 -2
View File
@@ -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;
+1 -1
View File
@@ -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;
}
+3 -3
View File
@@ -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;
+4 -3
View File
@@ -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;
}
+4 -2
View File
@@ -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);
/**
+2 -2
View File
@@ -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);
+1 -1
View File
@@ -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);