summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authornia <nia@NetBSD.org>2024-05-12 15:51:57 +0200
committerMarge Bot <emma+marge@anholt.net>2024-05-12 17:05:37 +0000
commit8cf3065812e7b8122d4d5983cfe6660154186534 (patch)
tree53760a48bebb5e65c251f2772303241425713b1a /src
parentb25b3492c5868671faa7ef327da8f90df5e99e16 (diff)
netbsd: Try getting the EDID via wscons if the DDC2 method fails.
Helps identifying displays on non-x86 hardware. Patch from Michael Lorenz, autotools'ified by me. Signed-off-by: Nia Alarie <nia@NetBSD.org> Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-video-nv/-/merge_requests/19>
Diffstat (limited to 'src')
-rw-r--r--src/nv_setup.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/nv_setup.c b/src/nv_setup.c
index 6a7c048..77f6c4a 100644
--- a/src/nv_setup.c
+++ b/src/nv_setup.c
@@ -25,8 +25,16 @@
#include "config.h"
#endif
+#include "xf86Priv.h"
+#include "xf86Privstr.h"
#include "nv_include.h"
+#ifdef HAVE_DEV_WSCONS_WSCONSIO_H
+#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 WSDISPLAYIO_GET_EDID
+ 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 ?