]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/amd/display: Share dce100_validate_global with DCE6-8
authorTimur Kristóf <timur.kristof@gmail.com>
Wed, 24 Sep 2025 11:38:36 +0000 (13:38 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 25 Sep 2025 19:53:46 +0000 (15:53 -0400)
The dce100_validate_global function was verbatim exactly the
same as dce60_validate_global and dce80_validate_global.

Share dce100_validate_global between DCE6-10 to save code size.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/resource/dce100/dce100_resource.c
drivers/gpu/drm/amd/display/dc/resource/dce100/dce100_resource.h
drivers/gpu/drm/amd/display/dc/resource/dce60/dce60_resource.c
drivers/gpu/drm/amd/display/dc/resource/dce80/dce80_resource.c

index 6421a56ffd23c7eacf67d7abb67031979581d505..c4b4dc3ad8c9d5aeb05fbb8e080c4a8aaec474f5 100644 (file)
@@ -898,7 +898,7 @@ static bool dce100_validate_surface_sets(
        return true;
 }
 
-static enum dc_status dce100_validate_global(
+enum dc_status dce100_validate_global(
                struct dc  *dc,
                struct dc_state *context)
 {
index 08e045601a770ed0c975c5ea842031aff97427fd..dd150a4b46105e953454deedbff76bd2222866c4 100644 (file)
@@ -41,6 +41,10 @@ struct resource_pool *dce100_create_resource_pool(
 
 enum dc_status dce100_validate_plane(const struct dc_plane_state *plane_state, struct dc_caps *caps);
 
+enum dc_status dce100_validate_global(
+               struct dc  *dc,
+               struct dc_state *context);
+
 enum dc_status dce100_validate_bandwidth(
                struct dc  *dc,
                struct dc_state *context,
index 61ad3703461e94e11310c82cd719e00c56c08316..53c67ebe779ff56ed6edb2aa25bc7de4680cdf5f 100644 (file)
@@ -864,36 +864,6 @@ static void dce60_resource_destruct(struct dce110_resource_pool *pool)
        }
 }
 
-static bool dce60_validate_surface_sets(
-               struct dc_state *context)
-{
-       int i;
-
-       for (i = 0; i < context->stream_count; i++) {
-               if (context->stream_status[i].plane_count == 0)
-                       continue;
-
-               if (context->stream_status[i].plane_count > 1)
-                       return false;
-
-               if (context->stream_status[i].plane_states[0]->format
-                               >= SURFACE_PIXEL_FORMAT_VIDEO_BEGIN)
-                       return false;
-       }
-
-       return true;
-}
-
-static enum dc_status dce60_validate_global(
-               struct dc *dc,
-               struct dc_state *context)
-{
-       if (!dce60_validate_surface_sets(context))
-               return DC_FAIL_SURFACE_VALIDATE;
-
-       return DC_OK;
-}
-
 static void dce60_destroy_resource_pool(struct resource_pool **pool)
 {
        struct dce110_resource_pool *dce110_pool = TO_DCE110_RES_POOL(*pool);
@@ -910,7 +880,7 @@ static const struct resource_funcs dce60_res_pool_funcs = {
        .validate_bandwidth = dce100_validate_bandwidth,
        .validate_plane = dce100_validate_plane,
        .add_stream_to_ctx = dce100_add_stream_to_ctx,
-       .validate_global = dce60_validate_global,
+       .validate_global = dce100_validate_global,
        .find_first_free_match_stream_enc_for_link = dce100_find_first_free_match_stream_enc_for_link
 };
 
index 0c9a39bf7ff4f1254728359afe551be756ee270c..5b77697452022f36a1429bb3e43ec8f9ac10a3d1 100644 (file)
@@ -870,36 +870,6 @@ static void dce80_resource_destruct(struct dce110_resource_pool *pool)
        }
 }
 
-static bool dce80_validate_surface_sets(
-               struct dc_state *context)
-{
-       int i;
-
-       for (i = 0; i < context->stream_count; i++) {
-               if (context->stream_status[i].plane_count == 0)
-                       continue;
-
-               if (context->stream_status[i].plane_count > 1)
-                       return false;
-
-               if (context->stream_status[i].plane_states[0]->format
-                               >= SURFACE_PIXEL_FORMAT_VIDEO_BEGIN)
-                       return false;
-       }
-
-       return true;
-}
-
-static enum dc_status dce80_validate_global(
-               struct dc *dc,
-               struct dc_state *context)
-{
-       if (!dce80_validate_surface_sets(context))
-               return DC_FAIL_SURFACE_VALIDATE;
-
-       return DC_OK;
-}
-
 static void dce80_destroy_resource_pool(struct resource_pool **pool)
 {
        struct dce110_resource_pool *dce110_pool = TO_DCE110_RES_POOL(*pool);
@@ -916,7 +886,7 @@ static const struct resource_funcs dce80_res_pool_funcs = {
        .validate_bandwidth = dce100_validate_bandwidth,
        .validate_plane = dce100_validate_plane,
        .add_stream_to_ctx = dce100_add_stream_to_ctx,
-       .validate_global = dce80_validate_global,
+       .validate_global = dce100_validate_global,
        .find_first_free_match_stream_enc_for_link = dce100_find_first_free_match_stream_enc_for_link
 };