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 KAA_PIXMAP_SCORE_PINNED	    1000 | ||||||
| 
 | 
 | ||||||
| #define MIN_OFFPIX_SIZE		(4096) | #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 | static void | ||||||
| kaaPixmapSave (ScreenPtr pScreen, KdOffscreenArea *area) | kaaPixmapSave (ScreenPtr pScreen, KdOffscreenArea *area) | ||||||
|  | @ -74,8 +89,6 @@ kaaPixmapSave (ScreenPtr pScreen, KdOffscreenArea *area) | ||||||
| 		  pPixmap->drawable.width, | 		  pPixmap->drawable.width, | ||||||
| 		  pPixmap->drawable.height)); | 		  pPixmap->drawable.height)); | ||||||
| 		   | 		   | ||||||
|     KdCheckSync (pPixmap->drawable.pScreen); |  | ||||||
| 
 |  | ||||||
|     src_pitch = pPixmap->devKind; |     src_pitch = pPixmap->devKind; | ||||||
|     dst_pitch = pKaaPixmap->devKind; |     dst_pitch = pKaaPixmap->devKind; | ||||||
| 
 | 
 | ||||||
|  | @ -86,7 +99,12 @@ kaaPixmapSave (ScreenPtr pScreen, KdOffscreenArea *area) | ||||||
|     pPixmap->devPrivate.ptr = dst; |     pPixmap->devPrivate.ptr = dst; | ||||||
|     pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; |     pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; | ||||||
|     pKaaPixmap->area = NULL; |     pKaaPixmap->area = NULL; | ||||||
|      | 
 | ||||||
|  |     if (!pKaaPixmap->dirty) | ||||||
|  | 	return; | ||||||
|  | 
 | ||||||
|  |     KdCheckSync (pPixmap->drawable.pScreen); | ||||||
|  | 
 | ||||||
|     bytes = src_pitch < dst_pitch ? src_pitch : dst_pitch; |     bytes = src_pitch < dst_pitch ? src_pitch : dst_pitch; | ||||||
| 
 | 
 | ||||||
|     i = pPixmap->drawable.height; |     i = pPixmap->drawable.height; | ||||||
|  | @ -152,6 +170,7 @@ kaaMoveInPixmap (PixmapPtr pPixmap) | ||||||
| { | { | ||||||
|     ScreenPtr	pScreen = pPixmap->drawable.pScreen; |     ScreenPtr	pScreen = pPixmap->drawable.pScreen; | ||||||
|     KaaScreenPriv (pScreen); |     KaaScreenPriv (pScreen); | ||||||
|  |     KaaPixmapPriv (pPixmap); | ||||||
|     int dst_pitch, src_pitch, bytes; |     int dst_pitch, src_pitch, bytes; | ||||||
|     unsigned char *dst, *src; |     unsigned char *dst, *src; | ||||||
|     int i; |     int i; | ||||||
|  | @ -168,7 +187,9 @@ kaaMoveInPixmap (PixmapPtr pPixmap) | ||||||
|      |      | ||||||
|     if (!kaaPixmapAllocArea (pPixmap)) |     if (!kaaPixmapAllocArea (pPixmap)) | ||||||
| 	return; | 	return; | ||||||
|      | 
 | ||||||
|  |     pKaaPixmap->dirty = FALSE; | ||||||
|  | 
 | ||||||
|     if (pKaaScr->info->UploadToScreen) |     if (pKaaScr->info->UploadToScreen) | ||||||
|     { |     { | ||||||
| 	if (pKaaScr->info->UploadToScreen(pPixmap, src, src_pitch)) | 	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 && |     if (pKaaPixmap->score != KAA_PIXMAP_SCORE_PINNED && | ||||||
| 	(pPixmap->devKind * h) >= MIN_OFFPIX_SIZE) | 	(pPixmap->devKind * h) >= MIN_OFFPIX_SIZE) | ||||||
| 	kaaPixmapAllocArea (pPixmap); | 	kaaPixmapAllocArea (pPixmap); | ||||||
|  |     pKaaPixmap->dirty = FALSE; | ||||||
|  | 
 | ||||||
|     return pPixmap; |     return pPixmap; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -437,6 +460,7 @@ kaaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n, | ||||||
| 	} | 	} | ||||||
|     } |     } | ||||||
|     (*pKaaScr->info->DoneSolid) (); |     (*pKaaScr->info->DoneSolid) (); | ||||||
|  |     kaaDrawableDirty (pDrawable); | ||||||
|     KdMarkSync(pDrawable->pScreen); |     KdMarkSync(pDrawable->pScreen); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -496,6 +520,7 @@ kaaCopyNtoN (DrawablePtr    pSrcDrawable, | ||||||
| 		    pbox, nbox, dx, dy, reverse, upsidedown,  | 		    pbox, nbox, dx, dy, reverse, upsidedown,  | ||||||
| 		    bitplane, closure); | 		    bitplane, closure); | ||||||
|     } |     } | ||||||
|  |     kaaDrawableDirty (pDstDrawable); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static RegionPtr | static RegionPtr | ||||||
|  | @ -605,6 +630,7 @@ kaaPolyFillRect(DrawablePtr pDrawable, | ||||||
| 	} | 	} | ||||||
|     } |     } | ||||||
|     (*pKaaScr->info->DoneSolid) (); |     (*pKaaScr->info->DoneSolid) (); | ||||||
|  |     kaaDrawableDirty (pDrawable); | ||||||
|     KdMarkSync(pDrawable->pScreen); |     KdMarkSync(pDrawable->pScreen); | ||||||
| } | } | ||||||
|      |      | ||||||
|  | @ -635,6 +661,7 @@ kaaSolidBoxClipped (DrawablePtr	pDrawable, | ||||||
| 	fbSolidBoxClipped (pDrawable, pClip, x1, y1, x2, y2, | 	fbSolidBoxClipped (pDrawable, pClip, x1, y1, x2, y2, | ||||||
| 			   fbAnd (GXcopy, fg, pm), | 			   fbAnd (GXcopy, fg, pm), | ||||||
| 			   fbXor (GXcopy, fg, pm)); | 			   fbXor (GXcopy, fg, pm)); | ||||||
|  | 	kaaDrawableDirty (pDrawable); | ||||||
| 	return; | 	return; | ||||||
|     } |     } | ||||||
|     for (nbox = REGION_NUM_RECTS(pClip), pbox = REGION_RECTS(pClip);  |     for (nbox = REGION_NUM_RECTS(pClip), pbox = REGION_RECTS(pClip);  | ||||||
|  | @ -667,6 +694,7 @@ kaaSolidBoxClipped (DrawablePtr	pDrawable, | ||||||
| 				 partX2 + xoff, partY2 + yoff); | 				 partX2 + xoff, partY2 + yoff); | ||||||
|     } |     } | ||||||
|     (*pKaaScr->info->DoneSolid) (); |     (*pKaaScr->info->DoneSolid) (); | ||||||
|  |     kaaDrawableDirty (pDrawable); | ||||||
|     KdMarkSync(pDrawable->pScreen); |     KdMarkSync(pDrawable->pScreen); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -754,6 +782,7 @@ kaaImageGlyphBlt (DrawablePtr	pDrawable, | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     KdCheckSync (pDrawable->pScreen); |     KdCheckSync (pDrawable->pScreen); | ||||||
|  |     kaaDrawableDirty (pDrawable); | ||||||
|      |      | ||||||
|     ppci = ppciInit; |     ppci = ppciInit; | ||||||
|     while (nglyph--) |     while (nglyph--) | ||||||
|  | @ -919,6 +948,7 @@ kaaFillRegionSolid (DrawablePtr	pDrawable, | ||||||
| 	fbFillRegionSolid (pDrawable, pRegion, 0, | 	fbFillRegionSolid (pDrawable, pRegion, 0, | ||||||
| 			   fbReplicatePixel (pixel, pDrawable->bitsPerPixel)); | 			   fbReplicatePixel (pixel, pDrawable->bitsPerPixel)); | ||||||
|     } |     } | ||||||
|  |     kaaDrawableDirty (pDrawable); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static void | static void | ||||||
|  |  | ||||||
|  | @ -43,6 +43,7 @@ typedef struct { | ||||||
|     int		    score; |     int		    score; | ||||||
|     int		    devKind; |     int		    devKind; | ||||||
|     DevUnion	    devPrivate; |     DevUnion	    devPrivate; | ||||||
|  |     Bool	    dirty; | ||||||
| } KaaPixmapPrivRec, *KaaPixmapPrivPtr; | } KaaPixmapPrivRec, *KaaPixmapPrivPtr; | ||||||
| 
 | 
 | ||||||
