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

drm/i915: Convert pipe_config_buffer_mismatch() to drm_printer

Utilize drm_printer in pipe_config_infoframe_mismatch() to avoid
a bit of code duplication.

print_hex_dump() doesn't know anything about the printer so
it still needs the DRM_UT_KMS check and special handling for
the loglevel. But at least we end up with a bit less copy-pasta.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240215164055.30585-6-ville.syrjala@linux.intel.comReviewed-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
parent 78d319a2
...@@ -4876,33 +4876,34 @@ pipe_config_buffer_mismatch(bool fastset, const struct intel_crtc *crtc, ...@@ -4876,33 +4876,34 @@ pipe_config_buffer_mismatch(bool fastset, const struct intel_crtc *crtc,
const char *name, const char *name,
const u8 *a, const u8 *b, size_t len) const u8 *a, const u8 *b, size_t len)
{ {
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); struct drm_i915_private *i915 = to_i915(crtc->base.dev);
struct drm_printer p;
const char *loglevel;
if (fastset) { if (fastset) {
if (!drm_debug_enabled(DRM_UT_KMS)) if (!drm_debug_enabled(DRM_UT_KMS))
return; return;
/* only dump up to the last difference */ p = drm_dbg_printer(&i915->drm, DRM_UT_KMS, NULL);
len = memcmp_diff_len(a, b, len); loglevel = KERN_DEBUG;
drm_dbg_kms(&dev_priv->drm, drm_printf(&p, "[CRTC:%d:%s] fastset requirement not met in %s buffer\n",
"[CRTC:%d:%s] fastset requirement not met in %s buffer\n", crtc->base.base.id, crtc->base.name, name);
crtc->base.base.id, crtc->base.name, name);
print_hex_dump(KERN_DEBUG, "expected: ", DUMP_PREFIX_NONE,
16, 0, a, len, false);
print_hex_dump(KERN_DEBUG, "found: ", DUMP_PREFIX_NONE,
16, 0, b, len, false);
} else { } else {
/* only dump up to the last difference */ p = drm_err_printer(&i915->drm, NULL);
len = memcmp_diff_len(a, b, len); loglevel = KERN_ERR;
drm_err(&dev_priv->drm, "[CRTC:%d:%s] mismatch in %s buffer\n", drm_printf(&p, "[CRTC:%d:%s] mismatch in %s buffer\n",
crtc->base.base.id, crtc->base.name, name); crtc->base.base.id, crtc->base.name, name);
print_hex_dump(KERN_ERR, "expected: ", DUMP_PREFIX_NONE,
16, 0, a, len, false);
print_hex_dump(KERN_ERR, "found: ", DUMP_PREFIX_NONE,
16, 0, b, len, false);
} }
/* only dump up to the last difference */
len = memcmp_diff_len(a, b, len);
print_hex_dump(loglevel, "expected: ", DUMP_PREFIX_NONE,
16, 0, a, len, false);
print_hex_dump(loglevel, "found: ", DUMP_PREFIX_NONE,
16, 0, b, len, false);
} }
static void __printf(4, 5) static void __printf(4, 5)
......
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