OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // The bulk of this file is support code; sorry about that. Here's an overview | 5 // The bulk of this file is support code; sorry about that. Here's an overview |
6 // to hopefully help readers of this code: | 6 // to hopefully help readers of this code: |
7 // - RenderingHelper is charged with interacting with X11/{EGL/GLES2,GLX/GL} or | 7 // - RenderingHelper is charged with interacting with X11/{EGL/GLES2,GLX/GL} or |
8 // Win/EGL. | 8 // Win/EGL. |
9 // - ClientState is an enum for the state of the decode client used by the test. | 9 // - ClientState is an enum for the state of the decode client used by the test. |
10 // - ClientStateNotification is a barrier abstraction that allows the test code | 10 // - ClientStateNotification is a barrier abstraction that allows the test code |
11 // to be written sequentially and wait for the decode client to see certain | 11 // to be written sequentially and wait for the decode client to see certain |
12 // state transitions. | 12 // state transitions. |
13 // - GLRenderingVDAClient is a VideoDecodeAccelerator::Client implementation | 13 // - GLRenderingVDAClient is a VideoDecodeAccelerator::Client implementation |
14 // - Finally actual TEST cases are at the bottom of this file, using the above | 14 // - Finally actual TEST cases are at the bottom of this file, using the above |
15 // infrastructure. | 15 // infrastructure. |
16 | 16 |
17 #include <dlfcn.h> | |
17 #include <fcntl.h> | 18 #include <fcntl.h> |
18 #include <sys/stat.h> | 19 #include <sys/stat.h> |
19 #include <sys/types.h> | 20 #include <sys/types.h> |
20 #include <algorithm> | 21 #include <algorithm> |
21 #include <deque> | 22 #include <deque> |
22 #include <map> | 23 #include <map> |
23 | 24 |
24 // Include gtest.h out of order because <X11/X.h> #define's Bool & None, which | 25 // Include gtest.h out of order because <X11/X.h> #define's Bool & None, which |
25 // gtest uses as struct names (inside a namespace). This means that | 26 // gtest uses as struct names (inside a namespace). This means that |
26 // #include'ing gtest after anything that pulls in X.h fails to compile. | 27 // #include'ing gtest after anything that pulls in X.h fails to compile. |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
552 if (throttling_client_) { | 553 if (throttling_client_) { |
553 client = throttling_client_.get(); | 554 client = throttling_client_.get(); |
554 weak_client = throttling_client_->AsWeakPtr(); | 555 weak_client = throttling_client_->AsWeakPtr(); |
555 } | 556 } |
556 #if defined(OS_WIN) | 557 #if defined(OS_WIN) |
557 decoder_.reset( | 558 decoder_.reset( |
558 new DXVAVideoDecodeAccelerator(base::Bind(&DoNothingReturnTrue))); | 559 new DXVAVideoDecodeAccelerator(base::Bind(&DoNothingReturnTrue))); |
559 #elif defined(OS_CHROMEOS) | 560 #elif defined(OS_CHROMEOS) |
560 #if defined(ARCH_CPU_ARMEL) | 561 #if defined(ARCH_CPU_ARMEL) |
561 | 562 |
562 scoped_ptr<V4L2Device> device = V4L2Device::Create(); | 563 scoped_ptr<V4L2Device> device = V4L2Device::Create( |
564 static_cast<EGLContext>(rendering_helper_->GetGLContext())); | |
563 if (!device.get()) { | 565 if (!device.get()) { |
564 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); | 566 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); |
565 return; | 567 return; |
566 } | 568 } |
567 decoder_.reset(new V4L2VideoDecodeAccelerator( | 569 decoder_.reset(new V4L2VideoDecodeAccelerator( |
568 static_cast<EGLDisplay>(rendering_helper_->GetGLDisplay()), | 570 static_cast<EGLDisplay>(rendering_helper_->GetGLDisplay()), |
569 weak_client, | 571 weak_client, |
570 base::Bind(&DoNothingReturnTrue), | 572 base::Bind(&DoNothingReturnTrue), |
571 device.Pass(), | 573 device.Pass(), |
572 base::MessageLoopProxy::current())); | 574 base::MessageLoopProxy::current())); |
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1548 // Needed to enable DVLOG through --vmodule. | 1550 // Needed to enable DVLOG through --vmodule. |
1549 logging::LoggingSettings settings; | 1551 logging::LoggingSettings settings; |
1550 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; | 1552 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
1551 settings.dcheck_state = | 1553 settings.dcheck_state = |
1552 logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS; | 1554 logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS; |
1553 CHECK(logging::InitLogging(settings)); | 1555 CHECK(logging::InitLogging(settings)); |
1554 | 1556 |
1555 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 1557 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
1556 DCHECK(cmd_line); | 1558 DCHECK(cmd_line); |
1557 | 1559 |
1560 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) | |
1561 dlopen("/usr/lib/libtegrav4l2.so", RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE); | |
1562 errno = 0; | |
1563 #endif | |
sheu
2014/03/07 00:18:08
VaapiWrapper does the dlopen once statically in In
| |
1564 | |
1558 CommandLine::SwitchMap switches = cmd_line->GetSwitches(); | 1565 CommandLine::SwitchMap switches = cmd_line->GetSwitches(); |
1559 for (CommandLine::SwitchMap::const_iterator it = switches.begin(); | 1566 for (CommandLine::SwitchMap::const_iterator it = switches.begin(); |
1560 it != switches.end(); ++it) { | 1567 it != switches.end(); ++it) { |
1561 if (it->first == "test_video_data") { | 1568 if (it->first == "test_video_data") { |
1562 content::g_test_video_data = it->second.c_str(); | 1569 content::g_test_video_data = it->second.c_str(); |
1563 continue; | 1570 continue; |
1564 } | 1571 } |
1565 // TODO(wuchengli): remove frame_deliver_log after CrOS test get updated. | 1572 // TODO(wuchengli): remove frame_deliver_log after CrOS test get updated. |
1566 // See http://crosreview.com/175426. | 1573 // See http://crosreview.com/175426. |
1567 if (it->first == "frame_delivery_log" || it->first == "output_log") { | 1574 if (it->first == "frame_delivery_log" || it->first == "output_log") { |
(...skipping 13 matching lines...) Expand all Loading... | |
1581 } | 1588 } |
1582 if (it->first == "v" || it->first == "vmodule") | 1589 if (it->first == "v" || it->first == "vmodule") |
1583 continue; | 1590 continue; |
1584 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; | 1591 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; |
1585 } | 1592 } |
1586 | 1593 |
1587 base::ShadowingAtExitManager at_exit_manager; | 1594 base::ShadowingAtExitManager at_exit_manager; |
1588 | 1595 |
1589 return RUN_ALL_TESTS(); | 1596 return RUN_ALL_TESTS(); |
1590 } | 1597 } |
OLD | NEW |