Skip to content

Commit e1e7bc4

Browse files
committed
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: Jani Nikula <[email protected]> Reviewed-by: Ville Syrjälä <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/e48346bfe09a632d5a5faa55e3c161b196cf21e8.1666614699.git.jani.nikula@intel.com
1 parent 66d17ec commit e1e7bc4

File tree

1 file changed

+77
-60
lines changed

1 file changed

+77
-60
lines changed

drivers/gpu/drm/drm_edid.c

Lines changed: 77 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1979,7 +1979,7 @@ bool drm_edid_block_valid(u8 *_block, int block_num, bool print_bad_edid,
19791979

19801980
status = edid_block_check(block, is_base_block);
19811981
if (status == EDID_BLOCK_HEADER_REPAIR) {
1982-
DRM_DEBUG("Fixing EDID header, your hardware may be failing\n");
1982+
DRM_DEBUG_KMS("Fixing EDID header, your hardware may be failing\n");
19831983
edid_header_fix(block);
19841984

19851985
/* Retry with fixed header, update status if that worked. */
@@ -2301,8 +2301,9 @@ int drm_edid_override_connector_update(struct drm_connector *connector)
23012301

23022302
drm_edid_free(override);
23032303

2304-
DRM_DEBUG_KMS("[CONNECTOR:%d:%s] adding %d modes via fallback override/firmware EDID\n",
2305-
connector->base.id, connector->name, num_modes);
2304+
drm_dbg_kms(connector->dev,
2305+
"[CONNECTOR:%d:%s] adding %d modes via fallback override/firmware EDID\n",
2306+
connector->base.id, connector->name, num_modes);
23062307
}
23072308

23082309
return num_modes;
@@ -3388,11 +3389,12 @@ drm_mode_do_interlace_quirk(struct drm_display_mode *mode,
33883389
* timing block contains enough info for us to create and return a new struct
33893390
* drm_display_mode.
33903391
*/
3391-
static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev,
3392+
static struct drm_display_mode *drm_mode_detailed(struct drm_connector *connector,
33923393
const struct drm_edid *drm_edid,
33933394
const struct detailed_timing *timing,
33943395
u32 quirks)
33953396
{
3397+
struct drm_device *dev = connector->dev;
33963398
struct drm_display_mode *mode;
33973399
const struct detailed_pixel_timing *pt = &timing->data.pixel_data;
33983400
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,
34093411
return NULL;
34103412

34113413
if (pt->misc & DRM_EDID_PT_STEREO) {
3412-
DRM_DEBUG_KMS("stereo mode not supported\n");
3414+
drm_dbg_kms(dev, "[CONNECTOR:%d:%s] Stereo mode not supported\n",
3415+
connector->base.id, connector->name);
34133416
return NULL;
34143417
}
34153418
if (!(pt->misc & DRM_EDID_PT_SEPARATE_SYNC)) {
3416-
DRM_DEBUG_KMS("composite sync not supported\n");
3419+
drm_dbg_kms(dev, "[CONNECTOR:%d:%s] Composite sync not supported\n",
3420+
connector->base.id, connector->name);
34173421
}
34183422

34193423
/* it is incorrect if hsync/vsync width is zero */
34203424
if (!hsync_pulse_width || !vsync_pulse_width) {
3421-
DRM_DEBUG_KMS("Incorrect Detailed timing. "
3422-
"Wrong Hsync/Vsync pulse width\n");
3425+
drm_dbg_kms(dev, "[CONNECTOR:%d:%s] Incorrect Detailed timing. Wrong Hsync/Vsync pulse width\n",
3426+
connector->base.id, connector->name);
34233427
return NULL;
34243428
}
34253429

@@ -3976,7 +3980,8 @@ add_cvt_modes(struct drm_connector *connector, const struct drm_edid *drm_edid)
39763980
return closure.modes;
39773981
}
39783982

3979-
static void fixup_detailed_cea_mode_clock(struct drm_display_mode *mode);
3983+
static void fixup_detailed_cea_mode_clock(struct drm_connector *connector,
3984+
struct drm_display_mode *mode);
39803985

39813986
static void
39823987
do_detailed_mode(const struct detailed_timing *timing, void *c)
@@ -3987,7 +3992,7 @@ do_detailed_mode(const struct detailed_timing *timing, void *c)
39873992
if (!is_detailed_timing_descriptor(timing))
39883993
return;
39893994

3990-
newmode = drm_mode_detailed(closure->connector->dev,
3995+
newmode = drm_mode_detailed(closure->connector,
39913996
closure->drm_edid, timing,
39923997
closure->quirks);
39933998
if (!newmode)
@@ -4001,7 +4006,7 @@ do_detailed_mode(const struct detailed_timing *timing, void *c)
40014006
* so fix up anything that looks like CEA/HDMI mode, but the clock
40024007
* is just slightly off.
40034008
*/
4004-
fixup_detailed_cea_mode_clock(newmode);
4009+
fixup_detailed_cea_mode_clock(closure->connector, newmode);
40054010

40064011
drm_mode_probed_add(closure->connector, newmode);
40074012
closure->modes++;
@@ -4663,7 +4668,8 @@ static int add_hdmi_mode(struct drm_connector *connector, u8 vic)
46634668
struct drm_display_mode *newmode;
46644669

46654670
if (!drm_valid_hdmi_vic(vic)) {
4666-
DRM_ERROR("Unknown HDMI VIC: %d\n", vic);
4671+
drm_err(connector->dev, "[CONNECTOR:%d:%s] Unknown HDMI VIC: %d\n",
4672+
connector->base.id, connector->name, vic);
46674673
return 0;
46684674
}
46694675

@@ -5270,7 +5276,8 @@ static int add_cea_modes(struct drm_connector *connector,
52705276
return modes;
52715277
}
52725278

5273-
static void fixup_detailed_cea_mode_clock(struct drm_display_mode *mode)
5279+
static void fixup_detailed_cea_mode_clock(struct drm_connector *connector,
5280+
struct drm_display_mode *mode)
52745281
{
52755282
const struct drm_display_mode *cea_mode;
52765283
int clock1, clock2, clock;
@@ -5308,8 +5315,10 @@ static void fixup_detailed_cea_mode_clock(struct drm_display_mode *mode)
53085315
if (mode->clock == clock)
53095316
return;
53105317

5311-
DRM_DEBUG("detailed mode matches %s VIC %d, adjusting clock %d -> %d\n",
5312-
type, vic, mode->clock, clock);
5318+
drm_dbg_kms(connector->dev,
5319+
"[CONNECTOR:%d:%s] detailed mode matches %s VIC %d, adjusting clock %d -> %d\n",
5320+
connector->base.id, connector->name,
5321+
type, vic, mode->clock, clock);
53135322
mode->clock = clock;
53145323
}
53155324

@@ -5417,15 +5426,12 @@ drm_parse_hdmi_vsdb_audio(struct drm_connector *connector, const u8 *db)
54175426
if (len >= 12)
54185427
connector->audio_latency[1] = db[12];
54195428

5420-
DRM_DEBUG_KMS("HDMI: latency present %d %d, "
5421-
"video latency %d %d, "
5422-
"audio latency %d %d\n",
5423-
connector->latency_present[0],
5424-
connector->latency_present[1],
5425-
connector->video_latency[0],
5426-
connector->video_latency[1],
5427-
connector->audio_latency[0],
5428-
connector->audio_latency[1]);
5429+
drm_dbg_kms(connector->dev,
5430+
"[CONNECTOR:%d:%s] HDMI: latency present %d %d, video latency %d %d, audio latency %d %d\n",
5431+
connector->base.id, connector->name,
5432+
connector->latency_present[0], connector->latency_present[1],
5433+
connector->video_latency[0], connector->video_latency[1],
5434+
connector->audio_latency[0], connector->audio_latency[1]);
54295435
}
54305436

54315437
static void
@@ -5523,7 +5529,9 @@ static void drm_edid_to_eld(struct drm_connector *connector,
55235529
return;
55245530

55255531
mnl = get_monitor_name(drm_edid, &eld[DRM_ELD_MONITOR_NAME_STRING]);
5526-
DRM_DEBUG_KMS("ELD monitor %s\n", &eld[DRM_ELD_MONITOR_NAME_STRING]);
5532+
drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] ELD monitor %s\n",
5533+
connector->base.id, connector->name,
5534+
&eld[DRM_ELD_MONITOR_NAME_STRING]);
55275535

55285536
eld[DRM_ELD_CEA_EDID_VER_MNL] = info->cea_rev << DRM_ELD_CEA_EDID_VER_SHIFT;
55295537
eld[DRM_ELD_CEA_EDID_VER_MNL] |= mnl;
@@ -5577,8 +5585,9 @@ static void drm_edid_to_eld(struct drm_connector *connector,
55775585
eld[DRM_ELD_BASELINE_ELD_LEN] =
55785586
DIV_ROUND_UP(drm_eld_calc_baseline_block_size(eld), 4);
55795587

5580-
DRM_DEBUG_KMS("ELD size %d, SAD count %d\n",
5581-
drm_eld_size(eld), total_sad_count);
5588+
drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] ELD size %d, SAD count %d\n",
5589+
connector->base.id, connector->name,
5590+
drm_eld_size(eld), total_sad_count);
55825591
}
55835592

