gma hsw: Enable Power Down Well for scaling on DDI A
The primary pipe can drive DDI A (eDP) without the Power Down
Well (PDW). The scalers are inside the PDW, though. To enable
scaling for DDI A, ensure the PDW is active.
When switching between scaled / unscaled modes, we'll have to
reconfigure the whole pipe.
Change-Id: I46318bb74d00a584d268a9d76787f8b26249264d
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/26663
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/common/haswell_shared/hw-gfx-gma-power_and_clocks_haswell.adb b/common/haswell_shared/hw-gfx-gma-power_and_clocks_haswell.adb
index c0d1e78..1c23254 100644
--- a/common/haswell_shared/hw-gfx-gma-power_and_clocks_haswell.adb
+++ b/common/haswell_shared/hw-gfx-gma-power_and_clocks_haswell.adb
@@ -1,5 +1,5 @@
--
--- Copyright (C) 2014-2016 secunet Security Networks AG
+-- Copyright (C) 2014-2018 secunet Security Networks AG
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
@@ -185,12 +185,19 @@
end if;
end PDW_On;
- function Need_PDW (Checked_Configs : Pipe_Configs) return Boolean is
+ function Need_PDW (Checked_Configs : Pipe_Configs) return Boolean
+ is
+ Primary : Pipe_Config renames Checked_Configs (GMA.Primary);
begin
- return (Checked_Configs (Primary).Port /= Disabled and
- Checked_Configs (Primary).Port /= Internal) or
- Checked_Configs (Secondary).Port /= Disabled or
- Checked_Configs (Tertiary).Port /= Disabled;
+ return
+ (Config.Use_PDW_For_EDP_Scaling and then
+ (Primary.Port = Internal and Requires_Scaling (Primary)))
+ or
+ (Primary.Port /= Disabled and Primary.Port /= Internal)
+ or
+ Checked_Configs (Secondary).Port /= Disabled
+ or
+ Checked_Configs (Tertiary).Port /= Disabled;
end Need_PDW;
----------------------------------------------------------------------------
diff --git a/common/hw-gfx-gma-config.ads.template b/common/hw-gfx-gma-config.ads.template
index 1a4d124..46e2782 100644
--- a/common/hw-gfx-gma-config.ads.template
+++ b/common/hw-gfx-gma-config.ads.template
@@ -1,5 +1,5 @@
--
--- Copyright (C) 2015-2017 secunet Security Networks AG
+-- Copyright (C) 2015-2018 secunet Security Networks AG
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
@@ -47,6 +47,7 @@
(CPU in Haswell .. Broadwell);
Pipe_Enabled_Workaround : constant Boolean := CPU = Broadwell;
Has_EDP_Transcoder : constant Boolean := CPU >= Haswell;
+ Use_PDW_For_EDP_Scaling : constant Boolean := CPU = Haswell;
Has_Pipe_DDI_Func : constant Boolean := CPU >= Haswell;
Has_Trans_Clk_Sel : constant Boolean := CPU >= Haswell;
Has_Pipe_MSA_Misc : constant Boolean := CPU >= Haswell;
diff --git a/common/hw-gfx-gma-pipe_setup.adb b/common/hw-gfx-gma-pipe_setup.adb
index ffa140f..995eecc 100644
--- a/common/hw-gfx-gma-pipe_setup.adb
+++ b/common/hw-gfx-gma-pipe_setup.adb
@@ -514,9 +514,7 @@
Rotated_Height (Framebuffer) <= Mode.V_Visible
is
begin
- if Rotated_Width (Framebuffer) /= Mode.H_Visible or
- Rotated_Height (Framebuffer) /= Mode.V_Visible
- then
+ if Requires_Scaling (Framebuffer, Mode) then
if Config.Has_Plane_Control then
Setup_Skylake_Pipe_Scaler (Controller, Mode, Framebuffer);
elsif Config.Has_GMCH_PFIT_CONTROL then
diff --git a/common/hw-gfx-gma.adb b/common/hw-gfx-gma.adb
index c3b2238..8ece078 100644
--- a/common/hw-gfx-gma.adb
+++ b/common/hw-gfx-gma.adb
@@ -1,5 +1,5 @@
--
--- Copyright (C) 2014-2017 secunet Security Networks AG
+-- Copyright (C) 2014-2018 secunet Security Networks AG
-- Copyright (C) 2017 Nico Huber <nico.h@gmx.de>
--
-- This program is free software; you can redistribute it and/or modify
@@ -231,6 +231,17 @@
Power_Changed := True;
end if;
end Update_Power;
+
+ function Full_Update (Cur_Config, New_Config : Pipe_Config) return Boolean
+ is
+ begin
+ return
+ Cur_Config.Port /= New_Config.Port or else
+ Cur_Config.Mode /= New_Config.Mode or else
+ (Config.Use_PDW_For_EDP_Scaling and then
+ (Cur_Config.Port = Internal and
+ Requires_Scaling (Cur_Config) /= Requires_Scaling (New_Config)));
+ end Full_Update;
begin
Old_Configs := Cur_Configs;
@@ -244,10 +255,7 @@
if Cur_Config.Port /= Disabled then
Check_HPD (Cur_Config.Port, Unplug_Detected);
- if Cur_Config.Port /= New_Config.Port or
- Cur_Config.Mode /= New_Config.Mode or
- Unplug_Detected
- then
+ if Full_Update (Cur_Config, New_Config) or Unplug_Detected then
Disable_Output (Pipe, Cur_Config);
Cur_Config.Port := Disabled;
Update_Power;
@@ -263,9 +271,8 @@
Cur_Config : Pipe_Config renames Cur_Configs (Pipe);
New_Config : Pipe_Config renames Configs (Pipe);
begin
- if New_Config.Port /= Disabled and then
- (Cur_Config.Port /= New_Config.Port or
- Cur_Config.Mode /= New_Config.Mode)
+ if New_Config.Port /= Disabled and
+ Full_Update (Cur_Config, New_Config)
then
if Wait_For_HPD (New_Config.Port) then
Check_HPD (New_Config.Port, Success);
diff --git a/common/hw-gfx-gma.ads b/common/hw-gfx-gma.ads
index fb5c7e5..824a59e 100644
--- a/common/hw-gfx-gma.ads
+++ b/common/hw-gfx-gma.ads
@@ -1,5 +1,5 @@
--
--- Copyright (C) 2015-2017 secunet Security Networks AG
+-- Copyright (C) 2015-2018 secunet Security Networks AG
-- Copyright (C) 2017 Nico Huber <nico.h@gmx.de>
--
-- This program is free software; you can redistribute it and/or modify
@@ -130,6 +130,13 @@
Cur_Configs : Pipe_Configs with Part_Of => State;
+ function Requires_Scaling (FB : Framebuffer_Type; Mode : Mode_Type)
+ return Boolean is
+ (Rotated_Width (FB) /= Mode.H_Visible or
+ Rotated_Height (FB) /= Mode.V_Visible);
+ function Requires_Scaling (Pipe_Cfg : Pipe_Config) return Boolean is
+ (Requires_Scaling (Pipe_Cfg.Framebuffer, Pipe_Cfg.Mode));
+
----------------------------------------------------------------------------
-- Internal representation of a single pipe's configuration