Skip to content

[Feature request] Wayland compositor side extension #294

Description

@nyorain

Hey i've got a feature request for an extension similiar to a combination of EGL_WL_bind_wayland_display provided by the mesa implementation (not an official extension) and EGL_KHR_image_base.

It should make wayland compositors able to retrieve vulkan images from wayland client buffer resources that are managed by the same drivers egl or vulkan client implementation.

If a wayland client uses vulkan (and the wayland wsi) the only way for the compositor to get the contents of this buffer is the egl extension. Therefore, one cannot write an efficient vulkan compositor backend which is really a pity considering that vulkan has (at least in theory) with VK_EXT_KHR_display a really nice and convinient api for direct rendering on linux.

I wrote down some first ideas how this extension could look like in vulkan.
I am not that familiar with the khronos extension naming scheme, so i am not sure what extension suffix it would get. KHR like the other WSI extensions?

To bind a wayland display to a vulkan instance (i.e. creating a wl_drm global) or to unbind it:

VkResult vkBindWaylandDisplay<Suffix>(VkInstance instance, struct wl_display *display);
VkResult vkUnbindWaylandDisplay<Suffix>(VkInstance instance, struct wl_display *display);

To check if a wayland client resource can be transformed into a vulkan image (i.e. if the resource is managed by the wl_drm):

vkResult vkQueryWaylandBuffer<Suffix>(
    VkInstance instance, 
    struct wl_resource *buffer, 
    VkWaylandBufferAttribute<Suffix> attribute, 
    uint32_t *value);

This kind of querying seems like not used anymore in vulkan, so it could also be done with a structure holding all the queryable information about a buffer (which would be something like size and format):

VkResult vkGetWaylandBufferProperties<Suffix>(
    VkInstance instance, 
    struct wl_resource *buffer,
    VkWaylandBufferProperties *pProperties);

Then just a function to create a vulkan image from a valid client buffer.
The VkWaylandBufferImageCreateInfo structure would contain the wl_resource* and some attributes like in egl.

VkResult vkCreateWaylandBufferImage<Suffix>(
    VkDevice device,
    VkWaylandBufferImageCreateInfo<Suffix> *pCreateInfo,
    VkAllocationCallbacks *pAllocator,
    VkImage *pImage);

Mesas intel driver already has a branch with some first implementation of something like this. But IMO it would really make sense to have a driver-independent extension.

If this is not the right place for a request like this or it is totally inappropriate please just let me know.
Thank you.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions