[PATCH v7 25/25] drm/i915: Commit color correction only when needed

Shashank Sharma
2015-10-20T12:34:52Z

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@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 f301b4e..5196a82 100644
--- a/drivers/gpu/drm/i915/intel_color_manager.c
+++ b/drivers/gpu/drm/i915/intel_color_manager.c
@@ -745,6 +745,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 */
@@ -786,6 +795,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,