Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/dist/drm/radeon Hack against the blank...



details:   https://anonhg.NetBSD.org/src/rev/cef9d847962e
branches:  trunk
changeset: 336764:cef9d847962e
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Mar 18 02:57:13 2015 +0000

description:
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.

diffstat:

 sys/external/bsd/drm2/dist/drm/radeon/radeon_display.c |  36 +++++++++++++++---
 1 files changed, 30 insertions(+), 6 deletions(-)

diffs (46 lines):

diff -r fd7636a4cedc -r cef9d847962e sys/external/bsd/drm2/dist/drm/radeon/radeon_display.c
--- a/sys/external/bsd/drm2/dist/drm/radeon/radeon_display.c    Wed Mar 18 02:05:05 2015 +0000
+++ b/sys/external/bsd/drm2/dist/drm/radeon/radeon_display.c    Wed Mar 18 02:57:13 2015 +0000
@@ -181,12 +181,36 @@
                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));
+               }
        }
 }
 



Home | Main Index | Thread Index | Old Index