dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v7 00/12] Add support for a DRM backlight capability
@ 2026-08-31 21:05 Mario Limonciello
  2026-08-31 21:05 ` [PATCH v7 01/12] Revert "backlight: Remove notifier" Mario Limonciello
                   ` (12 more replies)
  0 siblings, 13 replies; 23+ messages in thread
From: Mario Limonciello @ 2026-08-31 21:05 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

v6 -> v7:
    Core rework (feedback from Maxime Ripard):
     * Make the DRM backlight core backend-agnostic. Add a struct
       drm_backlight_funcs indirection so the backlight subsystem is just
       one backend; other backends (DDC/CI, MIPI-DCS, ...) can be added
       later without touching the core.
     * Stop dynamically allocating the DRM backlight. struct drm_backlight
       is now embedded in struct drm_connector and initialized by the
       core, so drivers no longer allocate it or handle allocation
       failure.
     * Drop the "drm/amd/display: Allow backlight registration to fail"
       patch; it is no longer needed now that nothing in the alloc path
       can fail.
     * Update the LUMINANCE property only through the atomic path. Remove
       the synchronous backlight writes from the property-set and legacy
       paths; the hardware is now touched solely from the atomic
       commit/enable path (via a workqueue, so slow backends never stall a
       commit).
     * Move the inlined luminance/DPMS logic into helpers and fix the
       comment style to match kernel conventions.

    Per-connector property (fixes a multi-panel bug):
     * Replace the single device-wide LUMINANCE property with a
       per-connector property created from the linked backend's range.
       Previously all connectors shared one property object, so linking a
       second panel corrupted the range reported for the others.
     * Never mutate the property min/max after creation (avoids racing
       GETPROPERTY). Add a kernel-internal drm_property.is_luminance flag
       to accept value 0 (DPMS off) without a device-wide pointer
       comparison.

    Kconfig (feedback from Thomas Zimmermann):
     * Drop "select BACKLIGHT_CLASS_DEVICE" from DRM. Add config
       DRM_BACKLIGHT which "depends on" BACKLIGHT_CLASS_DEVICE and
       provides no-op stubs when disabled, so DRM no longer forces the
       backlight subsystem into the kernel. Builds verified with the
       option both enabled and disabled.

    Documentation (feedback from Hans de Goede):
     * Document the LUMINANCE range table (1-N vs 0-N), that 1 is the
       minimum visible brightness, and that 0 means the display is turned
       off (with its vblank/pageflip implications).
     * Document BACKLIGHT_UPDATE_DRM.

    Misc:
     * backlight: fix a copy/paste kerneldoc on
       backlight_unregister_notifier and add a struct notifier_block
       forward declaration in backlight.h.
     * Split the old "drm: link connectors to backlight devices" patch
       into "drm/property: add a per-connector luminance flag" and "drm:
       add connector backlight (LUMINANCE) infrastructure", and rework the
       capability patch into "drm: add DRM_CLIENT_CAP_LUMINANCE".
     * Drop all Tested-by tags; the series has changed substantially and
       needs to be re-tested.

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

 drivers/gpu/drm/Kconfig                       |  18 +
 drivers/gpu/drm/Makefile                      |   2 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c       |   1 +
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |   5 +-
 .../display/amdgpu_dm/amdgpu_dm_backlight.c   |  15 +-
 .../display/amdgpu_dm/amdgpu_dm_backlight.h   |   2 +-
 .../display/amdgpu_dm/amdgpu_dm_connector.c   |   2 +
 .../tests/amdgpu_dm_backlight_test.c          |   4 +-
 drivers/gpu/drm/bridge/panel.c                |  15 +
 .../gpu/drm/display/drm_bridge_connector.c    |  11 +-
 drivers/gpu/drm/drm_atomic_helper.c           |  39 ++
 drivers/gpu/drm/drm_atomic_uapi.c             |  49 +-
 drivers/gpu/drm/drm_backlight.c               | 515 ++++++++++++++++++
 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                   |  17 +
 drivers/gpu/drm/drm_mode_config.c             |   1 +
 drivers/gpu/drm/drm_property.c                |   6 +
 drivers/gpu/drm/drm_sysfs.c                   |  26 +-
 .../gpu/drm/i915/display/intel_backlight.c    |   4 +
 drivers/gpu/drm/i915/display/intel_display.c  |   7 +-
 drivers/gpu/drm/i915/display/intel_dp.c       |   1 +
 drivers/gpu/drm/i915/i915_driver.c            |   1 +
 drivers/gpu/drm/xe/xe_device.c                |   3 +-
 drivers/video/backlight/backlight.c           |  99 ++++
 include/drm/drm_atomic_helper.h               |   2 +
 include/drm/drm_backlight.h                   | 158 ++++++
 include/drm/drm_bridge.h                      |   1 +
 include/drm/drm_connector.h                   |  20 +
 include/drm/drm_drv.h                         |  14 +
 include/drm/drm_file.h                        |   8 +
 include/drm/drm_property.h                    |  10 +
 include/linux/backlight.h                     |  63 +++
 include/uapi/drm/drm.h                        |  22 +
 35 files changed, 1195 insertions(+), 15 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] 23+ messages in thread

end of thread, other threads:[~2026-09-01  0:19 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-31 21:05 [PATCH v7 00/12] Add support for a DRM backlight capability Mario Limonciello
2026-08-31 21:05 ` [PATCH v7 01/12] Revert "backlight: Remove notifier" Mario Limonciello
2026-08-31 22:02   ` sashiko-bot
2026-08-31 21:05 ` [PATCH v7 02/12] backlight: add kernel-internal backlight API Mario Limonciello
2026-08-31 22:11   ` sashiko-bot
2026-08-31 21:05 ` [PATCH v7 03/12] drm/property: add a per-connector luminance flag Mario Limonciello
2026-08-31 21:05 ` [PATCH v7 04/12] drm: add connector backlight (LUMINANCE) infrastructure Mario Limonciello
2026-08-31 22:28   ` sashiko-bot
2026-08-31 21:05 ` [PATCH v7 05/12] drm: add DRM_CLIENT_CAP_LUMINANCE Mario Limonciello
2026-08-31 22:37   ` sashiko-bot
2026-08-31 21:05 ` [PATCH v7 06/12] drm/amd/display: Pass up errors reading actual brightness Mario Limonciello
2026-08-31 22:49   ` sashiko-bot
2026-08-31 21:05 ` [PATCH v7 07/12] drm/amd: Indicate driver supports luminance Mario Limonciello
2026-08-31 21:05 ` [PATCH v7 08/12] drm/amd/display: use drm backlight Mario Limonciello
2026-08-31 23:12   ` sashiko-bot
2026-08-31 21:05 ` [PATCH v7 09/12] drm/bridge: auto-link panel backlight in bridge connector Mario Limonciello
2026-08-31 23:24   ` sashiko-bot
2026-08-31 21:05 ` [PATCH v7 10/12] drm/xe: Indicate support for luminance on the connector Mario Limonciello
2026-08-31 23:30   ` sashiko-bot
2026-08-31 21:05 ` [PATCH v7 11/12] drm/i915: " Mario Limonciello
2026-08-31 21:05 ` [PATCH v7 12/12] drm/i915/display: use drm backlight Mario Limonciello
2026-08-31 23:55   ` sashiko-bot
2026-09-01  0:19 ` [PATCH v7 00/12] Add support for a DRM backlight capability Mario Limonciello

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).