[PATCH 0/6] drm/tinydrm: Support device unplug

Noralf Trønnes noralf at tronnes.org
Tue Aug 29 18:05:48 UTC 2017


Den 28.08.2017 23.58, skrev Daniel Vetter:
> Hi Noralf,
>
> On Mon, Aug 28, 2017 at 07:17:42PM +0200, Noralf Trønnes wrote:
>> This adds device unplug support to drm_fb_helper, drm_fb_cma_helper
>> (fbdev) and tinydrm.
>>
>> My motivation for doing this is to make tinydrm useable with USB
>> devices. This discussion gave insight into the problem:
>> [PATCH v5 2/6] drm/bridge: Add a devm_ allocator for panel bridge.
>> https://lists.freedesktop.org/archives/dri-devel/2017-August/149376.html
> Looks a lot less scary than I thought, but I think needs a bit more
> polish.

I'm glad you made me look closer at unregister_framebuffer(), since it
did handle this quite good. I was fooled by the 2 usb fbdev drivers
that forked out unregistering to a worker.

> I think it'd be also great if you could co-evolve the udl driver to get
> this right, since it looks like right now it'll just oops when you unplug
> when userspace is using the fbdev emulation. That way we'd be at least
> somewhat consistent with unpluggable drivers, and since it's only 1 other
> it should be doable. Unplugging is already hard, having 2 drivers do stuff
> differently (when we only have 2 with unplug support) pretty much
> guarnatees we'll never get this right.

I turns out that udl by default doesn't use fbdev mmap deferred io,
because it interferes with shmem's use of page->lru. This means that no
one uses it and since fbcon detaches itself on unregister_framebuffer(),
udl is in the clear with regards to fbdev.

In my shmem gem library I'll work around the page->lru issue by using a
shadow fbdev buffer. Since the library will have code from udl, I reckon
that udl can switch to using it.

Noralf.

> But maybe good to first develop this using your own driver only.
>
> Cheers, Daniel
>
>> Noralf.
>>
>> Noralf Trønnes (6):
>>    drm/fb-helper: Avoid NULL ptr dereference in fb_set_suspend()
>>    drm/fb-helper: Support device unplug
>>    drm/fb-cma-helper: Support device unplug
>>    drm/tinydrm: Embed drm_device in tinydrm_device
>>    drm/tinydrm/mi0283qt: Let the display pipe handle power
>>    drm/tinydrm: Support device unplug
>>
>>   drivers/gpu/drm/drm_fb_cma_helper.c         | 139 +++++++++----------
>>   drivers/gpu/drm/drm_fb_helper.c             | 207 +++++++++++++++++++++++++++-
>>   drivers/gpu/drm/tinydrm/core/tinydrm-core.c | 109 ++++++++++-----
>>   drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c |   2 +-
>>   drivers/gpu/drm/tinydrm/mi0283qt.c          |  77 +++--------
>>   drivers/gpu/drm/tinydrm/mipi-dbi.c          |  27 ++--
>>   drivers/gpu/drm/tinydrm/repaper.c           |  19 ++-
>>   drivers/gpu/drm/tinydrm/st7586.c            |  25 ++--
>>   include/drm/drm_fb_cma_helper.h             |   1 +
>>   include/drm/drm_fb_helper.h                 |  35 +++++
>>   include/drm/tinydrm/tinydrm.h               |  14 +-
>>   11 files changed, 460 insertions(+), 195 deletions(-)
>>
>> -- 
>> 2.7.4
>>



More information about the dri-devel mailing list