Commit graph

410 commits

Author SHA1 Message Date
Timo Witte
0553fc0b18 maxFALL and maxCLL to max_fall and max_cll + docu changes
Signed-off-by: Timo Witte <timo.witte@gmail.com>
2023-10-15 01:45:05 +02:00
Sebastian Wick
48f092c2ed color: reference the color-and-hdr repository
This serves two purposes: one is to direct people at the repository to
understand color management, digital color and the protocol design. The
other is to make the glossary the authority on the terms we use in the
protocol.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2023-10-13 14:04:27 +02:00
Pekka Paalanen
f6db52c782 color: add maxCLL, maxFALL
These complete the set of HDR static metadata as defined by CTA-861-H.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:14 +02:00
Pekka Paalanen
74cbd5e1fd color: clarify object vs. record
Improve consistency of wording inside the event, pointed out in review.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:14 +02:00
Pekka Paalanen
3a484cb61d color: deliver crucial, not all information
There could be two kinds of additions to wp_image_description_v1 events:

- Crucial ones, without which the description is useless, for example
  some completely new form of information that doesn't translate to old
  events. E.g. a standard appears for a profile file format that is
  utterly incompatible with ICC v4 files.

- Backwards compatible ones, which are additional details to existing
  forms of information. E.g. viewing environment parameters. In case
  these details are not possible to deliver, we know what assumptions
  are made, and can account for those.

When crucial events are missing, there is nothing one can do. In reality
the difference is not that obvious.

When additional detail events are missing, and it actually is possible to
have reasonable assumptions that hold, a compositor could deliver what
it can and follow the assumptions clients have done. However, this means
that the preferred or output image description is not what the
compositor actually has, it is something different, so the compositor
must take that into account. Therefore the backward compatible case
should be used only when it is necessary to keep existing applications
working as well as they did before.

This is to avoid the case where one adds a minor detail in the events,
and suddenly all color critical applications that do their own color
management stop being able to do their job because the compositor
refuses to communicate anything.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:14 +02:00
Pekka Paalanen
b190311f91 color: only display class ICC profiles
We are a display system, and we should always get pixels intended for
some display. Hence, accept only display class ICC profiles.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:14 +02:00
Pekka Paalanen
91a688ca46 color: move destroy requests
Make sure all destroy requests are the very first defined thing in each
interface, for consistency's sake.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:14 +02:00
Pekka Paalanen
8659ac8d23 color: simplify factory design
Supporting other factories in independent protocol extensions was a nice
idea, but complicates the design for questionable benefit. The existing
design was only half of it, too, because wp_image_description_v1
interface had events related to all factories instead of the factories
having their own events.

Therefore go back to a simple monolithic design, but keep the different
factory requests still optional and discoverable.

This gets rid of the new_id interface hack.

There is also a little bit of unifying the wording, and couple typo
fixes.

The ICC factory is turned into a creator object, because we are not sure
that there cannot be other properties that would need to be set.
When a compositor can read the file is clarified.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:14 +02:00
Pekka Paalanen
1f5f36be59 color: add supported_feature event
This makes the support for a few requests to be explicitly advertised
and unavailable otherwise. This allows compositors to support only
enumerated transfer functions and primaries, instead of requiring them
to support the arbitrary flavors. This may be useful for
hardware-specific compositors that cannot use programmable shading.

set_mastering_display_primaries is a bit more special. The support for
it is split into two features: basic support, and extended color volume
support. Extended color volume support requires handling color values
outside of the range [0.0, 1.0] which requires special care from
compositors. Silently clipping out-of-range values may or may not be
acceptable, so clients should be aware whether it works. If clipping is
acceptable, they can try an image description without extended color
volume.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:14 +02:00
Sebastian Wick
70e0c536e1 color: add the concept of readyness to image descriptions
Creating an image description might involve reading from file
descriptors which can take a significant amount of time. The previous
specification required image descriptions to fail after a roundtrip
which would make it impossible to send any events while creating an
image description in a compositor.

This commit changes the object to become ready only after receiving a
new ready event. Using the object before it is ready is an erro just
like using the object after receiving a failed event.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2023-10-12 17:11:13 +02:00
Pekka Paalanen
9f08c9551d color: add min/max absolute luminance
These are only useful when the image is defined in absolute luminance
units, IOW uses Perceptual Quantizer.

