From patchwork Tue Apr 17 16:30:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Barker X-Patchwork-Id: 7906 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 2614E23E12 for ; Tue, 17 Apr 2012 16:30:20 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id C021EA18172 for ; Tue, 17 Apr 2012 16:30:19 +0000 (UTC) Received: by iage36 with SMTP id e36so12501660iag.11 for ; Tue, 17 Apr 2012 09:30:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf :content-type:mime-version:x-launchpad-project:x-launchpad-branch :x-launchpad-message-rationale:x-launchpad-branch-revision-number :x-launchpad-notification-type:to:from:subject:message-id:date :reply-to:sender:errors-to:precedence:x-generated-by :x-launchpad-hash:x-gm-message-state; bh=tO5Aq4LVvnVJlNhkDdbORqYt1YJ3WMHN8k4Gq9WVpic=; b=k9uCBt5JxtFTm/qkkG3quDXU6CU3j9gGbq37UkuXV0yo2NvUMqO0ZaVVwuhfO5flqt eIpA552xlFgwcpeXmoDRIrikjD5uyjiFEM8BlpWZt/HnhEUCNFmQoENHni9KyKv4dyfO dRatU8+T/kdRlJhdYao3OvLMnl1aGILTyD+J7yL6gqOJITbdrAYmCzN2EWDiHLu85OL9 OlhXA6KzDJUu4Jjj708aukzQyR/GxBymlpwSspT/X9x1SBuhU03EW8udODhizYDDPadd WLfJo1rbyx5Amg8SXNKuoAPjVkt2jc/rY16PTESqs2km24X+mjDVmtxyvpIAMaKAzMO7 ACfA== Received: by 10.50.194.163 with SMTP id hx3mr10123107igc.49.1334680219104; Tue, 17 Apr 2012 09:30:19 -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.231.137.198 with SMTP id x6csp159314ibt; Tue, 17 Apr 2012 09:30:18 -0700 (PDT) Received: by 10.180.104.137 with SMTP id ge9mr29774496wib.20.1334680217378; Tue, 17 Apr 2012 09:30:17 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id f5si12880931wie.8.2012.04.17.09.30.16 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 17 Apr 2012 09:30:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) smtp.mail=bounces@canonical.com Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1SKBIG-0002B0-Rf for ; Tue, 17 Apr 2012 16:30:16 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id BB22DE012D for ; Tue, 17 Apr 2012 16:30:16 +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: 80 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~glcompbench-dev/glcompbench/trunk] Rev 80: Blur: Update the render object handling to support the addition of managed Message-Id: <20120417163016.28717.54835.launchpad@ackee.canonical.com> Date: Tue, 17 Apr 2012 16:30:16 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="15099"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: b9b6dfbd930f9f6264a17f4ca5d9a412f7c9a6a8 X-Gm-Message-State: ALoCoQllLoewuyF3oxduhOZFSUB6sBaU060yzyg3uypnW6w2x0Go5VaMveKwBlIUgVOnchKikLoF Merge authors: Jesse Barker (jesse-barker) Related merge proposals: https://code.launchpad.net/~glcompbench-dev/glcompbench/blur-update/+merge/99368 proposed by: Jesse Barker (jesse-barker) review: Approve - Alexandros Frantzis (afrantzis) ------------------------------------------------------------ revno: 80 [merge] committer: Jesse Barker branch nick: trunk timestamp: Tue 2012-04-17 09:27:49 -0700 message: Blur: Update the render object handling to support the addition of managed windows after initial set up (including between iterations). modified: src/composite-test-simple-blur.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-test-simple-blur.cc' --- src/composite-test-simple-blur.cc 2012-03-20 16:24:50 +0000 +++ src/composite-test-simple-blur.cc 2012-03-23 21:04:23 +0000 @@ -299,22 +299,29 @@ // Private structure used to avoid contaminating composite-test.h with all of // the CompositeTestSimpleBlur internal classes. // +typedef map BlurWindowMapType; struct BlurPrivate { RenderScreen screen; RenderClearImage desktop; - map windowMap; + BlurWindowMapType windowMap; int screen_width; int screen_height; double lastUpdateTime; float window_scale_factor; + unsigned int passes; + unsigned int radius; + bool separable; BlurPrivate() : desktop(GLCOMPBENCH_DATA_PATH"/background.png"), screen_width(0), screen_height(0), lastUpdateTime(0), - window_scale_factor(0.4) {} + window_scale_factor(0), + passes(0), + radius(0), + separable(false) {} ~BlurPrivate() {} }; @@ -339,7 +346,7 @@ CompositeTestSimpleBlur::~CompositeTestSimpleBlur() { - for (map::iterator winIt = priv_->windowMap.begin(); + for (BlurWindowMapType::iterator winIt = priv_->windowMap.begin(); winIt != priv_->windowMap.end(); winIt++) { @@ -372,9 +379,9 @@ { // See how our options tell us to behave... priv_->window_scale_factor = Util::fromString(options_["window-size"].value); - unsigned int passes(Util::fromString(options_["passes"].value)); - unsigned int radius(Util::fromString(options_["blur-radius"].value)); - bool separable(options_["separable"].value == "true"); + priv_->passes = Util::fromString(options_["passes"].value); + priv_->radius = Util::fromString(options_["blur-radius"].value); + priv_->separable = (options_["separable"].value == "true"); // Ensure we get a transparent clear color for all following operations glClearColor(0.0, 0.0, 0.0, 0.0); @@ -401,7 +408,7 @@ window_size *= priv_->window_scale_factor; clamp_size(window_size); vec2 corner_offset(window_size / 2.0); - RenderWindowBlur* ro = new RenderWindowBlur(passes, radius, separable); + RenderWindowBlur* ro = new RenderWindowBlur(priv_->passes, priv_->radius, priv_->separable); ro->init(program_); ro->set_background(win->get_texture().i); vec2 center(screen_size.x() * (0.5 + 0.25 * cos(i * angular_step)), @@ -448,21 +455,34 @@ { continue; } + vec2 window_size(cw->width(), cw->height()); + window_size *= priv_->window_scale_factor; + clamp_size(window_size); + vec2 corner_offset(window_size / 2.0); + vec2 center(screen_size.x() * (0.5 + 0.25 * cos(i * angular_step)), + screen_size.y() * (0.5 + 0.25 * sin(i * angular_step))); unsigned int winHandle(cw->get_xwindow()); - map::iterator roIt = priv_->windowMap.find(winHandle); + BlurWindowMapType::iterator roIt = priv_->windowMap.find(winHandle); if (roIt == priv_->windowMap.end()) { - Log::debug("Failed to find window 0x%x in window map\n", winHandle); - continue; + // This window either wasn't present during prepare_for_run, or + // when the last draw was triggered, so we'll add a render object + // for it to the map. + RenderWindowBlur* ro = new RenderWindowBlur(priv_->passes, priv_->radius, priv_->separable); + ro->init(program_); + pair retState = + priv_->windowMap.insert(make_pair(cw->get_xwindow(), ro)); + if (!retState.second) + { + // Map insertion failed. This shouldn't happen, but we need to + // check anyway. + Log::error("Failed to insert new render object into window map\n"); + continue; + } + roIt = retState.first; } RenderWindowBlur* ro = roIt->second; ro->refresh_window(cw->get_texture().i); - vec2 window_size(cw->width(), cw->height()); - window_size *= priv_->window_scale_factor; - clamp_size(window_size); - vec2 corner_offset(window_size / 2.0); - vec2 center(screen_size.x() * (0.5 + 0.25 * cos(i * angular_step)), - screen_size.y() * (0.5 + 0.25 * sin(i * angular_step))); ro->position(center - corner_offset); ro->resize(window_size); ro->render_to(priv_->desktop);