Browse Source

* changed vesa.inc do it doesn't try to use linear modes anymore (doesn't work
yet!!)
* fixed mode detection so the low modenumber of a driver doesn't have to be zero
anymore (so VESA autodetection now works)

Jonas Maebe 26 years ago
parent
commit
802730bfb5
3 changed files with 78 additions and 31 deletions
  1. 14 8
      rtl/go32v2/vesa.inc
  2. 14 1
      rtl/inc/graph/graph.pp
  3. 50 22
      rtl/inc/graph/modes.inc

+ 14 - 8
rtl/go32v2/vesa.inc

@@ -1675,9 +1675,9 @@ end;
        m1280x1024x32k,
        m1280x1024x32k,
        m1280x1024x64k :
        m1280x1024x64k :
          begin
          begin
-           DirectPutPixel:=@DirectPutPixVESA256Linear;
-           PutPixel:=@PutPixVESA256Linear;
-           GetPixel:=@GetPixVESA256Linear;
+           DirectPutPixel:=@DirectPutPixVESA32kor64kLinear;
+           PutPixel:=@PutPixVESA32kor64kLinear;
+           GetPixel:=@GetPixVESA32kor64kLinear;
            { linear mode for lines not yet implemented PM }
            { linear mode for lines not yet implemented PM }
            HLine:=@HLineDefault;
            HLine:=@HLineDefault;
            VLine:=@VLineDefault;
            VLine:=@VLineDefault;
@@ -1688,9 +1688,9 @@ end;
        m1024x768x256,
        m1024x768x256,
        m1280x1024x256:
        m1280x1024x256:
          begin
          begin
-           DirectPutPixel:=@DirectPutPixVESA32kor64kLinear;
-           PutPixel:=@PutPixVESA32kor64kLinear;
-           GetPixel:=@GetPixVESA32kor64kLinear;
+           DirectPutPixel:=@DirectPutPixVESA256Linear;
+           PutPixel:=@PutPixVESA256Linear;
+           GetPixel:=@GetPixVESA256Linear;
            { linear mode for lines not yet implemented PM }
            { linear mode for lines not yet implemented PM }
            HLine:=@HLineDefault;
            HLine:=@HLineDefault;
            VLine:=@VLineDefault;
            VLine:=@VLineDefault;
@@ -1880,7 +1880,7 @@ end;
 
 
      { VBE 2.0 and higher supports >= non VGA linear buffer types...}
      { VBE 2.0 and higher supports >= non VGA linear buffer types...}
      { this is backward compatible.                                 }
      { this is backward compatible.                                 }
-     if {((VESAModeInfo.Attr and ModeNoWindowed) <> 0) and }
+     if ((VESAModeInfo.Attr and ModeNoWindowed) <> 0) and
           ((VESAModeInfo.Attr and ModeLinearBuffer) <> 0) then
           ((VESAModeInfo.Attr and ModeLinearBuffer) <> 0) then
         begin
         begin
           if not SetupLinear(VESAModeInfo,mode) then
           if not SetupLinear(VESAModeInfo,mode) then
