diff options
55 files changed, 832 insertions, 1019 deletions
diff --git a/hw/kdrive/ati/ChangeLog b/hw/kdrive/ati/ChangeLog index 1f9ba29f0..0e5347087 100644 --- a/hw/kdrive/ati/ChangeLog +++ b/hw/kdrive/ati/ChangeLog @@ -1,3 +1,31 @@ +2005-06-09 Eric Anholt <anholt@FreeBSD.org> + + * ati.c: + * ati.h: + * ati_draw.c: (ATIWaitMarker), (ATIGetOffsetPitch), + (ATIUploadToScreen), (ATIUploadToScratch), (ATIDrawInit), + (ATIDrawEnable): + * ati_dri.c: (ATIDRISwapContext): + * ati_video.c: (R128DisplayVideo), (RadeonDisplayVideo): + - Replace the syncAccel hook in the kdrive structure with a pair of + hooks in the kaa structure: markSync and waitMarker. The first, if + set, returns a hardware-dependent marker number which can then be + waited for with waitMarker. If markSync is absent (which is the case + on all drivers currently), waitMarker must wait for idle on any given + marker number. The intention is to allow for more parallelism when + we get downloading from framebuffer, or more fine-grained idling. + - Replace the KdMarkSync/KdCheckSync functions with kaaMarkSync and + kaaWaitSync. These will need to be refined when KAA starts being + smart about using them. Merge kpict.c into kasync.c since kasyn.c has + all the rest of these fallback funcs. + - Restructure all drivers to initialize a KaaInfo structure by hand + rather than statically in dubious order. + - Whack the i810 driver into shape in hopes that it'll work after this + change (it certainly wouldn't have before this). Doesn't support my + i845 though. + - Make a new KXV helper to avoid duplicated code to fill the region + with the necessary color key. Use it in i810 and mach64 (tested). + 2005-02-28 Keith Packard <keithp@keithp.com> * ati_reg.h: diff --git a/hw/kdrive/ati/ati.c b/hw/kdrive/ati/ati.c index 7d395be6c..54624e751 100644 --- a/hw/kdrive/ati/ati.c +++ b/hw/kdrive/ati/ati.c @@ -756,7 +756,6 @@ KdCardFuncs ATIFuncs = { ATIDrawInit, /* initAccel */ ATIDrawEnable, /* enableAccel */ - ATIDrawSync, /* syncAccel */ ATIDrawDisable, /* disableAccel */ ATIDrawFini, /* finiAccel */ diff --git a/hw/kdrive/ati/ati.h b/hw/kdrive/ati/ati.h index cf7525b96..ac66f47a0 100644 --- a/hw/kdrive/ati/ati.h +++ b/hw/kdrive/ati/ati.h @@ -353,9 +353,6 @@ void ATIDrawEnable(ScreenPtr pScreen); void -ATIDrawSync(ScreenPtr pScreen); - -void ATIDrawDisable(ScreenPtr pScreen); void diff --git a/hw/kdrive/ati/ati_draw.c b/hw/kdrive/ati/ati_draw.c index 99b1b8ef2..40f281a87 100644 --- a/hw/kdrive/ati/ati_draw.c +++ b/hw/kdrive/ati/ati_draw.c @@ -192,6 +192,17 @@ ATIDrawSetup(ScreenPtr pScreen) } } +static void +ATIWaitMarker(ScreenPtr pScreen, int marker) +{ + KdScreenPriv(pScreen); + ATIScreenInfo(pScreenPriv); + + ENTER_DRAW(0); + ATIWaitIdle(atis); + LEAVE_DRAW(0); +} + void RadeonSwitchTo2D(ATIScreenInfo *atis) { @@ -287,12 +298,12 @@ ATIGetOffsetPitch(ATIScreenInfo *atis, int bpp, CARD32 *pitch_offset, ATICardInfo *atic = atis->atic; /* On the R128, depending on the bpp the screen can be set up so that it - * doesn't meet the offscreenPitch requirement but can still be + * doesn't meet the pitchAlign requirement but can still be * accelerated, so we check the specific pitch requirement of alignment * to 8 pixels. */ if (atic->is_radeon) { - if (pitch % atis->kaa.offscreenPitch != 0) + if (pitch % atis->kaa.pitchAlign != 0) ATI_FALLBACK(("Bad pitch 0x%08x\n", pitch)); *pitch_offset = ((pitch >> 6) << 22) | (offset >> 10); @@ -302,7 +313,7 @@ ATIGetOffsetPitch(ATIScreenInfo *atis, int bpp, CARD32 *pitch_offset, *pitch_offset = ((pitch / bpp) << 21) | (offset >> 5); } - if (offset % atis->kaa.offscreenByteAlign != 0) + if (offset % atis->kaa.offsetAlign != 0) ATI_FALLBACK(("Bad offset 0x%08x\n", offset)); return TRUE; @@ -656,7 +667,7 @@ ATIUploadToScreen(PixmapPtr pDst, char *src, int src_pitch) END_DMA(); } - KdMarkSync(pScreen); + kaaMarkSync(pScreen); ErrorF("hostdata upload %d,%d %dbpp\n", width, height, bpp); @@ -683,20 +694,19 @@ ATIUploadToScratch(PixmapPtr pSrc, PixmapPtr pDst) if (atis->kaa.flags & KAA_OFFSCREEN_ALIGN_POT) w = 1 << (ATILog2(w - 1) + 1); dst_pitch = (w * pSrc->drawable.bitsPerPixel / 8 + - atis->kaa.offscreenPitch - 1) & ~(atis->kaa.offscreenPitch - 1); + atis->kaa.pitchAlign - 1) & ~(atis->kaa.pitchAlign - 1); size = dst_pitch * pSrc->drawable.height; if (size > atis->scratch_area->size) ATI_FALLBACK(("Pixmap too large for scratch (%d,%d)\n", pSrc->drawable.width, pSrc->drawable.height)); - atis->scratch_next = (atis->scratch_next + - atis->kaa.offscreenByteAlign - 1) & - ~(atis->kaa.offscreenByteAlign - 1); + atis->scratch_next = (atis->scratch_next + atis->kaa.offsetAlign - 1) & + ~(atis->kaa.offsetAlign - 1); if (atis->scratch_next + size > atis->scratch_area->offset + atis->scratch_area->size) { /* Only sync when we've used all of the scratch area. */ - KdCheckSync(pSrc->drawable.pScreen); + kaaWaitSync(pSrc->drawable.pScreen); atis->scratch_next = atis->scratch_area->offset; } memcpy(pDst, pSrc, sizeof(*pDst)); @@ -771,6 +781,7 @@ ATIDrawInit(ScreenPtr pScreen) #endif /* USE_DRI */ memset(&atis->kaa, 0, sizeof(KaaScreenInfoRec)); + atis->kaa.waitMarker = ATIWaitMarker; atis->kaa.PrepareSolid = ATIPrepareSolid; atis->kaa.Solid = ATISolid; atis->kaa.DoneSolid = ATIDoneSolid; @@ -783,16 +794,16 @@ ATIDrawInit(ScreenPtr pScreen) atis->kaa.flags = KAA_OFFSCREEN_PIXMAPS; if (atic->is_radeon) { - atis->kaa.offscreenByteAlign = 1024; - atis->kaa.offscreenPitch = 64; + atis->kaa.offsetAlign = 1024; + atis->kaa.pitchAlign = 64; } else { /* Rage 128 compositing wants power-of-two pitches. */ atis->kaa.flags |= KAA_OFFSCREEN_ALIGN_POT; - atis->kaa.offscreenByteAlign = 32; + atis->kaa.offsetAlign = 32; /* Pitch alignment is in sets of 8 pixels, and we need to cover * 32bpp, so 32 bytes. */ - atis->kaa.offscreenPitch = 32; + atis->kaa.pitchAlign = 32; } kaaInitTrapOffsets(8, sample_offsets_x, sample_offsets_y, 0.0, 0.0); @@ -874,13 +885,13 @@ ATIDrawEnable(ScreenPtr pScreen) * can't be migrated. */ atis->scratch_area = KdOffscreenAlloc(pScreen, 131072, - atis->kaa.offscreenByteAlign, TRUE, ATIScratchSave, atis); + atis->kaa.offsetAlign, TRUE, ATIScratchSave, atis); if (atis->scratch_area != NULL) { atis->scratch_next = atis->scratch_area->offset; atis->kaa.UploadToScratch = ATIUploadToScratch; } - KdMarkSync(pScreen); + kaaMarkSync(pScreen); } void @@ -908,13 +919,3 @@ ATIDrawFini(ScreenPtr pScreen) kaaDrawFini(pScreen); } -void -ATIDrawSync(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - - ENTER_DRAW(0); - ATIWaitIdle(atis); - LEAVE_DRAW(0); -} diff --git a/hw/kdrive/ati/ati_dri.c b/hw/kdrive/ati/ati_dri.c index e7f2bef9f..64aa4625a 100644 --- a/hw/kdrive/ati/ati_dri.c +++ b/hw/kdrive/ati/ati_dri.c @@ -562,7 +562,7 @@ static void ATIDRISwapContext(ScreenPtr pScreen, DRISyncType syncType, if ((syncType==DRI_3D_SYNC) && (oldContextType==DRI_2D_CONTEXT) && (newContextType==DRI_2D_CONTEXT)) { /* Entering from Wakeup */ - KdMarkSync(pScreen); + kaaMarkSync(pScreen); } if ((syncType==DRI_2D_SYNC) && (oldContextType==DRI_NO_CONTEXT) && (newContextType==DRI_2D_CONTEXT)) { diff --git a/hw/kdrive/ati/ati_video.c b/hw/kdrive/ati/ati_video.c index 8e47d9ed0..ec26e6a5a 100644 --- a/hw/kdrive/ati/ati_video.c +++ b/hw/kdrive/ati/ati_video.c @@ -259,7 +259,7 @@ R128DisplayVideo(KdScreenInfo *screen, ATIPortPrivPtr pPortPriv) /* XXX: Shouldn't this be in kxv.c instead? */ DamageDamageRegion(pPortPriv->pDraw, &pPortPriv->clip); #endif - KdMarkSync(pScreen); + kaaMarkSync(pScreen); } union intfloat { @@ -490,7 +490,7 @@ RadeonDisplayVideo(KdScreenInfo *screen, ATIPortPrivPtr pPortPriv) /* XXX: Shouldn't this be in kxv.c instead? */ DamageDamageRegion(pPortPriv->pDraw, &pPortPriv->clip); #endif - KdMarkSync(pScreen); + kaaMarkSync(pScreen); } static void diff --git a/hw/kdrive/chips/chips.c b/hw/kdrive/chips/chips.c index ccaac5d2b..d727c875e 100644 --- a/hw/kdrive/chips/chips.c +++ b/hw/kdrive/chips/chips.c @@ -25,6 +25,7 @@ #include <config.h> #endif #include "chips.h" +#include "kaa.h" #include <sys/io.h> #undef CHIPS_DEBUG @@ -138,7 +139,7 @@ chipsRandRSetConfig (ScreenPtr pScreen, int rate, RRScreenSizePtr pSize) { - KdCheckSync (pScreen); + kaaWaitSync (pScreen); if (!vesaRandRSetConfig (pScreen, rotation, rate, pSize)) return FALSE; @@ -332,7 +333,6 @@ KdCardFuncs chipsFuncs = { chipsDrawInit, /* initAccel */ chipsDrawEnable, /* enableAccel */ - chipsDrawSync, /* syncAccel */ chipsDrawDisable, /* disableAccel */ chipsDrawFini, /* finiAccel */ diff --git a/hw/kdrive/chips/chips.h b/hw/kdrive/chips/chips.h index 869a0717c..f7b9784c6 100644 --- a/hw/kdrive/chips/chips.h +++ b/hw/kdrive/chips/chips.h @@ -76,6 +76,7 @@ typedef struct _chipsScreenInfo { CARD8 *off_screen; int off_screen_size; ChipsCursor cursor; + KaaScreenInfoRec kaa; } ChipsScreenInfo; #define getChipsScreenInfo(kd) ((ChipsScreenInfo *) ((kd)->screen->driver)) @@ -88,9 +89,6 @@ void chipsDrawEnable (ScreenPtr pScreen); void -chipsDrawSync (ScreenPtr pScreen); - -void chipsDrawDisable (ScreenPtr pScreen); void diff --git a/hw/kdrive/chips/chipsdraw.c b/hw/kdrive/chips/chipsdraw.c index e27508c09..ceb38d707 100644 --- a/hw/kdrive/chips/chipsdraw.c +++ b/hw/kdrive/chips/chipsdraw.c @@ -39,6 +39,7 @@ #include "fb.h" #include "migc.h" #include "miline.h" +#include "kaa.h" CARD8 chipsBltRop[16] = { /* GXclear */ 0x00, /* 0 */ @@ -159,6 +160,13 @@ chipsSet (ScreenPtr pScreen) pixelStride = pScreenPriv->screen->fb[0].pixelStride; } +static void +chipsWaitMarker (ScreenPtr pScreen, int marker) +{ + chipsSet (pScreen); + chipsWaitIdle (); +} + #ifdef HIQV #define CHIPS_BR0 0x00 /* offset */ #define CHIPS_BR1 0x04 /* bg */ @@ -424,23 +432,12 @@ chipsDoneCopy (void) { } -KaaScreenInfoRec chipsKaa = { - chipsPrepareSolid, - chipsSolid, - chipsDoneSolid, - - chipsPrepareCopy, - chipsCopy, - chipsDoneCopy, - - 0, 0, 0 -}; - Bool chipsDrawInit (ScreenPtr pScreen) { KdScreenPriv(pScreen); - + chipsScreenInfo(pScreenPriv); + switch (pScreenPriv->screen->fb[0].bitsPerPixel) { case 8: case 16: @@ -449,7 +446,16 @@ chipsDrawInit (ScreenPtr pScreen) return FALSE; } - if (!kaaDrawInit (pScreen, &chipsKaa)) + memset(&chipss->kaa, 0, sizeof(KaaScreenInfoRec)); + chipss->kaa.waitMarker = chipsWaitMarker; + chipss->kaa.PrepareSolid = chipsPrepareSolid; + chipss->kaa.Solid = chipsSolid; + chipss->kaa.DoneSolid = chipsDoneSolid; + chipss->kaa.PrepareCopy = chipsPrepareCopy; + chipss->kaa.Copy = chipsCopy; + chipss->kaa.DoneCopy = chipsDoneCopy; + + if (!kaaDrawInit (pScreen, &chipss->kaa)) return FALSE; return TRUE; @@ -474,7 +480,7 @@ chipsDrawEnable (ScreenPtr pScreen) chipsWaitIdle (); chipsWriteXR (chipss, 0x20, mode); - KdMarkSync (pScreen); + kaaMarkSync (pScreen); } void @@ -487,9 +493,3 @@ chipsDrawFini (ScreenPtr pScreen) { } -void -chipsDrawSync (ScreenPtr pScreen) -{ - chipsSet (pScreen); - chipsWaitIdle (); -} diff --git a/hw/kdrive/epson/epson13806.c b/hw/kdrive/epson/epson13806.c index 134946161..01ce6e76d 100644 --- a/hw/kdrive/epson/epson13806.c +++ b/hw/kdrive/epson/epson13806.c @@ -597,7 +597,6 @@ KdCardFuncs epsonFuncs = { epsonDrawInit, /* initAccel */ epsonDrawEnable, /* enableAccel */ - epsonDrawSync, /* syncAccel */ epsonDrawDisable, /* disableAccel */ epsonDrawFini, /* finiAccel */ diff --git a/hw/kdrive/epson/epson13806.h b/hw/kdrive/epson/epson13806.h index a9921e844..b80fe19a4 100644 --- a/hw/kdrive/epson/epson13806.h +++ b/hw/kdrive/epson/epson13806.h @@ -57,6 +57,7 @@ typedef struct _epsonPriv { typedef struct _epsonScrPriv { Rotation randr; Bool shadow; + KaaScreenInfoRec kaa; } EpsonScrPriv; extern KdCardFuncs epsonFuncs; @@ -115,9 +116,6 @@ void epsonDrawEnable (ScreenPtr pScreen); void -epsonDrawSync (ScreenPtr pScreen); - -void epsonDrawDisable (ScreenPtr pScreen); void diff --git a/hw/kdrive/epson/epson13806draw.c b/hw/kdrive/epson/epson13806draw.c index 791ad3c21..15c07025d 100644 --- a/hw/kdrive/epson/epson13806draw.c +++ b/hw/kdrive/epson/epson13806draw.c @@ -33,6 +33,8 @@ #include "epson13806draw.h" #include "epson13806reg.h" +#include "kaa.h" + #include "gcstruct.h" #include "scrnintstr.h" #include "pixmapstr.h" @@ -182,7 +184,28 @@ epsonWaitForHwBltDone (void) { while (EPSON13806_REG (EPSON13806_BLTCTRL0) & EPSON13806_BLTCTRL0_ACTIVE) {} } - + + +/* + * epsonDrawSync + * + * Description: Sync hardware acceleration + * + * History: + * 11-Feb-04 C.Stylianou NBL: Created. + * + */ + +static void +epsonWaitMarker (ScreenPtr pScreen, int marker) +{ + EPSON_DEBUG (fprintf(stderr,"+epsonDrawSync\n")); + + epsonWaitForHwBltDone (); + + EPSON_DEBUG (fprintf(stderr,"-epsonDrawSync\n")); +} + /* * epsonPrepareSolid @@ -428,20 +451,6 @@ epsonDoneCopy (void) EPSON_DEBUG_COPY (fprintf(stderr,"-epsonDoneCopy\n")); } -static KaaScreenInfoRec epsonKaa = { - .PrepareSolid = epsonPrepareSolid, - .Solid = epsonSolid, - .DoneSolid = epsonDoneSolid, - - .PrepareCopy = epsonPrepareCopy, - .Copy = epsonCopy, - .DoneCopy = epsonDoneCopy, - - 0, - 0, - .flags = KAA_OFFSCREEN_PIXMAPS, /* Flags */ -}; - /* * epsonDrawInit @@ -456,6 +465,10 @@ static KaaScreenInfoRec epsonKaa = { Bool epsonDrawInit (ScreenPtr pScreen) { + KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + EpsonScrPriv *epsons = screen->driver; + EPSON_DEBUG (fprintf(stderr,"+epsonDrawInit\n")); epsonSet(pScreen); @@ -535,7 +548,17 @@ epsonDrawInit (ScreenPtr pScreen) EPSON13806_REG16(EPSON13806_GPIOCTRL) |= 0x00fc; #endif - if (!kaaDrawInit (pScreen, &epsonKaa)) + memset(&epsons->kaa, 0, sizeof(KaaScreenInfoRec)); + epsons->kaa.waitMarker = epsonWaitMarker; + epsons->kaa.PrepareSolid = epsonPrepareSolid; + epsons->kaa.Solid = epsonSolid; + epsons->kaa.DoneSolid = epsonDoneSolid; + epsons->kaa.PrepareCopy = epsonPrepareCopy; + epsons->kaa.Copy = epsonCopy; + epsons->kaa.DoneCopy = epsonDoneCopy; + epsons->kaa.flags = KAA_OFFSCREEN_PIXMAPS; + + if (!kaaDrawInit (pScreen, &epsons->kaa)) return FALSE; EPSON_DEBUG (fprintf(stderr,"-epsonDrawInit\n")); @@ -558,29 +581,8 @@ epsonDrawEnable (ScreenPtr pScreen) { EPSON_DEBUG (fprintf(stderr,"+epsonDrawEnable\n")); epsonWaitForHwBltDone (); - KdMarkSync (pScreen); - EPSON_DEBUG (fprintf(stderr,"+epsonDrawEnable\n")); -} - - -/* - * epsonDrawSync - * - * Description: Sync hardware acceleration - * - * History: - * 11-Feb-04 C.Stylianou NBL: Created. - * - */ - -void -epsonDrawSync (ScreenPtr pScreen) -{ - EPSON_DEBUG (fprintf(stderr,"+epsonDrawSync\n")); - - epsonWaitForHwBltDone (); - - EPSON_DEBUG (fprintf(stderr,"-epsonDrawSync\n")); + kaaMarkSync (pScreen); + EPSON_DEBUG (fprintf(stderr,"-epsonDrawEnable\n")); } diff --git a/hw/kdrive/fake/fakeinit.c b/hw/kdrive/fake/fakeinit.c index 6942cb063..fc2496502 100644 --- a/hw/kdrive/fake/fakeinit.c +++ b/hw/kdrive/fake/fakeinit.c @@ -87,7 +87,6 @@ KdCardFuncs fakeFuncs = { 0, /* initAccel */ 0, /* enableAccel */ - 0, /* syncAccel */ 0, /* disableAccel */ 0, /* finiAccel */ diff --git a/hw/kdrive/i810/i810.c b/hw/kdrive/i810/i810.c index 9c3f6a3e5..a48cc63db 100644 --- a/hw/kdrive/i810/i810.c +++ b/hw/kdrive/i810/i810.c @@ -176,7 +176,7 @@ i810CardInit (KdCardInfo *card) return TRUE; } -void +static void i810ScreenFini (KdScreenInfo *screen) { I810ScreenInfo *i810s = (I810ScreenInfo *) screen->driver; @@ -185,7 +185,7 @@ i810ScreenFini (KdScreenInfo *screen) screen->driver = 0; } -Bool +static Bool i810InitScreen (ScreenPtr pScreen) { #ifdef XV @@ -194,7 +194,14 @@ i810InitScreen (ScreenPtr pScreen) { return TRUE; } -void +static Bool +i810FinishInitScreen(ScreenPtr pScreen) +{ + /* XXX: RandR init */ + return TRUE; +} + +static void i810CardFini (KdCardInfo *card) { I810CardInfo *i810c = (I810CardInfo *) card->driver; @@ -415,7 +422,7 @@ i810ReadControlMMIO(I810CardInfo *i810c, int addr, CARD8 index) { return minb(addr+1); } -Bool +static Bool i810ModeSupported (KdScreenInfo *screen, const KdMonitorTiming *t) { /* This is just a guess. */ @@ -424,7 +431,7 @@ i810ModeSupported (KdScreenInfo *screen, const KdMonitorTiming *t) return TRUE; } -Bool +static Bool i810ModeUsable (KdScreenInfo *screen) { KdCardInfo *card = screen->card; @@ -465,7 +472,7 @@ i810ModeUsable (KdScreenInfo *screen) return screen_size <= (i810c->videoRam * 1024); } -int i810AllocateGARTMemory( KdScreenInfo *screen ) +static int i810AllocateGARTMemory( KdScreenInfo *screen ) { KdCardInfo *card = screen->card; I810CardInfo *i810c = (I810CardInfo *) card->driver; @@ -589,7 +596,7 @@ int i810AllocateGARTMemory( KdScreenInfo *screen ) /* Allocate from a memrange, returns success */ -int i810AllocLow( I810MemRange *result, I810MemRange *pool, int size ) +static int i810AllocLow( I810MemRange *result, I810MemRange *pool, int size ) { if (size > pool->Size) return FALSE; @@ -600,7 +607,7 @@ int i810AllocLow( I810MemRange *result, I810MemRange *pool, int size ) return TRUE; } -int i810AllocHigh( I810MemRange *result, I810MemRange *pool, int size ) +static int i810AllocHigh( I810MemRange *result, I810MemRange *pool, int size ) { if (size > pool->Size) return 0; @@ -611,7 +618,7 @@ int i810AllocHigh( I810MemRange *result, I810MemRange *pool, int size ) return 1; } -Bool +static Bool i810AllocateFront(KdScreenInfo *screen) { KdCardInfo *card = screen->card; @@ -719,6 +726,8 @@ i810ScreenInit (KdScreenInfo *screen) memset (i810s, '\0', sizeof (I810ScreenInfo)); + i810s->i810c = i810c; + /* Default dimensions */ if (!screen->width || !screen->height) { @@ -933,7 +942,7 @@ DoSave(KdCardInfo *card, vgaRegPtr vgaReg, I810RegPtr i810Reg, Bool saveFonts) if ((i810Reg->LprbTail & TAIL_ADDR) != (i810Reg->LprbHead & HEAD_ADDR) && i810Reg->LprbLen & RING_VALID) { - i810PrintErrorState( card ); + i810PrintErrorState( i810c ); FatalError( "Active ring not flushed\n"); } @@ -943,7 +952,9 @@ DoSave(KdCardInfo *card, vgaRegPtr vgaReg, I810RegPtr i810Reg, Bool saveFonts) } } -void i810Preserve(KdCardInfo *card) { +static void +i810Preserve(KdCardInfo *card) +{ I810CardInfo *i810c = card->driver; i810VGAPtr vgap = &i810c->vga; @@ -954,10 +965,8 @@ void i810Preserve(KdCardInfo *card) { /* Famous last words */ void -i810PrintErrorState(KdCardInfo *card) +i810PrintErrorState(i810CardInfo *i810c) { - - I810CardInfo *i810c = card->driver; fprintf(stderr, "pgetbl_ctl: 0x%lx pgetbl_err: 0x%lx\n", INREG(PGETBL_CTL), @@ -993,7 +1002,7 @@ i810PrintErrorState(KdCardInfo *card) INREG16(IIR)); } -Bool +static Bool i810BindGARTMemory( KdScreenInfo *screen ) { @@ -1022,7 +1031,7 @@ i810BindGARTMemory( KdScreenInfo *screen ) return TRUE; } -Bool +static Bool i810UnbindGARTMemory(KdScreenInfo *screen) { KdCardInfo *card = screen->card; @@ -1124,7 +1133,7 @@ i810CalcVCLK( KdScreenInfo *screen, double freq ) #define Elements(x) (sizeof(x)/sizeof(*x)) -unsigned int +static unsigned int i810CalcWatermark( KdScreenInfo *screen, double freq, Bool dcache ) { @@ -1268,7 +1277,7 @@ static void i810PrintMode( vgaRegPtr vgaReg, I810RegPtr mode ) * HW, but still warns about not programming them... */ -void +static void i810VGASeqReset(i810VGAPtr vgap, Bool start) { if (start) @@ -1281,7 +1290,7 @@ i810VGASeqReset(i810VGAPtr vgap, Bool start) } } -void +static void i810VGAProtect(KdCardInfo *card, Bool on) { @@ -1666,7 +1675,7 @@ i810VGAInit(KdScreenInfo *screen, const KdMonitorTiming *t) int hactive, hblank, hbp, hfp; int vactive, vblank, vbp, vfp; - int h_screen_off, h_adjust, h_total, h_display_end, h_blank_start; + int h_screen_off = 0, h_adjust = 0, h_total, h_display_end, h_blank_start; int h_blank_end, h_sync_start, h_sync_end, v_total, v_retrace_start; int v_retrace_end, v_display_end, v_blank_start, v_blank_end; @@ -1911,7 +1920,7 @@ i810Restore(KdCardInfo *card) { DoRestore(card, &vgap->SavedReg, &i810c->SavedReg, TRUE); } -Bool +static Bool i810Enable (ScreenPtr pScreen) { KdScreenPriv(pScreen); @@ -1964,7 +1973,7 @@ i810Enable (ScreenPtr pScreen) } -void +static void i810Disable(ScreenPtr pScreen) { KdScreenPriv(pScreen); @@ -2035,7 +2044,9 @@ i810DPMS(ScreenPtr pScreen, int mode) } -void i810GetColors (ScreenPtr pScreen, int fb, int ndefs, xColorItem *c) { +static void +i810GetColors (ScreenPtr pScreen, int fb, int ndefs, xColorItem *c) +{ if (I810_DEBUG) fprintf(stderr,"i810GetColors (NOT IMPLEMENTED)\n"); @@ -2047,7 +2058,9 @@ void i810GetColors (ScreenPtr pScreen, int fb, int ndefs, xColorItem *c) { temp = Vminb((hw)->IOBase + VGA_IN_STAT_1_OFFSET); \ } while (0) -void i810PutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs) { +static void +i810PutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs) +{ KdScreenPriv(pScreen); KdScreenInfo *screen = pScreenPriv->screen; @@ -2079,6 +2092,8 @@ KdCardFuncs i810Funcs = { i810CardInit, /* cardinit */ i810ScreenInit, /* scrinit */ i810InitScreen, /* initScreen */ + i810FinishInitScreen, /* finishInitScreen */ + NULL, /* createResources */ i810Preserve, /* preserve */ i810Enable, /* enable */ i810DPMS, /* dpms */ @@ -2095,7 +2110,6 @@ KdCardFuncs i810Funcs = { i810InitAccel, /* initAccel */ i810EnableAccel, /* enableAccel */ - i810SyncAccel, /* syncAccel */ i810DisableAccel, /* disableAccel */ i810FiniAccel, /* finiAccel */ diff --git a/hw/kdrive/i810/i810.h b/hw/kdrive/i810/i810.h index bb8091fe4..5d1a0db08 100644 --- a/hw/kdrive/i810/i810.h +++ b/hw/kdrive/i810/i810.h @@ -122,17 +122,20 @@ typedef struct { ErrorF("BEGIN_LP_RING %d in %s:%d\n", n, __FILE__, __LINE__) #endif +#define LP_RING_LOCALS \ + unsigned int outring, ringmask; \ + volatile unsigned char *virt + #define BEGIN_LP_RING(n) \ - unsigned int outring, ringmask; \ - volatile unsigned char *virt; \ - if (n>2 && (I810_DEBUG&DEBUG_ALWAYS_SYNC)) i810Sync( screen ); \ - if (i810c->LpRing.space < n*4) i810WaitLpRing( screen, n*4, 0); \ - i810c->LpRing.space -= n*4; \ - if (I810_DEBUG & DEBUG_VERBOSE_RING) \ - LP_RING_MESSAGE(n); \ - outring = i810c->LpRing.tail; \ - ringmask = i810c->LpRing.tail_mask; \ - virt = i810c->LpRing.virtual_start; + if (n>2 && (I810_DEBUG&DEBUG_ALWAYS_SYNC)) \ + i810Sync(i810s); \ + if (i810c->LpRing.space < n*4) i810WaitLpRing(i810s, n*4, 0); \ + i810c->LpRing.space -= n*4; \ + if (I810_DEBUG & DEBUG_VERBOSE_RING) \ + LP_RING_MESSAGE(n); \ + outring = i810c->LpRing.tail; \ + ringmask = i810c->LpRing.tail_mask; \ + virt = i810c->LpRing.virtual_start; /* Memory mapped register access macros */ #define INREG8(addr) *(volatile CARD8 *)(i810c->MMIOBase + (addr)) @@ -193,6 +196,7 @@ extern int I810_DEBUG; #define PCI_CHIP_I810_DC100_BRIDGE 0x7122 #define PCI_CHIP_I810_E_BRIDGE 0x7124 #define PCI_CHIP_I815_BRIDGE 0x1130 +#define PCI_CHIP_I845G 0x2562 #endif @@ -277,7 +281,7 @@ typedef struct _i810CardInfo { I810RegRec ModeReg; I810RingBuffer LpRing; - unsigned int BR[20]; + unsigned int BR[20]; int CursorOffset; unsigned long CursorPhysical; @@ -286,8 +290,6 @@ typedef struct _i810CardInfo { unsigned long OverlayStart; int colorKey; - Bool NeedToSync; /* Need to sync accel stuff */ - int nextColorExpandBuf; ScreenBlockHandlerProcPtr BlockHandler; @@ -296,7 +298,9 @@ typedef struct _i810CardInfo { KdVideoAdaptorPtr adaptor; #endif -} I810CardInfo; +} i810CardInfo; + +typedef struct _i810CardInfo I810CardInfo; /* compatibility */ #define getI810CardInfo(kd) ((I810CardInfo *) ((kd)->card->driver)) #define i810CardInfo(kd) I810CardInfo *i810c = getI810CardInfo(kd) @@ -312,8 +316,14 @@ typedef struct _i810Cursor { } i810Cursor, *i810CursorPtr; typedef struct _i810ScreenInfo { + i810CardInfo *i810c; i810Cursor cursor; -} I810ScreenInfo; + + int pitch; + KaaScreenInfoRec kaa; +} i810ScreenInfo; + +typedef struct _i810ScreenInfo I810ScreenInfo; /* compatibility */ #define I810_CURSOR_HEIGHT 64 #define I810_CURSOR_WIDTH 64 @@ -348,9 +358,6 @@ i810InitAccel(ScreenPtr); void i810EnableAccel (ScreenPtr); -void -i810SyncAccel (ScreenPtr); - void i810DisableAccel (ScreenPtr); @@ -423,7 +430,7 @@ void i810VGASave(KdCardInfo *card, vgaRegPtr save, int flags); void -i810PrintErrorState(KdCardInfo *card); +i810PrintErrorState(i810CardInfo *i810c); void i810VGAGetIOBase(i810VGAPtr vgap); diff --git a/hw/kdrive/i810/i810_video.c b/hw/kdrive/i810/i810_video.c index 47db4bd06..520ba6b33 100644 --- a/hw/kdrive/i810/i810_video.c +++ b/hw/kdrive/i810/i810_video.c @@ -99,7 +99,7 @@ static int i810SetPortAttribute(KdScreenInfo *, Atom, int, pointer); static int i810GetPortAttribute(KdScreenInfo *, Atom, int *, pointer); static void i810QueryBestSize(KdScreenInfo *, Bool, short, short, short, short, unsigned int *, unsigned int *, pointer); -static int i810PutImage( KdScreenInfo *, +static int i810PutImage( KdScreenInfo *, DrawablePtr, short, short, short, short, short, short, short, short, int, unsigned char*, short, short, Bool, RegionPtr, pointer); static int i810QueryImageAttributes(KdScreenInfo *, @@ -929,20 +929,27 @@ i810AllocateMemory( return new_linear; } -static int -i810PutImage( - KdScreenInfo *screen, - short src_x, short src_y, - short drw_x, short drw_y, - short src_w, short src_h, - short drw_w, short drw_h, - int id, unsigned char* buf, - short width, short height, - Bool sync, - RegionPtr clipBoxes, pointer data -){ - KdCardInfo *card = screen->card; - I810CardInfo *i810c = (I810CardInfo *) card->driver; +static int +i810PutImage(KdScreenInfo *screen, + DrawablePtr pDraw, + short src_x, + short src_y, + short drw_x, + short drw_y, + short src_w, + short src_h, + short drw_w, + short drw_h, + int id, + unsigned char *buf, + short width, + short height, + Bool sync, + RegionPtr clipBoxes, + pointer data) +{ + KdCardInfo *card = screen->card; + I810CardInfo *i810c = (I810CardInfo *) card->driver; I810PortPrivPtr pPriv = (I810PortPrivPtr)data; INT32 x1, x2, y1, y2; int srcPitch, dstPitch; @@ -1029,14 +1036,7 @@ i810PutImage( /* update cliplist */ if(!REGION_EQUAL(screen->pScreen, &pPriv->clip, clipBoxes)) { REGION_COPY(screen->pScreen, &pPriv->clip, clipBoxes); - i810FillBoxSolid(screen, REGION_NUM_RECTS(clipBoxes), - REGION_RECTS(clipBoxes), - pPriv->colorKey, GXcopy, ~0); - /* - XAAFillSolidRects(screen, pPriv->colorKey, GXcopy, ~0, - REGION_NUM_RECTS(clipBoxes), - REGION_RECTS(clipBoxes)); - */ + KXVPaintRegion (pDraw, &pPriv->clip, pPriv->colorKey); } diff --git a/hw/kdrive/i810/i810draw.c b/hw/kdrive/i810/i810draw.c index 2423acfad..deff7c204 100644 --- a/hw/kdrive/i810/i810draw.c +++ b/hw/kdrive/i810/i810draw.c @@ -39,6 +39,7 @@ X Window System is a trademark of The Open Group */ #include <config.h> #endif #include "kdrive.h" +#include "kaa.h" #ifdef XV #include "kxv.h" #endif @@ -60,318 +61,12 @@ X Window System is a trademark of The Open Group */ #define NUM_STACK_RECTS 1024 -void -i810Sync( KdScreenInfo *screen ); -int -i810WaitLpRing( KdScreenInfo *screen, int n, int timeout_millis ); - -void -i810EmitInvarientState(KdScreenInfo *screen) -{ - KdCardInfo *card = screen->card; - I810CardInfo *i810c = (I810CardInfo *) card->driver; - - BEGIN_LP_RING( 10 ); - - OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE ); - OUT_RING( GFX_CMD_CONTEXT_SEL | CS_UPDATE_USE | CS_USE_CTX0 ); - OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE); - OUT_RING( 0 ); - - - OUT_RING( GFX_OP_COLOR_CHROMA_KEY ); - OUT_RING( CC1_UPDATE_KILL_WRITE | - CC1_DISABLE_KILL_WRITE | - CC1_UPDATE_COLOR_IDX | - CC1_UPDATE_CHROMA_LOW | - CC1_UPDATE_CHROMA_HI | - 0); - OUT_RING( 0 ); - OUT_RING( 0 ); - - /* No depth buffer in KDrive yet */ - /* OUT_RING( CMD_OP_Z_BUFFER_INFO ); */ - /* OUT_RING( pI810->DepthBuffer.Start | pI810->auxPitchBits); */ - - ADVANCE_LP_RING(); -} - -static unsigned int i810PatternRop[16] = { - 0x00, /* GXclear */ - 0xA0, /* GXand */ - 0x50, /* GXandReverse */ - 0xF0, /* GXcopy */ - 0x0A, /* GXandInvert */ - 0xAA, /* GXnoop */ - 0x5A, /* GXxor */ - 0xFA, /* GXor */ - 0x05, /* GXnor */ - 0xA5, /* GXequiv */ - 0x55, /* GXinvert */ - 0xF5, /* GXorReverse */ - 0x0F, /* GXcopyInvert */ - 0xAF, /* GXorInverted */ - 0x5F, /* GXnand */ - 0xFF /* GXset */ -}; - -void -i810SetupForSolidFill(KdScreenInfo *screen, int color, int rop, - unsigned int planemask) -{ - KdCardInfo *card = screen->card; - I810CardInfo *i810c = (I810CardInfo *) card->driver; - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF( "i810SetupForFillRectSolid color: %x rop: %x mask: %x\n", - color, rop, planemask); - - /* Color blit, p166 */ - i810c->BR[13] = (BR13_SOLID_PATTERN | - (i810PatternRop[rop] << 16) | - (screen->width * i810c->cpp)); - i810c->BR[16] = color; -} - - -void -i810SubsequentSolidFillRect(KdScreenInfo *screen, int x, int y, int w, int h) -{ - KdCardInfo *card = screen->card; - I810CardInfo *i810c = (I810CardInfo *) card->driver; - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF( "i810SubsequentFillRectSolid %d,%d %dx%d\n", - x,y,w,h); - - { - BEGIN_LP_RING(6); - - OUT_RING( BR00_BITBLT_CLIENT | BR00_OP_COLOR_BLT | 0x3 ); - OUT_RING( i810c->BR[13] ); - OUT_RING( (h << 16) | (w * i810c->cpp)); - OUT_RING( i810c->bufferOffset + - (y * screen->width + x) * i810c->cpp); - - OUT_RING( i810c->BR[16]); - OUT_RING( 0 ); /* pad to quadword */ - - ADVANCE_LP_RING(); - } -} - - -BOOL -i810FillOk (GCPtr pGC) -{ - FbBits depthMask; - - switch (pGC->fillStyle) { - case FillSolid: - return TRUE; - /* More cases later... */ - } - return FALSE; -} - -void -i810FillBoxSolid (KdScreenInfo *screen, int nBox, BoxPtr pBox, - unsigned long pixel, int alu, unsigned long planemask) -{ - i810SetupForSolidFill(screen, pixel, alu, planemask); - while (nBox--) - { - i810SubsequentSolidFillRect(screen, pBox->x1, pBox->y1, - pBox->x2-pBox->x1, pBox->y2-pBox->y1); - pBox++; - } - KdMarkSync(screen->pScreen); -} - - -void -i810PolyFillRect (DrawablePtr pDrawable, GCPtr pGC, - int nrectFill, xRectangle *prectInit) -{ - - - xRectangle *prect; - RegionPtr prgnClip; - register BoxPtr pbox; - register BoxPtr pboxClipped; - BoxPtr pboxClippedBase; - BoxPtr pextent; - BoxRec stackRects[NUM_STACK_RECTS]; - FbGCPrivPtr fbPriv = fbGetGCPrivate (pGC); - int numRects; - int n; - int xorg, yorg; - int x, y; - KdScreenPriv(pDrawable->pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - - if (!i810FillOk (pGC)) - { - KdCheckPolyFillRect (pDrawable, pGC, nrectFill, prectInit); - return; - } - prgnClip = fbGetCompositeClip(pGC); - 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 > NUM_STACK_RECTS) - { - pboxClippedBase = (BoxPtr)xalloc(numRects * sizeof(BoxRec)); - if (!pboxClippedBase) - return; - } - else - pboxClippedBase = stackRects; - - 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++; - } - } - } - } - if (pboxClipped != pboxClippedBase) - { - switch (pGC->fillStyle) { - case FillSolid: - i810FillBoxSolid(screen, - pboxClipped-pboxClippedBase, pboxClippedBase, - pGC->fgPixel, pGC->alu, pGC->planemask); - break; - /* More cases later... */ - } - } - if (pboxClippedBase != stackRects) - xfree(pboxClippedBase); -} - -void -i810RefreshRing(KdScreenInfo *screen) -{ - KdCardInfo *card = screen->card; - I810CardInfo *i810c = (I810CardInfo *) card->driver; - - i810c->LpRing.head = INREG(LP_RING + RING_HEAD) & HEAD_ADDR; - i810c->LpRing.tail = INREG(LP_RING + RING_TAIL); - i810c->LpRing.space = i810c->LpRing.head - (i810c->LpRing.tail+8); - if (i810c->LpRing.space < 0) - i810c->LpRing.space += i810c->LpRing.mem.Size; - - i810c->NeedToSync = TRUE; -} +i810ScreenInfo *accel_i810s; -int -i810WaitLpRing( KdScreenInfo *screen, int n, int timeout_millis ) +static int +i810WaitLpRing(i810ScreenInfo *i810s, int n, int timeout_millis) { - KdCardInfo *card = screen->card; - I810CardInfo *i810c = (I810CardInfo *) card->driver; + i810CardInfo *i810c = i810s->i810c; I810RingBuffer *ring = &(i810c->LpRing); int iters = 0; int start = 0; @@ -410,7 +105,7 @@ i810WaitLpRing( KdScreenInfo *screen, int n, int timeout_millis ) last_head = ring->head; } else if ( now - start > timeout_millis ) { - i810PrintErrorState( screen->card ); + i810PrintErrorState(i810c); fprintf(stderr, "space: %d wanted %d\n", ring->space, n ); FatalError("lockup\n"); } @@ -431,100 +126,165 @@ i810WaitLpRing( KdScreenInfo *screen, int n, int timeout_millis ) return iters; } -void -i810Sync( KdScreenInfo *screen ) +static void +i810Sync(i810ScreenInfo *i810s) { - KdCardInfo *card = screen->card; - I810CardInfo *i810c = card->driver; + i810CardInfo *i810c = i810s->i810c; + LP_RING_LOCALS; - if (I810_DEBUG) - fprintf(stderr, "i810Sync\n"); + if (I810_DEBUG) + fprintf(stderr, "i810Sync\n"); /* Send a flush instruction and then wait till the ring is empty. * This is stronger than waiting for the blitter to finish as it also * flushes the internal graphics caches. */ - { - BEGIN_LP_RING(2); - OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE ); - OUT_RING( 0 ); /* pad to quadword */ - ADVANCE_LP_RING(); - } + BEGIN_LP_RING(2); + OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE ); + OUT_RING( 0 ); /* pad to quadword */ + ADVANCE_LP_RING(); - i810WaitLpRing(screen, i810c->LpRing.mem.Size - 8, 0 ); + i810WaitLpRing(i810s, i810c->LpRing.mem.Size - 8, 0); - i810c->LpRing.space = i810c->LpRing.mem.Size - 8; - i810c->nextColorExpandBuf = 0; + i810c->LpRing.space = i810c->LpRing.mem.Size - 8; + i810c->nextColorExpandBuf = 0; } -static const GCOps i810Ops = { - KdCheckFillSpans, - KdCheckSetSpans, - KdCheckPutImage, - KdCheckCopyArea, - KdCheckCopyPlane, - KdCheckPolyPoint, - KdCheckPolylines, - KdCheckPolySegment, - miPolyRectangle, - KdCheckPolyArc, - miFillPolygon, - i810PolyFillRect, - miPolyFillArc, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - KdCheckImageGlyphBlt, - KdCheckPolyGlyphBlt, - KdCheckPushPixels, -#ifdef NEED_LINEHELPER - ,NULL +static void +i810WaitMarker(ScreenPtr pScreen, int marker) +{ + KdScreenPriv(pScreen); + i810ScreenInfo(pScreenPriv); + + i810Sync(i810s); +} + +#if 0 +static void +i810EmitInvarientState(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + i810CardInfo(pScreenPriv); + i810ScreenInfo(pScreenPriv); + LP_RING_LOCALS; + + BEGIN_LP_RING( 10 ); + + OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE ); + OUT_RING( GFX_CMD_CONTEXT_SEL | CS_UPDATE_USE | CS_USE_CTX0 ); + OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE); + OUT_RING( 0 ); + + + OUT_RING( GFX_OP_COLOR_CHROMA_KEY ); + OUT_RING( CC1_UPDATE_KILL_WRITE | + CC1_DISABLE_KILL_WRITE | + CC1_UPDATE_COLOR_IDX | + CC1_UPDATE_CHROMA_LOW | + CC1_UPDATE_CHROMA_HI | + 0); + OUT_RING( 0 ); + OUT_RING( 0 ); + + /* No depth buffer in KDrive yet */ + /* OUT_RING( CMD_OP_Z_BUFFER_INFO ); */ + /* OUT_RING( pI810->DepthBuffer.Start | pI810->auxPitchBits); */ + + ADVANCE_LP_RING(); +} #endif + +static unsigned int i810PatternRop[16] = { + 0x00, /* GXclear */ + 0xA0, /* GXand */ + 0x50, /* GXandReverse */ + 0xF0, /* GXcopy */ + 0x0A, /* GXandInvert */ + 0xAA, /* GXnoop */ + 0x5A, /* GXxor */ + 0xFA, /* GXor */ + 0x05, /* GXnor */ + 0xA5, /* GXequiv */ + 0x55, /* GXinvert */ + 0xF5, /* GXorReverse */ + 0x0F, /* GXcopyInvert */ + 0xAF, /* GXorInverted */ + 0x5F, /* GXnand */ + 0xFF /* GXset */ }; -void -i810ValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable) +static Bool +i810PrepareSolid(PixmapPtr pPix, int alu, Pixel pm, Pixel fg) { - FbGCPrivPtr fbPriv = fbGetGCPrivate(pGC); - - fbValidateGC (pGC, changes, pDrawable); - - if (pDrawable->type == DRAWABLE_WINDOW) - pGC->ops = (GCOps *) &i810Ops; - else - pGC->ops = (GCOps *) &kdAsyncPixmapGCOps; + KdScreenPriv(pPix->drawable.pScreen); + i810ScreenInfo(pScreenPriv); + i810CardInfo(pScreenPriv); + + if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) + ErrorF( "i810PrepareSolid color: %x rop: %x mask: %x\n", + fg, alu, pm); + + /* Color blit, p166 */ + i810c->BR[13] = BR13_SOLID_PATTERN | + (i810PatternRop[alu] << 16) | + (pPix->drawable.pScreen->width * i810c->cpp); + i810c->BR[16] = fg; + + accel_i810s = i810s; + + return TRUE; } -GCFuncs i810GCFuncs = { - i810ValidateGC, - miChangeGC, - miCopyGC, - miDestroyGC, - miChangeClip, - miDestroyClip, - miCopyClip -}; +static void +i810Solid(int x1, int y1, int x2, int y2) +{ + I810ScreenInfo *i810s = accel_i810s; + I810CardInfo *i810c = i810s->i810c; + LP_RING_LOCALS; + + if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) + ErrorF( "i810SubsequentFillRectSolid %d,%d %d,%d\n", x1, y1, x2, y2); + + BEGIN_LP_RING(6); + + OUT_RING( BR00_BITBLT_CLIENT | BR00_OP_COLOR_BLT | 0x3 ); + OUT_RING( i810c->BR[13] ); + OUT_RING( ((y2 - y1) << 16) | ((x2 - x1) * i810c->cpp)); + OUT_RING( i810c->bufferOffset + y1 * i810s->pitch + x1 * i810c->cpp ); + + OUT_RING( i810c->BR[16]); + OUT_RING( 0 ); /* pad to quadword */ -int -i810CreateGC (GCPtr pGC) + ADVANCE_LP_RING(); +} + +static void +i810DoneSolid(void) +{ +} + +static Bool +i810PrepareCopy(PixmapPtr pSrc, PixmapPtr pDst, int dx, int dy, int alu, Pixel pm) { - if (!fbCreateGC (pGC)) return FALSE; +} - if (pGC->depth != 1) - pGC->funcs = &i810GCFuncs; - - return TRUE; +static void +i810RefreshRing(i810CardInfo *i810c) +{ + i810c->LpRing.head = INREG(LP_RING + RING_HEAD) & HEAD_ADDR; + i810c->LpRing.tail = INREG(LP_RING + RING_TAIL); + i810c->LpRing.space = i810c->LpRing.head - (i810c->LpRing.tail+8); + if (i810c->LpRing.space < 0) + i810c->LpRing.space += i810c->LpRing.mem.Size; } + static void -i810SetRingRegs( KdScreenInfo *screen ) { +i810SetRingRegs(i810CardInfo *i810c) +{ unsigned int itemp; - KdCardInfo *card = screen->card; - I810CardInfo *i810c = (I810CardInfo *) card->driver; - OUTREG(LP_RING + RING_TAIL, 0 ); OUTREG(LP_RING + RING_HEAD, 0 ); @@ -542,65 +302,52 @@ i810SetRingRegs( KdScreenInfo *screen ) { Bool i810InitAccel(ScreenPtr pScreen) { + KdScreenPriv(pScreen); + i810ScreenInfo(pScreenPriv); + i810CardInfo(pScreenPriv); -/* fprintf(stderr,"i810InitAccel\n"); */ + memset(&i810s->kaa, 0, sizeof(KaaScreenInfoRec)); + i810s->kaa.waitMarker = i810WaitMarker; + i810s->kaa.PrepareSolid = i810PrepareSolid; + i810s->kaa.Solid = i810Solid; + i810s->kaa.DoneSolid = i810DoneSolid; + i810s->kaa.PrepareCopy = i810PrepareCopy; + i810s->kaa.Copy = NULL; + i810s->kaa.DoneCopy = NULL; - /* - * Hook up asynchronous drawing - */ - KdScreenInitAsync (pScreen); - /* - * Replace various fb screen functions - */ - pScreen->CreateGC = i810CreateGC; + i810s->pitch = pScreen->width * i810c->cpp; - return TRUE; + return FALSE; } void i810EnableAccel(ScreenPtr pScreen) { - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - KdCardInfo *card = screen->card; - I810CardInfo *i810c = (I810CardInfo *) card->driver; - -/* fprintf(stderr,"i810EnableAccel\n"); */ + i810CardInfo(pScreenPriv); if (i810c->LpRing.mem.Size == 0) { ErrorF("No memory for LpRing!! Acceleration not functional!!\n"); } - i810SetRingRegs( screen ); + i810SetRingRegs(i810c); - KdMarkSync (pScreen); + kaaMarkSync (pScreen); } void -i810SyncAccel(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - - i810Sync(screen); -} - -void i810DisableAccel(ScreenPtr pScreen) { KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; + i810CardInfo(pScreenPriv); + i810ScreenInfo(pScreenPriv); -/* fprintf(stderr,"i810DisableAccel\n"); */ - i810RefreshRing( screen ); - i810Sync( screen ); + i810RefreshRing(i810c); + i810Sync(i810s); } void i810FiniAccel(ScreenPtr pScreen) { -/* fprintf(stderr,"i810FiniAccel\n"); */ - } diff --git a/hw/kdrive/i810/i810stub.c b/hw/kdrive/i810/i810stub.c index 120e31c84..c679e976c 100644 --- a/hw/kdrive/i810/i810stub.c +++ b/hw/kdrive/i810/i810stub.c @@ -42,8 +42,13 @@ X Window System is a trademark of The Open Group */ #include "kdrive.h" #include "kxv.h" #include "i810.h" +#include "klinux.h" -static const int i810Cards[]={ PCI_CHIP_I810, PCI_CHIP_I810_DC100, PCI_CHIP_I810_E }; +static const int i810Cards[]={ + PCI_CHIP_I810, + PCI_CHIP_I810_DC100, + PCI_CHIP_I810_E +}; #define numI810Cards (sizeof(i810Cards) / sizeof(i810Cards[0])) @@ -53,8 +58,6 @@ InitCard (char *name) KdCardAttr attr; int i; - Bool LinuxFindPci(CARD16, CARD16, CARD32, KdCardAttr *); - for (i = 0; i < numI810Cards; i++) if (LinuxFindPci (0x8086, i810Cards[i], 0, &attr)) KdCardInfoAdd (&i810Funcs, &attr, (void *) i810Cards[i]); @@ -83,7 +86,6 @@ int ddxProcessArgument (int argc, char **argv, int i) { int ret; - int KdProcessArgument(int, char **, int); ret = KdProcessArgument(argc, argv, i); return ret; diff --git a/hw/kdrive/mach64/mach64.c b/hw/kdrive/mach64/mach64.c index c093ef83c..948065d03 100644 --- a/hw/kdrive/mach64/mach64.c +++ b/hw/kdrive/mach64/mach64.c @@ -25,6 +25,7 @@ #include <config.h> #endif #include "mach64.h" +#include "kaa.h" static Bool mach64CardInit (KdCardInfo *card) @@ -103,7 +104,7 @@ mach64RandRSetConfig (ScreenPtr pScreen, int rate, RRScreenSizePtr pSize) { - KdCheckSync (pScreen); + kaaWaitSync (pScreen); if (!vesaRandRSetConfig (pScreen, rotation, rate, pSize)) return FALSE; @@ -353,7 +354,7 @@ mach64DPMS (ScreenPtr pScreen, int mode) CRTC_GEN_CNTL &= ~(1 << 6); } - KdCheckSync (pScreen); + kaaWaitSync (pScreen); mach64WriteLCD (reg, 1, LCD_GEN_CTRL); @@ -425,7 +426,6 @@ KdCardFuncs mach64Funcs = { mach64DrawInit, /* initAccel */ mach64DrawEnable, /* enableAccel */ - mach64DrawSync, /* syncAccel */ mach64DrawDisable, /* disableAccel */ mach64DrawFini, /* finiAccel */ diff --git a/hw/kdrive/mach64/mach64.h b/hw/kdrive/mach64/mach64.h index ca042c282..5757cf72d 100644 --- a/hw/kdrive/mach64/mach64.h +++ b/hw/kdrive/mach64/mach64.h @@ -570,6 +570,7 @@ typedef struct _mach64ScreenInfo { Mach64Cursor cursor; CARD32 colorKey; KdVideoAdaptorPtr pAdaptor; + KaaScreenInfoRec kaa; } Mach64ScreenInfo; #define getMach64ScreenInfo(kd) ((Mach64ScreenInfo *) ((kd)->screen->driver)) @@ -624,9 +625,6 @@ void mach64DrawEnable (ScreenPtr pScreen); void -mach64DrawSync (ScreenPtr pScreen); - -void mach64DrawDisable (ScreenPtr pScreen); void diff --git a/hw/kdrive/mach64/mach64draw.c b/hw/kdrive/mach64/mach64draw.c index df53f3fad..4fd5f4a3f 100644 --- a/hw/kdrive/mach64/mach64draw.c +++ b/hw/kdrive/mach64/mach64draw.c @@ -41,6 +41,7 @@ #include "migc.h" #include "miline.h" #include "picturestr.h" +#include "kaa.h" CARD8 mach64Rop[16] = { /* GXclear */ 0x01, /* 0 */ @@ -336,6 +337,16 @@ static const Mach64AccelReg mach64AccelReg[] = { #define NACCELREG (sizeof mach64AccelReg / sizeof mach64AccelReg[0]) +static void +mach64WaitMarker (ScreenPtr pScreen, int marker) +{ + KdScreenPriv(pScreen); + mach64CardInfo(pScreenPriv); + reg = mach64c->reg; + + mach64WaitIdle (reg); +} + static Bool mach64Setup (PixmapPtr pDst, PixmapPtr pSrc, CARD32 combo, int wait) { @@ -537,29 +548,29 @@ mach64DoneCopy (void) #endif } -KaaScreenInfoRec mach64Kaa = { - mach64PrepareSolid, - mach64Solid, - mach64DoneSolid, - - mach64PrepareCopy, - mach64Copy, - mach64DoneCopy, - - 64, /* Offscreen byte alignment */ - 64, /* Offscreen pitch */ - KAA_OFFSCREEN_PIXMAPS, /* Flags */ -}; Bool mach64DrawInit (ScreenPtr pScreen) { KdScreenPriv(pScreen); - + mach64ScreenInfo(pScreenPriv); + + memset(&mach64s->kaa, 0, sizeof(KaaScreenInfoRec)); + mach64s->kaa.waitMarker = mach64WaitMarker; + mach64s->kaa.PrepareSolid = mach64PrepareSolid; + mach64s->kaa.Solid = mach64Solid; + mach64s->kaa.DoneSolid = mach64DoneSolid; + mach64s->kaa.PrepareCopy = mach64PrepareCopy; + mach64s->kaa.Copy = mach64Copy; + mach64s->kaa.DoneCopy = mach64DoneCopy; + mach64s->kaa.offsetAlign = 64; + mach64s->kaa.pitchAlign = 64; + mach64s->kaa.flags = KAA_OFFSCREEN_PIXMAPS; + if (pScreenPriv->screen->fb[0].depth == 4) return FALSE; - if (!kaaDrawInit (pScreen, &mach64Kaa)) + if (!kaaDrawInit (pScreen, &mach64s->kaa)) return FALSE; return TRUE; @@ -568,7 +579,7 @@ mach64DrawInit (ScreenPtr pScreen) void mach64DrawEnable (ScreenPtr pScreen) { - KdMarkSync (pScreen); + kaaMarkSync (pScreen); } void @@ -581,13 +592,3 @@ mach64DrawFini (ScreenPtr pScreen) { kaaDrawFini (pScreen); } - -void -mach64DrawSync (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - mach64CardInfo(pScreenPriv); - reg = mach64c->reg; - - mach64WaitIdle (reg); -} diff --git a/hw/kdrive/mach64/mach64stub.c b/hw/kdrive/mach64/mach64stub.c index c98044ec4..15ad0ce06 100644 --- a/hw/kdrive/mach64/mach64stub.c +++ b/hw/kdrive/mach64/mach64stub.c @@ -35,13 +35,15 @@ InitCard (char *name) { KdCardAttr attr; - if (LinuxFindPci (0x1002, 0x4c4d, 0, &attr)) + if (LinuxFindPci (0x1002, 0x4750, 0, &attr)) KdCardInfoAdd (&mach64Funcs, &attr, 0); - else if (LinuxFindPci (0x1002, 0x4c49, 0, &attr)) + else if (LinuxFindPci (0x1002, 0x4c42, 0, &attr)) KdCardInfoAdd (&mach64Funcs, &attr, 0); else if (LinuxFindPci (0x1002, 0x4c46, 0, &attr)) KdCardInfoAdd (&mach64Funcs, &attr, 0); - else if (LinuxFindPci (0x1002, 0x4c42, 0, &attr)) + else if (LinuxFindPci (0x1002, 0x4c49, 0, &attr)) + KdCardInfoAdd (&mach64Funcs, &attr, 0); + else if (LinuxFindPci (0x1002, 0x4c4d, 0, &attr)) KdCardInfoAdd (&mach64Funcs, &attr, 0); } diff --git a/hw/kdrive/mach64/mach64video.c b/hw/kdrive/mach64/mach64video.c index 1f945db3c..28d48deec 100644 --- a/hw/kdrive/mach64/mach64video.c +++ b/hw/kdrive/mach64/mach64video.c @@ -326,48 +326,6 @@ mach64CopyPlanarData(KdScreenInfo *screen, } } -static void -mach64PaintRegion (DrawablePtr pDraw, RegionPtr pRgn, Pixel fg) -{ - GCPtr pGC; - CARD32 val[2]; - xRectangle *rects, *r; - BoxPtr pBox = REGION_RECTS (pRgn); - int nBox = REGION_NUM_RECTS (pRgn); - - rects = ALLOCATE_LOCAL (nBox * sizeof (xRectangle)); - if (!rects) - goto bail0; - r = rects; - while (nBox--) - { - r->x = pBox->x1 - pDraw->x; - r->y = pBox->y1 - pDraw->y; - r->width = pBox->x2 - pBox->x1; - r->height = pBox->y2 - pBox->y1; - r++; - pBox++; - } - - pGC = GetScratchGC (pDraw->depth, pDraw->pScreen); - if (!pGC) - goto bail1; - - val[0] = fg; - val[1] = IncludeInferiors; - ChangeGC (pGC, GCForeground|GCSubwindowMode, val); - - ValidateGC (pDraw, pGC); - - (*pGC->ops->PolyFillRect) (pDraw, pGC, - REGION_NUM_RECTS (pRgn), rects); - - FreeScratchGC (pGC); -bail1: - DEALLOCATE_LOCAL (rects); -bail0: - ; -} /* Mach64ClipVideo - @@ -777,7 +735,7 @@ mach64PutImage(KdScreenInfo *screen, if (!REGION_EQUAL (screen->pScreen, &pPortPriv->clip, clipBoxes)) { REGION_COPY (screen->pScreen, &pPortPriv->clip, clipBoxes); - mach64PaintRegion (pDraw, &pPortPriv->clip, pPortPriv->colorKey); + KXVPaintRegion (pDraw, &pPortPriv->clip, pPortPriv->colorKey); } pPortPriv->videoOn = TRUE; @@ -898,7 +856,7 @@ mach64ReputImage (KdScreenInfo *screen, if (!REGION_EQUAL (screen->pScreen, &pPortPriv->clip, clipBoxes)) { REGION_COPY (screen->pScreen, &pPortPriv->clip, clipBoxes); - mach64PaintRegion (pDraw, &pPortPriv->clip, pPortPriv->colorKey); + KXVPaintRegion (pDraw, &pPortPriv->clip, pPortPriv->colorKey); } return Success; } diff --git a/hw/kdrive/mga/mga.c b/hw/kdrive/mga/mga.c index 561e80389..c3f9479a2 100644 --- a/hw/kdrive/mga/mga.c +++ b/hw/kdrive/mga/mga.c @@ -234,7 +234,6 @@ KdCardFuncs mgaFuncs = { mgaDrawInit, /* initAccel */ mgaDrawEnable, /* enableAccel */ - mgaDrawSync, /* syncAccel */ mgaDrawDisable, /* disableAccel */ mgaDrawFini, /* finiAccel */ diff --git a/hw/kdrive/mga/mga.h b/hw/kdrive/mga/mga.h index 3b3462063..979702e57 100644 --- a/hw/kdrive/mga/mga.h +++ b/hw/kdrive/mga/mga.h @@ -100,9 +100,10 @@ typedef struct _mgaCardInfo { typedef struct _mgaScreenInfo { VesaScreenPrivRec vesa; + KaaScreenInfoRec kaa; + int pitch; int pw; - } MgaScreenInfo; #define getMgaScreenInfo(kd) ((MgaScreenInfo *) ((kd)->screen->driver)) @@ -134,9 +135,6 @@ void mgaDrawEnable (ScreenPtr pScreen); void -mgaDrawSync (ScreenPtr pScreen); - -void mgaDrawDisable (ScreenPtr pScreen); void diff --git a/hw/kdrive/mga/mgadraw.c b/hw/kdrive/mga/mgadraw.c index 269ce6100..3f6d8b2a2 100644 --- a/hw/kdrive/mga/mgadraw.c +++ b/hw/kdrive/mga/mgadraw.c @@ -27,6 +27,7 @@ #endif #include "mga.h" #include "g400_common.h" +#include "kaa.h" #include <unistd.h> CARD32 mgaRop[16] = { @@ -70,6 +71,17 @@ mgaWaitIdle (void) while (MGA_IN32 (mmio, MGA_REG_STATUS) & 0x10000); } +static void +mgaWaitMarker (ScreenPtr pScreen, int marker) +{ + KdScreenPriv (pScreen); + mgaCardInfo (pScreenPriv); + + mmio = mgac->reg_base; + + mgaWaitIdle (); +} + Bool mgaSetup (ScreenPtr pScreen, int dest_bpp, int wait) { @@ -232,38 +244,40 @@ mgaUploadToScreen(PixmapPtr pDst, char *src, int src_pitch) { return TRUE; } -KaaScreenInfoRec mgaKaa = { - mgaPrepareSolid, - mgaSolid, - mgaDoneSolid, - - mgaPrepareCopy, - mgaCopy, - mgaDoneCopy, - - 192, /* 192 Offscreen byte alignment */ - 128, /* Pitch alignment is in sets of 32 pixels, and we need to - cover 32bpp, so 128 bytes */ - KAA_OFFSCREEN_PIXMAPS /* Flags */ -}; - Bool mgaDrawInit (ScreenPtr pScreen) { KdScreenPriv(pScreen); + mgaScreenInfo (pScreenPriv); KdCardInfo *card = pScreenPriv->card; + memset(&mgas->kaa, 0, sizeof(KaaScreenInfoRec)); + mgas->kaa.waitMarker = mgaWaitMarker; + mgas->kaa.PrepareSolid = mgaPrepareSolid; + mgas->kaa.Solid = mgaSolid; + mgas->kaa.DoneSolid = mgaDoneSolid; + mgas->kaa.PrepareCopy = mgaPrepareCopy; + mgas->kaa.Copy = mgaCopy; + mgas->kaa.DoneCopy = mgaDoneCopy; + /* In PW24 mode, we need to align to "3 64-bytes" */ + mgas->kaa.offsetAlign = 192; + /* Pitch alignment is in sets of 32 pixels, and we need to cover 32bpp, so + * 128 bytes + */ + mgas->kaa.pitchAlign = 128; + mgas->kaa.flags = KAA_OFFSCREEN_PIXMAPS; + if (card->attr.deviceID == MGA_G4XX_DEVICE_ID) { - mgaKaa.PrepareBlend=mgaPrepareBlend; - mgaKaa.Blend=mgaBlend; - mgaKaa.DoneBlend=mgaDoneBlend; - mgaKaa.PrepareComposite=mgaPrepareComposite; - mgaKaa.Composite=mgaComposite; - mgaKaa.DoneComposite=mgaDoneComposite; + mgas->kaa.PrepareBlend = mgaPrepareBlend; + mgas->kaa.Blend = mgaBlend; + mgas->kaa.DoneBlend = mgaDoneBlend; + mgas->kaa.PrepareComposite = mgaPrepareComposite; + mgas->kaa.Composite = mgaComposite; + mgas->kaa.DoneComposite = mgaDoneComposite; } /*mgaKaa.UploadToScreen=mgaUploadToScreen;*/ - if (!kaaDrawInit (pScreen, &mgaKaa)) + if (!kaaDrawInit (pScreen, &mgas->kaa)) return FALSE; return TRUE; @@ -292,7 +306,7 @@ mgaDrawEnable (ScreenPtr pScreen) FatalError ("unsupported pixel format"); } - KdMarkSync (pScreen); + kaaMarkSync (pScreen); } void @@ -305,13 +319,3 @@ mgaDrawFini (ScreenPtr pScreen) { } -void -mgaDrawSync (ScreenPtr pScreen) -{ - KdScreenPriv (pScreen); - mgaCardInfo (pScreenPriv); - - mmio = mgac->reg_base; - - mgaWaitIdle (); -} diff --git a/hw/kdrive/neomagic/ChangeLog b/hw/kdrive/neomagic/ChangeLog index 77d8839d8..c2c62dfe8 100644 --- a/hw/kdrive/neomagic/ChangeLog +++ b/hw/kdrive/neomagic/ChangeLog @@ -1,3 +1,27 @@ +2005-06-09 Eric Anholt <anholt@FreeBSD.org> + + * neo_draw.c: (neoWaitMarker), (neoDrawInit): + * neomagic.c: + * neomagic.h: + - Replace the syncAccel hook in the kdrive structure with a pair of + hooks in the kaa structure: markSync and waitMarker. The first, if + set, returns a hardware-dependent marker number which can then be + waited for with waitMarker. If markSync is absent (which is the case + on all drivers currently), waitMarker must wait for idle on any given + marker number. The intention is to allow for more parallelism when + we get downloading from framebuffer, or more fine-grained idling. + - Replace the KdMarkSync/KdCheckSync functions with kaaMarkSync and + kaaWaitSync. These will need to be refined when KAA starts being + smart about using them. Merge kpict.c into kasync.c since kasyn.c has + all the rest of these fallback funcs. + - Restructure all drivers to initialize a KaaInfo structure by hand + rather than statically in dubious order. + - Whack the i810 driver into shape in hopes that it'll work after this + change (it certainly wouldn't have before this). Doesn't support my + i845 though. + - Make a new KXV helper to avoid duplicated code to fill the region + with the necessary color key. Use it in i810 and mach64 (tested). + 2005-02-08 Keith Packard <keithp@keithp.com> reviewed by: <delete if not using a buddy> diff --git a/hw/kdrive/neomagic/neo_draw.c b/hw/kdrive/neomagic/neo_draw.c index b6419e73c..6c95f516a 100644 --- a/hw/kdrive/neomagic/neo_draw.c +++ b/hw/kdrive/neomagic/neo_draw.c @@ -71,6 +71,14 @@ static void neoWaitIdle(NeoCardInfo *neoc) while ((mmio->bltStat & 1) && ++i<100000); } +static void neoWaitMarker (ScreenPtr pScreen, int marker) +{ + KdScreenPriv(pScreen); + neoCardInfo(pScreenPriv); + + neoWaitIdle(neoc); +} + static void neoWaitFifo(NeoCardInfo *neoc, int requested_fifo_space) { neoWaitIdle( neoc ); @@ -156,20 +164,24 @@ static void neoDoneCopy (void) { } -KaaScreenInfoRec neoKaa = { - neoPrepareSolid, - neoSolid, - neoDoneSolid, - - neoPrepareCopy, - neoCopy, - neoDoneCopy -}; Bool neoDrawInit (ScreenPtr pScreen) { + KdScreenPriv(pScreen); + neoScreenInfo(pScreenPriv); + ENTER(); - if (!kaaDrawInit (pScreen, &neoKaa)) { + + memset(&neos->kaa, 0, sizeof(KaaScreenInfoRec)); + neos->kaa.waitMarker = neoWaitMarker; + neos->kaa.PrepareSolid = neoPrepareSolid; + neos->kaa.Solid = neoSolid; + neos->kaa.DoneSolid = neoDoneSolid; + neos->kaa.PrepareCopy = neoPrepareCopy; + neos->kaa.Copy = neoCopy; + neos->kaa.DoneCopy = neoDoneCopy; + + if (!kaaDrawInit (pScreen, &neos->kaa)) { return FALSE; } LEAVE(); @@ -201,9 +213,3 @@ void neoDrawFini (ScreenPtr pScreen) LEAVE(); } -void neoDrawSync (ScreenPtr pScreen) -{ - SetupNeo(pScreen); - - neoWaitIdle(neoc); -} diff --git a/hw/kdrive/neomagic/neomagic.c b/hw/kdrive/neomagic/neomagic.c index 68dbb9172..b9c6f6f30 100644 --- a/hw/kdrive/neomagic/neomagic.c +++ b/hw/kdrive/neomagic/neomagic.c @@ -328,7 +328,6 @@ KdCardFuncs neoFuncs = { neoDrawInit, // initAccel neoDrawEnable, // enableAccel - neoDrawSync, // syncAccel neoDrawDisable, // disableAccel neoDrawFini, // finiAccel diff --git a/hw/kdrive/neomagic/neomagic.h b/hw/kdrive/neomagic/neomagic.h index 590319652..b91e81e8a 100644 --- a/hw/kdrive/neomagic/neomagic.h +++ b/hw/kdrive/neomagic/neomagic.h @@ -166,6 +166,7 @@ typedef struct _neoScreenInfo { int pitch; int depth; KdVideoAdaptorPtr pAdaptor; + KaaScreenInfoRec kaa; } NeoScreenInfo; #define getNeoScreenInfo(kd) ((NeoScreenInfo *) ((kd)->screen->driver)) @@ -208,9 +209,6 @@ neoDrawDisable (ScreenPtr pScreen); void neoDrawFini (ScreenPtr pScreen); -void -neoDrawSync (ScreenPtr pScreen); - extern KdCardFuncs neoFuncs; #endif /* _NEOMAGIC_H_ */ diff --git a/hw/kdrive/nvidia/nvidia.c b/hw/kdrive/nvidia/nvidia.c index fa53476b1..e284f91f8 100644 --- a/hw/kdrive/nvidia/nvidia.c +++ b/hw/kdrive/nvidia/nvidia.c @@ -117,7 +117,7 @@ nvidiaRandRSetConfig (ScreenPtr pScreen, int rate, RRScreenSizePtr pSize) { - KdCheckSync (pScreen); + kaaWaitSync (pScreen); if (!vesaRandRSetConfig (pScreen, rotation, rate, pSize)) return FALSE; @@ -354,7 +354,6 @@ KdCardFuncs nvidiaFuncs = { nvidiaDrawInit, /* initAccel */ nvidiaDrawEnable, /* enableAccel */ - nvidiaDrawSync, /* syncAccel */ nvidiaDrawDisable, /* disableAccel */ nvidiaDrawFini, /* finiAccel */ diff --git a/hw/kdrive/nvidia/nvidia.h b/hw/kdrive/nvidia/nvidia.h index 083ffc0ea..3a36b43d7 100644 --- a/hw/kdrive/nvidia/nvidia.h +++ b/hw/kdrive/nvidia/nvidia.h @@ -160,6 +160,7 @@ typedef struct _nvidiaScreenInfo { CARD8 *off_screen; int off_screen_size; KdVideoAdaptorPtr pAdaptor; + KaaScreenInfoRec kaa; } NvidiaScreenInfo; #define getNvidiaScreenInfo(kd) ((NvidiaScreenInfo *) ((kd)->screen->driver)) @@ -217,9 +218,6 @@ void nvidiaDrawEnable (ScreenPtr pScreen); void -nvidiaDrawSync (ScreenPtr pScreen); - -void nvidiaDrawDisable (ScreenPtr pScreen); void diff --git a/hw/kdrive/nvidia/nvidiadraw.c b/hw/kdrive/nvidia/nvidiadraw.c index b49ed7805..8901e3707 100644 --- a/hw/kdrive/nvidia/nvidiadraw.c +++ b/hw/kdrive/nvidia/nvidiadraw.c @@ -40,6 +40,7 @@ #include "migc.h" #include "miline.h" #include "picturestr.h" +#include "kaa.h" CARD8 nvidiaRop[16] = { /* GXclear */ 0x01, /* 0 */ @@ -81,6 +82,15 @@ nvidiaWaitIdle (NvidiaCardInfo *card) } } +static void +nvidiaWaitMarker (ScreenPtr pScreen, int marker) +{ + KdScreenPriv(pScreen); + nvidiaCardInfo(pScreenPriv); + + nvidiaWaitIdle (nvidiac); +} + static Bool nvidiaPrepareSolid (PixmapPtr pPixmap, int alu, @@ -154,27 +164,27 @@ nvidiaDoneCopy (void) { } -KaaScreenInfoRec nvidiaKaa = { - nvidiaPrepareSolid, - nvidiaSolid, - nvidiaDoneSolid, - - nvidiaPrepareCopy, - nvidiaCopy, - nvidiaDoneCopy, -}; - Bool nvidiaDrawInit (ScreenPtr pScreen) { KdScreenPriv(pScreen); nvidiaCardInfo(pScreenPriv); + nvidiaScreenInfo(pScreenPriv); Bool ret = TRUE; ENTER (); if (pScreenPriv->screen->fb[0].depth == 4) ret = FALSE; + memset(&nvidias->kaa, 0, sizeof(KaaScreenInfoRec)); + nvidias->kaa.waitMarker = nvidiaWaitMarker; + nvidias->kaa.PrepareSolid = nvidiaPrepareSolid; + nvidias->kaa.Solid = nvidiaSolid; + nvidias->kaa.DoneSolid = nvidiaDoneSolid; + nvidias->kaa.PrepareCopy = nvidiaPrepareCopy; + nvidias->kaa.Copy = nvidiaCopy; + nvidias->kaa.DoneCopy = nvidiaDoneCopy; + if (ret && !nvidiac->rop) { ErrorF ("Failed to map fifo registers\n"); @@ -185,7 +195,7 @@ nvidiaDrawInit (ScreenPtr pScreen) ErrorF ("Fifo appears broken\n"); ret = FALSE; } - if (ret && !kaaDrawInit (pScreen, &nvidiaKaa)) + if (ret && !kaaDrawInit (pScreen, &nvidias->kaa)) { ErrorF ("kaaDrawInit failed\n"); ret = FALSE; @@ -215,7 +225,7 @@ nvidiaDrawEnable (ScreenPtr pScreen) ENTER (); nvidiac->fifo_size = nvidiac->rop->FifoFree.FifoFree; nvidiac->fifo_free = 0; - KdMarkSync (pScreen); + kaaMarkSync (pScreen); LEAVE (); } @@ -229,11 +239,3 @@ nvidiaDrawFini (ScreenPtr pScreen) { } -void -nvidiaDrawSync (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - nvidiaCardInfo(pScreenPriv); - - nvidiaWaitIdle (nvidiac); -} diff --git a/hw/kdrive/pm2/pm2.c b/hw/kdrive/pm2/pm2.c index 89d655ca8..a6b4142da 100644 --- a/hw/kdrive/pm2/pm2.c +++ b/hw/kdrive/pm2/pm2.c @@ -2,6 +2,7 @@ #include <config.h> #endif #include "kdrive.h" +#include "kaa.h" #include "pm2.h" @@ -198,7 +199,7 @@ pmRandRSetConfig (ScreenPtr pScreen, int rate, RRScreenSizePtr pSize) { - KdCheckSync (pScreen); + kaaWaitSync (pScreen); if (!vesaRandRSetConfig (pScreen, rotation, rate, pSize)) return FALSE; @@ -296,7 +297,6 @@ KdCardFuncs PM2Funcs = { pmDrawInit, /* initAccel */ pmDrawEnable, /* enableAccel */ - pmDrawSync, /* syncAccel */ pmDrawDisable, /* disableAccel */ pmDrawFini, /* finiAccel */ diff --git a/hw/kdrive/pm2/pm2.h b/hw/kdrive/pm2/pm2.h index cc39b38e2..e05903365 100644 --- a/hw/kdrive/pm2/pm2.h +++ b/hw/kdrive/pm2/pm2.h @@ -59,6 +59,7 @@ typedef struct _PM2ScreenInfo { CARD8 *off_screen; int off_screen_size; KdVideoAdaptorPtr pAdaptor; + KaaScreenInfoRec kaa; } PM2ScreenInfo; #define getPM2ScreenInfo(kd) ((PM2ScreenInfo *) ((kd)->screen->driver)) @@ -77,9 +78,6 @@ void pmDrawEnable (ScreenPtr); void -pmDrawSync (ScreenPtr); - -void pmDrawDisable (ScreenPtr); void diff --git a/hw/kdrive/pm2/pm2_draw.c b/hw/kdrive/pm2/pm2_draw.c index 076123281..1662adc96 100644 --- a/hw/kdrive/pm2/pm2_draw.c +++ b/hw/kdrive/pm2/pm2_draw.c @@ -2,6 +2,7 @@ #include <config.h> #endif #include "kdrive.h" +#include "kaa.h" #include "pm2.h" @@ -10,6 +11,20 @@ static VOL8 *mmio; static void Permedia2LoadCoord(int x, int y, int w, int h); +static void +pmWaitMarker (ScreenPtr pScreen, int marker) +{ + CHECKCLIPPING; + + while (GLINT_READ_REG(DMACount) != 0); + GLINT_WAIT(2); + GLINT_WRITE_REG(0x400, FilterMode); + GLINT_WRITE_REG(0, GlintSync); + do { + while(GLINT_READ_REG(OutFIFOWords) == 0); + } while (GLINT_READ_REG(OutputFIFO) != Sync_tag); +} + static Bool pmPrepareSolid (PixmapPtr pPixmap, int rop, @@ -159,27 +174,28 @@ Permedia2LoadCoord(int x, int y, } } -KaaScreenInfoRec pmKaa = { - pmPrepareSolid, - pmSolid, - pmDoneSolid, - - pmPrepareCopy, - pmCopy, - pmDoneCopy, -}; Bool pmDrawInit (ScreenPtr pScreen) { KdScreenPriv(pScreen); pmCardInfo(pScreenPriv); + pmScreenInfo(pScreenPriv); Bool ret = TRUE; card = pm2c; mmio = pm2c->reg_base; - if (ret && !kaaDrawInit (pScreen, &pmKaa)) + memset(&pm2s->kaa, 0, sizeof(KaaScreenInfoRec)); + pm2s->kaa.waitMarker = pmWaitMarker; + pm2s->kaa.PrepareSolid = pmPrepareSolid; + pm2s->kaa.Solid = pmSolid; + pm2s->kaa.DoneSolid = pmDoneSolid; + pm2s->kaa.PrepareCopy = pmPrepareCopy; + pm2s->kaa.Copy = pmCopy; + pm2s->kaa.DoneCopy = pmDoneCopy; + + if (ret && !kaaDrawInit (pScreen, &pm2s->kaa)) { ErrorF ("kaaDrawInit failed\n"); ret = FALSE; @@ -288,7 +304,7 @@ pmDrawEnable (ScreenPtr pScreen) GLINT_SLOW_WRITE_REG(0, StartY); GLINT_SLOW_WRITE_REG(0, GLINTCount); - KdMarkSync (pScreen); + kaaMarkSync (pScreen); } void @@ -300,17 +316,3 @@ void pmDrawFini (ScreenPtr pScreen) { } - -void -pmDrawSync (ScreenPtr pScreen) -{ - CHECKCLIPPING; - - while (GLINT_READ_REG(DMACount) != 0); - GLINT_WAIT(2); - GLINT_WRITE_REG(0x400, FilterMode); - GLINT_WRITE_REG(0, GlintSync); - do { - while(GLINT_READ_REG(OutFIFOWords) == 0); - } while (GLINT_READ_REG(OutputFIFO) != Sync_tag); -} diff --git a/hw/kdrive/r128/r128.c b/hw/kdrive/r128/r128.c index 2be8b26d2..62d96fab0 100644 --- a/hw/kdrive/r128/r128.c +++ b/hw/kdrive/r128/r128.c @@ -244,7 +244,6 @@ KdCardFuncs r128Funcs = { r128DrawInit, /* initAccel */ r128DrawEnable, /* enableAccel */ - r128DrawSync, /* syncAccel */ r128DrawDisable, /* disableAccel */ r128DrawFini, /* finiAccel */ diff --git a/hw/kdrive/r128/r128.h b/hw/kdrive/r128/r128.h index 8cf2bd4e2..02e3c10d5 100644 --- a/hw/kdrive/r128/r128.h +++ b/hw/kdrive/r128/r128.h @@ -83,6 +83,8 @@ typedef struct _r128ScreenInfo { CARD8 *off_screen; int off_screen_size; + KaaScreenInfoRec kaa; + int pitch; int datatype; @@ -114,9 +116,6 @@ void r128DrawEnable (ScreenPtr pScreen); void -r128DrawSync (ScreenPtr pScreen); - -void r128DrawDisable (ScreenPtr pScreen); void diff --git a/hw/kdrive/r128/r128draw.c b/hw/kdrive/r128/r128draw.c index be4dc79ae..208d7ef5f 100644 --- a/hw/kdrive/r128/r128draw.c +++ b/hw/kdrive/r128/r128draw.c @@ -26,6 +26,7 @@ #include <config.h> #endif #include "r128.h" +#include "kaa.h" CARD8 r128SolidRop[16] = { /* GXclear */ 0x00, /* 0 */ @@ -107,6 +108,17 @@ r128WaitIdle (void) } +static void +r128WaitMarker (ScreenPtr pScreen, int marker) +{ + KdScreenPriv (pScreen); + r128CardInfo (pScreenPriv); + + mmio = r128c->reg_base; + + r128WaitIdle (); +} + static Bool r128Setup (ScreenPtr pScreen, int wait) { @@ -219,20 +231,23 @@ r128DoneCopy (void) { } -KaaScreenInfoRec r128Kaa = { - r128PrepareSolid, - r128Solid, - r128DoneSolid, - - r128PrepareCopy, - r128Copy, - r128DoneCopy, -}; Bool r128DrawInit (ScreenPtr pScreen) { - if (!kaaDrawInit (pScreen, &r128Kaa)) + KdScreenPriv (pScreen); + r128ScreenInfo (pScreenPriv); + + memset(&r128s->kaa, 0, sizeof(KaaScreenInfoRec)); + r128s->kaa.waitMarker = r128WaitMarker; + r128s->kaa.PrepareSolid = r128PrepareSolid; + r128s->kaa.Solid = r128Solid; + r128s->kaa.DoneSolid = r128DoneSolid; + r128s->kaa.PrepareCopy = r128PrepareCopy; + r128s->kaa.Copy = r128Copy; + r128s->kaa.DoneCopy = r128DoneCopy; + + if (!kaaDrawInit (pScreen, &r128s->kaa)) return FALSE; return TRUE; @@ -245,7 +260,7 @@ r128DrawEnable (ScreenPtr pScreen) r128ScreenInfo (pScreenPriv); r128s->pitch = pScreenPriv->screen->width >> 3; - + switch (pScreenPriv->screen->fb[0].depth) { case 8: r128s->datatype = 2; @@ -270,7 +285,7 @@ r128DrawEnable (ScreenPtr pScreen) | R128_GMC_CLR_CMP_CNTL_DIS | R128_GMC_AUX_CLIP_DIS); - KdMarkSync (pScreen); + kaaMarkSync (pScreen); } void @@ -282,14 +297,3 @@ void r128DrawFini (ScreenPtr pScreen) { } - -void -r128DrawSync (ScreenPtr pScreen) -{ - KdScreenPriv (pScreen); - r128CardInfo (pScreenPriv); - - mmio = r128c->reg_base; - - r128WaitIdle (); -} diff --git a/hw/kdrive/smi/smi.c b/hw/kdrive/smi/smi.c index 635fca4da..05151aae9 100644 --- a/hw/kdrive/smi/smi.c +++ b/hw/kdrive/smi/smi.c @@ -108,7 +108,7 @@ smiRandRSetConfig (ScreenPtr pScreen, Bool ret; ENTER (); - KdCheckSync (pScreen); + kaaWaitSync (pScreen); ret = subRandRSetConfig (pScreen, randr, rate, pSize); LEAVE(); @@ -335,7 +335,6 @@ KdCardFuncs smiFuncs = { smiDrawInit, /* initAccel */ smiDrawEnable, /* enableAccel */ - smiDrawSync, /* syncAccel */ smiDrawDisable, /* disableAccel */ smiDrawFini, /* finiAccel */ diff --git a/hw/kdrive/smi/smi.h b/hw/kdrive/smi/smi.h index d4733213f..93b856939 100644 --- a/hw/kdrive/smi/smi.h +++ b/hw/kdrive/smi/smi.h @@ -186,6 +186,7 @@ typedef struct _smiScreenInfo { CARD32 stride; CARD32 data_format; CARD8 dpr_vpr_enable; + KaaScreenInfoRec kaa; } SmiScreenInfo; #define getSmiScreenInfo(kd) ((SmiScreenInfo *) ((kd)->screen->driver)) @@ -243,9 +244,6 @@ void smiDrawEnable (ScreenPtr pScreen); void -smiDrawSync (ScreenPtr pScreen); - -void smiDrawDisable (ScreenPtr pScreen); void diff --git a/hw/kdrive/smi/smidraw.c b/hw/kdrive/smi/smidraw.c index d1691fce0..a85382816 100644 --- a/hw/kdrive/smi/smidraw.c +++ b/hw/kdrive/smi/smidraw.c @@ -41,6 +41,7 @@ #include "migc.h" #include "miline.h" #include "picturestr.h" +#include "kaa.h" CARD8 smiBltRop[16] = { /* GXclear */ 0x00, /* 0 */ @@ -143,6 +144,15 @@ smiSetup (ScreenPtr pScreen, int wait) return TRUE; } +static void +smiWaitMarker (ScreenPtr pScreen, int marker) +{ + KdScreenPriv(pScreen); + smic = getSmiCardInfo(pScreenPriv); + + smiWaitIdle (smic); +} + static Bool smiPrepareSolid (PixmapPtr pPixmap, int alu, @@ -229,15 +239,6 @@ smiDoneCopy (void) { } -KaaScreenInfoRec smiKaa = { - smiPrepareSolid, - smiSolid, - smiDoneSolid, - - smiPrepareCopy, - smiCopy, - smiDoneCopy, -}; Bool smiDrawInit (ScreenPtr pScreen) @@ -258,7 +259,16 @@ smiDrawInit (ScreenPtr pScreen) return FALSE; } - if (!kaaDrawInit (pScreen, &smiKaa)) + memset(&smis->kaa, 0, sizeof(KaaScreenInfoRec)); + smis->kaa.PrepareSolid = smiPrepareSolid; + smis->kaa.Solid = smiSolid; + smis->kaa.DoneSolid = smiDoneSolid; + smis->kaa.PrepareCopy = smiPrepareCopy; + smis->kaa.Copy = smiCopy; + smis->kaa.DoneCopy = smiDoneCopy; + smis->kaa.waitMarker = smiWaitMarker; + + if (!kaaDrawInit (pScreen, &smis->kaa)) { LEAVE (); return FALSE; @@ -311,7 +321,7 @@ smiDrawEnable (ScreenPtr pScreen) } smiSetup (pScreen, 0); - KdMarkSync (pScreen); + kaaMarkSync (pScreen); LEAVE (); } @@ -332,12 +342,3 @@ smiDrawFini (ScreenPtr pScreen) ENTER (); LEAVE (); } - -void -smiDrawSync (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - smic = getSmiCardInfo(pScreenPriv); - - smiWaitIdle (smic); -} diff --git a/hw/kdrive/src/Makefile.am b/hw/kdrive/src/Makefile.am index 07c388d29..4758caea5 100644 --- a/hw/kdrive/src/Makefile.am +++ b/hw/kdrive/src/Makefile.am @@ -21,7 +21,6 @@ libkdrive_a_SOURCES = \ kmode.c \ knoop.c \ koffscreen.c \ - kpict.c \ kshadow.c \ ktest.c \ kxv.c \ diff --git a/hw/kdrive/src/kaa.c b/hw/kdrive/src/kaa.c index 6fa1d7ed0..559f4f5b4 100644 --- a/hw/kdrive/src/kaa.c +++ b/hw/kdrive/src/kaa.c @@ -104,7 +104,7 @@ kaaPixmapSave (ScreenPtr pScreen, KdOffscreenArea *area) return; #endif - KdCheckSync (pPixmap->drawable.pScreen); + kaaWaitSync (pPixmap->drawable.pScreen); bytes = src_pitch < dst_pitch ? src_pitch : dst_pitch; @@ -142,13 +142,13 @@ kaaPixmapAllocArea (PixmapPtr pPixmap) if (pKaaScr->info->flags & KAA_OFFSCREEN_ALIGN_POT && w != 1) w = 1 << (kaaLog2(w - 1) + 1); - pitch = (w * bpp / 8 + pKaaScr->info->offscreenPitch - 1) & - ~(pKaaScr->info->offscreenPitch - 1); + pitch = (w * bpp / 8 + pKaaScr->info->pitchAlign - 1) & + ~(pKaaScr->info->pitchAlign - 1); pKaaPixmap->devKind = pPixmap->devKind; pKaaPixmap->devPrivate = pPixmap->devPrivate; pKaaPixmap->area = KdOffscreenAlloc (pScreen, pitch * h, - pKaaScr->info->offscreenByteAlign, + pKaaScr->info->offsetAlign, FALSE, kaaPixmapSave, (pointer) pPixmap); if (!pKaaPixmap->area) @@ -202,7 +202,7 @@ kaaMoveInPixmap (PixmapPtr pPixmap) bytes = src_pitch < dst_pitch ? src_pitch : dst_pitch; - KdCheckSync (pPixmap->drawable.pScreen); + kaaWaitSync (pPixmap->drawable.pScreen); i = pPixmap->drawable.height; while (i--) { @@ -513,7 +513,7 @@ kaaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n, } (*pKaaScr->info->DoneSolid) (); kaaDrawableDirty (pDrawable); - KdMarkSync(pDrawable->pScreen); + kaaMarkSync (pDrawable->pScreen); } void @@ -563,11 +563,11 @@ kaaCopyNtoN (DrawablePtr pSrcDrawable, pbox++; } (*pKaaScr->info->DoneCopy) (); - KdMarkSync(pDstDrawable->pScreen); + kaaMarkSync (pDstDrawable->pScreen); } else { - KdCheckSync (pDstDrawable->pScreen); + kaaWaitSync (pDstDrawable->pScreen); fbCopyNtoN (pSrcDrawable, pDstDrawable, pGC, pbox, nbox, dx, dy, reverse, upsidedown, bitplane, closure); @@ -683,7 +683,7 @@ kaaPolyFillRect(DrawablePtr pDrawable, } (*pKaaScr->info->DoneSolid) (); kaaDrawableDirty (pDrawable); - KdMarkSync(pDrawable->pScreen); + kaaMarkSync (pDrawable->pScreen); } static void @@ -708,7 +708,7 @@ kaaSolidBoxClipped (DrawablePtr pDrawable, !(pPixmap = kaaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) || !(*pKaaScr->info->PrepareSolid) (pPixmap, GXcopy, pm, fg)) { - KdCheckSync (pDrawable->pScreen); + kaaWaitSync (pDrawable->pScreen); fg = fbReplicatePixel (fg, pDrawable->bitsPerPixel); fbSolidBoxClipped (pDrawable, pClip, x1, y1, x2, y2, fbAnd (GXcopy, fg, pm), @@ -747,7 +747,7 @@ kaaSolidBoxClipped (DrawablePtr pDrawable, } (*pKaaScr->info->DoneSolid) (); kaaDrawableDirty (pDrawable); - KdMarkSync(pDrawable->pScreen); + kaaMarkSync (pDrawable->pScreen); } static void @@ -833,7 +833,7 @@ kaaImageGlyphBlt (DrawablePtr pDrawable, opaque = FALSE; } - KdCheckSync (pDrawable->pScreen); + kaaWaitSync (pDrawable->pScreen); kaaDrawableDirty (pDrawable); ppci = ppciInit; @@ -992,11 +992,11 @@ kaaFillRegionSolid (DrawablePtr pDrawable, pBox++; } (*pKaaScr->info->DoneSolid) (); - KdMarkSync(pDrawable->pScreen); + kaaMarkSync (pDrawable->pScreen); } else { - KdCheckSync (pDrawable->pScreen); + kaaWaitSync (pDrawable->pScreen); fbFillRegionSolid (pDrawable, pRegion, 0, fbReplicatePixel (pixel, pDrawable->bitsPerPixel)); } @@ -1011,7 +1011,7 @@ kaaFillRegionTiled (DrawablePtr pDrawable, { else { - KdCheckSync + kaaWaitSync } #endif @@ -1134,3 +1134,28 @@ kaaDrawFini (ScreenPtr pScreen) xfree (pKaaScr); } + +void +kaaMarkSync (ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + KaaScreenPriv(pScreen); + + pScreenPriv->card->needSync = TRUE; + if (pKaaScr->info->markSync != NULL) { + pScreenPriv->card->lastMarker = (*pKaaScr->info->markSync) (pScreen); + } +} + +void +kaaWaitSync (ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + KaaScreenPriv(pScreen); + KdCardInfo *card = pScreenPriv->card; + + if (card->needSync) { + (*pKaaScr->info->waitMarker) (pScreen, card->lastMarker); + card->needSync = FALSE; + } +} diff --git a/hw/kdrive/src/kaa.h b/hw/kdrive/src/kaa.h index 27f991742..15f2faac2 100644 --- a/hw/kdrive/src/kaa.h +++ b/hw/kdrive/src/kaa.h @@ -27,6 +27,8 @@ #ifndef _KAA_H_ #define _KAA_H_ +#include "picturestr.h" + #define KaaGetScreenPriv(s) ((KaaScreenPrivPtr)(s)->devPrivates[kaaScreenPrivateIndex].ptr) #define KaaScreenPriv(s) KaaScreenPrivPtr pKaaScr = KaaGetScreenPriv(s) @@ -72,6 +74,12 @@ void kaaMoveInPixmap (PixmapPtr pPixmap); void +kaaMarkSync (ScreenPtr pScreen); + +void +kaaWaitSync (ScreenPtr pScreen); + +void kaaCopyNtoN (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, diff --git a/hw/kdrive/src/kaapict.c b/hw/kdrive/src/kaapict.c index 1e4d2ef61..bbd1584ff 100644 --- a/hw/kdrive/src/kaapict.c +++ b/hw/kdrive/src/kaapict.c @@ -279,7 +279,7 @@ kaaTryDriverSolidFill(PicturePtr pSrc, * before accessing it. We'd prefer for it to be in memory. */ if (kaaPixmapIsOffscreen(pSrcPix)) { - KdCheckSync(pDst->pDrawable->pScreen); + kaaWaitSync(pDst->pDrawable->pScreen); } pixel = *(CARD32 *)(pSrcPix->devPrivate.ptr); @@ -310,7 +310,7 @@ kaaTryDriverSolidFill(PicturePtr pSrc, } (*pKaaScr->info->DoneSolid) (); - KdMarkSync(pDst->pDrawable->pScreen); + kaaMarkSync (pDst->pDrawable->pScreen); kaaDrawableDirty (pDst->pDrawable); REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); @@ -397,7 +397,7 @@ kaaTryDriverBlend(CARD8 op, } (*pKaaScr->info->DoneBlend) (); - KdMarkSync(pDst->pDrawable->pScreen); + kaaMarkSync (pDst->pDrawable->pScreen); kaaDrawableDirty (pDst->pDrawable); REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); @@ -520,7 +520,7 @@ kaaTryDriverComposite(CARD8 op, } (*pKaaScr->info->DoneComposite) (); - KdMarkSync(pDst->pDrawable->pScreen); + kaaMarkSync (pDst->pDrawable->pScreen); kaaDrawableDirty (pDst->pDrawable); REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); diff --git a/hw/kdrive/src/kasync.c b/hw/kdrive/src/kasync.c index 4cb1e3b6b..724d546dd 100644 --- a/hw/kdrive/src/kasync.c +++ b/hw/kdrive/src/kasync.c @@ -28,6 +28,9 @@ #endif #include "kdrive.h" #include "kaa.h" +#include "picturestr.h" +#include "mipict.h" +#include "fbpict.h" /* * These functions wrap the low-level fb rendering functions and @@ -39,7 +42,7 @@ void KdCheckFillSpans (DrawablePtr pDrawable, GCPtr pGC, int nspans, DDXPointPtr ppt, int *pwidth, int fSorted) { - KdCheckSync (pDrawable->pScreen); + kaaWaitSync (pDrawable->pScreen); kaaDrawableDirty (pDrawable); fbFillSpans (pDrawable, pGC, nspans, ppt, pwidth, fSorted); } @@ -48,7 +51,7 @@ void KdCheckSetSpans (DrawablePtr pDrawable, GCPtr pGC, char *psrc, DDXPointPtr ppt, int *pwidth, int nspans, int fSorted) { - KdCheckSync (pDrawable->pScreen); + kaaWaitSync (pDrawable->pScreen); kaaDrawableDirty (pDrawable); fbSetSpans (pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted); } @@ -58,7 +61,7 @@ KdCheckPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y, int w, int h, int leftPad, int format, char *bits) { - KdCheckSync (pDrawable->pScreen); + kaaWaitSync (pDrawable->pScreen); kaaDrawableDirty (pDrawable); fbPutImage (pDrawable, pGC, depth, x, y, w, h, leftPad, format, bits); } @@ -67,7 +70,7 @@ RegionPtr KdCheckCopyArea (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy, int w, int h, int dstx, int dsty) { - KdCheckSync (pSrc->pScreen); + kaaWaitSync (pSrc->pScreen); kaaDrawableDirty (pDst); return fbCopyArea (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty); } @@ -77,7 +80,7 @@ KdCheckCopyPlane (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy, int w, int h, int dstx, int dsty, unsigned long bitPlane) { - KdCheckSync (pSrc->pScreen); + kaaWaitSync (pSrc->pScreen); kaaDrawableDirty (pDst); return fbCopyPlane (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty, bitPlane); @@ -87,7 +90,7 @@ void KdCheckPolyPoint (DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr pptInit) { - KdCheckSync (pDrawable->pScreen); + kaaWaitSync (pDrawable->pScreen); kaaDrawableDirty (pDrawable); fbPolyPoint (pDrawable, pGC, mode, npt, pptInit); } @@ -98,7 +101,7 @@ KdCheckPolylines (DrawablePtr pDrawable, GCPtr pGC, { if (pGC->lineWidth == 0) { - KdCheckSync(pDrawable->pScreen); + kaaWaitSync(pDrawable->pScreen); kaaDrawableDirty (pDrawable); } kaaDrawableDirty (pDrawable); @@ -110,7 +113,7 @@ KdCheckPolySegment (DrawablePtr pDrawable, GCPtr pGC, int nsegInit, xSegment *pSegInit) { if (pGC->lineWidth == 0) { - KdCheckSync(pDrawable->pScreen); + kaaWaitSync(pDrawable->pScreen); kaaDrawableDirty (pDrawable); } kaaDrawableDirty (pDrawable); @@ -122,7 +125,7 @@ KdCheckPolyRectangle (DrawablePtr pDrawable, GCPtr pGC, int nrects, xRectangle *prect) { if (pGC->lineWidth == 0) { - KdCheckSync(pDrawable->pScreen); + kaaWaitSync(pDrawable->pScreen); kaaDrawableDirty (pDrawable); } fbPolyRectangle (pDrawable, pGC, nrects, prect); @@ -134,7 +137,7 @@ KdCheckPolyArc (DrawablePtr pDrawable, GCPtr pGC, { if (pGC->lineWidth == 0) { - KdCheckSync(pDrawable->pScreen); + kaaWaitSync(pDrawable->pScreen); kaaDrawableDirty (pDrawable); fbPolyArc (pDrawable, pGC, narcs, pArcs); } @@ -147,7 +150,7 @@ void KdCheckFillPolygon (DrawablePtr pDrawable, GCPtr pGC, int shape, int mode, int count, DDXPointPtr pPts) { - KdCheckSync(pDrawable->pScreen); + kaaWaitSync(pDrawable->pScreen); kaaDrawableDirty (pDrawable); fbFillPolygon (pDrawable, pGC, mode, count, pPts); } @@ -157,7 +160,7 @@ void KdCheckPolyFillRect (DrawablePtr pDrawable, GCPtr pGC, int nrect, xRectangle *prect) { - KdCheckSync(pDrawable->pScreen); + kaaWaitSync(pDrawable->pScreen); kaaDrawableDirty (pDrawable); fbPolyFillRect (pDrawable, pGC, nrect, prect); } @@ -166,7 +169,7 @@ void KdCheckPolyFillArc (DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *pArcs) { - KdCheckSync(pDrawable->pScreen); + kaaWaitSync(pDrawable->pScreen); kaaDrawableDirty (pDrawable); fbPolyFillArc (pDrawable, pGC, narcs, pArcs); } @@ -176,7 +179,7 @@ KdCheckImageGlyphBlt (DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr *ppci, pointer pglyphBase) { - KdCheckSync(pDrawable->pScreen); + kaaWaitSync(pDrawable->pScreen); kaaDrawableDirty (pDrawable); fbImageGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); } @@ -186,7 +189,7 @@ KdCheckPolyGlyphBlt (DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr *ppci, pointer pglyphBase) { - KdCheckSync(pDrawable->pScreen); + kaaWaitSync(pDrawable->pScreen); kaaDrawableDirty (pDrawable); fbPolyGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); } @@ -196,7 +199,7 @@ KdCheckPushPixels (GCPtr pGC, PixmapPtr pBitmap, DrawablePtr pDrawable, int w, int h, int x, int y) { - KdCheckSync(pDrawable->pScreen); + kaaWaitSync(pDrawable->pScreen); kaaDrawableDirty (pDrawable); fbPushPixels (pGC, pBitmap, pDrawable, w, h, x, y); } @@ -207,7 +210,7 @@ KdCheckGetImage (DrawablePtr pDrawable, unsigned int format, unsigned long planeMask, char *d) { - KdCheckSync(pDrawable->pScreen); + kaaWaitSync(pDrawable->pScreen); fbGetImage (pDrawable, x, y, w, h, format, planeMask, d); } @@ -219,7 +222,7 @@ KdCheckGetSpans (DrawablePtr pDrawable, int nspans, char *pdstStart) { - KdCheckSync(pDrawable->pScreen); + kaaWaitSync(pDrawable->pScreen); fbGetSpans (pDrawable, wMax, ppt, pwidth, nspans, pdstStart); } @@ -230,7 +233,7 @@ KdCheckSaveAreas (PixmapPtr pPixmap, int yorg, WindowPtr pWin) { - KdCheckSync(pWin->drawable.pScreen); + kaaWaitSync(pWin->drawable.pScreen); kaaDrawableDirty (&pPixmap->drawable); fbSaveAreas (pPixmap, prgnSave, xorg, yorg, pWin); } @@ -242,7 +245,7 @@ KdCheckRestoreAreas (PixmapPtr pPixmap, int yorg, WindowPtr pWin) { - KdCheckSync(pWin->drawable.pScreen); + kaaWaitSync(pWin->drawable.pScreen); kaaDrawableDirty ((DrawablePtr)pWin); fbRestoreAreas (pPixmap, prgnSave, xorg, yorg, pWin); } @@ -250,7 +253,7 @@ KdCheckRestoreAreas (PixmapPtr pPixmap, void KdCheckPaintWindow (WindowPtr pWin, RegionPtr pRegion, int what) { - KdCheckSync (pWin->drawable.pScreen); + kaaWaitSync (pWin->drawable.pScreen); kaaDrawableDirty ((DrawablePtr)pWin); fbPaintWindow (pWin, pRegion, what); } @@ -258,7 +261,7 @@ KdCheckPaintWindow (WindowPtr pWin, RegionPtr pRegion, int what) void KdCheckCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) { - KdCheckSync (pWin->drawable.pScreen); + kaaWaitSync (pWin->drawable.pScreen); kaaDrawableDirty ((DrawablePtr)pWin); fbCopyWindow (pWin, ptOldOrg, prgnSrc); } @@ -270,7 +273,7 @@ KdCheckPaintKey(DrawablePtr pDrawable, CARD32 pixel, int layer) { - KdCheckSync (pDrawable->pScreen); + kaaWaitSync (pDrawable->pScreen); kaaDrawableDirty (pDrawable); fbOverlayPaintKey (pDrawable, pRegion, pixel, layer); } @@ -278,7 +281,7 @@ KdCheckPaintKey(DrawablePtr pDrawable, void KdCheckOverlayCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) { - KdCheckSync (pWin->drawable.pScreen); + kaaWaitSync (pWin->drawable.pScreen); kaaDrawableDirty ((DrawablePtr)pWin); fbOverlayCopyWindow (pWin, ptOldOrg, prgnSrc); } @@ -305,6 +308,47 @@ KdScreenInitAsync (ScreenPtr pScreen) #endif } +void +KdCheckComposite (CARD8 op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) +{ + kaaWaitSync (pDst->pDrawable->pScreen); + kaaDrawableDirty (pDst->pDrawable); + fbComposite (op, + pSrc, + pMask, + pDst, + xSrc, + ySrc, + xMask, + yMask, + xDst, + yDst, + width, + height); +} + +void +KdCheckRasterizeTrapezoid(PicturePtr pMask, + xTrapezoid *trap, + int x_off, + int y_off) +{ + kaaWaitSync (pMask->pDrawable->pScreen); + kaaDrawableDirty (pMask->pDrawable); + fbRasterizeTrapezoid (pMask, trap, x_off, y_off); +} + /* * Only need to stall for copyarea/copyplane */ @@ -333,3 +377,13 @@ const GCOps kdAsyncPixmapGCOps = { ,NULL #endif }; + +void +KdPictureInitAsync (ScreenPtr pScreen) +{ + PictureScreenPtr ps; + + ps = GetPictureScreen(pScreen); + ps->Composite = KdCheckComposite; + ps->RasterizeTrapezoid = KdCheckRasterizeTrapezoid; +} diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c index b27a6403d..0271d4e34 100644 --- a/hw/kdrive/src/kdrive.c +++ b/hw/kdrive/src/kdrive.c @@ -224,7 +224,7 @@ KdDisableScreen (ScreenPtr pScreen) if (!pScreenPriv->enabled) return; - KdCheckSync (pScreen); + kaaWaitSync (pScreen); if (!pScreenPriv->closed) KdSetRootClip (pScreen, FALSE); KdDisableColormap (pScreen); diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h index 5289ae0bd..c371263d3 100644 --- a/hw/kdrive/src/kdrive.h +++ b/hw/kdrive/src/kdrive.h @@ -89,7 +89,9 @@ typedef struct _KdCardInfo { struct _KdScreenInfo *screenList; int selected; struct _KdCardInfo *next; + Bool needSync; + int lastMarker; } KdCardInfo; extern KdCardInfo *kdCardInfo; @@ -180,7 +182,6 @@ typedef struct _KdCardFuncs { Bool (*initAccel) (ScreenPtr); void (*enableAccel) (ScreenPtr); - void (*syncAccel) (ScreenPtr); void (*disableAccel) (ScreenPtr); void (*finiAccel) (ScreenPtr); @@ -316,6 +317,13 @@ typedef struct _KaaTrapezoid { } KaaTrapezoid; typedef struct _KaaScreenInfo { + int offsetAlign; + int pitchAlign; + int flags; + + int (*markSync) (ScreenPtr pScreen); + void (*waitMarker) (ScreenPtr pScreen, int marker); + Bool (*PrepareSolid) (PixmapPtr pPixmap, int alu, Pixel planemask, @@ -337,10 +345,6 @@ typedef struct _KaaScreenInfo { int height); void (*DoneCopy) (void); - int offscreenByteAlign; - int offscreenPitch; - int flags; - Bool (*PrepareBlend) (int op, PicturePtr pSrcPicture, PicturePtr pDstPicture, @@ -421,17 +425,6 @@ extern KdOsFuncs *kdOsFuncs; (pointer) v) #define KdScreenPriv(pScreen) KdPrivScreenPtr pScreenPriv = KdGetScreenPriv(pScreen) -#define KdCheckSync(s) { \ - KdScreenPriv(s); \ - KdCardInfo *card = pScreenPriv->card; \ - if (card->needSync) { \ - card->needSync = FALSE; \ - (*card->cfuncs->syncAccel) (s); \ - } \ -} - -#define KdMarkSync(s) (KdGetScreenPriv(s)->card->needSync = TRUE) - /* kaa.c */ Bool kaaDrawInit (ScreenPtr pScreen, diff --git a/hw/kdrive/src/kpict.c b/hw/kdrive/src/kpict.c deleted file mode 100644 index e42ae427b..000000000 --- a/hw/kdrive/src/kpict.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * $RCSId: $ - * - * Copyright � 1999 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include "kdrive.h" -#include <picturestr.h> -#include <mipict.h> -#include <fbpict.h> -#include "kaa.h" - -void -KdCheckComposite (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height) -{ - KdCheckSync (pDst->pDrawable->pScreen); - kaaDrawableDirty (pDst->pDrawable); - fbComposite (op, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height); -} - -void -KdCheckRasterizeTrapezoid(PicturePtr pMask, - xTrapezoid *trap, - int x_off, - int y_off) -{ - KdCheckSync (pMask->pDrawable->pScreen); - kaaDrawableDirty (pMask->pDrawable); - fbRasterizeTrapezoid (pMask, trap, x_off, y_off); -} - -void -KdPictureInitAsync (ScreenPtr pScreen) -{ - PictureScreenPtr ps; - - ps = GetPictureScreen(pScreen); - ps->Composite = KdCheckComposite; - ps->RasterizeTrapezoid = KdCheckRasterizeTrapezoid; -} diff --git a/hw/kdrive/src/kxv.c b/hw/kdrive/src/kxv.c index c66bf589b..57ca0db30 100644 --- a/hw/kdrive/src/kxv.c +++ b/hw/kdrive/src/kxv.c @@ -1919,3 +1919,46 @@ KdXVCopyPlanarData(KdScreenInfo *screen, CARD8 *src, CARD8 *dst, int randr, } } } + +void +KXVPaintRegion (DrawablePtr pDraw, RegionPtr pRgn, Pixel fg) +{ + GCPtr pGC; + CARD32 val[2]; + xRectangle *rects, *r; + BoxPtr pBox = REGION_RECTS (pRgn); + int nBox = REGION_NUM_RECTS (pRgn); + + rects = ALLOCATE_LOCAL (nBox * sizeof (xRectangle)); + if (!rects) + goto bail0; + r = rects; + while (nBox--) + { + r->x = pBox->x1 - pDraw->x; + r->y = pBox->y1 - pDraw->y; + r->width = pBox->x2 - pBox->x1; + r->height = pBox->y2 - pBox->y1; + r++; + pBox++; + } + + pGC = GetScratchGC (pDraw->depth, pDraw->pScreen); + if (!pGC) + goto bail1; + + val[0] = fg; + val[1] = IncludeInferiors; + ChangeGC (pGC, GCForeground|GCSubwindowMode, val); + + ValidateGC (pDraw, pGC); + + (*pGC->ops->PolyFillRect) (pDraw, pGC, + REGION_NUM_RECTS (pRgn), rects); + + FreeScratchGC (pGC); +bail1: + DEALLOCATE_LOCAL (rects); +bail0: + ; +} diff --git a/hw/kdrive/src/kxv.h b/hw/kdrive/src/kxv.h index 28fc3c4ed..b9eca8b8e 100644 --- a/hw/kdrive/src/kxv.h +++ b/hw/kdrive/src/kxv.h @@ -256,6 +256,9 @@ KdXVCopyPlanarData(KdScreenInfo *screen, CARD8 *src, CARD8 *dst, int randr, int srcPitch, int srcPitch2, int dstPitch, int srcW, int srcH, int height, int top, int left, int h, int w, int id); +void +KXVPaintRegion (DrawablePtr pDraw, RegionPtr pRgn, Pixel fg); + KdVideoAdaptorPtr KdXVAllocateVideoAdaptorRec(KdScreenInfo * screen); void KdXVFreeVideoAdaptorRec(KdVideoAdaptorPtr ptr); diff --git a/hw/kdrive/via/via.c b/hw/kdrive/via/via.c index c2e9e067d..b8e1036aa 100644 --- a/hw/kdrive/via/via.c +++ b/hw/kdrive/via/via.c @@ -426,7 +426,6 @@ KdCardFuncs viaFuncs = { viaDrawInit, /* initAccel */ viaDrawEnable, /* enableAccel */ - viaDrawSync, /* syncAccel */ viaDrawDisable, /* disableAccel */ viaDrawFini, /* finiAccel */ diff --git a/hw/kdrive/via/via.h b/hw/kdrive/via/via.h index 2bb0c3d23..00f40bc04 100644 --- a/hw/kdrive/via/via.h +++ b/hw/kdrive/via/via.h @@ -107,6 +107,7 @@ typedef struct _viaCardInfo { */ typedef struct _viaScreenInfo { VesaScreenPrivRec vesa; + KaaScreenInfoRec kaa; } ViaScreenInfo; /* diff --git a/hw/kdrive/via/viadraw.c b/hw/kdrive/via/viadraw.c index 6f0931463..a6544ee36 100644 --- a/hw/kdrive/via/viadraw.c +++ b/hw/kdrive/via/viadraw.c @@ -34,6 +34,8 @@ #include "viadraw.h" #include "via_regs.h" #include <sched.h> +#include "kdrive.h" +#include "kaa.h" /* ** A global to contain card information between calls into this file. @@ -108,6 +110,29 @@ viaWaitIdle( ViaCardInfo* viac ) { } /* +** void viaDrawSync( ScreenPtr pScreen, int marker ) +** +** Description: +** Block until the graphics chip has finished all outstanding drawing +** operations and the framebuffer contents is static. +** +** Arguments: +** pScreen Pointer to screen strucutre for the screen we're +** waiting for drawing to end on. +** +** Return: +** None. +*/ +static void +viaWaitMarker( ScreenPtr pScreen, int marker ) { + KdScreenPriv( pScreen ); + ViaCardInfo* viac = pScreenPriv->card->driver; + + viaWaitIdle( viac ); +} + + +/* ** Bool viaPrepareSolid( PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg ) ** ** Description: @@ -214,8 +239,7 @@ viaSolid( int x1, int y1, int x2, int y2 ) { ** None. */ static void -viaDoneSolid() { - ; +viaDoneSolid(void) { } /* @@ -330,26 +354,9 @@ viaCopy( int srcX, int srcY, int dstX, int dstY, int w, int h ) { ** None. */ static void -viaDoneCopy() { - ; +viaDoneCopy(void) { } -/* -** viaKaa structure -** -** Description: -** Structure to contain function pointers to accelerated KAA operations -** in this driver. -*/ -KaaScreenInfoRec viaKaa = { - viaPrepareSolid, - viaSolid, - viaDoneSolid, - - viaPrepareCopy, - viaCopy, - viaDoneCopy, -}; /* ** Bool viaDrawInit( ScreenPtr pScreen ) @@ -370,6 +377,7 @@ Bool viaDrawInit( ScreenPtr pScreen ) { KdScreenPriv( pScreen ); ViaCardInfo* viac = pScreenPriv->card->driver; + ViaScreenInfo* vias = pScreenPriv->card->driver; CARD32 geMode = 0; if( !viac ) return FALSE; @@ -425,7 +433,16 @@ viaDrawInit( ScreenPtr pScreen ) { DebugF( "Initialized 2D engine!\n" ); - return kaaDrawInit( pScreen, &viaKaa ); + memset(&vias->kaa, 0, sizeof(KaaScreenInfoRec)); + vias->kaa.waitMarker = viaWaitMarker; + vias->kaa.PrepareSolid = viaPrepareSolid; + vias->kaa.Solid = viaSolid; + vias->kaa.DoneSolid = viaDoneSolid; + vias->kaa.PrepareCopy = viaPrepareCopy; + vias->kaa.Copy = viaCopy; + vias->kaa.DoneCopy = viaDoneCopy; + + return kaaDrawInit( pScreen, &vias->kaa ); } /* @@ -443,7 +460,7 @@ viaDrawInit( ScreenPtr pScreen ) { */ void viaDrawEnable( ScreenPtr pScreen ) { - KdMarkSync( pScreen ); + kaaMarkSync( pScreen ); } /* @@ -480,26 +497,3 @@ viaDrawDisable( ScreenPtr pScreen ) { void viaDrawFini( ScreenPtr pScreen ) { } - -/* -** void viaDrawSync( ScreenPtr pScreen ) -** -** Description: -** Block until the graphics chip has finished all outstanding drawing -** operations and the framebuffer contents is static. -** -** Arguments: -** pScreen Pointer to screen strucutre for the screen we're -** waiting for drawing to end on. -** -** Return: -** None. -*/ -void -viaDrawSync( ScreenPtr pScreen ) { - KdScreenPriv( pScreen ); - ViaCardInfo* viac = pScreenPriv->card->driver; - - viaWaitIdle( viac ); -} - |