[coreboot-gerrit] Change in libgfxinit[master]: gma pipe_setup: Replace Update_Offset() with Setup_FB()

Nico Huber (Code Review) gerrit at coreboot.org
Mon Jan 8 13:32:44 CET 2018


Nico Huber has uploaded this change for review. ( https://review.coreboot.org/23165


Change subject: gma pipe_setup: Replace Update_Offset() with Setup_FB()
......................................................................

gma pipe_setup: Replace Update_Offset() with Setup_FB()

Beside updates to the framebuffer offset in memory, Setup_FB() allows
changes to size, position, tiling and rotation, too. Basically every-
thing but changes to BPC (which would need an update in the transcoder
configuration on pre-Broadwell hardware, too).

It is not clear if the updates work fully synchronous on all hardware
generations. Though, tests on APL have shown a glitch free transition
so far.

Change-Id: I3c8352315390d9c4d2fb2a7e09355b5fe4089421
Signed-off-by: Nico Huber <nico.h at gmx.de>
---
M common/hw-gfx-gma-pipe_setup.adb
M common/hw-gfx-gma-pipe_setup.ads
M common/hw-gfx-gma.adb
3 files changed, 32 insertions(+), 22 deletions(-)



  git pull ssh://review.coreboot.org:29418/libgfxinit refs/changes/65/23165/1

diff --git a/common/hw-gfx-gma-pipe_setup.adb b/common/hw-gfx-gma-pipe_setup.adb
index e417c5d..569f682 100644
--- a/common/hw-gfx-gma-pipe_setup.adb
+++ b/common/hw-gfx-gma-pipe_setup.adb
@@ -461,25 +461,34 @@
 
    ----------------------------------------------------------------------------
 
+   procedure Setup_FB
+     (Pipe        : Pipe_Index;
+      Mode        : Mode_Type;
+      Framebuffer : Framebuffer_Type)
+   is
+      -- Enable dithering if framebuffer BPC differs from port BPC,
+      -- as smooth gradients look really bad without.
+      Dither : constant Boolean := Framebuffer.BPC /= Mode.BPC;
+   begin
+      pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));
+
+      Setup_Display (Controllers (Pipe), Framebuffer, Mode.BPC, Dither);
+      Setup_Scaling (Controllers (Pipe), Mode, Framebuffer);
+   end Setup_FB;
+
    procedure On
      (Pipe        : Pipe_Index;
       Port_Cfg    : Port_Config;
       Framebuffer : Framebuffer_Type)
    is
-      -- Enable dithering if framebuffer BPC differs from port BPC,
-      -- as smooth gradients look really bad without.
-      Dither : constant Boolean := Framebuffer.BPC /= Port_Cfg.Mode.BPC;
    begin
       pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));
 
       Transcoder.Setup (Pipe, Port_Cfg);
 
-      Setup_Display
-        (Controllers (Pipe), Framebuffer, Port_Cfg.Mode.BPC, Dither);
+      Setup_FB (Pipe, Port_Cfg.Mode, Framebuffer);
 
-      Setup_Scaling (Controllers (Pipe), Port_Cfg.Mode, Framebuffer);
-
-      Transcoder.On (Pipe, Port_Cfg, Dither);
+      Transcoder.On (Pipe, Port_Cfg, Framebuffer.BPC /= Port_Cfg.Mode.BPC);
    end On;
 
    ----------------------------------------------------------------------------
@@ -534,15 +543,4 @@
       end loop;
    end All_Off;
 
-   ----------------------------------------------------------------------------
-
-   procedure Update_Offset (Pipe : Pipe_Index; Framebuffer : Framebuffer_Type)
-   is
-   begin
-      pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));
-
-      Registers.Write
-        (Controllers (Pipe).DSPSURF, Framebuffer.Offset and 16#ffff_f000#);
-   end Update_Offset;
-
 end HW.GFX.GMA.Pipe_Setup;
diff --git a/common/hw-gfx-gma-pipe_setup.ads b/common/hw-gfx-gma-pipe_setup.ads
index 3ef5dcf..33d543e 100644
--- a/common/hw-gfx-gma-pipe_setup.ads
+++ b/common/hw-gfx-gma-pipe_setup.ads
@@ -36,7 +36,16 @@
 
    procedure All_Off;
 
-   procedure Update_Offset (Pipe : Pipe_Index; Framebuffer : Framebuffer_Type);
+   procedure Setup_FB
+     (Pipe        : Pipe_Index;
+      Mode        : Mode_Type;
+      Framebuffer : Framebuffer_Type)
+   with
+      Pre =>
+         Rotated_Width (Framebuffer) <= Mode.H_Visible and
+         Rotated_Height (Framebuffer) <= Mode.V_Visible and
+         (Framebuffer.Offset = VGA_PLANE_FRAMEBUFFER_OFFSET or
+          Framebuffer.Height + Framebuffer.Start_Y <= Framebuffer.V_Stride);
 
 private
 
diff --git a/common/hw-gfx-gma.adb b/common/hw-gfx-gma.adb
index ab15c84..37a39e7 100644
--- a/common/hw-gfx-gma.adb
+++ b/common/hw-gfx-gma.adb
@@ -284,9 +284,12 @@
 
             -- update framebuffer offset only
             elsif New_Config.Port /= Disabled and
-                  Cur_Config.Framebuffer /= New_Config.Framebuffer
+                  Cur_Config.Framebuffer /= New_Config.Framebuffer and
+                  Config_Helpers.Validate_Config
+                    (New_Config.Framebuffer, New_Config.Mode, Pipe)
             then
-               Display_Controller.Update_Offset (Pipe, New_Config.Framebuffer);
+               Display_Controller.Setup_FB
+                 (Pipe, New_Config.Mode, New_Config.Framebuffer);
                Cur_Config := New_Config;
             end if;
          end;

-- 
To view, visit https://review.coreboot.org/23165
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: libgfxinit
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3c8352315390d9c4d2fb2a7e09355b5fe4089421
Gerrit-Change-Number: 23165
Gerrit-PatchSet: 1
Gerrit-Owner: Nico Huber <nico.h at gmx.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180108/89f462e6/attachment-0001.html>


More information about the coreboot-gerrit mailing list