linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Antonino Daplas <adaplas@pol.net>
To: James Simmons <jsimmons@infradead.org>,
	Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Linux Fbdev development list <linux-fbdev-devel@lists.sourceforge.net>
Subject: [PATCH]: More optimization for accel_putcs()
Date: 22 Feb 2003 11:32:21 +0800	[thread overview]
Message-ID: <1045884656.1188.7.camel@localhost.localdomain> (raw)

[-- Attachment #1: Type: text/plain, Size: 1109 bytes --]

Geert, James,

Here's a patch for linux-2.5.61 + James' fbdev.diff so accel_putcs()
will do only 1 fb_imageblit() at the end when fontwidth is not divisible
by 8.  Tested on 4x6 and 12x22 fonts.  There should be a significant
performance increase even with the generic functions, however, the
greatest gain can be seen on drivers with accelerated fb_imageblit(). 
Here are some numbers:

no accel
scrollmode: yredraw
font: 12x22
visual: packed pixels

time cat /usr/src/linux/MAINTAINERS

linux-2.5.62 (old -- 1 fb_imageblit/character)

bpp8
----
real    0m5.247s
user    0m0.001s
sys     0m5.245s

bpp16
-----
real    0m9.640s
user    0m0.001s
sys     0m9.591s

bpp24
-----
real    0m15.943s
user    0m0.001s
sys     0m15.944s

bpp32
-----
real    0m19.653s
user    0m0.002s
sys     0m19.651s

linux-2.5.62 (new - 1 fb_imageblit at the end)

bpp8
----
real    0m3.867s
user    0m0.000s
sys     0m3.866s

bpp16
-----
real    0m5.894s
user    0m0.001s
sys     0m5.892s

bpp24
-----
real    0m13.669s
user    0m0.000s
sys     0m13.670s

bpp32
-----
real    0m11.053s
user    0m0.001s
sys     0m11.054s


Tony



[-- Attachment #2: accel_putcs.diff --]
[-- Type: text/x-patch, Size: 3444 bytes --]

diff -Naur linux-2.5.61-fbdev/drivers/video/console/fbcon.c linux-2.5.61/drivers/video/console/fbcon.c
--- linux-2.5.61-fbdev/drivers/video/console/fbcon.c	2003-02-22 02:34:26.000000000 +0000
+++ linux-2.5.61/drivers/video/console/fbcon.c	2003-02-22 03:16:45.000000000 +0000
@@ -332,16 +332,22 @@
 }	
 
 #define FB_PIXMAPSIZE 8192
+/*
+ * FIXME: Break up this function, it's becoming too long...
+ */        
 void accel_putcs(struct vc_data *vc, struct display *p,
 			const unsigned short *s, int count, int yy, int xx)
 {
+	static u8 pixmap[FB_PIXMAPSIZE];
+	struct fb_image image;
 	struct fb_info *info = p->fb_info;
 	unsigned short charmask = p->charmask;
 	unsigned int width = ((vc->vc_font.width + 7)/8);
 	unsigned int cellsize = vc->vc_font.height * width;
-	struct fb_image image;
+	unsigned int pitch, cnt, i, j, k;
+	unsigned int maxcnt = FB_PIXMAPSIZE/cellsize;
+	u8 *src, *dst, *dst0;
 	u16 c = scr_readw(s);
-	static u8 pixmap[FB_PIXMAPSIZE];
 	
 	image.fg_color = attr_fgcol(p, c);
 	image.bg_color = attr_bgcol(p, c);
@@ -349,13 +355,9 @@
 	image.dy = yy * vc->vc_font.height;
 	image.height = vc->vc_font.height;
 	image.depth = 0;
+	image.data = pixmap;
 
 	if (!(vc->vc_font.width & 7)) {
-		unsigned int pitch, cnt, i, j, k;
-		unsigned int maxcnt = FB_PIXMAPSIZE/cellsize;
-		char *src, *dst, *dst0;
-
-		image.data = pixmap;
 		while (count) {
 			if (count > maxcnt) 
 				cnt = k = maxcnt;
@@ -381,14 +383,48 @@
 			image.dx += cnt * vc->vc_font.width;
 			count -= cnt;
 		}
+		
 	} else {
-		image.width = vc->vc_font.width;
-		while (count--) {
-			image.data = p->fontdata + 
-				(scr_readw(s++) & charmask) * cellsize;
+		unsigned int shift_low = 0, mod = vc->vc_font.width % 8;
+		unsigned int shift_high = 8;
+		unsigned idx = vc->vc_font.width/8;
+		u8 mask;
+
+		while (count) {
+			if (count > maxcnt) 
+				cnt = k = maxcnt;
+			else
+				cnt = k = count;
+			
+			dst0 = pixmap;
+			image.width = vc->vc_font.width * cnt;
+			pitch = (image.width + 7)/8;
+			while (k--) {
+				src = p->fontdata + (scr_readw(s++)&charmask)*
+					cellsize;
+				dst = dst0;
+				mask = (u8) (0xfff << shift_high);
+				for (i = image.height; i--; ) {
+					for (j = 0; j < idx; j++) {
+						dst[j] &= mask;
+						dst[j] |= *src >> shift_low;
+						dst[j+1] = *src << shift_high;
+						src++;
+					}
+					dst[idx] &= mask;
+					dst[idx] |= *src++ >> shift_low;
+					dst += pitch;
+				}
+				shift_low += mod;
+				shift_low &= 7;
+				shift_high = 8 - shift_low;
+				dst0 += (shift_low) ? width - 1 : width;
+			}
+
 			info->fbops->fb_imageblit(info, &image);
-			image.dx += vc->vc_font.width;
-		}	
+			image.dx += cnt * vc->vc_font.width;
+			count -= cnt;
+		}
 	}
 }
 
diff -Naur linux-2.5.61-fbdev/drivers/video/fbmem.c linux-2.5.61/drivers/video/fbmem.c
--- linux-2.5.61-fbdev/drivers/video/fbmem.c	2003-02-22 02:34:26.000000000 +0000
+++ linux-2.5.61/drivers/video/fbmem.c	2003-02-22 02:42:06.000000000 +0000
@@ -363,14 +363,14 @@
 static int ofonly __initdata = 0;
 #endif
 
+#ifdef CONFIG_LOGO
+#include <linux/linux_logo.h>
+
 static inline unsigned safe_shift(unsigned d, int n)
 {
 	return n < 0 ? d >> -n : d << n;
 }
 
-#ifdef CONFIG_FB_LOGO
-#include <linux/linux_logo.h>
-
 static void __init fb_set_logocmap(struct fb_info *info,
 				   const struct linux_logo *logo)
 {

             reply	other threads:[~2003-02-22  3:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-22  3:32 Antonino Daplas [this message]
2003-02-23 11:07 ` [PATCH]: More optimization for accel_putcs() Antonino Daplas
2003-02-26 19:29   ` James Simmons

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=1045884656.1188.7.camel@localhost.localdomain \
    --to=adaplas@pol.net \
    --cc=geert@linux-m68k.org \
    --cc=jsimmons@infradead.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).