This completes the SMPTE ST 2086 HDR static metadata.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:13 +02:00
Pekka Paalanen
74e55290a2 color: fix container/primary color volume nomenclature
I accidentally used the term container color volume when I should have
used primary color volume. Fix that, and mention the primary color
volume more to ease cross referencing.

This reverts the change of the names of two requests. It did not feel
good to name them primary_primaries and primary_primaries_cicp.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:13 +02:00
Pekka Paalanen
1317176f1c color: move creator_params.create up
If new parameter requests are added in a backward compatible way, I
don't want to leave the create request in the middle.

This is a simple move, the spec is identical.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:13 +02:00
Pekka Paalanen
f6a294f045 color: move creator_params.destroy up
Destroying is the most important aspect of an interface, so move the
destroy request definitions as the first one.

If new requests for new parameters are added in the future in backward
compatible ways, the destroy request is not sitting in between old and
new parameters.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:13 +02:00
Pekka Paalanen
1aa4632de9 color: add target_primaries event
This new event mirrors the set_mastering_display_primaries, delivering
similar information. This allows clients to target a suitable color
sub-volume and avoid gamut mapping in the compositor, particularly for
HDR-like use cases.

The old primaries are renamed to container primaries to reduce
confusion.

The terminology follows color-and-hdr glossary.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:13 +02:00
Pekka Paalanen
c5a8ad1fdb color: add wp_image_description_v1.done
The get_information request talks about 'done' event, but it didn't
actually exist, so let's add it.

Clients do not need to ask for wl_display.sync explicitly.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:13 +02:00
Pekka Paalanen
d2fb6146c9 color: forbid get_information for client-created
Requests wp_color_management_output_v1.get_image_description and
wp_color_management_surface_v1.get_preferred already explicitly document
that get_information is allowed. Finish the definitions by adding notes
that image description objects created from client's data do not allow
get_informatio, and define the protocol error for the violation.

The principal reason to forbid get_information is the Wayland design
paradigm: if a client sets some data, it is up to the client to save
that data too if it needs it later. Asking the compositor for what the
client already knew is just useless overhead.

The practical reason to forbid get_information, especially for the ICC
factory, is to not require the compositor to store exactly the same data
the client gave it. If a compositor uses an internal representation of a
client given ICC file, then the compositor should not need to keep
*also* a copy of the ICC file around just in case the client might ask
for it.

This also avoids questions around whether a compositor should return
exactly the same data a client gave, or is a similar representation
enough.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:13 +02:00
Pekka Paalanen
c1a988a2d8 color: reword set_image_description
Drop the old notes about performance benefits, they are already
explained with preferred_changed. Also don't emphasize getting image
descriptions from outputs, that should not be a usual option. Only
display profiling software should use output-specific image
descriptions.

Maybe a good idea to mention that clients must understand the image
description and not just get_preferred, blindly slap it on the
wl_surface, and render without any adjustments.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:13 +02:00
Pekka Paalanen
35dce6bb98 color: no image description by default
This allows compositors to mimick non-color-managed behavior, or sRGB
assumption, or anything else they might have done or maybe want to do
with untagged surfaces. This may even vary from surface to surface, e.g.
specific applications through Xwayland handled differently from others.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:13 +02:00
Pekka Paalanen
3b9793b213 color: replace ISO document references
Why pay 208 CHF for an ISO document when allegedly the same is available
from color.org for free under a different name.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:13 +02:00
Pekka Paalanen
24ae95bee4 color: harmonize double-buffered state wording
Use standard wording for legibility.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:13 +02:00
Pekka Paalanen
a5adc07ccb color: advertise supported rendering intents
It probably makes sense to let compositors not always implement all
possible rendering intents to lower the barrier to implement this
extension.

Advertising supported rendering intents also trivially allows more
intents to be added later.

Fixed the wording to avoid "hint".

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:13 +02:00
Pekka Paalanen
a5cb9be869 color: clarify wp_image_description_v1.destroy
Move it up so it's the first defined request. Destruction is such a
fundamental part of any interface.

