All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: Benjamin Berg <bberg@redhat.com>, David Airlie <airlied@linux.ie>,
	Christian Kellner <ckellner@redhat.com>,
	Javier Martinez Canillas <javierm@redhat.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Nitin Joshi1 <njoshi1@lenovo.com>,
	Rajat Jain <rajatja@google.com>,
	Mark Pearson <mpearson@lenovo.com>
Subject: Re: RFC: Drm-connector properties managed by another driver / privacy screen support
Date: Wed, 15 Apr 2020 13:56:51 +0200	[thread overview]
Message-ID: <e91b5d9b-6f7a-92f4-7a9b-babf4209eed2@redhat.com> (raw)
In-Reply-To: <a053e2a7-77c8-8874-eaf8-afe970ad8f9c@redhat.com>

Hi,

On 4/15/20 1:39 PM, Hans de Goede wrote:

<snip>
>>> /* Add comment explaining why we need this messy stuff here */
>>> const char * const shadow_providers[] = {
>>> #ifdef CONFIG_THINKPAD_ACPI_MODULE
>>>          "thinkpad_acpi",
>>> #endif
>>> #ifdef CONFIG_OTHER_MODULE
>>>          "other",
>>> #endif
>>>          NULL
>>> };
>>>
>>> int module_init(void)
>>> {
>>>          /* do actual setup of the ?class? */
>>>
>>>          for (i = 0; shadow_providers[i]; i++)
>>>                  request_module(shadow_providers[i]);
>>>
>>>          return 0;
>>> }
>>
>> Hm I think explicitly loading drivers feels very much not device model
>> like. Don't these drivers auto-load, matching on acpi functions?
> 
> thinkpad_acpi does autoload based on a number of ACPI device-ids,
> the idea behind the above request_module is to avoid the need
> to have the acpi-match function you mentioned above.
> 
> Basically what would happen is e.g. :
> 
> 1. i915 loads, calls lcdshadow_get(dev, "eDP-1");
> 2. if this is the first lcdshadow_get() call then
>     the lcdshadow core will do the request_module calls,
>     allowing any of these modules to get loaded + probed and
>     call e.g. lcdshadow_register(&mylcdshadowdev, <gfx-adapter-dev-name>, "eDP-1");
> 3. After the request modules the lcdshadow_get() will walk over
>     the list of registered devices, including the ones just registered
>     by the request_module calls and then hopefully find a match
> 
> So by doing the request-module calls before checking for
> a matching lcdshadow dev, we avoid the need of having some of
> the knowledge currently abstracted away in the thinkpad_acpi driver
> duplicated inside the drm code somewhere.
> 
>> I guess if that doesn't exist, then we'd need to fix that one first :-/
>> In general no request_module please, that shouldn't be needed either.
>>
>> The trouble with request_module is also that (afaiui) it doesn't
>> really work well with parallel module load and all that, for
>> EPROBE_DEFER to work we do need to be able to answer "should we have a
>> driver?" independently of whether that driver has loaded already or
>> not.
> 
> The idea here is to avoid using EPROBE_DEFER (on x86 at least)
> and either directly return the lcdshadow_dev or ENOENT. Also
> see below.

<snip>

> Assuming we are going to add some device/model specific
> lcdshadow knowledge inside the lcdshadow core as you
> suggested with your "small acpi match function" above,
> we could do something similar to what the vga_switcheroo
> code is doing for this and have a lcdshadow_defer_probe()
> helper and call that really early in i915_pci_probe(),
> which currently already has this for the vgaswitcheroo case:
> 
>          if (vga_switcheroo_client_probe_defer(pdev))
>                  return -EPROBE_DEFER;

So thinking more about this and given the total lack of
EPROBE_DEFER handling in the 3 major X86 GPU/kms drivers
I think that adding a lcdshadow_defer_probe() helper is
the way to go. This will also avoid the need for duplicating
the lcdshadow detect functionality in the small ACPI-match
functions you mentioned (although that might still be
interesting to speedup the boot).

When everything is builtin then each enabled "module"-s
module_init function will get called, we can call a
lcdshadow_probe_done("module-name") function from those
and the lcdshadow core can then track if all potential
lcdhadow providers have initialized before it stops
returning non 0 from lcdshadow_defer_probe().

