summaryrefslogtreecommitdiffstats
path: root/chrome/gpu
diff options
context:
space:
mode:
authorkbr@google.com <kbr@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-31 17:55:57 +0000
committerkbr@google.com <kbr@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-31 17:55:57 +0000
commit28638b2ce5ec96bda25fd3583d7902dea0137fb2 (patch)
tree585a58803f76da08e806524086f0948f7393b663 /chrome/gpu
parent74f275448f43dac31331495148e832c376b18344 (diff)
downloadchromium_src-28638b2ce5ec96bda25fd3583d7902dea0137fb2.zip
chromium_src-28638b2ce5ec96bda25fd3583d7902dea0137fb2.tar.gz
chromium_src-28638b2ce5ec96bda25fd3583d7902dea0137fb2.tar.bz2
Implemented offscreen rendering path for GLES2CmdDecoder on Linux.
With these changes, WebGL runs in the sandbox on Linux. BUG=29120 TEST=ran WebGL demos in sandbox on Linux Review URL: http://codereview.chromium.org/1540004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43235 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/gpu')
-rw-r--r--chrome/gpu/gpu_thread.cc32
1 files changed, 32 insertions, 0 deletions
diff --git a/chrome/gpu/gpu_thread.cc b/chrome/gpu/gpu_thread.cc
index c2c190e..dcb16e9 100644
--- a/chrome/gpu/gpu_thread.cc
+++ b/chrome/gpu/gpu_thread.cc
@@ -5,6 +5,8 @@
#include "chrome/gpu/gpu_thread.h"
#include "build/build_config.h"
+
+#include "base/command_line.h"
#include "chrome/common/child_process.h"
#include "chrome/common/gpu_messages.h"
#include "chrome/gpu/gpu_config.h"
@@ -18,10 +20,40 @@
#include <X11/Xutil.h> // Must be last.
#endif
+#if defined(OS_LINUX)
+#include <gtk/gtk.h>
+#endif
+
GpuThread::GpuThread() {
#if defined(GPU_USE_GLX)
display_ = ::XOpenDisplay(NULL);
#endif
+#if defined(OS_LINUX)
+ {
+ // The X11 port of the command buffer code assumes it can access the X
+ // display via the macro GDK_DISPLAY(), which implies that Gtk has been
+ // initialized. This code was taken from PluginThread. TODO(kbr):
+ // rethink whether initializing Gtk is really necessary or whether we
+ // should just send the display connection down to the GPUProcessor.
+ g_thread_init(NULL);
+ const std::vector<std::string>& args =
+ CommandLine::ForCurrentProcess()->argv();
+ int argc = args.size();
+ scoped_array<char *> argv(new char *[argc + 1]);
+ for (size_t i = 0; i < args.size(); ++i) {
+ // TODO(piman@google.com): can gtk_init modify argv? Just being safe
+ // here.
+ argv[i] = strdup(args[i].c_str());
+ }
+ argv[argc] = NULL;
+ char **argv_pointer = argv.get();
+
+ gtk_init(&argc, &argv_pointer);
+ for (size_t i = 0; i < args.size(); ++i) {
+ free(argv[i]);
+ }
+ }
+#endif
}
GpuThread::~GpuThread() {