RegionPtr cfb8_32CopyArea( DrawablePtr pSrcDraw, DrawablePtr pDstDraw, GC *pGC, int srcx, int srcy, int width, int height, int dstx, int dsty ){ if(pSrcDraw->bitsPerPixel == 32) { if(pDstDraw->bitsPerPixel == 32) { if((pGC->alu == GXcopy) && (pGC->planemask == 0xff000000)) { return cfb32BitBlt (pSrcDraw, pDstDraw, pGC, srcx, srcy, width, height, dstx, dsty, cfbDoBitblt8To8GXcopy, 0L); } return(cfb32CopyArea(pSrcDraw, pDstDraw, pGC, srcx, srcy, width, height, dstx, dsty)); } else { /* have to translate 32 -> 8 copies */ return cfb32BitBlt (pSrcDraw, pDstDraw, pGC, srcx, srcy, width, height, dstx, dsty, cfbDoBitblt32To8, 0L); } } else { if(pDstDraw->bitsPerPixel == 32) { /* have to translate 8 -> 32 copies */ return cfb32BitBlt (pSrcDraw, pDstDraw, pGC, srcx, srcy, width, height, dstx, dsty, cfbDoBitblt8To32, 0L); } else { return(cfbCopyArea(pSrcDraw, pDstDraw, pGC, srcx, srcy, width, height, dstx, dsty)); } } }
RegionPtr CreatorCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, int srcx, int srcy, int width, int height, int dstx, int dsty) { FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDstDrawable->pScreen); ffb_fbcPtr ffb = pFfb->regs; RegionPtr ret; unsigned char *dptr, *sptr, *sfb; int garbage, all_planes; cfbGetByteWidthAndPointer (pDstDrawable, garbage, dptr); cfbGetByteWidthAndPointer (pSrcDrawable, garbage, sptr); if (pSrcDrawable->bitsPerPixel == 8) { sfb = (unsigned char *) pFfb->sfb8r; all_planes = 0xff; } else { sfb = (unsigned char *) pFfb->sfb32; all_planes = 0xffffff; } FFBLOG(("CreatorCopyArea: SFB(%p) s(%p) d(%p) alu(%x) pmsk(%08x) " "src(%08x:%08x) dst(%08x:%08x)\n", sfb, sptr, dptr, pGC->alu, pGC->planemask, srcx, srcy, dstx, dsty)); if (((pGC->planemask & all_planes) != all_planes || pGC->alu != GXcopy) && dptr != sfb) { if(sptr == sfb) { WindowPtr pWin = (WindowPtr) pSrcDrawable; FFB_ATTR_SFB_VAR_WIN(pFfb, pGC->planemask, pGC->alu, pWin); FFBWait(pFfb, ffb); } if (pSrcDrawable->bitsPerPixel == 8) return cfbCopyArea (pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty); else return cfb32CopyArea (pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty); } /* Try to use hw VSCROLL if possible */ if (!pFfb->disable_vscroll && /* must not be ffb1 in hires */ pGC->alu == GXcopy && /* it must be a copy */ dstx == srcx && /* X must be unchanging */ dsty != srcy && /* Y must be changing */ sptr == dptr && /* src and dst must be the framebuffer */ dptr == sfb) { WindowPtr pWin = (WindowPtr) pSrcDrawable; CreatorPrivWinPtr pFfbPrivWin = CreatorGetWindowPrivate(pWin); unsigned int fbc = pFfbPrivWin->fbc_base; int same_buffer; /* One last check, the read buffer and the write buffer * must be the same. VSCROLL only allows to move pixels * within the same buffer. */ if (!pFfb->has_double_buffer) { same_buffer = 1; } else { same_buffer = 0; if ((((fbc & FFB_FBC_WB_MASK) == FFB_FBC_WB_A) && ((fbc & FFB_FBC_RB_MASK) == FFB_FBC_RB_A)) || (((fbc & FFB_FBC_WB_MASK) == FFB_FBC_WB_B) && ((fbc & FFB_FBC_RB_MASK) == FFB_FBC_RB_B))) same_buffer = 1; } if (same_buffer != 0) { FFB_ATTR_VSCROLL_WIN(pFfb, pGC->planemask, pWin); if (pSrcDrawable->bitsPerPixel == 8) ret = cfbBitBlt (pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, (void (*)())CreatorDoVertBitblt, 0); else ret = cfb32BitBlt (pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, (void (*)())CreatorDoVertBitblt, 0); FFBLOG(("CreatorCopyArea: Done, returning %p\n", ret)); return ret; } } /* OK, we have to use GCOPY. */ /* Even when we are only reading from the framebuffer, we must * set the SFB_VAR attributes to handle double-buffering correctly. */ if(dptr == sfb || sptr == sfb) { WindowPtr pWin; if (dptr == sfb) pWin = (WindowPtr) pDstDrawable; else pWin = (WindowPtr) pSrcDrawable; FFB_ATTR_SFB_VAR_WIN(pFfb, pGC->planemask, pGC->alu, pWin); FFBWait(pFfb, ffb); } if (pSrcDrawable->bitsPerPixel == 8) ret = cfbBitBlt (pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, (void (*)())CreatorDoBitblt, 0); else ret = cfb32BitBlt (pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, (void (*)())CreatorDoBitblt, 0); FFBLOG(("CreatorCopyArea: Done, returning %p\n", ret)); return ret; }