drm/amd/display: Refactor mark_seamless_boot_stream()
authorMario Limonciello <mario.limonciello@amd.com>
Mon, 20 Jan 2025 19:49:03 +0000 (13:49 -0600)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 13 Feb 2025 02:02:58 +0000 (21:02 -0500)
mark_seamless_boot_stream() can be called multiple times to run
the more expensive checks in dc_validate_boot_timing().

Refactor the function so that if those have already passed once
the function isn't called again.

Also add a message the first time that they have passed to let
the user know the stream will be used for seamless boot.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Link: https://lore.kernel.org/r/20250120194903.1048811-4-superm1@kernel.org
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc_resource.c

index 72c88fdeb28cc7e593429b9167d7308b7922c519..7251587c3fb6011f5f73d76f88b64f741188300d 100644 (file)
@@ -3592,16 +3592,20 @@ static int acquire_resource_from_hw_enabled_state(
        return -1;
 }
 
-static void mark_seamless_boot_stream(
-               const struct dc  *dc,
-               struct dc_stream_state *stream)
+static void mark_seamless_boot_stream(const struct dc  *dc,
+                                     struct dc_stream_state *stream)
 {
        struct dc_bios *dcb = dc->ctx->dc_bios;
 
-       if (dc->config.allow_seamless_boot_optimization &&
-                       !dcb->funcs->is_accelerated_mode(dcb)) {
-               if (dc_validate_boot_timing(dc, stream->sink, &stream->timing))
-                       stream->apply_seamless_boot_optimization = true;
+       if (stream->apply_seamless_boot_optimization)
+               return;
+       if (!dc->config.allow_seamless_boot_optimization)
+               return;
+       if (dcb->funcs->is_accelerated_mode(dcb))
+               return;
+       if (dc_validate_boot_timing(dc, stream->sink, &stream->timing)) {
+               stream->apply_seamless_boot_optimization = true;
+               DC_LOG_INFO("Marked stream for seamless boot optimization\n");
        }
 }