drm/amd/display: Remove DPMS state dependency for fast boot
authorSivapiriyanKumarasamy <sivapiriyan.kumarasamy@amd.com>
Wed, 24 Apr 2019 14:20:15 +0000 (10:20 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 24 May 2019 17:21:00 +0000 (12:21 -0500)
[Why]
The DPMS state of a display should not impact whether we want to enable fast boot.
Currently fast boot is not enabled when resuming from S4 because of this.

[How]
Remove check for DPMS state when determining if fast boot
can be applied.

Signed-off-by: SivapiriyanKumarasamy <sivapiriyan.kumarasamy@amd.com>
Reviewed-by: Anthony Koo <Anthony.Koo@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c

index 5919716832a586e23c054c60ffe29e793b22991a..d3c821f3899b0f469990e876956226a72037a071 100644 (file)
@@ -1496,10 +1496,11 @@ static void disable_vga_and_power_gate_all_controllers(
        }
 }
 
-static struct dc_link *get_link_for_edp(struct dc *dc)
+static struct dc_link *get_edp_link(struct dc *dc)
 {
        int i;
 
+       // report any eDP links, even unconnected DDI's
        for (i = 0; i < dc->link_count; i++) {
                if (dc->links[i]->connector_signal == SIGNAL_TYPE_EDP)
                        return dc->links[i];
@@ -1507,23 +1508,13 @@ static struct dc_link *get_link_for_edp(struct dc *dc)
        return NULL;
 }
 
-static struct dc_link *get_link_for_edp_to_turn_off(
+static struct dc_link *get_edp_link_with_sink(
                struct dc *dc,
                struct dc_state *context)
 {
        int i;
        struct dc_link *link = NULL;
 
-       /* check if eDP panel is suppose to be set mode, if yes, no need to disable */
-       for (i = 0; i < context->stream_count; i++) {
-               if (context->streams[i]->signal == SIGNAL_TYPE_EDP) {
-                       if (context->streams[i]->dpms_off == true)
-                               return context->streams[i]->sink->link;
-                       else
-                               return NULL;
-               }
-       }
-
        /* check if there is an eDP panel not in use */
        for (i = 0; i < dc->link_count; i++) {
                if (dc->links[i]->local_sink &&
@@ -1546,59 +1537,53 @@ static struct dc_link *get_link_for_edp_to_turn_off(
 void dce110_enable_accelerated_mode(struct dc *dc, struct dc_state *context)
 {
        int i;
-       struct dc_link *edp_link_to_turnoff = NULL;
-       struct dc_link *edp_link = get_link_for_edp(dc);
-       bool can_edp_fast_boot_optimize = false;
-       bool apply_edp_fast_boot_optimization = false;
+       struct dc_link *edp_link_with_sink = get_edp_link_with_sink(dc, context);
+       struct dc_link *edp_link = get_edp_link(dc);
+       bool can_apply_edp_fast_boot = false;
        bool can_apply_seamless_boot = false;
 
-       for (i = 0; i < context->stream_count; i++) {
-               if (context->streams[i]->apply_seamless_boot_optimization) {
-                       can_apply_seamless_boot = true;
-                       break;
-               }
-       }
-
        if (dc->hwss.init_pipes)
                dc->hwss.init_pipes(dc, context);
 
-       if (edp_link) {
-               /* this seems to cause blank screens on DCE8 */
-               if ((dc->ctx->dce_version == DCE_VERSION_8_0) ||
-                   (dc->ctx->dce_version == DCE_VERSION_8_1) ||
-                   (dc->ctx->dce_version == DCE_VERSION_8_3))
-                       can_edp_fast_boot_optimize = false;
-               else
-                       can_edp_fast_boot_optimize =
-                               edp_link->link_enc->funcs->is_dig_enabled(edp_link->link_enc);
+       // Check fastboot support, disable on DCE8 because of blank screens
+       if (edp_link && dc->ctx->dce_version != DCE_VERSION_8_0 &&
+                   dc->ctx->dce_version != DCE_VERSION_8_1 &&
+                   dc->ctx->dce_version != DCE_VERSION_8_3) {
+
+               // enable fastboot if backend is enabled on eDP
+               if (edp_link->link_enc->funcs->is_dig_enabled(edp_link->link_enc)) {
+                       /* Find eDP stream and set optimization flag */
+                       for (i = 0; i < context->stream_count; i++) {
+                               if (context->streams[i]->signal == SIGNAL_TYPE_EDP) {
+                                       context->streams[i]->apply_edp_fast_boot_optimization = true;
+                                       can_apply_edp_fast_boot = true;
+                                       break;
+                               }
+                       }
+               }
        }
 
-       if (can_edp_fast_boot_optimize)
-               edp_link_to_turnoff = get_link_for_edp_to_turn_off(dc, context);
-
-       /* if OS doesn't light up eDP and eDP link is available, we want to disable
-        * If resume from S4/S5, should optimization.
-        */
-       if (can_edp_fast_boot_optimize && !edp_link_to_turnoff) {
-               /* Find eDP stream and set optimization flag */
-               for (i = 0; i < context->stream_count; i++) {
-                       if (context->streams[i]->signal == SIGNAL_TYPE_EDP) {
-                               context->streams[i]->apply_edp_fast_boot_optimization = true;
-                               apply_edp_fast_boot_optimization = true;
-                       }
+       // Check seamless boot support
+       for (i = 0; i < context->stream_count; i++) {
+               if (context->streams[i]->apply_seamless_boot_optimization) {
+                       can_apply_seamless_boot = true;
+                       break;
                }
        }
 
-       if (!apply_edp_fast_boot_optimization && !can_apply_seamless_boot) {
-               if (edp_link_to_turnoff) {
+       /* eDP should not have stream in resume from S4 and so even with VBios post
+        * it should get turned off
+        */
+       if (!can_apply_edp_fast_boot && !can_apply_seamless_boot) {
+               if (edp_link_with_sink) {
                        /*turn off backlight before DP_blank and encoder powered down*/
-                       dc->hwss.edp_backlight_control(edp_link_to_turnoff, false);
+                       dc->hwss.edp_backlight_control(edp_link_with_sink, false);
                }
                /*resume from S3, no vbios posting, no need to power down again*/
                power_down_all_hw_blocks(dc);
                disable_vga_and_power_gate_all_controllers(dc);
-               if (edp_link_to_turnoff)
-                       dc->hwss.edp_power_control(edp_link_to_turnoff, false);
+               if (edp_link_with_sink)
+                       dc->hwss.edp_power_control(edp_link_with_sink, false);
        }
        bios_set_scratch_acc_mode_change(dc->ctx->dc_bios);
 }