From: "Lankhorst, Maarten" <maarten.lankhorst@intel.com>
To: "Shankar, Uma" <uma.shankar@intel.com>,
"intel-gfx@lists.freedesktop.org"
<intel-gfx@lists.freedesktop.org>
Cc: "Syrjala, Ville" <ville.syrjala@intel.com>
Subject: Re: [v6 01/16] drm: Add Enhanced Gamma LUT precision structure
Date: Wed, 27 Mar 2019 12:12:43 +0000 [thread overview]
Message-ID: <1553688761.2524.7.camel@intel.com> (raw)
In-Reply-To: <1552985064-11974-2-git-send-email-uma.shankar@intel.com>
[-- Attachment #1.1: Type: text/plain, Size: 3436 bytes --]
tis 2019-03-19 klockan 14:14 +0530 skrev Uma Shankar:
> Existing LUT precision structure is having only 16 bit
> precision. This is not enough for upcoming enhanced hardwares
> and advance usecases like HDR processing. Hence added a new
> structure with 32 bit precision values. Also added the code,
> for extracting the same from values passed from userspace.
>
> v4: Rebase
>
> v5: Relocated the helper function to drm_color_mgmt.c. Declared
> the same in a header file (Alexandru Gheorghe)
>
> v6: Enhanced gamma lut structure to take U32.32 format as input.
> This is needed for HDR usecase which require higher precision.
>
> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> Reviewed-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
> ---
> drivers/gpu/drm/drm_color_mgmt.c | 19 +++++++++++++++++++
> include/drm/drm_color_mgmt.h | 1 +
> include/uapi/drm/drm_mode.h | 15 +++++++++++++++
> 3 files changed, 35 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_color_mgmt.c
> b/drivers/gpu/drm/drm_color_mgmt.c
> index d5d34d0..9dbfe1d 100644
> --- a/drivers/gpu/drm/drm_color_mgmt.c
> +++ b/drivers/gpu/drm/drm_color_mgmt.c
> @@ -128,6 +128,25 @@ uint32_t drm_color_lut_extract(uint32_t
> user_input, uint32_t bit_precision)
> }
> EXPORT_SYMBOL(drm_color_lut_extract);
>
> +/*
> + * Added to accommodate enhanced LUT precision.
> + * Max LUT precision is 32 bits.
> + */
> +u64 drm_color_lut_extract_ext(u64 user_input, u32 bit_precision)
> +{
> + u32 val = user_input & 0xffffffff;
> + u32 max = 0xffffffff >> (32 - bit_precision);
> +
> + /* Round only if we're not using full precision. */
> + if (bit_precision < 32) {
> + val += 1UL << (32 - bit_precision - 1);
> + val >>= 32 - bit_precision;
> + }
> +
> + return ((user_input & 0xffffffff) | clamp_val(val, 0, max));
I thought the userspace precision was U32.32, so the precision here is
max 64-bits?
Anyway the math looks wrong for a U32.32 value, it's probably:
user_input >> (64ULL - precision)
> +}
> +EXPORT_SYMBOL(drm_color_lut_extract_ext);
> +
> /**
> * drm_crtc_enable_color_mgmt - enable color management properties
> * @crtc: DRM CRTC
> diff --git a/include/drm/drm_color_mgmt.h
> b/include/drm/drm_color_mgmt.h
> index d1c662d..c9d2746 100644
> --- a/include/drm/drm_color_mgmt.h
> +++ b/include/drm/drm_color_mgmt.h
> @@ -30,6 +30,7 @@
> struct drm_plane;
>
> uint32_t drm_color_lut_extract(uint32_t user_input, uint32_t
> bit_precision);
> +u64 drm_color_lut_extract_ext(u64 user_input, u32 bit_precision);
>
> void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc,
> uint degamma_lut_size,
> diff --git a/include/uapi/drm/drm_mode.h
> b/include/uapi/drm/drm_mode.h
> index a439c2e..a0fae71 100644
> --- a/include/uapi/drm/drm_mode.h
> +++ b/include/uapi/drm/drm_mode.h
> @@ -630,6 +630,21 @@ struct drm_color_lut {
> __u16 reserved;
> };
>
> +/*
> + * Creating 64 bit palette entries for better data
> + * precision. This will be required for HDR and
> + * similar color processing usecases.
> + */
> +struct drm_color_lut_ext {
> + /*
> + * Data is U32.32 fixed point format.
> + */
> + __u64 red;
> + __u64 green;
> + __u64 blue;
> + __u64 reserved;
> +};
> +
> #define DRM_MODE_PAGE_FLIP_EVENT 0x01
> #define DRM_MODE_PAGE_FLIP_ASYNC 0x02
> #define DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE 0x4
[-- Attachment #1.2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 3282 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2019-03-27 12:12 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-19 8:44 [v6 00/16] Add Plane Color Properties Uma Shankar
2019-03-19 8:44 ` [v6 01/16] drm: Add Enhanced Gamma LUT precision structure Uma Shankar
2019-03-27 12:12 ` Lankhorst, Maarten [this message]
2019-03-28 13:49 ` Shankar, Uma
2019-03-19 8:44 ` [v6 02/16] drm: Add Plane Degamma properties Uma Shankar
2019-03-19 19:09 ` kbuild test robot
2019-03-19 8:44 ` [v6 03/16] drm: Add Plane CTM property Uma Shankar
2019-03-19 22:45 ` kbuild test robot
2019-03-19 8:44 ` [v6 04/16] drm: Add Plane Gamma properties Uma Shankar
2019-03-20 2:36 ` kbuild test robot
2019-03-19 8:44 ` [v6 05/16] drm: Define helper function for plane color enabling Uma Shankar
2019-03-19 8:44 ` [v6 06/16] drm/i915: Enable plane color features Uma Shankar
2019-03-19 8:44 ` [v6 07/16] drm/i915: Implement Plane Gamma for Bdw and Gen9 platforms Uma Shankar
2019-03-19 8:44 ` [v6 08/16] drm/i915: Load plane color luts from atomic flip Uma Shankar
2019-03-19 8:44 ` [v6 09/16] drm/i915: Add plane color capabilities Uma Shankar
2019-03-19 8:44 ` [v6 10/16] drm/i915/icl: Add ICL Plane Degamma Register definition Uma Shankar
2019-03-25 17:36 ` Matt Roper
2019-03-26 13:59 ` Shankar, Uma
2019-03-19 8:44 ` [v6 11/16] drm/i915/icl: Enable Plane Degamma Uma Shankar
2019-03-19 19:31 ` kbuild test robot
2019-03-19 8:44 ` [v6 12/16] drm/i915/icl: Add Plane Gamma Register Definitions Uma Shankar
2019-03-19 8:44 ` [v6 13/16] drm/i915/icl: Implement Plane Gamma Uma Shankar
2019-03-19 8:44 ` [v6 14/16] drm/i915: Enable Plane Gamma/Degamma Uma Shankar
2019-03-19 8:44 ` [v6 15/16] drm/i915: Define Plane CSC Registers Uma Shankar
2019-03-19 8:44 ` [v6 16/16] drm/i915: Enable Plane CSC Uma Shankar
2019-03-19 9:06 ` ✗ Fi.CI.CHECKPATCH: warning for Add Plane Color Properties (rev6) Patchwork
2019-03-19 9:16 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-03-19 9:25 ` ✓ Fi.CI.BAT: success " Patchwork
2019-03-19 17:12 ` ✓ Fi.CI.IGT: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1553688761.2524.7.camel@intel.com \
--to=maarten.lankhorst@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=uma.shankar@intel.com \
--cc=ville.syrjala@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox