summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorrockot <rockot@chromium.org>2015-08-11 17:40:34 -0700
committerCommit bot <commit-bot@chromium.org>2015-08-12 00:41:18 +0000
commitccc61032355c3198efa69f388b84cf2f5548041b (patch)
tree5f7c00d3f60718b9a6d6dcaf472545ba606177fd /content
parentefecf8ac86019d7f191159279f46c1a90d071be9 (diff)
downloadchromium_src-ccc61032355c3198efa69f388b84cf2f5548041b.zip
chromium_src-ccc61032355c3198efa69f388b84cf2f5548041b.tar.gz
chromium_src-ccc61032355c3198efa69f388b84cf2f5548041b.tar.bz2
Revert of Move NumberOfPlanesForGpuMemoryBufferFormat to gfx (patchset #4 id:120001 of https://codereview.chromium.org/1281043006/ )
Reason for revert: This breaks Win 64 builds: http://build.chromium.org/p/chromium.win/builders/Win%20x64%20GN Original issue's description: > Move NumberOfPlanesForGpuMemoryBufferFormat to gfx > > We will need to call it from media::GpuMemoryBufferVideoFramePool when we > add support for YUV_420_BIPLANAR. > > BUG=510260 > TEST=No behavior change, only moving code. > CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel > > Committed: https://crrev.com/85f29861d095a7c5dcf318053e8349d1efaddbab > Cr-Commit-Position: refs/heads/master@{#342942} TBR=reveman@chromium.org,ccameron@chromium.org,msw@chromium.org,jbauman@chromium.org,avi@chromium.org,andresantoso@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=510260 Review URL: https://codereview.chromium.org/1291643002 Cr-Commit-Position: refs/heads/master@{#342948}
Diffstat (limited to 'content')
-rw-r--r--content/browser/renderer_host/media/video_capture_buffer_pool.cc7
-rw-r--r--content/child/child_thread_impl_browsertest.cc4
-rw-r--r--content/common/gpu/client/gpu_memory_buffer_impl.cc25
-rw-r--r--content/common/gpu/client/gpu_memory_buffer_impl.h4
-rw-r--r--content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.cc7
-rw-r--r--content/common/gpu/client/gpu_memory_buffer_impl_unittest.cc7
6 files changed, 40 insertions, 14 deletions
diff --git a/content/browser/renderer_host/media/video_capture_buffer_pool.cc b/content/browser/renderer_host/media/video_capture_buffer_pool.cc
index ea8ff20..4d3e9a1 100644
--- a/content/browser/renderer_host/media/video_capture_buffer_pool.cc
+++ b/content/browser/renderer_host/media/video_capture_buffer_pool.cc
@@ -8,9 +8,8 @@
#include "base/memory/scoped_ptr.h"
#include "base/stl_util.h"
#include "content/browser/gpu/browser_gpu_memory_buffer_manager.h"
+#include "content/common/gpu/client/gpu_memory_buffer_impl.h"
#include "content/public/browser/browser_thread.h"
-#include "ui/gfx/buffer_format_util.h"
-#include "ui/gfx/gpu_memory_buffer.h"
namespace content {
@@ -58,7 +57,9 @@ class GpuMemoryBufferBufferHandle
public:
GpuMemoryBufferBufferHandle(gfx::GpuMemoryBuffer* gmb, size_t size)
: gmb_(gmb),
- data_(new void*[gfx::NumberOfPlanesForBufferFormat(gmb_->GetFormat())]),
+ data_(new void* [GpuMemoryBufferImpl::
+ NumberOfPlanesForGpuMemoryBufferFormat(
+ gmb_->GetFormat())]),
size_(size) {
DCHECK(gmb && !gmb_->IsMapped());
gmb_->Map(data_.get());
diff --git a/content/child/child_thread_impl_browsertest.cc b/content/child/child_thread_impl_browsertest.cc
index add820c..d6b82a8 100644
--- a/content/child/child_thread_impl_browsertest.cc
+++ b/content/child/child_thread_impl_browsertest.cc
@@ -16,7 +16,6 @@
#include "content/public/test/content_browser_test.h"
#include "content/public/test/content_browser_test_utils.h"
#include "content/shell/browser/shell.h"
-#include "ui/gfx/buffer_format_util.h"
#include "url/gurl.h"
namespace content {
@@ -158,7 +157,8 @@ IN_PROC_BROWSER_TEST_P(ChildThreadImplGpuMemoryBufferBrowserTest,
ASSERT_TRUE(buffer);
EXPECT_EQ(format, buffer->GetFormat());
- size_t num_planes = gfx::NumberOfPlanesForBufferFormat(format);
+ size_t num_planes =
+ GpuMemoryBufferImpl::NumberOfPlanesForGpuMemoryBufferFormat(format);
// Map buffer planes.
scoped_ptr<void* []> planes(new void* [num_planes]);
diff --git a/content/common/gpu/client/gpu_memory_buffer_impl.cc b/content/common/gpu/client/gpu_memory_buffer_impl.cc
index 81af399..928faa9 100644
--- a/content/common/gpu/client/gpu_memory_buffer_impl.cc
+++ b/content/common/gpu/client/gpu_memory_buffer_impl.cc
@@ -7,7 +7,6 @@
#include "base/logging.h"
#include "base/numerics/safe_math.h"
#include "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h"
-#include "ui/gfx/buffer_format_util.h"
#include "ui/gl/gl_bindings.h"
#if defined(OS_MACOSX)
@@ -79,6 +78,28 @@ GpuMemoryBufferImpl* GpuMemoryBufferImpl::FromClientBuffer(
}
// static
+size_t GpuMemoryBufferImpl::NumberOfPlanesForGpuMemoryBufferFormat(
+ gfx::BufferFormat format) {
+ switch (format) {
+ case gfx::BufferFormat::ATC:
+ case gfx::BufferFormat::ATCIA:
+ case gfx::BufferFormat::DXT1:
+ case gfx::BufferFormat::DXT5:
+ case gfx::BufferFormat::ETC1:
+ case gfx::BufferFormat::R_8:
+ case gfx::BufferFormat::RGBA_4444:
+ case gfx::BufferFormat::RGBA_8888:
+ case gfx::BufferFormat::RGBX_8888:
+ case gfx::BufferFormat::BGRA_8888:
+ return 1;
+ case gfx::BufferFormat::YUV_420:
+ return 3;
+ }
+ NOTREACHED();
+ return 0;
+}
+
+// static
size_t GpuMemoryBufferImpl::SubsamplingFactor(gfx::BufferFormat format,
int plane) {
switch (format) {
@@ -155,7 +176,7 @@ bool GpuMemoryBufferImpl::BufferSizeInBytes(const gfx::Size& size,
gfx::BufferFormat format,
size_t* size_in_bytes) {
base::CheckedNumeric<size_t> checked_size = 0;
- size_t num_planes = gfx::NumberOfPlanesForBufferFormat(format);
+ size_t num_planes = NumberOfPlanesForGpuMemoryBufferFormat(format);
for (size_t i = 0; i < num_planes; ++i) {
size_t row_size_in_bytes = 0;
if (!RowSizeInBytes(size.width(), format, i, &row_size_in_bytes))
diff --git a/content/common/gpu/client/gpu_memory_buffer_impl.h b/content/common/gpu/client/gpu_memory_buffer_impl.h
index 4ef4637..9e5c7da 100644
--- a/content/common/gpu/client/gpu_memory_buffer_impl.h
+++ b/content/common/gpu/client/gpu_memory_buffer_impl.h
@@ -34,6 +34,10 @@ class CONTENT_EXPORT GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer {
// Type-checking upcast routine. Returns an NULL on failure.
static GpuMemoryBufferImpl* FromClientBuffer(ClientBuffer buffer);
+ // Returns the number of planes based on the format of the buffer.
+ static size_t NumberOfPlanesForGpuMemoryBufferFormat(
+ gfx::BufferFormat format);
+
// Returns the subsampling factor applied to the given zero-indexed |plane| of
// the |format| both horizontally and vertically.
static size_t SubsamplingFactor(gfx::BufferFormat format, int plane);
diff --git a/content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.cc b/content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.cc
index d869ef0..9db3696 100644
--- a/content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.cc
+++ b/content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.cc
@@ -6,7 +6,6 @@
#include "base/bind.h"
#include "base/numerics/safe_math.h"
-#include "ui/gfx/buffer_format_util.h"
#include "ui/gl/gl_bindings.h"
namespace content {
@@ -150,7 +149,7 @@ bool GpuMemoryBufferImplSharedMemory::IsSizeValidForFormat(
case gfx::BufferFormat::RGBX_8888:
return true;
case gfx::BufferFormat::YUV_420: {
- size_t num_planes = gfx::NumberOfPlanesForBufferFormat(format);
+ size_t num_planes = NumberOfPlanesForGpuMemoryBufferFormat(format);
for (size_t i = 0; i < num_planes; ++i) {
size_t factor = SubsamplingFactor(format, i);
if (size.width() % factor || size.height() % factor)
@@ -167,7 +166,7 @@ bool GpuMemoryBufferImplSharedMemory::IsSizeValidForFormat(
bool GpuMemoryBufferImplSharedMemory::Map(void** data) {
DCHECK(!mapped_);
size_t offset = 0;
- size_t num_planes = gfx::NumberOfPlanesForBufferFormat(format_);
+ size_t num_planes = NumberOfPlanesForGpuMemoryBufferFormat(format_);
for (size_t i = 0; i < num_planes; ++i) {
data[i] = reinterpret_cast<uint8*>(shared_memory_->memory()) + offset;
size_t row_size_in_bytes = 0;
@@ -187,7 +186,7 @@ void GpuMemoryBufferImplSharedMemory::Unmap() {
}
void GpuMemoryBufferImplSharedMemory::GetStride(int* stride) const {
- size_t num_planes = gfx::NumberOfPlanesForBufferFormat(format_);
+ size_t num_planes = NumberOfPlanesForGpuMemoryBufferFormat(format_);
for (size_t i = 0; i < num_planes; ++i) {
size_t row_size_in_bytes = 0;
bool valid_row_size =
diff --git a/content/common/gpu/client/gpu_memory_buffer_impl_unittest.cc b/content/common/gpu/client/gpu_memory_buffer_impl_unittest.cc
index 1ab1d99..d96c7f4 100644
--- a/content/common/gpu/client/gpu_memory_buffer_impl_unittest.cc
+++ b/content/common/gpu/client/gpu_memory_buffer_impl_unittest.cc
@@ -7,7 +7,6 @@
#include "base/bind.h"
#include "content/common/gpu/gpu_memory_buffer_factory.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "ui/gfx/buffer_format_util.h"
namespace content {
namespace {
@@ -93,7 +92,8 @@ TEST_P(GpuMemoryBufferImplTest, Map) {
EXPECT_FALSE(buffer->IsMapped());
size_t num_planes =
- gfx::NumberOfPlanesForBufferFormat(configuration.format);
+ GpuMemoryBufferImpl::NumberOfPlanesForGpuMemoryBufferFormat(
+ configuration.format);
// Map buffer into user space.
scoped_ptr<void*[]> mapped_buffers(new void*[num_planes]);
@@ -155,7 +155,8 @@ TEST_P(GpuMemoryBufferImplTest, PersistentMap) {
EXPECT_FALSE(buffer->IsMapped());
size_t num_planes =
- gfx::NumberOfPlanesForBufferFormat(configuration.format);
+ GpuMemoryBufferImpl::NumberOfPlanesForGpuMemoryBufferFormat(
+ configuration.format);
// Map buffer into user space.
scoped_ptr<void* []> mapped_buffers(new void* [num_planes]);