Or if we still do the small match functions it could
be even smarter with this...

And for the modular case it can call request_module on
all (enabled as module) potential lcdhadow providers
(or again we could rely on the small match function
instead).

Then (on x86 at least) we can have lcdshadow_get never
return -EPROBE_DEFER and avoid the need to solve the
lack of EPROBE_DEFER support in the 3 major x86 drivers.

And this is all kernel internal, so if that lack of
EPROBE_DEFER support ever gets fixed then we can drop
the lcdshadow_defer_probe() hack and make
lcdshadow_get also return -EPROBE_DEFER on x86 in
some cases.

Regards,

Hans

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

  reply	other threads:[~2020-04-15 11:57 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-15  9:42 RFC: Drm-connector properties managed by another driver / privacy screen support Hans de Goede
2020-04-15  9:52 ` Daniel Vetter
2020-04-15 10:11   ` Hans de Goede
2020-04-15 10:22     ` Daniel Vetter
2020-04-15 11:39       ` Hans de Goede
2020-04-15 11:56         ` Hans de Goede [this message]
2020-04-15 12:01         ` Daniel Vetter
2020-04-15 13:02           ` Hans de Goede
2020-04-15 17:54             ` Daniel Vetter
2020-04-15 18:19               ` Hans de Goede
2020-04-15 18:29                 ` Daniel Vetter
2020-04-15 19:50                   ` Hans de Goede
2020-04-16  6:46                     ` Daniel Vetter
2020-04-15 15:28 ` Jani Nikula
2020-04-15 15:40   ` Hans de Goede
2020-04-15 17:14     ` [External] " Mark Pearson
2020-04-15 18:06       ` Hans de Goede
2020-04-15 19:20     ` Rajat Jain
2020-04-15 21:10       ` Jani Nikula
2020-04-15 21:21         ` Hans de Goede
2020-04-15 21:51           ` [External] " Mark Pearson
2020-04-17  9:05         ` Pekka Paalanen
2020-04-17  9:02     ` Pekka Paalanen
2020-04-17 11:55       ` Jani Nikula
2020-04-17 14:18         ` Daniel Vetter
2020-04-17 14:54           ` Benjamin Berg
2020-04-21 12:37         ` Hans de Goede
2020-04-21 12:40           ` Daniel Vetter
2020-04-21 14:46           ` Pekka Paalanen
2020-04-23 18:21             ` Rajat Jain
2020-04-24  7:40               ` Pekka Paalanen
2020-04-24  8:24                 ` Hans de Goede
2020-04-24  9:08                   ` Pekka Paalanen
2020-04-24 10:32                     ` Hans de Goede
2020-04-17 14:17       ` Daniel Vetter
2020-04-20  8:27         ` Operating KMS UAPI (Re: RFC: Drm-connector properties managed by another driver / privacy screen support) Pekka Paalanen
2020-04-20 10:04           ` Pekka Paalanen
2020-04-20 10:18             ` Simon Ser
2020-04-21 12:15             ` Daniel Vetter
2020-04-21 14:33               ` Pekka Paalanen
2020-04-21 14:39                 ` Simon Ser
2020-04-23 15:01                 ` Daniel Vetter
2020-04-24  8:32                   ` Pekka Paalanen
2020-04-28 14:51                     ` Daniel Vetter
2020-04-29 10:07                       ` Pekka Paalanen
2020-04-30 13:53                         ` Daniel Vetter
2020-05-04  9:49                           ` Pekka Paalanen
2020-05-04 11:00                             ` Daniel Vetter
2020-05-04 12:22                               ` Pekka Paalanen
2020-05-05  8:48                                 ` Daniel Vetter
2020-05-07  9:03                                   ` Pekka Paalanen
2020-04-20 10:15           ` Simon Ser
2020-04-20 12:22             ` Pekka Paalanen
2020-04-20 12:33               ` Simon Ser

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=e91b5d9b-6f7a-92f4-7a9b-babf4209eed2@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=airlied@linux.ie \
    --cc=bberg@redhat.com \
    --cc=ckellner@redhat.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=javierm@redhat.com \
    --cc=mpearson@lenovo.com \
    --cc=njoshi1@lenovo.com \
    --cc=rajatja@google.com \
    --cc=tzimmermann@suse.de \
    /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.