* [PATCH 1/3] mach64: fix display corruption on big endian machines
@ 2018-08-25 19:51 Mikulas Patocka
2018-08-27 12:54 ` Ville Syrjälä
0 siblings, 1 reply; 3+ messages in thread
From: Mikulas Patocka @ 2018-08-25 19:51 UTC (permalink / raw)
To: Ville Syrjälä, Bartlomiej Zolnierkiewicz; +Cc: linux-fbdev, dri-devel
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: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org
---
drivers/video/fbdev/aty/mach64_accel.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Index: linux-stable/drivers/video/fbdev/aty/mach64_accel.c
=================================--- linux-stable.orig/drivers/video/fbdev/aty/mach64_accel.c 2018-08-24 17:31:21.000000000 +0200
+++ linux-stable/drivers/video/fbdev/aty/mach64_accel.c 2018-08-24 19:12:40.000000000 +0200
@@ -345,7 +345,7 @@ void atyfb_imageblit(struct fb_info *inf
* since Rage 3D IIc we have DP_HOST_TRIPLE_EN bit
* 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;
}
@@ -382,7 +382,7 @@ void atyfb_imageblit(struct fb_info *inf
src_bytes = (((image->width * image->depth) + 7) / 8) * image->height;
/* 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;
u8 *pbitmapin = (u8*)image->data, *pbitmapout;
u32 hostdword;
@@ -415,7 +415,7 @@ void atyfb_imageblit(struct fb_info *inf
}
}
wait_for_fifo(1, par);
- aty_st_le32(HOST_DATA0, hostdword, par);
+ aty_st_le32(HOST_DATA0, le32_to_cpu(hostdword), par);
}
} else {
u32 *pbitmap, dwords = (src_bytes + 3) / 4;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/3] mach64: fix display corruption on big endian machines
2018-08-25 19:51 [PATCH 1/3] mach64: fix display corruption on big endian machines Mikulas Patocka
@ 2018-08-27 12:54 ` Ville Syrjälä
2018-10-08 10:36 ` Bartlomiej Zolnierkiewicz
0 siblings, 1 reply; 3+ messages in thread
From: Ville Syrjälä @ 2018-08-27 12:54 UTC (permalink / raw)
To: Mikulas Patocka; +Cc: linux-fbdev, dri-devel, Bartlomiej Zolnierkiewicz
On Sat, Aug 25, 2018 at 03:51:00PM -0400, Mikulas Patocka wrote:
> 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.
Makes sense.
Reviewed-by: Ville Syrjälä <syrjala@sci.fi>
>
> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
> Cc: stable@vger.kernel.org
>
> ---
> drivers/video/fbdev/aty/mach64_accel.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> Index: linux-stable/drivers/video/fbdev/aty/mach64_accel.c
> =================================> --- linux-stable.orig/drivers/video/fbdev/aty/mach64_accel.c 2018-08-24 17:31:21.000000000 +0200
> +++ linux-stable/drivers/video/fbdev/aty/mach64_accel.c 2018-08-24 19:12:40.000000000 +0200
> @@ -345,7 +345,7 @@ void atyfb_imageblit(struct fb_info *inf
> * since Rage 3D IIc we have DP_HOST_TRIPLE_EN bit
> * 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;
> }
>
> @@ -382,7 +382,7 @@ void atyfb_imageblit(struct fb_info *inf
> src_bytes = (((image->width * image->depth) + 7) / 8) * image->height;
>
> /* 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;
> u8 *pbitmapin = (u8*)image->data, *pbitmapout;
> u32 hostdword;
> @@ -415,7 +415,7 @@ void atyfb_imageblit(struct fb_info *inf
> }
> }
> wait_for_fifo(1, par);
> - aty_st_le32(HOST_DATA0, hostdword, par);
> + aty_st_le32(HOST_DATA0, le32_to_cpu(hostdword), par);
> }
> } else {
> u32 *pbitmap, dwords = (src_bytes + 3) / 4;
--
Ville Syrjälä
syrjala@sci.fi
http://www.sci.fi/~syrjala/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/3] mach64: fix display corruption on big endian machines
2018-08-27 12:54 ` Ville Syrjälä
@ 2018-10-08 10:36 ` Bartlomiej Zolnierkiewicz
0 siblings, 0 replies; 3+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2018-10-08 10:36 UTC (permalink / raw)
To: Ville Syrjälä; +Cc: linux-fbdev, Mikulas Patocka, dri-devel
On 08/27/2018 02:54 PM, Ville Syrj채l채 wrote:
> On Sat, Aug 25, 2018 at 03:51:00PM -0400, Mikulas Patocka wrote:
>> 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.
>
> Makes sense.
> Reviewed-by: Ville Syrj채l채 <syrjala@sci.fi>
Patch queued for 4.20, thanks.
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-10-08 10:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-25 19:51 [PATCH 1/3] mach64: fix display corruption on big endian machines Mikulas Patocka
2018-08-27 12:54 ` Ville Syrjälä
2018-10-08 10:36 ` Bartlomiej Zolnierkiewicz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).