Chromium Code Reviews| 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 #include "media/filters/gpu_video_decoder.h" | 5 #include "media/filters/gpu_video_decoder.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| 11 #include "base/command_line.h" | |
| 11 #include "base/cpu.h" | 12 #include "base/cpu.h" |
| 12 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
| 13 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
| 14 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
| 15 #include "base/synchronization/waitable_event.h" | 16 #include "base/synchronization/waitable_event.h" |
| 16 #include "base/task_runner_util.h" | 17 #include "base/task_runner_util.h" |
| 17 #include "gpu/command_buffer/common/mailbox_holder.h" | 18 #include "gpu/command_buffer/common/mailbox_holder.h" |
| 18 #include "media/base/bind_to_current_loop.h" | 19 #include "media/base/bind_to_current_loop.h" |
| 19 #include "media/base/decoder_buffer.h" | 20 #include "media/base/decoder_buffer.h" |
| 20 #include "media/base/media_log.h" | 21 #include "media/base/media_log.h" |
| 22 #include "media/base/media_switches.h" | |
| 21 #include "media/base/pipeline.h" | 23 #include "media/base/pipeline.h" |
| 22 #include "media/base/pipeline_status.h" | 24 #include "media/base/pipeline_status.h" |
| 23 #include "media/base/video_decoder_config.h" | 25 #include "media/base/video_decoder_config.h" |
| 24 #include "media/filters/gpu_video_accelerator_factories.h" | 26 #include "media/filters/gpu_video_accelerator_factories.h" |
| 25 #include "third_party/skia/include/core/SkBitmap.h" | 27 #include "third_party/skia/include/core/SkBitmap.h" |
| 26 | 28 |
| 27 namespace media { | 29 namespace media { |
| 28 | 30 |
| 29 // Maximum number of concurrent VDA::Decode() operations GVD will maintain. | 31 // Maximum number of concurrent VDA::Decode() operations GVD will maintain. |
| 30 // Higher values allow better pipelining in the GPU, but also require more | 32 // Higher values allow better pipelining in the GPU, but also require more |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 115 } | 117 } |
| 116 | 118 |
| 117 static bool IsCodedSizeSupported(const gfx::Size& coded_size) { | 119 static bool IsCodedSizeSupported(const gfx::Size& coded_size) { |
| 118 // Only non-Windows, Ivy Bridge+ platforms can support more than 1920x1080. | 120 // Only non-Windows, Ivy Bridge+ platforms can support more than 1920x1080. |
| 119 // We test against 1088 to account for 16x16 macroblocks. | 121 // We test against 1088 to account for 16x16 macroblocks. |
| 120 if (coded_size.width() <= 1920 && coded_size.height() <= 1088) | 122 if (coded_size.width() <= 1920 && coded_size.height() <= 1088) |
| 121 return true; | 123 return true; |
| 122 | 124 |
| 123 base::CPU cpu; | 125 base::CPU cpu; |
| 124 bool hw_large_video_support = | 126 bool hw_large_video_support = |
| 125 (cpu.vendor_name() == "GenuineIntel") && cpu.model() >= 55; | 127 CommandLine::ForCurrentProcess()->HasSwitch( |
| 128 switches::kForce4kAcceleratedVideoDecode) || | |
| 129 ((cpu.vendor_name() == "GenuineIntel") && cpu.model() >= 55); | |
|
piman
2014/05/15 17:02:27
Is this in the renderer?
What would happen if the
Pawel Osciak
2014/05/16 03:53:01
This gates whether a HW or SW decoder is used. It'
| |
| 126 bool os_large_video_support = true; | 130 bool os_large_video_support = true; |
| 127 #if defined(OS_WIN) | 131 #if defined(OS_WIN) |
| 128 os_large_video_support = false; | 132 os_large_video_support = false; |
| 129 #endif | 133 #endif |
| 130 return os_large_video_support && hw_large_video_support; | 134 return os_large_video_support && hw_large_video_support; |
| 131 } | 135 } |
| 132 | 136 |
| 133 // Report |status| to UMA and run |cb| with it. This is super-specific to the | 137 // Report |status| to UMA and run |cb| with it. This is super-specific to the |
| 134 // UMA stat reported because the UMA_HISTOGRAM_ENUMERATION API requires a | 138 // UMA stat reported because the UMA_HISTOGRAM_ENUMERATION API requires a |
| 135 // callsite to always be called with the same stat name (can't parameterize it). | 139 // callsite to always be called with the same stat name (can't parameterize it). |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 640 return; | 644 return; |
| 641 } | 645 } |
| 642 } | 646 } |
| 643 | 647 |
| 644 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() | 648 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() |
| 645 const { | 649 const { |
| 646 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); | 650 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); |
| 647 } | 651 } |
| 648 | 652 |
| 649 } // namespace media | 653 } // namespace media |
| OLD | NEW |