From: "Antonino A. Daplas" <adaplas@gmail.com>
To: Andrew Morton <akpm@osdl.org>,
Linux Fbdev development list
<linux-fbdev-devel@lists.sourceforge.net>
Cc: Ingo Oeser <ioe-lkml@rameria.de>,
linux-kernel@vger.kernel.org,
"David S. Miller" <davem@davemloft.net>,
benh@kernel.crashing.org, linux-kernel@hansmi.ch
Subject: [PATCH] fbdev: Fix usage of blank value passed to fb_blank
Date: Sun, 29 Jan 2006 10:18:19 +0800 [thread overview]
Message-ID: <43DC25EB.1040005@gmail.com> (raw)
In-Reply-To: <200601282106.21664.ioe-lkml@rameria.de>
The fb_blank() hook accepts 5 blanking levels which include 1 level designed
for console use only. Userspace is only aware of 4 levels. Thus, it's
possible for userspace to request VESA_VSYNC_SUSPEND which, in turn, is
interpreted by the fb driver as a request for FB_BLANK_NORMAL. A few drivers
return -EINVAL for this, confusing userspace apps that the driver may not
have VESA blanking support.
Fix by incrementing the blank value by one if the request originated from
userspace.
Signed-off-by: Antonino Daplas <adaplas@pol.net>
---
Ingo Oeser wrote:
> > May I suggest to hide this implementation detail?
> >
Yes. The change will be invisible to drivers.
Unfortunately, this may cause some userland breakage. X should work.
However, some apps may have been developed that uses the FB_BLANK constants
(DirectFB?). In these cases, they'll get a deeper blank level instead, so it
probably won't affect them significantly. A follow up patch that hides the
FB_BLANK constants may be worthwhile.
drivers/video/fbmem.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index d2dede6..5bed0fb 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -843,6 +843,19 @@ fb_blank(struct fb_info *info, int blank
{
int ret = -EINVAL;
+ /*
+ * The framebuffer core supports 5 blanking levels (FB_BLANK), whereas
+ * VESA defined only 4. The extra level, FB_BLANK_NORMAL, is a
+ * console invention and is not related to power management.
+ * Unfortunately, fb_blank callers, especially X, pass VESA constants
+ * leading to undefined behavior.
+ *
+ * To avoid confusion, fb_blank will assume VESA constants if coming
+ * from userspace, and FB_BLANK constants if coming from the kernel.
+ */
+ if (info->flags & FBINFO_MISC_USEREVENT && blank)
+ blank++;
+
if (blank > FB_BLANK_POWERDOWN)
blank = FB_BLANK_POWERDOWN;
next prev parent reply other threads:[~2006-01-29 2:19 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-27 23:13 [PATCH] framebuffer: Remove old radeon driver Michael Hanselmann
2006-01-28 4:09 ` Benjamin Herrenschmidt
2006-01-28 4:46 ` David S. Miller
2006-01-28 5:59 ` Antonino A. Daplas
2006-01-28 20:06 ` Ingo Oeser
2006-01-29 2:18 ` Antonino A. Daplas [this message]
2006-01-29 8:18 ` [PATCH] fbdev: Fix usage of blank value passed to fb_blank Andrew Morton
2006-01-29 10:40 ` Antonino A. Daplas
2006-01-29 14:42 ` [Linux-fbdev-devel] " Ville Syrjälä
2006-01-29 22:19 ` Antonino A. Daplas
2006-01-29 23:34 ` Antonino A. Daplas
2006-01-30 10:22 ` Geert Uytterhoeven
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=43DC25EB.1040005@gmail.com \
--to=adaplas@gmail.com \
--cc=akpm@osdl.org \
--cc=benh@kernel.crashing.org \
--cc=davem@davemloft.net \
--cc=ioe-lkml@rameria.de \
--cc=linux-fbdev-devel@lists.sourceforge.net \
--cc=linux-kernel@hansmi.ch \
--cc=linux-kernel@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