Module Name:    xsrc
Committed By:   macallan
Date:           Wed Jul 29 01:51:18 UTC 2015

Modified Files:
        xsrc/external/mit/xf86-video-r128/dist/src: r128_driver.c r128_output.c

Log Message:
port static EDID support via WSDISPLAYIO_GET_EDID back, now this works again
on my pismo


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 \
    xsrc/external/mit/xf86-video-r128/dist/src/r128_driver.c
cvs rdiff -u -r1.1.1.1 -r1.2 \
    xsrc/external/mit/xf86-video-r128/dist/src/r128_output.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-r128/dist/src/r128_driver.c
diff -u xsrc/external/mit/xf86-video-r128/dist/src/r128_driver.c:1.13 xsrc/external/mit/xf86-video-r128/dist/src/r128_driver.c:1.14
--- xsrc/external/mit/xf86-video-r128/dist/src/r128_driver.c:1.13	Mon Jul 20 01:33:51 2015
+++ xsrc/external/mit/xf86-video-r128/dist/src/r128_driver.c	Wed Jul 29 01:51:18 2015
@@ -508,7 +508,7 @@ void R128GetPanelInfoFromBIOS(xf86Output
     xf86GetOptValInteger(info->Options, OPTION_PANEL_WIDTH,  &(r128_output->PanelXRes));
     xf86GetOptValInteger(info->Options, OPTION_PANEL_HEIGHT, &(r128_output->PanelYRes));
 
-    if (!info->VBIOS) return;
+    if (!info->VBIOS) goto fallback;
     info->FPBIOSstart = 0;
 
     /* FIXME: There should be direct access to the start of the FP info
@@ -529,7 +529,7 @@ void R128GetPanelInfoFromBIOS(xf86Output
         }
     }
 
-    if (!FPHeader) return;
+    if (!FPHeader) goto fallback;
 
 
     /* Assume that only one panel is attached and supported */
@@ -540,25 +540,6 @@ void R128GetPanelInfoFromBIOS(xf86Output
         }
     }
 
-#ifdef __NetBSD__
-    if (!r128_output->PanelXRes || !r128_output->PanelYRes) {
-	/*
-	 * we may not be on x86 so check wsdisplay for panel dimensions
-	 * XXX this assumes that the r128 is the console, although that should
-	 * be the case in the vast majority of cases where an LCD is hooked up
-	 * directly
-	 * We should probably just check the relevant registers but I'm not
-	 * sure they're available at this point.
-	 */
-	struct wsdisplay_fbinfo fbinfo;
-	
-	if (ioctl(xf86Info.screenFd, WSDISPLAYIO_GINFO, &fbinfo) == 0) {
-	    r128_output->PanelXRes = fbinfo.width;
-	    r128_output->PanelYRes = fbinfo.height;
-	}
-    }
-#endif
-
 #ifndef AVOID_FBDEV
     if (!info->FPBIOSstart) return;
 #endif
@@ -612,6 +593,26 @@ void R128GetPanelInfoFromBIOS(xf86Output
                    "This support is untested and may not "
                    "function properly\n");
     }
+    return;
+fallback:
+#ifdef __NetBSD__
+    if (!r128_output->PanelXRes || !r128_output->PanelYRes) {
+	/*
+	 * we may not be on x86 so check wsdisplay for panel dimensions
+	 * XXX this assumes that the r128 is the console, although that should
+	 * be the case in the vast majority of cases where an LCD is hooked up
+	 * directly
+	 * We should probably just check the relevant registers but I'm not
+	 * sure they're available at this point.
+	 */
+	struct wsdisplay_fbinfo fbinfo;
+	
+	if (ioctl(xf86Info.screenFd, WSDISPLAYIO_GINFO, &fbinfo) == 0) {
+	    r128_output->PanelXRes = fbinfo.width;
+	    r128_output->PanelYRes = fbinfo.height;
+	}
+    }
+#endif
 }
 
 /* Read PLL parameters from BIOS block.  Default to typical values if there

Index: xsrc/external/mit/xf86-video-r128/dist/src/r128_output.c
diff -u xsrc/external/mit/xf86-video-r128/dist/src/r128_output.c:1.1.1.1 xsrc/external/mit/xf86-video-r128/dist/src/r128_output.c:1.2
--- xsrc/external/mit/xf86-video-r128/dist/src/r128_output.c:1.1.1.1	Mon Jul 20 00:23:09 2015
+++ xsrc/external/mit/xf86-video-r128/dist/src/r128_output.c	Wed Jul 29 01:51:18 2015
@@ -40,6 +40,14 @@
 #include "r128.h"
 #include "r128_probe.h"
 #include "r128_reg.h"
+#include "xf86Priv.h"
+
+#ifdef __NetBSD__
+#include <sys/time.h>
+#include <sys/ioctl.h>
+#include <dev/wscons/wsconsio.h>
+#endif
+
 
 static void R128ConnectorFindMonitor(ScrnInfoPtr pScrn, xf86OutputPtr output);
 
@@ -238,6 +246,24 @@ static R128MonitorType R128DisplayDDCCon
     uint32_t mask1, mask2;
 
     if (r128_output->type == OUTPUT_LVDS) {
+#ifdef __NetBSD__
+	struct wsdisplayio_edid_info ei;
+	char *buffer;
+	xf86MonPtr tmp;
+
+	buffer = malloc(1024);
+	ei.edid_data = buffer;
+	ei.buffer_size = 1024;
+	if (ioctl(xf86Info.screenFd, WSDISPLAYIO_GET_EDID, &ei) != -1) {
+	    xf86Msg(X_ERROR, "got %d bytes worth of EDID from wsdisplay\n",
+	      ei.data_size);
+	    tmp = xf86InterpretEEDID(pScrn->scrnIndex, buffer);
+	    tmp->flags |= MONITOR_EDID_COMPLETE_RAWDATA;
+	    *MonInfo = tmp;
+	    xf86OutputSetEDID(output, tmp);
+	} else
+	    free(buffer);
+#endif
         return MT_LCD;
     } else if (r128_output->type == OUTPUT_VGA) {
         mask1 = R128_GPIO_MONID_MASK_1 | (info->isPro2 ? R128_GPIO_MONID_MASK_2 : R128_GPIO_MONID_MASK_3);
@@ -297,8 +323,8 @@ DisplayModePtr R128ProbeOutputModes(xf86
     if (r128_output->pI2CBus) {
         edid_mon = xf86OutputGetEDID(output, r128_output->pI2CBus);
         xf86OutputSetEDID(output, edid_mon);
-        modes = xf86OutputGetEDIDModes(output);
     }
+    modes = xf86OutputGetEDIDModes(output);
 
     /* Letting this function return NULL would be a bad idea. With old cards
      * like r128, users often specify a small resolution in order to get DRI.

Reply via email to