Commit 46b3c0f6 authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Reduce ELD hex dumps a bit

Do the ELD hexdumps only up to the last differing byte.
The rest is typically all zeroes anyway so not much point
in dumping it.

Couldn't find anything for memcmp_diff_len() so
rolled my own.

v2: Use semantics and function name suggested by Jani

Cc: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230215150129.13288-1-ville.syrjala@linux.intel.comReviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
parent 8eb2e3b4
...@@ -5344,6 +5344,20 @@ pipe_config_dp_vsc_sdp_mismatch(struct drm_i915_private *dev_priv, ...@@ -5344,6 +5344,20 @@ pipe_config_dp_vsc_sdp_mismatch(struct drm_i915_private *dev_priv,
} }
} }
/* Returns the length up to and including the last differing byte */
static size_t
memcmp_diff_len(const u8 *a, const u8 *b, size_t len)
{
int i;
for (i = len - 1; i >= 0; i--) {
if (a[i] != b[i])
return i + 1;
}
return 0;
}
static void static void
pipe_config_buffer_mismatch(struct drm_i915_private *dev_priv, pipe_config_buffer_mismatch(struct drm_i915_private *dev_priv,
bool fastset, const char *name, bool fastset, const char *name,
...@@ -5353,6 +5367,9 @@ pipe_config_buffer_mismatch(struct drm_i915_private *dev_priv, ...@@ -5353,6 +5367,9 @@ pipe_config_buffer_mismatch(struct drm_i915_private *dev_priv,
if (!drm_debug_enabled(DRM_UT_KMS)) if (!drm_debug_enabled(DRM_UT_KMS))
return; return;
/* only dump up to the last difference */
len = memcmp_diff_len(a, b, len);
drm_dbg_kms(&dev_priv->drm, drm_dbg_kms(&dev_priv->drm,
"fastset mismatch in %s buffer\n", name); "fastset mismatch in %s buffer\n", name);
print_hex_dump(KERN_DEBUG, "expected: ", DUMP_PREFIX_NONE, print_hex_dump(KERN_DEBUG, "expected: ", DUMP_PREFIX_NONE,
...@@ -5360,6 +5377,9 @@ pipe_config_buffer_mismatch(struct drm_i915_private *dev_priv, ...@@ -5360,6 +5377,9 @@ pipe_config_buffer_mismatch(struct drm_i915_private *dev_priv,
print_hex_dump(KERN_DEBUG, "found: ", DUMP_PREFIX_NONE, print_hex_dump(KERN_DEBUG, "found: ", DUMP_PREFIX_NONE,
16, 0, b, len, false); 16, 0, b, len, false);
} else { } else {
/* only dump up to the last difference */
len = memcmp_diff_len(a, b, len);
drm_err(&dev_priv->drm, "mismatch in %s buffer\n", name); drm_err(&dev_priv->drm, "mismatch in %s buffer\n", name);
print_hex_dump(KERN_ERR, "expected: ", DUMP_PREFIX_NONE, print_hex_dump(KERN_ERR, "expected: ", DUMP_PREFIX_NONE,
16, 0, a, len, false); 16, 0, a, len, false);
......
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