Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
ynohtna
Feb 16, 2007

backwoods compatible
Illegal Hen

FAT32 SHAMER posted:

last weekend I uninstalled Bazzite and went back to windows after having dumb issues with Helldivers 2. did some reading over the week while experiencing new and exciting issues with the game, this time on windows, and realised I need to see if I have the same issues in a different distro or image and then potentially dehumanise myself and face to Win11. installed Nobara tonight, mostly since it’s a low-touch gaming distro that had a handy welcome app that installed a bunch of crap that I hadn’t bothered to try yet (like proton ge since it made the steam window dance around and have weird onClick positioning). then it installed Nvidia drivers for me, with the latest version. I installed HD2 and squad and both ran better than on Bazzite, which already ran games better than on windows. and there was even my beloved gnome variant :3:

once work starts slowing down I’d like to tweak around a bit more with stuff and straight up keep windows off the new machine I’m building

edit: I don’t actually remember if it had been established that the other thread was the Linux gaming thread or not

A strange game. The only winning move is not to install.

Adbot
ADBOT LOVES YOU

ziasquinn
Jan 1, 2006

Fallen Rib

FAT32 SHAMER posted:

last weekend I uninstalled Bazzite and went back to windows after having dumb issues with Helldivers 2. did some reading over the week while experiencing new and exciting issues with the game, this time on windows, and realised I need to see if I have the same issues in a different distro or image and then potentially dehumanise myself and face to Win11. installed Nobara tonight, mostly since it’s a low-touch gaming distro that had a handy welcome app that installed a bunch of crap that I hadn’t bothered to try yet (like proton ge since it made the steam window dance around and have weird onClick positioning). then it installed Nvidia drivers for me, with the latest version. I installed HD2 and squad and both ran better than on Bazzite, which already ran games better than on windows. and there was even my beloved gnome variant :3:

once work starts slowing down I’d like to tweak around a bit more with stuff and straight up keep windows off the new machine I’m building

edit: I don’t actually remember if it had been established that the other thread was the Linux gaming thread or not

you just gotta go deep and never reinstall windows. just keep reinstalling linux if you can't fix it. do it for a year and you'll be like "wow, what a waste of time! I learned so much!"

at least reinstalling linux only takes like 10 minutes.

Cybernetic Vermin
Apr 18, 2005

seeing how one of the first things one would reasonably be expected to learn from that experience would be the futility to keep reinstalling linux i think the people who do it are impossible to educate

spankmeister
Jun 15, 2008






I haven't reinstalled windows on any of my machines since idk, win7? XP SP2 maybe?

Sapozhnik
Jan 2, 2005

Nap Ghost
nvk soon, trust the plan

BlankSystemDaemon
Mar 13, 2009




spankmeister posted:

I haven't reinstalled windows on any of my machines since idk, win7? XP SP2 maybe?
Windows XP pre-SP2 (and especially pre-SP1) was such an utter shitshow, though - it's what drove me to try out Linux.

