From patchwork Tue May 27 16:28:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 31015 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f70.google.com (mail-oa0-f70.google.com [209.85.219.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EE75F203C3 for ; Tue, 27 May 2014 17:32:26 +0000 (UTC) Received: by mail-oa0-f70.google.com with SMTP id i4sf50271039oah.9 for ; Tue, 27 May 2014 10:32:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=IjFMkkb3BAz3HYiZ2P9iAEKQSaOfrBrJiaCpn0ncSt4=; b=NNGJ46mK4rbUJOhmpobGf1yAP+0IbwnUaUmIM1DXg70KPTJs4KPXFfkPveugBjahDH H2peT2O6WHk5I9Lor7oeCxZubXPKZx5pjLG32kaXiPuX7e1BlIj2mMz2X3lHcMssA6r9 Qedpk6qW+CtMChjMrD4JgxJx9KQRMJJWCY/QTcM0nHRLarxBS7YSXqs6CjIFZdY4Waup rkbY2udtizZfww9PRS2/6M0ADm8/5DwMZ2ezPJibhbNOa15k25sQjADAxjLIkWPUP6Lv 400F39uoPxebKoZTKbrKXG/zn54lrEEGyKZhlqkXiWfo+Ykg7zOHzggkYgxXW2SeznJN G44w== X-Gm-Message-State: ALoCoQmquUwxhK67FEnsc2589uj7t1L3sx0ujZbN19Wr9NFAGGn0U7wv1af37W57o4/U2V8KVFRS X-Received: by 10.182.241.9 with SMTP id we9mr14512909obc.22.1401211946336; Tue, 27 May 2014 10:32:26 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.86.100 with SMTP id o91ls3167989qgd.30.gmail; Tue, 27 May 2014 10:32:26 -0700 (PDT) X-Received: by 10.58.24.231 with SMTP id x7mr2313334vef.71.1401211946190; Tue, 27 May 2014 10:32:26 -0700 (PDT) Received: from mail-ve0-f169.google.com (mail-ve0-f169.google.com [209.85.128.169]) by mx.google.com with ESMTPS id vy2si8595016vcb.73.2014.05.27.10.32.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 27 May 2014 10:32:26 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.169 as permitted sender) client-ip=209.85.128.169; Received: by mail-ve0-f169.google.com with SMTP id jx11so11315859veb.28 for ; Tue, 27 May 2014 10:32:26 -0700 (PDT) X-Received: by 10.58.186.207 with SMTP id fm15mr28898895vec.4.1401211946125; Tue, 27 May 2014 10:32:26 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp137069vcb; Tue, 27 May 2014 10:32:25 -0700 (PDT) X-Received: by 10.140.42.12 with SMTP id b12mr41705267qga.109.1401211944724; Tue, 27 May 2014 10:32:24 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 10si18471757qav.9.2014.05.27.10.32.24 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 27 May 2014 10:32:24 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:36584 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WpKOD-0000md-St for patch@linaro.org; Tue, 27 May 2014 12:38:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41627) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WpKF9-0003Id-UP for qemu-devel@nongnu.org; Tue, 27 May 2014 12:28:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WpKF8-0002tU-QH for qemu-devel@nongnu.org; Tue, 27 May 2014 12:28:51 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:48252) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WpKF8-0002lf-KO for qemu-devel@nongnu.org; Tue, 27 May 2014 12:28:50 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1WpKEs-0005pw-CG; Tue, 27 May 2014 17:28:34 +0100 From: Peter Maydell To: Anthony Liguori Date: Tue, 27 May 2014 17:28:10 +0100 Message-Id: <1401208114-22404-3-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1401208114-22404-1-git-send-email-peter.maydell@linaro.org> References: <1401208114-22404-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Cc: qemu-devel@nongnu.org Subject: [Qemu-devel] [PULL 02/26] hw/display/pxa2xx_lcd: Fix 16bpp+alpha and 18bpp+alpha palette formats X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.169 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 The pxa2xx palette entry "16bpp plus transparency" format is xxxxxxxTRRRRR000GGGGGG00BBBBB000, and "18bpp plus transparency" is xxxxxxxTRRRRRR00GGGGGG00BBBBBB00. Correct errors in the code for reading these and converting them to the internal format. In particular, the buggy code was attempting to mask out bit 24 of a uint16_t, which Coverity spotted as an error. Reviewed-by: Peter Crosthwaite Signed-off-by: Peter Maydell Message-id: 1400233901-31785-1-git-send-email-peter.maydell@linaro.org --- hw/display/pxa2xx_lcd.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/hw/display/pxa2xx_lcd.c b/hw/display/pxa2xx_lcd.c index 80edb70..611fb17 100644 --- a/hw/display/pxa2xx_lcd.c +++ b/hw/display/pxa2xx_lcd.c @@ -620,24 +620,24 @@ static void pxa2xx_palette_parse(PXA2xxLCDState *s, int ch, int bpp) src += 2; break; case 1: /* 16 bpp plus transparency */ - alpha = *(uint16_t *) src & (1 << 24); + alpha = *(uint32_t *) src & (1 << 24); if (s->control[0] & LCCR0_CMS) - r = g = b = *(uint16_t *) src & 0xff; + r = g = b = *(uint32_t *) src & 0xff; else { - r = (*(uint16_t *) src & 0xf800) >> 8; - g = (*(uint16_t *) src & 0x07e0) >> 3; - b = (*(uint16_t *) src & 0x001f) << 3; + r = (*(uint32_t *) src & 0xf80000) >> 16; + g = (*(uint32_t *) src & 0x00fc00) >> 8; + b = (*(uint32_t *) src & 0x0000f8); } - src += 2; + src += 4; break; case 2: /* 18 bpp plus transparency */ alpha = *(uint32_t *) src & (1 << 24); if (s->control[0] & LCCR0_CMS) r = g = b = *(uint32_t *) src & 0xff; else { - r = (*(uint32_t *) src & 0xf80000) >> 16; + r = (*(uint32_t *) src & 0xfc0000) >> 16; g = (*(uint32_t *) src & 0x00fc00) >> 8; - b = (*(uint32_t *) src & 0x0000f8); + b = (*(uint32_t *) src & 0x0000fc); } src += 4; break;