drm/amd/display: Query DC for gfx handling when setting linear tiling

[Why]
Post-driver cases always use linear tiling yet gfx handling for this
case is improper, allowing for incorrect gfx structs to be populated and
used.

[How]
Query DC for the apporpriate linear tiling mode and populate the DCN
specific gfx version structs.

Reviewed-by: Dillon Varone <dillon.varone@amd.com>
Signed-off-by: Nicholas Carbones <Nicholas.Carbones@amd.com>
Signed-off-by: Chuanyu Tseng <chuanyu.tseng@amd.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Nicholas Carbones 2026-03-11 14:36:05 +08:00 committed by Alex Deucher
parent b034c5b0d8
commit 8333f22e44
23 changed files with 69 additions and 15 deletions

View File

@ -2617,6 +2617,16 @@ void dc_post_update_surfaces_to_stream(struct dc *dc)
dc->optimized_required = false; dc->optimized_required = false;
} }
void dc_get_default_tiling_info(const struct dc *dc, struct dc_tiling_info *tiling_info)
{
if (!dc || !tiling_info)
return;
if (dc->res_pool && dc->res_pool->funcs && dc->res_pool->funcs->get_default_tiling_info) {
dc->res_pool->funcs->get_default_tiling_info(tiling_info);
return;
}
}
bool dc_set_generic_gpio_for_stereo(bool enable, bool dc_set_generic_gpio_for_stereo(bool enable,
struct gpio_service *gpio_service) struct gpio_service *gpio_service)
{ {

View File

@ -1970,6 +1970,15 @@ void dc_plane_cm_retain(struct dc_plane_cm *cm);
void dc_post_update_surfaces_to_stream( void dc_post_update_surfaces_to_stream(
struct dc *dc); struct dc *dc);
/*
* dc_get_default_tiling_info() - Retrieve an ASIC-appropriate default tiling
* description for (typically) linear surfaces.
*
* This is used by OS/DM paths that need a valid, fully-initialized tiling
* description without hardcoding gfx-version specifics in the caller.
*/
void dc_get_default_tiling_info(const struct dc *dc, struct dc_tiling_info *tiling_info);
/** /**
* struct dc_validation_set - Struct to store surface/stream associations for validation * struct dc_validation_set - Struct to store surface/stream associations for validation
*/ */

View File

@ -214,6 +214,7 @@ struct resource_funcs {
unsigned int index); unsigned int index);
void (*get_panel_config_defaults)(struct dc_panel_config *panel_config); void (*get_panel_config_defaults)(struct dc_panel_config *panel_config);
void (*get_default_tiling_info)(struct dc_tiling_info *tiling_info);
void (*build_pipe_pix_clk_params)(struct pipe_ctx *pipe_ctx); void (*build_pipe_pix_clk_params)(struct pipe_ctx *pipe_ctx);
/* /*
* Get indicator of power from a context that went through full validation * Get indicator of power from a context that went through full validation

View File

@ -1273,6 +1273,12 @@ static const struct dc_cap_funcs cap_funcs = {
.get_dcc_compression_cap = dcn10_get_dcc_compression_cap .get_dcc_compression_cap = dcn10_get_dcc_compression_cap
}; };
void dcn10_get_default_tiling_info(struct dc_tiling_info *tiling_info)
{
tiling_info->gfxversion = DcGfxVersion9;
tiling_info->gfx9.swizzle = DC_SW_LINEAR;
}
static const struct resource_funcs dcn10_res_pool_funcs = { static const struct resource_funcs dcn10_res_pool_funcs = {
.destroy = dcn10_destroy_resource_pool, .destroy = dcn10_destroy_resource_pool,
.link_enc_create = dcn10_link_encoder_create, .link_enc_create = dcn10_link_encoder_create,
@ -1284,7 +1290,8 @@ static const struct resource_funcs dcn10_res_pool_funcs = {
.add_stream_to_ctx = dcn10_add_stream_to_ctx, .add_stream_to_ctx = dcn10_add_stream_to_ctx,
.patch_unknown_plane_state = dcn10_patch_unknown_plane_state, .patch_unknown_plane_state = dcn10_patch_unknown_plane_state,
.find_first_free_match_stream_enc_for_link = dcn10_find_first_free_match_stream_enc_for_link, .find_first_free_match_stream_enc_for_link = dcn10_find_first_free_match_stream_enc_for_link,
.get_vstartup_for_pipe = dcn10_get_vstartup_for_pipe .get_vstartup_for_pipe = dcn10_get_vstartup_for_pipe,
.get_default_tiling_info = dcn10_get_default_tiling_info
}; };
static uint32_t read_pipe_fuses(struct dc_context *ctx) static uint32_t read_pipe_fuses(struct dc_context *ctx)

View File

@ -53,5 +53,7 @@ struct stream_encoder *dcn10_find_first_free_match_stream_enc_for_link(
unsigned int dcn10_get_vstartup_for_pipe(struct pipe_ctx *pipe_ctx); unsigned int dcn10_get_vstartup_for_pipe(struct pipe_ctx *pipe_ctx);
void dcn10_get_default_tiling_info(struct dc_tiling_info *tiling_info);
#endif /* __DC_RESOURCE_DCN10_H__ */ #endif /* __DC_RESOURCE_DCN10_H__ */

View File

@ -2232,7 +2232,8 @@ static const struct resource_funcs dcn20_res_pool_funcs = {
.set_mcif_arb_params = dcn20_set_mcif_arb_params, .set_mcif_arb_params = dcn20_set_mcif_arb_params,
.populate_dml_pipes = dcn20_populate_dml_pipes_from_context, .populate_dml_pipes = dcn20_populate_dml_pipes_from_context,
.find_first_free_match_stream_enc_for_link = dcn10_find_first_free_match_stream_enc_for_link, .find_first_free_match_stream_enc_for_link = dcn10_find_first_free_match_stream_enc_for_link,
.get_vstartup_for_pipe = dcn10_get_vstartup_for_pipe .get_vstartup_for_pipe = dcn10_get_vstartup_for_pipe,
.get_default_tiling_info = dcn10_get_default_tiling_info
}; };
bool dcn20_dwbc_create(struct dc_context *ctx, struct resource_pool *pool) bool dcn20_dwbc_create(struct dc_context *ctx, struct resource_pool *pool)

View File

@ -1081,7 +1081,8 @@ static struct resource_funcs dcn201_res_pool_funcs = {
.patch_unknown_plane_state = dcn20_patch_unknown_plane_state, .patch_unknown_plane_state = dcn20_patch_unknown_plane_state,
.set_mcif_arb_params = dcn20_set_mcif_arb_params, .set_mcif_arb_params = dcn20_set_mcif_arb_params,
.find_first_free_match_stream_enc_for_link = dcn10_find_first_free_match_stream_enc_for_link, .find_first_free_match_stream_enc_for_link = dcn10_find_first_free_match_stream_enc_for_link,
.get_vstartup_for_pipe = dcn10_get_vstartup_for_pipe .get_vstartup_for_pipe = dcn10_get_vstartup_for_pipe,
.get_default_tiling_info = dcn10_get_default_tiling_info
}; };
static bool dcn201_resource_construct( static bool dcn201_resource_construct(

View File

@ -1378,7 +1378,8 @@ static const struct resource_funcs dcn21_res_pool_funcs = {
.find_first_free_match_stream_enc_for_link = dcn10_find_first_free_match_stream_enc_for_link, .find_first_free_match_stream_enc_for_link = dcn10_find_first_free_match_stream_enc_for_link,
.update_bw_bounding_box = dcn21_update_bw_bounding_box, .update_bw_bounding_box = dcn21_update_bw_bounding_box,
.get_panel_config_defaults = dcn21_get_panel_config_defaults, .get_panel_config_defaults = dcn21_get_panel_config_defaults,
.get_vstartup_for_pipe = dcn10_get_vstartup_for_pipe .get_vstartup_for_pipe = dcn10_get_vstartup_for_pipe,
.get_default_tiling_info = dcn10_get_default_tiling_info
}; };
static bool dcn21_resource_construct( static bool dcn21_resource_construct(

View File

@ -2248,7 +2248,8 @@ static const struct resource_funcs dcn30_res_pool_funcs = {
.update_bw_bounding_box = dcn30_update_bw_bounding_box, .update_bw_bounding_box = dcn30_update_bw_bounding_box,
.patch_unknown_plane_state = dcn20_patch_unknown_plane_state, .patch_unknown_plane_state = dcn20_patch_unknown_plane_state,
.get_panel_config_defaults = dcn30_get_panel_config_defaults, .get_panel_config_defaults = dcn30_get_panel_config_defaults,
.get_vstartup_for_pipe = dcn10_get_vstartup_for_pipe .get_vstartup_for_pipe = dcn10_get_vstartup_for_pipe,
.get_default_tiling_info = dcn10_get_default_tiling_info
}; };
#define CTX ctx #define CTX ctx

View File

@ -1400,7 +1400,8 @@ static struct resource_funcs dcn301_res_pool_funcs = {
.release_post_bldn_3dlut = dcn30_release_post_bldn_3dlut, .release_post_bldn_3dlut = dcn30_release_post_bldn_3dlut,
.update_bw_bounding_box = dcn301_update_bw_bounding_box, .update_bw_bounding_box = dcn301_update_bw_bounding_box,
.patch_unknown_plane_state = dcn20_patch_unknown_plane_state, .patch_unknown_plane_state = dcn20_patch_unknown_plane_state,
.get_vstartup_for_pipe = dcn10_get_vstartup_for_pipe .get_vstartup_for_pipe = dcn10_get_vstartup_for_pipe,
.get_default_tiling_info = dcn10_get_default_tiling_info,
}; };
static bool dcn301_resource_construct( static bool dcn301_resource_construct(

View File

@ -1155,7 +1155,8 @@ static struct resource_funcs dcn302_res_pool_funcs = {
.update_bw_bounding_box = dcn302_update_bw_bounding_box, .update_bw_bounding_box = dcn302_update_bw_bounding_box,
.patch_unknown_plane_state = dcn20_patch_unknown_plane_state, .patch_unknown_plane_state = dcn20_patch_unknown_plane_state,
.get_panel_config_defaults = dcn302_get_panel_config_defaults, .get_panel_config_defaults = dcn302_get_panel_config_defaults,
.get_vstartup_for_pipe = dcn10_get_vstartup_for_pipe .get_vstartup_for_pipe = dcn10_get_vstartup_for_pipe,
.get_default_tiling_info = dcn10_get_default_tiling_info
}; };
static struct dc_cap_funcs cap_funcs = { static struct dc_cap_funcs cap_funcs = {

View File

@ -1099,7 +1099,8 @@ static struct resource_funcs dcn303_res_pool_funcs = {
.update_bw_bounding_box = dcn303_update_bw_bounding_box, .update_bw_bounding_box = dcn303_update_bw_bounding_box,
.patch_unknown_plane_state = dcn20_patch_unknown_plane_state, .patch_unknown_plane_state = dcn20_patch_unknown_plane_state,
.get_panel_config_defaults = dcn303_get_panel_config_defaults, .get_panel_config_defaults = dcn303_get_panel_config_defaults,
.get_vstartup_for_pipe = dcn10_get_vstartup_for_pipe .get_vstartup_for_pipe = dcn10_get_vstartup_for_pipe,
.get_default_tiling_info = dcn10_get_default_tiling_info
}; };
static struct dc_cap_funcs cap_funcs = { static struct dc_cap_funcs cap_funcs = {

View File

@ -1851,6 +1851,7 @@ static struct resource_funcs dcn31_res_pool_funcs = {
.get_det_buffer_size = dcn31_get_det_buffer_size, .get_det_buffer_size = dcn31_get_det_buffer_size,
.get_vstartup_for_pipe = dcn10_get_vstartup_for_pipe, .get_vstartup_for_pipe = dcn10_get_vstartup_for_pipe,
.update_dc_state_for_encoder_switch = dcn31_update_dc_state_for_encoder_switch, .update_dc_state_for_encoder_switch = dcn31_update_dc_state_for_encoder_switch,
.get_default_tiling_info = dcn10_get_default_tiling_info,
.build_pipe_pix_clk_params = dcn20_build_pipe_pix_clk_params .build_pipe_pix_clk_params = dcn20_build_pipe_pix_clk_params
}; };

View File

@ -1782,7 +1782,8 @@ static struct resource_funcs dcn314_res_pool_funcs = {
.get_det_buffer_size = dcn31_get_det_buffer_size, .get_det_buffer_size = dcn31_get_det_buffer_size,
.get_vstartup_for_pipe = dcn10_get_vstartup_for_pipe, .get_vstartup_for_pipe = dcn10_get_vstartup_for_pipe,
.update_dc_state_for_encoder_switch = dcn31_update_dc_state_for_encoder_switch, .update_dc_state_for_encoder_switch = dcn31_update_dc_state_for_encoder_switch,
.build_pipe_pix_clk_params = dcn20_build_pipe_pix_clk_params .build_pipe_pix_clk_params = dcn20_build_pipe_pix_clk_params,
.get_default_tiling_info = dcn10_get_default_tiling_info
}; };
static struct clock_source *dcn30_clock_source_create( static struct clock_source *dcn30_clock_source_create(

View File

@ -1846,7 +1846,8 @@ static struct resource_funcs dcn315_res_pool_funcs = {
.get_det_buffer_size = dcn31_get_det_buffer_size, .get_det_buffer_size = dcn31_get_det_buffer_size,
.get_vstartup_for_pipe = dcn10_get_vstartup_for_pipe, .get_vstartup_for_pipe = dcn10_get_vstartup_for_pipe,
.update_dc_state_for_encoder_switch = dcn31_update_dc_state_for_encoder_switch, .update_dc_state_for_encoder_switch = dcn31_update_dc_state_for_encoder_switch,
.build_pipe_pix_clk_params = dcn20_build_pipe_pix_clk_params .build_pipe_pix_clk_params = dcn20_build_pipe_pix_clk_params,
.get_default_tiling_info = dcn10_get_default_tiling_info
}; };
static bool dcn315_resource_construct( static bool dcn315_resource_construct(

View File

@ -1721,7 +1721,8 @@ static struct resource_funcs dcn316_res_pool_funcs = {
.get_det_buffer_size = dcn31_get_det_buffer_size, .get_det_buffer_size = dcn31_get_det_buffer_size,
.get_vstartup_for_pipe = dcn10_get_vstartup_for_pipe, .get_vstartup_for_pipe = dcn10_get_vstartup_for_pipe,
.update_dc_state_for_encoder_switch = dcn31_update_dc_state_for_encoder_switch, .update_dc_state_for_encoder_switch = dcn31_update_dc_state_for_encoder_switch,
.build_pipe_pix_clk_params = dcn20_build_pipe_pix_clk_params .build_pipe_pix_clk_params = dcn20_build_pipe_pix_clk_params,
.get_default_tiling_info = dcn10_get_default_tiling_info
}; };
static bool dcn316_resource_construct( static bool dcn316_resource_construct(

View File

@ -2112,6 +2112,7 @@ static struct resource_funcs dcn32_res_pool_funcs = {
.patch_unknown_plane_state = dcn20_patch_unknown_plane_state, .patch_unknown_plane_state = dcn20_patch_unknown_plane_state,
.update_soc_for_wm_a = dcn30_update_soc_for_wm_a, .update_soc_for_wm_a = dcn30_update_soc_for_wm_a,
.add_phantom_pipes = dcn32_add_phantom_pipes, .add_phantom_pipes = dcn32_add_phantom_pipes,
.get_default_tiling_info = dcn10_get_default_tiling_info,
.build_pipe_pix_clk_params = dcn20_build_pipe_pix_clk_params, .build_pipe_pix_clk_params = dcn20_build_pipe_pix_clk_params,
.calculate_mall_ways_from_bytes = dcn32_calculate_mall_ways_from_bytes, .calculate_mall_ways_from_bytes = dcn32_calculate_mall_ways_from_bytes,
.get_vstartup_for_pipe = dcn10_get_vstartup_for_pipe, .get_vstartup_for_pipe = dcn10_get_vstartup_for_pipe,

View File

@ -1619,6 +1619,7 @@ static struct resource_funcs dcn321_res_pool_funcs = {
.calculate_mall_ways_from_bytes = dcn32_calculate_mall_ways_from_bytes, .calculate_mall_ways_from_bytes = dcn32_calculate_mall_ways_from_bytes,
.get_vstartup_for_pipe = dcn10_get_vstartup_for_pipe, .get_vstartup_for_pipe = dcn10_get_vstartup_for_pipe,
.get_max_hw_cursor_size = dcn32_get_max_hw_cursor_size, .get_max_hw_cursor_size = dcn32_get_max_hw_cursor_size,
.get_default_tiling_info = dcn10_get_default_tiling_info,
}; };
static uint32_t read_pipe_fuses(struct dc_context *ctx) static uint32_t read_pipe_fuses(struct dc_context *ctx)

View File

@ -1802,7 +1802,8 @@ static struct resource_funcs dcn35_res_pool_funcs = {
.get_det_buffer_size = dcn31_get_det_buffer_size, .get_det_buffer_size = dcn31_get_det_buffer_size,
.get_vstartup_for_pipe = dcn10_get_vstartup_for_pipe, .get_vstartup_for_pipe = dcn10_get_vstartup_for_pipe,
.update_dc_state_for_encoder_switch = dcn31_update_dc_state_for_encoder_switch, .update_dc_state_for_encoder_switch = dcn31_update_dc_state_for_encoder_switch,
.build_pipe_pix_clk_params = dcn20_build_pipe_pix_clk_params .build_pipe_pix_clk_params = dcn20_build_pipe_pix_clk_params,
.get_default_tiling_info = dcn10_get_default_tiling_info
}; };
static bool dcn35_resource_construct( static bool dcn35_resource_construct(

View File

@ -1775,7 +1775,8 @@ static struct resource_funcs dcn351_res_pool_funcs = {
.get_det_buffer_size = dcn31_get_det_buffer_size, .get_det_buffer_size = dcn31_get_det_buffer_size,
.get_vstartup_for_pipe = dcn10_get_vstartup_for_pipe, .get_vstartup_for_pipe = dcn10_get_vstartup_for_pipe,
.update_dc_state_for_encoder_switch = dcn31_update_dc_state_for_encoder_switch, .update_dc_state_for_encoder_switch = dcn31_update_dc_state_for_encoder_switch,
.build_pipe_pix_clk_params = dcn20_build_pipe_pix_clk_params .build_pipe_pix_clk_params = dcn20_build_pipe_pix_clk_params,
.get_default_tiling_info = dcn10_get_default_tiling_info
}; };
static bool dcn351_resource_construct( static bool dcn351_resource_construct(

View File

@ -1781,7 +1781,8 @@ static struct resource_funcs dcn36_res_pool_funcs = {
.get_preferred_eng_id_dpia = dcn36_get_preferred_eng_id_dpia, .get_preferred_eng_id_dpia = dcn36_get_preferred_eng_id_dpia,
.get_vstartup_for_pipe = dcn10_get_vstartup_for_pipe, .get_vstartup_for_pipe = dcn10_get_vstartup_for_pipe,
.update_dc_state_for_encoder_switch = dcn31_update_dc_state_for_encoder_switch, .update_dc_state_for_encoder_switch = dcn31_update_dc_state_for_encoder_switch,
.build_pipe_pix_clk_params = dcn20_build_pipe_pix_clk_params .build_pipe_pix_clk_params = dcn20_build_pipe_pix_clk_params,
.get_default_tiling_info = dcn10_get_default_tiling_info,
}; };
static bool dcn36_resource_construct( static bool dcn36_resource_construct(

View File

@ -1839,9 +1839,16 @@ static struct resource_funcs dcn401_res_pool_funcs = {
.calculate_mall_ways_from_bytes = dcn32_calculate_mall_ways_from_bytes, .calculate_mall_ways_from_bytes = dcn32_calculate_mall_ways_from_bytes,
.get_power_profile = dcn401_get_power_profile, .get_power_profile = dcn401_get_power_profile,
.get_vstartup_for_pipe = dcn401_get_vstartup_for_pipe, .get_vstartup_for_pipe = dcn401_get_vstartup_for_pipe,
.get_max_hw_cursor_size = dcn32_get_max_hw_cursor_size .get_max_hw_cursor_size = dcn32_get_max_hw_cursor_size,
.get_default_tiling_info = dcn401_get_default_tiling_info
}; };
void dcn401_get_default_tiling_info(struct dc_tiling_info *tiling_info)
{
tiling_info->gfxversion = DcGfxAddr3;
tiling_info->gfx_addr3.swizzle = DC_ADDR3_SW_LINEAR;
}
static uint32_t read_pipe_fuses(struct dc_context *ctx) static uint32_t read_pipe_fuses(struct dc_context *ctx)
{ {
uint32_t value = REG_READ(CC_DC_PIPE_DIS); uint32_t value = REG_READ(CC_DC_PIPE_DIS);

View File

@ -28,6 +28,8 @@ enum dc_status dcn401_validate_bandwidth(struct dc *dc,
void dcn401_prepare_mcache_programming(struct dc *dc, struct dc_state *context); void dcn401_prepare_mcache_programming(struct dc *dc, struct dc_state *context);
void dcn401_get_default_tiling_info(struct dc_tiling_info *tiling_info);
unsigned int dcn401_get_vstartup_for_pipe(struct pipe_ctx *pipe_ctx); unsigned int dcn401_get_vstartup_for_pipe(struct pipe_ctx *pipe_ctx);
/* Following are definitions for run time init of reg offsets */ /* Following are definitions for run time init of reg offsets */