From c839203c8c5d6bb4088c162010faeef418b23dcd Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Fri, 2 May 2025 15:24:27 +0200 Subject: [PATCH] xwayland: call miCreateScreenResources() directly No need for complicated wrapping/unwrapping: it's always just miCreateResources() anyway - so we can call it directly. Signed-off-by: Enrico Weigelt, metux IT consult --- hw/xwayland/xwayland-glamor.c | 13 ++++--------- hw/xwayland/xwayland-screen.c | 1 - hw/xwayland/xwayland-screen.h | 1 - hw/xwayland/xwayland-shm.c | 11 +++-------- 4 files changed, 7 insertions(+), 19 deletions(-) diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c index 881776a94..a20aa78cf 100644 --- a/hw/xwayland/xwayland-glamor.c +++ b/hw/xwayland/xwayland-glamor.c @@ -42,6 +42,8 @@ #include "linux-dmabuf-unstable-v1-client-protocol.h" #include "linux-drm-syncobj-v1-client-protocol.h" +#include "mi/mi_priv.h" + #include "xwayland-dmabuf.h" #include "xwayland-glamor.h" #include "xwayland-glamor-gbm.h" @@ -143,15 +145,9 @@ static Bool xwl_glamor_create_screen_resources(ScreenPtr screen) { struct xwl_screen *xwl_screen = xwl_screen_get(screen); - int ret; - screen->CreateScreenResources = xwl_screen->CreateScreenResources; - ret = (*screen->CreateScreenResources) (screen); - xwl_screen->CreateScreenResources = screen->CreateScreenResources; - screen->CreateScreenResources = xwl_glamor_create_screen_resources; - - if (!ret) - return ret; + if (!miCreateScreenResources(screen)) + return FALSE; if (xwl_screen->rootless) { screen->devPrivate = @@ -256,7 +252,6 @@ xwl_glamor_init(struct xwl_screen *xwl_screen) return FALSE; } - xwl_screen->CreateScreenResources = screen->CreateScreenResources; screen->CreateScreenResources = xwl_glamor_create_screen_resources; #ifdef XV diff --git a/hw/xwayland/xwayland-screen.c b/hw/xwayland/xwayland-screen.c index 449674444..6acb49599 100644 --- a/hw/xwayland/xwayland-screen.c +++ b/hw/xwayland/xwayland-screen.c @@ -1125,7 +1125,6 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv) xwl_screen->present = xwl_present_init(pScreen); if (!xwl_screen->glamor) { - xwl_screen->CreateScreenResources = pScreen->CreateScreenResources; pScreen->CreateScreenResources = xwl_shm_create_screen_resources; pScreen->CreatePixmap = xwl_shm_create_pixmap; pScreen->DestroyPixmap = xwl_shm_destroy_pixmap; diff --git a/hw/xwayland/xwayland-screen.h b/hw/xwayland/xwayland-screen.h index 49a167a12..7db6d3c87 100644 --- a/hw/xwayland/xwayland-screen.h +++ b/hw/xwayland/xwayland-screen.h @@ -69,7 +69,6 @@ struct xwl_screen { int hidpi; ClipNotifyProcPtr ClipNotify; - CreateScreenResourcesProcPtr CreateScreenResources; CloseScreenProcPtr CloseScreen; ConfigNotifyProcPtr ConfigNotify; RealizeWindowProcPtr RealizeWindow; diff --git a/hw/xwayland/xwayland-shm.c b/hw/xwayland/xwayland-shm.c index faca5224e..09844ee04 100644 --- a/hw/xwayland/xwayland-shm.c +++ b/hw/xwayland/xwayland-shm.c @@ -36,6 +36,7 @@ #include #include +#include "mi/mi_priv.h" #include "os/osdep.h" #include "fb.h" @@ -351,15 +352,9 @@ Bool xwl_shm_create_screen_resources(ScreenPtr screen) { struct xwl_screen *xwl_screen = xwl_screen_get(screen); - int ret; - screen->CreateScreenResources = xwl_screen->CreateScreenResources; - ret = (*screen->CreateScreenResources) (screen); - xwl_screen->CreateScreenResources = screen->CreateScreenResources; - screen->CreateScreenResources = xwl_shm_create_screen_resources; - - if (!ret) - return ret; + if (!miCreateScreenResources(screen)) + return FALSE; if (xwl_screen->rootless) screen->devPrivate =