From: jsg Date: Sun, 19 Dec 2021 03:39:05 +0000 (+0000) Subject: fix radeondrm console colours on sparc64 X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=cab855fe57fcb853be678ff73672a09d0c2c972e;p=openbsd fix radeondrm console colours on sparc64 Directly do register writes in the sparc64 specific radeondrm_setcolor() instead of trying to pass colour values via crtc->gamma_store. With these changes the console changes from white text on a black background to black text on a white background. Only older radeon families are handled and crtc selection is skipped as with radeonfb. Both of the sun radeon parts fall into this family < CHIP_RS600 path. xvr-100 (0x1002:0x5159 pci rv100) xvr-300 (0x1002:0x5b64 pcie rv380) Tested on a Sun Blade 100 with XVR-100 by Ted Bullock who also helped with the patch. --- diff --git a/sys/dev/pci/drm/radeon/radeon_kms.c b/sys/dev/pci/drm/radeon/radeon_kms.c index 07cce8dd5eb..72874bc2c67 100644 --- a/sys/dev/pci/drm/radeon/radeon_kms.c +++ b/sys/dev/pci/drm/radeon/radeon_kms.c @@ -360,34 +360,15 @@ radeondrm_setcolor(void *v, u_int index, u_int8_t r, u_int8_t g, u_int8_t b) { struct sunfb *sf = v; struct radeon_device *rdev = sf->sf_ro.ri_hw; - struct drm_device *dev = rdev->ddev; - uint16_t red, green, blue; - uint16_t *r_base, *g_base, *b_base; - struct drm_crtc *crtc; - int i, ret = 0; - - for (i = 0; i < rdev->num_crtc; i++) { - struct drm_modeset_acquire_ctx ctx; - crtc = &rdev->mode_info.crtcs[i]->base; - - red = (r << 8) | r; - green = (g << 8) | g; - blue = (b << 8) | b; - - DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret); - r_base = crtc->gamma_store; - g_base = r_base + crtc->gamma_size; - b_base = g_base + crtc->gamma_size; - - *r_base = red >> 6; - *g_base = green >> 6; - *b_base = blue >> 6; - - crtc->funcs->gamma_set(crtc, r_base, g_base, b_base, - crtc->gamma_size, &ctx); - - DRM_MODESET_LOCK_ALL_END(dev, ctx, ret); + /* see legacy_crtc_load_lut() */ + if (rdev->family < CHIP_RS600) { + WREG8(RADEON_PALETTE_INDEX, index); + WREG32(RADEON_PALETTE_30_DATA, + (r << 22) | (g << 12) | (b << 2)); + } else { + printf("%s: setcolor family %d not handled\n", + rdev->self.dv_xname, rdev->family); } } #endif