HNHacker News
TopNewBestAskShowJobs

dividuum

2,704 karma · joined October 19, 2011

I love programming

Working full time on a digital signage service:

  https://info-beamer.com
See https://dividuum.de/ for other projects.

Contact me at fw@dividuum.de / @dividuum

submissionscomments
dividuum··on Show HN: I vibecoded a 35k LoC recipe app
https://www.pickuplimes.com/ is pretty good.
dividuum··on Writing a tiny undo/redo stack in JavaScript
Thanks for your response. Interesting. I can see that working with these restrictions. This basically also assumes the data within that memory area only has pointers to either somewhere else in that area or to static structures outside, correct? Also the write rate is probably quite low as I imagine constantly handling SIGBUS would quickly slow things down? Did you look into userfaultfd?
dividuum··on Writing a tiny undo/redo stack in JavaScript
I honestly can’t tell if that’s an elaborate joke response or if that’s really something that works. If it does:

* How do you make sure you capture all mapped memory within a process? Walking something like /proc/self/maps?

* Does this include the stack and if so, doesn’t this cause havok when you write back. And if it doesn’t include the stack, can’t run things out of sync easily?

* This is then a page sized undo/redo, so it isn’t atomic with regards to actions triggered. Wouldn’t partially undoing such changes easily cause an invalid state?

dividuum··on TinyKVM: Fast sandbox that runs on top of Varnish
Yes

> TinyKVM can fork itself into copies that use copy-on-write to allow for huge workloads like LLMs to share most memory. As an example, 6GB weights required only 260MB working memory per instance, making it highly scalable.

dividuum··on TinyKVM: Fast sandbox that runs on top of Varnish
You need a few syscalls: to grow your heap size (brk) or to exit your program (exit). I took a quick look at their code and here are the syscalls and arguments implemented: https://github.com/varnish/tinykvm/blob/master/src/functions...

It’s a bit more than running a program under seccomp strict mode, but conceptually similar, so running anything too complicated likely won't work. You certainly won’t be able to sandbox chromium for taking website snapshots for example.

dividuum··on Exploring Polymorphism in C: Lessons from Linux and FFmpeg's Code Design (2019)
So does the good old Quake 2 rendering API. The game exported a bunch of functions to the renderer via refimport_t and the renderer in return provided functions via refexport_t. The only visible symbol in a rendering DLL is GetRefAPI_t: https://github.com/id-Software/Quake-2/blob/master/client/re...

I remember being impressed by this approach, so I shamelessly copied it for my programming game: https://github.com/dividuum/infon/blob/master/renderer.h :)

dividuum··on The most unhinged video wall, made out of Chromebooks
> The deprecation of OMXPlayer has been problematic for one, since I rely on some custom applications which need to be able to have some fairly precise/low latency requirements between when you tell it to start playing vs when the playback actually starts, etc. I haven’t found a suitable mechanism which meets our reqs on a Pi for controlling/playing videos yet since that deprecation.

Yeah. The Pi3 -> Pi4/5 jump was quite a massive change in how things work. I've been writing my own playback engine for 10 years now and that one was quite challenging. Precise playback start is something my software supports: You control everything in Lua and can, for example, preload a video and then start it based on either internal logic or based on an external trigger. Up to the Pi3, my software also supports dynamically adjusting the HDMI clock, so the vsyncs of multiple displays are synchronized. Customers have been using that for almost 10 years for video wall playback.

If you go with the hosted version of the software, provisioning is as simple as extracting a single 60MB zip file to an empty SD card and placing that into the Pi. If needed you can even use the API to preconfigure that ZIP file to include settings like WiFi.

