diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index 6f5698e189d..28c0a2fefd9 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -2208,6 +2208,137 @@ 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) { diff --git a/src/gallium/drivers/zink/VP_ZINK_requirements.json b/src/gallium/drivers/zink/VP_ZINK_requirements.json index 0e688c4fb43..4efef7efca9 100644 --- a/src/gallium/drivers/zink/VP_ZINK_requirements.json +++ b/src/gallium/drivers/zink/VP_ZINK_requirements.json @@ -399,7 +399,9 @@ "VK_EXT_non_seamless_cube_map": 1, "VK_KHR_pipeline_library": 1, "VK_EXT_attachment_feedback_loop_layout": 1, - "VK_EXT_attachment_feedback_loop_dynamic_state": 1 + "VK_EXT_attachment_feedback_loop_dynamic_state": 1, + "VK_KHR_maintenance6": 1, + "VK_KHR_maintenance7": 1 }, "features": { "VkPhysicalDeviceExtendedDynamicStateFeaturesEXT": { @@ -435,6 +437,12 @@ }, "VkPhysicalDeviceAttachmentFeedbackLoopDynamicStateFeaturesEXT": { "attachmentFeedbackLoopDynamicState": true + }, + "VkPhysicalDeviceMaintenance6FeaturesKHR": { + "maintenance6": true + }, + "VkPhysicalDeviceMaintenance7FeaturesKHR": { + "maintenance7": true } }, "properties": { @@ -447,6 +455,7 @@ "extensions": { "VK_EXT_provoking_vertex": 1, "VK_KHR_dynamic_rendering": 1, + "VK_KHR_dynamic_rendering_local_read": 1, "VK_EXT_dynamic_rendering_unused_attachments": 1, "VK_EXT_legacy_vertex_attributes": 1 }, @@ -454,6 +463,9 @@ "VkPhysicalDeviceDynamicRenderingFeatures": { "dynamicRendering": true }, + "VkPhysicalDeviceDynamicRenderingLocalReadFeaturesKHR": { + "dynamicRenderingLocalRead": true + }, "VkPhysicalDeviceDynamicRenderingUnusedAttachmentsFeaturesEXT": { "dynamicRenderingUnusedAttachments": true },