egl: Rename _eglAddDevice() to _eglFindDevice()

_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>
This commit is contained in:
Robert Foss
2023-06-23 17:50:12 +02:00
committed by Marge Bot
parent 7d231f8282
commit 3a9e1014e1
8 changed files with 11 additions and 15 deletions

View 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;

View 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

View 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;

View 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");

View 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;

View 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;

View 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");

View 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,