Skip to content

Commit cf49a45

Browse files
Austin Zhengalexdeucher
authored andcommitted
drm/amd/display: Add Component To Handle Bounding Box Values and IP Caps
[Why] Bounding box values can be stored in multiple locations. (e.g. PMFW, VBIOS, DMUB). The source and interpretation of these values can vary with DCN revision so there should be a component that can gather these values and translate them accordingly [How] Have component start with the statically defined values as a base. Then update them as needed with DCN-specific logic Guard this component with FPU flags since values need to be in float point. Reviewed-by: Jun Lei <jun.lei@amd.com> Signed-off-by: Austin Zheng <Austin.Zheng@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent de63b05 commit cf49a45

13 files changed

Lines changed: 475 additions & 356 deletions

File tree

drivers/gpu/drm/amd/display/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/mmhubbub
4444
subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/mpc
4545
subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/opp
4646
subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/pg
47+
subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/soc_and_ip_translator
4748
subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/modules/inc
4849
subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/modules/freesync
4950
subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/modules/color

drivers/gpu/drm/amd/display/dc/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ DC_LIBS += dcn301
3737
DC_LIBS += dcn31
3838
DC_LIBS += dml
3939
DC_LIBS += dml2
40+
DC_LIBS += soc_and_ip_translator
4041
endif
4142

4243
DC_LIBS += dce120

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484

8585
#if defined(CONFIG_DRM_AMD_DC_FP)
8686
#include "dml2/dml2_internal_types.h"
87+
#include "soc_and_ip_translator.h"
8788
#endif
8889

8990
#include "dce/dmub_outbox.h"
@@ -949,7 +950,9 @@ static void dc_destruct(struct dc *dc)
949950
}
950951

951952
dc_destroy_resource_pool(dc);
952-
953+
#ifdef CONFIG_DRM_AMD_DC_FP
954+
dc_destroy_soc_and_ip_translator(&dc->soc_and_ip_translator);
955+
#endif
953956
if (dc->link_srv)
954957
link_destroy_link_service(&dc->link_srv);
955958

@@ -1153,6 +1156,9 @@ static bool dc_construct(struct dc *dc,
11531156
dc->res_pool->funcs->update_bw_bounding_box(dc, dc->clk_mgr->bw_params);
11541157
DC_FP_END();
11551158
}
1159+
dc->soc_and_ip_translator = dc_create_soc_and_ip_translator(dc_ctx->dce_version);
1160+
if (!dc->soc_and_ip_translator)
1161+
goto fail;
11561162
#endif
11571163

11581164
if (!create_links(dc, init_params->num_virtual_links))

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1776,7 +1776,7 @@ struct dc {
17761776
struct dml2_configuration_options dml2_options;
17771777
struct dml2_configuration_options dml2_dc_power_options;
17781778
enum dc_acpi_cm_power_state power_state;
1779-
1779+
struct soc_and_ip_translator *soc_and_ip_translator;
17801780
};
17811781

17821782
struct dc_scaling_info {

drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_translation_helper.c

Lines changed: 15 additions & 353 deletions
Large diffs are not rendered by default.

drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_wrapper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static void dml21_init(const struct dc *in_dc, struct dml2_context *dml_ctx, con
6060

6161
DC_FP_START();
6262

63-
dml21_populate_dml_init_params(&dml_ctx->v21.dml_init, config, in_dc);
63+
dml21_populate_dml_init_params(&dml_ctx->v21.dml_init, &dml_ctx->config, in_dc);
6464

6565
dml2_initialize_instance(&dml_ctx->v21.dml_init);
6666

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// SPDX-License-Identifier: MIT
2+
//
3+
// Copyright 2025 Advanced Micro Devices, Inc.
4+
5+
#ifndef __SOC_AND_IP_TRANSLATOR_H__
6+
#define __SOC_AND_IP_TRANSLATOR_H__
7+
8+
#include "dc.h"
9+
#include "dml_top_soc_parameter_types.h"
10+
11+
struct soc_and_ip_translator_funcs {
12+
void (*get_soc_bb)(struct dml2_soc_bb *soc_bb, const struct dc *dc, const struct dml2_configuration_options *config);
13+
void (*get_ip_caps)(struct dml2_ip_capabilities *dml_ip_caps);
14+
};
15+
16+
struct soc_and_ip_translator {
17+
const struct soc_and_ip_translator_funcs *translator_funcs;
18+
};
19+
20+
struct soc_and_ip_translator *dc_create_soc_and_ip_translator(enum dce_version dc_version);
21+
void dc_destroy_soc_and_ip_translator(struct soc_and_ip_translator **soc_and_ip_translator);
22+
23+
24+
#endif // __SOC_AND_IP_TRANSLATOR_H__
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# SPDX-License-Identifier: MIT
2+
#
3+
# Copyright 2025 Advanced Micro Devices, Inc.
4+
# Makefile for bounding box component.
5+
# Floating point required due to nature of bounding box values
6+
7+
soc_and_ip_translator_ccflags := $(CC_FLAGS_FPU)
8+
soc_and_ip_translator_rcflags := $(CC_FLAGS_NO_FPU)
9+
10+
CFLAGS_$(AMDDALPATH)/dc/soc_and_ip_translator/dcn401/dcn401_soc_and_ip_translator.o := $(soc_and_ip_translator_ccflags)
11+
12+
CFLAGS_REMOVE_$(AMDDALPATH)/dc/soc_and_ip_translator/dcn401/dcn401_soc_and_ip_translator.o := $(soc_and_ip_translator_rcflags)
13+
14+
soc_and_ip_translator := soc_and_ip_translator.o
15+
soc_and_ip_translator += dcn401/dcn401_soc_and_ip_translator.o
16+
17+
AMD_DAL_soc_and_ip_translator := $(addprefix $(AMDDALPATH)/dc/soc_and_ip_translator/, $(soc_and_ip_translator))
18+
19+
AMD_DISPLAY_FILES += $(AMD_DAL_soc_and_ip_translator)

0 commit comments

Comments
 (0)