Commit e1e7bc48 authored by Jani Nikula's avatar Jani Nikula

drm/edid: convert to device specific logging

Convert to drm_kms_dbg/drm_err where possible, and reference the
connector using [CONNECTOR:%d:%s]. Pass connectors around a bit more to
enable this. Where this is not possible, unify the rest of the debugs to
DRM_DEBUG_KMS.

Rewrite tile debug logging to one line while at it.

v2:
- Use [CONNECTOR:%d:%s] throughout (Ville)
- Tile debug logging revamp
- Pass connector around a bit more
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/e48346bfe09a632d5a5faa55e3c161b196cf21e8.1666614699.git.jani.nikula@intel.com
parent 66d17ecd
...@@ -1979,7 +1979,7 @@ bool drm_edid_block_valid(u8 *_block, int block_num, bool print_bad_edid, ...@@ -1979,7 +1979,7 @@ bool drm_edid_block_valid(u8 *_block, int block_num, bool print_bad_edid,
status = edid_block_check(block, is_base_block); status = edid_block_check(block, is_base_block);
if (status == EDID_BLOCK_HEADER_REPAIR) { if (status == EDID_BLOCK_HEADER_REPAIR) {
DRM_DEBUG("Fixing EDID header, your hardware may be failing\n"); DRM_DEBUG_KMS("Fixing EDID header, your hardware may be failing\n");
edid_header_fix(block); edid_header_fix(block);
/* Retry with fixed header, update status if that worked. */ /* Retry with fixed header, update status if that worked. */
...@@ -2301,7 +2301,8 @@ int drm_edid_override_connector_update(struct drm_connector *connector) ...@@ -2301,7 +2301,8 @@ int drm_edid_override_connector_update(struct drm_connector *connector)
drm_edid_free(override); drm_edid_free(override);
DRM_DEBUG_KMS("[CONNECTOR:%d:%s] adding %d modes via fallback override/firmware EDID\n", drm_dbg_kms(connector->dev,
"[CONNECTOR:%d:%s] adding %d modes via fallback override/firmware EDID\n",
connector->base.id, connector->name, num_modes); connector->base.id, connector->name, num_modes);
} }
...@@ -3388,11 +3389,12 @@ drm_mode_do_interlace_quirk(struct drm_display_mode *mode, ...@@ -3388,11 +3389,12 @@ drm_mode_do_interlace_quirk(struct drm_display_mode *mode,
* timing block contains enough info for us to create and return a new struct * timing block contains enough info for us to create and return a new struct
* drm_display_mode. * drm_display_mode.
*/ */
static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev, static struct drm_display_mode *drm_mode_detailed(struct drm_connector *connector,
const struct drm_edid *drm_edid, const struct drm_edid *drm_edid,
const struct detailed_timing *timing, const struct detailed_timing *timing,
u32 quirks) u32 quirks)
{ {
struct drm_device *dev = connector->dev;
struct drm_display_mode *mode; struct drm_display_mode *mode;
const struct detailed_pixel_timing *pt = &timing->data.pixel_data; const struct detailed_pixel_timing *pt = &timing->data.pixel_data;
unsigned hactive = (pt->hactive_hblank_hi & 0xf0) << 4 | pt->hactive_lo; unsigned hactive = (pt->hactive_hblank_hi & 0xf0) << 4 | pt->hactive_lo;
...@@ -3409,17 +3411,19 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev, ...@@ -3409,17 +3411,19 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev,
return NULL; return NULL;
if (pt->misc & DRM_EDID_PT_STEREO) { if (pt->misc & DRM_EDID_PT_STEREO) {
DRM_DEBUG_KMS("stereo mode not supported\n"); drm_dbg_kms(dev, "[CONNECTOR:%d:%s] Stereo mode not supported\n",
connector->base.id, connector->name);
return NULL; return NULL;
} }
if (!(pt->misc & DRM_EDID_PT_SEPARATE_SYNC)) { if (!(pt->misc & DRM_EDID_PT_SEPARATE_SYNC)) {
DRM_DEBUG_KMS("composite sync not supported\n"); drm_dbg_kms(dev, "[CONNECTOR:%d:%s] Composite sync not supported\n",
connector->base.id, connector->name);
} }
/* it is incorrect if hsync/vsync width is zero */ /* it is incorrect if hsync/vsync width is zero */
if (!hsync_pulse_width || !vsync_pulse_width) { if (!hsync_pulse_width || !vsync_pulse_width) {
DRM_DEBUG_KMS("Incorrect Detailed timing. " drm_dbg_kms(dev, "[CONNECTOR:%d:%s] Incorrect Detailed timing. Wrong Hsync/Vsync pulse width\n",
"Wrong Hsync/Vsync pulse width\n"); connector->base.id, connector->name);
return NULL; return NULL;
} }
...@@ -3976,7 +3980,8 @@ add_cvt_modes(struct drm_connector *connector, const struct drm_edid *drm_edid) ...@@ -3976,7 +3980,8 @@ add_cvt_modes(struct drm_connector *connector, const struct drm_edid *drm_edid)
return closure.modes; return closure.modes;
} }
static void fixup_detailed_cea_mode_clock(struct drm_display_mode *mode); static void fixup_detailed_cea_mode_clock(struct drm_connector *connector,
struct drm_display_mode *mode);
static void static void
do_detailed_mode(const struct detailed_timing *timing, void *c) do_detailed_mode(const struct detailed_timing *timing, void *c)
...@@ -3987,7 +3992,7 @@ do_detailed_mode(const struct detailed_timing *timing, void *c) ...@@ -3987,7 +3992,7 @@ do_detailed_mode(const struct detailed_timing *timing, void *c)
if (!is_detailed_timing_descriptor(timing)) if (!is_detailed_timing_descriptor(timing))
return; return;
newmode = drm_mode_detailed(closure->connector->dev, newmode = drm_mode_detailed(closure->connector,
closure->drm_edid, timing, closure->drm_edid, timing,
closure->quirks); closure->quirks);
if (!newmode) if (!newmode)
...@@ -4001,7 +4006,7 @@ do_detailed_mode(const struct detailed_timing *timing, void *c) ...@@ -4001,7 +4006,7 @@ do_detailed_mode(const struct detailed_timing *timing, void *c)
* so fix up anything that looks like CEA/HDMI mode, but the clock * so fix up anything that looks like CEA/HDMI mode, but the clock
* is just slightly off. * is just slightly off.
*/ */
fixup_detailed_cea_mode_clock(newmode); fixup_detailed_cea_mode_clock(closure->connector, newmode);
drm_mode_probed_add(closure->connector, newmode); drm_mode_probed_add(closure->connector, newmode);
closure->modes++; closure->modes++;
...@@ -4663,7 +4668,8 @@ static int add_hdmi_mode(struct drm_connector *connector, u8 vic) ...@@ -4663,7 +4668,8 @@ static int add_hdmi_mode(struct drm_connector *connector, u8 vic)
struct drm_display_mode *newmode; struct drm_display_mode *newmode;
if (!drm_valid_hdmi_vic(vic)) { if (!drm_valid_hdmi_vic(vic)) {
DRM_ERROR("Unknown HDMI VIC: %d\n", vic); drm_err(connector->dev, "[CONNECTOR:%d:%s] Unknown HDMI VIC: %d\n",
connector->base.id, connector->name, vic);
return 0; return 0;
} }
...@@ -5270,7 +5276,8 @@ static int add_cea_modes(struct drm_connector *connector, ...@@ -5270,7 +5276,8 @@ static int add_cea_modes(struct drm_connector *connector,
return modes; return modes;
} }
static void fixup_detailed_cea_mode_clock(struct drm_display_mode *mode) static void fixup_detailed_cea_mode_clock(struct drm_connector *connector,
struct drm_display_mode *mode)
{ {
const struct drm_display_mode *cea_mode; const struct drm_display_mode *cea_mode;
int clock1, clock2, clock; int clock1, clock2, clock;
...@@ -5308,7 +5315,9 @@ static void fixup_detailed_cea_mode_clock(struct drm_display_mode *mode) ...@@ -5308,7 +5315,9 @@ static void fixup_detailed_cea_mode_clock(struct drm_display_mode *mode)
if (mode->clock == clock) if (mode->clock == clock)
return; return;
DRM_DEBUG("detailed mode matches %s VIC %d, adjusting clock %d -> %d\n", drm_dbg_kms(connector->dev,
"[CONNECTOR:%d:%s] detailed mode matches %s VIC %d, adjusting clock %d -> %d\n",
connector->base.id, connector->name,
type, vic, mode->clock, clock); type, vic, mode->clock, clock);
mode->clock = clock; mode->clock = clock;
} }
...@@ -5417,15 +5426,12 @@ drm_parse_hdmi_vsdb_audio(struct drm_connector *connector, const u8 *db) ...@@ -5417,15 +5426,12 @@ drm_parse_hdmi_vsdb_audio(struct drm_connector *connector, const u8 *db)
if (len >= 12) if (len >= 12)
connector->audio_latency[1] = db[12]; connector->audio_latency[1] = db[12];
DRM_DEBUG_KMS("HDMI: latency present %d %d, " drm_dbg_kms(connector->dev,
"video latency %d %d, " "[CONNECTOR:%d:%s] HDMI: latency present %d %d, video latency %d %d, audio latency %d %d\n",
"audio latency %d %d\n", connector->base.id, connector->name,
connector->latency_present[0], connector->latency_present[0], connector->latency_present[1],
connector->latency_present[1], connector->video_latency[0], connector->video_latency[1],
connector->video_latency[0], connector->audio_latency[0], connector->audio_latency[1]);
connector->video_latency[1],
connector->audio_latency[0],
connector->audio_latency[1]);
} }
static void static void
...@@ -5523,7 +5529,9 @@ static void drm_edid_to_eld(struct drm_connector *connector, ...@@ -5523,7 +5529,9 @@ static void drm_edid_to_eld(struct drm_connector *connector,
return; return;
mnl = get_monitor_name(drm_edid, &eld[DRM_ELD_MONITOR_NAME_STRING]); mnl = get_monitor_name(drm_edid, &eld[DRM_ELD_MONITOR_NAME_STRING]);
DRM_DEBUG_KMS("ELD monitor %s\n", &eld[DRM_ELD_MONITOR_NAME_STRING]); drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] ELD monitor %s\n",
connector->base.id, connector->name,
&eld[DRM_ELD_MONITOR_NAME_STRING]);
eld[DRM_ELD_CEA_EDID_VER_MNL] = info->cea_rev << DRM_ELD_CEA_EDID_VER_SHIFT; eld[DRM_ELD_CEA_EDID_VER_MNL] = info->cea_rev << DRM_ELD_CEA_EDID_VER_SHIFT;
eld[DRM_ELD_CEA_EDID_VER_MNL] |= mnl; eld[DRM_ELD_CEA_EDID_VER_MNL] |= mnl;
...@@ -5577,7 +5585,8 @@ static void drm_edid_to_eld(struct drm_connector *connector, ...@@ -5577,7 +5585,8 @@ static void drm_edid_to_eld(struct drm_connector *connector,
eld[DRM_ELD_BASELINE_ELD_LEN] = eld[DRM_ELD_BASELINE_ELD_LEN] =
DIV_ROUND_UP(drm_eld_calc_baseline_block_size(eld), 4); DIV_ROUND_UP(drm_eld_calc_baseline_block_size(eld), 4);
DRM_DEBUG_KMS("ELD size %d, SAD count %d\n", drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] ELD size %d, SAD count %d\n",
connector->base.id, connector->name,
drm_eld_size(eld), total_sad_count); drm_eld_size(eld), total_sad_count);
} }
...@@ -5849,7 +5858,8 @@ static void drm_parse_vcdb(struct drm_connector *connector, const u8 *db) ...@@ -5849,7 +5858,8 @@ static void drm_parse_vcdb(struct drm_connector *connector, const u8 *db)
{ {
struct drm_display_info *info = &connector->display_info; struct drm_display_info *info = &connector->display_info;
DRM_DEBUG_KMS("CEA VCDB 0x%02x\n", db[2]); drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] CEA VCDB 0x%02x\n",
connector->base.id, connector->name, db[2]);
if (db[2] & EDID_CEA_VCDB_QS) if (db[2] & EDID_CEA_VCDB_QS)
info->rgb_quant_range_selectable = true; info->rgb_quant_range_selectable = true;
...@@ -6052,39 +6062,39 @@ static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector, ...@@ -6052,39 +6062,39 @@ static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector,
if (hdmi[6] & DRM_EDID_HDMI_DC_30) { if (hdmi[6] & DRM_EDID_HDMI_DC_30) {
dc_bpc = 10; dc_bpc = 10;
info->edid_hdmi_rgb444_dc_modes |= DRM_EDID_HDMI_DC_30; info->edid_hdmi_rgb444_dc_modes |= DRM_EDID_HDMI_DC_30;
DRM_DEBUG("%s: HDMI sink does deep color 30.\n", drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] HDMI sink does deep color 30.\n",
connector->name); connector->base.id, connector->name);
} }
if (hdmi[6] & DRM_EDID_HDMI_DC_36) { if (hdmi[6] & DRM_EDID_HDMI_DC_36) {
dc_bpc = 12; dc_bpc = 12;
info->edid_hdmi_rgb444_dc_modes |= DRM_EDID_HDMI_DC_36; info->edid_hdmi_rgb444_dc_modes |= DRM_EDID_HDMI_DC_36;
DRM_DEBUG("%s: HDMI sink does deep color 36.\n", drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] HDMI sink does deep color 36.\n",
connector->name); connector->base.id, connector->name);
} }
if (hdmi[6] & DRM_EDID_HDMI_DC_48) { if (hdmi[6] & DRM_EDID_HDMI_DC_48) {
dc_bpc = 16; dc_bpc = 16;
info->edid_hdmi_rgb444_dc_modes |= DRM_EDID_HDMI_DC_48; info->edid_hdmi_rgb444_dc_modes |= DRM_EDID_HDMI_DC_48;
DRM_DEBUG("%s: HDMI sink does deep color 48.\n", drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] HDMI sink does deep color 48.\n",
connector->name); connector->base.id, connector->name);
} }
if (dc_bpc == 0) { if (dc_bpc == 0) {
DRM_DEBUG("%s: No deep color support on this HDMI sink.\n", drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] No deep color support on this HDMI sink.\n",
connector->name); connector->base.id, connector->name);
return; return;
} }
DRM_DEBUG("%s: Assigning HDMI sink color depth as %d bpc.\n", drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] Assigning HDMI sink color depth as %d bpc.\n",
connector->name, dc_bpc); connector->base.id, connector->name, dc_bpc);
info->bpc = dc_bpc; info->bpc = dc_bpc;
/* YCRCB444 is optional according to spec. */ /* YCRCB444 is optional according to spec. */
if (hdmi[6] & DRM_EDID_HDMI_DC_Y444) { if (hdmi[6] & DRM_EDID_HDMI_DC_Y444) {
info->edid_hdmi_ycbcr444_dc_modes = info->edid_hdmi_rgb444_dc_modes; info->edid_hdmi_ycbcr444_dc_modes = info->edid_hdmi_rgb444_dc_modes;
DRM_DEBUG("%s: HDMI sink does YCRCB444 in deep color.\n", drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] HDMI sink does YCRCB444 in deep color.\n",
connector->name); connector->base.id, connector->name);
} }
/* /*
...@@ -6092,8 +6102,8 @@ static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector, ...@@ -6092,8 +6102,8 @@ static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector,
* then deep color 36 bit must be supported. * then deep color 36 bit must be supported.
*/ */
if (!(hdmi[6] & DRM_EDID_HDMI_DC_36)) { if (!(hdmi[6] & DRM_EDID_HDMI_DC_36)) {
DRM_DEBUG("%s: HDMI sink should do DC_36, but does not!\n", drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] HDMI sink should do DC_36, but does not!\n",
connector->name); connector->base.id, connector->name);
} }
} }
...@@ -6110,10 +6120,9 @@ drm_parse_hdmi_vsdb_video(struct drm_connector *connector, const u8 *db) ...@@ -6110,10 +6120,9 @@ drm_parse_hdmi_vsdb_video(struct drm_connector *connector, const u8 *db)
if (len >= 7) if (len >= 7)
info->max_tmds_clock = db[7] * 5000; info->max_tmds_clock = db[7] * 5000;
DRM_DEBUG_KMS("HDMI: DVI dual %d, " drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] HDMI: DVI dual %d, max TMDS clock %d kHz\n",
"max TMDS clock %d kHz\n", connector->base.id, connector->name,
info->dvi_dual, info->dvi_dual, info->max_tmds_clock);
info->max_tmds_clock);
drm_parse_hdmi_deep_color_info(connector, db); drm_parse_hdmi_deep_color_info(connector, db);
} }
...@@ -6156,7 +6165,9 @@ static void drm_parse_cea_ext(struct drm_connector *connector, ...@@ -6156,7 +6165,9 @@ static void drm_parse_cea_ext(struct drm_connector *connector,
info->cea_rev = edid_ext[1]; info->cea_rev = edid_ext[1];
if (info->cea_rev != edid_ext[1]) if (info->cea_rev != edid_ext[1])
DRM_DEBUG_KMS("CEA extension version mismatch %u != %u\n", drm_dbg_kms(connector->dev,
"[CONNECTOR:%d:%s] CEA extension version mismatch %u != %u\n",
connector->base.id, connector->name,
info->cea_rev, edid_ext[1]); info->cea_rev, edid_ext[1]);
/* The existence of a CTA extension should imply RGB support */ /* The existence of a CTA extension should imply RGB support */
...@@ -6243,9 +6254,10 @@ static void drm_get_monitor_range(struct drm_connector *connector, ...@@ -6243,9 +6254,10 @@ static void drm_get_monitor_range(struct drm_connector *connector,
drm_for_each_detailed_block(drm_edid, get_monitor_range, &closure); drm_for_each_detailed_block(drm_edid, get_monitor_range, &closure);
DRM_DEBUG_KMS("Supported Monitor Refresh rate range is %d Hz - %d Hz\n", drm_dbg_kms(connector->dev,
info->monitor_range.min_vfreq, "[CONNECTOR:%d:%s] Supported Monitor Refresh rate range is %d Hz - %d Hz\n",
info->monitor_range.max_vfreq); connector->base.id, connector->name,
info->monitor_range.min_vfreq, info->monitor_range.max_vfreq);
} }
static void drm_parse_vesa_mso_data(struct drm_connector *connector, static void drm_parse_vesa_mso_data(struct drm_connector *connector,
...@@ -6387,8 +6399,9 @@ static u32 update_display_info(struct drm_connector *connector, ...@@ -6387,8 +6399,9 @@ static u32 update_display_info(struct drm_connector *connector,
if (info->bpc == 0 && edid->revision == 3 && if (info->bpc == 0 && edid->revision == 3 &&
edid->input & DRM_EDID_DIGITAL_DFP_1_X) { edid->input & DRM_EDID_DIGITAL_DFP_1_X) {
info->bpc = 8; info->bpc = 8;
DRM_DEBUG("%s: Assigning DFP sink color depth as %d bpc.\n", drm_dbg_kms(connector->dev,
connector->name, info->bpc); "[CONNECTOR:%d:%s] Assigning DFP sink color depth as %d bpc.\n",
connector->base.id, connector->name, info->bpc);
} }
/* Only defined for 1.4 with digital displays */ /* Only defined for 1.4 with digital displays */
...@@ -6420,8 +6433,9 @@ static u32 update_display_info(struct drm_connector *connector, ...@@ -6420,8 +6433,9 @@ static u32 update_display_info(struct drm_connector *connector,
break; break;
} }
DRM_DEBUG("%s: Assigning EDID-1.4 digital sink color depth as %d bpc.\n", drm_dbg_kms(connector->dev,
connector->name, info->bpc); "[CONNECTOR:%d:%s] Assigning EDID-1.4 digital sink color depth as %d bpc.\n",
connector->base.id, connector->name, info->bpc);
if (edid->features & DRM_EDID_FEATURE_RGB_YCRCB444) if (edid->features & DRM_EDID_FEATURE_RGB_YCRCB444)
info->color_formats |= DRM_COLOR_FORMAT_YCBCR444; info->color_formats |= DRM_COLOR_FORMAT_YCBCR444;
...@@ -7121,11 +7135,14 @@ static void drm_parse_tiled_block(struct drm_connector *connector, ...@@ -7121,11 +7135,14 @@ static void drm_parse_tiled_block(struct drm_connector *connector,
connector->tile_h_size = w + 1; connector->tile_h_size = w + 1;
connector->tile_v_size = h + 1; connector->tile_v_size = h + 1;
DRM_DEBUG_KMS("tile cap 0x%x\n", tile->tile_cap); drm_dbg_kms(connector->dev,
DRM_DEBUG_KMS("tile_size %d x %d\n", w + 1, h + 1); "[CONNECTOR:%d:%s] tile cap 0x%x, size %dx%d, num tiles %dx%d, location %dx%d, vend %c%c%c",
DRM_DEBUG_KMS("topo num tiles %dx%d, location %dx%d\n", connector->base.id, connector->name,
num_h_tile + 1, num_v_tile + 1, tile_h_loc, tile_v_loc); tile->tile_cap,
DRM_DEBUG_KMS("vend %c%c%c\n", tile->topology_id[0], tile->topology_id[1], tile->topology_id[2]); connector->tile_h_size, connector->tile_v_size,
connector->num_h_tile, connector->num_v_tile,
connector->tile_h_loc, connector->tile_v_loc,
tile->topology_id[0], tile->topology_id[1], tile->topology_id[2]);
tg = drm_mode_get_tile_group(connector->dev, tile->topology_id); tg = drm_mode_get_tile_group(connector->dev, tile->topology_id);
if (!tg) if (!tg)
......
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