55845593
static int _drm_edid_to_sad(const struct drm_edid *drm_edid,
@@ -5849,7 +5858,8 @@ static void drm_parse_vcdb(struct drm_connector *connector, const u8 *db)
58495858
{
58505859
struct drm_display_info *info = &connector->display_info;
58515860

5852-
DRM_DEBUG_KMS("CEA VCDB 0x%02x\n", db[2]);
5861+
drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] CEA VCDB 0x%02x\n",
5862+
connector->base.id, connector->name, db[2]);
58535863

58545864
if (db[2] & EDID_CEA_VCDB_QS)
58555865
info->rgb_quant_range_selectable = true;
@@ -6052,48 +6062,48 @@ static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector,
60526062
if (hdmi[6] & DRM_EDID_HDMI_DC_30) {
60536063
dc_bpc = 10;
60546064
info->edid_hdmi_rgb444_dc_modes |= DRM_EDID_HDMI_DC_30;
6055-
DRM_DEBUG("%s: HDMI sink does deep color 30.\n",
6056-
connector->name);
6065+
drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] HDMI sink does deep color 30.\n",
6066+
connector->base.id, connector->name);
60576067
}
60586068

60596069
if (hdmi[6] & DRM_EDID_HDMI_DC_36) {
60606070
dc_bpc = 12;
60616071
info->edid_hdmi_rgb444_dc_modes |= DRM_EDID_HDMI_DC_36;
6062-
DRM_DEBUG("%s: HDMI sink does deep color 36.\n",
6063-
connector->name);
6072+
drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] HDMI sink does deep color 36.\n",
6073+
connector->base.id, connector->name);
60646074
}
60656075

