Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd/display: update pipe topology log to support subvp

[why]
There is an ambiguity in subvp pipe topology log. The log doesn't show
subvp relation to main stream and it is not clear that certain stream
is an internal stream for subvp pipes.

[how]
Separate subvp pipe topology logging from main pipe topology. Log main
stream indices instead of the internal stream for subvp pipes.
The following is a sample log showing 2 streams with subvp enabled on
both:

pipe topology update
________________________
| plane0 slice0 stream0|
|DPP1----OPP1----OTG1----|
| plane0 slice0 stream1|
|DPP0----OPP0----OTG0----|
| (phantom pipes) |
| plane0 slice0 stream0|
|DPP3----OPP3----OTG3----|
| plane0 slice0 stream1|
|DPP2----OPP2----OTG2----|
|________________________|

Reviewed-by: Alvin Lee <alvin.lee2@amd.com>
Acked-by: Roman Li <roman.li@amd.com>
Signed-off-by: Wenjing Liu <wenjing.liu@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Wenjing Liu and committed by
Alex Deucher
5db346c2 89e5f42c

+65 -31
+65 -31
drivers/gpu/drm/amd/display/dc/core/dc_resource.c
··· 2193 2193 } 2194 2194 } 2195 2195 2196 - void resource_log_pipe_topology_update(struct dc *dc, struct dc_state *state) 2196 + static void resource_log_pipe_for_stream(struct dc *dc, struct dc_state *state, 2197 + struct pipe_ctx *otg_master, int stream_idx) 2197 2198 { 2198 - struct pipe_ctx *otg_master; 2199 2199 struct pipe_ctx *opp_heads[MAX_PIPES]; 2200 2200 struct pipe_ctx *dpp_pipes[MAX_PIPES]; 2201 2201 2202 - int stream_idx, slice_idx, dpp_idx, plane_idx, slice_count, dpp_count; 2202 + int slice_idx, dpp_idx, plane_idx, slice_count, dpp_count; 2203 2203 bool is_primary; 2204 + DC_LOGGER_INIT(dc->ctx->logger); 2205 + 2206 + slice_count = resource_get_opp_heads_for_otg_master(otg_master, 2207 + &state->res_ctx, opp_heads); 2208 + for (slice_idx = 0; slice_idx < slice_count; slice_idx++) { 2209 + plane_idx = -1; 2210 + if (opp_heads[slice_idx]->plane_state) { 2211 + dpp_count = resource_get_dpp_pipes_for_opp_head( 2212 + opp_heads[slice_idx], 2213 + &state->res_ctx, 2214 + dpp_pipes); 2215 + for (dpp_idx = 0; dpp_idx < dpp_count; dpp_idx++) { 2216 + is_primary = !dpp_pipes[dpp_idx]->top_pipe || 2217 + dpp_pipes[dpp_idx]->top_pipe->plane_state != dpp_pipes[dpp_idx]->plane_state; 2218 + if (is_primary) 2219 + plane_idx++; 2220 + resource_log_pipe(dc, dpp_pipes[dpp_idx], 2221 + stream_idx, slice_idx, 2222 + plane_idx, slice_count, 2223 + is_primary); 2224 + } 2225 + } else { 2226 + resource_log_pipe(dc, opp_heads[slice_idx], 2227 + stream_idx, slice_idx, plane_idx, 2228 + slice_count, true); 2229 + } 2230 + 2231 + } 2232 + } 2233 + 2234 + static int resource_stream_to_stream_idx(struct dc_state *state, 2235 + struct dc_stream_state *stream) 2236 + { 2237 + int i, stream_idx = -1; 2238 + 2239 + for (i = 0; i < state->stream_count; i++) 2240 + if (state->streams[i] == stream) { 2241 + stream_idx = i; 2242 + break; 2243 + } 2244 + return stream_idx; 2245 + } 2246 + 2247 + void resource_log_pipe_topology_update(struct dc *dc, struct dc_state *state) 2248 + { 2249 + struct pipe_ctx *otg_master; 2250 + int stream_idx, phantom_stream_idx; 2204 2251 DC_LOGGER_INIT(dc->ctx->logger); 2205 2252 2206 2253 DC_LOG_DC(" pipe topology update"); 2207 2254 DC_LOG_DC(" ________________________"); 2208 2255 for (stream_idx = 0; stream_idx < state->stream_count; stream_idx++) { 2256 + if (state->streams[stream_idx]->is_phantom) 2257 + continue; 2258 + 2209 2259 otg_master = resource_get_otg_master_for_stream( 2210 2260 &state->res_ctx, state->streams[stream_idx]); 2211 - if (!otg_master || otg_master->stream_res.tg == NULL) { 2212 - DC_LOG_DC("topology update: otg_master NULL stream_idx %d!\n", stream_idx); 2213 - return; 2214 - } 2215 - slice_count = resource_get_opp_heads_for_otg_master(otg_master, 2216 - &state->res_ctx, opp_heads); 2217 - for (slice_idx = 0; slice_idx < slice_count; slice_idx++) { 2218 - plane_idx = -1; 2219 - if (opp_heads[slice_idx]->plane_state) { 2220 - dpp_count = resource_get_dpp_pipes_for_opp_head( 2221 - opp_heads[slice_idx], 2222 - &state->res_ctx, 2223 - dpp_pipes); 2224 - for (dpp_idx = 0; dpp_idx < dpp_count; dpp_idx++) { 2225 - is_primary = !dpp_pipes[dpp_idx]->top_pipe || 2226 - dpp_pipes[dpp_idx]->top_pipe->plane_state != dpp_pipes[dpp_idx]->plane_state; 2227 - if (is_primary) 2228 - plane_idx++; 2229 - resource_log_pipe(dc, dpp_pipes[dpp_idx], 2230 - stream_idx, slice_idx, 2231 - plane_idx, slice_count, 2232 - is_primary); 2233 - } 2234 - } else { 2235 - resource_log_pipe(dc, opp_heads[slice_idx], 2236 - stream_idx, slice_idx, plane_idx, 2237 - slice_count, true); 2238 - } 2261 + resource_log_pipe_for_stream(dc, state, otg_master, stream_idx); 2262 + } 2263 + if (state->phantom_stream_count > 0) { 2264 + DC_LOG_DC(" | (phantom pipes) |"); 2265 + for (stream_idx = 0; stream_idx < state->stream_count; stream_idx++) { 2266 + if (state->stream_status[stream_idx].mall_stream_config.type != SUBVP_MAIN) 2267 + continue; 2239 2268 2269 + phantom_stream_idx = resource_stream_to_stream_idx(state, 2270 + state->stream_status[stream_idx].mall_stream_config.paired_stream); 2271 + otg_master = resource_get_otg_master_for_stream( 2272 + &state->res_ctx, state->streams[phantom_stream_idx]); 2273 + resource_log_pipe_for_stream(dc, state, otg_master, stream_idx); 2240 2274 } 2241 2275 } 2242 2276 DC_LOG_DC(" |________________________|\n");