From: Ted Bullock Subject: Re: radeondrm: use the common KMS console path on sparc64 To: tech@openbsd.org Date: Wed, 07 Oct 2026 22:06:42 -0600 Hello, Here is a slightly revised version of the patch that also clears the background after kernel mode setting, removing artifacts left on the screen by the console transition. Ted --- a/sys/dev/pci/drm/radeon/radeon_drv.c +++ b/sys/dev/pci/drm/radeon/radeon_drv.c @@ -743,9 +743,6 @@ void (*)(void *, int, int), void *); void radeondrm_doswitch(void *); void radeondrm_enter_ddb(void *, void *); -#ifdef __sparc64__ -void radeondrm_setcolor(void *, u_int, u_int8_t, u_int8_t, u_int8_t); -#endif void radeondrm_setpal(struct radeon_device *, struct rasops_info *); struct wsscreen_descr radeondrm_stdscreen = { @@ -864,11 +861,7 @@ struct radeon_device *rdev = ri->ri_hw; rasops_show_screen(ri, rdev->switchcookie, 0, NULL, NULL); -#ifdef __sparc64__ - fbwscons_setcolormap(&rdev->sf, radeondrm_setcolor); -#else radeondrm_setpal(rdev, ri); -#endif drm_fb_helper_restore_fbdev_mode_unlocked(rdev_to_drm(rdev)->fb_helper, false); @@ -890,26 +883,7 @@ drm_fb_helper_debug_enter(fb_helper->info); } -#ifdef __sparc64__ void -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; - - /* 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 - -void radeondrm_setpal(struct radeon_device *rdev, struct rasops_info *ri) { struct drm_device *dev = rdev_to_drm(rdev); @@ -1287,16 +1261,14 @@ if (ri->ri_bits == NULL) return; -#ifdef __sparc64__ - fbwscons_setcolormap(&rdev->sf, radeondrm_setcolor); - ri = &rdev->sf.sf_ro; -#else radeondrm_setpal(rdev, ri); ri->ri_flg = RI_CENTER | RI_VCONS | RI_WRONLY; +#ifdef __sparc64__ + ri->ri_flg |= RI_BSWAP | RI_FULLCLEAR; +#endif rasops_init(ri, 160, 160); ri->ri_hw = rdev; -#endif radeondrm_stdscreen.capabilities = ri->ri_caps; radeondrm_stdscreen.nrows = ri->ri_rows; @@ -1316,6 +1288,9 @@ uint32_t defattr; ri->ri_ops.pack_attr(ri->ri_active, 0, 0, 0, &defattr); +#ifdef __sparc64__ + ri->ri_ops.eraserows(ri->ri_active, 0, ri->ri_rows, defattr); +#endif wsdisplay_cnattach(&radeondrm_stdscreen, ri->ri_active, ri->ri_ccol, ri->ri_crow, defattr); }