mbox series

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

Message ID 20181212010551.6337-1-matthew.d.roper@intel.com (mailing list archive)
Headers show
Series Add gamma/degamma LUT validation helpers | expand

Message

Matt Roper Dec. 12, 2018, 1:05 a.m. UTC
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(+)