egl: move dri2_setup_device() after dri2_setup_extensions()
authorSimon Ser <contact@emersion.fr>
Wed, 15 Nov 2023 11:56:35 +0000 (12:56 +0100)
committerEric Engestrom <eric@engestrom.ch>
Sat, 18 Nov 2023 21:20:38 +0000 (21:20 +0000)
dri2_setup_device() will depend on the extensions being set up in
the next commit.

None of the code in-between depends on disp->Device AFAIU.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Tested-by: Iago Toral Quiroga <itoral@igalia.com>
Tested-by: Alejandro PiƱeiro <apinheiro@igalia.com>
Backport-to: 23.3
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26205>
(cherry picked from commit 9b70096f5e9ab7be23abc9154c3fb83b710ccd6b)

.pick_status.json
src/egl/drivers/dri2/platform_android.c
src/egl/drivers/dri2/platform_drm.c
src/egl/drivers/dri2/platform_wayland.c
src/egl/drivers/dri2/platform_x11.c

index ab982d9..9fc1af0 100644 (file)
@@ -94,7 +94,7 @@
         "description": "egl: move dri2_setup_device() after dri2_setup_extensions()",
         "nominated": true,
         "nomination_type": 4,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null,
         "notes": null
index 476f4cc..4fb5621 100644 (file)
@@ -1504,13 +1504,13 @@ dri2_initialize_android(_EGLDisplay *disp)
 
    dri2_dpy->fd_display_gpu = dri2_dpy->fd_render_gpu;
 
