[pkg-fso-commits] [SCM] xf86-video-glamo, SMedia Glamo video driver for X.Org branch, master, updated. upstream/0.0.0+20090707.git98c012f7-57-g9918e08

Thomas White taw at bitwiz.org.uk
Fri Jan 8 13:24:47 UTC 2010


The following commit has been merged in the master branch:
commit e727d8668afba6c2e50ee2097ae163b751274ce8
Author: Thomas White <taw at bitwiz.org.uk>
Date:   Tue Aug 18 21:14:44 2009 +0100

    Reallocate GEM objects when necessary

diff --git a/src/glamo-kms-exa.c b/src/glamo-kms-exa.c
index 5303aeb..e7d78cf 100644
--- a/src/glamo-kms-exa.c
+++ b/src/glamo-kms-exa.c
@@ -455,6 +455,7 @@ static Bool GlamoKMSExaModifyPixmapHeader(PixmapPtr pPix, int width, int height,
 	ScrnInfoPtr pScrn = xf86Screens[screen->myNum];
 	GlamoPtr pGlamo = GlamoPTR(pScrn);
 	struct glamo_exa_pixmap_priv *priv;
+	int new_size;
 
 	if (depth <= 0) depth = pPix->drawable.depth;
 	if (bitsPerPixel <= 0) bitsPerPixel = pPix->drawable.bitsPerPixel;
@@ -472,20 +473,19 @@ static Bool GlamoKMSExaModifyPixmapHeader(PixmapPtr pPix, int width, int height,
 		return FALSE;
 	}
 
-	if ( priv->bo == NULL ) {
+	new_size = (width * height * depth) / 8;
+	if ( new_size == 0 ) {
+		xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+		           "Zero-sized pixmap in ModifyPixmapHeader\n");
+		return FALSE;
+	}
 
-		int size;
+	if ( priv->bo == NULL ) {
 
 		/* This pixmap has no associated buffer object.
 		 * It's time to create one */
-		size = (width * height * depth) / 8;
-		if ( size == 0 ) {
-			xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-			           "Zero-sized pixmap in ModifyPixmapHeader\n");
-		}
-		priv->bo = glamo_bo_open(pGlamo->bufmgr, 0, size, 2,
+		priv->bo = glamo_bo_open(pGlamo->bufmgr, 0, new_size, 2,
 		                         GLAMO_GEM_DOMAIN_VRAM, 0);
-
 		if ( priv->bo == NULL ) {
 			xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
 				   "Failed to create buffer object"
@@ -493,6 +493,25 @@ static Bool GlamoKMSExaModifyPixmapHeader(PixmapPtr pPix, int width, int height,
 			return FALSE;
 		}
 
+	} else {
+
+		if ( priv->bo->size < new_size ) {
+
+			/* Get rid of the old GEM object */
+			glamo_bo_unref(priv->bo);
+
+			/* Create a new one of the correct size */
+			priv->bo = glamo_bo_open(pGlamo->bufmgr, 0, new_size, 2,
+				                 GLAMO_GEM_DOMAIN_VRAM, 0);
+			if ( priv->bo == NULL ) {
+				xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+					   "Failed to reallocate buffer object"
+					   " in ModifyPixmapHeader.\n");
+				return FALSE;
+			}
+
+		} /* else, reallocation is not required */
+
 	}
 
 	return FALSE;

-- 
xf86-video-glamo, SMedia Glamo video driver for X.Org



More information about the pkg-fso-commits mailing list