Add a "dirty" flag to the pixmap private. Clear it when setting up an
offscreen pixmap area, and set it when any rendering occurs. When
    moving a pixmap out of offscreen, don't read data back if it wasn't
    dirtied (compared to the system memory copy).
			
			
This commit is contained in:
		
							parent
							
								
									fd594b0559
								
							
						
					
					
						commit
						0207015669
					
				|  | @ -57,6 +57,21 @@ int kaaPixmapPrivateIndex; | |||
| #define KAA_PIXMAP_SCORE_PINNED	    1000 | ||||
| 
 | ||||
| #define MIN_OFFPIX_SIZE		(4096) | ||||
| void | ||||
| kaaDrawableDirty (DrawablePtr pDrawable) | ||||
| { | ||||
|     PixmapPtr pPixmap; | ||||
|     KaaPixmapPrivPtr pKaaPixmap; | ||||
| 
 | ||||
|     if (pDrawable->type == DRAWABLE_WINDOW) | ||||
| 	pPixmap = (*pDrawable->pScreen->GetWindowPixmap)((WindowPtr) pDrawable); | ||||
|     else | ||||
| 	pPixmap = (PixmapPtr)pDrawable; | ||||
| 
 | ||||
|     pKaaPixmap = KaaGetPixmapPriv(pPixmap); | ||||
|     if (pKaaPixmap != NULL) | ||||
| 	pKaaPixmap->dirty = TRUE; | ||||
| } | ||||
| 
 | ||||
| static void | ||||
| kaaPixmapSave (ScreenPtr pScreen, KdOffscreenArea *area) | ||||
|  | @ -74,8 +89,6 @@ kaaPixmapSave (ScreenPtr pScreen, KdOffscreenArea *area) | |||
| 		  pPixmap->drawable.width, | ||||
| 		  pPixmap->drawable.height)); | ||||
| 		   | ||||
|     KdCheckSync (pPixmap->drawable.pScreen); | ||||
| 
 | ||||
|     src_pitch = pPixmap->devKind; | ||||
|     dst_pitch = pKaaPixmap->devKind; | ||||
| 
 | ||||
|  | @ -86,7 +99,12 @@ kaaPixmapSave (ScreenPtr pScreen, KdOffscreenArea *area) | |||
|     pPixmap->devPrivate.ptr = dst; | ||||
|     pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; | ||||
|     pKaaPixmap->area = NULL; | ||||
|      | ||||
| 
 | ||||
|     if (!pKaaPixmap->dirty) | ||||
| 	return; | ||||
| 
 | ||||
|     KdCheckSync (pPixmap->drawable.pScreen); | ||||
| 
 | ||||
|     bytes = src_pitch < dst_pitch ? src_pitch : dst_pitch; | ||||
| 
 | ||||
|     i = pPixmap->drawable.height; | ||||
|  | @ -152,6 +170,7 @@ kaaMoveInPixmap (PixmapPtr pPixmap) | |||
| { | ||||
|     ScreenPtr	pScreen = pPixmap->drawable.pScreen; | ||||
|     KaaScreenPriv (pScreen); | ||||
|     KaaPixmapPriv (pPixmap); | ||||
|     int dst_pitch, src_pitch, bytes; | ||||
|     unsigned char *dst, *src; | ||||
|     int i; | ||||
|  | @ -168,7 +187,9 @@ kaaMoveInPixmap (PixmapPtr pPixmap) | |||
|      | ||||
|     if (!kaaPixmapAllocArea (pPixmap)) | ||||
| 	return; | ||||
|      | ||||
| 
 | ||||
|     pKaaPixmap->dirty = FALSE; | ||||
| 
 | ||||
|     if (pKaaScr->info->UploadToScreen) | ||||
|     { | ||||
| 	if (pKaaScr->info->UploadToScreen(pPixmap, src, src_pitch)) | ||||
|  | @ -301,6 +322,8 @@ kaaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth) | |||
|     if (pKaaPixmap->score != KAA_PIXMAP_SCORE_PINNED && | ||||
| 	(pPixmap->devKind * h) >= MIN_OFFPIX_SIZE) | ||||
| 	kaaPixmapAllocArea (pPixmap); | ||||
|     pKaaPixmap->dirty = FALSE; | ||||
| 
 | ||||
|     return pPixmap; | ||||
| } | ||||
| 
 | ||||
|  | @ -437,6 +460,7 @@ kaaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n, | |||
| 	} | ||||
|     } | ||||
|     (*pKaaScr->info->DoneSolid) (); | ||||
|     kaaDrawableDirty (pDrawable); | ||||
|     KdMarkSync(pDrawable->pScreen); | ||||
| } | ||||
| 
 | ||||
|  | @ -496,6 +520,7 @@ kaaCopyNtoN (DrawablePtr    pSrcDrawable, | |||
| 		    pbox, nbox, dx, dy, reverse, upsidedown,  | ||||
| 		    bitplane, closure); | ||||
|     } | ||||
|     kaaDrawableDirty (pDstDrawable); | ||||
| } | ||||
| 
 | ||||
