Skip to content

Commit cb1e0b0

Browse files
Wayne Linalexdeucher
authored andcommitted
drm/amdgpu/display/mst: limit payload to be updated one by one
[Why] amdgpu expects to update payload table for one stream one time by calling dm_helpers_dp_mst_write_payload_allocation_table(). Currently, it get modified to try to update HW payload table at once by referring mst_state. [How] This is just a quick workaround. Should find way to remove the temporary struct dc_dp_mst_stream_allocation_table later if set struct link_mst_stream_allocatio directly is possible. Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/2171 Signed-off-by: Wayne Lin <[email protected]> Signed-off-by: Harry Wentland <[email protected]> Fixes: 4d07b0b ("drm/display/dp_mst: Move all payload info into the atomic state") Cc: [email protected] # 6.1 Acked-by: Harry Wentland <[email protected]> Reviewed-by: Lyude Paul <[email protected]> Tested-by: Didier Raboud <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 1119e1f commit cb1e0b0

File tree

1 file changed

+39
-12
lines changed

1 file changed

+39
-12
lines changed

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

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -120,23 +120,50 @@ enum dc_edid_status dm_helpers_parse_edid_caps(
120120
}
121121

122122
static void
123-
fill_dc_mst_payload_table_from_drm(struct drm_dp_mst_topology_state *mst_state,
124-
struct amdgpu_dm_connector *aconnector,
123+
fill_dc_mst_payload_table_from_drm(struct dc_link *link,
124+
bool enable,
125+
struct drm_dp_mst_atomic_payload *target_payload,
125126
struct dc_dp_mst_stream_allocation_table *table)
126127
{
127128
struct dc_dp_mst_stream_allocation_table new_table = { 0 };
128129
struct dc_dp_mst_stream_allocation *sa;
129-
struct drm_dp_mst_atomic_payload *payload;
130+
struct link_mst_stream_allocation_table copy_of_link_table =
131+
link->mst_stream_alloc_table;
132+
133+
int i;
134+
int current_hw_table_stream_cnt = copy_of_link_table.stream_count;
135+
struct link_mst_stream_allocation *dc_alloc;
136+
137+
/* TODO: refactor to set link->mst_stream_alloc_table directly if possible.*/
138+
if (enable) {
139+
dc_alloc =
140+
&copy_of_link_table.stream_allocations[current_hw_table_stream_cnt];
141+
dc_alloc->vcp_id = target_payload->vcpi;
142+
dc_alloc->slot_count = target_payload->time_slots;
143+
} else {
144+
for (i = 0; i < copy_of_link_table.stream_count; i++) {
145+
dc_alloc =
146+
&copy_of_link_table.stream_allocations[i];
147+
148+
if (dc_alloc->vcp_id == target_payload->vcpi) {
149+
dc_alloc->vcp_id = 0;
150+
dc_alloc->slot_count = 0;
151+
break;
152+
}
153+
}
154+
ASSERT(i != copy_of_link_table.stream_count);
155+
}
130156

131157
/* Fill payload info*/
132-
list_for_each_entry(payload, &mst_state->payloads, next) {
133-
if (payload->delete)
134-
continue;
135-
136-
sa = &new_table.stream_allocations[new_table.stream_count];
137-
sa->slot_count = payload->time_slots;
138-
sa->vcp_id = payload->vcpi;
139-
new_table.stream_count++;
158+
for (i = 0; i < MAX_CONTROLLER_NUM; i++) {
159+
dc_alloc =
160+
&copy_of_link_table.stream_allocations[i];
161+
if (dc_alloc->vcp_id > 0 && dc_alloc->slot_count > 0) {
162+
sa = &new_table.stream_allocations[new_table.stream_count];
163+
sa->slot_count = dc_alloc->slot_count;
164+
sa->vcp_id = dc_alloc->vcp_id;
165+
new_table.stream_count++;
166+
}
140167
}
141168

142169
/* Overwrite the old table */
@@ -185,7 +212,7 @@ bool dm_helpers_dp_mst_write_payload_allocation_table(
185212
* AUX message. The sequence is slot 1-63 allocated sequence for each
186213
* stream. AMD ASIC stream slot allocation should follow the same
187214
* sequence. copy DRM MST allocation to dc */
188-
fill_dc_mst_payload_table_from_drm(mst_state, aconnector, proposed_table);
215+
fill_dc_mst_payload_table_from_drm(stream->link, enable, payload, proposed_table);
189216

190217
return true;
191218
}

0 commit comments

Comments
 (0)