[Intel-gfx] [PATCH v8 25/25] drm/i915: Commit color correction only when needed

Shashank Sharma shashank.sharma at intel.com
Thu Dec 3 03:37:01 PST 2015


This patch optimizes the commit path for i915 driver, by applying
color corrections, only when required. Pipe level color correction
(like CSC/gamma/degamma) once applied, sustain until the next change.

DRM layer sets a flag in crtc state (color_correction_changed),
whenever there is new set_property call. Apply color correction
from the commit layer, only when this flag is set, else pass.

Signed-off-by: Shashank Sharma <shashank.sharma at intel.com>
---
 drivers/gpu/drm/i915/intel_color_manager.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_color_manager.c b/drivers/gpu/drm/i915/intel_color_manager.c
index dbefc12..a53cb96 100644
--- a/drivers/gpu/drm/i915/intel_color_manager.c
+++ b/drivers/gpu/drm/i915/intel_color_manager.c
@@ -751,6 +751,15 @@ void intel_color_manager_crtc_commit(struct drm_device *dev,
 	struct drm_crtc *crtc = crtc_state->crtc;
 	int ret = -EINVAL;
 
+	/*
+	* CRTC level color correction, once applied on the
+	* pipe, goes on forever, until disabled, so there is no
+	* need to program all those correction registers on every
+	* commit. Do this only when a new correction applied.
+	*/
+	if (!crtc_state->color_correction_changed)
+		return;
+
 	blob = crtc_state->palette_after_ctm_blob;
 	if (blob) {
 		/* Gamma correction is platform specific */
@@ -792,6 +801,8 @@ void intel_color_manager_crtc_commit(struct drm_device *dev,
 		else
 			DRM_DEBUG_DRIVER("CSC correction success\n");
 	}
+
+	crtc_state->color_correction_changed = false;
 }
 
 void intel_attach_color_properties_to_crtc(struct drm_device *dev,
-- 
1.9.1



More information about the Intel-gfx mailing list