Skip to contentSkip to conversation

drm/color: Include CTM equations in kerneldoc

PATCH In review Brian Starkey 3 participants 6 messages Jan 27, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/color: Include CTM equations in kerneldoc

Explicitly state the expected CTM equations in the kerneldoc for the CTM property.

Cc Ville Syrjälä <[email protected]>
Cc Lionel Landwerlin <[email protected]>
Cc Daniel Vetter <[email protected]>

---

Hi,

This captures the outcome of the discussion on #dri-devel yesterday (2017-01-26):
https://people.freedesktop.org/~cbrill/dri-log/?channel=dri-devel&date=2017-01-26

I'm not sure about the stance on such explicit rst markup in kerneldoc, but without it the equations are pretty unreadable in the rendered output.

Cheers,
Brian

 drivers/gpu/drm/drm_color_mgmt.c |   10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/gpu/drm/drm_color_mgmt.c +10 -0
index 789b4c65cd69..63f3a7404fa1 100644
@@ -62,6 +62,16 @@
  *	unit/pass-thru matrix should be used. This is generally the driver
  *	boot-up state too.
  *
+ *	Given an input vector ``in[3]`` and an output vector ``out[3]``, the
+ *	transformation applied is:
+ *
+ *	| ``out[0] = matrix[0] * in[0] + matrix[1] * in[1] + matrix[2] * in[2];``
+ *	| ``out[1] = matrix[3] * in[0] + matrix[4] * in[1] + matrix[5] * in[2];``
+ *	| ``out[2] = matrix[6] * in[0] + matrix[7] * in[1] + matrix[8] * in[2];``
+ *
+ *	| For RGB formats, the input vector is assumed to be ``{ R, G, B }``.
+ *	| For YCbCr formats, the input vector is assumed to be ``{ Y, Cb, Cr }``.
+ *
  * “GAMMA_LUT”:
  *	Blob property to set the gamma lookup table (LUT) mapping pixel data
  *	after the transformation matrix to data sent to the connector. The
Signature · 6 lines
1.7.9.5

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw
Quoted 32 lines · Brian Starkey

Explicitly state the expected CTM equations in the kerneldoc for the CTM property.

Cc Ville Syrjälä <[email protected]>
Cc Lionel Landwerlin <[email protected]>
Cc Daniel Vetter <[email protected]>

---

Hi,

This captures the outcome of the discussion on #dri-devel yesterday (2017-01-26):
https://people.freedesktop.org/~cbrill/dri-log/?channel=dri-devel&date=2017-01-26

I'm not sure about the stance on such explicit rst markup in kerneldoc, but without it the equations are pretty unreadable in the rendered output.

Cheers,
Brian

 drivers/gpu/drm/drm_color_mgmt.c |   10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/gpu/drm/drm_color_mgmt.c +0 -0
index 789b4c65cd69..63f3a7404fa1 100644
@@ -62,6 +62,16 @@
  *	unit/pass-thru matrix should be used. This is generally the driver
  *	boot-up state too.

drivers/gpu/drm/drm_color_mgmt.c line 73

Quoted 10 lines
drivers/gpu/drm/drm_color_mgmt.c +9 -0
  *
+ *	Given an input vector ``in[3]`` and an output vector ``out[3]``, the
+ *	transformation applied is:
+ *
+ *	| ``out[0] = matrix[0] * in[0] + matrix[1] * in[1] + matrix[2] * in[2];``
+ *	| ``out[1] = matrix[3] * in[0] + matrix[4] * in[1] + matrix[5] * in[2];``
+ *	| ``out[2] = matrix[6] * in[0] + matrix[7] * in[1] + matrix[8] * in[2];``
+ *
+ *	| For RGB formats, the input vector is assumed to be ``{ R, G, B }``.
+ *	| For YCbCr formats, the input vector is assumed to be ``{ Y, Cb, Cr }``.

Talking about formats here could be a little confusing. One might think this has something to do with the framebuffer pixel format, when in fact it's only about the internal format used by the crtc.

And actually I don't think we can get away this easily for YCbCr since there is no way to indicate to userspace whether the pipe is internally RGB or YCbCr. Until we add a property to indicate RGB vs. YCbCr internal crtc formt (which userspace could actually set if the hardware allows it) we shouldn't even mention YCbCr. If there is hardware out there that always uses YCbCr, then I think those folks need to come up with a property to indicate that, or they'll just have to do the RGB->YCbCr conversion in the driver when populating the matrix.

