Skip to contentSkip to conversation

drm: document userspace expectations around the Colorspace connector property

PATCH In review Xaver Hugl 4 participants 8 messages Feb 9, 2024 – Feb 19, 2024

Subsystems (2)
lore
Share & tools
lore

Xaver Hugl

author
#0 lore raw

PATCH 1/1 drm: document userspace expectations around the Colorspace connector property

---
 drivers/gpu/drm/drm_connector.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/drm_connector.c +8 -0
index b0516505f7ae..01e13984629b 100644
@@ -2158,6 +2158,14 @@ EXPORT_SYMBOL(drm_mode_create_aspect_ratio_property);
  *     one supported. Sink supported colorspaces should be retrieved by
  *     userspace from EDID and driver will not explicitly expose them.
  *
+ *     As userspace can't currently know whether or not the output is using
+ *     RGB or YCC signalling, the driver must translate properties to their
+ *     relevant RGB or YCC counterparts, depending on the actually used
+ *     signalling. Property values that are only valid for either YCC or RGB
+ *     and have no equivalent for the other signalling type must not be
+ *     exposed as supported, unless the driver can guarantee it never uses
+ *     the signalling that doesn't match the property.
+ *
  *     Basically the expectation from userspace is:
  *      - Set up CRTC DEGAMMA/CTM/GAMMA to convert to some sink
  *        colorspace
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 27 lines · Xaver Hugl
---
 drivers/gpu/drm/drm_connector.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/drm_connector.c +8 -0
index b0516505f7ae..01e13984629b 100644
@@ -2158,6 +2158,14 @@ EXPORT_SYMBOL(drm_mode_create_aspect_ratio_property);
  *     one supported. Sink supported colorspaces should be retrieved by
  *     userspace from EDID and driver will not explicitly expose them.
  *
+ *     As userspace can't currently know whether or not the output is using
+ *     RGB or YCC signalling, the driver must translate properties to their
+ *     relevant RGB or YCC counterparts, depending on the actually used
+ *     signalling. Property values that are only valid for either YCC or RGB
+ *     and have no equivalent for the other signalling type must not be
+ *     exposed as supported, unless the driver can guarantee it never uses
+ *     the signalling that doesn't match the property.
+ *
  *     Basically the expectation from userspace is:
  *      - Set up CRTC DEGAMMA/CTM/GAMMA to convert to some sink
  *        colorspace
Signature · 1 line
2.43.0

Thank you!

Acked-by on v1 1/1
#2 lore raw
In reply to Xaver Hugl
Quoted 14 lines · On Fri, 9 Feb 2024 17:53:07 +0100 Xaver Hugl <[email protected]> wrote:
---
 drivers/gpu/drm/drm_connector.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/drm_connector.c +1 -0
index b0516505f7ae..01e13984629b 100644
@@ -2158,6 +2158,14 @@ EXPORT_SYMBOL(drm_mode_create_aspect_ratio_property);
  *     one supported. Sink supported colorspaces should be retrieved by
  *     userspace from EDID and driver will not explicitly expose them.
  *
+ *     As userspace can't currently know whether or not the output is using

drivers/gpu/drm/drm_connector.c EXPORT_SYMBOL(drm_mode_create_aspect_ratio_property); · line 2171

Quoted 10 lines
drivers/gpu/drm/drm_connector.c +7 -0
+ *     RGB or YCC signalling, the driver must translate properties to their
+ *     relevant RGB or YCC counterparts, depending on the actually used
+ *     signalling. Property values that are only valid for either YCC or RGB
+ *     and have no equivalent for the other signalling type must not be
+ *     exposed as supported, unless the driver can guarantee it never uses
+ *     the signalling that doesn't match the property.
+ *
  *     Basically the expectation from userspace is:
  *      - Set up CRTC DEGAMMA/CTM/GAMMA to convert to some sink
  *        colorspace

Thanks,
pq

#3 lore raw
In reply to Xaver Hugl
Quoted 14 lines · On Fri, 9 Feb 2024 17:53:07 +0100 Xaver Hugl <[email protected]> wrote:
---
 drivers/gpu/drm/drm_connector.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/drm_connector.c +1 -0
index b0516505f7ae..01e13984629b 100644
@@ -2158,6 +2158,14 @@ EXPORT_SYMBOL(drm_mode_create_aspect_ratio_property);
  *     one supported. Sink supported colorspaces should be retrieved by
  *     userspace from EDID and driver will not explicitly expose them.
  *
+ *     As userspace can't currently know whether or not the output is using

drivers/gpu/drm/drm_connector.c EXPORT_SYMBOL(drm_mode_create_aspect_ratio_property); · line 2171

Quoted 10 lines
drivers/gpu/drm/drm_connector.c +7 -0
+ *     RGB or YCC signalling, the driver must translate properties to their
+ *     relevant RGB or YCC counterparts, depending on the actually used
+ *     signalling. Property values that are only valid for either YCC or RGB
+ *     and have no equivalent for the other signalling type must not be
+ *     exposed as supported, unless the driver can guarantee it never uses
+ *     the signalling that doesn't match the property.
+ *
  *     Basically the expectation from userspace is:
  *      - Set up CRTC DEGAMMA/CTM/GAMMA to convert to some sink
  *        colorspace

While this addition is good, I have another question:

Does "Colorspace" property choose also the RGB->YCbCr matrix that the driver will use when it happens to use YCbCr signalling?

So far we have only been talking about the primaries and white point.

#4 lore raw
Quoted 30 lines · Pekka Paalanen
Quoted 14 lines · On Fri, 9 Feb 2024 17:53:07 +0100 Xaver Hugl <[email protected]> wrote:
---
 drivers/gpu/drm/drm_connector.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/drm_connector.c +1 -0
index b0516505f7ae..01e13984629b 100644
@@ -2158,6 +2158,14 @@ EXPORT_SYMBOL(drm_mode_create_aspect_ratio_property);
  *     one supported. Sink supported colorspaces should be retrieved by
  *     userspace from EDID and driver will not explicitly expose them.
  *
+ *     As userspace can't currently know whether or not the output is using

drivers/gpu/drm/drm_connector.c EXPORT_SYMBOL(drm_mode_create_aspect_ratio_property); · line 2171

Quoted 10 lines
drivers/gpu/drm/drm_connector.c +7 -0
+ *     RGB or YCC signalling, the driver must translate properties to their
+ *     relevant RGB or YCC counterparts, depending on the actually used
+ *     signalling. Property values that are only valid for either YCC or RGB
+ *     and have no equivalent for the other signalling type must not be
+ *     exposed as supported, unless the driver can guarantee it never uses
+ *     the signalling that doesn't match the property.
+ *
  *     Basically the expectation from userspace is:
  *      - Set up CRTC DEGAMMA/CTM/GAMMA to convert to some sink
  *        colorspace

While this addition is good, I have another question:

Quoted 4 lines

Does "Colorspace" property choose also the RGB->YCbCr matrix that the driver will use when it happens to use YCbCr signalling?

So far we have only been talking about the primaries and white point.

Uh, yeah, good point. The InfoFrames do affect both the YCbCr conversion and the transfer characteristics that the sink expects. Drivers should do the RGB to YCbCr conversion with the new matrix. I think (and very much hope) that drivers don't rely on the TF for any internal processing but if they did, they also should use the one the sink expects.

#5 lore raw
Quoted 34 lines · On Mon, 12 Feb 2024 17:50:36 +0100 Sebastian Wick <[email protected]>…
Quoted 33 lines · Pekka Paalanen
Quoted 14 lines · On Fri, 9 Feb 2024 17:53:07 +0100 Xaver Hugl <[email protected]> wrote:
---
 drivers/gpu/drm/drm_connector.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/drm_connector.c +1 -0
index b0516505f7ae..01e13984629b 100644
@@ -2158,6 +2158,14 @@ EXPORT_SYMBOL(drm_mode_create_aspect_ratio_property);
  *     one supported. Sink supported colorspaces should be retrieved by
  *     userspace from EDID and driver will not explicitly expose them.
  *
+ *     As userspace can't currently know whether or not the output is using

drivers/gpu/drm/drm_connector.c EXPORT_SYMBOL(drm_mode_create_aspect_ratio_property); · line 2171

Quoted 10 lines
drivers/gpu/drm/drm_connector.c +7 -0
+ *     RGB or YCC signalling, the driver must translate properties to their
+ *     relevant RGB or YCC counterparts, depending on the actually used
+ *     signalling. Property values that are only valid for either YCC or RGB
+ *     and have no equivalent for the other signalling type must not be
+ *     exposed as supported, unless the driver can guarantee it never uses
+ *     the signalling that doesn't match the property.
+ *
  *     Basically the expectation from userspace is:
  *      - Set up CRTC DEGAMMA/CTM/GAMMA to convert to some sink
  *        colorspace  

While this addition is good, I have another question:

Does "Colorspace" property choose also the RGB->YCbCr matrix that the driver will use when it happens to use YCbCr signalling?

Quoted 7 lines
Quoted 1 line

So far we have only been talking about the primaries and white point.

Uh, yeah, good point. The InfoFrames do affect both the YCbCr conversion and the transfer characteristics that the sink expects. Drivers should do the RGB to YCbCr conversion with the new matrix. I think (and very much hope) that drivers don't rely on the TF for any internal processing but if they did, they also should use the one the sink expects.

Oh, is transfer function also somehow associated here? That would be a third thing. Are there any "Colorspace" values that target a display with not gamma 2.2 TF (possibly extended/mirrored)?

The only TF metadata control I've known so far is the one in HDR_OUTPUT_METADATA.

Thanks,
pq

