[RFC PATCH v3 18/23] drm/colorop: Add 3x4 CTM type

Pekka Paalanen ppaalanen at gmail.com
Fri Dec 8 12:39:41 UTC 2023


On Wed, 8 Nov 2023 11:36:37 -0500
Harry Wentland <harry.wentland at amd.com> wrote:

> This type is used to support a 3x4 matrix in colorops. A 3x4
> matrix uses the last column as a "bias" column. Some HW exposes
> support for 3x4. The calculation looks like:
> 
>  out   matrix    in
>  |R|   |0  1  2  3 |   | R |
>  |G| = |4  5  6  7 | x | G |
>  |B|   |8  9  10 12|   | B |
>                        |1.0|
> 

The bottom-right element should be 11, not 12.

> This is also the first colorop where we need a blob property to
> program the property. For that we'll introduce a new DATA
> property that can be used by all colorop TYPEs requiring a
> blob. The way a DATA blob is read depends on the TYPE of
> the colorop.
> 
> We only create the DATA property for property types that
> need it.
> 
> Signed-off-by: Harry Wentland <harry.wentland at amd.com>
> ---
>  drivers/gpu/drm/drm_atomic_uapi.c | 30 ++++++++++++++++++++++++++++++
>  drivers/gpu/drm/drm_colorop.c     | 16 ++++++++++++++++
>  include/drm/drm_colorop.h         | 19 +++++++++++++++++++
>  include/uapi/drm/drm_mode.h       | 19 ++++++++++++++++++-
>  4 files changed, 83 insertions(+), 1 deletion(-)

...

> diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
> index 0ebf0f480dc8..b5d4dd5660d9 100644
> --- a/include/uapi/drm/drm_mode.h
> +++ b/include/uapi/drm/drm_mode.h
> @@ -847,6 +847,22 @@ struct drm_color_ctm {
>  	__u64 matrix[9];
>  };
>  
> +struct drm_color_ctm_3x4 {
> +	/*
> +	 * Conversion matrix with 3x4 dimensions in S31.32 sign-magnitude
> +	 * (not two's complement!) format.
> +	 *
> +	 * TODO what's the format?
> +	 *
> +	 * out   matrix          in
> +	 * |R|   |0  1  2  3 |   | R |
> +	 * |G| = |4  5  6  7 | x | G |
> +	 * |B|   |8  9  10 12|   | B |
> +	 *                       |1.0|
> +	 */

Again 11, not 12.


Thanks,
pq

> +	__u64 matrix[12];
> +};
> +
>  struct drm_color_lut {
>  	/*
>  	 * Values are mapped linearly to 0.0 - 1.0 range, with 0x0 == 0.0 and
> @@ -859,7 +875,8 @@ struct drm_color_lut {
>  };
>  
>  enum drm_colorop_type {
> -	DRM_COLOROP_1D_CURVE
> +	DRM_COLOROP_1D_CURVE,
> +	DRM_COLOROP_CTM_3X4,
>  };
>  
>  /**

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20231208/54201b3c/attachment-0001.sig>


More information about the wayland-devel mailing list