@@ -2369,7 +2369,13 @@ end;
 
 
 {
 {
 $Log$
 $Log$
-Revision 1.9  1999-12-12 13:34:20  jonas
+Revision 1.10  1999-12-21 17:42:17  jonas
+  * changed vesa.inc do it doesn't try to use linear modes anymore (doesn't work
+    yet!!)
+  * fixed mode detection so the low modenumber of a driver doesn't have to be zero
+    anymore (so VESA autodetection now works)
+
+Revision 1.9  1999/12/12 13:34:20  jonas
   * putimage now performs the lipping itself and uses directputpixel
   * putimage now performs the lipping itself and uses directputpixel
     (note: this REQUIRES or/and/notput support in directputpixel,
     (note: this REQUIRES or/and/notput support in directputpixel,
     this is not yet the case in the assembler versions!)
     this is not yet the case in the assembler versions!)

+ 14 - 1
rtl/inc/graph/graph.pp

@@ -203,7 +203,10 @@ Interface
      windows;
      windows;
   {$endif win32}
   {$endif win32}
 
 
+type smallint = -32768..32767;
+
     const
     const
+       maxsmallint = high(smallint);
        { error codes }
        { error codes }
        grOk =  0;
        grOk =  0;
        grNoInitGraph = -1;
        grNoInitGraph = -1;
@@ -2879,6 +2882,10 @@ end;
     repeat
     repeat
        GetModeRange(GraphDriver,LoMode,HiMode);
        GetModeRange(GraphDriver,LoMode,HiMode);
        { save the highest mode possible...}
        { save the highest mode possible...}
+       {$ifdef logging}
+       logln('Found driver '+strf(graphdriver)+' with modes '+
+              strf(lomode)+' - '+strf(himode));
+       {$endif logging}
        if HiMode = -1 then break;
        if HiMode = -1 then break;
        CpyMode:=HiMode;
        CpyMode:=HiMode;
        CpyDriver:=GraphDriver;
        CpyDriver:=GraphDriver;
@@ -3036,7 +3043,13 @@ SetGraphBufSize
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.49  1999-12-21 09:16:48  pierre
+  Revision 1.50  1999-12-21 17:42:17  jonas
+    * changed vesa.inc do it doesn't try to use linear modes anymore (doesn't work
+      yet!!)
+    * fixed mode detection so the low modenumber of a driver doesn't have to be zero
+      anymore (so VESA autodetection now works)
+
+  Revision 1.49  1999/12/21 09:16:48  pierre
    + CloseGraph if errors
    + CloseGraph if errors
 
 
   Revision 1.48  1999/12/20 11:22:36  peter
   Revision 1.48  1999/12/20 11:22:36  peter

+ 50 - 22
rtl/inc/graph/modes.inc

@@ -59,7 +59,7 @@
    end;
    end;
 
 
 
 
-   function searchmode(ReqDriver : smallint; reqmode: smallint): PModeInfo;
+   function searchmode(ReqDriver : smallint; var reqmode: smallint): PModeInfo;
   {********************************************************}
   {********************************************************}
   { Procedure SearchMode()                                 }
   { Procedure SearchMode()                                 }
   {--------------------------------------------------------}
   {--------------------------------------------------------}
@@ -67,15 +67,20 @@
   { and tries to find the <reqmode> in the <reqdriver>     }
   { and tries to find the <reqmode> in the <reqdriver>     }
   { return nil if not found, otherwise returns the found   }
   { return nil if not found, otherwise returns the found   }
   { structure.                                             }
   { structure.                                             }
+  { note: if reqmode = -32768, the first mode available    }
+  {   for reqdriver is returned (JM)                       }
   {********************************************************}
   {********************************************************}
     var
     var
-     list: PModeInfo;
+     lastDriver, lastMode: SmallInt;
+     list, lastModeInfo: PModeInfo;
     begin
     begin
 {$ifdef logging}
 {$ifdef logging}
       LogLn('Searching for driver '+strf(reqdriver)+' and mode '+strf(reqmode));
       LogLn('Searching for driver '+strf(reqdriver)+' and mode '+strf(reqmode));
 {$endif logging}
 {$endif logging}
         searchmode := nil;
         searchmode := nil;
         list := ModeList;
         list := ModeList;
+        If assigned(list) then
+          lastModeInfo := list;
         { go to the end of the list }
         { go to the end of the list }
         while assigned(list) do
         while assigned(list) do
           begin
           begin
@@ -83,18 +88,33 @@
            Log('Found driver '+strf(list^.DriverNumber)+
            Log('Found driver '+strf(list^.DriverNumber)+
                ' and mode $'+hexstr(list^.ModeNumber,4)+'... ');
                ' and mode $'+hexstr(list^.ModeNumber,4)+'... ');
 {$endif logging}
 {$endif logging}
-             if (list^.DriverNumber = ReqDriver) and
-               (list^.ModeNumber = ReqMode) then
+             if ((list^.DriverNumber = ReqDriver) and
+                 ((list^.ModeNumber = ReqMode) or
+                  { search for lowest mode }
+                  (reqMode = -32768))) or
+                 { search for highest mode }
+                ((reqMode = -32767) and
+                 (lastModeInfo^.driverNumber = reqDriver) and
+                 ((list^.driverNumber <> lastModeInfo^.driverNumber) or
+                   not(assigned(list^.next)))) then
                begin
                begin
 {$ifdef logging}
 {$ifdef logging}
                  LogLn('Accepted!');
                  LogLn('Accepted!');
 {$endif logging}
 {$endif logging}
                  searchmode := list;
                  searchmode := list;
+                 If reqMode = -32768 then
+                   reqMode := list^.modeNumber
+                 else if reqMode = -32767 then
+                   begin
+                     reqMode := lastModeInfo^.modeNumber;
+                     searchMode := lastModeInfo;
+                   end;
                  exit;
                  exit;
                end;
                end;
 {$ifdef logging}
 {$ifdef logging}
-                 LogLn('Rejected.');
+             LogLn('Rejected.');
 {$endif logging}
 {$endif logging}
+             lastModeInfo := list;
              list:=list^.next;
              list:=list^.next;
           end;
           end;
     end;
     end;
@@ -153,37 +173,39 @@
     procedure GetModeRange(GraphDriver: smallint; var LoMode,
     procedure GetModeRange(GraphDriver: smallint; var LoMode,
       HiMode: smallint);
       HiMode: smallint);
       var
       var
-       i : smallint;
        mode : PModeInfo;
        mode : PModeInfo;
      begin
      begin
        {$ifdef logging}
        {$ifdef logging}
        LogLn('GetModeRange : Enter ('+strf(GraphDriver)+')');
        LogLn('GetModeRange : Enter ('+strf(GraphDriver)+')');
        {$endif}
        {$endif}
-       LoMode:=-1;
        HiMode:=-1;
        HiMode:=-1;
        mode := nil;
        mode := nil;
        { First search if the graphics driver is supported ..  }
        { First search if the graphics driver is supported ..  }
        { since mode zero is always supported.. if that driver }
        { since mode zero is always supported.. if that driver }
        { is supported it should return something...           }
        { is supported it should return something...           }
-       mode := SearchMode(GraphDriver, 0);
+
+       { not true, e.g. VESA doesn't have a mode 0. Changed so}
+       { -32768 means "return lowest mode in second parameter }
+       { also, under VESA some modes may not be supported     }
+       { (e.g. $108 here) while some with a higher number can }
+       { be supported ($112 and onward), so I also added that }
+       { -32767 means "return highest mode in second parameter}
+       { This whole system should be overhauled though to work}
+       { without such hacks (JM)                              }
+       loMode := -32768;
+       mode := SearchMode(GraphDriver, loMode);
        { driver not supported...}
        { driver not supported...}
-       if not assigned(mode) then exit;
+       if not assigned(mode) then
+         begin
+           loMode := -1;
+           exit;
+         end;
        {$ifdef logging}
        {$ifdef logging}
        LogLn('GetModeRange : Mode 0 found');
        LogLn('GetModeRange : Mode 0 found');
        {$endif}
        {$endif}
        { now it exists... find highest available mode... }
        { now it exists... find highest available mode... }
-       LoMode := 0;
-       mode:=nil;
-       i:=-1;
-       repeat
-         inc(i);
-         { start search at 0..     }
-         {$ifdef logging}
-         LogLn('GetModeRange : Searching Mode '+strf(i));
-         {$endif}
-         mode:=SearchMode(GraphDriver,i);
-       until not assigned(mode);
-       HiMode := i-1;
+       hiMode := -32767;
+       mode:=SearchMode(GraphDriver,hiMode);
      end;
      end;
 
 
 
 
@@ -341,7 +363,13 @@
 
 
 {
 {
 $Log$
 $Log$
-Revision 1.15  1999-12-20 11:22:36  peter
+Revision 1.16  1999-12-21 17:42:18  jonas
+  * changed vesa.inc do it doesn't try to use linear modes anymore (doesn't work
+    yet!!)
+  * fixed mode detection so the low modenumber of a driver doesn't have to be zero
+    anymore (so VESA autodetection now works)
+
+Revision 1.15  1999/12/20 11:22:36  peter
   * integer -> smallint to overcome -S2 switch needed for ggi version
   * integer -> smallint to overcome -S2 switch needed for ggi version
 
 
 Revision 1.14  1999/12/04 21:20:04  michael
 Revision 1.14  1999/12/04 21:20:04  michael