/* * RETINA_SPEED_HACK code seems to work on some boards and on others * it causes text to smear horizontally */ void rh_scroll(struct ite_softc *ip, int sy, int sx, int count, int dir) { #ifndef RETINA_SPEED_HACK u_long *fb = (u_long *)__UNVOLATILE(ip->grf->g_fbkva); #endif rh_cursor(ip, ERASE_CURSOR); if (dir == SCROLL_UP) { #ifdef RETINA_SPEED_HACK screen_up(ip, sy - count, ip->bottom_margin, count); #else bcopy(fb + sy * ip->cols, fb + (sy - count) * ip->cols, 4 * (ip->bottom_margin - sy + 1) * ip->cols); rh_clear(ip, ip->bottom_margin + 1 - count, 0, count, ip->cols); #endif } else if (dir == SCROLL_DOWN) { #ifdef RETINA_SPEED_HACK screen_down(ip, sy, ip->bottom_margin, count); #else bcopy(fb + sy * ip->cols, fb + (sy + count) * ip->cols, 4 * (ip->bottom_margin - sy - count + 1) * ip->cols); rh_clear(ip, sy, 0, count, ip->cols); #endif } else if (dir == SCROLL_RIGHT) { RZ3AlphaCopy(ip->grf, sx, sy, sx + count, sy, ip->cols - (sx + count), 1); RZ3AlphaErase(ip->grf, sx, sy, count, 1); } else { RZ3AlphaCopy(ip->grf, sx + count, sy, sx, sy, ip->cols - (sx + count), 1); RZ3AlphaErase(ip->grf, ip->cols - count, sy, count, 1); } #ifndef RETINA_SPEED_HACK rh_cursor(ip, !ERASE_CURSOR); #endif }
sfb_cold_init( int unit, user_info_t *up) { sfb_softc_t *sfb; screen_softc_t sc = screen(unit); vm_offset_t base = tc_probe("sfb"); int hor_p, ver_p; boolean_t makes_sense; bcopy(&sfb_sw, &sc->sw, sizeof(sc->sw)); sc->flags |= COLOR_SCREEN; /* * I am confused here by the documentation. One document * sez there are three boards: * "PMAGB-BA" can do 1280x1024 @66Hz or @72Hz * "PMAGB-BC" can do 1024x864 @60Hz or 1280x1024 @72Hz * "PMAGB-BE" can do 1024x768 @72Hz or 1280x1024 @72Hz * Another document sez things differently: * "PMAGB-BB" can do 1024x768 @72Hz * "PMAGB-BD" can do 1024x864 @60Hz or 1280x1024 @72Hz * * I would be inclined to believe the first one, which came * with an actual piece of hardware attached (a PMAGB-BA). * But I could swear I got a first board (which blew up * instantly) and it was calling itself PMAGB-BB... * * Since I have not seen any other hardware I will make * this code as hypothetical as I can. Should work :-)) */ makes_sense = FALSE; { sfb_regs *regs; regs = (sfb_regs *) ((char *)base + SFB_OFFSET_REGS); hor_p = (regs->vhor_setup & 0x1ff) * 4; ver_p = regs->vvert_setup & 0x7ff; if (((hor_p == 1280) && (ver_p == 1024)) || ((hor_p == 1024) && (ver_p == 864)) || ((hor_p == 1024) && (ver_p == 768))) makes_sense = TRUE; } if (makes_sense) { sc->frame_scanline_width = hor_p; sc->frame_height = ver_p; sc->frame_visible_width = hor_p; sc->frame_visible_height = ver_p; } else { sc->frame_scanline_width = 1280; sc->frame_height = 1024; sc->frame_visible_width = 1280; sc->frame_visible_height = 1024; } pm_init_screen_params(sc,up); (void) screen_up(unit, up); sfb = pm_alloc( unit, sparsify(base + SFB_OFFSET_BT459), base + SFB_OFFSET_VRAM, -1); screen_default_colors(up); sfb_soft_reset(sc); /* * Clearing the screen at boot saves from scrolling * much, and speeds up booting quite a bit. */ screen_blitc( unit, 'C'-'@');/* clear screen */ }