adding state checker for gamma lut values
Subsystems (2)
cover adding state checker for gamma lut values
Thanks to Jani N, Matt and Ville for the review comments. Hopefully I have addressed all the current review comments and ready to receive more :)
In this patch series, added state checker to validate gamma_lut values. This reads hardware state, and compares the originally requested state to the state read from hardware.
v1: -Implementation done for legacy platforms (removed all the placeholders) (Jani)
-Added inverse function of drm_color_lut_extract to convert hardware
read values back to user values (code written by Jani)
-Renamed get_config() to color_config() (Jani)
-Placed all platform specific shifts and masks in i915_reg.h (Jani) -Renamed i9xx_get_config to i9xx_color_config and all related
functions (Jani)
-Removed debug logs from compare function (Jani)
-Renamed intel_compare_blob to intel_compare_lut and added platform specific
bit precision of the readout into the function (Jani)
-Renamed macro PIPE_CONF_CHECK_BLOB to PIPE_CONF_CHECK_COLOR_LUT (Jani) -Added check if blobs can be NULL (Jani)
-Added function in intel_color.c that returns the bit precision (Jani),
didn't add in device info since its gonna die soon (Ville)
v2: -Moved intel_compare_lut() from intel_display.c to intel_color.c (Jani)
-Changed color_config() func names to get_color_config() and same
for gamma func too (Jani)
-Removed blank line in i915_reg.h and aligned MASK with their
register name (Jani)
-Mask definition code indented and defined using REG_GENMASK() and
used using REG_FIELD_GET() (Jani)
-Made bit_precision func inline (Jani/Matt)
-Assigned bit_precision according to GAMMA_MODE (Matt/Ville) -Changed IS_ERR(blob) condition to (!blob) (Jani) -Rearranged blob check and lut_size conditions (Jani)
-Used inline function for the comparison (Jani)
-Separated the get config part from the state checker part to
another patch (Jani)
-Retained "internal" i9xx_internal_gamma_config for consistency
(Matt)
-Removed crtc_state_is_legacy_gamma check and replaced with
GAMMA_MODE (Matt)
-Created whole platform specific patch series as submitted by Ville for
clean up intel_color_check()
-Rebased on top of Ville's changes
TODO: -Matt suggested to rename get_gamma_config to get_gamma_lut or
i9xx_read_out_gamma_lut, Ville also named functions like i9xx_read_lut_8(), i9xx_read_lut_10(). Should we follow this?
-Answering Matt's query regarding intension to read and compare degamma/ctm".
Degamma will be my first priority after this and later ctm.
Should we have combined func or separate func for gamma/degamma val?
-Add separate func to log errors. I am not sure, what needs to be printed here?
Mismatched RGB value?
-Will make changes in next rev for changes made by Ville for cherryview_load_luts()
Swati Sharma (11):
[v2] drm/i915: Introduce vfunc intel_get_color_config to create hw lut [v2] drm/i915: Extract i9xx_get_color_config()
[v2] drm/i915: Extract cherryview_get_color_config()
[v2] drm/i915: Extract i965_get_color_config()
[v2] drm/i915: Extract icl_get_color_config()
[v2] drm/i915: Extract glk_get_color_config()
[v2] drm/i915: Extract bdw_get_color_config()
[v2] drm/i915: Extract ivb_get_color_config()
[v2] drm/i915: Extract ilk_get_color_config()
[v2] drm/i915: Enable intel_get_color_config()
[v2] drm/i915: Add intel_compare_color_lut() to compare hw and sw
gamma lut values
drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_reg.h | 15 ++ drivers/gpu/drm/i915/intel_color.c | 347 ++++++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_display.c | 13 ++ drivers/gpu/drm/i915/intel_drv.h | 4 + 5 files changed, 375 insertions(+), 5 deletions(-)
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 1/11 drm/i915: Introduce vfunc intel_get_color_config to create hw lut
--- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/intel_color.c | 7 +++++++ drivers/gpu/drm/i915/intel_drv.h | 1 + 3 files changed, 9 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +1 -0
@@ -341,6 +341,7 @@ struct drm_i915_display_funcs {* involved with the same commit. */ void (*load_luts)(const struct intel_crtc_state *crtc_state); +void (*get_color_config)(struct intel_crtc_state *crtc_state); };#define CSR_VERSION (major, minor) ((major) << 16 | (minor))
drivers/gpu/drm/i915/intel_color.c +7 -0
@@ -856,6 +856,13 @@ int intel_color_check(struct intel_crtc_state *crtc_state)return dev_priv->display.color_check (crtc_state); } +void intel_get_color_config (struct intel_crtc_state *crtc_state) +{ +struct drm_i915_private *dev_priv =to_i915 (crtc_state->base.crtc->dev); + + dev_priv->display.get_color_config (crtc_state); +} +static bool need_plane_update (struct intel_plane *plane,const struct intel_crtc_state *crtc_state) {
drivers/gpu/drm/i915/intel_drv.h +1 -0
@@ -2553,6 +2553,7 @@ int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_int intel_color_check (struct intel_crtc_state *crtc_state);void intel_color_commit (const struct intel_crtc_state *crtc_state);void intel_color_load_luts (const struct intel_crtc_state *crtc_state); +void intel_get_color_config (struct intel_crtc_state *crtc_state);/* intel_lspcon.c */ bool lspcon_init (struct intel_digital_port *intel_dig_port);
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 2/11 drm/i915: Extract i9xx_get_color_config()
In reply to Swati Sharma--- drivers/gpu/drm/i915/i915_reg.h | 3 +++ drivers/gpu/drm/i915/intel_color.c | 51 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +3 -0
@@ -7211,6 +7211,9 @@ enum {/* legacy palette */ #define _LGC_PALETTE_A 0x4a000#define _LGC_PALETTE_B 0x4a800 +#define LGC_PALETTE_RED_MASK REG_GENMASK(23, 16) +#define LGC_PALETTE_GREEN_MASK REG_GENMASK(15, 8) +#define LGC_PALETTE_BLUE_MASK REG_GENMASK(7, 0)#define LGC_PALETTE (pipe, i) _MMIO(_PIPE(pipe, _LGC_PALETTE_A, _LGC_PALETTE_B) + (i) * 4)/* ilk/snb precision palette */
drivers/gpu/drm/i915/intel_color.c +51 -0
63 lines not on this page · raw message
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 3/11 drm/i915: Extract cherryview_get_color_config()
In reply to Swati Sharma--- drivers/gpu/drm/i915/i915_reg.h | 3 +++ drivers/gpu/drm/i915/intel_color.c | 39 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +3 -0
@@ -10187,6 +10187,9 @@ enum skl_power_gate {#define CGM_PIPE_MODE_GAMMA (1 << 2)#define CGM_PIPE_MODE_CSC (1 << 1)#define CGM_PIPE_MODE_DEGAMMA (1 << 0) +#define CGM_PIPE_GAMMA_RED_MASK REG_GENMASK(9, 0) +#define CGM_PIPE_GAMMA_GREEN_MASK REG_GENMASK(25, 16) +#define CGM_PIPE_GAMMA_BLUE_MASK REG_GENMASK(9, 0)#define _CGM_PIPE_B_CSC_COEFF01 (VLV_DISPLAY_BASE + 0x69900)#define _CGM_PIPE_B_CSC_COEFF23 (VLV_DISPLAY_BASE + 0x69904)
drivers/gpu/drm/i915/intel_color.c +39 -0
@@ -1277,6 +1277,44 @@ static void i9xx_get_color_config(struct intel_crtc_state *crtc_state)i9xx_get_config_internal (crtc_state); } +static void cherryview_get_gamma_config (struct intel_crtc_state *crtc_state) +{ +struct intel_crtc *crtc =to_intel_crtc (crtc_state->base.crtc); +struct drm_device *dev = crtc->base.dev; +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev); +u32 i, val, lut_size =INTEL_INFO (dev_priv)->color.gamma_lut_size; +enum pipe pipe = crtc->pipe; +struct drm_property_blob *blob =NULL ; +struct drm_color_lut *blob_data; + + blob =drm_property_create_blob (dev, +sizeof (struct drm_color_lut ) *256 , +NULL ); +if (IS_ERR (blob)) +return ; + + blob_data = blob->data; + +for (i =0 ; i < lut_size; i++) { + val =I915_READ (CGM_PIPE_GAMMA (pipe, i,0 )); + blob_data[i].green =intel_color_lut_pack (REG_FIELD_GET (CGM_PIPE_GAMMA_GREEN_MASK , val) >>16 ,10 ); + blob_data[i].blue =intel_color_lut_pack (REG_FIELD_GET (CGM_PIPE_GAMMA_BLUE_MASK , val),10 ); + + val =I915_READ (CGM_PIPE_GAMMA (pipe, i,1 )); + blob_data[i].red =intel_color_lut_pack (REG_FIELD_GET (CGM_PIPE_GAMMA_RED_MASK , val),10 ); + } + + crtc_state->base.gamma_lut = blob; +} + +static void cherryview_get_color_config (struct intel_crtc_state *crtc_state) +{ +if (crtc_state->gamma_mode ==GAMMA_MODE_MODE_8BIT ) +i9xx_get_color_config (crtc_state); +else +cherryview_get_gamma_config (crtc_state); +} +void intel_color_init (struct intel_crtc *crtc) {struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev);
@@ -1289,6 +1327,7 @@ void intel_color_init(struct intel_crtc *crtc) dev_priv->display.color_check = chv_color_check; dev_priv->display.color_commit = i9xx_color_commit; dev_priv->display.load_luts = cherryview_load_luts; + dev_priv->display.get_color_config = cherryview_get_color_config; }else if (INTEL_GEN (dev_priv) >=4 ) { dev_priv->display.color_check = i9xx_color_check; dev_priv->display.color_commit = i9xx_color_commit;
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 4/11 drm/i915: Extract i965_get_color_config()
In reply to Swati Sharma--- drivers/gpu/drm/i915/i915_reg.h | 3 +++ drivers/gpu/drm/i915/intel_color.c | 39 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +3 -0
@@ -3582,6 +3582,9 @@ enum i915_power_well_id {#define _PALETTE_A 0xa000#define _PALETTE_B 0xa800#define _CHV_PALETTE_C 0xc000 +#define PALETTE_RED_MASK REG_GENMASK(23, 16) +#define PALETTE_GREEN_MASK REG_GENMASK(15, 8) +#define PALETTE_BLUE_MASK REG_GENMASK(7, 0)#define PALETTE (pipe, i) _MMIO(DISPLAY_MMIO_BASE(dev_priv) + \ _PICK((pipe), _PALETTE_A, \ _PALETTE_B, _CHV_PALETTE_C) + \
drivers/gpu/drm/i915/intel_color.c +39 -0
@@ -1315,6 +1315,44 @@ static void cherryview_get_color_config(struct intel_crtc_state *crtc_state)cherryview_get_gamma_config (crtc_state); } +static void i965_get_gamma_config_10p6 (struct intel_crtc_state *crtc_state) +{ +struct intel_crtc *crtc =to_intel_crtc (crtc_state->base.crtc); +struct drm_device *dev = crtc->base.dev; +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev); +u32 i, val1, val2, lut_size =INTEL_INFO (dev_priv)->color.gamma_lut_size; +enum pipe pipe = crtc->pipe; +struct drm_property_blob *blob =NULL ; +struct drm_color_lut *blob_data; + + blob =drm_property_create_blob (dev, +sizeof (struct drm_color_lut ) * lut_size, +NULL ); +if (IS_ERR (blob)) +return ; + + blob_data = blob->data; + +for (i =0 ; i < lut_size -1 ; i++) { + val1 =I915_READ (PALETTE (pipe,2 * i +0 )); + val2 =I915_READ (PALETTE (pipe,2 * i +1 )); + + blob_data[i].red = (REG_FIELD_GET (PALETTE_RED_MASK , val1) >>16 ) <<8 | (REG_FIELD_GET (PALETTE_RED_MASK , val2) >>16 ); + blob_data[i].green = (REG_FIELD_GET (PALETTE_GREEN_MASK , val1) >>8 ) <<8 | (REG_FIELD_GET (PALETTE_GREEN_MASK , val2) >>8 ); + blob_data[i].blue =REG_FIELD_GET (PALETTE_BLUE_MASK , val1) <<8 |REG_FIELD_GET (PALETTE_BLUE_MASK , val2) ; + } + + crtc_state->base.gamma_lut = blob; +} + +static void i965_get_color_config (struct intel_crtc_state *crtc_state) +{ +if (crtc_state->gamma_mode ==GAMMA_MODE_MODE_8BIT ) +i9xx_get_color_config (crtc_state); +else +i965_get_gamma_config_10p6 (crtc_state); +} +void intel_color_init (struct intel_crtc *crtc) {struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev);
@@ -1332,6 +1370,7 @@ void intel_color_init(struct intel_crtc *crtc) dev_priv->display.color_check = i9xx_color_check; dev_priv->display.color_commit = i9xx_color_commit; dev_priv->display.load_luts = i965_load_luts; + dev_priv->display.get_color_config = i965_get_color_config; }else { dev_priv->display.color_check = i9xx_color_check; dev_priv->display.color_commit = i9xx_color_commit;
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 5/11 drm/i915: Extract icl_get_color_config()
In reply to Swati Sharma--- drivers/gpu/drm/i915/i915_reg.h | 3 +++ drivers/gpu/drm/i915/intel_color.c | 49 +++++++++++++++++++++++++++++++++++++- 2 files changed, 51 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_reg.h +3 -0
@@ -10151,6 +10151,9 @@ enum skl_power_gate {#define _PAL_PREC_DATA_A 0x4A404#define _PAL_PREC_DATA_B 0x4AC04#define _PAL_PREC_DATA_C 0x4B404 +#define PREC_PAL_DATA_RED_MASK REG_GENMASK(29, 20) +#define PREC_PAL_DATA_GREEN_MASK REG_GENMASK(19, 10) +#define PREC_PAL_DATA_BLUE_MASK REG_GENMASK(9, 0)#define _PAL_PREC_GC_MAX_A 0x4A410#define _PAL_PREC_GC_MAX_B 0x4AC10#define _PAL_PREC_GC_MAX_C 0x4B410
drivers/gpu/drm/i915/intel_color.c +48 -1
62 lines not on this page · raw message
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 6/11 drm/i915: Extract glk_get_color_config()
In reply to Swati Sharma--- drivers/gpu/drm/i915/intel_color.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_color.c +11 -2
@@ -1398,6 +1398,14 @@ static void icl_get_color_config(struct intel_crtc_state *crtc_state)bdw_get_gamma_config (crtc_state,PAL_PREC_INDEX_VALUE (0 )); } +static void glk_get_color_config (struct intel_crtc_state *crtc_state) +{ +if (crtc_state->gamma_mode ==GAMMA_MODE_MODE_8BIT ) +i9xx_get_color_config (crtc_state); +else +bdw_get_gamma_config (crtc_state,PAL_PREC_INDEX_VALUE (0 )); +} +void intel_color_init (struct intel_crtc *crtc) {struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev);
@@ -1442,9 +1450,10 @@ void intel_color_init(struct intel_crtc *crtc)if (INTEL_GEN (dev_priv) >=11 ) { dev_priv->display.load_luts = icl_load_luts; dev_priv->display.get_color_config = icl_get_color_config; - } -else if (IS_CANNONLAKE (dev_priv) ||IS_GEMINILAKE (dev_priv)) + }else if (IS_CANNONLAKE (dev_priv) ||IS_GEMINILAKE (dev_priv)) { dev_priv->display.load_luts = glk_load_luts; + dev_priv->display.get_color_config = glk_get_color_config; + }else if (INTEL_GEN (dev_priv) >=8 ) dev_priv->display.load_luts = bdw_load_luts;else if (INTEL_GEN (dev_priv) >=7 )
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 7/11 drm/i915: Extract bdw_get_color_config()
In reply to Swati Sharma--- drivers/gpu/drm/i915/intel_color.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_color.c +14 -2
@@ -1406,6 +1406,17 @@ static void glk_get_color_config(struct intel_crtc_state *crtc_state)bdw_get_gamma_config (crtc_state,PAL_PREC_INDEX_VALUE (0 )); } +static void bdw_get_color_config (struct intel_crtc_state *crtc_state) +{ +if (crtc_state->gamma_mode ==GAMMA_MODE_MODE_8BIT ) +i9xx_get_color_config (crtc_state); +else if (crtc_state->gamma_mode ==GAMMA_MODE_MODE_SPLIT ) +bdw_get_gamma_config (crtc_state,PAL_PREC_SPLIT_MODE | +PAL_PREC_INDEX_VALUE (512 )); +else +bdw_get_gamma_config (crtc_state,PAL_PREC_INDEX_VALUE (0 )); +} +void intel_color_init (struct intel_crtc *crtc) {struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev);
@@ -1453,9 +1464,10 @@ void intel_color_init(struct intel_crtc *crtc) }else if (IS_CANNONLAKE (dev_priv) ||IS_GEMINILAKE (dev_priv)) { dev_priv->display.load_luts = glk_load_luts; dev_priv->display.get_color_config = glk_get_color_config; - } -else if (INTEL_GEN (dev_priv) >=8 ) + }else if (INTEL_GEN (dev_priv) >=8 ) { dev_priv->display.load_luts = bdw_load_luts; + dev_priv->display.get_color_config = bdw_get_color_config; + }else if (INTEL_GEN (dev_priv) >=7 ) dev_priv->display.load_luts = ivb_load_luts;else
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 8/11 drm/i915: Extract ivb_get_color_config()
In reply to Swati Sharma--- drivers/gpu/drm/i915/intel_color.c | 50 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_color.c +48 -2
@@ -1417,6 +1417,51 @@ static void bdw_get_color_config(struct intel_crtc_state *crtc_state)bdw_get_gamma_config (crtc_state,PAL_PREC_INDEX_VALUE (0 )); } +static void ivb_get_gamma_config (struct intel_crtc_state *crtc_state, +u32 prec_index) +{ +struct intel_crtc *crtc =to_intel_crtc (crtc_state->base.crtc); +struct drm_device *dev = crtc->base.dev; +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev); +int hw_lut_size =ivb_lut_10_size (prec_index); +enum pipe pipe = crtc->pipe; +struct drm_property_blob *blob =NULL ; +struct drm_color_lut *blob_data; +u32 i, val; + + blob =drm_property_create_blob (dev, +sizeof (struct drm_color_lut ) * hw_lut_size, +NULL ); +if (IS_ERR (blob)) +return ; + + blob_data = blob->data; + +for (i =0 ; i < hw_lut_size; i++) { +I915_WRITE (PREC_PAL_INDEX (pipe), prec_index++); + val =I915_READ (PREC_PAL_DATA (pipe)); + + blob_data[i].red =intel_color_lut_pack (REG_FIELD_GET (PREC_PAL_DATA_RED_MASK , val) >>20 ,10 ); + blob_data[i].green =intel_color_lut_pack (REG_FIELD_GET (PREC_PAL_DATA_GREEN_MASK , val) >>10 ,10 ); + blob_data[i].blue =intel_color_lut_pack (REG_FIELD_GET (PREC_PAL_DATA_BLUE_MASK , val),10 ); + } + +I915_WRITE (PREC_PAL_INDEX (pipe),0 ); + + crtc_state->base.gamma_lut = blob; +} + +static void ivb_get_color_config (struct intel_crtc_state *crtc_state) +{ +if (crtc_state->gamma_mode ==GAMMA_MODE_MODE_8BIT ) +i9xx_get_color_config (crtc_state); +else if (crtc_state->gamma_mode ==GAMMA_MODE_MODE_SPLIT ) +ivb_get_gamma_config (crtc_state,PAL_PREC_SPLIT_MODE | +PAL_PREC_INDEX_VALUE (512 )); +else +bdw_get_gamma_config (crtc_state,PAL_PREC_INDEX_VALUE (0 )); +} +void intel_color_init (struct intel_crtc *crtc) {struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev);
@@ -1467,9 +1512,10 @@ void intel_color_init(struct intel_crtc *crtc) }else if (INTEL_GEN (dev_priv) >=8 ) { dev_priv->display.load_luts = bdw_load_luts; dev_priv->display.get_color_config = bdw_get_color_config; - } -else if (INTEL_GEN (dev_priv) >=7 ) + }else if (INTEL_GEN (dev_priv) >=7 ) { dev_priv->display.load_luts = ivb_load_luts; + dev_priv->display.get_color_config = ivb_get_color_config; + }else dev_priv->display.load_luts = ilk_load_luts; }
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 9/11 drm/i915: Extract ilk_get_color_config()
In reply to Swati Sharma--- drivers/gpu/drm/i915/i915_reg.h | 3 +++ drivers/gpu/drm/i915/intel_color.c | 42 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 43 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +3 -0
@@ -7222,6 +7222,9 @@ enum {/* ilk/snb precision palette */ #define _PREC_PALETTE_A 0x4b000#define _PREC_PALETTE_B 0x4c000 +#define PREC_PALETTE_RED_MASK REG_GENMASK(29, 20) +#define PREC_PALETTE_GREEN_MASK REG_GENMASK(19, 10) +#define PREC_PALETTE_BLUE_MASK REG_GENMASK(9, 0)#define PREC_PALETTE (pipe, i) _MMIO(_PIPE(pipe, _PREC_PALETTE_A, _PREC_PALETTE_B) + (i) * 4)#define _PREC_PIPEAGCMAX 0x4d000
drivers/gpu/drm/i915/intel_color.c +40 -2
55 lines not on this page · raw message
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 10/11 drm/i915: Enable intel_get_color_config()
In reply to Swati Sharma--- drivers/gpu/drm/i915/intel_display.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/i915/intel_display.c +3 -0
@@ -8265,6 +8265,7 @@ static bool i9xx_get_pipe_config(struct intel_crtc *crtc, pipe_config->cgm_mode =I915_READ (CGM_PIPE_MODE (crtc->pipe));i9xx_get_pipe_color_config (pipe_config); +intel_get_color_config (pipe_config);if (INTEL_GEN (dev_priv) <4 ) pipe_config->double_wide = tmp &PIPECONF_DOUBLE_WIDE ;
@@ -9338,6 +9339,7 @@ static bool ironlake_get_pipe_config(struct intel_crtc *crtc, pipe_config->csc_mode =I915_READ (PIPE_CSC_MODE (crtc->pipe));i9xx_get_pipe_color_config (pipe_config); +intel_get_color_config (pipe_config);if (I915_READ (PCH_TRANSCONF (crtc->pipe)) &TRANS_ENABLE ) {struct intel_shared_dpll *pll;
@@ -9985,6 +9987,7 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc, pipe_config->csc_enable = true; }else {i9xx_get_pipe_color_config (pipe_config); +intel_get_color_config (pipe_config); } power_domain =POWER_DOMAIN_PIPE_PANEL_FITTER (crtc->pipe);
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 11/11 drm/i915: Add intel_compare_color_lut() to compare hw and sw gamma lut values
In reply to Swati Sharma--- drivers/gpu/drm/i915/intel_color.c | 49 ++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_display.c | 10 ++++++++ drivers/gpu/drm/i915/intel_drv.h | 3 +++ 3 files changed, 62 insertions(+)
drivers/gpu/drm/i915/intel_color.c +49 -0
@@ -1499,6 +1499,55 @@ static void ilk_get_color_config(struct intel_crtc_state *crtc_state)ilk_get_gamma_config (crtc_state); } +static inline bool gamma_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); +} + +bool intel_compare_color_lut (struct drm_property_blob *blob1, +struct drm_property_blob *blob2, +u32 gamma_mode) +{ +struct drm_color_lut *sw_lut = blob1->data; +struct drm_color_lut *hw_lut = blob2->data; +int sw_lut_size, hw_lut_size, i; +u32 bit_precision, err; + +if (!blob1 || !blob2) +return false; + +switch (gamma_mode) { +case GAMMA_MODE_MODE_8BIT : + bit_precision =8 ; +break ; +case GAMMA_MODE_MODE_10BIT : + bit_precision =10 ; +break ; +case GAMMA_MODE_MODE_12BIT : + bit_precision =12 ; +break ; +default : + bit_precision =8 ; + } + + err =0xffff >> bit_precision; + + sw_lut_size =drm_color_lut_size (blob1); + hw_lut_size =drm_color_lut_size (blob2); + +if (sw_lut_size != hw_lut_size) +return false; + +for (i =0 ; i < sw_lut_size; i++) { +if (!gamma_err_check (&hw_lut[i], &sw_lut[i], err)) +return false; + } + +return true; +} +void intel_color_init (struct intel_crtc *crtc) {struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev);
drivers/gpu/drm/i915/intel_display.c +10 -0
@@ -12206,6 +12206,14 @@ static bool fastboot_enabled(struct drm_i915_private *dev_priv) } \ } while (0) +#define PIPE_CONF_CHECK_COLOR_LUT (name, gamma_mode) do { \ + if (!intel_compare_color_lut(current_config->name, pipe_config->name, gamma_mode)) { \ + pipe_config_err(adjust, __stringify(name), \ + "hw_state doesn't match sw_state\n"); \ + ret = false; \ + } \ +} while (0) +#define PIPE_CONF_QUIRK (quirk) \ ((current_config->quirks | pipe_config->quirks) & (quirk))
@@ -12349,6 +12357,8 @@ static bool fastboot_enabled(struct drm_i915_private *dev_priv)PIPE_CONF_CHECK_INFOFRAME (spd);PIPE_CONF_CHECK_INFOFRAME (hdmi); +PIPE_CONF_CHECK_COLOR_LUT (base.gamma_lut, pipe_config->gamma_mode); +#undef PIPE_CONF_CHECK_X#undef PIPE_CONF_CHECK_I#undef PIPE_CONF_CHECK_BOOL
drivers/gpu/drm/i915/intel_drv.h +3 -0
@@ -2554,6 +2554,9 @@ int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_void intel_color_commit (const struct intel_crtc_state *crtc_state);void intel_color_load_luts (const struct intel_crtc_state *crtc_state);void intel_get_color_config (struct intel_crtc_state *crtc_state); +bool intel_compare_color_lut (struct drm_property_blob *blob1, +struct drm_property_blob *blob2, +u32 gamma_mode);/* intel_lspcon.c */ bool lspcon_init (struct intel_digital_port *intel_dig_port);
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for adding state checker for gamma lut values
In reply to Swati Sharma== Series Details ==
== Series Details ==
Series: adding state checker for gamma lut values
URL : https://patchwork.freedesktop.org/series/59226/
State : failure
== Summary ==
Applying: drm/i915: Introduce vfunc intel_get_color_config to create hw lut Using index info to reconstruct a base tree...
M drivers/gpu/drm/i915/i915_drv.h
M drivers/gpu/drm/i915/intel_color.c
M drivers/gpu/drm/i915/intel_drv.h
Falling back to patching base and 3-way merge...
Auto-merging drivers/gpu/drm/i915/intel_drv.h
CONFLICT (content): Merge conflict in drivers/gpu/drm/i915/intel_drv.h Auto-merging drivers/gpu/drm/i915/intel_color.c
Auto-merging drivers/gpu/drm/i915/i915_drv.h
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch' to see the failed patch
Patch failed at 0001 drm/i915: Introduce vfunc intel_get_color_config to create hw lut When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx