Skip to content

Commit

Permalink
ui/gl: Move GLImage into gl namespace.
Browse files Browse the repository at this point in the history
BUG=461575
R=piman@chromium.org,sievers@chromium.org,
TBR=fsamuel@chromium.org
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel

Review URL: https://codereview.chromium.org/1421903006

Cr-Commit-Position: refs/heads/master@{#356825}
  • Loading branch information
tfarina authored and Commit bot committed Oct 29, 2015
1 parent 69a0876 commit df856e0
Show file tree
Hide file tree
Showing 72 changed files with 380 additions and 362 deletions.
6 changes: 3 additions & 3 deletions cc/test/test_image_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ TestImageFactory::TestImageFactory() {
TestImageFactory::~TestImageFactory() {
}

scoped_refptr<gfx::GLImage> TestImageFactory::CreateImageForGpuMemoryBuffer(
scoped_refptr<gl::GLImage> TestImageFactory::CreateImageForGpuMemoryBuffer(
const gfx::GpuMemoryBufferHandle& handle,
const gfx::Size& size,
gfx::BufferFormat format,
unsigned internalformat,
int client_id) {
DCHECK_EQ(handle.type, gfx::SHARED_MEMORY_BUFFER);

scoped_refptr<gfx::GLImageSharedMemory> image(
new gfx::GLImageSharedMemory(size, internalformat));
scoped_refptr<gl::GLImageSharedMemory> image(
new gl::GLImageSharedMemory(size, internalformat));
if (!image->Initialize(handle.handle, handle.id, format, handle.offset))
return nullptr;

Expand Down
2 changes: 1 addition & 1 deletion cc/test/test_image_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class TestImageFactory : public gpu::ImageFactory {
~TestImageFactory() override;

// Overridden from gpu::ImageFactory:
scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer(
scoped_refptr<gl::GLImage> CreateImageForGpuMemoryBuffer(
const gfx::GpuMemoryBufferHandle& handle,
const gfx::Size& size,
gfx::BufferFormat format,
Expand Down
4 changes: 2 additions & 2 deletions components/mus/gles2/command_buffer_driver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ void CommandBufferDriver::CreateImage(int32_t id,
handle = base::FileDescriptor(platform_handle, false);
#endif

scoped_refptr<gfx::GLImageSharedMemory> image =
new gfx::GLImageSharedMemory(gfx_size, internal_format);
scoped_refptr<gl::GLImageSharedMemory> image =
new gl::GLImageSharedMemory(gfx_size, internal_format);
// TODO(jam): also need a mojo enum for this enum
if (!image->Initialize(handle, gfx::GpuMemoryBufferId(id), gpu_format, 0)) {
NOTREACHED();
Expand Down
2 changes: 1 addition & 1 deletion components/mus/gles2/command_buffer_local.cc
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ int32_t CommandBufferLocal::CreateImage(ClientBuffer buffer,
MojoGpuMemoryBufferImpl::FromClientBuffer(buffer);

gfx::GpuMemoryBufferHandle handle = gpu_memory_buffer->GetHandle();
scoped_refptr<gfx::GLImageSharedMemory> image(new gfx::GLImageSharedMemory(
scoped_refptr<gl::GLImageSharedMemory> image(new gl::GLImageSharedMemory(
gfx::Size(static_cast<int>(width), static_cast<int>(height)),
internalformat));
if (!image->Initialize(base::SharedMemory::DuplicateHandle(handle.handle),
Expand Down
6 changes: 3 additions & 3 deletions content/common/gpu/gpu_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1033,15 +1033,15 @@ uint64 GpuChannel::GetMemoryUsage() {
return size;
}

scoped_refptr<gfx::GLImage> GpuChannel::CreateImageForGpuMemoryBuffer(
scoped_refptr<gl::GLImage> GpuChannel::CreateImageForGpuMemoryBuffer(
const gfx::GpuMemoryBufferHandle& handle,
const gfx::Size& size,
gfx::BufferFormat format,
uint32 internalformat) {
switch (handle.type) {
case gfx::SHARED_MEMORY_BUFFER: {
scoped_refptr<gfx::GLImageSharedMemory> image(
new gfx::GLImageSharedMemory(size, internalformat));
scoped_refptr<gl::GLImageSharedMemory> image(
new gl::GLImageSharedMemory(size, internalformat));
if (!image->Initialize(handle.handle, handle.id, format, handle.offset))
return nullptr;

Expand Down
2 changes: 1 addition & 1 deletion content/common/gpu/gpu_channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class CONTENT_EXPORT GpuChannel

uint64 GetMemoryUsage();

scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer(
scoped_refptr<gl::GLImage> CreateImageForGpuMemoryBuffer(
const gfx::GpuMemoryBufferHandle& handle,
const gfx::Size& size,
gfx::BufferFormat format,
Expand Down
2 changes: 1 addition & 1 deletion content/common/gpu/gpu_command_buffer_stub.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,7 @@ void GpuCommandBufferStub::OnCreateImage(int32 id,
return;
}

scoped_refptr<gfx::GLImage> image = channel()->CreateImageForGpuMemoryBuffer(
scoped_refptr<gl::GLImage> image = channel()->CreateImageForGpuMemoryBuffer(
handle, size, format, internalformat);
if (!image.get())
return;
Expand Down
4 changes: 0 additions & 4 deletions content/common/gpu/gpu_memory_buffer_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
#include "ui/gfx/gpu_memory_buffer.h"
#include "ui/gfx/native_widget_types.h"

namespace gfx {
class GLImage;
}

namespace gpu {
class ImageFactory;
}
Expand Down
10 changes: 5 additions & 5 deletions content/common/gpu/gpu_memory_buffer_factory_io_surface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ gpu::ImageFactory* GpuMemoryBufferFactoryIOSurface::AsImageFactory() {
return this;
}

scoped_refptr<gfx::GLImage>
scoped_refptr<gl::GLImage>
GpuMemoryBufferFactoryIOSurface::CreateImageForGpuMemoryBuffer(
const gfx::GpuMemoryBufferHandle& handle,
const gfx::Size& size,
Expand All @@ -231,12 +231,12 @@ GpuMemoryBufferFactoryIOSurface::CreateImageForGpuMemoryBuffer(
IOSurfaceMapKey key(handle.id, client_id);
IOSurfaceMap::iterator it = io_surfaces_.find(key);
if (it == io_surfaces_.end())
return scoped_refptr<gfx::GLImage>();
return scoped_refptr<gl::GLImage>();

scoped_refptr<gfx::GLImageIOSurface> image(
new gfx::GLImageIOSurface(size, internalformat));
scoped_refptr<gl::GLImageIOSurface> image(
new gl::GLImageIOSurface(size, internalformat));
if (!image->Initialize(it->second.get(), handle.id, format))
return scoped_refptr<gfx::GLImage>();
return scoped_refptr<gl::GLImage>();

return image;
}
Expand Down
4 changes: 2 additions & 2 deletions content/common/gpu/gpu_memory_buffer_factory_io_surface.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/gpu_memory_buffer.h"

namespace gfx {
namespace gl {
class GLImage;
}

Expand Down Expand Up @@ -58,7 +58,7 @@ class CONTENT_EXPORT GpuMemoryBufferFactoryIOSurface
gpu::ImageFactory* AsImageFactory() override;

// Overridden from gpu::ImageFactory:
scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer(
scoped_refptr<gl::GLImage> CreateImageForGpuMemoryBuffer(
const gfx::GpuMemoryBufferHandle& handle,
const gfx::Size& size,
gfx::BufferFormat format,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ gpu::ImageFactory* GpuMemoryBufferFactoryOzoneNativePixmap::AsImageFactory() {
return this;
}

scoped_refptr<gfx::GLImage>
scoped_refptr<gl::GLImage>
GpuMemoryBufferFactoryOzoneNativePixmap::CreateImageForGpuMemoryBuffer(
const gfx::GpuMemoryBufferHandle& handle,
const gfx::Size& size,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "gpu/command_buffer/service/image_factory.h"
#include "ui/ozone/public/native_pixmap.h"

namespace gfx {
namespace gl {
class GLImage;
}

Expand Down Expand Up @@ -47,7 +47,7 @@ class CONTENT_EXPORT GpuMemoryBufferFactoryOzoneNativePixmap
gpu::ImageFactory* AsImageFactory() override;

// Overridden from gpu::ImageFactory:
scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer(
scoped_refptr<gl::GLImage> CreateImageForGpuMemoryBuffer(
const gfx::GpuMemoryBufferHandle& handle,
const gfx::Size& size,
gfx::BufferFormat format,
Expand Down
10 changes: 5 additions & 5 deletions content/common/gpu/gpu_memory_buffer_factory_surface_texture.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ gpu::ImageFactory* GpuMemoryBufferFactorySurfaceTexture::AsImageFactory() {
return this;
}

scoped_refptr<gfx::GLImage>
scoped_refptr<gl::GLImage>
GpuMemoryBufferFactorySurfaceTexture::CreateImageForGpuMemoryBuffer(
const gfx::GpuMemoryBufferHandle& handle,
const gfx::Size& size,
Expand All @@ -111,12 +111,12 @@ GpuMemoryBufferFactorySurfaceTexture::CreateImageForGpuMemoryBuffer(
SurfaceTextureMapKey key(handle.id.id, client_id);
SurfaceTextureMap::iterator it = surface_textures_.find(key);
if (it == surface_textures_.end())
return scoped_refptr<gfx::GLImage>();
return scoped_refptr<gl::GLImage>();

scoped_refptr<gfx::GLImageSurfaceTexture> image(
new gfx::GLImageSurfaceTexture(size));
scoped_refptr<gl::GLImageSurfaceTexture> image(
new gl::GLImageSurfaceTexture(size));
if (!image->Initialize(it->second.get()))
return scoped_refptr<gfx::GLImage>();
return scoped_refptr<gl::GLImage>();

return image;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@
#include "ui/gfx/gpu_memory_buffer.h"

namespace gfx {
class GLImage;
class SurfaceTexture;
}

namespace gl {
class GLImage;
}

namespace content {

class CONTENT_EXPORT GpuMemoryBufferFactorySurfaceTexture
Expand Down Expand Up @@ -52,7 +55,7 @@ class CONTENT_EXPORT GpuMemoryBufferFactorySurfaceTexture
gpu::ImageFactory* AsImageFactory() override;

// Overridden from gpu::ImageFactory:
scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer(
scoped_refptr<gl::GLImage> CreateImageForGpuMemoryBuffer(
const gfx::GpuMemoryBufferHandle& handle,
const gfx::Size& size,
gfx::BufferFormat format,
Expand Down
2 changes: 1 addition & 1 deletion content/common/gpu/image_transport_surface_overlay_mac.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ImageTransportSurfaceOverlayMac : public gfx::GLSurface,
bool SetBackbufferAllocation(bool allocated) override;
bool ScheduleOverlayPlane(int z_order,
gfx::OverlayTransform transform,
gfx::GLImage* image,
gl::GLImage* image,
const gfx::Rect& bounds_rect,
const gfx::RectF& crop_rect) override;
bool IsSurfaceless() const override;
Expand Down
6 changes: 3 additions & 3 deletions content/common/gpu/image_transport_surface_overlay_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -661,16 +661,16 @@ void Destroy() {
bool ImageTransportSurfaceOverlayMac::ScheduleOverlayPlane(
int z_order,
gfx::OverlayTransform transform,
gfx::GLImage* image,
gl::GLImage* image,
const gfx::Rect& bounds_rect,
const gfx::RectF& crop_rect) {
DCHECK_EQ(transform, gfx::OVERLAY_TRANSFORM_NONE);
if (transform != gfx::OVERLAY_TRANSFORM_NONE)
return false;

linked_ptr<OverlayPlane> plane(new OverlayPlane(
z_order, static_cast<gfx::GLImageIOSurface*>(image)->io_surface_id().id,
static_cast<gfx::GLImageIOSurface*>(image)->io_surface(),
z_order, static_cast<gl::GLImageIOSurface*>(image)->io_surface_id().id,
static_cast<gl::GLImageIOSurface*>(image)->io_surface(),
ConvertRectToDIPF(scale_factor_, bounds_rect), crop_rect));
if (z_order == 0)
pending_root_plane_ = plane;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,14 @@ AVDACodecImage* AndroidDeferredRenderingBackingStrategy::GetImageForPicture(
const media::PictureBuffer& picture_buffer) {
gpu::gles2::TextureRef* texture_ref = GetTextureForPicture(picture_buffer);
RETURN_NULL_IF_NULL(texture_ref);
gfx::GLImage* image =
gl::GLImage* image =
texture_ref->texture()->GetLevelImage(GetTextureTarget(), 0);
return static_cast<AVDACodecImage*>(image);
}

void AndroidDeferredRenderingBackingStrategy::SetImageForPicture(
const media::PictureBuffer& picture_buffer,
const scoped_refptr<gfx::GLImage>& image) {
const scoped_refptr<gl::GLImage>& image) {
gpu::gles2::TextureRef* texture_ref = GetTextureForPicture(picture_buffer);
RETURN_IF_NULL(texture_ref);

Expand Down Expand Up @@ -134,7 +134,7 @@ void AndroidDeferredRenderingBackingStrategy::AssignOnePictureBuffer(
const media::PictureBuffer& picture_buffer) {
// Attach a GLImage to each texture that will use the surface texture.
// We use a refptr here in case SetImageForPicture fails.
scoped_refptr<gfx::GLImage> gl_image(
scoped_refptr<gl::GLImage> gl_image(
new AVDACodecImage(shared_state_, media_codec_,
state_provider_->GetGlDecoder(), surface_texture_));
SetImageForPicture(picture_buffer, gl_image);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "content/common/content_export.h"
#include "content/common/gpu/media/android_video_decode_accelerator.h"

namespace gfx {
namespace gl {
class GLImage;
}

Expand Down Expand Up @@ -59,7 +59,7 @@ class CONTENT_EXPORT AndroidDeferredRenderingBackingStrategy
// Return the AVDACodecImage for a given PictureBuffer's texture.
AVDACodecImage* GetImageForPicture(const media::PictureBuffer&);
void SetImageForPicture(const media::PictureBuffer& picture_buffer,
const scoped_refptr<gfx::GLImage>& image);
const scoped_refptr<gl::GLImage>& image);

scoped_refptr<AVDASharedState> shared_state_;

Expand Down
4 changes: 2 additions & 2 deletions content/common/gpu/media/avda_codec_image.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace content {

// GLImage that renders MediaCodec buffers to a SurfaceTexture as needed
// in order to draw them.
class AVDACodecImage : public gfx::GLImage {
class AVDACodecImage : public gl::GLImage {
public:
AVDACodecImage(const scoped_refptr<AVDASharedState>&,
media::VideoCodecBridge* codec,
Expand All @@ -23,7 +23,7 @@ class AVDACodecImage : public gfx::GLImage {
~AVDACodecImage() override;

public:
// gfx::GLImage implementation
// gl::GLImage implementation
void Destroy(bool have_context) override;
gfx::Size GetSize() override;
unsigned GetInternalFormat() override;
Expand Down
2 changes: 1 addition & 1 deletion content/common/gpu/media/gpu_video_decode_accelerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ GpuVideoDecodeAccelerator::CreateV4L2SliceVDA() {

void GpuVideoDecodeAccelerator::BindImage(uint32 client_texture_id,
uint32 texture_target,
scoped_refptr<gfx::GLImage> image) {
scoped_refptr<gl::GLImage> image) {
gpu::gles2::GLES2Decoder* command_decoder = stub_->decoder();
gpu::gles2::TextureManager* texture_manager =
command_decoder->GetContextGroup()->texture_manager();
Expand Down
2 changes: 1 addition & 1 deletion content/common/gpu/media/gpu_video_decode_accelerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class GpuVideoDecodeAccelerator
// Helper to bind |image| to the texture specified by |client_texture_id|.
void BindImage(uint32 client_texture_id,
uint32 texture_target,
scoped_refptr<gfx::GLImage> image);
scoped_refptr<gl::GLImage> image);

// Route ID to communicate with the host.
const int32 host_route_id_;
Expand Down
2 changes: 1 addition & 1 deletion content/common/gpu/media/vaapi_drm_picture.cc
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ scoped_refptr<ui::NativePixmap> VaapiDrmPicture::ScalePixmap(
return scaled_pixmap_;
}

scoped_refptr<gfx::GLImage> VaapiDrmPicture::GetImageToBind() {
scoped_refptr<gl::GLImage> VaapiDrmPicture::GetImageToBind() {
return gl_image_;
}

Expand Down
6 changes: 3 additions & 3 deletions content/common/gpu/media/vaapi_drm_picture.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "content/common/gpu/media/vaapi_picture.h"
#include "ui/gfx/geometry/size.h"

namespace gfx {
namespace gl {
class GLImage;
}

Expand All @@ -42,7 +42,7 @@ class VaapiDrmPicture : public VaapiPicture {

bool DownloadFromSurface(const scoped_refptr<VASurface>& va_surface) override;

scoped_refptr<gfx::GLImage> GetImageToBind() override;
scoped_refptr<gl::GLImage> GetImageToBind() override;

bool AllowOverlay() const override;

Expand All @@ -69,7 +69,7 @@ class VaapiDrmPicture : public VaapiPicture {
scoped_refptr<ui::NativePixmap> scaled_pixmap_;

// EGLImage bound to the GL textures used by the VDA client.
scoped_refptr<gfx::GLImage> gl_image_;
scoped_refptr<gl::GLImage> gl_image_;

// VASurface used to transfer from the decoder's pixel format.
scoped_refptr<VASurface> va_surface_;
Expand Down
4 changes: 2 additions & 2 deletions content/common/gpu/media/vaapi_picture.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "base/threading/non_thread_safe.h"
#include "ui/gfx/geometry/size.h"

namespace gfx {
namespace gl {
class GLImage;
}

Expand All @@ -40,7 +40,7 @@ class VaapiPicture : public base::NonThreadSafe {
virtual bool AllowOverlay() const;

// Returns the |GLImage|, if any, to bind to the texture.
virtual scoped_refptr<gfx::GLImage> GetImageToBind() = 0;
virtual scoped_refptr<gl::GLImage> GetImageToBind() = 0;

// Downloads the |va_surface| into the picture, potentially scaling
// it if needed.
Expand Down
4 changes: 2 additions & 2 deletions content/common/gpu/media/vaapi_tfp_picture.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ bool VaapiTFPPicture::Initialize() {
return false;
}

glx_image_ = new gfx::GLImageGLX(size(), GL_RGB);
glx_image_ = new gl::GLImageGLX(size(), GL_RGB);
if (!glx_image_->Initialize(x_pixmap_)) {
// x_pixmap_ will be freed in the destructor.
LOG(ERROR) << "Failed creating a GLX Pixmap for TFP";
Expand All @@ -74,7 +74,7 @@ bool VaapiTFPPicture::DownloadFromSurface(
va_surface->size());
}

scoped_refptr<gfx::GLImage> VaapiTFPPicture::GetImageToBind() {
scoped_refptr<gl::GLImage> VaapiTFPPicture::GetImageToBind() {
return nullptr;
}

Expand Down
Loading

0 comments on commit df856e0

Please sign in to comment.