From abb16d98d6140936e84e767b2df6a9cdc3e486dc Mon Sep 17 00:00:00 2001 From: Nico Huber Date: Tue, 29 May 2018 01:44:26 +0200 Subject: [PATCH] gma hsw transcoder: Choose PDW path for scaling on DDI A If scaling is required, always drive DDI A through the Power Down Well (PDW) path. If not, keep the current "always on" path to allow power saving. Hopefully, this also enables us to use the eDP in legacy VGA text mode. Change-Id: Ia9135d253083d363872c7cf0b3e2b5b69ba0831f Signed-off-by: Nico Huber Reviewed-on: https://review.coreboot.org/26664 Reviewed-by: Arthur Heymans --- common/hw-gfx-gma-pipe_setup.adb | 6 +++++- common/hw-gfx-gma-transcoder.adb | 35 +++++++++++++++----------------- common/hw-gfx-gma-transcoder.ads | 8 ++++++-- 3 files changed, 27 insertions(+), 22 deletions(-) diff --git a/common/hw-gfx-gma-pipe_setup.adb b/common/hw-gfx-gma-pipe_setup.adb index 995eecc053..8f275c19c6 100644 --- a/common/hw-gfx-gma-pipe_setup.adb +++ b/common/hw-gfx-gma-pipe_setup.adb @@ -556,7 +556,11 @@ package body HW.GFX.GMA.Pipe_Setup is Setup_FB (Pipe, Port_Cfg.Mode, Framebuffer); - Transcoder.On (Pipe, Port_Cfg, Framebuffer.BPC /= Port_Cfg.Mode.BPC); + Transcoder.On + (Pipe => Pipe, + Port_Cfg => Port_Cfg, + Dither => Framebuffer.BPC /= Port_Cfg.Mode.BPC, + Scale => Requires_Scaling (Framebuffer, Port_Cfg.Mode)); end On; ---------------------------------------------------------------------------- diff --git a/common/hw-gfx-gma-transcoder.adb b/common/hw-gfx-gma-transcoder.adb index 97ad069cbe..daa5debd62 100644 --- a/common/hw-gfx-gma-transcoder.adb +++ b/common/hw-gfx-gma-transcoder.adb @@ -1,5 +1,5 @@ -- --- Copyright (C) 2015-2016 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 @@ -76,11 +76,6 @@ package body HW.GFX.GMA.Transcoder is DDI_FUNC_CTL_MODE_SELECT_DP_SST : constant := 2 * 2 ** 24; DDI_FUNC_CTL_MODE_SELECT_DP_MST : constant := 3 * 2 ** 24; DDI_FUNC_CTL_MODE_SELECT_FDI : constant := 4 * 2 ** 24; - DDI_FUNC_CTL_EDP_SELECT_MASK : constant := 7 * 2 ** 12; - DDI_FUNC_CTL_EDP_SELECT_ALWAYS_ON : constant := 0 * 2 ** 12; - DDI_FUNC_CTL_EDP_SELECT_A : constant := 4 * 2 ** 12; - DDI_FUNC_CTL_EDP_SELECT_B : constant := 5 * 2 ** 12; - DDI_FUNC_CTL_EDP_SELECT_C : constant := 6 * 2 ** 12; type DDI_Select_Array is array (Digital_Port) of Word32; DDI_FUNC_CTL_DDI_SELECT : constant DDI_Select_Array := @@ -105,16 +100,12 @@ package body HW.GFX.GMA.Transcoder is (False => 0 * 2 ** 16, True => 1 * 2 ** 16); - type EDP_Select_Array is array (Pipe_Index) of Word32; - DDI_FUNC_CTL_EDP_SELECT : constant EDP_Select_Array := - (Primary => DDI_FUNC_CTL_EDP_SELECT_ALWAYS_ON, -- we never use - -- panel fitter - Secondary => DDI_FUNC_CTL_EDP_SELECT_B, - Tertiary => DDI_FUNC_CTL_EDP_SELECT_C); - DDI_FUNC_CTL_EDP_SELECT_ONOFF : constant EDP_Select_Array := - (Primary => DDI_FUNC_CTL_EDP_SELECT_A, - Secondary => DDI_FUNC_CTL_EDP_SELECT_B, - Tertiary => DDI_FUNC_CTL_EDP_SELECT_C); + DDI_FUNC_CTL_EDP_SELECT_MASK : constant := 7 * 2 ** 12; + DDI_FUNC_CTL_EDP_SELECT_ALWAYS_ON : constant := 0 * 2 ** 12; + DDI_FUNC_CTL_EDP_SELECT : constant array (Pipe_Index) of Word32 := + (Primary => 4 * 2 ** 12, + Secondary => 5 * 2 ** 12, + Tertiary => 6 * 2 ** 12); type Port_Width_Array is array (DP_Lane_Count) of Word32; DDI_FUNC_CTL_PORT_WIDTH : constant Port_Width_Array := @@ -245,10 +236,16 @@ package body HW.GFX.GMA.Transcoder is procedure On (Pipe : Pipe_Index; Port_Cfg : Port_Config; - Dither : Boolean) + Dither : Boolean; + Scale : Boolean) is Trans : Transcoder_Regs renames Transcoders (Get_Idx (Pipe, Port_Cfg.Port)); + EDP_Select : constant Word32 := + (if Pipe = Primary and not Scale then + DDI_FUNC_CTL_EDP_SELECT_ALWAYS_ON + else + DDI_FUNC_CTL_EDP_SELECT (Pipe)); begin if Config.Has_Pipe_DDI_Func and Port_Cfg.Port in Digital_Port then Registers.Write @@ -259,7 +256,7 @@ package body HW.GFX.GMA.Transcoder is DDI_FUNC_CTL_BPC (Port_Cfg.Mode.BPC) or DDI_FUNC_CTL_VSYNC (Port_Cfg.Mode.V_Sync_Active_High) or DDI_FUNC_CTL_HSYNC (Port_Cfg.Mode.H_Sync_Active_High) or - DDI_FUNC_CTL_EDP_SELECT (Pipe) or + EDP_Select or DDI_FUNC_CTL_PORT_WIDTH (Port_Cfg.DP.Lane_Count)); end if; @@ -308,7 +305,7 @@ package body HW.GFX.GMA.Transcoder is if (Pipe = Primary and DDI_Func_Ctl = DDI_FUNC_CTL_EDP_SELECT_ALWAYS_ON) or - DDI_Func_Ctl = DDI_FUNC_CTL_EDP_SELECT_ONOFF (Pipe) + DDI_Func_Ctl = DDI_FUNC_CTL_EDP_SELECT (Pipe) then Trans_Off (Transcoders (Trans_EDP)); end if; diff --git a/common/hw-gfx-gma-transcoder.ads b/common/hw-gfx-gma-transcoder.ads index 79be8f718e..b02693369e 100644 --- a/common/hw-gfx-gma-transcoder.ads +++ b/common/hw-gfx-gma-transcoder.ads @@ -1,5 +1,5 @@ -- --- Copyright (C) 2015-2016 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 @@ -19,7 +19,11 @@ private package HW.GFX.GMA.Transcoder is procedure Setup (Pipe : Pipe_Index; Port_Cfg : Port_Config); - procedure On (Pipe : Pipe_Index; Port_Cfg : Port_Config; Dither : Boolean); + procedure On + (Pipe : Pipe_Index; + Port_Cfg : Port_Config; + Dither : Boolean; + Scale : Boolean); procedure Off (Pipe : Pipe_Index); procedure Clk_Off (Pipe : Pipe_Index);