Module Name:    xsrc
Committed By:   macallan
Date:           Thu Mar 25 17:22:02 UTC 2021

Modified Files:
        xsrc/external/mit/xf86-video-nv/dist/src: nv_setup.c

Log Message:
try WSDISPLAYIO_GET_EDID if DDC2 fails
now my iMac G5 correctly identifies its display


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.5 -r1.2 \
    xsrc/external/mit/xf86-video-nv/dist/src/nv_setup.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-nv/dist/src/nv_setup.c
diff -u xsrc/external/mit/xf86-video-nv/dist/src/nv_setup.c:1.1.1.5 xsrc/external/mit/xf86-video-nv/dist/src/nv_setup.c:1.2
--- xsrc/external/mit/xf86-video-nv/dist/src/nv_setup.c:1.1.1.5	Sun Mar  5 01:55:42 2017
+++ xsrc/external/mit/xf86-video-nv/dist/src/nv_setup.c	Thu Mar 25 17:22:02 2021
@@ -25,8 +25,16 @@
 #include "config.h"
 #endif
 
+#include "xf86Priv.h"
+#include "xf86Privstr.h"
 #include "nv_include.h"
 
+#ifdef __NetBSD__
+#include <sys/time.h>
+#include <sys/ioctl.h>
+#include <dev/wscons/wsconsio.h>
+#endif
+
 /*
  * Override VGA I/O routines.
  */
@@ -234,6 +242,26 @@ NVProbeDDC (ScrnInfoPtr pScrn, int bus)
 #else
     MonInfo = xf86DoEDID_DDC2(XF86_SCRN_ARG(pScrn), pNv->I2C);
 #endif
+#ifdef __NetBSD__
+    if (!MonInfo) {
+	/* ask wsdisplay */
+	struct wsdisplayio_edid_info ei;
+	char *buffer;
+	xf86MonPtr tmp;
+
+	buffer = malloc(1024);
+	ei.edid_data = buffer;
+	ei.buffer_size = 1024;
+	if (ioctl(xf86Info.consoleFd, WSDISPLAYIO_GET_EDID, &ei) != -1) {
+	    xf86Msg(X_INFO, "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;
+	}
+	free(buffer);
+    }
+#endif
     if (MonInfo) {
        xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
                   "DDC detected a %s:\n", MonInfo->features.input_type ?

Reply via email to