summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/drm_crtc.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2016-06-09 12:20:11 +1000
committerDave Airlie <airlied@redhat.com>2016-06-09 12:20:11 +1000
commit3c85f20a289d044f303f473ee6ab7502303fc3b0 (patch)
tree016657e9d62b77a3c7f237e58346bd6a7ab8cc6e /drivers/gpu/drm/drm_crtc.c
parent76c6dccf34413ca460372fde027bedcdc2f59f86 (diff)
parent492a426a2fc531774356e05f1ad87ab49e80156c (diff)
Merge tag 'omapdrm-4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux into drm-next
omapdrm changes for 4.8 * Update MAINTAINERS file for omapdrm and tilcdc * PLL refactoring to allow versatile use of the PLL clocks * Public omapdss header refactoring to separate omapfb and omapdrm * Gamma table support * Support reset GPIO and vcc regulator in omapdrm's panel-dpi * Minor cleanups * tag 'omapdrm-4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux: (69 commits) drm/omapdrm: Implement gamma_lut atomic crtc properties drm/omapdrm: Workaround for errata i734 (LCD1 Gamma) in DSS dispc drm/omapdrm: Add gamma table support to DSS dispc drm: drm_helper_crtc_enable_color_mgmt() => drm_crtc_enable_color_mgmt() drm/omap: rename panel/encoder Kconfig names drm: omapdrm: add DSI mapping drm: omapdrm: Remove unused omap_framebuffer_bo function drm: omapdrm: Remove unused omap_gem_tiled_size function drm: omapdrm: panel-lgphilips-lb035q02: Remove unused backlight GPIO drm/omap: panel-dpi: implement support for a vcc regulator drm/omap: panel-dpi: make (limited) use of a reset gpio devicetree/bindings: add reset-gpios and vcc-supply for panel-dpi MAINTAINERS: Add maintainer for TI LCDC DRM driver MAINTAINERS: Add maintainer for OMAP DRM driver drm/omap: fix pitch round-up drm/omap: remove align_pitch() drm/omap: remove unnecessary pitch round-up drm/omap: remove unneeded gpio includes drm/omap: Remove the video/omapdss.h and move it's content to local header file [media] omap_vout: Switch to use the video/omapfb_dss.h header file ...
Diffstat (limited to 'drivers/gpu/drm/drm_crtc.c')
-rw-r--r--drivers/gpu/drm/drm_crtc.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index a4e259524e11..df91dfe506eb 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -6023,3 +6023,48 @@ struct drm_tile_group *drm_mode_create_tile_group(struct drm_device *dev,
return tg;
}
EXPORT_SYMBOL(drm_mode_create_tile_group);
+
+/**
+ * drm_crtc_enable_color_mgmt - enable color management properties
+ * @crtc: DRM CRTC
+ * @degamma_lut_size: the size of the degamma lut (before CSC)
+ * @has_ctm: whether to attach ctm_property for CSC matrix
+ * @gamma_lut_size: the size of the gamma lut (after CSC)
+ *
+ * This function lets the driver enable the color correction
+ * properties on a CRTC. This includes 3 degamma, csc and gamma
+ * properties that userspace can set and 2 size properties to inform
+ * the userspace of the lut sizes. Each of the properties are
+ * optional. The gamma and degamma properties are only attached if
+ * their size is not 0 and ctm_property is only attached if has_ctm is
+ * true.
+ */
+void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc,
+ uint degamma_lut_size,
+ bool has_ctm,
+ uint gamma_lut_size)
+{
+ struct drm_device *dev = crtc->dev;
+ struct drm_mode_config *config = &dev->mode_config;
+
+ if (degamma_lut_size) {
+ drm_object_attach_property(&crtc->base,
+ config->degamma_lut_property, 0);
+ drm_object_attach_property(&crtc->base,
+ config->degamma_lut_size_property,
+ degamma_lut_size);
+ }
+
+ if (has_ctm)
+ drm_object_attach_property(&crtc->base,
+ config->ctm_property, 0);
+
+ if (gamma_lut_size) {
+ drm_object_attach_property(&crtc->base,
+ config->gamma_lut_property, 0);
+ drm_object_attach_property(&crtc->base,
+ config->gamma_lut_size_property,
+ gamma_lut_size);
+ }
+}
+EXPORT_SYMBOL(drm_crtc_enable_color_mgmt);