drm: add legacy support for using degamma for gamma
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Fri, 11 Dec 2020 11:42:37 +0000 (13:42 +0200)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Tue, 15 Dec 2020 13:46:03 +0000 (15:46 +0200)
commit1b8977434606f2dcd8a90ca660eb535b56945662
treec88f73abe2340fc120bd883418a03dc6b150b97d
parent6ca2ab8086af8434a4c0990882321a345c3cc2c6
drm: add legacy support for using degamma for gamma

The DRM core handles legacy gamma-set ioctl by setting GAMMA_LUT and
clearing CTM and DEGAMMA_LUT.

This works fine on HW where we have either:

degamma -> ctm -> gamma -> out

or

ctm -> gamma -> out

However, if the HW has gamma table before ctm, the atomic property
should be DEGAMMA_LUT, and thus we have:

degamma -> ctm -> out

This is fine for userspace which sets gamma table using the properties,
as the userspace can check for the existence of gamma & degamma, but the
legacy gamma-set ioctl does not work.

Change the DRM core to use DEGAMMA_LUT instead of GAMMA_LUT when the
latter is unavailable.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201211114237.213288-3-tomi.valkeinen@ti.com
drivers/gpu/drm/drm_color_mgmt.c
drivers/gpu/drm/drm_fb_helper.c