CVS commit: xsrc/external/mit/xf86-video-suncg14/dist/src

2019-02-28 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Fri Mar  1 02:22:27 UTC 2019

Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14_accel.c

Log Message:
poll SX_BZ instead of SX_MT, also complain and dump register info if CG14Wait()
times out.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.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-suncg14/dist/src/cg14_accel.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.13 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.14
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.13	Thu Dec  7 19:23:22 2017
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c	Fri Mar  1 02:22:27 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: cg14_accel.c,v 1.13 2017/12/07 19:23:22 macallan Exp $ */
+/* $NetBSD: cg14_accel.c,v 1.14 2019/03/01 02:22:27 macallan Exp $ */
 /*
  * Copyright (c) 2013 Michael Lorenz
  * All rights reserved.
@@ -69,8 +69,17 @@ static void CG14Copy8(PixmapPtr, int, in
 static inline void
 CG14Wait(Cg14Ptr p)
 {
-	/* we just wait until the instruction queue is empty */
-	while ((read_sx_reg(p, SX_CONTROL_STATUS) & SX_MT) != 0) {};
+	int bail = 1000;
+	/* we wait for the busy bit to clear */
+	while (((read_sx_reg(p, SX_CONTROL_STATUS) & SX_BZ) != 0) &&
+	   (bail > 0)) {
+		bail--;
+	};
+	if (bail == 0) {
+		xf86Msg(X_ERROR, "SX wait for idle timed out %08x %08x\n",
+		read_sx_reg(p, SX_CONTROL_STATUS),
+		read_sx_reg(p, SX_ERROR));
+	}
 }
 
 static void



CVS commit: xsrc/external/mit/xf86-video-suncg14/dist/src

2017-12-08 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Fri Dec  8 22:49:37 UTC 2017

Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14_render.c

Log Message:
do up to 4 pixels at a time CG14Comp_Over*()


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.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-suncg14/dist/src/cg14_render.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.11 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.12
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.11	Thu Dec  7 19:23:22 2017
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c	Fri Dec  8 22:49:37 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: cg14_render.c,v 1.11 2017/12/07 19:23:22 macallan Exp $ */
+/* $NetBSD: cg14_render.c,v 1.12 2017/12/08 22:49:37 macallan Exp $ */
 /*
  * Copyright (c) 2013 Michael Lorenz
  * All rights reserved.
@@ -471,8 +471,8 @@ void CG14Comp_Over32(Cg14Ptr p,
uint32_t dst, uint32_t dstpitch,
int width, int height, int flip)
 {
-	uint32_t srcx, dstx, m;
-	int line, x, i;
+	uint32_t srcx, dstx, mskx, m;
+	int line, x, i, num;
 
 	ENTER;
 
@@ -481,33 +481,44 @@ void CG14Comp_Over32(Cg14Ptr p,
 		srcx = src;
 		dstx = dst;
 
-		for (x = 0; x < width; x++) {
-			/* fetch source pixel */
-			write_sx_io(p, srcx, SX_LDUQ0(12, 0, srcx & 7));
+		for (x = 0; x < width; x += 4) {
+			/* we do up to 4 pixels at a time */
+			num = min(4, width - x);
+			if (num <= 0) {
+xf86Msg(X_ERROR, "wtf?!\n");
+continue;
+			}
+			/* fetch source pixels */
+			write_sx_io(p, srcx, SX_LDUQ0(12, num - 1, srcx & 7));
 			if (flip) {
 write_sx_reg(p, SX_INSTRUCTIONS,
-SX_ORS(13, 0, 40, 0));
+SX_GATHER(13, 4, 40, num - 1));
 write_sx_reg(p, SX_INSTRUCTIONS,
-SX_ORS(15, 0, 13, 0));
+SX_GATHER(15, 4, 44, num - 1));
 write_sx_reg(p, SX_INSTRUCTIONS,
-SX_ORS(40, 0, 15, 0));
+SX_SCATTER(40, 4, 15, num - 1));
+write_sx_reg(p, SX_INSTRUCTIONS,
+SX_SCATTER(44, 4, 13, num - 1));
+			}
+			/* fetch dst pixels */
+			write_sx_io(p, dstx, SX_LDUQ0(44, num - 1, dstx & 7));
+			/* now process up to 4 pixels */
+			for (i = 0; i < num; i++) {
+int ii = i << 2;
+/* write inverted alpha into SCAM */
+write_sx_reg(p, SX_INSTRUCTIONS,
+SX_XORS(12 + ii, 8, R_SCAM, 0));
+/* dst * (1 - alpha) + src */
+write_sx_reg(p, SX_INSTRUCTIONS,
+SX_SAXP16X16SR8(44 + ii, 12 + ii, 76 + ii, 3));
 			}
-			/* fetch dst pixel */
-			write_sx_io(p, dstx, SX_LDUQ0(20, 0, dstx & 7));
-			/* src is premultiplied with alpha */
-			/* write inverted alpha into SCAM */
-			write_sx_reg(p, SX_INSTRUCTIONS,
-			SX_XORV(12, 8, R_SCAM, 0));
-			/* dst * (1 - alpha) + R[13:15] */
-			write_sx_reg(p, SX_INSTRUCTIONS,
-			SX_SAXP16X16SR8(20, 12, 24, 3));
 			write_sx_io(p, dstx,
-			SX_STUQ0C(24, 0, dstx & 7));
-			dstx += 4;
-			srcx += 4;
+			SX_STUQ0C(76, num - 1, dstx & 7));
+			srcx += 16;
+			dstx += 16;
 		}
-		dst += dstpitch;
 		src += srcpitch;
+		dst += dstpitch;
 	}
 }
 
