Re: [PATCH v2] fbdev: fix fillrect for 24bpp modes

From: Andrew Morton
Date: Mon Apr 20 2009 - 19:19:58 EST


On Sat, 18 Apr 2009 20:52:34 +0200
Michal Januszewski <spock@xxxxxxxxxx> wrote:

> while (height--) {
> - dst += dst_idx >> (ffs(bits) - 1);
> + dst += dst_idx / bits;
> dst_idx &= (bits - 1);
> - fill_op(p, dst, dst_idx, pat, left, right,
> + r = dst_idx % bpp;
> + /* rotate pattern to the correct start position */
> +#ifdef __LITTLE_ENDIAN
> + pat2 = pat << r | pat >> (bpp-r);
> +#else
> + pat2 = pat << (bpp-r) | pat >> r;
> +#endif
> + fill_op(p, dst, dst_idx, pat2, left, right,
> width*bpp, bits);
> - r = (p->fix.line_length*8) % bpp;
> - pat = pat << (bpp-r) | pat >> r;
> dst_idx += p->fix.line_length*8;

hm, that's fairly eye-popping.

Could we do something like

pat2 = le32_to_cpu(rol32(cpu_to_le32(pat), r));

(might be wrong, but you see what I mean...)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/