Re: Could not change brightness anymore with i915kms & acpi_video modules c 202211

2023-02-03 Thread Rodney W. Grimes
> 
> Emmanuel Vadot writes:
> > On Thu, 02 Feb 2023 20:58:58 +
> > "Poul-Henning Kamp"  wrote:
> >
> > > 
> > > parv/FreeBSD writes:
> > > 
> > > > > Does backlight(8) works for you?
> > > >
> > > > Thanks for the clue. It does! It does ...
> > > >
> > > > - I get the same number back via "backlight" without any arguments as
> > > >   what I gave it earlier. There was no reporting of value being
> > > >   subtracted by one;
> > > 
> > > Sorry for the delay in reporting back.
> > > 
> > > I consistently read one less back, except for 0 and 100.
> >
> >  Even 50 ?
> 
>   # backlight 
>   brightness: 0
>   # backlight 50
>   # backlight
>   brightness: 49
>   # backlight 25
>   # backlight
>   brightness: 24
>   # backlight 75
>   # backlight
>   brightness: 74
> 
> yes

This smells like a zero-bias byte rounding issue...
Ie, if the backlight intensity register is 8 bit,
having values 0 to 255, and we scale 50% to
256 * 50% == 128 or do we scale to 255 * 50% == 127,
and then reverse it as 127/255 == 49.

> 
> >  So if you have, let's say brightness at 50%, and you plug an external
> > monitor, brightness goes up to 100% ?
> 
> No, plugging and unplugging does not change the backlight.
> 
> But when the screen saver has kicked in, and I wake it up again, it comes
> back at 100, (and reads back as 100)
> 
> -- 
> Poul-Henning Kamp   | UNIX since Zilog Zeus 3.20
> p...@freebsd.org | TCP/IP since RFC 956
> FreeBSD committer   | BSD since 4.3-tahoe
> Never attribute to malice what can adequately be explained by incompetence.
> 
> 

-- 
Rod Grimes rgri...@freebsd.org



Re: Could not change brightness anymore with i915kms & acpi_video modules c 202211

2023-02-03 Thread Poul-Henning Kamp

Emmanuel Vadot writes:
> On Thu, 02 Feb 2023 20:58:58 +
> "Poul-Henning Kamp"  wrote:
>
> > 
> > parv/FreeBSD writes:
> > 
> > > > Does backlight(8) works for you?
> > >
> > > Thanks for the clue. It does! It does ...
> > >
> > > - I get the same number back via "backlight" without any arguments as
> > >   what I gave it earlier. There was no reporting of value being
> > >   subtracted by one;
> > 
> > Sorry for the delay in reporting back.
> > 
> > I consistently read one less back, except for 0 and 100.
>
>  Even 50 ?

# backlight 
brightness: 0
# backlight 50
# backlight
brightness: 49
# backlight 25
# backlight
brightness: 24
# backlight 75
# backlight
brightness: 74

yes

>  So if you have, let's say brightness at 50%, and you plug an external
> monitor, brightness goes up to 100% ?

No, plugging and unplugging does not change the backlight.

But when the screen saver has kicked in, and I wake it up again, it comes
back at 100, (and reads back as 100)

-- 
Poul-Henning Kamp   | UNIX since Zilog Zeus 3.20
p...@freebsd.org | TCP/IP since RFC 956
FreeBSD committer   | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.



Re: Could not change brightness anymore with i915kms & acpi_video modules c 202211

2023-02-02 Thread Emmanuel Vadot
On Thu, 02 Feb 2023 20:58:58 +
"Poul-Henning Kamp"  wrote:

> 
> parv/FreeBSD writes:
> 
> > > Does backlight(8) works for you?
> >
> > Thanks for the clue. It does! It does ...
> >
> > - I get the same number back via "backlight" without any arguments as
> >   what I gave it earlier. There was no reporting of value being
> >   subtracted by one;
> 
> Sorry for the delay in reporting back.
> 
> I consistently read one less back, except for 0 and 100.

 Even 50 ?

> (This could easily be a BIOS bug)

 At first I though so too but I'll need to check if this isn't a
