drm/amd/display: Increase linebuffer pixel depth to 36bpp.
authorMario Kleiner <mario.kleiner.de@gmail.com>
Fri, 19 Mar 2021 21:03:15 +0000 (22:03 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 27 May 2021 19:00:47 +0000 (15:00 -0400)
Testing with the photometer shows that at least Raven Ridge DCN-1.0
does not achieve more than 10 bpc effective output precision with a
16 bpc unorm surface of type SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616,
unless linebuffer depth is increased from LB_PIXEL_DEPTH_30BPP to
LB_PIXEL_DEPTH_36BPP. Otherwise precision gets truncated somewhere
to 10 bpc effective depth.

Strangely this increase was not needed on Polaris11 DCE-11.2 during
testing to get 12 bpc effective precision. It also is not needed for
fp16 framebuffers.

Tested on DCN-1.0 and DCE-11.2.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc_resource.c
drivers/gpu/drm/amd/display/dc/dce/dce_transform.c
drivers/gpu/drm/amd/display/dc/dce110/dce110_transform_v.c
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp.c
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dpp.c
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dpp.c

index c4d699e2c2fc1a4b20eefec69c0f2c1e73fc337b..cd864cc83539bca399e6acce2f4a58e42d8f084c 100644 (file)
@@ -1039,9 +1039,12 @@ bool resource_build_scaling_params(struct pipe_ctx *pipe_ctx)
        /*
         * LB calculations depend on vp size, h/v_active and scaling ratios
         * Setting line buffer pixel depth to 24bpp yields banding
-        * on certain displays, such as the Sharp 4k
+        * on certain displays, such as the Sharp 4k. 36bpp is needed
+        * to support SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616 and
+        * SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616 with actual > 10 bpc
+        * precision on at least DCN display engines.
         */
-       pipe_ctx->plane_res.scl_data.lb_params.depth = LB_PIXEL_DEPTH_30BPP;
+       pipe_ctx->plane_res.scl_data.lb_params.depth = LB_PIXEL_DEPTH_36BPP;
        pipe_ctx->plane_res.scl_data.lb_params.alpha_en = plane_state->per_pixel_alpha;
 
        if (pipe_ctx->plane_res.xfm != NULL)
index 151dc7bf6d235676f196c2ca5837455499ffdfb6..92b53a30d95447f63151d799f98e86e72a67b1f2 100644 (file)
@@ -1647,7 +1647,8 @@ void dce_transform_construct(
        xfm_dce->lb_pixel_depth_supported =
                        LB_PIXEL_DEPTH_18BPP |
                        LB_PIXEL_DEPTH_24BPP |
-                       LB_PIXEL_DEPTH_30BPP;
+                       LB_PIXEL_DEPTH_30BPP |
+                       LB_PIXEL_DEPTH_36BPP;
 
        xfm_dce->lb_bits_per_entry = LB_BITS_PER_ENTRY;
        xfm_dce->lb_memory_size = LB_TOTAL_NUMBER_OF_ENTRIES; /*0x6B0*/
@@ -1675,7 +1676,8 @@ void dce60_transform_construct(
        xfm_dce->lb_pixel_depth_supported =
                        LB_PIXEL_DEPTH_18BPP |
                        LB_PIXEL_DEPTH_24BPP |
-                       LB_PIXEL_DEPTH_30BPP;
+                       LB_PIXEL_DEPTH_30BPP |
+                       LB_PIXEL_DEPTH_36BPP;
 
        xfm_dce->lb_bits_per_entry = LB_BITS_PER_ENTRY;
        xfm_dce->lb_memory_size = LB_TOTAL_NUMBER_OF_ENTRIES; /*0x6B0*/
index 29438c6050dbbf5529f88ea05545d9d69f34eb0f..45bca0db5e5e0ce8327e9077571133eda83e6830 100644 (file)
@@ -708,7 +708,8 @@ bool dce110_transform_v_construct(
        xfm_dce->lb_pixel_depth_supported =
                        LB_PIXEL_DEPTH_18BPP |
                        LB_PIXEL_DEPTH_24BPP |
-                       LB_PIXEL_DEPTH_30BPP;
+                       LB_PIXEL_DEPTH_30BPP |
+                       LB_PIXEL_DEPTH_36BPP;
 
        xfm_dce->prescaler_on = true;
        xfm_dce->lb_bits_per_entry = LB_BITS_PER_ENTRY;
index a77e7bd3b8d5b23477d01dbd01a043861d8d941e..91fdfcd8a14e78256b3827f264c5975fb3dfc242 100644 (file)
@@ -568,7 +568,8 @@ void dpp1_construct(
        dpp->lb_pixel_depth_supported =
                LB_PIXEL_DEPTH_18BPP |
                LB_PIXEL_DEPTH_24BPP |
-               LB_PIXEL_DEPTH_30BPP;
+               LB_PIXEL_DEPTH_30BPP |
+               LB_PIXEL_DEPTH_36BPP;
 
        dpp->lb_bits_per_entry = LB_BITS_PER_ENTRY;
        dpp->lb_memory_size = LB_TOTAL_NUMBER_OF_ENTRIES; /*0x1404*/
index 8f11e2b58cd725de5502284819df2429fcb3751e..ef37d3abaa56fa3eb399ea7816edef3195d5d8fd 100644 (file)
@@ -2593,7 +2593,7 @@ static void update_scaler(struct pipe_ctx *pipe_ctx)
                        pipe_ctx->plane_state->per_pixel_alpha && pipe_ctx->bottom_pipe;
 
        pipe_ctx->plane_res.scl_data.lb_params.alpha_en = per_pixel_alpha;
-       pipe_ctx->plane_res.scl_data.lb_params.depth = LB_PIXEL_DEPTH_30BPP;
+       pipe_ctx->plane_res.scl_data.lb_params.depth = LB_PIXEL_DEPTH_36BPP;
        /* scaler configuration */
        pipe_ctx->plane_res.dpp->funcs->dpp_set_scaler(
                        pipe_ctx->plane_res.dpp, &pipe_ctx->plane_res.scl_data);
index f2f44ddf522a48b9e8cfe035432adeacbf367b6d..a9e420c7d75ac6cfdfd9f29ed415628d7ec640a3 100644 (file)
@@ -432,7 +432,8 @@ bool dpp2_construct(
        dpp->lb_pixel_depth_supported =
                LB_PIXEL_DEPTH_18BPP |
                LB_PIXEL_DEPTH_24BPP |
-               LB_PIXEL_DEPTH_30BPP;
+               LB_PIXEL_DEPTH_30BPP |
+               LB_PIXEL_DEPTH_36BPP;
 
        dpp->lb_bits_per_entry = LB_BITS_PER_ENTRY;
        dpp->lb_memory_size = LB_TOTAL_NUMBER_OF_ENTRIES; /*0x1404*/
index 484a30592987f26733ffc2466227cbcaa20472d6..14e322761645a5e8774d8ac852ba3f8b19e1f32e 100644 (file)
@@ -1473,7 +1473,7 @@ static void dcn20_update_dchubp_dpp(
                        plane_state->update_flags.bits.per_pixel_alpha_change ||
                        pipe_ctx->stream->update_flags.bits.scaling) {
                pipe_ctx->plane_res.scl_data.lb_params.alpha_en = pipe_ctx->plane_state->per_pixel_alpha;
-               ASSERT(pipe_ctx->plane_res.scl_data.lb_params.depth == LB_PIXEL_DEPTH_30BPP);
+               ASSERT(pipe_ctx->plane_res.scl_data.lb_params.depth == LB_PIXEL_DEPTH_36BPP);
                /* scaler configuration */
                pipe_ctx->plane_res.dpp->funcs->dpp_set_scaler(
                                pipe_ctx->plane_res.dpp, &pipe_ctx->plane_res.scl_data);
index 154279b91967104ada076323555690e4f7376257..2140b75540cfe187202833e55f591034ea38545d 100644 (file)
@@ -1443,7 +1443,8 @@ bool dpp3_construct(
        dpp->lb_pixel_depth_supported =
                LB_PIXEL_DEPTH_18BPP |
                LB_PIXEL_DEPTH_24BPP |
-               LB_PIXEL_DEPTH_30BPP;
+               LB_PIXEL_DEPTH_30BPP |
+               LB_PIXEL_DEPTH_36BPP;
 
        dpp->lb_bits_per_entry = LB_BITS_PER_ENTRY;
        dpp->lb_memory_size = LB_TOTAL_NUMBER_OF_ENTRIES; /*0x1404*/