All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Javier Martinez Canillas <javierm@redhat.com>,
	Mario Limonciello <mario.limonciello@amd.com>,
	dri-devel@lists.freedesktop.org, harry.wentland@amd.com,
	Simona Vetter <simona@ffwll.ch>,
	Alex Deucher <alexander.deucher@amd.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	David Airlie <airlied@gmail.com>
Cc: Xaver Hugl <xaver.hugl@gmail.com>,
	amd-gfx@lists.freedesktop.org,
	"open list:INTEL DRM DISPLAY FOR XE AND I915 DRIVERS"
	<intel-gfx@lists.freedesktop.org>,
	"open list:INTEL DRM DISPLAY FOR XE AND I915 DRIVERS"
	<intel-xe@lists.freedesktop.org>,
	Hans de Goede <hansg@kernel.org>,
	David Herrmann <dh.herrmann@gmail.com>,
	Mario Limonciello <superm1@kernel.org>
Subject: Re: [PATCH v8 04/14] drm: add connector backlight (LUMINANCE) infrastructure
Date: Tue, 22 Sep 2026 14:08:45 +0200	[thread overview]
Message-ID: <a6efb08e-c88c-4f3b-ab40-2b56eb27bbeb@suse.de> (raw)
In-Reply-To: <xlv1ecelecm9.fsf@fmartine-thinkpadx1carbongen12.rmtes.csb>

Hi

Am 22.09.26 um 13:42 schrieb Javier Martinez Canillas:
> Mario Limonciello <mario.limonciello@amd.com> writes:
>
>> Backlight brightness is a property of a display, and thus of a DRM
>> connector, yet it has historically only been controllable through the
>> separate backlight sysfs interface. Add a generic, backend-agnostic
>> per-connector LUMINANCE range property so brightness can be driven
>> through the atomic modeset path like any other connector state.
>>
>> A struct drm_backlight is embedded in every connector and initialized by
>> the core; drivers do not allocate it. A driver links a backend (today a
>> backlight_device, in the future DDC/CI, MIPI-DCS, ...) with
>> drm_backlight_link(), which creates the connector's LUMINANCE property
> The infrastructure is meant to be backend-agnostic but drm_backlight_link()
> which creates the connector's LUMINANCE property is backend specific. Maybe
> would be better to not call drm_backlight to the DRM core helpers since it
> conflates the backlight subsystem specific helpers, and the ones that are
> supposed to be backend-agnostic.
>
> Maybe drm_brightness or drm_luminance would be more suitable? That way would
> be clear what is generic infra to handle the LUMINANCE property and what is
> specific to drivers using a backlight device.
>
> In fact, I think that would be better if you split this patch in the DRM core
> helpers and another patch that adds the backlight specific helpers on top. It
> would also be useful to have an example of a "native" backend, for drivers that
> have a trivial brightness management.
>
> For example, many small I2C or SPI display panels just send a few commands over
> the bus to change the backlight brightness. Those may have their own get/set
> luminance callbacks and register their own struct drm_backlight_funcs.
>
> Because right now seems to me that this drm_backlight infrastructure is mixing
> the two layers and we have a leaky abstraction.
>
>> with the backend's range. The property value is staged into the atomic
>> connector state and only pushed to the hardware from the commit/enable
>> path, via a workqueue so that slow backends never stall a commit. DPMS
>> off drives the backlight to 0 and DPMS on restores the committed value.
>>
>> The property range is per-connector (created from the backend's
>> max_brightness), so multiple panels no longer share and corrupt a single
>> device-wide range. drm_backlight_link() also carries the legacy-sysfs
>> takeover accounting used by the client capability added in a later patch.
>>
>> The whole feature is guarded by CONFIG_DRM_BACKLIGHT (which depends on,
>> rather than selects, BACKLIGHT_CLASS_DEVICE) so DRM does not pull the
>> backlight subsystem into the kernel when it is not wanted.
>>
> If we had a good separation between the drm_backlight core helpers and the
> backlight subsystem then this dependency wouldn't be needed. Drivers would
> use depend on CONFIG_DRM_BACKLIGHT to use the drm_backlight helpers and use
> BACKLIGHT_CLASS_DEVICE dependent helpers, to be used as set/get callbacks.
>
> Since DRM drivers that register a backlight device already depend on this
> Kconfig symbol, no additional dependencies will be needed. And drivers that
> only use the CONFIG_DRM_BACKLIGHT (with a different backend), won't need to
> depend on CONFIG_DRM_BACKLIGHT.
>
> In general, I think is preferable to have good helper functions that could
> be reused by drivers, instead of having mid-layers such as drm_backlight_link().

I want to second what Javier says here. I raise the same points in my 
rant about DRM design.

Best regards
Thomas


>

-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, (HRB 36809, AG Nürnberg)



  reply	other threads:[~2026-09-22 12:09 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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-22  8:23   ` Thomas Zimmermann
2026-09-22  8:49     ` Javier Martinez Canillas
2026-09-22 11:34       ` Mario Limonciello
2026-09-22 12:05         ` Thomas Zimmermann
2026-09-25 12:52           ` Xaver Hugl
2026-09-22 12:26         ` Maxime Ripard
2026-09-22 11:37     ` Mario Limonciello
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-22  8:32   ` Thomas Zimmermann
2026-09-25 16:30     ` Leo Li
2026-10-01 19:05       ` Harry Wentland
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-22 11:42   ` Javier Martinez Canillas
2026-09-22 12:08     ` Thomas Zimmermann [this message]
2026-09-22 11:58   ` Thomas Zimmermann
2026-10-01 19:12   ` Harry Wentland
2026-10-01 19:29     ` Xaver Hugl
2026-10-02  8:00     ` Maxime Ripard
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-22  8:53   ` Thomas Zimmermann
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  4:51 ` ✗ CI.checkpatch: warning for Add support for a DRM backlight capability (rev3) Patchwork
2026-09-08  4:53 ` ✓ CI.KUnit: success " Patchwork
2026-09-08  5:09 ` ✗ CI.checksparse: warning " Patchwork
2026-09-08  5:51 ` ✓ Xe.CI.BAT: success " Patchwork
2026-09-08  6:31 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-09-08  9:32 ` ✓ i915.CI.BAT: success " Patchwork
2026-09-08 18:45 ` ✗ i915.CI.Full: failure " Patchwork
2026-09-22  8:33 ` [PATCH v8 00/14] Add support for a DRM backlight capability Javier Martinez Canillas
2026-09-22 11:41   ` Mario Limonciello
2026-09-22 12:16     ` Maxime Ripard
2026-09-22 12:23       ` Thomas Zimmermann
2026-09-22 12:35         ` Maxime Ripard
2026-09-23  6:39           ` Thomas Zimmermann
2026-10-01 16:06             ` Maxime Ripard
2026-10-01 16:10               ` Mario Limonciello
2026-10-01 16:20                 ` Maxime Ripard
2026-09-23  8:07           ` Xaver Hugl
2026-10-01 16:18             ` Maxime Ripard
2026-10-01 16:21               ` Mario Limonciello
2026-10-01 16:55                 ` Javier Martinez Canillas
2026-10-02  8:01                   ` Maxime Ripard
2026-09-22 12:28     ` Javier Martinez Canillas
2026-09-23 20:12       ` Mario Limonciello

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a6efb08e-c88c-4f3b-ab40-2b56eb27bbeb@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dh.herrmann@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hansg@kernel.org \
    --cc=harry.wentland@amd.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=javierm@redhat.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mario.limonciello@amd.com \
    --cc=mripard@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=superm1@kernel.org \
    --cc=xaver.hugl@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.