60666076
if (hdmi[6] & DRM_EDID_HDMI_DC_48) {
60676077
dc_bpc = 16;
60686078
info->edid_hdmi_rgb444_dc_modes |= DRM_EDID_HDMI_DC_48;
6069-
DRM_DEBUG("%s: HDMI sink does deep color 48.\n",
6070-
connector->name);
6079+
drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] HDMI sink does deep color 48.\n",
6080+
connector->base.id, connector->name);
60716081
}
60726082

60736083
if (dc_bpc == 0) {
6074-
DRM_DEBUG("%s: No deep color support on this HDMI sink.\n",
6075-
connector->name);
6084+
drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] No deep color support on this HDMI sink.\n",
6085+
connector->base.id, connector->name);
60766086
return;
60776087
}
60786088

6079-
DRM_DEBUG("%s: Assigning HDMI sink color depth as %d bpc.\n",
6080-
connector->name, dc_bpc);
6089+
drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] Assigning HDMI sink color depth as %d bpc.\n",
6090+
connector->base.id, connector->name, dc_bpc);
60816091
info->bpc = dc_bpc;
60826092

60836093
/* YCRCB444 is optional according to spec. */
60846094
if (hdmi[6] & DRM_EDID_HDMI_DC_Y444) {
60856095
info->edid_hdmi_ycbcr444_dc_modes = info->edid_hdmi_rgb444_dc_modes;
6086-
DRM_DEBUG("%s: HDMI sink does YCRCB444 in deep color.\n",
6087-
connector->name);
6096+
drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] HDMI sink does YCRCB444 in deep color.\n",
6097+
connector->base.id, connector->name);
60886098
}
60896099

60906100
/*
60916101
* Spec says that if any deep color mode is supported at all,
60926102
* then deep color 36 bit must be supported.
60936103
*/
60946104
if (!(hdmi[6] & DRM_EDID_HDMI_DC_36)) {
6095-
DRM_DEBUG("%s: HDMI sink should do DC_36, but does not!\n",
6096-
connector->name);
6105+
drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] HDMI sink should do DC_36, but does not!\n",
6106+
connector->base.id, connector->name);
60976107
}
60986108
}
60996109

@@ -6110,10 +6120,9 @@ drm_parse_hdmi_vsdb_video(struct drm_connector *connector, const u8 *db)
61106120
if (len >= 7)
61116121
info->max_tmds_clock = db[7] * 5000;
61126122

6113-
DRM_DEBUG_KMS("HDMI: DVI dual %d, "
6114-
"max TMDS clock %d kHz\n",
6115-
info->dvi_dual,
6116-
info->max_tmds_clock);
6123+
drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] HDMI: DVI dual %d, max TMDS clock %d kHz\n",
6124+
connector->base.id, connector->name,
6125+
info->dvi_dual, info->max_tmds_clock);
61176126

