Module Name:    xsrc
Committed By:   macallan
Date:           Wed Dec 14 20:34:17 UTC 2016

Modified Files:
        xsrc/external/mit/xf86-video-glint/dist/src: pm3_exa.c

Log Message:
no more constant pitch, now we can use all video memory


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
    xsrc/external/mit/xf86-video-glint/dist/src/pm3_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/pm3_exa.c
diff -u xsrc/external/mit/xf86-video-glint/dist/src/pm3_exa.c:1.4 xsrc/external/mit/xf86-video-glint/dist/src/pm3_exa.c:1.5
--- xsrc/external/mit/xf86-video-glint/dist/src/pm3_exa.c:1.4	Wed Dec 14 16:51:44 2016
+++ xsrc/external/mit/xf86-video-glint/dist/src/pm3_exa.c	Wed Dec 14 20:34:17 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: pm3_exa.c,v 1.4 2016/12/14 16:51:44 macallan Exp $ */
+/* $NetBSD: pm3_exa.c,v 1.5 2016/12/14 20:34:17 macallan Exp $ */
 
 /*
  * Copyright (c) 2016 Michael Lorenz
@@ -73,6 +73,10 @@ Pm3PrepareCopy(PixmapPtr pSrcPixmap, Pix
 {
 	ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum];
 	GLINTPtr pGlint = GLINTPTR(pScrn);
+	int dstoff = exaGetPixmapOffset(pDstPixmap);
+	int dstpitch = exaGetPixmapPitch(pDstPixmap);
+	int srcoff = exaGetPixmapOffset(pSrcPixmap);
+	int srcpitch = exaGetPixmapPitch(pSrcPixmap);
 
 	ENTER;
 
@@ -99,7 +103,21 @@ Pm3PrepareCopy(PixmapPtr pSrcPixmap, Pix
 
 	pGlint->srcoff = exaGetPixmapOffset(pSrcPixmap);
 
-	GLINT_WAIT(2);
+	GLINT_WAIT(10);
+	GLINT_WRITE_REG(dstoff, PM3FBWriteBufferAddr0);
+	GLINT_WRITE_REG(dstpitch >> 2, PM3FBWriteBufferWidth0);
+	GLINT_WRITE_REG(dstoff, PM3FBDestReadBufferAddr0);
+	GLINT_WRITE_REG(dstpitch >> 2, PM3FBDestReadBufferWidth0);
+	GLINT_WRITE_REG(srcoff, PM3FBSourceReadBufferAddr);
+	GLINT_WRITE_REG(srcpitch >> 2, PM3FBSourceReadBufferWidth);
+	GLINT_WRITE_REG(PM3FBWriteMode_WriteEnable|
+		PM3FBWriteMode_OpaqueSpan|
+		PM3FBWriteMode_Enable0,
+		PM3FBWriteMode);
+	GLINT_WRITE_REG(
+		PM3FBDestReadMode_ReadEnable |
+		PM3FBDestReadMode_Enable0,
+		PM3FBDestReadMode);
 	PM3_PLANEMASK(planemask);
 	GLINT_WRITE_REG(pGlint->PM3_Config2D, PM3Config2D);
 	return TRUE;
@@ -113,15 +131,9 @@ Pm3Copy(PixmapPtr pDstPixmap,
 	GLINTPtr pGlint = GLINTPTR(pScrn);
 	/* Spans needs to be 32 bit aligned. */
 	int x_align = srcX & 0x1f;
-	int dstoff = exaGetPixmapOffset(pDstPixmap);
-	int pitch = exaGetPixmapPitch(pDstPixmap);
 	
 	ENTER;
 
-	/* assuming constant pitch for now */	
-	srcY += pGlint->srcoff / pitch;
-	dstY += dstoff / pitch;
-
 	GLINT_WAIT(5);
 	GLINT_WRITE_REG(((dstY & 0x0fff) << 16) | (dstX & 0x0fff), ScissorMinXY);
 	GLINT_WRITE_REG((((dstY + h) & 0x0fff) << 16) | ((dstX + w) & 0x0fff), ScissorMaxXY);
@@ -155,9 +167,24 @@ Pm3PrepareSolid(PixmapPtr pPixmap, int r
 {
 	ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
 	GLINTPtr pGlint = GLINTPTR(pScrn);
+	int offset = exaGetPixmapOffset(pPixmap);
+	int pitch = exaGetPixmapPitch(pPixmap);
 
 	ENTER;
 
+	GLINT_WAIT(6);
+	GLINT_WRITE_REG(offset, PM3FBWriteBufferAddr0);
+	GLINT_WRITE_REG(pitch >> 2, PM3FBWriteBufferWidth0);
+	GLINT_WRITE_REG(offset, PM3FBDestReadBufferAddr0);
+	GLINT_WRITE_REG(pitch >> 2, PM3FBDestReadBufferWidth0);
+	GLINT_WRITE_REG(PM3FBWriteMode_WriteEnable|
+		PM3FBWriteMode_OpaqueSpan|
+		PM3FBWriteMode_Enable0,
+		PM3FBWriteMode);
+	GLINT_WRITE_REG(
+		PM3FBDestReadMode_ReadEnable |
+		PM3FBDestReadMode_Enable0,
+		PM3FBDestReadMode);
 	/* Prepare Common Render2D & Config2D data */
 	pGlint->PM3_Render2D =
 		PM3Render2D_XPositive |
@@ -223,14 +250,10 @@ Pm3Solid(PixmapPtr pPixmap, int x1, int 
 {
 	ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
 	GLINTPtr pGlint = GLINTPTR(pScrn);
-	int offset = exaGetPixmapOffset(pPixmap);
-	int pitch = exaGetPixmapPitch(pPixmap);
 	int w = x2 - x1, h = y2 - y1;
 
 	ENTER;
 
-	y1 += offset / pitch;
-
 	GLINT_WAIT(2);
 	GLINT_WRITE_REG(
 		PM3RectanglePosition_XOffset(x1) |
@@ -308,7 +331,7 @@ Pm3InitEXA(ScreenPtr pScreen)
 	ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
 	GLINTPtr pGlint = GLINTPTR(pScrn);
 	ExaDriverPtr pExa;
-	int stride, lines;
+	int stride;
 
 	ENTER;
 
@@ -323,14 +346,12 @@ Pm3InitEXA(ScreenPtr pScreen)
 
 	pExa->memoryBase = pGlint->FbBase;
 	stride = pScrn->displayWidth * (pScrn->bitsPerPixel >> 3);
-	lines = min(pGlint->FbMapSize / stride, 4095);
-	pExa->memorySize = lines * stride;
-	xf86Msg(X_ERROR, "stride: %d\n", stride);
+	pExa->offScreenBase = stride * pScrn->virtualY;
+	pExa->memorySize = pGlint->FbMapSize;
 	pExa->offScreenBase = stride * pScrn->virtualY;
 
-	/* for now, until I figure out how to do variable stride */
-	pExa->pixmapOffsetAlign = stride;
-	pExa->pixmapPitchAlign = stride;
+	pExa->pixmapOffsetAlign = 32;
+	pExa->pixmapPitchAlign = 32;
 
 	pExa->flags = EXA_OFFSCREEN_PIXMAPS;
 

Reply via email to