From patchwork Tue Jul 19 16:02:24 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: alexandros.frantzis@linaro.org X-Patchwork-Id: 2765 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id CCD0623F3F for ; Tue, 19 Jul 2011 16:02:28 +0000 (UTC) Received: from mail-qy0-f173.google.com (mail-qy0-f173.google.com [209.85.216.173]) by fiordland.canonical.com (Postfix) with ESMTP id 92C11A18308 for ; Tue, 19 Jul 2011 16:02:28 +0000 (UTC) Received: by qyk10 with SMTP id 10so2651743qyk.11 for ; Tue, 19 Jul 2011 09:02:28 -0700 (PDT) Received: by 10.229.68.200 with SMTP id w8mr6507184qci.114.1311091346815; Tue, 19 Jul 2011 09:02:26 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.229.217.78 with SMTP id hl14cs88149qcb; Tue, 19 Jul 2011 09:02:26 -0700 (PDT) Received: by 10.227.42.34 with SMTP id q34mr5048136wbe.83.1311091344777; Tue, 19 Jul 2011 09:02:24 -0700 (PDT) Received: from adelie.canonical.com (adelie.canonical.com [91.189.90.139]) by mx.google.com with ESMTP id 16si10151852wbx.1.2011.07.19.09.02.24; Tue, 19 Jul 2011 09:02:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.139 as permitted sender) client-ip=91.189.90.139; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.139 as permitted sender) smtp.mail=bounces@canonical.com Received: from loganberry.canonical.com ([91.189.90.37]) by adelie.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1QjCka-0006do-5a for ; Tue, 19 Jul 2011 16:02:24 +0000 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id 263A22E8060 for ; Tue, 19 Jul 2011 16:02:24 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: glcompbench X-Launchpad-Branch: ~glcompbench-dev/glcompbench/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 51 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~glcompbench-dev/glcompbench/trunk] Rev 51: Support source pixmaps of any format for pixman compositing. Message-Id: <20110719160224.10139.89213.launchpad@loganberry.canonical.com> Date: Tue, 19 Jul 2011 16:02:24 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="13405"; Instance="initZopeless config overlay" X-Launchpad-Hash: 68b1fe39e83096569e22fbf7dda3c84c4460e696 ------------------------------------------------------------ revno: 51 committer: Alexandros Frantzis branch nick: trunk timestamp: Tue 2011-07-19 19:01:23 +0300 message: Support source pixmaps of any format for pixman compositing. modified: src/composite-window-pixman.cc --- lp:glcompbench https://code.launchpad.net/~glcompbench-dev/glcompbench/trunk You are subscribed to branch lp:glcompbench. To unsubscribe from this branch go to https://code.launchpad.net/~glcompbench-dev/glcompbench/trunk/+edit-subscription === modified file 'src/composite-window-pixman.cc' --- src/composite-window-pixman.cc 2011-07-18 16:26:56 +0000 +++ src/composite-window-pixman.cc 2011-07-19 16:01:23 +0000 @@ -146,17 +146,34 @@ return true; } +static unsigned int +count_bits(unsigned long n) +{ + unsigned int c; + for (c = 0; n; c++) + n &= n - 1; + return c; +} + bool CompositeWindowPixman::ensure_pixman_image() { if (pixman_image_) return true; + unsigned int red_bits = count_bits(ximage_->red_mask); + unsigned int green_bits = count_bits(ximage_->green_mask); + unsigned int blue_bits = count_bits(ximage_->blue_mask); + unsigned int alpha_bits = ximage_->depth - (red_bits + green_bits + blue_bits); + pixman_format_code_t format = static_cast( - PIXMAN_FORMAT(ximage_->bits_per_pixel, - PIXMAN_TYPE_ARGB, - ximage_->depth - 24, 8, 8, 8)); + PIXMAN_FORMAT(ximage_->bits_per_pixel, + PIXMAN_TYPE_ARGB, + alpha_bits, red_bits, green_bits, blue_bits)); + + Log::debug("Creating pixman image with bpp: %u format: a%ur%ug%ub%u\n", + ximage_->bits_per_pixel, alpha_bits, red_bits, green_bits, blue_bits); if (!pixman_format_supported_source(format)) { Log::debug("Source pixmap format is not supported by pixman!"); @@ -164,7 +181,7 @@ else { pixman_image_ = pixman_image_create_bits(format, width_, height_, reinterpret_cast(ximage_->data), - width_ * 4); + ximage_->bytes_per_line); } return pixman_image_ != 0;