61186127
drm_parse_hdmi_deep_color_info(connector, db);
61196128
}
@@ -6156,8 +6165,10 @@ static void drm_parse_cea_ext(struct drm_connector *connector,
61566165
info->cea_rev = edid_ext[1];
61576166

61586167
if (info->cea_rev != edid_ext[1])
6159-
DRM_DEBUG_KMS("CEA extension version mismatch %u != %u\n",
6160-
info->cea_rev, edid_ext[1]);
6168+
drm_dbg_kms(connector->dev,
6169+
"[CONNECTOR:%d:%s] CEA extension version mismatch %u != %u\n",
6170+
connector->base.id, connector->name,
6171+
info->cea_rev, edid_ext[1]);
61616172

61626173
/* The existence of a CTA extension should imply RGB support */
61636174
info->color_formats = DRM_COLOR_FORMAT_RGB444;
@@ -6243,9 +6254,10 @@ static void drm_get_monitor_range(struct drm_connector *connector,
62436254

62446255
drm_for_each_detailed_block(drm_edid, get_monitor_range, &closure);
62456256

6246-
DRM_DEBUG_KMS("Supported Monitor Refresh rate range is %d Hz - %d Hz\n",
6247-
info->monitor_range.min_vfreq,
6248-
info->monitor_range.max_vfreq);
6257+
drm_dbg_kms(connector->dev,
6258+
"[CONNECTOR:%d:%s] Supported Monitor Refresh rate range is %d Hz - %d Hz\n",
6259+
connector->base.id, connector->name,
6260+
info->monitor_range.min_vfreq, info->monitor_range.max_vfreq);
62496261
}
62506262

62516263
static void drm_parse_vesa_mso_data(struct drm_connector *connector,
@@ -6387,8 +6399,9 @@ static u32 update_display_info(struct drm_connector *connector,
63876399
if (info->bpc == 0 && edid->revision == 3 &&
63886400
edid->input & DRM_EDID_DIGITAL_DFP_1_X) {
63896401
info->bpc = 8;
6390-
DRM_DEBUG("%s: Assigning DFP sink color depth as %d bpc.\n",
6391-
connector->name, info->bpc);
6402+
drm_dbg_kms(connector->dev,
6403+
"[CONNECTOR:%d:%s] Assigning DFP sink color depth as %d bpc.\n",
6404+
connector->base.id, connector->name, info->bpc);
63926405
}
63936406

63946407
/* Only defined for 1.4 with digital displays */
@@ -6420,8 +6433,9 @@ static u32 update_display_info(struct drm_connector *connector,
64206433
break;
64216434
}
64226435

6423-
DRM_DEBUG("%s: Assigning EDID-1.4 digital sink color depth as %d bpc.\n",
6424-
connector->name, info->bpc);
6436+
drm_dbg_kms(connector->dev,
6437+
"[CONNECTOR:%d:%s] Assigning EDID-1.4 digital sink color depth as %d bpc.\n",
6438+
connector->base.id, connector->name, info->bpc);
64256439

64266440
if (edid->features & DRM_EDID_FEATURE_RGB_YCRCB444)
64276441
info->color_formats |= DRM_COLOR_FORMAT_YCBCR444;
@@ -7121,11 +7135,14 @@ static void drm_parse_tiled_block(struct drm_connector *connector,
71217135
connector->tile_h_size = w + 1;
71227136
connector->tile_v_size = h + 1;
71237137

7124-
DRM_DEBUG_KMS("tile cap 0x%x\n", tile->tile_cap);
7125-
DRM_DEBUG_KMS("tile_size %d x %d\n", w + 1, h + 1);
7126-
DRM_DEBUG_KMS("topo num tiles %dx%d, location %dx%d\n",
7127-
num_h_tile + 1, num_v_tile + 1, tile_h_loc, tile_v_loc);
7128-
DRM_DEBUG_KMS("vend %c%c%c\n", tile->topology_id[0], tile->topology_id[1], tile->topology_id[2]);
7138+
drm_dbg_kms(connector->dev,
7139+
"[CONNECTOR:%d:%s] tile cap 0x%x, size %dx%d, num tiles %dx%d, location %dx%d, vend %c%c%c",
7140+
connector->base.id, connector->name,
7141+
tile->tile_cap,
7142+
connector->tile_h_size, connector->tile_v_size,
7143+
connector->num_h_tile, connector->num_v_tile,
7144+
connector->tile_h_loc, connector->tile_v_loc,
7145+
tile->topology_id[0], tile->topology_id[1], tile->topology_id[2]);
71297146

71307147
tg = drm_mode_get_tile_group(connector->dev, tile->topology_id);
71317148
if (!tg)

0 commit comments

Comments
 (0)