summaryrefslogtreecommitdiff
path: root/src/drivers/intel/gma/gma.adb
blob: 10885e6e0938032a7b7035e533f7709e7feb6872 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
with HW.GFX.GMA;
with HW.GFX.GMA.Display_Probing;

use HW.GFX.GMA;

package body GMA is

   function read_edid
     (raw_edid :    out HW.GFX.EDID.Raw_EDID_Data;
      port     : in     Interfaces.C.int)
      return Interfaces.C.int
   is
      use type Interfaces.C.int;
      success : Boolean := true;
   begin
      if port not in Active_Port_Type'Pos (Active_Port_Type'First)
                     .. Active_Port_Type'Pos (Active_Port_Type'Last)
      then
         raw_edid := (others => 0);
         return -2;
      else
         if not HW.GFX.GMA.Is_Initialized then
            HW.GFX.GMA.Initialize (Success => success);
         end if;
         if success then
            HW.GFX.GMA.Display_Probing.Read_EDID
              (raw_edid, Active_Port_Type'Val (port), success);
         end if;
         if success then
            return 0;
         else
            return -1;
         end if;
      end if;
   end read_edid;

end GMA;