summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorfsamuel <fsamuel@chromium.org>2016-03-16 20:00:14 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-17 03:01:15 +0000
commit919cc1e06ee6e0a4ad1a217e03d5f7b912383831 (patch)
tree0c1d3f42fe54bcf72fab78faef2ab9480f07df22 /content
parent765ae6a97898b49c4ae7162c3aaef4126991a2ea (diff)
downloadchromium_src-919cc1e06ee6e0a4ad1a217e03d5f7b912383831.zip
chromium_src-919cc1e06ee6e0a4ad1a217e03d5f7b912383831.tar.gz
chromium_src-919cc1e06ee6e0a4ad1a217e03d5f7b912383831.tar.bz2
Move gl_helper to content/browser/compositor
content/common/gpu/client/gl_helper.{h|cc} depends on media. It looks like it's only used by content/browser/compositor anyway, so I moved it there. BUG=586384 Review URL: https://codereview.chromium.org/1802383002 Cr-Commit-Position: refs/heads/master@{#381651}
Diffstat (limited to 'content')
-rw-r--r--content/browser/compositor/buffer_queue.cc2
-rw-r--r--content/browser/compositor/buffer_queue_unittest.cc2
-rw-r--r--content/browser/compositor/delegated_frame_host.cc2
-rw-r--r--content/browser/compositor/gl_helper.cc (renamed from content/common/gpu/client/gl_helper.cc)365
-rw-r--r--content/browser/compositor/gl_helper.h (renamed from content/common/gpu/client/gl_helper.h)11
-rw-r--r--content/browser/compositor/gl_helper_benchmark.cc (renamed from content/common/gpu/client/gl_helper_benchmark.cc)146
-rw-r--r--content/browser/compositor/gl_helper_readback_support.cc (renamed from content/common/gpu/client/gl_helper_readback_support.cc)12
-rw-r--r--content/browser/compositor/gl_helper_readback_support.h (renamed from content/common/gpu/client/gl_helper_readback_support.h)15
-rw-r--r--content/browser/compositor/gl_helper_scaling.cc (renamed from content/common/gpu/client/gl_helper_scaling.cc)147
-rw-r--r--content/browser/compositor/gl_helper_scaling.h (renamed from content/common/gpu/client/gl_helper_scaling.h)68
-rw-r--r--content/browser/compositor/gl_helper_unittest.cc (renamed from content/common/gpu/client/gl_helper_unittest.cc)527
-rw-r--r--content/browser/compositor/gpu_process_transport_factory.cc2
-rw-r--r--content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.cc2
-rw-r--r--content/browser/compositor/owned_mailbox.cc2
-rw-r--r--content/browser/compositor/reflector_texture.cc2
-rw-r--r--content/browser/compositor/surface_utils.cc2
-rw-r--r--content/browser/compositor/test/no_transport_image_transport_factory.cc2
-rw-r--r--content/browser/media/capture/aura_window_capture_machine.cc2
-rw-r--r--content/browser/renderer_host/compositor_impl_android.cc2
-rw-r--r--content/browser/renderer_host/media/video_capture_controller.cc2
-rw-r--r--content/browser/renderer_host/render_widget_host_view_android.cc2
-rw-r--r--content/browser/renderer_host/render_widget_host_view_aura.cc2
-rw-r--r--content/browser/renderer_host/render_widget_host_view_aura_unittest.cc2
-rw-r--r--content/content_browser.gypi6
-rw-r--r--content/content_common.gypi6
-rw-r--r--content/content_tests.gypi4
-rw-r--r--content/renderer/media/renderer_gpu_video_accelerator_factories.cc1
-rw-r--r--content/test/BUILD.gn4
28 files changed, 444 insertions, 898 deletions
diff --git a/content/browser/compositor/buffer_queue.cc b/content/browser/compositor/buffer_queue.cc
index dbe2ee2..fe306aa 100644
--- a/content/browser/compositor/buffer_queue.cc
+++ b/content/browser/compositor/buffer_queue.cc
@@ -6,10 +6,10 @@
#include "base/containers/adapters.h"
#include "build/build_config.h"
+#include "content/browser/compositor/gl_helper.h"
#include "content/browser/compositor/image_transport_factory.h"
#include "content/browser/gpu/browser_gpu_memory_buffer_manager.h"
#include "content/common/gpu/client/context_provider_command_buffer.h"
-#include "content/common/gpu/client/gl_helper.h"
#include "gpu/GLES2/gl2extchromium.h"
#include "gpu/command_buffer/client/gles2_interface.h"
#include "gpu/command_buffer/service/image_factory.h"
diff --git a/content/browser/compositor/buffer_queue_unittest.cc b/content/browser/compositor/buffer_queue_unittest.cc
index 323d7ae..0a93a7e 100644
--- a/content/browser/compositor/buffer_queue_unittest.cc
+++ b/content/browser/compositor/buffer_queue_unittest.cc
@@ -11,9 +11,9 @@
#include "cc/test/test_context_provider.h"
#include "cc/test/test_web_graphics_context_3d.h"
+#include "content/browser/compositor/gl_helper.h"
#include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.h"
#include "content/browser/gpu/browser_gpu_memory_buffer_manager.h"
-#include "content/common/gpu/client/gl_helper.h"
#include "gpu/GLES2/gl2extchromium.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/content/browser/compositor/delegated_frame_host.cc b/content/browser/compositor/delegated_frame_host.cc
index e6ab7bb..348e436 100644
--- a/content/browser/compositor/delegated_frame_host.cc
+++ b/content/browser/compositor/delegated_frame_host.cc
@@ -21,10 +21,10 @@
#include "cc/surfaces/surface_factory.h"
#include "cc/surfaces/surface_hittest.h"
#include "cc/surfaces/surface_manager.h"
+#include "content/browser/compositor/gl_helper.h"
#include "content/browser/compositor/resize_lock.h"
#include "content/browser/compositor/surface_utils.h"
#include "content/browser/gpu/compositor_util.h"
-#include "content/common/gpu/client/gl_helper.h"
#include "content/public/browser/render_widget_host_view_frame_subscriber.h"
#include "content/public/common/content_switches.h"
#include "media/base/video_frame.h"
diff --git a/content/common/gpu/client/gl_helper.cc b/content/browser/compositor/gl_helper.cc
index 5549caa..55493e9 100644
--- a/content/common/gpu/client/gl_helper.cc
+++ b/content/browser/compositor/gl_helper.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "content/common/gpu/client/gl_helper.h"
+#include "content/browser/compositor/gl_helper.h"
#include <stddef.h>
#include <stdint.h>
@@ -19,8 +19,8 @@
#include "base/strings/string_util.h"
#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
-#include "content/common/gpu/client/gl_helper_readback_support.h"
-#include "content/common/gpu/client/gl_helper_scaling.h"
+#include "content/browser/compositor/gl_helper_readback_support.h"
+#include "content/browser/compositor/gl_helper_scaling.h"
#include "gpu/GLES2/gl2extchromium.h"
#include "gpu/command_buffer/client/context_support.h"
#include "gpu/command_buffer/common/mailbox.h"
@@ -55,19 +55,12 @@ class TextureFrameBufferPair {
TextureFrameBufferPair(GLES2Interface* gl, gfx::Size size)
: texture_(gl), framebuffer_(gl), size_(size) {
content::ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl, texture_);
- gl->TexImage2D(GL_TEXTURE_2D,
- 0,
- GL_RGBA,
- size.width(),
- size.height(),
- 0,
- GL_RGBA,
- GL_UNSIGNED_BYTE,
- NULL);
+ gl->TexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size.width(), size.height(), 0,
+ GL_RGBA, GL_UNSIGNED_BYTE, NULL);
content::ScopedFramebufferBinder<GL_FRAMEBUFFER> framebuffer_binder(
gl, framebuffer_);
- gl->FramebufferTexture2D(
- GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture_, 0);
+ gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ GL_TEXTURE_2D, texture_, 0);
}
GLuint texture() const { return texture_.id(); }
@@ -255,9 +248,8 @@ class GLHelper::CopyTextureToImpl
delete request;
}
}
- void Add(Request* r) {
- requests_.push(r);
- }
+ void Add(Request* r) { requests_.push(r); }
+
private:
std::queue<Request*> requests_;
DISALLOW_COPY_AND_ASSIGN(FinishRequestHelper);
@@ -370,7 +362,7 @@ class GLHelper::CopyTextureToImpl
bool swizzle);
static void nullcallback(bool success) {}
- void ReadbackDone(Request *request, int bytes_per_pixel);
+ void ReadbackDone(Request* request, int bytes_per_pixel);
void FinishRequest(Request* request,
bool result,
FinishRequestHelper* helper);
@@ -400,12 +392,8 @@ GLHelper::ScalerInterface* GLHelper::CreateScaler(ScalerQuality quality,
bool vertically_flip_texture,
bool swizzle) {
InitScalerImpl();
- return scaler_impl_->CreateScaler(quality,
- src_size,
- src_subrect,
- dst_size,
- vertically_flip_texture,
- swizzle);
+ return scaler_impl_->CreateScaler(quality, src_size, src_subrect, dst_size,
+ vertically_flip_texture, swizzle);
}
GLuint GLHelper::CopyTextureToImpl::ScaleTexture(
@@ -430,23 +418,12 @@ GLuint GLHelper::CopyTextureToImpl::ScaleTexture(
type = GL_UNSIGNED_SHORT_5_6_5;
}
- gl_->TexImage2D(GL_TEXTURE_2D,
- 0,
- format,
- dst_size.width(),
- dst_size.height(),
- 0,
- format,
- type,
- NULL);
+ gl_->TexImage2D(GL_TEXTURE_2D, 0, format, dst_size.width(),
+ dst_size.height(), 0, format, type, NULL);
}
scoped_ptr<ScalerInterface> scaler(
- helper_->CreateScaler(quality,
- src_size,
- src_subrect,
- dst_size,
- vertically_flip_texture,
- swizzle));
+ helper_->CreateScaler(quality, src_size, src_subrect, dst_size,
+ vertically_flip_texture, swizzle));
scaler->Scale(src_texture, dst_texture);
return dst_texture;
}
@@ -464,15 +441,9 @@ GLuint GLHelper::CopyTextureToImpl::EncodeTextureAsGrayscale(
gfx::Size((src_size.width() + 3) / 4, src_size.height());
{
ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl_, dst_texture);
- gl_->TexImage2D(GL_TEXTURE_2D,
- 0,
- GL_RGBA,
- encoded_texture_size->width(),
- encoded_texture_size->height(),
- 0,
- GL_RGBA,
- GL_UNSIGNED_BYTE,
- NULL);
+ gl_->TexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, encoded_texture_size->width(),
+ encoded_texture_size->height(), 0, GL_RGBA,
+ GL_UNSIGNED_BYTE, NULL);
}
helper_->InitScalerImpl();
@@ -480,9 +451,7 @@ GLuint GLHelper::CopyTextureToImpl::EncodeTextureAsGrayscale(
helper_->scaler_impl_.get()->CreatePlanarScaler(
src_size,
gfx::Rect(0, 0, (src_size.width() + 3) & ~3, src_size.height()),
- *encoded_texture_size,
- vertically_flip_texture,
- swizzle,
+ *encoded_texture_size, vertically_flip_texture, swizzle,
kRGBtoGrayscaleColorWeights));
grayscale_scaler->Scale(src_texture, dst_texture);
return dst_texture;
@@ -506,26 +475,18 @@ void GLHelper::CopyTextureToImpl::ReadbackAsync(
gl_->GenBuffers(1, &request->buffer);
gl_->BindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, request->buffer);
gl_->BufferData(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM,
- bytes_per_pixel * dst_size.GetArea(),
- NULL,
- GL_STREAM_READ);
+ bytes_per_pixel * dst_size.GetArea(), NULL, GL_STREAM_READ);
request->query = 0u;
gl_->GenQueriesEXT(1, &request->query);
gl_->BeginQueryEXT(GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM, request->query);
- gl_->ReadPixels(0,
- 0,
- dst_size.width(),
- dst_size.height(),
- format,
- type,
+ gl_->ReadPixels(0, 0, dst_size.width(), dst_size.height(), format, type,
NULL);
gl_->EndQueryEXT(GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM);
gl_->BindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, 0);
context_support_->SignalQuery(
- request->query,
- base::Bind(&CopyTextureToImpl::ReadbackDone, AsWeakPtr(),
- request, bytes_per_pixel));
+ request->query, base::Bind(&CopyTextureToImpl::ReadbackDone, AsWeakPtr(),
+ request, bytes_per_pixel));
}
void GLHelper::CopyTextureToImpl::CropScaleReadbackAndCleanTexture(
@@ -548,8 +509,8 @@ void GLHelper::CopyTextureToImpl::CropScaleReadbackAndCleanTexture(
readback_color_type = kRGBA_8888_SkColorType;
}
- FormatSupport supported = GetReadbackConfig(
- readback_color_type, true, &format, &type, &bytes_per_pixel);
+ FormatSupport supported = GetReadbackConfig(readback_color_type, true,
+ &format, &type, &bytes_per_pixel);
if (supported == GLHelperReadbackSupport::NOT_SUPPORTED) {
callback.Run(false);
@@ -571,16 +532,11 @@ void GLHelper::CopyTextureToImpl::CropScaleReadbackAndCleanTexture(
bool scale_swizzle = out_color_type == kAlpha_8_SkColorType
? false
: supported == GLHelperReadbackSupport::SWIZZLE;
- texture =
- ScaleTexture(src_texture,
- src_size,
- src_subrect,
- dst_size,
- true,
- scale_swizzle,
- out_color_type == kAlpha_8_SkColorType ? kN32_SkColorType
- : out_color_type,
- quality);
+ texture = ScaleTexture(src_texture, src_size, src_subrect, dst_size, true,
+ scale_swizzle, out_color_type == kAlpha_8_SkColorType
+ ? kN32_SkColorType
+ : out_color_type,
+ quality);
DCHECK(texture);
}
@@ -593,12 +549,9 @@ void GLHelper::CopyTextureToImpl::CropScaleReadbackAndCleanTexture(
// EncodeTextureAsGrayscale by default creates a texture which should be
// read back as RGBA, so need to swizzle if the readback format is BGRA.
bool encode_as_grayscale_swizzle = format == GL_BGRA_EXT;
- GLuint tmp_texture =
- EncodeTextureAsGrayscale(texture,
- dst_size,
- &readback_texture_size,
- encode_as_grayscale_vertical_flip,
- encode_as_grayscale_swizzle);
+ GLuint tmp_texture = EncodeTextureAsGrayscale(
+ texture, dst_size, &readback_texture_size,
+ encode_as_grayscale_vertical_flip, encode_as_grayscale_swizzle);
// If the scaled texture was created - delete it
if (scale_texture)
gl_->DeleteTextures(1, &texture);
@@ -611,32 +564,22 @@ void GLHelper::CopyTextureToImpl::CropScaleReadbackAndCleanTexture(
ScopedFramebufferBinder<GL_FRAMEBUFFER> framebuffer_binder(gl_,
dst_framebuffer);
ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl_, texture);
- gl_->FramebufferTexture2D(GL_FRAMEBUFFER,
- GL_COLOR_ATTACHMENT0,
- GL_TEXTURE_2D,
- texture,
- 0);
+ gl_->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
+ texture, 0);
int32_t bytes_per_row = out_color_type == kAlpha_8_SkColorType
? dst_size.width()
: dst_size.width() * bytes_per_pixel;
- ReadbackAsync(readback_texture_size,
- bytes_per_row,
- bytes_per_row,
- out,
- format,
- type,
- bytes_per_pixel,
- callback);
+ ReadbackAsync(readback_texture_size, bytes_per_row, bytes_per_row, out,
+ format, type, bytes_per_pixel, callback);
gl_->DeleteTextures(1, &texture);
}
-void GLHelper::CopyTextureToImpl::ReadbackTextureSync(
- GLuint texture,
- const gfx::Rect& src_rect,
- unsigned char* out,
- SkColorType color_type) {
+void GLHelper::CopyTextureToImpl::ReadbackTextureSync(GLuint texture,
+ const gfx::Rect& src_rect,
+ unsigned char* out,
+ SkColorType color_type) {
GLenum format, type;
size_t bytes_per_pixel;
FormatSupport supported =
@@ -649,15 +592,10 @@ void GLHelper::CopyTextureToImpl::ReadbackTextureSync(
ScopedFramebufferBinder<GL_FRAMEBUFFER> framebuffer_binder(gl_,
dst_framebuffer);
ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl_, texture);
- gl_->FramebufferTexture2D(
- GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
- gl_->ReadPixels(src_rect.x(),
- src_rect.y(),
- src_rect.width(),
- src_rect.height(),
- format,
- type,
- out);
+ gl_->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
+ texture, 0);
+ gl_->ReadPixels(src_rect.x(), src_rect.y(), src_rect.width(),
+ src_rect.height(), format, type, out);
}
void GLHelper::CopyTextureToImpl::ReadbackTextureAsync(
@@ -679,19 +617,11 @@ void GLHelper::CopyTextureToImpl::ReadbackTextureAsync(
ScopedFramebufferBinder<GL_FRAMEBUFFER> framebuffer_binder(gl_,
dst_framebuffer);
ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl_, texture);
- gl_->FramebufferTexture2D(GL_FRAMEBUFFER,
- GL_COLOR_ATTACHMENT0,
- GL_TEXTURE_2D,
- texture,
- 0);
- ReadbackAsync(dst_size,
- dst_size.width() * bytes_per_pixel,
- dst_size.width() * bytes_per_pixel,
- out,
- format,
- type,
- bytes_per_pixel,
- callback);
+ gl_->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
+ texture, 0);
+ ReadbackAsync(dst_size, dst_size.width() * bytes_per_pixel,
+ dst_size.width() * bytes_per_pixel, out, format, type,
+ bytes_per_pixel, callback);
}
GLuint GLHelper::CopyTextureToImpl::CopyAndScaleTexture(
@@ -700,12 +630,8 @@ GLuint GLHelper::CopyTextureToImpl::CopyAndScaleTexture(
const gfx::Size& dst_size,
bool vertically_flip_texture,
GLHelper::ScalerQuality quality) {
- return ScaleTexture(src_texture,
- src_size,
- gfx::Rect(src_size),
- dst_size,
- vertically_flip_texture,
- false,
+ return ScaleTexture(src_texture, src_size, gfx::Rect(src_size), dst_size,
+ vertically_flip_texture, false,
kRGBA_8888_SkColorType, // GL_RGBA
quality);
}
@@ -808,14 +734,9 @@ void GLHelper::CropScaleReadbackAndCleanTexture(
const base::Callback<void(bool)>& callback,
GLHelper::ScalerQuality quality) {
InitCopyTextToImpl();
- copy_texture_to_impl_->CropScaleReadbackAndCleanTexture(src_texture,
- src_size,
- src_subrect,
- dst_size,
- out,
- out_color_type,
- callback,
- quality);
+ copy_texture_to_impl_->CropScaleReadbackAndCleanTexture(
+ src_texture, src_size, src_subrect, dst_size, out, out_color_type,
+ callback, quality);
}
void GLHelper::CropScaleReadbackAndCleanMailbox(
@@ -829,13 +750,8 @@ void GLHelper::CropScaleReadbackAndCleanMailbox(
const base::Callback<void(bool)>& callback,
GLHelper::ScalerQuality quality) {
GLuint mailbox_texture = ConsumeMailboxToTexture(src_mailbox, sync_token);
- CropScaleReadbackAndCleanTexture(mailbox_texture,
- src_size,
- src_subrect,
- dst_size,
- out,
- out_color_type,
- callback,
+ CropScaleReadbackAndCleanTexture(mailbox_texture, src_size, src_subrect,
+ dst_size, out, out_color_type, callback,
quality);
gl_->DeleteTextures(1, &mailbox_texture);
}
@@ -855,11 +771,8 @@ void GLHelper::ReadbackTextureAsync(
SkColorType color_type,
const base::Callback<void(bool)>& callback) {
InitCopyTextToImpl();
- copy_texture_to_impl_->ReadbackTextureAsync(texture,
- dst_size,
- out,
- color_type,
- callback);
+ copy_texture_to_impl_->ReadbackTextureAsync(texture, dst_size, out,
+ color_type, callback);
}
GLuint GLHelper::CopyTexture(GLuint texture, const gfx::Size& size) {
@@ -891,8 +804,8 @@ GLuint GLHelper::CompileShaderFromSource(const GLchar* source, GLenum type) {
if (log_length) {
scoped_ptr<GLchar[]> log(new GLchar[log_length]);
GLsizei returned_log_length = 0;
- gl_->GetShaderInfoLog(
- shader, log_length, &returned_log_length, log.get());
+ gl_->GetShaderInfoLog(shader, log_length, &returned_log_length,
+ log.get());
LOG(ERROR) << std::string(log.get(), returned_log_length);
}
gl_->DeleteShader(shader);
@@ -992,33 +905,20 @@ GLuint GLHelper::ConsumeMailboxToTexture(const gpu::Mailbox& mailbox,
void GLHelper::ResizeTexture(GLuint texture, const gfx::Size& size) {
content::ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl_, texture);
- gl_->TexImage2D(GL_TEXTURE_2D,
- 0,
- GL_RGB,
- size.width(),
- size.height(),
- 0,
- GL_RGB,
- GL_UNSIGNED_BYTE,
- NULL);
+ gl_->TexImage2D(GL_TEXTURE_2D, 0, GL_RGB, size.width(), size.height(), 0,
+ GL_RGB, GL_UNSIGNED_BYTE, NULL);
}
void GLHelper::CopyTextureSubImage(GLuint texture, const gfx::Rect& rect) {
content::ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl_, texture);
- gl_->CopyTexSubImage2D(GL_TEXTURE_2D,
- 0,
- rect.x(),
- rect.y(),
- rect.x(),
- rect.y(),
- rect.width(),
- rect.height());
+ gl_->CopyTexSubImage2D(GL_TEXTURE_2D, 0, rect.x(), rect.y(), rect.x(),
+ rect.y(), rect.width(), rect.height());
}
void GLHelper::CopyTextureFullImage(GLuint texture, const gfx::Size& size) {
content::ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl_, texture);
- gl_->CopyTexImage2D(
- GL_TEXTURE_2D, 0, GL_RGB, 0, 0, size.width(), size.height(), 0);
+ gl_->CopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, size.width(),
+ size.height(), 0);
}
void GLHelper::Flush() {
@@ -1039,15 +939,11 @@ void GLHelper::CopyTextureToImpl::ReadbackPlane(
const base::Callback<void(bool)>& callback) {
gl_->BindFramebuffer(GL_FRAMEBUFFER, source->framebuffer());
const size_t offset = target->stride(plane) * (paste_rect.y() >> size_shift) +
- (paste_rect.x() >> size_shift);
- ReadbackAsync(source->size(),
- paste_rect.width() >> size_shift,
- target->stride(plane),
- target->data(plane) + offset,
+ (paste_rect.x() >> size_shift);
+ ReadbackAsync(source->size(), paste_rect.width() >> size_shift,
+ target->stride(plane), target->data(plane) + offset,
(swizzle == kSwizzleBGRA) ? GL_BGRA_EXT : GL_RGBA,
- GL_UNSIGNED_BYTE,
- 4,
- callback);
+ GL_UNSIGNED_BYTE, 4, callback);
}
const float GLHelper::CopyTextureToImpl::kRGBtoYColorWeights[] = {
@@ -1085,10 +981,7 @@ GLHelper::CopyTextureToImpl::ReadbackYUVImpl::ReadbackYUVImpl(
y_(gl,
scaler_impl->CreatePlanarScaler(
dst_size,
- gfx::Rect(0,
- 0,
- (dst_size.width() + 3) & ~3,
- dst_size.height()),
+ gfx::Rect(0, 0, (dst_size.width() + 3) & ~3, dst_size.height()),
gfx::Size((dst_size.width() + 3) / 4, dst_size.height()),
false,
(swizzle == kSwizzleBGRA),
@@ -1100,8 +993,7 @@ GLHelper::CopyTextureToImpl::ReadbackYUVImpl::ReadbackYUVImpl(
0,
(dst_size.width() + 7) & ~7,
(dst_size.height() + 1) & ~1),
- gfx::Size((dst_size.width() + 7) / 8,
- (dst_size.height() + 1) / 2),
+ gfx::Size((dst_size.width() + 7) / 8, (dst_size.height() + 1) / 2),
false,
(swizzle == kSwizzleBGRA),
kRGBtoUColorWeights)),
@@ -1112,8 +1004,7 @@ GLHelper::CopyTextureToImpl::ReadbackYUVImpl::ReadbackYUVImpl(
0,
(dst_size.width() + 7) & ~7,
(dst_size.height() + 1) & ~1),
- gfx::Size((dst_size.width() + 7) / 8,
- (dst_size.height() + 1) / 2),
+ gfx::Size((dst_size.width() + 7) / 8, (dst_size.height() + 1) / 2),
false,
(swizzle == kSwizzleBGRA),
kRGBtoVColorWeights)) {
@@ -1158,27 +1049,15 @@ void GLHelper::CopyTextureToImpl::ReadbackYUVImpl::ReadbackYUV(
// Read back planes, one at a time. Keep the video frame alive while doing the
// readback.
- copy_impl_->ReadbackPlane(y_.texture_and_framebuffer(),
- target,
- media::VideoFrame::kYPlane,
- 0,
- paste_rect,
- swizzle_,
+ copy_impl_->ReadbackPlane(y_.texture_and_framebuffer(), target,
+ media::VideoFrame::kYPlane, 0, paste_rect, swizzle_,
base::Bind(&nullcallback));
- copy_impl_->ReadbackPlane(u_.texture_and_framebuffer(),
- target,
- media::VideoFrame::kUPlane,
- 1,
- paste_rect,
- swizzle_,
+ copy_impl_->ReadbackPlane(u_.texture_and_framebuffer(), target,
+ media::VideoFrame::kUPlane, 1, paste_rect, swizzle_,
base::Bind(&nullcallback));
copy_impl_->ReadbackPlane(
- v_.texture_and_framebuffer(),
- target,
- media::VideoFrame::kVPlane,
- 1,
- paste_rect,
- swizzle_,
+ v_.texture_and_framebuffer(), target, media::VideoFrame::kVPlane, 1,
+ paste_rect, swizzle_,
base::Bind(&CallbackKeepingVideoFrameAlive, target, callback));
gl_->BindFramebuffer(GL_FRAMEBUFFER, 0);
media::LetterboxYUV(target.get(), paste_rect);
@@ -1217,36 +1096,23 @@ GLHelper::CopyTextureToImpl::ReadbackYUV_MRT::ReadbackYUV_MRT(
GLHelperScaling::SHADER_YUV_MRT_PASS1)),
pass2_shader_(scaler_impl->CreateYuvMrtShader(
gfx::Size((dst_size.width() + 3) / 4, dst_size.height()),
- gfx::Rect(0,
- 0,
- (dst_size.width() + 7) / 8 * 2,
- dst_size.height()),
- gfx::Size((dst_size.width() + 7) / 8,
- (dst_size.height() + 1) / 2),
+ gfx::Rect(0, 0, (dst_size.width() + 7) / 8 * 2, dst_size.height()),
+ gfx::Size((dst_size.width() + 7) / 8, (dst_size.height() + 1) / 2),
false,
(swizzle == kSwizzleBGRA),
GLHelperScaling::SHADER_YUV_MRT_PASS2)),
y_(gl, gfx::Size((dst_size.width() + 3) / 4, dst_size.height())),
uv_(gl),
u_(gl,
- gfx::Size((dst_size.width() + 7) / 8,
- (dst_size.height() + 1) / 2)),
+ gfx::Size((dst_size.width() + 7) / 8, (dst_size.height() + 1) / 2)),
v_(gl,
- gfx::Size((dst_size.width() + 7) / 8,
- (dst_size.height() + 1) / 2)) {
+ gfx::Size((dst_size.width() + 7) / 8, (dst_size.height() + 1) / 2)) {
DCHECK(!(dst_size.width() & 1));
DCHECK(!(dst_size.height() & 1));
content::ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl, uv_);
- gl->TexImage2D(GL_TEXTURE_2D,
- 0,
- GL_RGBA,
- (dst_size.width() + 3) / 4,
- dst_size.height(),
- 0,
- GL_RGBA,
- GL_UNSIGNED_BYTE,
- NULL);
+ gl->TexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (dst_size.width() + 3) / 4,
+ dst_size.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
}
void GLHelper::CopyTextureToImpl::ReadbackYUV_MRT::ReadbackYUV(
@@ -1293,27 +1159,12 @@ void GLHelper::CopyTextureToImpl::ReadbackYUV_MRT::ReadbackYUV(
}
// Read back planes, one at a time.
- copy_impl_->ReadbackPlane(&y_,
- target,
- media::VideoFrame::kYPlane,
- 0,
- paste_rect,
- swizzle_,
- base::Bind(&nullcallback));
- copy_impl_->ReadbackPlane(&u_,
- target,
- media::VideoFrame::kUPlane,
- 1,
- paste_rect,
- swizzle_,
- base::Bind(&nullcallback));
+ copy_impl_->ReadbackPlane(&y_, target, media::VideoFrame::kYPlane, 0,
+ paste_rect, swizzle_, base::Bind(&nullcallback));
+ copy_impl_->ReadbackPlane(&u_, target, media::VideoFrame::kUPlane, 1,
+ paste_rect, swizzle_, base::Bind(&nullcallback));
copy_impl_->ReadbackPlane(
- &v_,
- target,
- media::VideoFrame::kVPlane,
- 1,
- paste_rect,
- swizzle_,
+ &v_, target, media::VideoFrame::kVPlane, 1, paste_rect, swizzle_,
base::Bind(&CallbackKeepingVideoFrameAlive, target, callback));
gl_->BindFramebuffer(GL_FRAMEBUFFER, 0);
media::LetterboxYUV(target.get(), paste_rect);
@@ -1341,8 +1192,8 @@ ReadbackYUVInterface* GLHelper::CopyTextureToImpl::CreateReadbackPipelineYUV(
// ReadbackPlane() we will choose GL_RGBA/GL_BGRA_EXT based on swizzle
GLenum format, type;
size_t bytes_per_pixel;
- FormatSupport supported = GetReadbackConfig(
- kRGBA_8888_SkColorType, true, &format, &type, &bytes_per_pixel);
+ FormatSupport supported = GetReadbackConfig(kRGBA_8888_SkColorType, true,
+ &format, &type, &bytes_per_pixel);
DCHECK((format == GL_RGBA || format == GL_BGRA_EXT) &&
type == GL_UNSIGNED_BYTE);
@@ -1351,24 +1202,12 @@ ReadbackYUVInterface* GLHelper::CopyTextureToImpl::CreateReadbackPipelineYUV(
swizzle = kSwizzleBGRA;
if (max_draw_buffers_ >= 2 && use_mrt) {
- return new ReadbackYUV_MRT(gl_,
- this,
- helper_->scaler_impl_.get(),
- quality,
- src_size,
- src_subrect,
- dst_size,
- flip_vertically,
+ return new ReadbackYUV_MRT(gl_, this, helper_->scaler_impl_.get(), quality,
+ src_size, src_subrect, dst_size, flip_vertically,
swizzle);
}
- return new ReadbackYUVImpl(gl_,
- this,
- helper_->scaler_impl_.get(),
- quality,
- src_size,
- src_subrect,
- dst_size,
- flip_vertically,
+ return new ReadbackYUVImpl(gl_, this, helper_->scaler_impl_.get(), quality,
+ src_size, src_subrect, dst_size, flip_vertically,
swizzle);
}
@@ -1380,12 +1219,8 @@ ReadbackYUVInterface* GLHelper::CreateReadbackPipelineYUV(
bool flip_vertically,
bool use_mrt) {
InitCopyTextToImpl();
- return copy_texture_to_impl_->CreateReadbackPipelineYUV(quality,
- src_size,
- src_subrect,
- dst_size,
- flip_vertically,
- use_mrt);
+ return copy_texture_to_impl_->CreateReadbackPipelineYUV(
+ quality, src_size, src_subrect, dst_size, flip_vertically, use_mrt);
}
} // namespace content
diff --git a/content/common/gpu/client/gl_helper.h b/content/browser/compositor/gl_helper.h
index 2be3f5a..ebfc1a3 100644
--- a/content/common/gpu/client/gl_helper.h
+++ b/content/browser/compositor/gl_helper.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_
-#define CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_
+#ifndef CONTENT_BROWSER_COMPOSITOR_GL_HELPER_H_
+#define CONTENT_BROWSER_COMPOSITOR_GL_HELPER_H_
#include "base/atomicops.h"
#include "base/callback.h"
@@ -338,10 +338,7 @@ class CONTENT_EXPORT GLHelper {
// Creates |scaler_impl_| if NULL.
void InitScalerImpl();
- enum ReadbackSwizzle {
- kSwizzleNone = 0,
- kSwizzleBGRA
- };
+ enum ReadbackSwizzle { kSwizzleNone = 0, kSwizzleBGRA };
gpu::gles2::GLES2Interface* gl_;
gpu::ContextSupport* context_support_;
@@ -379,4 +376,4 @@ class CONTENT_EXPORT ReadbackYUVInterface {
} // namespace content
-#endif // CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_
+#endif // CONTENT_BROWSER_COMPOSITOR_GL_HELPER_H_
diff --git a/content/common/gpu/client/gl_helper_benchmark.cc b/content/browser/compositor/gl_helper_benchmark.cc
index 43a1dbc..fa87bf0 100644
--- a/content/common/gpu/client/gl_helper_benchmark.cc
+++ b/content/browser/compositor/gl_helper_benchmark.cc
@@ -24,8 +24,8 @@
#include "base/macros.h"
#include "base/strings/stringprintf.h"
#include "base/time/time.h"
-#include "content/common/gpu/client/gl_helper.h"
-#include "content/common/gpu/client/gl_helper_scaling.h"
+#include "content/browser/compositor/gl_helper.h"
+#include "content/browser/compositor/gl_helper_scaling.h"
#include "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkBitmap.h"
@@ -39,15 +39,13 @@ using blink::WebGLId;
using blink::WebGraphicsContext3D;
content::GLHelper::ScalerQuality kQualities[] = {
- content::GLHelper::SCALER_QUALITY_BEST,
- content::GLHelper::SCALER_QUALITY_GOOD,
- content::GLHelper::SCALER_QUALITY_FAST,
+ content::GLHelper::SCALER_QUALITY_BEST,
+ content::GLHelper::SCALER_QUALITY_GOOD,
+ content::GLHelper::SCALER_QUALITY_FAST,
};
-const char *kQualityNames[] = {
- "best",
- "good",
- "fast",
+const char* kQualityNames[] = {
+ "best", "good", "fast",
};
class GLHelperTest : public testing::Test {
@@ -59,12 +57,10 @@ class GLHelperTest : public testing::Test {
CreateOffscreenContext(attributes, lose_context_when_out_of_memory);
context_->InitializeOnCurrentThread();
- helper_.reset(
- new content::GLHelper(context_->GetGLInterface(),
- context_->GetContextSupport()));
+ helper_.reset(new content::GLHelper(context_->GetGLInterface(),
+ context_->GetContextSupport()));
helper_scaling_.reset(new content::GLHelperScaling(
- context_->GetGLInterface(),
- helper_.get()));
+ context_->GetGLInterface(), helper_.get()));
}
void TearDown() override {
@@ -73,9 +69,7 @@ class GLHelperTest : public testing::Test {
context_.reset(NULL);
}
-
- void LoadPngFileToSkBitmap(const base::FilePath& filename,
- SkBitmap* bitmap) {
+ void LoadPngFileToSkBitmap(const base::FilePath& filename, SkBitmap* bitmap) {
std::string compressed;
base::ReadFileToString(base::MakeAbsoluteFilePath(filename), &compressed);
ASSERT_TRUE(compressed.size());
@@ -91,10 +85,8 @@ class GLHelperTest : public testing::Test {
static_cast<unsigned char*>(bitmap->getPixels()),
gfx::PNGCodec::FORMAT_BGRA,
gfx::Size(bitmap->width(), bitmap->height()),
- static_cast<int>(bitmap->rowBytes()),
- true,
- std::vector<gfx::PNGCodec::Comment>(),
- &compressed));
+ static_cast<int>(bitmap->rowBytes()), true,
+ std::vector<gfx::PNGCodec::Comment>(), &compressed));
ASSERT_TRUE(compressed.size());
FILE* f = base::OpenFile(filename, "wb");
ASSERT_TRUE(f);
@@ -110,30 +102,19 @@ class GLHelperTest : public testing::Test {
std::deque<GLHelperScaling::ScaleOp> x_ops_, y_ops_;
};
-
TEST_F(GLHelperTest, ScaleBenchmark) {
- int output_sizes[] = { 1920, 1080,
- 1249, 720, // Output size on pixel
- 256, 144 };
- int input_sizes[] = { 3200, 2040,
- 2560, 1476, // Pixel tab size
- 1920, 1080,
- 1280, 720,
- 800, 480,
- 256, 144 };
+ int output_sizes[] = {1920, 1080, 1249, 720, // Output size on pixel
+ 256, 144};
+ int input_sizes[] = {3200, 2040, 2560, 1476, // Pixel tab size
+ 1920, 1080, 1280, 720, 800, 480, 256, 144};
for (size_t q = 0; q < arraysize(kQualities); q++) {
- for (size_t outsize = 0;
- outsize < arraysize(output_sizes);
- outsize += 2) {
- for (size_t insize = 0;
- insize < arraysize(input_sizes);
- insize += 2) {
+ for (size_t outsize = 0; outsize < arraysize(output_sizes); outsize += 2) {
+ for (size_t insize = 0; insize < arraysize(input_sizes); insize += 2) {
WebGLId src_texture = context_->createTexture();
WebGLId dst_texture = context_->createTexture();
WebGLId framebuffer = context_->createFramebuffer();
- const gfx::Size src_size(input_sizes[insize],
- input_sizes[insize + 1]);
+ const gfx::Size src_size(input_sizes[insize], input_sizes[insize + 1]);
const gfx::Size dst_size(output_sizes[outsize],
output_sizes[outsize + 1]);
SkBitmap input;
@@ -144,35 +125,18 @@ TEST_F(GLHelperTest, ScaleBenchmark) {
context_->bindFramebuffer(GL_FRAMEBUFFER, framebuffer);
context_->bindTexture(GL_TEXTURE_2D, dst_texture);
- context_->texImage2D(GL_TEXTURE_2D,
- 0,
- GL_RGBA,
- dst_size.width(),
- dst_size.height(),
- 0,
- GL_RGBA,
- GL_UNSIGNED_BYTE,
+ context_->texImage2D(GL_TEXTURE_2D, 0, GL_RGBA, dst_size.width(),
+ dst_size.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE,
0);
context_->bindTexture(GL_TEXTURE_2D, src_texture);
- context_->texImage2D(GL_TEXTURE_2D,
- 0,
- GL_RGBA,
- src_size.width(),
- src_size.height(),
- 0,
- GL_RGBA,
- GL_UNSIGNED_BYTE,
+ context_->texImage2D(GL_TEXTURE_2D, 0, GL_RGBA, src_size.width(),
+ src_size.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE,
input.getPixels());
- gfx::Rect src_subrect(0, 0,
- src_size.width(), src_size.height());
+ gfx::Rect src_subrect(0, 0, src_size.width(), src_size.height());
scoped_ptr<content::GLHelper::ScalerInterface> scaler(
- helper_->CreateScaler(kQualities[q],
- src_size,
- src_subrect,
- dst_size,
- false,
- false));
+ helper_->CreateScaler(kQualities[q], src_size, src_subrect,
+ dst_size, false, false));
// Scale once beforehand before we start measuring.
scaler->Scale(src_texture, dst_texture);
context_->finish();
@@ -200,15 +164,13 @@ TEST_F(GLHelperTest, ScaleBenchmark) {
context_->deleteFramebuffer(framebuffer);
std::string name;
- name = base::StringPrintf("scale_%dx%d_to_%dx%d_%s",
- src_size.width(),
- src_size.height(),
- dst_size.width(),
- dst_size.height(),
- kQualityNames[q]);
+ name = base::StringPrintf("scale_%dx%d_to_%dx%d_%s", src_size.width(),
+ src_size.height(), dst_size.width(),
+ dst_size.height(), kQualityNames[q]);
float ms = (end_time - start_time).InMillisecondsF() / iterations;
- printf("*RESULT gpu_scale_time: %s=%.2f ms\n", name.c_str(), ms);
+ VLOG(0) << base::StringPrintf("*RESULT gpu_scale_time: %s=%.2f ms\n",
+ name.c_str(), ms);
}
}
}
@@ -222,36 +184,20 @@ TEST_F(GLHelperTest, ScaleBenchmark) {
// the table below.
TEST_F(GLHelperTest, DISABLED_ScaleTestImage) {
int percents[] = {
- 230,
- 180,
- 150,
- 110,
- 90,
- 70,
- 50,
- 49,
- 40,
- 20,
- 10,
+ 230, 180, 150, 110, 90, 70, 50, 49, 40, 20, 10,
};
SkBitmap input;
- LoadPngFileToSkBitmap(base::FilePath(
- FILE_PATH_LITERAL("testimage.png")), &input);
+ LoadPngFileToSkBitmap(base::FilePath(FILE_PATH_LITERAL("testimage.png")),
+ &input);
WebGLId framebuffer = context_->createFramebuffer();
WebGLId src_texture = context_->createTexture();
const gfx::Size src_size(input.width(), input.height());
context_->bindFramebuffer(GL_FRAMEBUFFER, framebuffer);
context_->bindTexture(GL_TEXTURE_2D, src_texture);
- context_->texImage2D(GL_TEXTURE_2D,
- 0,
- GL_RGBA,
- src_size.width(),
- src_size.height(),
- 0,
- GL_RGBA,
- GL_UNSIGNED_BYTE,
+ context_->texImage2D(GL_TEXTURE_2D, 0, GL_RGBA, src_size.width(),
+ src_size.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE,
input.getPixels());
for (size_t q = 0; q < arraysize(kQualities); q++) {
@@ -259,27 +205,19 @@ TEST_F(GLHelperTest, DISABLED_ScaleTestImage) {
const gfx::Size dst_size(input.width() * percents[p] / 100,
input.height() * percents[p] / 100);
WebGLId dst_texture = helper_->CopyAndScaleTexture(
- src_texture,
- src_size,
- dst_size,
- false,
- kQualities[q]);
+ src_texture, src_size, dst_size, false, kQualities[q]);
SkBitmap output_pixels;
output_pixels.allocN32Pixels(dst_size.width(), dst_size.height());
helper_->ReadbackTextureSync(
- dst_texture,
- gfx::Rect(0, 0,
- dst_size.width(),
- dst_size.height()),
- static_cast<unsigned char *>(output_pixels.getPixels()),
+ dst_texture, gfx::Rect(0, 0, dst_size.width(), dst_size.height()),
+ static_cast<unsigned char*>(output_pixels.getPixels()),
kN32_SkColorType);
context_->deleteTexture(dst_texture);
std::string filename = base::StringPrintf("testoutput_%s_%d.ppm",
- kQualityNames[q],
- percents[p]);
- VLOG(0) << "Writing " << filename;
+ kQualityNames[q], percents[p]);
+ VLOG(0) << "Writing " << filename;
SaveToFile(&output_pixels, base::FilePath::FromUTF8Unsafe(filename));
}
}
diff --git a/content/common/gpu/client/gl_helper_readback_support.cc b/content/browser/compositor/gl_helper_readback_support.cc
index 91df07c..c389eda 100644
--- a/content/common/gpu/client/gl_helper_readback_support.cc
+++ b/content/browser/compositor/gl_helper_readback_support.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "content/common/gpu/client/gl_helper_readback_support.h"
+#include "content/browser/compositor/gl_helper_readback_support.h"
#include "base/logging.h"
#include "gpu/GLES2/gl2extchromium.h"
#include "third_party/skia/include/core/SkImageInfo.h"
@@ -81,20 +81,20 @@ void GLHelperReadbackSupport::GetAdditionalFormat(GLenum format,
gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- gl_->TexImage2D(
- GL_TEXTURE_2D, 0, format, kTestSize, kTestSize, 0, format, type, NULL);
+ gl_->TexImage2D(GL_TEXTURE_2D, 0, format, kTestSize, kTestSize, 0, format,
+ type, NULL);
ScopedFramebuffer dst_framebuffer(gl_);
ScopedFramebufferBinder<GL_FRAMEBUFFER> framebuffer_binder(gl_,
dst_framebuffer);
- gl_->FramebufferTexture2D(
- GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, dst_texture, 0);
+ gl_->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
+ dst_texture, 0);
GLint format_tmp = 0, type_tmp = 0;
gl_->GetIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT, &format_tmp);
gl_->GetIntegerv(GL_IMPLEMENTATION_COLOR_READ_TYPE, &type_tmp);
*format_out = format_tmp;
*type_out = type_tmp;
- struct FormatCacheEntry entry = { format, type, *format_out, *type_out };
+ struct FormatCacheEntry entry = {format, type, *format_out, *type_out};
format_cache_.push_back(entry);
}
diff --git a/content/common/gpu/client/gl_helper_readback_support.h b/content/browser/compositor/gl_helper_readback_support.h
index f9329e9..8f83a1f 100644
--- a/content/common/gpu/client/gl_helper_readback_support.h
+++ b/content/browser/compositor/gl_helper_readback_support.h
@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CONTENT_COMMON_GPU_CLIENT_GL_HELPER_READBACK_SUPPORT_H_
-#define CONTENT_COMMON_GPU_CLIENT_GL_HELPER_READBACK_SUPPORT_H_
+#ifndef CONTENT_BROWSER_COMPOSITOR_GL_HELPER_READBACK_SUPPORT_H_
+#define CONTENT_BROWSER_COMPOSITOR_GL_HELPER_READBACK_SUPPORT_H_
#include <stddef.h>
#include <vector>
-#include "content/common/gpu/client/gl_helper.h"
+#include "content/browser/compositor/gl_helper.h"
namespace content {
@@ -36,8 +36,11 @@ class CONTENT_EXPORT GLHelperReadbackSupport {
size_t* bytes_per_pixel);
// Provides the additional readback format/type pairing for a render target
// of a given format/type pairing
- void GetAdditionalFormat(GLenum format, GLenum type, GLenum *format_out,
- GLenum *type_out);
+ void GetAdditionalFormat(GLenum format,
+ GLenum type,
+ GLenum* format_out,
+ GLenum* type_out);
+
private:
struct FormatCacheEntry {
GLenum format;
@@ -69,4 +72,4 @@ class CONTENT_EXPORT GLHelperReadbackSupport {
} // namespace content
-#endif // CONTENT_COMMON_GPU_CLIENT_GL_HELPER_READBACK_SUPPORT_H_
+#endif // CONTENT_BROWSER_COMPOSITOR_GL_HELPER_READBACK_SUPPORT_H_
diff --git a/content/common/gpu/client/gl_helper_scaling.cc b/content/browser/compositor/gl_helper_scaling.cc
index 9df4f1a..0c7d977 100644
--- a/content/common/gpu/client/gl_helper_scaling.cc
+++ b/content/browser/compositor/gl_helper_scaling.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "content/common/gpu/client/gl_helper_scaling.h"
+#include "content/browser/compositor/gl_helper_scaling.h"
#include <stddef.h>
@@ -146,14 +146,8 @@ class ScalerImpl : public GLHelper::ScalerInterface,
gl_->GenTextures(1, &intermediate_texture_);
ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl_,
intermediate_texture_);
- gl_->TexImage2D(GL_TEXTURE_2D,
- 0,
- GL_RGBA,
- spec_.src_size.width(),
- spec_.src_size.height(),
- 0,
- GL_RGBA,
- GL_UNSIGNED_BYTE,
+ gl_->TexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, spec_.src_size.width(),
+ spec_.src_size.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE,
NULL);
}
}
@@ -178,11 +172,8 @@ class ScalerImpl : public GLHelper::ScalerInterface,
scoped_ptr<GLenum[]> buffers(new GLenum[dest_textures.size()]);
for (size_t t = 0; t < dest_textures.size(); t++) {
ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl_, dest_textures[t]);
- gl_->FramebufferTexture2D(GL_FRAMEBUFFER,
- GL_COLOR_ATTACHMENT0 + t,
- GL_TEXTURE_2D,
- dest_textures[t],
- 0);
+ gl_->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + t,
+ GL_TEXTURE_2D, dest_textures[t], 0);
buffers[t] = GL_COLOR_ATTACHMENT0 + t;
}
ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl_, source_texture);
@@ -194,12 +185,9 @@ class ScalerImpl : public GLHelper::ScalerInterface,
ScopedBufferBinder<GL_ARRAY_BUFFER> buffer_binder(
gl_, scaler_helper_->vertex_attributes_buffer_);
- shader_program_->UseProgram(spec_.src_size,
- spec_.src_subrect,
- spec_.dst_size,
- spec_.scale_x,
- spec_.vertically_flip_texture,
- color_weights_);
+ shader_program_->UseProgram(spec_.src_size, spec_.src_subrect,
+ spec_.dst_size, spec_.scale_x,
+ spec_.vertically_flip_texture, color_weights_);
gl_->Viewport(0, 0, spec_.dst_size.width(), spec_.dst_size.height());
if (dest_textures.size() > 1) {
@@ -382,13 +370,9 @@ void GLHelperScaling::ConvertScalerOpsToScalerStages(
}
}
- scaler_stages->push_back(ScalerStage(current_shader,
- src_size,
- src_subrect,
- intermediate_size,
- scale_x,
- vertically_flip_texture,
- swizzle));
+ scaler_stages->push_back(ScalerStage(current_shader, src_size, src_subrect,
+ intermediate_size, scale_x,
+ vertically_flip_texture, swizzle));
src_size = intermediate_size;
src_subrect = gfx::Rect(intermediate_size);
vertically_flip_texture = false;
@@ -406,37 +390,23 @@ void GLHelperScaling::ComputeScalerStages(
std::vector<ScalerStage>* scaler_stages) {
if (quality == GLHelper::SCALER_QUALITY_FAST ||
src_subrect.size() == dst_size) {
- scaler_stages->push_back(ScalerStage(SHADER_BILINEAR,
- src_size,
- src_subrect,
- dst_size,
- false,
- vertically_flip_texture,
- swizzle));
+ scaler_stages->push_back(ScalerStage(SHADER_BILINEAR, src_size, src_subrect,
+ dst_size, false,
+ vertically_flip_texture, swizzle));
return;
}
std::deque<GLHelperScaling::ScaleOp> x_ops, y_ops;
- GLHelperScaling::ScaleOp::AddOps(src_subrect.width(),
- dst_size.width(),
- true,
+ GLHelperScaling::ScaleOp::AddOps(src_subrect.width(), dst_size.width(), true,
quality == GLHelper::SCALER_QUALITY_GOOD,
&x_ops);
- GLHelperScaling::ScaleOp::AddOps(src_subrect.height(),
- dst_size.height(),
- false,
- quality == GLHelper::SCALER_QUALITY_GOOD,
- &y_ops);
-
- ConvertScalerOpsToScalerStages(quality,
- src_size,
- src_subrect,
- dst_size,
- vertically_flip_texture,
- swizzle,
- &x_ops,
- &y_ops,
- scaler_stages);
+ GLHelperScaling::ScaleOp::AddOps(
+ src_subrect.height(), dst_size.height(), false,
+ quality == GLHelper::SCALER_QUALITY_GOOD, &y_ops);
+
+ ConvertScalerOpsToScalerStages(quality, src_size, src_subrect, dst_size,
+ vertically_flip_texture, swizzle, &x_ops,
+ &y_ops, scaler_stages);
}
GLHelper::ScalerInterface* GLHelperScaling::CreateScaler(
@@ -447,13 +417,8 @@ GLHelper::ScalerInterface* GLHelperScaling::CreateScaler(
bool vertically_flip_texture,
bool swizzle) {
std::vector<ScalerStage> scaler_stages;
- ComputeScalerStages(quality,
- src_size,
- src_subrect,
- dst_size,
- vertically_flip_texture,
- swizzle,
- &scaler_stages);
+ ComputeScalerStages(quality, src_size, src_subrect, dst_size,
+ vertically_flip_texture, swizzle, &scaler_stages);
ScalerImpl* ret = NULL;
for (unsigned int i = 0; i < scaler_stages.size(); i++) {
@@ -469,13 +434,8 @@ GLHelper::ScalerInterface* GLHelperScaling::CreatePlanarScaler(
bool vertically_flip_texture,
bool swizzle,
const float color_weights[4]) {
- ScalerStage stage(SHADER_PLANAR,
- src_size,
- src_subrect,
- dst_size,
- true,
- vertically_flip_texture,
- swizzle);
+ ScalerStage stage(SHADER_PLANAR, src_size, src_subrect, dst_size, true,
+ vertically_flip_texture, swizzle);
return new ScalerImpl(gl_, this, stage, NULL, color_weights);
}
@@ -487,28 +447,22 @@ GLHelperScaling::ShaderInterface* GLHelperScaling::CreateYuvMrtShader(
bool swizzle,
ShaderType shader) {
DCHECK(shader == SHADER_YUV_MRT_PASS1 || shader == SHADER_YUV_MRT_PASS2);
- ScalerStage stage(shader,
- src_size,
- src_subrect,
- dst_size,
- true,
- vertically_flip_texture,
- swizzle);
+ ScalerStage stage(shader, src_size, src_subrect, dst_size, true,
+ vertically_flip_texture, swizzle);
return new ScalerImpl(gl_, this, stage, NULL, NULL);
}
const GLfloat GLHelperScaling::kVertexAttributes[] = {
- -1.0f, -1.0f, 0.0f, 0.0f, // vertex 0
- 1.0f, -1.0f, 1.0f, 0.0f, // vertex 1
- -1.0f, 1.0f, 0.0f, 1.0f, // vertex 2
- 1.0f, 1.0f, 1.0f, 1.0f, }; // vertex 3
+ -1.0f, -1.0f, 0.0f, 0.0f, // vertex 0
+ 1.0f, -1.0f, 1.0f, 0.0f, // vertex 1
+ -1.0f, 1.0f, 0.0f, 1.0f, // vertex 2
+ 1.0f, 1.0f, 1.0f, 1.0f,
+}; // vertex 3
void GLHelperScaling::InitBuffer() {
ScopedBufferBinder<GL_ARRAY_BUFFER> buffer_binder(gl_,
vertex_attributes_buffer_);
- gl_->BufferData(GL_ARRAY_BUFFER,
- sizeof(kVertexAttributes),
- kVertexAttributes,
+ gl_->BufferData(GL_ARRAY_BUFFER, sizeof(kVertexAttributes), kVertexAttributes,
GL_STATIC_DRAW);
}
@@ -812,7 +766,7 @@ scoped_refptr<ShaderProgram> GLHelperScaling::GetShaderProgram(ShaderType type,
break;
}
if (swizzle) {
- switch(type) {
+ switch (type) {
case SHADER_YUV_MRT_PASS1:
fragment_program.append(" gl_FragData[0] = gl_FragData[0].bgra;\n");
break;
@@ -889,24 +843,15 @@ void ShaderProgram::UseProgram(const gfx::Size& src_size,
// OpenGL defines the last parameter to VertexAttribPointer as type
// "const GLvoid*" even though it is actually an offset into the buffer
// object's data store and not a pointer to the client's address space.
- const void* offsets[2] = {
- 0, reinterpret_cast<const void*>(2 * sizeof(GLfloat))
- };
+ const void* offsets[2] = {0,
+ reinterpret_cast<const void*>(2 * sizeof(GLfloat))};
- gl_->VertexAttribPointer(position_location_,
- 2,
- GL_FLOAT,
- GL_FALSE,
- 4 * sizeof(GLfloat),
- offsets[0]);
+ gl_->VertexAttribPointer(position_location_, 2, GL_FLOAT, GL_FALSE,
+ 4 * sizeof(GLfloat), offsets[0]);
gl_->EnableVertexAttribArray(position_location_);
- gl_->VertexAttribPointer(texcoord_location_,
- 2,
- GL_FLOAT,
- GL_FALSE,
- 4 * sizeof(GLfloat),
- offsets[1]);
+ gl_->VertexAttribPointer(texcoord_location_, 2, GL_FLOAT, GL_FALSE,
+ 4 * sizeof(GLfloat), offsets[1]);
gl_->EnableVertexAttribArray(texcoord_location_);
gl_->Uniform1i(texture_location_, 0);
@@ -916,7 +861,8 @@ void ShaderProgram::UseProgram(const gfx::Size& src_size,
static_cast<float>(src_subrect.x()) / src_size.width(),
static_cast<float>(src_subrect.y()) / src_size.height(),
static_cast<float>(src_subrect.width()) / src_size.width(),
- static_cast<float>(src_subrect.height()) / src_size.height(), };
+ static_cast<float>(src_subrect.height()) / src_size.height(),
+ };
if (flip_y) {
src_subrect_texcoord[1] += src_subrect_texcoord[3];
src_subrect_texcoord[3] *= -1.0;
@@ -924,12 +870,11 @@ void ShaderProgram::UseProgram(const gfx::Size& src_size,
gl_->Uniform4fv(src_subrect_location_, 1, src_subrect_texcoord);
gl_->Uniform2f(src_pixelsize_location_, src_size.width(), src_size.height());
- gl_->Uniform2f(dst_pixelsize_location_,
- static_cast<float>(dst_size.width()),
+ gl_->Uniform2f(dst_pixelsize_location_, static_cast<float>(dst_size.width()),
static_cast<float>(dst_size.height()));
- gl_->Uniform2f(
- scaling_vector_location_, scale_x ? 1.0 : 0.0, scale_x ? 0.0 : 1.0);
+ gl_->Uniform2f(scaling_vector_location_, scale_x ? 1.0 : 0.0,
+ scale_x ? 0.0 : 1.0);
gl_->Uniform4fv(color_weights_location_, 1, color_weights);
}
diff --git a/content/common/gpu/client/gl_helper_scaling.h b/content/browser/compositor/gl_helper_scaling.h
index 511319a..6fbc033 100644
--- a/content/common/gpu/client/gl_helper_scaling.h
+++ b/content/browser/compositor/gl_helper_scaling.h
@@ -2,15 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CONTENT_COMMON_GPU_CLIENT_GL_HELPER_SCALING_H_
-#define CONTENT_COMMON_GPU_CLIENT_GL_HELPER_SCALING_H_
+#ifndef CONTENT_BROWSER_COMPOSITOR_GL_HELPER_SCALING_H_
+#define CONTENT_BROWSER_COMPOSITOR_GL_HELPER_SCALING_H_
#include <deque>
#include <map>
#include <vector>
#include "base/macros.h"
-#include "content/common/gpu/client/gl_helper.h"
+#include "content/browser/compositor/gl_helper.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
@@ -52,34 +52,30 @@ class CONTENT_EXPORT GLHelperScaling {
typedef std::pair<ShaderType, bool> ShaderProgramKeyType;
- GLHelperScaling(gpu::gles2::GLES2Interface* gl,
- GLHelper* helper);
+ GLHelperScaling(gpu::gles2::GLES2Interface* gl, GLHelper* helper);
~GLHelperScaling();
void InitBuffer();
- GLHelper::ScalerInterface* CreateScaler(
- GLHelper::ScalerQuality quality,
- gfx::Size src_size,
- gfx::Rect src_subrect,
- const gfx::Size& dst_size,
- bool vertically_flip_texture,
- bool swizzle);
-
- GLHelper::ScalerInterface* CreatePlanarScaler(
- const gfx::Size& src_size,
- const gfx::Rect& src_subrect,
- const gfx::Size& dst_size,
- bool vertically_flip_texture,
- bool swizzle,
- const float color_weights[4]);
-
- ShaderInterface* CreateYuvMrtShader(
- const gfx::Size& src_size,
- const gfx::Rect& src_subrect,
- const gfx::Size& dst_size,
- bool vertically_flip_texture,
- bool swizzle,
- ShaderType shader);
+ GLHelper::ScalerInterface* CreateScaler(GLHelper::ScalerQuality quality,
+ gfx::Size src_size,
+ gfx::Rect src_subrect,
+ const gfx::Size& dst_size,
+ bool vertically_flip_texture,
+ bool swizzle);
+
+ GLHelper::ScalerInterface* CreatePlanarScaler(const gfx::Size& src_size,
+ const gfx::Rect& src_subrect,
+ const gfx::Size& dst_size,
+ bool vertically_flip_texture,
+ bool swizzle,
+ const float color_weights[4]);
+
+ ShaderInterface* CreateYuvMrtShader(const gfx::Size& src_size,
+ const gfx::Rect& src_subrect,
+ const gfx::Size& dst_size,
+ bool vertically_flip_texture,
+ bool swizzle,
+ ShaderType shader);
private:
// A ScaleOp represents a pass in a scaler pipeline, in one dimension.
@@ -88,8 +84,7 @@ class CONTENT_EXPORT GLHelperScaling {
// Exposed in the header file for testing purposes.
struct ScaleOp {
ScaleOp(int factor, bool x, int size)
- : scale_factor(factor), scale_x(x), scale_size(size) {
- }
+ : scale_factor(factor), scale_x(x), scale_size(size) {}
// Calculate a set of ScaleOp needed to convert an image of size
// |src| into an image of size |dst|. If |scale_x| is true, then
@@ -138,7 +133,7 @@ class CONTENT_EXPORT GLHelperScaling {
// 2 means 50% scale
// 3 means 33% scale, etc.
int scale_factor;
- bool scale_x; // Otherwise y
+ bool scale_x; // Otherwise y
int scale_size; // Size to scale to.
};
@@ -169,7 +164,7 @@ class CONTENT_EXPORT GLHelperScaling {
const gfx::Size& dst_size,
bool vertically_flip_texture,
bool swizzle,
- std::vector<ScalerStage> *scaler_stages);
+ std::vector<ScalerStage>* scaler_stages);
// Take two queues of ScaleOp structs and generate a
// vector of scaler stages. This is the second half of
@@ -183,8 +178,7 @@ class CONTENT_EXPORT GLHelperScaling {
bool swizzle,
std::deque<GLHelperScaling::ScaleOp>* x_ops,
std::deque<GLHelperScaling::ScaleOp>* y_ops,
- std::vector<ScalerStage> *scaler_stages);
-
+ std::vector<ScalerStage>* scaler_stages);
scoped_refptr<ShaderProgram> GetShaderProgram(ShaderType type, bool swizzle);
@@ -199,8 +193,7 @@ class CONTENT_EXPORT GLHelperScaling {
// drawing a quad.
ScopedBuffer vertex_attributes_buffer_;
- std::map<ShaderProgramKeyType,
- scoped_refptr<ShaderProgram> > shader_programs_;
+ std::map<ShaderProgramKeyType, scoped_refptr<ShaderProgram>> shader_programs_;
friend class ShaderProgram;
friend class ScalerImpl;
@@ -208,7 +201,6 @@ class CONTENT_EXPORT GLHelperScaling {
DISALLOW_COPY_AND_ASSIGN(GLHelperScaling);
};
-
} // namespace content
-#endif // CONTENT_COMMON_GPU_CLIENT_GL_HELPER_SCALING_H_
+#endif // CONTENT_BROWSER_COMPOSITOR_GL_HELPER_SCALING_H_
diff --git a/content/common/gpu/client/gl_helper_unittest.cc b/content/browser/compositor/gl_helper_unittest.cc
index 59ea228..9ba79b7 100644
--- a/content/common/gpu/client/gl_helper_unittest.cc
+++ b/content/browser/compositor/gl_helper_unittest.cc
@@ -29,9 +29,9 @@
#include "base/test/test_suite.h"
#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
-#include "content/common/gpu/client/gl_helper.h"
-#include "content/common/gpu/client/gl_helper_readback_support.h"
-#include "content/common/gpu/client/gl_helper_scaling.h"
+#include "content/browser/compositor/gl_helper.h"
+#include "content/browser/compositor/gl_helper_readback_support.h"
+#include "content/browser/compositor/gl_helper_scaling.h"
#include "gpu/command_buffer/client/gl_in_process_context.h"
#include "gpu/command_buffer/client/gles2_implementation.h"
#include "media/base/video_frame.h"
@@ -45,9 +45,12 @@ namespace content {
content::GLHelper::ScalerQuality kQualities[] = {
content::GLHelper::SCALER_QUALITY_BEST,
content::GLHelper::SCALER_QUALITY_GOOD,
- content::GLHelper::SCALER_QUALITY_FAST, };
+ content::GLHelper::SCALER_QUALITY_FAST,
+};
-const char* kQualityNames[] = {"best", "good", "fast", };
+const char* kQualityNames[] = {
+ "best", "good", "fast",
+};
class GLHelperTest : public testing::Test {
protected:
@@ -116,8 +119,7 @@ class GLHelperTest : public testing::Test {
base::trace_event::TraceLog::GetInstance()->SetDisabled();
base::RunLoop run_loop;
base::trace_event::TraceLog::GetInstance()->Flush(
- base::Bind(&GLHelperTest::TraceDataCB,
- run_loop.QuitClosure(),
+ base::Bind(&GLHelperTest::TraceDataCB, run_loop.QuitClosure(),
base::Unretained(&json_data)));
run_loop.Run();
json_data.append("]");
@@ -125,9 +127,9 @@ class GLHelperTest : public testing::Test {
std::string error_msg;
scoped_ptr<base::Value> trace_data =
base::JSONReader::ReadAndReturnError(json_data, 0, NULL, &error_msg);
- CHECK(trace_data)
- << "JSON parsing failed (" << error_msg << ") JSON data:" << std::endl
- << json_data;
+ CHECK(trace_data) << "JSON parsing failed (" << error_msg
+ << ") JSON data:" << std::endl
+ << json_data;
base::ListValue* list;
CHECK(trace_data->GetAsList(&list));
@@ -216,11 +218,10 @@ class GLHelperTest : public testing::Test {
const std::vector<GLHelperScaling::ScalerStage>& scaler_stages) {
std::string ret;
for (size_t i = 0; i < scaler_stages.size(); i++) {
- ret.append(base::StringPrintf("%dx%d -> %dx%d ",
- scaler_stages[i].src_size.width(),
- scaler_stages[i].src_size.height(),
- scaler_stages[i].dst_size.width(),
- scaler_stages[i].dst_size.height()));
+ ret.append(base::StringPrintf(
+ "%dx%d -> %dx%d ", scaler_stages[i].src_size.width(),
+ scaler_stages[i].src_size.height(), scaler_stages[i].dst_size.width(),
+ scaler_stages[i].dst_size.height()));
bool xy_matters = false;
switch (scaler_stages[i].shader) {
case GLHelperScaling::SHADER_BILINEAR:
@@ -395,12 +396,12 @@ class GLHelperTest : public testing::Test {
}
if (x_samples) {
- EXPECT_TRUE(CheckScale(x_scale, x_samples, scaled_x))
- << "x_scale = " << x_scale;
+ EXPECT_TRUE(CheckScale(x_scale, x_samples, scaled_x)) << "x_scale = "
+ << x_scale;
}
if (y_samples) {
- EXPECT_TRUE(CheckScale(y_scale, y_samples, scaled_y))
- << "y_scale = " << y_scale;
+ EXPECT_TRUE(CheckScale(y_scale, y_samples, scaled_y)) << "y_scale = "
+ << y_scale;
}
if (x_scale != 1.0) {
@@ -510,8 +511,8 @@ class GLHelperTest : public testing::Test {
float value = c0 * kRGBtoGrayscaleColorWeights[0] +
c1 * kRGBtoGrayscaleColorWeights[1] +
c2 * kRGBtoGrayscaleColorWeights[2];
- SetChannel(
- output, dst_x, dst_y, 0, static_cast<int>(value * 255.0f + 0.5f));
+ SetChannel(output, dst_x, dst_y, 0,
+ static_cast<int>(value * 255.0f + 0.5f));
}
}
}
@@ -572,10 +573,9 @@ class GLHelperTest : public testing::Test {
}
for (int x = 0; x < xmag; x++) {
for (int y = 0; y < ymag; y++) {
- value += Bilinear(input,
- (dst_x * xmag + x + 0.5) * xscale / xmag,
- (dst_y * ymag + y + 0.5) * yscale / ymag,
- channel);
+ value += Bilinear(
+ input, (dst_x * xmag + x + 0.5) * xscale / xmag,
+ (dst_y * ymag + y + 0.5) * yscale / ymag, channel);
sum += 1.0;
}
}
@@ -587,10 +587,7 @@ class GLHelperTest : public testing::Test {
sum = 1.0;
}
value /= sum;
- SetChannel(output,
- dst_x,
- dst_y,
- channel,
+ SetChannel(output, dst_x, dst_y, channel,
static_cast<int>(value * 255.0f + 0.5f));
}
}
@@ -682,8 +679,8 @@ class GLHelperTest : public testing::Test {
int height,
int test_pattern) {
scoped_ptr<SkBitmap> bitmap(new SkBitmap);
- bitmap->allocPixels(SkImageInfo::Make(
- width, height, kRGBA_8888_SkColorType, kPremul_SkAlphaType));
+ bitmap->allocPixels(SkImageInfo::Make(width, height, kRGBA_8888_SkColorType,
+ kPremul_SkAlphaType));
for (int x = 0; x < width; ++x) {
for (int y = 0; y < height; ++y) {
@@ -745,21 +742,16 @@ class GLHelperTest : public testing::Test {
gl_->GenFramebuffers(1, &framebuffer);
scoped_ptr<SkBitmap> input_pixels =
CreateTestBitmap(xsize, ysize, test_pattern);
- BindTextureAndFrameBuffer(
- src_texture, framebuffer, input_pixels.get(), xsize, ysize);
+ BindTextureAndFrameBuffer(src_texture, framebuffer, input_pixels.get(),
+ xsize, ysize);
std::string message = base::StringPrintf(
"input size: %dx%d "
"output size: %dx%d "
"pattern: %d , quality: %s, "
"out_color_type: %d",
- xsize,
- ysize,
- scaled_xsize,
- scaled_ysize,
- test_pattern,
- kQualityNames[quality_index],
- out_color_type);
+ xsize, ysize, scaled_xsize, scaled_ysize, test_pattern,
+ kQualityNames[quality_index], out_color_type);
// Transform the bitmap using GLHelper::CropScaleReadbackAndCleanTexture.
SkBitmap output_pixels;
@@ -768,12 +760,9 @@ class GLHelperTest : public testing::Test {
base::RunLoop run_loop;
gfx::Size encoded_texture_size;
helper_->CropScaleReadbackAndCleanTexture(
- src_texture,
- gfx::Size(xsize, ysize),
- gfx::Rect(xsize, ysize),
+ src_texture, gfx::Size(xsize, ysize), gfx::Rect(xsize, ysize),
gfx::Size(scaled_xsize, scaled_ysize),
- static_cast<unsigned char*>(output_pixels.getPixels()),
- out_color_type,
+ static_cast<unsigned char*>(output_pixels.getPixels()), out_color_type,
base::Bind(&callcallback, run_loop.QuitClosure()),
kQualities[quality_index]);
run_loop.Run();
@@ -784,25 +773,20 @@ class GLHelperTest : public testing::Test {
if (xsize == scaled_xsize && ysize == scaled_ysize &&
out_color_type != kAlpha_8_SkColorType) {
const std::vector<GLHelperScaling::ScalerStage> dummy_stages;
- Compare(input_pixels.get(),
- &output_pixels,
- 0,
- NULL,
- dummy_stages,
+ Compare(input_pixels.get(), &output_pixels, 0, NULL, dummy_stages,
message + " comparing against input");
return;
}
// Now transform the bitmap using the reference implementation.
SkBitmap scaled_pixels;
- scaled_pixels.allocPixels(SkImageInfo::Make(scaled_xsize,
- scaled_ysize,
+ scaled_pixels.allocPixels(SkImageInfo::Make(scaled_xsize, scaled_ysize,
kRGBA_8888_SkColorType,
kPremul_SkAlphaType));
SkBitmap truth_pixels;
// Step 1: Scale
- ScaleSlowRecursive(
- input_pixels.get(), &scaled_pixels, kQualities[quality_index]);
+ ScaleSlowRecursive(input_pixels.get(), &scaled_pixels,
+ kQualities[quality_index]);
// Step 2: Encode to grayscale if needed.
if (out_color_type == kAlpha_8_SkColorType) {
truth_pixels.allocPixels(SkImageInfo::Make(
@@ -815,11 +799,7 @@ class GLHelperTest : public testing::Test {
// Now compare the results.
SkAutoLockPixels lock_input(truth_pixels);
const std::vector<GLHelperScaling::ScalerStage> dummy_stages;
- Compare(&truth_pixels,
- &output_pixels,
- 2,
- input_pixels.get(),
- dummy_stages,
+ Compare(&truth_pixels, &output_pixels, 2, input_pixels.get(), dummy_stages,
message + " comparing against transformed/scaled");
gl_->DeleteTextures(1, &src_texture);
@@ -841,18 +821,14 @@ class GLHelperTest : public testing::Test {
gl_->GenFramebuffers(1, &framebuffer);
scoped_ptr<SkBitmap> input_pixels =
CreateTestBitmap(xsize, ysize, test_pattern);
- BindTextureAndFrameBuffer(
- src_texture, framebuffer, input_pixels.get(), xsize, ysize);
+ BindTextureAndFrameBuffer(src_texture, framebuffer, input_pixels.get(),
+ xsize, ysize);
std::string message = base::StringPrintf(
"input size: %dx%d "
"output size: %dx%d "
"pattern: %d quality: %s",
- xsize,
- ysize,
- scaled_xsize,
- scaled_ysize,
- test_pattern,
+ xsize, ysize, scaled_xsize, scaled_ysize, test_pattern,
kQualityNames[quality_index]);
std::vector<GLHelperScaling::ScalerStage> stages;
@@ -873,14 +849,12 @@ class GLHelperTest : public testing::Test {
gfx::Size(scaled_xsize, scaled_ysize), flip, kQualities[quality_index]);
SkBitmap output_pixels;
- output_pixels.allocPixels(SkImageInfo::Make(scaled_xsize,
- scaled_ysize,
+ output_pixels.allocPixels(SkImageInfo::Make(scaled_xsize, scaled_ysize,
kRGBA_8888_SkColorType,
kPremul_SkAlphaType));
helper_->ReadbackTextureSync(
- dst_texture,
- gfx::Rect(0, 0, scaled_xsize, scaled_ysize),
+ dst_texture, gfx::Rect(0, 0, scaled_xsize, scaled_ysize),
static_cast<unsigned char*>(output_pixels.getPixels()),
kRGBA_8888_SkColorType);
if (flip) {
@@ -890,28 +864,19 @@ class GLHelperTest : public testing::Test {
// If the bitmap shouldn't have changed - compare against input.
if (xsize == scaled_xsize && ysize == scaled_ysize) {
- Compare(input_pixels.get(),
- &output_pixels,
- 0,
- NULL,
- stages,
+ Compare(input_pixels.get(), &output_pixels, 0, NULL, stages,
message + " comparing against input");
return;
}
// Now scale the bitmap using the reference implementation.
SkBitmap truth_pixels;
- truth_pixels.allocPixels(SkImageInfo::Make(scaled_xsize,
- scaled_ysize,
+ truth_pixels.allocPixels(SkImageInfo::Make(scaled_xsize, scaled_ysize,
kRGBA_8888_SkColorType,
kPremul_SkAlphaType));
- ScaleSlowRecursive(
- input_pixels.get(), &truth_pixels, kQualities[quality_index]);
- Compare(&truth_pixels,
- &output_pixels,
- 2,
- input_pixels.get(),
- stages,
+ ScaleSlowRecursive(input_pixels.get(), &truth_pixels,
+ kQualities[quality_index]);
+ Compare(&truth_pixels, &output_pixels, 2, input_pixels.get(), stages,
message + " comparing against scaled");
gl_->DeleteTextures(1, &src_texture);
@@ -927,25 +892,17 @@ class GLHelperTest : public testing::Test {
int dst_xsize,
int dst_ysize) {
std::vector<GLHelperScaling::ScalerStage> stages;
- helper_scaling_->ComputeScalerStages(kQualities[quality],
- gfx::Size(xsize, ysize),
- gfx::Rect(0, 0, xsize, ysize),
- gfx::Size(dst_xsize, dst_ysize),
- false,
- false,
- &stages);
- ValidateScalerStages(kQualities[quality],
- stages,
+ helper_scaling_->ComputeScalerStages(
+ kQualities[quality], gfx::Size(xsize, ysize),
+ gfx::Rect(0, 0, xsize, ysize), gfx::Size(dst_xsize, dst_ysize), false,
+ false, &stages);
+ ValidateScalerStages(kQualities[quality], stages,
gfx::Size(dst_xsize, dst_ysize),
- base::StringPrintf(
- "input size: %dx%d "
- "output size: %dx%d "
- "quality: %s",
- xsize,
- ysize,
- dst_xsize,
- dst_ysize,
- kQualityNames[quality]));
+ base::StringPrintf("input size: %dx%d "
+ "output size: %dx%d "
+ "quality: %s",
+ xsize, ysize, dst_xsize, dst_ysize,
+ kQualityNames[quality]));
}
// Create a scaling pipeline and make sure that the steps
@@ -957,17 +914,11 @@ class GLHelperTest : public testing::Test {
int dst_ysize,
const std::string& description) {
std::vector<GLHelperScaling::ScalerStage> stages;
- helper_scaling_->ComputeScalerStages(quality,
- gfx::Size(xsize, ysize),
- gfx::Rect(0, 0, xsize, ysize),
- gfx::Size(dst_xsize, dst_ysize),
- false,
- false,
- &stages);
- ValidateScalerStages(content::GLHelper::SCALER_QUALITY_GOOD,
- stages,
- gfx::Size(dst_xsize, dst_ysize),
- "");
+ helper_scaling_->ComputeScalerStages(
+ quality, gfx::Size(xsize, ysize), gfx::Rect(0, 0, xsize, ysize),
+ gfx::Size(dst_xsize, dst_ysize), false, false, &stages);
+ ValidateScalerStages(content::GLHelper::SCALER_QUALITY_GOOD, stages,
+ gfx::Size(dst_xsize, dst_ysize), "");
EXPECT_EQ(PrintStages(stages), description);
}
@@ -1070,7 +1021,8 @@ class GLHelperTest : public testing::Test {
}
}
- void DrawGridToBitmap(int w, int h,
+ void DrawGridToBitmap(int w,
+ int h,
SkColor background_color,
SkColor grid_color,
int grid_pitch,
@@ -1096,9 +1048,12 @@ class GLHelperTest : public testing::Test {
}
}
- void DrawCheckerToBitmap(int w, int h,
- SkColor color1, SkColor color2,
- int rect_w, int rect_h,
+ void DrawCheckerToBitmap(int w,
+ int h,
+ SkColor color1,
+ SkColor color2,
+ int rect_w,
+ int rect_h,
SkBitmap& bmp) {
ASSERT_GT(rect_w, 0);
ASSERT_GT(rect_h, 0);
@@ -1142,14 +1097,14 @@ class GLHelperTest : public testing::Test {
}
bool ColorsClose(SkColor color1, SkColor color2, SkColorType color_type) {
- bool red = ColorComponentsClose(SkColorGetR(color1),
- SkColorGetR(color2), color_type);
- bool green = ColorComponentsClose(SkColorGetG(color1),
- SkColorGetG(color2), color_type);
- bool blue = ColorComponentsClose(SkColorGetB(color1),
- SkColorGetB(color2), color_type);
- bool alpha = ColorComponentsClose(SkColorGetA(color1),
- SkColorGetA(color2), color_type);
+ bool red = ColorComponentsClose(SkColorGetR(color1), SkColorGetR(color2),
+ color_type);
+ bool green = ColorComponentsClose(SkColorGetG(color1), SkColorGetG(color2),
+ color_type);
+ bool blue = ColorComponentsClose(SkColorGetB(color1), SkColorGetB(color2),
+ color_type);
+ bool alpha = ColorComponentsClose(SkColorGetA(color1), SkColorGetA(color2),
+ color_type);
if (color_type == kRGB_565_SkColorType) {
return red && blue && green;
}
@@ -1159,10 +1114,9 @@ class GLHelperTest : public testing::Test {
bool IsEqual(const SkBitmap& bmp1, const SkBitmap& bmp2) {
if (bmp1.isNull() && bmp2.isNull())
return true;
- if (bmp1.width() != bmp2.width() ||
- bmp1.height() != bmp2.height()) {
- LOG(ERROR) << "Bitmap geometry check failure";
- return false;
+ if (bmp1.width() != bmp2.width() || bmp1.height() != bmp2.height()) {
+ LOG(ERROR) << "Bitmap geometry check failure";
+ return false;
}
if (bmp1.colorType() != bmp2.colorType())
return false;
@@ -1175,8 +1129,7 @@ class GLHelperTest : public testing::Test {
}
for (int y = 0; y < bmp1.height(); ++y) {
for (int x = 0; x < bmp1.width(); ++x) {
- if (!ColorsClose(bmp1.getColor(x,y),
- bmp2.getColor(x,y),
+ if (!ColorsClose(bmp1.getColor(x, y), bmp2.getColor(x, y),
bmp1.colorType())) {
LOG(ERROR) << "Bitmap color comparision failure";
return false;
@@ -1219,29 +1172,21 @@ class GLHelperTest : public testing::Test {
bool async) {
if (async) {
base::RunLoop run_loop;
- helper_->ReadbackTextureAsync(src_texture,
- src_size,
- pixels,
- color_type,
- base::Bind(&callcallback,
- run_loop.QuitClosure()));
+ helper_->ReadbackTextureAsync(
+ src_texture, src_size, pixels, color_type,
+ base::Bind(&callcallback, run_loop.QuitClosure()));
run_loop.Run();
} else {
- helper_->ReadbackTextureSync(src_texture,
- gfx::Rect(src_size),
- pixels,
+ helper_->ReadbackTextureSync(src_texture, gfx::Rect(src_size), pixels,
color_type);
}
}
// Test basic format readback.
bool TestTextureFormatReadback(const gfx::Size& src_size,
- SkColorType color_type,
- bool async) {
- SkImageInfo info =
- SkImageInfo::Make(src_size.width(),
- src_size.height(),
- color_type,
- kPremul_SkAlphaType);
+ SkColorType color_type,
+ bool async) {
+ SkImageInfo info = SkImageInfo::Make(src_size.width(), src_size.height(),
+ color_type, kPremul_SkAlphaType);
if (!helper_->IsReadbackConfigSupported(color_type)) {
LOG(INFO) << "Skipping test format not supported" << color_type;
return true;
@@ -1253,9 +1198,7 @@ class GLHelperTest : public testing::Test {
// Test Pattern-1, Fill with Plain color pattern.
// Erase the input bitmap with red color.
input_pixels.eraseColor(SK_ColorRED);
- BindAndAttachTextureWithPixels(src_texture,
- color_type,
- src_size,
+ BindAndAttachTextureWithPixels(src_texture, color_type, src_size,
input_pixels);
SkBitmap output_pixels;
output_pixels.allocPixels(info);
@@ -1272,13 +1215,9 @@ class GLHelperTest : public testing::Test {
const int rect_w = 10, rect_h = 4, src_grid_pitch = 10, src_grid_width = 4;
const SkColor color1 = SK_ColorRED, color2 = SK_ColorBLUE;
// Test Pattern-2, Fill with Grid Pattern.
- DrawGridToBitmap(src_size.width(), src_size.height(),
- color2, color1,
- src_grid_pitch, src_grid_width,
- input_pixels);
- BindAndAttachTextureWithPixels(src_texture,
- color_type,
- src_size,
+ DrawGridToBitmap(src_size.width(), src_size.height(), color2, color1,
+ src_grid_pitch, src_grid_width, input_pixels);
+ BindAndAttachTextureWithPixels(src_texture, color_type, src_size,
input_pixels);
ReadBackTexture(src_texture, src_size, pixels, color_type, async);
result = IsEqual(input_pixels, output_pixels);
@@ -1287,13 +1226,9 @@ class GLHelperTest : public testing::Test {
return false;
}
// Test Pattern-3, Fill with CheckerBoard Pattern.
- DrawCheckerToBitmap(src_size.width(),
- src_size.height(),
- color1,
- color2, rect_w, rect_h, input_pixels);
- BindAndAttachTextureWithPixels(src_texture,
- color_type,
- src_size,
+ DrawCheckerToBitmap(src_size.width(), src_size.height(), color1, color2,
+ rect_w, rect_h, input_pixels);
+ BindAndAttachTextureWithPixels(src_texture, color_type, src_size,
input_pixels);
ReadBackTexture(src_texture, src_size, pixels, color_type, async);
result = IsEqual(input_pixels, output_pixels);
@@ -1370,23 +1305,12 @@ class GLHelperTest : public testing::Test {
"output size: %dx%d "
"margin: %dx%d "
"pattern: %d %s %s",
- xsize,
- ysize,
- output_xsize,
- output_ysize,
- xmargin,
- ymargin,
- test_pattern,
- flip ? "flip" : "noflip",
- flip ? "mrt" : "nomrt");
+ xsize, ysize, output_xsize, output_ysize, xmargin, ymargin,
+ test_pattern, flip ? "flip" : "noflip", flip ? "mrt" : "nomrt");
scoped_ptr<ReadbackYUVInterface> yuv_reader(
helper_->CreateReadbackPipelineYUV(
- quality,
- gfx::Size(xsize, ysize),
- gfx::Rect(0, 0, xsize, ysize),
- gfx::Size(xsize, ysize),
- flip,
- use_mrt));
+ quality, gfx::Size(xsize, ysize), gfx::Rect(0, 0, xsize, ysize),
+ gfx::Size(xsize, ysize), flip, use_mrt));
scoped_refptr<media::VideoFrame> output_frame =
media::VideoFrame::CreateFrame(
@@ -1461,33 +1385,18 @@ class GLHelperTest : public testing::Test {
}
}
- ComparePlane(Y,
- y_stride,
- output_frame->visible_data(media::VideoFrame::kYPlane),
- output_frame->stride(media::VideoFrame::kYPlane),
- 2,
- output_xsize,
- output_ysize,
- &input_pixels,
- message + " Y plane");
- ComparePlane(U,
- u_stride,
- output_frame->visible_data(media::VideoFrame::kUPlane),
- output_frame->stride(media::VideoFrame::kUPlane),
- 2,
- output_xsize / 2,
- output_ysize / 2,
- &input_pixels,
- message + " U plane");
- ComparePlane(V,
- v_stride,
- output_frame->visible_data(media::VideoFrame::kVPlane),
- output_frame->stride(media::VideoFrame::kVPlane),
- 2,
- output_xsize / 2,
- output_ysize / 2,
- &input_pixels,
- message + " V plane");
+ ComparePlane(
+ Y, y_stride, output_frame->visible_data(media::VideoFrame::kYPlane),
+ output_frame->stride(media::VideoFrame::kYPlane), 2, output_xsize,
+ output_ysize, &input_pixels, message + " Y plane");
+ ComparePlane(
+ U, u_stride, output_frame->visible_data(media::VideoFrame::kUPlane),
+ output_frame->stride(media::VideoFrame::kUPlane), 2, output_xsize / 2,
+ output_ysize / 2, &input_pixels, message + " U plane");
+ ComparePlane(
+ V, v_stride, output_frame->visible_data(media::VideoFrame::kVPlane),
+ output_frame->stride(media::VideoFrame::kVPlane), 2, output_xsize / 2,
+ output_ysize / 2, &input_pixels, message + " V plane");
gl_->DeleteTextures(1, &src_texture);
}
@@ -1538,21 +1447,13 @@ class GLHelperTest : public testing::Test {
const std::string& description) {
std::vector<GLHelperScaling::ScalerStage> stages;
helper_scaling_->ConvertScalerOpsToScalerStages(
- content::GLHelper::SCALER_QUALITY_GOOD,
- gfx::Size(xsize, ysize),
- gfx::Rect(0, 0, xsize, ysize),
- gfx::Size(dst_xsize, dst_ysize),
- false,
- false,
- &x_ops_,
- &y_ops_,
- &stages);
+ content::GLHelper::SCALER_QUALITY_GOOD, gfx::Size(xsize, ysize),
+ gfx::Rect(0, 0, xsize, ysize), gfx::Size(dst_xsize, dst_ysize), false,
+ false, &x_ops_, &y_ops_, &stages);
EXPECT_EQ(x_ops_.size(), 0U);
EXPECT_EQ(y_ops_.size(), 0U);
- ValidateScalerStages(content::GLHelper::SCALER_QUALITY_GOOD,
- stages,
- gfx::Size(dst_xsize, dst_ysize),
- "");
+ ValidateScalerStages(content::GLHelper::SCALER_QUALITY_GOOD, stages,
+ gfx::Size(dst_xsize, dst_ysize), "");
EXPECT_EQ(PrintStages(stages), description);
}
@@ -1599,10 +1500,7 @@ class GLHelperTest : public testing::Test {
// X scaled to 40%, Y scaled 40%, two bilinear3 passes.
x_ops_.push_back(GLHelperScaling::ScaleOp(3, true, 40));
y_ops_.push_back(GLHelperScaling::ScaleOp(3, false, 40));
- CheckPipeline2(100,
- 100,
- 40,
- 40,
+ CheckPipeline2(100, 100, 40, 40,
"100x100 -> 100x40 bilinear3 Y\n"
"100x40 -> 40x40 bilinear3 X\n");
@@ -1610,10 +1508,7 @@ class GLHelperTest : public testing::Test {
x_ops_.push_back(GLHelperScaling::ScaleOp(0, true, 120));
x_ops_.push_back(GLHelperScaling::ScaleOp(2, true, 60));
y_ops_.push_back(GLHelperScaling::ScaleOp(3, false, 40));
- CheckPipeline2(100,
- 100,
- 60,
- 40,
+ CheckPipeline2(100, 100, 60, 40,
"100x100 -> 100x40 bilinear3 Y\n"
"100x40 -> 60x40 bilinear2 X\n");
@@ -1621,10 +1516,7 @@ class GLHelperTest : public testing::Test {
x_ops_.push_back(GLHelperScaling::ScaleOp(3, true, 40));
y_ops_.push_back(GLHelperScaling::ScaleOp(0, false, 120));
y_ops_.push_back(GLHelperScaling::ScaleOp(2, false, 60));
- CheckPipeline2(100,
- 100,
- 40,
- 60,
+ CheckPipeline2(100, 100, 40, 60,
"100x100 -> 100x60 bilinear2 Y\n"
"100x60 -> 40x60 bilinear3 X\n");
@@ -1635,10 +1527,7 @@ class GLHelperTest : public testing::Test {
y_ops_.push_back(GLHelperScaling::ScaleOp(0, false, 120));
y_ops_.push_back(GLHelperScaling::ScaleOp(2, false, 60));
y_ops_.push_back(GLHelperScaling::ScaleOp(2, false, 30));
- CheckPipeline2(100,
- 100,
- 30,
- 30,
+ CheckPipeline2(100, 100, 30, 30,
"100x100 -> 100x30 bilinear4 Y\n"
"100x30 -> 30x30 bilinear4 X\n");
@@ -1656,10 +1545,7 @@ class GLHelperTest : public testing::Test {
y_ops_.push_back(GLHelperScaling::ScaleOp(0, false, 120));
y_ops_.push_back(GLHelperScaling::ScaleOp(2, false, 60));
y_ops_.push_back(GLHelperScaling::ScaleOp(2, false, 30));
- CheckPipeline2(100,
- 100,
- 150,
- 30,
+ CheckPipeline2(100, 100, 150, 30,
"100x100 -> 100x30 bilinear4 Y\n"
"100x30 -> 150x30 bilinear\n");
@@ -1680,10 +1566,7 @@ class GLHelperTest : public testing::Test {
y_ops_.push_back(GLHelperScaling::ScaleOp(2, false, 4));
y_ops_.push_back(GLHelperScaling::ScaleOp(2, false, 2));
y_ops_.push_back(GLHelperScaling::ScaleOp(2, false, 1));
- CheckPipeline2(100,
- 100,
- 1,
- 1,
+ CheckPipeline2(100, 100, 1, 1,
"100x100 -> 100x32 bilinear4 Y\n"
"100x32 -> 100x4 bilinear4 Y\n"
"100x4 -> 64x1 bilinear2x2\n"
@@ -1705,68 +1588,53 @@ class GLHelperPixelTest : public GLHelperTest {
TEST_F(GLHelperTest, RGBASyncReadbackTest) {
const int kTestSize = 64;
- bool result = TestTextureFormatReadback(gfx::Size(kTestSize,kTestSize),
- kRGBA_8888_SkColorType,
- false);
+ bool result = TestTextureFormatReadback(gfx::Size(kTestSize, kTestSize),
+ kRGBA_8888_SkColorType, false);
EXPECT_EQ(result, true);
}
-
TEST_F(GLHelperTest, BGRASyncReadbackTest) {
const int kTestSize = 64;
- bool result = TestTextureFormatReadback(gfx::Size(kTestSize,kTestSize),
- kBGRA_8888_SkColorType,
- false);
+ bool result = TestTextureFormatReadback(gfx::Size(kTestSize, kTestSize),
+ kBGRA_8888_SkColorType, false);
EXPECT_EQ(result, true);
}
TEST_F(GLHelperTest, RGB565SyncReadbackTest) {
const int kTestSize = 64;
- bool result = TestTextureFormatReadback(gfx::Size(kTestSize,kTestSize),
- kRGB_565_SkColorType,
- false);
+ bool result = TestTextureFormatReadback(gfx::Size(kTestSize, kTestSize),
+ kRGB_565_SkColorType, false);
EXPECT_EQ(result, true);
}
TEST_F(GLHelperTest, RGBAASyncReadbackTest) {
const int kTestSize = 64;
- bool result = TestTextureFormatReadback(gfx::Size(kTestSize,kTestSize),
- kRGBA_8888_SkColorType,
- true);
+ bool result = TestTextureFormatReadback(gfx::Size(kTestSize, kTestSize),
+ kRGBA_8888_SkColorType, true);
EXPECT_EQ(result, true);
}
TEST_F(GLHelperTest, BGRAASyncReadbackTest) {
const int kTestSize = 64;
- bool result = TestTextureFormatReadback(gfx::Size(kTestSize,kTestSize),
- kBGRA_8888_SkColorType,
- true);
+ bool result = TestTextureFormatReadback(gfx::Size(kTestSize, kTestSize),
+ kBGRA_8888_SkColorType, true);
EXPECT_EQ(result, true);
}
TEST_F(GLHelperTest, RGB565ASyncReadbackTest) {
const int kTestSize = 64;
- bool result = TestTextureFormatReadback(gfx::Size(kTestSize,kTestSize),
- kRGB_565_SkColorType,
- true);
+ bool result = TestTextureFormatReadback(gfx::Size(kTestSize, kTestSize),
+ kRGB_565_SkColorType, true);
EXPECT_EQ(result, true);
}
TEST_F(GLHelperPixelTest, YUVReadbackOptTest) {
// This test uses the gpu.service/gpu_decoder tracing events to detect how
// many scaling passes are actually performed by the YUV readback pipeline.
- StartTracing(TRACE_DISABLED_BY_DEFAULT("gpu.service") ","
- TRACE_DISABLED_BY_DEFAULT("gpu_decoder"));
-
- TestYUVReadback(800,
- 400,
- 800,
- 400,
- 0,
- 0,
- 1,
- false,
- true,
+ StartTracing(TRACE_DISABLED_BY_DEFAULT(
+ "gpu.service") "," TRACE_DISABLED_BY_DEFAULT("gpu_decoder"));
+
+ TestYUVReadback(800, 400, 800, 400, 0, 0, 1, false, true,
content::GLHelper::SCALER_QUALITY_FAST);
std::map<std::string, int> event_counts;
@@ -1789,10 +1657,10 @@ TEST_F(GLHelperPixelTest, YUVReadbackOptTest) {
}
}
-class GLHelperPixelYuvReadback :
- public GLHelperPixelTest,
- public ::testing::WithParamInterface<
- std::tr1::tuple<bool, bool, unsigned int, unsigned int>> {};
+class GLHelperPixelYuvReadback
+ : public GLHelperPixelTest,
+ public ::testing::WithParamInterface<
+ std::tr1::tuple<bool, bool, unsigned int, unsigned int>> {};
int kYUVReadBackSizes[] = {2, 4, 14};
@@ -1806,25 +1674,17 @@ TEST_P(GLHelperPixelYuvReadback, Test) {
for (unsigned int oy = y; oy < arraysize(kYUVReadBackSizes); oy++) {
// If output is a subsection of the destination frame, (letterbox)
// then try different variations of where the subsection goes.
- for (Margin xm = x < ox ? MarginLeft : MarginRight;
- xm <= MarginRight;
+ for (Margin xm = x < ox ? MarginLeft : MarginRight; xm <= MarginRight;
xm = NextMargin(xm)) {
- for (Margin ym = y < oy ? MarginLeft : MarginRight;
- ym <= MarginRight;
+ for (Margin ym = y < oy ? MarginLeft : MarginRight; ym <= MarginRight;
ym = NextMargin(ym)) {
for (int pattern = 0; pattern < 3; pattern++) {
- TestYUVReadback(kYUVReadBackSizes[x],
- kYUVReadBackSizes[y],
- kYUVReadBackSizes[ox],
- kYUVReadBackSizes[oy],
- compute_margin(kYUVReadBackSizes[x],
- kYUVReadBackSizes[ox], xm),
- compute_margin(kYUVReadBackSizes[y],
- kYUVReadBackSizes[oy], ym),
- pattern,
- flip,
- use_mrt,
- content::GLHelper::SCALER_QUALITY_GOOD);
+ TestYUVReadback(
+ kYUVReadBackSizes[x], kYUVReadBackSizes[y],
+ kYUVReadBackSizes[ox], kYUVReadBackSizes[oy],
+ compute_margin(kYUVReadBackSizes[x], kYUVReadBackSizes[ox], xm),
+ compute_margin(kYUVReadBackSizes[y], kYUVReadBackSizes[oy], ym),
+ pattern, flip, use_mrt, content::GLHelper::SCALER_QUALITY_GOOD);
if (HasFailure()) {
return;
}
@@ -1840,22 +1700,20 @@ INSTANTIATE_TEST_CASE_P(
,
GLHelperPixelYuvReadback,
::testing::Combine(
- ::testing::Bool(),
- ::testing::Bool(),
- ::testing::Range<unsigned int>(0, arraysize(kYUVReadBackSizes)),
- ::testing::Range<unsigned int>(0, arraysize(kYUVReadBackSizes))));
-
+ ::testing::Bool(),
+ ::testing::Bool(),
+ ::testing::Range<unsigned int>(0, arraysize(kYUVReadBackSizes)),
+ ::testing::Range<unsigned int>(0, arraysize(kYUVReadBackSizes))));
int kRGBReadBackSizes[] = {3, 6, 16};
-class GLHelperPixelReadbackTest :
- public GLHelperPixelTest,
- public ::testing::WithParamInterface<
- std::tr1::tuple<unsigned int,
- unsigned int,
- unsigned int,
- unsigned int,
- unsigned int>> {};
+class GLHelperPixelReadbackTest
+ : public GLHelperPixelTest,
+ public ::testing::WithParamInterface<std::tr1::tuple<unsigned int,
+ unsigned int,
+ unsigned int,
+ unsigned int,
+ unsigned int>> {};
// Per pixel tests, all sizes are small so that we can print
// out the generated bitmaps.
@@ -1868,13 +1726,9 @@ TEST_P(GLHelperPixelReadbackTest, ScaleTest) {
for (int flip = 0; flip <= 1; flip++) {
for (int pattern = 0; pattern < 3; pattern++) {
- TestScale(kRGBReadBackSizes[x],
- kRGBReadBackSizes[y],
- kRGBReadBackSizes[dst_x],
- kRGBReadBackSizes[dst_y],
- pattern,
- q_index,
- flip == 1);
+ TestScale(kRGBReadBackSizes[x], kRGBReadBackSizes[y],
+ kRGBReadBackSizes[dst_x], kRGBReadBackSizes[dst_y], pattern,
+ q_index, flip == 1);
if (HasFailure()) {
return;
}
@@ -1882,7 +1736,6 @@ TEST_P(GLHelperPixelReadbackTest, ScaleTest) {
}
}
-
// Per pixel tests, all sizes are small so that we can print
// out the generated bitmaps.
TEST_P(GLHelperPixelReadbackTest, CropScaleReadbackAndCleanTextureTest) {
@@ -1897,14 +1750,10 @@ TEST_P(GLHelperPixelReadbackTest, CropScaleReadbackAndCleanTextureTest) {
for (size_t color_type = 0; color_type < arraysize(kColorTypes);
color_type++) {
for (int pattern = 0; pattern < 3; pattern++) {
- TestCropScaleReadbackAndCleanTexture(kRGBReadBackSizes[x],
- kRGBReadBackSizes[y],
- kRGBReadBackSizes[dst_x],
- kRGBReadBackSizes[dst_y],
- pattern,
- kColorTypes[color_type],
- false,
- q_index);
+ TestCropScaleReadbackAndCleanTexture(
+ kRGBReadBackSizes[x], kRGBReadBackSizes[y], kRGBReadBackSizes[dst_x],
+ kRGBReadBackSizes[dst_y], pattern, kColorTypes[color_type], false,
+ q_index);
if (HasFailure())
return;
}
@@ -1915,11 +1764,11 @@ INSTANTIATE_TEST_CASE_P(
,
GLHelperPixelReadbackTest,
::testing::Combine(
- ::testing::Range<unsigned int>(0, arraysize(kQualities)),
- ::testing::Range<unsigned int>(0, arraysize(kRGBReadBackSizes)),
- ::testing::Range<unsigned int>(0, arraysize(kRGBReadBackSizes)),
- ::testing::Range<unsigned int>(0, arraysize(kRGBReadBackSizes)),
- ::testing::Range<unsigned int>(0, arraysize(kRGBReadBackSizes))));
+ ::testing::Range<unsigned int>(0, arraysize(kQualities)),
+ ::testing::Range<unsigned int>(0, arraysize(kRGBReadBackSizes)),
+ ::testing::Range<unsigned int>(0, arraysize(kRGBReadBackSizes)),
+ ::testing::Range<unsigned int>(0, arraysize(kRGBReadBackSizes)),
+ ::testing::Range<unsigned int>(0, arraysize(kRGBReadBackSizes))));
// Validate that all scaling generates valid pipelines.
TEST_F(GLHelperTest, ValidateScalerPipelines) {
@@ -1929,8 +1778,8 @@ TEST_F(GLHelperTest, ValidateScalerPipelines) {
for (size_t y = 0; y < arraysize(sizes); y++) {
for (size_t dst_x = 0; dst_x < arraysize(sizes); dst_x++) {
for (size_t dst_y = 0; dst_y < arraysize(sizes); dst_y++) {
- TestScalerPipeline(
- q, sizes[x], sizes[y], sizes[dst_x], sizes[dst_y]);
+ TestScalerPipeline(q, sizes[x], sizes[y], sizes[dst_x],
+ sizes[dst_y]);
if (HasFailure()) {
return;
}
@@ -1945,26 +1794,14 @@ TEST_F(GLHelperTest, ValidateScalerPipelines) {
// for a few common use cases.
TEST_F(GLHelperTest, CheckSpecificPipelines) {
// Upscale should be single pass.
- CheckPipeline(content::GLHelper::SCALER_QUALITY_GOOD,
- 1024,
- 700,
- 1280,
- 720,
+ CheckPipeline(content::GLHelper::SCALER_QUALITY_GOOD, 1024, 700, 1280, 720,
"1024x700 -> 1280x720 bilinear\n");
// Slight downscale should use BILINEAR2X2.
- CheckPipeline(content::GLHelper::SCALER_QUALITY_GOOD,
- 1280,
- 720,
- 1024,
- 700,
+ CheckPipeline(content::GLHelper::SCALER_QUALITY_GOOD, 1280, 720, 1024, 700,
"1280x720 -> 1024x700 bilinear2x2\n");
// Most common tab capture pipeline on the Pixel.
// Should be using two BILINEAR3 passes.
- CheckPipeline(content::GLHelper::SCALER_QUALITY_GOOD,
- 2560,
- 1476,
- 1249,
- 720,
+ CheckPipeline(content::GLHelper::SCALER_QUALITY_GOOD, 2560, 1476, 1249, 720,
"2560x1476 -> 2560x720 bilinear3 Y\n"
"2560x720 -> 1249x720 bilinear3 X\n");
}
diff --git a/content/browser/compositor/gpu_process_transport_factory.cc b/content/browser/compositor/gpu_process_transport_factory.cc
index 1d05689..7d4769a 100644
--- a/content/browser/compositor/gpu_process_transport_factory.cc
+++ b/content/browser/compositor/gpu_process_transport_factory.cc
@@ -26,6 +26,7 @@
#include "cc/surfaces/surface_manager.h"
#include "content/browser/compositor/browser_compositor_output_surface.h"
#include "content/browser/compositor/browser_compositor_overlay_candidate_validator.h"
+#include "content/browser/compositor/gl_helper.h"
#include "content/browser/compositor/gpu_browser_compositor_output_surface.h"
#include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.h"
#include "content/browser/compositor/offscreen_browser_compositor_output_surface.h"
@@ -39,7 +40,6 @@
#include "content/browser/gpu/gpu_surface_tracker.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/common/gpu/client/context_provider_command_buffer.h"
-#include "content/common/gpu/client/gl_helper.h"
#include "content/common/gpu/client/gpu_channel_host.h"
#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
#include "content/common/gpu/gpu_process_launch_causes.h"
diff --git a/content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.cc b/content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.cc
index 0913548..d038fa8 100644
--- a/content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.cc
+++ b/content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.cc
@@ -10,10 +10,10 @@
#include "cc/output/output_surface_client.h"
#include "content/browser/compositor/browser_compositor_overlay_candidate_validator.h"
#include "content/browser/compositor/buffer_queue.h"
+#include "content/browser/compositor/gl_helper.h"
#include "content/browser/compositor/reflector_impl.h"
#include "content/browser/gpu/gpu_surface_tracker.h"
#include "content/common/gpu/client/context_provider_command_buffer.h"
-#include "content/common/gpu/client/gl_helper.h"
#include "gpu/GLES2/gl2extchromium.h"
#include "gpu/command_buffer/client/gles2_interface.h"
diff --git a/content/browser/compositor/owned_mailbox.cc b/content/browser/compositor/owned_mailbox.cc
index 912d4d5..8e05582 100644
--- a/content/browser/compositor/owned_mailbox.cc
+++ b/content/browser/compositor/owned_mailbox.cc
@@ -5,8 +5,8 @@
#include "content/browser/compositor/owned_mailbox.h"
#include "base/logging.h"
+#include "content/browser/compositor/gl_helper.h"
#include "content/browser/compositor/image_transport_factory.h"
-#include "content/common/gpu/client/gl_helper.h"
namespace content {
diff --git a/content/browser/compositor/reflector_texture.cc b/content/browser/compositor/reflector_texture.cc
index 2310662..c9b742d 100644
--- a/content/browser/compositor/reflector_texture.cc
+++ b/content/browser/compositor/reflector_texture.cc
@@ -4,9 +4,9 @@
#include "content/browser/compositor/reflector_texture.h"
+#include "content/browser/compositor/gl_helper.h"
#include "content/browser/compositor/owned_mailbox.h"
#include "content/common/gpu/client/context_provider_command_buffer.h"
-#include "content/common/gpu/client/gl_helper.h"
#include "gpu/command_buffer/client/context_support.h"
#include "gpu/command_buffer/client/gles2_interface.h"
diff --git a/content/browser/compositor/surface_utils.cc b/content/browser/compositor/surface_utils.cc
index ad4ce98..c01ead5 100644
--- a/content/browser/compositor/surface_utils.cc
+++ b/content/browser/compositor/surface_utils.cc
@@ -10,7 +10,7 @@
#include "cc/output/copy_output_result.h"
#include "cc/resources/single_release_callback.h"
#include "cc/surfaces/surface_id_allocator.h"
-#include "content/common/gpu/client/gl_helper.h"
+#include "content/browser/compositor/gl_helper.h"
#include "skia/ext/image_operations.h"
#include "skia/ext/refptr.h"
#include "third_party/skia/include/core/SkCanvas.h"
diff --git a/content/browser/compositor/test/no_transport_image_transport_factory.cc b/content/browser/compositor/test/no_transport_image_transport_factory.cc
index d4ed28c..74245a2 100644
--- a/content/browser/compositor/test/no_transport_image_transport_factory.cc
+++ b/content/browser/compositor/test/no_transport_image_transport_factory.cc
@@ -9,8 +9,8 @@
#include "build/build_config.h"
#include "cc/output/context_provider.h"
#include "cc/surfaces/surface_manager.h"
+#include "content/browser/compositor/gl_helper.h"
#include "content/browser/gpu/compositor_util.h"
-#include "content/common/gpu/client/gl_helper.h"
#include "gpu/command_buffer/client/gles2_interface.h"
#include "ui/compositor/compositor.h"
#include "ui/compositor/test/in_process_context_factory.h"
diff --git a/content/browser/media/capture/aura_window_capture_machine.cc b/content/browser/media/capture/aura_window_capture_machine.cc
index b722538..f2c4b11 100644
--- a/content/browser/media/capture/aura_window_capture_machine.cc
+++ b/content/browser/media/capture/aura_window_capture_machine.cc
@@ -12,9 +12,9 @@
#include "base/timer/timer.h"
#include "cc/output/copy_output_request.h"
#include "cc/output/copy_output_result.h"
+#include "content/browser/compositor/gl_helper.h"
#include "content/browser/compositor/image_transport_factory.h"
#include "content/browser/media/capture/desktop_capture_device_uma_types.h"
-#include "content/common/gpu/client/gl_helper.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/power_save_blocker.h"
#include "media/base/video_capture_types.h"
diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc
index def25cc..82db867 100644
--- a/content/browser/renderer_host/compositor_impl_android.cc
+++ b/content/browser/renderer_host/compositor_impl_android.cc
@@ -43,6 +43,7 @@
#include "cc/trees/layer_tree_settings.h"
#include "content/browser/android/child_process_launcher_android.h"
#include "content/browser/compositor/browser_compositor_overlay_candidate_validator_android.h"
+#include "content/browser/compositor/gl_helper.h"
#include "content/browser/gpu/browser_gpu_channel_host_factory.h"
#include "content/browser/gpu/browser_gpu_memory_buffer_manager.h"
#include "content/browser/gpu/compositor_util.h"
@@ -50,7 +51,6 @@
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/common/gpu/client/command_buffer_proxy_impl.h"
#include "content/common/gpu/client/context_provider_command_buffer.h"
-#include "content/common/gpu/client/gl_helper.h"
#include "content/common/gpu/client/gpu_channel_host.h"
#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
#include "content/common/gpu/gpu_process_launch_causes.h"
diff --git a/content/browser/renderer_host/media/video_capture_controller.cc b/content/browser/renderer_host/media/video_capture_controller.cc
index 472815c..1c40696 100644
--- a/content/browser/renderer_host/media/video_capture_controller.cc
+++ b/content/browser/renderer_host/media/video_capture_controller.cc
@@ -16,11 +16,11 @@
#include "base/metrics/sparse_histogram.h"
#include "base/stl_util.h"
#include "build/build_config.h"
+#include "content/browser/compositor/gl_helper.h"
#include "content/browser/renderer_host/media/media_stream_manager.h"
#include "content/browser/renderer_host/media/video_capture_buffer_pool.h"
#include "content/browser/renderer_host/media/video_capture_device_client.h"
#include "content/browser/renderer_host/media/video_capture_manager.h"
-#include "content/common/gpu/client/gl_helper.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/common/content_switches.h"
#include "media/base/video_frame.h"
diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc
index 9b12fe8..27b798a9 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.cc
+++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -38,6 +38,7 @@
#include "content/browser/android/overscroll_controller_android.h"
#include "content/browser/android/popup_touch_handle_drawable.h"
#include "content/browser/android/synchronous_compositor_base.h"
+#include "content/browser/compositor/gl_helper.h"
#include "content/browser/devtools/render_frame_devtools_agent_host.h"
#include "content/browser/gpu/browser_gpu_channel_host_factory.h"
#include "content/browser/gpu/compositor_util.h"
@@ -54,7 +55,6 @@
#include "content/browser/renderer_host/render_process_host_impl.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
-#include "content/common/gpu/client/gl_helper.h"
#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
#include "content/common/gpu/gpu_host_messages.h"
#include "content/common/gpu/gpu_process_launch_causes.h"
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index 27e1809..d3a001a 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -25,6 +25,7 @@
#include "content/browser/accessibility/browser_accessibility_manager.h"
#include "content/browser/accessibility/browser_accessibility_state_impl.h"
#include "content/browser/bad_message.h"
+#include "content/browser/compositor/gl_helper.h"
#include "content/browser/frame_host/frame_tree.h"
#include "content/browser/frame_host/frame_tree_node.h"
#include "content/browser/frame_host/render_frame_host_impl.h"
@@ -45,7 +46,6 @@
#include "content/browser/renderer_host/ui_events_helper.h"
#include "content/browser/renderer_host/web_input_event_aura.h"
#include "content/common/content_switches_internal.h"
-#include "content/common/gpu/client/gl_helper.h"
#include "content/common/gpu/gpu_messages.h"
#include "content/common/site_isolation_policy.h"
#include "content/common/view_messages.h"
diff --git a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
index dbd378b..912ad10 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
@@ -23,6 +23,7 @@
#include "cc/surfaces/surface.h"
#include "cc/surfaces/surface_manager.h"
#include "content/browser/browser_thread_impl.h"
+#include "content/browser/compositor/gl_helper.h"
#include "content/browser/compositor/resize_lock.h"
#include "content/browser/compositor/test/no_transport_image_transport_factory.h"
#include "content/browser/frame_host/render_widget_host_view_guest.h"
@@ -36,7 +37,6 @@
#include "content/browser/renderer_host/render_widget_host_delegate.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/web_contents/web_contents_view_aura.h"
-#include "content/common/gpu/client/gl_helper.h"
#include "content/common/host_shared_bitmap_manager.h"
#include "content/common/input/input_event_utils.h"
#include "content/common/input/synthetic_web_input_event_builders.h"
diff --git a/content/content_browser.gypi b/content/content_browser.gypi
index 889867b..0aa0d9a 100644
--- a/content/content_browser.gypi
+++ b/content/content_browser.gypi
@@ -538,6 +538,12 @@
# NOTE: These files are here instead of in compositor_browser_sources
# because the latter is not built on Android, whereas these files are
# needed on all platforms.
+ 'browser/compositor/gl_helper.cc',
+ 'browser/compositor/gl_helper.h',
+ 'browser/compositor/gl_helper_readback_support.cc',
+ 'browser/compositor/gl_helper_readback_support.h',
+ 'browser/compositor/gl_helper_scaling.cc',
+ 'browser/compositor/gl_helper_scaling.h',
'browser/compositor/surface_utils.cc',
'browser/compositor/surface_utils.h',
'browser/device_sensors/ambient_light_mac.cc',
diff --git a/content/content_common.gypi b/content/content_common.gypi
index 49528ef..a36f310 100644
--- a/content/content_common.gypi
+++ b/content/content_common.gypi
@@ -345,12 +345,6 @@
'common/gpu/client/command_buffer_proxy_impl.h',
'common/gpu/client/context_provider_command_buffer.cc',
'common/gpu/client/context_provider_command_buffer.h',
- 'common/gpu/client/gl_helper.cc',
- 'common/gpu/client/gl_helper.h',
- 'common/gpu/client/gl_helper_readback_support.cc',
- 'common/gpu/client/gl_helper_readback_support.h',
- 'common/gpu/client/gl_helper_scaling.cc',
- 'common/gpu/client/gl_helper_scaling.h',
'common/gpu/client/gpu_channel_host.cc',
'common/gpu/client/gpu_channel_host.h',
'common/gpu/client/gpu_jpeg_decode_accelerator_host.cc',
diff --git a/content/content_tests.gypi b/content/content_tests.gypi
index 89e47ee..a4a4901 100644
--- a/content/content_tests.gypi
+++ b/content/content_tests.gypi
@@ -1663,7 +1663,7 @@
'..',
],
'sources': [
- 'common/gpu/client/gl_helper_unittest.cc',
+ 'browser/compositor/gl_helper_unittest.cc',
'common/gpu/client/gpu_in_process_context_tests.cc',
'test/run_all_gl_tests.cc',
],
@@ -1701,7 +1701,7 @@
'..',
],
'sources': [
- 'common/gpu/client/gl_helper_benchmark.cc',
+ 'browser/compositor/gl_helper_benchmark.cc',
'test/run_gl_benchmark.cc',
],
},
diff --git a/content/renderer/media/renderer_gpu_video_accelerator_factories.cc b/content/renderer/media/renderer_gpu_video_accelerator_factories.cc
index 79cbebb..bf2b3f5 100644
--- a/content/renderer/media/renderer_gpu_video_accelerator_factories.cc
+++ b/content/renderer/media/renderer_gpu_video_accelerator_factories.cc
@@ -13,7 +13,6 @@
#include "content/child/child_gpu_memory_buffer_manager.h"
#include "content/child/child_thread_impl.h"
#include "content/common/gpu/client/context_provider_command_buffer.h"
-#include "content/common/gpu/client/gl_helper.h"
#include "content/common/gpu/client/gpu_channel_host.h"
#include "content/common/gpu/client/gpu_video_decode_accelerator_host.h"
#include "content/common/gpu/client/gpu_video_encode_accelerator_host.h"
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn
index 2d6a193..1820ef7 100644
--- a/content/test/BUILD.gn
+++ b/content/test/BUILD.gn
@@ -838,7 +838,7 @@ test("content_perftests") {
test("content_gl_tests") {
sources = [
- "../common/gpu/client/gl_helper_unittest.cc",
+ "../browser/compositor/gl_helper_unittest.cc",
"../common/gpu/client/gpu_in_process_context_tests.cc",
"run_all_gl_tests.cc",
]
@@ -875,7 +875,7 @@ test("content_gl_tests") {
test("content_gl_benchmark") {
sources = [
- "../common/gpu/client/gl_helper_benchmark.cc",
+ "../browser/compositor/gl_helper_benchmark.cc",
"run_gl_benchmark.cc",
]