Commit 3c6c6a78 authored by Mikulas Patocka's avatar Mikulas Patocka Committed by Bartlomiej Zolnierkiewicz

mach64: fix display corruption on big endian machines

The code for manual bit triple is not endian-clean. It builds the variable
"hostdword" using byte accesses, therefore we must read the variable with
"le32_to_cpu".

The patch also enables (hardware or software) bit triple only if the image
is monochrome (image->depth). If we want to blit full-color image, we
shouldn't use the triple code.
Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
Reviewed-by: default avatarVille Syrjälä <syrjala@sci.fi>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
parent ceadddde
...@@ -345,7 +345,7 @@ void atyfb_imageblit(struct fb_info *info, const struct fb_image *image) ...@@ -345,7 +345,7 @@ void atyfb_imageblit(struct fb_info *info, const struct fb_image *image)
* since Rage 3D IIc we have DP_HOST_TRIPLE_EN bit * since Rage 3D IIc we have DP_HOST_TRIPLE_EN bit
* this hwaccelerated triple has an issue with not aligned data * this hwaccelerated triple has an issue with not aligned data
*/ */
if (M64_HAS(HW_TRIPLE) && image->width % 8 == 0) if (image->depth == 1 && M64_HAS(HW_TRIPLE) && image->width % 8 == 0)
pix_width |= DP_HOST_TRIPLE_EN; pix_width |= DP_HOST_TRIPLE_EN;
} }
...@@ -382,7 +382,7 @@ void atyfb_imageblit(struct fb_info *info, const struct fb_image *image) ...@@ -382,7 +382,7 @@ void atyfb_imageblit(struct fb_info *info, const struct fb_image *image)
src_bytes = (((image->width * image->depth) + 7) / 8) * image->height; src_bytes = (((image->width * image->depth) + 7) / 8) * image->height;
/* manual triple each pixel */ /* manual triple each pixel */
if (info->var.bits_per_pixel == 24 && !(pix_width & DP_HOST_TRIPLE_EN)) { if (image->depth == 1 && info->var.bits_per_pixel == 24 && !(pix_width & DP_HOST_TRIPLE_EN)) {
int inbit, outbit, mult24, byte_id_in_dword, width; int inbit, outbit, mult24, byte_id_in_dword, width;
u8 *pbitmapin = (u8*)image->data, *pbitmapout; u8 *pbitmapin = (u8*)image->data, *pbitmapout;
u32 hostdword; u32 hostdword;
...@@ -415,7 +415,7 @@ void atyfb_imageblit(struct fb_info *info, const struct fb_image *image) ...@@ -415,7 +415,7 @@ void atyfb_imageblit(struct fb_info *info, const struct fb_image *image)
} }
} }
wait_for_fifo(1, par); wait_for_fifo(1, par);
aty_st_le32(HOST_DATA0, hostdword, par); aty_st_le32(HOST_DATA0, le32_to_cpu(hostdword), par);
} }
} else { } else {
u32 *pbitmap, dwords = (src_bytes + 3) / 4; u32 *pbitmap, dwords = (src_bytes + 3) / 4;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment