[PATCH xf86-video-r128 6/8] Refactor R128PreInitWeight

Kevin Brace kevinbrace at gmx.com
Tue Jun 5 00:44:59 UTC 2018


Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
---
 src/r128_driver.c | 36 +++++++++++++++++++-----------------
 1 file changed, 19 insertions(+), 17 deletions(-)

diff --git a/src/r128_driver.c b/src/r128_driver.c
index b29b191..dd3521c 100644
--- a/src/r128_driver.c
+++ b/src/r128_driver.c
@@ -680,29 +680,31 @@ static Bool R128PreInitVisual(ScrnInfoPtr pScrn)
 static Bool R128PreInitWeight(ScrnInfoPtr pScrn)
 {
     R128InfoPtr info          = R128PTR(pScrn);
-
-				/* Save flag for 6 bit DAC to use for
-				   setting CRTC registers.  Otherwise use
-				   an 8 bit DAC, even if xf86SetWeight sets
-				   pScrn->rgbBits to some value other than
-				   8. */
+    rgb defaultWeight = { 0, 0, 0 };
+
+    /* Save flag for 6 bit DAC to use for
+       setting CRTC registers.  Otherwise use
+       an 8 bit DAC, even if xf86SetWeight sets
+       pScrn->rgbBits to some value other than
+       8. */
+    pScrn->rgbBits = 8;
     info->dac6bits = FALSE;
+    if (pScrn->depth <= 8) {
+        if (xf86ReturnOptValBool(info->Options, OPTION_DAC_6BIT, FALSE)) {
+            pScrn->rgbBits = 6;
+            info->dac6bits = TRUE;
+        }
+    }
+
     if (pScrn->depth > 8) {
-	rgb defaultWeight = { 0, 0, 0 };
-	if (!xf86SetWeight(pScrn, defaultWeight, defaultWeight)) return FALSE;
-    } else {
-	pScrn->rgbBits = 8;
-	if (xf86ReturnOptValBool(info->Options, OPTION_DAC_6BIT, FALSE)) {
-	    pScrn->rgbBits = 6;
-	    info->dac6bits = TRUE;
-	}
+        if (!xf86SetWeight(pScrn, defaultWeight, defaultWeight)) return FALSE;
     }
+
     xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-	       "Using %d bits per RGB (%d bit DAC)\n",
-	       pScrn->rgbBits, info->dac6bits ? 6 : 8);
+               "Using %d bits per RGB (%d bit DAC)\n",
+               pScrn->rgbBits, info->dac6bits ? 6 : 8);
 
     return TRUE;
-
 }
 
 /* This is called by R128PreInit to handle config file overrides for things
-- 
2.7.4



More information about the xorg-driver-ati mailing list