dividuum··on The most unhinged video wall, made out of Chromebooks
I operate a digital signage company based around the Pi. Curious what problems you run into. SD cards?
dividuum··on The most unhinged video wall, made out of Chromebooks
You very very likely won't be able to decode a 13660×768 video fast enough.
dividuum··on Cross Views
It’s not the same. They are slightly different and depending on whether you cross-eye or parallel view them, both texts will slightly move away or towards you in 3D.
dividuum··on Cross Views
Once you learn how to cross view, you can cheat at those „find the difference“ quizzes: Cross view them and the differences will flicker.
dividuum··on Cross Views
A triangle with an exclamation mark inside.
dividuum··on Improving video rotation performance on the Pi using VPU vector instructions
Rotating videos using DRM/KMS on the Pi3 isn't trivial. I had to revert to using the VideoCore co-processor and its massive 64x64 register to improve performance to level comparable with the older firmware implementation. This blog post describe why that's necessary and how it works.
dividuum··on Hard numbers in the Wayland vs. X11 input latency discussion
Pis VideoCore has like 48 planes split up between writeback and HDMI output CRTCs. There’s one explicit Cursor plane per CRTC.
dividuum··on Systems ideas that sound good but almost never work
Steam added a P2P caching mechanism recently and allows downloading games for other local machines that already have the game installed. Greatly helps with avoiding duplicate downloads on a steam deck, for example.

I also added a similar mechanism to my own product years ago. Works flawlessly. Using content based addressing already made it quite easy to implement.

dividuum··on Accessing a DRM Framebuffer to display an image
> I dunno how much hardware abstraction there is in libdrm (and this is my own dawn fault as I should have dug deeper a long time ago in libdrm interface), do we have to "know" how to deal with the native format, or is there some (expensive) hardware abstraction to deal with this conversion?

From my experience there is no magic at all. You have to wire everything up yourself. Different cards expose different properties and limitations, albeit all through the same API. But you have to handle the differences yourself. For example the Pi's primary VC4 graphics card has 48 planes to place framebuffers onto the screen, while the minimal implementation their 7" display uses only has a single plane. Your code has to know how to handle this. DRM doesn't abstract that away.

dividuum··on Accessing a DRM Framebuffer to display an image
> The configuration validity depends on the current state of the display controller.

Yep. At least now the Pi's implementation does cause kernel tracebacks or lockups any more. Was rough in the beginning :-}

Flipping is supported (but not 90/270 rotation) and I use that together with a recently added transpose feature in the Writeback connector to support mirroring the primary VC4's output to the minimal DRM implementation of the official 7" display.

I'm using the Writeback connector to support screenshots, but copying every plane's configuration would be too much sometimes, so I heuristically compose some framebuffers via GL and then only place the remaining framebuffers (including the GL one) on Writeback and HDMI.

dividuum··on Accessing a DRM Framebuffer to display an image
My main source was reading other source and sometimes asking questions in the Pi forum. The already linked kmscube shows how some of mentioned techniques work. It was then mainly following up on API calls names and parameters (DRM_MODE_ATOMIC_TEST_ONLY) to find other snippets of code that use them. Felt a bit more like code archeology :-)
dividuum··on Accessing a DRM Framebuffer to display an image
Right. The number of times I got an EINVAL just to discover yet another reason was quiet something :) (Is there a better way to discover the true reason other than scrolling back through dmesg?)

I'm also falling back to GL composition in some cases or while taking screenshots to avoid composing twice (HDMI + Writeback) if the scene is too complex or if other restrictions make that mandatory: Planes can only be rotated 0/180 degrees on the Pi HVS, so rotating a video to a portrait orientation is done on the GPU.

dividuum··on Accessing a DRM Framebuffer to display an image
I've worked a lot this year on writing DRM/KMS code while porting my digital signage player (https://info-beamer.com) to support the Raspberry Pi5. Since they moved away from their proprietary Broadcom provided graphical APIs (OMX/dispmanx) the Pi now fully supports DRM and the implementation is really solid by now.

There is a ton more to learn: KMS (kernel mode setting) allows fine control over the video mode in case you cannot or do not want to rely on auto-detection.

Then there's the atomic API: Unlike in the blog post, all changes applied to the output (from video mode to plane positions or assigned framebuffers...) are gathered and then applied atomically in a single commit. If necessary you can test if your atomic commit is correct and will work by doing a "Test only commit" before doing the real commit. Making changes atomically avoids all kinds of race conditions resulting in, for example, screen tearing.