rounding error between backlight(4) and linuxkpi wrappers.
 I know that some hardware don't have a perfect pwm controller for the
backlight and so you have only some steps that it can do (but you don't
know them).

> It also looks like the "no-op" behaviour I reported previously have
> gone away with my latest kernel update.

 Weird, nothing has changed for a while in this area but happy that
it's fixed ;)

> But I see a new behaviour, but this may be intentional:  When it
> comes out of screen-blanking, it goes to 100 (and reports 100).

 I'm not too surprised about this behavior, there is probably something
that we could do about it but this will need more digging in linux
framework and the drm drivers.

> Also happens when an external monitor is connected, which is a
> bit annoying...

 So if you have, let's say brightness at 50%, and you plug an external
monitor, brightness goes up to 100% ?

> -- 
> Poul-Henning Kamp   | UNIX since Zilog Zeus 3.20
> p...@freebsd.org | TCP/IP since RFC 956
> FreeBSD committer   | BSD since 4.3-tahoe
> Never attribute to malice what can adequately be explained by incompetence.
> 


-- 
Emmanuel Vadot  



Re: Could not change brightness anymore with i915kms & acpi_video modules c 202211

2023-02-02 Thread Poul-Henning Kamp

parv/FreeBSD writes:

> > Does backlight(8) works for you?
>
> Thanks for the clue. It does! It does ...
>
> - I get the same number back via "backlight" without any arguments as
>   what I gave it earlier. There was no reporting of value being
>   subtracted by one;

Sorry for the delay in reporting back.

I consistently read one less back, except for 0 and 100.

(This could easily be a BIOS bug)

It also looks like the "no-op" behaviour I reported previously have
gone away with my latest kernel update.

But I see a new behaviour, but this may be intentional:  When it
comes out of screen-blanking, it goes to 100 (and reports 100).

Also happens when an external monitor is connected, which is a
bit annoying...

-- 
Poul-Henning Kamp   | UNIX since Zilog Zeus 3.20
p...@freebsd.org | TCP/IP since RFC 956
FreeBSD committer   | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.



Re: Could not change brightness anymore with i915kms & acpi_video modules c 202211

2023-02-02 Thread parv/FreeBSD
I should have requested in OP to CC to me as I have subscribed to
-current@ list without receiving email.

So here is my attempt to craft a reponse from the web page ...


https://lists.freebsd.org/archives/freebsd-current/2023-January/003142.html


> Oleksandr Kryvulia wrote on 20230131-092359 UTC
>
> 31.01.23 09:52, parv/FreeBSD пише:
> >
> > Since around 2022-11, I am unable to change display brightness
> > of the display of a Framework laptop (Intel i5-1135G7, Iris
> > Xe iGPU) with "i915kms" module (from "drm-510-kmod" package/port)
> > & "acpi_video" (FreeBSD) kernel module.
> >
> > Earlier I was able to change brightness via "hw.acpi.video" MIB ...
> >
> > # - Need to have both "i915kms" & "acpi_video" modules already loaded.
> > #
> > # 20221120 - These MIBs do not work anymore as they are missing.
> > hw.acpi.video.lcd0.economy=10
> > hw.acpi.video.lcd0.fullpower=40
> > hw.acpi.video.lcd0.brightness=15
...
> Does backlight(8) works for you?

Thanks for the clue. It does! It does ...

- I get the same number back via "backlight" without any arguments as
  what I gave it earlier. There was no reporting of value being
  subtracted by one;

- with 0, everything was near-black, dark enough for not being able to
  read anything on the console;

- with 100, screen was surely damn bright *oh my eyes*

- unlike Poul-Hennig K's experience ...


https://lists.freebsd.org/archives/freebsd-current/2023-January/003143.html

  ... when running with & without AC (for short periods) I did not see
  any change in "backlight" behaviour. The brightness did not change
  unless I had changed it myself.

Thanks again.


FreeBSD here is ...

  FreeBSD luna 14.0-CURRENT FreeBSD 14.0-CURRENT #6
  main-n260169-34ac629b40e6: Fri Jan 20 07:05:01 HST 2023
  root@luna:/build/world/freebsd/src/amd64.amd64/sys/GENERIC-Light
  amd64


