drm/amd/display: add odm_slice_rect parameter in spl_in
authorWenjing Liu <wenjing.liu@amd.com>
Thu, 25 Apr 2024 16:01:34 +0000 (12:01 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 14 Jun 2024 20:17:13 +0000 (16:17 -0400)
[why]
OPP input rect aka odm slice rect is a hardware dependent parameter that
can't be determined by SPL software logic. Therefore we need to
explicitly pass odm slice rect in. So ODM slice rect calculation is
moved out of SPL.

[how]
add odm_slice_rect parameter in spl_in

Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Wenjing Liu <wenjing.liu@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dc_spl_translate.c
drivers/gpu/drm/amd/display/dc/spl/dc_spl.c
drivers/gpu/drm/amd/display/dc/spl/dc_spl_types.h

index bc760448a37853d8ca42f5cace79a57d368f0f0b..58260631976493ba0ed26ea36b3dd129ba0c6516 100644 (file)
@@ -70,6 +70,8 @@ void translate_SPL_in_params_from_pipe_ctx(struct pipe_ctx *pipe_ctx, struct spl
 {
        const struct dc_plane_state *plane_state = pipe_ctx->plane_state;
        const struct dc_stream_state *stream = pipe_ctx->stream;
+       struct rect odm_slice_src = resource_get_odm_slice_src_rect(pipe_ctx);
+
        // Assign the function to calculate the number of partitions in the line buffer
        // This is used to determine the vtap support
        switch (plane_state->ctx->dce_version)  {
@@ -112,7 +114,8 @@ void translate_SPL_in_params_from_pipe_ctx(struct pipe_ctx *pipe_ctx, struct spl
        else
                spl_in->basic_in.mpc_combine_v = resource_get_mpc_slice_index(pipe_ctx);
 
-       spl_in->basic_out.odm_combine_factor = resource_get_odm_slice_count(pipe_ctx);
+       populate_splrect_from_rect(&spl_in->basic_out.odm_slice_rect, &odm_slice_src);
+       spl_in->basic_out.odm_combine_factor = 0;
        spl_in->odm_slice_index = resource_get_odm_slice_index(pipe_ctx);
        // Make spl input basic out info output_size width point to stream h active
        spl_in->basic_out.output_size.width =
index 9c6171e90163cc8a9616f8de02b367070062e1b3..ac58991eebbc6b8aaa21d95148f38fc933278335 100644 (file)
@@ -170,22 +170,31 @@ static struct spl_rect calculate_odm_slice_in_timing_active(struct spl_in *spl_i
        bool is_last_odm_slice = (odm_slice_idx + 1) == odm_slice_count;
        int h_active = spl_in->basic_out.output_size.width;
        int v_active = spl_in->basic_out.output_size.height;
-       int odm_slice_width = h_active / odm_slice_count;
+       int odm_slice_width;
        struct spl_rect odm_rec;
 
-       if (spl_in->basic_out.use_two_pixels_per_container && (odm_slice_width % 2))
-               odm_slice_width++;
-
-       odm_rec.x = odm_slice_width * odm_slice_idx;
-       odm_rec.width = is_last_odm_slice ?
-                       /* last slice width is the reminder of h_active */
-                       h_active - odm_slice_width * (odm_slice_count - 1) :
-                       /* odm slice width is the floor of h_active / count */
-                       odm_slice_width;
-       odm_rec.y = 0;
-       odm_rec.height = v_active;
+       if (spl_in->basic_out.odm_combine_factor > 0) {
+               odm_slice_width = h_active / odm_slice_count;
+               /*
+                * deprecated, caller must pass in odm slice rect i.e OPP input
+                * rect in timing active for the new interface.
+                */
+               if (spl_in->basic_out.use_two_pixels_per_container && (odm_slice_width % 2))
+                       odm_slice_width++;
+
+               odm_rec.x = odm_slice_width * odm_slice_idx;
+               odm_rec.width = is_last_odm_slice ?
+                               /* last slice width is the reminder of h_active */
+                               h_active - odm_slice_width * (odm_slice_count - 1) :
+                               /* odm slice width is the floor of h_active / count */
+                               odm_slice_width;
+               odm_rec.y = 0;
+               odm_rec.height = v_active;
+
+               return odm_rec;
+       }
 
-       return odm_rec;
+       return spl_in->basic_out.odm_slice_rect;
 }
 
 static void spl_calculate_recout(struct spl_in *spl_in, struct spl_out *spl_out)
index 49c866a558f6c25b8081f1535cf8b8b4fbd8d571..201201d3f55be28fefaf6729f7a5d7883aafd67e 100644 (file)
@@ -436,7 +436,8 @@ struct basic_out {
        struct spl_size output_size; // Output Size
        struct spl_rect dst_rect;       // Destination Rect
        struct spl_rect src_rect;       // Source rect
-       int odm_combine_factor; // ODM Combine Factor determine by get_odm_splits
+       int odm_combine_factor; // deprecated
+       struct spl_rect odm_slice_rect; // OPP input rect in timing active
        enum spl_view_3d view_format;   // TODO: View format Check if it is chroma subsampling
        bool always_scale;      // Is always scale enabled? Required for getting SCL_MODE
        int max_downscale_src_width; // Required to get optimal no of taps