[PATCH 4/9] debug
José Roberto de Souza
jose.souza at intel.com
Wed Feb 27 02:36:38 UTC 2019
---
drivers/gpu/drm/drm_atomic.c | 20 ++++++++++++-
drivers/gpu/drm/drm_atomic_helper.c | 15 ++++++++++
drivers/gpu/drm/i915/intel_color.c | 42 ++++++++++++++++++++++++---
drivers/gpu/drm/i915/intel_display.c | 36 +++++++++++++++++++++++
drivers/gpu/drm/i915/intel_pipe_crc.c | 28 ++++++++++++++++++
drivers/gpu/drm/i915/intel_psr.c | 5 ++++
include/drm/drm_device.h | 2 ++
7 files changed, 143 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 5eb40130fafb..d6125b27d44e 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -1019,7 +1019,10 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
struct drm_connector_state *conn_state;
int i, ret = 0;
- DRM_DEBUG_ATOMIC("checking %p\n", state);
+ DRM_DEBUG_ATOMIC("checking2 %p\n", state);
+
+ if (dev->debug)
+ dev->debug(state, "drm_atomic_check_only 1");
for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) {
ret = drm_atomic_plane_check(old_plane_state, new_plane_state);
@@ -1030,6 +1033,9 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
}
}
+ if (dev->debug)
+ dev->debug(state, "drm_atomic_check_only 2");
+
for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
ret = drm_atomic_crtc_check(old_crtc_state, new_crtc_state);
if (ret) {
@@ -1039,6 +1045,9 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
}
}
+ if (dev->debug)
+ dev->debug(state, "drm_atomic_check_only 3");
+
for_each_new_connector_in_state(state, conn, conn_state, i) {
ret = drm_atomic_connector_check(conn, conn_state);
if (ret) {
@@ -1048,6 +1057,9 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
}
}
+ if (dev->debug)
+ dev->debug(state, "drm_atomic_check_only 4");
+
if (config->funcs->atomic_check) {
ret = config->funcs->atomic_check(state->dev, state);
@@ -1058,6 +1070,9 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
}
}
+ if (dev->debug)
+ dev->debug(state, "drm_atomic_check_only 5");
+
if (!state->allow_modeset) {
for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
if (drm_atomic_crtc_needs_modeset(new_crtc_state)) {
@@ -1068,6 +1083,9 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
}
}
+ if (dev->debug)
+ dev->debug(state, "drm_atomic_check_only 6");
+
return 0;
}
EXPORT_SYMBOL(drm_atomic_check_only);
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 40ac19848034..f7642573934a 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -933,23 +933,38 @@ int drm_atomic_helper_check(struct drm_device *dev,
{
int ret;
+ if (dev->debug)
+ dev->debug(state, "drm_atomic_helper_check 1");
+
ret = drm_atomic_helper_check_modeset(dev, state);
if (ret)
return ret;
+ if (dev->debug)
+ dev->debug(state, "drm_atomic_helper_check 2");
+
if (dev->mode_config.normalize_zpos) {
ret = drm_atomic_normalize_zpos(dev, state);
if (ret)
return ret;
}
+ if (dev->debug)
+ dev->debug(state, "drm_atomic_helper_check 3");
+
ret = drm_atomic_helper_check_planes(dev, state);
if (ret)
return ret;
+ if (dev->debug)
+ dev->debug(state, "drm_atomic_helper_check 4");
+
if (state->legacy_cursor_update)
state->async_update = !drm_atomic_helper_async_check(dev, state);
+ if (dev->debug)
+ dev->debug(state, "drm_atomic_helper_check 5");
+
return ret;
}
EXPORT_SYMBOL(drm_atomic_helper_check);
diff --git a/drivers/gpu/drm/i915/intel_color.c b/drivers/gpu/drm/i915/intel_color.c
index da7a07d5ccea..8216df6c6e47 100644
--- a/drivers/gpu/drm/i915/intel_color.c
+++ b/drivers/gpu/drm/i915/intel_color.c
@@ -181,6 +181,7 @@ static void ilk_load_csc_matrix(const struct intel_crtc_state *crtc_state)
crtc_state->output_format == INTEL_OUTPUT_FORMAT_YCBCR444) {
ilk_load_ycbcr_conversion_matrix(crtc);
I915_WRITE(PIPE_CSC_MODE(pipe), crtc_state->csc_mode);
+ DRM_DEBUG_KMS("\tPIPE_CSC_MODE(pipe)=%x\n", crtc_state->csc_mode);
/*
* On pre GEN11 output CSC is not there, so with 1 pipe CSC
* RGB to YUV conversion can be done. No need to go further
@@ -254,12 +255,18 @@ static void ilk_load_csc_matrix(const struct intel_crtc_state *crtc_state)
I915_WRITE(PIPE_CSC_COEFF_RY_GY(pipe), coeffs[0] << 16 | coeffs[1]);
I915_WRITE(PIPE_CSC_COEFF_BY(pipe), coeffs[2] << 16);
+ DRM_DEBUG_KMS("\tPIPE_CSC_COEFF_RY_GY(pipe)=%x\n", coeffs[0] << 16 | coeffs[1]);
+ DRM_DEBUG_KMS("\tPIPE_CSC_COEFF_BY(pipe)=%x\n", coeffs[2] << 16);
I915_WRITE(PIPE_CSC_COEFF_RU_GU(pipe), coeffs[3] << 16 | coeffs[4]);
I915_WRITE(PIPE_CSC_COEFF_BU(pipe), coeffs[5] << 16);
+ DRM_DEBUG_KMS("\tPIPE_CSC_COEFF_RU_GU(pipe)=%x\n", coeffs[3] << 16 | coeffs[4]);
+ DRM_DEBUG_KMS("\tPIPE_CSC_COEFF_BU(pipe)=%x\n", coeffs[5] << 16);
I915_WRITE(PIPE_CSC_COEFF_RV_GV(pipe), coeffs[6] << 16 | coeffs[7]);
I915_WRITE(PIPE_CSC_COEFF_BV(pipe), coeffs[8] << 16);
+ DRM_DEBUG_KMS("\tPIPE_CSC_COEFF_RV_GV(pipe)=%x\n", coeffs[6] << 16 | coeffs[7]);
+ DRM_DEBUG_KMS("\tPIPE_CSC_COEFF_BV(pipe)=%x\n", coeffs[8] << 16);
I915_WRITE(PIPE_CSC_PREOFF_HI(pipe), 0);
I915_WRITE(PIPE_CSC_PREOFF_ME(pipe), 0);
@@ -276,6 +283,7 @@ static void ilk_load_csc_matrix(const struct intel_crtc_state *crtc_state)
I915_WRITE(PIPE_CSC_POSTOFF_LO(pipe), postoff);
I915_WRITE(PIPE_CSC_MODE(pipe), crtc_state->csc_mode);
+ DRM_DEBUG_KMS("\tPIPE_CSC_MODE(pipe)=%x\n", crtc_state->csc_mode);
} else {
u32 mode = CSC_MODE_YUV_TO_RGB;
@@ -426,6 +434,9 @@ static void skl_color_commit(const struct intel_crtc_state *crtc_state)
enum pipe pipe = crtc->pipe;
u32 val = 0;
+ DRM_DEBUG_KMS("skl_color_commit()\n");
+ DRM_DEBUG_KMS("\tgamma_enable=%i csc_enable=%i\n", crtc_state->gamma_enable, crtc_state->csc_enable);
+
/*
* We don't (yet) allow userspace to control the pipe background color,
* so force it to black, but apply pipe gamma and CSC appropriately
@@ -436,8 +447,10 @@ static void skl_color_commit(const struct intel_crtc_state *crtc_state)
if (crtc_state->csc_enable)
val |= SKL_BOTTOM_COLOR_CSC_ENABLE;
I915_WRITE(SKL_BOTTOM_COLOR(pipe), val);
+ DRM_DEBUG_KMS("\tSKL_BOTTOM_COLOR(pipe)=%x\n", val);
I915_WRITE(GAMMA_MODE(crtc->pipe), crtc_state->gamma_mode);
+ DRM_DEBUG_KMS("\tGAMMA_MODE(crtc->pipe)=%x\n", crtc_state->gamma_mode);
ilk_load_csc_matrix(crtc_state);
}
@@ -712,13 +725,19 @@ intel_color_add_affected_planes(struct intel_crtc_state *new_crtc_state)
intel_atomic_get_old_crtc_state(state, crtc);
struct intel_plane *plane;
+ DRM_DEBUG_KMS("intel_color_add_affted_planes()\n");
+
if (!new_crtc_state->base.active ||
- drm_atomic_crtc_needs_modeset(&new_crtc_state->base))
+ drm_atomic_crtc_needs_modeset(&new_crtc_state->base)) {
+ DRM_DEBUG_KMS("\tintel_color_add_affted_planes() 1\n");
return 0;
+ }
if (new_crtc_state->gamma_enable == old_crtc_state->gamma_enable &&
- new_crtc_state->csc_enable == old_crtc_state->csc_enable)
+ new_crtc_state->csc_enable == old_crtc_state->csc_enable) {
+ DRM_DEBUG_KMS("\tintel_color_add_affted_planes() 2\n");
return 0;
+ }
for_each_intel_plane_on_crtc(&dev_priv->drm, crtc, plane) {
struct intel_plane_state *plane_state;
@@ -733,6 +752,8 @@ intel_color_add_affected_planes(struct intel_crtc_state *new_crtc_state)
new_crtc_state->update_planes |= BIT(plane->id);
}
+ DRM_DEBUG_KMS("\tintel_color_add_affted_planes() 3\n");
+
return 0;
}
@@ -763,6 +784,8 @@ int intel_color_check(struct intel_crtc_state *crtc_state)
u32 gamma_tests, degamma_tests;
int ret;
+ DRM_DEBUG_KMS("intel_color_check()\n");
+
degamma_length = INTEL_INFO(dev_priv)->color.degamma_lut_size;
gamma_length = INTEL_INFO(dev_priv)->color.gamma_lut_size;
degamma_tests = INTEL_INFO(dev_priv)->color.degamma_lut_tests;
@@ -775,6 +798,7 @@ int intel_color_check(struct intel_crtc_state *crtc_state)
crtc_state->gamma_enable = (gamma_lut || degamma_lut) &&
!crtc_state->c8_planes;
+ DRM_DEBUG_KMS("\tgamma_enable=%i\n", crtc_state->gamma_enable);
if (INTEL_GEN(dev_priv) >= 9 ||
IS_BROADWELL(dev_priv) || IS_HASWELL(dev_priv))
@@ -783,6 +807,7 @@ int intel_color_check(struct intel_crtc_state *crtc_state)
crtc_state->csc_enable =
crtc_state->output_format != INTEL_OUTPUT_FORMAT_RGB ||
crtc_state->base.ctm || limited_color_range;
+ DRM_DEBUG_KMS("\tcsc_enable=%i\n", crtc_state->csc_enable);
ret = intel_color_add_affected_planes(crtc_state);
if (ret)
@@ -792,16 +817,21 @@ int intel_color_check(struct intel_crtc_state *crtc_state)
if (!crtc_state->gamma_enable ||
crtc_state_is_legacy_gamma(crtc_state)) {
crtc_state->gamma_mode = GAMMA_MODE_MODE_8BIT;
+ DRM_DEBUG_KMS("\tlegacy gamma\n");
return 0;
}
if (check_lut_size(degamma_lut, degamma_length) ||
- check_lut_size(gamma_lut, gamma_length))
+ check_lut_size(gamma_lut, gamma_length)) {
+ DRM_DEBUG_KMS("\tlut sizes\n");
return -EINVAL;
+ }
if (drm_color_lut_check(degamma_lut, degamma_tests) ||
- drm_color_lut_check(gamma_lut, gamma_tests))
+ drm_color_lut_check(gamma_lut, gamma_tests)) {
+ DRM_DEBUG_KMS("\tlut check\n");
return -EINVAL;
+ }
if (INTEL_GEN(dev_priv) >= 11)
crtc_state->gamma_mode = GAMMA_MODE_MODE_10BIT |
@@ -814,6 +844,8 @@ int intel_color_check(struct intel_crtc_state *crtc_state)
else
crtc_state->gamma_mode = GAMMA_MODE_MODE_8BIT;
+ DRM_DEBUG_KMS("\tgamma_mode=%x\n", crtc_state->gamma_mode);
+
crtc_state->csc_mode = 0;
if (INTEL_GEN(dev_priv) >= 11) {
@@ -824,6 +856,8 @@ int intel_color_check(struct intel_crtc_state *crtc_state)
crtc_state->csc_mode |= ICL_CSC_ENABLE;
}
+ DRM_DEBUG_KMS("\tcsc_mode=%x\n", crtc_state->csc_mode);
+
return 0;
}
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index fa240396d21a..5930838a2b6b 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -11242,6 +11242,9 @@ static int intel_crtc_atomic_check(struct drm_crtc *crtc,
ret = intel_color_check(pipe_config);
if (ret)
return ret;
+ } else {
+ DRM_DEBUG_KMS("not running intel_color_check() | mode_changed=%i color_mgmt_changed=%i gamma_enable=%i csc_enable=%i\n", mode_changed, crtc_state->color_mgmt_changed, pipe_config->gamma_enable, pipe_config->csc_enable);
+ dump_stack();
}
ret = 0;
@@ -11696,10 +11699,14 @@ clear_intel_crtc_state(struct intel_crtc_state *crtc_state)
/* Keep base drm_crtc_state intact, only clear our extended struct */
BUILD_BUG_ON(offsetof(struct intel_crtc_state, base));
+ DRM_DEBUG_KMS("clear_intel_crtc_state() &crtc_state->base + 1=%p &crtc_state->quirks=%p\n", &crtc_state->base + 1, &crtc_state->quirks);
memcpy(&crtc_state->base + 1, &saved_state->base + 1,
sizeof(*crtc_state) - sizeof(crtc_state->base));
kfree(saved_state);
+
+ DRM_DEBUG_KMS("clear_intel_crtc_state() gamma_enable=%i csc_enable=%i\n", crtc_state->gamma_enable, crtc_state->csc_enable);
+
return 0;
}
@@ -11715,6 +11722,7 @@ intel_modeset_pipe_config(struct drm_crtc *crtc,
int i;
bool retry = true;
+ // here
ret = clear_intel_crtc_state(pipe_config);
if (ret)
return ret;
@@ -13014,6 +13022,9 @@ static int intel_atomic_check(struct drm_device *dev,
int ret, i;
bool any_ms = false;
+ if (dev->debug)
+ dev->debug(state, "intel_atomic_check() 1");
+
/* Catch I915_MODE_FLAG_INHERITED */
for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state,
crtc_state, i) {
@@ -13022,10 +13033,16 @@ static int intel_atomic_check(struct drm_device *dev,
crtc_state->mode_changed = true;
}
+ if (dev->debug)
+ dev->debug(state, "intel_atomic_check() 2");
+
ret = drm_atomic_helper_check_modeset(dev, state);
if (ret)
return ret;
+ if (dev->debug)
+ dev->debug(state, "intel_atomic_check() 3");
+
for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, crtc_state, i) {
struct intel_crtc_state *pipe_config =
to_intel_crtc_state(crtc_state);
@@ -13038,14 +13055,21 @@ static int intel_atomic_check(struct drm_device *dev,
continue;
}
+ if (dev->debug)
+ dev->debug(state, "intel_atomic_check() 3.1");
+
ret = intel_modeset_pipe_config(crtc, pipe_config);
if (ret == -EDEADLK)
return ret;
+ if (dev->debug)
+ dev->debug(state, "intel_atomic_check() 3.2");
if (ret) {
intel_dump_pipe_config(to_intel_crtc(crtc),
pipe_config, "[failed]");
return ret;
}
+ if (dev->debug)
+ dev->debug(state, "intel_atomic_check() 3.3");
if (intel_pipe_config_compare(dev_priv,
to_intel_crtc_state(old_crtc_state),
@@ -13054,6 +13078,9 @@ static int intel_atomic_check(struct drm_device *dev,
pipe_config->update_pipe = true;
}
+ if (dev->debug)
+ dev->debug(state, "intel_atomic_check() 3.4");
+
if (needs_modeset(crtc_state))
any_ms = true;
@@ -13062,6 +13089,9 @@ static int intel_atomic_check(struct drm_device *dev,
"[modeset]" : "[fastset]");
}
+ if (dev->debug)
+ dev->debug(state, "intel_atomic_check() 4");
+
ret = drm_dp_mst_atomic_check(state);
if (ret)
return ret;
@@ -13075,6 +13105,9 @@ static int intel_atomic_check(struct drm_device *dev,
intel_state->cdclk.logical = dev_priv->cdclk.logical;
}
+ if (dev->debug)
+ dev->debug(state, "intel_atomic_check() 5");
+
ret = icl_add_linked_planes(intel_state);
if (ret)
return ret;
@@ -13083,6 +13116,9 @@ static int intel_atomic_check(struct drm_device *dev,
if (ret)
return ret;
+ if (dev->debug)
+ dev->debug(state, "intel_atomic_check() 6");
+
intel_fbc_choose_crtc(dev_priv, intel_state);
return calc_watermark_data(intel_state);
}
diff --git a/drivers/gpu/drm/i915/intel_pipe_crc.c b/drivers/gpu/drm/i915/intel_pipe_crc.c
index f6d0b2aaffe2..d3c5f898fe3b 100644
--- a/drivers/gpu/drm/i915/intel_pipe_crc.c
+++ b/drivers/gpu/drm/i915/intel_pipe_crc.c
@@ -280,6 +280,26 @@ static int ilk_pipe_crc_ctl_reg(enum intel_pipe_crc_source *source,
return 0;
}
+static void state_debug(struct drm_atomic_state *state, const char *txt)
+{
+ struct drm_crtc *crtc;
+ struct drm_crtc_state *new_crtc_state;
+ unsigned i;
+
+ DRM_DEBUG_KMS("debug %s\n", txt);
+
+ for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
+ struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+ struct intel_crtc_state *intel_crtc_state;
+ intel_crtc_state = to_intel_crtc_state(new_crtc_state);
+
+ DRM_DEBUG_KMS("pipe%c\n", pipe_name(intel_crtc->pipe));
+ DRM_DEBUG_KMS("\tgamma_enable=%i csc_enable=%i\n", intel_crtc_state->gamma_enable, intel_crtc_state->csc_enable);
+ }
+
+ dump_stack();
+}
+
static void
intel_crtc_crc_prepare(struct drm_i915_private *dev_priv, struct drm_crtc *crtc,
bool enable)
@@ -291,6 +311,9 @@ intel_crtc_crc_prepare(struct drm_i915_private *dev_priv, struct drm_crtc *crtc,
struct drm_modeset_acquire_ctx ctx;
int ret = 0;
+ if (!dev->debug)
+ dev->debug = state_debug;
+
drm_modeset_acquire_init(&ctx, 0);
state = drm_atomic_state_alloc(dev);
@@ -308,6 +331,11 @@ intel_crtc_crc_prepare(struct drm_i915_private *dev_priv, struct drm_crtc *crtc,
goto put_state;
}
+ pipe_config->base.mode_changed = pipe_config->crc_enabled != enable;
+ DRM_DEBUG_KMS("intel_crtc_crc_prepare() pipe%c mode_changed=%i crc_enabled=%i\n", pipe_name(intel_crtc->pipe), pipe_config->base.mode_changed, enable);
+ DRM_DEBUG_KMS("\tgamma_enable=%i csc_enable=%i\n", pipe_config->gamma_enable, pipe_config->csc_enable);
+ DRM_DEBUG_KMS("\tnormalize_zpos=%i\n", dev->mode_config.normalize_zpos);
+ DRM_DEBUG_KMS("\tdev->debug=%p\n", dev->debug);
pipe_config->crc_enabled = enable;
if (IS_HASWELL(dev_priv) && intel_crtc->pipe == PIPE_A) {
diff --git a/drivers/gpu/drm/i915/intel_psr.c b/drivers/gpu/drm/i915/intel_psr.c
index 6175b1d2e0c8..16d9f699405b 100644
--- a/drivers/gpu/drm/i915/intel_psr.c
+++ b/drivers/gpu/drm/i915/intel_psr.c
@@ -590,6 +590,8 @@ void intel_psr_compute_config(struct intel_dp *intel_dp,
if (intel_dp != dev_priv->psr.dp)
return;
+ DRM_DEBUG_KMS("intel_psr_compute_config()\n");
+
/*
* HSW spec explicitly says PSR is tied to port A.
* BDW+ platforms with DDI implementation of PSR have different
@@ -629,6 +631,9 @@ void intel_psr_compute_config(struct intel_dp *intel_dp,
crtc_state->has_psr = true;
crtc_state->has_psr2 = intel_psr2_config_valid(intel_dp, crtc_state);
+ DRM_DEBUG_KMS("\thas_psr=%i has_psr2=%i\n", crtc_state->has_psr, crtc_state->has_psr2);
+ DRM_DEBUG_KMS("\tpsr gamma_enable=%i csc_enable=%i\n", crtc_state->gamma_enable, crtc_state->csc_enable);
+ dump_stack();
}
static void intel_psr_activate(struct intel_dp *intel_dp)
diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h
index d5e092dccf3e..ba7b5146ee5b 100644
--- a/include/drm/drm_device.h
+++ b/include/drm/drm_device.h
@@ -353,6 +353,8 @@ struct drm_device {
/* Scatter gather memory */
struct drm_sg_mem *sg;
+
+ void (*debug)(struct drm_atomic_state *state, const char *txt);
};
#endif
--
2.21.0
More information about the Intel-gfx-trybot
mailing list