diff options
author | Krzysztof Helt <krzysztof.h1@wp.pl> | 2007-10-16 04:28:31 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 12:43:14 -0400 |
commit | b0a318e2d9230d5fa54d98c4e7b0ba03631e46fa (patch) | |
tree | 1ffd8b3cc39bd248a8d59dc57cfcfba74a9af642 | |
parent | f259ebb67b61bd8276fbfba43e119e68754be027 (diff) |
pm3fb: imageblit improved
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>
Signed-off-by: Antonino Daplas <adaplas@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | drivers/video/pm3fb.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/drivers/video/pm3fb.c b/drivers/video/pm3fb.c index 0e63f03b5367..280d108f18d1 100644 --- a/drivers/video/pm3fb.c +++ b/drivers/video/pm3fb.c | |||
@@ -46,6 +46,8 @@ | |||
46 | #define DPRINTK(a,b...) | 46 | #define DPRINTK(a,b...) |
47 | #endif | 47 | #endif |
48 | 48 | ||
49 | #define PM3_PIXMAP_SIZE (2048 * 4) | ||
50 | |||
49 | /* | 51 | /* |
50 | * Driver data | 52 | * Driver data |
51 | */ | 53 | */ |
@@ -513,7 +515,7 @@ static void pm3fb_imageblit(struct fb_info *info, const struct fb_image *image) | |||
513 | bgx = par->palette[image->bg_color]; | 515 | bgx = par->palette[image->bg_color]; |
514 | break; | 516 | break; |
515 | } | 517 | } |
516 | if (image->depth != 1 || (image->width & 0x1f)) { | 518 | if (image->depth != 1) { |
517 | return cfb_imageblit(info, image); | 519 | return cfb_imageblit(info, image); |
518 | } | 520 | } |
519 | if (info->var.bits_per_pixel == 8) { | 521 | if (info->var.bits_per_pixel == 8) { |
@@ -525,18 +527,24 @@ static void pm3fb_imageblit(struct fb_info *info, const struct fb_image *image) | |||
525 | bgx |= bgx << 16; | 527 | bgx |= bgx << 16; |
526 | } | 528 | } |
527 | 529 | ||
528 | PM3_WAIT(par, 5); | 530 | PM3_WAIT(par, 7); |
529 | 531 | ||
530 | PM3_WRITE_REG(par, PM3ForegroundColor, fgx); | 532 | PM3_WRITE_REG(par, PM3ForegroundColor, fgx); |
531 | PM3_WRITE_REG(par, PM3BackgroundColor, bgx); | 533 | PM3_WRITE_REG(par, PM3BackgroundColor, bgx); |
532 | 534 | ||
533 | /* ROP Ox3 is GXcopy */ | 535 | /* ROP Ox3 is GXcopy */ |
534 | PM3_WRITE_REG(par, PM3Config2D, | 536 | PM3_WRITE_REG(par, PM3Config2D, |
537 | PM3Config2D_UserScissorEnable | | ||
535 | PM3Config2D_UseConstantSource | | 538 | PM3Config2D_UseConstantSource | |
536 | PM3Config2D_ForegroundROPEnable | | 539 | PM3Config2D_ForegroundROPEnable | |
537 | (PM3Config2D_ForegroundROP(0x3)) | | 540 | (PM3Config2D_ForegroundROP(0x3)) | |
538 | PM3Config2D_OpaqueSpan | | 541 | PM3Config2D_OpaqueSpan | |
539 | PM3Config2D_FBWriteEnable); | 542 | PM3Config2D_FBWriteEnable); |
543 | PM3_WRITE_REG(par, PM3ScissorMinXY, | ||
544 | ((image->dy & 0x0fff) << 16) | (image->dx & 0x0fff)); | ||
545 | PM3_WRITE_REG(par, PM3ScissorMaxXY, | ||
546 | (((image->dy + image->height) & 0x0fff) << 16) | | ||
547 | ((image->dx + image->width) & 0x0fff)); | ||
540 | PM3_WRITE_REG(par, PM3RectanglePosition, | 548 | PM3_WRITE_REG(par, PM3RectanglePosition, |
541 | (PM3RectanglePosition_XOffset(image->dx)) | | 549 | (PM3RectanglePosition_XOffset(image->dx)) | |
542 | (PM3RectanglePosition_YOffset(image->dy))); | 550 | (PM3RectanglePosition_YOffset(image->dy))); |
@@ -550,7 +558,8 @@ static void pm3fb_imageblit(struct fb_info *info, const struct fb_image *image) | |||
550 | 558 | ||
551 | 559 | ||
552 | while (height--) { | 560 | while (height--) { |
553 | u32 width = (image->width + 31) >> 5; | 561 | int width = ((image->width + 7) >> 3) + info->pixmap.scan_align; |
562 | width >>= 2; | ||
554 | 563 | ||
555 | while (width >= PM3_FIFO_SIZE) { | 564 | while (width >= PM3_FIFO_SIZE) { |
556 | int i = PM3_FIFO_SIZE - 1; | 565 | int i = PM3_FIFO_SIZE - 1; |
@@ -1239,6 +1248,17 @@ static int __devinit pm3fb_probe(struct pci_dev *dev, | |||
1239 | FBINFO_HWACCEL_IMAGEBLIT | | 1248 | FBINFO_HWACCEL_IMAGEBLIT | |
1240 | FBINFO_HWACCEL_FILLRECT; | 1249 | FBINFO_HWACCEL_FILLRECT; |
1241 | 1250 | ||
1251 | info->pixmap.addr = kmalloc(PM3_PIXMAP_SIZE, GFP_KERNEL); | ||
1252 | if (!info->pixmap.addr) { | ||
1253 | retval = -ENOMEM; | ||
1254 | goto err_exit_pixmap; | ||
1255 | } | ||
1256 | info->pixmap.size = PM3_PIXMAP_SIZE; | ||
1257 | info->pixmap.buf_align = 4; | ||
1258 | info->pixmap.scan_align = 4; | ||
1259 | info->pixmap.access_align = 32; | ||
1260 | info->pixmap.flags = FB_PIXMAP_SYSTEM; | ||
1261 | |||
1242 | /* | 1262 | /* |
1243 | * This should give a reasonable default video mode. The following is | 1263 | * This should give a reasonable default video mode. The following is |
1244 | * done when we can set a video mode. | 1264 | * done when we can set a video mode. |
@@ -1275,6 +1295,8 @@ static int __devinit pm3fb_probe(struct pci_dev *dev, | |||
1275 | err_exit_all: | 1295 | err_exit_all: |
1276 | fb_dealloc_cmap(&info->cmap); | 1296 | fb_dealloc_cmap(&info->cmap); |
1277 | err_exit_both: | 1297 | err_exit_both: |
1298 | kfree(info->pixmap.addr); | ||
1299 | err_exit_pixmap: | ||
1278 | iounmap(info->screen_base); | 1300 | iounmap(info->screen_base); |
1279 | release_mem_region(pm3fb_fix.smem_start, pm3fb_fix.smem_len); | 1301 | release_mem_region(pm3fb_fix.smem_start, pm3fb_fix.smem_len); |
1280 | err_exit_mmio: | 1302 | err_exit_mmio: |
@@ -1305,6 +1327,7 @@ static void __devexit pm3fb_remove(struct pci_dev *dev) | |||
1305 | release_mem_region(fix->mmio_start, fix->mmio_len); | 1327 | release_mem_region(fix->mmio_start, fix->mmio_len); |
1306 | 1328 | ||
1307 | pci_set_drvdata(dev, NULL); | 1329 | pci_set_drvdata(dev, NULL); |
1330 | kfree(info->pixmap.addr); | ||
1308 | framebuffer_release(info); | 1331 | framebuffer_release(info); |
1309 | } | 1332 | } |
1310 | } | 1333 | } |