-   if (!dri2_setup_device(disp, false)) {
-      err = "DRI2: failed to setup EGLDevice";
+   if (!dri2_setup_extensions(disp)) {
+      err = "DRI2: failed to setup extensions";
       goto cleanup;
    }
 
-   if (!dri2_setup_extensions(disp)) {
-      err = "DRI2: failed to setup extensions";
+   if (!dri2_setup_device(disp, false)) {
+      err = "DRI2: failed to setup EGLDevice";
       goto cleanup;
    }
 
index 2f15ee7..9ae16f3 100644 (file)
@@ -639,11 +639,6 @@ dri2_initialize_drm(_EGLDisplay *disp)
       goto cleanup;
    }
 
-   if (!dri2_setup_device(disp, dri2_dpy->gbm_dri->software)) {
-      err = "DRI2: failed to setup EGLDevice";
-      goto cleanup;
-   }
-
    dri2_dpy->driver_name = strdup(dri2_dpy->gbm_dri->driver_name);
 
    if (!dri2_load_driver_dri3(disp)) {
@@ -677,6 +672,11 @@ dri2_initialize_drm(_EGLDisplay *disp)
       goto cleanup;
    }
 
+   if (!dri2_setup_device(disp, dri2_dpy->gbm_dri->software)) {
+      err = "DRI2: failed to setup EGLDevice";
+      goto cleanup;
+   }
+
    dri2_setup_screen(disp);
 
    if (!drm_add_configs_for_visuals(disp)) {
index ea54c54..b86328f 100644 (file)
@@ -2204,11 +2204,6 @@ dri2_initialize_wayland_drm(_EGLDisplay *disp)
    loader_get_user_preferred_fd(&dri2_dpy->fd_render_gpu,
                                 &dri2_dpy->fd_display_gpu);
 
-   if (!dri2_setup_device(disp, false)) {
-      _eglError(EGL_NOT_INITIALIZED, "DRI2: failed to setup EGLDevice");
-      goto cleanup;
-   }
-
    if (dri2_dpy->fd_render_gpu != dri2_dpy->fd_display_gpu) {
       free(dri2_dpy->device_name);
       dri2_dpy->device_name =
@@ -2245,6 +2240,11 @@ dri2_initialize_wayland_drm(_EGLDisplay *disp)
    if (!dri2_setup_extensions(disp))
       goto cleanup;
 
+   if (!dri2_setup_device(disp, false)) {
+      _eglError(EGL_NOT_INITIALIZED, "DRI2: failed to setup EGLDevice");
+      goto cleanup;
+   }
+
    dri2_setup_screen(disp);
 
    dri2_wl_setup_swap_interval(disp);
@@ -2771,11 +2771,6 @@ dri2_initialize_wayland_swrast(_EGLDisplay *disp)
    if (disp->Options.Zink)
       dri2_initialize_wayland_drm_extensions(dri2_dpy);
 
-   if (!dri2_setup_device(disp, true)) {
-      _eglError(EGL_NOT_INITIALIZED, "DRI2: failed to setup EGLDevice");
-      goto cleanup;
-   }
-
    dri2_dpy->driver_name = strdup(disp->Options.Zink ? "zink" : "swrast");
    if (!dri2_load_driver_swrast(disp))
       goto cleanup;
@@ -2788,6 +2783,11 @@ dri2_initialize_wayland_swrast(_EGLDisplay *disp)
    if (!dri2_setup_extensions(disp))
       goto cleanup;
 
+   if (!dri2_setup_device(disp, true)) {
+      _eglError(EGL_NOT_INITIALIZED, "DRI2: failed to setup EGLDevice");
+      goto cleanup;
+   }
+
    dri2_setup_screen(disp);
 
    dri2_wl_setup_swap_interval(disp);
index c6d88d0..6af987e 100644 (file)
@@ -1512,11 +1512,6 @@ dri2_initialize_x11_swrast(_EGLDisplay *disp)
    if (!dri2_get_xcb_connection(disp, dri2_dpy))
       goto cleanup;
 
-   if (!dri2_setup_device(disp, true)) {
-      _eglError(EGL_NOT_INITIALIZED, "DRI2: failed to setup EGLDevice");
-      goto cleanup;
-   }
-
    /*
     * Every hardware driver_name is set using strdup. Doing the same in
     * here will allow is to simply free the memory at dri2_terminate().
@@ -1536,6 +1531,11 @@ dri2_initialize_x11_swrast(_EGLDisplay *disp)
    if (!dri2_setup_extensions(disp))
       goto cleanup;
 
+   if (!dri2_setup_device(disp, true)) {
+      _eglError(EGL_NOT_INITIALIZED, "DRI2: failed to setup EGLDevice");
+      goto cleanup;
+   }
+
    dri2_setup_screen(disp);
 
    if (disp->Options.Zink) {
@@ -1602,11 +1602,6 @@ dri2_initialize_x11_dri3(_EGLDisplay *disp)
    if (!dri3_x11_connect(dri2_dpy))
       goto cleanup;
 
-   if (!dri2_setup_device(disp, false)) {
-      _eglError(EGL_NOT_INITIALIZED, "DRI2: failed to setup EGLDevice");
-      goto cleanup;
-   }
-
    if (!dri2_load_driver_dri3(disp))
       goto cleanup;
 
@@ -1621,6 +1616,11 @@ dri2_initialize_x11_dri3(_EGLDisplay *disp)
    if (!dri2_setup_extensions(disp))
       goto cleanup;
 
+   if (!dri2_setup_device(disp, false)) {
+      _eglError(EGL_NOT_INITIALIZED, "DRI2: failed to setup EGLDevice");
+      goto cleanup;
+   }
+
    dri2_setup_screen(disp);
 
    dri2_x11_setup_swap_interval(disp);
@@ -1707,11 +1707,6 @@ dri2_initialize_x11_dri2(_EGLDisplay *disp)
    if (!dri2_x11_connect(dri2_dpy))
       goto cleanup;
 
-   if (!dri2_setup_device(disp, false)) {
-      _eglError(EGL_NOT_INITIALIZED, "DRI2: failed to setup EGLDevice");
-      goto cleanup;
-   }
-
    if (!dri2_load_driver(disp))
       goto cleanup;
 
@@ -1729,6 +1724,11 @@ dri2_initialize_x11_dri2(_EGLDisplay *disp)
    if (!dri2_setup_extensions(disp))
       goto cleanup;
 
+   if (!dri2_setup_device(disp, false)) {
+      _eglError(EGL_NOT_INITIALIZED, "DRI2: failed to setup EGLDevice");
+      goto cleanup;
+   }
+
    dri2_setup_screen(disp);
 
    dri2_x11_setup_swap_interval(disp);