Module Name:    src
Committed By:   christos
Date:           Wed Mar 18 02:57:13 UTC 2015

Modified Files:
        src/sys/external/bsd/drm2/dist/drm/radeon: radeon_display.c

Log Message:
Hack against the blank console problem:
Leave the CLUT alone on ancient cards. At least this leaves us with a
semi working console (red and blue are flipped). Leave an example of what
seems to be happening but disable it because colors are better than 444 bit
greyscale.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
    src/sys/external/bsd/drm2/dist/drm/radeon/radeon_display.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/radeon/radeon_display.c
diff -u src/sys/external/bsd/drm2/dist/drm/radeon/radeon_display.c:1.2 src/sys/external/bsd/drm2/dist/drm/radeon/radeon_display.c:1.3
--- src/sys/external/bsd/drm2/dist/drm/radeon/radeon_display.c:1.2	Wed Jul 16 16:59:57 2014
+++ src/sys/external/bsd/drm2/dist/drm/radeon/radeon_display.c	Tue Mar 17 22:57:13 2015
@@ -181,12 +181,36 @@ static void legacy_crtc_load_lut(struct 
 		dac2_cntl |= RADEON_DAC2_PALETTE_ACC_CTL;
 	WREG32(RADEON_DAC_CNTL2, dac2_cntl);
 
-	WREG8(RADEON_PALETTE_INDEX, 0);
-	for (i = 0; i < 256; i++) {
-		WREG32(RADEON_PALETTE_30_DATA,
-			     (radeon_crtc->lut_r[i] << 20) |
-			     (radeon_crtc->lut_g[i] << 10) |
-			     (radeon_crtc->lut_b[i] << 0));
+	/*
+	 * At least the RV100 [vendor 1002 product 515e (rev. 0x02)]
+	 * has an old style palette
+	 */
+	if (ASIC_IS_RV100(rdev)) {
+#ifdef notyet
+		/*
+		 * Leave CLUT alone for now. The code below gives us a
+		 * nice 444 grayscale, but we are not in true color mode
+		 * anymore and I don't have any docs how to do this right.
+		 */
+		WREG8(RADEON_PALETTE_INDEX, 0);
+		for (i = 0; i < 256; i++) {
+#define R(x) (radeon_crtc->lut_r[i] >> 2)
+#define G(x) (radeon_crtc->lut_g[i] >> 2)
+#define B(x) (radeon_crtc->lut_b[i] >> 2)
+			WREG32(RADEON_PALETTE_DATA, ((R(i) << 16)
+				| (G(i) << 8) | B(i)) << 4);
+		}
+#else
+		printf("%s: unknown DAC, can't set lookup table\n", __func__);
+#endif
+	} else {
+		WREG8(RADEON_PALETTE_INDEX, 0);
+		for (i = 0; i < 256; i++) {
+			WREG32(RADEON_PALETTE_30_DATA,
+				     (radeon_crtc->lut_r[i] << 20) |
+				     (radeon_crtc->lut_g[i] << 10) |
+				     (radeon_crtc->lut_b[i] << 0));
+		}
 	}
 }
 

Reply via email to