Merge lp:~spenser-gilliland/glmark2/mali-fbdev into lp:glmark2/2011.11

Proposed by Spenser Gilliland
Status: Needs review
Proposed branch: lp:~spenser-gilliland/glmark2/mali-fbdev
Merge into: lp:glmark2/2011.11
Diff against target: 352 lines (+236/-9)
7 files modified
src/gl-state-egl.cpp (+5/-2)
src/libmatrix/program.cc (+2/-0)
src/main.cpp (+4/-0)
src/native-state-fbdev.cpp (+145/-0)
src/native-state-fbdev.h (+64/-0)
src/wscript_build (+10/-5)
wscript (+6/-2)
To merge this branch: bzr merge lp:~spenser-gilliland/glmark2/mali-fbdev
Reviewer Review Type Date Requested Status
Jesse Barker Pending
Review via email: mp+182970@code.launchpad.net

Description of the change

These changes add mali support to glmark2.

To post a comment you must log in.

Unmerged revisions

282. By Spenser Gilliland

add Mali GPU support

281. By Spenser Gilliland

do not require gl if using gles version

280. By Spenser Gilliland

GLchar not defined change to char

279. By Wladimir J. van der Laan

Add fbdev-glesv2 flavor

This exercises Mesa with the EGL 'fbdev' platform.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/gl-state-egl.cpp'
--- src/gl-state-egl.cpp 2013-03-04 19:07:07 +0000
+++ src/gl-state-egl.cpp 2013-08-29 17:40:29 +0000
@@ -414,9 +414,12 @@
414{414{
415 if (egl_display_)415 if (egl_display_)
416 return true;416 return true;
417417#ifdef HAS_MALI
418 egl_display_ = eglGetDisplay(EGL_DEFAULT_DISPLAY);
419#else
418 egl_display_ = eglGetDisplay(native_display_);420 egl_display_ = eglGetDisplay(native_display_);
419 if (!egl_display_) {421#endif
422 if (egl_display_ == EGL_NO_DISPLAY) {
420 Log::error("eglGetDisplay() failed with error: 0x%x\n", eglGetError());423 Log::error("eglGetDisplay() failed with error: 0x%x\n", eglGetError());
421 return false;424 return false;
422 }425 }
423426
=== modified file 'src/libmatrix/program.cc'
--- src/libmatrix/program.cc 2012-04-30 16:31:04 +0000
+++ src/libmatrix/program.cc 2013-08-29 17:40:29 +0000
@@ -17,6 +17,8 @@
17#include "gl-if.h"17#include "gl-if.h"
18#include "program.h"18#include "program.h"
1919
20typedef char GLchar;
21
20using std::string;22using std::string;
21using LibMatrix::mat4;23using LibMatrix::mat4;
22using LibMatrix::mat3;24using LibMatrix::mat3;
2325
=== modified file 'src/main.cpp'
--- src/main.cpp 2013-06-21 18:46:01 +0000
+++ src/main.cpp 2013-08-29 17:40:29 +0000
@@ -42,6 +42,8 @@
42#include "native-state-mir.h"42#include "native-state-mir.h"
43#elif GLMARK2_USE_WAYLAND43#elif GLMARK2_USE_WAYLAND
44#include "native-state-wayland.h"44#include "native-state-wayland.h"
45#elif GLMARK2_USE_FBDEV
46#include "native-state-fbdev.h"
45#endif47#endif
4648
47#if GLMARK2_USE_EGL49#if GLMARK2_USE_EGL
@@ -168,6 +170,8 @@
168 NativeStateMir native_state;170 NativeStateMir native_state;
169#elif GLMARK2_USE_WAYLAND171#elif GLMARK2_USE_WAYLAND
170 NativeStateWayland native_state;172 NativeStateWayland native_state;
173#elif GLMARK2_USE_FBDEV
174 NativeStateFBDEV native_state;
171#endif175#endif
172176
173#if GLMARK2_USE_EGL177#if GLMARK2_USE_EGL
174178
=== added file 'src/native-state-fbdev.cpp'
--- src/native-state-fbdev.cpp 1970-01-01 00:00:00 +0000
+++ src/native-state-fbdev.cpp 2013-08-29 17:40:29 +0000
@@ -0,0 +1,145 @@
1/*
2 * Copyright © 2012 Linaro Limited
3 * Copyright © 2013 Canonical Ltd
4 *
5 * This file is part of the glmark2 OpenGL (ES) 2.0 benchmark.
6 *
7 * glmark2 is free software: you can redistribute it and/or modify it under the
8 * terms of the GNU General Public License as published by the Free Software
9 * Foundation, either version 3 of the License, or (at your option) any later
10 * version.
11 *
12 * glmark2 is distributed in the hope that it will be useful, but WITHOUT ANY
13 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
15 * details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * glmark2. If not, see <http://www.gnu.org/licenses/>.
19 *
20 * Authors:
21 * Simon Que
22 * Jesse Barker
23 * Alexandros Frantzis
24 * Wladimir J. van der Laan
25 */
26#include "native-state-fbdev.h"
27#include "log.h"
28#include "util.h"
29
30#include <fcntl.h>
31#include <unistd.h>
32#include <sys/ioctl.h>
33#include <linux/fb.h>
34#if HAS_MALI
35#include <EGL/egl.h>
36#endif
37#ifdef ANDROID
38#define FBDEV_DEV "/dev/graphics/fb"
39#else
40#define FBDEV_DEV "/dev/fb"
41#endif
42
43/******************
44 * Public methods *
45 ******************/
46
47bool
48NativeStateFBDEV::init_display()
49{
50 if (fd == -1)
51 return init();
52 return true;
53}
54
55void*
56NativeStateFBDEV::display()
57{
58 return reinterpret_cast<void*>(fd);
59}
60
61bool
62NativeStateFBDEV::create_window(WindowProperties const& /*properties*/)
63{
64 struct fb_var_screeninfo fb_var;
65 if (fd == -1) {
66 Log::error("Error: display has not been initialized!\n");
67 return false;
68 }
69 if (ioctl(fd, FBIOGET_VSCREENINFO, &fb_var))
70 {
71 Log::error("Error: cannot get variable frame buffer info\n");
72 return false;
73 }
74 winprops.width = fb_var.xres;
75 winprops.height = fb_var.yres;
76 winprops.fullscreen = true;
77 return true;
78}
79
80void*
81NativeStateFBDEV::window(WindowProperties& properties)
82{
83 properties = winprops;
84#ifdef HAS_MALI
85 native_window.height = winprops.height;
86 native_window.width = winprops.width;
87 return reinterpret_cast<void*>(&native_window);
88#else
89 return NULL;
90#endif
91}
92
93void
94NativeStateFBDEV::visible(bool /*visible*/)
95{
96}
97
98bool
99NativeStateFBDEV::should_quit()
100{
101 return should_quit_;
102}
103
104void
105NativeStateFBDEV::flip()
106{
107}
108
109/*******************
110 * Private methods *
111 *******************/
112
113bool
114NativeStateFBDEV::init()
115{
116 std::string devname;
117 int num = 0; /* always fb0 for now */
118
119 devname = std::string(FBDEV_DEV) + Util::toString(num);
120 fd = open(devname.c_str(), O_RDWR);
121 if(fd == -1)
122 {
123 Log::error("Error: Cannot open framebuffer device %s\n", devname.c_str());
124 return false;
125 }
126
127 signal(SIGINT, &NativeStateFBDEV::quit_handler);
128
129 return true;
130}
131
132volatile std::sig_atomic_t NativeStateFBDEV::should_quit_(false);
133
134void
135NativeStateFBDEV::quit_handler(int /*signo*/)
136{
137 should_quit_ = true;
138}
139
140void
141NativeStateFBDEV::cleanup()
142{
143 close(fd);
144 fd = -1;
145}
0146
=== added file 'src/native-state-fbdev.h'
--- src/native-state-fbdev.h 1970-01-01 00:00:00 +0000
+++ src/native-state-fbdev.h 2013-08-29 17:40:29 +0000
@@ -0,0 +1,64 @@
1/*
2 * Copyright © 2012 Linaro Limited
3 * Copyright © 2013 Canonical Ltd
4 *
5 * This file is part of the glmark2 OpenGL (ES) 2.0 benchmark.
6 *
7 * glmark2 is free software: you can redistribute it and/or modify it under the
8 * terms of the GNU General Public License as published by the Free Software
9 * Foundation, either version 3 of the License, or (at your option) any later
10 * version.
11 *
12 * glmark2 is distributed in the hope that it will be useful, but WITHOUT ANY
13 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
15 * details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * glmark2. If not, see <http://www.gnu.org/licenses/>.
19 *
20 * Authors:
21 * Simon Que
22 * Jesse Barker
23 * Alexandros Frantzis
24 * Wladimir J. van der Laan
25 */
26#ifndef GLMARK2_NATIVE_STATE_FBDEV_H_
27#define GLMARK2_NATIVE_STATE_FBDEV_H_
28
29#include "native-state.h"
30#include <csignal>
31#include <cstring>
32
33#ifdef HAS_MALI
34#include <EGL/egl.h>
35#endif
36
37class NativeStateFBDEV : public NativeState
38{
39public:
40 NativeStateFBDEV() :
41 fd(-1) {}
42 ~NativeStateFBDEV() { cleanup(); }
43
44 bool init_display();
45 void* display();
46 bool create_window(WindowProperties const& properties);
47 void* window(WindowProperties& properties);
48 void visible(bool v);
49 bool should_quit();
50 void flip();
51
52private:
53 static void quit_handler(int signum);
54 static volatile std::sig_atomic_t should_quit_;
55 int fd;
56 WindowProperties winprops;
57#ifdef HAS_MALI
58 struct mali_native_window native_window;
59#endif
60 bool init();
61 void cleanup();
62};
63
64#endif /* GLMARK2_NATIVE_STATE_FBDEV_H_ */
065
=== modified file 'src/wscript_build'
--- src/wscript_build 2013-05-05 16:23:53 +0000
+++ src/wscript_build 2013-08-29 17:40:29 +0000
@@ -16,17 +16,20 @@
16 'mir-gl' : ['canvas-generic.cpp', 'native-state-mir.cpp', 'gl-state-egl.cpp'],16 'mir-gl' : ['canvas-generic.cpp', 'native-state-mir.cpp', 'gl-state-egl.cpp'],
17 'mir-glesv2' : ['canvas-generic.cpp', 'native-state-mir.cpp', 'gl-state-egl.cpp'],17 'mir-glesv2' : ['canvas-generic.cpp', 'native-state-mir.cpp', 'gl-state-egl.cpp'],
18 'wayland-gl' : ['canvas-generic.cpp', 'native-state-wayland.cpp', 'gl-state-egl.cpp'],18 'wayland-gl' : ['canvas-generic.cpp', 'native-state-wayland.cpp', 'gl-state-egl.cpp'],
19 'wayland-glesv2' : ['canvas-generic.cpp', 'native-state-wayland.cpp', 'gl-state-egl.cpp']19 'wayland-glesv2' : ['canvas-generic.cpp', 'native-state-wayland.cpp', 'gl-state-egl.cpp'],
20 'fbdev-glesv2' : ['canvas-generic.cpp', 'native-state-fbdev.cpp', 'gl-state-egl.cpp']
20}21}
21flavor_uselibs = {22flavor_uselibs = {
22 'x11-gl' : ['x11', 'gl', 'matrix-gl'],23 'x11-gl' : ['x11', 'gl', 'matrix-gl'],
23 'x11-glesv2' : ['x11', 'egl', 'glesv2', 'matrix-glesv2'],24 'x11-glesv2' : ['x11', 'egl', 'glesv2', 'matrix-glesv2'],
24 'drm-gl' : ['drm', 'gbm', 'egl', 'gl', 'matrix-gl'],25 'drm-gl' : ['drm', 'gbm', 'egl', 'gl', 'matrix-gl'],
25 'drm-glesv2' : ['drm', 'gbm', 'egl', 'glesv2', 'matrix-gl'],26 'drm-glesv2' : ['drm', 'gbm', 'egl', 'glesv2', 'matrix-glesv2'],
26 'mir-gl' : ['mirclient', 'egl', 'gl', 'matrix-gl'],27 'mir-gl' : ['mirclient', 'egl', 'gl', 'matrix-gl'],
27 'mir-glesv2' : ['mirclient', 'egl', 'glesv2', 'matrix-gl'],28 'mir-glesv2' : ['mirclient', 'egl', 'glesv2', 'matrix-glesv2'],
28 'wayland-gl' : ['wayland-client', 'wayland-egl', 'egl', 'gl', 'matrix-gl'],29 'wayland-gl' : ['wayland-client', 'wayland-egl', 'egl', 'gl', 'matrix-gl'],
29 'wayland-glesv2' : ['wayland-client', 'wayland-egl', 'egl', 'glesv2', 'matrix-gl']30 'wayland-glesv2' : ['wayland-client', 'wayland-egl', 'egl', 'glesv2',
31 'matrix-glesv2'],
32 'fbdev-glesv2' : ['egl', 'glesv2', 'matrix-glesv2']
30}33}
31flavor_defines = {34flavor_defines = {
32 'x11-gl' : ['GLMARK2_USE_X11', 'GLMARK2_USE_GL', 'GLMARK2_USE_GLX'],35 'x11-gl' : ['GLMARK2_USE_X11', 'GLMARK2_USE_GL', 'GLMARK2_USE_GLX'],
@@ -36,7 +39,8 @@
36 'mir-gl' : ['GLMARK2_USE_MIR', 'GLMARK2_USE_GL', 'GLMARK2_USE_EGL'],39 'mir-gl' : ['GLMARK2_USE_MIR', 'GLMARK2_USE_GL', 'GLMARK2_USE_EGL'],
37 'mir-glesv2' : ['GLMARK2_USE_MIR', 'GLMARK2_USE_GLESv2', 'GLMARK2_USE_EGL'],40 'mir-glesv2' : ['GLMARK2_USE_MIR', 'GLMARK2_USE_GLESv2', 'GLMARK2_USE_EGL'],
38 'wayland-gl' : ['GLMARK2_USE_WAYLAND', 'GLMARK2_USE_GL', 'GLMARK2_USE_EGL'],41 'wayland-gl' : ['GLMARK2_USE_WAYLAND', 'GLMARK2_USE_GL', 'GLMARK2_USE_EGL'],
39 'wayland-glesv2' : ['GLMARK2_USE_WAYLAND', 'GLMARK2_USE_GLESv2', 'GLMARK2_USE_EGL']42 'wayland-glesv2' : ['GLMARK2_USE_WAYLAND', 'GLMARK2_USE_GLESv2', 'GLMARK2_USE_EGL'],
43 'fbdev-glesv2' : ['GLMARK2_USE_FBDEV', 'GLMARK2_USE_GLESv2', 'GLMARK2_USE_EGL', 'MESA_EGL_NO_X11_HEADERS']
40}44}
4145
42includes = ['.', 'scene-ideas', 'scene-terrain']46includes = ['.', 'scene-ideas', 'scene-terrain']
@@ -74,6 +78,7 @@
74 features = ['cxx', 'cxxstlib'],78 features = ['cxx', 'cxxstlib'],
75 source = libmatrix_sources,79 source = libmatrix_sources,
76 target = 'matrix-glesv2',80 target = 'matrix-glesv2',
81 use = ['glesv2'], # for gles header
77 lib = ['m'],82 lib = ['m'],
78 includes = ['.'],83 includes = ['.'],
79 export_includes = 'libmatrix',84 export_includes = 'libmatrix',
8085
=== modified file 'wscript'
--- wscript 2013-05-05 16:23:53 +0000
+++ wscript 2013-08-29 17:40:29 +0000
@@ -19,7 +19,8 @@
19 'mir-gl' : 'glmark2-mir',19 'mir-gl' : 'glmark2-mir',
20 'mir-glesv2' : 'glmark2-es2-mir',20 'mir-glesv2' : 'glmark2-es2-mir',
21 'wayland-gl' : 'glmark2-wayland',21 'wayland-gl' : 'glmark2-wayland',
22 'wayland-glesv2' : 'glmark2-es2-wayland'22 'wayland-glesv2' : 'glmark2-es2-wayland',
23 'fbdev-glesv2' : 'glmark2-es2'
23}24}
24FLAVORS_STR = ", ".join(FLAVORS.keys())25FLAVORS_STR = ", ".join(FLAVORS.keys())
2526
@@ -45,7 +46,8 @@
45 dest = 'flavors',46 dest = 'flavors',
46 help = "a list of flavors to build (%s, all)" % FLAVORS_STR)47 help = "a list of flavors to build (%s, all)" % FLAVORS_STR)
47 opt.parser.set_default('flavors', [])48 opt.parser.set_default('flavors', [])
4849 opt.add_option('--for-mali', action='store_true', dest = 'mali',
50 default = False, help='enable ARM Mali GPU support')
49 opt.add_option('--no-debug', action='store_false', dest = 'debug',51 opt.add_option('--no-debug', action='store_false', dest = 'debug',
50 default = True, help='disable compiler debug information')52 default = True, help='disable compiler debug information')
51 opt.add_option('--no-opt', action='store_false', dest = 'opt',53 opt.add_option('--no-opt', action='store_false', dest = 'opt',
@@ -131,6 +133,8 @@
131 ctx.env.prepend_value('CXXFLAGS', '-O2')133 ctx.env.prepend_value('CXXFLAGS', '-O2')
132 if Options.options.debug:134 if Options.options.debug:
133 ctx.env.prepend_value('CXXFLAGS', '-g')135 ctx.env.prepend_value('CXXFLAGS', '-g')
136 if Options.options.mali:
137 ctx.env.append_unique('DEFINES','HAS_MALI=1')
134138
135 ctx.env.HAVE_EXTRAS = False139 ctx.env.HAVE_EXTRAS = False
136 if Options.options.extras_path is not None:140 if Options.options.extras_path is not None:

Subscribers

People subscribed via source and target branches