Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core functionality broken on my machine #26

Open
tklebanoff opened this issue Mar 6, 2020 · 5 comments
Open

core functionality broken on my machine #26

tklebanoff opened this issue Mar 6, 2020 · 5 comments

Comments

@tklebanoff
Copy link

Hello lumen developers! Thank you for providing this software enhancement.
Right now, I experience the following behavior:

Two desktop windows:

  • one with a mostly white webpage
  • one all black terminal

Sometimes, it works, but most of the time, this is the flow (in sequence):

start at black desktop with high brightness,
switch to white desktop,
screen dims (as I hoped),
two or three seconds later, it gets super bright without changing screen content (seems to be error),
manually adjust brightness to desired level -- everything OK,
then switch to black desktop, screen brightens (as I hoped),
but then two or three seconds later it dims without changing screen content (seems to be error)

Any idea what could be the problem?


Hardware Overview:

Model Name: MacBook Pro
Model Identifier: MacBookPro15,3
Processor Name: 8-Core Intel Core i9
Processor Speed: 2.4 GHz
Number of Processors: 1
Total Number of Cores: 8
L2 Cache (per Core): 256 KB
L3 Cache: 16 MB
Hyper-Threading Technology: Enabled
Memory: 32 GB

System Software Overview:

System Version: macOS 10.15.2 (19C57)
Kernel Version: Darwin 19.2.0
Boot Volume: Macintosh HD
Boot Mode: Normal
Secure Virtual Memory: Enabled
System Integrity Protection: Enabled
Time since boot: 22:07

Intel UHD Graphics 630:

Chipset Model: Intel UHD Graphics 630
Type: GPU
Bus: Built-In
VRAM (Dynamic, Max): 1536 MB
Vendor: Intel
Device ID: 0x3e9b
Revision ID: 0x0002
Automatic Graphics Switching: Supported
gMux Version: 5.0.0
Metal: Supported, feature set macOS GPUFamily2 v1
Displays:
Color LCD:
Display Type: Built-In Retina LCD
Resolution: 2880 x 1800 Retina
Framebuffer Depth: 24-Bit Color (ARGB8888)
Main Display: Yes
Mirror: Off
Online: Yes
Automatically Adjust Brightness: No
Connection Type: Internal

Radeon Pro Vega 20:

Chipset Model: Radeon Pro Vega 20
Type: GPU
Bus: PCIe
PCIe Lane Width: x16
VRAM (Total): 4 GB
Vendor: AMD (0x1002)
Device ID: 0x69af
Revision ID: 0x00c0
EFI Driver Version: 01.01.087
Automatic Graphics Switching: Supported
gMux Version: 5.0.0
Metal: Supported, feature set macOS GPUFamily2 v1

@anishathalye
Copy link
Owner

Thank you for the detailed report including system configuration.

Hmm, that is not the intended behavior...

The first couple things I would have you check are (1) are you using multiple monitors, and (2) did you forget to disable "automatically adjust brightness". But that all looks good.

Could you try the same procedure again, but add a couple seconds of delay every time you change your brightness manually? Basically, the check for brightness levels and screen contents don't happen continuously, there's some polling (every 0.5 seconds), so if you switch too fast after changing your brightness manually, it'll get confused.

Also, I have not tested on macOS 10.15, so I don't know if there's any incompatibility or issues related to that. I'm still currently on 10.14, personally. This seems unlikely, though.

@anishathalye
Copy link
Owner

Oh, the other issue could be: I only see one manual adjustment in your test procedure. Lumen learns from these manual adjustments, but if there's only one adjustment, it'll have only a single data point, so it won't do anything very useful. You need two manual adjustments before the learning starts being useful.

@farkmarnum
Copy link

@tklebanoff are you using f.lux or some other service that adjusts your display? I had the same exact issue but was able to resolve it by disabling f.lux. When running f.lux, I experienced the "brightness reverting" issue when using lumen, brightness-cli, brightness, etc., so it wasn't unique to lumen for me.

For reference, I'm running 10.15.7 on MacBookPro16,1 with AMD Radeon Pro 5300M.

@tklebanoff
Copy link
Author

Hi all, thank you for the replies -- sorry for the delay, sometimes I post detailed issues, put in place a temporary workaround, and then forget :) I suppose it is still helpful because other people encountering the same may learn of a pathway towards a fix.

@farkmarnum yes! I am using f.lux
I would like to keep using f.lux. I basically use it all day every day, and much prefer it to the regular screen behavior.

Do we know of any ways to achieve f.lux functionality properly alongside lumen functionality?

@farkmarnum
Copy link

farkmarnum commented Nov 19, 2020

@tklebanoff for the moment I've switched to using the Mac OS built-in Night Mode setting and manually adjusting, but I would prefer not to do that.

Lumen uses the IODisplayGetFloatParameter method from IOGraphicsLib to set the brightness.

f.lux is not open source, but I'd guess it's not using this API, since the system brightness level (the level I can see in System Preferences or the Touch Bar) never changes when I turn f.lux on or off. When I use tools that use IODisplayGetFloatParameter, the system brightness level changes.

This article says "Apple has deprecated IOKit’s brightness functionality in favor of a private, undocumented API," and delves a bit into reverse engineering it. So perhaps f.lux is using some form of that "API". The author of that article wrote a tool to access the inner API. It's in Python, but could perhaps provide some insight.

Edit: Here's another repo using the undocumented CoreDisplay API, and it explains that "after the introduction of Night Shift in 10.12.4 something changed and the [IOKit] brightness changes don't stick anymore." It's a little more helpful as it's written in Swift. Hopefully I'll have some time in the next week to dig more and see if I can implement the CoreDisplay API in lumen to fix this issue with f.lux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants