From patchwork Mon Aug 10 10:12:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yalin wang X-Patchwork-Id: 6982111 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 378E49F358 for ; Mon, 10 Aug 2015 10:13:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4B0C62035B for ; Mon, 10 Aug 2015 10:13:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6D03F2034F for ; Mon, 10 Aug 2015 10:13:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933406AbbHJKM7 (ORCPT ); Mon, 10 Aug 2015 06:12:59 -0400 Received: from mail-pa0-f53.google.com ([209.85.220.53]:36180 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932859AbbHJKM4 convert rfc822-to-8bit (ORCPT ); Mon, 10 Aug 2015 06:12:56 -0400 Received: by pacrr5 with SMTP id rr5so100851968pac.3; Mon, 10 Aug 2015 03:12:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-type:content-transfer-encoding:subject:message-id:date :to:mime-version; bh=as9A6zGxVmzzmJM3wVXk9jSLBQwATGWOxuyMvbZho8w=; b=bBMwOrWxBnPNTfS2iNslWiIFM7bdPJg+pnb0JzpMaON9EVkeF/dpE1ihIDw9kpwMge NOd722GLommgXV0tUtOLgNEyEhHFyC9RMtyP6TM2RrxCB9aGlxq0640srzfdOL3o239M tGF/wSATQUhyThJRWOCpmgEIyXvkf4NyZnvkyXd6wcybLuJDaYx4o6aQ4vGCXb+AqANV k/v1+5ok0oyfuXZVFv7XXMvfDhja5ZyNNWT1cpqFfkFp0n+KDqSt47uMGX/Tv4fG2CtS IxiTshzgjHZ5UVlB7I0c50ji+5Wl5ZA8h9E5OIx3z8Ejkd+ocOeMvBWWMpKU1w5p4vjl h+Pw== X-Received: by 10.68.108.101 with SMTP id hj5mr42339164pbb.156.1439201575651; Mon, 10 Aug 2015 03:12:55 -0700 (PDT) Received: from [17.87.29.244] ([17.87.29.244]) by smtp.gmail.com with ESMTPSA id gh5sm19029664pbc.87.2015.08.10.03.12.52 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Aug 2015 03:12:55 -0700 (PDT) From: yalin wang Subject: [RFC] fbdev/riva:change to use generice function to implement reverse_order() Message-Id: Date: Mon, 10 Aug 2015 18:12:50 +0800 To: adaplas@gmail.com, plagnioj@jcrosoft.com, tomi.valkeinen@ti.com, linux-fbdev@vger.kernel.org, open list Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2098\)) X-Mailer: Apple Mail (2.2098) Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This change to use swab32(bitrev32()) to implement reverse_order() function, have better performance on some platforms. Signed-off-by: yalin wang --- drivers/video/fbdev/riva/fbdev.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/drivers/video/fbdev/riva/fbdev.c b/drivers/video/fbdev/riva/fbdev.c index f1ad274..4803901 100644 --- a/drivers/video/fbdev/riva/fbdev.c +++ b/drivers/video/fbdev/riva/fbdev.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #ifdef CONFIG_PMAC_BACKLIGHT #include @@ -84,6 +85,7 @@ #define SetBit(n) (1<<(n)) #define Set8Bits(value) ((value)&0xff) +#define reverse_order(v) swab32(bitrev32(v)) /* HW cursor parameters */ #define MAX_CURS 32 @@ -451,15 +453,6 @@ static inline unsigned char MISCin(struct riva_par *par) return (VGA_RD08(par->riva.PVIO, 0x3cc)); } -static inline void reverse_order(u32 *l) -{ - u8 *a = (u8 *)l; - a[0] = bitrev8(a[0]); - a[1] = bitrev8(a[1]); - a[2] = bitrev8(a[2]); - a[3] = bitrev8(a[3]); -} - /* ------------------------------------------------------------------------- * * * cursor stuff @@ -497,8 +490,8 @@ static void rivafb_load_cursor_image(struct riva_par *par, u8 *data8, for (i = 0; i < h; i++) { b = *data++; - reverse_order(&b); - + b = reverse_order(b); + for (j = 0; j < w/2; j++) { tmp = 0; #if defined (__BIG_ENDIAN) @@ -1545,7 +1538,7 @@ static void rivafb_imageblit(struct fb_info *info, for (i = 0; i < 16; i++) { tmp = *((u32 *)cdat); cdat = (u8 *)((u32 *)cdat + 1); - reverse_order(&tmp); + tmp = reverse_order(tmp); NV_WR32(d, i*4, tmp); } size -= 16; @@ -1555,7 +1548,7 @@ static void rivafb_imageblit(struct fb_info *info, for (i = 0; i < size; i++) { tmp = *((u32 *) cdat); cdat = (u8 *)((u32 *)cdat + 1); - reverse_order(&tmp); + tmp = reverse_order(tmp); NV_WR32(d, i*4, tmp); } }