Quoted 6 lines
drivers/gpu/drm/drm_color_mgmt.c +1 -0
+ *
  * “GAMMA_LUT”:
  *	Blob property to set the gamma lookup table (LUT) mapping pixel data
  *	after the transformation matrix to data sent to the connector. The
Signature · 1 line
1.7.9.5
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw
Quoted 39 lines · Ville Syrjälä
Quoted 38 lines · Brian Starkey

Explicitly state the expected CTM equations in the kerneldoc for the CTM property.

Cc Ville Syrjälä <[email protected]>
Cc Lionel Landwerlin <[email protected]>
Cc Daniel Vetter <[email protected]>

---

Hi,

This captures the outcome of the discussion on #dri-devel yesterday (2017-01-26):
https://people.freedesktop.org/~cbrill/dri-log/?channel=dri-devel&date=2017-01-26

I'm not sure about the stance on such explicit rst markup in kerneldoc, but without it the equations are pretty unreadable in the rendered output.

Cheers,
Brian

 drivers/gpu/drm/drm_color_mgmt.c |   10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/gpu/drm/drm_color_mgmt.c +5 -0
index 789b4c65cd69..63f3a7404fa1 100644
@@ -62,6 +62,16 @@
  *	unit/pass-thru matrix should be used. This is generally the driver
  *	boot-up state too.
  *
+ *	Given an input vector ``in[3]`` and an output vector ``out[3]``, the
+ *	transformation applied is:
+ *
+ *	| ``out[0] = matrix[0] * in[0] + matrix[1] * in[1] + matrix[2] * in[2];``
+ *	| ``out[1] = matrix[3] * in[0] + matrix[4] * in[1] + matrix[5] * in[2];``
Quoted 8 lines

drivers/gpu/drm/drm_color_mgmt.c line 73

Quoted 4 lines
drivers/gpu/drm/drm_color_mgmt.c +4 -0
+ *	| ``out[2] = matrix[6] * in[0] + matrix[7] * in[1] + matrix[8] * in[2];``
+ *
+ *	| For RGB formats, the input vector is assumed to be ``{ R, G, B }``.
+ *	| For YCbCr formats, the input vector is assumed to be ``{ Y, Cb, Cr }``.

Talking about formats here could be a little confusing. One might think this has something to do with the framebuffer pixel format, when in fact it's only about the internal format used by the crtc.

Ah right, yes I see.

Actually, I *was* thinking about the framebuffer format here - but that is missing the context of us adding a CTM property for each plane (so that each plane can map the framebuffer format to the CRTC pipe's internal format).

Our intention (for Mali-DP) is to add CTM on each plane to be used for framebuffer -> CRTC pipe conversion, and then use the CTM on the CRTC for CRTC pipe -> output conversion.

Shall I just remove the two lines about pixel formats here, and then when we land per-plane CTM add some details about plane CTM matrices being before the CRTC CTM matrix?

Thanks,
-Brian

Quoted 10 lines

And actually I don't think we can get away this easily for YCbCr since there is no way to indicate to userspace whether the pipe is internally RGB or YCbCr. Until we add a property to indicate RGB vs. YCbCr internal crtc formt (which userspace could actually set if the hardware allows it) we shouldn't even mention YCbCr. If there is hardware out there that always uses YCbCr, then I think those folks need to come up with a property to indicate that, or they'll just have to do the RGB->YCbCr conversion in the driver when populating the matrix.

Quoted 10 lines
Quoted 6 lines
drivers/gpu/drm/drm_color_mgmt.c +1 -1
+ *
  * “GAMMA_LUT”:
  *	Blob property to set the gamma lookup table (LUT) mapping pixel data
  *	after the transformation matrix to data sent to the connector. The
--

1.7.9.5

Signature · 2 lines
Ville Syrjälä
Intel OTC

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw
Quoted 56 lines · Brian Starkey
Quoted 39 lines · Ville Syrjälä
Quoted 38 lines · Brian Starkey

Explicitly state the expected CTM equations in the kerneldoc for the CTM property.

Cc Ville Syrjälä <[email protected]>
Cc Lionel Landwerlin <[email protected]>
Cc Daniel Vetter <[email protected]>

---

Hi,

This captures the outcome of the discussion on #dri-devel yesterday (2017-01-26):
https://people.freedesktop.org/~cbrill/dri-log/?channel=dri-devel&date=2017-01-26

I'm not sure about the stance on such explicit rst markup in kerneldoc, but without it the equations are pretty unreadable in the rendered output.

Cheers,
Brian

 drivers/gpu/drm/drm_color_mgmt.c |   10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/gpu/drm/drm_color_mgmt.c +5 -0
index 789b4c65cd69..63f3a7404fa1 100644
@@ -62,6 +62,16 @@
  *	unit/pass-thru matrix should be used. This is generally the driver
  *	boot-up state too.
  *
+ *	Given an input vector ``in[3]`` and an output vector ``out[3]``, the
+ *	transformation applied is:
+ *
+ *	| ``out[0] = matrix[0] * in[0] + matrix[1] * in[1] + matrix[2] * in[2];``
+ *	| ``out[1] = matrix[3] * in[0] + matrix[4] * in[1] + matrix[5] * in[2];``
Quoted 8 lines

drivers/gpu/drm/drm_color_mgmt.c line 73

Quoted 4 lines
drivers/gpu/drm/drm_color_mgmt.c +4 -0
+ *	| ``out[2] = matrix[6] * in[0] + matrix[7] * in[1] + matrix[8] * in[2];``
+ *
+ *	| For RGB formats, the input vector is assumed to be ``{ R, G, B }``.
+ *	| For YCbCr formats, the input vector is assumed to be ``{ Y, Cb, Cr }``.

Talking about formats here could be a little confusing. One might think this has something to do with the framebuffer pixel format, when in fact it's only about the internal format used by the crtc.

Ah right, yes I see.

Actually, I *was* thinking about the framebuffer format here - but that is missing the context of us adding a CTM property for each plane (so that each plane can map the framebuffer format to the CRTC pipe's internal format).

Quoted 7 lines

Our intention (for Mali-DP) is to add CTM on each plane to be used for framebuffer -> CRTC pipe conversion, and then use the CTM on the CRTC for CRTC pipe -> output conversion.

Shall I just remove the two lines about pixel formats here, and then when we land per-plane CTM add some details about plane CTM matrices being before the CRTC CTM matrix?

We'll need to keep some note about the RGB order here. Userspace needs to know that to actually use the matrix. Oh and I guess we should really put this documentation into the uapi header.

Quoted 23 lines

Thanks,
-Brian

Quoted 20 lines

And actually I don't think we can get away this easily for YCbCr since there is no way to indicate to userspace whether the pipe is internally RGB or YCbCr. Until we add a property to indicate RGB vs. YCbCr internal crtc formt (which userspace could actually set if the hardware allows it) we shouldn't even mention YCbCr. If there is hardware out there that always uses YCbCr, then I think those folks need to come up with a property to indicate that, or they'll just have to do the RGB->YCbCr conversion in the driver when populating the matrix.

Quoted 6 lines
drivers/gpu/drm/drm_color_mgmt.c +1 -1
+ *
  * “GAMMA_LUT”:
  *	Blob property to set the gamma lookup table (LUT) mapping pixel data
  *	after the transformation matrix to data sent to the connector. The
--

1.7.9.5

Signature · 2 lines
Ville Syrjälä
Intel OTC
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw
Quoted 61 lines · Ville Syrjälä
Quoted 60 lines · Brian Starkey
Quoted 39 lines · Ville Syrjälä
Quoted 38 lines · Brian Starkey

Explicitly state the expected CTM equations in the kerneldoc for the CTM property.

Cc Ville Syrjälä <[email protected]>
Cc Lionel Landwerlin <[email protected]>
Cc Daniel Vetter <[email protected]>

---

Hi,

This captures the outcome of the discussion on #dri-devel yesterday (2017-01-26):
https://people.freedesktop.org/~cbrill/dri-log/?channel=dri-devel&date=2017-01-26

I'm not sure about the stance on such explicit rst markup in kerneldoc, but without it the equations are pretty unreadable in the rendered output.

Cheers,
Brian

 drivers/gpu/drm/drm_color_mgmt.c |   10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/gpu/drm/drm_color_mgmt.c +5 -0
index 789b4c65cd69..63f3a7404fa1 100644
@@ -62,6 +62,16 @@
  *	unit/pass-thru matrix should be used. This is generally the driver
  *	boot-up state too.
  *
+ *	Given an input vector ``in[3]`` and an output vector ``out[3]``, the
+ *	transformation applied is:
+ *
+ *	| ``out[0] = matrix[0] * in[0] + matrix[1] * in[1] + matrix[2] * in[2];``
+ *	| ``out[1] = matrix[3] * in[0] + matrix[4] * in[1] + matrix[5] * in[2];``
Quoted 8 lines

drivers/gpu/drm/drm_color_mgmt.c line 73

Quoted 4 lines
drivers/gpu/drm/drm_color_mgmt.c +4 -0
+ *	| ``out[2] = matrix[6] * in[0] + matrix[7] * in[1] + matrix[8] * in[2];``
+ *
+ *	| For RGB formats, the input vector is assumed to be ``{ R, G, B }``.
+ *	| For YCbCr formats, the input vector is assumed to be ``{ Y, Cb, Cr }``.

Talking about formats here could be a little confusing. One might think this has something to do with the framebuffer pixel format, when in fact it's only about the internal format used by the crtc.

Ah right, yes I see.

Actually, I *was* thinking about the framebuffer format here - but that is missing the context of us adding a CTM property for each plane (so that each plane can map the framebuffer format to the CRTC pipe's internal format).

Our intention (for Mali-DP) is to add CTM on each plane to be used for framebuffer -> CRTC pipe conversion, and then use the CTM on the CRTC for CRTC pipe -> output conversion.

Quoted 7 lines
Quoted 3 lines

Shall I just remove the two lines about pixel formats here, and then when we land per-plane CTM add some details about plane CTM matrices being before the CRTC CTM matrix?

We'll need to keep some note about the RGB order here. Userspace needs to know that to actually use the matrix. Oh and I guess we should really put this documentation into the uapi header.

Atm properties are documented in kernel-doc since they don't exist at all in the uapi. Well this here is somewhat an exception, since there's structs in uapi. But since nothing else in uapi thus far is reasonably documented I still think we should keep it in the kernel-doc for now. At least until someone starts taggling uapi docs properly ... -Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#5 lore raw
Quoted 70 lines · Daniel Vetter
Quoted 61 lines · Ville Syrjälä
Quoted 60 lines · Brian Starkey
Quoted 39 lines · Ville Syrjälä
Quoted 38 lines · Brian Starkey

Explicitly state the expected CTM equations in the kerneldoc for the CTM property.

Cc Ville Syrjälä <[email protected]>
Cc Lionel Landwerlin <[email protected]>
Cc Daniel Vetter <[email protected]>

---

Hi,

This captures the outcome of the discussion on #dri-devel yesterday (2017-01-26):
https://people.freedesktop.org/~cbrill/dri-log/?channel=dri-devel&date=2017-01-26

I'm not sure about the stance on such explicit rst markup in kerneldoc, but without it the equations are pretty unreadable in the rendered output.

Cheers,
Brian

 drivers/gpu/drm/drm_color_mgmt.c |   10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/gpu/drm/drm_color_mgmt.c +5 -0
index 789b4c65cd69..63f3a7404fa1 100644
@@ -62,6 +62,16 @@
  *	unit/pass-thru matrix should be used. This is generally the driver
  *	boot-up state too.
  *
+ *	Given an input vector ``in[3]`` and an output vector ``out[3]``, the
+ *	transformation applied is:
+ *
+ *	| ``out[0] = matrix[0] * in[0] + matrix[1] * in[1] + matrix[2] * in[2];``
+ *	| ``out[1] = matrix[3] * in[0] + matrix[4] * in[1] + matrix[5] * in[2];``
Quoted 8 lines

drivers/gpu/drm/drm_color_mgmt.c line 73

Quoted 4 lines
drivers/gpu/drm/drm_color_mgmt.c +4 -0
+ *	| ``out[2] = matrix[6] * in[0] + matrix[7] * in[1] + matrix[8] * in[2];``
+ *
+ *	| For RGB formats, the input vector is assumed to be ``{ R, G, B }``.
+ *	| For YCbCr formats, the input vector is assumed to be ``{ Y, Cb, Cr }``.

Talking about formats here could be a little confusing. One might think this has something to do with the framebuffer pixel format, when in fact it's only about the internal format used by the crtc.

Ah right, yes I see.

Actually, I *was* thinking about the framebuffer format here - but that is missing the context of us adding a CTM property for each plane (so that each plane can map the framebuffer format to the CRTC pipe's internal format).

Our intention (for Mali-DP) is to add CTM on each plane to be used for framebuffer -> CRTC pipe conversion, and then use the CTM on the CRTC for CRTC pipe -> output conversion.

Quoted 7 lines
Quoted 3 lines

Shall I just remove the two lines about pixel formats here, and then when we land per-plane CTM add some details about plane CTM matrices being before the CRTC CTM matrix?

We'll need to keep some note about the RGB order here. Userspace needs to know that to actually use the matrix. Oh and I guess we should really put this documentation into the uapi header.

Quoted 5 lines

Atm properties are documented in kernel-doc since they don't exist at all in the uapi. Well this here is somewhat an exception, since there's structs in uapi. But since nothing else in uapi thus far is reasonably documented I still think we should keep it in the kernel-doc for now. At least until someone starts taggling uapi docs properly ...

Ah. Makes sense to go with the flow for now.

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel