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 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 base::WeakPtr<VideoDecodeAccelerator::Client> weak_client = AsWeakPtr(); | 550 base::WeakPtr<VideoDecodeAccelerator::Client> weak_client = AsWeakPtr(); |
550 if (throttling_client_) { | 551 if (throttling_client_) { |
551 client = throttling_client_.get(); | 552 client = throttling_client_.get(); |
552 weak_client = throttling_client_->AsWeakPtr(); | 553 weak_client = throttling_client_->AsWeakPtr(); |
553 } | 554 } |
554 #if defined(OS_WIN) | 555 #if defined(OS_WIN) |
555 decoder_.reset( | 556 decoder_.reset( |
556 new DXVAVideoDecodeAccelerator(base::Bind(&DoNothingReturnTrue))); | 557 new DXVAVideoDecodeAccelerator(base::Bind(&DoNothingReturnTrue))); |
557 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) | 558 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
558 | 559 |
559 scoped_ptr<V4L2Device> device = V4L2Device::Create(); | 560 scoped_ptr<V4L2Device> device = V4L2Device::Create( |
| 561 static_cast<EGLContext>(rendering_helper_->GetGLContext())); |
560 if (!device.get()) { | 562 if (!device.get()) { |
561 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); | 563 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); |
562 return; | 564 return; |
563 } | 565 } |
564 decoder_.reset(new V4L2VideoDecodeAccelerator( | 566 decoder_.reset(new V4L2VideoDecodeAccelerator( |
565 static_cast<EGLDisplay>(rendering_helper_->GetGLDisplay()), | 567 static_cast<EGLDisplay>(rendering_helper_->GetGLDisplay()), |
566 weak_client, | 568 weak_client, |
567 base::Bind(&DoNothingReturnTrue), | 569 base::Bind(&DoNothingReturnTrue), |
568 device.Pass(), | 570 device.Pass(), |
569 base::MessageLoopProxy::current())); | 571 base::MessageLoopProxy::current())); |
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1535 CommandLine::Init(argc, argv); | 1537 CommandLine::Init(argc, argv); |
1536 | 1538 |
1537 // Needed to enable DVLOG through --vmodule. | 1539 // Needed to enable DVLOG through --vmodule. |
1538 logging::LoggingSettings settings; | 1540 logging::LoggingSettings settings; |
1539 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; | 1541 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
1540 CHECK(logging::InitLogging(settings)); | 1542 CHECK(logging::InitLogging(settings)); |
1541 | 1543 |
1542 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 1544 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
1543 DCHECK(cmd_line); | 1545 DCHECK(cmd_line); |
1544 | 1546 |
| 1547 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
| 1548 dlopen("/usr/lib/libtegrav4l2.so", RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE); |
| 1549 errno = 0; |
| 1550 #endif |
| 1551 |
1545 CommandLine::SwitchMap switches = cmd_line->GetSwitches(); | 1552 CommandLine::SwitchMap switches = cmd_line->GetSwitches(); |
1546 for (CommandLine::SwitchMap::const_iterator it = switches.begin(); | 1553 for (CommandLine::SwitchMap::const_iterator it = switches.begin(); |
1547 it != switches.end(); ++it) { | 1554 it != switches.end(); ++it) { |
1548 if (it->first == "test_video_data") { | 1555 if (it->first == "test_video_data") { |
1549 content::g_test_video_data = it->second.c_str(); | 1556 content::g_test_video_data = it->second.c_str(); |
1550 continue; | 1557 continue; |
1551 } | 1558 } |
1552 // TODO(wuchengli): remove frame_deliver_log after CrOS test get updated. | 1559 // TODO(wuchengli): remove frame_deliver_log after CrOS test get updated. |
1553 // See http://crosreview.com/175426. | 1560 // See http://crosreview.com/175426. |
1554 if (it->first == "frame_delivery_log" || it->first == "output_log") { | 1561 if (it->first == "frame_delivery_log" || it->first == "output_log") { |
(...skipping 13 matching lines...) Expand all Loading... |
1568 } | 1575 } |
1569 if (it->first == "v" || it->first == "vmodule") | 1576 if (it->first == "v" || it->first == "vmodule") |
1570 continue; | 1577 continue; |
1571 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; | 1578 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; |
1572 } | 1579 } |
1573 | 1580 |
1574 base::ShadowingAtExitManager at_exit_manager; | 1581 base::ShadowingAtExitManager at_exit_manager; |
1575 | 1582 |
1576 return RUN_ALL_TESTS(); | 1583 return RUN_ALL_TESTS(); |
1577 } | 1584 } |
OLD | NEW |