>-----Original Message----- >From: Sharma, Swati2 >Sent: Monday, August 26, 2019 11:56 AM >To: intel-gfx@xxxxxxxxxxxxxxxxxxxxx >Cc: Nikula, Jani <jani.nikula@xxxxxxxxx>; Sharma, Shashank ><shashank.sharma@xxxxxxxxx>; Manna, Animesh <animesh.manna@xxxxxxxxx>; >Nautiyal, Ankit K <ankit.k.nautiyal@xxxxxxxxx>; daniel.vetter@xxxxxxxx; >ville.syrjala@xxxxxxxxxxxxxxx; Shankar, Uma <uma.shankar@xxxxxxxxx>; Sharma, >Swati2 <swati2.sharma@xxxxxxxxx> >Subject: [v8][PATCH 03/10] drm/i915/display: Add func to compare hw/sw gamma lut > >Add func intel_color_lut_equal() to compare hw/sw gamma lut values. Since hw/sw >gamma lut sizes and lut enteries comparsion will be different for different gamma Typo here in entries and comparison. >modes, add gamma mode dependent checks. Please keep the revision history of patch as well. Also add what is changed from the previous version, like limiting to gamma mode alone. >Signed-off-by: Swati Sharma <swati2.sharma@xxxxxxxxx> >--- > drivers/gpu/drm/i915/display/intel_color.c | 71 ++++++++++++++++++++++++++++++ >drivers/gpu/drm/i915/display/intel_color.h | 6 +++ > 2 files changed, 77 insertions(+) > >diff --git a/drivers/gpu/drm/i915/display/intel_color.c >b/drivers/gpu/drm/i915/display/intel_color.c >index d2c1297..27727a1 100644 >--- a/drivers/gpu/drm/i915/display/intel_color.c >+++ b/drivers/gpu/drm/i915/display/intel_color.c >@@ -1450,6 +1450,77 @@ int intel_color_get_gamma_bit_precision(const struct >intel_crtc_state *crtc_stat > return 0; > } > >+static inline bool err_check(struct drm_color_lut *sw_lut, >+ struct drm_color_lut *hw_lut, u32 err) { >+ return ((abs((long)hw_lut->red - sw_lut->red)) <= err) && >+ ((abs((long)hw_lut->blue - sw_lut->blue)) <= err) && >+ ((abs((long)hw_lut->green - sw_lut->green)) <= err); } >+ >+static inline bool intel_color_lut_entry_equal(struct drm_color_lut *sw_lut, >+ struct drm_color_lut *hw_lut, >+ int hw_lut_size, u32 err) >+{ >+ int i; >+ >+ for (i = 0; i < hw_lut_size; i++) { >+ if (!err_check(&hw_lut[i], &sw_lut[i], err)) >+ return false; >+ } >+ >+ return true; >+} >+ >+bool intel_color_lut_equal(struct drm_property_blob *blob1, >+ struct drm_property_blob *blob2, >+ u32 gamma_mode, u32 bit_precision) { >+ struct drm_color_lut *sw_lut, *hw_lut; >+ int sw_lut_size, hw_lut_size; >+ u32 err; >+ >+ if (!blob1 != !blob2) >+ return false; >+ >+ if (!blob1) >+ return true; >+ >+ sw_lut_size = drm_color_lut_size(blob1); >+ hw_lut_size = drm_color_lut_size(blob2); >+ >+ switch (gamma_mode) { >+ case GAMMA_MODE_MODE_8BIT: >+ case GAMMA_MODE_MODE_10BIT: >+ if (sw_lut_size != hw_lut_size) >+ return false; >+ else You may drop else, just simply put break. >+ break; >+ default: >+ MISSING_CASE(gamma_mode); >+ return false; >+ } >+ >+ sw_lut = blob1->data; >+ hw_lut = blob2->data; >+ >+ err = 0xffff >> bit_precision; >+ >+ switch (gamma_mode) { >+ case GAMMA_MODE_MODE_8BIT: >+ case GAMMA_MODE_MODE_10BIT: >+ if (!intel_color_lut_entry_equal(sw_lut, hw_lut, hw_lut_size, err)) Limit it within 80 characters. >+ return false; >+ else >+ break; Drop else here as well. Indentation also seems off. >+ default: >+ MISSING_CASE(gamma_mode); >+ return false; >+ } >+ >+ return true; >+} >+ > void intel_color_init(struct intel_crtc *crtc) { > struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); diff --git >a/drivers/gpu/drm/i915/display/intel_color.h >b/drivers/gpu/drm/i915/display/intel_color.h >index 0226d3a..173727a 100644 >--- a/drivers/gpu/drm/i915/display/intel_color.h >+++ b/drivers/gpu/drm/i915/display/intel_color.h >@@ -6,8 +6,11 @@ > #ifndef __INTEL_COLOR_H__ > #define __INTEL_COLOR_H__ > >+#include <linux/types.h> >+ > struct intel_crtc_state; > struct intel_crtc; >+struct drm_property_blob; > > void intel_color_init(struct intel_crtc *crtc); int intel_color_check(struct >intel_crtc_state *crtc_state); @@ -15,5 +18,8 @@ void intel_color_load_luts(const >struct intel_crtc_state *crtc_state); void intel_color_get_config(struct >intel_crtc_state *crtc_state); int intel_color_get_gamma_bit_precision(const struct >intel_crtc_state *crtc_state); >+bool intel_color_lut_equal(struct drm_property_blob *blob1, >+ struct drm_property_blob *blob2, >+ u32 gamma_mode, u32 bit_precision); > > #endif /* __INTEL_COLOR_H__ */ >-- >1.9.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx