intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v8 00/14] Add support for a DRM backlight capability
@ 2026-09-08  4:40 Mario Limonciello
  2026-09-08  4:40 ` [PATCH v8 01/14] Revert "backlight: Remove notifier" Mario Limonciello
                   ` (15 more replies)
  0 siblings, 16 replies; 31+ messages in thread
From: Mario Limonciello @ 2026-09-08  4:40 UTC (permalink / raw)
  To: dri-devel, harry.wentland, Simona Vetter, Alex Deucher,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie
  Cc: Xaver Hugl, amd-gfx,
	open list:INTEL DRM DISPLAY FOR XE AND I915 DRIVERS,
	open list:INTEL DRM DISPLAY FOR XE AND I915 DRIVERS,
	Hans de Goede, Mario Limonciello

At Display Next Hackfest 2026 we reviewed progress moving brightness
control into the DRM connector properties.

There is a range LUMINANCE property that will default to 0->0.
Once a driver attaches a backlight it will be updated to 1->max.
If the panel supports the minimum backlight turning off the display
the range can later be updated to 0->max instead of 1->max.

The legacy sysfs interface is synchronized with the DRM connector.
When a compositor using this feature is loaded, sysfs writes are disabled
to prevent legacy tools from going out of sync with the compositor.

This has an implementation initially for amdgpu, i915, and Xe with eDP
connectors.  It can be extended to other connectors like DP for displays
that can be controlled via DDC as well later.

The following compositors have implemented matching support:
 * Kwin: https://invent.kde.org/plasma/kwin/-/merge_requests/9298
 * Mutter: https://gitlab.gnome.org/swick/mutter/-/commits/wip/kms-luminance-prop
 * Wlroots: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/5384

v7->v8:
  - Rebase on v7.3-rc2
  - backlight: add kernel-internal backlight API: 
    - Inhibit legacy "bl_power" sysfs writes during a DRM takeover, not 
      just "brightness", so the takeover is fully exclusive. 
    - backlight_set_brightness() now returns -ENXIO (and skips the uevent) 
      instead of reporting a false success when the device has no ops. 
    - Release ops_lock before emitting the change uevent. 
  - drm: add connector backlight (LUMINANCE) infrastructure: 
    - Take a reference in drm_backlight_get_device() and drop it in the 
      sysfs-link callers to close a use-after-free. 
    - Unlink any still-linked backend in drm_backlight_connector_cleanup() 
      instead of only WARN()ing, so a connector torn down on a probe-error 
      path no longer leaks a global-list entry / pending work item (also 
      removes an unconditional lockdep assertion). 
    - Guard the backend pointer against a concurrent re-link while 
      unlinking. 
    - Drop the redundant luminance restore in the bridge-enable path that 
      dereferenced the live connector state; the commit tail already 
      applies it from the new state. 
  - drm: add DRM_CLIENT_CAP_LUMINANCE: 
    - Serialize the capability change so concurrent ioctls on a shared fd 
      cannot unbalance the inhibit count. 
    - Track the legacy-inhibit device-wide so connectors hotplugged (e.g. 
      DP MST) while the capability is active inherit it, and no longer 
      trigger warnings when the client exits. 
  - drm/amd/display: Pass up errors reading actual brightness: 
    - Also return -EINVAL from the legacy PWM read error path (previously 
      returned the cached value), matching the KUnit test. 
  - drm/amd/display: use drm backlight: 
    - Apply the LUMINANCE property on modeset commits too, and avoid a NULL 
      CRTC-state dereference on brightness-only commits. 
  - drm/xe: Indicate support for luminance on the connector: 
    - Drop an unrelated DRIVER_GEM_GPUVA change squashed in by mistake. 
  - drm/i915/display: use drm backlight: 
    - Remove an unused <drm/drm_backlight.h> include from intel_dp.c. 

Mario Limonciello (12):
  Revert "backlight: Remove notifier"
  backlight: add kernel-internal backlight API
  drm/property: add a per-connector luminance flag
  drm: add connector backlight (LUMINANCE) infrastructure
  drm: add DRM_CLIENT_CAP_LUMINANCE
  drm/amd/display: Pass up errors reading actual brightness
  drm/amd: Indicate driver supports luminance
  drm/amd/display: use drm backlight
  drm/bridge: auto-link panel backlight in bridge connector
  drm/xe: Indicate support for luminance on the connector
  drm/i915: Indicate support for luminance on the connector
  drm/i915/display: use drm backlight

