[haiku-development] S3 Video Driver Fixes

  • From: Gerald Zajac <zajacg@xxxxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Thu, 18 Dec 2008 13:36:09 -0500

Attached is a diff file with two small fixes for the S3 video driver.

One fix changes the error codes returned by function SetDisplayMode() to use error codes that better describe the error. For example, if there is insufficient frame buffer memory to handle the mode, it will now return B_NO_MEMORY; whereas, it previously returned B_ERROR for all error conditions.

The other fix allows ProSavage chips to work properly after some boot screens are used. Previously my Samsung LCD monitor would remain blank after a 1280x1024x32 boot screen was selected. That is, nothing was displayed after the S3 driver set the display mode.

Best regards,
Gerald

Index: src/add-ons/accelerants/s3/savage_mode.cpp
===================================================================
--- src/add-ons/accelerants/s3/savage_mode.cpp  (revision 28815)
+++ src/add-ons/accelerants/s3/savage_mode.cpp  (working copy)
@@ -525,10 +525,14 @@
        WriteCrtcReg(0x67, regRec.CR67 & ~0x0e); // no STREAMS yet old and new
 
        // Set register SR19 to zero so that the ProSavage chips will start up
-       // when booting under BeOS using the default boot screen.
+       // when booting under BeOS using the default boot screen, and set 
register
+       // CR5F to zero so that the ProSavage chips will start up when Haiku 
boot
+       // screen had a depth of 32 bits/pixel
 
-       if (si.chipType == S3_PROSAVAGE || si.chipType == S3_TWISTER)
+       if (si.chipType == S3_PROSAVAGE || si.chipType == S3_TWISTER) {
                WriteSeqReg(0x19, 0);
+               WriteCrtcReg(0x5f, 0);
+       }
 
        // Clear bit 3 in SR30 so that Savage MX chip will startup.  If bit 3 is
        // not cleared, it will startup only if booting under BeOS using the
Index: src/add-ons/accelerants/s3/mode.cpp
===================================================================
--- src/add-ons/accelerants/s3/mode.cpp (revision 28815)
+++ src/add-ons/accelerants/s3/mode.cpp (working copy)
@@ -332,10 +332,10 @@
 
        uint32 maxPixelClock;
        if ( ! gInfo.GetColorSpaceParams(mode.space, mode.bpp, maxPixelClock))
-               return B_ERROR;
+               return B_BAD_VALUE;
 
        if (ProposeDisplayMode(&mode, pMode, pMode) != B_OK)
-               return B_ERROR;
+               return B_BAD_VALUE;
 
        // Note that for some Savage chips, accelerated drawing is badly messed 
up
        // when the display width is 1400 because 1400 is not evenly divisible 
by 32.
@@ -357,7 +357,7 @@
        // Is there enough frame buffer memory for this mode?
 
        if ( ! IsThereEnoughFBMemory(&mode, mode.bpp))
-               return B_ERROR;
+               return B_NO_MEMORY;
 
        TRACE("Set display mode: %dx%d  virtual size: %dx%d  color depth: %d 
bpp\n",
                mode.timing.h_display, mode.timing.v_display,

Other related posts: