egl: Rename _eglAddDevice() to _eglFindDevice()
authorRobert Foss <rfoss@kernel.org>
Fri, 23 Jun 2023 15:50:12 +0000 (17:50 +0200)
committerMarge Bot <emma+marge@anholt.net>
Mon, 17 Jul 2023 22:27:01 +0000 (22:27 +0000)
_eglAddDevice() is now only used to look up eglDevices,
which means that the function name is a bit misleading.

Since this function is only used for finding the
eglDevice, it should also no longer support adding
a device to the egl devices list.

Signed-off-by: Robert Foss <rfoss@kernel.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23742>

src/egl/drivers/dri2/platform_android.c
src/egl/drivers/dri2/platform_device.c
src/egl/drivers/dri2/platform_drm.c
src/egl/drivers/dri2/platform_surfaceless.c
src/egl/drivers/dri2/platform_wayland.c
src/egl/drivers/dri2/platform_x11.c
src/egl/main/egldevice.c
src/egl/main/egldevice.h

index 757d028..c1a2223 100644 (file)
@@ -1716,7 +1716,7 @@ dri2_initialize_android(_EGLDisplay *disp)
 
    dri2_dpy->fd_display_gpu = dri2_dpy->fd_render_gpu;
 
-   dev = _eglAddDevice(dri2_dpy->fd_render_gpu, false);
+   dev = _eglFindDevice(dri2_dpy->fd_render_gpu, false);
    if (!dev) {
       err = "DRI2: failed to find EGLDevice";
       goto cleanup;
index 15f82a5..cd5f13c 100644 (file)
@@ -242,7 +242,7 @@ device_get_fd(_EGLDisplay *disp, _EGLDevice *dev)
        *
        * Add a trivial sanity check since it doesn't cost us anything.
        */
-      if (dev != _eglAddDevice(fd, false))
+      if (dev != _eglFindDevice(fd, false))
          return -1;
 
       /* kms_swrast only work with primary node. It used to work with render
index 9b58ed9..b792eb8 100644 (file)
@@ -698,7 +698,7 @@ dri2_initialize_drm(_EGLDisplay *disp)
       goto cleanup;
    }
 
-   dev = _eglAddDevice(dri2_dpy->fd_render_gpu, dri2_dpy->gbm_dri->software);
+   dev = _eglFindDevice(dri2_dpy->fd_render_gpu, dri2_dpy->gbm_dri->software);
    if (!dev) {
       err = "DRI2: failed to find EGLDevice";
       goto cleanup;
index aa3d9cc..0321025 100644 (file)
@@ -288,7 +288,7 @@ surfaceless_probe_device_sw(_EGLDisplay *disp)
    struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
 
    dri2_dpy->fd_render_gpu = -1;
-   disp->Device = _eglAddDevice(dri2_dpy->fd_render_gpu, true);
+   disp->Device = _eglFindDevice(dri2_dpy->fd_render_gpu, true);
    assert(disp->Device);
 
    dri2_dpy->driver_name = strdup(disp->Options.Zink ? "zink" : "swrast");
index eef6259..5644099 100644 (file)
@@ -2252,7 +2252,7 @@ dri2_initialize_wayland_drm(_EGLDisplay *disp)
    loader_get_user_preferred_fd(&dri2_dpy->fd_render_gpu,
                                 &dri2_dpy->fd_display_gpu);
 
-   dev = _eglAddDevice(dri2_dpy->fd_render_gpu, false);
+   dev = _eglFindDevice(dri2_dpy->fd_render_gpu, false);
    if (!dev) {
       _eglError(EGL_NOT_INITIALIZED, "DRI2: failed to find EGLDevice");
       goto cleanup;
@@ -2796,7 +2796,7 @@ dri2_initialize_wayland_swrast(_EGLDisplay *disp)
       dri2_dpy->wl_dpy = disp->PlatformDisplay;
    }
 
-   dev = _eglAddDevice(dri2_dpy->fd_render_gpu, true);
+   dev = _eglFindDevice(dri2_dpy->fd_render_gpu, true);
    if (!dev) {
       _eglError(EGL_NOT_INITIALIZED, "DRI2: failed to find EGLDevice");
       goto cleanup;
index 10a0038..50e1333 100644 (file)
@@ -1517,7 +1517,7 @@ dri2_initialize_x11_swrast(_EGLDisplay *disp)
    if (!dri2_get_xcb_connection(disp, dri2_dpy))
       goto cleanup;
 
-   dev = _eglAddDevice(dri2_dpy->fd_render_gpu, true);
+   dev = _eglFindDevice(dri2_dpy->fd_render_gpu, true);
    if (!dev) {
       _eglError(EGL_NOT_INITIALIZED, "DRI2: failed to find EGLDevice");
       goto cleanup;
@@ -1610,7 +1610,7 @@ dri2_initialize_x11_dri3(_EGLDisplay *disp)
    if (!dri3_x11_connect(dri2_dpy))
       goto cleanup;
 
-   dev = _eglAddDevice(dri2_dpy->fd_render_gpu, false);
+   dev = _eglFindDevice(dri2_dpy->fd_render_gpu, false);
    if (!dev) {
       _eglError(EGL_NOT_INITIALIZED, "DRI2: failed to find EGLDevice");
       goto cleanup;
@@ -1723,7 +1723,7 @@ dri2_initialize_x11_dri2(_EGLDisplay *disp)
    if (!dri2_x11_connect(dri2_dpy))
       goto cleanup;
 
-   dev = _eglAddDevice(dri2_dpy->fd_render_gpu, false);
+   dev = _eglFindDevice(dri2_dpy->fd_render_gpu, false);
    if (!dev) {
       _eglError(EGL_NOT_INITIALIZED, "DRI2: failed to find EGLDevice");
       goto cleanup;
index 24020b3..a76d8e8 100644 (file)
@@ -163,7 +163,7 @@ _eglAddDRMDevice(drmDevicePtr device, _EGLDevice **out_dev)
  * If a software device, the fd is ignored.
  */
 _EGLDevice *
-_eglAddDevice(int fd, bool software)
+_eglFindDevice(int fd, bool software)
 {
    _EGLDevice *dev;
 
@@ -183,10 +183,6 @@ _eglAddDevice(int fd, bool software)
       dev = NULL;
       goto out;
    }
-
-   /* Device is not added - error or already present */
-   if (_eglAddDRMDevice(device, &dev) != 0)
-      drmFreeDevice(&device);
 #else
    _eglLog(_EGL_FATAL,
            "Driver bug: Built without libdrm, yet looking for HW device");
index 6b52863..6e0d069 100644 (file)
@@ -58,7 +58,7 @@ _eglLookupDevice(EGLDeviceEXT device)
 }
 
 _EGLDevice *
-_eglAddDevice(int fd, bool software);
+_eglFindDevice(int fd, bool software);
 
 enum _egl_device_extension {
    _EGL_DEVICE_SOFTWARE,