| static RegionPtr | ||||
|  | @ -605,6 +630,7 @@ kaaPolyFillRect(DrawablePtr pDrawable, | |||
| 	} | ||||
|     } | ||||
|     (*pKaaScr->info->DoneSolid) (); | ||||
|     kaaDrawableDirty (pDrawable); | ||||
|     KdMarkSync(pDrawable->pScreen); | ||||
| } | ||||
|      | ||||
|  | @ -635,6 +661,7 @@ kaaSolidBoxClipped (DrawablePtr	pDrawable, | |||
| 	fbSolidBoxClipped (pDrawable, pClip, x1, y1, x2, y2, | ||||
| 			   fbAnd (GXcopy, fg, pm), | ||||
| 			   fbXor (GXcopy, fg, pm)); | ||||
| 	kaaDrawableDirty (pDrawable); | ||||
| 	return; | ||||
|     } | ||||
|     for (nbox = REGION_NUM_RECTS(pClip), pbox = REGION_RECTS(pClip);  | ||||
|  | @ -667,6 +694,7 @@ kaaSolidBoxClipped (DrawablePtr	pDrawable, | |||
| 				 partX2 + xoff, partY2 + yoff); | ||||
|     } | ||||
|     (*pKaaScr->info->DoneSolid) (); | ||||
|     kaaDrawableDirty (pDrawable); | ||||
|     KdMarkSync(pDrawable->pScreen); | ||||
| } | ||||
| 
 | ||||
|  | @ -754,6 +782,7 @@ kaaImageGlyphBlt (DrawablePtr	pDrawable, | |||
|     } | ||||
| 
 | ||||
|     KdCheckSync (pDrawable->pScreen); | ||||
|     kaaDrawableDirty (pDrawable); | ||||
|      | ||||
|     ppci = ppciInit; | ||||
|     while (nglyph--) | ||||
|  | @ -919,6 +948,7 @@ kaaFillRegionSolid (DrawablePtr	pDrawable, | |||
| 	fbFillRegionSolid (pDrawable, pRegion, 0, | ||||
| 			   fbReplicatePixel (pixel, pDrawable->bitsPerPixel)); | ||||
|     } | ||||
|     kaaDrawableDirty (pDrawable); | ||||
| } | ||||
| 
 | ||||
| static void | ||||
|  |  | |||
|  | @ -43,6 +43,7 @@ typedef struct { | |||
|     int		    score; | ||||
|     int		    devKind; | ||||
|     DevUnion	    devPrivate; | ||||
|     Bool	    dirty; | ||||
| } KaaPixmapPrivRec, *KaaPixmapPrivPtr; | ||||
| 
 | ||||
| extern int kaaScreenPrivateIndex; | ||||
|  | @ -55,6 +56,9 @@ kaaPixmapUseScreen (PixmapPtr pPixmap); | |||
| void | ||||
| kaaPixmapUseMemory (PixmapPtr pPixmap); | ||||
| 
 | ||||
| void | ||||
| kaaDrawableDirty(DrawablePtr pDrawable); | ||||
| 
 | ||||
| Bool | ||||
| kaaDrawableIsOffscreen (DrawablePtr pDrawable); | ||||
| 
 | ||||
|  |  | |||
|  | @ -296,6 +296,7 @@ kaaTryDriverSolidFill(PicturePtr	pSrc, | |||
| 
 | ||||
|     (*pKaaScr->info->DoneSolid) (); | ||||
|     KdMarkSync(pDst->pDrawable->pScreen); | ||||
|     kaaDrawableDirty (pDst->pDrawable); | ||||
| 
 | ||||
|     REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); | ||||
|     return 1; | ||||
|  | @ -382,6 +383,7 @@ kaaTryDriverBlend(CARD8		op, | |||
|      | ||||
|     (*pKaaScr->info->DoneBlend) (); | ||||
|     KdMarkSync(pDst->pDrawable->pScreen); | ||||
|     kaaDrawableDirty (pDst->pDrawable); | ||||
| 
 | ||||
|     REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); | ||||
|     return 1; | ||||
|  | @ -503,6 +505,7 @@ kaaTryDriverComposite(CARD8		op, | |||
| 
 | ||||
|     (*pKaaScr->info->DoneComposite) (); | ||||
|     KdMarkSync(pDst->pDrawable->pScreen); | ||||
|     kaaDrawableDirty (pDst->pDrawable); | ||||
| 
 | ||||
|     REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); | ||||
|     return 1; | ||||
|  |  | |||
|  | @ -45,6 +45,7 @@ KdCheckComposite (CARD8      op, | |||
| 		  CARD16     height) | ||||
| { | ||||
|     KdCheckSync (pDst->pDrawable->pScreen); | ||||
|     kaaDrawableDirty (pDst->pDrawable); | ||||
|     fbComposite (op, | ||||
| 		 pSrc, | ||||
| 		 pMask, | ||||
|  | @ -66,6 +67,7 @@ KdCheckRasterizeTrapezoid(PicturePtr	pMask, | |||
| 			  int		y_off) | ||||
| { | ||||
|     KdCheckSync (pMask->pDrawable->pScreen); | ||||
|     kaaDrawableDirty (pMask->pDrawable); | ||||
|     fbRasterizeTrapezoid (pMask, trap, x_off, y_off); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue