dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Thomas Zimmermann <tzimmermann@suse.de>, Daniel Vetter <daniel@ffwll.ch>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>,
	Dave Airlie <airlied@linux.ie>,
	Emil Velikov <emil.l.velikov@gmail.com>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Sam Ravnborg <sam@ravnborg.org>
Subject: Re: [RFC][PATCH 0/9] drm: Support simple-framebuffer devices and firmware fbs
Date: Fri, 3 Jul 2020 12:55:04 +0200	[thread overview]
Message-ID: <4bd25272-cab4-1044-2cab-296ee2abb9d6@redhat.com> (raw)
In-Reply-To: <cc6021b0-d874-240e-9fda-1cec3dfe6648@suse.de>

Hi,

On 7/1/20 4:10 PM, Thomas Zimmermann wrote:
> Hi Daniel,
> 
> thanks for reviewing most of the patchset.
> 
> Am 30.06.20 um 11:06 schrieb Daniel Vetter:
>> On Mon, Jun 29, 2020 at 11:39 AM Hans de Goede <hdegoede@redhat.com> wrote:
>>>
>>> Hi,
>>>
>>> On 6/25/20 2:00 PM, Thomas Zimmermann wrote:
>>>> This patchset adds support for simple-framebuffer platform devices and
>>>> a handover mechanism for native drivers to take-over control of the
>>>> hardware.
>>>>
>>>> The new driver, called simplekms, binds to a simple-frambuffer platform
>>>> device. The kernel's boot code creates such devices for firmware-provided
>>>> framebuffers, such as EFI-GOP or VESA. Typically the BIOS, UEFI or boot
>>>> loader sets up the framebuffers. Description via device tree is also an
>>>> option.
>>>>
>>>> Simplekms is small enough to be linked into the kernel. The driver's main
>>>> purpose is to provide graphical output during the early phases of the boot
>>>> process, before the native DRM drivers are available. Native drivers are
>>>> typically loaded from an initrd ram disk. Occationally simplekms can also
>>>> serve as interim solution on graphics hardware without native DRM driver.
>>>
>>> Cool, thank you for doing this, this is a very welcome change,
>>> but ... (see below).
>>>
>>>> So far distributions rely on fbdev drivers, such as efifb, vesafb or
>>>> simplefb, for early-boot graphical output. However fbdev is deprecated and
>>>> the drivers do not provide DRM interfaces for modern userspace.
>>>>
>>>> Patches 1 and 2 prepare the DRM format helpers for simplekms.
>>>>
>>>> Patches 3 to 7 add the simplekms driver. It's build on simple DRM helpers
>>>> and SHMEM. It supports 16-bit, 24-bit and 32-bit RGB framebuffers. During
>>>> pageflips, SHMEM buffers are copied into the framebuffer memory, similar
>>>> to cirrus or mgag200. The code in patches 6 and 7 handles clocks and
>>>> regulators. It's based on the simplefb drivers, but has been modified for
>>>> DRM.
>>>>
>>>> Patches 8 and 9 add a hand-over mechanism. Simplekms acquires it's
>>>> framebuffer's I/O-memory range and provides a callback function to be
>>>> removed by a native driver. The native driver will remove simplekms before
>>>> taking over the hardware. The removal is integrated into existing helpers,
>>>> so drivers use it automatically.
>>>>
>>>> I tested simplekms with x86 EFI and VESA framebuffers, which both work
>>>> reliably. The fbdev console and Weston work automatically. Xorg requires
>>>> manual configuration of the device. Xorgs current modesetting driver does
>>>> not work with both, platform and PCI device, for the same physical
>>>> hardware. Once configured, X11 works.
>>>
>>> Ugh, Xorg not working OOTB is a bit of a showstopper, we cannot just go
>>> around and break userspace. OTOH this does seem like an userspace issue
>>> and not something which we can (or should try to) fix in the kernel.
>>>
>>> I guess the solution will have to be to have this default to N for now
>>> in Kconfig and clearly mention in the Kconfig help text that this needs
>>> a fixed Xorg modesetting driver before it can be enabled.
>>>
>>> Any chance you have time to work on fixing the Xorg modesetting driver
>>> so that this will just work with the standard Xorg autoconfiguration
>>> stuff?
>>
>> Hm, why do we even have both platform and pci drivers visible at the
>> same time? I thought the point of this is that simplekms is built-in,
>> then initrd loads the real drm driver, and by the time Xorg is
>> running, simplekms should be long gone.
>>
>> Maybe a few more details of what's going wrong and why to help unconfuse me?
> 
> I tested simplekms with PCI graphics cards.
> 
> Xorg does it's own scanning of the busses. It supports a platform bus,
> where it finds the simple-framebuffer device that is driven by
> simplekms. Xorg also scans the PCI bus, where is finds the native PCI
> device; usually driven by the native driver. It's the same hardware, but
> on different busses.
> 
> For each device, Xorg tries to configure a screen, the Xorg modeset
> driver tried to open the DRM device file and acquire DRM master status
> on it. This works for the first screen, but DRM master status can only
> be acquired once, so it fails for the second screen. Xorg then aborts
> and asks for manual configuration of the display device.
> 
> This can be solved by setting the platform device's bus id in the
> xorg.conf device section. It just doesn't happen automatically.
> 
> I found it hard to find a solution to this. Weston just opens a DRM
> device file and uses whatever it gets. Ideally, Xorg would do the same.
> That whole bus-scanning exercise gives it a wrong idea on which graphics
> devices are available.
> 
> One idea for a fix is to compare the device I/O-memory ranges and filter
> out duplicates on the Xorg modeset driver. I don't know how reliable
> this works in practice or if their are false positives.

