loader,glx,egl/x11: init dri_screen_display_gpu in struct loader_dri3_drawable
authorYogesh Mohanmarimuthu <yogesh.mohanmarimuthu@amd.com>
Mon, 18 Oct 2021 16:14:25 +0000 (21:44 +0530)
committerMarge Bot <emma+marge@anholt.net>
Tue, 24 Jan 2023 12:51:35 +0000 (12:51 +0000)
Initialize dri_screendisplay_gpu variable in struct laoder_dri3_drawable.
Also make dri_screen_display_gpu variable as input parameter to function
loader_dri3_drawable_init() since dri_screen variable is initialized this way.
This also helps to avoid duplicate initializing dri_screen_display_gpu
in glx and egl code.

Signed-off-by: Yogesh Mohanmarimuthu <yogesh.mohanmarimuthu@amd.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13422>

src/egl/drivers/dri2/platform_x11_dri3.c
src/glx/dri3_glx.c
src/loader/loader_dri3_helper.c
src/loader/loader_dri3_helper.h

index 243e2d3..04d0fe8 100644 (file)
@@ -189,6 +189,7 @@ dri3_create_surface(_EGLDisplay *disp, EGLint type, _EGLConfig *conf,
    if (loader_dri3_drawable_init(dri2_dpy->conn, drawable,
                                  egl_to_loader_dri3_drawable_type(type),
                                  dri2_dpy->dri_screen,
+                                 dri2_dpy->dri_screen_display_gpu,
                                  dri2_dpy->is_different_gpu,
                                  dri2_dpy->multibuffers_available,
                                  true,
index 613c620..b3c82dc 100644 (file)
@@ -364,7 +364,7 @@ dri3_create_drawable(struct glx_screen *base, XID xDrawable,
    if (loader_dri3_drawable_init(XGetXCBConnection(base->dpy),
                                  xDrawable,
                                  glx_to_loader_dri3_drawable_type(type),
-                                 psc->driScreen,
+                                 psc->driScreen, psc->driScreenDisplayGPU,
                                  psc->is_different_gpu, has_multibuffer,
                                  psc->prefer_back_buffer_reuse,
                                  config->driConfig,
@@ -374,7 +374,6 @@ dri3_create_drawable(struct glx_screen *base, XID xDrawable,
       return NULL;
    }
 
-   pdraw->loader_drawable.dri_screen_display_gpu = psc->driScreenDisplayGPU;
    return &pdraw->base;
 }
 
index 5c724c1..0cc73f7 100644 (file)
@@ -378,6 +378,7 @@ loader_dri3_drawable_init(xcb_connection_t *conn,
                           xcb_drawable_t drawable,
                           enum loader_dri3_drawable_type type,
                           __DRIscreen *dri_screen,
+                          __DRIscreen *dri_screen_display_gpu,
                           bool is_different_gpu,
                           bool multiplanes_available,
                           bool prefer_back_buffer_reuse,
@@ -397,6 +398,7 @@ loader_dri3_drawable_init(xcb_connection_t *conn,
    draw->type = type;
    draw->region = 0;
    draw->dri_screen = dri_screen;
+   draw->dri_screen_display_gpu = dri_screen_display_gpu;
    draw->is_different_gpu = is_different_gpu;
    draw->multiplanes_available = multiplanes_available;
    draw->prefer_back_buffer_reuse = prefer_back_buffer_reuse;
index 5eb9c90..8fe6c73 100644 (file)
@@ -208,6 +208,7 @@ loader_dri3_drawable_init(xcb_connection_t *conn,
                           xcb_drawable_t drawable,
                           enum loader_dri3_drawable_type type,
                           __DRIscreen *dri_screen,
+                          __DRIscreen *dri_screen_display_gpu,
                           bool is_different_gpu,
                           bool is_multiplanes_available,
                           bool prefer_back_buffer_reuse,