@@ -146,7 +146,7 @@ package body HW.GFX.GMA.Pipe_Setup is
146146
147147 -- -------------------------------------------------------------------------
148148
149- function Encode (LSW, MSW : Pos16 ) return Word32 is
149+ function Encode (LSW, MSW : Pos32 ) return Word32 is
150150 begin
151151 return Shift_Left (Word32 (MSW) - 1 , 16 ) or (Word32 (LSW) - 1 );
152152 end Encode ;
@@ -220,8 +220,8 @@ package body HW.GFX.GMA.Pipe_Setup is
220220 if Config.Has_Plane_Control then
221221 declare
222222 Stride, Offset : Word32;
223- Width : constant Pos16 := Rotated_Width (FB);
224- Height : constant Pos16 := Rotated_Height (FB);
223+ Width : constant Width_Type := Rotated_Width (FB);
224+ Height : constant Width_Type := Rotated_Height (FB);
225225 begin
226226 if Rotation_90 (FB) then
227227 Stride := Word32 (FB_Pitch (FB.V_Stride, FB));
@@ -376,7 +376,7 @@ package body HW.GFX.GMA.Pipe_Setup is
376376 begin
377377 -- off-screen cursor needs special care
378378 if X <= -Width or Y <= -Width or
379- X >= Int32 ( Rotated_Width (FB)) or Y >= Int32 ( Rotated_Height (FB) ) or
379+ X >= Rotated_Width (FB) or Y >= Rotated_Height (FB) or
380380 X > Config.Maximum_Cursor_X or Y > Config.Maximum_Cursor_Y
381381 then
382382 X := -Width;
@@ -393,31 +393,27 @@ package body HW.GFX.GMA.Pipe_Setup is
393393
394394 -- --------------------------------------------------------------------------
395395
396- function Scale (Val, Max, Num, Denom : Pos32 )
397- return Pos32 is ((Val * Num) / Denom)
396+ function Scale (Val, Max, Num, Denom : Width_Type )
397+ return Width_Type is ((Val * Num) / Denom)
398398 with
399- Pre =>
400- Val * Num <= Int32'Last and Denom <= Num and
401- Val * Num < Max * Denom,
399+ Pre => Denom <= Num and Val * Num < Max * Denom,
402400 Post => Scale'Result < Max;
403401
404402 procedure Scale_Keep_Aspect
405- (Width : out Pos32 ;
406- Height : out Pos32 ;
407- Max_Width : in Pos32 ;
408- Max_Height : in Pos32 ;
403+ (Width : out Width_Type ;
404+ Height : out Height_Type ;
405+ Max_Width : in Width_Type ;
406+ Max_Height : in Height_Type ;
409407 Framebuffer : in Framebuffer_Type)
410408 with
411409 Pre =>
412- Max_Width <= Pos32 (Pos16'Last) and
413- Max_Height <= Pos32 (Pos16'Last) and
414- Pos32 (Rotated_Width (Framebuffer)) <= Max_Width and
415- Pos32 (Rotated_Height (Framebuffer)) <= Max_Height,
410+ Rotated_Width (Framebuffer) <= Max_Width and
411+ Rotated_Height (Framebuffer) <= Max_Height,
416412 Post =>
417413 Width <= Max_Width and Height <= Max_Height
418414 is
419- Src_Width : constant Pos32 := Pos32 ( Rotated_Width (Framebuffer) );
420- Src_Height : constant Pos32 := Pos32 ( Rotated_Height (Framebuffer) );
415+ Src_Width : constant Width_Type := Rotated_Width (Framebuffer);
416+ Src_Height : constant Height_Type := Rotated_Height (Framebuffer);
421417 begin
422418 case Scaling_Type (Src_Width, Src_Height, Max_Width, Max_Height) is
423419 when Letterbox =>
@@ -448,8 +444,8 @@ package body HW.GFX.GMA.Pipe_Setup is
448444 (if Controller.PS_CTRL_2 /= Registers.Invalid_Register then
449445 PS_CTRL_SCALER_MODE_7X5_EXTENDED else 0 );
450446
451- Width_In : constant Pos32 := Pos32 ( Rotated_Width (Framebuffer) );
452- Height_In : constant Pos32 := Pos32 ( Rotated_Height (Framebuffer) );
447+ Width_In : constant Width_Type := Rotated_Width (Framebuffer);
448+ Height_In : constant Height_Type := Rotated_Height (Framebuffer);
453449
454450 -- We can scale up to 2.99x horizontally:
455451 Horizontal_Limit : constant Pos32 := (Width_In * 299 ) / 100 ;
@@ -464,15 +460,16 @@ package body HW.GFX.GMA.Pipe_Setup is
464460 else
465461 299 )) / 100 ;
466462
467- Width, Height : Pos32;
463+ Width : Width_Type;
464+ Height : Height_Type;
468465 begin
469466 -- Writes to WIN_SZ arm the PS registers.
470467
471468 Scale_Keep_Aspect
472469 (Width => Width,
473470 Height => Height,
474- Max_Width => Pos32'Min (Horizontal_Limit, Pos32 ( Mode.H_Visible) ),
475- Max_Height => Pos32'Min (Vertical_Limit, Pos32 ( Mode.V_Visible) ),
471+ Max_Width => Pos32'Min (Horizontal_Limit, Mode.H_Visible),
472+ Max_Height => Pos32'Min (Vertical_Limit, Mode.V_Visible),
476473 Framebuffer => Framebuffer);
477474
478475 Registers.Write
@@ -481,8 +478,8 @@ package body HW.GFX.GMA.Pipe_Setup is
481478 Registers.Write
482479 (Register => Controller.PS_WIN_POS_1,
483480 Value =>
484- Shift_Left (Word32 (Pos32 ( Mode.H_Visible) - Width) / 2 , 16 ) or
485- Word32 (Pos32 ( Mode.V_Visible) - Height) / 2 );
481+ Shift_Left (Word32 (Mode.H_Visible - Width) / 2 , 16 ) or
482+ Word32 (Mode.V_Visible - Height) / 2 );
486483 Registers.Write
487484 (Register => Controller.PS_WIN_SZ_1,
488485 Value => Shift_Left (Word32 (Width), 16 ) or Word32 (Height));
@@ -506,29 +503,30 @@ package body HW.GFX.GMA.Pipe_Setup is
506503 when Registers.PFC_CTL_1 => 2 * 2 ** 29 ,
507504 when others => 0 ) else 0 );
508505
509- Width, Height : Pos32;
506+ Width : Width_Type;
507+ Height : Height_Type;
510508 X, Y : Int32;
511509 begin
512510 -- Writes to WIN_SZ arm the PF registers.
513511
514512 Scale_Keep_Aspect
515513 (Width => Width,
516514 Height => Height,
517- Max_Width => Pos32 ( Mode.H_Visible) ,
518- Max_Height => Pos32 ( Mode.V_Visible) ,
515+ Max_Width => Mode.H_Visible,
516+ Max_Height => Mode.V_Visible,
519517 Framebuffer => Framebuffer);
520518
521519 -- Do not scale to odd width (at least Haswell has trouble with this).
522- if Width < Pos32 ( Mode.H_Visible) and Width mod 2 = 1 then
520+ if Width < Mode.H_Visible and Width mod 2 = 1 then
523521 Width := Width + 1 ;
524522 end if ;
525523
526- X := (Int32 ( Mode.H_Visible) - Width) / 2 ;
527- Y := (Int32 ( Mode.V_Visible) - Height) / 2 ;
524+ X := (Mode.H_Visible - Width) / 2 ;
525+ Y := (Mode.V_Visible - Height) / 2 ;
528526
529527 -- Hardware is picky about minimal horizontal gaps.
530- if Pos32 ( Mode.H_Visible) - Width <= 3 then
531- Width := Pos32( Mode.H_Visible) ;
528+ if Mode.H_Visible - Width <= 3 then
529+ Width := Mode.H_Visible;
532530 X := 0 ;
533531 end if ;
534532
0 commit comments