I think that this should work nicely, although I wonder how Xorg will
get the memory-range for the simplefb platform device, it looks like
it will need to parse /dev/iomem for this, or we need to add a
new sysfs attr to the simplefb device for this. Adding the new sysfs
attr has the added bonus that we only enable the duplicate based
resource check for simplefb devices.

Hmm, I think we can actually fix this quite simply, for the platform
device, check the basename of where the
/sys/bus/platform/devices/XXXX/driver symlink points to and if it
is simplekms ignore it, assuming that there will be another PCI
or platform device which is the actual GPU.

I guess that might cause a problem where the output-device driven
through simplekms is not visible to Xorg in any other way, but
I don't think that that ever happens?  And even if it does, then it
is probably better to teach Xorg about it, since we likely want to
replace simplekms with a more full-featured driver at some point
anyways.

Can you try commenting out the platform bus scanning code in Xorg's
autoconfigure code and see if that fixes the no Xorg.conf case ?

If it does the driver symlink trick will probably fix 99.9 %
of all cases here, and we can worry about the others if we
ever encounter them.

> A more fundamental solution is to introduce a DRM bus in Xorg that
> enumerates all available DRM device files. If there are any, no other
> busses would be scanned.

That would break the case where there are 2 cards and 1 has a kms
driver and the other only supports fbdev. Admittedly this is a
corner case, but I do believe that we cannot just go and break this.

Regards,

Hans

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

  reply	other threads:[~2020-07-03 10:55 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-25 12:00 [RFC][PATCH 0/9] drm: Support simple-framebuffer devices and firmware fbs Thomas Zimmermann
2020-06-25 12:00 ` [PATCH 1/9] drm/format-helper: Pass destination pitch to drm_fb_memcpy_dstclip() Thomas Zimmermann
2020-06-29  8:40   ` Daniel Vetter
2020-09-25 14:55     ` Thomas Zimmermann
2020-09-26 16:42       ` Daniel Vetter
2020-09-28  7:22         ` Thomas Zimmermann
2020-09-28  8:53           ` Daniel Vetter
2020-09-28  9:13             ` Thomas Zimmermann
2020-09-29  9:19               ` Daniel Vetter
2020-09-29  9:39                 ` Thomas Zimmermann
2020-09-29 11:32                   ` Daniel Vetter
2020-09-28 10:24             ` Gerd Hoffmann
2020-09-28 13:42               ` Pekka Paalanen
2020-06-25 12:00 ` [PATCH 2/9] drm/format-helper: Add blitter functions Thomas Zimmermann
2020-06-29  8:46   ` Daniel Vetter
2020-06-25 12:00 ` [PATCH 3/9] drm: Add simplekms driver Thomas Zimmermann
2020-06-29  9:06   ` Daniel Vetter
2020-09-25 15:01     ` Thomas Zimmermann
2020-09-25 15:14       ` Maxime Ripard
2020-09-28  7:25         ` Thomas Zimmermann
2021-02-10 16:14     ` Thomas Zimmermann
2020-06-25 12:00 ` [PATCH 4/9] drm/simplekms: Add fbdev emulation Thomas Zimmermann
2020-06-29  9:11   ` Daniel Vetter
2020-06-25 12:00 ` [PATCH 5/9] drm/simplekms: Initialize framebuffer data from device-tree node Thomas Zimmermann
2020-06-30  2:36   ` Rob Herring
2020-06-25 12:00 ` [PATCH 6/9] drm/simplekms: Acquire clocks from DT device node Thomas Zimmermann
2020-06-25 13:34   ` Geert Uytterhoeven
2020-06-29  9:07     ` Daniel Vetter
2020-06-25 12:00 ` [PATCH 7/9] drm/simplekms: Acquire regulators " Thomas Zimmermann
2020-06-25 13:36   ` Geert Uytterhoeven
2020-06-25 12:00 ` [PATCH 8/9] drm: Add infrastructure for platform devices Thomas Zimmermann
2020-06-29  9:27   ` Daniel Vetter
2020-09-28  8:40     ` Thomas Zimmermann
2020-09-28  8:50       ` Daniel Vetter
2020-09-28  9:14         ` Thomas Zimmermann
2020-09-29  8:59     ` Thomas Zimmermann
2020-09-29  9:20       ` Daniel Vetter
2020-06-30  9:11   ` Daniel Vetter
2020-06-25 12:00 ` [PATCH 9/9] drm/simplekms: Acquire memory aperture for framebuffer Thomas Zimmermann
2020-06-29  9:22   ` Daniel Vetter
2020-06-29 16:04     ` Greg KH
2020-06-29 16:23       ` Mark Brown
2020-06-29 16:57         ` Greg KH
2020-06-30  2:13       ` Rob Herring
2020-06-30  8:50         ` Greg KH
2020-06-29  9:38 ` [RFC][PATCH 0/9] drm: Support simple-framebuffer devices and firmware fbs Hans de Goede
2020-06-30  9:06   ` Daniel Vetter
2020-06-30  9:13     ` Hans de Goede
2020-07-01 14:10     ` Thomas Zimmermann
2020-07-03 10:55       ` Hans de Goede [this message]
2020-07-03 11:42         ` Thomas Zimmermann
2020-07-03 12:58         ` Daniel Vetter
2020-07-03 14:11           ` Hans de Goede
2020-07-01 13:48   ` Thomas Zimmermann
2020-07-03 10:44     ` Hans de Goede

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=4bd25272-cab4-1044-2cab-296ee2abb9d6@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=airlied@linux.ie \
    --cc=broonie@kernel.org \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emil.l.velikov@gmail.com \
    --cc=geert+renesas@glider.be \
    --cc=kraxel@redhat.com \
    --cc=lgirdwood@gmail.com \
    --cc=sam@ravnborg.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox