From 8cf3065812e7b8122d4d5983cfe6660154186534 Mon Sep 17 00:00:00 2001 From: nia Date: Sun, 12 May 2024 15:51:57 +0200 Subject: 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 Part-of: --- configure.ac | 2 ++ src/nv_setup.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/configure.ac b/configure.ac index a282013..a6df24c 100644 --- a/configure.ac +++ b/configure.ac @@ -72,6 +72,8 @@ AM_CONDITIONAL(HAVE_XEXTPROTO_71, [ test "$HAVE_XEXTPROTO_71" = "yes" ]) save_CFLAGS="$CFLAGS" CFLAGS="$XORG_CFLAGS" +AC_CHECK_HEADERS(dev/wscons/wsconsio.h) + # PCI rework AC_CHECK_DECL(XSERVER_LIBPCIACCESS, [XSERVER_LIBPCIACCESS=yes],[XSERVER_LIBPCIACCESS=no], 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 +#include +#include +#endif + /* * Override VGA I/O routines. */ @@ -233,6 +241,26 @@ NVProbeDDC (ScrnInfoPtr pScrn, int bus) MonInfo = xf86DoEEDID(XF86_SCRN_ARG(pScrn), pNv->I2C, TRUE); #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, -- cgit v1.2.3