Commit 9eedbeee authored by danakj@chromium.org's avatar danakj@chromium.org

video: On ChromeOS don't assume GLX always.

Hardware video decode depends on GLX but we may be using OSMesa. In
this case fallback to non-hardware video decode gracefully instead
of static casting to an incorrect type.

This allows us to remove flags forcing non-OSMesa for some tests,
and they will test hardware decode on the ChromeOS VMs still.

These flags must go in order to support browser tests running
with a compositor instead of using legacy software mode, since
GLX inside the bot Xvfb environment can not run the compositor.
(This is a small piece of enabling us to test real code paths
in browser tests https://codereview.chromium.org/120313002/ .)

R=piman
BUG=270918

Review URL: https://codereview.chromium.org/132503002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244111 0039d316-1c4b-4281-b951-d872f2087c98
parent 91ddd08c
...@@ -53,9 +53,6 @@ class WebrtcBrowserTest : public WebRtcTestBase { ...@@ -53,9 +53,6 @@ class WebrtcBrowserTest : public WebRtcTestBase {
EXPECT_FALSE(command_line->HasSwitch( EXPECT_FALSE(command_line->HasSwitch(
switches::kUseFakeUIForMediaStream)); switches::kUseFakeUIForMediaStream));
// The video playback will not work without a GPU, so force its use here.
command_line->AppendSwitch(switches::kUseGpuInTests);
// Flag used by TestWebAudioMediaStream to force garbage collection. // Flag used by TestWebAudioMediaStream to force garbage collection.
command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose-gc"); command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose-gc");
} }
......
...@@ -27,6 +27,9 @@ class WebrtcAecDumpBrowserTest : public ContentBrowserTest { ...@@ -27,6 +27,9 @@ class WebrtcAecDumpBrowserTest : public ContentBrowserTest {
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
ASSERT_TRUE(CreateTemporaryFileInDir(temp_dir_.path(), &dump_file_)); ASSERT_TRUE(CreateTemporaryFileInDir(temp_dir_.path(), &dump_file_));
// These tests expect pixel output.
UseRealGLContexts();
ContentBrowserTest::SetUp(); ContentBrowserTest::SetUp();
} }
...@@ -38,10 +41,6 @@ class WebrtcAecDumpBrowserTest : public ContentBrowserTest { ...@@ -38,10 +41,6 @@ class WebrtcAecDumpBrowserTest : public ContentBrowserTest {
ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch( ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch(
switches::kUseFakeUIForMediaStream)); switches::kUseFakeUIForMediaStream));
// The video playback will not work without a GPU, so force its use here.
// This may not be available on all VMs though.
command_line->AppendSwitch(switches::kUseGpuInTests);
// Enable AEC dump with the command line flag. // Enable AEC dump with the command line flag.
command_line->AppendSwitchPath(switches::kEnableWebRtcAecRecordings, command_line->AppendSwitchPath(switches::kEnableWebRtcAecRecordings,
dump_file_); dump_file_);
......
...@@ -88,6 +88,12 @@ class WebrtcBrowserTest: public ContentBrowserTest { ...@@ -88,6 +88,12 @@ class WebrtcBrowserTest: public ContentBrowserTest {
WebrtcBrowserTest() {} WebrtcBrowserTest() {}
virtual ~WebrtcBrowserTest() {} virtual ~WebrtcBrowserTest() {}
virtual void SetUp() OVERRIDE {
// These tests require pixel output.
UseRealGLContexts();
ContentBrowserTest::SetUp();
}
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
// We need fake devices in this test since we want to run on naked VMs. We // We need fake devices in this test since we want to run on naked VMs. We
// assume these switches are set by default in content_browsertests. // assume these switches are set by default in content_browsertests.
...@@ -95,10 +101,6 @@ class WebrtcBrowserTest: public ContentBrowserTest { ...@@ -95,10 +101,6 @@ class WebrtcBrowserTest: public ContentBrowserTest {
switches::kUseFakeDeviceForMediaStream)); switches::kUseFakeDeviceForMediaStream));
ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch( ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch(
switches::kUseFakeUIForMediaStream)); switches::kUseFakeUIForMediaStream));
// The video playback will not work without a GPU, so force its use here.
// This may not be available on all VMs though.
command_line->AppendSwitch(switches::kUseGpuInTests);
} }
void DumpChromeTraceCallback( void DumpChromeTraceCallback(
......
...@@ -28,8 +28,9 @@ ...@@ -28,8 +28,9 @@
#elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) && defined(USE_X11) #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) && defined(USE_X11)
#include "content/common/gpu/media/v4l2_video_decode_accelerator.h" #include "content/common/gpu/media/v4l2_video_decode_accelerator.h"
#elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11) #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11)
#include "ui/gl/gl_context_glx.h"
#include "content/common/gpu/media/vaapi_video_decode_accelerator.h" #include "content/common/gpu/media/vaapi_video_decode_accelerator.h"
#include "ui/gl/gl_context_glx.h"
#include "ui/gl/gl_implementation.h"
#elif defined(OS_ANDROID) #elif defined(OS_ANDROID)
#include "content/common/gpu/media/android_video_decode_accelerator.h" #include "content/common/gpu/media/android_video_decode_accelerator.h"
#endif #endif
...@@ -278,6 +279,12 @@ void GpuVideoDecodeAccelerator::Initialize( ...@@ -278,6 +279,12 @@ void GpuVideoDecodeAccelerator::Initialize(
make_context_current_, make_context_current_,
io_message_loop_)); io_message_loop_));
#elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11) #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11)
if (gfx::GetGLImplementation() != gfx::kGLImplementationDesktopGL) {
VLOG(1) << "HW video decode acceleration not available without "
"DesktopGL (GLX).";
NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE);
return;
}
gfx::GLContextGLX* glx_context = gfx::GLContextGLX* glx_context =
static_cast<gfx::GLContextGLX*>(stub_->decoder()->GetGLContext()); static_cast<gfx::GLContextGLX*>(stub_->decoder()->GetGLContext());
video_decode_accelerator_.reset(new VaapiVideoDecodeAccelerator( video_decode_accelerator_.reset(new VaapiVideoDecodeAccelerator(
......
...@@ -59,6 +59,9 @@ ...@@ -59,6 +59,9 @@
#elif defined(ARCH_CPU_X86_FAMILY) #elif defined(ARCH_CPU_X86_FAMILY)
#include "content/common/gpu/media/vaapi_video_decode_accelerator.h" #include "content/common/gpu/media/vaapi_video_decode_accelerator.h"
#include "content/common/gpu/media/vaapi_wrapper.h" #include "content/common/gpu/media/vaapi_wrapper.h"
#if defined(USE_X11)
#include "ui/gl/gl_implementation.h"
#endif // USE_X11
#endif // ARCH_CPU_ARMEL #endif // ARCH_CPU_ARMEL
#else #else
#error The VideoAccelerator tests are not supported on this platform. #error The VideoAccelerator tests are not supported on this platform.
...@@ -553,6 +556,8 @@ void GLRenderingVDAClient::CreateAndStartDecoder() { ...@@ -553,6 +556,8 @@ void GLRenderingVDAClient::CreateAndStartDecoder() {
base::Bind(&DoNothingReturnTrue), base::Bind(&DoNothingReturnTrue),
base::MessageLoopProxy::current())); base::MessageLoopProxy::current()));
#elif defined(ARCH_CPU_X86_FAMILY) #elif defined(ARCH_CPU_X86_FAMILY)
CHECK_EQ(gfx::kGLImplementationDesktopGL, gfx::GetGLImplementation())
<< "Hardware video decode does not work with OSMesa";
decoder_.reset(new VaapiVideoDecodeAccelerator( decoder_.reset(new VaapiVideoDecodeAccelerator(
static_cast<Display*>(rendering_helper_->GetGLDisplay()), static_cast<Display*>(rendering_helper_->GetGLDisplay()),
client, client,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment