-
Notifications
You must be signed in to change notification settings - Fork 470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add VK_EXT_disable_wayland_color_management #2410
base: main
Are you sure you want to change the base?
Add VK_EXT_disable_wayland_color_management #2410
Conversation
@colinmarc process-wise, we require that extension number and flag bits be reserved by a commit to main prior to the extension development branch actually being able to use them. I don't know where this extension stands deployment / release-wise, but we need to separate out the reservations and accept those first, to avoid a race condition (see extension 597 for a guide to what that PR would look like). In fact because #2414 also just came up, we will have to tweak one or the other of those reservation PRs since you can't both have extension 603. |
If you will go ahead and create the reservation PR using extension number 604, since #2416 just reserved 603, we should be good now (at least if nobody does an internal extension reservation MR first :-)). |
The Valid Usage statement should go in this PR Just write it as an undecorated bullet point, and the actual VUID tag will get assigned as part of the spec merge process. Implementation of the check itself would then follow as a PR against https://github.com/KhronosGroup/Vulkan-validationlayers |
8ecfdd7
to
0079eaa
Compare
Thanks all for the help! I reserved the extension in #2419. I also rebased and added the validation check. |
0079eaa
to
59f46ea
Compare
9dc46c9
to
08aac76
Compare
08aac76
to
e52e208
Compare
cc @swick |
The wayland protocol now supports has two surface extensions. I'm not convinced this extension is necessary. |
@swick what mechanism should a Vulkan implementation use to determine whether or not to create a |
I'm suggesting that you only need to create a |
That sounds a lot like alternative 2., which I outlined above, except you're suggesting delaying the creation of the surface until presentation, rather than delaying it until swapchain creation time. I don't think that offers any particular advantages over lazily creating it along with the swapchain, since the colorspace is known at swapchain creation time, and it's awkward for the implementation to wait until That solution suffers from the race conditions I mentioned - for example, what happens if you create a swapchain with |
You could ref count the |
Perhaps, but then apps wouldn't be able to tag their surface until after the first few frames are presented on the new swapchain, which would cause flickering. And swapchain destruction happens in a separate thread in a lot of apps, which could race.
I agree, so why not expressly and explicitly forbid it? That's what this extension does. You're proposing a potential mechanism, but what Vulkan requires is policy. Formulating your suggested mechanism as policy would be difficult to understand or enforce via validation. It would be something like
Compare that to these other policy alternatives:
(for the record, I prefer this option). or:
I find both of those much more understandable and enforceable. |
What's wrong with this? I find it an odd choice to create an extension which removes all VkColorSpaces other than VK_COLOR_SPACE_PASS_THROUGH_EXT when the app could just itself create swapchains with VK_COLOR_SPACE_PASS_THROUGH_EXT only. |
Ref counting non- |
I have a small complaint about the nomenclature here. I find "disable color management" misleading. In this proposal it means "do not use color management protocol", but I believe people will intuitively understand it as "push pixel values unmodified to display". The documentation is clear, though. How about something like VK_EXT_wayland_no_color_description? no_image_description would be straight from the Wayland extension, but I suspect "image description" could be easily confused with unrelated Vulkan terminology. As for whether this extension as a whole is a good idea, I cannot say. I'm not familiar with Vulkan. |
If people really want such an extension, then it shouldn't be wayland specific and just disable all I personally still don't really see the point though. |
Apparently We would have to work on defining it better and probably also explicitly define the interaction with the wayland color management protocol, or come up with a new VkColorSpace for this purpose. |
VK_EXT_disable_wayland_color_management
This adds a small extension, allowing applications to request that WSI implementations avoid using wayland color management, so that they can do it themselves. This addresses #2307.
Background
Wayland is growing color management and HDR support, in the soon-to-be-finalized
wp_color_management
protocol1. The protocol has support for tagging surfaces with colorspace information and HDR metadata, generally in ways matching up to Vulkan'sVK_KHR_swapchain_colorspace
andVK_EXT_hdr_metadata
, but also with facilities that are not currently expressible via Vulkan or other graphics APIs, such as using an ICC profile to describe a surface's content.As such, applications wanting to do color management or output HDR content on Wayland will roughly fall into three buckets:
The protocol's design is such that only one Wayland client may do color management for a particular surface at once. Specifically, only one
color_management_surface
may exist for a given Wayland surface at a time. Applications in the first group will create this object themselves, while applications in the second group will useVK_KHR_swapchain_colorspace
and other related extensions, and rely on WSI implementations to do the tagging for them. The third group wants to create the object themselves, but needs to prevent the WSI implementation from also creating the object, since that would be a protocol violation. Hence this extension.Alternatives considered
1. Check whether
VK_KHR_swapchain_colorspace
is enabledWSI implementations could check whether the application has enabled the extension, and only create
color_management_surface
objects if it is. This has a few problems:VK_COLOR_SPACE_PASS_THROUGH_EXT
, which matches the behavior they want, and must useVK_COLOR_SPACE_SRGB_NONLINEAR_KHR
, which may be completely unrelated to the content of their surface, to mean that the surface should remain untagged.2. Switch on
VK_COLOR_SPACE_PASS_THROUGH_EXT
This is more intuitively correct. Applications that set
PASS_THROUGH
would seem to be indicating that they want the surface to be untagged. However, this is difficult to implement. By the time the swapchain is create, the wayland surface has already been created, which means the driver must delay deciding whether to create thecolor_management_surface
object. Furthermore, if another swapchain is created with a different colorspace, thecolor_management_surface
must be created at that point, and then destroyed if the colorspace is again set toPASS_THROUGH
. All of those operations could potentially race with the application's creation or destruction of thecolor_management_surface
object, and such shenanigans would be pretty error-prone in general.Note
I would like to create a validation check to ensure that surfaces created with
VK_WAYLAND_SURFACE_CREATE_DISABLE_COLOR_MANAGEMENT
must only be used to create swapchains withVK_COLOR_SPACE_PASS_THROUGH_EXT
. Should that go in this PR, or somewhere else? Should the validation be onvkCreateSwapchainKHR
or onVkWaylandCreateSurafceKHR
?Footnotes
https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/14 ↩