Public bug reported:

I went from Kubuntu to Ubuntu and had this weird issues with laggy
brightness control when using prime-select intel. Brightness control
works flawless in the brightness slider in the power menu.

In summary the raw input comes from:
/dev/input/event4: AT Translated Set 2 keyboard
but the actual keypress ends up getting routed through the suspended nvidia 
card, /dev/input/event15.
The workaround was to listen on the actual keyboard and grab the raw keypresses 
0x3d and 0x3e. A small python script then calls brightnessctrl to adjust 
brightness.

I had help from googles AI to troubleshoot and fix.
AI summary:

### Summary
On Ubuntu 26.04 (GNOME 50, Linux 7.0) on a hybrid Intel + NVIDIA HP ZBook Fury 
16 G10 Mobile Workstation PC configured with `prime-select intel` (NVIDIA dGPU 
in runtime `suspended` / `D3cold` state), pressing the hardware screen 
brightness keys results in a ~1 second delay before brightness updates, and 
subsequent keypresses queue up.

On Kubuntu 26.04 (KDE Plasma, same kernel and `prime-select intel`
configuration) on the exact same hardware, brightness adjustment works
without this delay.

### Hardware & Environment
* **OS:** Ubuntu 26.04 (GNOME 50 / Wayland)
* **Vendor/Model:** HP Laptop (Intel iGPU + NVIDIA dGPU, `prime-select intel`, 
dGPU in `D3cold` runtime `suspended` state)
* **Backlight device:** `intel_backlight` 
(`/sys/class/backlight/intel_backlight`)

### Diagnostic Findings
1. **Direct sysfs/backlight performance is instantaneous:**
   Running `brightnessctl -d intel_backlight set 20%-` from a terminal 
completes in `0.004s` (`real 0m0.004s`) with immediate visual update, even 
after 10+ seconds of display idle (ruling out Intel PSR or `intel_backlight` 
driver latency).

2. **Input device behavior (`evtest` / `libinput debug-events`):**
   * `AT Translated Set 2 keyboard` (`/dev/input/event4`) immediately emits raw 
`EV_MSC` `MSC_SCAN` values `0x3d` (Brightness Down) and `0x3e` (Brightness Up) 
on keypress, with no translated `EV_KEY` event and no key-release event 
(`libinput` logs `*** (-1) pressed`).
   * The translated `KEY_BRIGHTNESSDOWN` (224) and `KEY_BRIGHTNESSUP` (225) 
events are instead emitted by the secondary ACPI `Video Bus` device 
(`/dev/input/event15`, 
`DEVPATH=/devices/pci0000:00/acpi.video_bus.1/input/input19/event15`) after a 
noticeable delay.

3. **GNOME vs. KDE behavior:**
   * When GNOME (`gnome-shell` / Mutter `MetaBacklight`) receives 
`KEY_BRIGHTNESSUP`/`DOWN` via `acpi.video_bus.1`, handling the brightness 
change stalls for ~1 second (likely due to Mutter probing DRM/ACPI backlight 
nodes associated with the suspended NVIDIA `Video Bus`, compounded by the 
delayed ACPI EC notify path).
   * In KDE Plasma (`PowerDevil`), brightness updates directly via 
`intel_backlight` without stalling.

### Workaround Confirmed
1. Ignoring `acpi.video_bus.1` via udev (`ENV{ID_INPUT}="0", 
ENV{ID_INPUT_KEY}="0"`).
2. Reading `MSC_SCAN` `0x3d` / `0x3e` directly from `AT Translated Set 2 
keyboard` (`*-serio-0-event-kbd`) via `evdev` and calling `brightnessctl -d 
intel_backlight`.
This reduces response time to <5ms consistently.

### Expected Behavior
GNOME Shell / Mutter should handle `KEY_BRIGHTNESSUP` and `KEY_BRIGHTNESSDOWN` 
immediately via the active `intel_backlight` device without stalling on the 
secondary `acpi.video_bus.1` / suspended discrete GPU path.

** Affects: gnome-shell (Ubuntu)
     Importance: Undecided
         Status: New

** Description changed:

- I went from Kubuntu to Ubuntu and had this weird issues with laggy brightness 
control when using prime-select intel.
-  
+ I went from Kubuntu to Ubuntu and had this weird issues with laggy
+ brightness control when using prime-select intel. Brightness control
+ works flawless in the brightness slider in the power menu.
+ 
  In summary the raw input comes from:
  /dev/input/event4: AT Translated Set 2 keyboard
  but the actual keypress ends up getting routed through the suspended nvidia 
card, /dev/input/event15.
  The workaround was to listen on the actual keyboard and grab the raw 
keypresses 0x3d and 0x3e. A small python script then calls brightnessctrl to 
adjust brightness.
- 
  
  I had help from googles AI to troubleshoot and fix.
  AI summary:
  
  ### Summary
  On Ubuntu 26.04 (GNOME 50, Linux 7.0) on a hybrid Intel + NVIDIA HP ZBook 
