From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 3/8] fb: Add shadowfb support
Date: Fri, 7 Aug 2015 15:45:36 +0200 [thread overview]
Message-ID: <1438955141-8850-4-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1438955141-8850-1-git-send-email-s.hauer@pengutronix.de>
For speeding up rendering we need shadow framebuffers. This is currently
implemented in the gui functions. This does not work properly when two
users (splash and fbconsole) use the same framebuffer since in this case
two different shadow framebuffers will be used. This patch implements
shadowfb handling in the fb core directly. With this the fb device gets
a parameter 'shadowfb'. When this is true the fb core will allocate a
shadow fb and provide it to the users.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/video/fb.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++
include/fb.h | 3 +++
2 files changed, 50 insertions(+)
diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index dbda8d4..3672c44 100644
--- a/drivers/video/fb.c
+++ b/drivers/video/fb.c
@@ -31,11 +31,40 @@ static int fb_ioctl(struct cdev* cdev, int req, void *data)
return 0;
}
+static int fb_alloc_shadowfb(struct fb_info *info)
+{
+ if (info->screen_base_shadow && info->shadowfb)
+ return 0;
+
+ if (!info->screen_base_shadow && !info->shadowfb)
+ return 0;
+
+ if (info->shadowfb) {
+ info->screen_base_shadow = memalign(PAGE_SIZE,
+ info->line_length * info->yres);
+ if (!info->screen_base_shadow)
+ return -ENOMEM;
+ memcpy(info->screen_base_shadow, info->screen_base,
+ info->line_length * info->yres);
+ } else {
+ free(info->screen_base_shadow);
+ info->screen_base_shadow = NULL;
+ }
+
+ return 0;
+}
+
int fb_enable(struct fb_info *info)
{
+ int ret;
+
if (info->enabled)
return 0;
+ ret = fb_alloc_shadowfb(info);
+ if (ret)
+ return ret;
+
info->fbops->fb_enable(info);
info->enabled = true;
@@ -188,6 +217,22 @@ static void fb_info(struct device_d *dev)
fb_print_modes(&info->edid_modes);
}
+void *fb_get_screen_base(struct fb_info *info)
+{
+ return info->screen_base_shadow ?
+ info->screen_base_shadow : info->screen_base;
+}
+
+int fb_set_shadowfb(struct param_d *p, void *priv)
+{
+ struct fb_info *info = priv;
+
+ if (!info->enabled)
+ return 0;
+
+ return fb_alloc_shadowfb(info);
+}
+
int register_framebuffer(struct fb_info *info)
{
int id = get_free_deviceid("fb");
@@ -245,6 +290,8 @@ int register_framebuffer(struct fb_info *info)
for (i = 0; i < info->edid_modes.num_modes; i++)
names[i + info->modes.num_modes] = info->edid_modes.modes[i].name;
dev_add_param_enum(dev, "mode_name", fb_set_modename, NULL, &info->current_mode, names, num_modes, info);
+ info->shadowfb = 1;
+ dev_add_param_bool(dev, "shadowfb", fb_set_shadowfb, NULL, &info->shadowfb, info);
info->mode = fb_num_to_mode(info, 0);
diff --git a/include/fb.h b/include/fb.h
index 311d5db..cf113c4 100644
--- a/include/fb.h
+++ b/include/fb.h
@@ -118,6 +118,7 @@ struct fb_info {
struct device_d dev; /* This is this fb device */
void *screen_base;
+ void *screen_base_shadow;
unsigned long screen_size;
void *priv;
@@ -141,6 +142,7 @@ struct fb_info {
int register_simplefb; /* If true a simplefb device node will
* be created.
*/
+ int shadowfb;
};
struct display_timings *of_get_display_timings(struct device_node *np);
@@ -167,5 +169,6 @@ void fb_edid_add_modes(struct fb_info *info);
void fb_of_reserve_add_fixup(struct fb_info *info);
int register_fbconsole(struct fb_info *fb);
+void *fb_get_screen_base(struct fb_info *info);
#endif /* __FB_H */
--
2.4.6
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2015-08-07 13:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-07 13:45 [PATCH] fbconsole updates Sascha Hauer
2015-08-07 13:45 ` [PATCH 1/8] video: fbconsole: do not enter when we are already in fbconsole Sascha Hauer
2015-08-07 13:45 ` [PATCH 2/8] fb: return original fb_info in FBIOGET_SCREENINFO Sascha Hauer
2015-08-07 13:45 ` Sascha Hauer [this message]
2015-08-07 13:45 ` [PATCH 4/8] splash command: simplify offscreen rendering Sascha Hauer
2015-08-07 13:45 ` [PATCH 5/8] gui: Use fb provided shadowfb for " Sascha Hauer
2015-08-07 13:45 ` [PATCH 6/8] gui: implement blitting screen areas Sascha Hauer
2015-08-07 13:45 ` [PATCH 7/8] fb: fbconsole: print cursor after clearing the screen Sascha Hauer
2015-08-07 13:45 ` [PATCH 8/8] fb: fbconsole: Add missing blits Sascha Hauer
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=1438955141-8850-4-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.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