aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar Joe Gregorio <jcgregorio@google.com>2017-06-01 13:24:11 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-06-01 18:03:45 +0000
commit97b10ac4847fba563834911f35235aaf0299d0c8 (patch)
tree1b3298011a42a51faeb3d8a9c49e131130cd4e38 /tools
parent842a56047093470de52083b8768585427e1def31 (diff)
[fiddle] Report GL driver info.
Bug: skia: Change-Id: I5338d6abef062f7da420e8cddafa082bedcfff25 Reviewed-on: https://skia-review.googlesource.com/18310 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Joe Gregorio <jcgregorio@google.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/fiddle/egl_context.cpp10
-rw-r--r--tools/fiddle/fiddle_main.cpp17
-rw-r--r--tools/fiddle/fiddle_main.h4
-rw-r--r--tools/fiddle/mesa_context.cpp3
-rw-r--r--tools/fiddle/null_context.cpp3
-rwxr-xr-xtools/fiddle/parse-fiddle-output7
6 files changed, 31 insertions, 13 deletions
diff --git a/tools/fiddle/egl_context.cpp b/tools/fiddle/egl_context.cpp
index cbab44cb37..107bb4ff1a 100644
--- a/tools/fiddle/egl_context.cpp
+++ b/tools/fiddle/egl_context.cpp
@@ -8,6 +8,7 @@
#include "fiddle_main.h"
#include <EGL/egl.h>
+#include <GLES2/gl2.h>
static const EGLint configAttribs[] = {
EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
@@ -29,7 +30,7 @@ static const EGLint pbufferAttribs[] = {
};
// create_grcontext implementation for EGL.
-sk_sp<GrContext> create_grcontext() {
+sk_sp<GrContext> create_grcontext(std::ostringstream &driverinfo) {
EGLDisplay eglDpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
if (EGL_NO_DISPLAY == eglDpy) {
return nullptr;
@@ -63,6 +64,13 @@ sk_sp<GrContext> create_grcontext() {
return nullptr;
}
+ driverinfo << "EGL " << major << "." << minor << "\n";
+ GrGLGetStringProc getString = (GrGLGetStringProc )eglGetProcAddress("glGetString");
+ driverinfo << "GL Versionr: " << getString(GL_VERSION) << "\n";
+ driverinfo << "GL Vendor: " << getString(GL_VENDOR) << "\n";
+ driverinfo << "GL Renderer: " << getString(GL_RENDERER) << "\n";
+ driverinfo << "GL Extensions: " << getString(GL_EXTENSIONS) << "\n";
+
auto interface = GrGLCreateNativeInterface();
if (!interface) {
return nullptr;
diff --git a/tools/fiddle/fiddle_main.cpp b/tools/fiddle/fiddle_main.cpp
index a097583b30..dbc0141ca0 100644
--- a/tools/fiddle/fiddle_main.cpp
+++ b/tools/fiddle/fiddle_main.cpp
@@ -26,6 +26,9 @@ double frame; // A value in [0, 1] of where we are in the animation.
// Global used by the local impl of SkDebugf.
std::ostringstream gTextOutput;
+// Global to record the GL driver info via create_grcontext().
+std::ostringstream gGLDriverInfo;
+
void SkDebugf(const char * fmt, ...) {
va_list args;
va_start(args, fmt);
@@ -137,7 +140,7 @@ int main(int argc, char** argv) {
rasterData.reset(encode_snapshot(rasterSurface));
}
if (options.gpu) {
- auto grContext = create_grcontext();
+ auto grContext = create_grcontext(gGLDriverInfo);
if (!grContext) {
fputs("Unable to get GrContext.\n", stderr);
} else {
@@ -175,14 +178,16 @@ int main(int argc, char** argv) {
printf("{\n");
if (!options.textOnly) {
- dump_output(rasterData, "Raster", !gpuData && !pdfData && !skpData);
- dump_output(gpuData, "Gpu", !pdfData && !skpData);
- dump_output(pdfData, "Pdf", !skpData);
- dump_output(skpData, "Skp");
+ dump_output(rasterData, "Raster", false);
+ dump_output(gpuData, "Gpu", false);
+ dump_output(pdfData, "Pdf", false);
+ dump_output(skpData, "Skp", false);
} else {
std::string textoutput = gTextOutput.str();
- dump_output(textoutput.c_str(), textoutput.length(), "Text");
+ dump_output(textoutput.c_str(), textoutput.length(), "Text", false);
}
+ std::string glinfo = gGLDriverInfo.str();
+ dump_output(glinfo.c_str(), glinfo.length(), "GLInfo", true);
printf("}\n");
return 0;
diff --git a/tools/fiddle/fiddle_main.h b/tools/fiddle/fiddle_main.h
index 4fadd365fa..fb9d409482 100644
--- a/tools/fiddle/fiddle_main.h
+++ b/tools/fiddle/fiddle_main.h
@@ -20,6 +20,8 @@
#include "skia.h"
#endif
+#include <sstream>
+
extern SkBitmap source;
extern sk_sp<SkImage> image;
extern double duration; // The total duration of the animation in seconds.
@@ -57,6 +59,6 @@ extern void draw(SkCanvas*);
// There are different implementations of create_grcontext() for EGL, Mesa,
// and a fallback to a null context.
-extern sk_sp<GrContext> create_grcontext();
+extern sk_sp<GrContext> create_grcontext(std::ostringstream &driverinfo);
#endif // fiddle_main_DEFINED
diff --git a/tools/fiddle/mesa_context.cpp b/tools/fiddle/mesa_context.cpp
index 70ee62bcc8..3b3726bfdb 100644
--- a/tools/fiddle/mesa_context.cpp
+++ b/tools/fiddle/mesa_context.cpp
@@ -10,12 +10,13 @@
#include <GL/osmesa.h>
// create_grcontext implementation for Mesa.
-sk_sp<GrContext> create_grcontext() {
+sk_sp<GrContext> create_grcontext(std::ostringstream &driverinfo) {
// We just leak the OSMesaContext... the process will die soon anyway.
if (OSMesaContext osMesaContext = OSMesaCreateContextExt(OSMESA_BGRA, 0, 0, 0, nullptr)) {
static uint32_t buffer[16 * 16];
OSMesaMakeCurrent(osMesaContext, &buffer, GL_UNSIGNED_BYTE, 16, 16);
}
+ driverinfo << "Mesa";
auto osmesa_get = [](void* ctx, const char name[]) {
SkASSERT(nullptr == ctx);
diff --git a/tools/fiddle/null_context.cpp b/tools/fiddle/null_context.cpp
index c331e8a98c..3fe0054ecc 100644
--- a/tools/fiddle/null_context.cpp
+++ b/tools/fiddle/null_context.cpp
@@ -8,6 +8,7 @@
#include "fiddle_main.h"
// create_grcontext for when neither Mesa nor EGL are available.
-sk_sp<GrContext> create_grcontext() {
+sk_sp<GrContext> create_grcontext(std::ostringstream &driverinfo) {
+ driverinfo << "(no GL driver available)";
return nullptr;
}
diff --git a/tools/fiddle/parse-fiddle-output b/tools/fiddle/parse-fiddle-output
index f9a2fac6d6..f44ff6445e 100755
--- a/tools/fiddle/parse-fiddle-output
+++ b/tools/fiddle/parse-fiddle-output
@@ -9,9 +9,10 @@ while IFS= read -r line; do
type=$(echo $line | sed -n 's/[^"]*"\([^"]*\)":.*/\1/p')
if [ "$type" ]; then
case "$type" in
- Raster|Gpu) ext='.png';;
- Pdf) ext='.pdf';;
- Skp) ext='.skp';;
+ Raster|Gpu) ext='.png';;
+ Pdf) ext='.pdf';;
+ Skp) ext='.skp';;
+ Text|GLInfo) ext='.txt';;
esac
dst="${TMPDIR:-/tmp}/fiddle_${type}${ext}"
echo $line | sed 's/[^"]*"[^"]*": "//; s/"\(,\|\)$//' \