From 6f1876952729fd1d468b51d4e1674a9160459c3b Mon Sep 17 00:00:00 2001 From: Dennis Bonke Date: Sun, 30 Jan 2022 21:49:35 +0100 Subject: [PATCH 1/8] xorg-server: Enable Xorg and disable old stuff Signed-off-by: Dennis Bonke --- bootstrap.d/x11-base.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bootstrap.d/x11-base.yml b/bootstrap.d/x11-base.yml index e34a5de18..8f70556af 100644 --- a/bootstrap.d/x11-base.yml +++ b/bootstrap.d/x11-base.yml @@ -125,7 +125,7 @@ packages: - '--cross-file' - '@SOURCE_ROOT@/scripts/meson-@OPTION:arch-triple@.cross-file' - '--prefix=/usr' - - '-Dxorg=false' + - '-Dxorg=true' - '-Dxephyr=false' - '-Dxwayland=true' - '-Dxnest=false' @@ -145,6 +145,10 @@ packages: - '-Dxvmc=false' - '-Dsystemd_logind=false' - '-Dsecure-rpc=false' + - '-Dglamor=false' + - '-Dvbe=false' + - '-Dint10=false' + - '-Dvgahw=false' - '@THIS_SOURCE_DIR@' build: - args: ['ninja'] From a2dd709ef96cc030dcb7670155d327d9f4468a27 Mon Sep 17 00:00:00 2001 From: Dennis Bonke Date: Sun, 30 Jan 2022 22:01:23 +0100 Subject: [PATCH 2/8] libpciaccess: Add initial port Signed-off-by: Dennis Bonke --- bootstrap.d/x11-libs.yml | 39 ++++++++ .../0001-Initial-WIP-Managarm-support.patch | 95 +++++++++++++++++++ 2 files changed, 134 insertions(+) create mode 100644 patches/libpciaccess/0001-Initial-WIP-Managarm-support.patch diff --git a/bootstrap.d/x11-libs.yml b/bootstrap.d/x11-libs.yml index 4de5ad577..2537b47e8 100644 --- a/bootstrap.d/x11-libs.yml +++ b/bootstrap.d/x11-libs.yml @@ -317,6 +317,45 @@ packages: environ: DESTDIR: '@THIS_COLLECT_DIR@' + - name: libpciaccess + source: + subdir: ports + git: 'https://gitlab.freedesktop.org/xorg/lib/libpciaccess.git' + tag: 'libpciaccess-0.16' + version: '0.16' + tools_required: + - host-autoconf-v2.69 + - host-automake-v1.11 + - host-libtool + - host-pkg-config + - host-xorg-macros + - host-autoconf-archive + - host-xtrans + regenerate: + - args: ['./autogen.sh'] + environ: + 'NOCONFIGURE': 'yes' + tools_required: + - system-gcc + pkgs_required: + - mlibc + - zlib + configure: + - args: + - '@THIS_SOURCE_DIR@/configure' + - '--host=@OPTION:arch-triple@' + - '--prefix=/usr' + - '--sysconfdir=/etc' + - '--localstatedir=/var' + - '--disable-static' + - '--with-pciids-path=/usr/share/hwdata' + - '--with-zlib' + build: + - args: ['make', '-j@PARALLELISM@'] + - args: ['make', 'install'] + environ: + DESTDIR: '@THIS_COLLECT_DIR@' + - name: libsm labels: [aarch64] architecture: '@OPTION:arch@' diff --git a/patches/libpciaccess/0001-Initial-WIP-Managarm-support.patch b/patches/libpciaccess/0001-Initial-WIP-Managarm-support.patch new file mode 100644 index 000000000..2970f6cd1 --- /dev/null +++ b/patches/libpciaccess/0001-Initial-WIP-Managarm-support.patch @@ -0,0 +1,95 @@ +From 4fb754d7e7d9d09e5cbb6ddd812ea1671fc01d43 Mon Sep 17 00:00:00 2001 +From: Dennis Bonke +Date: Sun, 30 Jan 2022 21:59:54 +0100 +Subject: [PATCH libpciaccess] Initial WIP Managarm support + +Signed-off-by: Dennis Bonke +--- + src/Makefile.am | 5 +++++ + src/common_init.c | 2 +- + src/common_interface.c | 2 +- + src/linux_sysfs.c | 10 +++++++++- + 4 files changed, 16 insertions(+), 3 deletions(-) + +diff --git a/src/Makefile.am b/src/Makefile.am +index f222aa5..e722452 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -31,6 +31,11 @@ OS_SUPPORT = linux_sysfs.c linux_devmem.c linux_devmem.h + VGA_ARBITER = common_vgaarb.c + endif + ++#if MANAGARM ++OS_SUPPORT = linux_sysfs.c linux_devmem.c linux_devmem.h ++VGA_ARBITER = common_vgaarb.c ++#endif ++ + if FREEBSD + OS_SUPPORT = freebsd_pci.c + VGA_ARBITER = common_vgaarb_stub.c +diff --git a/src/common_init.c b/src/common_init.c +index 1940cff..5206b4e 100644 +--- a/src/common_init.c ++++ b/src/common_init.c +@@ -55,7 +55,7 @@ pci_system_init( void ) + { + int err = ENOSYS; + +-#ifdef __linux__ ++#if defined (__linux__) || defined(__managarm__) + err = pci_system_linux_sysfs_create(); + #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) + err = pci_system_freebsd_create(); +diff --git a/src/common_interface.c b/src/common_interface.c +index cb95e90..975961c 100644 +--- a/src/common_interface.c ++++ b/src/common_interface.c +@@ -39,7 +39,7 @@ + #include "pciaccess.h" + #include "pciaccess_private.h" + +-#if defined(__linux__) || defined(__GLIBC__) || defined(__CYGWIN__) ++#if defined(__linux__) || defined(__GLIBC__) || defined(__CYGWIN__) || defined(__managarm__) + #include + + #if __BYTE_ORDER == __BIG_ENDIAN +diff --git a/src/linux_sysfs.c b/src/linux_sysfs.c +index d022644..9e1aaa9 100644 +--- a/src/linux_sysfs.c ++++ b/src/linux_sysfs.c +@@ -50,7 +50,7 @@ + #include + #include + +-#if defined(__i386__) || defined(__x86_64__) ++#if defined(__i386__) || defined(__x86_64__) && !defined(__managarm__) + #include + #else + #define inb(x) -1 +@@ -462,7 +462,11 @@ pci_device_linux_sysfs_read( struct pci_device * dev, void * data, + + + while ( temp_size > 0 ) { ++#ifndef __managarm__ + const ssize_t bytes = pread64( fd, data_bytes, temp_size, offset ); ++#else ++ const ssize_t bytes = pread(fd, data_bytes, temp_size, offset); ++#endif + + /* If zero bytes were read, then we assume it's the end of the + * config file. +@@ -522,7 +526,11 @@ pci_device_linux_sysfs_write( struct pci_device * dev, const void * data, + + + while ( temp_size > 0 ) { ++#ifndef __managarm__ + const ssize_t bytes = pwrite64( fd, data_bytes, temp_size, offset ); ++#else ++ const ssize_t bytes = pwrite(fd, data_bytes, temp_size, offset); ++#endif + + /* If zero bytes were written, then we assume it's the end of the + * config file. +-- +2.34.1 + From 9ace740a11d7d442776c65032371919d20be3514 Mon Sep 17 00:00:00 2001 From: Dennis Bonke Date: Sun, 30 Jan 2022 22:01:39 +0100 Subject: [PATCH 3/8] xorg-server: More native X work Signed-off-by: Dennis Bonke --- bootstrap.d/x11-base.yml | 2 +- .../0001-Add-managarm-support.patch | 17 +- patches/xorg-server/0002-WIP-Xorg-patch.patch | 252 ++++++++++++++++++ 3 files changed, 262 insertions(+), 9 deletions(-) create mode 100644 patches/xorg-server/0002-WIP-Xorg-patch.patch diff --git a/bootstrap.d/x11-base.yml b/bootstrap.d/x11-base.yml index 8f70556af..4765f79fd 100644 --- a/bootstrap.d/x11-base.yml +++ b/bootstrap.d/x11-base.yml @@ -117,6 +117,7 @@ packages: - nettle - xkbcomp - pixman + - libpciaccess configure: - args: - 'meson' @@ -136,7 +137,6 @@ packages: - '-Dvendor_name="The Managarm Project"' - '-Dvendor_name_short="Managarm"' - '-Dsuid_wrapper=false' - - '-Dpciaccess=false' - '-Ddpms=false' - '-Dscreensaver=false' - '-Dxres=false' diff --git a/patches/xorg-server/0001-Add-managarm-support.patch b/patches/xorg-server/0001-Add-managarm-support.patch index a048dcb0f..5f2bc2ef9 100644 --- a/patches/xorg-server/0001-Add-managarm-support.patch +++ b/patches/xorg-server/0001-Add-managarm-support.patch @@ -1,9 +1,10 @@ -From da0c8b76121406b220f1acb723851f09e2471b99 Mon Sep 17 00:00:00 2001 +From 56a55d3ebbd3139177989019686861b2b3d4685c Mon Sep 17 00:00:00 2001 From: Dennisbonke Date: Sat, 18 Jul 2020 16:19:17 +0200 -Subject: [PATCH] Add managarm support +Subject: [PATCH 1/2] Add managarm support Signed-off-by: Dennisbonke +Signed-off-by: Dennis Bonke --- include/meson.build | 2 +- include/os.h | 1 + @@ -13,7 +14,7 @@ Signed-off-by: Dennisbonke 5 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/meson.build b/include/meson.build -index ac2415327..82b093442 100644 +index ac24153..82b0934 100644 --- a/include/meson.build +++ b/include/meson.build @@ -132,7 +132,7 @@ conf_data.set('HAVE_POSIX_FALLOCATE', cc.has_function('posix_fallocate')) @@ -26,7 +27,7 @@ index ac2415327..82b093442 100644 conf_data.set('HAVE_SIGACTION', cc.has_function('sigaction')) conf_data.set('HAVE_STRCASECMP', cc.has_function('strcasecmp')) diff --git a/include/os.h b/include/os.h -index 2a1c29ef3..2a7fc76c5 100644 +index 2a1c29e..2a7fc76 100644 --- a/include/os.h +++ b/include/os.h @@ -51,6 +51,7 @@ SOFTWARE. @@ -38,7 +39,7 @@ index 2a1c29ef3..2a7fc76c5 100644 #include #endif diff --git a/mi/mibitblt.c b/mi/mibitblt.c -index 43d9bd917..740c0d268 100644 +index 43d9bd9..740c0d2 100644 --- a/mi/mibitblt.c +++ b/mi/mibitblt.c @@ -49,6 +49,8 @@ SOFTWARE. @@ -51,7 +52,7 @@ index 43d9bd917..740c0d268 100644 #include diff --git a/os/access.c b/os/access.c -index 97246160c..7afbd3a86 100644 +index 9724616..7afbd3a 100644 --- a/os/access.c +++ b/os/access.c @@ -117,7 +117,7 @@ SOFTWARE. @@ -64,7 +65,7 @@ index 97246160c..7afbd3a86 100644 #endif #if defined(SYSV) && defined(__i386__) diff --git a/os/utils.c b/os/utils.c -index 2ba1c8013..0156b20fb 100644 +index 2ba1c80..0156b20 100644 --- a/os/utils.c +++ b/os/utils.c @@ -1632,7 +1632,7 @@ Pclose(void *iop) @@ -77,5 +78,5 @@ index 2ba1c8013..0156b20fb 100644 int -- -2.28.0.rc2 +2.34.1 diff --git a/patches/xorg-server/0002-WIP-Xorg-patch.patch b/patches/xorg-server/0002-WIP-Xorg-patch.patch new file mode 100644 index 000000000..e8432be0c --- /dev/null +++ b/patches/xorg-server/0002-WIP-Xorg-patch.patch @@ -0,0 +1,252 @@ +From 92993dd28808c27d8f661a1d96b050ac3a65380d Mon Sep 17 00:00:00 2001 +From: Dennis Bonke +Date: Sun, 30 Jan 2022 21:53:07 +0100 +Subject: [PATCH 2/2] WIP Xorg patch + +Signed-off-by: Dennis Bonke +--- + hw/xfree86/common/xf86.h | 14 +++++++------- + hw/xfree86/common/xf86Config.c | 1 + + hw/xfree86/common/xf86Configure.c | 1 + + hw/xfree86/common/xf86Events.c | 1 + + hw/xfree86/drivers/modesetting/dumb_bo.c | 3 +++ + hw/xfree86/drivers/modesetting/meson.build | 1 + + hw/xfree86/fbdevhw/fbdevhw.c | 3 ++- + hw/xfree86/fbdevhw/meson.build | 2 ++ + hw/xfree86/os-support/bus/Pci.h | 2 +- + hw/xfree86/os-support/meson.build | 11 +++++++++++ + hw/xfree86/os-support/shared/platform_noop.c | 15 +++++++++++++++ + hw/xfree86/os-support/shared/posix_tty.c | 2 ++ + hw/xfree86/os-support/shared/sigio.c | 2 ++ + meson.build | 2 +- + 14 files changed, 50 insertions(+), 10 deletions(-) + +diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h +index 5743f0c..65801c5 100644 +--- a/hw/xfree86/common/xf86.h ++++ b/hw/xfree86/common/xf86.h +@@ -126,13 +126,13 @@ extern _X_EXPORT ScrnInfoPtr xf86ConfigPciEntity(ScrnInfoPtr pScrn, + EntityProc leave, + void *private); + #else +-#define xf86VGAarbiterInit() do {} while (0) +-#define xf86VGAarbiterFini() do {} while (0) +-#define xf86VGAarbiterLock(x) do {} while (0) +-#define xf86VGAarbiterUnlock(x) do {} while (0) +-#define xf86VGAarbiterScrnInit(x) do {} while (0) +-#define xf86VGAarbiterDeviceDecodes() do {} while (0) +-#define xf86VGAarbiterWrapFunctions() do {} while (0) ++//#define xf86VGAarbiterInit() do {} while (0) ++//#define xf86VGAarbiterFini() do {} while (0) ++//#define xf86VGAarbiterLock(x) do {} while (0) ++//#define xf86VGAarbiterUnlock(x) do {} while (0) ++//#define xf86VGAarbiterScrnInit(x) do {} while (0) ++//#define xf86VGAarbiterDeviceDecodes() do {} while (0) ++//#define xf86VGAarbiterWrapFunctions() do {} while (0) + #endif + + /* xf86Bus.c */ +diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c +index 09d27ec..416b557 100644 +--- a/hw/xfree86/common/xf86Config.c ++++ b/hw/xfree86/common/xf86Config.c +@@ -45,6 +45,7 @@ + #ifdef HAVE_XORG_CONFIG_H + #include + #endif ++#include + + #include + #include +diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c +index 44e7591..cf45ed1 100644 +--- a/hw/xfree86/common/xf86Configure.c ++++ b/hw/xfree86/common/xf86Configure.c +@@ -26,6 +26,7 @@ + #ifdef HAVE_XORG_CONFIG_H + #include + #endif ++#include + + #include "xf86.h" + #include "xf86Config.h" +diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c +index 8a800bd..ac8ed3c 100644 +--- a/hw/xfree86/common/xf86Events.c ++++ b/hw/xfree86/common/xf86Events.c +@@ -52,6 +52,7 @@ + #ifdef HAVE_XORG_CONFIG_H + #include + #endif ++#include + + #include + #include +diff --git a/hw/xfree86/drivers/modesetting/dumb_bo.c b/hw/xfree86/drivers/modesetting/dumb_bo.c +index cf13f0a..58f67fd 100644 +--- a/hw/xfree86/drivers/modesetting/dumb_bo.c ++++ b/hw/xfree86/drivers/modesetting/dumb_bo.c +@@ -38,6 +38,7 @@ + #include + #include + #include ++#include + + struct dumb_bo * + dumb_bo_create(int fd, +@@ -46,6 +47,8 @@ dumb_bo_create(int fd, + struct drm_mode_create_dumb arg; + struct dumb_bo *bo; + int ret; ++ fprintf(stderr, "XORG-SERVER: height %u width %u bpp %u\n", height, width, bpp); ++ abort(); + + bo = calloc(1, sizeof(*bo)); + if (!bo) +diff --git a/hw/xfree86/drivers/modesetting/meson.build b/hw/xfree86/drivers/modesetting/meson.build +index 5e13f1a..7b9bf40 100644 +--- a/hw/xfree86/drivers/modesetting/meson.build ++++ b/hw/xfree86/drivers/modesetting/meson.build +@@ -15,6 +15,7 @@ shared_module( + + include_directories: [inc, xorg_inc], + c_args: xorg_c_args, ++ link_args: ['-lshadow'], + dependencies: [ + common_dep, + udev_dep, +diff --git a/hw/xfree86/fbdevhw/fbdevhw.c b/hw/xfree86/fbdevhw/fbdevhw.c +index 9508951..3e064e1 100644 +--- a/hw/xfree86/fbdevhw/fbdevhw.c ++++ b/hw/xfree86/fbdevhw/fbdevhw.c +@@ -15,7 +15,8 @@ + #include "xf86cmap.h" + + #include "fbdevhw.h" +-#include "fbpriv.h" ++//#include "fbpriv.h" ++#include + #include "globals.h" + #include + +diff --git a/hw/xfree86/fbdevhw/meson.build b/hw/xfree86/fbdevhw/meson.build +index f3146f3..1955e7d 100644 +--- a/hw/xfree86/fbdevhw/meson.build ++++ b/hw/xfree86/fbdevhw/meson.build +@@ -1,5 +1,7 @@ + if host_machine.system() == 'linux' + srcs_fbdevhw = 'fbdevhw.c' ++elif host_machine.system() == 'managarm' ++ srcs_fbdevhw = 'fbdevhw.c' + else + srcs_fbdevhw = 'fbdevhwstub.c' + endif +diff --git a/hw/xfree86/os-support/bus/Pci.h b/hw/xfree86/os-support/bus/Pci.h +index 1921e02..dc56273 100644 +--- a/hw/xfree86/os-support/bus/Pci.h ++++ b/hw/xfree86/os-support/bus/Pci.h +@@ -139,7 +139,7 @@ + #define osPciInit(x) do {} while (0) + #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \ + defined(__OpenBSD__) || defined(__NetBSD__) || \ +- defined(__DragonFly__) || defined(__sun) || defined(__GNU__) ++ defined(__DragonFly__) || defined(__sun) || defined(__GNU__) || defined(__managarm__) + extern void osPciInit(void); + #else + #error No PCI support available for this architecture/OS combination +diff --git a/hw/xfree86/os-support/meson.build b/hw/xfree86/os-support/meson.build +index b6e5c97..227b3d3 100644 +--- a/hw/xfree86/os-support/meson.build ++++ b/hw/xfree86/os-support/meson.build +@@ -113,6 +113,16 @@ elif host_machine.system().endswith('bsd') + else + srcs_xorg_os_support += 'shared/agp_noop.c' + endif ++#elif host_machine.system() == 'managarm' ++# srcs_xorg_os_support += [ ++# 'linux/lnx_platform.c', ++# 'linux/lnx_init.c', ++# 'linux/lnx_video.c', ++# 'stub/stub_init.c', ++# 'stub/stub_video.c', ++# 'stub/stub_bell.c', ++# ] ++ #error('uwu') + else + # stub ossupport + srcs_xorg_os_support += [ +@@ -121,6 +131,7 @@ else + 'shared/ioperm_noop.c', + 'shared/kmod_noop.c', + 'shared/pm_noop.c', ++ 'shared/platform_noop.c', + 'shared/vidmem.c', + 'shared/posix_tty.c', + 'shared/sigio.c', +diff --git a/hw/xfree86/os-support/shared/platform_noop.c b/hw/xfree86/os-support/shared/platform_noop.c +index 199ae5e..a9568d6 100644 +--- a/hw/xfree86/os-support/shared/platform_noop.c ++++ b/hw/xfree86/os-support/shared/platform_noop.c +@@ -19,5 +19,20 @@ xf86PlatformDeviceCheckBusID(struct xf86_platform_device *device, const char *bu + void xf86PlatformDeviceProbe(struct OdevAttributes *attribs) + { + ++} ++ ++void xf86PlatformReprobeDevice(int index, struct OdevAttributes *attribs) ++{ ++ ++} ++ ++void NewGPUDeviceRequest(struct OdevAttributes *attribs) ++{ ++ ++} ++ ++void DeleteGPUDeviceRequest(struct OdevAttributes *attribs) ++{ ++ + } + #endif +diff --git a/hw/xfree86/os-support/shared/posix_tty.c b/hw/xfree86/os-support/shared/posix_tty.c +index 0cb9788..863f98f 100644 +--- a/hw/xfree86/os-support/shared/posix_tty.c ++++ b/hw/xfree86/os-support/shared/posix_tty.c +@@ -55,6 +55,8 @@ + #ifdef HAVE_XORG_CONFIG_H + #include + #endif ++#include ++#include + + #include + #include +diff --git a/hw/xfree86/os-support/shared/sigio.c b/hw/xfree86/os-support/shared/sigio.c +index 247bec7..17e0e78 100644 +--- a/hw/xfree86/os-support/shared/sigio.c ++++ b/hw/xfree86/os-support/shared/sigio.c +@@ -55,6 +55,8 @@ + #ifdef HAVE_XORG_CONFIG_H + #include + #endif ++#include ++#include + + #include + #include +diff --git a/meson.build b/meson.build +index c74135a..6b29dc5 100644 +--- a/meson.build ++++ b/meson.build +@@ -31,7 +31,7 @@ if cc.get_id() == 'gcc' or cc.get_id() == 'clang' + '-Wmissing-noreturn', + '-Wmissing-format-attribute', + '-Wredundant-decls', +- '-Werror=implicit', ++# '-Werror=implicit', + '-Werror=nonnull', + '-Werror=init-self', + '-Werror=main', +-- +2.34.1 + From b3c013de44f98ea41842768a461e89cec105ab43 Mon Sep 17 00:00:00 2001 From: Dennis Bonke Date: Sun, 30 Jan 2022 22:04:55 +0100 Subject: [PATCH 4/8] xorg-server: Add some extra files that are used Signed-off-by: Dennis Bonke --- bootstrap.d/x11-base.yml | 4 ++++ extrafiles/xinitrc | 1 + extrafiles/xorg.conf | 8 ++++++++ .../xorg-server/0001-Add-managarm-support.patch | 2 +- patches/xorg-server/0002-WIP-Xorg-patch.patch | 15 +++++++++------ 5 files changed, 23 insertions(+), 7 deletions(-) create mode 100644 extrafiles/xinitrc create mode 100644 extrafiles/xorg.conf diff --git a/bootstrap.d/x11-base.yml b/bootstrap.d/x11-base.yml index 4765f79fd..362c1f121 100644 --- a/bootstrap.d/x11-base.yml +++ b/bootstrap.d/x11-base.yml @@ -155,3 +155,7 @@ packages: - args: ['ninja', 'install'] environ: DESTDIR: '@THIS_COLLECT_DIR@' + - args: ['mkdir', '-p', '@THIS_COLLECT_DIR@/root'] + - args: ['mkdir', '-p', '@THIS_COLLECT_DIR@/etc/X11'] + - args: ['cp', '@SOURCE_ROOT@/extrafiles/xorg.conf', '@THIS_COLLECT_DIR@/etc/X11/'] + - args: ['cp', '@SOURCE_ROOT@/extrafiles/xinitrc', '@THIS_COLLECT_DIR@/root/.xinitrc'] diff --git a/extrafiles/xinitrc b/extrafiles/xinitrc new file mode 100644 index 000000000..3f671621d --- /dev/null +++ b/extrafiles/xinitrc @@ -0,0 +1 @@ +bspwm diff --git a/extrafiles/xorg.conf b/extrafiles/xorg.conf new file mode 100644 index 000000000..bf5c88887 --- /dev/null +++ b/extrafiles/xorg.conf @@ -0,0 +1,8 @@ +Section "Module" + Load "modesetting" +EndSection + +Section "Device" + Identifier "Card0" + Driver "modesetting" +EndSection diff --git a/patches/xorg-server/0001-Add-managarm-support.patch b/patches/xorg-server/0001-Add-managarm-support.patch index 5f2bc2ef9..590c96730 100644 --- a/patches/xorg-server/0001-Add-managarm-support.patch +++ b/patches/xorg-server/0001-Add-managarm-support.patch @@ -1,4 +1,4 @@ -From 56a55d3ebbd3139177989019686861b2b3d4685c Mon Sep 17 00:00:00 2001 +From 69fa0d775a335babea28efabfe45bc422e33fa55 Mon Sep 17 00:00:00 2001 From: Dennisbonke Date: Sat, 18 Jul 2020 16:19:17 +0200 Subject: [PATCH 1/2] Add managarm support diff --git a/patches/xorg-server/0002-WIP-Xorg-patch.patch b/patches/xorg-server/0002-WIP-Xorg-patch.patch index e8432be0c..edafa179c 100644 --- a/patches/xorg-server/0002-WIP-Xorg-patch.patch +++ b/patches/xorg-server/0002-WIP-Xorg-patch.patch @@ -1,4 +1,4 @@ -From 92993dd28808c27d8f661a1d96b050ac3a65380d Mon Sep 17 00:00:00 2001 +From a961e824a5aed0a2ce06a0c3ad2183545e798cd5 Mon Sep 17 00:00:00 2001 From: Dennis Bonke Date: Sun, 30 Jan 2022 21:53:07 +0100 Subject: [PATCH 2/2] WIP Xorg patch @@ -10,7 +10,7 @@ Signed-off-by: Dennis Bonke hw/xfree86/common/xf86Configure.c | 1 + hw/xfree86/common/xf86Events.c | 1 + hw/xfree86/drivers/modesetting/dumb_bo.c | 3 +++ - hw/xfree86/drivers/modesetting/meson.build | 1 + + hw/xfree86/drivers/modesetting/meson.build | 4 ++++ hw/xfree86/fbdevhw/fbdevhw.c | 3 ++- hw/xfree86/fbdevhw/meson.build | 2 ++ hw/xfree86/os-support/bus/Pci.h | 2 +- @@ -19,7 +19,7 @@ Signed-off-by: Dennis Bonke hw/xfree86/os-support/shared/posix_tty.c | 2 ++ hw/xfree86/os-support/shared/sigio.c | 2 ++ meson.build | 2 +- - 14 files changed, 50 insertions(+), 10 deletions(-) + 14 files changed, 53 insertions(+), 10 deletions(-) diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h index 5743f0c..65801c5 100644 @@ -104,14 +104,17 @@ index cf13f0a..58f67fd 100644 bo = calloc(1, sizeof(*bo)); if (!bo) diff --git a/hw/xfree86/drivers/modesetting/meson.build b/hw/xfree86/drivers/modesetting/meson.build -index 5e13f1a..7b9bf40 100644 +index 5e13f1a..c3662b4 100644 --- a/hw/xfree86/drivers/modesetting/meson.build +++ b/hw/xfree86/drivers/modesetting/meson.build -@@ -15,6 +15,7 @@ shared_module( +@@ -15,6 +15,10 @@ shared_module( include_directories: [inc, xorg_inc], c_args: xorg_c_args, -+ link_args: ['-lshadow'], ++ link_with: [ ++ libxserver_fb, ++ libxserver_miext_shadow, ++ ], dependencies: [ common_dep, udev_dep, From 51af824f9d78a8606d0edebf8bb15a30753d7159 Mon Sep 17 00:00:00 2001 From: Dennis Bonke Date: Sun, 30 Jan 2022 22:08:04 +0100 Subject: [PATCH 5/8] bspwm: Add port Signed-off-by: Dennis Bonke --- bootstrap.d/x11-wm.yml | 27 +++++++++++++++++++++++++++ bootstrap.yml | 1 + 2 files changed, 28 insertions(+) create mode 100644 bootstrap.d/x11-wm.yml diff --git a/bootstrap.d/x11-wm.yml b/bootstrap.d/x11-wm.yml new file mode 100644 index 000000000..714d183fd --- /dev/null +++ b/bootstrap.d/x11-wm.yml @@ -0,0 +1,27 @@ +packages: + - name: bspwm + source: + subdir: 'ports' + git: 'https://github.com/baskerville/bspwm.git' + tag: '0.9.10' + version: '0.9.10' + tools_required: + - system-gcc + pkgs_required: + - mlibc + - libxcb + - xcb-util + - xcb-util-wm + - xcb-util-keysyms + configure: + # bspwm does not seem to support out-of-tree builds, so we just copy + # the source tree into the build directory instead + - args: ['cp', '-r', '@THIS_SOURCE_DIR@/.', '@THIS_BUILD_DIR@'] + build: + - args: ['make', '-j@PARALLELISM@'] + environ: + CC: 'x86_64-managarm-gcc' + - args: ['make', 'install'] + environ: + PREFIX: '/usr' + DESTDIR: '@THIS_COLLECT_DIR@' diff --git a/bootstrap.yml b/bootstrap.yml index b87bf3c4c..a669f6e99 100644 --- a/bootstrap.yml +++ b/bootstrap.yml @@ -31,6 +31,7 @@ imports: - file: bootstrap.d/x11-libs.yml - file: bootstrap.d/x11-misc.yml - file: bootstrap.d/x11-themes.yml + - file: bootstrap.d/x11-wm.yml general: patch_author: The Managarm Project From cbae9eed0ad08d8e5d224f753bcec6d57b4430d9 Mon Sep 17 00:00:00 2001 From: Dennis Bonke Date: Mon, 31 Jan 2022 15:21:31 +0100 Subject: [PATCH 6/8] scripts: Update grub config file to add Xorg boot options Signed-off-by: Dennis Bonke --- scripts/grub.cfg | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/scripts/grub.cfg b/scripts/grub.cfg index dde465c67..00c08deb9 100644 --- a/scripts/grub.cfg +++ b/scripts/grub.cfg @@ -15,6 +15,14 @@ menuentry "managarm (kmscon, e9 output, 1024x768, plainfb)" { set gfxpayload="1024x768x32" } +menuentry "managarm (Xorg, e9 output, 1024x768, plainfb)" { + set root="(hd0,gpt2)" + multiboot /boot/managarm/eir-mb1 bochs init.launch=xorg plainfb.force=1 + module /boot/managarm/thor + module /boot/managarm/initrd.cpio + set gfxpayload="1024x768x32" +} + menuentry "managarm (Weston, e9 output, 1024x768)" { set root="(hd0,gpt2)" multiboot /boot/managarm/eir-mb1 bochs init.launch=weston @@ -31,6 +39,14 @@ menuentry "managarm (kmscon, e9 output, 1024x768)" { set gfxpayload="1024x768x32" } +menuentry "managarm (Xorg, e9 output, 1024x768)" { + set root="(hd0,gpt2)" + multiboot /boot/managarm/eir-mb1 bochs init.launch=xorg + module /boot/managarm/thor + module /boot/managarm/initrd.cpio + set gfxpayload="1024x768x32" +} + menuentry "managarm (development: profiling)" { set root="(hd0,gpt2)" multiboot /boot/managarm/eir-mb1 bochs init.launch=weston plainfb.force=1 kernel-profile From dc9b6f4d4be5b90b353e3fe0120215284c57120f Mon Sep 17 00:00:00 2001 From: Dennis Bonke Date: Mon, 31 Jan 2022 15:21:55 +0100 Subject: [PATCH 7/8] scripts: Update Limine config to add Xorg boot options Signed-off-by: Dennis Bonke --- scripts/limine.cfg | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/scripts/limine.cfg b/scripts/limine.cfg index 0c3630429..5c0d5d0d7 100644 --- a/scripts/limine.cfg +++ b/scripts/limine.cfg @@ -18,6 +18,15 @@ CMDLINE=bochs init.launch=kmscon plainfb.force=1 MODULE_PATH=uuid://@ROOT_UUID@/boot/managarm/thor MODULE_PATH=uuid://@ROOT_UUID@/boot/managarm/initrd.cpio +:managarm (Xorg, e9 output, plainfb) + +KERNEL_PATH=uuid://@ROOT_UUID@/boot/managarm/eir-stivale +PROTOCOL=stivale2 +CMDLINE=bochs init.launch=xorg plainfb.force=1 + +MODULE_PATH=uuid://@ROOT_UUID@/boot/managarm/thor +MODULE_PATH=uuid://@ROOT_UUID@/boot/managarm/initrd.cpio + :managarm (Weston, e9 output) KERNEL_PATH=uuid://@ROOT_UUID@/boot/managarm/eir-stivale @@ -36,6 +45,15 @@ CMDLINE=bochs init.launch=kmscon MODULE_PATH=uuid://@ROOT_UUID@/boot/managarm/thor MODULE_PATH=uuid://@ROOT_UUID@/boot/managarm/initrd.cpio +:managarm (Xorg, e9 output) + +KERNEL_PATH=uuid://@ROOT_UUID@/boot/managarm/eir-stivale +PROTOCOL=stivale2 +CMDLINE=bochs init.launch=xorg + +MODULE_PATH=uuid://@ROOT_UUID@/boot/managarm/thor +MODULE_PATH=uuid://@ROOT_UUID@/boot/managarm/initrd.cpio + :Physical hardware ::managarm (Weston, serial output, plainfb) @@ -56,6 +74,15 @@ CMDLINE=serial init.launch=kmscon plainfb.force=1 MODULE_PATH=uuid://@ROOT_UUID@/boot/managarm/thor MODULE_PATH=uuid://@ROOT_UUID@/boot/managarm/initrd.cpio +::managarm (Xorg, serial output, plainfb) + +KERNEL_PATH=uuid://@ROOT_UUID@/boot/managarm/eir-stivale +PROTOCOL=stivale2 +CMDLINE=serial init.launch=xorg plainfb.force=1 + +MODULE_PATH=uuid://@ROOT_UUID@/boot/managarm/thor +MODULE_PATH=uuid://@ROOT_UUID@/boot/managarm/initrd.cpio + :Expert options ::managarm (profiling, Weston, e9 output, plainfb) From 20c59719d4e9eb6b0be534a4dad54a6b281d3274 Mon Sep 17 00:00:00 2001 From: Dennis Bonke Date: Fri, 4 Feb 2022 17:20:34 +0100 Subject: [PATCH 8/8] xorg-server: Update the WIP Xorg patch Signed-off-by: Dennis Bonke --- patches/xorg-server/0002-WIP-Xorg-patch.patch | 27 ++++--------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/patches/xorg-server/0002-WIP-Xorg-patch.patch b/patches/xorg-server/0002-WIP-Xorg-patch.patch index edafa179c..107393493 100644 --- a/patches/xorg-server/0002-WIP-Xorg-patch.patch +++ b/patches/xorg-server/0002-WIP-Xorg-patch.patch @@ -1,4 +1,4 @@ -From a961e824a5aed0a2ce06a0c3ad2183545e798cd5 Mon Sep 17 00:00:00 2001 +From a5cae70e2a970000e15aa0fc3815ac6ffeb76b92 Mon Sep 17 00:00:00 2001 From: Dennis Bonke Date: Sun, 30 Jan 2022 21:53:07 +0100 Subject: [PATCH 2/2] WIP Xorg patch @@ -9,8 +9,7 @@ Signed-off-by: Dennis Bonke hw/xfree86/common/xf86Config.c | 1 + hw/xfree86/common/xf86Configure.c | 1 + hw/xfree86/common/xf86Events.c | 1 + - hw/xfree86/drivers/modesetting/dumb_bo.c | 3 +++ - hw/xfree86/drivers/modesetting/meson.build | 4 ++++ + hw/xfree86/drivers/modesetting/dumb_bo.c | 2 ++ hw/xfree86/fbdevhw/fbdevhw.c | 3 ++- hw/xfree86/fbdevhw/meson.build | 2 ++ hw/xfree86/os-support/bus/Pci.h | 2 +- @@ -19,7 +18,7 @@ Signed-off-by: Dennis Bonke hw/xfree86/os-support/shared/posix_tty.c | 2 ++ hw/xfree86/os-support/shared/sigio.c | 2 ++ meson.build | 2 +- - 14 files changed, 53 insertions(+), 10 deletions(-) + 13 files changed, 48 insertions(+), 10 deletions(-) diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h index 5743f0c..65801c5 100644 @@ -83,7 +82,7 @@ index 8a800bd..ac8ed3c 100644 #include #include diff --git a/hw/xfree86/drivers/modesetting/dumb_bo.c b/hw/xfree86/drivers/modesetting/dumb_bo.c -index cf13f0a..58f67fd 100644 +index cf13f0a..8ce78ae 100644 --- a/hw/xfree86/drivers/modesetting/dumb_bo.c +++ b/hw/xfree86/drivers/modesetting/dumb_bo.c @@ -38,6 +38,7 @@ @@ -94,30 +93,14 @@ index cf13f0a..58f67fd 100644 struct dumb_bo * dumb_bo_create(int fd, -@@ -46,6 +47,8 @@ dumb_bo_create(int fd, +@@ -46,6 +47,7 @@ dumb_bo_create(int fd, struct drm_mode_create_dumb arg; struct dumb_bo *bo; int ret; + fprintf(stderr, "XORG-SERVER: height %u width %u bpp %u\n", height, width, bpp); -+ abort(); bo = calloc(1, sizeof(*bo)); if (!bo) -diff --git a/hw/xfree86/drivers/modesetting/meson.build b/hw/xfree86/drivers/modesetting/meson.build -index 5e13f1a..c3662b4 100644 ---- a/hw/xfree86/drivers/modesetting/meson.build -+++ b/hw/xfree86/drivers/modesetting/meson.build -@@ -15,6 +15,10 @@ shared_module( - - include_directories: [inc, xorg_inc], - c_args: xorg_c_args, -+ link_with: [ -+ libxserver_fb, -+ libxserver_miext_shadow, -+ ], - dependencies: [ - common_dep, - udev_dep, diff --git a/hw/xfree86/fbdevhw/fbdevhw.c b/hw/xfree86/fbdevhw/fbdevhw.c index 9508951..3e064e1 100644 --- a/hw/xfree86/fbdevhw/fbdevhw.c