From patchwork Fri Feb 1 23:06:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tom Gall X-Patchwork-Id: 14413 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 CC95123F8B for ; Fri, 1 Feb 2013 23:06:58 +0000 (UTC) Received: from mail-vb0-f54.google.com (mail-vb0-f54.google.com [209.85.212.54]) by fiordland.canonical.com (Postfix) with ESMTP id 6B391A19414 for ; Fri, 1 Feb 2013 23:06:58 +0000 (UTC) Received: by mail-vb0-f54.google.com with SMTP id l1so2779016vba.13 for ; Fri, 01 Feb 2013 15:06:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:mime-version:content-type :content-transfer-encoding:x-gm-message-state; bh=NSnYVcU3k2LSIgOM8UzPgQ0q8OzaVl9ONnJom289mX8=; b=KyNaIZitMnV8acVdb1bwfAOb02onAqlB4eu7Y8oWOY+iWDqZlLxZ0GMMk/YaLOqIA9 wiH0dAvvqfmdHCdJaybWe2mpWLxlSt2Sk3XJ3O3MVMxXzs/b0KPGZGXj7W5TQNjjwPEB fpCo+YXv0ZH/1OekI/5g8zkLvktUrwAVfXth/u2QWtHtJiFdgfpkHnZrnyJbZKI1rAhd Ued0sUoGrxe1URMKQ68NPb8m80iI0QrxBIdEPakgFTEFUZldhgaSZ7FdliSSqM1l3Vdt Q4ATMbuGgrj+8AuDh5r4PROLSNW2VjmdL5xbemRzOCIh2NQT4aWpeCIc2e08HusLpzBt Saxg== X-Received: by 10.52.21.146 with SMTP id v18mr11158394vde.79.1359760017791; Fri, 01 Feb 2013 15:06:57 -0800 (PST) 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.58.252.8 with SMTP id zo8csp140893vec; Fri, 1 Feb 2013 15:06:57 -0800 (PST) X-Received: by 10.50.207.70 with SMTP id lu6mr274933igc.50.1359760016987; Fri, 01 Feb 2013 15:06:56 -0800 (PST) Received: from mail-ie0-x230.google.com (mail-ie0-x230.google.com [2607:f8b0:4001:c03::230]) by mx.google.com with ESMTPS id x4si2987340igc.35.2013.02.01.15.06.56 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 01 Feb 2013 15:06:56 -0800 (PST) Received-SPF: neutral (google.com: 2607:f8b0:4001:c03::230 is neither permitted nor denied by best guess record for domain of tom.gall@linaro.org) client-ip=2607:f8b0:4001:c03::230; Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:4001:c03::230 is neither permitted nor denied by best guess record for domain of tom.gall@linaro.org) smtp.mail=tom.gall@linaro.org Received: by mail-ie0-f176.google.com with SMTP id k13so2179137iea.7 for ; Fri, 01 Feb 2013 15:06:56 -0800 (PST) X-Received: by 10.50.149.132 with SMTP id ua4mr294517igb.18.1359760016713; Fri, 01 Feb 2013 15:06:56 -0800 (PST) Received: from mars.mantorvilleexpress.com ([70.35.96.184]) by mx.google.com with ESMTPS id px5sm4909818igc.0.2013.02.01.15.06.54 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 01 Feb 2013 15:06:55 -0800 (PST) From: Tom Gall To: piglit@lists.freedesktop.org Cc: patches@linaro.org, Tom Gall Subject: =?UTF-8?q?=5BPATCH=203/7=5D=20Android=3A=20Add=20Adrian=20M=20Negreanu=27s=20initial=20android=20support?= Date: Fri, 1 Feb 2013 17:06:35 -0600 Message-Id: <1359759999-31064-3-git-send-email-tom.gall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1359759999-31064-1-git-send-email-tom.gall@linaro.org> References: <1359759999-31064-1-git-send-email-tom.gall@linaro.org> MIME-Version: 1.0 X-Gm-Message-State: ALoCoQmagEsMmzxmnFg8Tvivy5D7scCSXtSojayye0znTLDD+VVbCfPQycpoANsGqWr1jCn+UyVm This are Adrian M Negreanu's changes for piglit to support Android. These are included in this patch series for the purposes of completeness. Signed-off-by: Tom Gall --- .../piglit-framework-gl/piglit_android_framework.c | 86 ++++++++++++++++++++ .../piglit-framework-gl/piglit_android_framework.h | 29 +++++++ .../piglit-framework-gl/piglit_wfl_framework.c | 11 +++ .../piglit-framework-gl/piglit_winsys_framework.c | 5 ++ 4 files changed, 131 insertions(+) create mode 100644 tests/util/piglit-framework-gl/piglit_android_framework.c create mode 100644 tests/util/piglit-framework-gl/piglit_android_framework.h diff --git a/tests/util/piglit-framework-gl/piglit_android_framework.c b/tests/util/piglit-framework-gl/piglit_android_framework.c new file mode 100644 index 0000000..e05bf1f --- /dev/null +++ b/tests/util/piglit-framework-gl/piglit_android_framework.c @@ -0,0 +1,86 @@ +/* + * Copyright © 2012 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include +#include +#include + +#include "piglit-util-gl-common.h" +#include "piglit_android_framework.h" + +static void +enter_event_loop(struct piglit_winsys_framework *winsys_fw) +{ + const struct piglit_gl_test_config *test_config = winsys_fw->wfl_fw.gl_fw.test_config; + + /* FINISHME: Write event loop for Android. + * + * Until we have proper Android support, give the user enough time + * to view the window by sleeping. + */ + sleep(8); +} + +static void +show_window(struct piglit_winsys_framework *winsys_fw) +{ + waffle_window_show(winsys_fw->wfl_fw.window); +} + +static void +destroy(struct piglit_gl_framework *gl_fw) +{ + struct piglit_winsys_framework *winsys_fw= piglit_winsys_framework(gl_fw); + + if (winsys_fw == NULL) + return; + + piglit_winsys_framework_teardown(winsys_fw); + free(winsys_fw); +} + +struct piglit_gl_framework* +piglit_android_framework_create(const struct piglit_gl_test_config *test_config) +{ + struct piglit_winsys_framework *winsys_fw = NULL; + struct piglit_gl_framework *gl_fw = NULL; + bool ok = true; + + winsys_fw = calloc(1, sizeof(*winsys_fw)); + gl_fw = &winsys_fw->wfl_fw.gl_fw; + + ok = piglit_winsys_framework_init(winsys_fw, test_config, + WAFFLE_PLATFORM_ANDROID); + if (!ok) + goto fail; + + winsys_fw->show_window = show_window; + winsys_fw->enter_event_loop = enter_event_loop; + gl_fw->destroy = destroy; + + return gl_fw; + +fail: + destroy(gl_fw); + return NULL; +} diff --git a/tests/util/piglit-framework-gl/piglit_android_framework.h b/tests/util/piglit-framework-gl/piglit_android_framework.h new file mode 100644 index 0000000..d7faf0c --- /dev/null +++ b/tests/util/piglit-framework-gl/piglit_android_framework.h @@ -0,0 +1,29 @@ +/* + * Copyright © 2012 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#pragma once + +#include "piglit_winsys_framework.h" + +struct piglit_gl_framework* +piglit_android_framework_create(const struct piglit_gl_test_config *test_config); diff --git a/tests/util/piglit-framework-gl/piglit_wfl_framework.c b/tests/util/piglit-framework-gl/piglit_wfl_framework.c index 6e59544..cb1f980 100644 --- a/tests/util/piglit-framework-gl/piglit_wfl_framework.c +++ b/tests/util/piglit-framework-gl/piglit_wfl_framework.c @@ -95,6 +95,17 @@ piglit_wfl_framework_choose_platform(void) #endif } + else if (strcmp(env, "android") == 0) { +#ifdef PIGLIT_HAS_ANDROID + return WAFFLE_PLATFORM_ANDROID; +#else + fprintf(stderr, "environment var PIGLIT_PLATFORM=android, " + "but piglit was built without Android support\n"); + piglit_report_result(PIGLIT_FAIL); +#endif + } + + else { fprintf(stderr, "environment var PIGLIT_PLATFORM has bad " "value \"%s\"\n", env); diff --git a/tests/util/piglit-framework-gl/piglit_winsys_framework.c b/tests/util/piglit-framework-gl/piglit_winsys_framework.c index 2564f81..9d1ea80 100644 --- a/tests/util/piglit-framework-gl/piglit_winsys_framework.c +++ b/tests/util/piglit-framework-gl/piglit_winsys_framework.c @@ -32,6 +32,7 @@ #include "piglit_winsys_framework.h" #include "piglit_wl_framework.h" #include "piglit_x11_framework.h" +#include "piglit_android_framework.h" struct piglit_winsys_framework* piglit_winsys_framework(struct piglit_gl_framework *gl_fw) @@ -151,6 +152,10 @@ piglit_winsys_framework_factory(const struct piglit_gl_test_config *test_config) */ case WAFFLE_PLATFORM_WAYLAND: return piglit_wl_framework_create(test_config); +#ifdef PIGLIT_HAS_ANDROID + case WAFFLE_PLATFORM_ANDROID: + return piglit_android_framework_create(test_config); +#endif default: assert(0); return NULL;