From patchwork Thu May 8 18:46:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 29851 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f72.google.com (mail-oa0-f72.google.com [209.85.219.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4B1FD202DD for ; Thu, 8 May 2014 18:47:04 +0000 (UTC) Received: by mail-oa0-f72.google.com with SMTP id l6sf14418989oag.7 for ; Thu, 08 May 2014 11:47:03 -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:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=NBCI0Kud5glsXeEZIocQ9LM+xMympkmqM+7HdU0iRCc=; b=babon2ocAtmW7Q0sjXdfjvPdtGIFZ49WFghsvGVEIdJisfFNG9s9ZGWOyTy0tJqAgx h8iG9T9UUT2dDUq/0PhdSlHxweyscqvg0Caa/H0yqrZ4PzwMQw58woPPfkkKihWphcJi /plKwEBX6gqnfazAUxcqVXz+nTNNIdjbTRV6ukx4J/SJfMPhGEBbdCwBarsBdwzWOfAx 6952t4UWetQK+0evLu9MwBC8jY+qKL4byMWwU8UWK0o/SQ3JjIOo/D7Gda4aI+zP4aWp LnukbHfBkmr4+CzMKibfgiIHmvUmWtnihcwAHw6ILmv7b5LWJS/w+T1lft/8cxeF8JIv Rt4A== X-Gm-Message-State: ALoCoQmcCOZQZc2j3adsWOG1AlhhayBP08gxNIUkr4Yeh+3bqGb3gt2RvYvZLFZPXj6HGt4QWFh5 X-Received: by 10.42.39.210 with SMTP id i18mr2333441ice.19.1399574823270; Thu, 08 May 2014 11:47:03 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.102.87 with SMTP id v81ls4410438qge.0.gmail; Thu, 08 May 2014 11:47:03 -0700 (PDT) X-Received: by 10.58.201.5 with SMTP id jw5mr4285188vec.6.1399574823121; Thu, 08 May 2014 11:47:03 -0700 (PDT) Received: from mail-ve0-f174.google.com (mail-ve0-f174.google.com [209.85.128.174]) by mx.google.com with ESMTPS id ie18si314980vec.175.2014.05.08.11.47.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 08 May 2014 11:47:03 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.128.174; Received: by mail-ve0-f174.google.com with SMTP id jw12so3837723veb.33 for ; Thu, 08 May 2014 11:47:03 -0700 (PDT) X-Received: by 10.58.13.104 with SMTP id g8mr4321158vec.16.1399574822942; Thu, 08 May 2014 11:47:02 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp17013vcb; Thu, 8 May 2014 11:47:02 -0700 (PDT) X-Received: by 10.112.50.2 with SMTP id y2mr3339382lbn.66.1399574821963; Thu, 08 May 2014 11:47:01 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id og9si1239907lbb.45.2014.05.08.11.47.01 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 08 May 2014 11:47:01 -0700 (PDT) Received-SPF: none (google.com: pm215@archaic.org.uk does not designate permitted sender hosts) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1WiTLO-00052j-OY; Thu, 08 May 2014 19:46:58 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Peter Crosthwaite Subject: [PATCH 3/8] hw/display/pxa2xx_lcd: Fix 16bpp+alpha and 18bpp+alpha palette formats Date: Thu, 8 May 2014 19:46:53 +0100 Message-Id: <1399574818-19349-4-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1399574818-19349-1-git-send-email-peter.maydell@linaro.org> References: <1399574818-19349-1-git-send-email-peter.maydell@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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. Signed-off-by: Peter Maydell --- hw/display/pxa2xx_lcd.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/display/pxa2xx_lcd.c b/hw/display/pxa2xx_lcd.c index 09cdf17..fce013d 100644 --- a/hw/display/pxa2xx_lcd.c +++ b/hw/display/pxa2xx_lcd.c @@ -620,13 +620,13 @@ 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 & 0x7c0000) >> 15; + g = (*(uint32_t *) src & 0x00fc00) >> 8; + b = (*(uint32_t *) src & 0x0000f8); } src += 2; break; @@ -635,9 +635,9 @@ static void pxa2xx_palette_parse(PXA2xxLCDState *s, int ch, int bpp) 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;