Skip to content

Commit 25f7cde

Browse files
Wayne Linalexdeucher
authored andcommitted
drm/amd/display: Add tags for indicating mst progress status
[Why & How] In order to leverage igt tool to maintain mst feature, expose new debugfs entry "mst_progress_status". In our dm flow, record down the result of each phase of mst and user can examine the mst result by checking whether each phase get completed successfully. Tested-by: Daniel Wheeler <[email protected]> Reviewed-by: Hersen Wu <[email protected]> Acked-by: Alan Liu <[email protected]> Signed-off-by: Wayne Lin <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 8b076fa commit 25f7cde

File tree

4 files changed

+94
-3
lines changed

4 files changed

+94
-3
lines changed

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,14 @@ struct dsc_preferred_settings {
571571
bool dsc_force_disable_passthrough;
572572
};
573573

574+
enum mst_progress_status {
575+
MST_STATUS_DEFAULT = 0,
576+
MST_PROBE = BIT(0),
577+
MST_REMOTE_EDID = BIT(1),
578+
MST_ALLOCATE_NEW_PAYLOAD = BIT(2),
579+
MST_CLEAR_ALLOCATED_PAYLOAD = BIT(3),
580+
};
581+
574582
struct amdgpu_dm_connector {
575583

576584
struct drm_connector base;
@@ -623,8 +631,20 @@ struct amdgpu_dm_connector {
623631
struct drm_display_mode freesync_vid_base;
624632

625633
int psr_skip_count;
634+
635+
/* Record progress status of mst*/
636+
uint8_t mst_status;
626637
};
627638

639+
static inline void amdgpu_dm_set_mst_status(uint8_t *status,
640+
uint8_t flags, bool set)
641+
{
642+
if (set)
643+
*status |= flags;
644+
else
645+
*status &= ~flags;
646+
}
647+
628648
#define to_amdgpu_dm_connector(x) container_of(x, struct amdgpu_dm_connector, base)
629649

630650
extern const struct amdgpu_ip_block_version dm_ip_block;

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ struct dmub_debugfs_trace_entry {
5050
uint32_t param1;
5151
};
5252

53+
static const char *const mst_progress_status[] = {
54+
"probe",
55+
"remote_edid",
56+
"allocate_new_payload",
57+
"clear_allocated_payload",
58+
};
59+
5360
/* parse_write_buffer_into_params - Helper function to parse debugfs write buffer into an array
5461
*
5562
* Function takes in attributes passed to debugfs write entry
@@ -2590,6 +2597,41 @@ static int dp_is_mst_connector_show(struct seq_file *m, void *unused)
25902597
return 0;
25912598
}
25922599

2600+
/*
2601+
* function description: Read out the mst progress status
2602+
*
2603+
* This function helps to determine the mst progress status of
2604+
* a mst connector.
2605+
*
2606+
* Access it with the following command:
2607+
*
2608+
* cat /sys/kernel/debug/dri/0/DP-X/mst_progress_status
2609+
*
2610+
*/
2611+
static int dp_mst_progress_status_show(struct seq_file *m, void *unused)
2612+
{
2613+
struct drm_connector *connector = m->private;
2614+
struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector);
2615+
struct amdgpu_device *adev = drm_to_adev(connector->dev);
2616+
int i;
2617+
2618+
mutex_lock(&aconnector->hpd_lock);
2619+
mutex_lock(&adev->dm.dc_lock);
2620+
2621+
if (aconnector->mst_status == MST_STATUS_DEFAULT) {
2622+
seq_puts(m, "disabled\n");
2623+
} else {
2624+
for (i = 0; i < sizeof(mst_progress_status)/sizeof(char *); i++)
2625+
seq_printf(m, "%s:%s\n",
2626+
mst_progress_status[i],
2627+
aconnector->mst_status & BIT(i) ? "done" : "not_done");
2628+
}
2629+
2630+
mutex_unlock(&adev->dm.dc_lock);
2631+
mutex_unlock(&aconnector->hpd_lock);
2632+
2633+
return 0;
2634+
}
25932635

25942636
DEFINE_SHOW_ATTRIBUTE(dp_dsc_fec_support);
25952637
DEFINE_SHOW_ATTRIBUTE(dmub_fw_state);
@@ -2601,6 +2643,7 @@ DEFINE_SHOW_ATTRIBUTE(hdcp_sink_capability);
26012643
DEFINE_SHOW_ATTRIBUTE(internal_display);
26022644
DEFINE_SHOW_ATTRIBUTE(psr_capability);
26032645
DEFINE_SHOW_ATTRIBUTE(dp_is_mst_connector);
2646+
DEFINE_SHOW_ATTRIBUTE(dp_mst_progress_status);
26042647

26052648
static const struct file_operations dp_dsc_clock_en_debugfs_fops = {
26062649
.owner = THIS_MODULE,
@@ -2744,7 +2787,8 @@ static const struct {
27442787
{"dp_dsc_fec_support", &dp_dsc_fec_support_fops},
27452788
{"max_bpc", &dp_max_bpc_debugfs_fops},
27462789
{"dsc_disable_passthrough", &dp_dsc_disable_passthrough_debugfs_fops},
2747-
{"is_mst_connector", &dp_is_mst_connector_fops}
2790+
{"is_mst_connector", &dp_is_mst_connector_fops},
2791+
{"mst_progress_status", &dp_mst_progress_status_fops}
27482792
};
27492793

27502794
#ifdef CONFIG_DRM_AMD_DC_HDCP

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,8 @@ bool dm_helpers_dp_mst_send_payload_allocation(
312312
struct amdgpu_dm_connector *aconnector;
313313
struct drm_dp_mst_topology_mgr *mst_mgr;
314314
struct drm_dp_mst_port *mst_port;
315+
enum mst_progress_status set_flag = MST_ALLOCATE_NEW_PAYLOAD;
316+
enum mst_progress_status clr_flag = MST_CLEAR_ALLOCATED_PAYLOAD;
315317

316318
aconnector = (struct amdgpu_dm_connector *)stream->dm_stream_context;
317319

@@ -325,8 +327,20 @@ bool dm_helpers_dp_mst_send_payload_allocation(
325327
if (!mst_mgr->mst_state)
326328
return false;
327329

328-
/* It's OK for this to fail */
329-
drm_dp_update_payload_part2(mst_mgr);
330+
if (!enable) {
331+
set_flag = MST_CLEAR_ALLOCATED_PAYLOAD;
332+
clr_flag = MST_ALLOCATE_NEW_PAYLOAD;
333+
}
334+
335+
if (drm_dp_update_payload_part2(mst_mgr)) {
336+
amdgpu_dm_set_mst_status(&aconnector->mst_status,
337+
set_flag, false);
338+
} else {
339+
amdgpu_dm_set_mst_status(&aconnector->mst_status,
340+
set_flag, true);
341+
amdgpu_dm_set_mst_status(&aconnector->mst_status,
342+
clr_flag, false);
343+
}
330344

331345
if (!enable)
332346
drm_dp_mst_deallocate_vcpi(mst_mgr, mst_port);

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@ amdgpu_dm_mst_connector_early_unregister(struct drm_connector *connector)
179179
aconnector->dc_sink = NULL;
180180
aconnector->edid = NULL;
181181
}
182+
183+
aconnector->mst_status = MST_STATUS_DEFAULT;
182184
drm_modeset_unlock(&root->mst_mgr.base.lock);
183185
}
184186

@@ -279,6 +281,9 @@ static int dm_dp_mst_get_modes(struct drm_connector *connector)
279281
edid = drm_dp_mst_get_edid(connector, &aconnector->mst_port->mst_mgr, aconnector->port);
280282

281283
if (!edid) {
284+
amdgpu_dm_set_mst_status(&aconnector->mst_status,
285+
MST_REMOTE_EDID, false);
286+
282287
drm_connector_update_edid_property(
283288
&aconnector->base,
284289
NULL);
@@ -309,6 +314,8 @@ static int dm_dp_mst_get_modes(struct drm_connector *connector)
309314
}
310315

311316
aconnector->edid = edid;
317+
amdgpu_dm_set_mst_status(&aconnector->mst_status,
318+
MST_REMOTE_EDID, true);
312319
}
313320

314321
if (aconnector->dc_sink && aconnector->dc_sink->sink_signal == SIGNAL_TYPE_VIRTUAL) {
@@ -430,6 +437,10 @@ dm_dp_mst_detect(struct drm_connector *connector,
430437
dc_sink_release(aconnector->dc_sink);
431438
aconnector->dc_sink = NULL;
432439
aconnector->edid = NULL;
440+
441+
amdgpu_dm_set_mst_status(&aconnector->mst_status,
442+
MST_REMOTE_EDID | MST_ALLOCATE_NEW_PAYLOAD | MST_CLEAR_ALLOCATED_PAYLOAD,
443+
false);
433444
}
434445

435446
return connection_status;
@@ -526,6 +537,8 @@ dm_dp_add_mst_connector(struct drm_dp_mst_topology_mgr *mgr,
526537
connector = &aconnector->base;
527538
aconnector->port = port;
528539
aconnector->mst_port = master;
540+
amdgpu_dm_set_mst_status(&aconnector->mst_status,
541+
MST_PROBE, true);
529542

530543
if (drm_connector_init(
531544
dev,

0 commit comments

Comments
 (0)