Module Name:    xsrc
Committed By:   macallan
Date:           Wed Jul  2 11:54:48 UTC 2014

Modified Files:
        xsrc/external/mit/xf86-video-suntcx/dist/src: tcx.h tcx_accel.c
            tcx_driver.c

Log Message:
detect and (attempt to) deal with 8bit TCX with 2MB VRAM
TODO: get one of these VRAM modules...


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 xsrc/external/mit/xf86-video-suntcx/dist/src/tcx.h
cvs rdiff -u -r1.7 -r1.8 \
    xsrc/external/mit/xf86-video-suntcx/dist/src/tcx_accel.c \
    xsrc/external/mit/xf86-video-suntcx/dist/src/tcx_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-suntcx/dist/src/tcx.h
diff -u xsrc/external/mit/xf86-video-suntcx/dist/src/tcx.h:1.5 xsrc/external/mit/xf86-video-suntcx/dist/src/tcx.h:1.6
--- xsrc/external/mit/xf86-video-suntcx/dist/src/tcx.h:1.5	Wed Jun 18 16:55:28 2014
+++ xsrc/external/mit/xf86-video-suntcx/dist/src/tcx.h	Wed Jul  2 11:54:48 2014
@@ -59,6 +59,7 @@ typedef struct {
 	CloseScreenProcPtr CloseScreen;
 	Bool		HWCursor;
 	Bool		Is8bit;
+	int		vramsize;	/* size of the 8bit fb */
 	uint64_t	*rblit;
 	uint64_t	*rstip;
 	xf86CursorInfoPtr CursorInfoRec;

Index: xsrc/external/mit/xf86-video-suntcx/dist/src/tcx_accel.c
diff -u xsrc/external/mit/xf86-video-suntcx/dist/src/tcx_accel.c:1.7 xsrc/external/mit/xf86-video-suntcx/dist/src/tcx_accel.c:1.8
--- xsrc/external/mit/xf86-video-suntcx/dist/src/tcx_accel.c:1.7	Tue Jun  4 22:58:31 2013
+++ xsrc/external/mit/xf86-video-suntcx/dist/src/tcx_accel.c	Wed Jul  2 11:54:48 2014
@@ -21,7 +21,7 @@
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
-/* $NetBSD: tcx_accel.c,v 1.7 2013/06/04 22:58:31 mrg Exp $ */
+/* $NetBSD: tcx_accel.c,v 1.8 2014/07/02 11:54:48 macallan Exp $ */
 
 #include <sys/types.h>
 
@@ -341,13 +341,13 @@ TcxInitAccel(ScreenPtr pScreen)
 
     /*
      * The S24 can display both 8 and 24bit data at the same time, and in
-     * 24bit we can choose between gamma corrected ad direct. No idea how that
+     * 24bit we can choose between gamma corrected and direct. No idea how that
      * would map to EXA - we'd have to pick the right framebuffer to draw into
      * and Solid() would need to know what kind of pixels to write
      */
     pExa->memoryBase = pTcx->fb;
     if (pScrn->depth == 8) {
-	pExa->memorySize = 1024 * 1024;
+	pExa->memorySize = pTcx->vramsize;
 	pExa->offScreenBase = pTcx->psdp->width * pTcx->psdp->height;
 	pExa->pixmapOffsetAlign = 1;
 	pExa->pixmapPitchAlign = 1;
Index: xsrc/external/mit/xf86-video-suntcx/dist/src/tcx_driver.c
diff -u xsrc/external/mit/xf86-video-suntcx/dist/src/tcx_driver.c:1.7 xsrc/external/mit/xf86-video-suntcx/dist/src/tcx_driver.c:1.8
--- xsrc/external/mit/xf86-video-suntcx/dist/src/tcx_driver.c:1.7	Wed Jun 18 16:55:28 2014
+++ xsrc/external/mit/xf86-video-suntcx/dist/src/tcx_driver.c	Wed Jul  2 11:54:48 2014
@@ -292,7 +292,7 @@ TCXPreInit(ScrnInfoPtr pScrn, int flags)
     TcxPtr pTcx;
     sbusDevicePtr psdp = NULL;
     MessageType from;
-    int i;
+    int i, prom;
     int hwCursor, lowDepth;
 
     if (flags & PROBE_DETECT) return FALSE;
@@ -341,18 +341,34 @@ TCXPreInit(ScrnInfoPtr pScrn, int flags)
     **********************/
     hwCursor = 0;
     lowDepth = 1;
-     if (sparcPromInit() >= 0) {
- 	hwCursor = sparcPromGetBool(&psdp->node, "hw-cursor");
- 	lowDepth = sparcPromGetBool(&psdp->node, "tcx-8-bit");
- 	sparcPromClose();
-    }
+
+    prom = sparcPromInit();
+    hwCursor = sparcPromGetBool(&psdp->node, "hw-cursor");
+    lowDepth = sparcPromGetBool(&psdp->node, "tcx-8-bit");
 
     pTcx->Is8bit = (lowDepth != 0); 
     /* all S24 support a hardware cursor */
-    if (!lowDepth)
+    if (!lowDepth) {
 	hwCursor = 1;
+	pTcx->vramsize = 0x100000;	/* size of the 8bit fb */
+    } else {
+	char *b;
+	int len = 4, v = 0;
+
+    	/* see if we have more than 1MB vram */
+	pTcx->vramsize = 0x100000;
+	if ((b = sparcPromGetProperty(&psdp->node, "vram", &len)) != NULL) {
+	    memcpy(&v, b, 4);
+	    if ((v > 0) && (v < 3))
+	    	pTcx->vramsize = 0x100000 * v;
+	}
+	xf86Msg(X_ERROR, "found %d MB video memory\n", v);
+    	    
+    }
+    if (prom)
+    	sparcPromClose();
 
-	xf86Msg(X_ERROR, "hw-cursor: %d\n", hwCursor);
+    xf86Msg(X_ERROR, "hw-cursor: %d\n", hwCursor);
 
     /*********************
     deal with depth
@@ -508,7 +524,7 @@ TCXScreenInit(SCREEN_INIT_ARGS_DECL)
     /* Map the TCX memory */
     if (pScrn->depth == 8) {
 	pTcx->fb =
-	    xf86MapSbusMem (pTcx->psdp, TCX_RAM8_VOFF, 1024 * 1024);
+	    xf86MapSbusMem (pTcx->psdp, TCX_RAM8_VOFF, pTcx->vramsize);
 	pTcx->pitchshift = 0;
     } else {
 	pTcx->fb =
@@ -527,12 +543,12 @@ TCXScreenInit(SCREEN_INIT_ARGS_DECL)
 
     if (pTcx->Is8bit) {
     	/* use STIP and BLIT on tcx */
-        pTcx->rblit = xf86MapSbusMem(pTcx->psdp, TCX_BLIT_VOFF, 8 * 1024 * 1024);
+        pTcx->rblit = xf86MapSbusMem(pTcx->psdp, TCX_BLIT_VOFF, 8 * pTcx->vramsize);
         if (pTcx->rblit == NULL) {
 	    xf86Msg(X_ERROR, "Couldn't map BLIT space\n");
 	    return FALSE;
         }
-        pTcx->rstip = xf86MapSbusMem(pTcx->psdp, TCX_STIP_VOFF, 8 * 1024 * 1024);
+        pTcx->rstip = xf86MapSbusMem(pTcx->psdp, TCX_STIP_VOFF, 8 * pTcx->vramsize);
         if (pTcx->rstip == NULL) {
 	    xf86Msg(X_ERROR, "Couldn't map STIP space\n");
 	    return FALSE;

Reply via email to