Make it more explicit on what destructions means. I imagine compositors
to use reference-counted image description implementation objects that
are independent of protocol objects. That is already what 'identity'
event implies. It would be more hassle to make sure that
set_image_description, destroy, commit would actually special-case the
destroy, and we would also need to define what that means.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:13 +02:00
Pekka Paalanen
3fc7b48ce4 color: rename gamma to power
Gamma is a term spoiled with too many different meanings. Let's use
different words to be more clear. This aligns the factory request and
the information event to use the same wording.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:13 +02:00
Pekka Paalanen
1a7c2f32a6 color: harmonize cicp events
Use the same wording as the factory interface requests.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:13 +02:00
Pekka Paalanen
cf21210045 color: clarify when get_information events are sent
The idea is that the compositor sends everything it knows, even if it
redundant.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:13 +02:00
Pekka Paalanen
dfd682598a color: reword icc_file event
Allow the fd to be read(2) as well. Mention that the compositor chooses
the profile details. It is possible that a compositor was not configured
with an output ICC profile, so it cannot sent one in that case.

Add a note about offset, which is different from
wp_image_description_factory_icc_v1: a compositor cannot risk some
client reading data before the given offset leading to an information
leak, so for non-zero offset a compositor would need to clear that
memory, so cannot use any bigger file as the base anyway.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:13 +02:00
Sebastian Wick
6899b3b72e color: add the concept of mastering display primaries
To support scRGB like extended gamuts and HDR metadata for limiting
gamut mapping distances.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2023-10-12 17:11:13 +02:00
Pekka Paalanen
2cb2453787 color: drop EDR
EDR can be a useful concept for relative luminance HDR, but it is not
needed or used with PQ or HLG.

Let's concentrate on the more well-known video standards using PQ and
HLG first. We can consider re-adding EDR back once we have a better idea
of how it mixes with PQ with metadata and HLG.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:13 +02:00
Pekka Paalanen
efcec81722 color: fix primaries event arguments
This is copied from the set_primaries request and description slightly
adapted. Now the integer values are clearly defined.

We still need to define when this event is sent, but that is for another
time.

Reported-by: Jérôme Carretero (@zougloub)
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:13 +02:00
Pekka Paalanen
4421a97803 color: rewrite wp_image_description intro
I think it reads better like this, with the introduction being in more
general terms. Updated to refer to the recently changed interfaces.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:13 +02:00
Pekka Paalanen
5414bfa9c2 color: remove redundant words
These were useless repetition.

Suggested-by: Uday Kiran (@pichika)
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:13 +02:00
Sebastian Wick
eedc4f6a28 color: Remove TODOs
Tracking via issues instead.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2023-10-12 17:11:13 +02:00
Sebastian Wick
5e10235217 color: Remove alpha mode support
This moved to the color-representation protocol.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2023-10-12 17:11:13 +02:00
Pekka Paalanen
d145157216 color: add already_set protocol error
This was already implied in wp_image_description_creator_params_v1
description but was lacking the error code.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:13 +02:00
Pekka Paalanen
affd8f0560 color: improve set_primaries description
Make it more in line with the other set_* requests.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:13 +02:00
Pekka Paalanen
997ec3e829 color: reword set_tf_gamma
Improve the definition and do not talk about gamma. Gamma is still in
the name, but maybe that's fine.

Change the encoding to support three decimals, I think that's well
enough.

Set some limits on the exponent so that compositor implementations do
not get into trouble with nonsense values.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:13 +02:00
Pekka Paalanen
bbf09b8fe3 color: rely on H.273 and advertise supported CICP
This way we do not need our own enumeration of what H.273 already
defines.

We can also handle additions to H.273, since compositors advertise the
supported code points explicitly, and using anything else is forbidden.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:13 +02:00
Pekka Paalanen
f780022548 color: drop cicp_color_primaries_id enum
Since we are going to rely on H.273 CICP, we do not need to have an
enumeration defined for these, we will simply use the CICP values.

