gma pipe setup: Refactor calculation to ease proof

Somehow GNATprove stumbles here when code changes elsewhere. Let's make
it focus on the linear-offset calculation.

Change-Id: Id5def319993b34144473984ca25c71d92c957180
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/27152
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
Nico Huber 2018-06-18 17:19:15 +02:00
parent b3b9fa34bb
commit d49b56baf9
1 changed files with 10 additions and 5 deletions

View File

@ -259,11 +259,16 @@ package body HW.GFX.GMA.Pipe_Setup is
Registers.Write
(Controller.DSPSTRIDE, Word32 (Pixel_To_Bytes (FB.Stride, FB)));
if Config.Has_DSP_Linoff and then FB.Tiling = Linear then
Registers.Write
(Register => Controller.DSPLINOFF,
Value => Word32 (Pixel_To_Bytes
(FB.Start_Y * FB.Stride + FB.Start_X, FB)));
Registers.Write (Controller.DSPTILEOFF, 0);
pragma Assert_And_Cut (True);
declare
Linear_Offset : constant Pixel_Type :=
FB.Start_Y * FB.Stride + FB.Start_X;
begin
Registers.Write
(Register => Controller.DSPLINOFF,
Value => Word32 (Pixel_To_Bytes (Linear_Offset, FB)));
Registers.Write (Controller.DSPTILEOFF, 0);
end;
else
if Config.Has_DSP_Linoff then
Registers.Write (Controller.DSPLINOFF, 0);