[PATCH 2/3] fb: satisfy semantics for shadowfb's alloc/free

Antony Pavlov antonynpavlov at gmail.com
Thu Nov 5 21:52:18 PST 2015


From: Aleksey Kuleshov <rndfax at yandex.ru>

Console enable -> alloc shadowfb.
Console disable -> free shadowfb.
Otherwise, if resolution gets changed, shadowfb will not be affected.

Signed-off-by: Aleksey Kuleshov <rndfax at yandex.ru>
---
 drivers/video/fb.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index 3672c44..bd8bab0 100644
--- a/drivers/video/fb.c
+++ b/drivers/video/fb.c
@@ -31,6 +31,12 @@ static int fb_ioctl(struct cdev* cdev, int req, void *data)
 	return 0;
 }
 
+static void fb_release_shadowfb(struct fb_info *info)
+{
+	free(info->screen_base_shadow);
+	info->screen_base_shadow = NULL;
+}
+
 static int fb_alloc_shadowfb(struct fb_info *info)
 {
 	if (info->screen_base_shadow && info->shadowfb)
@@ -47,8 +53,7 @@ static int fb_alloc_shadowfb(struct fb_info *info)
 		memcpy(info->screen_base_shadow, info->screen_base,
 				info->line_length * info->yres);
 	} else {
-		free(info->screen_base_shadow);
-		info->screen_base_shadow = NULL;
+		fb_release_shadowfb(info);
 	}
 
 	return 0;
@@ -79,6 +84,8 @@ int fb_disable(struct fb_info *info)
 
 	info->fbops->fb_disable(info);
 
+	fb_release_shadowfb(info);
+
 	info->enabled = false;
 
 	return 0;
-- 
2.6.2




More information about the barebox mailing list