Then there's the interaction with video decoding: Using FFmpeg on the Pi allows you to access to hardware decoder. They produce DRM framebuffers for each video frame. You can then directly assign them to planes and position them on the screen. The resulting playback is zero-copy and as fast as it gets on the Pi.

Another fun feature is the Writeback connector, which unlike the one ending up as an HDMI signal allows you to write your output to a new DRM framebuffer. This can, for example, be used to take screenshots of your output or even feed the buffer back into a video encoder.

One very frustration aspect is that there is basically no real documentation, especially about semantics. I guess it makes sense if you consider that there's probably only a limited number of API consumers (like desktop compositors, special video players).

dividuum··on Tweaking Stunt Island's 30-year-old 3D engine
Not sure how viable that would be, but if the rotation within the game is high-res enough I imagine one might render the same scene four times each with a rotation offset equivalent to half a pixel. Then combine those to a whopping 640x400 image :)
dividuum··on Raspberry Pi boosts Pi 5 performance with SDRAM tuning
Faking NUMA can help enforcing access patterns that make things faster:

> In the worst case, two sdram clients accessing different pages of the same bank, may cause repeated closing and opening of the pages, harming the usable bandwidth you can achieve. Which pages belong to a bank depends on the physical address lines of the buffers used. We have found that it is pretty common for buffers to be allocated in pathologically bad ways.

> NUMA allows us to have more control over this. We can split our sdram, into, say, 8 NUMA regions, and configure the kernel to interleave the allocations between the regions. In addition the sdram controller allows the address bits used for segmenting the banks to be reconfigured (which we've exposed through eeprom config SDRAM_BANKLOW).

https://forums.raspberrypi.com/viewtopic.php?t=378276

dividuum··on Raspberry Pi CM5 is a faster, drop-in upgrade
Right. I read it as "modified by Broadcom". Just wanted to point out, that this isn't inherently a bad thing if done right.
dividuum··on Raspberry Pi CM5 is a faster, drop-in upgrade
There is no "Broadcom-modified kernel". There's a fork with changes needed to support all Pi hardware at https://github.com/raspberrypi/linux. Unlike some boards were you're eternally stuck at old versions, the fork is actively maintained (currently mostly at 6.6, soon 6.12) with its changes regularly getting upstreamed. You post make it sound like the Pi kernel is a mess, which it is absolutely not.
dividuum··on Quake 3 Source Code Review: Network Model (2012)
There's enet (https://github.com/lsalzman/enet) or something like naia (https://github.com/naia-lib/naia) which supposedly uses ideas from the old (but very reliable back in the day) networking of the game Tribes 2 (https://github.com/nardo/tnl2 / https://www.gamedevs.org/uploads/tribes-networking-model.pdf).
dividuum··on Pipe Viewer – A Unix Utility You Should Know About
I was curious on how that’s supposed to work, so I took a quick look: It scans /proc for known commands, then looks up file descriptor information via their fd/fdinfo directory to get size/seek positions and then shows a percentage of the largest file.
dividuum··on Show HN: I built a(nother) house optimized for LAN parties
Aka Peg-DHCP (RFC 2322) - https://www.rfc-editor.org/rfc/rfc2322.txt
dividuum··on An Update on Apple M1/M2 GPU Drivers
I guess it's these two files?

The original 2600+ lines of C++: https://gitlab.freedesktop.org/asahi/mesa/-/blob/main/src/ga...

The translated code: https://gitlab.freedesktop.org/asahi/mesa/-/blob/main/src/as...

dividuum··on Raspberry Pi announces branded range of NVMe SSDs and SSD kit
What a weird thing to say. The Pi is more open source than ever. Output is controlled by DRM/KMS. Video decoding uses FFmpeg and OpenGL is now via Mesa. All of that was closed source binaries two generations ago. Kernel changes are pushed upstream if possible too. Sure I can’t print my own board, but that was never the case or the goal.
dividuum··on 45 years ago CompuServe connected the world before the World Wide Web
After recently reading about Fracint somewhere and now seeing this, it very likely confirms that this was the program my dad downloaded from CompuServe and used to render images over night on our 286. Thanks for the link :)
← PreviousPage 2 of 24Next →