362 lines
11 KiB
Diff
362 lines
11 KiB
Diff
diff --git a/glmark2-7215c0f337dae0b232535549c37fca441747a891/src/gl-state-egl.cpp b/glmark2-7215c0f337dae0b232535549c37fca441747a891/src/gl-state-egl.cpp
|
|
index 1d4a1e4..59f4612 100644
|
|
--- a/src/gl-state-egl.cpp
|
|
+++ b/src/gl-state-egl.cpp
|
|
@@ -414,9 +414,12 @@ GLStateEGL::gotValidDisplay()
|
|
{
|
|
if (egl_display_)
|
|
return true;
|
|
-
|
|
+#ifdef HAS_FBDEV
|
|
+ egl_display_ = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
|
+#else
|
|
egl_display_ = eglGetDisplay(native_display_);
|
|
- if (!egl_display_) {
|
|
+#endif
|
|
+ if (egl_display_ == EGL_NO_DISPLAY) {
|
|
Log::error("eglGetDisplay() failed with error: 0x%x\n", eglGetError());
|
|
return false;
|
|
}
|
|
diff --git a/glmark2-7215c0f337dae0b232535549c37fca441747a891/src/libmatrix/program.cc b/glmark2-7215c0f337dae0b232535549c37fca441747a891/src/libmatrix/program.cc
|
|
index b27298b..f8b1abd 100644
|
|
--- a/src/libmatrix/program.cc
|
|
+++ b/src/libmatrix/program.cc
|
|
@@ -17,6 +17,8 @@
|
|
#include "gl-if.h"
|
|
#include "program.h"
|
|
|
|
+typedef char GLchar;
|
|
+
|
|
using std::string;
|
|
using LibMatrix::mat4;
|
|
using LibMatrix::mat3;
|
|
diff --git a/glmark2-7215c0f337dae0b232535549c37fca441747a891/src/main.cpp b/glmark2-7215c0f337dae0b232535549c37fca441747a891/src/main.cpp
|
|
index b84b827..6237ac9 100644
|
|
--- a/src/main.cpp
|
|
+++ b/src/main.cpp
|
|
@@ -42,6 +42,8 @@
|
|
#include "native-state-mir.h"
|
|
#elif GLMARK2_USE_WAYLAND
|
|
#include "native-state-wayland.h"
|
|
+#elif GLMARK2_USE_FBDEV
|
|
+#include "native-state-fbdev.h"
|
|
#endif
|
|
|
|
#if GLMARK2_USE_EGL
|
|
@@ -168,6 +170,8 @@ main(int argc, char *argv[])
|
|
NativeStateMir native_state;
|
|
#elif GLMARK2_USE_WAYLAND
|
|
NativeStateWayland native_state;
|
|
+#elif GLMARK2_USE_FBDEV
|
|
+ NativeStateFBDEV native_state;
|
|
#endif
|
|
|
|
#if GLMARK2_USE_EGL
|
|
diff --git a/glmark2-7215c0f337dae0b232535549c37fca441747a891/src/scene-buffer.cpp b/glmark2-7215c0f337dae0b232535549c37fca441747a891/src/scene-buffer.cpp
|
|
index 80871aa..ef3a0b9 100644
|
|
--- a/src/scene-buffer.cpp
|
|
+++ b/src/scene-buffer.cpp
|
|
@@ -183,6 +183,7 @@ private:
|
|
double wave_k_;
|
|
double wave_period_;
|
|
double wave_full_period_;
|
|
+ double wave_fill_;
|
|
double wave_velocity_;
|
|
|
|
std::vector<double> displacement_;
|
|
diff --git a/glmark2-7215c0f337dae0b232535549c37fca441747a891/src/wscript_build b/glmark2-7215c0f337dae0b232535549c37fca441747a891/src/wscript_build
|
|
index ed0f6ea..cf86971 100644
|
|
--- a/src/wscript_build
|
|
+++ b/src/wscript_build
|
|
@@ -20,7 +20,8 @@ flavor_sources = {
|
|
'mir-gl' : common_flavor_sources + ['native-state-mir.cpp', 'gl-state-egl.cpp'],
|
|
'mir-glesv2' : common_flavor_sources + ['native-state-mir.cpp', 'gl-state-egl.cpp'],
|
|
'wayland-gl' : common_flavor_sources + ['native-state-wayland.cpp', 'gl-state-egl.cpp'],
|
|
- 'wayland-glesv2' : common_flavor_sources + ['native-state-wayland.cpp', 'gl-state-egl.cpp']
|
|
+ 'wayland-glesv2' : common_flavor_sources + ['native-state-wayland.cpp', 'gl-state-egl.cpp'],
|
|
+ 'fbdev-glesv2' : ['main.cpp', 'canvas-generic.cpp', 'native-state-fbdev.cpp', 'gl-state-egl.cpp']
|
|
}
|
|
flavor_uselibs = {
|
|
'x11-gl' : ['x11', 'gl', 'matrix-gl', 'common-gl'],
|
|
@@ -30,7 +31,8 @@ flavor_uselibs = {
|
|
'mir-gl' : ['mirclient', 'egl', 'gl', 'matrix-gl', 'common-gl'],
|
|
'mir-glesv2' : ['mirclient', 'egl', 'glesv2', 'matrix-glesv2', 'common-glesv2'],
|
|
'wayland-gl' : ['wayland-client', 'wayland-egl', 'egl', 'gl', 'matrix-gl', 'common-gl'],
|
|
- 'wayland-glesv2' : ['wayland-client', 'wayland-egl', 'egl', 'glesv2', 'matrix-glesv2', 'common-glesv2']
|
|
+ 'wayland-glesv2' : ['wayland-client', 'wayland-egl', 'egl', 'glesv2', 'matrix-glesv2', 'common-glesv2'],
|
|
+ 'fbdev-glesv2' : ['egl', 'glesv2', 'matrix-glesv2', 'gl', 'common-glesv2']
|
|
}
|
|
flavor_defines = {
|
|
'x11-gl' : ['GLMARK2_USE_X11', 'GLMARK2_USE_GL', 'GLMARK2_USE_GLX'],
|
|
@@ -40,7 +42,8 @@ flavor_defines = {
|
|
'mir-gl' : ['GLMARK2_USE_MIR', 'GLMARK2_USE_GL', 'GLMARK2_USE_EGL'],
|
|
'mir-glesv2' : ['GLMARK2_USE_MIR', 'GLMARK2_USE_GLESv2', 'GLMARK2_USE_EGL'],
|
|
'wayland-gl' : ['GLMARK2_USE_WAYLAND', 'GLMARK2_USE_GL', 'GLMARK2_USE_EGL'],
|
|
- 'wayland-glesv2' : ['GLMARK2_USE_WAYLAND', 'GLMARK2_USE_GLESv2', 'GLMARK2_USE_EGL']
|
|
+ 'wayland-glesv2' : ['GLMARK2_USE_WAYLAND', 'GLMARK2_USE_GLESv2', 'GLMARK2_USE_EGL'],
|
|
+ 'fbdev-glesv2' : ['GLMARK2_USE_FBDEV', 'GLMARK2_USE_GLESv2', 'GLMARK2_USE_EGL', 'MESA_EGL_NO_X11_HEADERS']
|
|
}
|
|
|
|
includes = ['.', 'scene-ideas', 'scene-terrain']
|
|
diff --git a/glmark2-7215c0f337dae0b232535549c37fca441747a891/wscript b/glmark2-7215c0f337dae0b232535549c37fca441747a891/wscript
|
|
index f9f2a17..c9c37ca 100644
|
|
--- a/wscript
|
|
+++ b/wscript
|
|
@@ -15,7 +15,8 @@ FLAVORS = {
|
|
'mir-gl' : 'glmark2-mir',
|
|
'mir-glesv2' : 'glmark2-es2-mir',
|
|
'wayland-gl' : 'glmark2-wayland',
|
|
- 'wayland-glesv2' : 'glmark2-es2-wayland'
|
|
+ 'wayland-glesv2' : 'glmark2-es2-wayland',
|
|
+ 'fbdev-glesv2' : 'glmark2-es2-fbdev'
|
|
}
|
|
FLAVORS_STR = ", ".join(FLAVORS.keys())
|
|
|
|
@@ -41,7 +42,8 @@ def options(opt):
|
|
dest = 'flavors',
|
|
help = "a list of flavors to build (%s, all)" % FLAVORS_STR)
|
|
opt.parser.set_default('flavors', [])
|
|
-
|
|
+ opt.add_option('--for-fbdev', action='store_true', dest = 'fbdev',
|
|
+ default = False, help='enable fbdev support')
|
|
opt.add_option('--no-debug', action='store_false', dest = 'debug',
|
|
default = True, help='disable compiler debug information')
|
|
opt.add_option('--no-opt', action='store_false', dest = 'opt',
|
|
@@ -123,6 +125,7 @@ def configure(ctx):
|
|
ctx.check_cfg(package = pkg, uselib_store = uselib, atleast_version=atleast,
|
|
args = '--cflags --libs', mandatory = mandatory)
|
|
|
|
+ ctx.env.append_unique('CXXFLAGS', '-Werror -Wall -Wextra -Wnon-virtual-dtor'.split(' '))
|
|
|
|
# Prepend CXX flags so that they can be overriden by the
|
|
# CXXFLAGS environment variable
|
|
@@ -130,7 +133,8 @@ def configure(ctx):
|
|
ctx.env.prepend_value('CXXFLAGS', '-O2')
|
|
if ctx.options.debug:
|
|
ctx.env.prepend_value('CXXFLAGS', '-g')
|
|
- ctx.env.prepend_value('CXXFLAGS', '-std=c++14 -Wall -Wextra -Wnon-virtual-dtor'.split(' '))
|
|
+ if ctx.options.fbdev:
|
|
+ ctx.env.append_unique('DEFINES','HAS_FBDEV=1')
|
|
|
|
ctx.env.HAVE_EXTRAS = False
|
|
if ctx.options.extras_path is not None:
|
|
--- /dev/null 2018-05-03 15:59:08.859931487 +0800
|
|
+++ b/src/native-state-fbdev.cpp 2018-05-03 15:37:55.000000000 +0800
|
|
@@ -0,0 +1,145 @@
|
|
+/*
|
|
+ * Copyright 漏 2012 Linaro Limited
|
|
+ * Copyright 漏 2013 Canonical Ltd
|
|
+ *
|
|
+ * This file is part of the glmark2 OpenGL (ES) 2.0 benchmark.
|
|
+ *
|
|
+ * glmark2 is free software: you can redistribute it and/or modify it under the
|
|
+ * terms of the GNU General Public License as published by the Free Software
|
|
+ * Foundation, either version 3 of the License, or (at your option) any later
|
|
+ * version.
|
|
+ *
|
|
+ * glmark2 is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
+ * details.
|
|
+ *
|
|
+ * You should have received a copy of the GNU General Public License along with
|
|
+ * glmark2. If not, see <http://www.gnu.org/licenses/>.
|
|
+ *
|
|
+ * Authors:
|
|
+ * Simon Que
|
|
+ * Jesse Barker
|
|
+ * Alexandros Frantzis
|
|
+ * Wladimir J. van der Laan
|
|
+ */
|
|
+#include "native-state-fbdev.h"
|
|
+#include "log.h"
|
|
+#include "util.h"
|
|
+
|
|
+#include <fcntl.h>
|
|
+#include <unistd.h>
|
|
+#include <sys/ioctl.h>
|
|
+#include <linux/fb.h>
|
|
+#if HAS_MALI
|
|
+#include <EGL/egl.h>
|
|
+#endif
|
|
+#ifdef ANDROID
|
|
+#define FBDEV_DEV "/dev/graphics/fb"
|
|
+#else
|
|
+#define FBDEV_DEV "/dev/fb"
|
|
+#endif
|
|
+
|
|
+/******************
|
|
+ * Public methods *
|
|
+ ******************/
|
|
+
|
|
+bool
|
|
+NativeStateFBDEV::init_display()
|
|
+{
|
|
+ if (fd == -1)
|
|
+ return init();
|
|
+ return true;
|
|
+}
|
|
+
|
|
+void*
|
|
+NativeStateFBDEV::display()
|
|
+{
|
|
+ return reinterpret_cast<void*>(fd);
|
|
+}
|
|
+
|
|
+bool
|
|
+NativeStateFBDEV::create_window(WindowProperties const& /*properties*/)
|
|
+{
|
|
+ struct fb_var_screeninfo fb_var;
|
|
+ if (fd == -1) {
|
|
+ Log::error("Error: display has not been initialized!\n");
|
|
+ return false;
|
|
+ }
|
|
+ if (ioctl(fd, FBIOGET_VSCREENINFO, &fb_var))
|
|
+ {
|
|
+ Log::error("Error: cannot get variable frame buffer info\n");
|
|
+ return false;
|
|
+ }
|
|
+ winprops.width = fb_var.xres;
|
|
+ winprops.height = fb_var.yres;
|
|
+ winprops.fullscreen = true;
|
|
+ return true;
|
|
+}
|
|
+
|
|
+void*
|
|
+NativeStateFBDEV::window(WindowProperties& properties)
|
|
+{
|
|
+ properties = winprops;
|
|
+#ifdef HAS_MALI
|
|
+ native_window.height = winprops.height;
|
|
+ native_window.width = winprops.width;
|
|
+ return reinterpret_cast<void*>(&native_window);
|
|
+#else
|
|
+ return NULL;
|
|
+#endif
|
|
+}
|
|
+
|
|
+void
|
|
+NativeStateFBDEV::visible(bool /*visible*/)
|
|
+{
|
|
+}
|
|
+
|
|
+bool
|
|
+NativeStateFBDEV::should_quit()
|
|
+{
|
|
+ return should_quit_;
|
|
+}
|
|
+
|
|
+void
|
|
+NativeStateFBDEV::flip()
|
|
+{
|
|
+}
|
|
+
|
|
+/*******************
|
|
+ * Private methods *
|
|
+ *******************/
|
|
+
|
|
+bool
|
|
+NativeStateFBDEV::init()
|
|
+{
|
|
+ std::string devname;
|
|
+ int num = 0; /* always fb0 for now */
|
|
+
|
|
+ devname = std::string(FBDEV_DEV) + Util::toString(num);
|
|
+ fd = open(devname.c_str(), O_RDWR);
|
|
+ if(fd == -1)
|
|
+ {
|
|
+ Log::error("Error: Cannot open framebuffer device %s\n", devname.c_str());
|
|
+ return false;
|
|
+ }
|
|
+
|
|
+ signal(SIGINT, &NativeStateFBDEV::quit_handler);
|
|
+
|
|
+ return true;
|
|
+}
|
|
+
|
|
+volatile std::sig_atomic_t NativeStateFBDEV::should_quit_(false);
|
|
+
|
|
+void
|
|
+NativeStateFBDEV::quit_handler(int /*signo*/)
|
|
+{
|
|
+ should_quit_ = true;
|
|
+}
|
|
+
|
|
+void
|
|
+NativeStateFBDEV::cleanup()
|
|
+{
|
|
+ close(fd);
|
|
+ fd = -1;
|
|
+}
|
|
--- /dev/null 2018-05-03 15:58:57.115930987 +0800
|
|
+++ b/src/native-state-fbdev.h 2018-05-03 15:37:55.000000000 +0800
|
|
@@ -0,0 +1,68 @@
|
|
+/*
|
|
+ * Copyright 漏 2012 Linaro Limited
|
|
+ * Copyright 漏 2013 Canonical Ltd
|
|
+ *
|
|
+ * This file is part of the glmark2 OpenGL (ES) 2.0 benchmark.
|
|
+ *
|
|
+ * glmark2 is free software: you can redistribute it and/or modify it under the
|
|
+ * terms of the GNU General Public License as published by the Free Software
|
|
+ * Foundation, either version 3 of the License, or (at your option) any later
|
|
+ * version.
|
|
+ *
|
|
+ * glmark2 is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
+ * details.
|
|
+ *
|
|
+ * You should have received a copy of the GNU General Public License along with
|
|
+ * glmark2. If not, see <http://www.gnu.org/licenses/>.
|
|
+ *
|
|
+ * Authors:
|
|
+ * Simon Que
|
|
+ * Jesse Barker
|
|
+ * Alexandros Frantzis
|
|
+ * Wladimir J. van der Laan
|
|
+ */
|
|
+#ifndef GLMARK2_NATIVE_STATE_FBDEV_H_
|
|
+#define GLMARK2_NATIVE_STATE_FBDEV_H_
|
|
+
|
|
+#include "native-state.h"
|
|
+#include <csignal>
|
|
+#include <cstring>
|
|
+#define HAS_MALI 1
|
|
+#ifdef HAS_MALI
|
|
+#include <EGL/egl.h>
|
|
+#endif
|
|
+
|
|
+class NativeStateFBDEV : public NativeState
|
|
+{
|
|
+public:
|
|
+ NativeStateFBDEV() :
|
|
+ fd(-1) {}
|
|
+ ~NativeStateFBDEV() { cleanup(); }
|
|
+
|
|
+ bool init_display();
|
|
+ void* display();
|
|
+ bool create_window(WindowProperties const& properties);
|
|
+ void* window(WindowProperties& properties);
|
|
+ void visible(bool v);
|
|
+ bool should_quit();
|
|
+ void flip();
|
|
+
|
|
+private:
|
|
+ static void quit_handler(int signum);
|
|
+ static volatile std::sig_atomic_t should_quit_;
|
|
+ int fd;
|
|
+ WindowProperties winprops;
|
|
+#ifdef HAS_MALI
|
|
+ struct mali_native_window {
|
|
+ unsigned short width;
|
|
+ unsigned short height;
|
|
+ };
|
|
+ struct mali_native_window native_window;
|
|
+#endif
|
|
+ bool init();
|
|
+ void cleanup();
|
|
+};
|
|
+
|
|
+#endif /* GLMARK2_NATIVE_STATE_FBDEV_H_ */
|