All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <syrjala@sci.fi>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Subject: Re: [PATCH 1/3] mach64: fix display corruption on big endian machines
Date: Mon, 27 Aug 2018 12:54:52 +0000	[thread overview]
Message-ID: <20180827125452.GD11867@sci.fi> (raw)
In-Reply-To: <alpine.LRH.2.02.1808251549550.8284@file01.intranet.prod.int.rdu2.redhat.com>

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/

WARNING: multiple messages have this Message-ID (diff)
From: "Ville Syrjälä" <syrjala@sci.fi>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Subject: Re: [PATCH 1/3] mach64: fix display corruption on big endian machines
Date: Mon, 27 Aug 2018 15:54:52 +0300	[thread overview]
Message-ID: <20180827125452.GD11867@sci.fi> (raw)
In-Reply-To: <alpine.LRH.2.02.1808251549550.8284@file01.intranet.prod.int.rdu2.redhat.com>

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/
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2018-08-27 12:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-25 19:51 [PATCH 1/3] mach64: fix display corruption on big endian machines Mikulas Patocka
2018-08-25 19:51 ` Mikulas Patocka
2018-08-27 12:54 ` Ville Syrjälä [this message]
2018-08-27 12:54   ` Ville Syrjälä
2018-10-08 10:36   ` Bartlomiej Zolnierkiewicz
2018-10-08 10:36     ` Bartlomiej Zolnierkiewicz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180827125452.GD11867@sci.fi \
    --to=syrjala@sci.fi \
    --cc=b.zolnierkie@samsung.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=mpatocka@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.