Module Name:    xsrc
Committed By:   macallan
Date:           Wed Mar  9 17:57:50 UTC 2022

Modified Files:
        xsrc/external/mit/xf86-video-suncg6/dist/src: cg6_driver.c

Log Message:
Check the PROM for the amount of available VRAM instead of guessing, and use
it all, now that we know we can.

thanks foo bar


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 \
    xsrc/external/mit/xf86-video-suncg6/dist/src/cg6_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-suncg6/dist/src/cg6_driver.c
diff -u xsrc/external/mit/xf86-video-suncg6/dist/src/cg6_driver.c:1.14 xsrc/external/mit/xf86-video-suncg6/dist/src/cg6_driver.c:1.15
--- xsrc/external/mit/xf86-video-suncg6/dist/src/cg6_driver.c:1.14	Thu Jul 18 18:02:10 2019
+++ xsrc/external/mit/xf86-video-suncg6/dist/src/cg6_driver.c	Wed Mar  9 17:57:50 2022
@@ -442,7 +442,8 @@ CG6ScreenInit(SCREEN_INIT_ARGS_DECL)
     ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
     Cg6Ptr pCg6;
     sbusDevicePtr psdp;
-    int ret;
+    int ret, prom, len, vmsize;
+    char *b;
 
     pCg6 = GET_CG6_FROM_SCRN(pScrn);
     psdp = pCg6->psdp;
@@ -457,6 +458,17 @@ CG6ScreenInit(SCREEN_INIT_ARGS_DECL)
      * usable VRAM ONLY. Works with NetBSD, may crash and burn on other OSes.
      */
     pCg6->vidmem = 2 * 1024 * 1024;
+
+    prom = sparcPromInit();
+    b = sparcPromGetProperty(&psdp->node, "vmsize", &len);
+    if (len == 4 && b != NULL) {
+    	memcpy(&vmsize, b, 4);
+	pCg6->vidmem = vmsize * 1024 * 1024; 	
+    }
+
+    if (prom)
+    	sparcPromClose();
+
     pCg6->fb = xf86MapSbusMem(psdp, CG6_RAM_VOFF, pCg6->vidmem);
     
     if (pCg6->fb == NULL) {

Reply via email to