Fury 16 G10 Mobile Workstation PC configured with `prime-select intel` (NVIDIA 
dGPU in runtime `suspended` / `D3cold` state), pressing the hardware screen 
brightness keys results in a ~1 second delay before brightness updates, and 
subsequent keypresses queue up.
  
  On Kubuntu 26.04 (KDE Plasma, same kernel and `prime-select intel`
  configuration) on the exact same hardware, brightness adjustment works
  without this delay.
  
  ### Hardware & Environment
  * **OS:** Ubuntu 26.04 (GNOME 50 / Wayland)
  * **Vendor/Model:** HP Laptop (Intel iGPU + NVIDIA dGPU, `prime-select 
intel`, dGPU in `D3cold` runtime `suspended` state)
  * **Backlight device:** `intel_backlight` 
(`/sys/class/backlight/intel_backlight`)
  
  ### Diagnostic Findings
  1. **Direct sysfs/backlight performance is instantaneous:**
-    Running `brightnessctl -d intel_backlight set 20%-` from a terminal 
completes in `0.004s` (`real 0m0.004s`) with immediate visual update, even 
after 10+ seconds of display idle (ruling out Intel PSR or `intel_backlight` 
driver latency).
+    Running `brightnessctl -d intel_backlight set 20%-` from a terminal 
completes in `0.004s` (`real 0m0.004s`) with immediate visual update, even 
after 10+ seconds of display idle (ruling out Intel PSR or `intel_backlight` 
driver latency).
  
  2. **Input device behavior (`evtest` / `libinput debug-events`):**
-    * `AT Translated Set 2 keyboard` (`/dev/input/event4`) immediately emits 
raw `EV_MSC` `MSC_SCAN` values `0x3d` (Brightness Down) and `0x3e` (Brightness 
Up) on keypress, with no translated `EV_KEY` event and no key-release event 
(`libinput` logs `*** (-1) pressed`).
-    * The translated `KEY_BRIGHTNESSDOWN` (224) and `KEY_BRIGHTNESSUP` (225) 
events are instead emitted by the secondary ACPI `Video Bus` device 
(`/dev/input/event15`, 
`DEVPATH=/devices/pci0000:00/acpi.video_bus.1/input/input19/event15`) after a 
noticeable delay.
+    * `AT Translated Set 2 keyboard` (`/dev/input/event4`) immediately emits 
raw `EV_MSC` `MSC_SCAN` values `0x3d` (Brightness Down) and `0x3e` (Brightness 
Up) on keypress, with no translated `EV_KEY` event and no key-release event 
(`libinput` logs `*** (-1) pressed`).
+    * The translated `KEY_BRIGHTNESSDOWN` (224) and `KEY_BRIGHTNESSUP` (225) 
events are instead emitted by the secondary ACPI `Video Bus` device 
(`/dev/input/event15`, 
`DEVPATH=/devices/pci0000:00/acpi.video_bus.1/input/input19/event15`) after a 
noticeable delay.
  
  3. **GNOME vs. KDE behavior:**
-    * When GNOME (`gnome-shell` / Mutter `MetaBacklight`) receives 
`KEY_BRIGHTNESSUP`/`DOWN` via `acpi.video_bus.1`, handling the brightness 
change stalls for ~1 second (likely due to Mutter probing DRM/ACPI backlight 
nodes associated with the suspended NVIDIA `Video Bus`, compounded by the 
delayed ACPI EC notify path).
-    * In KDE Plasma (`PowerDevil`), brightness updates directly via 
`intel_backlight` without stalling.
+    * When GNOME (`gnome-shell` / Mutter `MetaBacklight`) receives 
`KEY_BRIGHTNESSUP`/`DOWN` via `acpi.video_bus.1`, handling the brightness 
change stalls for ~1 second (likely due to Mutter probing DRM/ACPI backlight 
nodes associated with the suspended NVIDIA `Video Bus`, compounded by the 
delayed ACPI EC notify path).
+    * In KDE Plasma (`PowerDevil`), brightness updates directly via 
`intel_backlight` without stalling.
  
  ### Workaround Confirmed
  1. Ignoring `acpi.video_bus.1` via udev (`ENV{ID_INPUT}="0", 
ENV{ID_INPUT_KEY}="0"`).
  2. Reading `MSC_SCAN` `0x3d` / `0x3e` directly from `AT Translated Set 2 
keyboard` (`*-serio-0-event-kbd`) via `evdev` and calling `brightnessctl -d 
intel_backlight`.
  This reduces response time to <5ms consistently.
  
  ### Expected Behavior
  GNOME Shell / Mutter should handle `KEY_BRIGHTNESSUP` and 
`KEY_BRIGHTNESSDOWN` immediately via the active `intel_backlight` device 
without stalling on the secondary `acpi.video_bus.1` / suspended discrete GPU 
path.

-- 
You received this bug notification because you are a member of Ubuntu
Desktop Bugs, which is subscribed to gnome-shell in Ubuntu.
https://bugs.launchpad.net/bugs/2174739

Title:
  [26.04] ~1s input/backlight delay on brightness keys on hybrid
  Intel+NVIDIA HP laptop (acpi.video_bus.1 / MetaBacklight)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/2174739/+subscriptions


-- 
desktop-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/desktop-bugs

Reply via email to