From patchwork Tue Jun 19 09:53:10 2012 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: 9450 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 741EA23E55 for ; Tue, 19 Jun 2012 09:53:14 +0000 (UTC) Received: from mail-gg0-f180.google.com (mail-gg0-f180.google.com [209.85.161.180]) by fiordland.canonical.com (Postfix) with ESMTP id 2DBC1A187A8 for ; Tue, 19 Jun 2012 09:53:14 +0000 (UTC) Received: by mail-gg0-f180.google.com with SMTP id f1so4826191ggn.11 for ; Tue, 19 Jun 2012 02:53:14 -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=GOK0pQlE7hDGfwGqoCJkbu273FJYuV3uBqF6NiK2lGA=; b=DeG+bYoRKAatCxT+5JIbNzWeAj+xdOMbEyqLkgjj22hK2Pla2kpKQrOZqPx1yr9/R5 5nSeUcugzMnkNtDYYxowgY/xupaAjb53zyXivdPwF8NAm6Fa3V0H167v3uV9hJb6MUFV 7G7h/Rlx/Hq9YsVlYlTf7xjg6CxfJ7IZCjDVolu5ELc4avtJmsIxagtFIDMKsvm8kYG2 7+yfVI/Z3nkLKzppat7U8DZjP0UYBjE5syzHlXznDSJUpezGnYkj9+Q8UN5gHxiGSfz7 FIJhsOlwMLKYJ+B6A+ux9PNMbADoSW+OM9tW2FfL38FYMCyCM3owi6NkMgwRJg2Keu9p baTw== Received: by 10.42.155.73 with SMTP id t9mr7168669icw.48.1340099593786; Tue, 19 Jun 2012 02:53:13 -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.24.148 with SMTP id v20csp115664ibb; Tue, 19 Jun 2012 02:53:12 -0700 (PDT) Received: by 10.216.198.164 with SMTP id v36mr10793211wen.199.1340099591574; Tue, 19 Jun 2012 02:53:11 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id u49si11538569weh.73.2012.06.19.02.53.11 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 19 Jun 2012 02:53:11 -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 1Sgv7W-0006mo-W4 for ; Tue, 19 Jun 2012 09:53:10 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id E65CBE00AA for ; Tue, 19 Jun 2012 09:53:10 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: glmark2 X-Launchpad-Branch: ~glmark2-dev/glmark2/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 223 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~glmark2-dev/glmark2/trunk] Rev 223: CanvasX11, Doc: Support running in fullscreen mode (--fullscreen). Message-Id: <20120619095310.15926.37538.launchpad@ackee.canonical.com> Date: Tue, 19 Jun 2012 09:53:10 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="15435"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: a4b81b81eb9012c0e95528a5c8c0a7afdd6b577e X-Gm-Message-State: ALoCoQkB896zSQTo4JVPpllCV/KXc79QIjZ+uiFOPtFKGvyAdAr3QCChqB7pRjOOVxUEfEiH4A0o ------------------------------------------------------------ revno: 223 committer: Alexandros Frantzis branch nick: x11-fullscreen timestamp: Fri 2012-06-15 12:03:04 +0300 message: CanvasX11,Doc: Support running in fullscreen mode (--fullscreen). modified: README.android doc/glmark2.1.in src/canvas-x11.cpp src/canvas-x11.h src/options.cpp --- lp:glmark2 https://code.launchpad.net/~glmark2-dev/glmark2/trunk You are subscribed to branch lp:glmark2. To unsubscribe from this branch go to https://code.launchpad.net/~glmark2-dev/glmark2/trunk/+edit-subscription === modified file 'README.android' --- README.android 2012-05-15 13:10:28 +0000 +++ README.android 2012-06-15 09:03:04 +0000 @@ -36,6 +36,7 @@ --frame-end --off-screen --reuse-context +--fullscreen -l,--list-scenes The default visual config used on Android is: === modified file 'doc/glmark2.1.in' --- doc/glmark2.1.in 2012-05-24 10:11:54 +0000 +++ doc/glmark2.1.in 2012-06-15 09:03:04 +0000 @@ -39,6 +39,9 @@ \fB\-s\fR, \fB\-\-size\fR WxH Size of the output window (default: 800x600) .TP +\fB\-\-fullscreen\fR +Run in fullscreen mode (equivalent to --size -1x-1) +.TP \fB\-l\fR, \fB\-\-list\-scenes\fR Display information about the available scenes and their options === modified file 'src/canvas-x11.cpp' --- src/canvas-x11.cpp 2012-05-11 11:02:37 +0000 +++ src/canvas-x11.cpp 2012-06-15 09:03:04 +0000 @@ -26,6 +26,7 @@ #include "util.h" #include +#include #include #include @@ -232,6 +233,8 @@ bool CanvasX11::ensure_x_window() { + static const char *win_name("glmark2 "GLMARK_VERSION); + if (xwin_) return true; @@ -272,19 +275,28 @@ } /* set hints and properties */ - { - static const char *name("glmark2 "GLMARK_VERSION); + if (fullscreen_) { + Atom atom = XInternAtom(xdpy_, "_NET_WM_STATE_FULLSCREEN", True); + XChangeProperty(xdpy_, xwin_, + XInternAtom(xdpy_, "_NET_WM_STATE", True), + XA_ATOM, 32, PropModeReplace, + reinterpret_cast(&atom), 1); + } + else { XSizeHints sizehints; sizehints.min_width = width_; sizehints.min_height = height_; sizehints.max_width = width_; sizehints.max_height = height_; sizehints.flags = PMaxSize | PMinSize; - XSetNormalHints(xdpy_, xwin_, &sizehints); - XSetStandardProperties(xdpy_, xwin_, name, name, - None, NULL, 0, &sizehints); + + XSetWMProperties(xdpy_, xwin_, NULL, NULL, + NULL, 0, &sizehints, NULL, NULL); } + /* Set the window name */ + XStoreName(xdpy_ , xwin_, win_name); + /* Gracefully handle Window Delete event from window manager */ Atom wmDelete = XInternAtom(xdpy_, "WM_DELETE_WINDOW", True); XSetWMProtocols(xdpy_, xwin_, &wmDelete, 1); @@ -295,19 +307,36 @@ void CanvasX11::resize_no_viewport(int width, int height) { + bool request_fullscreen = (width == -1 || height == -1); + /* Recreate an existing window only if it has actually been resized */ if (xwin_) { - if (width_ != width || height_ != height) { + if (width_ != width || height_ != height || + fullscreen_ != request_fullscreen) + { XDestroyWindow(xdpy_, xwin_); xwin_ = 0; } - else { + else + { return; } } - width_ = width; - height_ = height; + fullscreen_ = request_fullscreen; + + if (fullscreen_) { + /* Get the screen (root window) size */ + XWindowAttributes window_attr; + XGetWindowAttributes(xdpy_, RootWindow(xdpy_, DefaultScreen(xdpy_)), + &window_attr); + width_ = window_attr.width; + height_ = window_attr.height; + } + else { + width_ = width; + height_ = height; + } if (!ensure_x_window()) Log::error("Error: Couldn't create X Window!\n"); === modified file 'src/canvas-x11.h' --- src/canvas-x11.h 2012-05-11 11:02:37 +0000 +++ src/canvas-x11.h 2012-06-15 09:03:04 +0000 @@ -48,7 +48,7 @@ protected: CanvasX11(int width, int height) : - Canvas(width, height), xwin_(0), xdpy_(0), + Canvas(width, height), xwin_(0), xdpy_(0), fullscreen_(false), gl_color_format_(0), gl_depth_format_(0), color_renderbuffer_(0), depth_renderbuffer_(0), fbo_(0) {} @@ -120,6 +120,7 @@ const char *get_gl_format_str(GLenum f); + bool fullscreen_; GLenum gl_color_format_; GLenum gl_depth_format_; GLuint color_renderbuffer_; === modified file 'src/options.cpp' --- src/options.cpp 2012-05-10 09:18:53 +0000 +++ src/options.cpp 2012-06-15 09:03:04 +0000 @@ -56,6 +56,7 @@ {"reuse-context", 0, 0, 0}, {"run-forever", 0, 0, 0}, {"size", 1, 0, 0}, + {"fullscreen", 0, 0, 0}, {"list-scenes", 0, 0, 0}, {"show-all-options", 0, 0, 0}, {"debug", 0, 0, 0}, @@ -133,6 +134,7 @@ " --reuse-context Use a single context for all scenes\n" " (by default, each scene gets its own context)\n" " -s, --size WxH Size of the output window (default: 800x600)\n" + " --fullscreen Run in fullscreen mode (equivalent to --size -1x-1)\n" " -l, --list-scenes Display information about the available scenes\n" " and their options\n" " --show-all-options Show all scene option values used for benchmarks\n" @@ -181,6 +183,8 @@ Options::reuse_context = true; else if (c == 's' || !strcmp(optname, "size")) parse_size(optarg, Options::size); + else if (!strcmp(optname, "fullscreen")) + Options::size = std::pair(-1, -1); else if (c == 'l' || !strcmp(optname, "list-scenes")) Options::list_scenes = true; else if (!strcmp(optname, "show-all-options"))