#6 lore raw
In reply to Sebastian Wick
Quoted 34 lines · Sebastian Wick
Quoted 33 lines · Pekka Paalanen
Quoted 14 lines · On Fri, 9 Feb 2024 17:53:07 +0100 Xaver Hugl <[email protected]> wrote:
---
 drivers/gpu/drm/drm_connector.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/drm_connector.c +1 -0
index b0516505f7ae..01e13984629b 100644
@@ -2158,6 +2158,14 @@ EXPORT_SYMBOL(drm_mode_create_aspect_ratio_property);
  *     one supported. Sink supported colorspaces should be retrieved by
  *     userspace from EDID and driver will not explicitly expose them.
  *
+ *     As userspace can't currently know whether or not the output is using

drivers/gpu/drm/drm_connector.c EXPORT_SYMBOL(drm_mode_create_aspect_ratio_property); · line 2171

Quoted 10 lines
drivers/gpu/drm/drm_connector.c +7 -0
+ *     RGB or YCC signalling, the driver must translate properties to their
+ *     relevant RGB or YCC counterparts, depending on the actually used
+ *     signalling. Property values that are only valid for either YCC or RGB
+ *     and have no equivalent for the other signalling type must not be
+ *     exposed as supported, unless the driver can guarantee it never uses
+ *     the signalling that doesn't match the property.
+ *
  *     Basically the expectation from userspace is:
  *      - Set up CRTC DEGAMMA/CTM/GAMMA to convert to some sink
  *        colorspace

While this addition is good, I have another question:

Does "Colorspace" property choose also the RGB->YCbCr matrix that the driver will use when it happens to use YCbCr signalling?

Quoted 7 lines
Quoted 1 line

So far we have only been talking about the primaries and white point.

Uh, yeah, good point. The InfoFrames do affect both the YCbCr conversion and the transfer characteristics that the sink expects. Drivers should do the RGB to YCbCr conversion with the new matrix. I think (and very much hope) that drivers don't rely on the TF for any internal processing but if they did, they also should use the one the sink expects.

What we need is:
- list of the property values that are still allowd (the ones that still make sense with the changed semantics)
- mark all the other ones as deprecated
- filter/reject the deprecated values when creating the property
- document each valid enum value fully (for both RGB and YCbCr output):
* what exacly is signalled to the sink via infoframe/msa/vsc sdp
* what processing is the driver expected to perform on the actual data

Signature · 2 lines
Ville Syrjälä
Intel
#7 lore raw
Quoted 43 lines · Ville Syrjälä
Quoted 34 lines · Sebastian Wick
Quoted 33 lines · Pekka Paalanen
Quoted 14 lines · On Fri, 9 Feb 2024 17:53:07 +0100 Xaver Hugl <[email protected]> wrote:
---
 drivers/gpu/drm/drm_connector.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/drm_connector.c +1 -0
index b0516505f7ae..01e13984629b 100644
@@ -2158,6 +2158,14 @@ EXPORT_SYMBOL(drm_mode_create_aspect_ratio_property);
  *     one supported. Sink supported colorspaces should be retrieved by
  *     userspace from EDID and driver will not explicitly expose them.
  *
+ *     As userspace can't currently know whether or not the output is using

drivers/gpu/drm/drm_connector.c EXPORT_SYMBOL(drm_mode_create_aspect_ratio_property); · line 2171

Quoted 10 lines
drivers/gpu/drm/drm_connector.c +7 -0
+ *     RGB or YCC signalling, the driver must translate properties to their
+ *     relevant RGB or YCC counterparts, depending on the actually used
+ *     signalling. Property values that are only valid for either YCC or RGB
+ *     and have no equivalent for the other signalling type must not be
+ *     exposed as supported, unless the driver can guarantee it never uses
+ *     the signalling that doesn't match the property.
+ *
  *     Basically the expectation from userspace is:
  *      - Set up CRTC DEGAMMA/CTM/GAMMA to convert to some sink
  *        colorspace

While this addition is good, I have another question:

Does "Colorspace" property choose also the RGB->YCbCr matrix that the driver will use when it happens to use YCbCr signalling?

Quoted 7 lines
Quoted 1 line

So far we have only been talking about the primaries and white point.

Uh, yeah, good point. The InfoFrames do affect both the YCbCr conversion and the transfer characteristics that the sink expects. Drivers should do the RGB to YCbCr conversion with the new matrix. I think (and very much hope) that drivers don't rely on the TF for any internal processing but if they did, they also should use the one the sink expects.

Quoted 8 lines

What we need is:
- list of the property values that are still allowd (the ones that still make sense with the changed semantics)
- mark all the other ones as deprecated
- filter/reject the deprecated values when creating the property
- document each valid enum value fully (for both RGB and YCbCr output):
* what exacly is signalled to the sink via infoframe/msa/vsc sdp
* what processing is the driver expected to perform on the actual data

I'm starting to agree that this is a better idea than coming up with a number of rules. We only rely on the default colorimetry as indicated by EDID and BT.2020.

Xaver, are you going to update the patch accordingly?

Quoted 4 lines
Signature · 2 lines
Ville Syrjälä
Intel