It's also problematic to create names for the CICP values, because each
code point matches several standards so they don't have canonical names.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:13 +02:00
Pekka Paalanen
46ff44052c color: add wp_image_description_v1.identity event
This will be useful for clients de-duplicating image descriptions (color
profiles). E.g. all wl_surfaces on the same single wl_output would
likely have the same preferred image description.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:13 +02:00
Pekka Paalanen
f50fc77bb5 color: surface preferred image description
Rather than pointing to a wl_output for the preferred image description,
deliver it more directly. This decouples the preferred image description
from outputs giving the compositor more freedom in recommendations.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:13 +02:00
Pekka Paalanen
ca4f7f951e color: update wp_color_management_output_v1.get_image_description
Update how the object must be created so it has an explicit interface
version. This might not be strictly necessary here because the inherited
version would be likely correct, but it's done for consistency.

Take into account that if wp_image_description_v1 interface does need
extending, old versions of it may not be sufficient for describing
outputs.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:13 +02:00
Pekka Paalanen
38af0b4a1f color: rework how wp_image_description_creator_params_v1 is created
Since the params object holds mutable state, it would be unorthodox to
create that straight from a global via wl_registry.bind, even though we
could just fine. To make things more familiar, define a separate global
factory interface for params objects.

Define the fatal protocol errors for this interface that are definitely
client bugs rather than unsupported image descriptions. Unsupported
image description errors are punted to a future image description
graceful error event that the ICC factory is going to need as well.

The error codes for duplicate setting of properties will be added later
as fatal protocol errors. More protocol errors for universally
unsupported image descriptions might be added later too.

The created and error events are removed, because the error event will
be in wp_image_description_v1 interface, and we cannot use the created
event because we need to pass the interface version explicitly to avoid
inheriting it. Unqualified new_id argument in an event has never been
tried as I know of, but it works in requests and causes less surprises.

The create request could be a second destructor for this interface, but
it's not a common pattern to have destructor with arguments, even less
with a new_id, so I chose to not try my luck there. Semantically it
would be correct. So, we do what zwp_linux_buffer_params_v1 does and
just say you need to destroy the object.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:13 +02:00
Pekka Paalanen
6400da7def color: re-design ICC image description factory
Turn wp_image_description_creator_icc_v1 into a global interface, so
that compositors can choose whether to advertise it or not. The name is
changed for consistency:
- global interfaces are factories
- one-shot helper objects are creators

set_icc request is turned into simply "create" that creates the image
description object. There is no room for any additional parameters,
because I believe we need to let the ICC handle those. We should not be
modifying their intents by adding e.g. viewing environment variables
here. What the ICC does not define, we do not add.

ICC data offset and length are added, so that ICC profiles embedded in
image files are easier to just pass through. Offset is only 32 bits,
though.

Some protocol errors that are clearly client bugs are defined, but all
other interpretation errors are left for the graceful failure event to
handle.

Add a definition of when a compositor must be finished with reading the
fd, to let clients know when it's safe to e.g. modify the file again.

The creation of the wp_image_description_v1 object requires the client
to set the interface and version explicitly. This is to allow extending
wp_image_description_v1 interface while allowing multiple independent
factories for it: the interface version must be given instead of
inherited.

Details of the error event are to be clarified later.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:13 +02:00
Pekka Paalanen
edb655a8b4 color: add graceful error event to wp_image_description_v1
The factory/creator interface cannot avoid creating the protocol object
because of the protocol mechanics, but we can still deliver the graceful
failure event immediately on it.

This will be used by all requests that create image description
objects.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:13 +02:00
Pekka Paalanen
f633baf187 color: rewrite zwp_color_manager_v1 description
The plan is to have this one as the main global singleton interface, and
then expose type-specific factories for image description objects, e.g.
one for ICC, another for parametrized.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:13 +02:00
Pekka Paalanen
da8525104a color: rewrite the top-level description
Give it an overview of what this is about.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:13 +02:00
Sebastian Wick
ea0637f875 color: Adhere to staging protocol conventions
* Rename zwp_ to wp_
* Rename protocol from color_management_unstable_v1 to color_management_v1

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2023-10-12 17:11:13 +02:00
Sebastian Wick
adf88cc13d color: Move color-management protocol from unstable to staging
Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2023-10-12 17:11:13 +02:00
Pekka Paalanen
a6aab6b835 color: whitespace fixes
Consistently set blank lines. Fix more indenting. Linewrap some.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-10-12 17:11:13 +02:00