Re: [LDWG][FBSD_LDWG] framework kernel module

From: Chris Moerz <freebsd_at_ny-central.org>
Date: Sat, 08 Mar 2025 20:47:55 UTC
Hi Gleb,

thanks for the insightful feedback!

>
> This feels like a wrong direction to me (or maybe I'm misunderstanding
> the intended usecase).

Honestly, you're right either way; that's why I'm asking for feedback. I
started building primarily as a learning experience for myself and because
I'm using x11-wm/dwm, which is an incredibly simplistic window manager.

I realize, I should have started with that.

I am pretty certain there are better ways for doing this and I imagine it
will be of use to a limited set of users - i.e. those who work on ttys
more than on X11 or anyone in a window manager setting like me. This is by
no means thought to be the definitive approach to backlight handling.

>
> Generally speaking, there are two approaches to manage the screen brightness:
>
> 1. From the lower levels, maybe even from within the kernel, like your
> kmod does.
> 2. From the upper levels, on the DE plane.
>
> Currently KDE Plasma takes the second approach and I think there
> should be a reason for it. Most likely a DE has more information on
> what's going on in the system to decide whether to dim the screen or
> lit it up. Another and more specific reason is to support multiseat
> configuration - when a computer has two monitors, two sets of input
> devices and two users simultaneosly running two graphical sessions we
> don't want an activity of the first one to affect the brightness of
> the second one.

Ha, that's a very good point! I admit I did not consider the dual screen
use case when I started building my kernel module. I suspect I could find
ways to still make it work, but that's besides the point.

Out of curiosity, I looked into dbus and I learned there's parts I can add
for making this more feature rich. I started building this because I
wanted to understand the problem space a bit better, and as such, this has
been quite enlightening so far. I would not have touched all those kernel
components, libraries and so on.

>
> Actually, Plasma already has a FreeBSD backend for brightness control,
> so dimming the screen after an inactivity period already works for us.
> Same goes for inhibiting brightness adjustments when a video is being
> played in a browser or a player application. Moreover, it will turn
> out that the kmod will fight with the DE to control brightness.

Yes, you're right - in those instances, it will likely be of little use,
if not even counter productive. It's a far cry from a general purpose
solution.

>
> What's the added value for the kmod, exactly? Maybe it is intended to
> be used with more simplistic DEs that do not control brightness
> themselves?
>

Pretty much that, to be honest. When I started building it, neither Gnome
nor KDE were in my mind. I expected that this makes it a niche product.

Hope that clarifies it a bit further.
Additional feedback welcome!

chris