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

Apple Silicon (M1 GPU) support #210

Closed
lukerooneyio opened this issue Nov 22, 2020 · 269 comments
Closed

Apple Silicon (M1 GPU) support #210

lukerooneyio opened this issue Nov 22, 2020 · 269 comments
Assignees

Comments

@lukerooneyio
Copy link

Hi, If you plan on beta testing it for Apple Silicon, I'd be happy to test and give feedback :)

Issue details

  • Mac device where Lunar is installed (Macbook Pro 2019, iMac, Mac Mini, Hackintosh etc.):
    Mac Mini M1

  • Monitor model (LG UltraFine 5K, DELL P2715Q etc.):
    BenQ 4K 27"

  • Monitor connection to the Mac device (HDMI-to-USB-C, USB-C-to-USB-C, miniDisplayPort-to-DisplayPort etc.):
    HDMI

  • Using an USB Docking Station or Hub:
    No

  • Lunar mode used (check it in the top-right corner of the Lunar interface)
    Manual

  • (only if you know how to compile a C program) Does this utility work for you? https://github.com/kfix/ddcctl
    optional response

Issue description:

Lunar loads fine, and I have no issues with using the interface, but adjusting the brightness/contrast has no effect on my monitor.

@alin23
Copy link
Owner

alin23 commented Nov 22, 2020

Hi @lukerooneyio !

I think the issue is not related to Apple Silicon as I have had reports of users using Lunar on M1 Macbooks without problems. It's probably happening because of the HDMI connection inside the Mac Mini. Try compiling ddcctl for M1 and see if that works. I'm pretty sure that won't work either because the DDC implementation is not something CPU specific.

@arjunkomath
Copy link

I'm facing the same issue with Mac mini and Dell AW3420DW

  • Mac device where Lunar is installed (Macbook Pro 2019, iMac, Mac Mini, Hackintosh etc.):
    Mac Mini M1

  • Monitor model (LG UltraFine 5K, DELL P2715Q etc.):
    Dell AW3420DW

  • Monitor connection to the Mac device (HDMI-to-USB-C, USB-C-to-USB-C, miniDisplayPort-to-DisplayPort etc.):
    USB-C-to-DisplayPort

  • Lunar mode used (check it in the top-right corner of the Lunar interface)
    Manual

Issue description:

exactly same as above

@alin23
Copy link
Owner

alin23 commented Nov 22, 2020

I'll be getting an M1 Macbook Pro next month so I'll be able to do more tests then. Thank you for the reports!

@thecork3004
Copy link

Hi Alin, just another user here to say also not working on the Mac mini M1. Sure you didn't need to know but just wanted to say its not isolated. Using it with LG 49wl95c-w

@LQkkeN
Copy link

LQkkeN commented Nov 28, 2020

Not working between M1 Mac Mini and Acer XV273K either.

@mrmachine
Copy link

Same as OP on MBP 13" M1. Lunar interface runs and looks like it should be working, but does not control my monitor which is connected directly via USB-C. Lunar previously worked with this monitor on a 16" MBP.

@alin23
Copy link
Owner

alin23 commented Dec 20, 2020

I've tried to fix this but for now it looks like macOS doesn't expose the I2C interface for the M1 GPU framebuffers.

All we can do is wait for a macOS update that will add this functionality back, although it's unlikely it's going to happen soon since it was never a publicly known feature.

@mrmachine
Copy link

So the earlier comment about reports that lunar works on M1 was a mistake? Lunar blanket does not work on any M1 device?

@alin23
Copy link
Owner

alin23 commented Dec 20, 2020

I misread a user's feedback which actually stated that for him Lunar worked on MBP 16" but not on the M1 MBP. Sorry for the confusion.

@rgaufman
Copy link

Any workarounds for M1 users? - maybe another utility temporarily? - I miss being able to control volume and brightness :)

@henrik
Copy link

henrik commented Dec 29, 2020

The only thing I’ve found so far that works on M1 for volume (it does not attempt to handle brightness) is SoundSource (paid with trial): https://rogueamoeba.com/soundsource/

UPDATE 2021-01-03:

Works in the sense of affecting the volume with HDMI/ARC speakers but doesn’t actually set the volume on the TV but fakes it somehow. It’s been a little buggy for me.

What I’ve done instead now is write a little script to change the volume on my Sony Bravia TV via API, and triggering that from the volume keys. (Configured them to be function keys instead, then mapped them to scripts via Alfred.)

@alin23
Copy link
Owner

alin23 commented Dec 30, 2020

You can follow the progress (or rather lack of it) in this ddcctl issue: kfix/ddcctl#86

I've tried tirelessly to send DDC messages from my M1 Macbook Pro but the hard truth is that for now macOS doesn't provide a way to do this. For some reason the GPU driver doesn't send the DDC messages to the monitor.

All we can do is hope that this is temporary and an update will re-add the I2C functionality to the GPU driver.

@bear-boss
Copy link

same problem on M1 air. Yet I found that QuickShade in App Store can work normally. @alin23

@lukerooneyio
Copy link
Author

lukerooneyio commented Jan 3, 2021 via email

@alin23
Copy link
Owner

alin23 commented Jan 3, 2021

same problem on M1 air. Yet I found that QuickShade in App Store can work normally. @alin23

Lunar changes the same brightness that you can change by using the physical controls on your monitor (buttons, touchpads etc).

QuickShade adds a software black overlay over the whole screen which, like @lukerooneyio mentioned, renders colors incorrectly, decreases contrast linearly instead of exponentially, and keeps the monitor LED backlight at the same strength which consumes more power and can heat up the monitor panel depending on how much time the monitor is kept on.

Of course, all this can be harder to notice for some users, so if you're happy with QuickShade, stick with that for now.

Lunar is dependent on having access to low level GPU controls which M1 doesn't provide yet. QuickShade is simply renderring a non-opaque black full screen window which is why it can work no matter the GPU used.

@radioactive76
Copy link

Looking forward to seeing if you get access to the controls on the M1. For now, QuickShade is not a bad alternative. Any suggestions for users to file a radar with Apple for this feature?

@rgaufman
Copy link

I purchased a thunderbolt 2 display from a decade ago, that works nicely and has brightness control on the M1 - does need a thunderbolt 2 to usb-c adapter though 😂

@alin23
Copy link
Owner

alin23 commented Jan 23, 2021

I purchased a thunderbolt 2 display from a decade ago, that works nicely and has brightness control on the M1 - does need a thunderbolt 2 to usb-c adapter though 😂

Yes, Apple vendored displays might still work as there is an alternative method implemented in Lunar that doesn't use DDC.

Looking forward to seeing if you get access to the controls on the M1. For now, QuickShade is not a bad alternative. Any suggestions for users to file a radar with Apple for this feature?

This is not a bug, it's simply the fact that M1 shares a big part of its architecture with the iPad A14 chip and Apple developers borrowed part of the GPU driver code from the iPad kernel which doesn't expose an I2C controller (which Lunar needs for DDC requests) and probably never will.

I tried some workarounds like a Raspberry Pi connected to a secondary HDMI input of the monitor that could send the DDC messages, or an Arduino type of board that could send raw DDC requests through the I2C pins of the HDMI connector. None of them worked unfortunately, most monitors only accept DDC requests from the currently selected input.

I guess we'll just have to wait for now.

@fmckeogh
Copy link

@alin23 Would you need an FPGA to inject DDC requests into an active HDMI signal or is it just not possible at all?

@alin23
Copy link
Owner

alin23 commented Jan 25, 2021

@alin23 Would you need an FPGA to inject DDC requests into an active HDMI signal or is it just not possible at all?

I didn't consider injecting DDC into an active HDMI signal as that would mean some cable cutting and modifying and this isn't really something that everyday users could do.

Maybe some HDMI splitter cable could work but not everyone uses HDMI. I use USB-C for example, other people use DisplayPort or HDMI-To-USB-C. It would be a nightmare to create a hardware solution for all these cables.

All I wanted to do is have an affordable board like a Pi, send DDC on a not used HDMI input, because I noticed that my Intel Macbook Pro 15" can very well control my monitor with Lunar through HDMI, even though the selected monitor input is USB-C where my M1 Macbook Pro is connected.

It doesn't always work, but it's bearable for now. The Pi though, it keeps saying there's no monitor connected until I switch the input to the Pi HDMI and then ddcutil functions without any problems.

@alin23
Copy link
Owner

alin23 commented Jul 8, 2021

@yonibloch @Rupeeee I'm taking a look at the logs. Until then, can you please try this beta? https://static.lunar.fyi/Lunar-4.5.2-beta1.zip

I re-added partial matching as a fallback if all other methods fail.

@yonibloch
Copy link

image
4.5.2 beta1 still behaves the same...

@alin23
Copy link
Owner

alin23 commented Jul 8, 2021

@yonibloch looks like you missed one file 😅

/Applications/Lunar.app/Contents/MacOS/Lunar @ displays --edid --system-info > ~/Desktop/Lunar-sysinfo.txt

@alin23
Copy link
Owner

alin23 commented Jul 8, 2021

Something's odd here..

Let me see if I got this:

  • You have an M1 Mac Mini
    • with only 1 Dell monitor
      • connected through an HDMI-to-USB-C cable/adapter
        • to the USB-C port of the Mac Mini?

The problem seems to be that Lunar thinks that the monitor is connected to the HDMI port and is disabling DDC for the monitor. If the above is correct then the HDMI port detection is flawed

@yonibloch
Copy link

Lunar-sysinfo.txt
here's the missing file!

Yes-- nothing's connected to the HDMI port on the Mac Mini.
The only "weird thing" that I can think of is that there's another USB-C cable connected from the Mac Mini to the monitor because the monitor support KVM (a USB hub that switches based on input).
I can see that Lunar sees that other display but it obviously isn't transferring any DDC, and it also sees it in beta4 and it doesn't create this issue:
image

@alin23
Copy link
Owner

alin23 commented Jul 8, 2021

@yonibloch @Rupeeee

Here's a beta build with improved HDMI port detection: https://static.lunar.fyi/Lunar-4.5.2-beta2.zip

Let me know if it works ^_^

About the other monitor you see, it's not exactly what you think: https://lunar.fyi/faq#ghost-monitors

@yonibloch
Copy link

It works! ☺️

@alin23
Copy link
Owner

alin23 commented Jul 8, 2021

Woo! I'll release 4.5.3 then as there are a bunch more fixes around gamma as well.

@Rupeeee
Copy link

Rupeeee commented Jul 8, 2021

Works like a charm! (I updated through the official release not the beta)

@fancymans
Copy link

fancymans commented Jul 8, 2021

If you have one monitor connected to HDMI and one to USB-C then the USB-C one should still work if it accepts DDC.

Can you please send:

  1. Diagnostics (Click on Open Lunar Diagnostics in the Lunar menu, press keyboard keys when prompted by the text, and after finishing the process click on the Send Diagnostics button.)
  2. Logs (the file at ~/Library/Caches/Lunar/swiftybeaver.log)
  3. Ioreg small dump: ioreg -r -l -c AppleT810xIO > ~/Desktop/AppleT810xIO.ioreg.txt then send the file that got created on your desktop

Sent diagnostics via the in-app tool. I noticed the brightness changed on the monitor connected with USB-C as expected, but adjusting brightness at all within Lunar (manually setting, media keys, or hot keys) don't work.

Here are the other logs requested as well:

swiftybeaver.log

AppleT810xIO.ioreg.txt

Also I noticed the monitor that had brightness changed during the diagnostic test, shows as "No controls available" in Lunar even though Native and Hardware DDC controls are enabled in the menu.
Screenshot 2021-07-08 at 12 26 34

@alin23
Copy link
Owner

alin23 commented Jul 8, 2021

@fancymans please update to 4.5.3. This has been fixed already 😊

@fancymans
Copy link

@alin23 Unfortunately even on 4.5.3 (and even after restarting Mac mini) there is no change in behavior.

Diagnostics still successfully changes brightness of monitor, but controls within Lunar do not.

Resent diag results, here are new logs after updating to 4.5.3
swiftybeaver.log
AppleT810xIO.ioreg.txt

@alin23
Copy link
Owner

alin23 commented Jul 8, 2021

Oh weird.. it seems I missed something in the detection logic. I'll take a look tomorrow. Thank you for all the details, it's very helpful!

@alin23
Copy link
Owner

alin23 commented Jul 9, 2021

@fancymans @yonibloch @Rupeeee @waydabber

Can you help with testing an updated detection logic for M1?

Here's the build: https://static.lunar.fyi/Lunar-4.5.4-beta1.zip

You have very different IORegistry trees and I'd like to make sure that this detection works for all of you.

@waydabber
Copy link

waydabber commented Jul 9, 2021

@alin23

Works perfectly on

  • M1 MBA + LG UHD over USB-C
  • M1 Mini + L24 over USB-C/DP and Dummy over HDMI (DP is controllable, HDMI is set to no hardware controls - both as expected)

Cheers! :)

@porcherie
Copy link

@alin23
I am using Lunar 4.5.3 On M1 MacBook Pro connected directly with usb-c to LG ‎27UL850-W and as long as the app is open the screen is not turning off.
When I quit the app, screen is behaving as expected

@Rupeeee
Copy link

Rupeeee commented Jul 9, 2021

Works perfectly @alin23

AppleT810xIO.ioreg.txt

I'm afraid I couldn't find the cached info from the diagnostics (at the directory you specified, or anywhere else on my computer), but I have sent the diagnostics in app (which worked well to change the screen brightness)

cheers!

@alin23
Copy link
Owner

alin23 commented Jul 9, 2021

@porcherie let's get on Lunar's Discord for this discussion. It's not exactly related to this issue.

@alin23
Copy link
Owner

alin23 commented Jul 9, 2021

Works perfectly @alin23

AppleT810xIO.ioreg.txt

I'm afraid I couldn't find the cached info from the diagnostics (at the directory you specified, or anywhere else on my computer), but I have sent the diagnostics in app (which worked well to change the screen brightness)

cheers!

Great! I'll also be waiting for @fancymans and @yonibloch responses before releasing the upgrade.

@Rupeeee
Copy link

Rupeeee commented Jul 9, 2021

I think also some confusion might be due to the fact that when you're on the proper app page there's only one display shown (at least for me, which is good because I only have one display plugged in), but when you hover over the icon in the menu bar at the top, 2 displays appear. You can remove the first one, but it comes back.

See the screenshot for clarity (I am also having a problem with horribly washed out colours which only started intermittently yesterday when I switched from the HDMI-HDMI cable to the USB-C-HDMI cable I'm using now to get the hardware controls to work. Any fix suggestions welcome!)
Screenshot 2021-07-09 at 11 17 11

@alin23
Copy link
Owner

alin23 commented Jul 9, 2021

About the other not connected monitor, it is a system problem. Read here for more details: https://lunar.fyi/faq#ghost-monitors

The washed out colours is another system problem, a lot of M1 users have it. It's usually caused by macOS incorrectly sending an YPbPr signal instead of RGB: https://forums.macrumors.com/threads/m1-mac-external-display-fuzzy-fonts-colors-ypbpr-vs-rgb.2276345/

@Rupeeee
Copy link

Rupeeee commented Jul 9, 2021

Brilliant thank you I'll have a look into both of those!

@fancymans
Copy link

Here's the build: https://static.lunar.fyi/Lunar-4.5.4-beta1.zip

It's working over USB-C Thunderbolt now! :) Here's logs again just in case it's needed. Using DDC on main monitor, and gamma for HDMI monitor works out well.

swiftybeaver.log
AppleT810xIO.ioreg.txt

@alin23
Copy link
Owner

alin23 commented Jul 9, 2021

Great to hear that! I'll release the update then.

@trK54Ylmz
Copy link

I use Mac Mini 2020 M1 with ASUS VS229 and DELL U2414H which both supports DDC. When I connect one of them Thunderbolt USB-C the hardware controls works like charm but the other one which connected via HDMI only supports Gamma.

Is this possible to support both monitors for Hardware Controls?

@alin23
Copy link
Owner

alin23 commented Jul 14, 2021

@trK54Ylmz
No, the Mac Mini HDMI port doesn't forward DDC requests to the monitor. Nobody knows why yet, it simply doesn't work.

There's a whole issue about that here: #125

@adyz
Copy link

adyz commented Dec 15, 2021

I use a USB Audio DAC connected to my monitor. The monitor is connected via usb c to a Macbook Air M1 and the volume indicator is shown on the screen (and it changes the UI) but the volume does not actually change in my headphones.

Awesome stuff with this tool!

@alin23
Copy link
Owner

alin23 commented Dec 15, 2021

Hi @adyz

Lunar only changes the volume value of the monitor. If you go into the monitor OSD using its physical buttons, and the volume value corresponds to the value in the Lunar UI, then that means everything works as expected and the monitor reacts to the volume commands.

USB DACs usually have their own volume, that can't be changed by Lunar or any other app.

@adyz
Copy link

adyz commented Dec 15, 2021

@alin23 - Ah, I understand. Thank you!

@ShangLin-Wu
Copy link

ShangLin-Wu commented Nov 2, 2022

Hi @alin23 ,
May I ask where can I find the IOAVService header like IOAVServiceCreateWithService?
How did you know its input parameters? thanks.

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