Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Mario Limonciello <mario.limonciello@amd.com>,
	Javier Martinez Canillas <javierm@redhat.com>
Cc: 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>,
	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>,
	Marta Lofstedt <marta.lofstedt@intel.com>,
	Mario Limonciello <superm1@kernel.org>
Subject: Re: [PATCH v8 02/14] backlight: add kernel-internal backlight API
Date: Tue, 22 Sep 2026 14:05:04 +0200	[thread overview]
Message-ID: <b60d3430-ca99-40b6-aaa0-7b8d481ebda6@suse.de> (raw)
In-Reply-To: <ff86caeb-4388-4660-b3c0-ddc42bc274e3@amd.com>

Hi

Am 22.09.26 um 13:34 schrieb Mario Limonciello:
>
>
> On 9/22/26 03:49, Javier Martinez Canillas wrote:
>> On Tue, Sep 22, 2026 at 10:24 AM Thomas Zimmermann 
>> <tzimmermann@suse.de> wrote:
>>>
>>> Hi Mario
>>>
>>> Am 08.09.26 um 06:40 schrieb Mario Limonciello:
>>>> So far backlights have only been controlled via sysfs. However, 
>>>> sysfs is
>>>> not a proper user-space API for runtime modifications, and never was
>>>> intended to provide such. The DRM drivers are now prepared to provide
>>>> such a backlight link so user-space can control backlight via DRM
>>>> connector properties. This allows us to employ the same 
>>>> access-management
>>>> we use for mode-setting.
>>>>
>>>> This patch adds a few kernel-internal backlight helpers so we can 
>>>> modify
>>>> backlights from within DRM, a brightness-changed notification, and a
>>>> per-device takeover count so that legacy sysfs writes can be inhibited
>>>> (-EBUSY) while a luminance-aware DRM client is in control.
>>>>
>>>> Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
>>>>
>>
>> [...]
>>
>>>> @@ -150,6 +153,13 @@ static ssize_t bl_power_store(struct device 
>>>> *dev, struct device_attribute *attr,
>>>>        struct backlight_device *bd = to_backlight_device(dev);
>>>>        unsigned long power, old_power;
>>>>
>>>> +     /* A luminance-aware DRM client has taken over this 
>>>> backlight; the
>>>> +      * legacy sysfs interface is disabled until the last such client
>>>> +      * goes away.
>>>> +      */
>>>> +     if (atomic_read(&bd->drm_takeover) > 0)
>>>> +             return -EBUSY;
>>>> +
>>>>        rc = kstrtoul(buf, 0, &power);
>>>>        if (rc)
>>>>                return rc;
>>>> @@ -214,6 +224,13 @@ static ssize_t brightness_store(struct device 
>>>> *dev,
>>>>        struct backlight_device *bd = to_backlight_device(dev);
>>>>        unsigned long brightness;
>>>>
>>>> +     /* A luminance-aware DRM client has taken over this 
>>>> backlight; the
>>>> +      * legacy sysfs interface is disabled until the last such client
>>>> +      * goes away.
>>>> +      */
>>>> +     if (atomic_read(&bd->drm_takeover) > 0)
>>>> +             return -EBUSY;
>>>
>>> Can you really do that?  AFAIU sysfs is now a de-facto uapi for 
>>> backlights.
>>
>> And regardless if this can be done or not, I belive that would be
>> better if this is something that drivers decide to do and just return
>> -EBUSY from their struct backlight_ops..update_status.
>>
>> Ideally the sysfs interface should continue to be work as Thomas said
>> and a write could trigger a mode set for example, but I don't know if
>> that is feasible to do due locking.
>>
>
> Well the problem ends up being that something can change brightness 
> behind the compositor's back if you leave sysfs available.
>
> The whole design here is to put the compositor in control.  For 
> example if compositor wants to enforce brightness to be a certain 
> value when certain content is being displayed.

And as I mentioned, it might not be that easy. Sysfs has been the entry 
point to backlight brightness so far AFAIU.

Did you consider treating this similar to display hotplugging?  When the 
user plug a display in or out, the DRM driver sends a message to the 
compositor in user space. [1]  I think it might be possible to do a 
similar thing for changes to brightness.

[1] 
https://elixir.bootlin.com/linux/v7.2.6/source/drivers/gpu/drm/drm_probe_helper.c#L747

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:05 UTC|newest]

Thread overview: 64+ 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 [this message]
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
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  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
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=b60d3430-ca99-40b6-aaa0-7b8d481ebda6@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=marta.lofstedt@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox