Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3011106imu; Mon, 19 Nov 2018 09:19:28 -0800 (PST) X-Google-Smtp-Source: AJdET5e03RYyQ+UcK5UXE+jcFeC5s1xT+nAcsps5iC/Msj4a23HFTYdji55PhDDDU9mC41KMVVsN X-Received: by 2002:a63:ba19:: with SMTP id k25mr20861601pgf.194.1542647968327; Mon, 19 Nov 2018 09:19:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542647968; cv=none; d=google.com; s=arc-20160816; b=PWBf2Pqp5SgzO06MMuF/p4hG/ZommkYMCNZRiq4bpIn2mDjZhUvK9KGOaAiHHRyNOi ndIkozydHd14Tswr10GcRvGmmyEUTqowiDzM23dg4ZSlHTXth9Rz1yvLkhLH9upDyB4T WN3q6JQCgEOUZUirXvN+C8q4Ql3LloCE1wnYxIoXfAvpEXnBViDwwFr3sJxwsg85P/9C PceFD2bYctCYfe0481hTF1uXJnNb9uc7sCzGpMONelIlDB9bNK/+Ohe1E+aRZc45LxuR vcj/z93iYm41626UjAcNvJTKv7858NU1QDCDBM+nxnVi1d8ZauUmW+tUNeGXl95Lmlay c5kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1aqGV8468R6eyHYNkiVUvGrjYzcLm9Y3iP8ZEnyQy7c=; b=QmY9Sei8UmWsrs0uSyhiOoXpeT1Guzz5n2hMiNDkaGIOkHHv91vnnnUTjz7ZpoUB9U RhZ1iQcEUIxp2SDfc7cdgS9ygeH+PAHubc9ul50WnD/Au1xW0ujJPSTf3dczx2WQRJay yvmoRmqJnGixra2c9M9KFy/Z3WKEvz5QMzgVAqkLgf8kxvNBvPpGHCrhBinZ0tq96JjW nBiKfez+7Dd0KEK3LB7S2i7d9Hni+KcYlsUwmz5zUioh1ax2D/I7+nLSzKKiQuto39Cp hbkGzxQ7zYMWl3iG1+l/MKLCNznI70g7CdFUSS4hb3xHxUXEBdsMTYdxu4LQV6eWS8Bv O8xA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lE+yBIQ1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c2-v6si41400149plb.123.2018.11.19.09.19.13; Mon, 19 Nov 2018 09:19:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lE+yBIQ1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405640AbeKTDZl (ORCPT + 99 others); Mon, 19 Nov 2018 22:25:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:38896 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404648AbeKTDZk (ORCPT ); Mon, 19 Nov 2018 22:25:40 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2FE2A223CB; Mon, 19 Nov 2018 17:01:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542646883; bh=SVhDpaQrpxUWgKBurBTs68azfHHhucWte0d0WJ2IPdk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lE+yBIQ120hbkMSzB+P3Cixzi1SGJ3m2F1PYjputKC11bs6Tk0q+nCcIZSnmwqX6w oOZBMDN2KyGhMiC13Bu/MNSpl7vJokj2mJVY3J5c8HK4keYhVfwUC/tinwVHkB8G8k NSot39NHYJxaZbqjFWqOkIv/gumpORzcIsJ3fPgc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikulas Patocka , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Bartlomiej Zolnierkiewicz Subject: [PATCH 4.4 127/160] mach64: fix display corruption on big endian machines Date: Mon, 19 Nov 2018 17:29:26 +0100 Message-Id: <20181119162642.751856898@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181119162630.031306128@linuxfoundation.org> References: <20181119162630.031306128@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mikulas Patocka commit 3c6c6a7878d00a3ac997a779c5b9861ff25dfcc8 upstream. 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 Reviewed-by: Ville Syrjälä Cc: stable@vger.kernel.org Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/video/fbdev/aty/mach64_accel.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/video/fbdev/aty/mach64_accel.c +++ b/drivers/video/fbdev/aty/mach64_accel.c @@ -344,7 +344,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; } @@ -381,7 +381,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; @@ -414,7 +414,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;