summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-25 01:29:15 +0000
committerzmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-25 01:29:15 +0000
commit198ae6b456fc839277a7c7581db55c732f120e1e (patch)
tree6275ad52a95b236f72b5d5c8b60fc3ab92f3dea3
parent5c66bce28f4b6ee916473a934fca6fca2d55fdc6 (diff)
downloadchromium_src-198ae6b456fc839277a7c7581db55c732f120e1e.zip
chromium_src-198ae6b456fc839277a7c7581db55c732f120e1e.tar.gz
chromium_src-198ae6b456fc839277a7c7581db55c732f120e1e.tar.bz2
Collect GL_EXTENSIONS string in GPUInfo and display it in about:gpu page.
(A second try after being reverted.) Review URL: http://codereview.chromium.org/6279009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72445 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/dom_ui/gpu_internals_ui.cc2
-rw-r--r--chrome/common/gpu_info.cc9
-rw-r--r--chrome/common/gpu_info.h7
-rw-r--r--chrome/common/gpu_info_unittest.cc1
-rw-r--r--chrome/common/gpu_messages.cc4
-rw-r--r--chrome/common/gpu_messages_unittest.cc2
-rw-r--r--chrome/gpu/gpu_info_collector.cc1
-rw-r--r--chrome/gpu/gpu_info_collector_unittest.cc21
8 files changed, 45 insertions, 2 deletions
diff --git a/chrome/browser/dom_ui/gpu_internals_ui.cc b/chrome/browser/dom_ui/gpu_internals_ui.cc
index 752a5f5..c9e9dda 100644
--- a/chrome/browser/dom_ui/gpu_internals_ui.cc
+++ b/chrome/browser/dom_ui/gpu_internals_ui.cc
@@ -295,6 +295,8 @@ DictionaryValue* GpuInfoToDict(const GPUInfo& gpu_info) {
gpu_info.gl_renderer()));
basic_info->Append(NewDescriptionValuePair("GL_VERSION",
gpu_info.gl_version_string()));
+ basic_info->Append(NewDescriptionValuePair("GL_EXTENSIONS",
+ gpu_info.gl_extensions()));
DictionaryValue* info = new DictionaryValue();
info->Set("basic_info", basic_info);
diff --git a/chrome/common/gpu_info.cc b/chrome/common/gpu_info.cc
index a89bf82..5a88e34 100644
--- a/chrome/common/gpu_info.cc
+++ b/chrome/common/gpu_info.cc
@@ -16,6 +16,7 @@ GPUInfo::GPUInfo()
gl_version_string_(""),
gl_vendor_(""),
gl_renderer_(""),
+ gl_extensions_(""),
can_lose_context_(false) {
}
@@ -67,6 +68,10 @@ std::string GPUInfo::gl_renderer() const {
return gl_renderer_;
}
+std::string GPUInfo::gl_extensions() const {
+ return gl_extensions_;
+}
+
bool GPUInfo::can_lose_context() const {
return can_lose_context_;
}
@@ -113,6 +118,10 @@ void GPUInfo::SetGLRenderer(const std::string& gl_renderer) {
gl_renderer_ = gl_renderer;
}
+void GPUInfo::SetGLExtensions(const std::string& gl_extensions) {
+ gl_extensions_ = gl_extensions;
+}
+
void GPUInfo::SetCanLoseContext(bool can_lose_context) {
can_lose_context_ = can_lose_context;
}
diff --git a/chrome/common/gpu_info.h b/chrome/common/gpu_info.h
index 206ade1..95c2237 100644
--- a/chrome/common/gpu_info.h
+++ b/chrome/common/gpu_info.h
@@ -79,6 +79,10 @@ class GPUInfo {
// Return "" if we are not using OpenGL.
std::string gl_renderer() const;
+ // Return the GL_EXTENSIONS string.
+ // Return "" if we are not using OpenGL.
+ std::string gl_extensions() const;
+
// Return the device semantics, i.e. whether the Vista and Windows 7 specific
// semantics are available.
bool can_lose_context() const;
@@ -103,6 +107,8 @@ class GPUInfo {
void SetGLRenderer(const std::string& gl_renderer);
+ void SetGLExtensions(const std::string& gl_extensions);
+
void SetCanLoseContext(bool can_lose_context);
#if defined(OS_WIN)
@@ -125,6 +131,7 @@ class GPUInfo {
std::string gl_version_string_;
std::string gl_vendor_;
std::string gl_renderer_;
+ std::string gl_extensions_;
bool can_lose_context_;
#if defined(OS_WIN)
diff --git a/chrome/common/gpu_info_unittest.cc b/chrome/common/gpu_info_unittest.cc
index 2dc2de7..57227e8 100644
--- a/chrome/common/gpu_info_unittest.cc
+++ b/chrome/common/gpu_info_unittest.cc
@@ -20,5 +20,6 @@ TEST(GPUInfoBasicTest, EmptyGPUInfo) {
EXPECT_EQ(gpu_info.gl_version_string(), "");
EXPECT_EQ(gpu_info.gl_vendor(), "");
EXPECT_EQ(gpu_info.gl_renderer(), "");
+ EXPECT_EQ(gpu_info.gl_extensions(), "");
EXPECT_EQ(gpu_info.can_lose_context(), false);
}
diff --git a/chrome/common/gpu_messages.cc b/chrome/common/gpu_messages.cc
index 6114cd5..7f1f5c0 100644
--- a/chrome/common/gpu_messages.cc
+++ b/chrome/common/gpu_messages.cc
@@ -140,6 +140,7 @@ void ParamTraits<GPUInfo> ::Write(Message* m, const param_type& p) {
WriteParam(m, p.gl_version_string());
WriteParam(m, p.gl_vendor());
WriteParam(m, p.gl_renderer());
+ WriteParam(m, p.gl_extensions());
WriteParam(m, p.can_lose_context());
#if defined(OS_WIN)
@@ -160,6 +161,7 @@ bool ParamTraits<GPUInfo> ::Read(const Message* m, void** iter, param_type* p) {
std::string gl_version_string;
std::string gl_vendor;
std::string gl_renderer;
+ std::string gl_extensions;
bool can_lose_context;
bool ret = ReadParam(m, iter, &progress);
ret = ret && ReadParam(m, iter, &initialization_time);
@@ -173,6 +175,7 @@ bool ParamTraits<GPUInfo> ::Read(const Message* m, void** iter, param_type* p) {
ret = ret && ReadParam(m, iter, &gl_version_string);
ret = ret && ReadParam(m, iter, &gl_vendor);
ret = ret && ReadParam(m, iter, &gl_renderer);
+ ret = ret && ReadParam(m, iter, &gl_extensions);
ret = ret && ReadParam(m, iter, &can_lose_context);
p->SetProgress(static_cast<GPUInfo::Progress>(progress));
if (!ret)
@@ -186,6 +189,7 @@ bool ParamTraits<GPUInfo> ::Read(const Message* m, void** iter, param_type* p) {
p->SetGLVersionString(gl_version_string);
p->SetGLVendor(gl_vendor);
p->SetGLRenderer(gl_renderer);
+ p->SetGLExtensions(gl_extensions);
p->SetCanLoseContext(can_lose_context);
#if defined(OS_WIN)
diff --git a/chrome/common/gpu_messages_unittest.cc b/chrome/common/gpu_messages_unittest.cc
index 9be8162..b3f2c34 100644
--- a/chrome/common/gpu_messages_unittest.cc
+++ b/chrome/common/gpu_messages_unittest.cc
@@ -22,6 +22,7 @@ TEST(GPUIPCMessageTest, GPUInfo) {
input.SetGLVersionString("3.2.0 NVIDIA 195.36.24");
input.SetGLVendor("NVIDIA Corporation");
input.SetGLRenderer("Quadro FX 380/PCI/SSE2");
+ input.SetGLExtensions("GL_ARB_texture_rg GL_ARB_window_pos");
input.SetCanLoseContext(false);
IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL);
@@ -43,6 +44,7 @@ TEST(GPUIPCMessageTest, GPUInfo) {
EXPECT_EQ(input.gl_version_string(), output.gl_version_string());
EXPECT_EQ(input.gl_vendor(), output.gl_vendor());
EXPECT_EQ(input.gl_renderer(), output.gl_renderer());
+ EXPECT_EQ(input.gl_extensions(), output.gl_extensions());
EXPECT_EQ(input.can_lose_context(), output.can_lose_context());
std::string log_message;
diff --git a/chrome/gpu/gpu_info_collector.cc b/chrome/gpu/gpu_info_collector.cc
index bb55eaf..f6936fd 100644
--- a/chrome/gpu/gpu_info_collector.cc
+++ b/chrome/gpu/gpu_info_collector.cc
@@ -89,6 +89,7 @@ bool CollectGraphicsInfoGL(GPUInfo* gpu_info) {
gpu_info->SetGLRenderer(GetGLString(GL_RENDERER));
gpu_info->SetGLVendor(GetGLString(GL_VENDOR));
gpu_info->SetGLVersionString(GetGLString(GL_VERSION));
+ gpu_info->SetGLExtensions(GetGLString(GL_EXTENSIONS));
bool validGLVersionInfo = CollectGLVersionInfo(gpu_info);
bool validVideoCardInfo = CollectVideoCardInfo(gpu_info);
diff --git a/chrome/gpu/gpu_info_collector_unittest.cc b/chrome/gpu/gpu_info_collector_unittest.cc
index 1d0156f..09282f7 100644
--- a/chrome/gpu/gpu_info_collector_unittest.cc
+++ b/chrome/gpu/gpu_info_collector_unittest.cc
@@ -33,6 +33,9 @@ class GPUInfoCollectorTest : public testing::Test {
const char* gl_vendor = "NVIDIA Corporation";
const char* gl_version_string = "3.1.0";
const char* gl_shading_language_version = "1.40 NVIDIA via Cg compiler";
+ const char* gl_extensions =
+ "GL_OES_packed_depth_stencil GL_EXT_texture_format_BGRA8888 "
+ "GL_EXT_read_format_bgra";
#elif defined(OS_MACOSX)
const uint32 vendor_id = 0x10de;
const uint32 device_id = 0x0640;
@@ -44,6 +47,9 @@ class GPUInfoCollectorTest : public testing::Test {
const char* gl_vendor = "NVIDIA Corporation";
const char* gl_version_string = "2.1 NVIDIA-1.6.18";
const char* gl_shading_language_version = "1.20 ";
+ const char* gl_extensions =
+ "GL_OES_packed_depth_stencil GL_EXT_texture_format_BGRA8888 "
+ "GL_EXT_read_format_bgra";
#else // defined (OS_LINUX)
const uint32 vendor_id = 0x10de;
const uint32 device_id = 0x0658;
@@ -55,6 +61,9 @@ class GPUInfoCollectorTest : public testing::Test {
const char* gl_vendor = "NVIDIA Corporation";
const char* gl_version_string = "3.2.0 NVIDIA 195.36.24";
const char* gl_shading_language_version = "1.50 NVIDIA via Cg compiler";
+ const char* gl_extensions =
+ "GL_OES_packed_depth_stencil GL_EXT_texture_format_BGRA8888 "
+ "GL_EXT_read_format_bgra";
#endif
test_values_.SetVideoCardInfo(vendor_id, device_id);
test_values_.SetDriverInfo(driver_vendor, driver_version);
@@ -63,12 +72,12 @@ class GPUInfoCollectorTest : public testing::Test {
test_values_.SetGLRenderer(gl_renderer);
test_values_.SetGLVendor(gl_vendor);
test_values_.SetGLVersionString(gl_version_string);
+ test_values_.SetGLExtensions(gl_extensions);
test_values_.SetCanLoseContext(false);
EXPECT_CALL(*gl_, GetString(GL_EXTENSIONS))
.WillRepeatedly(Return(reinterpret_cast<const GLubyte*>(
- "GL_OES_packed_depth_stencil GL_EXT_texture_format_BGRA8888 "
- "GL_EXT_read_format_bgra")));
+ gl_extensions)));
EXPECT_CALL(*gl_, GetString(GL_SHADING_LANGUAGE_VERSION))
.WillRepeatedly(Return(reinterpret_cast<const GLubyte*>(
gl_shading_language_version)));
@@ -153,3 +162,11 @@ TEST_F(GPUInfoCollectorTest, GLVendorGL) {
EXPECT_EQ(test_values_.gl_vendor(), gl_vendor);
}
+TEST_F(GPUInfoCollectorTest, GLExtensionsGL) {
+ GPUInfo gpu_info;
+ gpu_info_collector::CollectGraphicsInfoGL(&gpu_info);
+ std::string gl_extensions = gpu_info.gl_extensions();
+ EXPECT_EQ(test_values_.gl_extensions(), gl_extensions);
+}
+
+