- parv

--


Re: Could not change brightness anymore with i915kms & acpi_video modules c 202211

2023-01-31 Thread Poul-Henning Kamp

Emmanuel Vadot writes:

>  What does backlight reports after you've unplugged the AC adaptor ?

I cant make that experiment right now, I also ethernet through that
connector, but I'll do it later today.

But speaking of what backlight reports:

critter phk> backlight
brightness: 0
critter phk> backlight 10
critter phk> backlight
brightness: 9
critter phk> backlight 20
critter phk> backlight
brightness: 19
critter phk> backlight 30
critter phk> backlight
brightness: 29

-- 
Poul-Henning Kamp   | UNIX since Zilog Zeus 3.20
p...@freebsd.org | TCP/IP since RFC 956
FreeBSD committer   | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.



Re: Could not change brightness anymore with i915kms & acpi_video modules c 202211

2023-01-31 Thread Emmanuel Vadot
On Tue, 31 Jan 2023 13:09:39 +
"Poul-Henning Kamp"  wrote:

> 
> Emmanuel Vadot writes:
> 
> > > > Does backlight(8) works for you?
> > > 
> > > Speaking of backlight(8):  On my T14s, I see the following:
> > > 
> > > If I set the light with backlight(8) to something, say 30%, and then
> > > change the power-situation, for instance by unplugging the charger,
> > > the backlight goes up to 100%.
> > > 
> > > If I then try to set it back to 30% with backlight(8), nothing happens.
> > > 
> > > If I use any other value, for instance 31%, backlight(8) does the job.
> > > 
> > > I guess somewhere some code says "It's always 30%, just return" ?
> > > 
> > > This might be a bit confusing if you have the intensity encoded in
> > > some script, which then "sometimes does not work"...
> >
> >  Smells like
> > https://cgit.freebsd.org/src/commit/sys/dev/backlight/backlight.c?id=e26ef41f79902991c772b59927c721aa7fa5fc64
> >  It's not in 13.1 but will be in 13.2
> 
> I'm running
> 
>   14.0-CURRENT #0 main-n260119-7f2109f240c2: Mon Jan 16 22:54:18 UTC 2023

 What does backlight reports after you've unplugged the AC adaptor ?

-- 
Emmanuel Vadot  



Re: Could not change brightness anymore with i915kms & acpi_video modules c 202211

2023-01-31 Thread Poul-Henning Kamp

Emmanuel Vadot writes:

> > > Does backlight(8) works for you?
> > 
> > Speaking of backlight(8):  On my T14s, I see the following:
> > 
> > If I set the light with backlight(8) to something, say 30%, and then
> > change the power-situation, for instance by unplugging the charger,
> > the backlight goes up to 100%.
> > 
> > If I then try to set it back to 30% with backlight(8), nothing happens.
> > 
> > If I use any other value, for instance 31%, backlight(8) does the job.
> > 
> > I guess somewhere some code says "It's always 30%, just return" ?
> > 
> > This might be a bit confusing if you have the intensity encoded in
> > some script, which then "sometimes does not work"...
>
>  Smells like
> https://cgit.freebsd.org/src/commit/sys/dev/backlight/backlight.c?id=e26ef41f79902991c772b59927c721aa7fa5fc64
>  It's not in 13.1 but will be in 13.2

I'm running

14.0-CURRENT #0 main-n260119-7f2109f240c2: Mon Jan 16 22:54:18 UTC 2023

-- 
Poul-Henning Kamp   | UNIX since Zilog Zeus 3.20
p...@freebsd.org | TCP/IP since RFC 956
FreeBSD committer   | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.



Re: Could not change brightness anymore with i915kms & acpi_video modules c 202211

2023-01-31 Thread Emmanuel Vadot
On Tue, 31 Jan 2023 12:33:02 +
"Poul-Henning Kamp"  wrote:

> 
> Oleksandr Kryvulia writes:
> 
> > Does backlight(8) works for you?
> 
> Speaking of backlight(8):  On my T14s, I see the following:
> 
> If I set the light with backlight(8) to something, say 30%, and then
> change the power-situation, for instance by unplugging the charger,
> the backlight goes up to 100%.
> 
> If I then try to set it back to 30% with backlight(8), nothing happens.
> 
> If I use any other value, for instance 31%, backlight(8) does the job.
> 
> I guess somewhere some code says "It's always 30%, just return" ?
> 
> This might be a bit confusing if you have the intensity encoded in
> some script, which then "sometimes does not work"...

 Smells like
https://cgit.freebsd.org/src/commit/sys/dev/backlight/backlight.c?id=e26ef41f79902991c772b59927c721aa7fa5fc64
 It's not in 13.1 but will be in 13.2

> 
> -- 
> Poul-Henning Kamp   | UNIX since Zilog Zeus 3.20
> p...@freebsd.org | TCP/IP since RFC 956
> FreeBSD committer   | BSD since 4.3-tahoe
> Never attribute to malice what can adequately be explained by incompetence.
> 


-- 
Emmanuel Vadot  



Re: Could not change brightness anymore with i915kms & acpi_video modules c 202211

2023-01-31 Thread Goran Mekić

On 1/31/23 13:33, Poul-Henning Kamp wrote:
> Speaking of backlight(8):  On my T14s, I see the following:
>
> If I set the light with backlight(8) to something, say 30%, and then
> change the power-situation, for instance by unplugging the charger,
> the backlight goes up to 100%.
>
> If I then try to set it back to 30% with backlight(8), nothing happens.
>
> If I use any other value, for instance 31%, backlight(8) does the job.
>
> I guess somewhere some code says "It's always 30%, just return" ?
>
> This might be a bit confusing if you have the intensity encoded in
> some script, which then "sometimes does not work"...
>
Actually, I think the problem is a bit deeper, as yet-to-come version of 
DRM 5.14 suffers from the similar problem: 
https://github.com/freebsd/drm-kmod/pull/226#issuecomment-1400399357. 
TL;DR: new DRM code sets brightness to 0% while backlight(8) reports 100%.


Regards,
meka



Re: Could not change brightness anymore with i915kms & acpi_video modules c 202211

2023-01-31 Thread Poul-Henning Kamp

Oleksandr Kryvulia writes:

> Does backlight(8) works for you?

Speaking of backlight(8):  On my T14s, I see the following:

If I set the light with backlight(8) to something, say 30%, and then
change the power-situation, for instance by unplugging the charger,
the backlight goes up to 100%.

If I then try to set it back to 30% with backlight(8), nothing happens.

If I use any other value, for instance 31%, backlight(8) does the job.

I guess somewhere some code says "It's always 30%, just return" ?

This might be a bit confusing if you have the intensity encoded in
some script, which then "sometimes does not work"...

-- 
Poul-Henning Kamp   | UNIX since Zilog Zeus 3.20
p...@freebsd.org | TCP/IP since RFC 956
FreeBSD committer   | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.



Re: Could not change brightness anymore with i915kms & acpi_video modules c 202211

2023-01-31 Thread Oleksandr Kryvulia

31.01.23 09:52, parv/FreeBSD пише:


Since around 2022-11, I am unable to change display brightness
of the display of a Framework laptop (Intel i5-1135G7, Iris
Xe iGPU) with "i915kms" module (from "drm-510-kmod" package/port)
& "acpi_video" (FreeBSD) kernel module.

Earlier I was able to change brightness via "hw.acpi.video" MIB ...

# - Need to have both "i915kms" & "acpi_video" modules already loaded.
#
# 20221120 - These MIBs do not work anymore as they are missing.
hw.acpi.video.lcd0.economy=10
hw.acpi.video.lcd0.fullpower=40
hw.acpi.video.lcd0.brightness=15


... now the whole of "hw.acpi.video" stub is missing. Nothing has
changed in terms of how/when "i915kms" & "acpi_video" are loaded (via
"kld_list" variable via "/etc/rc.conf" in that order).

What am I missing?


Does backlight(8) works for you?