]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amd/display: Add Gfx Base Case For Linear Tiling Handling
authorNicholas Carbones <ncarbone@amd.com>
Tue, 6 Jan 2026 22:35:51 +0000 (17:35 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 3 Feb 2026 21:40:10 +0000 (16:40 -0500)
[Why]
Post-driver cases always use linear tiling yet there is no dedicated
Gfx handling for this condition.

[How]
Add DcGfxBase/DalGfxBase to gfx version enums and set tiling to linear
when it is used. Also, enforce the use of proper tiling format as tiling
information is used.

Reviewed-by: Dillon Varone <dillon.varone@amd.com>
Signed-off-by: Nicholas Carbones <ncarbone@amd.com>
Signed-off-by: Wayne Lin <wayne.lin@amd.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 files changed:
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
drivers/gpu/drm/amd/display/dc/core/dc.c
drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c
drivers/gpu/drm/amd/display/dc/core/dc_resource.c
drivers/gpu/drm/amd/display/dc/dc_hw_types.h
drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c
drivers/gpu/drm/amd/display/dc/dce110/dce110_mem_input_v.c
drivers/gpu/drm/amd/display/dc/dml/calcs/dcn_calcs.c
drivers/gpu/drm/amd/display/dc/hubp/dcn10/dcn10_hubp.c
drivers/gpu/drm/amd/display/dc/hubp/dcn20/dcn20_hubp.c
drivers/gpu/drm/amd/display/dc/hubp/dcn30/dcn30_hubp.c
drivers/gpu/drm/amd/display/dc/hubp/dcn401/dcn401_hubp.c
drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource_helpers.c

index 56332f3f95ef4f0c0d58a9648ca2ef48bba08688..ca40166ca924ad3bad533d6ada1e66f02ba34bb7 100644 (file)
@@ -8032,6 +8032,7 @@ static enum dc_status dm_validate_stream_and_context(struct dc *dc,
        dc_plane_state->plane_size.chroma_size.height  = stream->src.height;
        dc_plane_state->plane_size.chroma_size.width   = stream->src.width;
        dc_plane_state->format = SURFACE_PIXEL_FORMAT_GRPH_ARGB8888;
+       dc_plane_state->tiling_info.gfxversion = DcGfxVersion9;
        dc_plane_state->tiling_info.gfx9.swizzle = DC_SW_UNKNOWN;
        dc_plane_state->rotation = ROTATION_ANGLE_0;
        dc_plane_state->is_tiling_rotated = false;
index 4305691ba45e638e7bde184e074efc50e4295296..441b7e0a3b2227ee2ed930a7e2de78a1630cd1ce 100644 (file)
@@ -2768,6 +2768,7 @@ static struct surface_update_descriptor get_plane_info_update_type(const struct
                case DcGfxVersion7:
                case DcGfxVersion8:
                case DcGfxVersionUnknown:
+               case DcGfxBase:
                default:
                        break;
                }
index 052d573408c3eb88e5d16067602755817d2601f0..a13d9d7dd6c5057528b8c891e9895ada4d1c0541 100644 (file)
@@ -2065,6 +2065,13 @@ void get_surface_tile_visual_confirm_color(
        while (bottom_pipe_ctx->bottom_pipe != NULL)
                bottom_pipe_ctx = bottom_pipe_ctx->bottom_pipe;
 
+       if (bottom_pipe_ctx->plane_state->tiling_info.gfxversion == DcGfxBase) {
+               /* LINEAR Surface - set border color to red */
+               color->color_r_cr = color_value;
+               return;
+       }
+
+       ASSERT(bottom_pipe_ctx->plane_state->tiling_info.gfxversion == DcGfxVersion9);
        switch (bottom_pipe_ctx->plane_state->tiling_info.gfx9.swizzle) {
        case DC_SW_LINEAR:
                /* LINEAR Surface - set border color to red */
index 848c267ef11e7460ac4601582bc56d596fbd3d12..b4e5a79e97497fa23473a9da5cf043993d890270 100644 (file)
@@ -4434,6 +4434,7 @@ enum dc_status dc_validate_global_state(
 
                        if (dc->res_pool->funcs->patch_unknown_plane_state &&
                                        pipe_ctx->plane_state &&
+                                       pipe_ctx->plane_state->tiling_info.gfxversion == DcGfxVersion9 &&
                                        pipe_ctx->plane_state->tiling_info.gfx9.swizzle == DC_SW_UNKNOWN) {
                                result = dc->res_pool->funcs->patch_unknown_plane_state(pipe_ctx->plane_state);
                                if (result != DC_OK)
index cfa569a7bff1bb109c1a9501061efcdb241767df..7121629da38ed9a88ddb44210497eb774736307a 100644 (file)
@@ -342,7 +342,8 @@ enum swizzle_mode_addr3_values {
 };
 
 enum dc_gfxversion {
-       DcGfxVersion7 = 0,
+       DcGfxBase = 0,
+       DcGfxVersion7,
        DcGfxVersion8,
        DcGfxVersion9,
        DcGfxVersion10,
index 1c2009e38aa125f67c0b72c18d7236abb9640fda..5df58fadc8621061f24a1051e49c0a63d5361da9 100644 (file)
@@ -100,6 +100,7 @@ static enum mi_bits_per_pixel get_mi_bpp(
 static enum mi_tiling_format get_mi_tiling(
                struct dc_tiling_info *tiling_info)
 {
+       ASSERT(tiling_info->gfxversion == DcGfxVersion8);
        switch (tiling_info->gfx8.array_mode) {
        case DC_ARRAY_1D_TILED_THIN1:
        case DC_ARRAY_1D_TILED_THICK:
@@ -433,6 +434,7 @@ static void program_tiling(
        struct dce_mem_input *dce_mi, const struct dc_tiling_info *info)
 {
        if (dce_mi->masks->GRPH_SW_MODE) { /* GFX9 */
+               ASSERT(info->gfxversion == DcGfxVersion9);
                REG_UPDATE_6(GRPH_CONTROL,
                                GRPH_SW_MODE, info->gfx9.swizzle,
                                GRPH_NUM_BANKS, log_2(info->gfx9.num_banks),
@@ -447,6 +449,7 @@ static void program_tiling(
        }
 
        if (dce_mi->masks->GRPH_MICRO_TILE_MODE) { /* GFX8 */
+               ASSERT(info->gfxversion == DcGfxVersion8);
                REG_UPDATE_9(GRPH_CONTROL,
                                GRPH_NUM_BANKS, info->gfx8.num_banks,
                                GRPH_BANK_WIDTH, info->gfx8.bank_width,
index 2c43c24226385d4cbd6911d75f69192c027811bb..67cfca3361fb93bbedc4c75255515fd28dd6c692 100644 (file)
@@ -165,6 +165,8 @@ static void program_tiling(
        const struct dc_tiling_info *info,
        const enum surface_pixel_format pixel_format)
 {
+       ASSERT(info->gfxversion == DcGfxVersion8);
+
        uint32_t value = 0;
 
        set_reg_field_value(value, info->gfx8.num_banks,
@@ -541,6 +543,7 @@ static const unsigned int *get_dvmm_hw_setting(
        else
                bpp = bpp_8;
 
+       ASSERT(tiling_info->gfxversion == DcGfxVersion8);
        switch (tiling_info->gfx8.array_mode) {
        case DC_ARRAY_1D_TILED_THIN1:
        case DC_ARRAY_1D_TILED_THICK:
index 74962791302f653ae83d0b632c8d00b85eaa4c78..71eeee02c0fa5b5293a7b8d7679e84cbab39bf31 100644 (file)
@@ -1006,6 +1006,7 @@ bool dcn_validate_bandwidth(
 
                        v->source_pixel_format[input_idx] = tl_pixel_format_to_bw_defs(
                                        pipe->plane_state->format);
+                       ASSERT(pipe->plane_state->tiling_info.gfxversion == DcGfxVersion9);
                        v->source_surface_mode[input_idx] = tl_sw_mode_to_bw_defs(
                                        pipe->plane_state->tiling_info.gfx9.swizzle);
                        v->lb_bit_per_pixel[input_idx] = tl_lb_bpp_to_int(pipe->plane_res.scl_data.lb_params.depth);
index 6378e3fd72494c7d03f56d806e1def8368f60c40..e697d9bf1b44cfd5d0d6cec0526c9cf11320fd4d 100644 (file)
@@ -145,6 +145,8 @@ void hubp1_program_tiling(
 {
        struct dcn10_hubp *hubp1 = TO_DCN10_HUBP(hubp);
 
+       ASSERT(info->gfxversion == DcGfxVersion9);
+
        REG_UPDATE_6(DCSURF_ADDR_CONFIG,
                        NUM_PIPES, log_2(info->gfx9.num_pipes),
                        NUM_BANKS, log_2(info->gfx9.num_banks),
index 92288de4cc10c312959c6179dcb8251ec1e15ed6..4715e60e812ac68584698bbafb5828d97ea2f2cd 100644 (file)
@@ -313,6 +313,8 @@ static void hubp2_program_tiling(
        const struct dc_tiling_info *info,
        const enum surface_pixel_format pixel_format)
 {
+       ASSERT(info->gfxversion == DcGfxVersion9);
+
        REG_UPDATE_3(DCSURF_ADDR_CONFIG,
                        NUM_PIPES, log_2(info->gfx9.num_pipes),
                        PIPE_INTERLEAVE, info->gfx9.pipe_interleave,
index 0cc6f455898981e3f4c147c42641cc662b0d8227..207c2f86b7d78a2284c847ab8a2d5eb1e88035fb 100644 (file)
@@ -321,6 +321,8 @@ void hubp3_program_tiling(
        const struct dc_tiling_info *info,
        const enum surface_pixel_format pixel_format)
 {
+       ASSERT(info->gfxversion == DcGfxVersion9);
+
        REG_UPDATE_4(DCSURF_ADDR_CONFIG,
                NUM_PIPES, log_2(info->gfx9.num_pipes),
                PIPE_INTERLEAVE, info->gfx9.pipe_interleave,
index c205500290ecd7d3af50affafd92b39af589709f..861e940250af2440064a468dd591104b3127e4f3 100644 (file)
@@ -589,7 +589,12 @@ void hubp401_program_tiling(
         *
         * DIM_TYPE field in DCSURF_TILING for Display is always 1 (2D dimension) which is HW default.
         */
-        REG_UPDATE(DCSURF_TILING_CONFIG, SW_MODE, info->gfx_addr3.swizzle);
+        if (info->gfxversion == DcGfxAddr3) {
+               REG_UPDATE(DCSURF_TILING_CONFIG, SW_MODE, info->gfx_addr3.swizzle);
+       } else {
+               /* linear */
+               REG_UPDATE(DCSURF_TILING_CONFIG, SW_MODE, 0);
+       }
 }
 
 void hubp401_program_size(
index f5a4e97c40ced260157fe1aef6b11015b43d98fa..7d99f5d79e6dc0075185bd868be3f39c6d20ef7c 100644 (file)
@@ -401,7 +401,8 @@ void dcn32_set_det_allocations(struct dc *dc, struct dc_state *context,
         */
        if (pipe_cnt == 1) {
                pipes[0].pipe.src.det_size_override = DCN3_2_MAX_DET_SIZE;
-               if (pipe->plane_state && !disable_unbounded_requesting && pipe->plane_state->tiling_info.gfx9.swizzle != DC_SW_LINEAR) {
+               if (pipe->plane_state && !disable_unbounded_requesting && pipe->plane_state->tiling_info.gfxversion != DcGfxBase &&
+                       !(pipe->plane_state->tiling_info.gfxversion == DcGfxVersion9 && pipe->plane_state->tiling_info.gfx9.swizzle == DC_SW_LINEAR)) {
                        if (!is_dual_plane(pipe->plane_state->format)) {
                                pipes[0].pipe.src.det_size_override = DCN3_2_DEFAULT_DET_SIZE;
                                pipes[0].pipe.src.unbounded_req_mode = true;