diff --git a/CHANGELOG.md b/CHANGELOG.md index b382c7a..1d8a579 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,3 +9,5 @@ Current . - The linux patchs are now hosted on the repo. - Fixed and added precision on the KMS setup in the README.md +- $DISPLAY environment var is not hardcoded anymore in gm-15khz but + simply appended to already set $DISPLAY screen number. diff --git a/Makefile b/Makefile index 7f622d8..e34ba43 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,9 @@ LINUX_HEADERS_ALL_DEB = $(BUILDDIR)/linux-headers-$(KERNEL_BASE_VERSION)-$(KERNE LINUX_HEADERS_GENERIC_DEB = $(BUILDDIR)/linux-headers-$(KERNEL_BASE_VERSION)-$(KERNEL_ABI_NUMBER)-generic_$(KERNEL_BASE_VERSION)-$(KERNEL_ABI_NUMBER).$(KERNEL_UPLOAD_NUMBER)+patched15khz_amd64.deb LINUX_IMAGE_DEB = $(BUILDDIR)/linux-image-$(KERNEL_BASE_VERSION)-$(KERNEL_ABI_NUMBER)-generic_$(KERNEL_BASE_VERSION)-$(KERNEL_ABI_NUMBER).$(KERNEL_UPLOAD_NUMBER)+patched15khz_amd64.deb -LINUX_15KHZ_PATCH = src/patch-3.19/linux-3.19.diff +#LINUX_15KHZ_PATCH = src/patch-3.19/linux-3.19.diff +LINUX_15KHZ_PATCH = src/linux-4.2.diff + LINUX_AT9200_PATCH = src/patch-3.19/ati9200_pllfix-3.19.diff LINUX_AVGA3000_PATCH = src/patch-3.19/avga3000-3.19.diff @@ -58,17 +60,16 @@ install: mkdir -p $(PREFIX)/bin cp src/bin/gm-15khz $(PREFIX)/bin/ @echo "Install finished" - @echo "Please reboot your computer using the new -patched15khz kernel" + @echo "Please reboot your computer to the new patched kernel" uninstall: rm -r $(PREFIX)/lib/15khz-arcade-pkg rm $(PREFIX)/bin/gm-15khz apt-get install --reinstall xserver-xorg-video-nouveau - @echo "Uninstall finished." - @echo - @echo "The patched Linux kernel can't be safely uninstalled automatically while running." - @echo "Don't forget to uninstall it manually after booted to another kernel using:" - @echo "sudo apt-get remove linux-image--patched15khz linux-headers--patched15khz" + sudo apt-get remove $(notdir $(LINUX_HEADERS_ALL_DEB)) \ + $(notdir $(LINUX_HEADERS_GENERIC_DEB)) \ + $(notdir $(LINUX_IMAGE_DEB)) + @echo "Uninstall finished. Please reboot your computer now" dist: @@ -124,6 +125,8 @@ $(GROOVYMAME_BIN): $(MAME_SRC_PKG) \ cd $(TMPDIR)/mame && patch -p0 --binary < $(realpath $(MAME_HI_PATCH)) cd $(TMPDIR)/mame && patch -p0 --binary < $(realpath $(MAME_GROOVY_PATCH)) cd $(TMPDIR)/mame && MAKEFLAGS= MFLAGS= make + cd $(TMPDIR)/mame && rm mame.zip + cd $(TMPDIR)/mame && make clean mkdir -p $(BUILDDIR)/groovymame64 cp -r $(TMPDIR)/mame/* $(BUILDDIR)/groovymame64 rm -rf $(TMPDIR)/mame diff --git a/README.md b/README.md index 9291f30..e244d97 100644 --- a/README.md +++ b/README.md @@ -6,39 +6,39 @@ Arcade videogames monitor running at 15Khz horizontal scan frequencies) to the VGA output of an Nvidia card using Ubuntu while keeping your primary screen connected. -One of the aims is to play emulated retro arcade/console/computer games +The goal is to play emulated retro arcade/console/computer games at real low resolutions on this monitor using emulators like MAME. Doing this is actually harder than it sounds because: -- Linux kernel disallows 15Khz horizontal scan frequencies which are - used by theses old monitors — 31Khz is now the norm +- For some graphics card, and to enables some features, Linux kernel + must be patched. - Nvidia Drivers disallow resolutions lower than 320x200 - This setup requires not so obvious Xorg configuration - Using 15khz monitors require the use of custom [modelines](https://en.wikipedia.org/wiki/XFree86_Modeline) - unhandled by Xorg nor Mame. + which must be setup manually — There are tools for that. -This project helps to resolve theses issues by providing instructions -and a `Makefile` which help generating: +The content of this file helps to resolve theses issues by providing +instructions for generating: - A patched Linux kernel wich allows 15Khz modelines as a deb package - Patched nouveau drivers allowing low resolutions as a deb package - Patched Mame binary using GroovyMame patch allowing Mame to generate - good 15khz compatible modelines on the fly + good 15khz compatible modelines on the fly. - A Groovymame bash launcher which sets custom SDL env vars resolving some weird SDL related behaviors, sets the \$DISPLAY var on the right screen and tells the linker to use the patched nouveau.dri.so library. -The generation of theses assets can be done automatically using `make` -or manually by following the provided instructions. +A Makefile is provided for automating the generation and configuration of +most of the following steps. Motivation ---------- The main purpose of this repository is to keep track and automate steps -needed to achieve this goal. Second motivation is to share hoping that +needed to achieve this goal. Second motivation is to share, hoping that it might help despite it fits my hardware/OS specifically. If you have suggestions or knowledges to make it more generic feel free to let me know. @@ -85,7 +85,7 @@ the generation and installation of the assets. ``` {.sourceCode .bash} $ sudo apt-get build-dep linux-image mame - $ sudo apt-get install fakeroot + $ sudo apt-get install fakeroot qt5-default qtbase5-dev qtbase5-dev-tools ``` 2. `git clone` this repository @@ -151,11 +151,13 @@ So to launch a program on this screen, prefix the command-line with $ DISPLAY=:0.1 xrandr ``` +### Groovymame + To launch groovymame64: $ gm-15khz sf2 -Note the absence of the prefix DISPLAY=:0.1 . It is useless because it +Note the absence of the env var DISPLAY. It is useless because it is already set inside the `gm-15khz` bash launcher. `gm-15khz` is simply a wrapper of the `groovymame64` binary. All command line arguments following `gm-15khz` invocation are passed to the underlying @@ -167,11 +169,23 @@ Detailled instructions for manual setup This chapter describes step by step how to connects your 15khz monitor on your computer having an Nvidia card using Ubuntu. -### Allowing the Linux Kernel for 15khz modelines. +### Patching the kernel + +As i am not the author of the patchs — thanks to arcadecontrol forum — it +is not very clear to me what is the aim of the patch but i presume +the following: -Linux kernels disallows 15khz modelines to preserve monitors healths. -Patchs for the kernel are made for bypassing this security. Here are the -steps to follow to patch a kernel, compil and boot it. +- The patch allows 15khz modelines in `KMS` mode, which is the display + engine used by the kernel at boot (splashscreen) before Xorg is + launched +- The patch provide diff for ArcadeVGA and ATI cards. I think without + theses thoses cards are not allowed to handle low resolutions or 15khz + modelines. +- **The patch is not required for NVIDIA cards**, at least for mine. Only + patched nouveau drivers — as explained bellow — are required if the + only goal is to play emulators and if you don't care about the + booting phase. +- Patching the Kernel > 3.19, KMS feature doesn't seems to work. 1. Know the version of the installed Kernel: @@ -360,7 +374,7 @@ setup, some environment variables must be set: SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS=1 \ SDL_VIDEO_X11_XRANDR=0 \ SDL_VIDEO_X11_XVIDMODE=0 \ - DISPLAY=:0.1 \ + DISPLAY=$DISPLAY.1 \ ./groovymame sms sonic ``` @@ -379,8 +393,8 @@ The environment variables are explained below: action of theses SDL environnment variables is pretty hard understand but they fix it. -- **DISPLAY=:0.1**: This tells Xorg to execute the program on the - Screen1 (CRT Screen). Note: This number can be :1.1 on your system. +- **DISPLAY=:$DISPLAY.1**: This tells Xorg to execute the program on the + Screen1 (CRT Screen). The `gm-15khz` bash launcher provided when installing the assets using the Makefile is basically a wrapper of GroovyMame which sets theses diff --git a/src/bin/gm-15khz b/src/bin/gm-15khz index 1c5ef5c..7416df6 100755 --- a/src/bin/gm-15khz +++ b/src/bin/gm-15khz @@ -12,9 +12,6 @@ export SDL_VIDEO_X11_XVIDMODE=0 export SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS=1 # Tell X to use the second screen -export DISPLAY=:0.1 - -# Tell MESA to use the patched nouveau_dri.so -export LIBGL_DRIVERS_PATH=$rootPath/../lib/15khz-arcade-pkg +export DISPLAY=$DISPLAY.1 $rootPath/../lib/15khz-arcade-pkg/groovymame64/mame64 $@ diff --git a/src/libgl1-mesa-dri-10.5.2-zaphodheads.diff b/src/libgl1-mesa-dri-10.5.2-zaphodheads.diff deleted file mode 100644 index e484c1f..0000000 --- a/src/libgl1-mesa-dri-10.5.2-zaphodheads.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- gallium/winsys/nouveau/drm/nouveau_drm_winsys.c 2014-10-03 05:59:51.000000000 +0200 -+++ gallium/winsys/nouveau/drm/nouveau_drm_winsys.c 2015-07-02 21:33:30.494900651 +0200 -@@ -120,7 +120,9 @@ - if (!screen) - goto err; - -- util_hash_table_set(fd_tab, intptr_to_pointer(fd), screen); -+ //util_hash_table_set(fd_tab, intptr_to_pointer(fd), screen); -+ /* Use dupfd in hash table, to avoid crashes in ZaphodHeads configs */ -+ util_hash_table_set(fd_tab, intptr_to_pointer(dupfd), screen); - screen->refcount = 1; - pipe_mutex_unlock(nouveau_screen_mutex); - return &screen->base;