summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBastian Stender <bst@pengutronix.de>2017-02-28 15:31:26 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2017-02-28 15:52:53 +0100
commitb9cf45f00c6e120f58f02f45ef949a7be54da999 (patch)
tree6fdcf7a7e162764a341e6f73c4b99c123b5c0a80 /drivers
parentb4f55fcf355a4d0ac456445a5f42f259f2812b57 (diff)
downloadbarebox-b9cf45f00c6e120f58f02f45ef949a7be54da999.tar.gz
barebox-b9cf45f00c6e120f58f02f45ef949a7be54da999.tar.xz
fb: introduce flush for virtual framebuffer
Some drivers need an explicit sync method to flush the virtual framebuffer to the display. It is called fb_flush(). fb_flush() gets called on fbc_putc, on fb_close and in the pattern cycle in the fbtest command. Signed-off-by: Bastian Stender <bst@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/fb.c26
-rw-r--r--drivers/video/fbconsole.c3
2 files changed, 29 insertions, 0 deletions
diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index 4d2d3aa650..6b88f2df97 100644
--- a/drivers/video/fb.c
+++ b/drivers/video/fb.c
@@ -31,6 +31,30 @@ static int fb_ioctl(struct cdev* cdev, int req, void *data)
return 0;
}
+static int fb_close(struct cdev *cdev)
+{
+ struct fb_info *info = cdev->priv;
+
+ if (info->fbops->fb_flush)
+ info->fbops->fb_flush(info);
+ return 0;
+}
+
+static int fb_op_flush(struct cdev *cdev)
+{
+ struct fb_info *info = cdev->priv;
+
+ if (info->fbops->fb_flush)
+ info->fbops->fb_flush(info);
+ return 0;
+}
+
+void fb_flush(struct fb_info *info)
+{
+ if (info->fbops->fb_flush)
+ info->fbops->fb_flush(info);
+}
+
static void fb_release_shadowfb(struct fb_info *info)
{
free(info->screen_base_shadow);
@@ -199,6 +223,8 @@ static struct file_operations fb_ops = {
.memmap = generic_memmap_rw,
.lseek = dev_lseek_default,
.ioctl = fb_ioctl,
+ .close = fb_close,
+ .flush = fb_op_flush,
};
static void fb_print_mode(struct fb_videomode *mode)
diff --git a/drivers/video/fbconsole.c b/drivers/video/fbconsole.c
index 3b5637b2ba..b261f17048 100644
--- a/drivers/video/fbconsole.c
+++ b/drivers/video/fbconsole.c
@@ -335,6 +335,7 @@ static void fbc_putc(struct console_device *cdev, char c)
{
struct fbc_priv *priv = container_of(cdev,
struct fbc_priv, cdev);
+ struct fb_info *fb = priv->fb;
if (priv->in_console)
return;
@@ -393,6 +394,8 @@ static void fbc_putc(struct console_device *cdev, char c)
}
priv->in_console = 0;
+
+ fb_flush(fb);
}
static int setup_font(struct fbc_priv *priv)