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>
This commit is contained in:
parent
b4f55fcf35
commit
b9cf45f00c
|
@ -169,6 +169,7 @@ static int do_fbtest(int argc, char *argv[])
|
|||
pattern = patterns[i++ % ARRAY_SIZE(patterns)].func;
|
||||
pattern(sc, color);
|
||||
gu_screen_blit(sc);
|
||||
fb_flush(sc->info);
|
||||
|
||||
start = get_time_ns();
|
||||
while (!is_timeout(start, 2 * SECOND))
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -86,6 +86,7 @@ struct fb_ops {
|
|||
void (*fb_enable)(struct fb_info *info);
|
||||
void (*fb_disable)(struct fb_info *info);
|
||||
int (*fb_activate_var)(struct fb_info *info);
|
||||
void (*fb_flush)(struct fb_info *info);
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -152,6 +153,7 @@ int register_framebuffer(struct fb_info *info);
|
|||
|
||||
int fb_enable(struct fb_info *info);
|
||||
int fb_disable(struct fb_info *info);
|
||||
void fb_flush(struct fb_info *info);
|
||||
|
||||
#define FBIOGET_SCREENINFO _IOR('F', 1, loff_t)
|
||||
#define FBIO_ENABLE _IO('F', 2)
|
||||
|
|
Loading…
Reference in New Issue