WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: building love2d on RPI3  (Read 182 times)

Offline breadbanana

  • Newbie
  • *
  • Posts: 9
building love2d on RPI3
« on: April 10, 2025, 08:55:48 PM »
Hello guys!

So i've been working with TC for a while now and the experience is been absolutely good.
So i developed an applicaiton demo on dietpi using love2d with kmsdrm and opengles2 WHICH WORK on this enviroment

So i did the same steps here and was expecting the same results, but this isn't what happend:
i'm on the love 11.5 and built SDL2.32 from source too, i made sure to disable all stuff that i'don't need there
Code: [Select]
./configure --enable-alsa=yes --enable-oss=no --enable-pulseaudio=no --enable-esd=no --enable-pipewire=no --enable-arm-neon=yes --enable-arm-simd=yes --enable-video-opengl=no --enable-video-opengles=yes --enable-video-vulkan=no --enable-video-rpi=yes --enable-video-x11=no --enable-video-wayland=no --enable-video-kmsdrm=yes
Then i built love2d, it works... but the performance is suboptimal!
The first thing i see it declares it is running on:
Code: [Select]
OpenGL 4.5 (Core Profile) Mesa 24.2.5 Mesa llvmpipeinstead:
Code: [Select]
OpenGL ES       OpenGL ES 2.0 Mesa 23.2.1-1~bpo12+rpt3  Broadcom        VC4 V3D 2.1
The second issue i see when i try to run my application with "SDL_VIDEODRIVER=kmsdrm" to force the application to run over kmsdrm i get:
Code: [Select]
Error: Could not initialize SDL video subsystem (kmsdrm not available)
i do tce-loaded rpi-vc-dev, mesa-dev, libegl-dev and libdrm-dev

Any ideia of what may i be missing? anything may help! thanks!

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 15079
Re: building love2d on RPI3
« Reply #1 on: April 11, 2025, 03:09:35 AM »
Do you have dtoverlay=vc4-kms-v3d in your config.txt?

Have you loaded Xorg-3d?

Offline breadbanana

  • Newbie
  • *
  • Posts: 9
Re: building love2d on RPI3
« Reply #2 on: Today at 12:26:10 PM »
Juanito, thanks for your interest in the topic
the config.txt is pretty much the standard one, some diferences are on the sound cart and in the uart peripherals.

just before the end of file it has:
Code: [Select]
[all]
# Enable DRM VC4 V3D driver
dtoverlay=vc4-kms-v3d
max_framebuffers=2
i'm not using X at all, this is my main objective with this build. i had success when doing it trough dietpi.

love let me use some system vars to configure which driver and which graphics backend i can use
the main question is i want to use kmsdrm, and i THINK i had everything tce-loaded from it ( may i be wrong? ) but as soon i force using it i get that "kmsdrm not available". i think this might be the first hint that something is wrong.
i've tested the SDL2 from the repo and tryied to built it myself.

Thanks in advance.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 15079
Re: building love2d on RPI3
« Reply #3 on: Today at 12:31:01 PM »
You’ll need graphics-KERNEL loaded.

I just updated SDL2 - it says it supports kmsdrm.

Offline breadbanana

  • Newbie
  • *
  • Posts: 9
Re: building love2d on RPI3
« Reply #4 on: Today at 02:22:05 PM »
let's do some sanity checks
I'm on raspberry pi 3b+. I'm pretty sure it is a good unity, is quite new, and was being used on other machine.
i've downloaded the image from
Code: [Select]
http://tinycorelinux.net/15.x/aarch64/releases/RPi/piCore64-15.0.0.zip, my focus with this device is to work mainly with RPI3 maybe on Zero W2, and RPI4 on some rare ocasions.

I've removed every .tcz i've built and working with only the .tczs that are on the repository.

using uname-r i get
Code: [Select]
6.6.47-piCore-v8
when requesting kmsprint i get:
Code: [Select]
terminate called after throwing an instance of 'std::runtime_error'
  what():  failed to find DRM cards
Aborted

but if i modprobe -r vc4 and then modprobe vc4, i get from kmsprint:
Code: [Select]
Connector 0 (32) HDMI-A-1 (connected)
  Encoder 0 (31) TMDS
    Crtc 3 (90) 1600x900@60.00 108.000 1600/24/80/96/+ 900/1/3/96/+ 60 (60.00) P|D
      Plane 3 (80) fb-id: 292 (crtcs: 3) 0,0 1600x900 -> 0,0 1600x900 (XR24 AR24 AB24 XB24 RG16 BG16 AR15 XR15 RG24 BG24 YU16 YV16 YU24 YV24 YU12 YV12 NV12 NV21 NV16 NV61 RGB8 BGR8 XR12 AR12 XB12 AB12 BX12 BA12 RX12 RA12)
        FB 292 1600x900 RG16

i believe this might be a hint:

after that, when i load love2d and request  what drivers it is using it returns :
Code: [Select]
OpenGL  2.1 Mesa 24.2.5 Broadcom        VC4 V3D 2.1and i see my fps are quite low. it is using OpenGL2.1 instead OpenGL ES 2.0 ( which this might make some sense as i'm using the repo built not my custom built sdl) but atleast is using the video hardware.

my questions are, why i'm need to reload module vc4 by hand after built?

in the past I used to configure the desired video resolution on config.txt, and afaik these configs are legacy and barelly supported, what are the standards today? how can i force 720p for instance and maybe even ignore monitor EDID?

Thanks in advance!


Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1350
Re: building love2d on RPI3
« Reply #5 on: Today at 03:21:45 PM »
Resolution has to be set in the video application.   None of the legacy firmware stuff works with the vc4 kms driver.   You can try to set the resolution of the Linux Console using the video= on the kernel command line (See the raspi documentation for that)