EXPORT_SYMBOL(drm_fb_xrgb8888_to_rgb332);
static void drm_fb_xrgb8888_to_rgb565_line(u16 *dbuf, const u32 *sbuf,
- unsigned int pixels,
- bool swab)
+ unsigned int pixels)
{
unsigned int x;
u16 val16;
val16 = ((sbuf[x] & 0x00F80000) >> 8) |
((sbuf[x] & 0x0000FC00) >> 5) |
((sbuf[x] & 0x000000F8) >> 3);
- if (swab)
- dbuf[x] = swab16(val16);
- else
- dbuf[x] = val16;
+ dbuf[x] = val16;
+ }
+}
+
+static void drm_fb_xrgb8888_to_rgb565_swab_line(u16 *dbuf, const u32 *sbuf,
+ unsigned int pixels)
+{
+ unsigned int x;
+ u16 val16;
+
+ for (x = 0; x < pixels; x++) {
+ val16 = ((sbuf[x] & 0x00F80000) >> 8) |
+ ((sbuf[x] & 0x0000FC00) >> 5) |
+ ((sbuf[x] & 0x000000F8) >> 3);
+ dbuf[x] = swab16(val16);
}
}
vaddr += clip_offset(clip, fb->pitches[0], sizeof(u32));
for (y = 0; y < lines; y++) {
memcpy(sbuf, vaddr, src_len);
- drm_fb_xrgb8888_to_rgb565_line(dst, sbuf, linepixels, swab);
+ if (swab)
+ drm_fb_xrgb8888_to_rgb565_swab_line(dst, sbuf, linepixels);
+ else
+ drm_fb_xrgb8888_to_rgb565_line(dst, sbuf, linepixels);
vaddr += fb->pitches[0];
dst += dst_pitch;
}
vaddr += clip_offset(clip, fb->pitches[0], sizeof(u32));
for (y = 0; y < lines; y++) {
- drm_fb_xrgb8888_to_rgb565_line(dbuf, vaddr, linepixels, swab);
+ if (swab)
+ drm_fb_xrgb8888_to_rgb565_swab_line(dbuf, vaddr, linepixels);
+ else
+ drm_fb_xrgb8888_to_rgb565_line(dbuf, vaddr, linepixels);
memcpy_toio(dst, dbuf, dst_len);
vaddr += fb->pitches[0];
dst += dst_pitch;