revert part of 94e470a32d
accidentally added during rebase Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30949>
This commit is contained in:

committed by
Marge Bot

parent
9d981a4c5b
commit
ecb788624b
@@ -2208,137 +2208,6 @@ dri2_initialize_wayland_drm_extensions(struct dri2_egl_display *dri2_dpy)
|
||||
return true;
|
||||
}
|
||||
|
||||
static EGLBoolean
|
||||
platform_wayland_finalize(_EGLDisplay *disp)
|
||||
{
|
||||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
|
||||
|
||||
if (dri2_wl_formats_init(&dri2_dpy->formats) < 0)
|
||||
return EGL_FALSE;
|
||||
|
||||
if (disp->PlatformDisplay == NULL) {
|
||||
dri2_dpy->wl_dpy = wl_display_connect(NULL);
|
||||
if (dri2_dpy->wl_dpy == NULL)
|
||||
goto cleanup;
|
||||
dri2_dpy->own_device = true;
|
||||
} else {
|
||||
dri2_dpy->wl_dpy = disp->PlatformDisplay;
|
||||
}
|
||||
|
||||
const char *queue_str;
|
||||
if (dri2_dpy->kopper)
|
||||
queue_str = "mesa egl kopper display queue";
|
||||
else if (disp->Options.ForceSoftware)
|
||||
queue_str = "mesa egl swrast display queue";
|
||||
else
|
||||
queue_str = "mesa egl display queue";
|
||||
|
||||
dri2_dpy->wl_queue = wl_display_create_queue_with_name(dri2_dpy->wl_dpy, queue_str);
|
||||
|
||||
dri2_dpy->wl_dpy_wrapper = wl_proxy_create_wrapper(dri2_dpy->wl_dpy);
|
||||
if (dri2_dpy->wl_dpy_wrapper == NULL)
|
||||
goto cleanup;
|
||||
|
||||
wl_proxy_set_queue((struct wl_proxy *)dri2_dpy->wl_dpy_wrapper,
|
||||
dri2_dpy->wl_queue);
|
||||
|
||||
if (dri2_dpy->own_device)
|
||||
wl_display_dispatch_pending(dri2_dpy->wl_dpy);
|
||||
|
||||
dri2_dpy->wl_registry = wl_display_get_registry(dri2_dpy->wl_dpy_wrapper);
|
||||
wl_registry_add_listener(dri2_dpy->wl_registry, ®istry_listener_drm,
|
||||
dri2_dpy);
|
||||
|
||||
if (roundtrip(dri2_dpy) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (!dri2_initialize_wayland_drm_extensions(dri2_dpy))
|
||||
goto cleanup;
|
||||
|
||||
loader_get_user_preferred_fd(&dri2_dpy->fd_render_gpu,
|
||||
&dri2_dpy->fd_display_gpu);
|
||||
|
||||
if (dri2_dpy->fd_render_gpu != dri2_dpy->fd_display_gpu) {
|
||||
free(dri2_dpy->device_name);
|
||||
dri2_dpy->device_name =
|
||||
loader_get_device_name_for_fd(dri2_dpy->fd_render_gpu);
|
||||
if (!dri2_dpy->device_name) {
|
||||
_eglError(EGL_BAD_ALLOC, "wayland-egl: failed to get device name "
|
||||
"for requested GPU");
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
/* we have to do the check now, because loader_get_user_preferred_fd
|
||||
* will return a render-node when the requested gpu is different
|
||||
* to the server, but also if the client asks for the same gpu than
|
||||
* the server by requesting its pci-id */
|
||||
dri2_dpy->is_render_node =
|
||||
drmGetNodeTypeFromFd(dri2_dpy->fd_render_gpu) == DRM_NODE_RENDER;
|
||||
|
||||
dri2_dpy->driver_name = loader_get_driver_for_fd(dri2_dpy->fd_render_gpu);
|
||||
if (dri2_dpy->driver_name == NULL) {
|
||||
_eglError(EGL_BAD_ALLOC, "DRI2: failed to get driver name");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
dri2_dpy->loader_extensions = dri2_loader_extensions;
|
||||
if (!dri2_load_driver(disp)) {
|
||||
_eglError(EGL_BAD_ALLOC, "DRI2: failed to load driver");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!dri2_create_screen(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);
|
||||
|
||||
if (dri2_dpy->wl_drm) {
|
||||
/* To use Prime, we must have _DRI_IMAGE v7 at least.
|
||||
* createImageFromDmaBufs support indicates that Prime export/import is
|
||||
* supported by the driver. We deprecated the support to GEM names API, so
|
||||
* we bail out if the driver does not support Prime. */
|
||||
if (!(dri2_dpy->capabilities & WL_DRM_CAPABILITY_PRIME) ||
|
||||
!dri2_dpy->has_dmabuf_import) {
|
||||
_eglLog(_EGL_WARNING, "wayland-egl: display does not support prime");
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
dri2_wl_add_configs_for_visuals(disp);
|
||||
|
||||
dri2_set_WL_bind_wayland_display(disp);
|
||||
/* When cannot convert EGLImage to wl_buffer when on a different gpu,
|
||||
* because the buffer of the EGLImage has likely a tiling mode the server
|
||||
* gpu won't support. These is no way to check for now. Thus do not support
|
||||
* the extension */
|
||||
if (dri2_dpy->fd_render_gpu == dri2_dpy->fd_display_gpu)
|
||||
disp->Extensions.WL_create_wayland_buffer_from_image = EGL_TRUE;
|
||||
|
||||
disp->Extensions.EXT_buffer_age = EGL_TRUE;
|
||||
|
||||
disp->Extensions.EXT_swap_buffers_with_damage = EGL_TRUE;
|
||||
|
||||
disp->Extensions.EXT_present_opaque = EGL_TRUE;
|
||||
|
||||
/* Fill vtbl last to prevent accidentally calling virtual function during
|
||||
* initialization.
|
||||
*/
|
||||
dri2_dpy->vtbl = &dri2_wl_display_vtbl;
|
||||
|
||||
return EGL_TRUE;
|
||||
|
||||
cleanup:
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
static EGLBoolean
|
||||
dri2_initialize_wayland_drm(_EGLDisplay *disp)
|
||||
{
|
||||
|
Reference in New Issue
Block a user