static void riva_rectfill(struct rivafb_info *rinfo, int sy, int sx, int height, int width, u_int color) { RIVA_FIFO_FREE(rinfo->riva, Bitmap, 1); rinfo->riva.Bitmap->Color1A = color; RIVA_FIFO_FREE(rinfo->riva, Bitmap, 2); rinfo->riva.Bitmap->UnclippedRectangle[0].TopLeft = (sx << 16) | sy; rinfo->riva.Bitmap->UnclippedRectangle[0].WidthHeight = (width << 16) | height; }
/* set copy ROP, no mask */ static void riva_setup_ROP(struct rivafb_info *rinfo) { RIVA_FIFO_FREE(rinfo->riva, Patt, 5); rinfo->riva.Patt->Shape = 0; rinfo->riva.Patt->Color0 = 0xffffffff; rinfo->riva.Patt->Color1 = 0xffffffff; rinfo->riva.Patt->Monochrome[0] = 0xffffffff; rinfo->riva.Patt->Monochrome[1] = 0xffffffff; RIVA_FIFO_FREE(rinfo->riva, Rop, 1); rinfo->riva.Rop->Rop3 = 0xCC; }
static void fbcon_riva1632_revc(struct display *p, int xx, int yy) { struct rivafb_info *rinfo = (struct rivafb_info *) (p->fb_info); xx *= fontwidth(p); yy *= fontheight(p); RIVA_FIFO_FREE(rinfo->riva, Rop, 1); rinfo->riva.Rop->Rop3 = 0x66; // XOR riva_rectfill(rinfo, yy, xx, fontheight(p), fontwidth(p), 0xffffffff); RIVA_FIFO_FREE(rinfo->riva, Rop, 1); rinfo->riva.Rop->Rop3 = 0xCC; // back to COPY }
void riva_setup_accel(struct rivafb_info *rinfo) { RIVA_FIFO_FREE(rinfo->riva, Clip, 2); rinfo->riva.Clip->TopLeft = 0x0; rinfo->riva.Clip->WidthHeight = 0x80008000; riva_setup_ROP(rinfo); wait_for_idle(rinfo); }
static void fbcon_riva_writechr(struct vc_data *conp, struct display *p, int c, int fgx, int bgx, int yy, int xx) { u8 *cdat; struct rivafb_info *rinfo = (struct rivafb_info *)(p->fb_info); int w, h; volatile u32 *d; u32 cdat2; int i, j, cnt; w = fontwidth(p); h = fontheight(p); if (w <= 8) cdat = p->fontdata + (c & p->charmask) * h; else cdat = p->fontdata + ((c & p->charmask) * h << 1); RIVA_FIFO_FREE(rinfo->riva, Bitmap, 7); rinfo->riva.Bitmap->ClipE.TopLeft = (yy << 16) | (xx & 0xFFFF); rinfo->riva.Bitmap->ClipE.BottomRight = ((yy+h) << 16) | ((xx+w) & 0xffff); rinfo->riva.Bitmap->Color0E = bgx; rinfo->riva.Bitmap->Color1E = fgx; rinfo->riva.Bitmap->WidthHeightInE = (h << 16) | 32; rinfo->riva.Bitmap->WidthHeightOutE = (h << 16) | 32; rinfo->riva.Bitmap->PointE = (yy << 16) | (xx & 0xFFFF); d = &rinfo->riva.Bitmap->MonochromeData01E; for (i = h; i > 0; i-=16) { if (i >= 16) cnt = 16; else cnt = i; RIVA_FIFO_FREE(rinfo->riva, Bitmap, cnt); for (j = 0; j < cnt; j++) { if (w <= 8) cdat2 = *cdat++; else { cdat2 = *(u16*)cdat; cdat += sizeof(u16); } fbcon_reverse_order(&cdat2); d[j] = cdat2; } } }
static int FillHWRect(_THIS, SDL_Surface *dst, SDL_Rect *rect, Uint32 color) { int dstX, dstY; int dstW, dstH; RivaBitmap *Bitmap = (RivaBitmap *)(mapped_io + BITMAP_OFFSET); /* Don't blit to the display surface when switched away */ if ( switched_away ) { return -2; /* no hardware access */ } if ( dst == this->screen ) { SDL_mutexP(hw_lock); } /* Set up the X/Y base coordinates */ dstW = rect->w; dstH = rect->h; FB_dst_to_xy(this, dst, &dstX, &dstY); /* Adjust for the current rectangle */ dstX += rect->x; dstY += rect->y; RIVA_FIFO_FREE(Bitmap, 1); Bitmap->Color1A = color; RIVA_FIFO_FREE(Bitmap, 2); Bitmap->UnclippedRectangle[0].TopLeft = (dstX << 16) | dstY; Bitmap->UnclippedRectangle[0].WidthHeight = (dstW << 16) | dstH; FB_AddBusySurface(dst); if ( dst == this->screen ) { SDL_mutexV(hw_lock); } return(0); }
static int FillHWRect(_THIS, SDL_Surface *dst, SDL_Rect *rect, Uint32 color) { int dstX, dstY; int dstW, dstH; RivaBitmap *Bitmap = (RivaBitmap *)(mapped_io + BITMAP_OFFSET); if ( switched_away ) { return -2; } if ( dst == this->screen ) { SDL_mutexP(hw_lock); } dstW = rect->w; dstH = rect->h; FB_dst_to_xy(this, dst, &dstX, &dstY); dstX += rect->x; dstY += rect->y; RIVA_FIFO_FREE(Bitmap, 1); Bitmap->Color1A = color; RIVA_FIFO_FREE(Bitmap, 2); Bitmap->UnclippedRectangle[0].TopLeft = (dstX << 16) | dstY; Bitmap->UnclippedRectangle[0].WidthHeight = (dstW << 16) | dstH; FB_AddBusySurface(dst); if ( dst == this->screen ) { SDL_mutexV(hw_lock); } return(0); }
static int HWAccelBlit(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect) { SDL_VideoDevice *this = current_video; int srcX, srcY; int dstX, dstY; int dstW, dstH; RivaScreenBlt *Blt = (RivaScreenBlt *)(mapped_io + BLT_OFFSET); /* FIXME: For now, only blit to display surface */ if ( dst->pitch != SDL_VideoSurface->pitch ) { return(src->map->sw_blit(src, srcrect, dst, dstrect)); } /* Don't blit to the display surface when switched away */ if ( switched_away ) { return -2; /* no hardware access */ } if ( dst == this->screen ) { SDL_mutexP(hw_lock); } /* Calculate source and destination base coordinates (in pixels) */ dstW = dstrect->w; dstH = dstrect->h; FB_dst_to_xy(this, src, &srcX, &srcY); FB_dst_to_xy(this, dst, &dstX, &dstY); /* Adjust for the current blit rectangles */ srcX += srcrect->x; srcY += srcrect->y; dstX += dstrect->x; dstY += dstrect->y; RIVA_FIFO_FREE(Blt, 3); Blt->TopLeftSrc = (srcY << 16) | srcX; Blt->TopLeftDst = (dstY << 16) | dstX; Blt->WidthHeight = (dstH << 16) | dstW; FB_AddBusySurface(src); FB_AddBusySurface(dst); if ( dst == this->screen ) { SDL_mutexV(hw_lock); } return(0); }
static int HWAccelBlit(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect) { SDL_VideoDevice *this = current_video; int srcX, srcY; int dstX, dstY; int dstW, dstH; RivaScreenBlt *Blt = (RivaScreenBlt *)(mapped_io + BLT_OFFSET); if ( dst->pitch != SDL_VideoSurface->pitch ) { return(src->map->sw_blit(src, srcrect, dst, dstrect)); } if ( switched_away ) { return -2; } if ( dst == this->screen ) { SDL_mutexP(hw_lock); } dstW = dstrect->w; dstH = dstrect->h; FB_dst_to_xy(this, src, &srcX, &srcY); FB_dst_to_xy(this, dst, &dstX, &dstY); srcX += srcrect->x; srcY += srcrect->y; dstX += dstrect->x; dstY += dstrect->y; RIVA_FIFO_FREE(Blt, 3); Blt->TopLeftSrc = (srcY << 16) | srcX; Blt->TopLeftDst = (dstY << 16) | dstX; Blt->WidthHeight = (dstH << 16) | dstW; FB_AddBusySurface(src); FB_AddBusySurface(dst); if ( dst == this->screen ) { SDL_mutexV(hw_lock); } return(0); }
static void fbcon_riva_bmove(struct display *p, int sy, int sx, int dy, int dx, int height, int width) { struct rivafb_info *rinfo = (struct rivafb_info *)(p->fb_info); sx *= fontwidth(p); sy *= fontheight(p); dx *= fontwidth(p); dy *= fontheight(p); width *= fontwidth(p); height *= fontheight(p); RIVA_FIFO_FREE(rinfo->riva, Blt, 3); rinfo->riva.Blt->TopLeftSrc = (sy << 16) | sx; rinfo->riva.Blt->TopLeftDst = (dy << 16) | dx; rinfo->riva.Blt->WidthHeight = (height << 16) | width; wait_for_idle(rinfo); }