@@ -518,7 +529,7 @@ void CG14Comp_Over32Mask(Cg14Ptr p,
int width, int height, int flip)
 {
 	uint32_t srcx, dstx, mskx, m;
-	int line, x, i;
+	int line, x, i, num;
 
 	ENTER;
 
@@ -528,39 +539,50 @@ void CG14Comp_Over32Mask(Cg14Ptr p,
 		mskx = msk;
 		dstx = dst;
 
-		for (x = 0; x < width; x++) {
-			/* fetch source pixel */
-			write_sx_io(p, srcx, SX_LDUQ0(12, 0, srcx & 7));
+		for (x = 0; x < width; x += 4) {
+			/* we do up to 4 pixels at a time */
+			num = min(4, width - x);
+			if (num <= 0) {
+xf86Msg(X_ERROR, "wtf?!\n");
+continue;
+			}
+			/* fetch source pixels */
+			write_sx_io(p, srcx, SX_LDUQ0(12, num - 1, srcx & 7));
 			if (flip) {
 write_sx_reg(p, SX_INSTRUCTIONS,
-SX_ORS(13, 0, 40, 0));
+SX_GATHER(13, 4, 40, num - 1));
+write_sx_reg(p, SX_INSTRUCTIONS,
+SX_GATHER(15, 4, 44, num - 1));
 write_sx_reg(p, SX_INSTRUCTIONS,
-SX_ORS(15, 0, 13, 0));
+SX_SCATTER(40, 4, 15, num - 1));
 write_sx_reg(p, SX_INSTRUCTIONS,
-SX_ORS(40, 0, 15, 0));
+SX_SCATTER(44, 4, 13, num - 1));
 			}
 			/* fetch mask */
-			write_sx_io(p, mskx & (~7), SX_LDB(9, 0, mskx & 7));
-			/* fetch dst pixel */
-			write_sx_io(p, dstx, SX_LDUQ0(20, 0, dstx & 7));
-			/* stick mask alpha into SCAM */
-			write_sx_reg(p, SX_INSTRUCTIONS,
-			SX_ORS(9, 0, R_SCAM, 0));
-			/* apply mask */
-			/* src is premultiplied with alpha */
-			write_sx_reg(p, SX_INSTRUCTIONS,
-			SX_SAXP16X16SR8(12, 0, 16, 3));
-			/* write inverted alpha into SCAM */
-			write_sx_reg(p, SX_INSTRUCTIONS,
-			SX_XORV(16, 8, R_SCAM, 0));
-			/* dst * (1 - alpha) + R[13:15] */
-			

CVS commit: xsrc/external/mit/xf86-video-suncg14/dist/src

2017-12-07 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Thu Dec  7 19:23:22 UTC 2017

Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14.h cg14_accel.c
cg14_render.c

Log Message:
RGB/BGR-flip source images in CG14Comp_Over32*() with non-solid sources
as well. This takes care of most remaining RGB/BGR issues in xrender.
Next step: do more than one pixel at a time in those operations.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c
cvs rdiff -u -r1.10 -r1.11 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.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-suncg14/dist/src/cg14.h
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.12 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.13
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.12	Mon Oct 30 22:09:54 2017
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h	Thu Dec  7 19:23:22 2017
@@ -135,13 +135,13 @@ void CG14Comp_Over8Solid(Cg14Ptr, uint32
 void CG14Comp_Over32Solid(Cg14Ptr, uint32_t, uint32_t, uint32_t, uint32_t,
int, int);
 void CG14Comp_Over32(Cg14Ptr, uint32_t, uint32_t, uint32_t, uint32_t,
-   int, int);
+   int, int, int);
 void CG14Comp_Over32Mask(Cg14Ptr, uint32_t, uint32_t, uint32_t, uint32_t,
-   uint32_t, uint32_t, int, int);
+   uint32_t, uint32_t, int, int, int);
 void CG14Comp_Over32Mask_noalpha(Cg14Ptr, uint32_t, uint32_t, uint32_t,
-		   uint32_t, uint32_t, uint32_t, int, int);
+		   uint32_t, uint32_t, uint32_t, int, int, int);
 void CG14Comp_Over32Mask32_noalpha(Cg14Ptr, uint32_t, uint32_t, uint32_t,
-		   uint32_t, uint32_t, uint32_t, int, int);
+		   uint32_t, uint32_t, uint32_t, int, int, int);
 void CG14Comp_Add8(Cg14Ptr, uint32_t, uint32_t, uint32_t, uint32_t,
int, int);
 void CG14Comp_Add8_32(Cg14Ptr, uint32_t, uint32_t, uint32_t, uint32_t,
Index: xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.12 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.13
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.12	Mon Oct 30 22:09:54 2017
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c	Thu Dec  7 19:23:22 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: cg14_accel.c,v 1.12 2017/10/30 22:09:54 macallan Exp $ */
+/* $NetBSD: cg14_accel.c,v 1.13 2017/12/07 19:23:22 macallan Exp $ */
 /*
  * Copyright (c) 2013 Michael Lorenz
  * All rights reserved.
@@ -888,11 +888,15 @@ CG14Composite(PixmapPtr pDst, int srcX, 
 	Cg14Ptr p = GET_CG14_FROM_SCRN(pScrn);
 	uint32_t dstoff, dstpitch;
 	uint32_t dst, msk, src;
+	int flip = 0;
 
 	ENTER;
 	dstoff = exaGetPixmapOffset(pDst);		
 	dstpitch = exaGetPixmapPitch(pDst);
 
+	flip = (PICT_FORMAT_TYPE(p->srcformat) !=
+		PICT_FORMAT_TYPE(p->dstformat));
+
 	switch (p->op) {
 		case PictOpOver:
 			dst = dstoff + (dstY * dstpitch) + (dstX << 2);
@@ -943,12 +947,12 @@ CG14Composite(PixmapPtr pDst, int srcX, 
 			src, p->srcpitch,
 			msk, p->mskpitch,
 			dst, dstpitch,
-			width, height);
+			width, height, flip);
 		} else {
 			CG14Comp_Over32(p, 
 			src, p->srcpitch,
 			dst, dstpitch,
-			width, height);
+			width, height, flip);
 		}
 		break;
 	case PICT_x8r8g8b8:
@@ -967,7 +971,7 @@ CG14Composite(PixmapPtr pDst, int srcX, 
 			src, p->srcpitch,
 			msk, p->mskpitch,
 			dst, dstpitch,
-			width, height);
+			width, height, flip);
 		} else if ((p->mskformat == PICT_a8r8g8b8) ||
 			   (p->mskformat == PICT_a8b8g8r8)) {
 			msk = p->mskoff + 
@@ -977,7 +981,7 @@ CG14Composite(PixmapPtr pDst, int srcX, 
 			src, p->srcpitch,
 			msk, p->mskpitch,
 			dst, dstpitch,
-			width, height);
+			width, height, flip);
 		} else {
 			xf86Msg(X_ERROR, "no src alpha, mask is %x\n", p->mskformat);
 		}

Index: xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.10 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.11
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.10	Mon Oct 30 22:09:54 2017
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c	Thu Dec  7 19:23:22 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: cg14_render.c,v 1.10 2017/10/30 22:09:54 macallan Exp $ */
+/* $NetBSD: cg14_render.c,v 1.11 2017/12/07 19:23:22 macallan Exp $ */
 /*
  * Copyright (c) 2013 Michael Lorenz
  * All rights reserved.
@@ -469,7 +469,7 @@ void CG14Comp_Add8_32(Cg14Ptr p,
 void 

CVS commit: xsrc/external/mit/xf86-video-suncg14/dist/src

2017-10-30 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Mon Oct 30 22:09:54 UTC 2017

Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14.h cg14_accel.c
cg14_render.c

Log Message:
support PictOpAdd with A8 source and ARGB/ABGR destination
now labels in windowmaker look right again


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c
cvs rdiff -u -r1.9 -r1.10 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.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-suncg14/dist/src/cg14.h
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.11 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.12
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.11	Tue Apr 29 08:40:58 2014
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h	Mon Oct 30 22:09:54 2017
@@ -144,6 +144,8 @@ void CG14Comp_Over32Mask32_noalpha(Cg14P
 		   uint32_t, uint32_t, uint32_t, int, int);
 void CG14Comp_Add8(Cg14Ptr, uint32_t, uint32_t, uint32_t, uint32_t,
int, int);
+void CG14Comp_Add8_32(Cg14Ptr, uint32_t, uint32_t, uint32_t, uint32_t,
+   int, int);
 void CG14Comp_Add32(Cg14Ptr, uint32_t, uint32_t, uint32_t, uint32_t,
int, int);
 
Index: xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.11 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.12
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.11	Sat Jan 14 00:20:16 2017
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c	Mon Oct 30 22:09:54 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: cg14_accel.c,v 1.11 2017/01/14 00:20:16 macallan Exp $ */
+/* $NetBSD: cg14_accel.c,v 1.12 2017/10/30 22:09:54 macallan Exp $ */
 /*
  * Copyright (c) 2013 Michael Lorenz
  * All rights reserved.
@@ -995,9 +995,22 @@ CG14Composite(PixmapPtr pDst, int srcX, 
 case PICT_a8:
 	src = p->srcoff +
 	(srcY * p->srcpitch) + srcX;
-	dst = dstoff + (dstY * dstpitch) + dstX;
-	CG14Comp_Add8(p, src, p->srcpitch,
-	dst, dstpitch, width, height);
+	if (p->dstformat == PICT_a8) {
+		dst = dstoff + 
+		  (dstY * dstpitch) + dstX;
+		CG14Comp_Add8(p,
+		src, p->srcpitch,
+		dst, dstpitch,
+		width, height);
+	} else {
+		dst = dstoff + 
+		  (dstY * dstpitch) +
+		  (dstX << 2);
+		CG14Comp_Add8_32(p,
+		src, p->srcpitch,
+		dst, dstpitch,
+		width, height);
+	}
 	break;
 case PICT_a8r8g8b8:
 case PICT_x8r8g8b8:

Index: xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.9 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.10
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.9	Fri Sep 16 22:07:25 2016
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c	Mon Oct 30 22:09:54 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: cg14_render.c,v 1.9 2016/09/16 22:07:25 macallan Exp $ */
+/* $NetBSD: cg14_render.c,v 1.10 2017/10/30 22:09:54 macallan Exp $ */
 /*
  * Copyright (c) 2013 Michael Lorenz
  * All rights reserved.
@@ -395,6 +395,77 @@ void CG14Comp_Add8(Cg14Ptr p,
 	}
 }
 
+void CG14Comp_Add8_32(Cg14Ptr p,
+   uint32_t src, uint32_t srcpitch,
+   uint32_t dst, uint32_t dstpitch,
+   int width, int height)
+{
+	int line;
+	uint32_t srcx, dstx, srcoff, dstoff;
+	int pre, full, part, x;
+	uint8_t *d;
+	char buffer[256];
+	ENTER;
+
+	srcoff = src & 7;
+	src &= ~7;
+	dstoff = dst & 7;
+	dst &= ~7;
+	full = width >> 5;	/* chunks of 32 */
+	part = width & 31;	/* leftovers */
+
+#ifdef SX_DEBUG
+	xf86Msg(X_ERROR, "%d %d, %d x %d, %d %d\n", srcpitch, dstpitch,
+	width, height, full, part);
+#endif
+	/* we do this up to 32 pixels at a time */
+	for (line = 0; line < height; line++) {
+		srcx = src;
+		dstx = dst;
+		for (x = 0; x < full; x++) {
+			/* load source bytes */
+			write_sx_io(p, srcx, SX_LDB(8, 31, srcoff));
+			/* load alpha from destination */
+			write_sx_io(p, dstx, SX_LDUC0(40, 31, dstoff));
+			write_sx_reg(p, SX_INSTRUCTIONS,
+			SX_ADDV(8, 40, 72, 15));
+			write_sx_reg(p, SX_INSTRUCTIONS,
+			SX_ADDV(24, 56, 88, 15));
+			/* write clamped values back into dest alpha */
+			write_sx_io(p, dstx, SX_STUC0C(72, 31, dstoff));
+			srcx += 32;
+			dstx += 128;
+		}
+
+		if (part > 0) {
+			/* do leftovers */
+			write_sx_io(p, srcx, SX_LDB(8, part - 1, srcoff));
+			write_sx_io(p, dstx, SX_LDUC0(40, part - 1, dstoff));
+			if (part > 16) {
+write_sx_reg(p, SX_INSTRUCTIONS,
+SX_ADDV(8, 40, 72, 15));
+write_sx_reg(p, 

CVS commit: xsrc/external/mit/xf86-video-suncg14/dist/src

2017-01-13 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Sat Jan 14 00:20:16 UTC 2017

Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14_accel.c

Log Message:
handle 8bit pixmaps in CG14PrepareCopy(), now the glyph cache works properly


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.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-suncg14/dist/src/cg14_accel.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.10 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.11
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.10	Fri Jan 13 20:58:40 2017
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c	Sat Jan 14 00:20:16 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: cg14_accel.c,v 1.10 2017/01/13 20:58:40 macallan Exp $ */
+/* $NetBSD: cg14_accel.c,v 1.11 2017/01/14 00:20:16 macallan Exp $ */
 /*
  * Copyright (c) 2013 Michael Lorenz
  * All rights reserved.
@@ -63,6 +63,9 @@ int src_formats[] = {PICT_a8r8g8b8, PICT
 		 PICT_a8b8g8r8, PICT_x8b8g8r8, PICT_a8};
 int tex_formats[] = {PICT_a8r8g8b8, PICT_a8b8g8r8, PICT_a8};
 
+static void CG14Copy32(PixmapPtr, int, int, int, int, int, int);
+static void CG14Copy8(PixmapPtr, int, int, int, int, int, int);
+
 static inline void
 CG14Wait(Cg14Ptr p)
 {
@@ -101,6 +104,17 @@ CG14PrepareCopy(PixmapPtr pSrcPixmap, Pi
 		write_sx_reg(p, SX_ROP_CONTROL, alu);
 		p->last_rop = alu;
 	}
+	switch (pSrcPixmap->drawable.bitsPerPixel)  {
+		case 8:
+			p->pExa->Copy = CG14Copy8;
+			break;
+		case 32:
+			p->pExa->Copy = CG14Copy32;
+			break;
+		default:
+			xf86Msg(X_ERROR, "%s depth %d\n", __func__,
+			pSrcPixmap->drawable.bitsPerPixel);
+	}
 	p->srcpitch = exaGetPixmapPitch(pSrcPixmap);
 	p->srcoff = exaGetPixmapOffset(pSrcPixmap);
 	p->xdir = xdir;
@@ -109,7 +123,7 @@ CG14PrepareCopy(PixmapPtr pSrcPixmap, Pi
 }
 
 static void
-CG14Copy(PixmapPtr pDstPixmap,
+CG14Copy32(PixmapPtr pDstPixmap,
  int srcX, int srcY, int dstX, int dstY, int w, int h)
 {
 	ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum];
@@ -284,6 +298,181 @@ CG14Copy(PixmapPtr pDstPixmap,
 }
 
 static void
+CG14Copy8(PixmapPtr pDstPixmap,
+ int srcX, int srcY, int dstX, int dstY, int w, int h)
+{
+	ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum];
+	Cg14Ptr p = GET_CG14_FROM_SCRN(pScrn);
+	int dstpitch, dstoff, srcpitch, srcoff;
+	int srcstart, dststart, xinc, srcinc, dstinc;
+	int line, count, s, d, num;
+
+	ENTER;
+	dstpitch = exaGetPixmapPitch(pDstPixmap);
+	dstoff = exaGetPixmapOffset(pDstPixmap);
+	srcpitch = p->srcpitch;
+	srcoff = p->srcoff;
+	/*
+	 * should clear the WO bit in SX_CONTROL_STATUS, then check if SX
+	 * actually wrote anything and only sync if it did
+	 */
+	srcstart = srcX + (srcpitch * srcY) + srcoff;
+	dststart = dstX + (dstpitch * dstY) + dstoff;
+
+	/*
+	 * we always copy up to 32 pixels at a time so direction doesn't
+	 * matter if w<=32
+	 */
+	if (w > 32) {
+		if (p->xdir < 0) {
+			srcstart += (w - 32);
+			dststart += (w - 32);
+			xinc = -32;
+		} else
+			xinc = 32;
+	} else
+		xinc = 32;
+	if (p->ydir < 0) {
+		srcstart += (h - 1) * srcpitch;
+		dststart += (h - 1) * dstpitch;
+		srcinc = -srcpitch;
+		dstinc = -dstpitch;
+	} else {
+		srcinc = srcpitch;
+		dstinc = dstpitch;
+	}
+	if (p->last_rop == 0xcc) {
+		/* plain old copy */
+		if ( xinc > 0) {
+			/* going left to right */
+			for (line = 0; line < h; line++) {
+count = 0;
+s = srcstart;
+d = dststart;
+while ( count < w) {
+	num = min(32, w - count);
+	write_sx_io(p, s,
+	SX_LDB(10, num - 1, s & 7));
+	write_sx_io(p, d,
+	SX_STBM(10, num - 1, d & 7));
+	s += xinc;
+	d += xinc;
+	count += 32;
+}
+srcstart += srcinc;
+dststart += dstinc;
+			}
+		} else {
+			/* going right to left */
+			int i, chunks = (w >> 5);
+			for (line = 0; line < h; line++) {
+s = srcstart;
+d = dststart;
+count = w;
+for (i = 0; i < chunks; i++) {
+	write_sx_io(p, s,
+	SX_LDB(10, 31, s & 7));
+	write_sx_io(p, d,
+	SX_STBM(10, 31, d & 7));
+	s -= 32;
+	d -= 32;
+	count -= 32;
+}
+/* leftovers, if any */
+if (count > 0) {
+	s += (32 - count);
+	d += (32 - count);
+	write_sx_io(p, s,
+	SX_LDB(10, count - 1, s & 7));
+	write_sx_io(p, d,
+	SX_STBM(10, count - 1, d & 7));
+}
+srcstart += srcinc;
+dststart += dstinc;
+			}
+		}
+	} else {
+		/* ROPs needed */
+		if ( xinc > 0) {
+			/* going left to right */
+			for (line = 0; line < h; line++) {
+count = 0;
+s = srcstart;
+d = dststart;
+while ( count < w) {
+	num = min(32, w - count);
+	write_sx_io(p, s,
+	SX_LDB(10, num - 1, s & 7));
+	write_sx_io(p, d,
+	   

CVS commit: xsrc/external/mit/xf86-video-suncg14/dist/src

2017-01-13 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Fri Jan 13 20:58:40 UTC 2017

Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14_accel.c

Log Message:
CG14CheckComposite():
- don't crash with SX_DEBUG set
- check destination format


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.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-suncg14/dist/src/cg14_accel.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.9 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.10
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.9	Fri Sep 16 22:05:47 2016
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c	Fri Jan 13 20:58:40 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: cg14_accel.c,v 1.9 2016/09/16 22:05:47 macallan Exp $ */
+/* $NetBSD: cg14_accel.c,v 1.10 2017/01/13 20:58:40 macallan Exp $ */
 /*
  * Copyright (c) 2013 Michael Lorenz
  * All rights reserved.
@@ -549,20 +549,37 @@ CG14CheckComposite(int op, PicturePtr pS
 		DPRINTF(X_ERROR, "%s: rejecting %d\n", __func__, op);
 		return FALSE;
 	}
-	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 (pSrcPicture != NULL) {
+		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;
+		}
+		DPRINTF(X_ERROR, "src is %x, %d\n", pSrcPicture->format, op);
 	}
 
-	DPRINTF(X_ERROR, "src is %x, %d: %d %d\n", pSrcPicture->format, op,
-	pSrcPicture->pDrawable->width, pSrcPicture->pDrawable->height);
+	if (pDstPicture != NULL) {
+		i = 0;
+		ok = FALSE;
+		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, "dst is %x, %d\n", pDstPicture->format, op);
+	}
 
 	if (pMaskPicture != NULL) {
 		DPRINTF(X_ERROR, "mask is %x %d %d\n", pMaskPicture->format,



CVS commit: xsrc/external/mit/xf86-video-suncg14/dist/src

2016-09-17 Thread Christos Zoulas
Module Name:xsrc
Committed By:   christos
Date:   Sun Sep 18 02:05:38 UTC 2016

Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14_driver.c

Log Message:
There is no X_DEBUG


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.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-suncg14/dist/src/cg14_driver.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c:1.13 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c:1.14
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c:1.13	Fri Sep 16 17:16:37 2016
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c	Sat Sep 17 22:05:38 2016
@@ -355,7 +355,7 @@ CG14PreInit(ScrnInfoPtr pScrn, int flags
 	if (len >= 24) {
 	memcpy(reg, ptr, 24);
 	size = reg[5];
-	xf86Msg(X_DEBUG, "memsize from reg: %d MB\n", size >> 20);
+	xf86Msg(X_INFO, "memsize from reg: %d MB\n", size >> 20);
 	if (size > pCg14->memsize)
 		pCg14->memsize = size;
 	}



CVS commit: xsrc/external/mit/xf86-video-suncg14/dist/src

2016-09-16 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Fri Sep 16 22:07:25 UTC 2016

Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14_render.c

Log Message:
do PictOpOver operations 4 pixels at a time - this is a vector processor,
let's do some vector processing
-> about 40% speed increase


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.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-suncg14/dist/src/cg14_render.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.8 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.9
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.8	Fri Sep 16 21:16:37 2016
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c	Fri Sep 16 22:07:25 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: cg14_render.c,v 1.8 2016/09/16 21:16:37 macallan Exp $ */
+/* $NetBSD: cg14_render.c,v 1.9 2016/09/16 22:07:25 macallan Exp $ */
 /*
  * Copyright (c) 2013 Michael Lorenz
  * All rights reserved.
@@ -43,11 +43,11 @@
 #include "cg14.h"
 #include 
 
-#define SX_SINGLE
+/*#define SX_SINGLE*/
 /*#define SX_RENDER_DEBUG*/
 /*#define SX_ADD_SOFTWARE*/
 
-#ifdef SX__RENDER_DEBUG
+#ifdef SX_RENDER_DEBUG
 #define ENTER xf86Msg(X_ERROR, "%s>\n", __func__);
 #define DPRINTF xf86Msg
 #else
@@ -71,8 +71,47 @@ void CG14Comp_Over32Solid(Cg14Ptr p,
 	for (line = 0; line < height; line++) {
 		mskx = msk;
 		dstx = dst;
-#ifdef SX_SINGLE
-
+#ifndef SX_SINGLE
+		int rest;
+		for (x = 0; x < width; x += 4) {
+			rest = width - x;
+			/* fetch 4 mask values */
+			write_sx_io(p, mskx, SX_LDUQ0(12, 3, mskx & 7));
+			/* fetch destination pixels */
+			write_sx_io(p, dstx, SX_LDUQ0(60, 3, dstx & 7));
+			/* duplicate them for all channels */
+			write_sx_reg(p, SX_INSTRUCTIONS, SX_ORS(0, 12, 13, 2));
+			write_sx_reg(p, SX_INSTRUCTIONS, SX_ORS(0, 16, 17, 2));
+			write_sx_reg(p, SX_INSTRUCTIONS, SX_ORS(0, 20, 21, 2));
+			write_sx_reg(p, SX_INSTRUCTIONS, SX_ORS(0, 24, 25, 2));
+			/* generate inverted alpha */
+			write_sx_reg(p, SX_INSTRUCTIONS,
+			SX_XORS(12, 8, 28, 15));
+			/* multiply source */
+			write_sx_reg(p, SX_INSTRUCTIONS,
+			SX_MUL16X16SR8(8, 12, 44, 3));
+			write_sx_reg(p, SX_INSTRUCTIONS,
+			SX_MUL16X16SR8(8, 16, 48, 3));
+			write_sx_reg(p, SX_INSTRUCTIONS,
+			SX_MUL16X16SR8(8, 20, 52, 3));
+			write_sx_reg(p, SX_INSTRUCTIONS,
+			SX_MUL16X16SR8(8, 24, 56, 3));
+			/* multiply dest */
+			write_sx_reg(p, SX_INSTRUCTIONS,
+			SX_MUL16X16SR8(28, 60, 76, 15));
+			/* add up */
+			write_sx_reg(p, SX_INSTRUCTIONS,
+			SX_ADDV(44, 76, 92, 15));
+			/* write back */
+			if (rest < 4) {
+write_sx_io(p, dstx, SX_STUQ0C(92, rest - 1, dstx & 7));
+			} else {
+write_sx_io(p, dstx, SX_STUQ0C(92, 3, dstx & 7));
+			}
+			dstx += 16;
+			mskx += 16;
+		}
+#else /* SX_SINGLE */
 		for (x = 0; x < width; x++) {
 			m = *(volatile uint32_t *)(p->fb + mskx);
 			m = m >> 24;
@@ -114,17 +153,43 @@ void CG14Comp_Over32Solid(Cg14Ptr p,
 			dstx += 4;
 			mskx += 4;
 		}
-#else
+#endif /* SX_SINGLE */
+		dst += dstpitch;
+		msk += srcpitch;
+	}
+}
+
+void CG14Comp_Over8Solid(Cg14Ptr p,
+   uint32_t src, uint32_t srcpitch,
+   uint32_t dst, uint32_t dstpitch,
+   int width, int height)
+{
+	uint32_t msk = src, mskx, dstx, m;
+	int line, x, i;
+#ifdef SX_DEBUG
+	char buffer[256];
+#endif
+	ENTER;
+
+	DPRINTF(X_ERROR, "src: %d %d %d, %08x\n", read_sx_reg(p, SX_QUEUED(9)),
+	read_sx_reg(p, SX_QUEUED(10)), read_sx_reg(p, SX_QUEUED(11)),
+	*(uint32_t *)(p->fb + p->srcoff));
+	for (line = 0; line < height; line++) {
+		mskx = msk;
+		dstx = dst;
+#ifndef SX_SINGLE
+		int rest;
 		for (x = 0; x < width; x += 4) {
+			rest = width - x;			
 			/* fetch 4 mask values */
-			write_sx_io(p, mskx, SX_LDUQ0(12, 3, mskx & 7));
+			write_sx_io(p, mskx, SX_LDB(12, 3, mskx & 7));
 			/* fetch destination pixels */
 			write_sx_io(p, dstx, SX_LDUQ0(60, 3, dstx & 7));
 			/* duplicate them for all channels */
+			write_sx_reg(p, SX_INSTRUCTIONS, SX_ORS(0, 13, 16, 3));
+			write_sx_reg(p, SX_INSTRUCTIONS, SX_ORS(0, 14, 20, 3));
+			write_sx_reg(p, SX_INSTRUCTIONS, SX_ORS(0, 15, 24, 3));
 			write_sx_reg(p, SX_INSTRUCTIONS, SX_ORS(0, 12, 13, 2));
-			write_sx_reg(p, SX_INSTRUCTIONS, SX_ORS(0, 16, 17, 2));
-			write_sx_reg(p, SX_INSTRUCTIONS, SX_ORS(0, 20, 21, 2));
-			write_sx_reg(p, SX_INSTRUCTIONS, SX_ORS(0, 24, 25, 2));
 			/* generate inverted alpha */
 			write_sx_reg(p, SX_INSTRUCTIONS,
 			SX_XORS(12, 8, 28, 15));
@@ -144,36 +209,15 @@ void CG14Comp_Over32Solid(Cg14Ptr p,
 			write_sx_reg(p, SX_INSTRUCTIONS,
 			SX_ADDV(44, 76, 92, 15));
 			/* write back */
-			write_sx_io(p, dstx, SX_STUQ0C(92, 3, dstx & 7));
+			if (rest < 4) {
+write_sx_io(p, dstx, 

CVS commit: xsrc/external/mit/xf86-video-suncg14/dist/src

2016-09-16 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Fri Sep 16 22:05:47 UTC 2016

Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14_accel.c

Log Message:
- DPRINTF() some debug output
- remove unused #defines


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.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-suncg14/dist/src/cg14_accel.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.8 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.9
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.8	Fri Sep 16 21:16:37 2016
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c	Fri Sep 16 22:05:47 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: cg14_accel.c,v 1.8 2016/09/16 21:16:37 macallan Exp $ */
+/* $NetBSD: cg14_accel.c,v 1.9 2016/09/16 22:05:47 macallan Exp $ */
 /*
  * Copyright (c) 2013 Michael Lorenz
  * All rights reserved.
@@ -43,9 +43,7 @@
 #include "cg14.h"
 #include 
 
-#define SX_SINGLE
 /*#define SX_DEBUG*/
-/*#define SX_ADD_SOFTWARE*/
 
 #ifdef SX_DEBUG
 #define ENTER xf86Msg(X_ERROR, "%s>\n", __func__);
@@ -548,7 +546,7 @@ CG14CheckComposite(int op, PicturePtr pS
 	 */
 	
 	if ((op != PictOpOver) && (op != PictOpAdd) && (op != PictOpSrc)) {
-		xf86Msg(X_ERROR, "%s: rejecting %d\n", __func__, op);
+		DPRINTF(X_ERROR, "%s: rejecting %d\n", __func__, op);
 		return FALSE;
 	}
 	i = 0;
@@ -558,7 +556,7 @@ CG14CheckComposite(int op, PicturePtr pS
 	}
 
 	if (!ok) {
-		xf86Msg(X_ERROR, "%s: unsupported src format %x\n",
+		DPRINTF(X_ERROR, "%s: unsupported src format %x\n",
 		__func__, pSrcPicture->format);
 		return FALSE;
 	}
@@ -852,9 +850,9 @@ CG14InitAccel(ScreenPtr pScreen)
 	pExa->pixmapOffsetAlign = 8;
 	pExa->pixmapPitchAlign = 8;
 
-	pExa->flags = EXA_OFFSCREEN_PIXMAPS |
-		  /*EXA_SUPPORTS_OFFSCREEN_OVERLAPS |*/
-		  EXA_MIXED_PIXMAPS;
+	pExa->flags = EXA_OFFSCREEN_PIXMAPS
+		  /* | EXA_SUPPORTS_OFFSCREEN_OVERLAPS |*/
+		  | EXA_MIXED_PIXMAPS;
 
 	/*
 	 * these limits are bogus



CVS commit: xsrc/external/mit/xf86-video-suncg14/dist/src

2016-09-16 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Fri Sep 16 21:16:37 UTC 2016

Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14_accel.c
cg14_cursor.c cg14_driver.c cg14_render.c

Log Message:
adapt to xorg 1.18


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c
cvs rdiff -u -r1.2 -r1.3 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_cursor.c
cvs rdiff -u -r1.12 -r1.13 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.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-suncg14/dist/src/cg14_accel.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.7 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.8
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.7	Tue Jul 30 21:49:38 2013
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c	Fri Sep 16 21:16:37 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: cg14_accel.c,v 1.7 2013/07/30 21:49:38 macallan Exp $ */
+/* $NetBSD: cg14_accel.c,v 1.8 2016/09/16 21:16:37 macallan Exp $ */
 /*
  * Copyright (c) 2013 Michael Lorenz
  * All rights reserved.
@@ -28,7 +28,11 @@
  * POSSIBILITY OF SUCH DAMAGE.
  *
  */
- 
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include 
 
 /* all driver need this */
Index: xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.7 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.8
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.7	Tue Jul 30 21:49:38 2013
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c	Fri Sep 16 21:16:37 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: cg14_render.c,v 1.7 2013/07/30 21:49:38 macallan Exp $ */
+/* $NetBSD: cg14_render.c,v 1.8 2016/09/16 21:16:37 macallan Exp $ */
 /*
  * Copyright (c) 2013 Michael Lorenz
  * All rights reserved.
@@ -29,6 +29,10 @@
  *
  */
  
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include 
 
 /* all driver need this */
@@ -224,10 +228,10 @@ void CG14Comp_Over8Solid(Cg14Ptr p,
 			/* fetch destination pixels */
 			write_sx_io(p, dstx, SX_LDUQ0(60, 3, dstx & 7));
 			/* duplicate them for all channels */
+			write_sx_reg(p, SX_INSTRUCTIONS, SX_ORS(0, 13, 16, 3));
+			write_sx_reg(p, SX_INSTRUCTIONS, SX_ORS(0, 14, 20, 3));
+			write_sx_reg(p, SX_INSTRUCTIONS, SX_ORS(0, 15, 24, 3));
 			write_sx_reg(p, SX_INSTRUCTIONS, SX_ORS(0, 12, 13, 2));
-			write_sx_reg(p, SX_INSTRUCTIONS, SX_ORS(0, 16, 17, 2));
-			write_sx_reg(p, SX_INSTRUCTIONS, SX_ORS(0, 20, 21, 2));
-			write_sx_reg(p, SX_INSTRUCTIONS, SX_ORS(0, 24, 25, 2));
 			/* generate inverted alpha */
 			write_sx_reg(p, SX_INSTRUCTIONS,
 			SX_XORS(12, 8, 28, 15));

Index: xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_cursor.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_cursor.c:1.2 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_cursor.c:1.3
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_cursor.c:1.2	Wed Jun 19 13:20:05 2013
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_cursor.c	Fri Sep 16 21:16:37 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: cg14_cursor.c,v 1.2 2013/06/19 13:20:05 macallan Exp $ */
+/* $NetBSD: cg14_cursor.c,v 1.3 2016/09/16 21:16:37 macallan Exp $ */
 /*
  * Copyright (c) 2005 Michael Lorenz
  * All rights reserved.
@@ -29,6 +29,10 @@
  *
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include 
 
 /* all driver need this */

Index: xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c:1.12 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c:1.13
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c:1.12	Wed Sep  7 17:10:18 2016
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c	Fri Sep 16 21:16:37 2016
@@ -58,6 +58,8 @@ static void	CG14InitCplane24(ScrnInfoPtr
 static void	CG14ExitCplane24(ScrnInfoPtr pScrn);
 static void*CG14WindowLinear(ScreenPtr, CARD32, CARD32, int, CARD32 *,
 			  void *);
+static Bool	CG14DriverFunc(ScrnInfoPtr pScrn, xorgDriverFuncOp op,
+pointer ptr);
 
 /* Required if the driver supports mode switching */
 static Bool	CG14SwitchMode(SWITCH_MODE_ARGS_DECL);
@@ -93,7 +95,8 @@ _X_EXPORT DriverRec SUNCG14 = {
 CG14Probe,
 CG14AvailableOptions,
 NULL,
-0
+0,
+CG14DriverFunc
 };
 
 typedef enum {
@@ -140,7 +143,7 @@ cg14Setup(pointer module, pointer opts, 
 
 if (!setupDone) {
 	setupDone = TRUE;
-	xf86AddDriver(, module, 0);
+	xf86AddDriver(, module, HaveDriverFuncs);
 
 	/*
 	 * Modules that this driver always requires can be loaded here
@@ -299,7 +302,8 @@ CG14PreInit(ScrnInfoPtr pScrn, int flags
 {
 Cg14Ptr pCg14;

CVS commit: xsrc/external/mit/xf86-video-suncg14/dist/src

2014-04-29 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Tue Apr 29 08:40:58 UTC 2014

Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14.h

Log Message:
write all SX commands to 64bit-aligned addresses
now this works on rev. 27 hardware


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h

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-suncg14/dist/src/cg14.h
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.10 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.11
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.10	Thu Jul 25 17:37:30 2013
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h	Tue Apr 29 08:40:58 2014
@@ -123,7 +123,7 @@ read_sx_reg(Cg14Ptr p, int reg)
 static inline void
 write_sx_io(Cg14Ptr p, int reg, uint32_t val)
 {
-	*(volatile uint32_t *)(p-sxio + reg) = val;
+	*(volatile uint32_t *)(p-sxio + (reg  ~7)) = val;
 }
 
 Bool CG14SetupCursor(ScreenPtr);



CVS commit: xsrc/external/mit/xf86-video-suncg14/dist/src

2013-07-30 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Tue Jul 30 19:28:46 UTC 2013

Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14_render.c

Log Message:
support PictOpOver with 32bit source and mask


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.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-suncg14/dist/src/cg14_render.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.5 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.6
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.5	Thu Jul 25 17:37:30 2013
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c	Tue Jul 30 19:28:46 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: cg14_render.c,v 1.5 2013/07/25 17:37:30 macallan Exp $ */
+/* $NetBSD: cg14_render.c,v 1.6 2013/07/30 19:28:46 macallan Exp $ */
 /*
  * Copyright (c) 2013 Michael Lorenz
  * All rights reserved.
@@ -536,23 +536,23 @@ void CG14Comp_Over32Mask32_noalpha(Cg14P
 			/* fetch source pixel */
 			write_sx_io(p, srcx, SX_LDUQ0(12, 0, srcx  7));
 			/* fetch mask */
-			write_sx_io(p, mskx  (~7), SX_LDB(9, 0, mskx  7));
+			write_sx_io(p, mskx  (~7), SX_LDUQ0(16, 0, mskx  7));
 			/* fetch dst pixel */
 			write_sx_io(p, dstx, SX_LDUQ0(20, 0, dstx  7));
-			/* write alpha into SCAM */
+			/* set src alpha to 0xff */
 			write_sx_reg(p, SX_INSTRUCTIONS,
-			SX_ORS(9, 0, R_SCAM, 0));
-			/* src * alpha + R0 */
+			SX_ORS(8, 0, 12, 0));
+			/* apply mask */
 			write_sx_reg(p, SX_INSTRUCTIONS,
-			SX_SAXP16X16SR8(13, 0, 17, 2));
+			SX_MUL16X16SR8R(12, 16, 24, 3));
 			/* write inverted alpha into SCAM */
 			write_sx_reg(p, SX_INSTRUCTIONS,
-			SX_XORV(9, 8, R_SCAM, 0));
-			/* dst * (1 - alpha) + R[13:15] */
+			SX_XORV(12, 8, R_SCAM, 0));
+			/* dst * (1 - alpha) + R[25:31] */
 			write_sx_reg(p, SX_INSTRUCTIONS,
-			SX_SAXP16X16SR8(21, 17, 25, 2));
+			SX_SAXP16X16SR8(21, 25, 29, 2));
 			write_sx_io(p, dstx,
-			SX_STUQ0C(24, 0, dstx  7));
+			SX_STUQ0C(28, 0, dstx  7));
 			srcx += 4;
 			mskx += 4;
 			dstx += 4;



CVS commit: xsrc/external/mit/xf86-video-suncg14/dist/src

2013-07-30 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Tue Jul 30 21:49:38 UTC 2013

Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14_accel.c
cg14_render.c

Log Message:
now we get PictOpOver with no source alpha and a 32bit mask right
( mostly gtk2 icons and button images )
TODO: RGB vs. BGR


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.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-suncg14/dist/src/cg14_accel.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.6 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.7
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.6	Thu Jul 25 17:37:30 2013
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c	Tue Jul 30 21:49:38 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: cg14_accel.c,v 1.6 2013/07/25 17:37:30 macallan Exp $ */
+/* $NetBSD: cg14_accel.c,v 1.7 2013/07/30 21:49:38 macallan Exp $ */
 /*
  * Copyright (c) 2013 Michael Lorenz
  * All rights reserved.
@@ -613,11 +613,11 @@ CG14PrepareComposite(int op, PicturePtr 
 		}
 	}
 	if (pMaskPicture != NULL) {
-		p-mskoff = exaGetPixmapOffset(pMask);		
+		p-mskoff = exaGetPixmapOffset(pMask);
 		p-mskpitch = exaGetPixmapPitch(pMask);
 		p-mskformat = pMaskPicture-format;
 	} else {
-		p-mskoff = 0;		
+		p-mskoff = 0;
 		p-mskpitch = 0;
 		p-mskformat = 0;
 	}
@@ -807,6 +807,8 @@ CG14Composite(PixmapPtr pDst, int srcX, 
 		case PictOpSrc:
 			DPRINTF(X_ERROR, Src %08x %08x\n,
 			p-srcformat, p-dstformat);
+			if (p-mskformat != 0)
+xf86Msg(X_ERROR, Src mask %08x\n, p-mskformat);
 			CG14Copy(pDst, srcX, srcY, dstX, dstY, width, height);
 			break;
 		default:
Index: xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.6 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.7
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.6	Tue Jul 30 19:28:46 2013
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c	Tue Jul 30 21:49:38 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: cg14_render.c,v 1.6 2013/07/30 19:28:46 macallan Exp $ */
+/* $NetBSD: cg14_render.c,v 1.7 2013/07/30 21:49:38 macallan Exp $ */
 /*
  * Copyright (c) 2013 Michael Lorenz
  * All rights reserved.
@@ -407,7 +407,7 @@ void CG14Comp_Over32(Cg14Ptr p,
 			SX_XORV(12, 8, R_SCAM, 0));
 			/* dst * (1 - alpha) + R[13:15] */
 			write_sx_reg(p, SX_INSTRUCTIONS,
-			SX_SAXP16X16SR8(21, 13, 25, 2));
+			SX_SAXP16X16SR8(20, 12, 24, 3));
 			write_sx_io(p, dstx,
 			SX_STUQ0C(24, 0, dstx  7));
 			dstx += 4;
@@ -454,7 +454,7 @@ void CG14Comp_Over32Mask(Cg14Ptr p,
 			SX_XORV(16, 8, R_SCAM, 0));
 			/* dst * (1 - alpha) + R[13:15] */
 			write_sx_reg(p, SX_INSTRUCTIONS,
-			SX_SAXP16X16SR8(21, 17, 25, 2));
+			SX_SAXP16X16SR8(20, 16, 24, 3));
 			write_sx_io(p, dstx,
 			SX_STUQ0C(24, 0, dstx  7));
 			srcx += 4;
@@ -487,6 +487,9 @@ void CG14Comp_Over32Mask_noalpha(Cg14Ptr
 		for (x = 0; x  width; x++) {
 			/* fetch source pixel */
 			write_sx_io(p, srcx, SX_LDUQ0(12, 0, srcx  7));
+			/* set src alpha to 0xff */
+			write_sx_reg(p, SX_INSTRUCTIONS,
+			SX_ORS(8, 0, 12, 0));
 			/* fetch mask */
 			write_sx_io(p, mskx  (~7), SX_LDB(9, 0, mskx  7));
 			/* fetch dst pixel */
@@ -496,13 +499,13 @@ void CG14Comp_Over32Mask_noalpha(Cg14Ptr
 			SX_ORS(9, 0, R_SCAM, 0));
 			/* src * alpha + R0 */
 			write_sx_reg(p, SX_INSTRUCTIONS,
-			SX_SAXP16X16SR8(13, 0, 17, 2));
+			SX_SAXP16X16SR8(12, 0, 16, 3));
 			/* write inverted alpha into SCAM */
 			write_sx_reg(p, SX_INSTRUCTIONS,
 			SX_XORV(9, 8, R_SCAM, 0));
 			/* dst * (1 - alpha) + R[13:15] */
 			write_sx_reg(p, SX_INSTRUCTIONS,
-			SX_SAXP16X16SR8(21, 17, 25, 2));
+			SX_SAXP16X16SR8(20, 16, 24, 3));
 			write_sx_io(p, dstx,
 			SX_STUQ0C(24, 0, dstx  7));
 			srcx += 4;
@@ -536,21 +539,24 @@ void CG14Comp_Over32Mask32_noalpha(Cg14P
 			/* fetch source pixel */
 			write_sx_io(p, srcx, SX_LDUQ0(12, 0, srcx  7));
 			/* fetch mask */
-			write_sx_io(p, mskx  (~7), SX_LDUQ0(16, 0, mskx  7));
+			write_sx_io(p, mskx, SX_LDUQ0(16, 0, mskx  7));
 			/* fetch dst pixel */
 			write_sx_io(p, dstx, SX_LDUQ0(20, 0, dstx  7));
 			/* set src alpha to 0xff */
 			write_sx_reg(p, SX_INSTRUCTIONS,
 			SX_ORS(8, 0, 12, 0));
-			/* apply mask */
+			/* mask alpha to SCAM */
+			write_sx_reg(p, SX_INSTRUCTIONS,
+			SX_ORS(16, 0, R_SCAM, 0));
+			/* src * alpha */
 			write_sx_reg(p, SX_INSTRUCTIONS,
-			SX_MUL16X16SR8R(12, 16, 24, 3));
+			SX_SAXP16X16SR8(12, 0, 24, 3));
 			/* write inverted alpha into SCAM */
 			write_sx_reg(p, SX_INSTRUCTIONS,
-			SX_XORV(12, 8, R_SCAM, 0));
-			/* dst * 

CVS commit: xsrc/external/mit/xf86-video-suncg14/dist/src

2013-07-25 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Thu Jul 25 17:37:30 UTC 2013

Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14.h cg14_accel.c
cg14_render.c

Log Message:
support PictOpOver with 32bit source and 32bit mask
this needs more work but at least it makes things like gkrellm readable


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h
cvs rdiff -u -r1.5 -r1.6 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c
cvs rdiff -u -r1.4 -r1.5 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.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-suncg14/dist/src/cg14.h
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.9 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.10
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.9	Wed Jul  3 15:29:34 2013
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h	Thu Jul 25 17:37:30 2013
@@ -140,6 +140,8 @@ void CG14Comp_Over32Mask(Cg14Ptr, uint32
uint32_t, uint32_t, int, int);
 void CG14Comp_Over32Mask_noalpha(Cg14Ptr, uint32_t, uint32_t, uint32_t,
 		   uint32_t, uint32_t, uint32_t, int, int);
+void CG14Comp_Over32Mask32_noalpha(Cg14Ptr, uint32_t, uint32_t, uint32_t,
+		   uint32_t, uint32_t, uint32_t, int, int);
 void CG14Comp_Add8(Cg14Ptr, uint32_t, uint32_t, uint32_t, uint32_t,
int, int);
 void CG14Comp_Add32(Cg14Ptr, uint32_t, uint32_t, uint32_t, uint32_t,

Index: xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.5 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.6
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.5	Wed Jul  3 15:29:34 2013
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c	Thu Jul 25 17:37:30 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: cg14_accel.c,v 1.5 2013/07/03 15:29:34 macallan Exp $ */
+/* $NetBSD: cg14_accel.c,v 1.6 2013/07/25 17:37:30 macallan Exp $ */
 /*
  * Copyright (c) 2013 Michael Lorenz
  * All rights reserved.
@@ -759,6 +759,16 @@ CG14Composite(PixmapPtr pDst, int srcX, 
 			msk, p-mskpitch,
 			dst, dstpitch,
 			width, height);
+		} else if ((p-mskformat == PICT_a8r8g8b8) ||
+			   (p-mskformat == PICT_a8b8g8r8)) {
+			msk = p-mskoff + 
+			(maskY * p-mskpitch) +
+			(maskX  2);	
+			CG14Comp_Over32Mask32_noalpha(p, 
+			src, p-srcpitch,
+			msk, p-mskpitch,
+			dst, dstpitch,
+			width, height);
 		} else {
 			xf86Msg(X_ERROR, no src alpha, mask is %x\n, p-mskformat);
 		}

Index: xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.4 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.5
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.4	Wed Jul  3 15:29:34 2013
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c	Thu Jul 25 17:37:30 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: cg14_render.c,v 1.4 2013/07/03 15:29:34 macallan Exp $ */
+/* $NetBSD: cg14_render.c,v 1.5 2013/07/25 17:37:30 macallan Exp $ */
 /*
  * Copyright (c) 2013 Michael Lorenz
  * All rights reserved.
@@ -514,3 +514,51 @@ void CG14Comp_Over32Mask_noalpha(Cg14Ptr
 		dst += dstpitch;
 	}
 }
+
+void CG14Comp_Over32Mask32_noalpha(Cg14Ptr p,
+   uint32_t src, uint32_t srcpitch,
+   uint32_t msk, uint32_t mskpitch,
+   uint32_t dst, uint32_t dstpitch,
+   int width, int height)
+{
+	uint32_t srcx, dstx, mskx, m;
+	int line, x, i;
+
+	ENTER;
+
+	write_sx_reg(p, SX_QUEUED(8), 0xff);
+	for (line = 0; line  height; line++) {
+		srcx = src;
+		mskx = msk;
+		dstx = dst;
+
+		for (x = 0; x  width; x++) {
+			/* fetch source pixel */
+			write_sx_io(p, srcx, SX_LDUQ0(12, 0, srcx  7));
+			/* fetch mask */
+			write_sx_io(p, mskx  (~7), SX_LDB(9, 0, mskx  7));
+			/* fetch dst pixel */
+			write_sx_io(p, dstx, SX_LDUQ0(20, 0, dstx  7));
+			/* write alpha into SCAM */
+			write_sx_reg(p, SX_INSTRUCTIONS,
+			SX_ORS(9, 0, R_SCAM, 0));
+			/* src * alpha + R0 */
+			write_sx_reg(p, SX_INSTRUCTIONS,
+			SX_SAXP16X16SR8(13, 0, 17, 2));
+			/* write inverted alpha into SCAM */
+			write_sx_reg(p, SX_INSTRUCTIONS,
+			SX_XORV(9, 8, R_SCAM, 0));
+			/* dst * (1 - alpha) + R[13:15] */
+			write_sx_reg(p, SX_INSTRUCTIONS,
+			SX_SAXP16X16SR8(21, 17, 25, 2));
+			write_sx_io(p, dstx,
+			SX_STUQ0C(24, 0, dstx  7));
+			srcx += 4;
+			mskx += 4;
+			dstx += 4;
+		}
+		src += srcpitch;
+		msk += mskpitch;
+		dst += dstpitch;
+	}
+}



CVS commit: xsrc/external/mit/xf86-video-suncg14/dist/src

2013-07-03 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Wed Jul  3 15:29:34 UTC 2013

Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14.h cg14_accel.c
cg14_render.c

Log Message:
- fetch fill colour for text drawing in CheckComposite, swap red and blue
  channels as needed
- support solid sources without a drawable
now gtk2 apps no longer crash the Xserver and text is drawn in the correct
colour
next step: 32bit PictOpOver with 32bit mask, gtk2 seems to use those a lot


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h
cvs rdiff -u -r1.4 -r1.5 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c
cvs rdiff -u -r1.3 -r1.4 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.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-suncg14/dist/src/cg14.h
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.8 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.9
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.8	Wed Jul  3 02:05:52 2013
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h	Wed Jul  3 15:29:34 2013
@@ -99,7 +99,7 @@ typedef struct {
 	uint32_t	srcformat, dstformat, mskformat;
 	uint32_t	fillcolour;
 	int		op;
-	Bool		source_is_solid;
+	Bool		source_is_solid, no_source_pixmap;
 	int		xdir, ydir;	
 	ExaDriverPtr 	pExa;
 } Cg14Rec, *Cg14Ptr;

Index: xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.4 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.5
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.4	Wed Jul  3 02:05:52 2013
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c	Wed Jul  3 15:29:34 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: cg14_accel.c,v 1.4 2013/07/03 02:05:52 macallan Exp $ */
+/* $NetBSD: cg14_accel.c,v 1.5 2013/07/03 15:29:34 macallan Exp $ */
 /*
  * Copyright (c) 2013 Michael Lorenz
  * All rights reserved.
@@ -583,19 +583,24 @@ CG14PrepareComposite(int op, PicturePtr 
 
 	ENTER;
 
+	p-no_source_pixmap = FALSE;
+	p-source_is_solid = FALSE;
+
 	if (pSrcPicture-format == PICT_a1) {
 		xf86Msg(X_ERROR, src mono, dst %x, op %d\n,
 		pDstPicture-format, op);
 		if (pMaskPicture != NULL) {
 			xf86Msg(X_ERROR, msk %x\n, pMaskPicture-format);
 		}
-	} 
+	}
 	if (pSrcPicture-pSourcePict != NULL) {
 		if (pSrcPicture-pSourcePict-type == SourcePictTypeSolidFill) {
 			p-fillcolour =
 			pSrcPicture-pSourcePict-solidFill.color;
-			xf86Msg(X_ERROR, %s: solid src %08x\n,
+			DPRINTF(X_ERROR, %s: solid src %08x\n,
 			__func__, p-fillcolour);
+			p-no_source_pixmap = TRUE;
+			p-source_is_solid = TRUE;
 		}
 	}
 	if ((pMaskPicture != NULL)  (pMaskPicture-pSourcePict != NULL)) {
@@ -616,12 +621,43 @@ CG14PrepareComposite(int op, PicturePtr 
 		p-mskpitch = 0;
 		p-mskformat = 0;
 	}
-	p-source_is_solid = 
-	   ((pSrc-drawable.width == 1)  (pSrc-drawable.height == 1));
-	p-srcoff = exaGetPixmapOffset(pSrc);		
-	p-srcpitch = exaGetPixmapPitch(pSrc);		
+	if (pSrc != NULL) {
+		p-source_is_solid = 
+		   ((pSrc-drawable.width == 1)  (pSrc-drawable.height == 1));
+		p-srcoff = exaGetPixmapOffset(pSrc);
+		p-srcpitch = exaGetPixmapPitch(pSrc);
+		if (p-source_is_solid) {
+			p-fillcolour = *(uint32_t *)(p-fb + p-srcoff);
+		}
+	}
 	p-srcformat = pSrcPicture-format;
 	p-dstformat = pDstPicture-format;
+	
+	if (p-source_is_solid) {
+		uint32_t temp;
+
+		/* stuff source colour into SX registers, swap as needed */
+		temp = p-fillcolour;
+		switch (p-srcformat) {
+			case PICT_a8r8g8b8:
+			case PICT_x8r8g8b8:
+write_sx_reg(p, SX_QUEUED(9), temp  0xff);
+temp = temp  8;
+write_sx_reg(p, SX_QUEUED(10), temp  0xff);
+temp = temp  8;
+write_sx_reg(p, SX_QUEUED(11), temp  0xff);
+break;
+			case PICT_a8b8g8r8:
+			case PICT_x8b8g8r8:
+write_sx_reg(p, SX_QUEUED(11), temp  0xff);
+temp = temp  8;
+write_sx_reg(p, SX_QUEUED(10), temp  0xff);
+temp = temp  8;
+write_sx_reg(p, SX_QUEUED(9), temp  0xff);
+break;
+		}
+		write_sx_reg(p, SX_QUEUED(8), 0xff);
+	}
 	p-op = op;
 	if (op == PictOpSrc) {
 		CG14PrepareCopy(pSrc, pDst, 1, 1, GXcopy, 0x);

Index: xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.3 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.4
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.3	Wed Jul  3 02:05:52 2013
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c	Wed Jul  3 15:29:34 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: cg14_render.c,v 1.3 2013/07/03 02:05:52 macallan Exp $ */
+/* $NetBSD: cg14_render.c,v 1.4 2013/07/03 15:29:34 macallan Exp $ */
 /*
  * Copyright (c) 2013 Michael Lorenz
  * All rights reserved.
@@ -63,9 +63,7 @@ void 

CVS commit: xsrc/external/mit/xf86-video-suncg14/dist/src

2013-07-02 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Wed Jul  3 02:05:53 UTC 2013

Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14.h cg14_accel.c
cg14_render.c

Log Message:
support PictOpOver with 32bit source without alpha, alpha in mask
now KDE3 looks mostly right
( yes, it's almost usable on a 125MHz HyperSPARC )
gtk2 apps still crash though


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h
cvs rdiff -u -r1.3 -r1.4 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c
cvs rdiff -u -r1.2 -r1.3 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.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-suncg14/dist/src/cg14.h
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.7 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.8
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.7	Tue Jun 25 12:26:57 2013
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h	Wed Jul  3 02:05:52 2013
@@ -138,6 +138,8 @@ void CG14Comp_Over32(Cg14Ptr, uint32_t, 
int, int);
 void CG14Comp_Over32Mask(Cg14Ptr, uint32_t, uint32_t, uint32_t, uint32_t,
uint32_t, uint32_t, int, int);
+void CG14Comp_Over32Mask_noalpha(Cg14Ptr, uint32_t, uint32_t, uint32_t,
+		   uint32_t, uint32_t, uint32_t, int, int);
 void CG14Comp_Add8(Cg14Ptr, uint32_t, uint32_t, uint32_t, uint32_t,
int, int);
 void CG14Comp_Add32(Cg14Ptr, uint32_t, uint32_t, uint32_t, uint32_t,

Index: xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.3 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.4
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.3	Tue Jun 25 12:31:29 2013
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c	Wed Jul  3 02:05:52 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: cg14_accel.c,v 1.3 2013/06/25 12:31:29 macallan Exp $ */
+/* $NetBSD: cg14_accel.c,v 1.4 2013/07/03 02:05:52 macallan Exp $ */
 /*
  * Copyright (c) 2013 Michael Lorenz
  * All rights reserved.
@@ -293,7 +293,8 @@ CG14PrepareSolid(PixmapPtr pPixmap, int 
 	Cg14Ptr p = GET_CG14_FROM_SCRN(pScrn);
 
 	ENTER;
-	DPRINTF(X_ERROR, bits per pixel: %d\n, pPixmap-drawable.bitsPerPixel);
+	DPRINTF(X_ERROR, bits per pixel: %d\n,
+	pPixmap-drawable.bitsPerPixel);
 	write_sx_reg(p, SX_QUEUED(8), fg);
 	write_sx_reg(p, SX_QUEUED(9), fg);
 	if (planemask != p-last_mask) {
@@ -583,7 +584,8 @@ CG14PrepareComposite(int op, PicturePtr 
 	ENTER;
 
 	if (pSrcPicture-format == PICT_a1) {
-		xf86Msg(X_ERROR, src mono, dst %x, op %d\n, pDstPicture-format, op);
+		xf86Msg(X_ERROR, src mono, dst %x, op %d\n,
+		pDstPicture-format, op);
 		if (pMaskPicture != NULL) {
 			xf86Msg(X_ERROR, msk %x\n, pMaskPicture-format);
 		}
@@ -674,10 +676,11 @@ CG14Composite(PixmapPtr pDst, int srcX, 
 		break;
 	default:
 		xf86Msg(X_ERROR,
-		unsupported mask format\n);
+		  unsupported mask format\n);
 }
 			} else {
-DPRINTF(X_ERROR, non-solid over with msk %x\n, p-mskformat);
+DPRINTF(X_ERROR, non-solid over with msk %x\n,
+p-mskformat);
 switch (p-srcformat) {
 	case PICT_a8r8g8b8:
 	case PICT_a8b8g8r8:
@@ -705,7 +708,24 @@ CG14Composite(PixmapPtr pDst, int srcX, 
 		break;
 	case PICT_x8r8g8b8:
 	case PICT_x8b8g8r8:
-		xf86Msg(X_ERROR, alpha better be separate\n);
+		src = p-srcoff +
+		(srcY * p-srcpitch) +
+		(srcX  2);
+		dst = dstoff +
+		(dstY * dstpitch) +
+		(dstX  2);
+		if (p-mskformat == PICT_a8) {
+			msk = p-mskoff + 
+			(maskY * p-mskpitch) +
+			maskX;	
+			CG14Comp_Over32Mask_noalpha(p, 
+			src, p-srcpitch,
+			msk, p-mskpitch,
+			dst, dstpitch,
+			width, height);
+		} else {
+			xf86Msg(X_ERROR, no src alpha, mask is %x\n, p-mskformat);
+		}
 		break;
 	default:
 		xf86Msg(X_ERROR, %s: format %x in non-solid Over op\n,

Index: xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.2 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.3
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.2	Tue Jun 25 12:31:29 2013
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c	Wed Jul  3 02:05:52 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: cg14_render.c,v 1.2 2013/06/25 12:31:29 macallan Exp $ */
+/* $NetBSD: cg14_render.c,v 1.3 2013/07/03 02:05:52 macallan Exp $ */
 /*
  * Copyright (c) 2013 Michael Lorenz
  * All rights reserved.
@@ -119,9 +119,9 @@ void CG14Comp_Over32Solid(Cg14Ptr p,
 			/* fetch destination pixels */
 			write_sx_io(p, dstx, SX_LDUQ0(60, 3, dstx  7));
 			/* 

CVS commit: xsrc/external/mit/xf86-video-suncg14/dist/src

2013-06-25 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Tue Jun 25 12:26:57 UTC 2013

Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14.h cg14_accel.c
Added Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14_render.c

Log Message:
- support PictOpSrc, mask is ignored so far
- support PictOpOver with non-solid source, with or without mask - now QT3
  icons are rendered properly
- move render operations into their own file


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h
cvs rdiff -u -r1.1 -r1.2 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c
cvs rdiff -u -r0 -r1.1 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.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-suncg14/dist/src/cg14.h
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.6 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.7
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.6	Wed Jun 19 13:26:01 2013
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h	Tue Jun 25 12:26:57 2013
@@ -99,13 +99,50 @@ typedef struct {
 	uint32_t	srcformat, dstformat, mskformat;
 	uint32_t	fillcolour;
 	int		op;
+	Bool		source_is_solid;
 	int		xdir, ydir;	
 	ExaDriverPtr 	pExa;
 } Cg14Rec, *Cg14Ptr;
 
+/* SX stuff */
+/* write an SX register */
+static inline void
+write_sx_reg(Cg14Ptr p, int reg, uint32_t val)
+{
+	*(volatile uint32_t *)(p-sxreg + reg) = val;
+}
+
+/* read an SX register */
+static inline uint32_t
+read_sx_reg(Cg14Ptr p, int reg)
+{
+	return *(volatile uint32_t *)(p-sxreg + reg);
+}
+
+/* write a memory referencing instruction */
+static inline void
+write_sx_io(Cg14Ptr p, int reg, uint32_t val)
+{
+	*(volatile uint32_t *)(p-sxio + reg) = val;
+}
+
 Bool CG14SetupCursor(ScreenPtr);
 Bool CG14InitAccel(ScreenPtr);
 
+/* xrender ops */
+void CG14Comp_Over8Solid(Cg14Ptr, uint32_t, uint32_t, uint32_t, uint32_t,
+   int, int);
+void CG14Comp_Over32Solid(Cg14Ptr, uint32_t, uint32_t, uint32_t, uint32_t,
+   int, int);
+void CG14Comp_Over32(Cg14Ptr, uint32_t, uint32_t, uint32_t, uint32_t,
+   int, int);
+void CG14Comp_Over32Mask(Cg14Ptr, uint32_t, uint32_t, uint32_t, uint32_t,
+   uint32_t, uint32_t, int, int);
+void CG14Comp_Add8(Cg14Ptr, uint32_t, uint32_t, uint32_t, uint32_t,
+   int, int);
+void CG14Comp_Add32(Cg14Ptr, uint32_t, uint32_t, uint32_t, uint32_t,
+   int, int);
+
 #define GET_CG14_FROM_SCRN(p)((Cg14Ptr)((p)-driverPrivate))
 
 /*

Index: xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.1 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.2
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.1	Wed Jun 19 13:26:01 2013
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c	Tue Jun 25 12:26:57 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: cg14_accel.c,v 1.1 2013/06/19 13:26:01 macallan Exp $ */
+/* $NetBSD: cg14_accel.c,v 1.2 2013/06/25 12:26:57 macallan Exp $ */
 /*
  * Copyright (c) 2013 Michael Lorenz
  * All rights reserved.
@@ -61,29 +61,6 @@ int src_formats[] = {PICT_a8r8g8b8, PICT
 		 PICT_a8b8g8r8, PICT_x8b8g8r8, PICT_a8};
 int tex_formats[] = {PICT_a8r8g8b8, PICT_a8b8g8r8, PICT_a8};
 
-char c[8] =  .,:+*oX;
-
-/* write an SX register */
-static inline void
-write_sx_reg(Cg14Ptr p, int reg, uint32_t val)
-{
-	*(volatile uint32_t *)(p-sxreg + reg) = val;
-}
-
-/* read an SX register */
-static inline uint32_t
-read_sx_reg(Cg14Ptr p, int reg)
-{
-	return *(volatile uint32_t *)(p-sxreg + reg);
-}
-
-/* write a memory referencing instruction */
-static inline void
-write_sx_io(Cg14Ptr p, int reg, uint32_t val)
-{
-	*(volatile uint32_t *)(p-sxio + reg) = val;
-}
-
 static inline void
 CG14Wait(Cg14Ptr p)
 {
@@ -565,7 +542,7 @@ CG14CheckComposite(int op, PicturePtr pS
 	 * over time and likely have to spill over into its own source file.
 	 */
 	
-	if ((op != PictOpOver)  (op != PictOpAdd)) {
+	if ((op != PictOpOver)  (op != PictOpAdd)  (op != PictOpSrc)) {
 		xf86Msg(X_ERROR, %s: rejecting %d\n, __func__, op);
 		return FALSE;
 	}
@@ -581,7 +558,7 @@ CG14CheckComposite(int op, PicturePtr pS
 		return FALSE;
 	}
 
-	DPRINTF(X_ERROR, src is %x %d %d\n, pSrcPicture-format,
+	DPRINTF(X_ERROR, src is %x, %d: %d %d\n, pSrcPicture-format, op,
 	pSrcPicture-pDrawable-width, pSrcPicture-pDrawable-height);
 
 	if (pMaskPicture != NULL) {
@@ -605,11 +582,17 @@ CG14PrepareComposite(int op, PicturePtr 
 
 	ENTER;
 
+	if (pSrcPicture-format == PICT_a1) {
+		xf86Msg(X_ERROR, src mono, dst %x, op %d\n, pDstPicture-format, op);
+		if (pMaskPicture != NULL) {
+			xf86Msg(X_ERROR, msk %x\n, pMaskPicture-format);
+		}
+	} 
 	if (pSrcPicture-pSourcePict != NULL) {
 		if 

CVS commit: xsrc/external/mit/xf86-video-suncg14/dist/src

2013-06-25 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Tue Jun 25 12:31:29 UTC 2013

Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14_accel.c
cg14_render.c

Log Message:
missed one
( move CG14Comp_Over32Solid() too )


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c
cvs rdiff -u -r1.1 -r1.2 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.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-suncg14/dist/src/cg14_accel.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.2 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.3
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.2	Tue Jun 25 12:26:57 2013
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c	Tue Jun 25 12:31:29 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: cg14_accel.c,v 1.2 2013/06/25 12:26:57 macallan Exp $ */
+/* $NetBSD: cg14_accel.c,v 1.3 2013/06/25 12:31:29 macallan Exp $ */
 /*
  * Copyright (c) 2013 Michael Lorenz
  * All rights reserved.
@@ -631,104 +631,6 @@ CG14PrepareComposite(int op, PicturePtr 
 	return TRUE;
 }
 
-void CG14Comp_Over32Solid(Cg14Ptr p,
-   uint32_t src, uint32_t srcpitch,
-   uint32_t dst, uint32_t dstpitch,
-   int width, int height)
-{
-	uint32_t msk = src, mskx, dstx, m;
-	int line, x, i;
-
-	ENTER;
-	/* first get the source colour */
-	write_sx_io(p, p-srcoff, SX_LDUQ0(8, 0, p-srcoff  7));
-	write_sx_reg(p, SX_QUEUED(8), 0xff);
-	for (line = 0; line  height; line++) {
-		mskx = msk;
-		dstx = dst;
-#ifdef SX_SINGLE
-
-		for (x = 0; x  width; x++) {
-			m = *(volatile uint32_t *)(p-fb + mskx);
-			m = m  24;
-			if (m == 0) {
-/* nothing to do - all transparent */
-			} else if (m == 0xff) {
-/* all opaque */
-write_sx_io(p, dstx, SX_STUQ0(8, 0, dstx  7));
-			} else {
-/* fetch alpha value, stick it into scam */
-/* mask is in R[12:15] */
-/*write_sx_io(p, mskx,
-SX_LDUQ0(12, 0, mskx  7));*/
-write_sx_reg(p, SX_QUEUED(12), m);
-/* fetch dst pixel */
-write_sx_io(p, dstx, SX_LDUQ0(20, 0, dstx  7));
-write_sx_reg(p, SX_INSTRUCTIONS,
-SX_ORV(12, 0, R_SCAM, 0));
-/*
- * src * alpha + R0
- * R[9:11] * SCAM + R0 - R[17:19]
- */
-write_sx_reg(p, SX_INSTRUCTIONS,
-SX_SAXP16X16SR8(9, 0, 17, 2));
-			
-/* invert SCAM */
-write_sx_reg(p, SX_INSTRUCTIONS,
-SX_XORV(12, 8, R_SCAM, 0));
-#ifdef SX_DEBUG
-write_sx_reg(p, SX_INSTRUCTIONS,
-SX_XORV(12, 8, 13, 0));
-#endif
-/* dst * (1 - alpha) + R[13:15] */
-write_sx_reg(p, SX_INSTRUCTIONS,
-SX_SAXP16X16SR8(21, 17, 25, 2));
-write_sx_io(p, dstx,
-SX_STUQ0C(24, 0, dstx  7));
-			}
-			dstx += 4;
-			mskx += 4;
-		}
-#else
-		for (x = 0; x  width; x += 4) {
-			/* fetch 4 mask values */
-			write_sx_io(p, mskx, SX_LDUQ0(12, 3, mskx  7));
-			/* fetch destination pixels */
-			write_sx_io(p, dstx, SX_LDUQ0(60, 3, dstx  7));
-			/* duplicate them for all channels */
-			write_sx_reg(p, SX_INSTRUCTIONS, SX_ORS(0, 12, 13, 2));			
-			write_sx_reg(p, SX_INSTRUCTIONS, SX_ORS(0, 16, 17, 2));			
-			write_sx_reg(p, SX_INSTRUCTIONS, SX_ORS(0, 20, 21, 2));			
-			write_sx_reg(p, SX_INSTRUCTIONS, SX_ORS(0, 24, 25, 2));
-			/* generate inverted alpha */
-			write_sx_reg(p, SX_INSTRUCTIONS,
-			SX_XORS(12, 8, 28, 15));
-			/* multiply source */
-			write_sx_reg(p, SX_INSTRUCTIONS,
-			SX_MUL16X16SR8(8, 12, 44, 3));
-			write_sx_reg(p, SX_INSTRUCTIONS,
-			SX_MUL16X16SR8(8, 16, 48, 3));
-			write_sx_reg(p, SX_INSTRUCTIONS,
-			SX_MUL16X16SR8(8, 20, 52, 3));
-			write_sx_reg(p, SX_INSTRUCTIONS,
-			SX_MUL16X16SR8(8, 24, 56, 3));
-			/* multiply dest */
-			write_sx_reg(p, SX_INSTRUCTIONS,
-			SX_MUL16X16SR8(28, 60, 76, 15));
-			/* add up */
-			write_sx_reg(p, SX_INSTRUCTIONS,
-			SX_ADDV(44, 76, 92, 15));
-			/* write back */
-			write_sx_io(p, dstx, SX_STUQ0C(92, 3, dstx  7));
-			dstx += 16;
-			mskx += 16;
-		}
-#endif
-		dst += dstpitch;
-		msk += srcpitch;
-	}
-}
-
 void
 CG14Composite(PixmapPtr pDst, int srcX, int srcY,
   int maskX, int maskY,

Index: xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.1 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.2
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.1	Tue Jun 25 12:26:57 2013
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c	Tue Jun 25 12:31:29 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: cg14_render.c,v 1.1 2013/06/25 12:26:57 macallan Exp $ */
+/* $NetBSD: cg14_render.c,v 1.2 2013/06/25 12:31:29 macallan Exp $ */
 /*
  * Copyright (c) 2013 Michael Lorenz
  * All rights reserved.
@@ -53,6 +53,105 

CVS commit: xsrc/external/mit/xf86-video-suncg14/dist/src

2013-06-19 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Wed Jun 19 13:20:05 UTC 2013

Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14_cursor.c

Log Message:
remove some unnecessary #includes


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_cursor.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-suncg14/dist/src/cg14_cursor.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_cursor.c:1.1 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_cursor.c:1.2
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_cursor.c:1.1	Thu Apr 14 16:48:59 2011
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_cursor.c	Wed Jun 19 13:20:05 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: cg14_cursor.c,v 1.1 2011/04/14 16:48:59 macallan Exp $ */
+/* $NetBSD: cg14_cursor.c,v 1.2 2013/06/19 13:20:05 macallan Exp $ */
 /*
  * Copyright (c) 2005 Michael Lorenz
  * All rights reserved.
@@ -30,10 +30,6 @@
  */
 
 #include sys/types.h
-#include sys/time.h
-#include sys/endian.h
-#include dev/wscons/wsconsio.h
-#include errno.h
 
 /* all driver need this */
 #include xf86.h



CVS commit: xsrc/external/mit/xf86-video-suncg14/dist/src

2013-06-19 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Wed Jun 19 13:26:01 UTC 2013

Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14.h cg14_driver.c
Added Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14_accel.c

Log Message:
support hardware acceleration via SX
This requires a recent cgfourteen kernel driver which allows userland to map
SX register space.
Basic acceleration is enabled by default ( use Option Accel false to turn
it off ), XRender support is incomplete but good enough for anti-aliased text
rendering ( enable with Option xrender true ).


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h
cvs rdiff -u -r0 -r1.1 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c
cvs rdiff -u -r1.9 -r1.10 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.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-suncg14/dist/src/cg14.h
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.5 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.6
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.5	Tue Jun  4 22:20:41 2013
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h	Wed Jun 19 13:26:01 2013
@@ -30,6 +30,7 @@
 #include X11/Xmd.h
 #include gcstruct.h
 #include xf86sbusBus.h
+#include exa.h
 
 /* Various offsets in virtual (ie. mmap()) spaces Linux and Solaris support. */
 #define CG14_REGS_VOFF		0x	/* registers */
@@ -50,6 +51,11 @@
 #define CG14_G32_VOFF		0xb000
 #define CG14_R32_VOFF		0xc000
 
+/* these two are NetBSD specific */
+#define CG14_SXREG_VOFF		0x0001	/* SX userspace registers */
+#define CG14_SXIO_VOFF		0xd000
+
+
 /* Hardware cursor map */
 #define CG14_CURS_SIZE		32
 struct cg14curs {
@@ -76,6 +82,7 @@ typedef struct {
 	int		width;
 	int		height;
 	int		use_shadow;
+	int		memsize;
 	int		HWCursor;
 	void *		shadow;
 	sbusDevicePtr	psdp;
@@ -83,9 +90,21 @@ typedef struct {
 	CreateScreenResourcesProcPtr CreateScreenResources;
 	OptionInfoPtr	Options;
 	xf86CursorInfoPtr	CursorInfoRec;
+	/* SX accel stuff */
+	void		*sxreg, *sxio;
+	int		use_accel, use_xrender;
+	uint32_t	last_mask;
+	uint32_t	last_rop;
+	uint32_t	srcoff, srcpitch, mskoff, mskpitch;
+	uint32_t	srcformat, dstformat, mskformat;
+	uint32_t	fillcolour;
+	int		op;
+	int		xdir, ydir;	
+	ExaDriverPtr 	pExa;
 } Cg14Rec, *Cg14Ptr;
 
 Bool CG14SetupCursor(ScreenPtr);
+Bool CG14InitAccel(ScreenPtr);
 
 #define GET_CG14_FROM_SCRN(p)((Cg14Ptr)((p)-driverPrivate))
 

Index: xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c:1.9 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c:1.10
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c:1.9	Tue Jun  4 22:20:41 2013
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c	Wed Jun 19 13:26:01 2013
@@ -99,11 +99,15 @@ _X_EXPORT DriverRec SUNCG14 = {
 typedef enum {
 	OPTION_SHADOW_FB,
 	OPTION_HW_CURSOR,
-	OPTION_SW_CURSOR
+	OPTION_SW_CURSOR,
+	OPTION_ACCEL,
+	OPTION_XRENDER
 } CG14Opts;
 
 static const OptionInfoRec CG14Options[] = {
-{ OPTION_SHADOW_FB, ShadowFB, OPTV_BOOLEAN, {0}, TRUE},
+{ OPTION_SHADOW_FB,	ShadowFB, OPTV_BOOLEAN, {0}, TRUE},
+{ OPTION_ACCEL, 	Accel,OPTV_BOOLEAN, {0}, TRUE},
+{ OPTION_XRENDER,	XRender,  OPTV_BOOLEAN, {0}, FALSE},
 { -1,			NULL,		OPTV_NONE,	{0}, FALSE }
 };
 
@@ -342,6 +346,13 @@ CG14PreInit(ScrnInfoPtr pScrn, int flags
 if (psdp == NULL)
 	return FALSE;
 
+pCg14-memsize = 4 * 1024 * 1024;	/* always safe */
+if ((psdp-height * psdp-width * 4)  0x0040)
+	 pCg14-memsize = 0x0080;
+if (psdp-size  pCg14-memsize)
+	pCg14-memsize = psdp-size;
+xf86DrvMsg(pScrn-scrnIndex, X_PROBED, found %d MB video memory\n,
+  pCg14-memsize  20);
 /*
 deal with depth
 */
@@ -370,6 +381,10 @@ CG14PreInit(ScrnInfoPtr pScrn, int flags
 xf86ProcessOptions(pScrn-scrnIndex, pScrn-options, pCg14-Options);
 pCg14-use_shadow = xf86ReturnOptValBool(pCg14-Options, OPTION_SHADOW_FB,
 TRUE);
+pCg14-use_accel = xf86ReturnOptValBool(pCg14-Options, OPTION_ACCEL,
+TRUE);
+pCg14-use_xrender = xf86ReturnOptValBool(pCg14-Options, OPTION_XRENDER,
+FALSE);
 
 /*
  * This must happen after pScrn-display has been set because
@@ -505,7 +520,7 @@ CG14ScreenInit(SCREEN_INIT_ARGS_DECL)
 ScrnInfoPtr pScrn;
 Cg14Ptr pCg14;
 VisualPtr visual;
-int ret;
+int ret, have_accel = 0;
 
 /* 
  * First get the ScrnInfoRec
@@ -515,13 +530,28 @@ CG14ScreenInit(SCREEN_INIT_ARGS_DECL)
 pCg14 = GET_CG14_FROM_SCRN(pScrn);
 
 /* Map the CG14 memory */
-pCg14-fb = xf86MapSbusMem (pCg14-psdp, CG14_BGR_VOFF, 4 *
-

CVS commit: xsrc/external/mit/xf86-video-suncg14/dist/src

2011-05-25 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Thu May 26 00:36:04 UTC 2011

Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14_driver.c

Log Message:
#include sys/ioctl.h


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.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-suncg14/dist/src/cg14_driver.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c:1.7 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c:1.8
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c:1.7	Thu Apr 14 16:59:48 2011
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c	Thu May 26 00:36:03 2011
@@ -26,6 +26,7 @@
 #endif
 
 #include string.h
+#include sys/ioctl.h
 
 #include xf86.h
 #include xf86_OSproc.h



CVS commit: xsrc/external/mit/xf86-video-suncg14/dist/src

2011-04-14 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Thu Apr 14 16:59:48 UTC 2011

Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14_driver.c

Log Message:
oops, missed some debug spam


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.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-suncg14/dist/src/cg14_driver.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c:1.6 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c:1.7
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c:1.6	Thu Apr 14 16:48:59 2011
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c	Thu Apr 14 16:59:48 2011
@@ -574,7 +574,6 @@
 /* must be after RGB ordering fixed */
 fbPictureInit (pScreen, 0, 0);
 
-xf86DrvMsg(scrnIndex, X_ERROR, calling CG14ShadowInit\n);
 if (pCg14-use_shadow  !CG14ShadowInit(pScreen)) {
 	xf86DrvMsg(scrnIndex, X_ERROR,
 		shadow framebuffer initialization failed\n);



CVS commit: xsrc/external/mit/xf86-video-suncg14/dist/src

2010-06-16 Thread matthew green
Module Name:xsrc
Committed By:   mrg
Date:   Thu Jun 17 04:50:43 UTC 2010

Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14_driver.c

Log Message:
merge xf86-video-suncg14 1.1.1


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.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-suncg14/dist/src/cg14_driver.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c:1.3 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c:1.4
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c:1.3	Thu Jun 10 13:26:46 2010
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c	Thu Jun 17 04:50:43 2010
@@ -20,7 +20,6 @@
  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14_driver.c,v 1.6 2001/10/01 13:44:10 eich Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -66,9 +65,9 @@
 #define CG14_VERSION 4000
 #define CG14_NAME SUNCG14
 #define CG14_DRIVER_NAME suncg14
-#define CG14_MAJOR_VERSION 1
-#define CG14_MINOR_VERSION 1
-#define CG14_PATCHLEVEL 0
+#define CG14_MAJOR_VERSION PACKAGE_VERSION_MAJOR
+#define CG14_MINOR_VERSION PACKAGE_VERSION_MINOR
+#define CG14_PATCHLEVEL PACKAGE_VERSION_PATCHLEVEL
 
 /* 
  * This contains the functions needed by the server after loading the driver



CVS commit: xsrc/external/mit/xf86-video-suncg14/dist/src

2010-06-10 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Thu Jun 10 13:26:46 UTC 2010

Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14.h cg14_driver.c

Log Message:
Make ioctl(CG14_SET_PIXELMODE) a proper NetBSD ioctl() ( as in use _IOW ),
also fix some bogosity in colour weights and depth.
With this and the kernel changes committed earlier the cg14 in my SS20 works
with the suncg14 driver.
TODO:
- beat some sanity in the order in which the Xserver issues various ioctl()s
  and opens or closes devices to reduce unnecessary flicker and make sure we
  end up in the right colour mode when entering and exiting X
- add hw cursor support
- support 8 bit visuals along with 24 bit or alone for high resolutions


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h
cvs rdiff -u -r1.2 -r1.3 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.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-suncg14/dist/src/cg14.h
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.1.1.1 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.2
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.1.1.1	Thu Feb 11 00:16:41 2010
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h	Thu Jun 10 13:26:46 2010
@@ -68,6 +68,11 @@
  * This should match corresponding definition in Solaris's
  * '/usr/include/sys/cg14io.h'.
  */
+#ifdef __NetBSD__
+#include sys/ioccom.h
+#define CG14_SET_PIXELMODE	_IOW('M', 3, int)
+#else
 #define CG14_SET_PIXELMODE	(('M'  8) | 3)
+#endif
 
 #endif /* CG14_H */

Index: xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c:1.2 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c:1.3
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c:1.2	Sun Mar 14 01:14:51 2010
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c	Thu Jun 10 13:26:46 2010
@@ -331,12 +331,12 @@
 deal with depth
 */
 
-if (!xf86SetDepthBpp(pScrn, 32, 0, 32, Support32bppFb)) {
-	return FALSE;
-} else {
-	/* Check that the returned depth is one we support */
-	switch (pScrn-depth) {
+if (!xf86SetDepthBpp(pScrn, 0, 0, 0, Support24bppFb|Support32bppFb))
+		return FALSE;
+/* Check that the returned depth is one we support */
+switch (pScrn-depth) {
 	case 32:
+	case 24:
 	/* OK */
 	break;
 	default:
@@ -344,7 +344,6 @@
 		   Given depth (%d) is not supported by this driver\n,
 		   pScrn-depth);
 	return FALSE;
-	}
 }
 
 /* Collect all of the relevant option flags (fill in pScrn-options) */
@@ -360,7 +359,7 @@
  * xf86SetWeight references it.
  */
 if (pScrn-depth  8) {
-	rgb weight = {10, 11, 11};
+	rgb weight = {0, 0, 0};
 	rgb mask = {0xff, 0xff00, 0xff};

 	if (!xf86SetWeight(pScrn, weight, mask)) {
@@ -446,8 +445,11 @@
  (pCg14-psdp-width * pCg14-psdp-height));
 pCg14-xlut = xf86MapSbusMem (pCg14-psdp, CG14_XLUT_VOFF, 4096);
 
-if (! pCg14-fb || !pCg14-x32 || !pCg14-xlut)
+if (! pCg14-fb || !pCg14-x32 || !pCg14-xlut) {
+	xf86Msg(X_ERROR, can't mmap something: fd %08x  x32 %08x xlut %08x\n,
+	(uint32_t)pCg14-fb, (uint32_t)pCg14-x32, (uint32_t)pCg14-xlut);
 	return FALSE;
+}
 
 /* Darken the screen for aesthetic reasons and set the viewport */
 CG14SaveScreen(pScreen, SCREEN_SAVER_ON);
@@ -541,6 +543,7 @@
 static Bool
 CG14SwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
 {
+xf86Msg(X_ERROR, CG14SwitchMode\n);
 return TRUE;
 }
 
@@ -601,6 +604,7 @@
 Cg14Ptr pCg14 = GET_CG14_FROM_SCRN(pScrn);
 
 pScrn-vtSema = FALSE;
+CG14ExitCplane24 (pScrn);
 xf86UnmapSbusMem(pCg14-psdp, pCg14-fb,
 		 (pCg14-psdp-width * pCg14-psdp-height * 4));
 xf86UnmapSbusMem(pCg14-psdp, pCg14-x32,



CVS commit: xsrc/external/mit/xf86-video-suncg14/dist/src

2010-03-13 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Sun Mar 14 01:14:51 UTC 2010

Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14_driver.c

Log Message:
xf86Version.h is no more


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.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-suncg14/dist/src/cg14_driver.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c:1.1.1.1 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c:1.2
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c:1.1.1.1	Thu Feb 11 00:16:41 2010
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c	Sun Mar 14 01:14:51 2010
@@ -30,7 +30,6 @@
 
 #include xf86.h
 #include xf86_OSproc.h
-#include xf86Version.h
 #include mipointer.h
 #include mibstore.h
 #include micmap.h