Log In  

I get screen tearing in any scrolling Pico 8 game that I tried, even when navigating the splore menu. A retro console shouldn't have screen tearing.

Is there any way to enable VSYNC and get rid of screen tearing in Pico 8?

If this is not possible currently, can Vsync be added in the future?

P#98557 2021-10-12 23:47 ( Edited 2021-10-13 18:22)

:: merwok

The reason is probably that pico8 doesn’t have that because it is not needed. Sometimes games in the browser have some tearing, but with the real console it doesn’t happen. As we discussed on discord, if you have the right driver and config for your screen, then pico8 doesn’t have anything more to do.

P#98561 2021-10-13 01:27 ( Edited 2021-10-13 01:28)

If you notice tearing IN-BETWEEN pixels, then it is not PICO-8's fault. Instead it has to do with your video driver. I never have tearing with PICO-8. It is likely that all programs will act this way for your PC.

P#98562 2021-10-13 01:35

Maybe it is because I am using the version on my Pi 400? I tried all the different graphics drivers though. There's always screen tearing. Maybe the RPi version is just not advanced enough yet. Or maybe the gfx drivers on Pi 400 are not good enough yet. I cannot find any Vsync option for the gfx driver on Pi 400. I think other platforms have options to enforce vsync in the gfx drivers.

P#98568 2021-10-13 03:56 ( Edited 2021-10-13 03:57)

i have an pi400 running manjaro. got a link to a cart that presents tearing i can test with?

P#98569 2021-10-13 06:56

R-type in splore - favorites. You might have to play a minute or two to see it tear.

I am pretty sure this is an issue specifically with the Raspberry Pi 4 graphics drivers. They seem to be broken and maybe they will be fixed in some future release of Raspberry Pi OS. Previous RPi versions (RPi 2 and 3) had working drivers with no screen tearing.

Switching from fkms to kms (beta, unstable) drivers and re-compiling sdl2 to use kms fixes the screen tearing but then audio over hdmi stops working for me.

Many people have screen tearing on Pi 4: https://retropie.org.uk/forum/topic/27632/fixing-screen-tearing-issues-on-rpi4/41

I will give it another year or two until hopefully the RPi devs can finally fix their broken gfx drivers.

P#98578 2021-10-13 10:42 ( Edited 2021-10-13 10:45)

I got it to work on my Pi 400 and Pi 3 without screen tearing. I had to do a LOT of things.

1) execute

sudo rpi-update

to get the latest bleeding edge beta version of the OS

2) switch gfx driver to latest bleeding edge kms version by editing config.txt:

sudo nano /boot/config.txt

On Pi4, change dtoverlay setting to dtoverlay=vc4-kms-v3d-pi4

On Pi3, change dtoverlay setting to dtoverlay=vc4-kms-v3d

Then, press CTRL-X to save the edited file. Reboot.

3) build my own SDL2 library with the new kms gfx driver enabled, by executing this set of commands from here: http://mydedibox.fr/rpi4-sdl2-kms-drm-compilation-no-x/

The commands to build SDL2 are the following:

sudo apt install -y build-essential git libasound2-dev libsamplerate0-dev libibus-1.0-dev libdbus-1-dev libudev-dev libgles2-mesa-dev libdrm-dev libgbm-dev
git clone https://github.com/spurious/SDL-mirror.git
cd SDL-mirror
CFLAGS='-mfpu=neon -mtune=cortex-a72 -march=armv8-a' ./configure --prefix=/usr --disable-video-x11 --disable-video-wayland --disable-video-rpi --enable-video-kmsdrm --enable-arm-neon
make -j4
sudo make install

4) Force pico8 to use the new SDL2 library by making a shell script in the pico-8 folder via "nano start.sh" with following contents

#!/bin/sh
export LD_LIBRARY_PATH=/usr/lib
exec ./pico8_dyn "[email protected]"

CTRL-X to save.

5) Enter

chmod 777 start.sh

to allow me to execute the script

6) Exit Desktop via CTRL-ALT-F6, login again into the bare shell, and start pico8 via

./start.sh

No more tearing and 300 fps!!!

Update: I just tried and I had do to exactly the same steps to disable the screen-tearing in Pico 8 on my Raspberry Pi 3 as well. The only difference was to use dtoverlay=vc4-kms-v3d without the -pi4 suffix.

P#98587 2021-10-13 17:08 ( Edited 2021-10-14 15:19)

To reduce input lag, I also added the following settings to the first line in /boot/cmdline.txt
usbhid.jspoll=1 usbhid.mousepoll=1 xpad.cpoll=1

To poll USB controllers and XInput controllers at 1 kHz rate.

P#98617 2021-10-14 02:38

[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2021-10-19 15:32:09 | 0.010s | Q:20