| extern int kaaScreenPrivateIndex; | extern int kaaScreenPrivateIndex; | ||||||
|  | @ -55,6 +56,9 @@ kaaPixmapUseScreen (PixmapPtr pPixmap); | ||||||
| void | void | ||||||
| kaaPixmapUseMemory (PixmapPtr pPixmap); | kaaPixmapUseMemory (PixmapPtr pPixmap); | ||||||
| 
 | 
 | ||||||
|  | void | ||||||
|  | kaaDrawableDirty(DrawablePtr pDrawable); | ||||||
|  | 
 | ||||||
| Bool | Bool | ||||||
| kaaDrawableIsOffscreen (DrawablePtr pDrawable); | kaaDrawableIsOffscreen (DrawablePtr pDrawable); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -296,6 +296,7 @@ kaaTryDriverSolidFill(PicturePtr	pSrc, | ||||||
| 
 | 
 | ||||||
|     (*pKaaScr->info->DoneSolid) (); |     (*pKaaScr->info->DoneSolid) (); | ||||||
|     KdMarkSync(pDst->pDrawable->pScreen); |     KdMarkSync(pDst->pDrawable->pScreen); | ||||||
|  |     kaaDrawableDirty (pDst->pDrawable); | ||||||
| 
 | 
 | ||||||
|     REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); |     REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); | ||||||
|     return 1; |     return 1; | ||||||
|  | @ -382,6 +383,7 @@ kaaTryDriverBlend(CARD8		op, | ||||||
|      |      | ||||||
|     (*pKaaScr->info->DoneBlend) (); |     (*pKaaScr->info->DoneBlend) (); | ||||||
|     KdMarkSync(pDst->pDrawable->pScreen); |     KdMarkSync(pDst->pDrawable->pScreen); | ||||||
|  |     kaaDrawableDirty (pDst->pDrawable); | ||||||
| 
 | 
 | ||||||
|     REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); |     REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); | ||||||
|     return 1; |     return 1; | ||||||
|  | @ -503,6 +505,7 @@ kaaTryDriverComposite(CARD8		op, | ||||||
| 
 | 
 | ||||||
|     (*pKaaScr->info->DoneComposite) (); |     (*pKaaScr->info->DoneComposite) (); | ||||||
|     KdMarkSync(pDst->pDrawable->pScreen); |     KdMarkSync(pDst->pDrawable->pScreen); | ||||||
|  |     kaaDrawableDirty (pDst->pDrawable); | ||||||
| 
 | 
 | ||||||
|     REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); |     REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); | ||||||
|     return 1; |     return 1; | ||||||
|  |  | ||||||
|  | @ -45,6 +45,7 @@ KdCheckComposite (CARD8      op, | ||||||
| 		  CARD16     height) | 		  CARD16     height) | ||||||
| { | { | ||||||
|     KdCheckSync (pDst->pDrawable->pScreen); |     KdCheckSync (pDst->pDrawable->pScreen); | ||||||
|  |     kaaDrawableDirty (pDst->pDrawable); | ||||||
|     fbComposite (op, |     fbComposite (op, | ||||||
| 		 pSrc, | 		 pSrc, | ||||||
| 		 pMask, | 		 pMask, | ||||||
|  | @ -66,6 +67,7 @@ KdCheckRasterizeTrapezoid(PicturePtr	pMask, | ||||||
| 			  int		y_off) | 			  int		y_off) | ||||||
| { | { | ||||||
|     KdCheckSync (pMask->pDrawable->pScreen); |     KdCheckSync (pMask->pDrawable->pScreen); | ||||||
|  |     kaaDrawableDirty (pMask->pDrawable); | ||||||
|     fbRasterizeTrapezoid (pMask, trap, x_off, y_off); |     fbRasterizeTrapezoid (pMask, trap, x_off, y_off); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue