Skip to content

Commit e4863f1

Browse files
AMD-aricalexdeucher
authored andcommitted
drm/amd/display: Multi display cause system lag on mode change
[Why] DCValidator is created/destroyed repeatedly for cofunctional validation which causes a lot of memory thrashing, particularly when Driver Verifer is enabled. [How] Implement a basic caching algorithm that will cache DCValidator with a matching topology. When a match is found, the DCValidator can be reused. If there is no match, a new one will be created and inserted into the cache if there is space or an unreference entry can be evicted. Signed-off-by: Aric Cyr <aric.cyr@amd.com> Acked-by: Aurabindo Pillai <aurabindo.pillai@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 48e48e5 commit e4863f1

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

  • drivers/gpu/drm/amd/display/dc/core

‎drivers/gpu/drm/amd/display/dc/core/dc.c‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,20 +1481,26 @@ bool dc_post_update_surfaces_to_stream(struct dc *dc)
14811481
return true;
14821482
}
14831483

1484-
struct dc_state *dc_create_state(struct dc *dc)
1484+
static void init_state(struct dc *dc, struct dc_state *context)
14851485
{
1486-
struct dc_state *context = kvzalloc(sizeof(struct dc_state),
1487-
GFP_KERNEL);
1488-
1489-
if (!context)
1490-
return NULL;
14911486
/* Each context must have their own instance of VBA and in order to
14921487
* initialize and obtain IP and SOC the base DML instance from DC is
14931488
* initially copied into every context
14941489
*/
14951490
#ifdef CONFIG_DRM_AMD_DC_DCN
14961491
memcpy(&context->bw_ctx.dml, &dc->dml, sizeof(struct display_mode_lib));
14971492
#endif
1493+
}
1494+
1495+
struct dc_state *dc_create_state(struct dc *dc)
1496+
{
1497+
struct dc_state *context = kzalloc(sizeof(struct dc_state),
1498+
GFP_KERNEL);
1499+
1500+
if (!context)
1501+
return NULL;
1502+
1503+
init_state(dc, context);
14981504

14991505
kref_init(&context->refcount);
15001506

0 commit comments

Comments
 (0)