From: "Bruno Prémont" <bonbons@linux-vserver.org>
To: linux-fbdev@vger.kernel.org
Subject: Re: [PATCH 4/4] HID: picolcd: implement refcounting of framebuffer
Date: Tue, 29 Jun 2010 20:42:01 +0000 [thread overview]
Message-ID: <20100629224201.54db5c2f@neptune.home> (raw)
In-Reply-To: <20100628223327.23c6006a@neptune.home>
On Mon, 28 June 2010 Bernie Thompson <bernie@plugable.com> wrote:
> On Mon, Jun 28, 2010 at 1:33 PM, Bruno Prémont
> <bonbons@linux-vserver.org> wrote:
> > As our device may be hot-unplugged and framebuffer cannot handle
> > this case by itself we need to keep track of usage count so as
> > to release fb_info and framebuffer memory only after the last user
> > has closed framebuffer.
> >
> > We need to do the freeing in a scheduled work as fb_release()
> > is called with fb_info lock held.
>
> The udlfb (DisplayLink) framebuffer driver just got a similar fix in
> the last few days:
> http://git.plugable.com/gitphp/index.php?p=udlfb&a=commit&h®0502457e54904b1a9e0d67db6719182824da7c
>
> The need to schedule work in fb_release() because fbmem.c touches it
> after release is especially unfortunate (we had to do the same).
>
> Anyone have existing thoughts about fixing the release path more centrally?
The best option IMHO would be that framebuffer_release() would free up
memory when framebuffer is not in use anymore (or last close if FB was
in use when framebuffer_release() was called).
Something like
framebuffer_alloc() <-- set refcount to 1
...
register_framebuffer() <-- inc refcount
...
and open() of fb device would inc refcount
and close() would decrement it
unregister_framebuffer() <-- dec refcount
framebuffer_release() <-- dec refcount
When after decrementing refcount, refcount reaches zero
close() or framebuffer_release() would free the framebuffer, calling
fbops fb_release() callback so owner can do cleanup if it has something
to do.
That way it would be easiest for drivers of removable framebuffers,
possibly also useful for kms adding/removing framebuffers for extra
monitors.
Thanks,
Bruno
next prev parent reply other threads:[~2010-06-29 20:42 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-09 16:49 Deadlock between fbcon and fb_defio? Bruno Prémont
2010-05-10 0:00 ` Jaya Kumar
2010-05-10 6:00 ` Bruno Prémont
2010-05-26 19:58 ` vfree() and mmap()ed framebuffer with defio (Was: Deadlock Bruno Prémont
2010-05-30 11:09 ` [Patch] HID: Fix PicoLCD to allow it to run fbcon and handle unplug Bruno Prémont
2010-06-23 10:32 ` [Patch] HID: Fix PicoLCD to allow it to run fbcon and handle Bruno Prémont
2010-06-24 8:54 ` Jiri Kosina
2010-06-28 20:26 ` [Patch 0/4] " Bruno Prémont
2010-06-28 20:29 ` [PATCH 1/4] HID: picolcd: fix deferred_io init/cleanup to Bruno Prémont
2010-06-30 1:52 ` Jaya Kumar
2010-06-30 5:56 ` Bruno Prémont
2010-06-30 20:36 ` [PATCH 1/4 - adjusted changelog] HID: picolcd: fix deferred_io Bruno Prémont
2010-07-11 20:58 ` Jiri Kosina
2010-07-12 6:17 ` Bruno Prémont
2010-07-12 16:05 ` Jiri Kosina
2010-07-12 16:09 ` Jiri Kosina
2010-06-28 20:30 ` [PATCH 2/4] HID: picolcd: Add minimal palette required by fbcon on Bruno Prémont
2010-06-28 20:31 ` [PATCH 3/4] HID: picolcd: do not reallocate memory on depth change Bruno Prémont
2010-06-28 20:33 ` [PATCH 4/4] HID: picolcd: implement refcounting of framebuffer Bruno Prémont
2010-06-28 21:26 ` Bernie Thompson
2010-06-29 20:42 ` Bruno Prémont [this message]
2010-06-30 15:41 ` Bernie Thompson
2010-06-30 9:28 ` [Patch 0/4] HID: Fix PicoLCD to allow it to run fbcon and handle Jiri Kosina
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=20100629224201.54db5c2f@neptune.home \
--to=bonbons@linux-vserver.org \
--cc=linux-fbdev@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).