pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
modular-xorg-server-dfbsd-meson: Update wip/modular-xorg-server-dfbsd-meson through 2019-03-13
Module Name: pkgsrc-wip
Committed By: David Shao <davshao%gmail.com@localhost>
Pushed By: dshao
Date: Wed Mar 13 17:15:13 2019 -0700
Changeset: 92ad31cd544c86c9edbb72d05b46922717f920f7
Modified Files:
modular-xorg-server-dfbsd-meson/Makefile.common
modular-xorg-server-dfbsd-meson/TODO
modular-xorg-server-dfbsd-meson/distinfo
modular-xorg-server-dfbsd-meson/options.mk
modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_common_xf86AutoConfig.c
modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_common_xf86Config.c
modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_drivers_modesetting_drmmode__display.c
modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_os-support_bsd_bsd__VTsw.c
modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_os-support_bsd_bsd__init.c
Added Files:
modular-xorg-server-dfbsd-meson/patches/patch-Xext_xf86bigfont.c
modular-xorg-server-dfbsd-meson/patches/patch-config_wscons.c
modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_common_xf86Configure.c
modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_common_xf86Helper.c
modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_common_xf86pciBus.c
modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_int10_helper__exec.c
modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_modes_xf86RandR12.c
modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_os-support_bus_bsd__pci.c
modular-xorg-server-dfbsd-meson/patches/patch-os_utils.c
Log Message:
modular-xorg-server-dfbsd-meson: Update wip/modular-xorg-server-dfbsd-meson through 2019-03-13
Added options for so-far unsuccessful attempt to get modesetting driver to work
on any OS on some Intel integrated graphics machine gen4+.
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=92ad31cd544c86c9edbb72d05b46922717f920f7
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
modular-xorg-server-dfbsd-meson/Makefile.common | 8 +-
modular-xorg-server-dfbsd-meson/TODO | 2 +
modular-xorg-server-dfbsd-meson/distinfo | 27 +-
modular-xorg-server-dfbsd-meson/options.mk | 99 ++++++
.../patches/patch-Xext_xf86bigfont.c | 16 +
.../patches/patch-config_wscons.c | 169 ++++++++++
.../patch-hw_xfree86_common_xf86AutoConfig.c | 10 +-
.../patches/patch-hw_xfree86_common_xf86Config.c | 16 +-
.../patch-hw_xfree86_common_xf86Configure.c | 14 +
.../patches/patch-hw_xfree86_common_xf86Helper.c | 23 ++
.../patches/patch-hw_xfree86_common_xf86pciBus.c | 45 +++
..._xfree86_drivers_modesetting_drmmode__display.c | 110 ++++++-
.../patches/patch-hw_xfree86_int10_helper__exec.c | 33 ++
.../patches/patch-hw_xfree86_modes_xf86RandR12.c | 14 +
.../patch-hw_xfree86_os-support_bsd_bsd__VTsw.c | 118 ++++++-
.../patch-hw_xfree86_os-support_bsd_bsd__init.c | 347 ++++++++++++++++++++-
.../patch-hw_xfree86_os-support_bus_bsd__pci.c | 13 +
.../patches/patch-os_utils.c | 21 ++
18 files changed, 1054 insertions(+), 31 deletions(-)
diffs:
diff --git a/modular-xorg-server-dfbsd-meson/Makefile.common b/modular-xorg-server-dfbsd-meson/Makefile.common
index 85c40bde2a..7653c30f1d 100644
--- a/modular-xorg-server-dfbsd-meson/Makefile.common
+++ b/modular-xorg-server-dfbsd-meson/Makefile.common
@@ -2,8 +2,14 @@
# used by x11/modular-xorg-server/Makefile
# used by x11/modular-xorg-xephyr/Makefile
+# 2019-03-13 Add xf86OSInputThreadInit to stub os-support as well
+COMMIT_ID= c020769dbfb965740c8441d8242b738ef572a7c9
+
+# 2019-03-11 mi: Shortcut miDoCopy/miCopyArea based on clipList
+# COMMIT_ID= f665a9c9e6c8643f3050378249db3088ae3057be
+
# 2019-03-05 meson: Bump required meson version to 0.46
-COMMIT_ID= 7e046b9467784451769af3a03db46e3c690063b0
+# COMMIT_ID= 7e046b9467784451769af3a03db46e3c690063b0
# 2019-02-27 Revert "gitlab-ci: Only run docker-image stage if relevant source files change"
# COMMIT_ID= 0ec9a13c2a207e98e2dd6b352552c0e069af0727
diff --git a/modular-xorg-server-dfbsd-meson/TODO b/modular-xorg-server-dfbsd-meson/TODO
index 9a1403ffc2..21cacf4094 100644
--- a/modular-xorg-server-dfbsd-meson/TODO
+++ b/modular-xorg-server-dfbsd-meson/TODO
@@ -11,3 +11,5 @@ into FreeBSD ports, supports evdev.
Get modular-xorg-xephyr to build again.
Get xf86-video-nv, xf86-video-vmware to build again.
+
+Get modesetting driver to work on any Intel device any OS.
diff --git a/modular-xorg-server-dfbsd-meson/distinfo b/modular-xorg-server-dfbsd-meson/distinfo
index a88d264204..9c2eee5e5e 100644
--- a/modular-xorg-server-dfbsd-meson/distinfo
+++ b/modular-xorg-server-dfbsd-meson/distinfo
@@ -1,34 +1,43 @@
$NetBSD: distinfo,v 1.94 2019/02/28 12:32:39 tnn Exp $
-SHA1 (xserver-7e046b9467784451769af3a03db46e3c690063b0.tar.xz) = d2e507964d1aa6e48d04a119e0cf04413928c6f4
-RMD160 (xserver-7e046b9467784451769af3a03db46e3c690063b0.tar.xz) = 6508909bee2c0bcb4003476b1ce4e0058eb25736
-SHA512 (xserver-7e046b9467784451769af3a03db46e3c690063b0.tar.xz) = 05f4e5ba6f992863f3738f9017914304df8059e22abdf57c4ab8e54d7ad22398e176910312fd423223414bf505db6d5f2870a59f7ed8b04fd16d701bb637157c
-Size (xserver-7e046b9467784451769af3a03db46e3c690063b0.tar.xz) = 3098028 bytes
+SHA1 (xserver-c020769dbfb965740c8441d8242b738ef572a7c9.tar.xz) = a4438a7965d01b1b8aa05f78c325cfdb010d5a52
+RMD160 (xserver-c020769dbfb965740c8441d8242b738ef572a7c9.tar.xz) = baa1cb52e64c1d9f56ed15083927758a801ca65d
+SHA512 (xserver-c020769dbfb965740c8441d8242b738ef572a7c9.tar.xz) = acb7c883bff1ecd8d2c1f8a606a4fcc9b852f764b2f79c037234673ef4794a3b0fe53e2d9660c4c53fc1933f7ef68334322d83f231d749849bdc8ec7a3ffefe3
+Size (xserver-c020769dbfb965740c8441d8242b738ef572a7c9.tar.xz) = 3097140 bytes
+SHA1 (patch-Xext_xf86bigfont.c) = f79803c6c120f96aefddd665c42b9d83769c9071
SHA1 (patch-config_config-backends.h) = f44868caa51e972a76949f73ac6083640af2c351
SHA1 (patch-config_config.c) = 5a3fe4cb6c2170335ab547f438386cff77a9c152
SHA1 (patch-config_devd.c) = d8c534837b1c448563c363465570b9dc403f19fa
SHA1 (patch-config_meson.build) = 865a422bc018e9778b3d8d52ee1bdbe042814550
+SHA1 (patch-config_wscons.c) = 6fe39b02fa6a9e98dd82321152afe33c55b9d272
SHA1 (patch-glamor_glamor__egl.c) = 8057778a5f0fd03c3ecd1191cff9123310396a1f
-SHA1 (patch-hw_xfree86_common_xf86AutoConfig.c) = 61c72780a65d423965225a2dd2206bcf2264c89f
-SHA1 (patch-hw_xfree86_common_xf86Config.c) = bcb413a2211ddcde0728a368e313bea841e03828
+SHA1 (patch-hw_xfree86_common_xf86AutoConfig.c) = ec02893276a3f4360f27fd8648d846f3074057db
+SHA1 (patch-hw_xfree86_common_xf86Config.c) = 904e192e3abf80e78e2afba0f589e51c25ccc3a2
+SHA1 (patch-hw_xfree86_common_xf86Configure.c) = 519bbe4b0edbd08b4eac85feaab5c7d4590283f9
SHA1 (patch-hw_xfree86_common_xf86Globals.c) = da35eb1c437eaffce0b8f8a3964e3a75631d8a73
+SHA1 (patch-hw_xfree86_common_xf86Helper.c) = 658ba1e2f987468f7ceabb4ec5b209ca4080db7e
SHA1 (patch-hw_xfree86_common_xf86Xinput.c) = 5ad0c36fe68f87c853ac084640269e3b8f9370c9
+SHA1 (patch-hw_xfree86_common_xf86pciBus.c) = 6d112060b0ebb2be8c93bf567d4a4904829af44b
SHA1 (patch-hw_xfree86_common_xf86sbusBus.h) = f56f87336b2f669413ebb1005a2b64568a111f92
SHA1 (patch-hw_xfree86_dri2_dri2.c) = 475ea1956f2e71d684cf1e5a8a68b30279959a04
-SHA1 (patch-hw_xfree86_drivers_modesetting_drmmode__display.c) = 61735de44b0579d0a3d2bfb0d91c72c365d1b93f
+SHA1 (patch-hw_xfree86_drivers_modesetting_drmmode__display.c) = 6fd5822ecef0dbb55adf55173e213215fab7f26e
+SHA1 (patch-hw_xfree86_int10_helper__exec.c) = 06a35862bccbcf9c7496b44ee7762c393ca418ff
SHA1 (patch-hw_xfree86_modes_xf86Cursors.c) = bd9870edb1196a4d2eab49b2d13fbe6eefbe4c09
+SHA1 (patch-hw_xfree86_modes_xf86RandR12.c) = 6a55dc74cae9897c73e77edda5b677afeb70d60f
SHA1 (patch-hw_xfree86_os-support_bsd_arm__video.c) = 9c03b24f44eafc5fabe27e9d6cc6c54b607e47c3
-SHA1 (patch-hw_xfree86_os-support_bsd_bsd__VTsw.c) = 90343f694c27a6fdd5070e1167687943bd056a99
-SHA1 (patch-hw_xfree86_os-support_bsd_bsd__init.c) = 0180a25df158ce3716071882fbb55cff9fe8e5ff
+SHA1 (patch-hw_xfree86_os-support_bsd_bsd__VTsw.c) = f5e7c510d35a1adfb9aae8dfc05a2ab3503ef904
+SHA1 (patch-hw_xfree86_os-support_bsd_bsd__init.c) = fe6f69af9435f9fdb4c8e7e4bccc20c131ae219c
SHA1 (patch-hw_xfree86_os-support_bsd_i386__video.c) = 68889e3ae80b9536d82909855ec7156caa928374
SHA1 (patch-hw_xfree86_os-support_bsd_ppc__video.c) = 2f5126ee47cbd66c0241e8fbf66c8af363e01fd7
SHA1 (patch-hw_xfree86_os-support_bus_Sbus.c) = 0035b970bdae1bab51b8ca6bfeed060ec4df3a60
+SHA1 (patch-hw_xfree86_os-support_bus_bsd__pci.c) = dc2fe5d02196b4a074ebd4d8405a69e7bbbb7a5e
SHA1 (patch-hw_xfree86_os-support_meson.build) = 9a254dbd4480a58ee1f8515d6f810d40ca6cd74a
SHA1 (patch-hw_xfree86_os-support_solaris_solaris-amd64.S) = 088a3118deb7567194e08dd46e34cb6edba38400
SHA1 (patch-hw_xfree86_os-support_xf86_OSproc.h) = e1c049857893d2f050d5fb297a3e8ef86f0b1d7e
SHA1 (patch-hw_xfree86_os_support_bus_xf86Sbus.h) = 0e0a243b737f8f762c9f8f24a2265d1b6aefb544
SHA1 (patch-hw_xfree86_xorg-wrapper.c) = d1178c088307cd3781f8989522bab570b551ff55
SHA1 (patch-include_meson.build) = 8e7cfb8140e325279fbd8fcebc165b9ddcf4c32d
+SHA1 (patch-os_utils.c) = ce6d474deb9b04701ac16c4bdb3131e41a98bfa2
SHA1 (patch-randr_randr.c) = eb44a07770ca7308d706aa2324408bb8c6c6b7ba
SHA1 (patch-randr_rrlease.c) = 82ace923fe7b65f4cf1be2ff243eabd886f3109e
SHA1 (patch-test_xtest.c) = 77622ef481e91e64b3a6dd64b8579404f33ec88f
diff --git a/modular-xorg-server-dfbsd-meson/options.mk b/modular-xorg-server-dfbsd-meson/options.mk
index 1d3e50e46f..87b215425f 100644
--- a/modular-xorg-server-dfbsd-meson/options.mk
+++ b/modular-xorg-server-dfbsd-meson/options.mk
@@ -13,6 +13,18 @@ PKG_SUPPORTED_OPTIONS+= revert_flink
PKG_SUPPORTED_OPTIONS+= revert_randr_lease
PKG_SUPPORTED_OPTIONS+= allow_unprivileged
PKG_SUPPORTED_OPTIONS+= xkb_evdev
+PKG_SUPPORTED_OPTIONS+= add_modesetting_driver
+PKG_SUPPORTED_OPTIONS+= add_scfb_driver
+
+PKG_SUPPORTED_OPTIONS+= strict_netbsd
+
+PKG_SUPPORTED_OPTIONS+= modesetting_on_intel
+PKG_SUPPORTED_OPTIONS+= fallback_not_wsdisplay
+PKG_SUPPORTED_OPTIONS+= kbd_by_masking_bits
+PKG_SUPPORTED_OPTIONS+= usl_vt_switching
+PKG_SUPPORTED_OPTIONS+= openbsd_more_calls
+PKG_SUPPORTED_OPTIONS+= randr_backlight
+PKG_SUPPORTED_OPTIONS+= ws_drivers_openbsd
.if ${OPSYS} == "FreeBSD" || ${OPSYS} == "DragonFly"
PKG_SUGGESTED_OPTIONS+= devd
@@ -27,6 +39,53 @@ PKG_SUGGESTED_OPTIONS+= revert_randr_lease
PKG_SUGGESTED_OPTIONS+= allow_unprivileged
.endif
+# Add modesetting driver in xf86AutoConfig.c
+.if ${OPSYS} == "FreeBSD" || ${OPSYS} == "DragonFly"
+PKG_SUGGESTED_OPTIONS+= add_modesetting_driver
+.endif
+
+# Add scfb driver in xf86AutoConfig.c
+.if ${OPSYS} == "FreeBSD"
+PKG_SUGGESTED_OPTIONS+= add_scfb_driver
+.endif
+
+.if ${OPSYS} == "NetBSD"
+PKG_SUGGESTED_OPTIONS+= strict_netbsd
+.endif
+
+# Patch from OpenBSD to aggressively use the modesetting driver on intel integrated graphics
+# .if ${OPSYS} == "FreeBSD" || ${OPSYS} == "DragonFly" || ${OPSYS} == "NetBSD" || ${OPSYS} == "OpenBSD"
+# PKG_SUGGESTED_OPTIONS+= modesetting_on_intel
+# .endif
+
+# From OpenBSD 6.5 xenocara xserver 1.19.6
+.if ${OPSYS} == "OpenBSD"
+PKG_SUGGESTED_OPTIONS+= fallback_not_wsdisplay
+.endif
+
+.if ${OPSYS} == "OpenBSD"
+PKG_SUGGESTED_OPTIONS+= kbd_by_masking_bits
+.endif
+
+# Implement VT switching based on the USL compat interface
+.if ${OPSYS} == "OpenBSD"
+PKG_SUGGESTED_OPTIONS+= usl_vt_switching
+.endif
+
+.if ${OPSYS} == "OpenBSD"
+PKG_SUGGESTED_OPTIONS+= openbsd_more_calls
+.endif
+
+# From OpenBSD 6.5 xenocara xserver 1.19.6
+.if ${OPSYS} == "OpenBSD"
+PKG_SUGGESTED_OPTIONS+= randr_backlight
+.endif
+
+# From OpenBSD 6.5 xenocara xserver 1.19.6
+.if ${OPSYS} == "OpenBSD"
+PKG_SUGGESTED_OPTIONS+= ws_drivers_openbsd
+.endif
+
.include "../../mk/bsd.options.mk"
PLIST_VARS+= dri dtrace
@@ -133,3 +192,43 @@ MESON_ARGS+= -Dxkb_default_rules=evdev
.else
MESON_ARGS+= -Dxkb_default_rules=base
.endif
+
+.if !empty(PKG_OPTIONS:Madd_modesetting_driver)
+CPPFLAGS+= -DADD_MODESETTING_DRIVER
+.endif
+
+.if !empty(PKG_OPTIONS:Madd_scfb_driver)
+CPPFLAGS+= -DADD_SCFB_DRIVER
+.endif
+
+.if !empty(PKG_OPTIONS:Mstrict_netbsd)
+CPPFLAGS+= -DSTRICT_NETBSD
+.endif
+
+.if !empty(PKG_OPTIONS:Mmodesetting_on_intel)
+CPPFLAGS+= -DMODESETTING_ON_INTEL
+.endif
+
+.if !empty(PKG_OPTIONS:Mfallback_not_wsdisplay)
+CPPFLAGS+= -DFALLBACK_NOT_WSDISPLAY
+.endif
+
+.if !empty(PKG_OPTIONS:Mkbd_by_masking_bits)
+CPPFLAGS+= -DKBD_BY_MASKING_BITS
+.endif
+
+.if !empty(PKG_OPTIONS:Musl_vt_switching)
+CPPFLAGS+= -DUSL_VT_SWITCHING
+.endif
+
+.if !empty(PKG_OPTIONS:Mopenbsd_more_calls)
+CPPFLAGS+= -DOPENBSD_MORE_CALLS
+.endif
+
+.if !empty(PKG_OPTIONS:Mws_drivers_openbsd)
+CPPFLAGS+= -DWS_DRIVERS_OPENBSD
+.endif
+
+.if !empty(PKG_OPTIONS:Mrandr_backlight)
+CPPFLAGS+= -DRANDR_BACKLIGHT
+.endif
diff --git a/modular-xorg-server-dfbsd-meson/patches/patch-Xext_xf86bigfont.c b/modular-xorg-server-dfbsd-meson/patches/patch-Xext_xf86bigfont.c
new file mode 100644
index 0000000000..f61126f1af
--- /dev/null
+++ b/modular-xorg-server-dfbsd-meson/patches/patch-Xext_xf86bigfont.c
@@ -0,0 +1,16 @@
+$NetBSD$
+
+--- Xext/xf86bigfont.c.orig 2019-03-05 16:34:21.000000000 +0000
++++ Xext/xf86bigfont.c
+@@ -377,7 +377,11 @@ ProcXF86BigfontQueryFont(ClientPtr clien
+ #ifdef HAS_SHM
+ if (!badSysCall)
+ pDesc = (ShmDescPtr) FontGetPrivate(pFont, FontShmdescIndex);
++#if defined(STRICT_NETBSD)
++ if (pDesc && pDesc->attach_addr) {
++#else
+ if (pDesc) {
++#endif
+ pCI = (xCharInfo *) pDesc->attach_addr;
+ if (stuff_flags & XF86Bigfont_FLAGS_Shm)
+ shmid = pDesc->shmid;
diff --git a/modular-xorg-server-dfbsd-meson/patches/patch-config_wscons.c b/modular-xorg-server-dfbsd-meson/patches/patch-config_wscons.c
new file mode 100644
index 0000000000..8efc93b5e8
--- /dev/null
+++ b/modular-xorg-server-dfbsd-meson/patches/patch-config_wscons.c
@@ -0,0 +1,169 @@
+$NetBSD$
+
+Changes from NetBSD xsrc xorg-server 1.20.4.
+
+Option for masking bits to compare kbd value from OpenBSD xenocara.
+
+--- config/wscons.c.orig 2019-03-05 16:34:21.000000000 +0000
++++ config/wscons.c
+@@ -25,14 +25,17 @@
+ #include <dix-config.h>
+ #endif
+
+-#include <dev/wscons/wsconsio.h>
+-#include <dev/wscons/wsksymdef.h>
+-
++#include <sys/types.h>
+ #include <sys/ioctl.h>
++#include <sys/time.h>
++#include <fcntl.h>
+ #include <errno.h>
+ #include <string.h>
+ #include <unistd.h>
+
++#include <dev/wscons/wsconsio.h>
++#include <dev/wscons/wsksymdef.h>
++
+ #include "input.h"
+ #include "inputstr.h"
+ #include "os.h"
+@@ -41,6 +44,7 @@
+ #define WSCONS_KBD_DEVICE "/dev/wskbd"
+ #define WSCONS_MOUSE_PREFIX "/dev/wsmouse"
+
++#if defined(KB_LA) && defined(KB_CF)
+ #define KB_OVRENC \
+ { KB_UK, "gb" }, \
+ { KB_SV, "se" }, \
+@@ -48,13 +52,27 @@
+ { KB_SF, "ch" }, \
+ { KB_LA, "latam" }, \
+ { KB_CF, "ca" }
++#else
++#define KB_OVRENC \
++ { KB_UK, "gb" }, \
++ { KB_SV, "se" }, \
++ { KB_SG, "ch" }, \
++ { KB_SF, "ch" }
++#endif
+
+ struct nameint {
+ int val;
+ char *name;
+ } kbdenc[] = {
+ KB_OVRENC,
++#if defined(STRICT_NETBSD)
++ KB_ENCTAB
++#ifndef __NetBSD__
++ ,
++#endif
++#else /* !STRICT_NETBSD */
+ KB_ENCTAB,
++#endif /* STRICT_NETBSD */
+ {0}
+ };
+
+@@ -62,10 +80,14 @@ struct nameint kbdvar[] = {
+ {KB_NODEAD | KB_SG, "de_nodeadkeys"},
+ {KB_NODEAD | KB_SF, "fr_nodeadkeys"},
+ {KB_SF, "fr"},
++#if defined(KB_CF)
+ {KB_DVORAK | KB_CF, "fr-dvorak"},
++#endif
+ {KB_DVORAK | KB_FR, "bepo"},
+ {KB_DVORAK, "dvorak"},
++#if defined(KB_CF)
+ {KB_CF, "fr-legacy"},
++#endif
+ {KB_NODEAD, "nodeadkeys"},
+ {0}
+ };
+@@ -121,8 +143,12 @@ wscons_add_keyboard(void)
+ input_options = input_option_new(input_options, "name", WSCONS_KBD_DEVICE);
+ input_options = input_option_new(input_options, "driver", "kbd");
+
++#if defined(STRICT_NETBSD)
++ if (asprintf(&config_info, "wscons:%s", WSCONS_KBD_DEVICE) != -1)
++#else
+ config_info = Xprintf("wscons:%s", WSCONS_KBD_DEVICE);
+ if (!config_info)
++#endif
+ goto unwind;
+ if (KB_ENCODING(wsenc) == KB_USER) {
+ /* Ignore wscons "user" layout */
+@@ -138,7 +164,11 @@ wscons_add_keyboard(void)
+ break;
+ }
+ for (i = 0; kbdvar[i].val; i++)
++#if defined(KBD_BY_MASKING_BITS)
++ if ((wsenc & kbdvar[i].val) == kbdvar[i].val) {
++#else
+ if (wsenc == kbdvar[i].val || KB_VARIANT(wsenc) == kbdvar[i].val) {
++#endif
+ LogMessageVerb(X_INFO, 3, "wskbd: using variant %s\n",
+ kbdvar[i].name);
+ input_options = input_option_new(input_options,
+@@ -146,7 +176,11 @@ wscons_add_keyboard(void)
+ break;
+ }
+ for (i = 0; kbdopt[i].val; i++)
++#if defined(KBD_BY_MASKING_BITS)
++ if (KB_VARIANT(wsenc) & kbdopt[i].val) {
++#else
+ if (KB_VARIANT(wsenc) == kbdopt[i].val) {
++#endif
+ LogMessageVerb(X_INFO, 3, "wskbd: using option %s\n",
+ kbdopt[i].name);
+ input_options = input_option_new(input_options,
+@@ -185,8 +219,12 @@ wscons_add_pointer(const char *path, con
+ char *config_info = NULL;
+ int rc;
+
++#if defined(STRICT_NETBSD)
++ if (asprintf(&config_info, "wscons:%s", path) == -1)
++#else
+ config_info = Xprintf("wscons:%s", path);
+ if (!config_info)
++#endif
+ return;
+
+ input_options = input_option_new(input_options, "_source", "server/wscons");
+@@ -220,7 +258,11 @@ wscons_add_pointers(void)
+ for (i = 0; i < 4; i++) {
+ snprintf(devname, sizeof(devname), "%s%d", WSCONS_MOUSE_PREFIX, i);
+ LogMessageVerb(X_INFO, 10, "wsmouse: checking %s\n", devname);
+- fd = open_device(devnamem O_RDWR | O_NONBLOCK | O_EXCL);
++#ifdef __NetBSD__
++ fd = open(devname, O_RDWR | O_NONBLOCK | O_EXCL);
++#else
++ fd = open_device(devname, O_RDWR | O_NONBLOCK | O_EXCL);
++#endif
+ if (fd == -1) {
+ LogMessageVerb(X_WARNING, 10, "%s: %s\n", devname, strerror(errno));
+ continue;
+@@ -233,9 +275,11 @@ wscons_add_pointers(void)
+ }
+ close(fd);
+ switch (wsmouse_type) {
++#if defined(WSMOUSE_TYPE_SYNAPTICS)
+ case WSMOUSE_TYPE_SYNAPTICS:
+ wscons_add_pointer(devname, "synaptics", ATTR_TOUCHPAD);
+ break;
++#endif
+ case WSMOUSE_TYPE_TPANEL:
+ wscons_add_pointer(devname, "ws", ATTR_TOUCHSCREEN);
+ break;
+@@ -243,8 +287,13 @@ wscons_add_pointers(void)
+ break;
+ }
+ }
++#if defined(WS_DRIVERS_OPENBSD)
++ /* Add a default entry catching all other mux elements as "ws" */
++ wscons_add_pointer(WSCONS_MOUSE_PREFIX, "ws", ATTR_POINTER);
++#else
+ /* Add a default entry catching all other mux elements as "mouse" */
+ wscons_add_pointer(WSCONS_MOUSE_PREFIX, "mouse", ATTR_POINTER);
++#endif
+ }
+
+ int
diff --git a/modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_common_xf86AutoConfig.c b/modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_common_xf86AutoConfig.c
index a019dacd4c..d4ac861607 100644
--- a/modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_common_xf86AutoConfig.c
+++ b/modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_common_xf86AutoConfig.c
@@ -2,16 +2,20 @@ $NetBSD: patch-hw_xfree86_common_xf86AutoConfig.c,v 1.3 2018/10/26 10:20:12 maya
Patches from FreeBSD ports /DragonFly dports for x11-servers/xorg-server 1.18.4.
+Add option for modesetting driver.
+
+Add option for scfb driver.
+
Look for wsfb on netbsd (needed by genfb)
---- hw/xfree86/common/xf86AutoConfig.c.orig 2018-10-25 14:13:21.000000000 +0000
+--- hw/xfree86/common/xf86AutoConfig.c.orig 2019-03-05 16:34:21.000000000 +0000
+++ hw/xfree86/common/xf86AutoConfig.c
@@ -294,7 +294,7 @@ listPossibleVideoDrivers(XF86MatchedDriv
xf86PciMatchDriver(md);
#endif
-#if defined(__linux__)
-+#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__)
++#if defined(__linux__) || defined(ADD_MODESETTING_DRIVER)
xf86AddMatchedDriver(md, "modesetting");
#endif
@@ -22,7 +26,7 @@ Look for wsfb on netbsd (needed by genfb)
-#else
+#elif defined(__linux__)
xf86AddMatchedDriver(md, "fbdev");
-+#elif defined(__FreeBSD__)
++#elif defined(ADD_SCFB_DRIVER)
+ xf86AddMatchedDriver(md, "scfb");
#endif
#endif /* !__sun */
diff --git a/modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_common_xf86Config.c b/modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_common_xf86Config.c
index b888c06b04..c2a690c181 100644
--- a/modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_common_xf86Config.c
+++ b/modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_common_xf86Config.c
@@ -3,9 +3,21 @@ $NetBSD$
devd support to detect devices from FreeBSD ports / DragonFly dports
x11-servers/xorg-server 1.18.4.
---- hw/xfree86/common/xf86Config.c.orig 2017-01-05 21:19:31.000000000 +0000
+--- hw/xfree86/common/xf86Config.c.orig 2019-03-05 16:34:21.000000000 +0000
+++ hw/xfree86/common/xf86Config.c
-@@ -1375,13 +1375,16 @@ checkCoreInputDevices(serverLayoutPtr se
+@@ -1020,7 +1020,11 @@ checkCoreInputDevices(serverLayoutPtr se
+ MessageType from = X_DEFAULT;
+
+ const char *mousedrivers[] = { "mouse", "synaptics", "evdev", "vmmouse",
++#if defined(WS_DRIVERS_OPENBSD)
++ "ws", "void", NULL
++#else
+ "void", NULL
++#endif
+ };
+
+ /*
+@@ -1260,13 +1264,16 @@ checkCoreInputDevices(serverLayoutPtr se
}
if (!xf86Info.forceInputDevices && !(foundPointer && foundKeyboard)) {
diff --git a/modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_common_xf86Configure.c b/modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_common_xf86Configure.c
new file mode 100644
index 0000000000..993500391d
--- /dev/null
+++ b/modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_common_xf86Configure.c
@@ -0,0 +1,14 @@
+$NetBSD$
+
+--- hw/xfree86/common/xf86Configure.c.orig 2019-03-05 16:34:21.000000000 +0000
++++ hw/xfree86/common/xf86Configure.c
+@@ -821,6 +821,9 @@ DoConfigure(void)
+ ErrorF("To test the server, run 'X -config %s'\n\n", filename);
+
+ bail:
++#if defined(OPENBSD_MORE_CALLS)
++ CloseWellKnownConnections();
++#endif
+ OsCleanup(TRUE);
+ ddxGiveUp(EXIT_ERR_CONFIGURE);
+ fflush(stderr);
diff --git a/modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_common_xf86Helper.c b/modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_common_xf86Helper.c
new file mode 100644
index 0000000000..fb93a53d11
--- /dev/null
+++ b/modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_common_xf86Helper.c
@@ -0,0 +1,23 @@
+$NetBSD$
+
+--- hw/xfree86/common/xf86Helper.c.orig 2019-03-05 16:34:21.000000000 +0000
++++ hw/xfree86/common/xf86Helper.c
+@@ -1281,6 +1281,18 @@ xf86MatchDevice(const char *drivername,
+ if (sectlist)
+ *sectlist = NULL;
+
++#if defined(STRICT_NETBSD)
++ /*
++ * 20111009 jmcneill: This line was removed with the following commit upstream:
++ * http://cgit.freedesktop.org/xorg/xserver/commit/hw/xfree86/common/xf86Helper.c?id=0ceac6f64f5ad9bc2ac4b19be2dd245ffba78b05
++ *
++ * However, the log message is inaccurate: xf86MatchDevice will get called at
++ * configuration time by drivers who still implement the legacy probing
++ * API.
++ */
++ if (xf86DoConfigure && xf86DoConfigurePass1) return 1;
++#endif
++
+ /*
+ * This can happen when running Xorg -showopts and a module like ati
+ * or vmware tries to load its submodules when xf86ConfigLayout is empty
diff --git a/modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_common_xf86pciBus.c b/modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_common_xf86pciBus.c
new file mode 100644
index 0000000000..62997d9022
--- /dev/null
+++ b/modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_common_xf86pciBus.c
@@ -0,0 +1,45 @@
+$NetBSD$
+
+From OpenBSD 6.5 xenocara
+
+--- hw/xfree86/common/xf86pciBus.c.orig 2019-03-05 16:34:21.000000000 +0000
++++ hw/xfree86/common/xf86pciBus.c
+@@ -1174,9 +1174,38 @@ xf86VideoPtrToDriverList(struct pci_devi
+ case 0x0bef:
+ /* Use fbdev/vesa driver on Oaktrail, Medfield, CDV */
+ break;
++#if defined(MODESETTING_ON_INTEL)
++ case 0x3577:
++ case 0x2562:
++ case 0x3582:
++ case 0x358e: /* 854 */
++ case 0x2572:
++ case 0x2582:
++ case 0x258a:
++ case 0x2592:
++ case 0x2772:
++ case 0x27a2:
++ case 0x27ae:
++ case 0x2972:
++ case 0x29b2:
++ case 0x29c2:
++ case 0x29d2:
++ case 0xa001:
++ case 0xa011:
++ case 0x0042: /* XXX Ironlake is unstable with modesetting */
++ case 0x0046:
++ /* Use intel driver on 2nd and 3rd generation */
++ driverList[0] = "intel";
++ break;
++ default:
++ /* Use modesetting driver on 4th generation and up */
++ driverList[0] = "modesetting";
++ break;
++#else
+ default:
+ driverList[0] = "intel";
+ break;
++#endif
+ }
+ break;
+ case 0x102b:
diff --git a/modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_drivers_modesetting_drmmode__display.c b/modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_drivers_modesetting_drmmode__display.c
index 0bea7afcea..74a077ce6c 100644
--- a/modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_drivers_modesetting_drmmode__display.c
+++ b/modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_drivers_modesetting_drmmode__display.c
@@ -6,9 +6,109 @@ Option to revert effects of upstream:
commit e4e3447603b5fd3a38a92c3f972396d1f81168ad
---- hw/xfree86/drivers/modesetting/drmmode_display.c.orig 2018-10-15 15:59:33.000000000 +0000
+Option from OpenBSD xenocara for randr backlight setting
+
+--- hw/xfree86/drivers/modesetting/drmmode_display.c.orig 2019-03-05 16:34:21.000000000 +0000
+++ hw/xfree86/drivers/modesetting/drmmode_display.c
-@@ -3196,6 +3196,7 @@ drmmode_xf86crtc_resize(ScrnInfoPtr scrn
+@@ -1754,11 +1754,21 @@ drmmode_set_target_scanout_pixmap_cpu(xf
+ DamageRegister(&ppix->drawable, ppriv->slave_damage);
+
+ if (ppriv->fb_id == 0) {
++#if defined(STRICT_NETBSD)
++ int ret = drmModeAddFB(drmmode->fd, ppix->drawable.width,
++#else
+ drmModeAddFB(drmmode->fd, ppix->drawable.width,
++#endif
+ ppix->drawable.height,
+ ppix->drawable.depth,
+ ppix->drawable.bitsPerPixel,
+ ppix->devKind, ppriv->backing_bo->handle, &ppriv->fb_id);
++#if defined(STRICT_NETBSD)
++ if (ret) {
++ ErrorF("failed to set scanout pixmap cpu\n");
++ return FALSE;
++ }
++#endif
+ }
+ *target = ppix;
+ return TRUE;
+@@ -2579,6 +2589,10 @@ drmmode_property_ignore(drmModePropertyP
+ return FALSE;
+ }
+
++#if defined(RANDR_BACKLIGHT)
++static Atom backlight_atom;
++#endif
++
+ static void
+ drmmode_output_create_resources(xf86OutputPtr output)
+ {
+@@ -2757,7 +2771,52 @@ drmmode_output_set_property(xf86OutputPt
+ static Bool
+ drmmode_output_get_property(xf86OutputPtr output, Atom property)
+ {
++#if defined(RANDR_BACKLIGHT)
++ drmmode_output_private_ptr drmmode_output = output->driver_private;
++ drmmode_ptr drmmode = drmmode_output->drmmode;
++ drmModeObjectPropertiesPtr props;
++ int i;
++
++ if (property != backlight_atom)
++ return TRUE;
++
++ props = drmModeObjectGetProperties(drmmode->fd, drmmode_output->output_id,
++ DRM_MODE_OBJECT_CONNECTOR);
++ if (!props)
++ return FALSE;
++
++ for (i = 0; i < drmmode_output->num_props; i++) {
++ drmmode_prop_ptr p = &drmmode_output->props[i];
++ int j;
++
++ if (p->atoms[0] != property)
++ continue;
++
++ for (j = 0; j < props->count_props; j++) {
++ if (props->props[j] == p->mode_prop->prop_id) {
++ INT32 value;
++ int err;
++
++ value = p->value = props->prop_values[j];
++ err = RRChangeOutputProperty(output->randr_output, p->atoms[0],
++ XA_INTEGER, 32, PropModeReplace, 1,
++ &value, FALSE, TRUE);
++ if (err != 0) {
++ xf86DrvMsg(output->scrn->scrnIndex, X_ERROR,
++ "RRChangeOutputProperty error, %d\n", err);
++ }
++
++ drmModeFreeObjectProperties(props);
++ return TRUE;
++ }
++ }
++ }
++
++ drmModeFreeObjectProperties(props);
++ return FALSE;
++#else
+ return TRUE;
++#endif
+ }
+
+ static const xf86OutputFuncsRec drmmode_output_funcs = {
+@@ -2837,7 +2896,11 @@ static int parse_path_blob(drmModeProper
+ if (!conn)
+ return -1;
+ len = conn - (blob_data + 4);
++#if defined(STRICT_NETBSD)
++ if (len + 1 >= sizeof(conn_id))
++#else
+ if (len + 1> 5)
++#endif
+ return -1;
+ memcpy(conn_id, blob_data + 4, len);
+ conn_id[len] = '\0';
+@@ -3202,6 +3265,7 @@ drmmode_xf86crtc_resize(ScrnInfoPtr scrn
return FALSE;
}
@@ -16,7 +116,7 @@ commit e4e3447603b5fd3a38a92c3f972396d1f81168ad
static void
drmmode_validate_leases(ScrnInfoPtr scrn)
{
-@@ -3233,6 +3234,7 @@ drmmode_validate_leases(ScrnInfoPtr scrn
+@@ -3239,6 +3303,7 @@ drmmode_validate_leases(ScrnInfoPtr scrn
free(lessees);
}
@@ -24,7 +124,7 @@ commit e4e3447603b5fd3a38a92c3f972396d1f81168ad
static int
drmmode_create_lease(RRLeasePtr lease, int *fd)
-@@ -3485,8 +3487,10 @@ drmmode_set_desired_modes(ScrnInfoPtr pS
+@@ -3491,8 +3556,10 @@ drmmode_set_desired_modes(ScrnInfoPtr pS
}
}
@@ -35,7 +135,7 @@ commit e4e3447603b5fd3a38a92c3f972396d1f81168ad
return TRUE;
}
-@@ -3693,8 +3697,10 @@ drmmode_handle_uevents(int fd, void *clo
+@@ -3699,8 +3766,10 @@ drmmode_handle_uevents(int fd, void *clo
drmmode_output_init(scrn, drmmode, mode_res, i, TRUE, 0);
}
diff --git a/modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_int10_helper__exec.c b/modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_int10_helper__exec.c
new file mode 100644
index 0000000000..8709a7ca6d
--- /dev/null
+++ b/modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_int10_helper__exec.c
@@ -0,0 +1,33 @@
+$NetBSD$
+
+--- hw/xfree86/int10/helper_exec.c.orig 2019-03-05 16:34:21.000000000 +0000
++++ hw/xfree86/int10/helper_exec.c
+@@ -676,6 +676,7 @@ bios_checksum(const uint8_t *start, int
+ void
+ LockLegacyVGA(xf86Int10InfoPtr pInt, legacyVGAPtr vga)
+ {
++#if !defined(NO_LEGACY_VGA) || !defined(STRICT_NETBSD)
+ vga->save_msr = pci_io_read8(pInt->io, 0x03CC);
+ vga->save_vse = pci_io_read8(pInt->io, 0x03C3);
+ #ifndef __ia64__
+@@ -688,17 +689,20 @@ LockLegacyVGA(xf86Int10InfoPtr pInt, leg
+ pci_io_write8(pInt->io, 0x46E8, ~(uint8_t) 0x08 & vga->save_46e8);
+ #endif
+ pci_io_write8(pInt->io, 0x0102, ~(uint8_t) 0x01 & vga->save_pos102);
++#endif /* NO_LEGACY_VGA */
+ }
+
+ void
+ UnlockLegacyVGA(xf86Int10InfoPtr pInt, legacyVGAPtr vga)
+ {
++#if !defined(NO_LEGACY_VGA) || !defined(STRICT_NETBSD)
+ pci_io_write8(pInt->io, 0x0102, vga->save_pos102);
+ #ifndef __ia64__
+ pci_io_write8(pInt->io, 0x46E8, vga->save_46e8);
+ #endif
+ pci_io_write8(pInt->io, 0x03C3, vga->save_vse);
+ pci_io_write8(pInt->io, 0x03C2, vga->save_msr);
++#endif /* NO_LEGACY_VGA */
+ }
+
+ #if defined (_PC)
diff --git a/modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_modes_xf86RandR12.c b/modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_modes_xf86RandR12.c
new file mode 100644
index 0000000000..96ee812086
--- /dev/null
+++ b/modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_modes_xf86RandR12.c
@@ -0,0 +1,14 @@
+$NetBSD$
+
+--- hw/xfree86/modes/xf86RandR12.c.orig 2019-03-05 16:34:21.000000000 +0000
++++ hw/xfree86/modes/xf86RandR12.c
+@@ -825,6 +825,9 @@ xf86RandR12CreateScreenResources(ScreenP
+ pScreen->width = width;
+ pScreen->height = height;
+ xf86RandR12ScreenSetSize(pScreen, width, height, mmWidth, mmHeight);
++#if defined(OPENBSD_MORE_CALLS)
++ xf86ReconfigureLayout();
++#endif
+ }
+
+ if (randrp->virtualX == -1 || randrp->virtualY == -1) {
diff --git a/modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_os-support_bsd_bsd__VTsw.c b/modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_os-support_bsd_bsd__VTsw.c
index b2053bec7e..f7c0621103 100644
--- a/modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_os-support_bsd_bsd__VTsw.c
+++ b/modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_os-support_bsd_bsd__VTsw.c
@@ -2,10 +2,70 @@ $NetBSD: patch-hw_xfree86_os-support_bsd_bsd__VTsw.c,v 1.1 2015/10/11 18:28:53 t
VT switching support. From xsrc.
---- hw/xfree86/os-support/bsd/bsd_VTsw.c.orig 2015-05-21 14:21:39.000000000 +0000
+--- hw/xfree86/os-support/bsd/bsd_VTsw.c.orig 2019-03-05 16:34:21.000000000 +0000
+++ hw/xfree86/os-support/bsd/bsd_VTsw.c
-@@ -68,6 +68,9 @@ xf86VTSwitchAway()
+@@ -44,30 +44,69 @@
+ void
+ xf86VTRequest(int sig)
{
++#if defined(USL_VT_SWITCHING)
++#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) \
++ || defined(WSCONS_SUPPORT)
++ if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT ||
++ xf86Info.consType == WSCONS) {
++ xf86Info.vtRequestsPending = TRUE;
++ }
++#endif
++#else /* !USL_VT_SWITCHING */
+ #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
+ if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) {
+ xf86Info.vtRequestsPending = TRUE;
+ }
+ #endif
++#endif /* USL_VT_SWITCHING */
+ return;
+ }
+
+ Bool
+ xf86VTSwitchPending()
+ {
++#if defined(USL_VT_SWITCHING)
++#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) \
++ || defined(WSCONS_SUPPORT)
++ if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT ||
++ xf86Info.consType == WSCONS) {
++ return xf86Info.vtRequestsPending ? TRUE : FALSE;
++ }
++#endif
++#else /* !USL_VT_SWITCHING */
+ #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
+ if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) {
+ return xf86Info.vtRequestsPending ? TRUE : FALSE;
+ }
+ #endif
++#endif /* USL_VT_SWITCHING */
+ return FALSE;
+ }
+
+ Bool
+ xf86VTSwitchAway()
+ {
++#if defined(USL_VT_SWITCHING)
++#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) \
++ || defined(WSCONS_SUPPORT)
++ if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT ||
++ xf86Info.consType == WSCONS) {
++#ifdef WSCONS_SUPPORT
++ ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT);
++#endif
++ xf86Info.vtRequestsPending = FALSE;
++ if (ioctl(xf86Info.consoleFd, VT_RELDISP, 1) < 0)
++ return FALSE;
++ else
++ return TRUE;
++ }
++#endif
++#else /* !USL_VT_SWITCHING */
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) {
+#ifdef WSCONS_SUPPORT
@@ -14,8 +74,33 @@ VT switching support. From xsrc.
xf86Info.vtRequestsPending = FALSE;
if (ioctl(xf86Info.consoleFd, VT_RELDISP, 1) < 0)
return FALSE;
-@@ -83,6 +86,9 @@ xf86VTSwitchTo()
+@@ -75,14 +114,34 @@ xf86VTSwitchAway()
+ return TRUE;
+ }
+ #endif
++#endif /* USL_VT_SWITCHING */
+ return FALSE;
+ }
+
+ Bool
+ xf86VTSwitchTo()
{
++#if defined(USL_VT_SWITCHING)
++#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) \
++ || defined(WSCONS_SUPPORT)
++ if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT ||
++ xf86Info.consType == WSCONS) {
++#ifdef WSCONS_SUPPORT
++ ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS);
++#endif
++ xf86Info.vtRequestsPending = FALSE;
++ if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0)
++ return FALSE;
++ else
++ return TRUE;
++ }
++#endif
++#else /* !USL_VT_SWITCHING */
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) {
+#ifdef WSCONS_SUPPORT
@@ -24,3 +109,30 @@ VT switching support. From xsrc.
xf86Info.vtRequestsPending = FALSE;
if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0)
return FALSE;
+@@ -90,14 +149,26 @@ xf86VTSwitchTo()
+ return TRUE;
+ }
+ #endif
++#endif /* USL_VT_SWITCHING */
+ return TRUE;
+ }
+
+ Bool
+ xf86VTActivate(int vtno)
+ {
++#if defined(USL_VT_SWITCHING)
++#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) \
++ || defined(WSCONS_SUPPORT)
++ if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT
++ || xf86Info.consType == WSCONS) {
++ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, vtno) < 0)
++ return FALSE;
++ }
++#endif
++#else /* !USL_VT_SWITCHING */
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, vtno) < 0) {
+ return FALSE;
+ }
++#endif /* USL_VT_SWITCHING */
+ return TRUE;
+ }
diff --git a/modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_os-support_bsd_bsd__init.c b/modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_os-support_bsd_bsd__init.c
index 588e43728c..b9a4fa5ab3 100644
--- a/modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_os-support_bsd_bsd__init.c
+++ b/modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_os-support_bsd_bsd__init.c
@@ -16,10 +16,25 @@ for bug #196678
https://bugs.freebsd.org/bugzilla/attachment.cgi?id=191592&action=diff
---- hw/xfree86/os-support/bsd/bsd_init.c.orig 2018-10-25 14:13:21.000000000 +0000
+--- hw/xfree86/os-support/bsd/bsd_init.c.orig 2019-03-05 16:34:21.000000000 +0000
+++ hw/xfree86/os-support/bsd/bsd_init.c
-@@ -48,6 +48,10 @@ static int devConsoleFd = -1;
- #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
+@@ -37,6 +37,9 @@
+
+ #include <sys/utsname.h>
+ #include <sys/ioctl.h>
++#if defined(USL_VT_SWITCHING)
++#include <sys/sysctl.h>
++#endif
+ #include <stdlib.h>
+ #include <errno.h>
+
+@@ -45,9 +48,14 @@ static Bool KeepTty = FALSE;
+ #ifdef PCCONS_SUPPORT
+ static int devConsoleFd = -1;
+ #endif
+-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
++#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) \
++ || (defined(WSCONS_SUPPORT) && defined(USL_VT_SWITCHING))
static int VTnum = -1;
static int initialVT = -1;
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
@@ -29,9 +44,76 @@ https://bugs.freebsd.org/bugzilla/attachment.cgi?id=191592&action=diff
#endif
#ifdef PCCONS_SUPPORT
-@@ -165,10 +169,12 @@ xf86OpenConsole()
+@@ -67,13 +75,21 @@ static int initialVT = -1;
+ #ifdef PCVT_SUPPORT
+ /* Hellmuth Michaelis' pcvt driver */
+ #ifndef __OpenBSD__
++#if defined(__NetBSD__)
++#define PCVT_CONSOLE_DEV "/dev/ttyE0"
++#else
+ #define PCVT_CONSOLE_DEV "/dev/ttyv0"
++#endif
+ #else
+ #define PCVT_CONSOLE_DEV "/dev/ttyC0"
+ #endif
+ #define PCVT_CONSOLE_MODE O_RDWR|O_NDELAY
+ #endif
+
++#if defined(WSCONS_SUPPORT) && defined(USL_VT_SWITCHING)
++static Bool hasVT = FALSE; /* has VT support ? */
++#endif
++
+ #if defined(WSCONS_SUPPORT) && defined(__NetBSD__)
+ /* NetBSD's new console driver */
+ #define WSCONS_PCVT_COMPAT_CONSOLE_DEV "/dev/ttyE0"
+@@ -134,6 +150,11 @@ static int xf86OpenWScons(void);
+ * pcvt or syscons might succesfully probe as pccons.)
+ */
+ static xf86ConsOpen_t xf86ConsTab[] = {
++#if defined(USL_VT_SWITCHING)
++#ifdef WSCONS_SUPPORT
++ xf86OpenWScons,
++#endif
++#endif /* USL_VT_SWITCHING */
+ #ifdef PCVT_SUPPORT
+ xf86OpenPcvt,
+ #endif
+@@ -143,9 +164,11 @@ static xf86ConsOpen_t xf86ConsTab[] = {
+ #ifdef PCCONS_SUPPORT
+ xf86OpenPccons,
+ #endif
++#if !defined(USL_VT_SWITCHING)
+ #ifdef WSCONS_SUPPORT
+ xf86OpenWScons,
#endif
++#endif /* !USL_VT_SWITCHING */
+ (xf86ConsOpen_t) NULL
+ };
+@@ -155,7 +178,8 @@ xf86OpenConsole()
+ int i, fd = -1;
+ xf86ConsOpen_t *driver;
+
+-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
++#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) \
++ || (defined(WSCONS_SUPPORT) && defined(USL_VT_SWITCHING))
+ int result;
+
+ #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+@@ -164,11 +188,23 @@ xf86OpenConsole()
+ vtmode_t vtmode;
+ #endif
+
++#if defined(WSCONS_SUPPORT) && defined(USL_VT_SWITCHING)
++ int mode;
++#endif
++
++#if defined(USL_VT_SWITCHING)
++ if (xf86Info.consoleFd != -1) {
++ return;
++ }
++#endif
++
if (serverGeneration == 1) {
+#if !defined(ALLOW_UNPRIVILEGED)
/* check if we are run with euid==0 */
@@ -42,7 +124,7 @@ https://bugs.freebsd.org/bugzilla/attachment.cgi?id=191592&action=diff
if (!KeepTty) {
/*
-@@ -230,6 +236,9 @@ xf86OpenConsole()
+@@ -230,6 +266,9 @@ xf86OpenConsole()
* Add cases for other *BSD that behave the same.
*/
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
@@ -52,7 +134,7 @@ https://bugs.freebsd.org/bugzilla/attachment.cgi?id=191592&action=diff
uname(&uts);
i = atof(uts.release) * 100;
if (i >= 310)
-@@ -253,6 +262,9 @@ xf86OpenConsole()
+@@ -253,6 +292,9 @@ xf86OpenConsole()
#endif
acquire_vt:
if (!xf86Info.ShareVTs) {
@@ -62,7 +144,7 @@ https://bugs.freebsd.org/bugzilla/attachment.cgi?id=191592&action=diff
/*
* now get the VT
*/
-@@ -287,6 +299,27 @@ xf86OpenConsole()
+@@ -287,6 +329,27 @@ xf86OpenConsole()
if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0) {
FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed");
}
@@ -90,7 +172,225 @@ https://bugs.freebsd.org/bugzilla/attachment.cgi?id=191592&action=diff
}
else { /* xf86Info.ShareVTs */
close(xf86Info.consoleFd);
-@@ -594,6 +627,10 @@ xf86CloseConsole()
+@@ -295,7 +358,40 @@ xf86OpenConsole()
+ #endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
+ #ifdef WSCONS_SUPPORT
+ case WSCONS:
++
++#if defined(USL_VT_SWITCHING)
++ if (hasVT) {
++ /* now get the VT */
++ SYSCALL(result =
++ ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno));
++ if (result != 0) {
++ xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE %d failed\n", xf86Info.vtno);
++ }
++ SYSCALL(result =
++ ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno));
++ if (result != 0) {
++ xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n");
++ }
++
++ OsSignal(SIGUSR1, xf86VTRequest);
++
++ vtmode.mode = VT_PROCESS;
++ vtmode.relsig = SIGUSR1;
++ vtmode.acqsig = SIGUSR1;
++ vtmode.frsig = SIGUSR1;
++ if (ioctl(xf86Info.consoleFd, VT_SETMODE, &vtmode) < 0) {
++ FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed");
++ }
++ }
++ mode = WSDISPLAYIO_MODE_MAPPED;
++ if (ioctl(fd, WSDISPLAYIO_SMODE, &mode) < 0) {
++ FatalError("%s: WSDISPLAYIO_MODE_MAPPED failed (%s)\n%s",
++ "xf86OpenConsole", strerror(errno),
++ CHECK_DRIVER_MSG);
++ }
++#else /* !USL_VT_SWITCHING */
+ /* Nothing to do */
++#endif /* USL_VT_SWITCHING */
+ break;
+ #endif
+ }
+@@ -414,8 +510,18 @@ xf86OpenSyscons()
+ }
+
+ close(fd);
++#ifndef __OpenBSD__
++#if defined(__NetBSD__)
++ snprintf(vtname, sizeof(vtname), "/dev/ttyE%01x",
++ xf86Info.vtno - 1);
++#else
+ snprintf(vtname, sizeof(vtname), "/dev/ttyv%01x",
+ xf86Info.vtno - 1);
++#endif
++#else
++ snprintf(vtname, sizeof(vtname), "/dev/ttyC%01x",
++ xf86Info.vtno - 1);
++#endif
+ if ((fd = open(vtname, SYSCONS_CONSOLE_MODE, 0)) < 0) {
+ FatalError("xf86OpenSyscons: Cannot open %s (%s)",
+ vtname, strerror(errno));
+@@ -457,12 +563,26 @@ xf86OpenPcvt()
+ struct pcvtid pcvt_version;
+
+ #ifndef __OpenBSD__
++#if defined(__NetBSD__)
++ vtprefix = "/dev/ttyE";
++#else
+ vtprefix = "/dev/ttyv";
++#endif
+ #else
+ vtprefix = "/dev/ttyC";
+ #endif
+
++#if defined(USL_VT_SWITCHING)
++ if (VTnum != -1) {
++ snprintf(vtname, sizeof(vtname), "%s%x", vtprefix, VTnum - 1);
++ fd = open(vtname, PCVT_CONSOLE_MODE, 0);
++ }
++ else {
++ fd = open(PCVT_CONSOLE_DEV, PCVT_CONSOLE_MODE, 0);
++ }
++#else /* !USL_VT_SWITCHING */
+ fd = open(PCVT_CONSOLE_DEV, PCVT_CONSOLE_MODE, 0);
++#endif /* USL_VT_SWITCHING */
+ #ifdef WSCONS_PCVT_COMPAT_CONSOLE_DEV
+ if (fd < 0) {
+ fd = open(WSCONS_PCVT_COMPAT_CONSOLE_DEV, PCVT_CONSOLE_MODE, 0);
+@@ -529,6 +649,9 @@ xf86OpenPcvt()
+ xf86Msg(X_PROBED, "Using pcvt driver (version %d.%d)\n",
+ pcvt_version.rmajor, pcvt_version.rminor);
+ #endif
++#if defined(STRICT_NETBSD)
++ xf86Msg(X_PROBED, "using VT number %d\n", xf86Info.vtno);
++#endif
+ }
+ else {
+ /* Not pcvt */
+@@ -546,11 +669,101 @@ xf86OpenPcvt()
+ static int
+ xf86OpenWScons()
+ {
++#if defined(USL_VT_SWITCHING)
++ char vtname[16], vtprefix[16];
++ char *p;
++ int mib[2];
++ int fd = -1;
++ int i;
++ size_t len;
++ dev_t dev;
++ vtmode_t vtmode;
++#else /* !USL_VT_SWITCHING */
+ int fd = -1;
+ int mode = WSDISPLAYIO_MODE_MAPPED;
+ int i;
+ char ttyname[16];
++#endif /* USL_VT_SWITCHING */
+
++#if defined(USL_VT_SWITCHING)
++ if (xf86Info.ShareVTs)
++ FatalError("-sharevt is not supported with wscons\n");
++
++ /* default value if probing the console device fails */
++#if defined(__NetBSD__)
++ snprintf(vtprefix, sizeof(vtprefix), "/dev/ttyE");
++#elif defined(__OpenBSD__)
++ snprintf(vtprefix, sizeof(vtprefix), "/dev/ttyC");
++#else
++ snprintf(vtprefix, sizeof(vtprefix), "/dev/ttyv");
++#endif
++
++ /* probe console device - it my be /dev/ttyD0 on some multi-heads setups */
++ mib[0] = CTL_KERN;
++ mib[1] = KERN_CONSDEV;
++ len = sizeof(dev);
++ if (sysctl(mib, 2, &dev, &len, NULL, 0) != -1) {
++ snprintf(vtname, sizeof(vtname), "/dev/%s", devname(dev, S_IFCHR));
++ if ((fd = open(vtname, O_RDWR)) != -1) {
++ if (ioctl(fd, WSDISPLAYIO_GTYPE, &i) == 0) {
++ /* console is a wsdisplay(4) device */
++ strlcpy(vtprefix, vtname, sizeof(vtprefix));
++ /* strip number, assuming 0 */
++ p = strchr(vtprefix, '0');
++ *p = '\0';
++ close(fd);
++ fd = -1;
++ }
++ }
++ }
++ if (VTnum != -1) {
++ snprintf(vtname, sizeof(vtname), "%s%01x", vtprefix, VTnum - 1);
++ xf86Info.vtno = VTnum;
++ } else {
++ snprintf(vtname, sizeof(vtname), "%s0", vtprefix);
++ }
++ fd = open(vtname, O_RDWR);
++ if (fd == -1)
++ return fd;
++
++ /* Check if USL VTs are supported */
++ if (ioctl(fd, VT_GETACTIVE, &initialVT) < 0) {
++ if (errno == ENOTTY) {
++ /* double-check that this is a wsdisplay screeen */
++ if (ioctl(fd, WSDISPLAYIO_GTYPE, &i) == -1) {
++ close(fd);
++ return -1;
++ }
++ /* NO VTs */
++ initialVT = 1;
++ hasVT = FALSE;
++ } else {
++ close(fd);
++ return -1;
++ }
++ } else {
++ hasVT = TRUE;
++ /* find a free VT */
++ if (xf86Info.vtno == -1) {
++ if (ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) {
++ /* All VTs are in use. If initialVT was found, use it. */
++ if (initialVT != -1)
++ xf86Info.vtno = initialVT;
++ else
++ FatalError("xf86OpenWScons: Cannot find a free VT");
++ }
++ /* re-open the new VT */
++ close(fd);
++ snprintf(vtname, sizeof(vtname), "%s%01x", vtprefix,
++ xf86Info.vtno - 1);
++ if ((fd = open(vtname, O_RDWR)) < 0)
++ FatalError("xf86OpenWScons: cannot open %s (%s)",
++ vtname, strerror(errno));
++ }
++ }
++ xf86Info.consType = WSCONS;
++ xf86Msg(X_PROBED, "Using wscons driver on %s\n", vtname);
++#else /* !USL_VT_SWITCHING */
+ /* XXX Is this ok? */
+ for (i = 0; i < 8; i++) {
+ #if defined(__NetBSD__)
+@@ -569,6 +782,7 @@ xf86OpenWScons()
+ xf86Info.consType = WSCONS;
+ xf86Msg(X_PROBED, "Using wscons driver\n");
+ }
++#endif /* USL_VT_SWITCHING */
+ return fd;
+ }
+
+@@ -581,8 +795,10 @@ xf86CloseConsole()
+ struct vt_mode VT;
+ #endif
+
++#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) || !defined(STRICT_NETBSD)
+ if (xf86Info.ShareVTs)
+ return;
++#endif
+
+ switch (xf86Info.consType) {
+ #ifdef PCCONS_SUPPORT
+@@ -594,6 +810,10 @@ xf86CloseConsole()
case SYSCONS:
case PCVT:
ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT); /* Back to text mode */
@@ -101,3 +401,34 @@ https://bugs.freebsd.org/bugzilla/attachment.cgi?id=191592&action=diff
if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) != -1) {
VT.mode = VT_AUTO;
ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* dflt vt handling */
+@@ -614,6 +834,10 @@ xf86CloseConsole()
+ int mode = WSDISPLAYIO_MODE_EMUL;
+
+ ioctl(xf86Info.consoleFd, WSDISPLAYIO_SMODE, &mode);
++#if defined(USL_VT_SWITCHING)
++ if (initialVT != -1 && hasVT)
++ ioctl(xf86Info.consoleFd, VT_ACTIVATE, initialVT);
++#endif
+ break;
+ }
+ #endif
+@@ -638,7 +862,8 @@ xf86ProcessArgument(int argc, char *argv
+ KeepTty = TRUE;
+ return 1;
+ }
+-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
++#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) \
++ || (defined(WSCONS_SUPPORT) && defined(USL_VT_SWITCHING))
+ if ((argv[i][0] == 'v') && (argv[i][1] == 't')) {
+ if (sscanf(argv[i], "vt%2d", &VTnum) == 0 || VTnum < 1 || VTnum > 12) {
+ UseMsg();
+@@ -654,7 +879,8 @@ xf86ProcessArgument(int argc, char *argv
+ void
+ xf86UseMsg()
+ {
+-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
++#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) \
++ || (defined(WSCONS_SUPPORT) && defined(USL_VT_SWITCHING))
+ ErrorF("vtXX use the specified VT number (1-12)\n");
+ #endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
+ ErrorF("-keeptty ");
diff --git a/modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_os-support_bus_bsd__pci.c b/modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_os-support_bus_bsd__pci.c
new file mode 100644
index 0000000000..fc43f9d7cf
--- /dev/null
+++ b/modular-xorg-server-dfbsd-meson/patches/patch-hw_xfree86_os-support_bus_bsd__pci.c
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- hw/xfree86/os-support/bus/bsd_pci.c.orig 2019-03-05 16:34:21.000000000 +0000
++++ hw/xfree86/os-support/bus/bsd_pci.c
+@@ -51,5 +51,8 @@
+ void
+ osPciInit(void)
+ {
++#if defined(OPENBSD_MORE_CALLS)
++ xf86OpenConsole();
++#endif
+ xf86InitVidMem();
+ }
diff --git a/modular-xorg-server-dfbsd-meson/patches/patch-os_utils.c b/modular-xorg-server-dfbsd-meson/patches/patch-os_utils.c
new file mode 100644
index 0000000000..99822afdd4
--- /dev/null
+++ b/modular-xorg-server-dfbsd-meson/patches/patch-os_utils.c
@@ -0,0 +1,21 @@
+$NetBSD$
+
+--- os/utils.c.orig 2019-03-05 16:34:21.000000000 +0000
++++ os/utils.c
+@@ -734,9 +734,16 @@ ProcessCommandLine(int argc, char *argv[
+ #if !defined(WIN32) || !defined(__MINGW32__)
+ struct rlimit core_limit;
+
++#if defined(STRICT_NETBSD)
++ if (getrlimit(RLIMIT_CORE, &core_limit) != -1) {
++ core_limit.rlim_cur = core_limit.rlim_max;
++ setrlimit(RLIMIT_CORE, &core_limit);
++ }
++#else
+ getrlimit(RLIMIT_CORE, &core_limit);
+ core_limit.rlim_cur = core_limit.rlim_max;
+ setrlimit(RLIMIT_CORE, &core_limit);
++#endif /* STRICT_NETBSD */
+ #endif
+ CoreDump = TRUE;
+ }
Home |
Main Index |
Thread Index |
Old Index