linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Antonino A. Daplas" <adaplas@hotpop.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Linux Fbdev development list <linux-fbdev-devel@lists.sourceforge.net>
Subject: [PATCH] fbcon: Another fix for fbcon generic blanking code
Date: Thu, 4 Nov 2004 16:47:12 +0800	[thread overview]
Message-ID: <200411041647.13799.adaplas@hotpop.com> (raw)

If the driver has no fb_blank hook, then the generic method is to clear the
screen and then disallow writes to the framebuffer.  However, if the console
is leaving graphics mode (KD_GRAPHICS), it would update the screen
first, then unblank.  However, since writes to the framebuffers are
disallowed, the update failes, and upon unblank, the screen is left empty
except for the flashing cursor.  (This happens, for example when switching
from X to console).

The fix is to allow writes to the framebuffer even if the console is blanked.
To imitate a blank screen, the get_color() function will return the
attributes of the erase character (black on black) if the console is blanked
and if the driver has no fb_blank hook.

I think this fixes the rest of the major bugs in the blanking code.  

Signed-off-by: Antonino Daplas <adaplas@pol.net>
---

 fbcon.c |   23 +++++++++++++++--------
 1 files changed, 15 insertions(+), 8 deletions(-)

diff -Nru a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
--- a/drivers/video/console/fbcon.c	2004-11-03 10:19:37 +08:00
+++ b/drivers/video/console/fbcon.c	2004-11-04 16:26:10 +08:00
@@ -203,8 +203,7 @@
 static inline int fbcon_is_inactive(struct vc_data *vc, struct fb_info *info)
 {
 	return (info->state != FBINFO_STATE_RUNNING ||
-		vt_cons[vc->vc_num]->vc_mode != KD_TEXT ||
-		(console_blanked && info->fbops->fb_blank));
+		vt_cons[vc->vc_num]->vc_mode != KD_TEXT);
 }
 
 static inline int get_color(struct vc_data *vc, struct fb_info *info,
@@ -213,6 +212,12 @@
 	int depth = fb_get_color_depth(info);
 	int color = 0;
 
+	if (!info->fbops->fb_blank && console_blanked) {
+		unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
+
+		c = vc->vc_video_erase_char & charmask;
+	}
+
 	if (depth != 1)
 		color = (is_fg) ? attr_fgcol((vc->vc_hi_font_mask) ? 9 : 8, c)
 			: attr_bgcol((vc->vc_hi_font_mask) ? 13 : 12, c);
@@ -224,6 +229,9 @@
 		int fg = (info->fix.visual != FB_VISUAL_MONO01) ? 1 : 0;
 		int bg = (info->fix.visual != FB_VISUAL_MONO01) ? 0 : 1;
 
+		if (!info->fbops->fb_blank && console_blanked)
+			fg = bg;
+
 		color = (is_fg) ? fg : bg;
 		break;
 	}
@@ -244,6 +252,7 @@
 		break;
 	}
 
+
 	return color;
 }
 
@@ -1939,9 +1948,8 @@
 
 	update_var(vc->vc_num, info);
 	fbcon_set_palette(vc, color_table); 	
+	fbcon_clear_margins(vc, 0);
 
-	if (vt_cons[vc->vc_num]->vc_mode == KD_TEXT)
-		fbcon_clear_margins(vc, 0);
 	if (logo_shown == FBCON_LOGO_DRAW) {
 
 		logo_shown = fg_console;
@@ -2478,10 +2486,9 @@
 	if (scrollback_current == scrollback_old)
 		return 0;
 
-	if (!info->fbops->fb_blank &&
-	    (console_blanked || vt_cons[vc->vc_num]->vc_mode != KD_TEXT
-	     || !lines))
+	if (fbcon_is_inactive(vc, info))
 		return 0;
+
 	fbcon_cursor(vc, CM_ERASE);
 
 	offset = p->yscroll - scrollback_current;
@@ -2510,7 +2517,7 @@
 
 static int fbcon_set_origin(struct vc_data *vc)
 {
-	if (softback_lines && !console_blanked)
+	if (softback_lines)
 		fbcon_scrolldelta(vc, softback_lines);
 	return 0;
 }






-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click

                 reply	other threads:[~2004-11-04  8:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=200411041647.13799.adaplas@hotpop.com \
    --to=adaplas@hotpop.com \
    --cc=akpm@osdl.org \
    --cc=linux-fbdev-devel@lists.sourceforge.net \
    /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;
as well as URLs for NNTP newsgroup(s).