All of lore.kernel.org
 help / color / mirror / Atom feed
From: Krzysztof Helt <krzysztof.h1@wp.pl>
To: Linux Fbdev development list <linux-fbdev-devel@lists.sourceforge.net>
Subject: [PATCH] pm3fb: imageblit improved
Date: Wed, 13 Jun 2007 23:24:03 +0200	[thread overview]
Message-ID: <46706073.9090501@wp.pl> (raw)

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

From: Krzysztof Helt <krzysztof.h1@wp.pl>

This patch removes the pm3_imageblit() restriction to blit only images with width divisable by 32.

Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>

---

This patch requires previous patches which added accelerated copyarea and fillrect.

--- linux-2.6.21.old/drivers/video/pm3fb.c	2007-06-12 19:30:06.269593579 +0200
+++ linux-2.6.21/drivers/video/pm3fb.c	2007-06-13 19:45:00.119603402 +0200
@@ -46,6 +46,8 @@
 #define DPRINTK(a,b...)
 #endif
 
+#define PM3_PIXMAP_SIZE	(2048 * 4)
+
 /*
  * Driver data
  */
@@ -513,7 +515,7 @@ static void pm3fb_imageblit(struct fb_in
 			bgx = par->palette[image->bg_color];
 			break;
 	}
-	if (image->depth != 1 || (image->width & 0x1f)) {
+	if (image->depth != 1) {
 		return cfb_imageblit(info, image);
 	}
 	if (info->var.bits_per_pixel == 8) {
@@ -525,18 +527,24 @@ static void pm3fb_imageblit(struct fb_in
 		bgx |= bgx << 16;
 	}
 
-	PM3_WAIT(par, 5);
+	PM3_WAIT(par, 7);
 
 	PM3_WRITE_REG(par, PM3ForegroundColor, fgx);
 	PM3_WRITE_REG(par, PM3BackgroundColor, bgx);
 
 	/* ROP Ox3 is GXcopy */
 	PM3_WRITE_REG(par, PM3Config2D,
+			PM3Config2D_UserScissorEnable |
 			PM3Config2D_UseConstantSource |
 			PM3Config2D_ForegroundROPEnable |
 			(PM3Config2D_ForegroundROP(0x3)) |
 			PM3Config2D_OpaqueSpan |
 			PM3Config2D_FBWriteEnable);
+	PM3_WRITE_REG(par, PM3ScissorMinXY,
+			((image->dy & 0x0fff) << 16) | (image->dx & 0x0fff));
+	PM3_WRITE_REG(par, PM3ScissorMaxXY,
+			(((image->dy + image->height) & 0x0fff) << 16) |
+			((image->dx + image->width) & 0x0fff));
 	PM3_WRITE_REG(par, PM3RectanglePosition,
 			(PM3RectanglePosition_XOffset(image->dx)) |
 			(PM3RectanglePosition_YOffset(image->dy)));
@@ -550,7 +558,8 @@ static void pm3fb_imageblit(struct fb_in
 
 
 	while (height--) {
-		u32 width = (image->width + 31) >> 5;
+		int width = ((image->width + 7) >> 3) + info->pixmap.scan_align;
+		width >>= 2;
 
 		while (width >= PM3_FIFO_SIZE) {
 			int i = PM3_FIFO_SIZE - 1;
@@ -1240,6 +1249,17 @@ static int __devinit pm3fb_probe(struct 
 			FBINFO_HWACCEL_IMAGEBLIT |
 			FBINFO_HWACCEL_FILLRECT;
 
+	info->pixmap.addr = kmalloc(PM3_PIXMAP_SIZE, GFP_KERNEL);
+	if (!info->pixmap.addr) {
+		retval = -ENOMEM;
+		goto err_exit_pixmap;
+	}
+	info->pixmap.size = PM3_PIXMAP_SIZE;
+	info->pixmap.buf_align = 4;
+	info->pixmap.scan_align = 4;
+	info->pixmap.access_align = 32;
+	info->pixmap.flags = FB_PIXMAP_SYSTEM;
+
 	/*
 	 * This should give a reasonable default video mode. The following is
 	 * done when we can set a video mode.
@@ -1276,6 +1296,8 @@ static int __devinit pm3fb_probe(struct 
  err_exit_all:
 	fb_dealloc_cmap(&info->cmap);
  err_exit_both:
+	kfree(info->pixmap.addr);
+ err_exit_pixmap:
 	iounmap(info->screen_base);
 	release_mem_region(pm3fb_fix.smem_start, pm3fb_fix.smem_len);
  err_exit_mmio:
@@ -1306,6 +1328,7 @@ static void __devexit pm3fb_remove(struc
 		release_mem_region(fix->mmio_start, fix->mmio_len);
 
 		pci_set_drvdata(dev, NULL);
+		kfree(info->pixmap.addr);
 		framebuffer_release(info);
 	}
 }

[-- Attachment #2: pm3fb-imageblit.diff --]
[-- Type: text/plain, Size: 3035 bytes --]

From: Krzysztof Helt <krzysztof.h1@wp.pl>

This patch removes pm3_imageblit restriction to blit only images with width divisable by 32.

Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>

---

This patch requires previous patches which added accelerated copyarea and fillrect.

--- linux-2.6.21.old/drivers/video/pm3fb.c	2007-06-12 19:30:06.269593579 +0200
+++ linux-2.6.21/drivers/video/pm3fb.c	2007-06-13 19:45:00.119603402 +0200
@@ -46,6 +46,8 @@
 #define DPRINTK(a,b...)
 #endif
 
+#define PM3_PIXMAP_SIZE	(2048 * 4)
+
 /*
  * Driver data
  */
@@ -513,7 +515,7 @@ static void pm3fb_imageblit(struct fb_in
 			bgx = par->palette[image->bg_color];
 			break;
 	}
-	if (image->depth != 1 || (image->width & 0x1f)) {
+	if (image->depth != 1) {
 		return cfb_imageblit(info, image);
 	}
 	if (info->var.bits_per_pixel == 8) {
@@ -525,18 +527,24 @@ static void pm3fb_imageblit(struct fb_in
 		bgx |= bgx << 16;
 	}
 
-	PM3_WAIT(par, 5);
+	PM3_WAIT(par, 7);
 
 	PM3_WRITE_REG(par, PM3ForegroundColor, fgx);
 	PM3_WRITE_REG(par, PM3BackgroundColor, bgx);
 
 	/* ROP Ox3 is GXcopy */
 	PM3_WRITE_REG(par, PM3Config2D,
+			PM3Config2D_UserScissorEnable |
 			PM3Config2D_UseConstantSource |
 			PM3Config2D_ForegroundROPEnable |
 			(PM3Config2D_ForegroundROP(0x3)) |
 			PM3Config2D_OpaqueSpan |
 			PM3Config2D_FBWriteEnable);
+	PM3_WRITE_REG(par, PM3ScissorMinXY,
+			((image->dy & 0x0fff) << 16) | (image->dx & 0x0fff));
+	PM3_WRITE_REG(par, PM3ScissorMaxXY,
+			(((image->dy + image->height) & 0x0fff) << 16) |
+			((image->dx + image->width) & 0x0fff));
 	PM3_WRITE_REG(par, PM3RectanglePosition,
 			(PM3RectanglePosition_XOffset(image->dx)) |
 			(PM3RectanglePosition_YOffset(image->dy)));
@@ -550,7 +558,8 @@ static void pm3fb_imageblit(struct fb_in
 
 
 	while (height--) {
-		u32 width = (image->width + 31) >> 5;
+		int width = ((image->width + 7) >> 3) + info->pixmap.scan_align;
+		width >>= 2;
 
 		while (width >= PM3_FIFO_SIZE) {
 			int i = PM3_FIFO_SIZE - 1;
@@ -1240,6 +1249,17 @@ static int __devinit pm3fb_probe(struct 
 			FBINFO_HWACCEL_IMAGEBLIT |
 			FBINFO_HWACCEL_FILLRECT;
 
+	info->pixmap.addr = kmalloc(PM3_PIXMAP_SIZE, GFP_KERNEL);
+	if (!info->pixmap.addr) {
+		retval = -ENOMEM;
+		goto err_exit_pixmap;
+	}
+	info->pixmap.size = PM3_PIXMAP_SIZE;
+	info->pixmap.buf_align = 4;
+	info->pixmap.scan_align = 4;
+	info->pixmap.access_align = 32;
+	info->pixmap.flags = FB_PIXMAP_SYSTEM;
+
 	/*
 	 * This should give a reasonable default video mode. The following is
 	 * done when we can set a video mode.
@@ -1276,6 +1296,8 @@ static int __devinit pm3fb_probe(struct 
  err_exit_all:
 	fb_dealloc_cmap(&info->cmap);
  err_exit_both:
+	kfree(info->pixmap.addr);
+ err_exit_pixmap:
 	iounmap(info->screen_base);
 	release_mem_region(pm3fb_fix.smem_start, pm3fb_fix.smem_len);
  err_exit_mmio:
@@ -1306,6 +1328,7 @@ static void __devexit pm3fb_remove(struc
 		release_mem_region(fix->mmio_start, fix->mmio_len);
 
 		pci_set_drvdata(dev, NULL);
+		kfree(info->pixmap.addr);
 		framebuffer_release(info);
 	}
 }

[-- Attachment #3: Type: text/plain, Size: 286 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

[-- Attachment #4: Type: text/plain, Size: 182 bytes --]

_______________________________________________
Linux-fbdev-devel mailing list
Linux-fbdev-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel

                 reply	other threads:[~2007-06-13 21:22 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=46706073.9090501@wp.pl \
    --to=krzysztof.h1@wp.pl \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.