Module Name:    xsrc
Committed By:   macallan
Date:           Fri Dec 23 06:52:17 UTC 2016

Modified Files:
        xsrc/external/mit/xf86-video-glint/dist/src: glint.h glint_driver.c
            glint_regs.h pm2_common.c pm2_exa.c

Log Message:
add xrender acceleration for Permedia 2. Needs some EXA change to be useful
though, a patch has been sent to xorg-devel@


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 xsrc/external/mit/xf86-video-glint/dist/src/glint.h
cvs rdiff -u -r1.10 -r1.11 \
    xsrc/external/mit/xf86-video-glint/dist/src/glint_driver.c
cvs rdiff -u -r1.1.1.3 -r1.2 \
    xsrc/external/mit/xf86-video-glint/dist/src/glint_regs.h
cvs rdiff -u -r1.2 -r1.3 \
    xsrc/external/mit/xf86-video-glint/dist/src/pm2_common.c
cvs rdiff -u -r1.5 -r1.6 \
    xsrc/external/mit/xf86-video-glint/dist/src/pm2_exa.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/xf86-video-glint/dist/src/glint.h
diff -u xsrc/external/mit/xf86-video-glint/dist/src/glint.h:1.3 xsrc/external/mit/xf86-video-glint/dist/src/glint.h:1.4
--- xsrc/external/mit/xf86-video-glint/dist/src/glint.h:1.3	Sat Dec 10 01:57:54 2016
+++ xsrc/external/mit/xf86-video-glint/dist/src/glint.h	Fri Dec 23 06:52:17 2016
@@ -151,7 +151,11 @@ typedef struct {
     XAAInfoRecPtr	AccelInfoRec;
 #endif
     ExaDriverPtr 	pExa;
-    int			srcoff;
+    int			srcoff, srcpitch;
+    int			mskoff, mskpitch;
+    int			srcformat, dstformat, mskformat;
+    int			fillcolour, op;
+    Bool		source_is_solid, no_source_pixmap, render;
 
     CloseScreenProcPtr	CloseScreen;
     ScreenBlockHandlerProcPtr BlockHandler;

Index: xsrc/external/mit/xf86-video-glint/dist/src/glint_driver.c
diff -u xsrc/external/mit/xf86-video-glint/dist/src/glint_driver.c:1.10 xsrc/external/mit/xf86-video-glint/dist/src/glint_driver.c:1.11
--- xsrc/external/mit/xf86-video-glint/dist/src/glint_driver.c:1.10	Sat Dec 10 01:57:54 2016
+++ xsrc/external/mit/xf86-video-glint/dist/src/glint_driver.c	Fri Dec 23 06:52:17 2016
@@ -197,6 +197,7 @@ typedef enum {
     OPTION_RGB_BITS,
     OPTION_NOACCEL,
     OPTION_BLOCK_WRITE,
+    OPTION_RENDER_ACCEL,
     OPTION_FIREGL3000,
     OPTION_OVERLAY,
     OPTION_SHADOW_FB,
@@ -210,6 +211,7 @@ static const OptionInfoRec GLINTOptions[
     { OPTION_RGB_BITS,		"RGBbits",	OPTV_INTEGER,	{0}, FALSE },
     { OPTION_NOACCEL,		"NoAccel",	OPTV_BOOLEAN,	{0}, FALSE },
     { OPTION_BLOCK_WRITE,	"BlockWrite",	OPTV_BOOLEAN,   {0}, FALSE },
+    { OPTION_RENDER_ACCEL,	"RenderAccel",	OPTV_BOOLEAN,   {0}, FALSE },
     { OPTION_FIREGL3000,	"FireGL3000",   OPTV_BOOLEAN,	{0}, FALSE },
     { OPTION_OVERLAY,		"Overlay",	OPTV_ANYSTR,	{0}, FALSE },
     { OPTION_SHADOW_FB,		"ShadowFB",	OPTV_BOOLEAN,	{0}, FALSE },
@@ -1054,6 +1056,10 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flag
 	pGlint->NoAccel = TRUE;
 	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n");
     }
+    if (xf86ReturnOptValBool(pGlint->Options, OPTION_RENDER_ACCEL, FALSE)) {
+	pGlint->render = TRUE;
+	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Render Acceleration enabled\n");
+    }
     if (xf86ReturnOptValBool(pGlint->Options, OPTION_SHADOW_FB, FALSE)) {
 	pGlint->ShadowFB = TRUE;
 	pGlint->NoAccel = TRUE;

Index: xsrc/external/mit/xf86-video-glint/dist/src/glint_regs.h
diff -u xsrc/external/mit/xf86-video-glint/dist/src/glint_regs.h:1.1.1.3 xsrc/external/mit/xf86-video-glint/dist/src/glint_regs.h:1.2
--- xsrc/external/mit/xf86-video-glint/dist/src/glint_regs.h:1.1.1.3	Sun Jun  2 07:25:12 2013
+++ xsrc/external/mit/xf86-video-glint/dist/src/glint_regs.h	Fri Dec 23 06:52:17 2016
@@ -712,6 +712,9 @@
 #define TexelLUTMode						GLINT_TAG_ADDR(0x0c,0x0f)
 
 #define TextureColorMode					GLINT_TAG_ADDR(0x0d,0x00)
+#  define TextureModeModulate	0 << 1
+#  define TextureModeDecal	1 << 1
+#  define TextureModeCopy	3 << 1
 #  define TextureTypeOpenGL 0
 #  define TextureTypeApple  1 << 4
 #  define TextureKsDDA      1 << 5 /* only Apple-Mode */
@@ -770,6 +773,7 @@
 	/* DstFBData				*/
 	/* UNIT_DISABLE				*/
 
+#	define ABM_SrcZERO					0 << 1
 #	define ABM_SrcONE					1 << 1
 #	define ABM_SrcDST_COLOR				2 << 1
 #	define ABM_SrcONE_MINUS_DST_COLOR			3 << 1
@@ -778,6 +782,7 @@
 #	define ABM_SrcDST_ALPHA				6 << 1
 #	define ABM_SrcONE_MINUS_DST_ALPHA			7 << 1
 #	define ABM_SrcSRC_ALPHA_SATURATE			8 << 1
+#	define ABM_DstZERO					0 << 5
 #	define ABM_DstONE					1 << 5
 #	define ABM_DstSRC_COLOR				2 << 5
 #	define ABM_DstONE_MINUS_SRC_COLOR			3 << 5
@@ -1302,12 +1307,13 @@ do{								\
 	}							\
 }
 
-#define DO_PLANEMASK(planemask)					\
+#define DO_PLANEMASK(p)						\
 { 								\
-	if (planemask != pGlint->planemask) {			\
-		pGlint->planemask = planemask;			\
-		REPLICATE(planemask); 				\
-		GLINT_WRITE_REG(planemask, FBHardwareWriteMask);\
+	if (p != pGlint->planemask) {				\
+		CARD32 pm = p;					\
+		pGlint->planemask = p;				\
+		REPLICATE(pm); 					\
+		GLINT_WRITE_REG(pm, FBHardwareWriteMask);	\
 	}							\
 } 
 

Index: xsrc/external/mit/xf86-video-glint/dist/src/pm2_common.c
diff -u xsrc/external/mit/xf86-video-glint/dist/src/pm2_common.c:1.2 xsrc/external/mit/xf86-video-glint/dist/src/pm2_common.c:1.3
--- xsrc/external/mit/xf86-video-glint/dist/src/pm2_common.c:1.2	Sat Dec 10 01:57:54 2016
+++ xsrc/external/mit/xf86-video-glint/dist/src/pm2_common.c	Fri Dec 23 06:52:17 2016
@@ -72,6 +72,12 @@ Permedia2InitializeEngine(ScrnInfoPtr pS
     GLINT_SLOW_WRITE_REG(UNIT_DISABLE,	ColorDDAMode);
     GLINT_SLOW_WRITE_REG(UNIT_DISABLE,	TextureColorMode);
     GLINT_SLOW_WRITE_REG(UNIT_DISABLE,	TextureAddressMode);
+    GLINT_SLOW_WRITE_REG(0,		SStart);
+    GLINT_SLOW_WRITE_REG(0,		dSdx);
+    GLINT_SLOW_WRITE_REG(1 << 20,	dSdyDom);
+    GLINT_SLOW_WRITE_REG(UNIT_DISABLE,	TStart);    
+    GLINT_SLOW_WRITE_REG(1 << 20,	dTdx);
+    GLINT_SLOW_WRITE_REG(0,		dTdyDom);
     GLINT_SLOW_WRITE_REG(UNIT_DISABLE,	PMTextureReadMode);
     GLINT_SLOW_WRITE_REG(pGlint->pprod,	LBReadMode);
     GLINT_SLOW_WRITE_REG(UNIT_DISABLE,	AlphaBlendMode);

Index: xsrc/external/mit/xf86-video-glint/dist/src/pm2_exa.c
diff -u xsrc/external/mit/xf86-video-glint/dist/src/pm2_exa.c:1.5 xsrc/external/mit/xf86-video-glint/dist/src/pm2_exa.c:1.6
--- xsrc/external/mit/xf86-video-glint/dist/src/pm2_exa.c:1.5	Wed Dec 14 16:51:44 2016
+++ xsrc/external/mit/xf86-video-glint/dist/src/pm2_exa.c	Fri Dec 23 06:52:17 2016
@@ -45,7 +45,7 @@
 #include "glint_regs.h"
 #include "glint.h"
 
-//#define PM2_DEBUG
+/*#define PM2_DEBUG*/
 
 #ifdef PM2_DEBUG
 #define STATIC static
@@ -57,6 +57,41 @@
 #define DPRINTF while (0) xf86Msg
 #endif
 
+int src_formats[] = {PICT_a8r8g8b8, PICT_x8r8g8b8,
+		     PICT_a8b8g8r8, PICT_x8b8g8r8};
+int tex_formats[] = {PICT_a8r8g8b8, PICT_a8b8g8r8};
+
+static uint32_t Pm2BlendOps[] = {
+    /* Clear */
+    ABM_SrcZERO			| ABM_DstZERO,
+    /* Src */
+    ABM_SrcONE			| ABM_DstZERO,
+    /* Dst */
+    ABM_SrcZERO			| ABM_DstONE,
+    /* Over */
+    ABM_SrcONE			| ABM_DstONE_MINUS_SRC_ALPHA,
+    /* OverReverse */
+    ABM_SrcONE_MINUS_DST_ALPHA	| ABM_DstONE,
+    /* In */
+    ABM_SrcDST_ALPHA		| ABM_DstZERO,
+    /* InReverse */
+    ABM_SrcZERO			| ABM_DstSRC_ALPHA,
+    /* Out */
+    ABM_SrcONE_MINUS_DST_ALPHA	| ABM_DstZERO,
+    /* OutReverse */
+    ABM_SrcZERO			| ABM_DstONE_MINUS_SRC_ALPHA,
+    /* Atop */
+    ABM_SrcDST_ALPHA		| ABM_DstONE_MINUS_SRC_ALPHA,
+    /* AtopReverse */
+    ABM_SrcONE_MINUS_DST_ALPHA	| ABM_DstSRC_ALPHA,
+    /* Xor */
+    ABM_SrcONE_MINUS_DST_ALPHA	| ABM_DstONE_MINUS_SRC_ALPHA,
+    /* Add */
+    ABM_SrcONE			| ABM_DstONE
+};
+
+#define arraysize(ary)        (sizeof(ary) / sizeof(ary[0]))
+
 STATIC void
 Pm2WaitMarker(ScreenPtr pScreen, int Marker)
 {
@@ -78,8 +113,11 @@ Pm2PrepareCopy(PixmapPtr pSrcPixmap, Pix
 	if (xdir == 1) pGlint->BltScanDirection |= XPositive;
 	if (ydir == 1) pGlint->BltScanDirection |= YPositive;
   
-	GLINT_WAIT(4);
+	GLINT_WAIT(6);
 	DO_PLANEMASK(planemask);
+	GLINT_WRITE_REG(UNIT_DISABLE, AlphaBlendMode);
+	GLINT_WRITE_REG(UNIT_DISABLE, DitherMode);
+	GLINT_WRITE_REG(UNIT_DISABLE, TextureAddressMode);
 
 	GLINT_WRITE_REG(UNIT_DISABLE, ColorDDAMode);
 	if ((rop == GXset) || (rop == GXclear)) {
@@ -131,8 +169,6 @@ Pm2Copy(PixmapPtr pDstPixmap,
         		       FBSourceDelta);
 	}
 	GLINT_WRITE_REG(PrimitiveRectangle | pGlint->BltScanDirection, Render);
-
-	exaMarkSync(pDstPixmap->drawable.pScreen);
 }
 
 STATIC void
@@ -153,7 +189,10 @@ Pm2PrepareSolid(PixmapPtr pPixmap, int r
 
 	REPLICATE(color);
 
-	GLINT_WAIT(6);
+	GLINT_WAIT(8);
+	GLINT_WRITE_REG(UNIT_DISABLE, AlphaBlendMode);
+	GLINT_WRITE_REG(UNIT_DISABLE, DitherMode);
+	GLINT_WRITE_REG(UNIT_DISABLE, TextureAddressMode);
 	DO_PLANEMASK(planemask);
 	if (rop == GXcopy) {
 		GLINT_WRITE_REG(UNIT_DISABLE, ColorDDAMode);
@@ -195,8 +234,6 @@ Pm2Solid(PixmapPtr pPixmap, int x1, int 
   		speed = 0;
 	}
 	GLINT_WRITE_REG(PrimitiveRectangle | XPositive | YPositive | speed, Render);
-
-	exaMarkSync(pPixmap->drawable.pScreen);
 }
 
 /*
@@ -235,10 +272,12 @@ Pm2UploadToScreen(PixmapPtr pDst, int x,
 		/* use host blit */
 		y += offset / dst_pitch;
 		adr = y * (dst_pitch >> 2) + x;
+		DPRINTF(X_ERROR, "%d %d\n", x, y);
         	while (h--) {
         		s = (CARD32 *)src;
         		xx = w;
-        		GLINT_WAIT(1);
+        		GLINT_WAIT(2);
+        		DO_PLANEMASK(0xffffffff);
         		GLINT_WRITE_REG(adr, TextureDownloadOffset);
 			while (xx > 0) {
 				chunk = min(fs - 1, xx);
@@ -290,6 +329,262 @@ Pm2DownloadFromScreen(PixmapPtr pSrc, in
 }
 
 Bool
+Pm2CheckComposite(int op, PicturePtr pSrcPicture,
+                           PicturePtr pMaskPicture,
+                           PicturePtr pDstPicture)
+{
+	int i, ok = FALSE;
+
+	ENTER;
+
+	i = 0;
+	while ((i < arraysize(src_formats)) && (!ok)) {
+		ok =  (pSrcPicture->format == src_formats[i]);
+		i++;
+	}
+
+	if (!ok) {
+		DPRINTF(X_ERROR, "%s: unsupported src format %x\n",
+		    __func__, pSrcPicture->format);
+		return FALSE;
+	}
+
+	if (pDstPicture != NULL) {
+		i = 0;
+		while ((i < arraysize(src_formats)) && (!ok)) {
+			ok =  (pDstPicture->format == src_formats[i]);
+			i++;
+		}
+
+		if (!ok) {
+			DPRINTF(X_ERROR, "%s: unsupported dst format %x\n",
+			    __func__, pDstPicture->format);
+			return FALSE;
+		}
+	}
+
+	DPRINTF(X_ERROR, "src is %x, %d\n", pSrcPicture->format, op);
+
+	if (pMaskPicture != NULL) {
+		i = 0;
+		ok = FALSE;
+		while ((i < arraysize(tex_formats)) && (!ok)) {
+			ok =  (pMaskPicture->format == tex_formats[i]);
+			i++;
+		}
+		if (!ok) {
+			DPRINTF(X_ERROR, "%s: unsupported mask format %x\n",
+			    __func__, pMaskPicture->format);
+			return FALSE;
+		}
+		DPRINTF(X_ERROR, "mask is %x %d %d\n", pMaskPicture->format,
+		    pMaskPicture->pDrawable->width,
+		    pMaskPicture->pDrawable->height);
+		if (op != PictOpOver)
+			return FALSE;
+	}
+	DPRINTF(X_ERROR, "true\n");
+	return TRUE;
+}
+
+Bool
+Pm2PrepareComposite(int op, PicturePtr pSrcPicture,
+                             PicturePtr pMaskPicture,
+                             PicturePtr pDstPicture,
+                             PixmapPtr  pSrc,
+                             PixmapPtr  pMask,
+                             PixmapPtr  pDst)
+{
+	ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
+	GLINTPtr pGlint   = GLINTPTR(pScrn);
+
+	ENTER;
+
+	pGlint->no_source_pixmap = FALSE;
+	pGlint->source_is_solid = FALSE;
+
+	if (pSrcPicture->pSourcePict != NULL) {
+		if (pSrcPicture->pSourcePict->type == SourcePictTypeSolidFill) {
+			pGlint->fillcolour =
+			    pSrcPicture->pSourcePict->solidFill.color;
+			DPRINTF(X_ERROR, "%s: solid src %08x\n",
+			    __func__, pGlint->fillcolour);
+			pGlint->no_source_pixmap = TRUE;
+			pGlint->source_is_solid = TRUE;
+		}
+	}
+	if ((pMaskPicture != NULL) && (pMaskPicture->pSourcePict != NULL)) {
+		if (pMaskPicture->pSourcePict->type ==
+		    SourcePictTypeSolidFill) {
+			pGlint->fillcolour = 
+			   pMaskPicture->pSourcePict->solidFill.color;
+			DPRINTF(X_ERROR, "%s: solid mask %08x\n",
+			    __func__, pGlint->fillcolour);
+		}
+	}
+	if (pMaskPicture != NULL) {
+		pGlint->mskoff = exaGetPixmapOffset(pMask);
+		pGlint->mskpitch = exaGetPixmapPitch(pMask);
+		pGlint->mskformat = pMaskPicture->format;
+	} else {
+		pGlint->mskoff = 0;
+		pGlint->mskpitch = 0;
+		pGlint->mskformat = 0;
+	}
+	if (pSrc != NULL) {
+		pGlint->source_is_solid = 
+		   ((pSrc->drawable.width == 1) && (pSrc->drawable.height == 1));
+		pGlint->srcoff = exaGetPixmapOffset(pSrc);
+		pGlint->srcpitch = exaGetPixmapPitch(pSrc);
+		if (pGlint->source_is_solid) {
+			pGlint->fillcolour = exaGetPixmapFirstPixel(pSrc);
+		}
+	}
+	pGlint->srcformat = pSrcPicture->format;
+	pGlint->dstformat = pDstPicture->format;
+
+
+	pGlint->op = op;
+	/* first things first */
+	if (pGlint->source_is_solid)
+		goto ok;
+	if (pGlint->mskpitch == 0)
+		goto ok;
+	DPRINTF(X_ERROR, "nope\n");
+	return FALSE;
+ok:
+	GLINT_WAIT(10);
+	GLINT_WRITE_REG(UNIT_DISABLE, ColorDDAMode);
+	LOADROP(GXcopy);
+	GLINT_WRITE_REG(0, QStart);
+	GLINT_WRITE_REG(0, dQdx);
+	GLINT_WRITE_REG(0, dQdyDom);
+	GLINT_WRITE_REG(0x20, PMTextureDataFormat);
+	GLINT_WRITE_REG(1 << 20, dSdx);
+	GLINT_WRITE_REG(0, dSdyDom);
+	GLINT_WRITE_REG(0, dTdx);
+	GLINT_WRITE_REG(1 << 20, dTdyDom);
+	return TRUE;
+}
+
+void
+Pm2Comp_Over32Solid(ScrnInfoPtr pScrn, int maskX, int maskY,
+				     int dstX, int dstY,
+				     int width, int height)
+{
+	GLINTPtr pGlint = GLINTPTR(pScrn);
+	unsigned long pp;
+	uint32_t *m;
+	int i, j;
+
+	ENTER;
+
+	/* first blit the source colour into the mask */
+	GLINT_WAIT(8);
+	GLINT_WRITE_REG(UNIT_DISABLE, AlphaBlendMode);
+	GLINT_WRITE_REG(UNIT_DISABLE, DitherMode);
+	GLINT_WRITE_REG(CFBRM_Packed| CWM_Enable, Config);
+	GLINT_WRITE_REG(pGlint->fillcolour, FBBlockColor);
+	DO_PLANEMASK(0x00ffffff);	/* preserve alpha */
+       	Permedia2LoadCoord(pScrn, maskX, maskY + pGlint->mskoff / pGlint->mskpitch, width, height);
+	GLINT_WRITE_REG(
+	    PrimitiveRectangle | XPositive | YPositive | FastFillEnable,
+	    Render);
+
+	/* now do the actual rendering */
+	GLINT_WAIT(15);
+
+	/* enable alpha blending */
+	GLINT_WRITE_REG(
+	    ABM_SrcSRC_ALPHA | ABM_DstONE_MINUS_SRC_ALPHA |
+	    ABM_ColorOrderRGB | UNIT_ENABLE, AlphaBlendMode);
+
+	/* not sure if we need this, everything is in ARGB anyway */
+	GLINT_WRITE_REG(UNIT_ENABLE | DTM_ColorOrderRGB, DitherMode);
+
+	/* setup for drawing the dst rectangle... */
+	GLINT_WRITE_REG(CFBRM_DstEnable | /*CFBRM_Packed|*/ CWM_Enable, Config);
+       	Permedia2LoadCoord(pScrn, dstX, dstY, width, height);
+       	/* point at the texture, 1:1 mapping etc. */
+	GLINT_WRITE_REG(pGlint->mskoff >> 2, PMTextureBaseAddress);
+	GLINT_WRITE_REG(1 | 0xb << 9 | 0xb << 13 | 1 << 1 | 1 << 3, PMTextureReadMode);		
+	GLINT_WRITE_REG(1 | TextureModeCopy, TextureColorMode);		
+	GLINT_WRITE_REG(1, TextureAddressMode);
+	GLINT_WRITE_REG(maskX << 20, SStart);
+	GLINT_WRITE_REG(maskY << 20, TStart);
+	GLINT_WRITE_REG(PrimitiveRectangle | XPositive | YPositive | TextureEnable,
+	    Render);
+}
+
+void
+Pm2Comp_Op32(ScrnInfoPtr pScrn, int op, int srcX, int srcY,
+				     int dstX, int dstY,
+				     int width, int height)
+{
+	GLINTPtr pGlint = GLINTPTR(pScrn);
+
+	ENTER;
+
+	GLINT_WAIT(8);
+	DO_PLANEMASK(0xffffffff);
+	
+	GLINT_WRITE_REG(
+	    Pm2BlendOps[op] |
+	    ABM_ColorOrderRGB | UNIT_ENABLE, AlphaBlendMode);
+	GLINT_WRITE_REG(UNIT_ENABLE | DTM_ColorOrderRGB, DitherMode);
+	GLINT_WRITE_REG(CFBRM_DstEnable | /*CFBRM_Packed|*/ CWM_Enable, Config);
+       	Permedia2LoadCoord(pScrn, dstX, dstY, width, height);
+	GLINT_WRITE_REG(pGlint->srcoff >> 2, PMTextureBaseAddress);
+	GLINT_WRITE_REG(1 | 0xb << 9 | 0xb << 13 | 1 << 1 | 1 << 3, PMTextureReadMode);		
+	GLINT_WRITE_REG(1 | TextureModeCopy, TextureColorMode);		
+	GLINT_WRITE_REG(1, TextureAddressMode);
+	GLINT_WRITE_REG(srcX << 20, SStart);
+	GLINT_WRITE_REG(srcY << 20, TStart);
+	GLINT_WRITE_REG(PrimitiveRectangle | XPositive | YPositive | TextureEnable,
+	    Render);
+}
+
+void
+Pm2Composite(PixmapPtr pDst, int srcX, int srcY,
+                              int maskX, int maskY,
+                              int dstX, int dstY,
+                              int width, int height)
+{
+	ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
+	GLINTPtr pGlint   = GLINTPTR(pScrn);
+	uint32_t dstoff, dstpitch;
+
+	ENTER;
+	dstoff = exaGetPixmapOffset(pDst);		
+	dstpitch = exaGetPixmapPitch(pDst);
+	dstY += dstoff / dstpitch;
+	if (pGlint->source_is_solid) {
+		switch (pGlint->op) {
+			case PictOpOver:
+				DPRINTF(X_ERROR, "Over %08x %08x, %d %d\n",
+				    pGlint->mskformat, pGlint->dstformat, dstX, dstY);
+				switch (pGlint->mskformat) {
+					case PICT_a8r8g8b8:
+					case PICT_a8b8g8r8:
+						Pm2Comp_Over32Solid(pScrn,
+						    maskX, maskY,
+						    dstX, dstY,
+						    width, height);
+						break;
+					default:
+						xf86Msg(X_ERROR,
+						  "unsupported mask format\n");
+				}
+				break;
+			default:
+				xf86Msg(X_ERROR, "unsupported op %d\n", pGlint->op);
+		}
+	} else {
+		Pm2Comp_Op32(pScrn, pGlint->op, srcX, srcY, dstX, dstY, width, height);
+	}
+}
+
+Bool
 Pm2InitEXA(ScreenPtr pScreen)
 {
 	ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
@@ -312,6 +607,7 @@ Pm2InitEXA(ScreenPtr pScreen)
 	stride = pScrn->displayWidth * (pScrn->bitsPerPixel >> 3);
 	lines = min(pGlint->FbMapSize / stride, 2047);
 	pExa->memorySize = lines * stride;
+	pExa->offScreenBase = stride * pScrn->virtualY;
 	DPRINTF(X_ERROR, "stride: %d\n", stride);
 	DPRINTF(X_ERROR, "pprod: %08x\n", pGlint->pprod);
 	pExa->offScreenBase = stride * pScrn->virtualY;
@@ -322,8 +618,8 @@ Pm2InitEXA(ScreenPtr pScreen)
 
 	pExa->flags = EXA_OFFSCREEN_PIXMAPS;
 
-	pExa->maxX = 2048;
-	pExa->maxY = 2048;
+	pExa->maxX = 2047;
+	pExa->maxY = 2047;
 
 	pExa->WaitMarker = Pm2WaitMarker;
 
@@ -334,12 +630,17 @@ Pm2InitEXA(ScreenPtr pScreen)
 	pExa->Copy = Pm2Copy;
 	pExa->DoneCopy = Pm2DoneCopy;
 
-	/* EXA hits more optimized paths when it does not have to fallback 
-	 * because of missing UTS/DFS, hook memcpy-based UTS/DFS.
-	 */
+	if (pGlint->render) {
+		pExa->CheckComposite = Pm2CheckComposite;
+		pExa->PrepareComposite = Pm2PrepareComposite;
+		pExa->Composite = Pm2Composite;
+		pExa->DoneComposite = Pm2DoneCopy;
+	}
+
+if (0) {
 	pExa->UploadToScreen = Pm2UploadToScreen;
 	pExa->DownloadFromScreen = Pm2DownloadFromScreen;
-
+}
 	Permedia2InitializeEngine(pScrn);
 
 	return exaDriverInit(pScreen, pExa);

Reply via email to