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

Configure Feed

Select the types of activity you want to include in your feed.

drm/amd/display: Update cursor limits based on SW cursor fallback limits

[Why&How]
For determining the cursor size limit, use the same checks that
are used for determining SW cursor fallback instead of only
using SubVP

Reviewed-by: Aric Cyr <aric.cyr@amd.com>
Acked-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: Alvin Lee <alvin.lee2@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Alvin Lee and committed by
Alex Deucher
ddd5298c c7c19779

+47 -37
+4 -4
drivers/gpu/drm/amd/display/dc/core/dc.c
··· 5472 5472 void dc_query_current_properties(struct dc *dc, struct dc_current_properties *properties) 5473 5473 { 5474 5474 unsigned int i; 5475 - bool subvp_in_use = false; 5475 + bool subvp_sw_cursor_req = false; 5476 5476 5477 5477 for (i = 0; i < dc->current_state->stream_count; i++) { 5478 - if (dc->current_state->streams[i]->mall_stream_config.type != SUBVP_NONE) { 5479 - subvp_in_use = true; 5478 + if (check_subvp_sw_cursor_fallback_req(dc, dc->current_state->streams[i])) { 5479 + subvp_sw_cursor_req = true; 5480 5480 break; 5481 5481 } 5482 5482 } 5483 - properties->cursor_size_limit = subvp_in_use ? 64 : dc->caps.max_cursor_size; 5483 + properties->cursor_size_limit = subvp_sw_cursor_req ? 64 : dc->caps.max_cursor_size; 5484 5484 } 5485 5485 5486 5486 /**
+39
drivers/gpu/drm/amd/display/dc/core/dc_resource.c
··· 1341 1341 data->viewport_c.y += src.y / vpc_div; 1342 1342 } 1343 1343 1344 + static bool is_subvp_high_refresh_candidate(struct dc_stream_state *stream) 1345 + { 1346 + uint32_t refresh_rate; 1347 + struct dc *dc = stream->ctx->dc; 1348 + 1349 + refresh_rate = (stream->timing.pix_clk_100hz * (uint64_t)100 + 1350 + stream->timing.v_total * stream->timing.h_total - (uint64_t)1); 1351 + refresh_rate = div_u64(refresh_rate, stream->timing.v_total); 1352 + refresh_rate = div_u64(refresh_rate, stream->timing.h_total); 1353 + 1354 + /* If there's any stream that fits the SubVP high refresh criteria, 1355 + * we must return true. This is because cursor updates are asynchronous 1356 + * with full updates, so we could transition into a SubVP config and 1357 + * remain in HW cursor mode if there's no cursor update which will 1358 + * then cause corruption. 1359 + */ 1360 + if ((refresh_rate >= 120 && refresh_rate <= 175 && 1361 + stream->timing.v_addressable >= 1080 && 1362 + stream->timing.v_addressable <= 2160) && 1363 + (dc->current_state->stream_count > 1 || 1364 + (dc->current_state->stream_count == 1 && !stream->allow_freesync))) 1365 + return true; 1366 + 1367 + return false; 1368 + } 1369 + 1344 1370 bool resource_build_scaling_params(struct pipe_ctx *pipe_ctx) 1345 1371 { 1346 1372 const struct dc_plane_state *plane_state = pipe_ctx->plane_state; ··· 5147 5121 return DC_OK; 5148 5122 } 5149 5123 5124 + bool check_subvp_sw_cursor_fallback_req(const struct dc *dc, struct dc_stream_state *stream) 5125 + { 5126 + if (!dc->debug.disable_subvp_high_refresh && is_subvp_high_refresh_candidate(stream)) 5127 + return true; 5128 + if (dc->current_state->stream_count == 1 && stream->timing.v_addressable >= 2880 && 5129 + ((stream->timing.pix_clk_100hz * 100) / stream->timing.v_total / stream->timing.h_total) < 120) 5130 + return true; 5131 + else if (dc->current_state->stream_count > 1 && stream->timing.v_addressable >= 2160 && 5132 + ((stream->timing.pix_clk_100hz * 100) / stream->timing.v_total / stream->timing.h_total) < 120) 5133 + return true; 5134 + 5135 + return false; 5136 + }
+1 -33
drivers/gpu/drm/amd/display/dc/core/dc_stream.c
··· 288 288 } 289 289 } 290 290 291 - static bool is_subvp_high_refresh_candidate(struct dc_stream_state *stream) 292 - { 293 - uint32_t refresh_rate; 294 - struct dc *dc = stream->ctx->dc; 295 - 296 - refresh_rate = (stream->timing.pix_clk_100hz * (uint64_t)100 + 297 - stream->timing.v_total * stream->timing.h_total - (uint64_t)1); 298 - refresh_rate = div_u64(refresh_rate, stream->timing.v_total); 299 - refresh_rate = div_u64(refresh_rate, stream->timing.h_total); 300 - 301 - /* If there's any stream that fits the SubVP high refresh criteria, 302 - * we must return true. This is because cursor updates are asynchronous 303 - * with full updates, so we could transition into a SubVP config and 304 - * remain in HW cursor mode if there's no cursor update which will 305 - * then cause corruption. 306 - */ 307 - if ((refresh_rate >= 120 && refresh_rate <= 175 && 308 - stream->timing.v_addressable >= 1080 && 309 - stream->timing.v_addressable <= 2160) && 310 - (dc->current_state->stream_count > 1 || 311 - (dc->current_state->stream_count == 1 && !stream->allow_freesync))) 312 - return true; 313 - 314 - return false; 315 - } 316 - 317 291 /* 318 292 * dc_stream_set_cursor_attributes() - Update cursor attributes and set cursor surface address 319 293 */ ··· 321 347 * 3. If not subvp high refresh, for multi display cases, if resolution is >= 4K and refresh rate < 120hz 322 348 */ 323 349 if (dc->debug.allow_sw_cursor_fallback && attributes->height * attributes->width * 4 > 16384) { 324 - if (!dc->debug.disable_subvp_high_refresh && is_subvp_high_refresh_candidate(stream)) 325 - return false; 326 - if (dc->current_state->stream_count == 1 && stream->timing.v_addressable >= 2880 && 327 - ((stream->timing.pix_clk_100hz * 100) / stream->timing.v_total / stream->timing.h_total) < 120) 328 - return false; 329 - else if (dc->current_state->stream_count > 1 && stream->timing.v_addressable >= 2160 && 330 - ((stream->timing.pix_clk_100hz * 100) / stream->timing.v_total / stream->timing.h_total) < 120) 350 + if (check_subvp_sw_cursor_fallback_req(dc, stream)) 331 351 return false; 332 352 } 333 353
+3
drivers/gpu/drm/amd/display/dc/inc/resource.h
··· 604 604 enum dc_status update_dp_encoder_resources_for_test_harness(const struct dc *dc, 605 605 struct dc_state *context, 606 606 struct pipe_ctx *pipe_ctx); 607 + 608 + bool check_subvp_sw_cursor_fallback_req(const struct dc *dc, struct dc_stream_state *stream); 609 + 607 610 #endif /* DRIVERS_GPU_DRM_AMD_DC_DEV_DC_INC_RESOURCE_H_ */