Commit e9b14658 authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Split color_commit() into noarm+arm pair

To reduce the amount of registers written during the vblank evade
critical section let's also split the .color_commit() hook to
noarm+arm pair. The noarm hook runs before the vblank evasion
with the arm hook staying inside the critical section.

Just the framework here, actually moving stuff out into the noarm
hook will follow.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220224165103.15682-4-ville.syrjala@linux.intel.comReviewed-by: default avatarStanislav Lisovskiy <stanislav.lisovskiy@intel.com>
parent 46fc66be
...@@ -31,12 +31,21 @@ ...@@ -31,12 +31,21 @@
struct intel_color_funcs { struct intel_color_funcs {
int (*color_check)(struct intel_crtc_state *crtc_state); int (*color_check)(struct intel_crtc_state *crtc_state);
/* /*
* Program double buffered color management registers during * Program non-arming double buffered color management registers
* vblank evasion. The registers should then latch during the * before vblank evasion. The registers should then latch after
* next vblank start, alongside any other double buffered registers * the arming register is written (by color_commit_arm()) during
* involved with the same commit. * the next vblank start, alongside any other double buffered
* registers involved with the same commit. This hook is optional.
*/
void (*color_commit_noarm)(const struct intel_crtc_state *crtc_state);
/*
* Program arming double buffered color management registers
* during vblank evasion. The registers (and whatever other registers
* they arm that were written by color_commit_noarm) should then latch
* during the next vblank start, alongside any other double buffered
* registers involved with the same commit.
*/ */
void (*color_commit)(const struct intel_crtc_state *crtc_state); void (*color_commit_arm)(const struct intel_crtc_state *crtc_state);
/* /*
* Load LUTs (and other single buffered color management * Load LUTs (and other single buffered color management
* registers). Will (hopefully) be called during the vblank * registers). Will (hopefully) be called during the vblank
...@@ -491,7 +500,7 @@ static void icl_lut_multi_seg_pack(struct drm_color_lut *entry, u32 ldw, u32 udw ...@@ -491,7 +500,7 @@ static void icl_lut_multi_seg_pack(struct drm_color_lut *entry, u32 ldw, u32 udw
REG_FIELD_GET(PAL_PREC_MULTI_SEG_BLUE_LDW_MASK, ldw); REG_FIELD_GET(PAL_PREC_MULTI_SEG_BLUE_LDW_MASK, ldw);
} }
static void i9xx_color_commit(const struct intel_crtc_state *crtc_state) static void i9xx_color_commit_arm(const struct intel_crtc_state *crtc_state)
{ {
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
...@@ -504,7 +513,7 @@ static void i9xx_color_commit(const struct intel_crtc_state *crtc_state) ...@@ -504,7 +513,7 @@ static void i9xx_color_commit(const struct intel_crtc_state *crtc_state)
intel_de_write(dev_priv, PIPECONF(pipe), val); intel_de_write(dev_priv, PIPECONF(pipe), val);
} }
static void ilk_color_commit(const struct intel_crtc_state *crtc_state) static void ilk_color_commit_arm(const struct intel_crtc_state *crtc_state)
{ {
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
...@@ -519,7 +528,7 @@ static void ilk_color_commit(const struct intel_crtc_state *crtc_state) ...@@ -519,7 +528,7 @@ static void ilk_color_commit(const struct intel_crtc_state *crtc_state)
ilk_load_csc_matrix(crtc_state); ilk_load_csc_matrix(crtc_state);
} }
static void hsw_color_commit(const struct intel_crtc_state *crtc_state) static void hsw_color_commit_arm(const struct intel_crtc_state *crtc_state)
{ {
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
...@@ -530,7 +539,7 @@ static void hsw_color_commit(const struct intel_crtc_state *crtc_state) ...@@ -530,7 +539,7 @@ static void hsw_color_commit(const struct intel_crtc_state *crtc_state)
ilk_load_csc_matrix(crtc_state); ilk_load_csc_matrix(crtc_state);
} }
static void skl_color_commit(const struct intel_crtc_state *crtc_state) static void skl_color_commit_arm(const struct intel_crtc_state *crtc_state)
{ {
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
...@@ -1169,11 +1178,19 @@ void intel_color_load_luts(const struct intel_crtc_state *crtc_state) ...@@ -1169,11 +1178,19 @@ void intel_color_load_luts(const struct intel_crtc_state *crtc_state)
dev_priv->color_funcs->load_luts(crtc_state); dev_priv->color_funcs->load_luts(crtc_state);
} }
void intel_color_commit(const struct intel_crtc_state *crtc_state) void intel_color_commit_noarm(const struct intel_crtc_state *crtc_state)
{
struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc->dev);
if (dev_priv->color_funcs->color_commit_noarm)
dev_priv->color_funcs->color_commit_noarm(crtc_state);
}
void intel_color_commit_arm(const struct intel_crtc_state *crtc_state)
{ {
struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc->dev); struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc->dev);
dev_priv->color_funcs->color_commit(crtc_state); dev_priv->color_funcs->color_commit_arm(crtc_state);
} }
static bool intel_can_preload_luts(const struct intel_crtc_state *new_crtc_state) static bool intel_can_preload_luts(const struct intel_crtc_state *new_crtc_state)
...@@ -2132,70 +2149,70 @@ static void icl_read_luts(struct intel_crtc_state *crtc_state) ...@@ -2132,70 +2149,70 @@ static void icl_read_luts(struct intel_crtc_state *crtc_state)
static const struct intel_color_funcs chv_color_funcs = { static const struct intel_color_funcs chv_color_funcs = {
.color_check = chv_color_check, .color_check = chv_color_check,
.color_commit = i9xx_color_commit, .color_commit_arm = i9xx_color_commit_arm,
.load_luts = chv_load_luts, .load_luts = chv_load_luts,
.read_luts = chv_read_luts, .read_luts = chv_read_luts,
}; };
static const struct intel_color_funcs i965_color_funcs = { static const struct intel_color_funcs i965_color_funcs = {
.color_check = i9xx_color_check, .color_check = i9xx_color_check,
.color_commit = i9xx_color_commit, .color_commit_arm = i9xx_color_commit_arm,
.load_luts = i965_load_luts, .load_luts = i965_load_luts,
.read_luts = i965_read_luts, .read_luts = i965_read_luts,
}; };
static const struct intel_color_funcs i9xx_color_funcs = { static const struct intel_color_funcs i9xx_color_funcs = {
.color_check = i9xx_color_check, .color_check = i9xx_color_check,
.color_commit = i9xx_color_commit, .color_commit_arm = i9xx_color_commit_arm,
.load_luts = i9xx_load_luts, .load_luts = i9xx_load_luts,
.read_luts = i9xx_read_luts, .read_luts = i9xx_read_luts,
}; };
static const struct intel_color_funcs icl_color_funcs = { static const struct intel_color_funcs icl_color_funcs = {
.color_check = icl_color_check, .color_check = icl_color_check,
.color_commit = skl_color_commit, .color_commit_arm = skl_color_commit_arm,
.load_luts = icl_load_luts, .load_luts = icl_load_luts,
.read_luts = icl_read_luts, .read_luts = icl_read_luts,
}; };
static const struct intel_color_funcs glk_color_funcs = { static const struct intel_color_funcs glk_color_funcs = {
.color_check = glk_color_check, .color_check = glk_color_check,
.color_commit = skl_color_commit, .color_commit_arm = skl_color_commit_arm,
.load_luts = glk_load_luts, .load_luts = glk_load_luts,
.read_luts = glk_read_luts, .read_luts = glk_read_luts,
}; };
static const struct intel_color_funcs skl_color_funcs = { static const struct intel_color_funcs skl_color_funcs = {
.color_check = ivb_color_check, .color_check = ivb_color_check,
.color_commit = skl_color_commit, .color_commit_arm = skl_color_commit_arm,
.load_luts = bdw_load_luts, .load_luts = bdw_load_luts,
.read_luts = NULL, .read_luts = NULL,
}; };
static const struct intel_color_funcs bdw_color_funcs = { static const struct intel_color_funcs bdw_color_funcs = {
.color_check = ivb_color_check, .color_check = ivb_color_check,
.color_commit = hsw_color_commit, .color_commit_arm = hsw_color_commit_arm,
.load_luts = bdw_load_luts, .load_luts = bdw_load_luts,
.read_luts = NULL, .read_luts = NULL,
}; };
static const struct intel_color_funcs hsw_color_funcs = { static const struct intel_color_funcs hsw_color_funcs = {
.color_check = ivb_color_check, .color_check = ivb_color_check,
.color_commit = hsw_color_commit, .color_commit_arm = hsw_color_commit_arm,
.load_luts = ivb_load_luts, .load_luts = ivb_load_luts,
.read_luts = NULL, .read_luts = NULL,
}; };
static const struct intel_color_funcs ivb_color_funcs = { static const struct intel_color_funcs ivb_color_funcs = {
.color_check = ivb_color_check, .color_check = ivb_color_check,
.color_commit = ilk_color_commit, .color_commit_arm = ilk_color_commit_arm,
.load_luts = ivb_load_luts, .load_luts = ivb_load_luts,
.read_luts = NULL, .read_luts = NULL,
}; };
static const struct intel_color_funcs ilk_color_funcs = { static const struct intel_color_funcs ilk_color_funcs = {
.color_check = ilk_color_check, .color_check = ilk_color_check,
.color_commit = ilk_color_commit, .color_commit_arm = ilk_color_commit_arm,
.load_luts = ilk_load_luts, .load_luts = ilk_load_luts,
.read_luts = ilk_read_luts, .read_luts = ilk_read_luts,
}; };
......
...@@ -14,7 +14,8 @@ struct drm_property_blob; ...@@ -14,7 +14,8 @@ struct drm_property_blob;
void intel_color_init(struct intel_crtc *crtc); void intel_color_init(struct intel_crtc *crtc);
int intel_color_check(struct intel_crtc_state *crtc_state); int intel_color_check(struct intel_crtc_state *crtc_state);
void intel_color_commit(const struct intel_crtc_state *crtc_state); void intel_color_commit_noarm(const struct intel_crtc_state *crtc_state);
void intel_color_commit_arm(const struct intel_crtc_state *crtc_state);
void intel_color_load_luts(const struct intel_crtc_state *crtc_state); void intel_color_load_luts(const struct intel_crtc_state *crtc_state);
void intel_color_get_config(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); int intel_color_get_gamma_bit_precision(const struct intel_crtc_state *crtc_state);
......
...@@ -1779,7 +1779,8 @@ static void ilk_crtc_enable(struct intel_atomic_state *state, ...@@ -1779,7 +1779,8 @@ static void ilk_crtc_enable(struct intel_atomic_state *state,
* clocks enabled * clocks enabled
*/ */
intel_color_load_luts(new_crtc_state); intel_color_load_luts(new_crtc_state);
intel_color_commit(new_crtc_state); intel_color_commit_noarm(new_crtc_state);
intel_color_commit_arm(new_crtc_state);
/* update DSPCNTR to configure gamma for pipe bottom color */ /* update DSPCNTR to configure gamma for pipe bottom color */
intel_disable_primary_plane(new_crtc_state); intel_disable_primary_plane(new_crtc_state);
...@@ -1970,7 +1971,8 @@ static void hsw_crtc_enable(struct intel_atomic_state *state, ...@@ -1970,7 +1971,8 @@ static void hsw_crtc_enable(struct intel_atomic_state *state,
* clocks enabled * clocks enabled
*/ */
intel_color_load_luts(new_crtc_state); intel_color_load_luts(new_crtc_state);
intel_color_commit(new_crtc_state); intel_color_commit_noarm(new_crtc_state);
intel_color_commit_arm(new_crtc_state);
/* update DSPCNTR to configure gamma/csc for pipe bottom color */ /* update DSPCNTR to configure gamma/csc for pipe bottom color */
if (DISPLAY_VER(dev_priv) < 9) if (DISPLAY_VER(dev_priv) < 9)
intel_disable_primary_plane(new_crtc_state); intel_disable_primary_plane(new_crtc_state);
...@@ -2390,7 +2392,8 @@ static void valleyview_crtc_enable(struct intel_atomic_state *state, ...@@ -2390,7 +2392,8 @@ static void valleyview_crtc_enable(struct intel_atomic_state *state,
i9xx_pfit_enable(new_crtc_state); i9xx_pfit_enable(new_crtc_state);
intel_color_load_luts(new_crtc_state); intel_color_load_luts(new_crtc_state);
intel_color_commit(new_crtc_state); intel_color_commit_noarm(new_crtc_state);
intel_color_commit_arm(new_crtc_state);
/* update DSPCNTR to configure gamma for pipe bottom color */ /* update DSPCNTR to configure gamma for pipe bottom color */
intel_disable_primary_plane(new_crtc_state); intel_disable_primary_plane(new_crtc_state);
...@@ -2429,7 +2432,8 @@ static void i9xx_crtc_enable(struct intel_atomic_state *state, ...@@ -2429,7 +2432,8 @@ static void i9xx_crtc_enable(struct intel_atomic_state *state,
i9xx_pfit_enable(new_crtc_state); i9xx_pfit_enable(new_crtc_state);
intel_color_load_luts(new_crtc_state); intel_color_load_luts(new_crtc_state);
intel_color_commit(new_crtc_state); intel_color_commit_noarm(new_crtc_state);
intel_color_commit_arm(new_crtc_state);
/* update DSPCNTR to configure gamma for pipe bottom color */ /* update DSPCNTR to configure gamma for pipe bottom color */
intel_disable_primary_plane(new_crtc_state); intel_disable_primary_plane(new_crtc_state);
...@@ -8083,7 +8087,7 @@ static void commit_pipe_pre_planes(struct intel_atomic_state *state, ...@@ -8083,7 +8087,7 @@ static void commit_pipe_pre_planes(struct intel_atomic_state *state,
if (!modeset) { if (!modeset) {
if (new_crtc_state->uapi.color_mgmt_changed || if (new_crtc_state->uapi.color_mgmt_changed ||
new_crtc_state->update_pipe) new_crtc_state->update_pipe)
intel_color_commit(new_crtc_state); intel_color_commit_arm(new_crtc_state);
if (DISPLAY_VER(dev_priv) >= 9 || IS_BROADWELL(dev_priv)) if (DISPLAY_VER(dev_priv) >= 9 || IS_BROADWELL(dev_priv))
bdw_set_pipemisc(new_crtc_state); bdw_set_pipemisc(new_crtc_state);
...@@ -8163,6 +8167,11 @@ static void intel_update_crtc(struct intel_atomic_state *state, ...@@ -8163,6 +8167,11 @@ static void intel_update_crtc(struct intel_atomic_state *state,
intel_fbc_update(state, crtc); intel_fbc_update(state, crtc);
if (!modeset &&
(new_crtc_state->uapi.color_mgmt_changed ||
new_crtc_state->update_pipe))
intel_color_commit_noarm(new_crtc_state);
intel_crtc_planes_update_noarm(state, crtc); intel_crtc_planes_update_noarm(state, crtc);
/* Perform vblank evasion around commit operation */ /* Perform vblank evasion around commit operation */
...@@ -10003,7 +10012,8 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc, ...@@ -10003,7 +10012,8 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc,
} }
/* Disable any background color/etc. set by the BIOS */ /* Disable any background color/etc. set by the BIOS */
intel_color_commit(crtc_state); intel_color_commit_noarm(crtc_state);
intel_color_commit_arm(crtc_state);
} }
/* Adjust the state of the output pipe according to whether we /* Adjust the state of the output pipe according to whether we
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment