The patch titled viafb-2d-engine-rewrite-v2 has been added to the -mm tree. Its filename is viafb-2d-engine-rewrite-v2.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: viafb-2d-engine-rewrite-v2 From: Florian Tobias Schandinat <FlorianSchandinat@xxxxxx> v2: - fix copyarea with overlapping areas - add raster operation code conversion and checking Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@xxxxxx> Cc: Scott Fang <ScottFang@xxxxxxxxxxxxxx> Cc: Joseph Chan <JosephChan@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/video/via/accel.c | 84 ++++++++++++++++++++++++++------- drivers/video/via/viafbdev.c | 8 ++- 2 files changed, 75 insertions(+), 17 deletions(-) diff -puN drivers/video/via/accel.c~viafb-2d-engine-rewrite-v2 drivers/video/via/accel.c --- a/drivers/video/via/accel.c~viafb-2d-engine-rewrite-v2 +++ a/drivers/video/via/accel.c @@ -25,13 +25,40 @@ static int hw_bitblt_1(void __iomem *eng u32 *src_mem, u32 src_addr, u32 src_pitch, u32 src_x, u32 src_y, u32 fg_color, u32 bg_color, u8 fill_rop) { - u32 tmp, i; + u32 ge_cmd = 0, tmp, i; if (!op || op > 3) { printk(KERN_WARNING "hw_bitblt_1: Invalid operation: %d\n", op); return -EINVAL; } + if (op != VIA_BITBLT_FILL && !src_mem && src_addr == dst_addr) { + if (src_x < dst_x) { + ge_cmd |= 0x00008000; + src_x += width - 1; + dst_x += width - 1; + } + if (src_y < dst_y) { + ge_cmd |= 0x00004000; + src_y += height - 1; + dst_y += height - 1; + } + } + + if (op == VIA_BITBLT_FILL) { + switch (fill_rop) { + case 0x00: /* blackness */ + case 0x5A: /* pattern inversion */ + case 0xF0: /* pattern copy */ + case 0xFF: /* whiteness */ + break; + default: + printk(KERN_WARNING "hw_bitblt_1: Invalid fill rop: " + "%u\n", fill_rop); + return -EINVAL; + } + } + switch (dst_bpp) { case 8: tmp = 0x00000000; @@ -113,19 +140,18 @@ static int hw_bitblt_1(void __iomem *eng tmp = (tmp >> 3) | (dst_pitch << (16 - 3)); writel(tmp, engine + 0x38); - tmp = 0; if (op == VIA_BITBLT_FILL) - tmp |= fill_rop << 24 | 0x00002000 | 0x00000001; + ge_cmd |= fill_rop << 24 | 0x00002000 | 0x00000001; else { - tmp = 0xCC000000; /* ROP=SRCCOPY */ + ge_cmd |= 0xCC000000; /* ROP=SRCCOPY */ if (src_mem) - tmp |= 0x00000040; + ge_cmd |= 0x00000040; if (op == VIA_BITBLT_MONO) - tmp |= 0x00000002 | 0x00000100 | 0x00020000; + ge_cmd |= 0x00000002 | 0x00000100 | 0x00020000; else - tmp |= 0x00000001; + ge_cmd |= 0x00000001; } - writel(tmp, engine); + writel(ge_cmd, engine); if (op == VIA_BITBLT_FILL || !src_mem) return 0; @@ -144,13 +170,40 @@ static int hw_bitblt_2(void __iomem *eng u32 *src_mem, u32 src_addr, u32 src_pitch, u32 src_x, u32 src_y, u32 fg_color, u32 bg_color, u8 fill_rop) { - u32 tmp, i; + u32 ge_cmd = 0, tmp, i; if (!op || op > 3) { printk(KERN_WARNING "hw_bitblt_2: Invalid operation: %d\n", op); return -EINVAL; } + if (op != VIA_BITBLT_FILL && !src_mem && src_addr == dst_addr) { + if (src_x < dst_x) { + ge_cmd |= 0x00008000; + src_x += width - 1; + dst_x += width - 1; + } + if (src_y < dst_y) { + ge_cmd |= 0x00004000; + src_y += height - 1; + dst_y += height - 1; + } + } + + if (op == VIA_BITBLT_FILL) { + switch (fill_rop) { + case 0x00: /* blackness */ + case 0x5A: /* pattern inversion */ + case 0xF0: /* pattern copy */ + case 0xFF: /* whiteness */ + break; + default: + printk(KERN_WARNING "hw_bitblt_2: Invalid fill rop: " + "%u\n", fill_rop); + return -EINVAL; + } + } + switch (dst_bpp) { case 8: tmp = 0x00000000; @@ -230,19 +283,18 @@ static int hw_bitblt_2(void __iomem *eng if (op == VIA_BITBLT_MONO) writel(bg_color, engine + 0x50); - tmp = 0; if (op == VIA_BITBLT_FILL) - tmp |= fill_rop << 24 | 0x00002000 | 0x00000001; + ge_cmd |= fill_rop << 24 | 0x00002000 | 0x00000001; else { - tmp = 0xCC000000; /* ROP=SRCCOPY */ + ge_cmd |= 0xCC000000; /* ROP=SRCCOPY */ if (src_mem) - tmp |= 0x00000040; + ge_cmd |= 0x00000040; if (op == VIA_BITBLT_MONO) - tmp |= 0x00000002 | 0x00000100 | 0x00020000; + ge_cmd |= 0x00000002 | 0x00000100 | 0x00020000; else - tmp |= 0x00000001; + ge_cmd |= 0x00000001; } - writel(tmp, engine); + writel(ge_cmd, engine); if (op == VIA_BITBLT_FILL || !src_mem) return 0; diff -puN drivers/video/via/viafbdev.c~viafb-2d-engine-rewrite-v2 drivers/video/via/viafbdev.c --- a/drivers/video/via/viafbdev.c~viafb-2d-engine-rewrite-v2 +++ a/drivers/video/via/viafbdev.c @@ -768,6 +768,7 @@ static void viafb_fillrect(struct fb_inf { struct viafb_par *viapar = info->par; u32 fg_color; + u8 rop; if (!viapar->shared->hw_bitblt) { cfb_fillrect(info, rect); @@ -782,11 +783,16 @@ static void viafb_fillrect(struct fb_inf else fg_color = rect->color; + if (rect->rop == ROP_XOR) + rop = 0x5A; + else + rop = 0xF0; + DEBUG_MSG(KERN_DEBUG "viafb 2D engine: fillrect\n"); if (viapar->shared->hw_bitblt(viapar->io_virt, VIA_BITBLT_FILL, rect->width, rect->height, info->var.bits_per_pixel, viapar->vram_addr, info->fix.line_length, rect->dx, rect->dy, - NULL, 0, 0, 0, 0, fg_color, 0, rect->rop)) + NULL, 0, 0, 0, 0, fg_color, 0, rop)) cfb_fillrect(info, rect); } _ Patches currently in -mm which might be from FlorianSchandinat@xxxxxx are viafb-remove-duplicated-cx700-register-init.patch viafb-remove-temporary-start-address-setting.patch viafb-merge-viafb_update_viafb_par-in-viafb_update_fix.patch viafb-split-viafb_set_start_addr-up.patch viafb-fix-ioremap_nocache-error-handling.patch viafb-clean-up-viamodeh.patch viafb-remove-duplicated-mode-information.patch viafb-clean-up-duoview.patch viafb-clean-up-virtual-memory-handling.patch viafb-remove-unused-video-device-stuff.patch viafb-remove-lvds-initialization.patch viafb-another-small-cleanup-of-viafb_par.patch viafb-improve-viafb_par.patch viafb-2d-engine-rewrite.patch viafb-2d-engine-rewrite-v2.patch viafb-switch-to-seq_file.patch fb-fix-fb_pan_display-range-check.patch fb-do-not-ignore-fb_set_par-errors.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html