diff options
author | reveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-18 15:40:59 +0000 |
---|---|---|
committer | reveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-18 15:40:59 +0000 |
commit | b63f1d6dc0569a970a43c5a456d38cd543eea27c (patch) | |
tree | f3dd7ee9d94aafb84caab814c189c22662c53d6a /ui/gl/gl_image_memory.h | |
parent | 602b5a29f74202a4c36acfedcf1562f78abfce3c (diff) | |
download | chromium_src-b63f1d6dc0569a970a43c5a456d38cd543eea27c.zip chromium_src-b63f1d6dc0569a970a43c5a456d38cd543eea27c.tar.gz chromium_src-b63f1d6dc0569a970a43c5a456d38cd543eea27c.tar.bz2 |
gpu: Remove Create/DeleteImage IPC by adding an X11_PIXMAP_BUFFER GpuMemoryBuffer type.
This adds a new GpuMemoryBuffer type that can be used to create
a GpuMemoryBuffer from an existing X11 pixmap.
This removes Create/DeleteImage IPC and reduces complexity
significantly as it allows the ImageManager to be moved to
the decoder and simply track images.
A new platform dependent GpuMemoryBufferFactory interface
is introduced to allow this new type of buffer to be created
on the GPU service side. To avoid the need for any global
variables, this factory instance is also responsible for
creating GLImage instances.
The old factory interface used by android_webview is renamed
InProcessGpuMemoryBufferFactory until it can be removed in
favor of this new interface.
BUG=368716
TEST=gpu_unittests, gl_tests --gtest_filter=GpuMemoryBufferTest.Lifecycle
Review URL: https://codereview.chromium.org/331723003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284097 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gl/gl_image_memory.h')
-rw-r--r-- | ui/gl/gl_image_memory.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/ui/gl/gl_image_memory.h b/ui/gl/gl_image_memory.h new file mode 100644 index 0000000..e91008a --- /dev/null +++ b/ui/gl/gl_image_memory.h @@ -0,0 +1,55 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_GL_GL_IMAGE_MEMORY_H_ +#define UI_GL_GL_IMAGE_MEMORY_H_ + +#include "ui/gl/gl_image.h" + +#if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || \ + defined(USE_OZONE) +#include <EGL/egl.h> +#include <EGL/eglext.h> +#endif + +namespace gfx { + +class GL_EXPORT GLImageMemory : public GLImage { + public: + GLImageMemory(const gfx::Size& size, unsigned internalformat); + + bool Initialize(const unsigned char* memory); + + // Overridden from GLImage: + virtual void Destroy() OVERRIDE; + virtual gfx::Size GetSize() OVERRIDE; + virtual bool BindTexImage(unsigned target) OVERRIDE; + virtual void ReleaseTexImage(unsigned target) OVERRIDE {} + virtual void WillUseTexImage() OVERRIDE {} + virtual void DidUseTexImage() OVERRIDE {} + virtual void WillModifyTexImage() OVERRIDE {} + virtual void DidModifyTexImage() OVERRIDE {} + + protected: + virtual ~GLImageMemory(); + + bool HasValidFormat() const; + size_t Bytes() const; + + private: + const unsigned char* memory_; + const gfx::Size size_; + const unsigned internalformat_; +#if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || \ + defined(USE_OZONE) + unsigned egl_texture_id_; + EGLImageKHR egl_image_; +#endif + + DISALLOW_COPY_AND_ASSIGN(GLImageMemory); +}; + +} // namespace gfx + +#endif // UI_GL_GL_IMAGE_MEMORY_H_ |