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 |
(...skipping 22 matching lines...) Expand all Loading... |
33 #include "base/stl_util.h" | 33 #include "base/stl_util.h" |
34 #include "base/string_number_conversions.h" | 34 #include "base/string_number_conversions.h" |
35 #include "base/string_split.h" | 35 #include "base/string_split.h" |
36 #include "base/stringize_macros.h" | 36 #include "base/stringize_macros.h" |
37 #include "base/synchronization/condition_variable.h" | 37 #include "base/synchronization/condition_variable.h" |
38 #include "base/synchronization/lock.h" | 38 #include "base/synchronization/lock.h" |
39 #include "base/synchronization/waitable_event.h" | 39 #include "base/synchronization/waitable_event.h" |
40 #include "base/threading/thread.h" | 40 #include "base/threading/thread.h" |
41 #include "base/utf_string_conversions.h" | 41 #include "base/utf_string_conversions.h" |
42 #include "content/common/gpu/media/rendering_helper.h" | 42 #include "content/common/gpu/media/rendering_helper.h" |
| 43 #include "content/public/common/content_switches.h" |
43 | 44 |
44 #if defined(OS_WIN) | 45 #if defined(OS_WIN) |
45 #include "content/common/gpu/media/dxva_video_decode_accelerator.h" | 46 #include "content/common/gpu/media/dxva_video_decode_accelerator.h" |
46 #elif defined(OS_MACOSX) | 47 #elif defined(OS_MACOSX) |
47 #include "content/common/gpu/media/mac_video_decode_accelerator.h" | 48 #include "content/common/gpu/media/mac_video_decode_accelerator.h" |
| 49 #elif defined(OS_CHROMEOS) |
| 50 #if defined(ARCH_CPU_ARMEL) |
| 51 #include "content/common/gpu/media/exynos_video_decode_accelerator.h" |
| 52 #include "content/common/gpu/media/omx_video_decode_accelerator.h" |
48 #elif defined(ARCH_CPU_X86_FAMILY) | 53 #elif defined(ARCH_CPU_X86_FAMILY) |
49 #include "content/common/gpu/media/vaapi_video_decode_accelerator.h" | 54 #include "content/common/gpu/media/vaapi_video_decode_accelerator.h" |
50 #elif defined(ARCH_CPU_ARMEL) | 55 #endif // ARCH_CPU_ARMEL |
51 #include "content/common/gpu/media/omx_video_decode_accelerator.h" | |
52 #else | 56 #else |
53 #error The VideoAccelerator tests are not supported on this platform. | 57 #error The VideoAccelerator tests are not supported on this platform. |
54 #endif // defined(OS_WIN) | 58 #endif // OS_WIN |
55 | 59 |
56 using media::VideoDecodeAccelerator; | 60 using media::VideoDecodeAccelerator; |
57 | 61 |
58 namespace content { | 62 namespace content { |
59 namespace { | 63 namespace { |
60 | 64 |
61 // Values optionally filled in from flags; see main() below. | 65 // Values optionally filled in from flags; see main() below. |
62 // The syntax of this variable is: | 66 // The syntax of this variable is: |
63 // filename:width:height:numframes:numfragments:minFPSwithRender:minFPSnoRender | 67 // filename:width:height:numframes:numfragments:minFPSwithRender:minFPSnoRender |
64 // where only the first field is required. Value details: | 68 // where only the first field is required. Value details: |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 | 329 |
326 void GLRenderingVDAClient::CreateDecoder() { | 330 void GLRenderingVDAClient::CreateDecoder() { |
327 CHECK(decoder_deleted()); | 331 CHECK(decoder_deleted()); |
328 CHECK(!decoder_.get()); | 332 CHECK(!decoder_.get()); |
329 #if defined(OS_WIN) | 333 #if defined(OS_WIN) |
330 decoder_.reset(new DXVAVideoDecodeAccelerator( | 334 decoder_.reset(new DXVAVideoDecodeAccelerator( |
331 this, base::Bind(&DoNothingReturnTrue))); | 335 this, base::Bind(&DoNothingReturnTrue))); |
332 #elif defined(OS_MACOSX) | 336 #elif defined(OS_MACOSX) |
333 decoder_.reset(new MacVideoDecodeAccelerator( | 337 decoder_.reset(new MacVideoDecodeAccelerator( |
334 static_cast<CGLContextObj>(rendering_helper_->GetGLContext()), this)); | 338 static_cast<CGLContextObj>(rendering_helper_->GetGLContext()), this)); |
335 #elif defined(ARCH_CPU_ARMEL) | 339 #elif defined(OS_CHROMEOS) |
336 decoder_.reset( | 340 #if defined(ARCH_CPU_ARMEL) |
337 new OmxVideoDecodeAccelerator( | 341 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseExynosVda)) { |
338 static_cast<EGLDisplay>(rendering_helper_->GetGLDisplay()), | 342 decoder_.reset( |
339 static_cast<EGLContext>(rendering_helper_->GetGLContext()), | 343 new ExynosVideoDecodeAccelerator( |
340 this, | 344 static_cast<EGLDisplay>(rendering_helper_->GetGLDisplay()), |
341 base::Bind(&DoNothingReturnTrue))); | 345 static_cast<EGLContext>(rendering_helper_->GetGLContext()), |
| 346 this, base::Bind(&DoNothingReturnTrue))); |
| 347 } else { |
| 348 decoder_.reset( |
| 349 new OmxVideoDecodeAccelerator( |
| 350 static_cast<EGLDisplay>(rendering_helper_->GetGLDisplay()), |
| 351 static_cast<EGLContext>(rendering_helper_->GetGLContext()), |
| 352 this, base::Bind(&DoNothingReturnTrue))); |
| 353 } |
342 #elif defined(ARCH_CPU_X86_FAMILY) | 354 #elif defined(ARCH_CPU_X86_FAMILY) |
343 decoder_.reset(new VaapiVideoDecodeAccelerator( | 355 decoder_.reset(new VaapiVideoDecodeAccelerator( |
344 static_cast<Display*>(rendering_helper_->GetGLDisplay()), | 356 static_cast<Display*>(rendering_helper_->GetGLDisplay()), |
345 static_cast<GLXContext>(rendering_helper_->GetGLContext()), | 357 static_cast<GLXContext>(rendering_helper_->GetGLContext()), |
346 this, base::Bind(&DoNothingReturnTrue))); | 358 this, base::Bind(&DoNothingReturnTrue))); |
| 359 #endif // ARCH_CPU_ARMEL |
347 #endif // OS_WIN | 360 #endif // OS_WIN |
348 CHECK(decoder_.get()); | 361 CHECK(decoder_.get()); |
349 SetState(CS_DECODER_SET); | 362 SetState(CS_DECODER_SET); |
350 if (decoder_deleted()) | 363 if (decoder_deleted()) |
351 return; | 364 return; |
352 | 365 |
353 // Configure the decoder. | 366 // Configure the decoder. |
354 media::VideoCodecProfile profile = media::H264PROFILE_BASELINE; | 367 media::VideoCodecProfile profile = media::H264PROFILE_BASELINE; |
355 if (profile_ != -1) | 368 if (profile_ != -1) |
356 profile = static_cast<media::VideoCodecProfile>(profile_); | 369 profile = static_cast<media::VideoCodecProfile>(profile_); |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
917 | 930 |
918 CommandLine::SwitchMap switches = cmd_line->GetSwitches(); | 931 CommandLine::SwitchMap switches = cmd_line->GetSwitches(); |
919 for (CommandLine::SwitchMap::const_iterator it = switches.begin(); | 932 for (CommandLine::SwitchMap::const_iterator it = switches.begin(); |
920 it != switches.end(); ++it) { | 933 it != switches.end(); ++it) { |
921 if (it->first == "test_video_data") { | 934 if (it->first == "test_video_data") { |
922 content::test_video_data = it->second.c_str(); | 935 content::test_video_data = it->second.c_str(); |
923 continue; | 936 continue; |
924 } | 937 } |
925 if (it->first == "v" || it->first == "vmodule") | 938 if (it->first == "v" || it->first == "vmodule") |
926 continue; | 939 continue; |
| 940 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
| 941 if (it->first == switches::kUseExynosVda) |
| 942 continue; |
| 943 #endif |
927 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; | 944 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; |
928 } | 945 } |
929 | 946 |
930 base::ShadowingAtExitManager at_exit_manager; | 947 base::ShadowingAtExitManager at_exit_manager; |
931 content::RenderingHelper::InitializePlatform(); | 948 content::RenderingHelper::InitializePlatform(); |
932 | 949 |
933 #if defined(OS_WIN) | 950 #if defined(OS_WIN) |
934 base::WaitableEvent event(true, false); | 951 base::WaitableEvent event(true, false); |
935 content::DXVAVideoDecodeAccelerator::PreSandboxInitialization( | 952 content::DXVAVideoDecodeAccelerator::PreSandboxInitialization( |
936 base::Bind(&base::WaitableEvent::Signal, | 953 base::Bind(&base::WaitableEvent::Signal, |
937 base::Unretained(&event))); | 954 base::Unretained(&event))); |
938 event.Wait(); | 955 event.Wait(); |
939 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) | 956 #elif defined(OS_CHROMEOS) |
940 content::OmxVideoDecodeAccelerator::PreSandboxInitialization(); | 957 #if defined(ARCH_CPU_ARMEL) |
941 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) | 958 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseExynosVda)) |
| 959 content::ExynosVideoDecodeAccelerator::PreSandboxInitialization(); |
| 960 else |
| 961 content::OmxVideoDecodeAccelerator::PreSandboxInitialization(); |
| 962 #elif defined(ARCH_CPU_X86_FAMILY) |
942 content::VaapiVideoDecodeAccelerator::PreSandboxInitialization(); | 963 content::VaapiVideoDecodeAccelerator::PreSandboxInitialization(); |
943 #endif | 964 #endif // ARCH_CPU_ARMEL |
| 965 #endif // OS_CHROMEOS |
944 | 966 |
945 return RUN_ALL_TESTS(); | 967 return RUN_ALL_TESTS(); |
946 } | 968 } |
OLD | NEW |