Linux had lovely documentation, so someone burned the hot-off-the-presses FreeBSD 4.0 ISO, and printed the manual for me on paper (at a university, where the printers weren't secured properly if you had CUPS) - which leads right up to today, since I never stopped using it.

outhole surfer
Mar 18, 2003

reinstall windows is a legit fix for linux with embarrassing frequency, since windows update often updates device firmwares

fixed my rig ally's sound by installing windows, running updates, then reinstalling linux

Tankakern
Jul 25, 2007

we got fwupd now

FlapYoJacks
Feb 12, 2009
I bought a Legion Go, and surprisingly, BazziteOS, works perfectly and gives an additional 1 - 3 hours of battery life. Everything works OOB: even HDR, sleep, the joysticks, and sound.

How the hell does Windows somehow get worse battery life than Linux? :psyduck:

FlapYoJacks fucked around with this message at 05:40 on May 20, 2024

outhole surfer
Mar 18, 2003

i need to try bazzite. i use chimeraos today and have sleep issues. the ally *appears* to sleep, but if you put it in a bag for a couple hours you'll find it toasty as gently caress with a drained battery

it boots in no time, so i make sure to just power it off, but auto hibernate seems like low hanging fruit for a distro to implement

psiox
Oct 15, 2001

Babylon 5 Street Team
oh man, I just got one of those GPD devices when it was being talked about earlier in some thread and first tried Nobara on it because it's maintained by a person that also does good Proton releases. That was a mistake because one person cannot maintain a good distro, so after fighting with it for a week I went to Bazzite and it is absolutely flawless out of the box. I mean, I wish I could tune TDP more but it's a very new device and I can only hope that things work better eventually. But it's leaps and bounds more functional than Nobara was, and plus it's not named after an anime or something.

ryanrs
Jul 12, 2011

I found good DRM example code!

https://github.com/dvdhrm/docs/tree/master/drm-howto
- modeset.c
- modeset-double-buffered.c
- modeset-vsync.c
- modeset-atomic.c

Builds and runs cleanly on a Raspberry Pi Zero 2 W with RPi OS Lite 32-bit.

You probably need this library:
$ sudo apt install libdrm-dev

Colonel Taint
Mar 14, 2004


ryanrs posted:

I found good DRM example code!

https://github.com/dvdhrm/docs/tree/master/drm-howto
- modeset.c
- modeset-double-buffered.c
- modeset-vsync.c
- modeset-atomic.c

Builds and runs cleanly on a Raspberry Pi Zero 2 W with RPi OS Lite 32-bit.

You probably need this library:
$ sudo apt install libdrm-dev

A bit late to the party but have you considered running a gstreamer pipeline? There are elements that will resize video and I believe it's also possible to render direct to a drm device via kmssink. I'm not really familiar with zoneminder but if it's sending video you may be able to use an actual streaming protocol such as RTSP as well.

ryanrs
Jul 12, 2011

I thought a little bit about video, but I am worried about system load on both the ARM zoneminder server and the RPi Zero. The Zero has a hardware h.264 decoder, so video could work, and work well if the hardware is used right. But the jpeg approach is easier to throttle, by slowing down the framerate to 1 every 5 secs or whatever.

Now having played this a bit, the 1920x1080 jpegs are about 150kbytes. If I run 1 jpeg/sec, that is more bandwidth than the video stream from the camera. So it is possible video might use less system resources than the jpegs.

The scene I am recording is extremely static (camera pointed at car & wall). I don't know if 1 fps vs 0.1 fps would even be detectable, aside from the superimposed clock jumping 10 secs at a time.

ryanrs
Jul 12, 2011

ryanrs posted:

I will develop the DRM code a bit more. Maybe I'll start to like it.

My FBDEV program took 92 ms to run, and left the jpeg on the screen.

My DRM program takes 100 ms to start up, then 60 ms to show a jpeg. Since this version of my program does proper mode setting, when it exits the screen goes back to the login prompt cleanly.


Having the program throw up 1 jpeg and exit was a very simple, clean design. But with the switch to DRM, it makes sense for my program to hang around and display several jpegs. I pretty much need to if I want to keep the image on the display. Plus goodies like double buffering and vsync make more sense when you have a sequence of frames to show.

So instead of taking jpeg filenames as arguments, my program reads the filenames from stdin, one per line. This solves some questions re. timing of the images and how long to hold onto the screen (until EOF). And importantly, it keeps a simple UNIX-ish interface that you can play with from the command line.

code:
$ (while true; do curl -so /tmp/frame.jpg 'http://192.168.5.30/cgi-bin/nph-zms?mode=single&monitor=1'; echo /tmp/frame.jpg; sleep 1; done) | ./console-jpeg
I'll polish the code over the weekend and think of a nice way to handle multiple displays, like on a RPi 4.

In terms of complexity, it'll be about 500 lines of code with few dependencies (libjpeg-turbo, libdrm).

big black turnout
Jan 13, 2009



Fallen Rib

Tankakern posted:

we got fwupd now

nm. what's fwupd with you

FlapYoJacks
Feb 12, 2009

big black turnout posted:

nm. what's fwupd with you

Fwup deez nuts.

FAT32 SHAMER
Aug 16, 2012



FlapYoJacks posted:

I bought a Legion Go, and surprisingly, BazziteOS, works perfectly and gives an additional 1 - 3 hours of battery life. Everything works OOB: even HDR, sleep, the joysticks, and sound.

How the hell does Windows somehow get worse battery life than Windows? :psyduck:

it’s impressively good. I also really like vanilla Fedora a lot.

FlapYoJacks
Feb 12, 2009
yeah, the Legion Go is insanely good for what it is. And, as a boring monolithic company, their warranty services will usually just work, unlike Asus.

ryanrs
Jul 12, 2011

My 1 fps slideshow, including fetching the jpegs over the network, now runs at about 5% CPU, 0.15 load avg. That is a lot better than the 1 cpu-second ImageMagick was using per frame.

At this point I'm much happier with the performance. It's sipping cpu in the background, like a slideshow screensaver ought to.

Sapozhnik
Jan 2, 2005

Nap Ghost
hell yeah i love doing embdev c work like that, it's like drinking a fine brandy. wish i could have a good job doing it

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

ryanrs posted:

I even checked to see if maybe the API was released recently, but no, it's been around for over a decade. Is there some other place I should be looking for docs?

the source?

I don’t (just) mean that in the flippant sense of “just read the code duh” but also the source should have man pages or HTML files or whatever other form of documentation they have

pseudorandom name
May 6, 2007

I'd like to repeat my question: why aren't you using the existing graphics stack?

ryanrs
Jul 12, 2011

I am. I'm just writing an app to paint a jpeg on the console. This is how you do it.

e: Or do you mean why am I not running X Windows, etc. This board is meant to be more of an appliance. It'll probably be plugged into a TV. So there's no need for a desktop (also it only has 512 MB of RAM).

ryanrs fucked around with this message at 05:26 on May 18, 2024

pseudorandom name
May 6, 2007

No, how you do it is a fullscreen app on X or Wayland (without the desktop) or directly on the device using EGL. You shouldn't be interacting with KMS or libdrm at all.

ryanrs
Jul 12, 2011

Never heard of it. Most of the code I saw was using fbdev, with scattered warnings that it was deprecated and to use KMS/DRM instead.

e: If opengl es works well on an rpi without X, then that is definitely something I will play with in a future project, tho probably not for this one.

ryanrs fucked around with this message at 06:58 on May 18, 2024

ryanrs
Jul 12, 2011

OK, here is another Linux question, maybe someone knows the answer.

What is the right way to put an attached HDMI display to sleep? For example, maybe I'll only wake the display if motion is detected.

I see mention of DPMS, but I don't know if that's still the right way. Or maybe there's a DRM api for turning the crtc or encoder on and off?

FAT32 SHAMER
Aug 16, 2012



afaik that’s the million dollar question isn’t it?

ryanrs
Jul 12, 2011

looool if i have to use setterm to do it

(I hope setterm is not the right answer)

ryanrs
Jul 12, 2011

2.5 years ago, someone asked the same question and received no answer, so he answered it himself.

Stack Overflow: DRM/KMS disable connector and crtc

If you pass a bunch of zeros and null pointers to the CRTC, it shuts off the HDMI port. This makes sense because the CRTC is what generates the video timing signals such as vsync. Turning off these clocks is traditionally how CRTs were told to sleep. I am not surprised HDMI works similarly.

drmModeSetCrtc(fd_drm, crtc_id, 0, 0, 0, 0, 0, 0);

I'm not sure if it's the null frame buffer or the null connection list that is telling it to shut off. But it works great on a Raspberyy Pi Zero 2 W and this old Dell LCD with DVI inputs.


e: another way, possibly better: https://github.com/tomba/kmsxx/blob/master/utils/kmsblank.cpp

ryanrs fucked around with this message at 21:05 on May 18, 2024

ryanrs
Jul 12, 2011

Sapozhnik posted:

I think it got replaced by the "render nodes" concept, it's mostly a legacy thing that xorg cares about at this point. I think.

These days you can have hardware that can scanout but not render and vice versa. So DRM is stuck being an api for two almost totally unrelated hardware blocks that have nothing in common other than passing buffers between each other, possibly via dma-buf wrapped in some other api like Wayland or whatever.

The mode setting /dev node requires privileged access (on desktop I believe systemd-logind passes fds to user processes and can forcefully revoke those fds using the new revoke system call) and the rendering /dev node or nodes plural do not require special access. Both kinds of dev node can be opened using libdrm although render nodes will be opened by hardware specific Mesa graphics drivers and not by applications directly. These access control mechanisms obsolete the old DRM master concept.

Disclaimer the above might be complete bullshit but this is my understanding of it

I'm testing my code on a RPi 4 to figure dual monitor support, and now I see what you're talking about. My previous board had a Videocore 4 and only one card device. The RPi 4 has a Videocore 6, and has device files for card0 and card1. I have to open both and poke around to find which one is has the 2D framebuffers.

One other change: In a concession to general utility, I adapted console-jpeg to work with images that are not precisely as wide as your screen. I didn't have a general-purpose image resizer immediately at hand, so it's using libturbo-jpeg's scaling code. It can scale from 1/8 -2x, in multiples of 1/8. It automatically picks the largest size that completely fits on the screen.

I also need to decide if this thing is going to be C or C++. Right now it's sort of indeterminate.

pseudorandom name
May 6, 2007

ryanrs
Jul 12, 2011

literally the entire program is pointer arithmetic

it memory maps its input files just so it can do even more pointer arithmetic

e: tomorrow I'll post the code on github so people can make fun of it

ryanrs fucked around with this message at 06:49 on May 19, 2024

spankmeister
Jun 15, 2008






memory map deez nuts

Truga
May 4, 2014
Lipstick Apathy

FlapYoJacks posted:

How the hell does Windows somehow get worse battery life than Windows? :psyduck:
this has been a thing on since like... 2008 era. as long as your laptop/device doesn't have weird proprietary acpi bullshit that's not yet reverse engineered, you'll get more battery life because idle linux is idle while idle windows is still running at least one service loading a cpu core or two. also, the whole thing with logging your location, heart rate, bladder status, mouse movement, and keystrokes and sending them to copilot or whatever the gently caress is its latest telemetry brand name

Truga
May 4, 2014
Lipstick Apathy
i had a vaio Z sometime around 2010-2016, and it was pretty funny how when people at work noticed how great it is they also got it, but instead of 9h of battery life they only had 6h, because while the support on linux was kinda wonky until bumblebee started supporting it properly, you could manually rmmod nvidia and get an additional 3h battery life, but windows 1. couldn't shut it off correctly and 2. only worked with "official sony drivers" because it had custom device IDs for all the hardware, so nothing you'd want to use nvidia for loving worked with 5 years out of date gpu drivers anyway

ziasquinn
Jan 1, 2006

Fallen Rib
:jerkbag:

ryanrs
Jul 12, 2011

Github: ryanrsrs/console-jpeg

Works on my Raspberry Pi 4B and RPi Zero 2 W. It doesn't work on my Rockchip server, so don't get your hope up re. other platforms. I'll see if I can make it work on the RK3399.

I need to write a lot more examples. I think you can use tee to setup mirroring, but I still need to try it out.

Turns out listing the displays on the system and letting the user pick one is a huge pain in the rear end.



ryanrs posted:

I also need to decide if this thing is going to be C or C++. Right now it's sort of indeterminate.

Since this is the Linux thread, I decided to write it in the style of Linux, but with // comments because they are clearly superior.

https://github.com/ryanrsrs/console-jpeg/blob/main/console-jpeg.c

sb hermit
Dec 13, 2016





ryanrs posted:

Github: ryanrsrs/console-jpeg

Works on my Raspberry Pi 4B and RPi Zero 2 W. It doesn't work on my Rockchip server, so don't get your hope up re. other platforms. I'll see if I can make it work on the RK3399.

I need to write a lot more examples. I think you can use tee to setup mirroring, but I still need to try it out.

Turns out listing the displays on the system and letting the user pick one is a huge pain in the rear end.

Since this is the Linux thread, I decided to write it in the style of Linux, but with // comments because they are clearly superior.

https://github.com/ryanrsrs/console-jpeg/blob/main/console-jpeg.c

I really appreciate the effort on display, especially the minimal use of external libraries and the custom argument parsing routines.

If I had to attack this issue, I would probably have kept the program running as a daemon (so you would likely have to use udp or a named pipe to talk to it although stdin could still work in a pinch) in order to (1) reduce latency and (2) provide other helpful indicators such as a health indicator for the sensor or some other general error. Maybe even play music or a sound effect to draw attention to it. But all of that is definitely out of scope of your original goals.

Adbot
ADBOT LOVES YOU

BattleMaster
Aug 14, 2000

sb hermit posted:

If I had to attack this issue, I would probably have kept the program running as a daemon (so you would likely have to use udp or a named pipe to talk to it although stdin could still work in a pinch) in order to (1) reduce latency and (2) provide other helpful indicators such as a health indicator for the sensor or some other general error. Maybe even play music or a sound effect to draw attention to it. But all of that is definitely out of scope of your original goals.

In a distro using systemd, you can even have systemd automatically create a socket and connect it to one of the standard streams of the service.

That's one of the great things about systemd - you can write something as a normal console application and turn it into a background daemon with logging and provisions for IPC without the application even being aware of those things. Which gives you an awful lot of freedom in how the program ends up being used since when writing it you don't have to assume anything else than that it's running in a terminal doing normal things.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply