From 78d80c93260b9a67c65b12cb5cf4c4e624efc144 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Thu, 26 Jan 2006 03:26:06 +0000 Subject: Remove remaining cfb-isms and dead accel code. --- src/Makefile.am | 26 -- src/ffb_accel.c | 2 - src/ffb_bcopy.c | 563 --------------------------------- src/ffb_checks.c | 292 ------------------ src/ffb_circle.c | 213 ------------- src/ffb_clip.c | 107 ------- src/ffb_clip.h | 49 --- src/ffb_cplane.c | 405 ------------------------ src/ffb_dbe.c | 906 ------------------------------------------------------ src/ffb_dga.c | 1 - src/ffb_dri.c | 5 - src/ffb_frect.c | 713 ------------------------------------------ src/ffb_fspans.c | 125 -------- src/ffb_gc.c | 758 --------------------------------------------- src/ffb_gc.h | 151 --------- src/ffb_glyph.c | 384 ----------------------- src/ffb_gspans.c | 134 -------- src/ffb_line.c | 199 ------------ src/ffb_plygon.c | 171 ----------- src/ffb_point.c | 112 ------- src/ffb_rect.c | 211 ------------- src/ffb_seg.c | 200 ------------ src/ffb_sspans.c | 170 ---------- src/ffb_stip.c | 68 ---- src/ffb_stip.h | 36 --- src/ffb_stubs.c | 548 --------------------------------- src/ffb_wline.c | 900 ----------------------------------------------------- src/ffb_zeroarc.c | 540 -------------------------------- 28 files changed, 7989 deletions(-) delete mode 100644 src/ffb_bcopy.c delete mode 100644 src/ffb_checks.c delete mode 100644 src/ffb_circle.c delete mode 100644 src/ffb_clip.c delete mode 100644 src/ffb_clip.h delete mode 100644 src/ffb_cplane.c delete mode 100644 src/ffb_dbe.c delete mode 100644 src/ffb_frect.c delete mode 100644 src/ffb_fspans.c delete mode 100644 src/ffb_gc.c delete mode 100644 src/ffb_gc.h delete mode 100644 src/ffb_glyph.c delete mode 100644 src/ffb_gspans.c delete mode 100644 src/ffb_line.c delete mode 100644 src/ffb_plygon.c delete mode 100644 src/ffb_point.c delete mode 100644 src/ffb_rect.c delete mode 100644 src/ffb_seg.c delete mode 100644 src/ffb_sspans.c delete mode 100644 src/ffb_stip.c delete mode 100644 src/ffb_stip.h delete mode 100644 src/ffb_stubs.c delete mode 100644 src/ffb_wline.c delete mode 100644 src/ffb_zeroarc.c (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index 7a908f3..f1832bc 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -35,38 +35,18 @@ endif sunffb_drv_la_SOURCES = \ ffb_accel.c \ ffb_attr.c \ - ffb_bcopy.c \ - ffb_checks.c \ - ffb_circle.c \ - ffb_cplane.c \ ffb_cursor.c \ ffb_dac.c \ ffb_dac.h \ - ffb_dbe.c \ ffb_ddc.c \ ffb_dga.c \ ffb_driver.c \ ffb_fifo.h \ - ffb_frect.c \ - ffb_fspans.c \ - ffb_gc.c \ - ffb_gc.h \ - ffb_glyph.c \ - ffb_gspans.c \ ffb.h \ - ffb_line.c \ ffb_loops.h \ - ffb_plygon.c \ - ffb_point.c \ ffb_rcache.h \ ffb_regs.h \ - ffb_seg.c \ - ffb_sspans.c \ - ffb_stip.c \ - ffb_stip.h \ - ffb_stubs.c \ ffb_wid.c \ - ffb_zeroarc.c \ $(SPARC_ASM_SRC) if DRI @@ -74,9 +54,3 @@ sunffb_drv_la_SOURCES += \ ffb_dri.c \ ffb_drishare.h endif - -EXTRA_DIST = \ - ffb_clip.c \ - ffb_clip.h \ - ffb_wline.c \ - ffb_rect.c diff --git a/src/ffb_accel.c b/src/ffb_accel.c index 73e96f3..b9cb053 100644 --- a/src/ffb_accel.c +++ b/src/ffb_accel.c @@ -43,8 +43,6 @@ #include "ffb_rcache.h" #include "ffb_loops.h" #include "ffb_regs.h" -#include "ffb_stip.h" -#include "ffb_gc.h" int CreatorScreenPrivateIndex; int CreatorGCPrivateIndex; diff --git a/src/ffb_bcopy.c b/src/ffb_bcopy.c deleted file mode 100644 index e077965..0000000 --- a/src/ffb_bcopy.c +++ /dev/null @@ -1,563 +0,0 @@ -/* - * Acceleration for the Creator and Creator3D framebuffer - Bit-blit copies. - * - * Copyright (C) 1998,1999 Jakub Jelinek (jakub@redhat.com) - * Copyright (C) 1999 David S. Miller (davem@redhat.com) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * JAKUB JELINEK OR DAVID MILLER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_bcopy.c,v 1.1 2000/05/18 23:21:35 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "ffb.h" -#include "ffb_regs.h" -#include "ffb_rcache.h" -#include "ffb_fifo.h" -#include "ffb_loops.h" - -#include "pixmapstr.h" -#include "scrnintstr.h" - -#define PSZ 8 -#include "cfb.h" -#undef PSZ -#include "cfb32.h" - -#ifdef FFB_BLOCKCOPY_IMPLEMENTED -/* Due to VIS based copyarea and ffb rop vertscroll being significantly faster - * than the blockcopy rop, blockcopy was not implemented at all in the final - * FFB hardware design. This code is left here for hack value. -DaveM - */ -#error To use it, we would need to fix this to use WIDs in FFB attributes -DaveM -void -CreatorDoHWBitblt(DrawablePtr pSrc, DrawablePtr pDst, int alu, RegionPtr prgnDst, - DDXPointPtr pptSrc, unsigned long planemask) -{ - FFBPtr pFfb = GET_FFB_FROM_SCREEN (pSrc->pScreen); - ffb_fbcPtr ffb = pFfb->regs; - BoxPtr pboxTmp; - DDXPointPtr pptTmp; - int nbox; - BoxPtr pboxNext, pboxBase, pbox; - - nbox = REGION_NUM_RECTS(prgnDst); - pbox = REGION_RECTS(prgnDst); - - FFB_WRITE_ATTRIBUTES(pFfb, - FFB_PPC_ACE_DISABLE|FFB_PPC_APE_DISABLE|FFB_PPC_CS_CONST, - FFB_PPC_ACE_MASK|FFB_PPC_APE_MASK|FFB_PPC_CS_MASK, - planemask, - FFB_ROP_NEW, - FFB_DRAWOP_BCOPY, pFfb->fg_cache, - FFB_FBC_DEFAULT); - - /* need to blit rectangles in different orders, depending on the direction of copy - so that an area isnt overwritten before it is blitted */ - if (pptSrc->y < pbox->y1 && nbox > 1) { - if (pptSrc->x < pbox->x1) { - pboxTmp = pbox + nbox; - pptTmp = pptSrc + nbox; - while(nbox--) { - pboxTmp--; - pptTmp--; - FFBFifo(pFfb, 6); - FFB_WRITE64(&ffb->by, pptTmp->y, pptTmp->x); - FFB_WRITE64_2(&ffb->dy, pboxTmp->y1, pboxTmp->x1); - FFB_WRITE64_3(&ffb->bh, - (pboxTmp->y2 - pboxTmp->y1), - (pboxTmp->x2 - pboxTmp->x1)); - } - } else { - /* keep ordering in each band, reverse order of bands */ - pboxBase = pboxNext = pbox+nbox-1; - - while (pboxBase >= pbox) { /* for each band */ - /* find first box in band */ - while (pboxNext >= pbox && pboxBase->y1 == pboxNext->y1) - pboxNext--; - - pboxTmp = pboxNext + 1; /* first box in band */ - pptTmp = pptSrc + (pboxTmp - pbox); /* first point in band */ - - while (pboxTmp <= pboxBase) { /* for each box in band */ - FFBFifo(pFfb, 6); - FFB_WRITE64(&ffb->by, pptTmp->y, pptTmp->x); - FFB_WRITE64_2(&ffb->dy, pboxTmp->y1, pboxTmp->x1); - FFB_WRITE64_3(&ffb->bh, - (pboxTmp->y2 - pboxTmp->y1), - (pboxTmp->x2 - pboxTmp->x1)); - ++pboxTmp; - ++pptTmp; - } - pboxBase = pboxNext; - } - } - } else { - if((pptSrc->x < pbox->x1) && (nbox > 1)) { - pboxBase = pboxNext = pbox; - while(pboxBase < pbox+nbox) { - while((pboxNexty1 == pboxBase->y1)) - pboxNext++; - pboxTmp = pboxNext; - pptTmp = pptSrc + (pboxTmp - pbox); - while(pboxTmp != pboxBase) { - --pboxTmp; - --pptTmp; - FFBFifo(pFfb, 6); - FFB_WRITE64(&ffb->by, pptTmp->y, pptTmp->x); - FFB_WRITE64_2(&ffb->dy, pboxTmp->y1, pboxTmp->x1); - FFB_WRITE64_3(&ffb->bh, - (pboxTmp->y2 - pboxTmp->y1), - (pboxTmp->x2 - pboxTmp->x1)); - } - pboxBase = pboxNext; - } - } else { - /* dont need to change order of anything */ - pptTmp = pptSrc; - pboxTmp = pbox; - - while (nbox--) { - FFBFifo(pFfb, 6); - FFB_WRITE64(&ffb->by, pptTmp->y, pptTmp->x); - FFB_WRITE64_2(&ffb->dy, pboxTmp->y1, pboxTmp->x1); - FFB_WRITE64_3(&ffb->bh, - (pboxTmp->y2 - pboxTmp->y1), - (pboxTmp->x2 - pboxTmp->x1)); - pboxTmp++; - pptTmp++; - } - } - } - pFfb->rp_active = 1; - FFBSync(pFfb, ffb); -} -#endif /* FFB_BLOCKCOPY_IMPLEMENTED */ - -/* We know here that only y is changing and that the hw attributes - * have been set higher up in the call chain. - */ -void -CreatorDoVertBitblt(DrawablePtr pSrc, DrawablePtr pDst, int alu, RegionPtr prgnDst, - DDXPointPtr pptSrc, unsigned long planemask) -{ - FFBPtr pFfb = GET_FFB_FROM_SCREEN (pSrc->pScreen); - ffb_fbcPtr ffb = pFfb->regs; - BoxPtr pbox; - int nbox; - - pbox = REGION_RECTS(prgnDst); - nbox = REGION_NUM_RECTS(prgnDst); - - /* No garbage please. */ - if(nbox <= 0) - return; - - FFBLOG(("VSCROLL(%d): ", nbox)); - - /* Need to blit rectangles in different orders, depending - * on the direction of copy so that an area isnt overwritten - * before it is blitted. - */ - if (nbox > 1 && pptSrc->y < pbox->y1) { - BoxPtr pboxBase = pbox + nbox - 1; - BoxPtr pboxNext = pboxBase; - - /* Keep ordering in each band, reverse order of bands. */ - while (pboxBase >= pbox) { /* for each band */ - BoxPtr pboxTmp; - DDXPointPtr pptTmp; - - /* find first box in band */ - while (pboxNext >= pbox && pboxBase->y1 == pboxNext->y1) - pboxNext--; - - pboxTmp = pboxNext + 1; /* first box in band */ - pptTmp = pptSrc + (pboxTmp - pbox); /* first point in band */ - while (pboxTmp <= pboxBase) { - FFBLOG(("1[%08x:%08x:%08x:%08x:%08x:%08x] ", - pptTmp->x, pptTmp->y, pboxTmp->x1, pboxTmp->y1, - pboxTmp->x2, pboxTmp->y2)); - FFBFifo(pFfb, 7); - ffb->drawop = FFB_DRAWOP_VSCROLL; - FFB_WRITE64(&ffb->by, pptTmp->y, pptTmp->x); - FFB_WRITE64_2(&ffb->dy, pboxTmp->y1, pboxTmp->x1); - FFB_WRITE64_3(&ffb->bh, (pboxTmp->y2 - pboxTmp->y1), - (pboxTmp->x2 - pboxTmp->x1)); - pboxTmp++; - pptTmp++; - } - pboxBase = pboxNext; - } - } else { - /* Dont need to change order of anything. */ - while (nbox--) { - FFBLOG(("2[%08x:%08x:%08x:%08x:%08x:%08x] ", - pptSrc->x, pptSrc->y, pbox->x1, pbox->y1, - pbox->x2, pbox->y2)); - FFBFifo(pFfb, 7); - ffb->drawop = FFB_DRAWOP_VSCROLL; - FFB_WRITE64(&ffb->by, pptSrc->y, pptSrc->x); - FFB_WRITE64_2(&ffb->dy, pbox->y1, pbox->x1); - FFB_WRITE64_3(&ffb->bh, (pbox->y2 - pbox->y1), - (pbox->x2 - pbox->x1)); - pbox++; - pptSrc++; - } - } - pFfb->rp_active = 1; - FFBLOG(("done\n")); - FFBSync(pFfb, ffb); -} - -extern void VISmoveImageLR(unsigned char *, unsigned char *, long, long, long, long); -extern void VISmoveImageRL(unsigned char *, unsigned char *, long, long, long, long); - -/* The hw attributes have been set by someone higher up in the call - * chain. - */ -void -CreatorDoBitblt(DrawablePtr pSrc, DrawablePtr pDst, int alu, RegionPtr prgnDst, - DDXPointPtr pptSrc, unsigned long planemask) -{ - FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDst->pScreen); - BoxPtr pboxTmp, pboxNext, pboxBase, pbox; - DDXPointPtr pptTmp; - unsigned char *psrcBase, *pdstBase; - int nbox, widthSrc, widthDst, careful, use_prefetch; - int psz_shift; - - cfbGetByteWidthAndPointer (pSrc, widthSrc, psrcBase) - cfbGetByteWidthAndPointer (pDst, widthDst, pdstBase) - - careful = ((pSrc == pDst) || - ((pSrc->type == DRAWABLE_WINDOW) && - (pDst->type == DRAWABLE_WINDOW))); - use_prefetch = (pFfb->use_blkread_prefetch && - (psrcBase == (unsigned char *)pFfb->sfb32 || - psrcBase == (unsigned char *)pFfb->sfb8r)); - - pbox = REGION_RECTS(prgnDst); - nbox = REGION_NUM_RECTS(prgnDst); - - pptTmp = pptSrc; - pboxTmp = pbox; - - FFBLOG(("GCOPY(%d): ", nbox)); - - if (pSrc->bitsPerPixel == 8) - psz_shift = 0; - else - psz_shift = 2; - - if (careful && pptSrc->y < pbox->y1) { - if (pptSrc->x < pbox->x1) { - /* reverse order of bands and rects in each band */ - pboxTmp=pbox+nbox; - pptTmp=pptSrc+nbox; - - while (nbox--){ - pboxTmp--; - pptTmp--; - FFBLOG(("[%08x:%08x:%08x:%08x:%08x:%08x] ", - pptTmp->x, pptTmp->y, pboxTmp->x1, pboxTmp->y1, - pboxTmp->x2, pboxTmp->y2)); - if (pptTmp->x < pbox->x2) { - if (use_prefetch) { - FFBFifo(pFfb, 1); - pFfb->regs->mer = FFB_MER_EDRA; - pFfb->rp_active = 1; - FFBWait(pFfb, pFfb->regs); - } - VISmoveImageRL ((psrcBase + - ((pptTmp->y + pboxTmp->y2 - pboxTmp->y1 - 1) * - widthSrc) + - (pptTmp->x << psz_shift)), - (pdstBase + - ((pboxTmp->y2 - 1) * widthDst) + - (pboxTmp->x1 << psz_shift)), - (pboxTmp->x2 - pboxTmp->x1) << psz_shift, - (pboxTmp->y2 - pboxTmp->y1), - -widthSrc, -widthDst); - } else { - if (use_prefetch) { - FFBFifo(pFfb, 1); - pFfb->regs->mer = FFB_MER_EIRA; - pFfb->rp_active = 1; - FFBWait(pFfb, pFfb->regs); - } - VISmoveImageLR ((psrcBase + - ((pptTmp->y + pboxTmp->y2 - pboxTmp->y1 - 1) * - widthSrc) + - (pptTmp->x << psz_shift)), - (pdstBase + - ((pboxTmp->y2 - 1) * widthDst) + - (pboxTmp->x1 << psz_shift)), - (pboxTmp->x2 - pboxTmp->x1) << psz_shift, - (pboxTmp->y2 - pboxTmp->y1), - -widthSrc, -widthDst); - } - } - } else { - /* keep ordering in each band, reverse order of bands */ - pboxBase = pboxNext = pbox+nbox-1; - - while (pboxBase >= pbox) { /* for each band */ - - /* find first box in band */ - while (pboxNext >= pbox && - pboxBase->y1 == pboxNext->y1) - pboxNext--; - - pboxTmp = pboxNext+1; /* first box in band */ - pptTmp = pptSrc + (pboxTmp - pbox); /* first point in band */ - - FFBLOG(("[%08x:%08x:%08x:%08x:%08x:%08x] ", - pptTmp->x, pptTmp->y, pboxTmp->x1, pboxTmp->y1, - pboxTmp->x2, pboxTmp->y2)); - while (pboxTmp <= pboxBase) { /* for each box in band */ - if (use_prefetch) { - FFBFifo(pFfb, 1); - pFfb->regs->mer = FFB_MER_EIRA; - pFfb->rp_active = 1; - FFBWait(pFfb, pFfb->regs); - } - VISmoveImageLR ((psrcBase + - ((pptTmp->y + pboxTmp->y2 - pboxTmp->y1 - 1) * - widthSrc) + - (pptTmp->x << psz_shift)), - (pdstBase + - ((pboxTmp->y2 - 1) * widthDst) + - (pboxTmp->x1 << psz_shift)), - (pboxTmp->x2 - pboxTmp->x1) << psz_shift, - (pboxTmp->y2 - pboxTmp->y1), - -widthSrc, -widthDst); - ++pboxTmp; - ++pptTmp; - } - pboxBase = pboxNext; - - } - } - } else { - if (careful && pptSrc->x < pbox->x1) { - /* reverse order of rects in each band */ - - pboxBase = pboxNext = pbox; - - while (pboxBase < pbox+nbox) { /* for each band */ - - /* find last box in band */ - while (pboxNext < pbox+nbox && - pboxNext->y1 == pboxBase->y1) - pboxNext++; - - pboxTmp = pboxNext; /* last box in band */ - pptTmp = pptSrc + (pboxTmp - pbox); /* last point in band */ - - while (pboxTmp != pboxBase) { /* for each box in band */ - --pboxTmp; - --pptTmp; - FFBLOG(("[%08x:%08x:%08x:%08x:%08x:%08x] ", - pptTmp->x, pptTmp->y, pboxTmp->x1, pboxTmp->y1, - pboxTmp->x2, pboxTmp->y2)); - if (pptTmp->x < pbox->x2) { - if (use_prefetch) { - FFBFifo(pFfb, 1); - pFfb->regs->mer = FFB_MER_EDRA; - pFfb->rp_active = 1; - } - VISmoveImageRL ((psrcBase + - (pptTmp->y * widthSrc) + - (pptTmp->x << psz_shift)), - (pdstBase + - (pboxTmp->y1 * widthDst) + - (pboxTmp->x1 << psz_shift)), - (pboxTmp->x2 - pboxTmp->x1) << psz_shift, - (pboxTmp->y2 - pboxTmp->y1), - widthSrc, widthDst); - } else { - if (use_prefetch) { - FFBFifo(pFfb, 1); - pFfb->regs->mer = FFB_MER_EIRA; - pFfb->rp_active = 1; - FFBWait(pFfb, pFfb->regs); - } - VISmoveImageLR ((psrcBase + - (pptTmp->y * widthSrc) + - (pptTmp->x << psz_shift)), - (pdstBase + - (pboxTmp->y1 * widthDst) + - (pboxTmp->x1 << psz_shift)), - (pboxTmp->x2 - pboxTmp->x1) << psz_shift, - (pboxTmp->y2 - pboxTmp->y1), - widthSrc, widthDst); - } - } - pboxBase = pboxNext; - } - } else { - while (nbox--) { - FFBLOG(("[%08x:%08x:%08x:%08x:%08x:%08x] ", - pptTmp->x, pptTmp->y, pboxTmp->x1, pboxTmp->y1, - pboxTmp->x2, pboxTmp->y2)); - if (use_prefetch) { - FFBFifo(pFfb, 1); - pFfb->regs->mer = FFB_MER_EIRA; - pFfb->rp_active = 1; - FFBWait(pFfb, pFfb->regs); - } - VISmoveImageLR ((psrcBase + - (pptTmp->y * widthSrc) + - (pptTmp->x << psz_shift)), - (pdstBase + - (pboxTmp->y1 * widthDst) + - (pboxTmp->x1 << psz_shift)), - (pboxTmp->x2 - pboxTmp->x1) << psz_shift, - (pboxTmp->y2 - pboxTmp->y1), - widthSrc, widthDst); - pboxTmp++; - pptTmp++; - } - } - } - if (use_prefetch) { - FFBFifo(pFfb, 1); - pFfb->regs->mer = FFB_MER_DRA; - pFfb->rp_active = 1; - FFBWait(pFfb, pFfb->regs); - } - FFBLOG(("done\n")); -} - -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; -} diff --git a/src/ffb_checks.c b/src/ffb_checks.c deleted file mode 100644 index a1527a1..0000000 --- a/src/ffb_checks.c +++ /dev/null @@ -1,292 +0,0 @@ -/* - * Acceleration for the Creator and Creator3D framebuffer - stipple/tile/line-pattern - * verification. - * - * Copyright (C) 1998,1999 Jakub Jelinek (jakub@redhat.com) - * Copyright (C) 1999 David S. Miller (davem@redhat.com) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * JAKUB JELINEK OR DAVID MILLER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_checks.c,v 1.1 2000/05/18 23:21:35 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "ffb.h" -#include "ffb_regs.h" -#include "ffb_rcache.h" -#include "ffb_fifo.h" - -#include "pixmapstr.h" -#include "scrnintstr.h" - -#define PSZ 8 -#include "cfb.h" -#undef PSZ -#include "cfb32.h" - -int -CreatorCheckTile (PixmapPtr pPixmap, CreatorStipplePtr stipple, int ox, int oy, int ph) -{ - unsigned int *sbits; - unsigned int fg = 0, bg = 0; - int fgset = 0, bgset = 0; - unsigned int *tilebitsLine, *tilebits, tilebit; - unsigned int sbit, mask; - int nbwidth; - int h, w; - int x, y; - int s_y, s_x; - - h = pPixmap->drawable.height; - if (h > 32 || (h & (h - 1))) - return FALSE; - - w = pPixmap->drawable.width; - if (w > 32 || (w & (w - 1))) - return FALSE; - - stipple->patalign = (oy << 16) | ox; - sbits = stipple->bits; - tilebitsLine = (unsigned int *) pPixmap->devPrivate.ptr; - nbwidth = pPixmap->devKind / sizeof(unsigned int); - - for (y = 0; y < h; y++) { - tilebits = tilebitsLine; - tilebitsLine += nbwidth; - sbit = 0; - mask = 1 << 31; - for (x = 0; x < w; x++) { - tilebit = *tilebits++; - if (fgset && tilebit == fg) - sbit |= mask; - else if (!bgset || tilebit != bg) { - if (!fgset) { - fgset = 1; - fg = tilebit; - sbit |= mask; - } else if (!bgset) { - bgset = 1; - bg = tilebit; - } else { - return FALSE; - } - } - mask >>= 1; - } - for (s_x = w; s_x < 32; s_x <<= 1) - sbit = sbit | (sbit >> s_x); - sbit = (sbit >> ox) | (sbit << (32 - ox)); - for (s_y = y; s_y < 32; s_y += h) - sbits[(s_y + oy) & 31] = sbit; - } - stipple->pagable = 1; - for(y = 0; y < (32 - ph); y++) { - if(sbits[y] != sbits[(y+ph) & (32 - 1)]) { - stipple->pagable = 0; - break; - } - } - stipple->fg = fg; - stipple->bg = bg; - stipple->inhw = 0; - return TRUE; -} - -int -CreatorCheckStipple (PixmapPtr pPixmap, CreatorStipplePtr stipple, int ox, int oy, int ph) -{ - unsigned int *sbits; - unsigned int *stippleBits; - unsigned int sbit, mask, nbwidth; - int h, w; - int y; - int s_y, s_x; - - h = pPixmap->drawable.height; - if (h > 32 || (h & (h - 1))) - return FALSE; - - w = pPixmap->drawable.width; - if (w > 32 || (w & (w - 1))) - return FALSE; - - stipple->patalign = (oy << 16) | ox; - sbits = stipple->bits; - stippleBits = (unsigned int *) pPixmap->devPrivate.ptr; - nbwidth = pPixmap->devKind / sizeof(unsigned int); - mask = ~0 << (32 - w); - for (y = 0; y < h; y++) { - sbit = (*stippleBits) & mask; - stippleBits += nbwidth; - for (s_x = w; s_x < 32; s_x <<= 1) - sbit = sbit | (sbit >> s_x); - sbit = (sbit >> ox) | (sbit << (32 - ox)); - for (s_y = y; s_y < 32; s_y += h) - sbits[(s_y + oy) & 31] = sbit; - } - stipple->pagable = 1; - for(y = 0; y < (32 - ph); y++) { - if(sbits[y] != sbits[(y+ph) & (32 - 1)]) { - stipple->pagable = 0; - break; - } - } - stipple->inhw = 0; - return TRUE; -} - -int -CreatorCheckLinePattern(GCPtr pGC, CreatorPrivGCPtr gcPriv) -{ - unsigned int linepat = 0; - unsigned char *dashp = (unsigned char *)pGC->dash; - int ndash = pGC->numInDashList; - int doff = (int) pGC->dashOffset; - int smallest_dashlen; - int i, nbits = 0; - - for(i = 0; i < ndash; i++) - nbits += dashp[i]; - if(nbits <= 16) { - /* We can do it simply, so don't try to use all of - * the hair below. - */ - nbits = 0; - for(i = 0; i < ndash; i++) { - int this_bits = dashp[i]; - if((i & 1) == 0) { - int x; - - for(x = 0; x < this_bits; x++) - linepat |= (1<<(nbits + x)); - } - nbits += this_bits; - } - smallest_dashlen = 1; - } else { - /* Iteratively find a usable line pattern bitmap and - * assosciated scale. This is slow, but it works. - * Feel free to come up with something more efficient. -DaveM - */ - smallest_dashlen = 0; - while(smallest_dashlen++ < 16) { - int bits_so_far = 0; - - for(i = 0; i < ndash; i++) { - if((dashp[i] % smallest_dashlen) != 0) - break; - bits_so_far += dashp[i] / smallest_dashlen; - if(bits_so_far >= 16) - return FALSE; - } - if(i == ndash) - break; - } - if(smallest_dashlen == 16) - return FALSE; - - /* Compute the final scaled line pattern. */ - nbits = 0; - for(i = 0; i < ndash; i++) { - int this_bits = dashp[i] / smallest_dashlen; - - nbits += this_bits; - if((i & 1) != 0) - continue; - while(this_bits--) - linepat |= (1<<(nbits - this_bits - 1)); - } - } - - /* We're golden... */ - linepat = ((linepat << FFB_LPAT_PATTERN_SHIFT) | - (smallest_dashlen << FFB_LPAT_SCALEVAL_SHIFT) | - ((nbits & 0xf) << FFB_LPAT_PATLEN_SHIFT) | - (((doff / smallest_dashlen) & 0xf) << FFB_LPAT_PATPTR_SHIFT) | - (((doff % smallest_dashlen) & 0xf) << FFB_LPAT_SCALEPTR_SHIFT)); - gcPriv->linepat = linepat; - return TRUE; -} - -/* cache one stipple; figuring out if we can use the stipple is as hard as - * computing it, so we just use this one and leave it here if it - * can't be used this time - */ - -CreatorStipplePtr FFB_tmpStipple; - -int -CreatorCheckFill (GCPtr pGC, DrawablePtr pDrawable) -{ - CreatorPrivGCPtr gcPriv = CreatorGetGCPrivate (pGC); - FFBPtr pFfb = GET_FFB_FROM_SCREEN(pDrawable->pScreen); - CreatorStipplePtr stipple; - unsigned int alu; - int xrot, yrot, ph = FFB_FFPARMS(pFfb).pagefill_height; - - if (pGC->fillStyle == FillSolid) { - if (gcPriv->stipple) { - xfree (gcPriv->stipple); - gcPriv->stipple = 0; - } - return TRUE; - } - if (!(stipple = gcPriv->stipple)) { - if (!FFB_tmpStipple) { - FFB_tmpStipple = (CreatorStipplePtr) xalloc (sizeof *FFB_tmpStipple); - if (!FFB_tmpStipple) - return FALSE; - } - stipple = FFB_tmpStipple; - } - xrot = (pGC->patOrg.x + pDrawable->x) & 31; - yrot = (pGC->patOrg.y + pDrawable->y) & 31; - alu = pGC->alu; - switch (pGC->fillStyle) { - case FillTiled: - if (!CreatorCheckTile (pGC->tile.pixmap, stipple, xrot, yrot, ph)) { - if (gcPriv->stipple) { - xfree (gcPriv->stipple); - gcPriv->stipple = 0; - } - return FALSE; - } - break; - case FillStippled: - alu |= FFB_ROP_EDIT_BIT; - case FillOpaqueStippled: - if (!CreatorCheckStipple (pGC->stipple, stipple, xrot, yrot, ph)) { - if (gcPriv->stipple) { - xfree (gcPriv->stipple); - gcPriv->stipple = 0; - } - return FALSE; - } - stipple->fg = pGC->fgPixel; - stipple->bg = pGC->bgPixel; - break; - } - stipple->alu = alu; - gcPriv->stipple = stipple; - if (stipple == FFB_tmpStipple) - FFB_tmpStipple = 0; - return TRUE; -} diff --git a/src/ffb_circle.c b/src/ffb_circle.c deleted file mode 100644 index ee71ad5..0000000 --- a/src/ffb_circle.c +++ /dev/null @@ -1,213 +0,0 @@ -/* - * Acceleration for the Creator and Creator3D framebuffer - Circle rops. - * - * Copyright (C) 1999 David S. Miller (davem@redhat.com) - * Copyright (C) 1999 Jakub Jelinek (jakub@redhat.com) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * JAKUB JELINEK OR DAVID MILLER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_circle.c,v 1.1 2000/05/18 23:21:36 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "ffb.h" -#include "ffb_regs.h" -#include "ffb_rcache.h" -#include "ffb_fifo.h" -#include "ffb_stip.h" - -#include "pixmapstr.h" -#include "scrnintstr.h" - -#define PSZ 8 -#include "cfb.h" -#undef PSZ -#include "cfb32.h" - -#include "mi.h" -#include "mifillarc.h" - -/* Wheee, circles... */ -static void -CreatorFillEllipseSolid(DrawablePtr pDrawable, GCPtr pGC, xArc *arc) -{ - WindowPtr pWin = (WindowPtr) pDrawable; - FFBPtr pFfb = GET_FFB_FROM_SCREEN(pDrawable->pScreen); - CreatorPrivGCPtr gcPriv = CreatorGetGCPrivate (pGC); - ffb_fbcPtr ffb = pFfb->regs; - miFillArcRec info; - int x, y, e, yk, xk, ym, xm, dx, dy, xorg, yorg, slw; - - /* Get the RP ready. */ - if(gcPriv->stipple == NULL) { - FFB_ATTR_GC(pFfb, pGC, pWin, - FFB_PPC_APE_DISABLE | FFB_PPC_CS_CONST, - FFB_DRAWOP_RECTANGLE); - } else { - unsigned int fbc; - - FFBSetStipple(pFfb, ffb, gcPriv->stipple, - FFB_PPC_CS_CONST, FFB_PPC_CS_MASK); - FFB_WRITE_PMASK(pFfb, ffb, pGC->planemask); - FFB_WRITE_DRAWOP(pFfb, ffb, FFB_DRAWOP_RECTANGLE); - fbc = FFB_FBC_WIN(pWin); - fbc = (fbc & ~FFB_FBC_XE_MASK) | FFB_FBC_XE_OFF; - FFB_WRITE_FBC(pFfb, ffb, fbc); - } - - /* Start computing the rects. */ - miFillArcSetup(arc, &info); - MIFILLARCSETUP(); - if(pGC->miTranslate) { - xorg += pDrawable->x; - yorg += pDrawable->y; - } - while(y > 0) { - MIFILLARCSTEP(slw); - if(slw > 0) { - /* Render. */ - FFBFifo(pFfb, 4); - FFB_WRITE64(&ffb->by, yorg - y, xorg - x); - FFB_WRITE64_2(&ffb->bh, 1, slw); - if(miFillArcLower(slw)) { - FFBFifo(pFfb, 4); - FFB_WRITE64(&ffb->by, yorg + y + dy, xorg - x); - FFB_WRITE64_2(&ffb->bh, 1, slw); - } - } - } - pFfb->rp_active = 1; - FFBSync(pFfb, ffb); -} - -#define ADDSPAN(l,r) \ - if (r >= l) { \ - FFBFifo(pFfb, 4); \ - FFB_WRITE64(&ffb->by, ya, l); \ - FFB_WRITE64_2(&ffb->bh, 1, r - l + 1); \ - } - -#define ADDSLICESPANS(flip) \ - if (!flip) \ - { \ - ADDSPAN(xl, xr); \ - } \ - else \ - { \ - xc = xorg - x; \ - ADDSPAN(xc, xr); \ - xc += slw - 1; \ - ADDSPAN(xl, xc); \ - } - -static void -CreatorFillArcSliceSolid(DrawablePtr pDrawable, GCPtr pGC, xArc *arc) -{ - WindowPtr pWin = (WindowPtr) pDrawable; - FFBPtr pFfb = GET_FFB_FROM_SCREEN(pDrawable->pScreen); - CreatorPrivGCPtr gcPriv = CreatorGetGCPrivate (pGC); - ffb_fbcPtr ffb = pFfb->regs; - miFillArcRec info; - miArcSliceRec slice; - int x, y, e, yk, xk, ym, xm, dx, dy, xorg, yorg, slw; - int ya, xl, xr, xc; - - /* Get the RP ready. */ - if(gcPriv->stipple == NULL) { - FFB_ATTR_GC(pFfb, pGC, pWin, - FFB_PPC_APE_DISABLE | FFB_PPC_CS_CONST, - FFB_DRAWOP_RECTANGLE); - } else { - unsigned int fbc; - - FFBSetStipple(pFfb, ffb, gcPriv->stipple, - FFB_PPC_CS_CONST, FFB_PPC_CS_MASK); - FFB_WRITE_PMASK(pFfb, ffb, pGC->planemask); - FFB_WRITE_DRAWOP(pFfb, ffb, FFB_DRAWOP_RECTANGLE); - fbc = FFB_FBC_WIN(pWin); - fbc = (fbc & ~FFB_FBC_XE_MASK) | FFB_FBC_XE_OFF; - FFB_WRITE_FBC(pFfb, ffb, fbc); - FFB_WRITE_FBC(pFfb, ffb, FFB_FBC_WIN(pWin)); - } - miFillArcSetup(arc, &info); - miFillArcSliceSetup(arc, &slice, pGC); - MIFILLARCSETUP(); - slw = arc->height; - if (slice.flip_top || slice.flip_bot) - slw += (arc->height >> 1) + 1; - if (pGC->miTranslate) { - xorg += pDrawable->x; - yorg += pDrawable->y; - slice.edge1.x += pDrawable->x; - slice.edge2.x += pDrawable->x; - } - while (y > 0) { - MIFILLARCSTEP(slw); - MIARCSLICESTEP(slice.edge1); - MIARCSLICESTEP(slice.edge2); - if (miFillSliceUpper(slice)) { - ya = yorg - y; - MIARCSLICEUPPER(xl, xr, slice, slw); - ADDSLICESPANS(slice.flip_top); - } - if (miFillSliceLower(slice)) { - ya = yorg + y + dy; - MIARCSLICELOWER(xl, xr, slice, slw); - ADDSLICESPANS(slice.flip_bot); - } - } - pFfb->rp_active = 1; - FFBSync(pFfb, ffb); -} - -void -CreatorPolyFillArcSolid (DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs) -{ - RegionPtr cclip; - xArc *arc; - BoxRec box; - int i, x2, y2; - - FFBLOG(("CreatorPolyFillArcSolid: narcs(%d)\n", narcs)); - cclip = cfbGetCompositeClip(pGC); - for(arc = parcs, i = narcs; --i >= 0; arc++) { - if(miFillArcEmpty(arc)) - continue; - if(miCanFillArc(arc)) { - box.x1 = arc->x + pDrawable->x; - box.y1 = arc->y + pDrawable->y; - box.x2 = x2 = box.x1 + (int)arc->width + 1; - box.y2 = y2 = box.y1 + (int)arc->height + 1; - if((x2 & ~0x7ff) == 0 && - (y2 & ~0x7ff) == 0 && - (RECT_IN_REGION(pDrawable->pScreen, cclip, &box) == rgnIN)) { - if(arc->angle2 >= FULLCIRCLE || - arc->angle2 <= -FULLCIRCLE) - CreatorFillEllipseSolid(pDrawable, pGC, arc); - else - CreatorFillArcSliceSolid(pDrawable, pGC, arc); - continue; - } - } - /* Use slow mi code if we can't handle it simply. */ - miPolyFillArc(pDrawable, pGC, 1, arc); - } -} diff --git a/src/ffb_clip.c b/src/ffb_clip.c deleted file mode 100644 index 812007c..0000000 --- a/src/ffb_clip.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Acceleration for the Creator and Creator3D framebuffer - clip setting. - * - * Copyright (C) 1999 Jakub Jelinek (jakub@redhat.com) - * Copyright (C) 1999 David S. Miller (davem@redhat.com) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * JAKUB JELINEK OR DAVID MILLER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ -/* $XFree86$ */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "ffb.h" -#include "ffb_regs.h" -#include "ffb_rcache.h" -#include "ffb_fifo.h" -#include "ffb_clip.h" - -unsigned int -FFBSetClip(FFBPtr pFfb, ffb_fbcPtr ffb, RegionPtr pClip, int numRects) -{ - unsigned int xy1, xy2; - - if (numRects == 1) { - xy1 = (pClip->extents.y1 << 16) | pClip->extents.x1; - xy2 = ((pClip->extents.y2 - 1) << 16) | (pClip->extents.x2 - 1); - if (pFfb->clips[0] == xy1 && pFfb->clips[1] == xy2) - return FFB_PPC_VCE_2D|FFB_PPC_ACE_DISABLE; - FFBFifo(pFfb, 2); - FFB_WRITE64(&ffb->vclipmin, xy1, xy2); - pFfb->clips[0] = xy1; - pFfb->clips[1] = xy2; - return FFB_PPC_VCE_2D|FFB_PPC_ACE_DISABLE; - } else if (numRects <= 5) { - ffb_auxclipPtr auxclip; - BoxPtr pBox = REGION_RECTS(pClip); - int i, j; - unsigned int xy3, xy4; - - xy1 = (pBox->y1 << 16) | pBox->x1; - xy2 = ((pBox->y2 - 1) << 16) | (pBox->x2 - 1); - if (pFfb->clips[0] == xy1 && pFfb->clips[1] == xy2) { - j = 0; - for (i = 1; i < numRects; i++) { - xy3 = (pBox[i].y1 << 16) | pBox[i].x1; - xy4 = ((pBox[i].y2 - 1) << 16) | (pBox[i].x2 - 1); - if (j || xy3 != pFfb->clips[2*i] || xy4 != pFfb->clips[2*i+1]) { - j = 1; - pFfb->clips[2*i] = xy3; - pFfb->clips[2*i+1] = xy4; - } - } - for (; i < 5; i++) { - if (j || pFfb->clips[2*i] != 1 || pFfb->clips[2*i+1]) { - j = 1; - pFfb->clips[2*i] = 1; - pFfb->clips[2*i+1] = 0; - } - } - if (!j) - return FFB_PPC_VCE_2D|FFB_PPC_ACE_AUX_ADD; - FFBFifo(pFfb, 8); - auxclip = ffb->auxclip; - for (i = 1; i < 5; i++, auxclip++) - FFB_WRITE64P(&auxclip->min, &pFfb->clips[2*i]); - return FFB_PPC_VCE_2D|FFB_PPC_ACE_AUX_ADD; - } - FFBFifo(pFfb, 10); - FFB_WRITE64(&ffb->vclipmin, xy1, xy2); - pFfb->clips[0] = xy1; - pFfb->clips[1] = xy2; - auxclip = ffb->auxclip; - pBox++; - for (i = 1; i < numRects; i++, auxclip++, pBox++) { - xy3 = (pBox->y1 << 16) | pBox->x1; - xy4 = ((pBox->y2 - 1) << 16) | (pBox->x2 - 1); - FFB_WRITE64(&auxclip->min, xy3, xy4); - pFfb->clips[2*i] = xy3; - pFfb->clips[2*i+1] = xy4; - } - for (; i < 5; i++, auxclip++) { - FFB_WRITE64(&auxclip->min, 1, 0); - pFfb->clips[2*i] = 1; - pFfb->clips[2*i+1] = 0; - } - return FFB_PPC_VCE_2D|FFB_PPC_ACE_AUX_ADD; - } - return 0; -} diff --git a/src/ffb_clip.h b/src/ffb_clip.h deleted file mode 100644 index b90655b..0000000 --- a/src/ffb_clip.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Acceleration for the Creator and Creator3D framebuffer - clipping defines. - * - * Copyright (C) 1999 Jakub Jelinek (jakub@redhat.com) - * Copyright (C) 1999 David S. Miller (davem@redhat.com) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * JAKUB JELINEK OR DAVID MILLER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_clip.h,v 1.1 2000/05/18 23:21:36 dawes Exp $ */ - -#ifndef FFBCLIP_H -#define FFBCLIP_H - -extern unsigned int FFBSetClip(FFBPtr pFfb, - ffb_fbcPtr ffb, - RegionPtr pClip, - int numRects); -static __inline__ void -FFBSet1Clip(FFBPtr pFfb, ffb_fbcPtr ffb, BoxPtr extents) -{ - unsigned int xy1, xy2; - - xy1 = (extents->y1 << 16) | extents->x1; - xy2 = ((extents->y2 - 1) << 16) | (extents->x2 - 1); - if (pFfb->clips[0] == xy1 && pFfb->clips[1] == xy2) - return; - FFBFifo(pFfb, 2); - FFB_WRITE64(&ffb->vclipmin, xy1, xy2); - pFfb->clips[0] = xy1; - pFfb->clips[1] = xy2; -} - -#endif /* FFBCLIP_H */ diff --git a/src/ffb_cplane.c b/src/ffb_cplane.c deleted file mode 100644 index 61b2669..0000000 --- a/src/ffb_cplane.c +++ /dev/null @@ -1,405 +0,0 @@ -/* - * Acceleration for the Creator and Creator3D framebuffer - Plane copies. - * - * Copyright (C) 1998,1999 Jakub Jelinek (jakub@redhat.com) - * Copyright (C) 1999 David S. Miller (davem@redhat.com) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * JAKUB JELINEK OR DAVID MILLER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_cplane.c,v 1.2tsi Exp $ */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "ffb.h" -#include "ffb_regs.h" -#include "ffb_rcache.h" -#include "ffb_fifo.h" - -#include "pixmapstr.h" -#include "scrnintstr.h" - -#define PSZ 8 -#include "cfb.h" -#undef PSZ -#include "cfb32.h" - -#include "cfbmskbits.h" -#include "mi.h" - -/* Blatantly stolen from mach64 driver. */ -#define mfbmaskbits(x, w, startmask, endmask, nlw) \ - startmask = starttab[(x)&0x1f]; \ - endmask = endtab[((x)+(w)) & 0x1f]; \ - if (startmask) \ - nlw = (((w) - (32 - ((x)&0x1f))) >> 5); \ - else \ - nlw = (w) >> 5; - -#define mfbmaskpartialbits(x, w, mask) \ - mask = partmasks[(x)&0x1f][(w)&0x1f]; - -#define LeftMost 0 -#define StepBit(bit, inc) ((bit) += (inc)) - - -#define GetBits(psrc, nBits, curBit, bitPos, bits) {\ - bits = 0; \ - while (nBits--) { \ - bits |= ((*psrc++ >> bitPos) & 1) << curBit; \ - StepBit (curBit, 1); \ - } \ -} - -static void -CreatorCopyPlane32to1 (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, int rop, RegionPtr prgnDst, - DDXPointPtr pptSrc, unsigned long planemask, unsigned long bitPlane) -{ - int srcx, srcy, dstx, dsty, width, height; - unsigned long *psrcBase; - unsigned long *pdstBase; - int widthSrc, widthDst; - unsigned int *psrcLine; - unsigned int *pdstLine; - register unsigned int *psrc; - register int i; - register int curBit; - register int bitPos; - register unsigned int bits; - register unsigned int *pdst; - unsigned int startmask, endmask; - int niStart = 0, niEnd = 0; - int bitStart = 0, bitEnd = 0; - int nl, nlMiddle; - int nbox; - BoxPtr pbox; - int result; - - extern int starttab[32], endtab[32]; - extern unsigned int partmasks[32][32]; - - if (!(planemask & 1)) - return; - - /* must explicitly ask for "int" widths, as code below expects it */ - /* on some machines (Sparc64), "long" and "int" are not the same size */ - cfbGetTypedWidthAndPointer (pSrcDrawable, widthSrc, psrcBase, int, unsigned long) - cfbGetTypedWidthAndPointer (pDstDrawable, widthDst, pdstBase, int, unsigned long) - - bitPos = ffs (bitPlane) - 1; - - nbox = REGION_NUM_RECTS(prgnDst); - pbox = REGION_RECTS(prgnDst); - while (nbox--) { - dstx = pbox->x1; - dsty = pbox->y1; - srcx = pptSrc->x; - srcy = pptSrc->y; - width = pbox->x2 - pbox->x1; - height = pbox->y2 - pbox->y1; - pbox++; - pptSrc++; - psrcLine = (unsigned int *)psrcBase + srcy * widthSrc + srcx; - pdstLine = (unsigned int *)pdstBase + dsty * widthDst + (dstx >> 5); - if (dstx + width <= 32) { - mfbmaskpartialbits(dstx, width, startmask); - nlMiddle = 0; - endmask = 0; - } else { - mfbmaskbits (dstx, width, startmask, endmask, nlMiddle); - } - if (startmask) { - niStart = 32 - (dstx & 0x1f); - bitStart = LeftMost; - StepBit (bitStart, (dstx & 0x1f)); - } - if (endmask) { - niEnd = (dstx + width) & 0x1f; - bitEnd = LeftMost; - } - if (rop == GXcopy) { - while (height--) { - psrc = psrcLine; - pdst = pdstLine; - psrcLine += widthSrc; - pdstLine += widthDst; - if (startmask) { - i = niStart; - curBit = bitStart; - GetBits (psrc, i, curBit, bitPos, bits); - - *pdst = (*pdst & ~startmask) | bits; - pdst++; - } - nl = nlMiddle; - - while (nl--) { - i = 32; - curBit = LeftMost; - GetBits (psrc, i, curBit, bitPos, bits); - *pdst++ = bits; - } - if (endmask) { - i = niEnd; - curBit = bitEnd; - GetBits (psrc, i, curBit, bitPos, bits); - - *pdst = (*pdst & ~endmask) | bits; - } - } - } else { - while (height--) { - psrc = psrcLine; - pdst = pdstLine; - psrcLine += widthSrc; - pdstLine += widthDst; - if (startmask) { - i = niStart; - curBit = bitStart; - GetBits (psrc, i, curBit, bitPos, bits); - DoRop (result, rop, bits, *pdst); - - *pdst = (*pdst & ~startmask) | (result & startmask); - pdst++; - } - nl = nlMiddle; - while (nl--) { - i = 32; - curBit = LeftMost; - GetBits (psrc, i, curBit, bitPos, bits); - DoRop (result, rop, bits, *pdst); - *pdst = result; - ++pdst; - } - if (endmask) { - i = niEnd; - curBit = bitEnd; - GetBits (psrc, i, curBit, bitPos, bits); - DoRop (result, rop, bits, *pdst); - - *pdst = (*pdst & ~endmask) | (result & endmask); - } - } - } - } -} - -static unsigned int copyPlaneFG, copyPlaneBG; - -static void -CreatorCopyPlane1toFbBpp (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, int alu, RegionPtr prgnDst, DDXPointPtr pptSrc, unsigned long planemask, unsigned long bitPlane) -{ - FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDstDrawable->pScreen); - WindowPtr pWin = (WindowPtr) pDstDrawable; - ffb_fbcPtr ffb = pFfb->regs; - int srcx, srcy, dstx, dsty, width, height; - int xoffSrc, widthSrc; - unsigned int *psrcBase, *psrc, *psrcStart; - unsigned int w, tmp, i; - int nbox; - BoxPtr pbox; - - { - unsigned int ppc = (FFB_PPC_APE_DISABLE | FFB_PPC_TBE_OPAQUE | - FFB_PPC_CS_CONST); - unsigned int ppc_mask = (FFB_PPC_APE_MASK | FFB_PPC_TBE_MASK | - FFB_PPC_CS_MASK); - unsigned int rop = (FFB_ROP_EDIT_BIT | alu) | (FFB_ROP_NEW << 8); - unsigned int fbc = FFB_FBC_WIN(pWin); - - fbc = (fbc & ~FFB_FBC_XE_MASK) | FFB_FBC_XE_OFF; - - if((pFfb->ppc_cache & ppc_mask) != ppc || - pFfb->fg_cache != copyPlaneFG || - pFfb->fbc_cache != fbc || - pFfb->rop_cache != rop || - pFfb->pmask_cache != planemask || - pFfb->bg_cache != copyPlaneBG) { - pFfb->ppc_cache &= ~ppc_mask; - pFfb->ppc_cache |= ppc; - pFfb->fg_cache = copyPlaneFG; - pFfb->fbc_cache = fbc; - pFfb->rop_cache = rop; - pFfb->pmask_cache = planemask; - pFfb->bg_cache = copyPlaneBG; - pFfb->rp_active = 1; - FFBFifo(pFfb, 6); - ffb->ppc = ppc; - ffb->fg = copyPlaneFG; - ffb->fbc = fbc; - ffb->rop = rop; - ffb->pmask = planemask; - ffb->bg = copyPlaneBG; - } - } - - cfbGetTypedWidthAndPointer (pSrcDrawable, widthSrc, psrcBase, unsigned int, unsigned int) - - nbox = REGION_NUM_RECTS(prgnDst); - pbox = REGION_RECTS(prgnDst); - while (nbox--) { - dstx = pbox->x1; - dsty = pbox->y1; - srcx = pptSrc->x; - srcy = pptSrc->y; - width = pbox->x2 - dstx; - height = pbox->y2 - dsty; - pbox++; - pptSrc++; - if (!width) - continue; - psrc = psrcBase + srcy * widthSrc + (srcx >> 5); - for (xoffSrc = srcx & 0x1f; height--; psrc = psrcStart + widthSrc) { - w = width; - psrcStart = psrc; - FFBFifo(pFfb, (1 + (xoffSrc != 0))); - ffb->fontxy = ((dsty++ << 16) | (dstx & 0xffff)); - if (xoffSrc) { - tmp = 32 - xoffSrc; - if (tmp > w) - tmp = w; - FFB_WRITE_FONTW(pFfb, ffb, tmp); - FFB_WRITE_FONTINC(pFfb, ffb, tmp); - ffb->font = *psrc++ << xoffSrc; - w -= tmp; - } - if (!w) - continue; - FFB_WRITE_FONTW(pFfb, ffb, 32); - FFB_WRITE_FONTINC(pFfb, ffb, 32); - while (w >= 256) { - FFBFifo(pFfb, 8); - for (i = 0; i < 8; i++) - ffb->font = *psrc++; - w -= 256; - } - while (w >= 32) { - FFBFifo(pFfb, 1); - ffb->font = *psrc++; - w -= 32; - } - if (w) { - FFB_WRITE_FONTW(pFfb, ffb, w); - FFBFifo(pFfb, 1); - ffb->font = *psrc++; - } - } - } - pFfb->rp_active = 1; - FFBSync(pFfb, ffb); -} - -RegionPtr CreatorCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, - GCPtr pGC, int srcx, int srcy, int width, int height, - int dstx, int dsty, unsigned long bitPlane) -{ - FFBPtr pFfb = GET_FFB_FROM_SCREEN (pSrcDrawable->pScreen); - WindowPtr pWin = (WindowPtr) pDstDrawable; - ffb_fbcPtr ffb = pFfb->regs; - RegionPtr ret; - - FFBLOG(("CreatorCopyPlane: sbpp(%d) dbpp(%d) src[%08x:%08x] dst[%08x:%08x] bplane(%08x)\n", - pSrcDrawable->bitsPerPixel, pDstDrawable->bitsPerPixel, - srcx, srcy, dstx, dsty, bitPlane)); - if (pSrcDrawable->bitsPerPixel == 1 && - (pDstDrawable->bitsPerPixel == 32 || pDstDrawable->bitsPerPixel == 8)) { - if (bitPlane == 1) { - copyPlaneFG = pGC->fgPixel; - copyPlaneBG = pGC->bgPixel; - ret = cfbCopyPlaneReduce (pSrcDrawable, pDstDrawable, - pGC, srcx, srcy, - width, height, dstx, dsty, - CreatorCopyPlane1toFbBpp, - bitPlane); - } else - ret = miHandleExposures (pSrcDrawable, pDstDrawable, - pGC, srcx, srcy, width, height, dstx, dsty, bitPlane); - } else if ((pSrcDrawable->bitsPerPixel == 32 || pSrcDrawable->bitsPerPixel == 8) - && pDstDrawable->bitsPerPixel == 1) { - extern int InverseAlu[16]; - int oldalu; - - oldalu = pGC->alu; - if ((pGC->fgPixel & 1) == 0 && (pGC->bgPixel&1) == 1) - pGC->alu = InverseAlu[pGC->alu]; - else if ((pGC->fgPixel & 1) == (pGC->bgPixel & 1)) - pGC->alu = mfbReduceRop(pGC->alu, pGC->fgPixel); - FFB_ATTR_SFB_VAR_WIN(pFfb, 0x00ffffff, GXcopy, pWin); - FFBWait(pFfb, ffb); - if (pSrcDrawable->bitsPerPixel == 32) { - ret = cfbCopyPlaneReduce (pSrcDrawable, pDstDrawable, - pGC, srcx, srcy, - width, height, dstx, dsty, - CreatorCopyPlane32to1, - bitPlane); - } else { - ret = cfbCopyPlaneReduce (pSrcDrawable, pDstDrawable, - pGC, srcx, srcy, - width, height, dstx, dsty, - cfbCopyPlane8to1, bitPlane); - } - pGC->alu = oldalu; - } else { - PixmapPtr pBitmap; - ScreenPtr pScreen = pSrcDrawable->pScreen; - GCPtr pGC1; - - pBitmap = (*pScreen->CreatePixmap) (pScreen, width, height, 1); - if (!pBitmap) - return NULL; - pGC1 = GetScratchGC (1, pScreen); - if (!pGC1) { - (*pScreen->DestroyPixmap) (pBitmap); - return NULL; - } - /* - * don't need to set pGC->fgPixel,bgPixel as copyPlane{8,32}to1 - * ignores pixel values, expecting the rop to "do the - * right thing", which GXcopy will. - */ - ValidateGC ((DrawablePtr) pBitmap, pGC1); - /* no exposures here, scratch GC's don't get graphics expose */ - FFB_ATTR_SFB_VAR_WIN(pFfb, 0x00ffffff, GXcopy, pWin); - FFBWait(pFfb, ffb); - if (pSrcDrawable->bitsPerPixel == 32) { - cfbCopyPlaneReduce (pSrcDrawable, (DrawablePtr) pBitmap, - pGC1, srcx, srcy, width, height, - 0, 0, CreatorCopyPlane32to1, - bitPlane); - } else { - cfbCopyPlaneReduce (pSrcDrawable, (DrawablePtr) pBitmap, - pGC1, srcx, srcy, width, height, - 0, 0, cfbCopyPlane8to1, - bitPlane); - } - copyPlaneFG = pGC->fgPixel; - copyPlaneBG = pGC->bgPixel; - cfbCopyPlaneReduce ((DrawablePtr) pBitmap, pDstDrawable, pGC, - 0, 0, width, height, dstx, dsty, - CreatorCopyPlane1toFbBpp, 1); - FreeScratchGC (pGC1); - (*pScreen->DestroyPixmap) (pBitmap); - /* compute resultant exposures */ - ret = miHandleExposures (pSrcDrawable, pDstDrawable, pGC, - srcx, srcy, width, height, - dstx, dsty, bitPlane); - } - return ret; -} diff --git a/src/ffb_dbe.c b/src/ffb_dbe.c deleted file mode 100644 index 19dbbd1..0000000 --- a/src/ffb_dbe.c +++ /dev/null @@ -1,906 +0,0 @@ -/* - * Acceleration for the Creator and Creator3D framebuffer - Dbe Acceleration. - * - * Copyright (C) 2000 David S. Miller (davem@redhat.com) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * DAVID MILLER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dbe.c,v 1.1 2000/05/23 04:47:44 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#define NEED_REPLIES -#define NEED_EVENTS -#include -#include -#include "misc.h" -#include "os.h" -#include "windowstr.h" -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "extnsionst.h" -#include "dixstruct.h" -#include "resource.h" -#include "opaque.h" -#include "dbestruct.h" -#include "regionstr.h" -#include "gcstruct.h" -#include "inputstr.h" - -#define PSZ 8 -#include "cfb.h" -#undef PSZ -#include "cfb32.h" - -#include "xf86_ansic.h" -#include "xf86.h" - -#include "ffb.h" -#include "ffb_fifo.h" -#include "ffb_rcache.h" - -static int FFBDbePrivPrivGeneration = 0; -static int FFBDbeWindowPrivPrivIndex = -1; -static RESTYPE dbeDrawableResType; -static RESTYPE dbeWindowPrivResType; -static int dbeScreenPrivIndex = -1; -static int dbeWindowPrivIndex = -1; - -#define FFB_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv) \ - (((FFBDbeWindowPrivPrivIndex < 0) || (!pDbeWindowPriv)) ? \ - NULL : \ - ((FFBDbeWindowPrivPrivPtr) \ - ((pDbeWindowPriv)->devPrivates[FFBDbeWindowPrivPrivIndex].ptr))) - -#define FFB_DBE_WINDOW_PRIV_PRIV_FROM_WINDOW(pWin) \ - FFB_DBE_WINDOW_PRIV_PRIV(DBE_WINDOW_PRIV(pWin)) - -typedef struct _FFBDbeWindowPrivPrivRec { - int HwAccelerated; - int HwCurrentBuf; /* 0 = buffer A, 1 = buffer B */ - - /* We need also what midbe would use in case we must - * revert to unaccelerated dbe. - */ - PixmapPtr pBackBuffer; - PixmapPtr pFrontBuffer; - - /* Back pointer to generic DBE layer window private. */ - DbeWindowPrivPtr pDbeWindowPriv; -} FFBDbeWindowPrivPrivRec, *FFBDbeWindowPrivPrivPtr; - -static Bool -FFBDbeGetVisualInfo(ScreenPtr pScreen, XdbeScreenVisualInfo *pScrVisInfo) -{ - XdbeVisualInfo *visInfo; - DepthPtr pDepth; - int i, j, k, count; - - /* XXX Should check for double-buffer presence. But even if - * XXX the double-buffer is not present we can still play - * XXX tricks with GetWindowPixmap in 8bpp mode, ie. double - * XXX buffer between the R and G planes of buffer A. -DaveM - */ - - /* Determine number of visuals for this screen. */ - for (i = 0, count = 0; i < pScreen->numDepths; i++) - count += pScreen->allowedDepths[i].numVids; - - /* Allocate an array of XdbeVisualInfo items. */ - if (!(visInfo = (XdbeVisualInfo *)xalloc(count * sizeof(XdbeVisualInfo)))) - return FALSE; - - for (i = 0, k = 0; i < pScreen->numDepths; i++) { - /* For each depth of this screen, get visual information. */ - pDepth = &pScreen->allowedDepths[i]; - for (j = 0; j < pDepth->numVids; j++) { - /* For each visual for this depth of this screen, get visual ID - * and visual depth. For now, we will always return - * the same performance level for all visuals (0). A higher - * performance level value indicates higher performance. - */ - visInfo[k].visual = pDepth->vids[j]; - visInfo[k].depth = pDepth->depth; - - /* XXX We should set this appropriately... -DaveM */ - visInfo[k].perflevel = 0; - k++; - } - } - - /* Record the number of visuals and point visual_depth to - * the array of visual info. - */ - pScrVisInfo->count = count; - pScrVisInfo->visinfo = visInfo; - - return TRUE; -} - -static void -FFBDbeUpdateWidPlane(WindowPtr pWin, GCPtr pGC) -{ - FFBPtr pFfb = GET_FFB_FROM_SCREEN(pWin->drawable.pScreen); - CreatorPrivWinPtr pFfbPrivWin = CreatorGetWindowPrivate(pWin); - RegionPtr prgnClip; - BoxPtr pboxClipped, pboxClippedBase; - unsigned int fbc; - int numRects; - int x, y, w, h; - - x = pWin->drawable.x; - y = pWin->drawable.y; - w = pWin->drawable.width; - h = pWin->drawable.height; - - fbc = pFfbPrivWin->fbc_base; - fbc = (fbc & ~FFB_FBC_WB_MASK) | FFB_FBC_WB_AB; - fbc = (fbc & ~FFB_FBC_XE_MASK) | FFB_FBC_XE_ON; - fbc = (fbc & ~FFB_FBC_RGBE_MASK) | FFB_FBC_RGBE_OFF; - - prgnClip = cfbGetCompositeClip(pGC); - numRects = REGION_NUM_RECTS (prgnClip); - pboxClippedBase = (BoxPtr) ALLOCATE_LOCAL(numRects * sizeof(BoxRec)); - if (!pboxClippedBase) - return; - - pboxClipped = pboxClippedBase; - { - int x1, y1, x2, y2, bx2, by2; - BoxRec box; - BoxPtr pextent; - - pextent = REGION_EXTENTS(pGC->pScreen, prgnClip); - x1 = pextent->x1; - y1 = pextent->y1; - x2 = pextent->x2; - y2 = pextent->y2; - - if ((box.x1 = x) < x1) - box.x1 = x1; - - if ((box.y1 = y) < y1) - box.y1 = y1; - - bx2 = (int) x + (int) w; - if (bx2 > x2) - bx2 = x2; - box.x2 = bx2; - - by2 = (int) y + (int) h; - if (by2 > y2) - by2 = y2; - box.y2 = by2; - - if ((box.x1 < box.x2) && (box.y1 < box.y2)) { - int n = REGION_NUM_RECTS (prgnClip); - BoxPtr pbox = REGION_RECTS(prgnClip); - - /* Clip the rectangle to each box in the clip region - * this is logically equivalent to calling Intersect() - */ - while(n--) { - pboxClipped->x1 = max(box.x1, pbox->x1); - pboxClipped->y1 = max(box.y1, pbox->y1); - pboxClipped->x2 = min(box.x2, pbox->x2); - pboxClipped->y2 = min(box.y2, pbox->y2); - pbox++; - - /* see if clipping left anything */ - if(pboxClipped->x1 < pboxClipped->x2 && - pboxClipped->y1 < pboxClipped->y2) - pboxClipped++; - } - } - } - - if (pboxClipped != pboxClippedBase) { - ffb_fbcPtr ffb = pFfb->regs; - int num = (pboxClipped - pboxClippedBase); - - FFB_ATTR_RAW(pFfb, - FFB_PPC_APE_DISABLE | FFB_PPC_CS_CONST | FFB_PPC_XS_WID, - FFB_PPC_APE_MASK | FFB_PPC_CS_MASK | FFB_PPC_XS_MASK, - pGC->planemask, - ((FFB_ROP_EDIT_BIT | pGC->alu) | (FFB_ROP_NEW << 8)), - FFB_DRAWOP_RECTANGLE, - pGC->fgPixel, - fbc, pFfbPrivWin->wid); - - pboxClipped = pboxClippedBase; - while (num--) { - int xx, yy, ww, hh; - - xx = pboxClipped->x1; - yy = pboxClipped->y1; - ww = (pboxClipped->x2 - xx); - hh = (pboxClipped->y2 - yy); - FFBFifo(pFfb, 4); - FFB_WRITE64(&ffb->by, yy, xx); - FFB_WRITE64_2(&ffb->bh, hh, ww); - } - } - - DEALLOCATE_LOCAL (pboxClippedBase); -} - -static int -FFBDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction) -{ - ScreenPtr pScreen; - FFBPtr pFfb; - DbeWindowPrivPtr pDbeWindowPriv; - FFBDbeWindowPrivPrivPtr pDbeWindowPrivPriv; - DbeScreenPrivPtr pDbeScreenPriv; - GCPtr pGC; - xRectangle clearRect; - - pScreen = pWin->drawable.pScreen; - pDbeWindowPriv = DBE_WINDOW_PRIV(pWin); - pFfb = GET_FFB_FROM_SCREEN(pScreen); - - pDbeWindowPrivPriv = FFB_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv); - if (pDbeWindowPriv->nBufferIDs == 0) { - /* There is no buffer associated with the window. - * We have to create the window priv priv. Remember, the window - * priv was created at the DIX level, so all we need to do is - * create the priv priv and attach it to the priv. - */ - pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen); - - /* Setup the window priv priv. */ - pDbeWindowPrivPriv->pDbeWindowPriv = pDbeWindowPriv; - - if (!pFfb->NoAccel && pFfb->has_double_buffer) { - CreatorPrivWinPtr pFfbPrivWin; - unsigned int wid, fbc; - - /* We just render directly into the hardware, all - * that is needed is to swap the rendering attributes - * and the WID settings during a swap. - */ - if (!AddResource(bufId, dbeDrawableResType, - (pointer)&pWin->drawable)) { - /* Free the buffer and the drawable resource. */ - FreeResource(bufId, RT_NONE); - return BadAlloc; - } - - pFfbPrivWin = CreatorGetWindowPrivate(pWin); - wid = FFBWidUnshare(pFfb, pFfbPrivWin->wid); - if (wid == (unsigned int)-1) - return BadAlloc; - - pFfbPrivWin->wid = wid; - - /* Attach the priv priv to the priv. */ - pDbeWindowPriv->devPrivates[FFBDbeWindowPrivPrivIndex].ptr = - (pointer)pDbeWindowPrivPriv; - - /* Indicate we are doing hw acceleration. */ - pDbeWindowPrivPriv->HwAccelerated = 1; - - /* Start rendering into buffer B. */ - pDbeWindowPrivPriv->HwCurrentBuf = 1; - - /* No back/front temporary pixmaps. */ - pDbeWindowPrivPriv->pFrontBuffer = NULL; - pDbeWindowPrivPriv->pBackBuffer = NULL; - - /* Switch to writing into buffer B. */ - fbc = pFfbPrivWin->fbc_base; - fbc &= ~(FFB_FBC_WB_MASK | FFB_FBC_RB_MASK); - fbc |= (FFB_FBC_WB_B | FFB_FBC_RB_B); - pFfbPrivWin->fbc_base = fbc; - - pGC = GetScratchGC(pWin->drawable.depth, pWin->drawable.pScreen); - - /* Fill X plane of front and back buffers. */ - if ((*pDbeScreenPriv->SetupBackgroundPainter)(pWin, pGC)) { - ValidateGC(&pWin->drawable, pGC); - FFBDbeUpdateWidPlane(pWin, pGC); - } - - /* Clear out buffer B. */ - clearRect.x = clearRect.y = 0; - clearRect.width = pWin->drawable.width; - clearRect.height = pWin->drawable.height; - if ((*pDbeScreenPriv->SetupBackgroundPainter)(pWin, pGC)) { - ValidateGC(&pWin->drawable, pGC); - (*pGC->ops->PolyFillRect)(&pWin->drawable, pGC, 1, &clearRect); - } - - FreeScratchGC(pGC); - } else { - /* Get a front pixmap. */ - if (!(pDbeWindowPrivPriv->pFrontBuffer = - (*pScreen->CreatePixmap)(pScreen, pDbeWindowPriv->width, - pDbeWindowPriv->height, - pWin->drawable.depth))) - return BadAlloc; - - /* Get a back pixmap. */ - if (!(pDbeWindowPrivPriv->pBackBuffer = - (*pScreen->CreatePixmap)(pScreen, pDbeWindowPriv->width, - pDbeWindowPriv->height, - pWin->drawable.depth))) { - (*pScreen->DestroyPixmap)(pDbeWindowPrivPriv->pFrontBuffer); - return BadAlloc; - } - - - /* Make the back pixmap a DBE drawable resource. */ - if (!AddResource(bufId, dbeDrawableResType, - (pointer)pDbeWindowPrivPriv->pBackBuffer)) { - /* Free the buffer and the drawable resource. */ - FreeResource(bufId, RT_NONE); - return(BadAlloc); - } - - /* Attach the priv priv to the priv. */ - pDbeWindowPriv->devPrivates[FFBDbeWindowPrivPrivIndex].ptr = - (pointer)pDbeWindowPrivPriv; - - /* Indicate we are doing this non-accelerated. */ - pDbeWindowPrivPriv->HwAccelerated = 0; - - /* Clear the back buffer. */ - pGC = GetScratchGC(pWin->drawable.depth, pWin->drawable.pScreen); - if ((*pDbeScreenPriv->SetupBackgroundPainter)(pWin, pGC)) { - ValidateGC((DrawablePtr)pDbeWindowPrivPriv->pBackBuffer, pGC); - clearRect.x = clearRect.y = 0; - clearRect.width = pDbeWindowPrivPriv->pBackBuffer->drawable.width; - clearRect.height = pDbeWindowPrivPriv->pBackBuffer->drawable.height; - (*pGC->ops->PolyFillRect)( - (DrawablePtr)pDbeWindowPrivPriv->pBackBuffer, pGC, 1, - &clearRect); - } - FreeScratchGC(pGC); - } - } else { - pointer cookie; - - /* A buffer is already associated with the window. - * Place the new buffer ID information at the head of the ID list. - */ - if (pDbeWindowPrivPriv->HwAccelerated != 0) - cookie = (pointer)&pWin->drawable; - else - cookie = (pointer)pDbeWindowPrivPriv->pBackBuffer; - - /* Associate the new ID with an existing pixmap. */ - if (!AddResource(bufId, dbeDrawableResType, cookie)) - return BadAlloc; - } - - return Success; -} - -static void -FFBDbeAliasBuffers(DbeWindowPrivPtr pDbeWindowPriv) -{ - FFBDbeWindowPrivPrivPtr pDbeWindowPrivPriv = - FFB_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv); - pointer cookie; - int i; - - if (pDbeWindowPrivPriv->HwAccelerated != 0) - cookie = (pointer) &pDbeWindowPriv->pWindow->drawable; - else - cookie = (pointer) pDbeWindowPrivPriv->pBackBuffer; - - for (i = 0; i < pDbeWindowPriv->nBufferIDs; i++) - ChangeResourceValue(pDbeWindowPriv->IDs[i], dbeDrawableResType, cookie); -} - -static int -FFBDbeSwapBuffers(ClientPtr client, int *pNumWindows, DbeSwapInfoPtr swapInfo) -{ - FFBDbeWindowPrivPrivPtr pDbeWindowPrivPriv; - DbeScreenPrivPtr pDbeScreenPriv; - PixmapPtr pTmpBuffer; - xRectangle clearRect; - WindowPtr pWin; - GCPtr pGC; - - pWin = swapInfo[0].pWindow; - pDbeScreenPriv = DBE_SCREEN_PRIV_FROM_WINDOW(pWin); - pDbeWindowPrivPriv = FFB_DBE_WINDOW_PRIV_PRIV_FROM_WINDOW(pWin); - pGC = GetScratchGC(pWin->drawable.depth, pWin->drawable.pScreen); - - if (pDbeWindowPrivPriv->HwAccelerated != 0) { - FFBPtr pFfb = GET_FFB_FROM_SCREEN(pWin->drawable.pScreen); - CreatorPrivWinPtr pFfbPrivWin = CreatorGetWindowPrivate(pWin); - unsigned int fbc; - int visible; - - /* Unfortunately, this is necessary for correctness. */ - FFBWait(pFfb, pFfb->regs); - - /* Flip front/back in the WID. */ - visible = 0; - if (pWin->viewable && - pWin->visibility != VisibilityFullyObscured) - visible = 1; - FFBWidChangeBuffer(pFfb, pFfbPrivWin->wid, visible); - - /* Indicate where we are rendering now. */ - pDbeWindowPrivPriv->HwCurrentBuf ^= 1; - - /* Update framebuffer controls. */ - fbc = pFfbPrivWin->fbc_base; - fbc &= ~(FFB_FBC_WB_MASK | FFB_FBC_RB_MASK); - if (pDbeWindowPrivPriv->HwCurrentBuf == 0) - fbc |= FFB_FBC_WB_A | FFB_FBC_RB_A; - else - fbc |= FFB_FBC_WB_B | FFB_FBC_RB_B; - - /* For XdbeUndefined we do not have to do anything. - * This is true for XdbeUntouched as well because we - * do in fact retain the unobscured contents of the - * front buffer while it is being displayed, thus now - * when it has become the back buffer it is still holding - * those contents. - * - * The XdbeUntouched case is important because most apps - * using dbe use this type of swap. - */ - - if (swapInfo[0].swapAction == XdbeCopied) { - unsigned int fbc_front_to_back; - - /* Do a GCOPY, front to back. */ - fbc_front_to_back = fbc & ~FFB_FBC_RB_MASK; - if (pDbeWindowPrivPriv->HwCurrentBuf == 0) - fbc_front_to_back |= FFB_FBC_RB_B; - else - fbc_front_to_back |= FFB_FBC_RB_A; - - pFfbPrivWin->fbc_base = fbc_front_to_back; - ValidateGC(&pWin->drawable, pGC); - (*pGC->ops->CopyArea)(&pWin->drawable, - &pWin->drawable, - pGC, - 0, 0, - pWin->drawable.width, - pWin->drawable.height, - 0, 0); - } else if (swapInfo[0].swapAction == XdbeBackground) { - if ((*pDbeScreenPriv->SetupBackgroundPainter)(pWin, pGC)) { - ValidateGC(&pWin->drawable, pGC); - clearRect.x = 0; - clearRect.y = 0; - clearRect.width = pWin->drawable.width; - clearRect.height = pWin->drawable.height; - (*pGC->ops->PolyFillRect)(&pWin->drawable, pGC, - 1, &clearRect); - } - } - - /* Ok, now render with these fb controls. */ - pFfbPrivWin->fbc_base = fbc; - } else { - if (swapInfo[0].swapAction == XdbeUntouched) { - ValidateGC((DrawablePtr)pDbeWindowPrivPriv->pFrontBuffer, pGC); - (*pGC->ops->CopyArea)((DrawablePtr)pWin, - (DrawablePtr)pDbeWindowPrivPriv->pFrontBuffer, - pGC, 0, 0, pWin->drawable.width, - pWin->drawable.height, 0, 0); - } - - ValidateGC((DrawablePtr)pWin, pGC); - (*pGC->ops->CopyArea)((DrawablePtr)pDbeWindowPrivPriv->pBackBuffer, - (DrawablePtr)pWin, pGC, 0, 0, - pWin->drawable.width, pWin->drawable.height, - 0, 0); - - if (swapInfo[0].swapAction == XdbeBackground) { - if ((*pDbeScreenPriv->SetupBackgroundPainter)(pWin, pGC)) { - ValidateGC((DrawablePtr)pDbeWindowPrivPriv->pBackBuffer, - pGC); - clearRect.x = 0; - clearRect.y = 0; - clearRect.width = - pDbeWindowPrivPriv->pBackBuffer->drawable.width; - clearRect.height = - pDbeWindowPrivPriv->pBackBuffer->drawable.height; - (*pGC->ops->PolyFillRect)( - (DrawablePtr)pDbeWindowPrivPriv->pBackBuffer, - pGC, 1, &clearRect); - } - } else if (swapInfo[0].swapAction == XdbeUntouched) { - /* Swap pixmap pointers. */ - pTmpBuffer = pDbeWindowPrivPriv->pBackBuffer; - pDbeWindowPrivPriv->pBackBuffer = - pDbeWindowPrivPriv->pFrontBuffer; - pDbeWindowPrivPriv->pFrontBuffer = pTmpBuffer; - FFBDbeAliasBuffers(pDbeWindowPrivPriv->pDbeWindowPriv); - } - } - - /* Remove the swapped window from the swap information array and decrement - * pNumWindows to indicate to the DIX level how many windows were actually - * swapped. - */ - if (*pNumWindows > 1) { - /* We were told to swap more than one window, but we only swapped the - * first one. Remove the first window in the list by moving the last - * window to the beginning. - */ - swapInfo[0].pWindow = swapInfo[*pNumWindows - 1].pWindow; - swapInfo[0].swapAction = swapInfo[*pNumWindows - 1].swapAction; - - /* Clear the last window information just to be safe. */ - swapInfo[*pNumWindows - 1].pWindow = (WindowPtr)NULL; - swapInfo[*pNumWindows - 1].swapAction = 0; - } else { - /* Clear the window information just to be safe. */ - swapInfo[0].pWindow = (WindowPtr)NULL; - swapInfo[0].swapAction = 0; - } - - (*pNumWindows)--; - - FreeScratchGC(pGC); - - return Success; -} - -static void -FFBDbeWinPrivDelete(DbeWindowPrivPtr pDbeWindowPriv, XID bufId) -{ - WindowPtr pWin = pDbeWindowPriv->pWindow; - FFBDbeWindowPrivPrivPtr pDbeWindowPrivPriv; - - if (pDbeWindowPriv->nBufferIDs != 0) { - /* We still have at least one more buffer ID associated with this - * window. - */ - return; - } - - /* We have no more buffer IDs associated with this window. We need to - * free some stuff. - */ - pDbeWindowPrivPriv = FFB_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv); - - /* If we were accelerating we need to restore the framebuffer - * attributes. We need to also free up the Dbe WID and go - * back to using the shared one. - */ - if (pDbeWindowPrivPriv->HwAccelerated != 0) { - FFBPtr pFfb = GET_FFB_FROM_SCREEN(pWin->drawable.pScreen); - CreatorPrivWinPtr pFfbPrivWin = CreatorGetWindowPrivate(pWin); - xRectangle clearRect; - unsigned int fbc; - GCPtr pGC; - - pFfbPrivWin->wid = FFBWidReshare(pFfb, pFfbPrivWin->wid); - - /* Go back to using buffer A. */ - fbc = pFfbPrivWin->fbc_base; - fbc &= ~(FFB_FBC_WB_MASK | FFB_FBC_RB_MASK); - fbc |= FFB_FBC_WB_A | FFB_FBC_RB_A; - - /* Now fixup the WID channel. */ - pFfbPrivWin->fbc_base = - (fbc & ~FFB_FBC_RGBE_MASK) | FFB_FBC_RGBE_OFF; - - pGC = GetScratchGC(pWin->drawable.depth, pWin->drawable.pScreen); - clearRect.x = clearRect.y = 0; - clearRect.width = pWin->drawable.width; - clearRect.height = pWin->drawable.height; - ValidateGC(&pWin->drawable, pGC); - FFBDbeUpdateWidPlane(pWin, pGC); - (*pGC->ops->PolyFillRect)(&pWin->drawable, pGC, 1, &clearRect); - FreeScratchGC(pGC); - - pFfbPrivWin->fbc_base = fbc; - } else { - /* Destroy the front and back pixmaps. */ - if (pDbeWindowPrivPriv->pFrontBuffer) - (*pDbeWindowPriv->pWindow->drawable.pScreen->DestroyPixmap)( - pDbeWindowPrivPriv->pFrontBuffer); - if (pDbeWindowPrivPriv->pBackBuffer) - (*pDbeWindowPriv->pWindow->drawable.pScreen->DestroyPixmap)( - pDbeWindowPrivPriv->pBackBuffer); - } -} - -static Bool -FFBDbePositionWindow(WindowPtr pWin, int x, int y) -{ - ScreenPtr pScreen; - DbeScreenPrivPtr pDbeScreenPriv; - DbeWindowPrivPtr pDbeWindowPriv; - FFBDbeWindowPrivPrivPtr pDbeWindowPrivPriv; - int width, height; - int dx, dy, dw, dh; - int sourcex, sourcey; - int destx, desty; - int savewidth, saveheight; - PixmapPtr pFrontBuffer; - PixmapPtr pBackBuffer; - Bool clear; - GCPtr pGC; - xRectangle clearRect; - Bool ret; - - /* 1. Unwrap the member routine. */ - pScreen = pWin->drawable.pScreen; - pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen); - pScreen->PositionWindow = pDbeScreenPriv->PositionWindow; - - /* 2. Do any work necessary before the member routine is called. - * - * In this case we do not need to do anything. - */ - - /* 3. Call the member routine, saving its result if necessary. */ - ret = (*pScreen->PositionWindow)(pWin, x, y); - - /* 4. Rewrap the member routine, restoring the wrapper value first in case - * the wrapper (or something that it wrapped) change this value. - */ - pDbeScreenPriv->PositionWindow = pScreen->PositionWindow; - pScreen->PositionWindow = FFBDbePositionWindow; - - /* 5. Do any work necessary after the member routine has been called. */ - if (!(pDbeWindowPriv = DBE_WINDOW_PRIV(pWin))) - return ret; - - if (pDbeWindowPriv->width == pWin->drawable.width && - pDbeWindowPriv->height == pWin->drawable.height) - return ret; - - width = pWin->drawable.width; - height = pWin->drawable.height; - - dx = pWin->drawable.x - pDbeWindowPriv->x; - dy = pWin->drawable.y - pDbeWindowPriv->y; - dw = width - pDbeWindowPriv->width; - dh = height - pDbeWindowPriv->height; - - GravityTranslate (0, 0, -dx, -dy, dw, dh, pWin->bitGravity, &destx, &desty); - - clear = ((pDbeWindowPriv->width < (unsigned short)width ) || - (pDbeWindowPriv->height < (unsigned short)height) || - (pWin->bitGravity == ForgetGravity)); - - sourcex = 0; - sourcey = 0; - savewidth = pDbeWindowPriv->width; - saveheight = pDbeWindowPriv->height; - - /* Clip rectangle to source and destination. */ - if (destx < 0) { - savewidth += destx; - sourcex -= destx; - destx = 0; - } - - if (destx + savewidth > width) - savewidth = width - destx; - - if (desty < 0) { - saveheight += desty; - sourcey -= desty; - desty = 0; - } - - if (desty + saveheight > height) - saveheight = height - desty; - - pDbeWindowPriv->width = width; - pDbeWindowPriv->height = height; - pDbeWindowPriv->x = pWin->drawable.x; - pDbeWindowPriv->y = pWin->drawable.y; - - pGC = GetScratchGC (pWin->drawable.depth, pScreen); - - if (clear) { - if ((*pDbeScreenPriv->SetupBackgroundPainter)(pWin, pGC)) { - clearRect.x = 0; - clearRect.y = 0; - clearRect.width = width; - clearRect.height = height; - } else { - clear = FALSE; - } - } - - pDbeWindowPrivPriv = FFB_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv); - if (pDbeWindowPrivPriv->HwAccelerated != 0) { - /* If we're hw accelerating, things are much easier. */ - ValidateGC(&pWin->drawable, pGC); - FFBDbeUpdateWidPlane(pWin, pGC); - if (clear) { - CreatorPrivWinPtr pFfbPrivWin = CreatorGetWindowPrivate(pWin); - unsigned int fbc, orig_fbc; - - ValidateGC(&pWin->drawable, pGC); - (*pGC->ops->PolyFillRect)(&pWin->drawable, pGC, - 1, &clearRect); - - orig_fbc = fbc = pFfbPrivWin->fbc_base; - fbc &= ~(FFB_FBC_WB_MASK); - if (pDbeWindowPrivPriv->HwCurrentBuf == 0) - fbc |= FFB_FBC_WB_B; - else - fbc |= FFB_FBC_WB_A; - - pFfbPrivWin->fbc_base = fbc; - - if ((*pDbeScreenPriv->SetupBackgroundPainter)(pWin, pGC)) { - ValidateGC(&pWin->drawable, pGC); - clearRect.x = 0; - clearRect.y = 0; - clearRect.width = width; - clearRect.height = height; - (*pGC->ops->PolyFillRect)(&pWin->drawable, pGC, - 1, &clearRect); - } - - pFfbPrivWin->fbc_base = orig_fbc; - } - - FreeScratchGC(pGC); - } else { - /* Create DBE buffer pixmaps equal to size of resized window. */ - pFrontBuffer = (*pScreen->CreatePixmap)(pScreen, width, height, - pWin->drawable.depth); - - pBackBuffer = (*pScreen->CreatePixmap)(pScreen, width, height, - pWin->drawable.depth); - - if (!pFrontBuffer || !pBackBuffer) { - /* We failed at creating 1 or 2 of the pixmaps. */ - if (pFrontBuffer) - (*pScreen->DestroyPixmap)(pFrontBuffer); - if (pBackBuffer) - (*pScreen->DestroyPixmap)(pBackBuffer); - - /* Destroy all buffers for this window. */ - while (pDbeWindowPriv) { - /* DbeWindowPrivDelete() will free the window private - * if there no more buffer IDs associated with this - * window. - */ - FreeResource(pDbeWindowPriv->IDs[0], RT_NONE); - pDbeWindowPriv = DBE_WINDOW_PRIV(pWin); - } - FreeScratchGC(pGC); - return FALSE; - } else { - /* Clear out the new DBE buffer pixmaps. */ - ValidateGC((DrawablePtr)pFrontBuffer, pGC); - - /* I suppose this could avoid quite a bit of work if - * it computed the minimal area required. - */ - if (clear) { - (*pGC->ops->PolyFillRect)((DrawablePtr)pFrontBuffer, pGC, 1, - &clearRect); - (*pGC->ops->PolyFillRect)((DrawablePtr)pBackBuffer , pGC, 1, - &clearRect); - } - - /* Copy the contents of the old DBE pixmaps to the new pixmaps. */ - if (pWin->bitGravity != ForgetGravity) { - (*pGC->ops->CopyArea)((DrawablePtr)pDbeWindowPrivPriv->pFrontBuffer, - (DrawablePtr)pFrontBuffer, pGC, - sourcex, sourcey, - savewidth, saveheight, - destx, desty); - (*pGC->ops->CopyArea)((DrawablePtr)pDbeWindowPrivPriv->pBackBuffer, - (DrawablePtr)pBackBuffer, pGC, - sourcex, sourcey, - savewidth, saveheight, destx, desty); - } - - /* Destroy the old pixmaps, and point the DBE window priv to the new - * pixmaps. - */ - (*pScreen->DestroyPixmap)(pDbeWindowPrivPriv->pFrontBuffer); - (*pScreen->DestroyPixmap)(pDbeWindowPrivPriv->pBackBuffer); - - pDbeWindowPrivPriv->pFrontBuffer = pFrontBuffer; - pDbeWindowPrivPriv->pBackBuffer = pBackBuffer; - - /* Make sure all XID are associated with the new back pixmap. */ - FFBDbeAliasBuffers(pDbeWindowPriv); - - FreeScratchGC(pGC); - } - } - - return ret; -} - -static void -FFBDbeResetProc(ScreenPtr pScreen) -{ - DbeScreenPrivPtr pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen); - - /* Unwrap wrappers */ - pScreen->PositionWindow = pDbeScreenPriv->PositionWindow; -} - -static Bool -FFBDbeInit(ScreenPtr pScreen, DbeScreenPrivPtr pDbeScreenPriv) -{ - ScrnInfoPtr pScrn; - FFBPtr pFfb; - - pScrn = xf86Screens[pScreen->myNum]; - pFfb = GET_FFB_FROM_SCRN(pScrn); - xf86Msg(X_INFO, "%s: Setting up double-buffer acceleration.\n", - pFfb->psdp->device); - - /* Copy resource types created by DIX */ - dbeDrawableResType = pDbeScreenPriv->dbeDrawableResType; - dbeWindowPrivResType = pDbeScreenPriv->dbeWindowPrivResType; - - /* Copy private indices created by DIX */ - dbeScreenPrivIndex = pDbeScreenPriv->dbeScreenPrivIndex; - dbeWindowPrivIndex = pDbeScreenPriv->dbeWindowPrivIndex; - - /* Reset the window priv privs if generations do not match. */ - if (FFBDbePrivPrivGeneration != serverGeneration) { - /* Allocate the window priv priv. */ - FFBDbeWindowPrivPrivIndex = (*pDbeScreenPriv->AllocWinPrivPrivIndex)(); - - if (!(*pDbeScreenPriv->AllocWinPrivPriv)(pScreen, - FFBDbeWindowPrivPrivIndex, - sizeof(FFBDbeWindowPrivPrivRec))) - return FALSE; - - /* Make sure we only do this code once. */ - FFBDbePrivPrivGeneration = serverGeneration; - } - - /* Wrap functions. */ - pDbeScreenPriv->PositionWindow = pScreen->PositionWindow; - pScreen->PositionWindow = FFBDbePositionWindow; - - /* Initialize the per-screen DBE function pointers. */ - pDbeScreenPriv->GetVisualInfo = FFBDbeGetVisualInfo; - pDbeScreenPriv->AllocBackBufferName = FFBDbeAllocBackBufferName; - pDbeScreenPriv->SwapBuffers = FFBDbeSwapBuffers; - pDbeScreenPriv->BeginIdiom = 0; - pDbeScreenPriv->EndIdiom = 0; - pDbeScreenPriv->ResetProc = FFBDbeResetProc; - pDbeScreenPriv->WinPrivDelete = FFBDbeWinPrivDelete; - - /* The FFB implementation doesn't need buffer validation. */ - pDbeScreenPriv->ValidateBuffer = (void (*)())NoopDDA; - - return TRUE; -} - -extern void DbeRegisterFunction(ScreenPtr pScreen, Bool (*funct)(ScreenPtr, DbeScreenPrivPtr)); - -Bool -FFBDbePreInit(ScreenPtr pScreen) -{ - DbeRegisterFunction(pScreen, FFBDbeInit); - return TRUE; -} diff --git a/src/ffb_dga.c b/src/ffb_dga.c index 257f930..ed5d6ae 100644 --- a/src/ffb_dga.c +++ b/src/ffb_dga.c @@ -36,7 +36,6 @@ #include "ffb_regs.h" #include "ffb_rcache.h" #include "ffb_fifo.h" -#include "ffb_stip.h" #include "ffb_loops.h" static Bool FFB_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **, diff --git a/src/ffb_dri.c b/src/ffb_dri.c index 486edc3..209a9d3 100644 --- a/src/ffb_dri.c +++ b/src/ffb_dri.c @@ -33,11 +33,6 @@ #include "xf86PciInfo.h" #include "xf86Pci.h" -#define PSZ 8 -#include "cfb.h" -#undef PSZ -#include "cfb16.h" -#include "cfb32.h" #include "miline.h" diff --git a/src/ffb_frect.c b/src/ffb_frect.c deleted file mode 100644 index 75c6f24..0000000 --- a/src/ffb_frect.c +++ /dev/null @@ -1,713 +0,0 @@ -/* - * Acceleration for the Creator and Creator3D framebuffer - Rectangle filling. - * - * Copyright (C) 1998,1999 Jakub Jelinek (jakub@redhat.com) - * Copyright (C) 1998 Michal Rehacek (majkl@iname.com) - * Copyright (C) 1999 David S. Miller (davem@redhat.com) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * JAKUB JELINEK, MICHAL REHACEK, OR DAVID MILLER BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - * - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_frect.c,v 1.2 2000/05/23 04:47:44 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "ffb.h" -#include "ffb_regs.h" -#include "ffb_rcache.h" -#include "ffb_fifo.h" -#include "ffb_stip.h" -#include "ffb_loops.h" - -#include "pixmapstr.h" -#include "scrnintstr.h" - -#define PSZ 8 -#include "cfb.h" -#undef PSZ -#include "cfb32.h" - -#define PAGEFILL_DISABLED(pFfb) ((pFfb)->disable_pagefill != 0) -#define FASTFILL_AP_DISABLED(pFfb) ((pFfb)->disable_fastfill_ap != 0) - -void -CreatorFillBoxStipple (DrawablePtr pDrawable, int nBox, BoxPtr pBox, CreatorStipplePtr stipple) -{ - FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen); - WindowPtr pWin = (WindowPtr) pDrawable; - ffb_fbcPtr ffb = pFfb->regs; - unsigned int bits[32]; - unsigned int newalign; - - FFBLOG(("CreatorFillBoxStipple: nbox(%d)\n", nBox)); - newalign = ((pDrawable->y & 31) << 16) | (pDrawable->x & 31); - if (stipple->patalign != newalign) { - int x, y, i; - - x = (pDrawable->x - (stipple->patalign & 0xffff)) & 31; - y = (pDrawable->y - (stipple->patalign >> 16)) & 31; - if (x | y) { - memcpy(bits, stipple->bits, sizeof(bits)); - for (i = 0; i < 32; i++) - stipple->bits[(i + y) & 31] = - (bits[i] >> x) | (bits[i] << (32 - x)); - stipple->inhw = 0; - } - stipple->patalign = newalign; - } - - FFBSetStipple(pFfb, ffb, stipple, - FFB_PPC_APE_DISABLE|FFB_PPC_CS_CONST|FFB_PPC_XS_WID, - FFB_PPC_APE_MASK|FFB_PPC_CS_MASK|FFB_PPC_XS_MASK); - FFB_WRITE_PMASK(pFfb, ffb, ~0); - FFB_WRITE_DRAWOP(pFfb, ffb, FFB_DRAWOP_RECTANGLE); - FFB_WRITE_FBC(pFfb, ffb, FFB_FBC_WIN(pWin)); - FFB_WRITE_WID(pFfb, ffb, FFB_WID_WIN(pWin)); - - while(nBox--) { - register int x, y, w, h; - - x = pBox->x1; - y = pBox->y1; - w = (pBox->x2 - x); - h = (pBox->y2 - y); - FFBFifo(pFfb, 4); - FFB_WRITE64(&ffb->by, y, x); - FFB_WRITE64_2(&ffb->bh, h, w); - pBox++; - } - - pFfb->rp_active = 1; - FFBSync(pFfb, ffb); -} - -enum ffb_fillrect_method { fillrect_page, - fillrect_fast, fillrect_fast_opaque, - fillrect_normal }; - -#define BOX_AREA(__w, __h) ((int)(__w) * (int)(__h)) - -/* Compute the page aligned box for a page mode fast fill. - * In 'ework' this returns greater than zero if there are some odd - * edges to take care of which are outside of the page aligned area. - * It will place less than zero there if the box is too small, - * indicating that a different method must be used to fill it. - */ -#define CreatorPageFillParms(pFfb, ffp, x, y, w, h, px, py, pw, ph, ework) \ -do { int xdiff, ydiff; \ - int pf_bh = ffp->pagefill_height; \ - int pf_bw = ffp->pagefill_width; \ - py = ((y + (pf_bh - 1)) & ~(pf_bh - 1)); \ - ydiff = py - y; \ - px = pFfb->Pf_AlignTab[x + (pf_bw - 1)]; \ - xdiff = px - x; \ - ph = ((h - ydiff) & ~(pf_bh - 1)); \ - if(ph <= 0) \ - ework = -1; \ - else { \ - pw = pFfb->Pf_AlignTab[w - xdiff]; \ - if(pw <= 0) { \ - ework = -1; \ - } else { \ - ework = (((xdiff > 0) || \ - (ydiff > 0) || \ - ((w - pw) > 0) || \ - ((h - ph) > 0))) ? 1 : 0; \ - } \ - } \ -} while(0); - -/* Compute fixups of non-page aligned areas after a page fill. - * Return the number of fixups needed. - */ -static __inline__ int -CreatorComputePageFillFixups(xRectangle *fixups, - int x, int y, int w, int h, - int paligned_x, int paligned_y, - int paligned_w, int paligned_h) -{ - int nfixups = 0; - - /* FastFill Left */ - if(paligned_x != x) { - fixups[nfixups].x = x; - fixups[nfixups].y = paligned_y; - fixups[nfixups].width = paligned_x - x; - fixups[nfixups].height = paligned_h; - nfixups++; - } - /* FastFill Top */ - if(paligned_y != y) { - fixups[nfixups].x = x; - fixups[nfixups].y = y; - fixups[nfixups].width = w; - fixups[nfixups].height = paligned_y - y; - nfixups++; - } - /* FastFill Right */ - if((x+w) != (paligned_x+paligned_w)) { - fixups[nfixups].x = (paligned_x+paligned_w); - fixups[nfixups].y = paligned_y; - fixups[nfixups].width = (x+w) - fixups[nfixups].x; - fixups[nfixups].height = paligned_h; - nfixups++; - } - /* FastFill Bottom */ - if((y+h) != (paligned_y+paligned_h)) { - fixups[nfixups].x = x; - fixups[nfixups].y = (paligned_y+paligned_h); - fixups[nfixups].width = w; - fixups[nfixups].height = (y+h) - fixups[nfixups].y; - nfixups++; - } - return nfixups; -} - -/* Fill a set of boxes, pagefill and fastfill not allowed. */ -static void -CreatorBoxFillNormal(FFBPtr pFfb, - int nbox, BoxPtr pbox) -{ - ffb_fbcPtr ffb = pFfb->regs; - - FFBLOG(("BFNormal: ")); - if(nbox) - FFB_WRITE_DRAWOP(pFfb, ffb, FFB_DRAWOP_RECTANGLE); - while(nbox--) { - register int x, y, w, h; - - x = pbox->x1; - y = pbox->y1; - w = (pbox->x2 - x); - h = (pbox->y2 - y); - pbox++; - FFBLOG(("[%08x:%08x:%08x:%08x] ", x, y, w, h)); - FFBFifo(pFfb, 4); - FFB_WRITE64(&ffb->by, y, x); - FFB_WRITE64_2(&ffb->bh, h, w); - } - FFBLOG(("\n")); -} - -/* Fill a set of boxes, only non-pagemode fastfill is allowed. */ -static void -CreatorBoxFillFast(FFBPtr pFfb, - int nbox, BoxPtr pbox) -{ - ffb_fbcPtr ffb = pFfb->regs; - - FFBLOG(("BFFast: ")); - while(nbox--) { - struct fastfill_parms *ffp = &FFB_FFPARMS(pFfb); - register int x, y, w, h; - - x = pbox->x1; - y = pbox->y1; - w = (pbox->x2 - x); - h = (pbox->y2 - y); - pbox++; - if(BOX_AREA(w, h) < ffp->fastfill_small_area) { - /* Too small for fastfill to be useful. */ - FFBLOG(("NRM(%08x:%08x:%08x:%08x) ", - x, y, w, h)); - FFB_WRITE_DRAWOP(pFfb, ffb, FFB_DRAWOP_RECTANGLE); - FFBFifo(pFfb, 4); - FFB_WRITE64(&ffb->by, y, x); - FFB_WRITE64_2(&ffb->bh, h, w); - } else { - FFBLOG(("FST(%08x:%08x:%08x:%08x:[%08x:%08x]) ", - x, y, w, h, - (w + (x & (ffp->fastfill_width - 1))), - (h + (y & (ffp->fastfill_height - 1))))); - if (pFfb->ffb_res == ffb_res_high && - ((x & 7) != 0 || (w & 7) != 0)) { - FFB_WRITE_DRAWOP(pFfb, ffb, FFB_DRAWOP_RECTANGLE); - if ((x & 7) != 0) { - register int nx = x; - register int nw; - - nw = 8 - (nx & 7); - if (nw > w) - nw = w; - FFBFifo(pFfb, 4); - FFB_WRITE64(&ffb->by, y, nx); - FFB_WRITE64_2(&ffb->bh, h, nw); - x += nw; - w -= nw; - } - if ((w & 7) != 0) { - register int nx, nw; - - nw = (w & 7); - nx = x + (w - nw); - FFBFifo(pFfb, 4); - FFB_WRITE64(&ffb->by, y, nx); - FFB_WRITE64_2(&ffb->bh, h, nw); - w -= nw; - } - if (w <= 0) - goto next_rect; - } - FFB_WRITE_DRAWOP(pFfb, ffb, FFB_DRAWOP_FASTFILL); - FFBFifo(pFfb, 10); - ffb->by = FFB_FASTFILL_COLOR_BLK; - FFB_WRITE64(&ffb->dy, 0, 0); - FFB_WRITE64_2(&ffb->bh, - ffp->fastfill_height, - (ffp->fastfill_width * 4)); - FFB_WRITE64_3(&ffb->dy, y, x); - ffb->bh = (h + (y & (ffp->fastfill_height - 1))); - FFB_WRITE64(&ffb->by, FFB_FASTFILL_BLOCK, - (w + (x & (ffp->fastfill_width - 1)))); - } - next_rect: - ; - } - FFBLOG(("\n")); -} - -/* Fill a set of boxes, any fastfill method is allowed. */ -static void -CreatorBoxFillPage(FFBPtr pFfb, - int nbox, BoxPtr pbox) -{ - ffb_fbcPtr ffb = pFfb->regs; - - FFBLOG(("BFPage: ")); - while(nbox--) { - struct fastfill_parms *ffp = &FFB_FFPARMS(pFfb); - register int x, y, w, h; - - x = pbox->x1; - y = pbox->y1; - w = (pbox->x2 - x); - h = (pbox->y2 - y); - pbox++; - if(BOX_AREA(w, h) < ffp->fastfill_small_area) { - /* Too small for fastfill or page fill to be useful. */ - FFBLOG(("NRM(%08x:%08x:%08x:%08x) ", - x, y, w, h)); - FFB_WRITE_DRAWOP(pFfb, ffb, FFB_DRAWOP_RECTANGLE); - FFBFifo(pFfb, 4); - FFB_WRITE64(&ffb->by, y, x); - FFB_WRITE64_2(&ffb->bh, h, w); - } else { - int paligned_y, paligned_x; - int paligned_h, paligned_w = 0; - int extra_work; - - if (pFfb->ffb_res == ffb_res_high && - ((x & 7) != 0 || (w & 7) != 0)) { - FFB_WRITE_DRAWOP(pFfb, ffb, FFB_DRAWOP_RECTANGLE); - if ((x & 7) != 0) { - register int nx = x; - register int nw; - - nw = 8 - (nx & 7); - if (nw > w) - nw = w; - FFBFifo(pFfb, 4); - FFB_WRITE64(&ffb->by, y, nx); - FFB_WRITE64_2(&ffb->bh, h, nw); - x += nw; - w -= nw; - } - if ((w & 7) != 0) { - register int nx, nw; - - nw = (w & 7); - nx = x + (w - nw); - FFBFifo(pFfb, 4); - FFB_WRITE64(&ffb->by, y, nx); - FFB_WRITE64_2(&ffb->bh, h, nw); - w -= nw; - } - if (w <= 0) - goto next_rect; - } - - FFB_WRITE_DRAWOP(pFfb, ffb, FFB_DRAWOP_FASTFILL); - if((w < (ffp->pagefill_width<<1)) || - (h < (ffp->pagefill_height<<1))) - goto do_fastfill; - - CreatorPageFillParms(pFfb, ffp, - x, y, w, h, - paligned_x, paligned_y, - paligned_w, paligned_h, extra_work); - - /* See if the aligned area is large enough for - * page fill to be worthwhile. - */ - if(extra_work < 0 || - BOX_AREA(paligned_w, paligned_h) < ffp->pagefill_small_area) { - do_fastfill: - FFBLOG(("FST(%08x:%08x:%08x:%08x:[%08x:%08x]) ", - x, y, w, h, - (w + (x & (ffp->fastfill_width - 1))), - (h + (y & (ffp->fastfill_height - 1))))); - FFBFifo(pFfb, 10); - ffb->by = FFB_FASTFILL_COLOR_BLK; - FFB_WRITE64(&ffb->dy, 0, 0); - FFB_WRITE64_2(&ffb->bh, - ffp->fastfill_height, - (ffp->fastfill_width * 4)); - FFB_WRITE64_3(&ffb->dy, y, x); - ffb->bh = (h + (y & (ffp->fastfill_height - 1))); - FFB_WRITE64(&ffb->by, FFB_FASTFILL_BLOCK, - (w + (x & (ffp->fastfill_width - 1)))); - } else { - /* Ok, page fill is worth it, let it rip. */ - FFBLOG(("PAG(%08x:%08x:%08x:%08x) ", - paligned_x, paligned_y, paligned_w, paligned_h)); - FFBFifo(pFfb, 15); - ffb->by = FFB_FASTFILL_COLOR_BLK; - FFB_WRITE64(&ffb->dy, 0, 0); - FFB_WRITE64_2(&ffb->bh, ffp->fastfill_height, (ffp->fastfill_width * 4)); - ffb->by = FFB_FASTFILL_BLOCK_X; - FFB_WRITE64(&ffb->dy, 0, 0); - FFB_WRITE64_2(&ffb->bh, ffp->pagefill_height, (ffp->pagefill_width * 4)); - FFB_WRITE64_3(&ffb->dy, paligned_y, paligned_x); - ffb->bh = paligned_h; - FFB_WRITE64(&ffb->by, FFB_FASTFILL_PAGE, paligned_w); - - if(extra_work) { - register int nfixups; - - /* Ok, we're going to do at least one fixup. */ - nfixups = CreatorComputePageFillFixups(pFfb->Pf_Fixups, - x, y, w, h, - paligned_x, paligned_y, - paligned_w, paligned_h); - - /* NOTE: For the highres case we have already - * aligned the outermost X and W coordinates. - * Therefore we can be assured that the fixup - * X and W coordinates below will be 8 pixel - * aligned as well. Do the math, it works. -DaveM - */ - - FFBFifo(pFfb, 5 + (nfixups * 5)); - ffb->by = FFB_FASTFILL_COLOR_BLK; - FFB_WRITE64(&ffb->dy, 0, 0); - FFB_WRITE64_2(&ffb->bh, ffp->fastfill_height, (ffp->fastfill_width * 4)); - - while(--nfixups >= 0) { - register int xx, yy, ww, hh; - - xx = pFfb->Pf_Fixups[nfixups].x; - yy = pFfb->Pf_Fixups[nfixups].y; - FFB_WRITE64(&ffb->dy, yy, xx); - ww = (pFfb->Pf_Fixups[nfixups].width + - (xx & (ffp->fastfill_width - 1))); - hh = (pFfb->Pf_Fixups[nfixups].height + - (yy & (ffp->fastfill_height - 1))); - FFBLOG(("FIXUP(%08x:%08x:%08x:%08x) ", - xx, yy, ww, hh)); - if(nfixups != 0) { - ffb->by = FFB_FASTFILL_BLOCK; - FFB_WRITE64_2(&ffb->bh, hh, ww); - } else { - ffb->bh = hh; - FFB_WRITE64(&ffb->by, FFB_FASTFILL_BLOCK, ww); - } - } - } - } - } - next_rect: - ; - } - FFBLOG(("\n")); -} - -void -CreatorFillBoxSolid (DrawablePtr pDrawable, int nBox, BoxPtr pBox, unsigned long pixel) -{ - FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen); - WindowPtr pWin = (WindowPtr) pDrawable; - - FFBLOG(("CreatorFillBoxSolid: nbox(%d)\n", nBox)); - FFB_ATTR_FFWIN(pFfb, pWin, - FFB_PPC_APE_DISABLE | FFB_PPC_CS_CONST, - pixel); - if (PAGEFILL_DISABLED(pFfb)) - CreatorBoxFillNormal(pFfb, nBox, pBox); - else - CreatorBoxFillPage(pFfb, nBox, pBox); - - pFfb->rp_active = 1; - FFBSync(pFfb, pFfb->regs); -} - -static void -FFBSetStippleFast(FFBPtr pFfb, ffb_fbcPtr ffb, - CreatorStipplePtr stipple, - unsigned int ppc, unsigned int ppc_mask) -{ - ppc |= FFB_PPC_APE_ENABLE | FFB_PPC_TBE_TRANSPARENT | FFB_PPC_XS_WID; - ppc_mask |= FFB_PPC_APE_MASK | FFB_PPC_TBE_MASK | FFB_PPC_XS_MASK; - FFB_WRITE_PPC(pFfb, ffb, ppc, ppc_mask); - FFB_WRITE_ROP(pFfb, ffb, (FFB_ROP_EDIT_BIT|stipple->alu)|(FFB_ROP_NEW<<8)); - FFB_WRITE_FG(pFfb, ffb, stipple->fg); - FFBFifo(pFfb, 32); - FFB_STIPPLE_LOAD(&ffb->pattern[0], &stipple->bits[0]); -} - -static void -FFBSetStippleFastIdentity(FFBPtr pFfb, - ffb_fbcPtr ffb, - CreatorStipplePtr stipple) -{ - int i; - - FFB_WRITE_FG(pFfb, ffb, stipple->bg); - FFBFifo(pFfb, 32); - for(i = 0; i < 32; i++) - ffb->pattern[i] = ~stipple->bits[i]; - stipple->inhw = 0; - pFfb->laststipple = NULL; -} - -void -CreatorPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, xRectangle *prectInit) -{ - FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen); - ffb_fbcPtr ffb = pFfb->regs; - xRectangle *prect; - RegionPtr prgnClip; - register BoxPtr pbox; - register BoxPtr pboxClipped; - BoxPtr pboxClippedBase; - BoxPtr pextent; - CreatorPrivGCPtr gcPriv; - int numRects; - int n; - int xorg, yorg; - - /* No garbage please. */ - if (nrectFill <= 0) - return; - - gcPriv = CreatorGetGCPrivate (pGC); - FFBLOG(("CreatorPolyFillRect: nrect(%d) ALU(%x) STIP(%p) pmsk(%08x)\n", - nrectFill, pGC->alu, gcPriv->stipple, pGC->planemask)); - prgnClip = cfbGetCompositeClip(pGC); - prect = prectInit; - xorg = pDrawable->x; - yorg = pDrawable->y; - if (xorg || yorg) { - prect = prectInit; - n = nrectFill; - while (n--) { - prect->x += xorg; - prect->y += yorg; - prect++; - } - } - - prect = prectInit; - numRects = REGION_NUM_RECTS (prgnClip) * nrectFill; - if (numRects > 64) { - pboxClippedBase = (BoxPtr)ALLOCATE_LOCAL(numRects * sizeof(BoxRec)); - if (!pboxClippedBase) - return; - } else - pboxClippedBase = pFfb->ClippedBoxBuf; - - pboxClipped = pboxClippedBase; - if (REGION_NUM_RECTS(prgnClip) == 1) { - int x1, y1, x2, y2, bx2, by2; - - pextent = REGION_RECTS(prgnClip); - x1 = pextent->x1; - y1 = pextent->y1; - x2 = pextent->x2; - y2 = pextent->y2; - while (nrectFill--) { - if ((pboxClipped->x1 = prect->x) < x1) - pboxClipped->x1 = x1; - - if ((pboxClipped->y1 = prect->y) < y1) - pboxClipped->y1 = y1; - - bx2 = (int) prect->x + (int) prect->width; - if (bx2 > x2) - bx2 = x2; - pboxClipped->x2 = bx2; - - by2 = (int) prect->y + (int) prect->height; - if (by2 > y2) - by2 = y2; - pboxClipped->y2 = by2; - - prect++; - if ((pboxClipped->x1 < pboxClipped->x2) && - (pboxClipped->y1 < pboxClipped->y2)) - pboxClipped++; - } - } else { - int x1, y1, x2, y2, bx2, by2; - - pextent = REGION_EXTENTS(pGC->pScreen, prgnClip); - x1 = pextent->x1; - y1 = pextent->y1; - x2 = pextent->x2; - y2 = pextent->y2; - while (nrectFill--) { - BoxRec box; - - if ((box.x1 = prect->x) < x1) - box.x1 = x1; - - if ((box.y1 = prect->y) < y1) - box.y1 = y1; - - bx2 = (int) prect->x + (int) prect->width; - if (bx2 > x2) - bx2 = x2; - box.x2 = bx2; - - by2 = (int) prect->y + (int) prect->height; - if (by2 > y2) - by2 = y2; - box.y2 = by2; - - prect++; - - if ((box.x1 >= box.x2) || (box.y1 >= box.y2)) - continue; - - n = REGION_NUM_RECTS (prgnClip); - pbox = REGION_RECTS(prgnClip); - - /* Clip the rectangle to each box in the clip region - * this is logically equivalent to calling Intersect() - */ - while(n--) { - pboxClipped->x1 = max(box.x1, pbox->x1); - pboxClipped->y1 = max(box.y1, pbox->y1); - pboxClipped->x2 = min(box.x2, pbox->x2); - pboxClipped->y2 = min(box.y2, pbox->y2); - pbox++; - - /* see if clipping left anything */ - if(pboxClipped->x1 < pboxClipped->x2 && - pboxClipped->y1 < pboxClipped->y2) - pboxClipped++; - } - } - } - /* Now fill the pre-clipped boxes. */ - if(pboxClipped != pboxClippedBase) { - enum ffb_fillrect_method how = fillrect_page; - int num = (pboxClipped - pboxClippedBase); - int f_w = pboxClippedBase->x2 - pboxClippedBase->x1; - int f_h = pboxClippedBase->y2 - pboxClippedBase->y1; - WindowPtr pWin = (WindowPtr) pDrawable; - unsigned int fbc = FFB_FBC_WIN(pWin); - unsigned int drawop = FFB_DRAWOP_FASTFILL; - - if (PAGEFILL_DISABLED(pFfb) || - pGC->alu != GXcopy || - BOX_AREA(f_w, f_h) < 128) { - drawop = FFB_DRAWOP_RECTANGLE; - how = fillrect_normal; - } else if (gcPriv->stipple != NULL) { - if (FASTFILL_AP_DISABLED(pFfb)) { - drawop = FFB_DRAWOP_RECTANGLE; - how = fillrect_normal; - } else { - if ((gcPriv->stipple->alu & FFB_ROP_EDIT_BIT) != 0) - how = fillrect_fast; - else - how = fillrect_fast_opaque; - } - } else { - int all_planes; - - /* Plane masks are not controllable with page fills. */ - if (pGC->depth == 8) - all_planes = 0xff; - else - all_planes = 0xffffff; - if ((pGC->planemask & all_planes) != all_planes) - how = fillrect_fast; - } - - if (how == fillrect_page) { - fbc &= ~(FFB_FBC_XE_MASK | FFB_FBC_RGBE_MASK); - fbc |= FFB_FBC_XE_ON | FFB_FBC_RGBE_ON; - } - - /* In the high-resolution modes, the Creator3D transforms - * the framebuffer such that the dual-buffers present become - * one large single buffer. As such you need to enable both - * A and B write buffers for page/fast fills to work properly - * under this configuration. -DaveM - */ - if (pFfb->ffb_res == ffb_res_high) - fbc |= FFB_FBC_WB_B; - - /* Setup the attributes. */ - if (gcPriv->stipple == NULL) { - FFB_ATTR_RAW(pFfb, - FFB_PPC_APE_DISABLE|FFB_PPC_CS_CONST|FFB_PPC_XS_WID, - FFB_PPC_APE_MASK|FFB_PPC_CS_MASK|FFB_PPC_XS_MASK, - pGC->planemask, - ((FFB_ROP_EDIT_BIT|pGC->alu)|(FFB_ROP_NEW<<8)), - drawop, - pGC->fgPixel, - fbc, FFB_WID_WIN(pWin)); - } else { - if (how == fillrect_fast_opaque) { - FFBSetStippleFast(pFfb, ffb, gcPriv->stipple, - FFB_PPC_CS_CONST|FFB_PPC_XS_WID, - FFB_PPC_CS_MASK|FFB_PPC_XS_MASK); - } else { - FFBSetStipple(pFfb, ffb, gcPriv->stipple, - FFB_PPC_CS_CONST|FFB_PPC_XS_WID, - FFB_PPC_CS_MASK|FFB_PPC_XS_MASK); - } - FFB_WRITE_DRAWOP(pFfb, ffb, drawop); - FFB_WRITE_FBC(pFfb, ffb, fbc); - FFB_WRITE_WID(pFfb, ffb, FFB_WID_WIN(pWin)); - } - - /* Now render. */ - if(how == fillrect_normal) - CreatorBoxFillNormal(pFfb, num, pboxClippedBase); - else if(how == fillrect_fast || how == fillrect_fast_opaque) - CreatorBoxFillFast(pFfb, num, pboxClippedBase); - else - CreatorBoxFillPage(pFfb, num, pboxClippedBase); - - if(how == fillrect_fast_opaque) { - FFBSetStippleFastIdentity(pFfb, ffb, gcPriv->stipple); - CreatorBoxFillFast(pFfb, num, pboxClippedBase); - } - - pFfb->rp_active = 1; - FFBSync(pFfb, ffb); - } - if (pboxClippedBase != pFfb->ClippedBoxBuf) - DEALLOCATE_LOCAL (pboxClippedBase); -} diff --git a/src/ffb_fspans.c b/src/ffb_fspans.c deleted file mode 100644 index 2f505b5..0000000 --- a/src/ffb_fspans.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Acceleration for the Creator and Creator3D framebuffer - Fill spans. - * - * Copyright (C) 1998,1999 Jakub Jelinek (jakub@redhat.com) - * Copyright (C) 1999 David S. Miller (davem@redhat.com) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * JAKUB JELINEK OR DAVID MILLER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_fspans.c,v 1.1 2000/05/18 23:21:36 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "ffb.h" -#include "ffb_regs.h" -#include "ffb_rcache.h" -#include "ffb_fifo.h" -#include "ffb_stip.h" -#include "ffb_loops.h" - -#include "pixmapstr.h" -#include "scrnintstr.h" - -#include "mi.h" -#include "mispans.h" - -#define PSZ 8 -#include "cfb.h" -#undef PSZ -#include "cfb32.h" - -void -CreatorFillSpans (DrawablePtr pDrawable, GCPtr pGC, - int n, DDXPointPtr ppt, - int *pwidth, int fSorted) -{ - WindowPtr pWin = (WindowPtr) pDrawable; - CreatorPrivGCPtr gcPriv = CreatorGetGCPrivate (pGC); - FFBPtr pFfb = GET_FFB_FROM_SCREEN (pGC->pScreen); - ffb_fbcPtr ffb = pFfb->regs; - int *pwidthFree; - DDXPointPtr pptFree; - RegionPtr clip = cfbGetCompositeClip(pGC); - int nTmp = n * miFindMaxBand(clip); - - FFBLOG(("CreatorFillSpans: n(%d) fsorted(%d)\n", n, fSorted)); - pwidthFree = (int *)ALLOCATE_LOCAL(nTmp * sizeof(int)); - pptFree = (DDXPointRec *)ALLOCATE_LOCAL(nTmp * sizeof(DDXPointRec)); - if (!pptFree || !pwidthFree) { - if (pptFree) DEALLOCATE_LOCAL(pptFree); - if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree); - return; - } - n = miClipSpans(clip, - ppt, pwidth, n, - pptFree, pwidthFree, fSorted); - pwidth = pwidthFree; - ppt = pptFree; - if(gcPriv->stipple == NULL) { - FFB_ATTR_GC(pFfb, pGC, pWin, - FFB_PPC_APE_DISABLE | FFB_PPC_CS_CONST, - FFB_DRAWOP_BRLINEOPEN); - } else { - unsigned int fbc; - - FFBSetStipple(pFfb, ffb, gcPriv->stipple, - FFB_PPC_CS_CONST, FFB_PPC_CS_MASK); - FFB_WRITE_PMASK(pFfb, ffb, pGC->planemask); - FFB_WRITE_DRAWOP(pFfb, ffb, FFB_DRAWOP_BRLINEOPEN); - fbc = FFB_FBC_WIN(pWin); - fbc = (fbc & ~FFB_FBC_XE_MASK) | FFB_FBC_XE_OFF; - FFB_WRITE_FBC(pFfb, ffb, fbc); - } - FFBFifo(pFfb, 1); - ffb->lpat = 0; - - if (pFfb->has_brline_bug) { - while(n--) { - register int x, y, w; - - x = ppt->x; - y = ppt->y; - w = *pwidth++; - FFBFifo(pFfb, 5); - ffb->ppc = 0; - FFB_WRITE64(&ffb->by, y, x); - FFB_WRITE64_2(&ffb->bh, y, (x + w)); - ppt++; - } - } else { - while(n--) { - register int x, y, w; - - x = ppt->x; - y = ppt->y; - w = *pwidth++; - FFBFifo(pFfb, 4); - FFB_WRITE64(&ffb->by, y, x); - FFB_WRITE64_2(&ffb->bh, y, (x + w)); - ppt++; - } - } - - DEALLOCATE_LOCAL(pptFree); - DEALLOCATE_LOCAL(pwidthFree); - pFfb->rp_active = 1; - FFBSync(pFfb, ffb); -} diff --git a/src/ffb_gc.c b/src/ffb_gc.c deleted file mode 100644 index 7fa34a4..0000000 --- a/src/ffb_gc.c +++ /dev/null @@ -1,758 +0,0 @@ -/* - * Acceleration for the Creator and Creator3D framebuffer - GC implementation. - * - * Copyright (C) 1998,1999,2000 Jakub Jelinek (jakub@redhat.com) - * Copyright (C) 1998 Michal Rehacek (majkl@iname.com) - * Copyright (C) 1999 David S. Miller (davem@redhat.com) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * JAKUB JELINEK, MICHAL REHACEK, OR DAVID MILLER BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - * - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_gc.c,v 1.2 2000/05/23 04:47:44 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "ffb.h" -#include "ffb_regs.h" -#include "ffb_rcache.h" -#include "ffb_fifo.h" -#include "ffb_loops.h" -#include "ffb_gc.h" - -#include "scrnintstr.h" -#include "pixmapstr.h" -#include -#include "dixfontstr.h" - -#define PSZ 8 -#include "cfb.h" -#undef PSZ -#include "cfb32.h" - -#include "migc.h" -#include "mi.h" -#include "mispans.h" - -GCOps CreatorTEOps1Rect8 = { - CreatorFillSpans, - CreatorSetSpans, - cfbPutImage, - CreatorCopyArea, - CreatorCopyPlane, - CreatorPolyPoint, - CreatorPolylines, - CreatorPolySegment, - miPolyRectangle, - CreatorZeroPolyArc, - CreatorFillPolygon, - CreatorPolyFillRect, - CreatorPolyFillArcSolid, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - CreatorTEGlyphBlt, - CreatorPolyTEGlyphBlt, - miPushPixels -#ifdef NEED_LINEHELPER - ,NULL -#endif -}; - -GCOps CreatorTEOps1Rect32 = { - CreatorFillSpans, - CreatorSetSpans, - cfb32PutImage, - CreatorCopyArea, - CreatorCopyPlane, - CreatorPolyPoint, - CreatorPolylines, - CreatorPolySegment, - miPolyRectangle, - CreatorZeroPolyArc, - CreatorFillPolygon, - CreatorPolyFillRect, - CreatorPolyFillArcSolid, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - CreatorTEGlyphBlt, - CreatorPolyTEGlyphBlt, - miPushPixels -#ifdef NEED_LINEHELPER - ,NULL -#endif -}; - -GCOps CreatorTEOps8 = { - CreatorFillSpans, - CreatorSetSpans, - cfbPutImage, - CreatorCopyArea, - CreatorCopyPlane, - CreatorPolyPoint, - CreatorLineSSStub, - CreatorSegmentSSStub, - miPolyRectangle, - CreatorZeroPolyArc, - CreatorFillPolygon, - CreatorPolyFillRect, - CreatorPolyFillArcSolid, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - CreatorTEGlyphBlt, - CreatorPolyTEGlyphBlt, - miPushPixels -#ifdef NEED_LINEHELPER - ,NULL -#endif -}; - -GCOps CreatorTEOps32 = { - CreatorFillSpans, - CreatorSetSpans, - cfb32PutImage, - CreatorCopyArea, - CreatorCopyPlane, - CreatorPolyPoint, - CreatorLineSSStub, - CreatorSegmentSSStub, - miPolyRectangle, - CreatorZeroPolyArc, - CreatorFillPolygon, - CreatorPolyFillRect, - CreatorPolyFillArcSolid, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - CreatorTEGlyphBlt, - CreatorPolyTEGlyphBlt, - miPushPixels -#ifdef NEED_LINEHELPER - ,NULL -#endif -}; - -GCOps CreatorNonTEOps1Rect8 = { - CreatorFillSpans, - CreatorSetSpans, - cfbPutImage, - CreatorCopyArea, - CreatorCopyPlane, - CreatorPolyPoint, - CreatorPolylines, - CreatorPolySegment, - miPolyRectangle, - CreatorZeroPolyArc, - CreatorFillPolygon, - CreatorPolyFillRect, - CreatorPolyFillArcSolid, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - miImageGlyphBlt, - CreatorPolyGlyphBlt, - miPushPixels -#ifdef NEED_LINEHELPER - ,NULL -#endif -}; - -GCOps CreatorNonTEOps1Rect32 = { - CreatorFillSpans, - CreatorSetSpans, - cfb32PutImage, - CreatorCopyArea, - CreatorCopyPlane, - CreatorPolyPoint, - CreatorPolylines, - CreatorPolySegment, - miPolyRectangle, - CreatorZeroPolyArc, - CreatorFillPolygon, - CreatorPolyFillRect, - CreatorPolyFillArcSolid, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - miImageGlyphBlt, - CreatorPolyGlyphBlt, - miPushPixels -#ifdef NEED_LINEHELPER - ,NULL -#endif -}; - -GCOps CreatorNonTEOps8 = { - CreatorFillSpans, - CreatorSetSpans, - cfbPutImage, - CreatorCopyArea, - CreatorCopyPlane, - CreatorPolyPoint, - CreatorLineSSStub, - CreatorSegmentSSStub, - miPolyRectangle, - CreatorZeroPolyArc, - CreatorFillPolygon, - CreatorPolyFillRect, - CreatorPolyFillArcSolid, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - miImageGlyphBlt, - CreatorPolyGlyphBlt, - miPushPixels -#ifdef NEED_LINEHELPER - ,NULL -#endif -}; - -GCOps CreatorNonTEOps32 = { - CreatorFillSpans, - CreatorSetSpans, - cfb32PutImage, - CreatorCopyArea, - CreatorCopyPlane, - CreatorPolyPoint, - CreatorLineSSStub, - CreatorSegmentSSStub, - miPolyRectangle, - CreatorZeroPolyArc, - CreatorFillPolygon, - CreatorPolyFillRect, - CreatorPolyFillArcSolid, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - miImageGlyphBlt, - CreatorPolyGlyphBlt, - miPushPixels -#ifdef NEED_LINEHELPER - ,NULL -#endif -}; - -#define FONTWIDTH(font) (FONTMAXBOUNDS(font,rightSideBearing) - \ - FONTMINBOUNDS(font,leftSideBearing)) -#define FONTHEIGHT(font) (FONTMAXBOUNDS(font,ascent) + \ - FONTMINBOUNDS(font,descent)) - -static GCOps * -CreatorMatchCommon (GCPtr pGC, cfbPrivGCPtr devPriv) -{ - int depth = pGC->depth; - - if (pGC->lineWidth != 0) return 0; - if (pGC->lineStyle != LineSolid) return 0; - if (pGC->fillStyle != FillSolid) return 0; - if (devPriv->rop != GXcopy) return 0; - if (pGC->font && - FONTWIDTH (pGC->font) <= 32 && - FONTHEIGHT (pGC->font) <= 100 && - FONTMINBOUNDS(pGC->font,characterWidth) >= 0) { - if (TERMINALFONT(pGC->font)) { - if (devPriv->oneRect) { - return (depth == 8 ? - &CreatorTEOps1Rect8 : - &CreatorTEOps1Rect32); - } else { - return (depth == 8 ? - &CreatorTEOps8 : - &CreatorTEOps32); - } - } else { - if (devPriv->oneRect) { - return (depth == 8 ? - &CreatorNonTEOps1Rect8 : - &CreatorNonTEOps1Rect32); - } else { - return (depth == 8 ? - &CreatorNonTEOps8 : - &CreatorNonTEOps32); - } - } - } - return 0; -} - -static void -CreatorDestroyGC (GCPtr pGC) -{ - CreatorPrivGCPtr gcPriv = CreatorGetGCPrivate (pGC); - - if (gcPriv->stipple) - xfree (gcPriv->stipple); - miDestroyGC (pGC); -} - -static __inline__ void -CreatorNewLine(GCPtr pGC, cfbPrivGCPtr devPriv, CreatorPrivGCPtr gcPriv, int accel) -{ - pGC->ops->FillPolygon = miFillPolygon; - pGC->ops->PolyRectangle = miPolyRectangle; - if (pGC->lineWidth == 0) - pGC->ops->PolyArc = miZeroPolyArc; - else - pGC->ops->PolyArc = miPolyArc; - if (accel) { - pGC->ops->FillPolygon = CreatorFillPolygon; - if (pGC->lineWidth == 0 && pGC->capStyle != CapNotLast) - pGC->ops->PolyArc = CreatorZeroPolyArc; - } - pGC->ops->PolySegment = miPolySegment; - gcPriv->linepat = 0; - - /* Segment and Line ops are only accelerated if there is - * one clipping region. - */ - if (accel && !devPriv->oneRect) - accel = 0; - - if (pGC->lineStyle == LineSolid) { - if(pGC->lineWidth == 0) { - if (pGC->fillStyle == FillSolid) { - pGC->ops->Polylines = CreatorLineSSStub; - pGC->ops->PolySegment = CreatorSegmentSSStub; - } else - pGC->ops->Polylines = miZeroLine; - if (accel) { - gcPriv->PolySegment = pGC->ops->PolySegment; - gcPriv->Polylines = pGC->ops->Polylines; - pGC->ops->PolySegment = CreatorPolySegment; - pGC->ops->Polylines = CreatorPolylines; - } - } else { - pGC->ops->Polylines = miWideLine; - } - } else if(pGC->lineStyle == LineOnOffDash) { - if (pGC->lineWidth == 0 && pGC->fillStyle == FillSolid) { - pGC->ops->Polylines = CreatorLineSDStub; - pGC->ops->PolySegment = CreatorSegmentSDStub; - if(accel && - CreatorCheckLinePattern(pGC, gcPriv)) { - gcPriv->PolySegment = pGC->ops->PolySegment; - gcPriv->Polylines = pGC->ops->Polylines; - pGC->ops->PolySegment = CreatorPolySegment; - pGC->ops->Polylines = CreatorPolylines; - } - } else { - pGC->ops->Polylines = miWideDash; - } - } else if(pGC->lineStyle == LineDoubleDash) { - if (pGC->lineWidth == 0 && pGC->fillStyle == FillSolid) { - pGC->ops->Polylines = CreatorLineSDStub; - pGC->ops->PolySegment = CreatorSegmentSDStub; - } else { - pGC->ops->Polylines = miWideDash; - } - } -} - -static __inline__ void -CreatorNewGlyph(GCPtr pGC, CreatorPrivGCPtr gcPriv) -{ - if (FONTWIDTH(pGC->font) > 32 || - FONTHEIGHT(pGC->font) > 100 || - FONTMINBOUNDS(pGC->font,characterWidth) < 0) { - pGC->ops->PolyGlyphBlt = miPolyGlyphBlt; - pGC->ops->ImageGlyphBlt = miImageGlyphBlt; - } else { - if (pGC->fillStyle == FillSolid) { - if (TERMINALFONT (pGC->font)) { - pGC->ops->PolyGlyphBlt = CreatorPolyTEGlyphBlt; - } else { - pGC->ops->PolyGlyphBlt = CreatorPolyGlyphBlt; - } - } else { - pGC->ops->PolyGlyphBlt = miPolyGlyphBlt; - } - - /* special case ImageGlyphBlt for terminal emulator fonts */ - if (TERMINALFONT(pGC->font)) - pGC->ops->ImageGlyphBlt = CreatorTEGlyphBlt; - else - pGC->ops->ImageGlyphBlt = miImageGlyphBlt; - } -} - -static __inline__ void -CreatorNewFillSpans(GCPtr pGC, cfbPrivGCPtr devPriv, CreatorPrivGCPtr gcPriv, int accel) -{ - if (pGC->fillStyle == FillSolid) { - pGC->ops->FillSpans = CreatorSolidSpansGeneralStub; - } else if(pGC->fillStyle == FillTiled) { - if (pGC->pRotatedPixmap) { - int pmsk = (pGC->depth == 8 ? 0xff : 0xffffff); - if (pGC->alu == GXcopy && (pGC->planemask & pmsk) == pmsk) - pGC->ops->FillSpans = CreatorTile32FSCopyStub; - else - pGC->ops->FillSpans = CreatorTile32FSGeneralStub; - } else - pGC->ops->FillSpans = CreatorUnnaturalTileFSStub; - } else if(pGC->fillStyle == FillStippled) { - if (pGC->pRotatedPixmap) - pGC->ops->FillSpans = Creator8Stipple32FSStub; - else - pGC->ops->FillSpans = CreatorUnnaturalStippleFSStub; - } else if(pGC->fillStyle == FillOpaqueStippled) { - if (pGC->pRotatedPixmap) - pGC->ops->FillSpans = Creator8OpaqueStipple32FSStub; - else - pGC->ops->FillSpans = CreatorUnnaturalStippleFSStub; - } else - FatalError("CreatorValidateGC: illegal fillStyle\n"); - if (accel) - pGC->ops->FillSpans = CreatorFillSpans; -} - -static __inline__ void -CreatorNewFillArea(GCPtr pGC, cfbPrivGCPtr devPriv, CreatorPrivGCPtr gcPriv, int accel) -{ - if (accel) { - pGC->ops->PolyFillRect = CreatorPolyFillRect; - pGC->ops->PolyFillArc = CreatorPolyFillArcSolid; - } else { - pGC->ops->PolyFillRect = miPolyFillRect; - if(pGC->fillStyle == FillSolid || pGC->fillStyle == FillTiled) - pGC->ops->PolyFillRect = CreatorPolyFillRectStub; - pGC->ops->PolyFillArc = miPolyFillArc; - } - pGC->ops->PushPixels = mfbPushPixels; -} - -void -CreatorValidateGC (GCPtr pGC, unsigned long changes, DrawablePtr pDrawable) -{ - int mask; /* stateChanges */ - int new_rrop; - int new_line, new_text, new_fillspans, new_fillarea; - int new_rotate; - int xrot, yrot; - /* flags for changing the proc vector */ - cfbPrivGCPtr devPriv; - CreatorPrivGCPtr gcPriv; - int oneRect, type; - int accel, drawableChanged; - FFBPtr pFfb = GET_FFB_FROM_SCREEN(pDrawable->pScreen); - - gcPriv = CreatorGetGCPrivate (pGC); - type = pFfb->vtSema ? -1 : pDrawable->type; - if (type != DRAWABLE_WINDOW) { - if (gcPriv->type == DRAWABLE_WINDOW) { - extern GCOps cfbNonTEOps; - extern GCOps cfb32NonTEOps; - - miDestroyGCOps (pGC->ops); - - if (pGC->depth == 8) - pGC->ops = &cfbNonTEOps; - else - pGC->ops = &cfb32NonTEOps; - - changes = (1 << (GCLastBit+1)) - 1; - pGC->stateChanges = changes; - gcPriv->type = type; - } - if (pGC->depth == 8) - cfbValidateGC (pGC, changes, pDrawable); - else - cfb32ValidateGC (pGC, changes, pDrawable); - - /* Our high speed VIS copyarea can - * be used on pixmaps too. - * But don't clobber someones ops prototype!! - */ - if (!pGC->ops->devPrivate.val) { - pGC->ops = miCreateGCOps(pGC->ops); - pGC->ops->devPrivate.val = 1; - } - pGC->ops->CopyArea = CreatorCopyArea; - return; - } - - if (gcPriv->type != DRAWABLE_WINDOW) { - changes = (1 << (GCLastBit+1)) - 1; - gcPriv->type = DRAWABLE_WINDOW; - } - - new_rotate = pGC->lastWinOrg.x != pDrawable->x || - pGC->lastWinOrg.y != pDrawable->y; - if(new_rotate != 0) { - pGC->lastWinOrg.x = pDrawable->x; - pGC->lastWinOrg.y = pDrawable->y; - } - - devPriv = cfbGetGCPrivate(pGC); - new_rrop = FALSE; - new_line = FALSE; - new_text = FALSE; - new_fillspans = FALSE; - new_fillarea = FALSE; - - drawableChanged = (pDrawable->serialNumber != - (pGC->serialNumber & (DRAWABLE_SERIAL_BITS))); -#define CLIP_BITS (GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode) - /* If the client clip is different or moved OR the subwindowMode has - * changed OR the window's clip has changed since the last validation, - * we need to recompute the composite clip . - */ - if ((changes & CLIP_BITS) != 0 || drawableChanged) { - miComputeCompositeClip(pGC, pDrawable); - oneRect = REGION_NUM_RECTS(cfbGetCompositeClip(pGC)) == 1; - if (oneRect != devPriv->oneRect) { - new_line = TRUE; - devPriv->oneRect = oneRect; - } - } - - /* A while loop with a switch statement inside? No thanks. -DaveM */ - mask = changes; - if((mask & (GCFunction | GCForeground | GCBackground | GCPlaneMask)) != 0) - new_rrop = TRUE; - if((mask & (GCPlaneMask | GCFillStyle | GCFont)) != 0) - new_text = TRUE; - if((mask & (GCLineStyle | GCLineWidth | GCFillStyle | GCCapStyle)) != 0) - new_line = TRUE; - if((mask & (GCFillStyle | GCTile | GCStipple)) != 0) - new_fillspans = new_fillarea = TRUE; - if(new_rotate == FALSE && - (mask & (GCTileStipXOrigin | GCTileStipYOrigin)) != 0) - new_rotate = TRUE; - if((mask & GCStipple) != 0) { - if(pGC->stipple) { - int width = pGC->stipple->drawable.width; - PixmapPtr nstipple; - - if ((width <= 32) && !(width & (width - 1))) { - int depth = pGC->depth; - nstipple = (depth == 8 ? - cfbCopyPixmap(pGC->stipple) : - cfb32CopyPixmap(pGC->stipple)); - if (nstipple) { - if (depth == 8) - cfbPadPixmap(nstipple); - else - cfb32PadPixmap(nstipple); - (*pGC->pScreen->DestroyPixmap)(pGC->stipple); - pGC->stipple = nstipple; - } - } - } - } - - /* If the drawable has changed, check its depth and ensure suitable - * entries are in the proc vector. - */ - if (drawableChanged) - new_fillspans = TRUE; /* deal with FillSpans later */ - - if (new_rotate || new_fillspans) { - Bool new_pix = FALSE; - - xrot = pGC->patOrg.x + pDrawable->x; - yrot = pGC->patOrg.y + pDrawable->y; - if (!CreatorCheckFill (pGC, pDrawable)) { - switch (pGC->fillStyle) { - case FillTiled: - if (!pGC->tileIsPixel) - { - int width = pGC->tile.pixmap->drawable.width; - - if (pGC->depth == 8) - width *= 8; - else - width *= 32; - - if ((width <= 32) && !(width & (width - 1))) { - if (pGC->depth == 8) - cfbCopyRotatePixmap(pGC->tile.pixmap, - &pGC->pRotatedPixmap, - xrot, yrot); - else - cfb32CopyRotatePixmap(pGC->tile.pixmap, - &pGC->pRotatedPixmap, - xrot, yrot); - new_pix = TRUE; - } - } - break; - case FillStippled: - case FillOpaqueStippled: - { - int width = pGC->stipple->drawable.width; - - if ((width <= 32) && !(width & (width - 1))) - { - mfbCopyRotatePixmap(pGC->stipple, - &pGC->pRotatedPixmap, xrot, yrot); - new_pix = TRUE; - } - } - break; - } - } - if (!new_pix && pGC->pRotatedPixmap) { - (*pGC->pScreen->DestroyPixmap)(pGC->pRotatedPixmap); - pGC->pRotatedPixmap = (PixmapPtr) NULL; - } - } - - if (new_rrop) { - int old_rrop; - - if (gcPriv->stipple) { - if (pGC->fillStyle == FillStippled) - gcPriv->stipple->alu = pGC->alu | FFB_ROP_EDIT_BIT; - else - gcPriv->stipple->alu = pGC->alu; - if (pGC->fillStyle != FillTiled) { - gcPriv->stipple->fg = pGC->fgPixel; - gcPriv->stipple->bg = pGC->bgPixel; - } - } - - old_rrop = devPriv->rop; - if (pGC->depth == 8) - devPriv->rop = cfbReduceRasterOp (pGC->alu, pGC->fgPixel, - pGC->planemask, - &devPriv->and, &devPriv->xor); - else - devPriv->rop = cfb32ReduceRasterOp (pGC->alu, pGC->fgPixel, - pGC->planemask, - &devPriv->and, &devPriv->xor); - if (old_rrop == devPriv->rop) - new_rrop = FALSE; - else { - new_line = TRUE; - new_text = TRUE; - new_fillspans = TRUE; - new_fillarea = TRUE; - } - } - - if (new_rrop || new_fillspans || new_text || new_fillarea || new_line) { - GCOps *newops; - int using_creator_ops = 0; - - if ((newops = CreatorMatchCommon (pGC, devPriv))) { - if (pGC->ops->devPrivate.val) - miDestroyGCOps (pGC->ops); - pGC->ops = newops; - new_rrop = new_line = new_fillspans = new_text = new_fillarea = 0; - using_creator_ops = 1; - } else { - if (!pGC->ops->devPrivate.val) { - pGC->ops = miCreateGCOps (pGC->ops); - pGC->ops->devPrivate.val = 1; - } - - /* We have to make sure the copyarea op always - * points to our special routine as it maintains the - * synchronization between the raster processor and direct - * access to the frame buffer. - */ - pGC->ops->CopyArea = CreatorCopyArea; - } - if (pGC->depth == 8) - newops = cfbMatchCommon(pGC, devPriv); - else - newops = cfb32MatchCommon(pGC, devPriv); - - if (newops) { - gcPriv->PolySegment = newops->PolySegment; - gcPriv->Polylines = newops->Polylines; - - if (using_creator_ops) { - /* Fixup line/segment backup ops. */ - if (pGC->ops->PolySegment == CreatorPolySegment) - gcPriv->PolySegment = CreatorSegmentSSStub; - if (pGC->ops->Polylines == CreatorPolylines) - gcPriv->Polylines = CreatorLineSSStub; - } - } - } - - accel = pGC->fillStyle == FillSolid || gcPriv->stipple; - - /* deal with the changes we've collected */ - if (new_line) - CreatorNewLine(pGC, devPriv, gcPriv, accel); - - if (new_text && pGC->font) - CreatorNewGlyph(pGC, gcPriv); - - if (new_fillspans) - CreatorNewFillSpans(pGC, devPriv, gcPriv, accel); - - if (new_fillarea) - CreatorNewFillArea(pGC, devPriv, gcPriv, accel); -} - -GCFuncs CreatorGCFuncs = { - CreatorValidateGC, - miChangeGC, - miCopyGC, - CreatorDestroyGC, - miChangeClip, - miDestroyClip, - miCopyClip -}; - -Bool -CreatorCreateGC (GCPtr pGC) -{ - CreatorPrivGCPtr gcPriv; - - if (pGC->depth == 1) - return mfbCreateGC(pGC); - - if (pGC->depth == 8) { - if (!cfbCreateGC(pGC)) - return FALSE; - } else { - if (!cfb32CreateGC(pGC)) - return FALSE; - } - - if (pGC->depth == 8) - pGC->ops = &CreatorNonTEOps8; - else - pGC->ops = &CreatorNonTEOps32; - - pGC->funcs = &CreatorGCFuncs; - gcPriv = CreatorGetGCPrivate(pGC); - gcPriv->type = DRAWABLE_WINDOW; - gcPriv->linepat = 0; - gcPriv->stipple = 0; - gcPriv->PolySegment = CreatorSegmentSSStub; - gcPriv->Polylines = CreatorLineSSStub; - - return TRUE; -} diff --git a/src/ffb_gc.h b/src/ffb_gc.h deleted file mode 100644 index 3e62269..0000000 --- a/src/ffb_gc.h +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Acceleration for the Creator and Creator3D framebuffer - Accel func declarations. - * - * Copyright (C) 1998,1999 Jakub Jelinek (jakub@redhat.com) - * Copyright (C) 1998 Michal Rehacek (majkl@iname.com) - * Copyright (C) 1999 David S. Miller (davem@redhat.com) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * JAKUB JELINEK, MICHAL REHACEK, OR DAVID MILLER BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - * - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_gc.h,v 1.2 2000/05/23 04:47:44 dawes Exp $ */ - -#ifndef FFBGC_H -#define FFBGC_H - -extern void CreatorDoBitblt(DrawablePtr pSrc, DrawablePtr pDst, int alu, RegionPtr prgnDst, - DDXPointPtr pptSrc, unsigned long planemask); - -extern void CreatorDoVertBitblt(DrawablePtr pSrc, DrawablePtr pDst, int alu, RegionPtr prgnDst, - DDXPointPtr pptSrc, unsigned long planemask); - -extern RegionPtr CreatorCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, - GCPtr pGC, int srcx, int srcy, int width, int height, - int dstx, int dsty); - -extern RegionPtr CreatorCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, - GCPtr pGC, int srcx, int srcy, int width, int height, - int dstx, int dsty, unsigned long bitPlane); - -extern void CreatorFillBoxSolid (DrawablePtr pDrawable, int nBox, - BoxPtr pBox, unsigned long pixel); - -extern void CreatorFillBoxStipple (DrawablePtr pDrawable, - int nBox, BoxPtr pBox, CreatorStipplePtr stipple); - -extern void CreatorPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, - int nrectFill, xRectangle *prectInit); - -extern void CreatorFillSpans (DrawablePtr pDrawable, GCPtr pGC, - int n, DDXPointPtr ppt, - int *pwidth, int fSorted); - -extern void CreatorPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, - int npt, xPoint *pptInit); - -extern void CreatorPolySegment (DrawablePtr pDrawable, GCPtr pGC, - int nseg, xSegment *pSeg); - -extern void CreatorFillPolygon (DrawablePtr pDrawable, GCPtr pGC, - int shape, int mode, int count, DDXPointPtr ppt); - -extern void CreatorPolylines (DrawablePtr pDrawable, GCPtr pGC, - int mode, int npt, DDXPointPtr ppt); - -extern void CreatorPolyGlyphBlt (DrawablePtr pDrawable, GCPtr pGC, int x, int y, - unsigned int nglyph, CharInfoPtr *ppci, pointer pGlyphBase); - -extern void CreatorTEGlyphBlt (DrawablePtr pDrawable, GCPtr pGC, int x, int y, - unsigned int nglyph, CharInfoPtr *ppci, pointer pGlyphBase); - -extern void CreatorPolyTEGlyphBlt (DrawablePtr pDrawable, GCPtr pGC, int x, int y, - unsigned int nglyph, CharInfoPtr *ppci, pointer pGlyphBase); - -extern void CreatorPolyFillArcSolid (DrawablePtr pDrawable, GCPtr pGC, - int narcs, xArc *parcs); - -extern void CreatorZeroPolyArc(DrawablePtr pDrawable, GCPtr pGC, - int narcs, xArc *parcs); - -extern int CreatorCheckTile (PixmapPtr pPixmap, CreatorStipplePtr stipple, - int ox, int oy, int ph); - -extern int CreatorCheckStipple (PixmapPtr pPixmap, CreatorStipplePtr stipple, - int ox, int oy, int ph); - -extern int CreatorCheckLinePattern(GCPtr pGC, CreatorPrivGCPtr gcPriv); - -extern int CreatorCheckFill (GCPtr pGC, DrawablePtr pDrawable); - -extern void CreatorSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *pcharsrc, - DDXPointPtr ppt, int *pwidth, int nspans, int fSorted); - -/* Stuff still not accelerated fully. */ -extern void CreatorSegmentSSStub (DrawablePtr pDrawable, GCPtr pGC, - int nseg, xSegment *pSeg); - -extern void CreatorLineSSStub (DrawablePtr pDrawable, GCPtr pGC, - int mode, int npt, DDXPointPtr ppt); - -extern void CreatorSegmentSDStub (DrawablePtr pDrawable, GCPtr pGC, - int nseg, xSegment *pSeg); - -extern void CreatorLineSDStub (DrawablePtr pDrawable, GCPtr pGC, - int mode, int npt, DDXPointPtr ppt); - -extern void CreatorSolidSpansGeneralStub (DrawablePtr pDrawable, GCPtr pGC, - int nInit, DDXPointPtr pptInit, - int *pwidthInit, int fSorted); - -extern void CreatorPolyGlyphBlt8Stub (DrawablePtr pDrawable, GCPtr pGC, - int x, int y, unsigned int nglyph, CharInfoPtr *ppci, - pointer pglyphBase); - -extern void CreatorImageGlyphBlt8Stub (DrawablePtr pDrawable, GCPtr pGC, - int x, int y, unsigned int nglyph, - CharInfoPtr *ppci, pointer pglyphBase); - -extern void CreatorTile32FSCopyStub(DrawablePtr pDrawable, GCPtr pGC, - int nInit, DDXPointPtr pptInit, - int *pwidthInit, int fSorted); - -extern void CreatorTile32FSGeneralStub(DrawablePtr pDrawable, GCPtr pGC, - int nInit, DDXPointPtr pptInit, - int *pwidthInit, int fSorted); - -extern void CreatorUnnaturalTileFSStub(DrawablePtr pDrawable, GCPtr pGC, - int nInit, DDXPointPtr pptInit, - int *pwidthInit, int fSorted); - -extern void Creator8Stipple32FSStub(DrawablePtr pDrawable, GCPtr pGC, - int nInit, DDXPointPtr pptInit, - int *pwidthInit, int fSorted); - -extern void CreatorUnnaturalStippleFSStub(DrawablePtr pDrawable, GCPtr pGC, - int nInit, DDXPointPtr pptInit, - int *pwidthInit, int fSorted); - -extern void Creator8OpaqueStipple32FSStub(DrawablePtr pDrawable, GCPtr pGC, - int nInit, DDXPointPtr pptInit, - int *pwidthInit, int fSorted); - -extern void CreatorPolyFillRectStub(DrawablePtr pDrawable, GCPtr pGC, - int nrectFill, xRectangle *prectInit); - -#endif /* FFBGC_H */ diff --git a/src/ffb_glyph.c b/src/ffb_glyph.c deleted file mode 100644 index 52ab9d8..0000000 --- a/src/ffb_glyph.c +++ /dev/null @@ -1,384 +0,0 @@ -/* - * Acceleration for the Creator and Creator3D framebuffer - Glyph rops. - * - * Copyright (C) 1998,1999 Jakub Jelinek (jakub@redhat.com) - * Copyright (C) 1998 Michal Rehacek (majkl@iname.com) - * Copyright (C) 1999 David S. Miller (davem@redhat.com) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * JAKUB JELINEK, MICHAL REHACEK, OR DAVID MILLER BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - * - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_glyph.c,v 1.1 2000/05/18 23:21:37 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "ffb.h" -#include "ffb_regs.h" -#include "ffb_rcache.h" -#include "ffb_fifo.h" -#include "ffb_loops.h" - -#include "pixmapstr.h" -#include "scrnintstr.h" -#include -#include "dixfontstr.h" - -#define PSZ 8 -#include "cfb.h" -#undef PSZ -#include "cfb32.h" - -void -CreatorPolyGlyphBlt (DrawablePtr pDrawable, GCPtr pGC, int x, int y, - unsigned int nglyph, CharInfoPtr *ppci, pointer pGlyphBase) -{ - FFBPtr pFfb = GET_FFB_FROM_SCREEN (pGC->pScreen); - ffb_fbcPtr ffb = pFfb->regs; - FontPtr pfont = pGC->font; - RegionPtr clip = cfbGetCompositeClip(pGC); - BoxPtr pbox = REGION_RECTS(clip); - int nbox = REGION_NUM_RECTS(clip); - int skippix, skipglyph, width, n, i; - int Left, Right, Top, Bottom, LeftEdge, RightEdge; - - FFBLOG(("CreatorPolyGlyphBlt: xy[%08x:%08x] nglyph(%d)\n", x, y, nglyph)); - x += pDrawable->x; - y += pDrawable->y; - - width = 0; - for(i = 0; i < (nglyph - 1); i++) - width += (ppci[i])->metrics.characterWidth; - - Left = x + (ppci[0])->metrics.leftSideBearing; - Right = x + (width + (ppci[nglyph - 1])->metrics.rightSideBearing); - Top = y - FONTMAXBOUNDS(pfont, ascent); - Bottom = y + FONTMAXBOUNDS(pfont, descent); - - while(nbox && (Top >= pbox->y2)) { - pbox++; - nbox--; - } - - if(!nbox || Bottom < pbox->y1) - return; - - /* Ok, setup the chip. */ - { - unsigned int ppc = (FFB_PPC_APE_DISABLE | FFB_PPC_TBE_TRANSPARENT | - FFB_PPC_CS_CONST); - unsigned int ppc_mask = (FFB_PPC_APE_MASK | FFB_PPC_TBE_MASK | - FFB_PPC_CS_MASK); - unsigned int pmask = pGC->planemask; - unsigned int rop = (FFB_ROP_EDIT_BIT | pGC->alu) | (FFB_ROP_NEW << 8); - unsigned int fg = pGC->fgPixel; - WindowPtr pWin = (WindowPtr) pDrawable; - unsigned int fbc = FFB_FBC_WIN(pWin); - - fbc = (fbc & ~FFB_FBC_XE_MASK) | FFB_FBC_XE_OFF; - - if((pFfb->ppc_cache & ppc_mask) != ppc || - pFfb->fg_cache != fg || - pFfb->fbc_cache != fbc || - pFfb->rop_cache != rop || - pFfb->pmask_cache != pmask || - pFfb->fontinc_cache != ((1<<16) | 0)) { - pFfb->ppc_cache &= ~ppc_mask; - pFfb->ppc_cache |= ppc; - pFfb->fg_cache = fg; - pFfb->fbc_cache = fbc; - pFfb->rop_cache = rop; - pFfb->pmask_cache = pmask; - pFfb->fontinc_cache = ((1<<16) | 0); - pFfb->rp_active = 1; - FFBFifo(pFfb, 6); - ffb->ppc = ppc; - ffb->fg = fg; - ffb->fbc = fbc; - ffb->rop = rop; - ffb->pmask = pmask; - ffb->fontinc = ((1 << 16) | 0); - } - } - - while(nbox && (Bottom >= pbox->y1)) { - LeftEdge = max(Left, pbox->x1); - RightEdge = min(Right, pbox->x2); - if(RightEdge > LeftEdge) { - int walk, x_start; - - skippix = LeftEdge - x; - skipglyph = walk = 0; - while(skippix >= (walk + (ppci[skipglyph])->metrics.rightSideBearing)) { - walk += (ppci[skipglyph])->metrics.characterWidth; - skipglyph++; - } - x_start = x + walk; - skippix = RightEdge - x; - n = 0; - i = skipglyph; - while((i < nglyph) && - (skippix > (walk + (ppci[i])->metrics.leftSideBearing))) { - walk += (ppci[i])->metrics.characterWidth; - i++; - n++; - } - if(n) { - CharInfoPtr *ppci_iter = ppci + skipglyph; - CharInfoPtr pci; - unsigned int *bits; - int w, h, x0, y0, xskip, yskip; - - while(n--) { - pci = *ppci_iter++; - w = GLYPHWIDTHPIXELS(pci); - h = GLYPHHEIGHTPIXELS(pci); - if(!w || !h) - goto next_glyph; - - x0 = x_start + pci->metrics.leftSideBearing; - y0 = y - pci->metrics.ascent; - bits = (unsigned int *) pci->bits; - - /* Now clip it to the bits we should actually - * render. - */ - xskip = yskip = 0; - if(pbox->x1 > x0) { - xskip = pbox->x1 - x0; - w -= xskip; - x0 = pbox->x1; - if(w <= 0) - goto next_glyph; - } - if(pbox->y1 > y0) { - yskip = pbox->y1 - y0; - h -= yskip; - y0 = pbox->y1; - if(h <= 0) - goto next_glyph; - } - if(pbox->x2 < (x0 + w)) { - w = pbox->x2 - x0; - if(w <= 0) - goto next_glyph; - } - if(pbox->y2 < (y0 + h)) { - h = pbox->y2 - y0; - if(h <= 0) - goto next_glyph; - } - - FFB_WRITE_FONTW(pFfb, ffb, w); - FFBFifo(pFfb, 1 + h); - ffb->fontxy = ((y0 << 16) | x0); - for(i = 0; i < h; i++) - ffb->font = bits[yskip + i] << xskip; - - next_glyph: - x_start += pci->metrics.characterWidth; - } - } - } - nbox--; - pbox++; - } - pFfb->rp_active = 1; - FFBSync(pFfb, ffb); -} - -void -CreatorTEGlyphBlt (DrawablePtr pDrawable, GCPtr pGC, int x, int y, - unsigned int nglyph, CharInfoPtr *ppci, pointer pGlyphBase) -{ - FFBPtr pFfb = GET_FFB_FROM_SCREEN (pGC->pScreen); - ffb_fbcPtr ffb = pFfb->regs; - RegionPtr clip = cfbGetCompositeClip(pGC); - int nbox = REGION_NUM_RECTS(clip); - BoxPtr pbox = REGION_RECTS(clip); - FontPtr pfont = pGC->font; - int glyphWidth = FONTMAXBOUNDS(pfont, characterWidth); - int skippix, skipglyphs, Left, Right, Top, Bottom; - int LeftEdge, RightEdge, ytop, ybot, h, w; - - FFBLOG(("CreatorTEGlyphBlt: xy[%08x:%08x] nglyph(%d) pgbase(%p)\n", - x, y, nglyph, pGlyphBase)); - - Left = x + pDrawable->x; - Right = Left + (glyphWidth * nglyph); - y += pDrawable->y; - Top = y - FONTASCENT(pfont); - Bottom = y + FONTDESCENT(pfont); - - while(nbox && (Top >= pbox->y2)) { - pbox++; - nbox--; - } - - if(!nbox || Bottom <= pbox->y1) - return; - - /* Ok, setup the chip. */ - { - unsigned int ppc = FFB_PPC_APE_DISABLE|FFB_PPC_CS_CONST; - unsigned int ppc_mask = FFB_PPC_APE_MASK|FFB_PPC_TBE_MASK|FFB_PPC_CS_MASK; - unsigned int pmask = pGC->planemask; - unsigned int rop; - unsigned int fg = pGC->fgPixel; - unsigned int bg = pGC->bgPixel; - WindowPtr pWin = (WindowPtr) pDrawable; - unsigned int fbc = FFB_FBC_WIN(pWin); - - fbc = (fbc & ~FFB_FBC_XE_MASK) | FFB_FBC_XE_OFF; - - if(pGlyphBase) { - ppc |= FFB_PPC_TBE_TRANSPARENT; - rop = FFB_ROP_EDIT_BIT | pGC->alu; - } else { - ppc |= FFB_PPC_TBE_OPAQUE; - rop = FFB_ROP_EDIT_BIT | GXcopy; - } - rop |= (FFB_ROP_NEW << 8); - if((pFfb->ppc_cache & ppc_mask) != ppc || - pFfb->fg_cache != fg || - pFfb->fbc_cache != fbc || - pFfb->rop_cache != rop || - pFfb->pmask_cache != pmask || - pFfb->fontinc_cache != ((1<<16) | 0) || - (!pGlyphBase && pFfb->bg_cache != bg)) { - pFfb->ppc_cache &= ~ppc_mask; - pFfb->ppc_cache |= ppc; - pFfb->fg_cache = fg; - pFfb->fbc_cache = fbc; - pFfb->rop_cache = rop; - pFfb->pmask_cache = pmask; - pFfb->fontinc_cache = ((1<<16) | 0); - if(!pGlyphBase) - pFfb->bg_cache = bg; - FFBFifo(pFfb, (!pGlyphBase ? 7 : 6)); - ffb->ppc = ppc; - ffb->fg = fg; - ffb->fbc = fbc; - ffb->rop = rop; - ffb->pmask = pmask; - ffb->fontinc = ((1 << 16) | 0); - if(!pGlyphBase) - ffb->bg = bg; - } - } - - while(nbox && (Bottom > pbox->y1)) { - LeftEdge = max(Left, pbox->x1); - RightEdge = min(Right, pbox->x2); - - if(RightEdge > LeftEdge) { - ytop = max(Top, pbox->y1); - ybot = min(Bottom, pbox->y2); - - if((skippix = LeftEdge - Left)) { - skipglyphs = skippix / glyphWidth; - skippix %= glyphWidth; - } else - skipglyphs = 0; - w = RightEdge - LeftEdge; - - /* Get aligned onto a character. */ - if(skippix) { - unsigned int *gbits = (unsigned int *) ppci[skipglyphs++]->bits; - int chunk_size = (glyphWidth - skippix); - - if (chunk_size > w) - chunk_size = w; - - FFB_WRITE_FONTW(pFfb, ffb, chunk_size); - FFBFifo(pFfb, 1 + (ybot - ytop)); - ffb->fontxy = ((ytop << 16) | LeftEdge); - for(h = (ytop - Top); h < (ybot - Top); h++) - ffb->font = gbits[h] << skippix; - LeftEdge += chunk_size; - w -= chunk_size; - } - /* And now blit the rest with unrolled loops. */ -#define LoopIt(chunkW, loadup, fetch) \ - FFB_WRITE_FONTW(pFfb, ffb, chunkW); \ - while (w >= chunkW) { \ - loadup \ - FFBFifo(pFfb, 1 + (ybot - ytop)); \ - ffb->fontxy = ((ytop << 16) | LeftEdge); \ - for(h = (ytop - Top); h < (ybot - Top); h++) \ - ffb->font = fetch; \ - LeftEdge += chunkW; \ - w -= chunkW; \ - } - if(glyphWidth <= 8) { - int chunk_size = glyphWidth << 2; - LoopIt(chunk_size, - unsigned int *char1 = ((unsigned int *)ppci[skipglyphs++]->bits)+(ytop-Top); - unsigned int *char2 = ((unsigned int *)ppci[skipglyphs++]->bits)+(ytop-Top); - unsigned int *char3 = ((unsigned int *)ppci[skipglyphs++]->bits)+(ytop-Top); - unsigned int *char4 = ((unsigned int *)ppci[skipglyphs++]->bits)+(ytop-Top);, - (*char1++ | ((*char2++ | ((*char3++ | (*char4++ >> glyphWidth)) - >> glyphWidth)) - >> glyphWidth))) - } else if(glyphWidth <= 10) { - int chunk_size = (glyphWidth << 1) + glyphWidth; - LoopIt(chunk_size, - unsigned int *char1 = ((unsigned int *)ppci[skipglyphs++]->bits)+(ytop-Top); - unsigned int *char2 = ((unsigned int *)ppci[skipglyphs++]->bits)+(ytop-Top); - unsigned int *char3 = ((unsigned int *)ppci[skipglyphs++]->bits)+(ytop-Top);, - (*char1++ | ((*char2++ | (*char3++ >> glyphWidth)) >> glyphWidth))); - } else if(glyphWidth <= 16) { - int chunk_size = glyphWidth << 1; - LoopIt(chunk_size, - unsigned int *char1 = ((unsigned int *)ppci[skipglyphs++]->bits)+(ytop-Top); - unsigned int *char2 = ((unsigned int *)ppci[skipglyphs++]->bits)+(ytop-Top);, - (*char1++ | (*char2++ >> glyphWidth))); - } -#undef LoopIt - /* Take care of any final glyphs. */ - while(w > 0) { - unsigned int *gbits = (unsigned int *) ppci[skipglyphs++]->bits; - int pix = glyphWidth; - - if(w < pix) - pix = w; - FFB_WRITE_FONTW(pFfb, ffb, pix); - FFBFifo(pFfb, 1 + (ybot - ytop)); - ffb->fontxy = ((ytop << 16) | LeftEdge); - for(h = (ytop - Top); h < (ybot - Top); h++) - ffb->font = gbits[h]; - LeftEdge += pix; - w -= pix; - } - } - nbox--; - pbox++; - } - - pFfb->rp_active = 1; - FFBSync(pFfb, ffb); -} - -void -CreatorPolyTEGlyphBlt (DrawablePtr pDrawable, GCPtr pGC, int x, int y, - unsigned int nglyph, CharInfoPtr *ppci, pointer pGlyphBase) -{ - CreatorTEGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, (char *) 1); -} diff --git a/src/ffb_gspans.c b/src/ffb_gspans.c deleted file mode 100644 index a4753d0..0000000 --- a/src/ffb_gspans.c +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Acceleration for the Creator and Creator3D framebuffer - Get spans. - * - * Copyright (C) 1998,1999 Jakub Jelinek (jakub@redhat.com) - * Copyright (C) 1999 David S. Miller (davem@redhat.com) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * JAKUB JELINEK OR DAVID MILLER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_gspans.c,v 1.1 2000/05/18 23:21:37 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "ffb.h" -#include "ffb_regs.h" -#include "ffb_rcache.h" -#include "ffb_fifo.h" - -#include "pixmapstr.h" -#include "scrnintstr.h" - -#define PSZ 8 -#include "cfb.h" -#undef PSZ -#include "cfb32.h" - -void -CreatorGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt, - int *pwidth, int nspans, char *pchardstStart) -{ - FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen); - ffb_fbcPtr ffb = pFfb->regs; - char *addrp; - - FFBLOG(("CreatorGetSpans: wmax(%d) nspans(%d)\n", wMax, nspans)); - - /* Punt early for this case. */ - if(pDrawable->bitsPerPixel == 1) { - mfbGetSpans(pDrawable, wMax, ppt, pwidth, - nspans, pchardstStart); - return; - } - - /* This code only works when sucking bits directly from - * the framebuffer. - */ - if(pDrawable->type != DRAWABLE_WINDOW) { - if (pDrawable->bitsPerPixel == 8) - cfbGetSpans(pDrawable, wMax, ppt, pwidth, - nspans, pchardstStart); - else - cfb32GetSpans(pDrawable, wMax, ppt, pwidth, - nspans, pchardstStart); - return; - } - - /* - * XFree86 DDX empties the root borderClip when the VT is - * switched away; this checks for that case - */ - if (!cfbDrawableEnabled(pDrawable)) - return; - - /* We're just reading pixels from SFB, but we could be using - * a different read buffer when double-buffering. - */ - FFB_ATTR_SFB_VAR_WIN(pFfb, 0x00ffffff, GXcopy, (WindowPtr)pDrawable); - FFBWait(pFfb, ffb); - - if (pDrawable->bitsPerPixel == 32) { - unsigned int *pdst = (unsigned int *)pchardstStart; - - addrp = (char *) pFfb->sfb32; - - if ((nspans == 1) && (*pwidth == 1)) { - *pdst = *(unsigned int *)(addrp + (ppt->y << 13) + (ppt->x << 2)); - return; - } - - while(nspans--) { - int w = min(ppt->x + *pwidth, 2048) - ppt->x; - unsigned int *psrc = (unsigned int *) (addrp + - (ppt->y << 13) + - (ppt->x << 2)); - unsigned int *pdstNext = pdst + w; - - while (w--) - *psrc++ = *pdst++; - pdst = pdstNext; - ppt++; - pwidth++; - } - } else { - unsigned char *pdst = (unsigned char *)pchardstStart; - - addrp = (char *) pFfb->sfb8r; - - if ((nspans == 1) && (*pwidth == 1)) { - *pdst = *(unsigned char *)(addrp + (ppt->y << 11) + (ppt->x << 0)); - return; - } - - while(nspans--) { - int w = min(ppt->x + *pwidth, 2048) - ppt->x; - unsigned char *psrc = (unsigned char *) (addrp + - (ppt->y << 11) + - (ppt->x << 0)); - unsigned char *pdstNext = pdst + w; - - while (w--) - *psrc++ = *pdst++; - pdst = pdstNext; - ppt++; - pwidth++; - } - } -} diff --git a/src/ffb_line.c b/src/ffb_line.c deleted file mode 100644 index 7a81233..0000000 --- a/src/ffb_line.c +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Acceleration for the Creator and Creator3D framebuffer - Line rops. - * - * Copyright (C) 1998,1999 Jakub Jelinek (jakub@redhat.com) - * Copyright (C) 1999 David S. Miller (davem@redhat.com) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * JAKUB JELINEK OR DAVID MILLER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_line.c,v 1.1 2000/05/18 23:21:37 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "ffb.h" -#include "ffb_regs.h" -#include "ffb_rcache.h" -#include "ffb_fifo.h" -#include "ffb_stip.h" - -#include "pixmapstr.h" -#include "scrnintstr.h" - -#define PSZ 8 -#include "cfb.h" -#undef PSZ -#include "cfb32.h" - -#include "miline.h" - -/* The scheme here is similar as for segments, except that - * if there are any out of range coordinate, we fully punt - * and do all of the pieces in software. This is as to - * avoid complexity in final line capping, sloped lines, line - * patterns etc. - */ -#define IN_RANGE(_extent, _x, _y) \ - ((_x) >= (_extent)->x1 && (_x) < (_extent)->x2 && \ - (_y) >= (_extent)->y1 && (_y) < (_extent)->y2) - - -void -CreatorPolylines (DrawablePtr pDrawable, GCPtr pGC, int mode, int nptInit, DDXPointPtr pptInit) -{ - WindowPtr pWin = (WindowPtr) pDrawable; - CreatorPrivGCPtr gcPriv = CreatorGetGCPrivate (pGC); - FFBPtr pFfb = GET_FFB_FROM_SCREEN (pGC->pScreen); - ffb_fbcPtr ffb = pFfb->regs; - DDXPointPtr ppt; - BoxPtr extent; - int x, y, xorg, yorg, npt, capLast; - - npt = nptInit; - if (npt <= 1) - return; - ppt = pptInit; - xorg = pDrawable->x; - yorg = pDrawable->y; - x = ppt->x + xorg; - y = ppt->y + yorg; - extent = REGION_RECTS(cfbGetCompositeClip(pGC)); - if (!IN_RANGE(extent, x, y)) - goto punt_rest; - ppt++; - while(npt--) { - if (mode == CoordModeOrigin) { - x = ppt->x + xorg; - y = ppt->y + yorg; - } else { - x += ppt->x; - y += ppt->y; - } - if (!IN_RANGE(extent, x, y)) - goto punt_rest; - ppt++; - } - FFBLOG(("CreatorPolylines: npt(%d) lpat(%08x) alu(%x) pmsk(%08x)\n", - npt, gcPriv->linepat, pGC->alu, pGC->planemask)); - if(gcPriv->stipple == NULL) { - FFB_ATTR_GC(pFfb, pGC, pWin, - FFB_PPC_APE_DISABLE | FFB_PPC_CS_CONST, - FFB_DRAWOP_BRLINEOPEN); - } else { - unsigned int fbc; - - FFBSetStipple(pFfb, ffb, gcPriv->stipple, - FFB_PPC_CS_CONST, FFB_PPC_CS_MASK); - FFB_WRITE_PMASK(pFfb, ffb, pGC->planemask); - FFB_WRITE_DRAWOP(pFfb, ffb, FFB_DRAWOP_BRLINEOPEN); - fbc = FFB_FBC_WIN(pWin); - fbc = (fbc & ~FFB_FBC_XE_MASK) | FFB_FBC_XE_OFF; - FFB_WRITE_FBC(pFfb, ffb, fbc); - } - pFfb->rp_active = 1; - - ppt = pptInit; - npt = nptInit; - x = ppt->x + xorg; - y = ppt->y + yorg; - - FFBFifo(pFfb, 3); - ffb->lpat = gcPriv->linepat; - ffb->by = y; - ffb->bx = x; - ppt++; - npt--; - capLast = pGC->capStyle != CapNotLast; - if (mode == CoordModeOrigin) { - if (capLast) - npt--; - if (pFfb->has_brline_bug) { - while (npt--) { - x = ppt->x + xorg; - y = ppt->y + yorg; - ppt++; - FFBFifo(pFfb, 3); - ffb->ppc = 0; - FFB_WRITE64(&ffb->bh, y, x); - } - } else { - while (npt--) { - x = ppt->x + xorg; - y = ppt->y + yorg; - ppt++; - FFBFifo(pFfb, 2); - FFB_WRITE64(&ffb->bh, y, x); - } - } - if (capLast) { - register int x2, y2; - - x2 = ppt->x + xorg; - y2 = ppt->y + yorg; - - FFB_WRITE_DRAWOP(pFfb, ffb, FFB_DRAWOP_BRLINECAP); - FFBFifo(pFfb, 5); - ffb->ppc = 0; - FFB_WRITE64(&ffb->by, y, x); - FFB_WRITE64_2(&ffb->bh, y2, x2); - } - } else { - if (capLast) - npt--; - if (pFfb->has_brline_bug) { - while (npt--) { - x += ppt->x; - y += ppt->y; - ppt++; - - FFBFifo(pFfb, 3); - ffb->ppc = 0; - FFB_WRITE64(&ffb->bh, y, x); - } - } else { - while (npt--) { - x += ppt->x; - y += ppt->y; - ppt++; - - FFBFifo(pFfb, 2); - FFB_WRITE64(&ffb->bh, y, x); - } - } - if (capLast) { - register int x2, y2; - - x2 = x + ppt->x; - y2 = y + ppt->y; - - FFB_WRITE_DRAWOP(pFfb, ffb, FFB_DRAWOP_BRLINECAP); - FFBFifo(pFfb, 5); - ffb->ppc = 0; - FFB_WRITE64(&ffb->by, y, x); - FFB_WRITE64_2(&ffb->bh, y2, x2); - } - } - FFBSync(pFfb, ffb); - return; - -punt_rest: - gcPriv->Polylines(pDrawable, pGC, mode, nptInit, pptInit); - return; -} diff --git a/src/ffb_plygon.c b/src/ffb_plygon.c deleted file mode 100644 index 2259054..0000000 --- a/src/ffb_plygon.c +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Acceleration for the Creator and Creator3D framebuffer - Polygon rops. - * - * Copyright (C) 1999 Jakub Jelinek (jakub@redhat.com) - * Copyright (C) 1999 David S. Miller (davem@redhat.com) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * JAKUB JELINEK OR DAVID MILLER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - * - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_plygon.c,v 1.1 2000/05/18 23:21:37 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "ffb.h" -#include "ffb_regs.h" -#include "ffb_rcache.h" -#include "ffb_fifo.h" -#include "ffb_stip.h" - -#include "pixmapstr.h" -#include "scrnintstr.h" - -#define PSZ 8 -#include "cfb.h" -#undef PSZ -#include "cfb32.h" - -#include "mi.h" - -void -CreatorFillPolygon (DrawablePtr pDrawable, GCPtr pGC, int shape, int mode, int count, DDXPointPtr ppt) -{ - WindowPtr pWin = (WindowPtr) pDrawable; - CreatorPrivGCPtr gcPriv = CreatorGetGCPrivate (pGC); - FFBPtr pFfb = GET_FFB_FROM_SCREEN (pGC->pScreen); - ffb_fbcPtr ffb = pFfb->regs; - BoxRec box; - int lx, rx, ty, by; - int t, b, i, j, k, l, tt; - int xy[12] FFB_ALIGN64; - int xOrg, yOrg; - - FFBLOG(("CreatorFillPolygon: ALU(%x) PMSK(%08x) shape(%d) mode(%d) count(%d)\n", - pGC->alu, pGC->planemask, shape, mode, count)); - if (count < 3) - return; - - if (shape != Convex && count > 3) { - miFillPolygon (pDrawable, pGC, shape, mode, count, ppt); - return; - } - - xOrg = pDrawable->x; - yOrg = pDrawable->y; - - ppt->x += xOrg; - ppt->y += yOrg; - lx = ppt->x; - rx = ppt->x; - ty = ppt->y; - by = ppt->y; - t = b = 0; - tt = 1; - for (i = 1; i < count; i++) { - if (mode == CoordModeOrigin) { - ppt[i].x += xOrg; - ppt[i].y += yOrg; - } else { - ppt[i].x += ppt[i-1].x; - ppt[i].y += ppt[i-1].y; - } - if (ppt[i].x < lx) - lx = ppt[i].x; - if (ppt[i].x > rx) - rx = ppt[i].x; - if (ppt[i].y < ty) { - ty = ppt[i].y; - t = i; - tt = 1; - } else if (ppt[i].y == ty) - tt++; - if (ppt[i].y > by) { - by = ppt[i].y; - b = i; - } - } - if (tt > 2) { - miFillConvexPoly(pDrawable, pGC, count, ppt); - return; - } else if (tt == 2) { - i = t - 1; - if (i < 0) - i = count - 1; - if (ppt[i].y == ppt[t].y) - t = i; - } - box.x1 = lx; - box.x2 = rx + 1; - box.y1 = ty; - box.y2 = by + 1; - - switch (RECT_IN_REGION(pGC->pScreen, cfbGetCompositeClip(pGC), &box)) { - case rgnPART: - miFillConvexPoly(pDrawable, pGC, count, ppt); - case rgnOUT: - return; - } - if(gcPriv->stipple == NULL) { - FFB_ATTR_GC(pFfb, pGC, pWin, - FFB_PPC_APE_DISABLE | FFB_PPC_CS_CONST, - FFB_DRAWOP_POLYGON); - } else { - unsigned int fbc; - - FFBSetStipple(pFfb, ffb, gcPriv->stipple, - FFB_PPC_CS_CONST, FFB_PPC_CS_MASK); - FFB_WRITE_PMASK(pFfb, ffb, pGC->planemask); - FFB_WRITE_DRAWOP(pFfb, ffb, FFB_DRAWOP_POLYGON); - fbc = FFB_FBC_WIN(pWin); - fbc = (fbc & ~FFB_FBC_XE_MASK) | FFB_FBC_XE_OFF; - FFB_WRITE_FBC(pFfb, ffb, fbc); - } - xy[0] = ppt[t].y; - xy[1] = ppt[t].x; - j = t + 1; - if (j == count) j = 0; - xy[2] = ppt[j].y; - xy[3] = ppt[j].x; - j = t + 2; - if (j >= count) - j -= count; - for (i = 2 * count - 4; i; i -= k) { - b = 2; - for (k = 0; k < i && k < 8; k+=2) { - xy[4 + k] = ppt[j].y; - xy[4 + k + 1] = ppt[j].x; - if (xy[4 + k] > xy[b]) - b = 4 + k; - j++; if (j == count) j = 0; - } - FFBFifo(pFfb, 4 + k); - for (l = 0; l < b - 2; l+=2) - FFB_WRITE64P(&ffb->by, &xy[l]); - FFB_WRITE64P(&ffb->bh, &xy[l]); - for (l+=2; l <= k; l+=2) - FFB_WRITE64P(&ffb->by, &xy[l]); - FFB_WRITE64P(&ffb->ebyi, &xy[l]); - xy[2] = xy[l]; - xy[3] = xy[l+1]; - } - pFfb->rp_active = 1; - FFBSync(pFfb, ffb); -} diff --git a/src/ffb_point.c b/src/ffb_point.c deleted file mode 100644 index c7b0dfd..0000000 --- a/src/ffb_point.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Acceleration for the Creator and Creator3D framebuffer - Point rops. - * - * Copyright (C) 1999 Jakub Jelinek (jakub@redhat.com) - * Copyright (C) 1999 David S. Miller (davem@redhat.com) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * JAKUB JELINEK OR DAVID MILLER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - * - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_point.c,v 1.1 2000/05/18 23:21:37 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "ffb.h" -#include "ffb_regs.h" -#include "ffb_rcache.h" -#include "ffb_fifo.h" -#include "ffb_loops.h" - -#include "pixmapstr.h" -#include "scrnintstr.h" - -#define PSZ 8 -#include "cfb.h" -#undef PSZ -#include "cfb32.h" - -void -CreatorPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, - int npt, xPoint *pptInit) -{ - FFBPtr pFfb = GET_FFB_FROM_SCREEN (pGC->pScreen); - WindowPtr pWin = (WindowPtr) pDrawable; - ffb_fbcPtr ffb = pFfb->regs; - RegionPtr clip; - int numRects; - register int off, c1, c2; - register char *addrp; - register int *ppt, pt, i; - BoxPtr pbox; - xPoint *pptPrev; - - FFBLOG(("CreatorPolyPoint: ALU(%x) PMSK(%08x) mode(%d) npt(%d)\n", - pGC->alu, pGC->planemask, mode, npt)); - - if (pGC->alu == GXnoop) - return; - - clip = cfbGetCompositeClip(pGC); - numRects = REGION_NUM_RECTS(clip); - off = *(int *)&pDrawable->x; - off -= (off & 0x8000) << 1; - if (mode == CoordModePrevious && npt > 1) { - for (pptPrev = pptInit + 1, i = npt - 1; --i >= 0; pptPrev++) { - pptPrev->x += pptPrev[-1].x; - pptPrev->y += pptPrev[-1].y; - } - } - - FFB_ATTR_GC(pFfb, pGC, pWin, - FFB_PPC_APE_DISABLE | FFB_PPC_CS_CONST, - pFfb->drawop_cache); - FFBWait(pFfb, ffb); - - if (pGC->depth == 8) { - addrp = (char *)pFfb->sfb8r + (pDrawable->y << 11) + (pDrawable->x << 0); - pbox = REGION_RECTS(clip); - while (numRects--) { - c1 = *(int *)&pbox->x1 - off; - c2 = *(int *)&pbox->x2 - off - 0x00010001; - for (ppt = (int *)pptInit, i = npt; --i >= 0; ) { - pt = *ppt++; - if (!(((pt - c1) | (c2 - pt)) & 0x80008000)) - *(unsigned char *)(addrp + ((pt << 11) & 0x3ff800) + - ((pt >> 16) & 0x07ff)) = 0; - } - pbox++; - } - } else { - addrp = (char *)pFfb->sfb32 + (pDrawable->y << 13) + (pDrawable->x << 2); - pbox = REGION_RECTS(clip); - while (numRects--) { - c1 = *(int *)&pbox->x1 - off; - c2 = *(int *)&pbox->x2 - off - 0x00010001; - for (ppt = (int *)pptInit, i = npt; --i >= 0; ) { - pt = *ppt++; - if (!(((pt - c1) | (c2 - pt)) & 0x80008000)) - *(unsigned int *)(addrp + ((pt << 13) & 0xffe000) + - ((pt >> 14) & 0x1ffc)) = 0; - } - pbox++; - } - } -} diff --git a/src/ffb_rect.c b/src/ffb_rect.c deleted file mode 100644 index 22d3936..0000000 --- a/src/ffb_rect.c +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Acceleration for the Creator and Creator3D framebuffer - Non-filled rects. - * - * Copyright (C) 1999 David S. Miller (davem@redhat.com) - * Copyright (C) 1999 Jakub Jelinek (jakub@redhat.com) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * DAVID MILLER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_rect.c,v 1.1 2000/05/18 23:21:37 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#define PSZ 32 - -#include "ffb.h" -#include "ffb_regs.h" -#include "ffb_rcache.h" -#include "ffb_fifo.h" -#include "ffb_loops.h" -#include "ffb_clip.h" - -#include "pixmapstr.h" -#include "scrnintstr.h" - -#include "cfb.h" - -#error If we start using this again, need to fixup FFB_WRITE_ATTRIBUTES for wids -DaveM - -/* Heavily derived from mipolyrect.c code, see there for authors. */ - -/* This about it, capping makes not a single difference ever, - * always the upper left corner coordinate will be pixelated. - */ -void -CreatorPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, - int nrects, xRectangle *pRects) -{ - FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen); - CreatorPrivGCPtr gcPriv = CreatorGetGCPrivate (pGC); - ffb_fbcPtr ffb = pFfb->regs; - xRectangle *pR = pRects; - RegionPtr clip; - unsigned int ppc, line_drawop; - int bound_tmp, i, numRects; - - if(nrects <= 0) - return; - clip = ((cfbPrivGC *)(pGC->devPrivates[cfbGCPrivateIndex].ptr))->pCompositeClip; - numRects = REGION_NUM_RECTS(clip); - if (!numRects) - return; - if(!(ppc = FFBSetClip(pFfb, ffb, clip, numRects))) { - miPolyRectangle(pDrawable, pGC, nrects, pRects); - return; - } - if(pGC->lineStyle == LineDoubleDash) - line_drawop = FFB_DRAWOP_DDLINE; - else - line_drawop = FFB_DRAWOP_BRLINECAP; - if(gcPriv->stipple == NULL) { - FFB_WRITE_ATTRIBUTES(pFfb, - ppc|FFB_PPC_APE_DISABLE|FFB_PPC_TBE_OPAQUE| - FFB_PPC_XS_CONST|FFB_PPC_YS_CONST|FFB_PPC_ZS_CONST|FFB_PPC_CS_CONST, - FFB_PPC_VCE_MASK|FFB_PPC_ACE_MASK|FFB_PPC_APE_MASK|FFB_PPC_TBE_MASK| - FFB_PPC_XS_MASK|FFB_PPC_YS_MASK|FFB_PPC_ZS_MASK|FFB_PPC_CS_MASK, - pGC->planemask, - FFB_ROP_EDIT_BIT|pGC->alu, - -1, pGC->fgPixel, - FFB_FBC_DEFAULT); - if(pGC->lineStyle == LineDoubleDash) - FFB_WRITE_BG(pFfb, ffb, pGC->bgPixel); - } else { - FFBSetStipple(pFfb, ffb, gcPriv->stipple, - ppc| - FFB_PPC_XS_CONST|FFB_PPC_YS_CONST|FFB_PPC_ZS_CONST|FFB_PPC_CS_CONST, - FFB_PPC_VCE_MASK|FFB_PPC_ACE_MASK| - FFB_PPC_XS_MASK|FFB_PPC_YS_MASK|FFB_PPC_ZS_MASK|FFB_PPC_CS_MASK); - FFB_WRITE_PMASK(pFfb, ffb, pGC->planemask); - FFB_WRITE_FBC(pFfb, ffb, FFB_FBC_DEFAULT); - } - -#define MINBOUND(dst,eqn) bound_tmp = eqn; \ - if (bound_tmp < -32768) \ - bound_tmp = -32768; \ - dst = bound_tmp; - -#define MAXBOUND(dst,eqn) bound_tmp = eqn; \ - if (bound_tmp > 32767) \ - bound_tmp = 32767; \ - dst = bound_tmp; - -#define MAXUBOUND(dst,eqn) bound_tmp = eqn; \ - if (bound_tmp > 65535) \ - bound_tmp = 65535; \ - dst = bound_tmp; - - if (pGC->lineStyle == LineSolid && - pGC->joinStyle == JoinMiter && - pGC->lineWidth != 0) { - int ntmp; - int offset1, offset2, offset3; - int x, y, width, height; - int tx, ty, tw, th; - - ntmp = (nrects << 2); - offset2 = pGC->lineWidth; - offset1 = offset2 >> 1; - offset3 = offset2 - offset1; - for (i = 0; i < nrects; i++) { - x = pR->x; - y = pR->y; - width = pR->width; - height = pR->height; - pR++; - if (width == 0 && height == 0) { - FFB_WRITE_DRAWOP(pFfb, ffb, FFB_DRAWOP_DOT); - FFBFifo(pFfb, 2); - FFB_WRITE64(&ffb->bh, y + pDrawable->y, x + pDrawable->x); - continue; - } - FFB_WRITE_DRAWOP(pFfb, ffb, FFB_DRAWOP_RECTANGLE); - if (height < offset2 || width < offset1) { - if (height == 0) { - tx = x; - tw = width; - } else { - MINBOUND (tx, x - offset1); - MAXUBOUND (tw, width + offset2); - } - if (width == 0) { - ty = y; - th = height; - } else { - MINBOUND (ty, y - offset1); - MAXUBOUND (th, height + offset2); - } - FFBFifo(pFfb, 4); - FFB_WRITE64(&ffb->by, ty + pDrawable->y, tx + pDrawable->x); - FFB_WRITE64_2(&ffb->bh, th, tw); - } else { - MINBOUND(tx, x - offset1); - MINBOUND(ty, y - offset1); - MAXUBOUND(tw, width + offset2); - th = offset2; - FFBFifo(pFfb, 13); - FFB_WRITE64(&ffb->by, ty + pDrawable->y, tx + pDrawable->x); - FFB_WRITE64_2(&ffb->bh, th, tw); - MAXBOUND(ty, y + offset3); - tw = offset2; - th = height - offset2; - ffb->by = ty + pDrawable->y; - FFB_WRITE64_2(&ffb->bh, th, tw); - MAXBOUND(tx, x + width - offset1); - ffb->bx = tx + pDrawable->x; - ffb->bw = tw; - MINBOUND(tx, x - offset1); - MAXBOUND(ty, y + height - offset1); - MAXUBOUND(tw, width + offset2); - th = offset2; - FFB_WRITE64(&ffb->by, ty + pDrawable->y, tx + pDrawable->x); - FFB_WRITE64_2(&ffb->bh, th, tw); - } - } - } else { - int xOrg = pDrawable->x; - int yOrg = pDrawable->y; - unsigned int linepat = gcPriv->linepat; - - FFB_WRITE_DRAWOP(pFfb, ffb, line_drawop); - if(linepat == 0) { - FFBFifo(pFfb, 1); - ffb->lpat = 0; - } - for (i=0; i < nrects; i++) { - register int x0, xCoord, y0, yCoord; - - x0 = xCoord = pR->x; - y0 = yCoord = pR->y; - FFBFifo(pFfb, 11); - if(linepat) - ffb->lpat = linepat; - else - ffb->ppc = 0; - FFB_WRITE64(&ffb->by, (yCoord + yOrg), (xCoord + xOrg)); - MAXBOUND(xCoord, pR->x + (int) pR->width); - FFB_WRITE64(&ffb->bh, (yCoord + yOrg), (xCoord + xOrg)); - MAXBOUND(yCoord, pR->y + (int) pR->height); - FFB_WRITE64_2(&ffb->bh, (yCoord + yOrg), (xCoord + xOrg)); - FFB_WRITE64_3(&ffb->bh, (yCoord + yOrg), (x0 + xOrg)); - FFB_WRITE64(&ffb->bh, (y0 + yOrg), (x0 + xOrg)); - pR++; - } - } -} diff --git a/src/ffb_seg.c b/src/ffb_seg.c deleted file mode 100644 index 9be630a..0000000 --- a/src/ffb_seg.c +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Acceleration for the Creator and Creator3D framebuffer - Segment rops. - * - * Copyright (C) 1998,1999,2000 Jakub Jelinek (jakub@redhat.com) - * Copyright (C) 1999 David S. Miller (davem@redhat.com) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * JAKUB JELINEK OR DAVID MILLER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - * - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_seg.c,v 1.1 2000/05/18 23:21:37 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "ffb.h" -#include "ffb_regs.h" -#include "ffb_rcache.h" -#include "ffb_fifo.h" -#include "ffb_loops.h" -#include "ffb_stip.h" - -#include "pixmapstr.h" -#include "scrnintstr.h" - -#define PSZ 8 -#include "cfb.h" -#undef PSZ -#include "cfb32.h" - -#include "miline.h" - -/* The general strategy is to do the drawing completely in hardware - * iff: - * 1) Single region rect - * 2) Both ends of the segment lie within it - */ -#define SEG_DRAWOP(__pgc) ((__pgc)->capStyle == CapNotLast ? \ - FFB_DRAWOP_BRLINEOPEN : \ - FFB_DRAWOP_BRLINECAP) -static void -ReloadSegmentAttrs(FFBPtr pFfb, CreatorPrivGCPtr gcPriv, GCPtr pGC, WindowPtr pWin) -{ - if(gcPriv->stipple == NULL) { - FFB_ATTR_GC(pFfb, pGC, pWin, - FFB_PPC_APE_DISABLE | FFB_PPC_CS_CONST, - SEG_DRAWOP(pGC)); - } else { - ffb_fbcPtr ffb = pFfb->regs; - unsigned int fbc; - - FFBSetStipple(pFfb, ffb, gcPriv->stipple, - FFB_PPC_CS_CONST, FFB_PPC_CS_MASK); - FFB_WRITE_PMASK(pFfb, ffb, pGC->planemask); - FFB_WRITE_DRAWOP(pFfb, ffb, SEG_DRAWOP(pGC)); - fbc = FFB_FBC_WIN(pWin); - fbc = (fbc & ~FFB_FBC_XE_MASK) | FFB_FBC_XE_OFF; - FFB_WRITE_FBC(pFfb, ffb, fbc); - } -} - -void -CreatorPolySegment (DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pSeg) -{ - WindowPtr pWin = (WindowPtr) pDrawable; - CreatorPrivGCPtr gcPriv = CreatorGetGCPrivate (pGC); - FFBPtr pFfb = GET_FFB_FROM_SCREEN (pGC->pScreen); - ffb_fbcPtr ffb = pFfb->regs; - BoxPtr extent; - int xorg, yorg, lpat; - - if (nseg == 0) - return; - - FFBLOG(("CreatorPolySegment: ALU(%x) PMSK(%08x) nseg(%d) lpat(%08x)\n", - pGC->alu, pGC->planemask, nseg, gcPriv->linepat)); - - if (gcPriv->stipple == NULL) { - FFB_ATTR_GC(pFfb, pGC, pWin, - FFB_PPC_APE_DISABLE | FFB_PPC_CS_CONST, - SEG_DRAWOP(pGC)); - } else { - unsigned int fbc; - - FFBSetStipple(pFfb, ffb, gcPriv->stipple, - FFB_PPC_CS_CONST, FFB_PPC_CS_MASK); - FFB_WRITE_PMASK(pFfb, ffb, pGC->planemask); - FFB_WRITE_DRAWOP(pFfb, ffb, SEG_DRAWOP(pGC)); - fbc = FFB_FBC_WIN(pWin); - fbc = (fbc & ~FFB_FBC_XE_MASK) | FFB_FBC_XE_OFF; - FFB_WRITE_FBC(pFfb, ffb, fbc); - } - - pFfb->rp_active = 1; - xorg = pDrawable->x; - yorg = pDrawable->y; - extent = REGION_RECTS(cfbGetCompositeClip(pGC)); - lpat = gcPriv->linepat; - - if (lpat == 0) { - FFBFifo(pFfb, 1); - ffb->lpat = 0; - if (pFfb->has_brline_bug) { - while (nseg--) { - register int x1 = pSeg->x1 + xorg; - register int y1 = pSeg->y1 + yorg; - register int x2 = pSeg->x2 + xorg; - register int y2 = pSeg->y2 + yorg; - - if (x1 >= extent->x1 && - x2 >= extent->x1 && - x1 < extent->x2 && - x2 < extent->x2 && - y1 >= extent->y1 && - y2 >= extent->y1 && - y1 < extent->y2 && - y2 < extent->y2) { - FFBFifo(pFfb, 5); - ffb->ppc = 0; - FFB_WRITE64(&ffb->by, y1, x1); - FFB_WRITE64_2(&ffb->bh, y2, x2); - } else { - gcPriv->PolySegment(pDrawable, pGC, 1, pSeg); - ReloadSegmentAttrs(pFfb, gcPriv, pGC, pWin); - pFfb->rp_active = 1; - } - pSeg++; - } - } else { - while (nseg--) { - register int x1 = pSeg->x1 + xorg; - register int y1 = pSeg->y1 + yorg; - register int x2 = pSeg->x2 + xorg; - register int y2 = pSeg->y2 + yorg; - - if (x1 >= extent->x1 && - x2 >= extent->x1 && - x1 < extent->x2 && - x2 < extent->x2 && - y1 >= extent->y1 && - y2 >= extent->y1 && - y1 < extent->y2 && - y2 < extent->y2) { - FFBFifo(pFfb, 4); - FFB_WRITE64(&ffb->by, y1, x1); - FFB_WRITE64_2(&ffb->bh, y2, x2); - } else { - gcPriv->PolySegment(pDrawable, pGC, 1, pSeg); - ReloadSegmentAttrs(pFfb, gcPriv, pGC, pWin); - pFfb->rp_active = 1; - } - pSeg++; - } - } - } else { - /* No reason to optimize the non-brline bug case since - * we have to write the line pattern register each loop - * anyways. - */ - while (nseg--) { - register int x1 = pSeg->x1 + xorg; - register int y1 = pSeg->y1 + yorg; - register int x2 = pSeg->x2 + xorg; - register int y2 = pSeg->y2 + yorg; - - if (x1 >= extent->x1 && x2 >= extent->x1 && - x1 < extent->x2 && x2 < extent->x2 && - y1 >= extent->y1 && y2 >= extent->y1 && - y1 < extent->y2 && y2 < extent->y2) { - FFBFifo(pFfb, 5); - ffb->lpat = lpat; - FFB_WRITE64(&ffb->by, y1, x1); - FFB_WRITE64_2(&ffb->bh, y2, x2); - } else { - gcPriv->PolySegment(pDrawable, pGC, 1, pSeg); - ReloadSegmentAttrs(pFfb, gcPriv, pGC, pWin); - pFfb->rp_active = 1; - } - pSeg++; - } - } - - FFBSync(pFfb, ffb); -} diff --git a/src/ffb_sspans.c b/src/ffb_sspans.c deleted file mode 100644 index 39d3f47..0000000 --- a/src/ffb_sspans.c +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Acceleration for the Creator and Creator3D framebuffer - Set spans. - * - * Copyright (C) 1998,1999 Jakub Jelinek (jakub@redhat.com) - * Copyright (C) 1999 David S. Miller (davem@redhat.com) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * JAKUB JELINEK OR DAVID MILLER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_sspans.c,v 1.1 2000/05/18 23:21:37 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "ffb.h" -#include "ffb_regs.h" -#include "ffb_rcache.h" -#include "ffb_fifo.h" - -#include "pixmapstr.h" -#include "scrnintstr.h" - -#define PSZ 8 -#include "cfb.h" -#undef PSZ -#include "cfb32.h" - -/* PPC does all of the planemask and ROP'ing on the written pixels, - * and we know various other things are constant, so this is easy. - */ -static void -CreatorSetScanline(int y, int xOrigin, int xStart, int xEnd, - unsigned int *_psrc, char *sfb, int depth) -{ - if (depth == 8) { - unsigned char *psrc = (unsigned char *)_psrc; - unsigned char *pdst = (unsigned char *)(sfb + - (y << 11) + - (xStart << 0)); - int w = xEnd - xStart; - - psrc += (xStart - xOrigin); - while(w--) - *pdst++ = *psrc++; - } else { - unsigned int *psrc = (unsigned int *)_psrc; - unsigned int *pdst = (unsigned int *)(sfb + - (y << 13) + - (xStart << 2)); - int w = xEnd - xStart; - - psrc += (xStart - xOrigin); - while(w--) - *pdst++ = *psrc++; - } -} - -void -CreatorSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *pcharsrc, - DDXPointPtr ppt, int *pwidth, int nspans, int fSorted) -{ - WindowPtr pWin = (WindowPtr) pDrawable; - FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen); - ffb_fbcPtr ffb = pFfb->regs; - unsigned int *psrc = (unsigned int *)pcharsrc; - BoxPtr pbox, pboxLast, pboxTest; - DDXPointPtr pptLast; - RegionPtr prgnDst; - char *addrp; - int xStart, xEnd, yMax; - - if(pDrawable->type != DRAWABLE_WINDOW) { - if (pDrawable->bitsPerPixel == 8) - cfbSetSpans(pDrawable, pGC, pcharsrc, ppt, - pwidth, nspans, fSorted); - else - cfb32SetSpans(pDrawable, pGC, pcharsrc, ppt, - pwidth, nspans, fSorted); - return; - } - FFBLOG(("CreatorSetSpans: ALU(%x) PMSK(%08x) nspans(%d) fsorted(%d)\n", - pGC->alu, pGC->planemask, nspans, fSorted)); - if (pGC->alu == GXnoop) - return; - - /* Get SFB ready. */ - FFB_ATTR_SFB_VAR_WIN(pFfb, pGC->planemask, pGC->alu, pWin); - FFBWait(pFfb, ffb); - - if (pGC->depth == 8) - addrp = (char *) pFfb->sfb8r; - else - addrp = (char *) pFfb->sfb32; - - yMax = (int) pDrawable->y + (int) pDrawable->height; - prgnDst = cfbGetCompositeClip(pGC); - pbox = REGION_RECTS(prgnDst); - pboxLast = pbox + REGION_NUM_RECTS(prgnDst); - pptLast = ppt + nspans; - if(fSorted) { - pboxTest = pbox; - while(ppt < pptLast) { - pbox = pboxTest; - if(ppt->y >= yMax) - break; - while(pbox < pboxLast) { - if(pbox->y1 > ppt->y) { - break; - } else if(pbox->y2 <= ppt->y) { - pboxTest = ++pbox; - continue; - } else if(pbox->x1 > ppt->x + *pwidth) { - break; - } else if(pbox->x2 <= ppt->x) { - pbox++; - continue; - } - xStart = max(pbox->x1, ppt->x); - xEnd = min(ppt->x + *pwidth, pbox->x2); - CreatorSetScanline(ppt->y, ppt->x, xStart, xEnd, - psrc, addrp, pGC->depth); - if(ppt->x + *pwidth <= pbox->x2) - break; - else - pbox++; - } - ppt++; - psrc += *pwidth++; - } - } else { - while(ppt < pptLast) { - if(ppt->y >= 0 && ppt->y < yMax) { - for(pbox = REGION_RECTS(prgnDst); pbox < pboxLast; pbox++) { - if(pbox->y1 > ppt->y) { - break; - } else if(pbox->y2 <= ppt->y) { - pbox++; - break; - } - if(pbox->x1 <= ppt->x + *pwidth && - pbox->x2 > ppt->x) { - xStart = max(pbox->x1, ppt->x); - xEnd = min(pbox->x2, ppt->x + *pwidth); - CreatorSetScanline(ppt->y, ppt->x, - xStart, xEnd, - psrc, addrp, pGC->depth); - } - } - } - ppt++; - psrc += *pwidth++; - } - } -} diff --git a/src/ffb_stip.c b/src/ffb_stip.c deleted file mode 100644 index f434d1d..0000000 --- a/src/ffb_stip.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Acceleration for the Creator and Creator3D framebuffer - stipple setting. - * - * Copyright (C) 1998,1999 Jakub Jelinek (jakub@redhat.com) - * Copyright (C) 1999 David S. Miller (davem@redhat.com) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * JAKUB JELINEK OR DAVID MILLER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - * - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_stip.c,v 1.1 2000/05/18 23:21:38 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "ffb.h" -#include "ffb_regs.h" -#include "ffb_rcache.h" -#include "ffb_fifo.h" -#include "ffb_stip.h" -#include "ffb_loops.h" - -void -FFBSetStipple(FFBPtr pFfb, ffb_fbcPtr ffb, - CreatorStipplePtr stipple, - unsigned int ppc, unsigned int ppc_mask) -{ - int transparent = ((stipple->alu & FFB_ROP_EDIT_BIT) != 0); - - if(transparent) - ppc |= FFB_PPC_APE_ENABLE|FFB_PPC_TBE_TRANSPARENT; - else - ppc |= FFB_PPC_APE_ENABLE|FFB_PPC_TBE_OPAQUE; - ppc_mask |= FFB_PPC_APE_MASK|FFB_PPC_TBE_MASK; - FFB_WRITE_PPC(pFfb, ffb, ppc, ppc_mask); - FFB_WRITE_ROP(pFfb, ffb, - (FFB_ROP_EDIT_BIT|stipple->alu)| (FFB_ROP_NEW<<8)); - - if (stipple->inhw && pFfb->laststipple == stipple) { - FFB_WRITE_FG(pFfb, ffb, stipple->fg); - if(!transparent) - FFB_WRITE_BG(pFfb, ffb, stipple->bg); - return; - } - FFBFifo(pFfb, 32); - FFB_STIPPLE_LOAD(&ffb->pattern[0], &stipple->bits[0]); - FFB_WRITE_FG(pFfb, ffb, stipple->fg); - if(!transparent) - FFB_WRITE_BG(pFfb, ffb, stipple->bg); - stipple->inhw = 1; - pFfb->laststipple = stipple; -} diff --git a/src/ffb_stip.h b/src/ffb_stip.h deleted file mode 100644 index 3d490d0..0000000 --- a/src/ffb_stip.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Acceleration for the Creator and Creator3D framebuffer - stipple defines. - * - * Copyright (C) 1998,1999 Jakub Jelinek (jakub@redhat.com) - * Copyright (C) 1999 David S. Miller (davem@redhat.com) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * JAKUB JELINEK OR DAVID MILLER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - * - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_stip.h,v 1.1 2000/05/18 23:21:38 dawes Exp $ */ - -#ifndef FFBSTIP_H -#define FFBSTIP_H - -extern void FFBSetStipple(FFBPtr pFfb, - ffb_fbcPtr ffb, - CreatorStipplePtr stipple, - unsigned int ppc, unsigned int ppc_mask); - -#endif /* FFBSTIP_H */ diff --git a/src/ffb_stubs.c b/src/ffb_stubs.c deleted file mode 100644 index 2fdd746..0000000 --- a/src/ffb_stubs.c +++ /dev/null @@ -1,548 +0,0 @@ -/* - * Acceleration for the Creator and Creator3D framebuffer - Unaccelerated stuff. - * - * Copyright (C) 1999 David S. Miller (davem@redhat.com) - * Copyright (C) 1999 Jakub Jelinek (jakub@redhat.com) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * DAVID MILLER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_stubs.c,v 1.1 2000/05/18 23:21:38 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "ffb.h" -#include "ffb_regs.h" -#include "ffb_rcache.h" -#include "ffb_fifo.h" - -#include "pixmapstr.h" -#include "scrnintstr.h" - -#define PSZ 8 -#include "cfb.h" -#undef PSZ -#include "cfb32.h" - -/* CFB is just too clever for it's own good. There are paths - * in cfb for 8bpp that just arbitrarily change the ROP of the - * GC and assume it just works even without revalidating that - * GC. So for now we turn this stuff off. -DaveM - */ -#undef USE_SFB_TRICKS - -#ifdef USE_SFB_TRICKS -/* Sorry, have to expose some CFB internals to get the stubs right. -DaveM */ -struct cfb_gcstate { - unsigned long pmask; - int alu, rop, and, xor; -}; - -#define CFB_STATE_SAVE(__statep, __gcp, __privp) \ -do { (__statep)->pmask = (__gcp)->planemask; \ - (__statep)->alu = (__gcp)->alu; \ - (__statep)->rop = (__privp)->rop; \ - (__statep)->and = (__privp)->and; \ - (__statep)->xor = (__privp)->xor; \ -} while(0) - -#define CFB_STATE_RESTORE(__statep, __gcp, __privp) \ -do { (__gcp)->planemask = (__statep)->pmask; \ - (__gcp)->alu = (__statep)->alu; \ - (__privp)->rop = (__statep)->rop; \ - (__privp)->and = (__statep)->and; \ - (__privp)->xor = (__statep)->xor; \ -} while(0) - -#define CFB_STATE_SET_SFB(__gcp, __privp) \ -do { (__gcp)->alu = GXcopy; \ - (__gcp)->planemask = (((__gcp)->depth==8)?0xff:0xffffff); \ - (__privp)->rop = GXcopy; \ - (__privp)->and = 0; \ - (__privp)->xor = (__gcp)->fgPixel; \ -} while(0) -#endif - -/* Stubs so we can wait for the raster processor to - * unbusy itself before we let the cfb code write - * directly to the framebuffer. - */ -void -CreatorSolidSpansGeneralStub (DrawablePtr pDrawable, GCPtr pGC, - int nInit, DDXPointPtr pptInit, - int *pwidthInit, int fSorted) -{ - WindowPtr pWin = (WindowPtr) pDrawable; - FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen); - ffb_fbcPtr ffb = pFfb->regs; - - FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__)); - FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin); - FFBWait(pFfb, ffb); - if (pGC->depth == 8) - cfbSolidSpansGeneral(pDrawable, pGC, nInit, pptInit, - pwidthInit, fSorted); - else - cfb32SolidSpansGeneral(pDrawable, pGC, nInit, pptInit, - pwidthInit, fSorted); -} - -void -CreatorSegmentSSStub (DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pSeg) -{ - WindowPtr pWin = (WindowPtr) pDrawable; - FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen); - ffb_fbcPtr ffb = pFfb->regs; - cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC); -#ifdef USE_SFB_TRICKS - struct cfb_gcstate cfb_state; -#endif - - FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__)); -#ifndef USE_SFB_TRICKS - FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin); - FFBWait(pFfb, ffb); - if (pGC->depth == 8) { - if (devPriv->oneRect && - ((pDrawable->x >= pGC->pScreen->width - 32768) && - (pDrawable->y >= pGC->pScreen->height - 32768))) - cfb8SegmentSS1Rect(pDrawable, pGC, nseg, pSeg); - else - cfbSegmentSS(pDrawable, pGC, nseg, pSeg); - } else - cfb32SegmentSS(pDrawable, pGC, nseg, pSeg); -#else - CFB_STATE_SAVE(&cfb_state, pGC, devPriv); - FFB_ATTR_SFB_VAR_WIN(pFfb, cfb_state.pmask, cfb_state.alu, pWin); - FFBWait(pFfb, ffb); - CFB_STATE_SET_SFB(pGC, devPriv); - if (pGC->depth == 8) { - if (devPriv->oneRect && - ((pDrawable->x >= pGC->pScreen->width - 32768) && - (pDrawable->y >= pGC->pScreen->height - 32768))) - cfb8SegmentSS1Rect(pDrawable, pGC, nseg, pSeg); - else - cfbSegmentSS(pDrawable, pGC, nseg, pSeg); - } else - cfb32SegmentSS(pDrawable, pGC, nseg, pSeg); - CFB_STATE_RESTORE(&cfb_state, pGC, devPriv); -#endif -} - -void -CreatorLineSSStub (DrawablePtr pDrawable, GCPtr pGC, - int mode, int npt, DDXPointPtr ppt) -{ - WindowPtr pWin = (WindowPtr) pDrawable; - FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen); - ffb_fbcPtr ffb = pFfb->regs; - cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC); -#ifdef USE_SFB_TRICKS - struct cfb_gcstate cfb_state; -#endif - - FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__)); -#ifndef USE_SFB_TRICKS - FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin); - FFBWait(pFfb, ffb); - if (pGC->depth == 8) { - if (devPriv->oneRect && - ((pDrawable->x >= pGC->pScreen->width - 32768) && - (pDrawable->y >= pGC->pScreen->height - 32768))) - cfb8LineSS1Rect(pDrawable, pGC, mode, npt, ppt); - else - cfbLineSS(pDrawable, pGC, mode, npt, ppt); - } else - cfb32LineSS(pDrawable, pGC, mode, npt, ppt); -#else - CFB_STATE_SAVE(&cfb_state, pGC, devPriv); - FFB_ATTR_SFB_VAR_WIN(pFfb, cfb_state.pmask, cfb_state.alu, pWin); - FFBWait(pFfb, ffb); - CFB_STATE_SET_SFB(pGC, devPriv); - if (pGC->depth == 8) { - if (devPriv->oneRect && - ((pDrawable->x >= pGC->pScreen->width - 32768) && - (pDrawable->y >= pGC->pScreen->height - 32768))) - cfb8LineSS1Rect(pDrawable, pGC, mode, npt, ppt); - else - cfbLineSS(pDrawable, pGC, mode, npt, ppt); - } else - cfb32LineSS(pDrawable, pGC, mode, npt, ppt); - CFB_STATE_RESTORE(&cfb_state, pGC, devPriv); -#endif -} - -void -CreatorSegmentSDStub (DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pSeg) -{ - WindowPtr pWin = (WindowPtr) pDrawable; - FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen); - ffb_fbcPtr ffb = pFfb->regs; -#ifdef USE_SFB_TRICKS - struct cfb_gcstate cfb_state; - cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC); -#endif - - FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__)); -#ifndef USE_SFB_TRICKS - FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin); - FFBWait(pFfb, ffb); - if (pGC->depth == 8) - cfbSegmentSD(pDrawable, pGC, nseg, pSeg); - else - cfb32SegmentSD(pDrawable, pGC, nseg, pSeg); -#else - CFB_STATE_SAVE(&cfb_state, pGC, devPriv); - FFB_ATTR_SFB_VAR_WIN(pFfb, cfb_state.pmask, cfb_state.alu, pWin); - FFBWait(pFfb, ffb); - CFB_STATE_SET_SFB(pGC, devPriv); - if (pGC->depth == 8) - cfbSegmentSD(pDrawable, pGC, nseg, pSeg); - else - cfb32SegmentSD(pDrawable, pGC, nseg, pSeg); - CFB_STATE_RESTORE(&cfb_state, pGC, devPriv); -#endif -} - -void -CreatorLineSDStub (DrawablePtr pDrawable, GCPtr pGC, - int mode, int npt, DDXPointPtr ppt) -{ - WindowPtr pWin = (WindowPtr) pDrawable; - FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen); - ffb_fbcPtr ffb = pFfb->regs; -#ifdef USE_SFB_TRICKS - struct cfb_gcstate cfb_state; - cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC); -#endif - - FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__)); -#ifndef USE_SFB_TRICKS - FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin); - FFBWait(pFfb, ffb); - if (pGC->depth == 8) - cfbLineSD(pDrawable, pGC, mode, npt, ppt); - else - cfb32LineSD(pDrawable, pGC, mode, npt, ppt); -#else - CFB_STATE_SAVE(&cfb_state, pGC, devPriv); - FFB_ATTR_SFB_VAR_WIN(pFfb, cfb_state.pmask, cfb_state.alu, pWin); - FFBWait(pFfb, ffb); - CFB_STATE_SET_SFB(pGC, devPriv); - if (pGC->depth == 8) - cfbLineSD(pDrawable, pGC, mode, npt, ppt); - else - cfb32LineSD(pDrawable, pGC, mode, npt, ppt); - CFB_STATE_RESTORE(&cfb_state, pGC, devPriv); -#endif -} - -void -CreatorPolyGlyphBlt8Stub (DrawablePtr pDrawable, GCPtr pGC, - int x, int y, unsigned int nglyph, CharInfoPtr *ppci, - pointer pglyphBase) -{ - WindowPtr pWin = (WindowPtr) pDrawable; - FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen); - ffb_fbcPtr ffb = pFfb->regs; -#ifdef USE_SFB_TRICKS - struct cfb_gcstate cfb_state; - cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC); -#endif - - FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__)); -#ifndef USE_SFB_TRICKS - FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin); - FFBWait(pFfb, ffb); - if (pGC->depth == 8) - cfbPolyGlyphBlt8(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); - else - cfb32PolyGlyphBlt8(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); -#else - CFB_STATE_SAVE(&cfb_state, pGC, devPriv); - FFB_ATTR_SFB_VAR_WIN(pFfb, cfb_state.pmask, cfb_state.alu, pWin); - FFBWait(pFfb, ffb); - CFB_STATE_SET_SFB(pGC, devPriv); - if (pGC->depth == 8) - cfbPolyGlyphBlt8(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); - else - cfb32PolyGlyphBlt8(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); - CFB_STATE_RESTORE(&cfb_state, pGC, devPriv); -#endif -} - -void -CreatorImageGlyphBlt8Stub (DrawablePtr pDrawable, GCPtr pGC, - int x, int y, unsigned int nglyph, - CharInfoPtr *ppci, pointer pglyphBase) -{ - WindowPtr pWin = (WindowPtr) pDrawable; - FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen); - ffb_fbcPtr ffb = pFfb->regs; -#ifdef USE_SFB_TRICKS - struct cfb_gcstate cfb_state; - cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC); -#endif - - FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__)); -#ifndef USE_SFB_TRICKS - FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin); - FFBWait(pFfb, ffb); - if (pGC->depth == 8) - cfbImageGlyphBlt8(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); - else - cfb32ImageGlyphBlt8(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); -#else - CFB_STATE_SAVE(&cfb_state, pGC, devPriv); - FFB_ATTR_SFB_VAR_WIN(pFfb, cfb_state.pmask, cfb_state.alu, pWin); - FFBWait(pFfb, ffb); - CFB_STATE_SET_SFB(pGC, devPriv); - if (pGC->depth == 8) - cfbImageGlyphBlt8(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); - else - cfb32ImageGlyphBlt8(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); - CFB_STATE_RESTORE(&cfb_state, pGC, devPriv); -#endif -} - -void -CreatorTile32FSCopyStub(DrawablePtr pDrawable, GCPtr pGC, - int nInit, DDXPointPtr pptInit, - int *pwidthInit, int fSorted) -{ - WindowPtr pWin = (WindowPtr) pDrawable; - FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen); - ffb_fbcPtr ffb = pFfb->regs; -#ifdef USE_SFB_TRICKS - struct cfb_gcstate cfb_state; - cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC); -#endif - - FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__)); -#ifndef USE_SFB_TRICKS - FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin); - FFBWait(pFfb, ffb); - if (pGC->depth == 8) - cfbTile32FSCopy(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted); - else - cfb32Tile32FSCopy(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted); -#else - CFB_STATE_SAVE(&cfb_state, pGC, devPriv); - FFB_ATTR_SFB_VAR_WIN(pFfb, cfb_state.pmask, cfb_state.alu, pWin); - FFBWait(pFfb, ffb); - CFB_STATE_SET_SFB(pGC, devPriv); - if (pGC->depth == 8) - cfbTile32FSCopy(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted); - else - cfb32Tile32FSCopy(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted); - CFB_STATE_RESTORE(&cfb_state, pGC, devPriv); -#endif -} - -void -CreatorTile32FSGeneralStub(DrawablePtr pDrawable, GCPtr pGC, - int nInit, DDXPointPtr pptInit, - int *pwidthInit, int fSorted) -{ - WindowPtr pWin = (WindowPtr) pDrawable; - FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen); - ffb_fbcPtr ffb = pFfb->regs; -#ifdef USE_SFB_TRICKS - struct cfb_gcstate cfb_state; - cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC); -#endif - - FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__)); -#ifndef USE_SFB_TRICKS - FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin); - FFBWait(pFfb, ffb); - if (pGC->depth == 8) - cfbTile32FSGeneral(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted); - else - cfb32Tile32FSGeneral(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted); -#else - CFB_STATE_SAVE(&cfb_state, pGC, devPriv); - FFB_ATTR_SFB_VAR_WIN(pFfb, cfb_state.pmask, cfb_state.alu, pWin); - FFBWait(pFfb, ffb); - CFB_STATE_SET_SFB(pGC, devPriv); - if (pGC->depth == 8) - cfbTile32FSGeneral(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted); - else - cfb32Tile32FSGeneral(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted); - CFB_STATE_RESTORE(&cfb_state, pGC, devPriv); -#endif -} - -void -CreatorUnnaturalTileFSStub(DrawablePtr pDrawable, GCPtr pGC, - int nInit, DDXPointPtr pptInit, - int *pwidthInit, int fSorted) -{ - WindowPtr pWin = (WindowPtr) pDrawable; - FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen); - ffb_fbcPtr ffb = pFfb->regs; -#ifdef USE_SFB_TRICKS - struct cfb_gcstate cfb_state; - cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC); -#endif - - FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__)); -#ifndef USE_SFB_TRICKS - FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin); - FFBWait(pFfb, ffb); - if (pGC->depth == 8) - cfbUnnaturalTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted); - else - cfb32UnnaturalTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted); -#else - CFB_STATE_SAVE(&cfb_state, pGC, devPriv); - FFB_ATTR_SFB_VAR_WIN(pFfb, cfb_state.pmask, cfb_state.alu, pWin); - FFBWait(pFfb, ffb); - CFB_STATE_SET_SFB(pGC, devPriv); - if (pGC->depth == 8) - cfbUnnaturalTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted); - else - cfb32UnnaturalTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted); - CFB_STATE_RESTORE(&cfb_state, pGC, devPriv); -#endif -} - -void -Creator8Stipple32FSStub(DrawablePtr pDrawable, GCPtr pGC, - int nInit, DDXPointPtr pptInit, - int *pwidthInit, int fSorted) -{ - WindowPtr pWin = (WindowPtr) pDrawable; - FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen); - ffb_fbcPtr ffb = pFfb->regs; -#ifdef USE_SFB_TRICKS - struct cfb_gcstate cfb_state; - cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC); -#endif - - FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__)); -#ifndef USE_SFB_TRICKS - FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin); - FFBWait(pFfb, ffb); - cfb8Stipple32FS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted); -#else - CFB_STATE_SAVE(&cfb_state, pGC, devPriv); - FFB_ATTR_SFB_VAR_WIN(pFfb, cfb_state.pmask, cfb_state.alu, pWin); - FFBWait(pFfb, ffb); - CFB_STATE_SET_SFB(pGC, devPriv); - cfb8Stipple32FS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted); - CFB_STATE_RESTORE(&cfb_state, pGC, devPriv); -#endif -} - -void -CreatorUnnaturalStippleFSStub(DrawablePtr pDrawable, GCPtr pGC, - int nInit, DDXPointPtr pptInit, - int *pwidthInit, int fSorted) -{ - WindowPtr pWin = (WindowPtr) pDrawable; - FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen); - ffb_fbcPtr ffb = pFfb->regs; -#ifdef USE_SFB_TRICKS - struct cfb_gcstate cfb_state; - cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC); -#endif - - FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__)); -#ifndef USE_SFB_TRICKS - FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin); - FFBWait(pFfb, ffb); - if (pGC->depth == 8) - cfbUnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted); - else - cfb32UnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted); -#else - CFB_STATE_SAVE(&cfb_state, pGC, devPriv); - FFB_ATTR_SFB_VAR_WIN(pFfb, cfb_state.pmask, cfb_state.alu, pWin); - FFBWait(pFfb, ffb); - CFB_STATE_SET_SFB(pGC, devPriv); - if (pGC->depth == 8) - cfbUnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted); - else - cfb32UnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted); - CFB_STATE_RESTORE(&cfb_state, pGC, devPriv); -#endif -} - -void -Creator8OpaqueStipple32FSStub(DrawablePtr pDrawable, GCPtr pGC, - int nInit, DDXPointPtr pptInit, - int *pwidthInit, int fSorted) -{ - WindowPtr pWin = (WindowPtr) pDrawable; - FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen); - ffb_fbcPtr ffb = pFfb->regs; -#ifdef USE_SFB_TRICKS - struct cfb_gcstate cfb_state; - cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC); -#endif - - FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__)); -#ifndef USE_SFB_TRICKS - FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin); - FFBWait(pFfb, ffb); - cfb8OpaqueStipple32FS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted); -#else - CFB_STATE_SAVE(&cfb_state, pGC, devPriv); - FFB_ATTR_SFB_VAR_WIN(pFfb, cfb_state.pmask, cfb_state.alu, pWin); - FFBWait(pFfb, ffb); - CFB_STATE_SET_SFB(pGC, devPriv); - cfb8OpaqueStipple32FS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted); - CFB_STATE_RESTORE(&cfb_state, pGC, devPriv); -#endif -} - -void -CreatorPolyFillRectStub(DrawablePtr pDrawable, GCPtr pGC, - int nrectFill, xRectangle *prectInit) -{ - WindowPtr pWin = (WindowPtr) pDrawable; - FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen); - ffb_fbcPtr ffb = pFfb->regs; -#ifdef USE_SFB_TRICKS - struct cfb_gcstate cfb_state; - cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC); -#endif - - FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__)); -#ifndef USE_SFB_TRICKS - FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin); - FFBWait(pFfb, ffb); - if (pGC->depth == 8) - cfbPolyFillRect(pDrawable, pGC, nrectFill, prectInit); - else - cfb32PolyFillRect(pDrawable, pGC, nrectFill, prectInit); -#else - CFB_STATE_SAVE(&cfb_state, pGC, devPriv); - FFB_ATTR_SFB_VAR_WIN(pFfb, cfb_state.pmask, cfb_state.alu, pWin); - FFBWait(pFfb, ffb); - CFB_STATE_SET_SFB(pGC, devPriv); - if (pGC->depth == 8) - cfbPolyFillRect(pDrawable, pGC, nrectFill, prectInit); - else - cfb32PolyFillRect(pDrawable, pGC, nrectFill, prectInit); - CFB_STATE_RESTORE(&cfb_state, pGC, devPriv); -#endif -} diff --git a/src/ffb_wline.c b/src/ffb_wline.c deleted file mode 100644 index 08afe8f..0000000 --- a/src/ffb_wline.c +++ /dev/null @@ -1,900 +0,0 @@ -/* - * Acceleration for the Creator and Creator3D framebuffer - Wide line rops. - * - * Copyright (C) 1999 David S. Miller (davem@redhat.com) - * Copyright (C) 1999 Jakub Jelinek (jakub@redhat.com) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * JAKUB JELINEK OR DAVID MILLER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - * - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_wline.c,v 1.2 2000/05/23 04:47:45 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#define PSZ 32 - -#include "ffb.h" -#include "ffb_regs.h" -#include "ffb_rcache.h" -#include "ffb_fifo.h" - -#include "pixmapstr.h" -#include "scrnintstr.h" - -#include "cfb.h" - -#include "miwideline.h" - -#error If we start using this again, need to fixup FFB_WRITE_ATTRIBUTES for wids -DaveM - -/* Wheee, wide lines... */ -extern int miPolyBuildEdge(); - -static int LeftClip, RightClip, TopClip, BottomClip; - -#define Y_IN_BOX(y) (((y) >= TopClip) && ((y) <= BottomClip)) -#define CLIPSTEPEDGE(edgey,edge,edgeleft) \ -if (ybase == edgey) { \ - if (edgeleft) { \ - if (edge->x > xcl) \ - xcl = edge->x; \ - } else { \ - if (edge->x < xcr) \ - xcr = edge->x; \ - } \ - edgey++; \ - edge->x += edge->stepx; \ - edge->e += edge->dx; \ - if (edge->e > 0) { \ - edge->x += edge->signdx; \ - edge->e -= edge->dy; \ - } \ -} - -#define CreatorPointHelper(pFfb, x, y) \ -do { \ - ffb_fbcPtr ffb = (pFfb)->regs; \ - FFB_WRITE_DRAWOP((pFfb), ffb, FFB_DRAWOP_DOT); \ - FFBFifo(pFfb, 2); \ - FFB_WRITE64(&ffb->bh, (y), (x)); \ -} while (0) - -static void CreatorFillRectHelper(FFBPtr pFfb, - int x, int y, int dx, int dy) -{ - ffb_fbcPtr ffb = pFfb->regs; - int x2 = x + dx - 1; - int y2 = y + dy - 1; - - if(x < LeftClip) - x = LeftClip; - if(x2 > RightClip) - x2 = RightClip; - if(y < TopClip) - y = TopClip; - if(y2 > BottomClip) - y2 = BottomClip; - - dx = x2 - x + 1; - dy = y2 - y + 1; - - if((dx > 0) && (dy > 0)) { - FFB_WRITE_DRAWOP(pFfb, ffb, FFB_DRAWOP_RECTANGLE); - FFBFifo(pFfb, 4); - FFB_WRITE64(&ffb->by, y, x); - FFB_WRITE64_2(&ffb->bh, dy, dx); - } -} - -/* The span helper does not check for y being clipped, caller beware */ -static void CreatorSpanHelper(FFBPtr pFfb, - int x1, int y, int width) -{ - ffb_fbcPtr ffb = pFfb->regs; - int x2 = x1 + width - 1; - - if(x1 < LeftClip) - x1 = LeftClip; - if(x2 > RightClip) - x2 = RightClip; - width = x2 - x1 + 1; - - if(width > 0) { - FFB_WRITE_DRAWOP(pFfb, ffb, FFB_DRAWOP_RECTANGLE); - FFBFifo(pFfb, 4); - FFB_WRITE64(&ffb->by, y, x1); - FFB_WRITE64_2(&ffb->bh, 1, width); - } -} - -#define FixError(x, dx, dy, e, sign, step, h) { \ - e += (h) * dx; \ - x += (h) * step; \ - if(e > 0) { \ - x += e * sign/dy; \ - e %= dy; \ - if(e) { \ - x += sign; \ - e -= dy; \ - } \ - } \ -} - -static void -CreatorFillPolyHelper (DrawablePtr pDrawable, GCPtr pGC, - int y, int overall_height, - PolyEdgePtr left, PolyEdgePtr right, - int left_count, int right_count) -{ - FFBPtr pFfb = GET_FFB_FROM_SCREEN(pDrawable->pScreen); - int left_x, left_e, left_stepx, left_signdx, left_dy, left_dx; - int right_x, right_e, right_stepx, right_signdx, right_dy, right_dx, height; - int left_height = 0; - int right_height = 0; - int xorg = 0; - - if (pGC->miTranslate) { - y += pDrawable->y; - xorg = pDrawable->x; - } - - while ((left_count || left_height) && (right_count || right_height)) { - if (!left_height && left_count) { - left_height = left->height; - left_x = left->x + xorg; - left_stepx = left->stepx; - left_signdx = left->signdx; - left_e = left->e; - left_dy = left->dy; - left_dx = left->dx; - left_count--; - left++; - } - if (!right_height && right_count) { - right_height = right->height; - right_x = right->x + xorg + 1; - right_stepx = right->stepx; - right_signdx = right->signdx; - right_e = right->e; - right_dy = right->dy; - right_dx = right->dx; - right_count--; - right++; - } - - height = (left_height > right_height) ? right_height : left_height; - - left_height -= height; - right_height -= height; - while (height--) { - if((right_x > left_x) && Y_IN_BOX(y)) - CreatorSpanHelper(pFfb, left_x, y, right_x - left_x); - - y++; - - left_x += left_stepx; - left_e += left_dx; - if (left_e > 0) { - left_x += left_signdx; - left_e -= left_dy; - } - right_x += right_stepx; - right_e += right_dx; - if (right_e > 0) { - right_x += right_signdx; - right_e -= right_dy; - } - } - } -} - -static void -CreatorWideSegment (DrawablePtr pDrawable, GCPtr pGC, - int x1, int y1, int x2, int y2, - Bool projectLeft, Bool projectRight, - LineFacePtr leftFace, LineFacePtr rightFace) -{ - FFBPtr pFfb = GET_FFB_FROM_SCREEN(pDrawable->pScreen); - double l, L, r, xa, ya, projectXoff, projectYoff, k, maxy; - int x, y, dx, dy, finaly, lefty, righty, topy, bottomy, signdx; - PolyEdgePtr left, right, top, bottom; - PolyEdgeRec lefts[2], rights[2]; - LineFacePtr tface; - int lw = pGC->lineWidth; - - /* draw top-to-bottom always */ - if (y2 < y1 || y2 == y1 && x2 < x1) { - x = x1; - x1 = x2; - x2 = x; - - y = y1; - y1 = y2; - y2 = y; - - x = projectLeft; - projectLeft = projectRight; - projectRight = x; - - tface = leftFace; - leftFace = rightFace; - rightFace = tface; - } - - dy = y2 - y1; - signdx = 1; - dx = x2 - x1; - if (dx < 0) - signdx = -1; - - leftFace->x = x1; - leftFace->y = y1; - leftFace->dx = dx; - leftFace->dy = dy; - - rightFace->x = x2; - rightFace->y = y2; - rightFace->dx = -dx; - rightFace->dy = -dy; - - if (!dy) { - rightFace->xa = 0; - rightFace->ya = (double) lw / 2.0; - rightFace->k = -(double) (lw * dx) / 2.0; - leftFace->xa = 0; - leftFace->ya = -rightFace->ya; - leftFace->k = rightFace->k; - x = x1; - if (projectLeft) - x -= (lw >> 1); - y = y1 - (lw >> 1); - dx = x2 - x; - if (projectRight) - dx += (lw + 1 >> 1); - dy = lw; - if(pGC->miTranslate) { - x += pDrawable->x; - y += pDrawable->y; - } - CreatorFillRectHelper(pFfb, x, y, dx, dy); - } else if (!dx) { - leftFace->xa = (double) lw / 2.0; - leftFace->ya = 0; - leftFace->k = (double) (lw * dy) / 2.0; - rightFace->xa = -leftFace->xa; - rightFace->ya = 0; - rightFace->k = leftFace->k; - y = y1; - if (projectLeft) - y -= lw >> 1; - x = x1 - (lw >> 1); - dy = y2 - y; - if (projectRight) - dy += (lw + 1 >> 1); - dx = lw; - if(pGC->miTranslate) { - x += pDrawable->x; - y += pDrawable->y; - } - CreatorFillRectHelper(pFfb, x, y, dx, dy); - } else { - l = ((double) lw) / 2.0; - L = sqrt((double)(dx*dx + dy*dy)); - - if (dx < 0) { - right = &rights[1]; - left = &lefts[0]; - top = &rights[0]; - bottom = &lefts[1]; - } else { - right = &rights[0]; - left = &lefts[1]; - top = &lefts[0]; - bottom = &rights[1]; - } - r = l / L; - - /* coord of upper bound at integral y */ - ya = -r * dx; - xa = r * dy; - - if (projectLeft | projectRight) { - projectXoff = -ya; - projectYoff = xa; - } - - /* xa * dy - ya * dx */ - k = l * L; - - leftFace->xa = xa; - leftFace->ya = ya; - leftFace->k = k; - rightFace->xa = -xa; - rightFace->ya = -ya; - rightFace->k = k; - - if (projectLeft) - righty = miPolyBuildEdge (xa - projectXoff, ya - projectYoff, - k, dx, dy, x1, y1, 0, right); - else - righty = miPolyBuildEdge (xa, ya, - k, dx, dy, x1, y1, 0, right); - - /* coord of lower bound at integral y */ - ya = -ya; - xa = -xa; - - /* xa * dy - ya * dx */ - k = - k; - - if (projectLeft) - lefty = miPolyBuildEdge (xa - projectXoff, ya - projectYoff, - k, dx, dy, x1, y1, 1, left); - else - lefty = miPolyBuildEdge (xa, ya, - k, dx, dy, x1, y1, 1, left); - - /* coord of top face at integral y */ - if (signdx > 0) { - ya = -ya; - xa = -xa; - } - - if (projectLeft) { - double xap = xa - projectXoff; - double yap = ya - projectYoff; - topy = miPolyBuildEdge (xap, yap, xap * dx + yap * dy, - -dy, dx, x1, y1, dx > 0, top); - } - else - topy = miPolyBuildEdge(xa, ya, 0.0, - -dy, dx, x1, y1, dx > 0, top); - - /* coord of bottom face at integral y */ - if (projectRight) { - double xap = xa + projectXoff; - double yap = ya + projectYoff; - bottomy = miPolyBuildEdge (xap, yap, xap * dx + yap * dy, - -dy, dx, x2, y2, dx < 0, bottom); - maxy = -ya + projectYoff; - } else { - bottomy = miPolyBuildEdge (xa, ya, 0.0, - -dy, dx, x2, y2, dx < 0, bottom); - maxy = -ya; - } - - finaly = ICEIL (maxy) + y2; - - if (dx < 0) { - left->height = bottomy - lefty; - right->height = finaly - righty; - top->height = righty - topy; - } else { - right->height = bottomy - righty; - left->height = finaly - lefty; - top->height = lefty - topy; - } - bottom->height = finaly - bottomy; - CreatorFillPolyHelper (pDrawable, pGC, topy, - bottom->height + bottomy - topy, lefts, rights, 2, 2); - } -} - -static void -CreatorLineArcI (DrawablePtr pDraw, GCPtr pGC, int xorg, int yorg) -{ - FFBPtr pFfb = GET_FFB_FROM_SCREEN(pDraw->pScreen); - int x, y, e, ex, slw; - - if (pGC->miTranslate) { - xorg += pDraw->x; - yorg += pDraw->y; - } - - slw = pGC->lineWidth; - if (slw == 1) { - CreatorPointHelper(pFfb, xorg, yorg); - return; - } - - y = (slw >> 1) + 1; - if (slw & 1) - e = - ((y << 2) + 3); - else - e = - (y << 3); - ex = -4; - x = 0; - while (y) { - e += (y << 3) - 4; - while (e >= 0) { - x++; - e += (ex = -((x << 3) + 4)); - } - y--; - slw = (x << 1) + 1; - if ((e == ex) && (slw > 1)) - slw--; - - if(Y_IN_BOX(yorg - y)) - CreatorSpanHelper(pFfb, xorg - x, yorg - y, slw); - - if ((y != 0) && ((slw > 1) || (e != ex)) && Y_IN_BOX(yorg + y)) - CreatorSpanHelper(pFfb, xorg - x, yorg + y, slw); - } -} - -static void -CreatorLineArcD (DrawablePtr pDraw, GCPtr pGC, - double xorg, double yorg, - PolyEdgePtr edge1, int edgey1, Bool edgeleft1, - PolyEdgePtr edge2, int edgey2, Bool edgeleft2) -{ - FFBPtr pFfb = GET_FFB_FROM_SCREEN(pDraw->pScreen); - double radius, x0, y0, el, er, yk, xlk, xrk, k; - int xbase, ybase, y, boty, xl, xr, xcl, xcr, ymin, ymax, ymin1, ymin2; - Bool edge1IsMin, edge2IsMin; - - xbase = floor(xorg); - x0 = xorg - xbase; - ybase = ICEIL (yorg); - y0 = yorg - ybase; - if (pGC->miTranslate) { - xbase += pDraw->x; - ybase += pDraw->y; - edge1->x += pDraw->x; - edge2->x += pDraw->x; - edgey1 += pDraw->y; - edgey2 += pDraw->y; - } - - xlk = x0 + x0 + 1.0; - xrk = x0 + x0 - 1.0; - yk = y0 + y0 - 1.0; - radius = ((double)pGC->lineWidth) / 2.0; - y = floor(radius - y0 + 1.0); - ybase -= y; - ymin = ybase; - ymax = 65536; - edge1IsMin = FALSE; - ymin1 = edgey1; - if (edge1->dy >= 0) { - if (!edge1->dy) { - if (edgeleft1) - edge1IsMin = TRUE; - else - ymax = edgey1; - edgey1 = 65536; - } else if ((edge1->signdx < 0) == edgeleft1) - edge1IsMin = TRUE; - } - edge2IsMin = FALSE; - ymin2 = edgey2; - if (edge2->dy >= 0) { - if (!edge2->dy) { - if (edgeleft2) - edge2IsMin = TRUE; - else - ymax = edgey2; - edgey2 = 65536; - } else if ((edge2->signdx < 0) == edgeleft2) - edge2IsMin = TRUE; - } - if (edge1IsMin) { - ymin = ymin1; - if (edge2IsMin && (ymin1 > ymin2)) - ymin = ymin2; - } else if (edge2IsMin) - ymin = ymin2; - el = radius * radius - ((y + y0) * (y + y0)) - (x0 * x0); - er = el + xrk; - xl = 1; - xr = 0; - if (x0 < 0.5) { - xl = 0; - el -= xlk; - } - boty = (y0 < -0.5) ? 1 : 0; - if (ybase + y - boty > ymax) - boty = ymax - ybase - y; - while (y > boty) { - k = (y << 1) + yk; - er += k; - while (er > 0.0) { - xr++; - er += xrk - (xr << 1); - } - el += k; - while (el >= 0.0) { - xl--; - el += (xl << 1) - xlk; - } - y--; - ybase++; - if (ybase < ymin) - continue; - xcl = xl + xbase; - xcr = xr + xbase; - CLIPSTEPEDGE(edgey1, edge1, edgeleft1); - CLIPSTEPEDGE(edgey2, edge2, edgeleft2); - if((xcr >= xcl) && Y_IN_BOX(ybase)) - CreatorSpanHelper(pFfb, xcl, ybase, xcr - xcl + 1); - } - er = xrk - (xr << 1) - er; - el = (xl << 1) - xlk - el; - boty = floor(-y0 - radius + 1.0); - if (ybase + y - boty > ymax) - boty = ymax - ybase - y; - while (y > boty) { - k = (y << 1) + yk; - er -= k; - while ((er >= 0.0) && (xr >= 0)) { - xr--; - er += xrk - (xr << 1); - } - el -= k; - while ((el > 0.0) && (xl <= 0)) { - xl++; - el += (xl << 1) - xlk; - } - y--; - ybase++; - if (ybase < ymin) - continue; - xcl = xl + xbase; - xcr = xr + xbase; - CLIPSTEPEDGE(edgey1, edge1, edgeleft1); - CLIPSTEPEDGE(edgey2, edge2, edgeleft2); - if((xcr >= xcl) && Y_IN_BOX(ybase)) - CreatorSpanHelper(pFfb, xcl, ybase, xcr - xcl + 1); - } -} - - -static void -CreatorLineArc (DrawablePtr pDraw, GCPtr pGC, - LineFacePtr leftFace, LineFacePtr rightFace, - double xorg, double yorg, - Bool isInt) -{ - int xorgi, yorgi, edgey1, edgey2; - PolyEdgeRec edge1, edge2; - Bool edgeleft1, edgeleft2; - - if (isInt) { - xorgi = leftFace ? leftFace->x : rightFace->x; - yorgi = leftFace ? leftFace->y : rightFace->y; - } - edgey1 = 65536; - edgey2 = 65536; - edge1.x = 0; /* not used, keep memory checkers happy */ - edge1.dy = -1; - edge2.x = 0; /* not used, keep memory checkers happy */ - edge2.dy = -1; - edgeleft1 = FALSE; - edgeleft2 = FALSE; - - if ((pGC->lineWidth > 2) && - (pGC->capStyle == CapRound && pGC->joinStyle != JoinRound || - pGC->joinStyle == JoinRound && pGC->capStyle == CapButt)) { - if (isInt) { - xorg = (double) xorgi; - yorg = (double) yorgi; - } - - if (leftFace && rightFace) { - miRoundJoinClip (leftFace, rightFace, &edge1, &edge2, - &edgey1, &edgey2, &edgeleft1, &edgeleft2); - } else if (leftFace) { - edgey1 = miRoundCapClip (leftFace, isInt, &edge1, &edgeleft1); - } else if (rightFace) { - edgey2 = miRoundCapClip (rightFace, isInt, &edge2, &edgeleft2); - } - - isInt = FALSE; - } - - if (isInt) - CreatorLineArcI(pDraw, pGC, xorgi, yorgi); - else - CreatorLineArcD(pDraw, pGC, xorg, yorg, - &edge1, edgey1, edgeleft1, - &edge2, edgey2, edgeleft2); -} - -static void -CreatorLineJoin (DrawablePtr pDrawable, GCPtr pGC, LineFacePtr pLeft, LineFacePtr pRight) -{ - FFBPtr pFfb = GET_FFB_FROM_SCREEN(pDrawable->pScreen); - double mx, my, denom; - PolyVertexRec vertices[4]; - PolySlopeRec slopes[4]; - PolyEdgeRec left[4], right[4]; - int edgecount, nleft, nright, y, height, swapslopes; - int joinStyle = pGC->joinStyle; - int lw = pGC->lineWidth; - - if (lw == 1) { - /* Lines going in the same direction have no join */ - if ((pLeft->dx >= 0) == (pRight->dx <= 0)) - return; - if (joinStyle != JoinRound) { - denom = - pLeft->dx * (double)pRight->dy + pRight->dx * - (double)pLeft->dy; - if (denom == 0.0) - return; /* no join to draw */ - } - if (joinStyle != JoinMiter) { - if(pGC->miTranslate) - CreatorPointHelper(pFfb, - pLeft->x + pDrawable->x, - pLeft->y + pDrawable->y); - else - CreatorPointHelper(pFfb, pLeft->x, pLeft->y); - return; - } - } else { - if (joinStyle == JoinRound) { - CreatorLineArc(pDrawable, pGC, pLeft, pRight, - (double)0.0, (double)0.0, TRUE); - return; - } - denom = - pLeft->dx * (double)pRight->dy + pRight->dx * - (double)pLeft->dy; - if (denom == 0.0) - return; /* no join to draw */ - } - - swapslopes = 0; - if (denom > 0) { - pLeft->xa = -pLeft->xa; - pLeft->ya = -pLeft->ya; - pLeft->dx = -pLeft->dx; - pLeft->dy = -pLeft->dy; - } else { - swapslopes = 1; - pRight->xa = -pRight->xa; - pRight->ya = -pRight->ya; - pRight->dx = -pRight->dx; - pRight->dy = -pRight->dy; - } - - vertices[0].x = pRight->xa; - vertices[0].y = pRight->ya; - slopes[0].dx = -pRight->dy; - slopes[0].dy = pRight->dx; - slopes[0].k = 0; - - vertices[1].x = 0; - vertices[1].y = 0; - slopes[1].dx = pLeft->dy; - slopes[1].dy = -pLeft->dx; - slopes[1].k = 0; - - vertices[2].x = pLeft->xa; - vertices[2].y = pLeft->ya; - - if (joinStyle == JoinMiter) { - my = (pLeft->dy * (pRight->xa * pRight->dy - pRight->ya * pRight->dx) - - pRight->dy * (pLeft->xa * pLeft->dy - pLeft->ya * pLeft->dx ))/ - denom; - if (pLeft->dy != 0) - mx = pLeft->xa + (my - pLeft->ya) * - (double) pLeft->dx / (double) pLeft->dy; - else - mx = pRight->xa + (my - pRight->ya) * - (double) pRight->dx / (double) pRight->dy; - - /* check miter limit */ - if ((mx * mx + my * my) * 4 > SQSECANT * lw * lw) - joinStyle = JoinBevel; - } - - if (joinStyle == JoinMiter) { - slopes[2].dx = pLeft->dx; - slopes[2].dy = pLeft->dy; - slopes[2].k = pLeft->k; - if (swapslopes) { - slopes[2].dx = -slopes[2].dx; - slopes[2].dy = -slopes[2].dy; - slopes[2].k = -slopes[2].k; - } - vertices[3].x = mx; - vertices[3].y = my; - slopes[3].dx = pRight->dx; - slopes[3].dy = pRight->dy; - slopes[3].k = pRight->k; - if (swapslopes) { - slopes[3].dx = -slopes[3].dx; - slopes[3].dy = -slopes[3].dy; - slopes[3].k = -slopes[3].k; - } - edgecount = 4; - } else { - double scale, dx, dy, adx, ady; - - adx = dx = pRight->xa - pLeft->xa; - ady = dy = pRight->ya - pLeft->ya; - if (adx < 0) - adx = -adx; - if (ady < 0) - ady = -ady; - scale = ady; - if (adx > ady) - scale = adx; - slopes[2].dx = (dx * 65536) / scale; - slopes[2].dy = (dy * 65536) / scale; - slopes[2].k = ((pLeft->xa + pRight->xa) * slopes[2].dy - - (pLeft->ya + pRight->ya) * slopes[2].dx) / 2.0; - edgecount = 3; - } - - y = miPolyBuildPoly (vertices, slopes, edgecount, pLeft->x, pLeft->y, - left, right, &nleft, &nright, &height); - CreatorFillPolyHelper(pDrawable, pGC, y, height, left, right, nleft, nright); -} - -void -CreatorWideLineSolid (DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr pPts) -{ - int x1, y1, x2, y2, first = TRUE; - Bool projectLeft, projectRight, somethingDrawn = FALSE, selfJoin = FALSE; - LineFaceRec leftFace, rightFace, prevRightFace, firstFace; - cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC); - FFBPtr pFfb = GET_FFB_FROM_SCREEN(pDrawable->pScreen); - ffb_fbcPtr ffb = pFfb->regs; - RegionPtr clip; - int numRects; - unsigned int ppc; - BoxPtr pbox; - - clip = ((cfbPrivGC *)(pGC->devPrivates[cfbGCPrivateIndex].ptr))->pCompositeClip; - numRects = REGION_NUM_RECTS(clip); - if (!numRects) - return; - if (!(ppc = FFBSetClip(pFfb, ffb, clip, numRects))) { - miWideLine(pDrawable, pGC, mode, npt, pPts); - return; - } - - LeftClip = 2048; TopClip = 2048; - RightClip = 0; BottomClip = 0; - for (pbox = REGION_RECTS(clip); numRects; numRects--, pbox++) { - if (pbox->x1 < LeftClip) LeftClip = pbox->x1; - if (pbox->x2 > RightClip) RightClip = pbox->x2 - 1; - if (pbox->y1 < TopClip) TopClip = pbox->y1; - if (pbox->y2 > BottomClip) BottomClip = pbox->y2 - 1; - } - - FFB_WRITE_ATTRIBUTES(pFfb, - ppc|FFB_PPC_APE_DISABLE|FFB_PPC_TBE_OPAQUE| - FFB_PPC_XS_CONST|FFB_PPC_YS_CONST|FFB_PPC_ZS_CONST|FFB_PPC_CS_CONST, - FFB_PPC_VCE_MASK|FFB_PPC_ACE_MASK|FFB_PPC_APE_MASK|FFB_PPC_TBE_MASK| - FFB_PPC_XS_MASK|FFB_PPC_YS_MASK|FFB_PPC_ZS_MASK|FFB_PPC_CS_MASK, - pGC->planemask, - FFB_ROP_EDIT_BIT|pGC->alu, - -1, pGC->fgPixel, - FFB_FBC_DEFAULT); - - x2 = pPts->x; - y2 = pPts->y; - if (npt > 1) { - if (mode == CoordModePrevious) { - int nptTmp; - register DDXPointPtr pPtsTmp; - - x1 = x2; - y1 = y2; - nptTmp = npt; - pPtsTmp = pPts + 1; - while (--nptTmp) { - x1 += pPtsTmp->x; - y1 += pPtsTmp->y; - ++pPtsTmp; - } - if ((x2 == x1) && (y2 == y1)) - selfJoin = TRUE; - } else if ((x2 == pPts[npt-1].x) && (y2 == pPts[npt-1].y)) - selfJoin = TRUE; - } - - projectLeft = ((pGC->capStyle == CapProjecting) && !selfJoin); - projectRight = FALSE; - - while (--npt) { - x1 = x2; - y1 = y2; - ++pPts; - x2 = pPts->x; - y2 = pPts->y; - if (mode == CoordModePrevious) { - x2 += x1; - y2 += y1; - } - if ((x1 != x2) || (y1 != y2)) { - somethingDrawn = TRUE; - if ((npt == 1) && (pGC->capStyle == CapProjecting) && !selfJoin) - projectRight = TRUE; - CreatorWideSegment(pDrawable, pGC, x1, y1, x2, y2, - projectLeft, projectRight, &leftFace, &rightFace); - if (first) { - if (selfJoin) - firstFace = leftFace; - else if (pGC->capStyle == CapRound) { - if (pGC->lineWidth == 1) { - if(pGC->miTranslate) - CreatorPointHelper(pFfb, - x1 + pDrawable->x, - y1 + pDrawable->y); - else - CreatorPointHelper(pFfb, x1, y1); - } else - CreatorLineArc(pDrawable, pGC, - &leftFace, (LineFacePtr) NULL, - (double)0.0, (double)0.0, - TRUE); - } - } else - CreatorLineJoin (pDrawable, pGC, &leftFace, &prevRightFace); - - prevRightFace = rightFace; - first = FALSE; - projectLeft = FALSE; - } - if (npt == 1 && somethingDrawn) { - if (selfJoin) - CreatorLineJoin (pDrawable, pGC, &firstFace, &rightFace); - else if (pGC->capStyle == CapRound) { - if (pGC->lineWidth == 1) { - if(pGC->miTranslate) - CreatorPointHelper(pFfb, - x2 + pDrawable->x, - y2 + pDrawable->y); - else - CreatorPointHelper(pFfb, x2, y2); - } else - CreatorLineArc (pDrawable, pGC, - (LineFacePtr) NULL, &rightFace, - (double)0.0, (double)0.0, - TRUE); - } - } - } - - /* handle crock where all points are coincedent */ - if (!somethingDrawn) { - projectLeft = (pGC->capStyle == CapProjecting); - CreatorWideSegment (pDrawable, pGC, - x2, y2, x2, y2, projectLeft, projectLeft, - &leftFace, &rightFace); - if (pGC->capStyle == CapRound) { - CreatorLineArc (pDrawable, pGC, - &leftFace, (LineFacePtr) NULL, - (double)0.0, (double)0.0, - TRUE); - rightFace.dx = -1; /* sleezy hack to make it work */ - CreatorLineArc (pDrawable, pGC, - (LineFacePtr) NULL, &rightFace, - (double)0.0, (double)0.0, - TRUE); - } - } - pFfb->rp_active = 1; -} diff --git a/src/ffb_zeroarc.c b/src/ffb_zeroarc.c deleted file mode 100644 index 74ba3c9..0000000 --- a/src/ffb_zeroarc.c +++ /dev/null @@ -1,540 +0,0 @@ -/* - * Acceleration for the Creator and Creator3D framebuffer - Zero arc - * rops. - * - * Copyright (C) 1999 Jakub Jelinek (jakub@redhat.com) - * - * Derived from mi/mizerarc.c, see there for authors. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * JAKUB JELINEK OR DAVID MILLER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_zeroarc.c,v 1.1 2000/05/18 23:21:38 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "ffb.h" -#include "ffb_regs.h" -#include "ffb_rcache.h" -#include "ffb_fifo.h" -#include "ffb_stip.h" - -#include "pixmapstr.h" -#include "scrnintstr.h" - -#define PSZ 8 -#include "cfb.h" -#undef PSZ -#include "cfb32.h" - -#include "mi.h" -#include "mizerarc.h" - -#define FULLCIRCLE (360 * 64) -#define OCTANT (45 * 64) -#define QUADRANT (90 * 64) -#define HALFCIRCLE (180 * 64) -#define QUADRANT3 (270 * 64) - -typedef struct { - int skipStart; - int haveStart; - DDXPointRec startPt; - int haveLast; - int skipLast; - DDXPointRec endPt; - int dashIndex; - int dashOffset; - int dashIndexInit; - int dashOffsetInit; -} DashInfo; - -#define Pixelate(xval,yval,ext) \ -if (((xval)+xoff) >= (ext)->x1 && \ - ((xval)+xoff) < (ext)->x2 && \ - ((yval)+yoff) >= (ext)->y1 && \ - ((yval)+yoff) < (ext)->y2) { \ - FFBFifo(pFfb, 2); \ - FFB_WRITE64(&ffb->bh, ((yval)+yoff), ((xval)+xoff)); \ -} - -#define Pixelate1(xval,yval,ext) \ -if (((xval)+xoff) >= (ext)->x1 && \ - ((xval)+xoff) < (ext)->x2 && \ - ((yval)+yoff) >= (ext)->y1 && \ - ((yval)+yoff) < (ext)->y2) { \ - FFBFifo(pFfb, 2); \ - FFB_WRITE64(&ffb->bh, ((yval)+yoff), ((xval)+xoff)); \ -} - -#define DoPix(idx,xval,yval,ext) if (mask & (1 << idx)) Pixelate(xval, yval,ext); - -static void -CreatorZeroArcPts(xArc *arc, DrawablePtr pDrawable, GCPtr pGC, BoxPtr pextent) -{ - miZeroArcRec info; - register int x, y, a, b, d, mask; - register int k1, k3, dx, dy; - int xoff, yoff; - Bool do360; - FFBPtr pFfb = GET_FFB_FROM_SCREEN(pDrawable->pScreen); - ffb_fbcPtr ffb = pFfb->regs; - - xoff = 0; - yoff = 0; - if (pGC->miTranslate) { - xoff = pDrawable->x; - yoff = pDrawable->y; - } - do360 = miZeroArcSetup(arc, &info, TRUE); - MIARCSETUP(); - mask = info.initialMask; - if (!(arc->width & 1)) { - DoPix(1, info.xorgo, info.yorg, pextent); - DoPix(3, info.xorgo, info.yorgo, pextent); - } - if (!info.end.x || !info.end.y) { - mask = info.end.mask; - info.end = info.altend; - } - if (do360 && (arc->width == arc->height) && !(arc->width & 1)) { - int yorgh = info.yorg + info.h; - int xorghp = info.xorg + info.h; - int xorghn = info.xorg - info.h; - int lastx = 0, lasty = 0; - - while (1) { - if (a < 0) - break; - Pixelate1(info.xorg + x, info.yorg + y, pextent); - Pixelate1(info.xorg - x, info.yorg + y, pextent); - Pixelate1(info.xorg - x, info.yorgo - y, pextent); - Pixelate1(info.xorg + x, info.yorgo - y, pextent); - Pixelate1(xorghp - y, yorgh - x, pextent); - Pixelate1(xorghn + y, yorgh - x, pextent); - Pixelate1(xorghn + y, yorgh + x, pextent); - lastx = xorghp - y; lasty = yorgh + x; - Pixelate1(xorghp - y, yorgh + x, pextent); - MIARCCIRCLESTEP(;); - } - if (x <= 0 || lastx != info.xorg + x || lasty != info.yorg + y) { - Pixelate1(info.xorg + x, info.yorg + y, pextent); - Pixelate1(info.xorg - x, info.yorg + y, pextent); - Pixelate1(info.xorg - x, info.yorgo - y, pextent); - Pixelate1(info.xorg + x, info.yorgo - y, pextent); - } - x = info.w; - y = info.h; - } else if (do360) { - while (y < info.h || x < info.w) { - MIARCOCTANTSHIFT(;); - Pixelate1(info.xorg + x, info.yorg + y, pextent); - Pixelate1(info.xorgo - x, info.yorg + y, pextent); - Pixelate1(info.xorgo - x, info.yorgo - y, pextent); - Pixelate1(info.xorg + x, info.yorgo - y, pextent); - MIARCSTEP(;,;); - } - } else { - while (y < info.h || x < info.w) { - MIARCOCTANTSHIFT(;); - if ((x == info.start.x) || (y == info.start.y)) { - mask = info.start.mask; - info.start = info.altstart; - } - DoPix(0, info.xorg + x, info.yorg + y, pextent); - DoPix(1, info.xorgo - x, info.yorg + y, pextent); - DoPix(2, info.xorgo - x, info.yorgo - y, pextent); - DoPix(3, info.xorg + x, info.yorgo - y, pextent); - if (x == info.end.x || y == info.end.y) { - mask = info.end.mask; - info.end = info.altend; - } - MIARCSTEP(;,;); - } - } - if (x == info.start.x || y == info.start.y) - mask = info.start.mask; - DoPix(0, info.xorg + x, info.yorg + y, pextent); - DoPix(2, info.xorgo - x, info.yorgo - y, pextent); - if (arc->height & 1) { - DoPix(1, info.xorgo - x, info.yorg + y, pextent); - DoPix(3, info.xorg + x, info.yorgo - y, pextent); - } -} - -#undef DoPix -#define DoPix(idx,xval,yval) \ - if (mask & (1 << idx)) \ - { \ - arcPts[idx]->x = xval; \ - arcPts[idx]->y = yval; \ - arcPts[idx]++; \ - } - -static void -CreatorZeroArcDashPts(GCPtr pGC, xArc *arc, DashInfo *dinfo, DDXPointPtr points, - int maxPts, DDXPointPtr *evenPts, DDXPointPtr *oddPts) -{ - miZeroArcRec info; - register int x, y, a, b, d, mask; - register int k1, k3, dx, dy; - int dashRemaining; - DDXPointPtr arcPts[4]; - DDXPointPtr startPts[5], endPts[5]; - int deltas[5]; - DDXPointPtr startPt, pt, lastPt, pts; - int i, j, delta, ptsdelta, seg, startseg; - - for (i = 0; i < 4; i++) - arcPts[i] = points + (i * maxPts); - miZeroArcSetup(arc, &info, FALSE); - MIARCSETUP(); - mask = info.initialMask; - startseg = info.startAngle / QUADRANT; - startPt = arcPts[startseg]; - if (!(arc->width & 1)) { - DoPix(1, info.xorgo, info.yorg); - DoPix(3, info.xorgo, info.yorgo); - } - if (!info.end.x || !info.end.y) { - mask = info.end.mask; - info.end = info.altend; - } - while (y < info.h || x < info.w) { - MIARCOCTANTSHIFT(;); - if ((x == info.firstx) || (y == info.firsty)) - startPt = arcPts[startseg]; - if ((x == info.start.x) || (y == info.start.y)) { - mask = info.start.mask; - info.start = info.altstart; - } - DoPix(0, info.xorg + x, info.yorg + y); - DoPix(1, info.xorgo - x, info.yorg + y); - DoPix(2, info.xorgo - x, info.yorgo - y); - DoPix(3, info.xorg + x, info.yorgo - y); - if (x == info.end.x || y == info.end.y) { - mask = info.end.mask; - info.end = info.altend; - } - MIARCSTEP(;,;); - } - if (x == info.firstx || y == info.firsty) - startPt = arcPts[startseg]; - if (x == info.start.x || y == info.start.y) - mask = info.start.mask; - DoPix(0, info.xorg + x, info.yorg + y); - DoPix(2, info.xorgo - x, info.yorgo - y); - if (arc->height & 1) { - DoPix(1, info.xorgo - x, info.yorg + y); - DoPix(3, info.xorg + x, info.yorgo - y); - } - for (i = 0; i < 4; i++) { - seg = (startseg + i) & 3; - pt = points + (seg * maxPts); - if (seg & 1) { - startPts[i] = pt; - endPts[i] = arcPts[seg]; - deltas[i] = 1; - } else { - startPts[i] = arcPts[seg] - 1; - endPts[i] = pt - 1; - deltas[i] = -1; - } - } - startPts[4] = startPts[0]; - endPts[4] = startPt; - startPts[0] = startPt; - if (startseg & 1) { - if (startPts[4] != endPts[4]) - endPts[4]--; - deltas[4] = 1; - } else { - if (startPts[0] > startPts[4]) - startPts[0]--; - if (startPts[4] < endPts[4]) - endPts[4]--; - deltas[4] = -1; - } - if (arc->angle2 < 0) { - DDXPointPtr tmps, tmpe; - int tmpd; - - tmpd = deltas[0]; - tmps = startPts[0] - tmpd; - tmpe = endPts[0] - tmpd; - startPts[0] = endPts[4] - deltas[4]; - endPts[0] = startPts[4] - deltas[4]; - deltas[0] = -deltas[4]; - startPts[4] = tmpe; - endPts[4] = tmps; - deltas[4] = -tmpd; - tmpd = deltas[1]; - tmps = startPts[1] - tmpd; - tmpe = endPts[1] - tmpd; - startPts[1] = endPts[3] - deltas[3]; - endPts[1] = startPts[3] - deltas[3]; - deltas[1] = -deltas[3]; - startPts[3] = tmpe; - endPts[3] = tmps; - deltas[3] = -tmpd; - tmps = startPts[2] - deltas[2]; - startPts[2] = endPts[2] - deltas[2]; - endPts[2] = tmps; - deltas[2] = -deltas[2]; - } - for (i = 0; i < 5 && startPts[i] == endPts[i]; i++); - if (i == 5) - return; - pt = startPts[i]; - for (j = 4; startPts[j] == endPts[j]; j--); - lastPt = endPts[j] - deltas[j]; - if (dinfo->haveLast && - (pt->x == dinfo->endPt.x) && (pt->y == dinfo->endPt.y)) { - startPts[i] += deltas[i]; - } else { - dinfo->dashIndex = dinfo->dashIndexInit; - dinfo->dashOffset = dinfo->dashOffsetInit; - } - if (!dinfo->skipStart && (info.startAngle != info.endAngle)) { - dinfo->startPt = *pt; - dinfo->haveStart = TRUE; - } else if (!dinfo->skipLast && dinfo->haveStart && - (lastPt->x == dinfo->startPt.x) && - (lastPt->y == dinfo->startPt.y) && - (lastPt != startPts[i])) - endPts[j] = lastPt; - if (info.startAngle != info.endAngle) { - dinfo->haveLast = TRUE; - dinfo->endPt = *lastPt; - } - dashRemaining = pGC->dash[dinfo->dashIndex] - dinfo->dashOffset; - for (i = 0; i < 5; i++) { - pt = startPts[i]; - lastPt = endPts[i]; - delta = deltas[i]; - while (pt != lastPt) { - if (dinfo->dashIndex & 1) { - pts = *oddPts; - ptsdelta = -1; - } else { - pts = *evenPts; - ptsdelta = 1; - } - while ((pt != lastPt) && --dashRemaining >= 0) { - *pts = *pt; - pts += ptsdelta; - pt += delta; - } - if (dinfo->dashIndex & 1) - *oddPts = pts; - else - *evenPts = pts; - if (dashRemaining <= 0) { - if (++(dinfo->dashIndex) == pGC->numInDashList) - dinfo->dashIndex = 0; - dashRemaining = pGC->dash[dinfo->dashIndex]; - } - } - } - dinfo->dashOffset = pGC->dash[dinfo->dashIndex] - dashRemaining; -} - -void -CreatorZeroPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs) -{ - WindowPtr pWin = (WindowPtr) pDrawable; - int maxPts = 0; - register int n; - register xArc *arc; - register int i; - register int j, k; - DDXPointPtr points = NULL, pts, oddPts; - int numPts = 0; - DashInfo dinfo; - FFBPtr pFfb; - ffb_fbcPtr ffb; - RegionPtr clip; - int numRects, ppc; - BoxPtr pbox; - CreatorPrivGCPtr gcPriv; - register int off = 0, c1, c2; - register char *addrp = NULL; - register int *ppt, pt, pix; - - gcPriv = CreatorGetGCPrivate (pGC); - pFfb = GET_FFB_FROM_SCREEN(pDrawable->pScreen); - ffb = pFfb->regs; - clip = cfbGetCompositeClip(pGC); - numRects = REGION_NUM_RECTS(clip); - if (!numRects) - return; - if (pGC->lineStyle == LineSolid && numRects != 1) { - miZeroPolyArc(pDrawable, pGC, narcs, parcs); - return; - } - FFBLOG(("CreatorZeroPolyArc: ALU(%x) PMSK(%08x) narcs(%d)\n", - pGC->alu, pGC->planemask, narcs)); - if (pGC->lineStyle == LineSolid) - for (arc = parcs, i = narcs, j = 0; --i >= 0; arc++) { - if (!miCanZeroArc(arc)) - miPolyArc(pDrawable, pGC, 1, arc); - else - j++; - } - else - for (arc = parcs, i = narcs, j = 0; --i >= 0; arc++) { - if (!miCanZeroArc(arc)) - miPolyArc(pDrawable, pGC, 1, arc); - else { - j++; - if (arc->width > arc->height) - n = arc->width + (arc->height >> 1); - else - n = arc->height + (arc->width >> 1); - if (n > maxPts) - maxPts = n; - } - } - if (!j) - return; - - if (pGC->lineStyle != LineSolid) { - numPts = maxPts << 2; - points = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * (numPts + (maxPts << 1))); - if (!points) return; - dinfo.haveStart = FALSE; - dinfo.skipStart = FALSE; - dinfo.haveLast = FALSE; - dinfo.dashIndexInit = 0; - dinfo.dashOffsetInit = 0; - miStepDash((int)pGC->dashOffset, &dinfo.dashIndexInit, - (unsigned char *) pGC->dash, (int)pGC->numInDashList, - &dinfo.dashOffsetInit); - off = *(int *)&pDrawable->x; - off -= (off & 0x8000) << 1; - if (pGC->depth == 8) { - addrp = (char *)pFfb->sfb8r + - (pDrawable->y << 11) + (pDrawable->x << 0); - } else { - addrp = (char *)pFfb->sfb32 + - (pDrawable->y << 13) + (pDrawable->x << 2); - } - ppc = FFB_PPC_CS_VAR; - } else - ppc = FFB_PPC_CS_CONST; - - if(gcPriv->stipple == NULL) { - FFB_ATTR_GC(pFfb, pGC, pWin, - ppc | FFB_PPC_APE_DISABLE, - FFB_DRAWOP_DOT); - } else { - unsigned int fbc; - - FFBSetStipple(pFfb, ffb, gcPriv->stipple, - ppc, FFB_PPC_CS_MASK); - FFB_WRITE_PMASK(pFfb, ffb, pGC->planemask); - FFB_WRITE_DRAWOP(pFfb, ffb, FFB_DRAWOP_DOT); - fbc = FFB_FBC_WIN(pWin); - fbc = (fbc & ~FFB_FBC_XE_MASK) | FFB_FBC_XE_OFF; - FFB_WRITE_FBC(pFfb, ffb, fbc); - } - if((ppc & FFB_PPC_CS_MASK) == FFB_PPC_CS_VAR) - FFBWait(pFfb, ffb); - - for (arc = parcs, i = narcs; --i >= 0; arc++) { - if (miCanZeroArc(arc)) { - if (pGC->lineStyle == LineSolid) - CreatorZeroArcPts(arc, pDrawable, pGC, REGION_RECTS(clip)); - else { - pts = points; - oddPts = &points[(numPts >> 1) - 1]; - dinfo.skipLast = i; - CreatorZeroArcDashPts(pGC, arc, &dinfo, - oddPts + 1, maxPts, &pts, &oddPts); - dinfo.skipStart = TRUE; - n = pts - points; - pbox = REGION_RECTS(clip); - j = numRects; - pix = pGC->fgPixel; - if (pGC->depth == 8) { - while (j--) { - c1 = *(int *)&pbox->x1 - off; - c2 = *(int *)&pbox->x2 - off - 0x00010001; - for (ppt = (int *)points, k = n; --k >= 0; ) { - pt = *ppt++; - if (!(((pt - c1) | (c2 - pt)) & 0x80008000)) - *(unsigned char *)(addrp + ((pt << 11) & 0x3ff800) + ((pt >> 16) & 0x07ff)) = pix; - } - pbox++; - } - } else { - while (j--) { - c1 = *(int *)&pbox->x1 - off; - c2 = *(int *)&pbox->x2 - off - 0x00010001; - for (ppt = (int *)points, k = n; --k >= 0; ) { - pt = *ppt++; - if (!(((pt - c1) | (c2 - pt)) & 0x80008000)) - *(unsigned int *)(addrp + ((pt << 13) & 0xffe000) + ((pt >> 14) & 0x1ffc)) = pix; - } - pbox++; - } - } - if (pGC->lineStyle != LineDoubleDash) - continue; - if ((pGC->fillStyle == FillSolid) || (pGC->fillStyle == FillStippled)) - pix = pGC->bgPixel; - pts = &points[numPts >> 1]; - oddPts++; - n = pts - oddPts; - pbox = REGION_RECTS(clip); - j = numRects; - if (pGC->depth == 8) { - while (j--) { - c1 = *(int *)&pbox->x1 - off; - c2 = *(int *)&pbox->x2 - off - 0x00010001; - for (ppt = (int *)oddPts, k = n; --k >= 0; ) { - pt = *ppt++; - if (!(((pt - c1) | (c2 - pt)) & 0x80008000)) - *(unsigned char *)(addrp + ((pt << 11) & 0x3ff800) + ((pt >> 16) & 0x07ff)) = pix; - } - pbox++; - } - } else { - while (j--) { - c1 = *(int *)&pbox->x1 - off; - c2 = *(int *)&pbox->x2 - off - 0x00010001; - for (ppt = (int *)oddPts, k = n; --k >= 0; ) { - pt = *ppt++; - if (!(((pt - c1) | (c2 - pt)) & 0x80008000)) - *(unsigned int *)(addrp + ((pt << 13) & 0xffe000) + ((pt >> 14) & 0x1ffc)) = pix; - } - pbox++; - } - } - } - } - } - if (pGC->lineStyle != LineSolid) { - DEALLOCATE_LOCAL(points); - } else { - pFfb->rp_active = 1; - FFBSync(pFfb, ffb); - } -} -- cgit v1.2.3