mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Antony Pavlov <antonynpavlov@gmail.com>
To: barebox@lists.infradead.org
Cc: Aleksey Kuleshov <rndfax@yandex.ru>
Subject: [PATCH 2/3] fb: satisfy semantics for shadowfb's alloc/free
Date: Fri,  6 Nov 2015 08:52:18 +0300	[thread overview]
Message-ID: <1446789139-4781-3-git-send-email-antonynpavlov@gmail.com> (raw)
In-Reply-To: <1446789139-4781-1-git-send-email-antonynpavlov@gmail.com>

From: Aleksey Kuleshov <rndfax@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@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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2015-11-06  5:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-06  5:52 [PATCH 0/3] fb & fbconsole misc fixes Antony Pavlov
2015-11-06  5:52 ` [PATCH 1/3] fbconsole: no need to copy extra line Antony Pavlov
2015-11-06  5:52 ` Antony Pavlov [this message]
2015-11-06  5:52 ` [PATCH 3/3] fb: alloc or free shadowfb whether fb enabled or disabled Antony Pavlov
2015-11-06  6:35 ` [PATCH 0/3] fb & fbconsole misc fixes 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=1446789139-4781-3-git-send-email-antonynpavlov@gmail.com \
    --to=antonynpavlov@gmail.com \
    --cc=barebox@lists.infradead.org \
    --cc=rndfax@yandex.ru \
    /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