Module Name:    xsrc
Committed By:   macallan
Date:           Wed Jul 24 16:07:59 UTC 2019

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

Log Message:
avoid stalling the CPU by letting the SX instruction FIFO drain every couple
of memory instructions.
No more missed IPIs when building stuff in an xterm so far...


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 \
    xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h
cvs rdiff -u -r1.14 -r1.15 \
    xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c
cvs rdiff -u -r1.12 -r1.13 \
    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.13 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.14
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.13	Thu Dec  7 19:23:22 2017
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h	Wed Jul 24 16:07:59 2019
@@ -31,6 +31,7 @@
 #include "gcstruct.h"
 #include "xf86sbusBus.h"
 #include "exa.h"
+#include <sparc/sxreg.h>
 
 /* Various offsets in virtual (ie. mmap()) spaces Linux and Solaris support. */
 #define CG14_REGS_VOFF		0x00000000	/* registers */
@@ -100,7 +101,8 @@ typedef struct {
 	uint32_t	fillcolour;
 	int		op;
 	Bool		source_is_solid, no_source_pixmap;
-	int		xdir, ydir;	
+	int		xdir, ydir;
+	int		queuecount;
 	ExaDriverPtr 	pExa;
 } Cg14Rec, *Cg14Ptr;
 
@@ -123,7 +125,14 @@ read_sx_reg(Cg14Ptr p, int reg)
 static inline void
 write_sx_io(Cg14Ptr p, int reg, uint32_t val)
 {
+	if (p->queuecount > 6) {
+		/* let the queue drain to avoid stalling the CPU */
+		do { } while 
+		    ((read_sx_reg(p, SX_CONTROL_STATUS) & SX_MT) == 0);
+		p->queuecount = 0;
+	}
 	*(volatile uint32_t *)(p->sxio + (reg & ~7)) = val;
+	p->queuecount++;
 }
 
 Bool CG14SetupCursor(ScreenPtr);

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.14 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.15
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.14	Fri Mar  1 02:22:27 2019
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c	Wed Jul 24 16:07:59 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: cg14_accel.c,v 1.14 2019/03/01 02:22:27 macallan Exp $ */
+/* $NetBSD: cg14_accel.c,v 1.15 2019/07/24 16:07:59 macallan Exp $ */
 /*
  * Copyright (c) 2013 Michael Lorenz
  * All rights reserved.
@@ -41,7 +41,6 @@
 #include "compiler.h"
 
 #include "cg14.h"
-#include <sparc/sxreg.h>
 
 /*#define SX_DEBUG*/
 
@@ -1121,6 +1120,7 @@ CG14InitAccel(ScreenPtr pScreen)
 	pExa->UploadToScreen = CG14UploadToScreen;
 	pExa->DownloadFromScreen = CG14DownloadFromScreen;
 
+	p->queuecount = 0;
 	/* do some hardware init */
 	write_sx_reg(p, SX_PLANEMASK, 0xffffffff);
 	p->last_mask = 0xffffffff;

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.12 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.13
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.12	Fri Dec  8 22:49:37 2017
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c	Wed Jul 24 16:07:59 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: cg14_render.c,v 1.12 2017/12/08 22:49:37 macallan Exp $ */
+/* $NetBSD: cg14_render.c,v 1.13 2019/07/24 16:07:59 macallan Exp $ */
 /*
  * Copyright (c) 2013 Michael Lorenz
  * All rights reserved.
@@ -41,7 +41,6 @@
 #include "compiler.h"
 
 #include "cg14.h"
-#include <sparc/sxreg.h>
 
 /*#define SX_SINGLE*/
 /*#define SX_RENDER_DEBUG*/

Reply via email to