- 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).
			
			
This commit is contained in:
		
							parent
							
								
									72ca8e1b54
								
							
						
					
					
						commit
						545c082cf9
					
				|  | @ -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> | 2005-02-28  Keith Packard  <keithp@keithp.com> | ||||||
| 
 | 
 | ||||||
| 	* ati_reg.h: | 	* ati_reg.h: | ||||||
|  |  | ||||||
|  | @ -756,7 +756,6 @@ KdCardFuncs ATIFuncs = { | ||||||
| 
 | 
 | ||||||
| 	ATIDrawInit,		/* initAccel */ | 	ATIDrawInit,		/* initAccel */ | ||||||
| 	ATIDrawEnable,		/* enableAccel */ | 	ATIDrawEnable,		/* enableAccel */ | ||||||
| 	ATIDrawSync,		/* syncAccel */ |  | ||||||
| 	ATIDrawDisable,		/* disableAccel */ | 	ATIDrawDisable,		/* disableAccel */ | ||||||
| 	ATIDrawFini,		/* finiAccel */ | 	ATIDrawFini,		/* finiAccel */ | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -352,9 +352,6 @@ ATIDrawInit(ScreenPtr pScreen); | ||||||
| void | void | ||||||
| ATIDrawEnable(ScreenPtr pScreen); | ATIDrawEnable(ScreenPtr pScreen); | ||||||
| 
 | 
 | ||||||
| void |  | ||||||
| ATIDrawSync(ScreenPtr pScreen); |  | ||||||
| 
 |  | ||||||
| void | void | ||||||
| ATIDrawDisable(ScreenPtr pScreen); | ATIDrawDisable(ScreenPtr pScreen); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -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 | void | ||||||
| RadeonSwitchTo2D(ATIScreenInfo *atis) | RadeonSwitchTo2D(ATIScreenInfo *atis) | ||||||
| { | { | ||||||
|  | @ -287,12 +298,12 @@ ATIGetOffsetPitch(ATIScreenInfo *atis, int bpp, CARD32 *pitch_offset, | ||||||
| 	ATICardInfo *atic = atis->atic; | 	ATICardInfo *atic = atis->atic; | ||||||
| 
 | 
 | ||||||
| 	/* On the R128, depending on the bpp the screen can be set up so that it
 | 	/* 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 | 	 * accelerated, so we check the specific pitch requirement of alignment | ||||||
| 	 * to 8 pixels. | 	 * to 8 pixels. | ||||||
| 	 */ | 	 */ | ||||||
| 	if (atic->is_radeon) { | 	if (atic->is_radeon) { | ||||||
| 		if (pitch % atis->kaa.offscreenPitch != 0) | 		if (pitch % atis->kaa.pitchAlign != 0) | ||||||
| 			ATI_FALLBACK(("Bad pitch 0x%08x\n", pitch)); | 			ATI_FALLBACK(("Bad pitch 0x%08x\n", pitch)); | ||||||
| 		*pitch_offset = ((pitch >> 6) << 22) | (offset >> 10); | 		*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); | 		*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)); | 		ATI_FALLBACK(("Bad offset 0x%08x\n", offset)); | ||||||
| 
 | 
 | ||||||
| 	return TRUE; | 	return TRUE; | ||||||
|  | @ -656,7 +667,7 @@ ATIUploadToScreen(PixmapPtr pDst, char *src, int src_pitch) | ||||||
| 		END_DMA(); | 		END_DMA(); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	KdMarkSync(pScreen); | 	kaaMarkSync(pScreen); | ||||||
| 
 | 
 | ||||||
| 	ErrorF("hostdata upload %d,%d %dbpp\n", width, height, bpp); | 	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) | 	if (atis->kaa.flags & KAA_OFFSCREEN_ALIGN_POT) | ||||||
| 		w = 1 << (ATILog2(w - 1) + 1); | 		w = 1 << (ATILog2(w - 1) + 1); | ||||||
| 	dst_pitch = (w * pSrc->drawable.bitsPerPixel / 8 + | 	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; | 	size = dst_pitch * pSrc->drawable.height; | ||||||
| 	if (size > atis->scratch_area->size) | 	if (size > atis->scratch_area->size) | ||||||
| 		ATI_FALLBACK(("Pixmap too large for scratch (%d,%d)\n", | 		ATI_FALLBACK(("Pixmap too large for scratch (%d,%d)\n", | ||||||
| 		    pSrc->drawable.width, pSrc->drawable.height)); | 		    pSrc->drawable.width, pSrc->drawable.height)); | ||||||
| 
 | 
 | ||||||
| 	atis->scratch_next = (atis->scratch_next + | 	atis->scratch_next = (atis->scratch_next + atis->kaa.offsetAlign - 1) & | ||||||
| 	    atis->kaa.offscreenByteAlign - 1) & | 	    ~(atis->kaa.offsetAlign - 1); | ||||||
| 	    ~(atis->kaa.offscreenByteAlign - 1); |  | ||||||
| 	if (atis->scratch_next + size > atis->scratch_area->offset + | 	if (atis->scratch_next + size > atis->scratch_area->offset + | ||||||
| 	    atis->scratch_area->size) { | 	    atis->scratch_area->size) { | ||||||
| 		/* Only sync when we've used all of the scratch area. */ | 		/* 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; | 		atis->scratch_next = atis->scratch_area->offset; | ||||||
| 	} | 	} | ||||||
| 	memcpy(pDst, pSrc, sizeof(*pDst)); | 	memcpy(pDst, pSrc, sizeof(*pDst)); | ||||||
|  | @ -771,6 +781,7 @@ ATIDrawInit(ScreenPtr pScreen) | ||||||
| #endif /* USE_DRI */ | #endif /* USE_DRI */ | ||||||
| 
 | 
 | ||||||
| 	memset(&atis->kaa, 0, sizeof(KaaScreenInfoRec)); | 	memset(&atis->kaa, 0, sizeof(KaaScreenInfoRec)); | ||||||
|  | 	atis->kaa.waitMarker = ATIWaitMarker; | ||||||
| 	atis->kaa.PrepareSolid = ATIPrepareSolid; | 	atis->kaa.PrepareSolid = ATIPrepareSolid; | ||||||
| 	atis->kaa.Solid = ATISolid; | 	atis->kaa.Solid = ATISolid; | ||||||
| 	atis->kaa.DoneSolid = ATIDoneSolid; | 	atis->kaa.DoneSolid = ATIDoneSolid; | ||||||
|  | @ -783,16 +794,16 @@ ATIDrawInit(ScreenPtr pScreen) | ||||||
| 
 | 
 | ||||||
| 	atis->kaa.flags = KAA_OFFSCREEN_PIXMAPS; | 	atis->kaa.flags = KAA_OFFSCREEN_PIXMAPS; | ||||||
| 	if (atic->is_radeon) { | 	if (atic->is_radeon) { | ||||||
| 		atis->kaa.offscreenByteAlign = 1024; | 		atis->kaa.offsetAlign = 1024; | ||||||
| 		atis->kaa.offscreenPitch = 64; | 		atis->kaa.pitchAlign = 64; | ||||||
| 	} else { | 	} else { | ||||||
| 		/* Rage 128 compositing wants power-of-two pitches. */ | 		/* Rage 128 compositing wants power-of-two pitches. */ | ||||||
| 		atis->kaa.flags |= KAA_OFFSCREEN_ALIGN_POT; | 		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
 | 		/* Pitch alignment is in sets of 8 pixels, and we need to cover
 | ||||||
| 		 * 32bpp, so 32 bytes. | 		 * 32bpp, so 32 bytes. | ||||||
| 		 */ | 		 */ | ||||||
| 		atis->kaa.offscreenPitch = 32; | 		atis->kaa.pitchAlign = 32; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	kaaInitTrapOffsets(8, sample_offsets_x, sample_offsets_y, 0.0, 0.0); | 	kaaInitTrapOffsets(8, sample_offsets_x, sample_offsets_y, 0.0, 0.0); | ||||||
|  | @ -874,13 +885,13 @@ ATIDrawEnable(ScreenPtr pScreen) | ||||||
| 	 * can't be migrated. | 	 * can't be migrated. | ||||||
| 	 */ | 	 */ | ||||||
| 	atis->scratch_area = KdOffscreenAlloc(pScreen, 131072, | 	atis->scratch_area = KdOffscreenAlloc(pScreen, 131072, | ||||||
| 	    atis->kaa.offscreenByteAlign, TRUE, ATIScratchSave, atis); | 	    atis->kaa.offsetAlign, TRUE, ATIScratchSave, atis); | ||||||
| 	if (atis->scratch_area != NULL) { | 	if (atis->scratch_area != NULL) { | ||||||
| 		atis->scratch_next = atis->scratch_area->offset; | 		atis->scratch_next = atis->scratch_area->offset; | ||||||
| 		atis->kaa.UploadToScratch = ATIUploadToScratch; | 		atis->kaa.UploadToScratch = ATIUploadToScratch; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	KdMarkSync(pScreen); | 	kaaMarkSync(pScreen); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void | void | ||||||
|  | @ -908,13 +919,3 @@ ATIDrawFini(ScreenPtr pScreen) | ||||||
| 	kaaDrawFini(pScreen); | 	kaaDrawFini(pScreen); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void |  | ||||||
| ATIDrawSync(ScreenPtr pScreen) |  | ||||||
| { |  | ||||||
| 	KdScreenPriv(pScreen); |  | ||||||
| 	ATIScreenInfo(pScreenPriv); |  | ||||||
| 
 |  | ||||||
| 	ENTER_DRAW(0); |  | ||||||
| 	ATIWaitIdle(atis); |  | ||||||
| 	LEAVE_DRAW(0); |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  | @ -562,7 +562,7 @@ static void ATIDRISwapContext(ScreenPtr pScreen, DRISyncType syncType, | ||||||
| 	if ((syncType==DRI_3D_SYNC) && (oldContextType==DRI_2D_CONTEXT) && | 	if ((syncType==DRI_3D_SYNC) && (oldContextType==DRI_2D_CONTEXT) && | ||||||
| 	    (newContextType==DRI_2D_CONTEXT)) { | 	    (newContextType==DRI_2D_CONTEXT)) { | ||||||
| 		/* Entering from Wakeup */ | 		/* Entering from Wakeup */ | ||||||
| 		KdMarkSync(pScreen); | 		kaaMarkSync(pScreen); | ||||||
| 	} | 	} | ||||||
| 	if ((syncType==DRI_2D_SYNC) && (oldContextType==DRI_NO_CONTEXT) && | 	if ((syncType==DRI_2D_SYNC) && (oldContextType==DRI_NO_CONTEXT) && | ||||||
| 	    (newContextType==DRI_2D_CONTEXT)) { | 	    (newContextType==DRI_2D_CONTEXT)) { | ||||||
|  |  | ||||||
|  | @ -259,7 +259,7 @@ R128DisplayVideo(KdScreenInfo *screen, ATIPortPrivPtr pPortPriv) | ||||||
| 	/* XXX: Shouldn't this be in kxv.c instead? */ | 	/* XXX: Shouldn't this be in kxv.c instead? */ | ||||||
| 	DamageDamageRegion(pPortPriv->pDraw, &pPortPriv->clip); | 	DamageDamageRegion(pPortPriv->pDraw, &pPortPriv->clip); | ||||||
| #endif | #endif | ||||||
| 	KdMarkSync(pScreen); | 	kaaMarkSync(pScreen); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| union intfloat { | union intfloat { | ||||||
|  | @ -490,7 +490,7 @@ RadeonDisplayVideo(KdScreenInfo *screen, ATIPortPrivPtr pPortPriv) | ||||||
| 	/* XXX: Shouldn't this be in kxv.c instead? */ | 	/* XXX: Shouldn't this be in kxv.c instead? */ | ||||||
| 	DamageDamageRegion(pPortPriv->pDraw, &pPortPriv->clip); | 	DamageDamageRegion(pPortPriv->pDraw, &pPortPriv->clip); | ||||||
| #endif | #endif | ||||||
| 	KdMarkSync(pScreen); | 	kaaMarkSync(pScreen); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static void | static void | ||||||
|  |  | ||||||
|  | @ -25,6 +25,7 @@ | ||||||
| #include <config.h> | #include <config.h> | ||||||
| #endif | #endif | ||||||
| #include "chips.h" | #include "chips.h" | ||||||
|  | #include "kaa.h" | ||||||
| #include <sys/io.h> | #include <sys/io.h> | ||||||
| 
 | 
 | ||||||
| #undef CHIPS_DEBUG | #undef CHIPS_DEBUG | ||||||
|  | @ -138,7 +139,7 @@ chipsRandRSetConfig (ScreenPtr		pScreen, | ||||||
| 		      int		rate, | 		      int		rate, | ||||||
| 		      RRScreenSizePtr	pSize) | 		      RRScreenSizePtr	pSize) | ||||||
| { | { | ||||||
|     KdCheckSync (pScreen); |     kaaWaitSync (pScreen); | ||||||
| 
 | 
 | ||||||
|     if (!vesaRandRSetConfig (pScreen, rotation, rate, pSize)) |     if (!vesaRandRSetConfig (pScreen, rotation, rate, pSize)) | ||||||
| 	return FALSE; | 	return FALSE; | ||||||
|  | @ -332,7 +333,6 @@ KdCardFuncs	chipsFuncs = { | ||||||
|      |      | ||||||
|     chipsDrawInit,        /* initAccel */ |     chipsDrawInit,        /* initAccel */ | ||||||
|     chipsDrawEnable,      /* enableAccel */ |     chipsDrawEnable,      /* enableAccel */ | ||||||
|     chipsDrawSync,	    /* syncAccel */ |  | ||||||
|     chipsDrawDisable,     /* disableAccel */ |     chipsDrawDisable,     /* disableAccel */ | ||||||
|     chipsDrawFini,        /* finiAccel */ |     chipsDrawFini,        /* finiAccel */ | ||||||
|      |      | ||||||
|  |  | ||||||
|  | @ -76,6 +76,7 @@ typedef struct _chipsScreenInfo { | ||||||
|     CARD8	    *off_screen; |     CARD8	    *off_screen; | ||||||
|     int		    off_screen_size; |     int		    off_screen_size; | ||||||
|     ChipsCursor   cursor; |     ChipsCursor   cursor; | ||||||
|  |     KaaScreenInfoRec kaa; | ||||||
| } ChipsScreenInfo; | } ChipsScreenInfo; | ||||||
| 
 | 
 | ||||||
| #define getChipsScreenInfo(kd) ((ChipsScreenInfo *) ((kd)->screen->driver)) | #define getChipsScreenInfo(kd) ((ChipsScreenInfo *) ((kd)->screen->driver)) | ||||||
|  | @ -87,9 +88,6 @@ chipsDrawInit (ScreenPtr pScreen); | ||||||
| void | void | ||||||
| chipsDrawEnable (ScreenPtr pScreen); | chipsDrawEnable (ScreenPtr pScreen); | ||||||
| 
 | 
 | ||||||
| void |  | ||||||
| chipsDrawSync (ScreenPtr pScreen); |  | ||||||
| 
 |  | ||||||
| void | void | ||||||
| chipsDrawDisable (ScreenPtr pScreen); | chipsDrawDisable (ScreenPtr pScreen); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -39,6 +39,7 @@ | ||||||
| #include	"fb.h" | #include	"fb.h" | ||||||
| #include	"migc.h" | #include	"migc.h" | ||||||
| #include	"miline.h" | #include	"miline.h" | ||||||
|  | #include	"kaa.h" | ||||||
| 
 | 
 | ||||||
| CARD8 chipsBltRop[16] = { | CARD8 chipsBltRop[16] = { | ||||||
|     /* GXclear      */      0x00,         /* 0 */ |     /* GXclear      */      0x00,         /* 0 */ | ||||||
|  | @ -159,6 +160,13 @@ chipsSet (ScreenPtr pScreen) | ||||||
|     pixelStride = pScreenPriv->screen->fb[0].pixelStride; |     pixelStride = pScreenPriv->screen->fb[0].pixelStride; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | static void | ||||||
|  | chipsWaitMarker (ScreenPtr pScreen, int marker) | ||||||
|  | { | ||||||
|  |     chipsSet (pScreen); | ||||||
|  |     chipsWaitIdle (); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| #ifdef HIQV | #ifdef HIQV | ||||||
| #define CHIPS_BR0	0x00	/* offset */ | #define CHIPS_BR0	0x00	/* offset */ | ||||||
| #define CHIPS_BR1    	0x04	/* bg */ | #define CHIPS_BR1    	0x04	/* bg */ | ||||||
|  | @ -424,23 +432,12 @@ chipsDoneCopy (void) | ||||||
| { | { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| KaaScreenInfoRec    chipsKaa = { |  | ||||||
|     chipsPrepareSolid, |  | ||||||
|     chipsSolid, |  | ||||||
|     chipsDoneSolid, |  | ||||||
| 
 |  | ||||||
|     chipsPrepareCopy, |  | ||||||
|     chipsCopy, |  | ||||||
|     chipsDoneCopy, |  | ||||||
| 
 |  | ||||||
|     0, 0, 0 |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| Bool | Bool | ||||||
| chipsDrawInit (ScreenPtr pScreen) | chipsDrawInit (ScreenPtr pScreen) | ||||||
| { | { | ||||||
|     KdScreenPriv(pScreen); |     KdScreenPriv(pScreen); | ||||||
|      |     chipsScreenInfo(pScreenPriv); | ||||||
|  | 
 | ||||||
|     switch (pScreenPriv->screen->fb[0].bitsPerPixel) { |     switch (pScreenPriv->screen->fb[0].bitsPerPixel) { | ||||||
|     case 8: |     case 8: | ||||||
|     case 16: |     case 16: | ||||||
|  | @ -449,7 +446,16 @@ chipsDrawInit (ScreenPtr pScreen) | ||||||
| 	return FALSE; | 	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 FALSE; | ||||||
|      |      | ||||||
|     return TRUE; |     return TRUE; | ||||||
|  | @ -474,7 +480,7 @@ chipsDrawEnable (ScreenPtr pScreen) | ||||||
|     chipsWaitIdle (); |     chipsWaitIdle (); | ||||||
|     chipsWriteXR (chipss, 0x20, mode); |     chipsWriteXR (chipss, 0x20, mode); | ||||||
|      |      | ||||||
|     KdMarkSync (pScreen); |     kaaMarkSync (pScreen); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void | void | ||||||
|  | @ -487,9 +493,3 @@ chipsDrawFini (ScreenPtr pScreen) | ||||||
| { | { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void |  | ||||||
| chipsDrawSync (ScreenPtr pScreen) |  | ||||||
| { |  | ||||||
|     chipsSet (pScreen); |  | ||||||
|     chipsWaitIdle (); |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  | @ -597,7 +597,6 @@ KdCardFuncs epsonFuncs = { | ||||||
| 
 | 
 | ||||||
|     epsonDrawInit,          /* initAccel */ |     epsonDrawInit,          /* initAccel */ | ||||||
|     epsonDrawEnable,        /* enableAccel */ |     epsonDrawEnable,        /* enableAccel */ | ||||||
|     epsonDrawSync,          /* syncAccel */ |  | ||||||
|     epsonDrawDisable,       /* disableAccel */ |     epsonDrawDisable,       /* disableAccel */ | ||||||
|     epsonDrawFini,          /* finiAccel */ |     epsonDrawFini,          /* finiAccel */ | ||||||
|      |      | ||||||
|  |  | ||||||
|  | @ -57,6 +57,7 @@ typedef struct _epsonPriv { | ||||||
| typedef struct _epsonScrPriv { | typedef struct _epsonScrPriv { | ||||||
|     Rotation		randr; |     Rotation		randr; | ||||||
|     Bool			shadow; |     Bool			shadow; | ||||||
|  |     KaaScreenInfoRec	kaa; | ||||||
| } EpsonScrPriv; | } EpsonScrPriv; | ||||||
| 
 | 
 | ||||||
| extern KdCardFuncs  epsonFuncs; | extern KdCardFuncs  epsonFuncs; | ||||||
|  | @ -114,9 +115,6 @@ epsonDrawInit (ScreenPtr pScreen); | ||||||
| void | void | ||||||
| epsonDrawEnable (ScreenPtr pScreen); | epsonDrawEnable (ScreenPtr pScreen); | ||||||
| 
 | 
 | ||||||
| void |  | ||||||
| epsonDrawSync (ScreenPtr pScreen); |  | ||||||
| 
 |  | ||||||
| void | void | ||||||
| epsonDrawDisable (ScreenPtr pScreen); | epsonDrawDisable (ScreenPtr pScreen); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -33,6 +33,8 @@ | ||||||
| #include    "epson13806draw.h" | #include    "epson13806draw.h" | ||||||
| #include    "epson13806reg.h" | #include    "epson13806reg.h" | ||||||
| 
 | 
 | ||||||
|  | #include    "kaa.h" | ||||||
|  | 
 | ||||||
| #include    "gcstruct.h" | #include    "gcstruct.h" | ||||||
| #include    "scrnintstr.h" | #include    "scrnintstr.h" | ||||||
| #include    "pixmapstr.h" | #include    "pixmapstr.h" | ||||||
|  | @ -182,7 +184,28 @@ epsonWaitForHwBltDone (void) | ||||||
| { | { | ||||||
|     while (EPSON13806_REG (EPSON13806_BLTCTRL0) & EPSON13806_BLTCTRL0_ACTIVE) {} |     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 |  * epsonPrepareSolid | ||||||
|  | @ -428,20 +451,6 @@ epsonDoneCopy (void) | ||||||
|     EPSON_DEBUG_COPY (fprintf(stderr,"-epsonDoneCopy\n")); |     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 |  * epsonDrawInit | ||||||
|  | @ -456,6 +465,10 @@ static KaaScreenInfoRec epsonKaa = { | ||||||
| Bool | Bool | ||||||
| epsonDrawInit (ScreenPtr pScreen) | epsonDrawInit (ScreenPtr pScreen) | ||||||
| { | { | ||||||
|  |     KdScreenPriv(pScreen); | ||||||
|  |     KdScreenInfo *screen = pScreenPriv->screen; | ||||||
|  |     EpsonScrPriv *epsons = screen->driver; | ||||||
|  | 
 | ||||||
|    EPSON_DEBUG (fprintf(stderr,"+epsonDrawInit\n")); |    EPSON_DEBUG (fprintf(stderr,"+epsonDrawInit\n")); | ||||||
|     |     | ||||||
|    epsonSet(pScreen); |    epsonSet(pScreen); | ||||||
|  | @ -535,7 +548,17 @@ epsonDrawInit (ScreenPtr pScreen) | ||||||
|     EPSON13806_REG16(EPSON13806_GPIOCTRL) |= 0x00fc; |     EPSON13806_REG16(EPSON13806_GPIOCTRL) |= 0x00fc; | ||||||
| #endif | #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; |         return FALSE; | ||||||
|      |      | ||||||
|     EPSON_DEBUG (fprintf(stderr,"-epsonDrawInit\n")); |     EPSON_DEBUG (fprintf(stderr,"-epsonDrawInit\n")); | ||||||
|  | @ -558,29 +581,8 @@ epsonDrawEnable (ScreenPtr pScreen) | ||||||
| { | { | ||||||
|     EPSON_DEBUG (fprintf(stderr,"+epsonDrawEnable\n")); |     EPSON_DEBUG (fprintf(stderr,"+epsonDrawEnable\n")); | ||||||
|     epsonWaitForHwBltDone (); |     epsonWaitForHwBltDone (); | ||||||
|     KdMarkSync (pScreen); |     kaaMarkSync (pScreen); | ||||||
|     EPSON_DEBUG (fprintf(stderr,"+epsonDrawEnable\n")); |     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")); |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -87,7 +87,6 @@ KdCardFuncs	fakeFuncs = { | ||||||
|      |      | ||||||
|     0,			    /* initAccel */ |     0,			    /* initAccel */ | ||||||
|     0,			    /* enableAccel */ |     0,			    /* enableAccel */ | ||||||
|     0,			    /* syncAccel */ |  | ||||||
|     0,			    /* disableAccel */ |     0,			    /* disableAccel */ | ||||||
|     0,			    /* finiAccel */ |     0,			    /* finiAccel */ | ||||||
|      |      | ||||||
|  |  | ||||||
|  | @ -176,7 +176,7 @@ i810CardInit (KdCardInfo *card) | ||||||
|     return TRUE; |     return TRUE; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void | static void | ||||||
| i810ScreenFini (KdScreenInfo *screen) | i810ScreenFini (KdScreenInfo *screen) | ||||||
| { | { | ||||||
|     I810ScreenInfo    *i810s = (I810ScreenInfo *) screen->driver; |     I810ScreenInfo    *i810s = (I810ScreenInfo *) screen->driver; | ||||||
|  | @ -185,7 +185,7 @@ i810ScreenFini (KdScreenInfo *screen) | ||||||
|     screen->driver = 0;     |     screen->driver = 0;     | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| Bool | static Bool | ||||||
| i810InitScreen (ScreenPtr pScreen) { | i810InitScreen (ScreenPtr pScreen) { | ||||||
| 
 | 
 | ||||||
| #ifdef XV | #ifdef XV | ||||||
|  | @ -194,7 +194,14 @@ i810InitScreen (ScreenPtr pScreen) { | ||||||
|     return TRUE; |     return TRUE; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void | static Bool | ||||||
|  | i810FinishInitScreen(ScreenPtr pScreen) | ||||||
|  | { | ||||||
|  |     /* XXX: RandR init */ | ||||||
|  |     return TRUE; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | static void | ||||||
| i810CardFini (KdCardInfo *card) | i810CardFini (KdCardInfo *card) | ||||||
| { | { | ||||||
|     I810CardInfo	*i810c = (I810CardInfo *) card->driver; |     I810CardInfo	*i810c = (I810CardInfo *) card->driver; | ||||||
|  | @ -415,7 +422,7 @@ i810ReadControlMMIO(I810CardInfo *i810c, int addr, CARD8 index) { | ||||||
|   return minb(addr+1); |   return minb(addr+1); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| Bool | static Bool | ||||||
| i810ModeSupported (KdScreenInfo *screen, const KdMonitorTiming *t) | i810ModeSupported (KdScreenInfo *screen, const KdMonitorTiming *t) | ||||||
| { | { | ||||||
|     /* This is just a guess. */ |     /* This is just a guess. */ | ||||||
|  | @ -424,7 +431,7 @@ i810ModeSupported (KdScreenInfo *screen, const KdMonitorTiming *t) | ||||||
|     return TRUE; |     return TRUE; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| Bool | static Bool | ||||||
| i810ModeUsable (KdScreenInfo *screen) | i810ModeUsable (KdScreenInfo *screen) | ||||||
| { | { | ||||||
|     KdCardInfo	    *card = screen->card; |     KdCardInfo	    *card = screen->card; | ||||||
|  | @ -465,7 +472,7 @@ i810ModeUsable (KdScreenInfo *screen) | ||||||
|     return screen_size <= (i810c->videoRam * 1024); |     return screen_size <= (i810c->videoRam * 1024); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| int i810AllocateGARTMemory( KdScreenInfo *screen )  | static int i810AllocateGARTMemory( KdScreenInfo *screen )  | ||||||
| { | { | ||||||
|    KdCardInfo	    *card = screen->card; |    KdCardInfo	    *card = screen->card; | ||||||
|    I810CardInfo    *i810c = (I810CardInfo *) card->driver; |    I810CardInfo    *i810c = (I810CardInfo *) card->driver; | ||||||
|  | @ -589,7 +596,7 @@ int i810AllocateGARTMemory( KdScreenInfo *screen ) | ||||||
| 
 | 
 | ||||||
| /* Allocate from a memrange, returns success */ | /* 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; |    if (size > pool->Size) return FALSE; | ||||||
| 
 | 
 | ||||||
|  | @ -600,7 +607,7 @@ int i810AllocLow( I810MemRange *result, I810MemRange *pool, int size ) | ||||||
|    return TRUE; |    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; |    if (size > pool->Size) return 0; | ||||||
| 
 | 
 | ||||||
|  | @ -611,7 +618,7 @@ int i810AllocHigh( I810MemRange *result, I810MemRange *pool, int size ) | ||||||
|    return 1; |    return 1; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| Bool | static Bool | ||||||
| i810AllocateFront(KdScreenInfo *screen) { | i810AllocateFront(KdScreenInfo *screen) { | ||||||
| 
 | 
 | ||||||
|     KdCardInfo	    *card = screen->card; |     KdCardInfo	    *card = screen->card; | ||||||
|  | @ -719,6 +726,8 @@ i810ScreenInit (KdScreenInfo *screen) | ||||||
| 
 | 
 | ||||||
|     memset (i810s, '\0', sizeof (I810ScreenInfo)); |     memset (i810s, '\0', sizeof (I810ScreenInfo)); | ||||||
| 
 | 
 | ||||||
|  |     i810s->i810c = i810c; | ||||||
|  | 
 | ||||||
|     /* Default dimensions */ |     /* Default dimensions */ | ||||||
|     if (!screen->width || !screen->height) |     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) && |     if ((i810Reg->LprbTail & TAIL_ADDR) != (i810Reg->LprbHead & HEAD_ADDR) && | ||||||
|         i810Reg->LprbLen & RING_VALID) { |         i810Reg->LprbLen & RING_VALID) { | ||||||
|         i810PrintErrorState( card ); |         i810PrintErrorState( i810c ); | ||||||
|         FatalError( "Active ring not flushed\n"); |         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; |     I810CardInfo    *i810c = card->driver; | ||||||
|     i810VGAPtr      vgap = &i810c->vga; |     i810VGAPtr      vgap = &i810c->vga; | ||||||
| 
 | 
 | ||||||
|  | @ -954,10 +965,8 @@ void i810Preserve(KdCardInfo *card) { | ||||||
| /* Famous last words
 | /* Famous last words
 | ||||||
|  */ |  */ | ||||||
| void  | void  | ||||||
| i810PrintErrorState(KdCardInfo *card) | i810PrintErrorState(i810CardInfo *i810c) | ||||||
| { | { | ||||||
| 
 |  | ||||||
|     I810CardInfo    *i810c = card->driver; |  | ||||||
|      |      | ||||||
|    fprintf(stderr, "pgetbl_ctl: 0x%lx pgetbl_err: 0x%lx\n",  |    fprintf(stderr, "pgetbl_ctl: 0x%lx pgetbl_err: 0x%lx\n",  | ||||||
| 	   INREG(PGETBL_CTL), | 	   INREG(PGETBL_CTL), | ||||||
|  | @ -993,7 +1002,7 @@ i810PrintErrorState(KdCardInfo *card) | ||||||
| 	   INREG16(IIR)); | 	   INREG16(IIR)); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| Bool | static Bool | ||||||
| i810BindGARTMemory( KdScreenInfo *screen )  | i810BindGARTMemory( KdScreenInfo *screen )  | ||||||
| { | { | ||||||
|      |      | ||||||
|  | @ -1022,7 +1031,7 @@ i810BindGARTMemory( KdScreenInfo *screen ) | ||||||
|     return TRUE; |     return TRUE; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| Bool | static Bool | ||||||
| i810UnbindGARTMemory(KdScreenInfo  *screen)  | i810UnbindGARTMemory(KdScreenInfo  *screen)  | ||||||
| { | { | ||||||
|     KdCardInfo	    *card = screen->card; |     KdCardInfo	    *card = screen->card; | ||||||
|  | @ -1124,7 +1133,7 @@ i810CalcVCLK( KdScreenInfo *screen, double freq ) | ||||||
| 
 | 
 | ||||||
| #define Elements(x) (sizeof(x)/sizeof(*x)) | #define Elements(x) (sizeof(x)/sizeof(*x)) | ||||||
| 
 | 
 | ||||||
| unsigned int  | static unsigned int  | ||||||
| i810CalcWatermark( KdScreenInfo *screen, double freq, Bool dcache ) | 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... |  * HW, but still warns about not programming them... | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| void | static void | ||||||
| i810VGASeqReset(i810VGAPtr vgap, Bool start) | i810VGASeqReset(i810VGAPtr vgap, Bool start) | ||||||
| { | { | ||||||
|     if (start) |     if (start) | ||||||
|  | @ -1281,7 +1290,7 @@ i810VGASeqReset(i810VGAPtr vgap, Bool start) | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void | static void | ||||||
| i810VGAProtect(KdCardInfo *card, Bool on) | i810VGAProtect(KdCardInfo *card, Bool on) | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
|  | @ -1666,7 +1675,7 @@ i810VGAInit(KdScreenInfo *screen, const KdMonitorTiming *t) | ||||||
| 
 | 
 | ||||||
|     int hactive, hblank, hbp, hfp; |     int hactive, hblank, hbp, hfp; | ||||||
|     int vactive, vblank, vbp, vfp; |     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 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; |     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); |     DoRestore(card, &vgap->SavedReg, &i810c->SavedReg, TRUE); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| Bool | static Bool | ||||||
| i810Enable (ScreenPtr pScreen) | i810Enable (ScreenPtr pScreen) | ||||||
| { | { | ||||||
|     KdScreenPriv(pScreen); |     KdScreenPriv(pScreen); | ||||||
|  | @ -1964,7 +1973,7 @@ i810Enable (ScreenPtr pScreen) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| void | static void | ||||||
| i810Disable(ScreenPtr pScreen) { | i810Disable(ScreenPtr pScreen) { | ||||||
| 
 | 
 | ||||||
|     KdScreenPriv(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) |     if (I810_DEBUG) | ||||||
|         fprintf(stderr,"i810GetColors (NOT IMPLEMENTED)\n"); |         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);		     \ | 	    temp = Vminb((hw)->IOBase + VGA_IN_STAT_1_OFFSET);		     \ | ||||||
| 	} while (0) | 	} 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); |     KdScreenPriv(pScreen); | ||||||
|     KdScreenInfo    *screen = pScreenPriv->screen; |     KdScreenInfo    *screen = pScreenPriv->screen; | ||||||
|  | @ -2079,6 +2092,8 @@ KdCardFuncs	i810Funcs = { | ||||||
|     i810CardInit,               /* cardinit */ |     i810CardInit,               /* cardinit */ | ||||||
|     i810ScreenInit,             /* scrinit */ |     i810ScreenInit,             /* scrinit */ | ||||||
|     i810InitScreen,             /* initScreen */ |     i810InitScreen,             /* initScreen */ | ||||||
|  |     i810FinishInitScreen,       /* finishInitScreen */ | ||||||
|  |     NULL,			/* createResources */ | ||||||
|     i810Preserve,               /* preserve */ |     i810Preserve,               /* preserve */ | ||||||
|     i810Enable,                 /* enable */ |     i810Enable,                 /* enable */ | ||||||
|     i810DPMS,                   /* dpms */ |     i810DPMS,                   /* dpms */ | ||||||
|  | @ -2095,7 +2110,6 @@ KdCardFuncs	i810Funcs = { | ||||||
| 
 | 
 | ||||||
|     i810InitAccel,              /* initAccel */ |     i810InitAccel,              /* initAccel */ | ||||||
|     i810EnableAccel,            /* enableAccel */ |     i810EnableAccel,            /* enableAccel */ | ||||||
|     i810SyncAccel,              /* syncAccel */ |  | ||||||
|     i810DisableAccel,           /* disableAccel */ |     i810DisableAccel,           /* disableAccel */ | ||||||
|     i810FiniAccel,              /* finiAccel */ |     i810FiniAccel,              /* finiAccel */ | ||||||
|      |      | ||||||
|  |  | ||||||
|  | @ -122,17 +122,20 @@ typedef struct { | ||||||
|    ErrorF("BEGIN_LP_RING %d in %s:%d\n", n, __FILE__, __LINE__) |    ErrorF("BEGIN_LP_RING %d in %s:%d\n", n, __FILE__, __LINE__) | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | #define LP_RING_LOCALS \ | ||||||
|  |     unsigned int outring, ringmask;					\ | ||||||
|  |     volatile unsigned char *virt | ||||||
|  | 
 | ||||||
| #define BEGIN_LP_RING(n)						\ | #define BEGIN_LP_RING(n)						\ | ||||||
|    unsigned int outring, ringmask;					\ |     if (n>2 && (I810_DEBUG&DEBUG_ALWAYS_SYNC))				\ | ||||||
|    volatile unsigned char *virt;							\ | 	i810Sync(i810s);	\ | ||||||
|    if (n>2 && (I810_DEBUG&DEBUG_ALWAYS_SYNC)) i810Sync( screen );	\ |     if (i810c->LpRing.space < n*4) i810WaitLpRing(i810s, n*4, 0);	\ | ||||||
|    if (i810c->LpRing.space < n*4) i810WaitLpRing( screen, n*4, 0);	\ |     i810c->LpRing.space -= n*4;						\ | ||||||
|    i810c->LpRing.space -= n*4;						\ |     if (I810_DEBUG & DEBUG_VERBOSE_RING) 				\ | ||||||
|    if (I810_DEBUG & DEBUG_VERBOSE_RING) 				\ | 	LP_RING_MESSAGE(n);						\ | ||||||
|       LP_RING_MESSAGE(n);						\ |     outring = i810c->LpRing.tail;					\ | ||||||
|    outring = i810c->LpRing.tail;					\ |     ringmask = i810c->LpRing.tail_mask;					\ | ||||||
|    ringmask = i810c->LpRing.tail_mask;					\ |     virt = i810c->LpRing.virtual_start;			 | ||||||
|    virt = i810c->LpRing.virtual_start;			 |  | ||||||
| 
 | 
 | ||||||
| /* Memory mapped register access macros */ | /* Memory mapped register access macros */ | ||||||
| #define INREG8(addr)        *(volatile CARD8  *)(i810c->MMIOBase + (addr)) | #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_DC100_BRIDGE 0x7122 | ||||||
| #define PCI_CHIP_I810_E_BRIDGE     0x7124 | #define PCI_CHIP_I810_E_BRIDGE     0x7124 | ||||||
| #define PCI_CHIP_I815_BRIDGE       0x1130 | #define PCI_CHIP_I815_BRIDGE       0x1130 | ||||||
|  | #define PCI_CHIP_I845G             0x2562 | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @ -277,7 +281,7 @@ typedef struct _i810CardInfo { | ||||||
|     I810RegRec ModeReg; |     I810RegRec ModeReg; | ||||||
|     I810RingBuffer LpRing; |     I810RingBuffer LpRing; | ||||||
| 
 | 
 | ||||||
|    unsigned int BR[20];  |     unsigned int BR[20];  | ||||||
| 
 | 
 | ||||||
|     int CursorOffset; |     int CursorOffset; | ||||||
|     unsigned long CursorPhysical; |     unsigned long CursorPhysical; | ||||||
|  | @ -286,8 +290,6 @@ typedef struct _i810CardInfo { | ||||||
|     unsigned long OverlayStart; |     unsigned long OverlayStart; | ||||||
|     int colorKey; |     int colorKey; | ||||||
| 
 | 
 | ||||||
|     Bool NeedToSync; /* Need to sync accel stuff */ |  | ||||||
| 
 |  | ||||||
|     int nextColorExpandBuf; |     int nextColorExpandBuf; | ||||||
| 
 | 
 | ||||||
|     ScreenBlockHandlerProcPtr BlockHandler; |     ScreenBlockHandlerProcPtr BlockHandler; | ||||||
|  | @ -296,7 +298,9 @@ typedef struct _i810CardInfo { | ||||||
|     KdVideoAdaptorPtr adaptor; |     KdVideoAdaptorPtr adaptor; | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| } I810CardInfo; | } i810CardInfo; | ||||||
|  | 
 | ||||||
|  | typedef struct _i810CardInfo I810CardInfo;	/* compatibility */ | ||||||
| 
 | 
 | ||||||
| #define getI810CardInfo(kd)	((I810CardInfo *) ((kd)->card->driver)) | #define getI810CardInfo(kd)	((I810CardInfo *) ((kd)->card->driver)) | ||||||
| #define i810CardInfo(kd)	I810CardInfo *i810c = getI810CardInfo(kd) | #define i810CardInfo(kd)	I810CardInfo *i810c = getI810CardInfo(kd) | ||||||
|  | @ -312,8 +316,14 @@ typedef struct _i810Cursor { | ||||||
| } i810Cursor, *i810CursorPtr; | } i810Cursor, *i810CursorPtr; | ||||||
| 
 | 
 | ||||||
| typedef struct _i810ScreenInfo { | typedef struct _i810ScreenInfo { | ||||||
|  |     i810CardInfo *i810c; | ||||||
|     i810Cursor cursor; |     i810Cursor cursor; | ||||||
| } I810ScreenInfo; | 
 | ||||||
|  |     int pitch; | ||||||
|  |     KaaScreenInfoRec kaa; | ||||||
|  | } i810ScreenInfo; | ||||||
|  | 
 | ||||||
|  | typedef struct _i810ScreenInfo I810ScreenInfo;	/* compatibility */ | ||||||
| 
 | 
 | ||||||
| #define I810_CURSOR_HEIGHT 64 | #define I810_CURSOR_HEIGHT 64 | ||||||
| #define I810_CURSOR_WIDTH 64 | #define I810_CURSOR_WIDTH 64 | ||||||
|  | @ -348,9 +358,6 @@ i810InitAccel(ScreenPtr); | ||||||
| void         | void         | ||||||
| i810EnableAccel (ScreenPtr); | i810EnableAccel (ScreenPtr); | ||||||
| 
 | 
 | ||||||
| void	 |  | ||||||
| i810SyncAccel (ScreenPtr); |  | ||||||
| 
 |  | ||||||
| void         | void         | ||||||
| i810DisableAccel (ScreenPtr); | i810DisableAccel (ScreenPtr); | ||||||
| 
 | 
 | ||||||
|  | @ -423,7 +430,7 @@ void | ||||||
| i810VGASave(KdCardInfo *card, vgaRegPtr save, int flags); | i810VGASave(KdCardInfo *card, vgaRegPtr save, int flags); | ||||||
| 
 | 
 | ||||||
| void  | void  | ||||||
| i810PrintErrorState(KdCardInfo *card); | i810PrintErrorState(i810CardInfo *i810c); | ||||||
| 
 | 
 | ||||||
| void | void | ||||||
| i810VGAGetIOBase(i810VGAPtr vgap); | i810VGAGetIOBase(i810VGAPtr vgap); | ||||||
|  |  | ||||||
|  | @ -99,7 +99,7 @@ static int i810SetPortAttribute(KdScreenInfo *, Atom, int, pointer); | ||||||
| static int i810GetPortAttribute(KdScreenInfo *, Atom, int *, pointer); | static int i810GetPortAttribute(KdScreenInfo *, Atom, int *, pointer); | ||||||
| static void i810QueryBestSize(KdScreenInfo *, Bool, | static void i810QueryBestSize(KdScreenInfo *, Bool, | ||||||
| 	short, short, short, short, unsigned int *, unsigned int *, pointer); | 	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, | 	short, short, short, short, short, short, short, short, | ||||||
| 	int, unsigned char*, short, short, Bool, RegionPtr, pointer); | 	int, unsigned char*, short, short, Bool, RegionPtr, pointer); | ||||||
| static int i810QueryImageAttributes(KdScreenInfo *,  | static int i810QueryImageAttributes(KdScreenInfo *,  | ||||||
|  | @ -929,20 +929,27 @@ i810AllocateMemory( | ||||||
|    return new_linear; |    return new_linear; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static int  | static int | ||||||
| i810PutImage(  | i810PutImage(KdScreenInfo	    *screen,  | ||||||
|   KdScreenInfo *screen,  | 	       DrawablePtr	    pDraw, | ||||||
|   short src_x, short src_y,  | 	       short		    src_x, | ||||||
|   short drw_x, short drw_y, | 	       short		    src_y, | ||||||
|   short src_w, short src_h,  | 	       short		    drw_x, | ||||||
|   short drw_w, short drw_h, | 	       short		    drw_y, | ||||||
|   int id, unsigned char* buf,  | 	       short		    src_w, | ||||||
|   short width, short height,  | 	       short		    src_h, | ||||||
|   Bool sync, | 	       short		    drw_w, | ||||||
|   RegionPtr clipBoxes, pointer data | 	       short		    drw_h, | ||||||
| ){ | 	       int		     id, | ||||||
|   KdCardInfo *card = screen->card; | 	       unsigned char	    *buf, | ||||||
|   I810CardInfo	*i810c = (I810CardInfo *) card->driver; | 	       short		    width, | ||||||
|  | 	       short		    height, | ||||||
|  | 	       Bool		    sync, | ||||||
|  | 	       RegionPtr	    clipBoxes, | ||||||
|  | 	       pointer		    data) | ||||||
|  | { | ||||||
|  |     KdCardInfo *card = screen->card; | ||||||
|  |     I810CardInfo *i810c = (I810CardInfo *) card->driver; | ||||||
|     I810PortPrivPtr pPriv = (I810PortPrivPtr)data; |     I810PortPrivPtr pPriv = (I810PortPrivPtr)data; | ||||||
|     INT32 x1, x2, y1, y2; |     INT32 x1, x2, y1, y2; | ||||||
|     int srcPitch, dstPitch; |     int srcPitch, dstPitch; | ||||||
|  | @ -1029,14 +1036,7 @@ i810PutImage( | ||||||
|     /* update cliplist */ |     /* update cliplist */ | ||||||
|     if(!REGION_EQUAL(screen->pScreen, &pPriv->clip, clipBoxes)) { |     if(!REGION_EQUAL(screen->pScreen, &pPriv->clip, clipBoxes)) { | ||||||
| 	REGION_COPY(screen->pScreen, &pPriv->clip, clipBoxes); | 	REGION_COPY(screen->pScreen, &pPriv->clip, clipBoxes); | ||||||
|         i810FillBoxSolid(screen, REGION_NUM_RECTS(clipBoxes), | 	KXVPaintRegion (pDraw, &pPriv->clip, pPriv->colorKey); | ||||||
|                          REGION_RECTS(clipBoxes), |  | ||||||
|                          pPriv->colorKey, GXcopy, ~0); |  | ||||||
|         /*
 |  | ||||||
| 	XAAFillSolidRects(screen, pPriv->colorKey, GXcopy, ~0,  |  | ||||||
| 					REGION_NUM_RECTS(clipBoxes), |  | ||||||
| 					REGION_RECTS(clipBoxes)); |  | ||||||
|         */ |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -39,6 +39,7 @@ X Window System is a trademark of The Open Group */ | ||||||
| #include <config.h> | #include <config.h> | ||||||
| #endif | #endif | ||||||
| #include "kdrive.h" | #include "kdrive.h" | ||||||
|  | #include "kaa.h" | ||||||
| #ifdef XV | #ifdef XV | ||||||
| #include "kxv.h" | #include "kxv.h" | ||||||
| #endif | #endif | ||||||
|  | @ -60,318 +61,12 @@ X Window System is a trademark of The Open Group */ | ||||||
| 
 | 
 | ||||||
| #define NUM_STACK_RECTS	1024 | #define NUM_STACK_RECTS	1024 | ||||||
| 
 | 
 | ||||||
| void | i810ScreenInfo    *accel_i810s; | ||||||
| i810Sync( KdScreenInfo *screen ); |  | ||||||
| int |  | ||||||
| i810WaitLpRing( KdScreenInfo *screen, int n, int timeout_millis ); |  | ||||||
| 
 | 
 | ||||||
| void  | static int | ||||||
| i810EmitInvarientState(KdScreenInfo *screen) | i810WaitLpRing(i810ScreenInfo *i810s, int n, int timeout_millis) | ||||||
| { | { | ||||||
|     KdCardInfo	    *card = screen->card; |     i810CardInfo *i810c = i810s->i810c; | ||||||
|     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; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| int |  | ||||||
| i810WaitLpRing( KdScreenInfo *screen, int n, int timeout_millis ) |  | ||||||
| { |  | ||||||
|     KdCardInfo	    *card = screen->card; |  | ||||||
|     I810CardInfo    *i810c = (I810CardInfo *) card->driver; |  | ||||||
|     I810RingBuffer *ring = &(i810c->LpRing); |     I810RingBuffer *ring = &(i810c->LpRing); | ||||||
|     int iters = 0; |     int iters = 0; | ||||||
|     int start = 0; |     int start = 0; | ||||||
|  | @ -410,7 +105,7 @@ i810WaitLpRing( KdScreenInfo *screen, int n, int timeout_millis ) | ||||||
| 	 last_head = ring->head; | 	 last_head = ring->head; | ||||||
|       } else if ( now - start > timeout_millis ) {  |       } else if ( now - start > timeout_millis ) {  | ||||||
| 
 | 
 | ||||||
| 	 i810PrintErrorState( screen->card );  | 	 i810PrintErrorState(i810c);  | ||||||
| 	 fprintf(stderr, "space: %d wanted %d\n", ring->space, n ); | 	 fprintf(stderr, "space: %d wanted %d\n", ring->space, n ); | ||||||
| 	 FatalError("lockup\n");  | 	 FatalError("lockup\n");  | ||||||
|       } |       } | ||||||
|  | @ -431,99 +126,164 @@ i810WaitLpRing( KdScreenInfo *screen, int n, int timeout_millis ) | ||||||
|    return iters; |    return iters; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void | static void | ||||||
| i810Sync( KdScreenInfo *screen )  | i810Sync(i810ScreenInfo *i810s)  | ||||||
| { | { | ||||||
|     KdCardInfo	    *card = screen->card; |     i810CardInfo *i810c = i810s->i810c; | ||||||
|     I810CardInfo    *i810c = card->driver; |     LP_RING_LOCALS; | ||||||
| 
 | 
 | ||||||
|    if (I810_DEBUG) |     if (I810_DEBUG) | ||||||
|       fprintf(stderr, "i810Sync\n"); | 	fprintf(stderr, "i810Sync\n"); | ||||||
|     |     | ||||||
|    /* Send a flush instruction and then wait till the ring is empty.
 |    /* 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 |     * This is stronger than waiting for the blitter to finish as it also | ||||||
|     * flushes the internal graphics caches. |     * flushes the internal graphics caches. | ||||||
|     */ |     */ | ||||||
|    { |     BEGIN_LP_RING(2); | ||||||
|        BEGIN_LP_RING(2);    |     OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE ); | ||||||
|        OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE ); |     OUT_RING( 0 );		/* pad to quadword */ | ||||||
|        OUT_RING( 0 );		/* pad to quadword */ |     ADVANCE_LP_RING(); | ||||||
|        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->LpRing.space = i810c->LpRing.mem.Size - 8; | ||||||
|    i810c->nextColorExpandBuf = 0; |     i810c->nextColorExpandBuf = 0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static const GCOps	i810Ops = { | static void | ||||||
|     KdCheckFillSpans, | i810WaitMarker(ScreenPtr pScreen, int marker) | ||||||
|     KdCheckSetSpans, | { | ||||||
|     KdCheckPutImage, |     KdScreenPriv(pScreen); | ||||||
|     KdCheckCopyArea, |     i810ScreenInfo(pScreenPriv); | ||||||
|     KdCheckCopyPlane, | 
 | ||||||
|     KdCheckPolyPoint, |     i810Sync(i810s); | ||||||
|     KdCheckPolylines, | } | ||||||
|     KdCheckPolySegment, | 
 | ||||||
|     miPolyRectangle, | #if 0 | ||||||
|     KdCheckPolyArc, | static void | ||||||
|     miFillPolygon, | i810EmitInvarientState(ScreenPtr pScreen) | ||||||
|     i810PolyFillRect, | { | ||||||
|     miPolyFillArc, |     KdScreenPriv(pScreen); | ||||||
|     miPolyText8, |     i810CardInfo(pScreenPriv); | ||||||
|     miPolyText16, |     i810ScreenInfo(pScreenPriv); | ||||||
|     miImageText8, |     LP_RING_LOCALS; | ||||||
|     miImageText16, | 
 | ||||||
|     KdCheckImageGlyphBlt, |     BEGIN_LP_RING( 10 ); | ||||||
|     KdCheckPolyGlyphBlt, | 
 | ||||||
|     KdCheckPushPixels, |     OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE ); | ||||||
| #ifdef NEED_LINEHELPER |     OUT_RING( GFX_CMD_CONTEXT_SEL | CS_UPDATE_USE | CS_USE_CTX0 ); | ||||||
|     ,NULL |     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 | #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 | static Bool | ||||||
| i810ValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable) | i810PrepareSolid(PixmapPtr pPix, int alu, Pixel pm, Pixel fg) | ||||||
| { | { | ||||||
|     FbGCPrivPtr fbPriv = fbGetGCPrivate(pGC); |     KdScreenPriv(pPix->drawable.pScreen); | ||||||
|      |     i810ScreenInfo(pScreenPriv); | ||||||
|     fbValidateGC (pGC, changes, pDrawable); |     i810CardInfo(pScreenPriv); | ||||||
|      |  | ||||||
|     if (pDrawable->type == DRAWABLE_WINDOW) |  | ||||||
| 	pGC->ops = (GCOps *) &i810Ops; |  | ||||||
|     else |  | ||||||
| 	pGC->ops = (GCOps *) &kdAsyncPixmapGCOps; |  | ||||||
| } |  | ||||||
| 
 | 
 | ||||||
| GCFuncs	i810GCFuncs = { |     if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) | ||||||
|     i810ValidateGC, |       ErrorF( "i810PrepareSolid color: %x rop: %x mask: %x\n",  | ||||||
|     miChangeGC, | 	      fg, alu, pm); | ||||||
|     miCopyGC, |  | ||||||
|     miDestroyGC, |  | ||||||
|     miChangeClip, |  | ||||||
|     miDestroyClip, |  | ||||||
|     miCopyClip |  | ||||||
| }; |  | ||||||
| 
 | 
 | ||||||
| int |     /* Color blit, p166 */ | ||||||
| i810CreateGC (GCPtr pGC) |     i810c->BR[13] = BR13_SOLID_PATTERN |  | ||||||
| { | 		    (i810PatternRop[alu] << 16) | | ||||||
|     if (!fbCreateGC (pGC)) | 		    (pPix->drawable.pScreen->width * i810c->cpp); | ||||||
| 	return FALSE; |     i810c->BR[16] = fg; | ||||||
|  | 
 | ||||||
|  |     accel_i810s = i810s; | ||||||
| 
 | 
 | ||||||
|     if (pGC->depth != 1) |  | ||||||
| 	pGC->funcs = &i810GCFuncs; |  | ||||||
|      |  | ||||||
|     return TRUE; |     return TRUE; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static void | static void | ||||||
| i810SetRingRegs( KdScreenInfo *screen ) { | i810Solid(int x1, int y1, int x2, int y2) | ||||||
|    unsigned int itemp; | { | ||||||
|  |     I810ScreenInfo *i810s = accel_i810s; | ||||||
|  |     I810CardInfo *i810c = i810s->i810c; | ||||||
|  |     LP_RING_LOCALS; | ||||||
| 
 | 
 | ||||||
|    KdCardInfo	    *card = screen->card; |     if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) | ||||||
|    I810CardInfo    *i810c = (I810CardInfo *) card->driver; | 	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 */ | ||||||
|  | 
 | ||||||
|  |     ADVANCE_LP_RING(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | static void | ||||||
|  | i810DoneSolid(void) | ||||||
|  | { | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | static Bool | ||||||
|  | i810PrepareCopy(PixmapPtr pSrc, PixmapPtr pDst, int dx, int dy, int alu, Pixel pm) | ||||||
|  | { | ||||||
|  | 	return FALSE; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 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(i810CardInfo *i810c) | ||||||
|  | { | ||||||
|  |    unsigned int itemp; | ||||||
| 
 | 
 | ||||||
|    OUTREG(LP_RING + RING_TAIL, 0 ); |    OUTREG(LP_RING + RING_TAIL, 0 ); | ||||||
|    OUTREG(LP_RING + RING_HEAD, 0 ); |    OUTREG(LP_RING + RING_HEAD, 0 ); | ||||||
|  | @ -542,65 +302,52 @@ i810SetRingRegs( KdScreenInfo *screen ) { | ||||||
| Bool | Bool | ||||||
| i810InitAccel(ScreenPtr pScreen) | 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; | ||||||
| 
 | 
 | ||||||
|     /*
 |     i810s->pitch = pScreen->width * i810c->cpp; | ||||||
|      * Hook up asynchronous drawing |  | ||||||
|      */ |  | ||||||
|     KdScreenInitAsync (pScreen); |  | ||||||
|     /*
 |  | ||||||
|      * Replace various fb screen functions |  | ||||||
|      */ |  | ||||||
|     pScreen->CreateGC = i810CreateGC; |  | ||||||
| 
 | 
 | ||||||
|     return TRUE; |     return FALSE; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void | void | ||||||
| i810EnableAccel(ScreenPtr pScreen) | i810EnableAccel(ScreenPtr pScreen) | ||||||
| { | { | ||||||
| 
 |  | ||||||
|     KdScreenPriv(pScreen); |     KdScreenPriv(pScreen); | ||||||
|     KdScreenInfo    *screen = pScreenPriv->screen; |     i810CardInfo(pScreenPriv); | ||||||
|     KdCardInfo	    *card = screen->card; |  | ||||||
|     I810CardInfo    *i810c = (I810CardInfo *) card->driver; |  | ||||||
| 
 |  | ||||||
| /*     fprintf(stderr,"i810EnableAccel\n"); */ |  | ||||||
| 
 | 
 | ||||||
|     if (i810c->LpRing.mem.Size == 0) { |     if (i810c->LpRing.mem.Size == 0) { | ||||||
|         ErrorF("No memory for LpRing!! Acceleration not functional!!\n"); |         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 | void | ||||||
| i810DisableAccel(ScreenPtr pScreen) | i810DisableAccel(ScreenPtr pScreen) | ||||||
| { | { | ||||||
|     KdScreenPriv(pScreen); |     KdScreenPriv(pScreen); | ||||||
|     KdScreenInfo    *screen = pScreenPriv->screen; |     i810CardInfo(pScreenPriv); | ||||||
|  |     i810ScreenInfo(pScreenPriv); | ||||||
|      |      | ||||||
| /*     fprintf(stderr,"i810DisableAccel\n"); */ |     i810RefreshRing(i810c); | ||||||
|     i810RefreshRing( screen ); |     i810Sync(i810s); | ||||||
|     i810Sync( screen ); |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void | void | ||||||
| i810FiniAccel(ScreenPtr pScreen) | i810FiniAccel(ScreenPtr pScreen) | ||||||
| { | { | ||||||
| /*     fprintf(stderr,"i810FiniAccel\n"); */ |  | ||||||
| 
 |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -42,8 +42,13 @@ X Window System is a trademark of The Open Group */ | ||||||
| #include "kdrive.h" | #include "kdrive.h" | ||||||
| #include "kxv.h" | #include "kxv.h" | ||||||
| #include "i810.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])) | #define numI810Cards (sizeof(i810Cards) / sizeof(i810Cards[0])) | ||||||
| 
 | 
 | ||||||
|  | @ -53,8 +58,6 @@ InitCard (char *name) | ||||||
|     KdCardAttr	attr; |     KdCardAttr	attr; | ||||||
|     int		i; |     int		i; | ||||||
| 
 | 
 | ||||||
|     Bool LinuxFindPci(CARD16, CARD16, CARD32, KdCardAttr *);  |  | ||||||
| 
 |  | ||||||
|     for (i = 0; i < numI810Cards; i++) |     for (i = 0; i < numI810Cards; i++) | ||||||
| 	if (LinuxFindPci (0x8086, i810Cards[i], 0, &attr)) | 	if (LinuxFindPci (0x8086, i810Cards[i], 0, &attr)) | ||||||
| 	    KdCardInfoAdd (&i810Funcs, &attr, (void *) i810Cards[i]); | 	    KdCardInfoAdd (&i810Funcs, &attr, (void *) i810Cards[i]); | ||||||
|  | @ -83,7 +86,6 @@ int | ||||||
| ddxProcessArgument (int argc, char **argv, int i) | ddxProcessArgument (int argc, char **argv, int i) | ||||||
| { | { | ||||||
|     int	ret; |     int	ret; | ||||||
|     int KdProcessArgument(int, char **, int); |  | ||||||
|      |      | ||||||
|     ret = KdProcessArgument(argc, argv, i); |     ret = KdProcessArgument(argc, argv, i); | ||||||
|     return ret; |     return ret; | ||||||
|  |  | ||||||
|  | @ -25,6 +25,7 @@ | ||||||
| #include <config.h> | #include <config.h> | ||||||
| #endif | #endif | ||||||
| #include "mach64.h" | #include "mach64.h" | ||||||
|  | #include "kaa.h" | ||||||
| 
 | 
 | ||||||
| static Bool | static Bool | ||||||
| mach64CardInit (KdCardInfo *card) | mach64CardInit (KdCardInfo *card) | ||||||
|  | @ -103,7 +104,7 @@ mach64RandRSetConfig (ScreenPtr		pScreen, | ||||||
| 		      int		rate, | 		      int		rate, | ||||||
| 		      RRScreenSizePtr	pSize) | 		      RRScreenSizePtr	pSize) | ||||||
| { | { | ||||||
|     KdCheckSync (pScreen); |    kaaWaitSync (pScreen); | ||||||
| 
 | 
 | ||||||
|     if (!vesaRandRSetConfig (pScreen, rotation, rate, pSize)) |     if (!vesaRandRSetConfig (pScreen, rotation, rate, pSize)) | ||||||
| 	return FALSE; | 	return FALSE; | ||||||
|  | @ -353,7 +354,7 @@ mach64DPMS (ScreenPtr pScreen, int mode) | ||||||
| 	CRTC_GEN_CNTL &= ~(1 << 6); | 	CRTC_GEN_CNTL &= ~(1 << 6); | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     KdCheckSync (pScreen); |     kaaWaitSync (pScreen); | ||||||
| 
 | 
 | ||||||
|     mach64WriteLCD (reg, 1, LCD_GEN_CTRL); |     mach64WriteLCD (reg, 1, LCD_GEN_CTRL); | ||||||
|      |      | ||||||
|  | @ -425,7 +426,6 @@ KdCardFuncs	mach64Funcs = { | ||||||
|      |      | ||||||
|     mach64DrawInit,	    /* initAccel */ |     mach64DrawInit,	    /* initAccel */ | ||||||
|     mach64DrawEnable,	    /* enableAccel */ |     mach64DrawEnable,	    /* enableAccel */ | ||||||
|     mach64DrawSync,	    /* syncAccel */ |  | ||||||
|     mach64DrawDisable,	    /* disableAccel */ |     mach64DrawDisable,	    /* disableAccel */ | ||||||
|     mach64DrawFini,	    /* finiAccel */ |     mach64DrawFini,	    /* finiAccel */ | ||||||
|      |      | ||||||
|  |  | ||||||
|  | @ -570,6 +570,7 @@ typedef struct _mach64ScreenInfo { | ||||||
|     Mach64Cursor		cursor; |     Mach64Cursor		cursor; | ||||||
|     CARD32			colorKey; |     CARD32			colorKey; | ||||||
|     KdVideoAdaptorPtr		pAdaptor; |     KdVideoAdaptorPtr		pAdaptor; | ||||||
|  |     KaaScreenInfoRec		kaa; | ||||||
| } Mach64ScreenInfo; | } Mach64ScreenInfo; | ||||||
| 
 | 
 | ||||||
| #define getMach64ScreenInfo(kd) ((Mach64ScreenInfo *) ((kd)->screen->driver)) | #define getMach64ScreenInfo(kd) ((Mach64ScreenInfo *) ((kd)->screen->driver)) | ||||||
|  | @ -623,9 +624,6 @@ mach64DrawReinit (ScreenPtr pScreen); | ||||||
| void | void | ||||||
| mach64DrawEnable (ScreenPtr pScreen); | mach64DrawEnable (ScreenPtr pScreen); | ||||||
| 
 | 
 | ||||||
| void |  | ||||||
| mach64DrawSync (ScreenPtr pScreen); |  | ||||||
| 
 |  | ||||||
| void | void | ||||||
| mach64DrawDisable (ScreenPtr pScreen); | mach64DrawDisable (ScreenPtr pScreen); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -41,6 +41,7 @@ | ||||||
| #include	"migc.h" | #include	"migc.h" | ||||||
| #include	"miline.h" | #include	"miline.h" | ||||||
| #include	"picturestr.h" | #include	"picturestr.h" | ||||||
|  | #include	"kaa.h" | ||||||
| 
 | 
 | ||||||
| CARD8 mach64Rop[16] = { | CARD8 mach64Rop[16] = { | ||||||
|     /* GXclear      */      0x01,         /* 0 */ |     /* GXclear      */      0x01,         /* 0 */ | ||||||
|  | @ -336,6 +337,16 @@ static const Mach64AccelReg	mach64AccelReg[] = { | ||||||
| 
 | 
 | ||||||
| #define NACCELREG (sizeof mach64AccelReg / sizeof mach64AccelReg[0]) | #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 | static Bool | ||||||
| mach64Setup (PixmapPtr pDst, PixmapPtr pSrc, CARD32 combo, int wait) | mach64Setup (PixmapPtr pDst, PixmapPtr pSrc, CARD32 combo, int wait) | ||||||
| { | { | ||||||
|  | @ -537,29 +548,29 @@ mach64DoneCopy (void) | ||||||
| #endif | #endif | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| KaaScreenInfoRec    mach64Kaa = { |  | ||||||
|     mach64PrepareSolid, |  | ||||||
|     mach64Solid, |  | ||||||
|     mach64DoneSolid, |  | ||||||
| 
 |  | ||||||
|     mach64PrepareCopy, |  | ||||||
|     mach64Copy, |  | ||||||
|     mach64DoneCopy, |  | ||||||
| 
 |  | ||||||
|     64,			    /* Offscreen byte alignment */ |  | ||||||
|     64,			    /* Offscreen pitch */ |  | ||||||
|     KAA_OFFSCREEN_PIXMAPS,  /* Flags */ |  | ||||||
| }; |  | ||||||
| 
 | 
 | ||||||
| Bool | Bool | ||||||
| mach64DrawInit (ScreenPtr pScreen) | mach64DrawInit (ScreenPtr pScreen) | ||||||
| { | { | ||||||
|     KdScreenPriv(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) |     if (pScreenPriv->screen->fb[0].depth == 4) | ||||||
| 	return FALSE; | 	return FALSE; | ||||||
|      |      | ||||||
|     if (!kaaDrawInit (pScreen, &mach64Kaa)) |     if (!kaaDrawInit (pScreen, &mach64s->kaa)) | ||||||
| 	return FALSE; | 	return FALSE; | ||||||
| 
 | 
 | ||||||
|     return TRUE; |     return TRUE; | ||||||
|  | @ -568,7 +579,7 @@ mach64DrawInit (ScreenPtr pScreen) | ||||||
| void | void | ||||||
| mach64DrawEnable (ScreenPtr pScreen) | mach64DrawEnable (ScreenPtr pScreen) | ||||||
| { | { | ||||||
|     KdMarkSync (pScreen); |     kaaMarkSync (pScreen); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void | void | ||||||
|  | @ -581,13 +592,3 @@ mach64DrawFini (ScreenPtr pScreen) | ||||||
| { | { | ||||||
|     kaaDrawFini (pScreen); |     kaaDrawFini (pScreen); | ||||||
| } | } | ||||||
| 
 |  | ||||||
| void |  | ||||||
| mach64DrawSync (ScreenPtr pScreen) |  | ||||||
| { |  | ||||||
|     KdScreenPriv(pScreen); |  | ||||||
|     mach64CardInfo(pScreenPriv); |  | ||||||
|     reg = mach64c->reg; |  | ||||||
|      |  | ||||||
|     mach64WaitIdle (reg); |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  | @ -35,13 +35,15 @@ InitCard (char *name) | ||||||
| { | { | ||||||
|     KdCardAttr	attr; |     KdCardAttr	attr; | ||||||
| 
 | 
 | ||||||
|     if (LinuxFindPci (0x1002, 0x4c4d, 0, &attr)) |     if (LinuxFindPci (0x1002, 0x4750, 0, &attr)) | ||||||
| 	KdCardInfoAdd (&mach64Funcs, &attr, 0); | 	KdCardInfoAdd (&mach64Funcs, &attr, 0); | ||||||
|     else if (LinuxFindPci (0x1002, 0x4c49, 0, &attr)) |     else if (LinuxFindPci (0x1002, 0x4c42, 0, &attr)) | ||||||
| 	KdCardInfoAdd (&mach64Funcs, &attr, 0); | 	KdCardInfoAdd (&mach64Funcs, &attr, 0); | ||||||
|     else if (LinuxFindPci (0x1002, 0x4c46, 0, &attr)) |     else if (LinuxFindPci (0x1002, 0x4c46, 0, &attr)) | ||||||
| 	KdCardInfoAdd (&mach64Funcs, &attr, 0); | 	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); | 	KdCardInfoAdd (&mach64Funcs, &attr, 0); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -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 -  
 | /* Mach64ClipVideo -  
 | ||||||
| 
 | 
 | ||||||
|  | @ -777,7 +735,7 @@ mach64PutImage(KdScreenInfo	    *screen, | ||||||
|     if (!REGION_EQUAL (screen->pScreen, &pPortPriv->clip, clipBoxes)) |     if (!REGION_EQUAL (screen->pScreen, &pPortPriv->clip, clipBoxes)) | ||||||
|     { |     { | ||||||
| 	REGION_COPY (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; |     pPortPriv->videoOn = TRUE; | ||||||
|  | @ -898,7 +856,7 @@ mach64ReputImage (KdScreenInfo	    *screen, | ||||||
| 	if (!REGION_EQUAL (screen->pScreen, &pPortPriv->clip, clipBoxes)) | 	if (!REGION_EQUAL (screen->pScreen, &pPortPriv->clip, clipBoxes)) | ||||||
| 	{ | 	{ | ||||||
| 	    REGION_COPY (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; | 	return Success; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -234,7 +234,6 @@ KdCardFuncs mgaFuncs = { | ||||||
|      |      | ||||||
|     mgaDrawInit,	/* initAccel */ |     mgaDrawInit,	/* initAccel */ | ||||||
|     mgaDrawEnable,	/* enableAccel */ |     mgaDrawEnable,	/* enableAccel */ | ||||||
|     mgaDrawSync,	/* syncAccel */ |  | ||||||
|     mgaDrawDisable,	/* disableAccel */ |     mgaDrawDisable,	/* disableAccel */ | ||||||
|     mgaDrawFini,	/* finiAccel */ |     mgaDrawFini,	/* finiAccel */ | ||||||
|      |      | ||||||
|  |  | ||||||
|  | @ -100,9 +100,10 @@ typedef struct _mgaCardInfo { | ||||||
| typedef struct _mgaScreenInfo { | typedef struct _mgaScreenInfo { | ||||||
|     VesaScreenPrivRec vesa; |     VesaScreenPrivRec vesa; | ||||||
| 
 | 
 | ||||||
|  |     KaaScreenInfoRec kaa; | ||||||
|  | 
 | ||||||
|     int pitch; |     int pitch; | ||||||
|     int pw; |     int pw; | ||||||
|      |  | ||||||
| } MgaScreenInfo; | } MgaScreenInfo; | ||||||
| 
 | 
 | ||||||
| #define getMgaScreenInfo(kd) ((MgaScreenInfo *) ((kd)->screen->driver)) | #define getMgaScreenInfo(kd) ((MgaScreenInfo *) ((kd)->screen->driver)) | ||||||
|  | @ -133,9 +134,6 @@ mgaDrawInit (ScreenPtr pScreen); | ||||||
| void | void | ||||||
| mgaDrawEnable (ScreenPtr pScreen); | mgaDrawEnable (ScreenPtr pScreen); | ||||||
| 
 | 
 | ||||||
| void |  | ||||||
| mgaDrawSync (ScreenPtr pScreen); |  | ||||||
| 
 |  | ||||||
| void | void | ||||||
| mgaDrawDisable (ScreenPtr pScreen); | mgaDrawDisable (ScreenPtr pScreen); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -27,6 +27,7 @@ | ||||||
| #endif | #endif | ||||||
| #include "mga.h" | #include "mga.h" | ||||||
| #include "g400_common.h" | #include "g400_common.h" | ||||||
|  | #include "kaa.h" | ||||||
| #include <unistd.h> | #include <unistd.h> | ||||||
| 
 | 
 | ||||||
| CARD32 mgaRop[16] = { | CARD32 mgaRop[16] = { | ||||||
|  | @ -70,6 +71,17 @@ mgaWaitIdle (void) | ||||||
|     while (MGA_IN32 (mmio, MGA_REG_STATUS) & 0x10000); |     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 | Bool | ||||||
| mgaSetup (ScreenPtr pScreen, int dest_bpp, int wait) | mgaSetup (ScreenPtr pScreen, int dest_bpp, int wait) | ||||||
| { | { | ||||||
|  | @ -232,38 +244,40 @@ mgaUploadToScreen(PixmapPtr pDst, char *src, int src_pitch) { | ||||||
|   return TRUE; |   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 | Bool | ||||||
| mgaDrawInit (ScreenPtr pScreen) | mgaDrawInit (ScreenPtr pScreen) | ||||||
| { | { | ||||||
|     KdScreenPriv(pScreen); |     KdScreenPriv(pScreen); | ||||||
|  |     mgaScreenInfo (pScreenPriv); | ||||||
|     KdCardInfo *card = pScreenPriv->card; |     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) { |     if (card->attr.deviceID == MGA_G4XX_DEVICE_ID) { | ||||||
|         mgaKaa.PrepareBlend=mgaPrepareBlend; |         mgas->kaa.PrepareBlend	= mgaPrepareBlend; | ||||||
| 	mgaKaa.Blend=mgaBlend; | 	mgas->kaa.Blend		= mgaBlend; | ||||||
| 	mgaKaa.DoneBlend=mgaDoneBlend; | 	mgas->kaa.DoneBlend	= mgaDoneBlend; | ||||||
| 	mgaKaa.PrepareComposite=mgaPrepareComposite; | 	mgas->kaa.PrepareComposite = mgaPrepareComposite; | ||||||
| 	mgaKaa.Composite=mgaComposite; | 	mgas->kaa.Composite	= mgaComposite; | ||||||
| 	mgaKaa.DoneComposite=mgaDoneComposite; | 	mgas->kaa.DoneComposite	= mgaDoneComposite; | ||||||
|     } |     } | ||||||
|     /*mgaKaa.UploadToScreen=mgaUploadToScreen;*/ |     /*mgaKaa.UploadToScreen=mgaUploadToScreen;*/ | ||||||
|          |          | ||||||
|     if (!kaaDrawInit (pScreen, &mgaKaa)) |     if (!kaaDrawInit (pScreen, &mgas->kaa)) | ||||||
| 	return FALSE; | 	return FALSE; | ||||||
| 
 | 
 | ||||||
|     return TRUE; |     return TRUE; | ||||||
|  | @ -292,7 +306,7 @@ mgaDrawEnable (ScreenPtr pScreen) | ||||||
|       FatalError ("unsupported pixel format"); |       FatalError ("unsupported pixel format"); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     KdMarkSync (pScreen); |     kaaMarkSync (pScreen); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void | void | ||||||
|  | @ -305,13 +319,3 @@ mgaDrawFini (ScreenPtr pScreen) | ||||||
| { | { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void |  | ||||||
| mgaDrawSync (ScreenPtr pScreen) |  | ||||||
| { |  | ||||||
|     KdScreenPriv (pScreen); |  | ||||||
|     mgaCardInfo (pScreenPriv); |  | ||||||
| 
 |  | ||||||
|     mmio = mgac->reg_base; |  | ||||||
| 
 |  | ||||||
|     mgaWaitIdle (); |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  | @ -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> | 2005-02-08  Keith Packard  <keithp@keithp.com> | ||||||
| 
 | 
 | ||||||
| 	reviewed by: <delete if not using a buddy> | 	reviewed by: <delete if not using a buddy> | ||||||
|  |  | ||||||
|  | @ -71,6 +71,14 @@ static  void neoWaitIdle(NeoCardInfo *neoc) | ||||||
|     while ((mmio->bltStat & 1) && ++i<100000); |     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) | static  void neoWaitFifo(NeoCardInfo *neoc, int requested_fifo_space) | ||||||
| { | { | ||||||
|     neoWaitIdle( neoc ); |     neoWaitIdle( neoc ); | ||||||
|  | @ -156,20 +164,24 @@ static void neoDoneCopy (void) | ||||||
| { | { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| KaaScreenInfoRec neoKaa = { |  | ||||||
|     neoPrepareSolid, |  | ||||||
|     neoSolid, |  | ||||||
|     neoDoneSolid, |  | ||||||
| 
 |  | ||||||
|     neoPrepareCopy, |  | ||||||
|     neoCopy, |  | ||||||
|     neoDoneCopy |  | ||||||
| }; |  | ||||||
| 
 | 
 | ||||||
| Bool neoDrawInit (ScreenPtr pScreen) | Bool neoDrawInit (ScreenPtr pScreen) | ||||||
| { | { | ||||||
|  |     KdScreenPriv(pScreen); | ||||||
|  |     neoScreenInfo(pScreenPriv); | ||||||
|  | 
 | ||||||
|     ENTER(); |     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; |         return FALSE; | ||||||
|     } |     } | ||||||
|     LEAVE(); |     LEAVE(); | ||||||
|  | @ -201,9 +213,3 @@ void neoDrawFini (ScreenPtr pScreen) | ||||||
|     LEAVE(); |     LEAVE(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void neoDrawSync (ScreenPtr pScreen) |  | ||||||
| { |  | ||||||
|     SetupNeo(pScreen); |  | ||||||
| 
 |  | ||||||
|     neoWaitIdle(neoc); |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  | @ -328,7 +328,6 @@ KdCardFuncs    neoFuncs = { | ||||||
| 
 | 
 | ||||||
|     neoDrawInit,              // initAccel
 |     neoDrawInit,              // initAccel
 | ||||||
|     neoDrawEnable,            // enableAccel
 |     neoDrawEnable,            // enableAccel
 | ||||||
|     neoDrawSync,              // syncAccel
 |  | ||||||
|     neoDrawDisable,           // disableAccel
 |     neoDrawDisable,           // disableAccel
 | ||||||
|     neoDrawFini,              // finiAccel
 |     neoDrawFini,              // finiAccel
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -166,6 +166,7 @@ typedef struct _neoScreenInfo { | ||||||
|     int pitch; |     int pitch; | ||||||
|     int depth; |     int depth; | ||||||
|     KdVideoAdaptorPtr pAdaptor; |     KdVideoAdaptorPtr pAdaptor; | ||||||
|  |     KaaScreenInfoRec kaa; | ||||||
| } NeoScreenInfo; | } NeoScreenInfo; | ||||||
| 
 | 
 | ||||||
| #define getNeoScreenInfo(kd) ((NeoScreenInfo *) ((kd)->screen->driver)) | #define getNeoScreenInfo(kd) ((NeoScreenInfo *) ((kd)->screen->driver)) | ||||||
|  | @ -208,9 +209,6 @@ neoDrawDisable (ScreenPtr pScreen); | ||||||
| void | void | ||||||
| neoDrawFini (ScreenPtr pScreen); | neoDrawFini (ScreenPtr pScreen); | ||||||
| 
 | 
 | ||||||
| void |  | ||||||
| neoDrawSync (ScreenPtr pScreen); |  | ||||||
| 
 |  | ||||||
| extern KdCardFuncs  neoFuncs; | extern KdCardFuncs  neoFuncs; | ||||||
| 
 | 
 | ||||||
| #endif /* _NEOMAGIC_H_ */ | #endif /* _NEOMAGIC_H_ */ | ||||||
|  |  | ||||||
|  | @ -117,7 +117,7 @@ nvidiaRandRSetConfig (ScreenPtr		pScreen, | ||||||
| 		      int		rate, | 		      int		rate, | ||||||
| 		      RRScreenSizePtr	pSize) | 		      RRScreenSizePtr	pSize) | ||||||
| { | { | ||||||
|     KdCheckSync (pScreen); |     kaaWaitSync (pScreen); | ||||||
| 
 | 
 | ||||||
|     if (!vesaRandRSetConfig (pScreen, rotation, rate, pSize)) |     if (!vesaRandRSetConfig (pScreen, rotation, rate, pSize)) | ||||||
| 	return FALSE; | 	return FALSE; | ||||||
|  | @ -354,7 +354,6 @@ KdCardFuncs	nvidiaFuncs = { | ||||||
|      |      | ||||||
|     nvidiaDrawInit,	    /* initAccel */ |     nvidiaDrawInit,	    /* initAccel */ | ||||||
|     nvidiaDrawEnable,	    /* enableAccel */ |     nvidiaDrawEnable,	    /* enableAccel */ | ||||||
|     nvidiaDrawSync,	    /* syncAccel */ |  | ||||||
|     nvidiaDrawDisable,	    /* disableAccel */ |     nvidiaDrawDisable,	    /* disableAccel */ | ||||||
|     nvidiaDrawFini,	    /* finiAccel */ |     nvidiaDrawFini,	    /* finiAccel */ | ||||||
|      |      | ||||||
|  |  | ||||||
|  | @ -160,6 +160,7 @@ typedef struct _nvidiaScreenInfo { | ||||||
|     CARD8			*off_screen; |     CARD8			*off_screen; | ||||||
|     int				off_screen_size; |     int				off_screen_size; | ||||||
|     KdVideoAdaptorPtr		pAdaptor; |     KdVideoAdaptorPtr		pAdaptor; | ||||||
|  |     KaaScreenInfoRec		kaa; | ||||||
| } NvidiaScreenInfo; | } NvidiaScreenInfo; | ||||||
| 
 | 
 | ||||||
| #define getNvidiaScreenInfo(kd) ((NvidiaScreenInfo *) ((kd)->screen->driver)) | #define getNvidiaScreenInfo(kd) ((NvidiaScreenInfo *) ((kd)->screen->driver)) | ||||||
|  | @ -216,9 +217,6 @@ nvidiaDrawReinit (ScreenPtr pScreen); | ||||||
| void | void | ||||||
| nvidiaDrawEnable (ScreenPtr pScreen); | nvidiaDrawEnable (ScreenPtr pScreen); | ||||||
| 
 | 
 | ||||||
| void |  | ||||||
| nvidiaDrawSync (ScreenPtr pScreen); |  | ||||||
| 
 |  | ||||||
| void | void | ||||||
| nvidiaDrawDisable (ScreenPtr pScreen); | nvidiaDrawDisable (ScreenPtr pScreen); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -40,6 +40,7 @@ | ||||||
| #include	"migc.h" | #include	"migc.h" | ||||||
| #include	"miline.h" | #include	"miline.h" | ||||||
| #include	"picturestr.h" | #include	"picturestr.h" | ||||||
|  | #include	"kaa.h" | ||||||
| 
 | 
 | ||||||
| CARD8 nvidiaRop[16] = { | CARD8 nvidiaRop[16] = { | ||||||
|     /* GXclear      */      0x01,         /* 0 */ |     /* 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 | static Bool | ||||||
| nvidiaPrepareSolid (PixmapPtr   pPixmap, | nvidiaPrepareSolid (PixmapPtr   pPixmap, | ||||||
| 		    int		alu, | 		    int		alu, | ||||||
|  | @ -154,27 +164,27 @@ nvidiaDoneCopy (void) | ||||||
| { | { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| KaaScreenInfoRec    nvidiaKaa = { |  | ||||||
|     nvidiaPrepareSolid, |  | ||||||
|     nvidiaSolid, |  | ||||||
|     nvidiaDoneSolid, |  | ||||||
| 
 |  | ||||||
|     nvidiaPrepareCopy, |  | ||||||
|     nvidiaCopy, |  | ||||||
|     nvidiaDoneCopy, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| Bool | Bool | ||||||
| nvidiaDrawInit (ScreenPtr pScreen) | nvidiaDrawInit (ScreenPtr pScreen) | ||||||
| { | { | ||||||
|     KdScreenPriv(pScreen); |     KdScreenPriv(pScreen); | ||||||
|     nvidiaCardInfo(pScreenPriv); |     nvidiaCardInfo(pScreenPriv); | ||||||
|  |     nvidiaScreenInfo(pScreenPriv); | ||||||
|     Bool    ret = TRUE; |     Bool    ret = TRUE; | ||||||
|      |      | ||||||
|     ENTER (); |     ENTER (); | ||||||
|     if (pScreenPriv->screen->fb[0].depth == 4) |     if (pScreenPriv->screen->fb[0].depth == 4) | ||||||
| 	ret = FALSE; | 	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) |     if (ret && !nvidiac->rop) | ||||||
|     { |     { | ||||||
| 	ErrorF ("Failed to map fifo registers\n"); | 	ErrorF ("Failed to map fifo registers\n"); | ||||||
|  | @ -185,7 +195,7 @@ nvidiaDrawInit (ScreenPtr pScreen) | ||||||
| 	ErrorF ("Fifo appears broken\n"); | 	ErrorF ("Fifo appears broken\n"); | ||||||
| 	ret = FALSE; | 	ret = FALSE; | ||||||
|     } |     } | ||||||
|     if (ret && !kaaDrawInit (pScreen, &nvidiaKaa)) |     if (ret && !kaaDrawInit (pScreen, &nvidias->kaa)) | ||||||
|     { |     { | ||||||
| 	ErrorF ("kaaDrawInit failed\n"); | 	ErrorF ("kaaDrawInit failed\n"); | ||||||
| 	ret = FALSE; | 	ret = FALSE; | ||||||
|  | @ -215,7 +225,7 @@ nvidiaDrawEnable (ScreenPtr pScreen) | ||||||
|     ENTER (); |     ENTER (); | ||||||
|     nvidiac->fifo_size = nvidiac->rop->FifoFree.FifoFree; |     nvidiac->fifo_size = nvidiac->rop->FifoFree.FifoFree; | ||||||
|     nvidiac->fifo_free = 0; |     nvidiac->fifo_free = 0; | ||||||
|     KdMarkSync (pScreen); |     kaaMarkSync (pScreen); | ||||||
|     LEAVE (); |     LEAVE (); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -229,11 +239,3 @@ nvidiaDrawFini (ScreenPtr pScreen) | ||||||
| { | { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void |  | ||||||
| nvidiaDrawSync (ScreenPtr pScreen) |  | ||||||
| { |  | ||||||
|     KdScreenPriv(pScreen); |  | ||||||
|     nvidiaCardInfo(pScreenPriv); |  | ||||||
|      |  | ||||||
|     nvidiaWaitIdle (nvidiac); |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  | @ -2,6 +2,7 @@ | ||||||
| #include <config.h> | #include <config.h> | ||||||
| #endif | #endif | ||||||
| #include "kdrive.h" | #include "kdrive.h" | ||||||
|  | #include "kaa.h" | ||||||
| 
 | 
 | ||||||
| #include "pm2.h" | #include "pm2.h" | ||||||
| 
 | 
 | ||||||
|  | @ -198,7 +199,7 @@ pmRandRSetConfig (ScreenPtr		pScreen, | ||||||
| 		      int		rate, | 		      int		rate, | ||||||
| 		      RRScreenSizePtr	pSize) | 		      RRScreenSizePtr	pSize) | ||||||
| { | { | ||||||
|     KdCheckSync (pScreen); |     kaaWaitSync (pScreen); | ||||||
| 
 | 
 | ||||||
|     if (!vesaRandRSetConfig (pScreen, rotation, rate, pSize)) |     if (!vesaRandRSetConfig (pScreen, rotation, rate, pSize)) | ||||||
| 	return FALSE; | 	return FALSE; | ||||||
|  | @ -296,7 +297,6 @@ KdCardFuncs	PM2Funcs = { | ||||||
| 
 | 
 | ||||||
|     pmDrawInit,              /* initAccel */ |     pmDrawInit,              /* initAccel */ | ||||||
|     pmDrawEnable,            /* enableAccel */ |     pmDrawEnable,            /* enableAccel */ | ||||||
|     pmDrawSync,              /* syncAccel */ |  | ||||||
|     pmDrawDisable,           /* disableAccel */ |     pmDrawDisable,           /* disableAccel */ | ||||||
|     pmDrawFini,              /* finiAccel */ |     pmDrawFini,              /* finiAccel */ | ||||||
|      |      | ||||||
|  |  | ||||||
|  | @ -59,6 +59,7 @@ typedef struct _PM2ScreenInfo { | ||||||
|     CARD8 *off_screen; |     CARD8 *off_screen; | ||||||
|     int	 off_screen_size; |     int	 off_screen_size; | ||||||
|     KdVideoAdaptorPtr pAdaptor; |     KdVideoAdaptorPtr pAdaptor; | ||||||
|  |     KaaScreenInfoRec kaa; | ||||||
| } PM2ScreenInfo; | } PM2ScreenInfo; | ||||||
| 
 | 
 | ||||||
| #define getPM2ScreenInfo(kd) ((PM2ScreenInfo *) ((kd)->screen->driver)) | #define getPM2ScreenInfo(kd) ((PM2ScreenInfo *) ((kd)->screen->driver)) | ||||||
|  | @ -76,9 +77,6 @@ pmDrawInit(ScreenPtr); | ||||||
| void | void | ||||||
| pmDrawEnable (ScreenPtr); | pmDrawEnable (ScreenPtr); | ||||||
| 
 | 
 | ||||||
| void |  | ||||||
| pmDrawSync (ScreenPtr); |  | ||||||
| 
 |  | ||||||
| void | void | ||||||
| pmDrawDisable (ScreenPtr); | pmDrawDisable (ScreenPtr); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -2,6 +2,7 @@ | ||||||
| #include <config.h> | #include <config.h> | ||||||
| #endif | #endif | ||||||
| #include "kdrive.h" | #include "kdrive.h" | ||||||
|  | #include "kaa.h" | ||||||
| 
 | 
 | ||||||
| #include "pm2.h" | #include "pm2.h" | ||||||
| 
 | 
 | ||||||
|  | @ -10,6 +11,20 @@ static VOL8	*mmio; | ||||||
| 
 | 
 | ||||||
| static void Permedia2LoadCoord(int x, int y, int w, int h); | 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 | static Bool | ||||||
| pmPrepareSolid (PixmapPtr   	pPixmap, | pmPrepareSolid (PixmapPtr   	pPixmap, | ||||||
| 		int		rop, | 		int		rop, | ||||||
|  | @ -159,27 +174,28 @@ Permedia2LoadCoord(int x, int y, | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| KaaScreenInfoRec    pmKaa = { |  | ||||||
|     pmPrepareSolid, |  | ||||||
|     pmSolid, |  | ||||||
|     pmDoneSolid, |  | ||||||
| 
 |  | ||||||
|     pmPrepareCopy, |  | ||||||
|     pmCopy, |  | ||||||
|     pmDoneCopy, |  | ||||||
| }; |  | ||||||
| 
 | 
 | ||||||
| Bool | Bool | ||||||
| pmDrawInit (ScreenPtr pScreen) | pmDrawInit (ScreenPtr pScreen) | ||||||
| { | { | ||||||
|     KdScreenPriv(pScreen); |     KdScreenPriv(pScreen); | ||||||
|     pmCardInfo(pScreenPriv); |     pmCardInfo(pScreenPriv); | ||||||
|  |     pmScreenInfo(pScreenPriv); | ||||||
|     Bool    ret = TRUE; |     Bool    ret = TRUE; | ||||||
| 
 | 
 | ||||||
|     card = pm2c; |     card = pm2c; | ||||||
|     mmio = pm2c->reg_base; |     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"); | 	ErrorF ("kaaDrawInit failed\n"); | ||||||
| 	ret = FALSE; | 	ret = FALSE; | ||||||
|  | @ -288,7 +304,7 @@ pmDrawEnable (ScreenPtr pScreen) | ||||||
|     GLINT_SLOW_WRITE_REG(0, StartY); |     GLINT_SLOW_WRITE_REG(0, StartY); | ||||||
|     GLINT_SLOW_WRITE_REG(0, GLINTCount); |     GLINT_SLOW_WRITE_REG(0, GLINTCount); | ||||||
| 
 | 
 | ||||||
|     KdMarkSync (pScreen); |     kaaMarkSync (pScreen); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void | void | ||||||
|  | @ -300,17 +316,3 @@ void | ||||||
| pmDrawFini (ScreenPtr pScreen) | 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); |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  | @ -244,7 +244,6 @@ KdCardFuncs r128Funcs = { | ||||||
|      |      | ||||||
|     r128DrawInit,	/* initAccel */ |     r128DrawInit,	/* initAccel */ | ||||||
|     r128DrawEnable,	/* enableAccel */ |     r128DrawEnable,	/* enableAccel */ | ||||||
|     r128DrawSync,	/* syncAccel */ |  | ||||||
|     r128DrawDisable,	/* disableAccel */ |     r128DrawDisable,	/* disableAccel */ | ||||||
|     r128DrawFini,	/* finiAccel */ |     r128DrawFini,	/* finiAccel */ | ||||||
|      |      | ||||||
|  |  | ||||||
|  | @ -83,6 +83,8 @@ typedef struct _r128ScreenInfo { | ||||||
|     CARD8 *off_screen; |     CARD8 *off_screen; | ||||||
|     int off_screen_size; |     int off_screen_size; | ||||||
| 
 | 
 | ||||||
|  |     KaaScreenInfoRec kaa; | ||||||
|  | 
 | ||||||
|     int pitch; |     int pitch; | ||||||
|     int datatype; |     int datatype; | ||||||
| 
 | 
 | ||||||
|  | @ -113,9 +115,6 @@ r128DrawInit (ScreenPtr pScreen); | ||||||
| void | void | ||||||
| r128DrawEnable (ScreenPtr pScreen); | r128DrawEnable (ScreenPtr pScreen); | ||||||
| 
 | 
 | ||||||
| void |  | ||||||
| r128DrawSync (ScreenPtr pScreen); |  | ||||||
| 
 |  | ||||||
| void | void | ||||||
| r128DrawDisable (ScreenPtr pScreen); | r128DrawDisable (ScreenPtr pScreen); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -26,6 +26,7 @@ | ||||||
| #include <config.h> | #include <config.h> | ||||||
| #endif | #endif | ||||||
| #include "r128.h" | #include "r128.h" | ||||||
|  | #include "kaa.h" | ||||||
| 
 | 
 | ||||||
| CARD8 r128SolidRop[16] = { | CARD8 r128SolidRop[16] = { | ||||||
|     /* GXclear      */      0x00,         /* 0 */ |     /* 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 | static Bool | ||||||
| r128Setup (ScreenPtr pScreen, int wait) | r128Setup (ScreenPtr pScreen, int wait) | ||||||
| { | { | ||||||
|  | @ -219,20 +231,23 @@ r128DoneCopy (void) | ||||||
| { | { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| KaaScreenInfoRec r128Kaa = { |  | ||||||
|     r128PrepareSolid, |  | ||||||
|     r128Solid, |  | ||||||
|     r128DoneSolid, |  | ||||||
| 
 |  | ||||||
|     r128PrepareCopy, |  | ||||||
|     r128Copy, |  | ||||||
|     r128DoneCopy, |  | ||||||
| }; |  | ||||||
| 
 | 
 | ||||||
| Bool | Bool | ||||||
| r128DrawInit (ScreenPtr pScreen) | 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 FALSE; | ||||||
| 
 | 
 | ||||||
|     return TRUE; |     return TRUE; | ||||||
|  | @ -245,7 +260,7 @@ r128DrawEnable (ScreenPtr pScreen) | ||||||
|     r128ScreenInfo (pScreenPriv); |     r128ScreenInfo (pScreenPriv); | ||||||
| 
 | 
 | ||||||
|     r128s->pitch = pScreenPriv->screen->width >> 3; |     r128s->pitch = pScreenPriv->screen->width >> 3; | ||||||
|      | 
 | ||||||
|     switch (pScreenPriv->screen->fb[0].depth) { |     switch (pScreenPriv->screen->fb[0].depth) { | ||||||
|     case 8: |     case 8: | ||||||
| 	r128s->datatype = 2; | 	r128s->datatype = 2; | ||||||
|  | @ -270,7 +285,7 @@ r128DrawEnable (ScreenPtr pScreen) | ||||||
| 				 | R128_GMC_CLR_CMP_CNTL_DIS | 				 | R128_GMC_CLR_CMP_CNTL_DIS | ||||||
| 				 | R128_GMC_AUX_CLIP_DIS); | 				 | R128_GMC_AUX_CLIP_DIS); | ||||||
|      |      | ||||||
|     KdMarkSync (pScreen); |     kaaMarkSync (pScreen); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void | void | ||||||
|  | @ -282,14 +297,3 @@ void | ||||||
| r128DrawFini (ScreenPtr pScreen) | r128DrawFini (ScreenPtr pScreen) | ||||||
| { | { | ||||||
| } | } | ||||||
| 
 |  | ||||||
| void |  | ||||||
| r128DrawSync (ScreenPtr pScreen) |  | ||||||
| { |  | ||||||
|     KdScreenPriv (pScreen); |  | ||||||
|     r128CardInfo (pScreenPriv); |  | ||||||
| 
 |  | ||||||
|     mmio = r128c->reg_base; |  | ||||||
| 
 |  | ||||||
|     r128WaitIdle (); |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  | @ -108,7 +108,7 @@ smiRandRSetConfig (ScreenPtr		pScreen, | ||||||
|     Bool    ret; |     Bool    ret; | ||||||
|      |      | ||||||
|     ENTER (); |     ENTER (); | ||||||
|     KdCheckSync (pScreen); |     kaaWaitSync (pScreen); | ||||||
| 
 | 
 | ||||||
|     ret = subRandRSetConfig (pScreen, randr, rate, pSize); |     ret = subRandRSetConfig (pScreen, randr, rate, pSize); | ||||||
|     LEAVE(); |     LEAVE(); | ||||||
|  | @ -335,7 +335,6 @@ KdCardFuncs	smiFuncs = { | ||||||
|      |      | ||||||
|     smiDrawInit,	    /* initAccel */ |     smiDrawInit,	    /* initAccel */ | ||||||
|     smiDrawEnable,	    /* enableAccel */ |     smiDrawEnable,	    /* enableAccel */ | ||||||
|     smiDrawSync,	    /* syncAccel */ |  | ||||||
|     smiDrawDisable,	    /* disableAccel */ |     smiDrawDisable,	    /* disableAccel */ | ||||||
|     smiDrawFini,	    /* finiAccel */ |     smiDrawFini,	    /* finiAccel */ | ||||||
|      |      | ||||||
|  |  | ||||||
|  | @ -186,6 +186,7 @@ typedef struct _smiScreenInfo { | ||||||
|     CARD32		stride; |     CARD32		stride; | ||||||
|     CARD32		data_format; |     CARD32		data_format; | ||||||
|     CARD8		dpr_vpr_enable; |     CARD8		dpr_vpr_enable; | ||||||
|  |     KaaScreenInfoRec kaa; | ||||||
| } SmiScreenInfo; | } SmiScreenInfo; | ||||||
| 
 | 
 | ||||||
| #define getSmiScreenInfo(kd) ((SmiScreenInfo *) ((kd)->screen->driver)) | #define getSmiScreenInfo(kd) ((SmiScreenInfo *) ((kd)->screen->driver)) | ||||||
|  | @ -242,9 +243,6 @@ smiDrawReinit (ScreenPtr pScreen); | ||||||
| void | void | ||||||
| smiDrawEnable (ScreenPtr pScreen); | smiDrawEnable (ScreenPtr pScreen); | ||||||
| 
 | 
 | ||||||
| void |  | ||||||
| smiDrawSync (ScreenPtr pScreen); |  | ||||||
| 
 |  | ||||||
| void | void | ||||||
| smiDrawDisable (ScreenPtr pScreen); | smiDrawDisable (ScreenPtr pScreen); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -41,6 +41,7 @@ | ||||||
| #include	"migc.h" | #include	"migc.h" | ||||||
| #include	"miline.h" | #include	"miline.h" | ||||||
| #include	"picturestr.h" | #include	"picturestr.h" | ||||||
|  | #include	"kaa.h" | ||||||
| 
 | 
 | ||||||
| CARD8 smiBltRop[16] = { | CARD8 smiBltRop[16] = { | ||||||
|     /* GXclear      */      0x00,         /* 0 */ |     /* GXclear      */      0x00,         /* 0 */ | ||||||
|  | @ -143,6 +144,15 @@ smiSetup (ScreenPtr pScreen, int wait) | ||||||
|     return TRUE; |     return TRUE; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | static void | ||||||
|  | smiWaitMarker (ScreenPtr pScreen, int marker) | ||||||
|  | { | ||||||
|  |     KdScreenPriv(pScreen); | ||||||
|  |     smic = getSmiCardInfo(pScreenPriv); | ||||||
|  |      | ||||||
|  |     smiWaitIdle (smic); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| static Bool | static Bool | ||||||
| smiPrepareSolid (PixmapPtr    pPixmap, | smiPrepareSolid (PixmapPtr    pPixmap, | ||||||
| 		 int		alu, | 		 int		alu, | ||||||
|  | @ -229,15 +239,6 @@ smiDoneCopy (void) | ||||||
| { | { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| KaaScreenInfoRec    smiKaa = { |  | ||||||
|     smiPrepareSolid, |  | ||||||
|     smiSolid, |  | ||||||
|     smiDoneSolid, |  | ||||||
| 
 |  | ||||||
|     smiPrepareCopy, |  | ||||||
|     smiCopy, |  | ||||||
|     smiDoneCopy, |  | ||||||
| }; |  | ||||||
| 
 | 
 | ||||||
| Bool | Bool | ||||||
| smiDrawInit (ScreenPtr pScreen) | smiDrawInit (ScreenPtr pScreen) | ||||||
|  | @ -258,7 +259,16 @@ smiDrawInit (ScreenPtr pScreen) | ||||||
| 	return FALSE; | 	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 (); | 	LEAVE (); | ||||||
| 	return FALSE; | 	return FALSE; | ||||||
|  | @ -311,7 +321,7 @@ smiDrawEnable (ScreenPtr pScreen) | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     smiSetup (pScreen, 0); |     smiSetup (pScreen, 0); | ||||||
|     KdMarkSync (pScreen); |     kaaMarkSync (pScreen); | ||||||
|     LEAVE (); |     LEAVE (); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -332,12 +342,3 @@ smiDrawFini (ScreenPtr pScreen) | ||||||
|     ENTER (); |     ENTER (); | ||||||
|     LEAVE (); |     LEAVE (); | ||||||
| } | } | ||||||
| 
 |  | ||||||
| void |  | ||||||
| smiDrawSync (ScreenPtr pScreen) |  | ||||||
| { |  | ||||||
|     KdScreenPriv(pScreen); |  | ||||||
|     smic = getSmiCardInfo(pScreenPriv); |  | ||||||
|      |  | ||||||
|     smiWaitIdle (smic); |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  | @ -21,7 +21,6 @@ libkdrive_a_SOURCES =	\ | ||||||
| 	kmode.c		\
 | 	kmode.c		\
 | ||||||
| 	knoop.c		\
 | 	knoop.c		\
 | ||||||
| 	koffscreen.c	\
 | 	koffscreen.c	\
 | ||||||
| 	kpict.c		\
 |  | ||||||
| 	kshadow.c	\
 | 	kshadow.c	\
 | ||||||
| 	ktest.c		\
 | 	ktest.c		\
 | ||||||
| 	kxv.c		\
 | 	kxv.c		\
 | ||||||
|  |  | ||||||
|  | @ -104,7 +104,7 @@ kaaPixmapSave (ScreenPtr pScreen, KdOffscreenArea *area) | ||||||
| 	return; | 	return; | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|     KdCheckSync (pPixmap->drawable.pScreen); |     kaaWaitSync (pPixmap->drawable.pScreen); | ||||||
| 
 | 
 | ||||||
|     bytes = src_pitch < dst_pitch ? src_pitch : dst_pitch; |     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) |     if (pKaaScr->info->flags & KAA_OFFSCREEN_ALIGN_POT && w != 1) | ||||||
| 	w = 1 << (kaaLog2(w - 1) + 1); | 	w = 1 << (kaaLog2(w - 1) + 1); | ||||||
|     pitch = (w * bpp / 8 + pKaaScr->info->offscreenPitch - 1) & |     pitch = (w * bpp / 8 + pKaaScr->info->pitchAlign - 1) & | ||||||
|             ~(pKaaScr->info->offscreenPitch - 1); |             ~(pKaaScr->info->pitchAlign - 1); | ||||||
|      |      | ||||||
|     pKaaPixmap->devKind = pPixmap->devKind; |     pKaaPixmap->devKind = pPixmap->devKind; | ||||||
|     pKaaPixmap->devPrivate = pPixmap->devPrivate; |     pKaaPixmap->devPrivate = pPixmap->devPrivate; | ||||||
|     pKaaPixmap->area = KdOffscreenAlloc (pScreen, pitch * h, |     pKaaPixmap->area = KdOffscreenAlloc (pScreen, pitch * h, | ||||||
| 					 pKaaScr->info->offscreenByteAlign, | 					 pKaaScr->info->offsetAlign, | ||||||
| 					 FALSE,  | 					 FALSE,  | ||||||
| 					 kaaPixmapSave, (pointer) pPixmap); | 					 kaaPixmapSave, (pointer) pPixmap); | ||||||
|     if (!pKaaPixmap->area) |     if (!pKaaPixmap->area) | ||||||
|  | @ -202,7 +202,7 @@ kaaMoveInPixmap (PixmapPtr pPixmap) | ||||||
|      |      | ||||||
|     bytes = src_pitch < dst_pitch ? src_pitch : dst_pitch; |     bytes = src_pitch < dst_pitch ? src_pitch : dst_pitch; | ||||||
| 
 | 
 | ||||||
|     KdCheckSync (pPixmap->drawable.pScreen); |     kaaWaitSync (pPixmap->drawable.pScreen); | ||||||
| 
 | 
 | ||||||
|     i = pPixmap->drawable.height; |     i = pPixmap->drawable.height; | ||||||
|     while (i--) { |     while (i--) { | ||||||
|  | @ -513,7 +513,7 @@ kaaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n, | ||||||
|     } |     } | ||||||
|     (*pKaaScr->info->DoneSolid) (); |     (*pKaaScr->info->DoneSolid) (); | ||||||
|     kaaDrawableDirty (pDrawable); |     kaaDrawableDirty (pDrawable); | ||||||
|     KdMarkSync(pDrawable->pScreen); |     kaaMarkSync (pDrawable->pScreen); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void | void | ||||||
|  | @ -563,11 +563,11 @@ kaaCopyNtoN (DrawablePtr    pSrcDrawable, | ||||||
| 	    pbox++; | 	    pbox++; | ||||||
| 	} | 	} | ||||||
| 	(*pKaaScr->info->DoneCopy) (); | 	(*pKaaScr->info->DoneCopy) (); | ||||||
| 	KdMarkSync(pDstDrawable->pScreen); | 	kaaMarkSync (pDstDrawable->pScreen); | ||||||
|     } |     } | ||||||
|     else |     else | ||||||
|     { |     { | ||||||
| 	KdCheckSync (pDstDrawable->pScreen); | 	kaaWaitSync (pDstDrawable->pScreen); | ||||||
| 	fbCopyNtoN (pSrcDrawable, pDstDrawable, pGC,  | 	fbCopyNtoN (pSrcDrawable, pDstDrawable, pGC,  | ||||||
| 		    pbox, nbox, dx, dy, reverse, upsidedown,  | 		    pbox, nbox, dx, dy, reverse, upsidedown,  | ||||||
| 		    bitplane, closure); | 		    bitplane, closure); | ||||||
|  | @ -683,7 +683,7 @@ kaaPolyFillRect(DrawablePtr pDrawable, | ||||||
|     } |     } | ||||||
|     (*pKaaScr->info->DoneSolid) (); |     (*pKaaScr->info->DoneSolid) (); | ||||||
|     kaaDrawableDirty (pDrawable); |     kaaDrawableDirty (pDrawable); | ||||||
|     KdMarkSync(pDrawable->pScreen); |     kaaMarkSync (pDrawable->pScreen); | ||||||
| } | } | ||||||
|      |      | ||||||
| static void | static void | ||||||
|  | @ -708,7 +708,7 @@ kaaSolidBoxClipped (DrawablePtr	pDrawable, | ||||||
| 	!(pPixmap = kaaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) || | 	!(pPixmap = kaaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) || | ||||||
| 	!(*pKaaScr->info->PrepareSolid) (pPixmap, GXcopy, pm, fg)) | 	!(*pKaaScr->info->PrepareSolid) (pPixmap, GXcopy, pm, fg)) | ||||||
|     { |     { | ||||||
| 	KdCheckSync (pDrawable->pScreen); | 	kaaWaitSync (pDrawable->pScreen); | ||||||
| 	fg = fbReplicatePixel (fg, pDrawable->bitsPerPixel); | 	fg = fbReplicatePixel (fg, pDrawable->bitsPerPixel); | ||||||
| 	fbSolidBoxClipped (pDrawable, pClip, x1, y1, x2, y2, | 	fbSolidBoxClipped (pDrawable, pClip, x1, y1, x2, y2, | ||||||
| 			   fbAnd (GXcopy, fg, pm), | 			   fbAnd (GXcopy, fg, pm), | ||||||
|  | @ -747,7 +747,7 @@ kaaSolidBoxClipped (DrawablePtr	pDrawable, | ||||||
|     } |     } | ||||||
|     (*pKaaScr->info->DoneSolid) (); |     (*pKaaScr->info->DoneSolid) (); | ||||||
|     kaaDrawableDirty (pDrawable); |     kaaDrawableDirty (pDrawable); | ||||||
|     KdMarkSync(pDrawable->pScreen); |     kaaMarkSync (pDrawable->pScreen); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static void | static void | ||||||
|  | @ -833,7 +833,7 @@ kaaImageGlyphBlt (DrawablePtr	pDrawable, | ||||||
| 	opaque = FALSE; | 	opaque = FALSE; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     KdCheckSync (pDrawable->pScreen); |     kaaWaitSync (pDrawable->pScreen); | ||||||
|     kaaDrawableDirty (pDrawable); |     kaaDrawableDirty (pDrawable); | ||||||
|      |      | ||||||
|     ppci = ppciInit; |     ppci = ppciInit; | ||||||
|  | @ -992,11 +992,11 @@ kaaFillRegionSolid (DrawablePtr	pDrawable, | ||||||
| 	    pBox++; | 	    pBox++; | ||||||
| 	} | 	} | ||||||
| 	(*pKaaScr->info->DoneSolid) (); | 	(*pKaaScr->info->DoneSolid) (); | ||||||
| 	KdMarkSync(pDrawable->pScreen); | 	kaaMarkSync (pDrawable->pScreen); | ||||||
|     } |     } | ||||||
|     else |     else | ||||||
|     { |     { | ||||||
| 	KdCheckSync (pDrawable->pScreen); | 	kaaWaitSync (pDrawable->pScreen); | ||||||
| 	fbFillRegionSolid (pDrawable, pRegion, 0, | 	fbFillRegionSolid (pDrawable, pRegion, 0, | ||||||
| 			   fbReplicatePixel (pixel, pDrawable->bitsPerPixel)); | 			   fbReplicatePixel (pixel, pDrawable->bitsPerPixel)); | ||||||
|     } |     } | ||||||
|  | @ -1011,7 +1011,7 @@ kaaFillRegionTiled (DrawablePtr pDrawable, | ||||||
| { | { | ||||||
|     else |     else | ||||||
|     { |     { | ||||||
| 	KdCheckSync | 	kaaWaitSync | ||||||
| } | } | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | @ -1134,3 +1134,28 @@ kaaDrawFini (ScreenPtr pScreen) | ||||||
| 
 | 
 | ||||||
|     xfree (pKaaScr); |     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; | ||||||
|  |     } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -27,6 +27,8 @@ | ||||||
| #ifndef _KAA_H_ | #ifndef _KAA_H_ | ||||||
| #define _KAA_H_ | #define _KAA_H_ | ||||||
| 
 | 
 | ||||||
|  | #include "picturestr.h" | ||||||
|  | 
 | ||||||
| #define KaaGetScreenPriv(s)	((KaaScreenPrivPtr)(s)->devPrivates[kaaScreenPrivateIndex].ptr) | #define KaaGetScreenPriv(s)	((KaaScreenPrivPtr)(s)->devPrivates[kaaScreenPrivateIndex].ptr) | ||||||
| #define KaaScreenPriv(s)	KaaScreenPrivPtr    pKaaScr = KaaGetScreenPriv(s) | #define KaaScreenPriv(s)	KaaScreenPrivPtr    pKaaScr = KaaGetScreenPriv(s) | ||||||
| 
 | 
 | ||||||
|  | @ -71,6 +73,12 @@ kaaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp); | ||||||
| void | void | ||||||
| kaaMoveInPixmap (PixmapPtr pPixmap); | kaaMoveInPixmap (PixmapPtr pPixmap); | ||||||
| 
 | 
 | ||||||
|  | void | ||||||
|  | kaaMarkSync (ScreenPtr pScreen); | ||||||
|  | 
 | ||||||
|  | void | ||||||
|  | kaaWaitSync (ScreenPtr pScreen); | ||||||
|  | 
 | ||||||
| void | void | ||||||
| kaaCopyNtoN (DrawablePtr    pSrcDrawable, | kaaCopyNtoN (DrawablePtr    pSrcDrawable, | ||||||
| 	     DrawablePtr    pDstDrawable, | 	     DrawablePtr    pDstDrawable, | ||||||
|  |  | ||||||
|  | @ -279,7 +279,7 @@ kaaTryDriverSolidFill(PicturePtr	pSrc, | ||||||
|      * before accessing it.  We'd prefer for it to be in memory. |      * before accessing it.  We'd prefer for it to be in memory. | ||||||
|      */ |      */ | ||||||
|     if (kaaPixmapIsOffscreen(pSrcPix)) { |     if (kaaPixmapIsOffscreen(pSrcPix)) { | ||||||
| 	KdCheckSync(pDst->pDrawable->pScreen); | 	kaaWaitSync(pDst->pDrawable->pScreen); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     pixel = *(CARD32 *)(pSrcPix->devPrivate.ptr); |     pixel = *(CARD32 *)(pSrcPix->devPrivate.ptr); | ||||||
|  | @ -310,7 +310,7 @@ kaaTryDriverSolidFill(PicturePtr	pSrc, | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     (*pKaaScr->info->DoneSolid) (); |     (*pKaaScr->info->DoneSolid) (); | ||||||
|     KdMarkSync(pDst->pDrawable->pScreen); |     kaaMarkSync (pDst->pDrawable->pScreen); | ||||||
|     kaaDrawableDirty (pDst->pDrawable); |     kaaDrawableDirty (pDst->pDrawable); | ||||||
| 
 | 
 | ||||||
|     REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); |     REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); | ||||||
|  | @ -397,7 +397,7 @@ kaaTryDriverBlend(CARD8		op, | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     (*pKaaScr->info->DoneBlend) (); |     (*pKaaScr->info->DoneBlend) (); | ||||||
|     KdMarkSync(pDst->pDrawable->pScreen); |     kaaMarkSync (pDst->pDrawable->pScreen); | ||||||
|     kaaDrawableDirty (pDst->pDrawable); |     kaaDrawableDirty (pDst->pDrawable); | ||||||
| 
 | 
 | ||||||
|     REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); |     REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); | ||||||
|  | @ -520,7 +520,7 @@ kaaTryDriverComposite(CARD8		op, | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     (*pKaaScr->info->DoneComposite) (); |     (*pKaaScr->info->DoneComposite) (); | ||||||
|     KdMarkSync(pDst->pDrawable->pScreen); |     kaaMarkSync (pDst->pDrawable->pScreen); | ||||||
|     kaaDrawableDirty (pDst->pDrawable); |     kaaDrawableDirty (pDst->pDrawable); | ||||||
| 
 | 
 | ||||||
|     REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); |     REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); | ||||||
|  |  | ||||||
|  | @ -28,6 +28,9 @@ | ||||||
| #endif | #endif | ||||||
| #include "kdrive.h" | #include "kdrive.h" | ||||||
| #include "kaa.h" | #include "kaa.h" | ||||||
|  | #include "picturestr.h" | ||||||
|  | #include "mipict.h" | ||||||
|  | #include "fbpict.h" | ||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|  * These functions wrap the low-level fb rendering functions and |  * These functions wrap the low-level fb rendering functions and | ||||||
|  | @ -39,7 +42,7 @@ void | ||||||
| KdCheckFillSpans  (DrawablePtr pDrawable, GCPtr pGC, int nspans, | KdCheckFillSpans  (DrawablePtr pDrawable, GCPtr pGC, int nspans, | ||||||
| 		   DDXPointPtr ppt, int *pwidth, int fSorted) | 		   DDXPointPtr ppt, int *pwidth, int fSorted) | ||||||
| { | { | ||||||
|     KdCheckSync (pDrawable->pScreen); |     kaaWaitSync (pDrawable->pScreen); | ||||||
|     kaaDrawableDirty (pDrawable); |     kaaDrawableDirty (pDrawable); | ||||||
|     fbFillSpans (pDrawable, pGC, nspans, ppt, pwidth, fSorted); |     fbFillSpans (pDrawable, pGC, nspans, ppt, pwidth, fSorted); | ||||||
| } | } | ||||||
|  | @ -48,7 +51,7 @@ void | ||||||
| KdCheckSetSpans (DrawablePtr pDrawable, GCPtr pGC, char *psrc, | KdCheckSetSpans (DrawablePtr pDrawable, GCPtr pGC, char *psrc, | ||||||
| 		 DDXPointPtr ppt, int *pwidth, int nspans, int fSorted) | 		 DDXPointPtr ppt, int *pwidth, int nspans, int fSorted) | ||||||
| { | { | ||||||
|     KdCheckSync (pDrawable->pScreen); |     kaaWaitSync (pDrawable->pScreen); | ||||||
|     kaaDrawableDirty (pDrawable); |     kaaDrawableDirty (pDrawable); | ||||||
|     fbSetSpans (pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted); |     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, | 		 int x, int y, int w, int h, int leftPad, int format, | ||||||
| 		 char *bits) | 		 char *bits) | ||||||
| { | { | ||||||
|     KdCheckSync (pDrawable->pScreen); |     kaaWaitSync (pDrawable->pScreen); | ||||||
|     kaaDrawableDirty (pDrawable); |     kaaDrawableDirty (pDrawable); | ||||||
|     fbPutImage (pDrawable, pGC, depth, x, y, w, h, leftPad, format, bits); |     fbPutImage (pDrawable, pGC, depth, x, y, w, h, leftPad, format, bits); | ||||||
| } | } | ||||||
|  | @ -67,7 +70,7 @@ RegionPtr | ||||||
| KdCheckCopyArea (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, | KdCheckCopyArea (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, | ||||||
| 		 int srcx, int srcy, int w, int h, int dstx, int dsty) | 		 int srcx, int srcy, int w, int h, int dstx, int dsty) | ||||||
| { | { | ||||||
|     KdCheckSync (pSrc->pScreen); |     kaaWaitSync (pSrc->pScreen); | ||||||
|     kaaDrawableDirty (pDst); |     kaaDrawableDirty (pDst); | ||||||
|     return fbCopyArea (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty); |     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, | 		  int srcx, int srcy, int w, int h, int dstx, int dsty, | ||||||
| 		  unsigned long bitPlane) | 		  unsigned long bitPlane) | ||||||
| { | { | ||||||
|     KdCheckSync (pSrc->pScreen); |     kaaWaitSync (pSrc->pScreen); | ||||||
|     kaaDrawableDirty (pDst); |     kaaDrawableDirty (pDst); | ||||||
|     return fbCopyPlane (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty, |     return fbCopyPlane (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty, | ||||||
| 			bitPlane); | 			bitPlane); | ||||||
|  | @ -87,7 +90,7 @@ void | ||||||
| KdCheckPolyPoint (DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, | KdCheckPolyPoint (DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, | ||||||
| 		  DDXPointPtr pptInit) | 		  DDXPointPtr pptInit) | ||||||
| { | { | ||||||
|     KdCheckSync (pDrawable->pScreen); |     kaaWaitSync (pDrawable->pScreen); | ||||||
|     kaaDrawableDirty (pDrawable); |     kaaDrawableDirty (pDrawable); | ||||||
|     fbPolyPoint (pDrawable, pGC, mode, npt, pptInit); |     fbPolyPoint (pDrawable, pGC, mode, npt, pptInit); | ||||||
| } | } | ||||||
|  | @ -98,7 +101,7 @@ KdCheckPolylines (DrawablePtr pDrawable, GCPtr pGC, | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
|     if (pGC->lineWidth == 0) { |     if (pGC->lineWidth == 0) { | ||||||
| 	KdCheckSync(pDrawable->pScreen); | 	kaaWaitSync(pDrawable->pScreen); | ||||||
| 	kaaDrawableDirty (pDrawable); | 	kaaDrawableDirty (pDrawable); | ||||||
|     } |     } | ||||||
|     kaaDrawableDirty (pDrawable); |     kaaDrawableDirty (pDrawable); | ||||||
|  | @ -110,7 +113,7 @@ KdCheckPolySegment (DrawablePtr pDrawable, GCPtr pGC, | ||||||
| 		    int nsegInit, xSegment *pSegInit) | 		    int nsegInit, xSegment *pSegInit) | ||||||
| { | { | ||||||
|     if (pGC->lineWidth == 0) { |     if (pGC->lineWidth == 0) { | ||||||
| 	KdCheckSync(pDrawable->pScreen); | 	kaaWaitSync(pDrawable->pScreen); | ||||||
| 	kaaDrawableDirty (pDrawable); | 	kaaDrawableDirty (pDrawable); | ||||||
|     } |     } | ||||||
|     kaaDrawableDirty (pDrawable); |     kaaDrawableDirty (pDrawable); | ||||||
|  | @ -122,7 +125,7 @@ KdCheckPolyRectangle (DrawablePtr pDrawable, GCPtr pGC, | ||||||
| 		      int nrects, xRectangle *prect) | 		      int nrects, xRectangle *prect) | ||||||
| { | { | ||||||
|     if (pGC->lineWidth == 0) { |     if (pGC->lineWidth == 0) { | ||||||
| 	KdCheckSync(pDrawable->pScreen); | 	kaaWaitSync(pDrawable->pScreen); | ||||||
| 	kaaDrawableDirty (pDrawable); | 	kaaDrawableDirty (pDrawable); | ||||||
|     } |     } | ||||||
|     fbPolyRectangle (pDrawable, pGC, nrects, prect); |     fbPolyRectangle (pDrawable, pGC, nrects, prect); | ||||||
|  | @ -134,7 +137,7 @@ KdCheckPolyArc (DrawablePtr pDrawable, GCPtr pGC, | ||||||
| { | { | ||||||
|     if (pGC->lineWidth == 0) |     if (pGC->lineWidth == 0) | ||||||
|     { |     { | ||||||
| 	KdCheckSync(pDrawable->pScreen); | 	kaaWaitSync(pDrawable->pScreen); | ||||||
| 	kaaDrawableDirty (pDrawable); | 	kaaDrawableDirty (pDrawable); | ||||||
| 	fbPolyArc (pDrawable, pGC, narcs, pArcs); | 	fbPolyArc (pDrawable, pGC, narcs, pArcs); | ||||||
|     } |     } | ||||||
|  | @ -147,7 +150,7 @@ void | ||||||
| KdCheckFillPolygon (DrawablePtr pDrawable, GCPtr pGC,  | KdCheckFillPolygon (DrawablePtr pDrawable, GCPtr pGC,  | ||||||
| 		    int shape, int mode, int count, DDXPointPtr pPts) | 		    int shape, int mode, int count, DDXPointPtr pPts) | ||||||
| { | { | ||||||
|     KdCheckSync(pDrawable->pScreen); |     kaaWaitSync(pDrawable->pScreen); | ||||||
|     kaaDrawableDirty (pDrawable); |     kaaDrawableDirty (pDrawable); | ||||||
|     fbFillPolygon (pDrawable, pGC, mode, count, pPts); |     fbFillPolygon (pDrawable, pGC, mode, count, pPts); | ||||||
| } | } | ||||||
|  | @ -157,7 +160,7 @@ void | ||||||
| KdCheckPolyFillRect (DrawablePtr pDrawable, GCPtr pGC, | KdCheckPolyFillRect (DrawablePtr pDrawable, GCPtr pGC, | ||||||
| 		     int nrect, xRectangle *prect) | 		     int nrect, xRectangle *prect) | ||||||
| { | { | ||||||
|     KdCheckSync(pDrawable->pScreen); |     kaaWaitSync(pDrawable->pScreen); | ||||||
|     kaaDrawableDirty (pDrawable); |     kaaDrawableDirty (pDrawable); | ||||||
|     fbPolyFillRect (pDrawable, pGC, nrect, prect); |     fbPolyFillRect (pDrawable, pGC, nrect, prect); | ||||||
| } | } | ||||||
|  | @ -166,7 +169,7 @@ void | ||||||
| KdCheckPolyFillArc (DrawablePtr pDrawable, GCPtr pGC,  | KdCheckPolyFillArc (DrawablePtr pDrawable, GCPtr pGC,  | ||||||
| 		    int narcs, xArc *pArcs) | 		    int narcs, xArc *pArcs) | ||||||
| { | { | ||||||
|     KdCheckSync(pDrawable->pScreen); |     kaaWaitSync(pDrawable->pScreen); | ||||||
|     kaaDrawableDirty (pDrawable); |     kaaDrawableDirty (pDrawable); | ||||||
|     fbPolyFillArc (pDrawable, pGC, narcs, pArcs); |     fbPolyFillArc (pDrawable, pGC, narcs, pArcs); | ||||||
| } | } | ||||||
|  | @ -176,7 +179,7 @@ KdCheckImageGlyphBlt (DrawablePtr pDrawable, GCPtr pGC, | ||||||
| 		      int x, int y, unsigned int nglyph, | 		      int x, int y, unsigned int nglyph, | ||||||
| 		      CharInfoPtr *ppci, pointer pglyphBase) | 		      CharInfoPtr *ppci, pointer pglyphBase) | ||||||
| { | { | ||||||
|     KdCheckSync(pDrawable->pScreen); |     kaaWaitSync(pDrawable->pScreen); | ||||||
|     kaaDrawableDirty (pDrawable); |     kaaDrawableDirty (pDrawable); | ||||||
|     fbImageGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); |     fbImageGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); | ||||||
| } | } | ||||||
|  | @ -186,7 +189,7 @@ KdCheckPolyGlyphBlt (DrawablePtr pDrawable, GCPtr pGC, | ||||||
| 		     int x, int y, unsigned int nglyph, | 		     int x, int y, unsigned int nglyph, | ||||||
| 		     CharInfoPtr *ppci, pointer pglyphBase) | 		     CharInfoPtr *ppci, pointer pglyphBase) | ||||||
| { | { | ||||||
|     KdCheckSync(pDrawable->pScreen); |     kaaWaitSync(pDrawable->pScreen); | ||||||
|     kaaDrawableDirty (pDrawable); |     kaaDrawableDirty (pDrawable); | ||||||
|     fbPolyGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); |     fbPolyGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); | ||||||
| } | } | ||||||
|  | @ -196,7 +199,7 @@ KdCheckPushPixels (GCPtr pGC, PixmapPtr pBitmap, | ||||||
| 		   DrawablePtr pDrawable, | 		   DrawablePtr pDrawable, | ||||||
| 		   int w, int h, int x, int y) | 		   int w, int h, int x, int y) | ||||||
| { | { | ||||||
|     KdCheckSync(pDrawable->pScreen); |     kaaWaitSync(pDrawable->pScreen); | ||||||
|     kaaDrawableDirty (pDrawable); |     kaaDrawableDirty (pDrawable); | ||||||
|     fbPushPixels (pGC, pBitmap, pDrawable, w, h, x, y); |     fbPushPixels (pGC, pBitmap, pDrawable, w, h, x, y); | ||||||
| } | } | ||||||
|  | @ -207,7 +210,7 @@ KdCheckGetImage (DrawablePtr pDrawable, | ||||||
| 		 unsigned int format, unsigned long planeMask, | 		 unsigned int format, unsigned long planeMask, | ||||||
| 		 char *d) | 		 char *d) | ||||||
| { | { | ||||||
|     KdCheckSync(pDrawable->pScreen); |     kaaWaitSync(pDrawable->pScreen); | ||||||
|     fbGetImage (pDrawable, x, y, w, h, format, planeMask, d); |     fbGetImage (pDrawable, x, y, w, h, format, planeMask, d); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -219,7 +222,7 @@ KdCheckGetSpans (DrawablePtr pDrawable, | ||||||
| 		 int nspans, | 		 int nspans, | ||||||
| 		 char *pdstStart) | 		 char *pdstStart) | ||||||
| { | { | ||||||
|     KdCheckSync(pDrawable->pScreen); |     kaaWaitSync(pDrawable->pScreen); | ||||||
|     fbGetSpans (pDrawable, wMax, ppt, pwidth, nspans, pdstStart); |     fbGetSpans (pDrawable, wMax, ppt, pwidth, nspans, pdstStart); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -230,7 +233,7 @@ KdCheckSaveAreas (PixmapPtr	pPixmap, | ||||||
| 		  int		yorg, | 		  int		yorg, | ||||||
| 		  WindowPtr	pWin) | 		  WindowPtr	pWin) | ||||||
| { | { | ||||||
|     KdCheckSync(pWin->drawable.pScreen); |     kaaWaitSync(pWin->drawable.pScreen); | ||||||
|     kaaDrawableDirty (&pPixmap->drawable); |     kaaDrawableDirty (&pPixmap->drawable); | ||||||
|     fbSaveAreas (pPixmap, prgnSave, xorg, yorg, pWin); |     fbSaveAreas (pPixmap, prgnSave, xorg, yorg, pWin); | ||||||
| } | } | ||||||
|  | @ -242,7 +245,7 @@ KdCheckRestoreAreas (PixmapPtr	pPixmap, | ||||||
| 		     int    	yorg, | 		     int    	yorg, | ||||||
| 		     WindowPtr	pWin) | 		     WindowPtr	pWin) | ||||||
| { | { | ||||||
|     KdCheckSync(pWin->drawable.pScreen); |     kaaWaitSync(pWin->drawable.pScreen); | ||||||
|     kaaDrawableDirty ((DrawablePtr)pWin); |     kaaDrawableDirty ((DrawablePtr)pWin); | ||||||
|     fbRestoreAreas (pPixmap, prgnSave, xorg, yorg, pWin); |     fbRestoreAreas (pPixmap, prgnSave, xorg, yorg, pWin); | ||||||
| } | } | ||||||
|  | @ -250,7 +253,7 @@ KdCheckRestoreAreas (PixmapPtr	pPixmap, | ||||||
| void | void | ||||||
| KdCheckPaintWindow (WindowPtr pWin, RegionPtr pRegion, int what) | KdCheckPaintWindow (WindowPtr pWin, RegionPtr pRegion, int what) | ||||||
| { | { | ||||||
|     KdCheckSync (pWin->drawable.pScreen); |     kaaWaitSync (pWin->drawable.pScreen); | ||||||
|     kaaDrawableDirty ((DrawablePtr)pWin); |     kaaDrawableDirty ((DrawablePtr)pWin); | ||||||
|     fbPaintWindow (pWin, pRegion, what); |     fbPaintWindow (pWin, pRegion, what); | ||||||
| } | } | ||||||
|  | @ -258,7 +261,7 @@ KdCheckPaintWindow (WindowPtr pWin, RegionPtr pRegion, int what) | ||||||
| void | void | ||||||
| KdCheckCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) | KdCheckCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) | ||||||
| { | { | ||||||
|     KdCheckSync (pWin->drawable.pScreen); |     kaaWaitSync (pWin->drawable.pScreen); | ||||||
|     kaaDrawableDirty ((DrawablePtr)pWin); |     kaaDrawableDirty ((DrawablePtr)pWin); | ||||||
|     fbCopyWindow (pWin, ptOldOrg, prgnSrc); |     fbCopyWindow (pWin, ptOldOrg, prgnSrc); | ||||||
| } | } | ||||||
|  | @ -270,7 +273,7 @@ KdCheckPaintKey(DrawablePtr  pDrawable, | ||||||
| 		CARD32       pixel, | 		CARD32       pixel, | ||||||
| 		int          layer) | 		int          layer) | ||||||
| { | { | ||||||
|     KdCheckSync (pDrawable->pScreen); |     kaaWaitSync (pDrawable->pScreen); | ||||||
|     kaaDrawableDirty (pDrawable); |     kaaDrawableDirty (pDrawable); | ||||||
|     fbOverlayPaintKey (pDrawable,  pRegion, pixel, layer); |     fbOverlayPaintKey (pDrawable,  pRegion, pixel, layer); | ||||||
| } | } | ||||||
|  | @ -278,7 +281,7 @@ KdCheckPaintKey(DrawablePtr  pDrawable, | ||||||
| void | void | ||||||
| KdCheckOverlayCopyWindow  (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) | KdCheckOverlayCopyWindow  (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) | ||||||
| { | { | ||||||
|     KdCheckSync (pWin->drawable.pScreen); |     kaaWaitSync (pWin->drawable.pScreen); | ||||||
|     kaaDrawableDirty ((DrawablePtr)pWin); |     kaaDrawableDirty ((DrawablePtr)pWin); | ||||||
|     fbOverlayCopyWindow (pWin, ptOldOrg, prgnSrc); |     fbOverlayCopyWindow (pWin, ptOldOrg, prgnSrc); | ||||||
| } | } | ||||||
|  | @ -305,6 +308,47 @@ KdScreenInitAsync (ScreenPtr pScreen) | ||||||
| #endif | #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 |  * Only need to stall for copyarea/copyplane | ||||||
|  */ |  */ | ||||||
|  | @ -333,3 +377,13 @@ const GCOps kdAsyncPixmapGCOps = { | ||||||
|     ,NULL |     ,NULL | ||||||
| #endif | #endif | ||||||
| }; | }; | ||||||
|  | 
 | ||||||
|  | void | ||||||
|  | KdPictureInitAsync (ScreenPtr pScreen) | ||||||
|  | { | ||||||
|  |     PictureScreenPtr    ps; | ||||||
|  | 
 | ||||||
|  |     ps = GetPictureScreen(pScreen); | ||||||
|  |     ps->Composite = KdCheckComposite; | ||||||
|  |     ps->RasterizeTrapezoid = KdCheckRasterizeTrapezoid; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -224,7 +224,7 @@ KdDisableScreen (ScreenPtr pScreen) | ||||||
|      |      | ||||||
|     if (!pScreenPriv->enabled) |     if (!pScreenPriv->enabled) | ||||||
| 	return; | 	return; | ||||||
|     KdCheckSync (pScreen); |     kaaWaitSync (pScreen); | ||||||
|     if (!pScreenPriv->closed) |     if (!pScreenPriv->closed) | ||||||
| 	KdSetRootClip (pScreen, FALSE); | 	KdSetRootClip (pScreen, FALSE); | ||||||
|     KdDisableColormap (pScreen); |     KdDisableColormap (pScreen); | ||||||
|  |  | ||||||
|  | @ -89,7 +89,9 @@ typedef struct _KdCardInfo { | ||||||
|     struct _KdScreenInfo    *screenList; |     struct _KdScreenInfo    *screenList; | ||||||
|     int			    selected; |     int			    selected; | ||||||
|     struct _KdCardInfo	    *next; |     struct _KdCardInfo	    *next; | ||||||
|  | 
 | ||||||
|     Bool		    needSync; |     Bool		    needSync; | ||||||
|  |     int			    lastMarker; | ||||||
| } KdCardInfo; | } KdCardInfo; | ||||||
| 
 | 
 | ||||||
| extern KdCardInfo	*kdCardInfo; | extern KdCardInfo	*kdCardInfo; | ||||||
|  | @ -180,7 +182,6 @@ typedef struct _KdCardFuncs { | ||||||
| 
 | 
 | ||||||
|     Bool        (*initAccel) (ScreenPtr); |     Bool        (*initAccel) (ScreenPtr); | ||||||
|     void        (*enableAccel) (ScreenPtr); |     void        (*enableAccel) (ScreenPtr); | ||||||
|     void	(*syncAccel) (ScreenPtr); |  | ||||||
|     void        (*disableAccel) (ScreenPtr); |     void        (*disableAccel) (ScreenPtr); | ||||||
|     void        (*finiAccel) (ScreenPtr); |     void        (*finiAccel) (ScreenPtr); | ||||||
| 
 | 
 | ||||||
|  | @ -316,6 +317,13 @@ typedef struct _KaaTrapezoid { | ||||||
| } KaaTrapezoid; | } KaaTrapezoid; | ||||||
| 
 | 
 | ||||||
| typedef struct _KaaScreenInfo { | typedef struct _KaaScreenInfo { | ||||||
|  |     int	        offsetAlign; | ||||||
|  |     int         pitchAlign; | ||||||
|  |     int		flags; | ||||||
|  | 
 | ||||||
|  |     int		(*markSync) (ScreenPtr pScreen); | ||||||
|  |     void	(*waitMarker) (ScreenPtr pScreen, int marker); | ||||||
|  | 
 | ||||||
|     Bool	(*PrepareSolid) (PixmapPtr	pPixmap, |     Bool	(*PrepareSolid) (PixmapPtr	pPixmap, | ||||||
| 				 int		alu, | 				 int		alu, | ||||||
| 				 Pixel		planemask, | 				 Pixel		planemask, | ||||||
|  | @ -337,10 +345,6 @@ typedef struct _KaaScreenInfo { | ||||||
| 			 int	height); | 			 int	height); | ||||||
|     void	(*DoneCopy) (void); |     void	(*DoneCopy) (void); | ||||||
| 
 | 
 | ||||||
|     int	        offscreenByteAlign; |  | ||||||
|     int         offscreenPitch; |  | ||||||
|     int		flags; |  | ||||||
| 
 |  | ||||||
|     Bool        (*PrepareBlend) (int		op, |     Bool        (*PrepareBlend) (int		op, | ||||||
| 				 PicturePtr	pSrcPicture, | 				 PicturePtr	pSrcPicture, | ||||||
| 				 PicturePtr	pDstPicture, | 				 PicturePtr	pDstPicture, | ||||||
|  | @ -421,17 +425,6 @@ extern KdOsFuncs	*kdOsFuncs; | ||||||
| 				    (pointer) v) | 				    (pointer) v) | ||||||
| #define KdScreenPriv(pScreen) KdPrivScreenPtr pScreenPriv = KdGetScreenPriv(pScreen) | #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 */ | /* kaa.c */ | ||||||
| Bool | Bool | ||||||
| kaaDrawInit (ScreenPtr	        pScreen, | kaaDrawInit (ScreenPtr	        pScreen, | ||||||
|  |  | ||||||
|  | @ -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; |  | ||||||
| } |  | ||||||
|  | @ -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: | ||||||
|  |     ; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -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 srcPitch, int srcPitch2, int dstPitch, int srcW, int srcH, int height, | ||||||
|    int top, int left, int h, int w, int id); |    int top, int left, int h, int w, int id); | ||||||
| 
 | 
 | ||||||
|  | void | ||||||
|  | KXVPaintRegion (DrawablePtr pDraw, RegionPtr pRgn, Pixel fg); | ||||||
|  | 
 | ||||||
| KdVideoAdaptorPtr KdXVAllocateVideoAdaptorRec(KdScreenInfo * screen); | KdVideoAdaptorPtr KdXVAllocateVideoAdaptorRec(KdScreenInfo * screen); | ||||||
| 
 | 
 | ||||||
| void KdXVFreeVideoAdaptorRec(KdVideoAdaptorPtr ptr); | void KdXVFreeVideoAdaptorRec(KdVideoAdaptorPtr ptr); | ||||||
|  |  | ||||||
|  | @ -426,7 +426,6 @@ KdCardFuncs viaFuncs = { | ||||||
| 
 | 
 | ||||||
| 	viaDrawInit,		/* initAccel */ | 	viaDrawInit,		/* initAccel */ | ||||||
| 	viaDrawEnable,		/* enableAccel */ | 	viaDrawEnable,		/* enableAccel */ | ||||||
| 	viaDrawSync,		/* syncAccel */ |  | ||||||
| 	viaDrawDisable,		/* disableAccel */ | 	viaDrawDisable,		/* disableAccel */ | ||||||
| 	viaDrawFini,		/* finiAccel */ | 	viaDrawFini,		/* finiAccel */ | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -107,6 +107,7 @@ typedef struct _viaCardInfo { | ||||||
| */ | */ | ||||||
| typedef struct _viaScreenInfo { | typedef struct _viaScreenInfo { | ||||||
| 	VesaScreenPrivRec	vesa; | 	VesaScreenPrivRec	vesa; | ||||||
|  | 	KaaScreenInfoRec	kaa; | ||||||
| } ViaScreenInfo; | } ViaScreenInfo; | ||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|  |  | ||||||
|  | @ -34,6 +34,8 @@ | ||||||
| #include "viadraw.h" | #include "viadraw.h" | ||||||
| #include "via_regs.h" | #include "via_regs.h" | ||||||
| #include <sched.h> | #include <sched.h> | ||||||
|  | #include "kdrive.h" | ||||||
|  | #include "kaa.h" | ||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
| ** A global to contain card information between calls into this file. | ** A global to contain card information between calls into this file. | ||||||
|  | @ -107,6 +109,29 @@ viaWaitIdle( ViaCardInfo* viac ) { | ||||||
| 		sched_yield(); | 		sched_yield(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | /*
 | ||||||
|  | ** 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 ) | ** Bool viaPrepareSolid( PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg ) | ||||||
| ** | ** | ||||||
|  | @ -214,8 +239,7 @@ viaSolid( int x1, int y1, int x2, int y2 ) { | ||||||
| **	None. | **	None. | ||||||
| */ | */ | ||||||
| static void | static void | ||||||
| viaDoneSolid() { | viaDoneSolid(void) { | ||||||
| 	; |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|  | @ -330,26 +354,9 @@ viaCopy( int srcX, int srcY, int dstX, int dstY, int w, int h ) { | ||||||
| **	None. | **	None. | ||||||
| */ | */ | ||||||
| static void | 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 ) | ** Bool viaDrawInit( ScreenPtr pScreen ) | ||||||
|  | @ -370,6 +377,7 @@ Bool | ||||||
| viaDrawInit( ScreenPtr pScreen ) { | viaDrawInit( ScreenPtr pScreen ) { | ||||||
| 	KdScreenPriv( pScreen ); | 	KdScreenPriv( pScreen ); | ||||||
| 	ViaCardInfo* viac = pScreenPriv->card->driver; | 	ViaCardInfo* viac = pScreenPriv->card->driver; | ||||||
|  | 	ViaScreenInfo* vias = pScreenPriv->card->driver; | ||||||
| 	CARD32 geMode = 0; | 	CARD32 geMode = 0; | ||||||
| 
 | 
 | ||||||
| 	if( !viac ) return FALSE; | 	if( !viac ) return FALSE; | ||||||
|  | @ -425,7 +433,16 @@ viaDrawInit( ScreenPtr pScreen ) { | ||||||
| 
 | 
 | ||||||
| 	DebugF( "Initialized 2D engine!\n" ); | 	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 | void | ||||||
| viaDrawEnable( ScreenPtr pScreen ) { | viaDrawEnable( ScreenPtr pScreen ) { | ||||||
| 	KdMarkSync( pScreen ); | 	kaaMarkSync( pScreen ); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|  | @ -480,26 +497,3 @@ viaDrawDisable( ScreenPtr pScreen ) { | ||||||
| void | void | ||||||
| viaDrawFini( ScreenPtr pScreen ) { | 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 ); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue