[PATCH 0/2] Add gamma/degamma LUT validation helpers

Matt Roper matthew.d.roper at intel.com
Wed Dec 12 01:05:49 UTC 2018


Some platforms require that gamma or degamma LUT's have certain
characteristics in order to be programmed into the hardware.  If a
userspace-provided LUT violates a platform's hardware requirements, we
want to be able to catch this during the atomic check and reject the
transaction rather than just silently trying to program an invalid table
into the hardware.  Let's add a couple helpers that can be called by
drivers' check functions:

 - drm_color_lut_is_increasing() checks a table to see whether
   subsequent entries are always equal to or greater than prior entries
   (i.e., the gamma ramp never decreases).
 - drm_color_lut_has_equal_channels() checks a table to see whether the
   r, g, and b channels are equal for each table entry.

On Intel, we need the first helper for the degamma table on all
platforms, and we need the second one for the degamma table on GLK and
ICL (actual degamma support for those two platforms hasn't landed yet,
but there's work in flight by Uma and Swati to add it, so we might as
well get the checks ready early).

Matt Roper (2):
  drm: Add color management LUT validation helpers
  drm/i915: Validate userspace-provided color management LUT's

 drivers/gpu/drm/drm_color_mgmt.c   | 53 ++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_color.c | 18 +++++++++++++
 include/drm/drm_color_mgmt.h       |  3 +++
 3 files changed, 74 insertions(+)

-- 
2.14.4



More information about the dri-devel mailing list