Mario Limonciello (AMD) (2):
  drm/amdgpu: Check bios_scratch_reg_offset in backlight level helper
  drm/amd/display: Update KUnit backlight tests for luminance property
    and fixtures

 drivers/gpu/drm/Kconfig                       |  18 +
 drivers/gpu/drm/Makefile                      |   2 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c  |   7 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c       |   1 +
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  15 +-
 .../display/amdgpu_dm/amdgpu_dm_backlight.c   |  36 +-
 .../display/amdgpu_dm/amdgpu_dm_backlight.h   |   2 +-
 .../display/amdgpu_dm/amdgpu_dm_connector.c   |   2 +
 .../tests/amdgpu_dm_backlight_test.c          |  18 +-
 .../amdgpu_dm/tests/amdgpu_dm_kunit_helpers.c |   8 +-
 drivers/gpu/drm/bridge/panel.c                |  15 +
 .../gpu/drm/display/drm_bridge_connector.c    |  11 +-
 drivers/gpu/drm/drm_atomic_helper.c           |  35 ++
 drivers/gpu/drm/drm_atomic_uapi.c             |  49 +-
 drivers/gpu/drm/drm_backlight.c               | 550 ++++++++++++++++++
 drivers/gpu/drm/drm_connector.c               |  56 ++
 drivers/gpu/drm/drm_drv.c                     |   8 +
 drivers/gpu/drm/drm_file.c                    |   5 +
 drivers/gpu/drm/drm_ioctl.c                   |  24 +
 drivers/gpu/drm/drm_mode_config.c             |   1 +
 drivers/gpu/drm/drm_property.c                |   6 +
 drivers/gpu/drm/drm_sysfs.c                   |  32 +-
 .../gpu/drm/i915/display/intel_backlight.c    |   6 +
 drivers/gpu/drm/i915/display/intel_display.c  |   7 +-
 drivers/gpu/drm/i915/i915_driver.c            |   1 +
 drivers/gpu/drm/xe/xe_device.c                |   1 +
 drivers/video/backlight/backlight.c           | 108 ++++
 include/drm/drm_atomic_helper.h               |   2 +
 include/drm/drm_backlight.h                   | 166 ++++++
 include/drm/drm_bridge.h                      |   1 +
 include/drm/drm_connector.h                   |  20 +
 include/drm/drm_drv.h                         |   7 +
 include/drm/drm_file.h                        |   8 +
 include/drm/drm_mode_config.h                 |  11 +
 include/drm/drm_property.h                    |  10 +
 include/linux/backlight.h                     |  67 +++
 include/uapi/drm/drm.h                        |  22 +
 37 files changed, 1313 insertions(+), 25 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_backlight.c
 create mode 100644 include/drm/drm_backlight.h

-- 
2.43.0


^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2026-09-08 18:45 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-08  4:40 [PATCH v8 00/14] Add support for a DRM backlight capability Mario Limonciello
2026-09-08  4:40 ` [PATCH v8 01/14] Revert "backlight: Remove notifier" Mario Limonciello
2026-09-08  4:51   ` sashiko-bot
2026-09-08  4:40 ` [PATCH v8 02/14] backlight: add kernel-internal backlight API Mario Limonciello
2026-09-08  4:52   ` sashiko-bot
2026-09-08 15:45   ` Jani Nikula
2026-09-08 16:00     ` Mario Limonciello
2026-09-08 16:33       ` Jani Nikula
2026-09-08  4:40 ` [PATCH v8 03/14] drm/property: add a per-connector luminance flag Mario Limonciello
2026-09-08  4:54   ` sashiko-bot
2026-09-08  4:40 ` [PATCH v8 04/14] drm: add connector backlight (LUMINANCE) infrastructure Mario Limonciello
2026-09-08  4:54   ` sashiko-bot
2026-09-08 15:48   ` Jani Nikula
2026-09-08  4:40 ` [PATCH v8 05/14] drm: add DRM_CLIENT_CAP_LUMINANCE Mario Limonciello
2026-09-08  4:55   ` sashiko-bot
2026-09-08  4:40 ` [PATCH v8 06/14] drm/amd/display: Pass up errors reading actual brightness Mario Limonciello
2026-09-08  4:40 ` [PATCH v8 07/14] drm/amd: Indicate driver supports luminance Mario Limonciello
2026-09-08  4:40 ` [PATCH v8 08/14] drm/amd/display: use drm backlight Mario Limonciello
2026-09-08  4:57   ` sashiko-bot
2026-09-08  4:40 ` [PATCH v8 09/14] drm/amdgpu: Check bios_scratch_reg_offset in backlight level helper Mario Limonciello
2026-09-08  4:51   ` sashiko-bot
2026-09-08  4:40 ` [PATCH v8 10/14] drm/amd/display: Update KUnit backlight tests for luminance property and fixtures Mario Limonciello
2026-09-08  4:54   ` sashiko-bot
2026-09-08  4:40 ` [PATCH v8 11/14] drm/bridge: auto-link panel backlight in bridge connector Mario Limonciello
2026-09-08  4:40 ` [PATCH v8 12/14] drm/xe: Indicate support for luminance on the connector Mario Limonciello
2026-09-08  4:57   ` sashiko-bot
2026-09-08  4:40 ` [PATCH v8 13/14] drm/i915: " Mario Limonciello
2026-09-08  4:40 ` [PATCH v8 14/14] drm/i915/display: use drm backlight Mario Limonciello
2026-09-08  5:03   ` sashiko-bot
2026-09-08  9:32 ` ✓ i915.CI.BAT: success for Add support for a DRM backlight capability (rev3) Patchwork
2026-09-08 18:45 ` ✗ i915.CI.Full: failure " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).