All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Peres <martin.peres@linux.intel.com>
To: "Hans de Goede" <hdegoede@redhat.com>,
	"Jani Nikula" <jani.nikula@linux.intel.com>,
	"Stéphane Marchesin" <stephane.marchesin@gmail.com>
Cc: "Martin Gräßlin" <mgraesslin@kde.org>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>
Subject: Re: KMS backlight ABI proposition
Date: Fri, 24 Feb 2017 14:56:23 +0200	[thread overview]
Message-ID: <e70710d0-1faa-9e56-a570-ac8385aa9f8f@linux.intel.com> (raw)
In-Reply-To: <429a0992-b744-6632-c04a-f1b665323e40@redhat.com>

On 24/02/17 12:44, Hans de Goede wrote:
> Hi,
>
> On 24-02-17 11:23, Martin Peres wrote:
>> On 24/02/17 11:59, Hans de Goede wrote:
>>> Hi,
>>>
>>> On 24-02-17 10:48, Hans de Goede wrote:
>>>> Hi,
>>>>
>>>> On 24-02-17 10:46, Hans de Goede wrote:
>>>>> Hi,
>>>>>
>>>>> On 24-02-17 10:34, Jani Nikula wrote:
>>>>>> On Fri, 24 Feb 2017, Hans de Goede <hdegoede@redhat.com> wrote:
>>>>>>> On 24-02-17 09:43, Jani Nikula wrote:
>>>>>>>> I don't think we have any good ideas how to solve the property max
>>>>>>>> changing on the fly. But based on the discussion so far, it's
>>>>>>>> starting
>>>>>>>> to look like we'll need to study that more thoroughly.
>>>>>>>
>>>>>>> As I mentioned in another part of the thread, I think we can just
>>>>>>> return
>>>>>>> -EBUSY if udev tries to change the binding when a drm-node is open
>>>>>>> *and* the backlight/brightness property has been accessed (even if
>>>>>>> read only) through that drm-node. We can reset the busy flag when
>>>>>>> the (last open) drm-node gets closed.
>>>>>>
>>>>>> That's certainly easier than coming up with ways to notify the
>>>>>> userspace
>>>>>> about property range changes. The obvious downside is that you
>>>>>> have to
>>>>>> kill X to do the re-association. That's fine for when everything just
>>>>>> works (i.e. everything happens before the drm node is opened), but
>>>>>> for
>>>>>> debugging it's a bit painful. Can we live with that?
>>>>>
>>>>> Sure, debugging udev rules is somewhat tricky in general (requires
>>>>> manually triggering udev). When asking users to test udev rule / hwdb
>>>>> patches I usually just ask them to reboot.
>>>>>
>>>>>>> I'm adding the *and* the backlight/brightness property has been
>>>>>>> accessed
>>>>>>> condition so that udev can still do its thing while a boot splash
>>>>>>> screen is active. This assumes that boot splash screens do not
>>>>>>> touch the brightness.
>>>>>>
>>>>>> I presume udev will have to do its job before the drm node is
>>>>>> opened, I
>>>>>> think relying on the userspace not touching the brightness
>>>>>> property is
>>>>>> going to be racy/flaky.
>>>>>
>>>>> Making sure that udev does its job before we show the splashscreen
>>>>> is tricky, note the idea is that the splashscreen *never* touches
>>>>> the brightness property and by the time regular X / wayland launches
>>>>> udev should have had plenty of time to complete its job.
>>>>>
>>>>> I do not know how hard it will be to add the code to detect triggering
>>>>> the property being touched, but that is the best I can come up with
>>>>> to still allow the bootsplash (e.g. plymouth) to use the drm-node.
>>>>
>>>> p.s.
>>>>
>>>> I realize this aint pretty, alternatively we could just document that
>>>> root may change the back-end of the property and that in that case
>>>> the max value may change and that it is up to userspace to make sure
>>>> that it deals with this (e.g. by not changing the backend at a bad
>>>> time).
>>>
>>> Sorry for all the mails, I just realized that this (making it
>>> userspace's
>>> problem entirely) is exactly what the input subsystem does. Things like
>>> setkeycodes, but esp. also the fixing of min/max value for absolute axis
>>> for touchpads are done by /lib/udev/hwdb.d/60-evdev.hwdb and the
>>> unwritten rule there is that udev needs to do this before wayland or
>>> xorg start using the touchpad and queries the min/max values (which it
>>> does once and then caches the results).
>>>
>>> I just checked the implementation of the EVIOCSABS ioctl and it does
>>> not check that the device is not in use while the changes are applied.
>>>
>>> So I think the best solution here is to just document that changing the
>>> backend and thus the max value while it is being used is not the best
>>> idea, but is allowed by the kernel.
>>
>> What's wrong with sending a hotplug event upon changing the backlight
>> driver? This would work even when X is running!
>
> Propagating that is going to be tricky, does randr even allow changing
> the range of a property after it has been registered ?

It does, unless the property was set immutable.

>
> With that said, yes sending a change uevent when this changes probably
> is a good idea regardless.

I think that solves the problem pretty nicely, so yes :)
Will wait until monday to send an updated email with the new proposal.

Dave, I would really like to hear more about your thoughts on this. Did 
we explain sufficiently well why we think pushing work onto the 
userspace will not work?

Martin
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2017-02-24 12:56 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-17 12:58 KMS backlight ABI proposition Martin Peres
2017-02-20 12:46 ` Martin Peres
2017-02-20 14:11   ` Daniel Thompson
2017-02-22 15:05     ` Jani Nikula
2017-02-22 15:18       ` Martin Peres
2017-02-22 16:20       ` Hans de Goede
2017-02-23  8:55         ` Jani Nikula
2017-02-23 13:44           ` Hans de Goede
2017-02-20 16:25   ` Thierry Reding
2017-02-22 15:38     ` Jani Nikula
2017-02-20 19:27 ` Dave Airlie
2017-02-20 19:57   ` Hans de Goede
2017-02-22 15:08     ` Martin Peres
2017-02-20 22:40   ` Alex Deucher
2017-02-20 23:01     ` Jasper St. Pierre
2017-02-22 14:00       ` Jani Nikula
2017-02-22 16:35         ` Jasper St. Pierre
2017-02-22 15:48   ` Jani Nikula
2017-02-20 20:09 ` Hans de Goede
2017-02-22 14:14   ` Jani Nikula
2017-02-22 19:07 ` Stéphane Marchesin
2017-02-23  8:40   ` Jani Nikula
2017-02-23 13:38     ` Hans de Goede
2017-02-23 17:31     ` Stéphane Marchesin
2017-02-24  8:43       ` Jani Nikula
2017-02-24  8:55         ` Hans de Goede
2017-02-24  9:34           ` Jani Nikula
2017-02-24  9:46             ` Hans de Goede
2017-02-24  9:48               ` Hans de Goede
2017-02-24  9:59                 ` Hans de Goede
2017-02-24 10:23                   ` Martin Peres
2017-02-24 10:44                     ` Hans de Goede
2017-02-24 12:56                       ` Martin Peres [this message]
2017-02-24 11:16         ` Daniel Thompson
2017-02-24 11:41           ` Jani Nikula
2017-02-23 17:41     ` Jasper St. Pierre

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=e70710d0-1faa-9e56-a570-ac8385aa9f8f@linux.intel.com \
    --to=martin.peres@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hdegoede@redhat.com \
    --cc=jani.nikula@linux.intel.com \
    --cc=mgraesslin@kde.org \
    --cc=stephane.marchesin@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.