+++ /dev/null
-// Copyright 2014 Samsung Electronics. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-
-#include "base/command_line.h"
-#include "content/common/gpu/client/gpu_memory_buffer_impl.h"
-#include "content/public/common/content_switches.h"
-
-
-#include "content/common/gpu/client/gpu_memory_buffer_impl_efl_pixmap.h"
-#include "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h"
-
-#include "base/process/process.h"
-#include "base/threading/platform_thread.h"
-
-namespace content {
-
-namespace {
-static bool IsZeroCopyEnabled() {
- static bool zero_copy_enabled =
- CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableZeroCopy);
- return zero_copy_enabled;
-}
-}
-
-// static
-void GpuMemoryBufferImpl::Create(gfx::GpuMemoryBufferId id,
- const gfx::Size& size,
- Format format,
- Usage usage,
- int client_id,
- const CreationCallback& callback) {
- // TODO: Rendering TG will implement following for Wayland.
-#if !defined(WAYLAND_BRINGUP)
- if (IsZeroCopyEnabled() &&
- GpuMemoryBufferImplEflPixmap::IsConfigurationSupported(format, usage)) {
- GpuMemoryBufferImplEflPixmap::Create(id, size, format, client_id, callback);
- return;
- }
-#else
- NOTIMPLEMENTED();
-#endif
-
- if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported(
- size, format, usage)) {
- GpuMemoryBufferImplSharedMemory::Create(id, size, format, callback);
- return;
- }
-
- callback.Run(scoped_ptr<GpuMemoryBufferImpl>());
-}
-
-// static
-void GpuMemoryBufferImpl::AllocateForChildProcess(
- gfx::GpuMemoryBufferId id,
- const gfx::Size& size,
- Format format,
- Usage usage,
- base::ProcessHandle child_process,
- int child_client_id,
- const AllocationCallback& callback) {
- // TODO: Rendering TG will implement following for Wayland.
-#if !defined(WAYLAND_BRINGUP)
- if (IsZeroCopyEnabled() &&
- GpuMemoryBufferImplEflPixmap::IsConfigurationSupported(format, usage)) {
- GpuMemoryBufferImplEflPixmap::AllocateForChildProcess(
- id, size, format, child_client_id, callback);
- return;
- }
-#else
- NOTIMPLEMENTED();
-#endif
-
- if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported(
- size, format, usage)) {
- GpuMemoryBufferImplSharedMemory::AllocateForChildProcess(
- id, size, format, child_process, callback);
- return;
- }
-
- callback.Run(gfx::GpuMemoryBufferHandle());
-}
-
-// static
-void GpuMemoryBufferImpl::DeletedByChildProcess(
- gfx::GpuMemoryBufferType type,
- gfx::GpuMemoryBufferId id,
- base::ProcessHandle child_process,
- int child_client_id,
- uint32 sync_point) {
- switch (type) {
- case gfx::SHARED_MEMORY_BUFFER:
- break;
- case gfx::EFL_PIXMAP_BUFFER:
- // TODO: Rendering TG will implement following for Wayland.
-#if !defined(WAYLAND_BRINGUP)
- GpuMemoryBufferImplEflPixmap::DeletedByChildProcess(
- id, child_client_id, sync_point);
-#else
- NOTIMPLEMENTED();
-#endif
- break;
- default:
- NOTREACHED();
- break;
- }
-}
-
-// static
-scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle(
- const gfx::GpuMemoryBufferHandle& handle,
- const gfx::Size& size,
- Format format,
- const DestructionCallback& callback) {
- switch (handle.type) {
- case gfx::SHARED_MEMORY_BUFFER:
- return GpuMemoryBufferImplSharedMemory::CreateFromHandle(
- handle, size, format, callback);
- case gfx::EFL_PIXMAP_BUFFER:
- // TODO: Rendering TG will implement following for Wayland.
-#if !defined(WAYLAND_BRINGUP)
- return GpuMemoryBufferImplEflPixmap::CreateFromHandle(
- handle, size, format, callback);
-#else
- NOTIMPLEMENTED();
- return NULL;
-#endif
- default:
- return scoped_ptr<GpuMemoryBufferImpl>();
- }
-}
-
-} // namespace content
+++ /dev/null
-// Copyright 2014 Samsung Electronics. All rights reserved.
-// 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/gpu_memory_buffer_impl_efl_pixmap.h"
-
-#include "base/atomic_sequence_num.h"
-#include "base/bind.h"
-#include "base/trace_event/trace_event.h"
-#include "base/logging.h"
-#include "base/numerics/safe_math.h"
-#include "content/common/gpu/client/gpu_memory_buffer_factory_host.h"
-#include "ui/gl/efl_pixmap.h"
-#include "ui/gl/gl_bindings.h"
-
-namespace content {
-namespace {
-
-// TODO(prashant.n): Move this to browser side code as per m41.
-//base::StaticAtomicSequenceNumber g_next_buffer_id;
-
-
-void GpuMemoryBufferDeleted(gfx::GpuMemoryBufferId id,
- int client_id,
- uint32 sync_point) {
- GpuMemoryBufferFactoryHost::GetInstance()->DestroyGpuMemoryBuffer(
- gfx::EFL_PIXMAP_BUFFER, id, client_id, sync_point);
-}
-
-
-void GpuMemoryBufferCreated(
- const gfx::Size& size,
- gfx::GpuMemoryBuffer::Format format,
- int client_id,
- const GpuMemoryBufferImpl::CreationCallback& callback,
- const gfx::GpuMemoryBufferHandle& handle) {
- if (handle.is_null()) {
- callback.Run(scoped_ptr<GpuMemoryBufferImpl>());
- return;
- }
- DCHECK_EQ(gfx::EFL_PIXMAP_BUFFER, handle.type);
- callback.Run(GpuMemoryBufferImplEflPixmap::CreateFromHandle(
- handle, size, format, base::Bind(&GpuMemoryBufferDeleted, handle.id, client_id)));
-}
-
-void GpuMemoryBufferCreatedForChildProcess(
- const GpuMemoryBufferImpl::AllocationCallback& callback,
- const gfx::GpuMemoryBufferHandle& handle) {
- DCHECK_EQ(gfx::EFL_PIXMAP_BUFFER, handle.type);
- callback.Run(handle);
-}
-
-} // namespace
-
-GpuMemoryBufferImplEflPixmap::GpuMemoryBufferImplEflPixmap(
- gfx::GpuMemoryBufferId id,
- const gfx::Size& size,
- Format format,
- const DestructionCallback& callback,
- scoped_ptr<gfx::EflPixmapImpl> efl_pixmap)
- : GpuMemoryBufferImpl(id, size, format, callback),
- efl_pixmap_(efl_pixmap.Pass()),
- stride_(0u) {
-}//Need to check
-
-GpuMemoryBufferImplEflPixmap::~GpuMemoryBufferImplEflPixmap() {
-}
-
-// static
-void GpuMemoryBufferImplEflPixmap::Create(
- gfx::GpuMemoryBufferId id,
- const gfx::Size& size,
- Format format,
- int client_id,
- const CreationCallback& callback) {
- GpuMemoryBufferFactoryHost::GetInstance()->CreateGpuMemoryBuffer(
- gfx::EFL_PIXMAP_BUFFER,
- id,
- size,
- format,
- MAP,
- client_id,
- base::Bind(&GpuMemoryBufferCreated, size, format, client_id, callback));
-}
-
-// static
-void GpuMemoryBufferImplEflPixmap::AllocateForChildProcess(
- gfx::GpuMemoryBufferId id,
- const gfx::Size& size,
- Format format,
- int child_client_id,
- const AllocationCallback& callback) {
- GpuMemoryBufferFactoryHost::GetInstance()->CreateGpuMemoryBuffer(
- gfx::EFL_PIXMAP_BUFFER,
- id,
- size,
- format,
- MAP,
- child_client_id,
- base::Bind(&GpuMemoryBufferCreatedForChildProcess, callback));
-}
-// static
-scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImplEflPixmap::CreateFromHandle(
- const gfx::GpuMemoryBufferHandle& handle,
- const gfx::Size& size,
- Format format,
- const DestructionCallback& callback) {
- DCHECK(IsFormatSupported(format));
- DCHECK(handle.efl_pixmap_id);
- // TODO: Rendering TG will implement following for Wayland.
-#if !defined(WAYLAND_BRINGUP)
- return make_scoped_ptr<GpuMemoryBufferImpl>(new GpuMemoryBufferImplEflPixmap(
- handle.id, size, format, callback,make_scoped_ptr<gfx::EflPixmapImpl>(new gfx::EflPixmapImpl(
- gfx::EflPixmapBase::BUFFER, handle.efl_pixmap_id))));
-#else
- NOTIMPLEMENTED();
- return NULL;
-#endif
-}
-
-void GpuMemoryBufferImplEflPixmap::DeletedByChildProcess(
- gfx::GpuMemoryBufferId id,
- int child_client_id,
- uint32_t sync_point) {
- GpuMemoryBufferFactoryHost::GetInstance()->DestroyGpuMemoryBuffer(
- gfx::EFL_PIXMAP_BUFFER, id, child_client_id, sync_point);
-}
-
-// static
-bool GpuMemoryBufferImplEflPixmap::IsFormatSupported(Format format) {
- switch (format) {
- case RGBA_8888:
- case BGRA_8888:
- return true;
- case RGBX_8888:
- return false;
- }
-
- NOTREACHED();
- return false;
-}
-
-// static
-bool GpuMemoryBufferImplEflPixmap::IsUsageSupported(Usage usage) {
- switch (usage) {
- case MAP:
- return true;
- case SCANOUT:
- return false;
- }
-
- NOTREACHED();
- return false;
-}
-
-// static
-bool GpuMemoryBufferImplEflPixmap::IsLayoutSupported(const gfx::Size& size,
- Format format) {
- if (!IsFormatSupported(format))
- return false;
-
- return true;
-}
-
-// static
-bool GpuMemoryBufferImplEflPixmap::IsConfigurationSupported(Format format,
- Usage usage) {
- return IsFormatSupported(format) && IsUsageSupported(usage);
-}
-
-void* GpuMemoryBufferImplEflPixmap::Map() {
- TRACE_EVENT0("gpu", "GpuMemoryBufferImplEflPixmap::Map");
- DCHECK(efl_pixmap_);
- DCHECK(!mapped_);
- mapped_ = true;
- void* buffer = efl_pixmap_->Map();
- stride_ = efl_pixmap_->GetStride();
-
- return buffer;
-}
-
-void GpuMemoryBufferImplEflPixmap::Unmap() {
- TRACE_EVENT0("gpu", "GpuMemoryBufferImplEflPixmap::Unmap");
- DCHECK(efl_pixmap_);
- DCHECK(mapped_);
- efl_pixmap_->UnMap();
- mapped_ = false;
-}
-
-uint32 GpuMemoryBufferImplEflPixmap::GetStride() const {
- return stride_;
-}
-
-gfx::GpuMemoryBufferHandle GpuMemoryBufferImplEflPixmap::GetHandle() const {
- gfx::GpuMemoryBufferHandle handle;
- handle.type = gfx::EFL_PIXMAP_BUFFER;
- handle.id = id_;
- handle.efl_pixmap_id = efl_pixmap_->GetId();
- return handle;
-}
-
-} // namespace content
+++ /dev/null
-// Copyright 2014 Samsung Electronics. All rights reserved.
-// 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_GPU_MEMORY_BUFFER_IMPL_EFL_PIXMAP_H_
-#define CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_EFL_PIXMAP_H_
-
-#include "content/common/gpu/client/gpu_memory_buffer_impl.h"
-
-namespace gfx {
-class EflPixmapImpl;
-}
-
-namespace content {
-
-// Implementation of GPU memory buffer based on efl pixmap.
-class GpuMemoryBufferImplEflPixmap : public GpuMemoryBufferImpl {
- public:
- static void Create(gfx::GpuMemoryBufferId id,
- const gfx::Size& size,
- Format format,
- int client_id,
- const CreationCallback& callback);
-
- static void AllocateForChildProcess(gfx::GpuMemoryBufferId id,
- const gfx::Size& size,
- Format format,
- int child_client_id,
- const AllocationCallback& callback);
-
- static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle(
- const gfx::GpuMemoryBufferHandle& handle,
- const gfx::Size& size,
- Format format,
- const DestructionCallback& callback);
-
- static void DeletedByChildProcess(gfx::GpuMemoryBufferId id,
- int child_client_id,
- uint32_t sync_point);
-
- static bool IsFormatSupported(Format format);
- static bool IsUsageSupported(Usage usage);
- static bool IsLayoutSupported(const gfx::Size& size, Format format);
- static bool IsConfigurationSupported(Format format, Usage usage);
-
- // Overridden from gfx::GpuMemoryBuffer:
- virtual void* Map() override;
- virtual void Unmap() override;
- virtual uint32 GetStride() const override;
- virtual gfx::GpuMemoryBufferHandle GetHandle() const override;
-
- private:
- GpuMemoryBufferImplEflPixmap(gfx::GpuMemoryBufferId id,
- const gfx::Size& size,
- Format format,
- const DestructionCallback& callback,
- scoped_ptr<gfx::EflPixmapImpl> efl_pixmap);
- virtual ~GpuMemoryBufferImplEflPixmap();
-
- gfx::GpuMemoryBufferId id_;
- scoped_ptr<gfx::EflPixmapImpl> efl_pixmap_;
- size_t stride_;
-
- DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplEflPixmap);
-};
-
-} // namespace content
-
-#endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_EFL_PIXMAP_H_
+++ /dev/null
-// Copyright 2014 Samsung Electronics. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "content/common/gpu/gpu_memory_buffer_factory.h"
-
-#include "base/logging.h"
-#include "content/common/gpu/gpu_memory_buffer_factory_efl_pixmap.h"
-#include "gpu/command_buffer/service/image_factory.h"
-#include "ui/gl/gl_image.h"
-#include "ui/gl/gl_image_efl_pixmap.h"
-#include "ui/gl/gl_image_shared_memory.h"
-
-namespace content {
-namespace {
-
-class GpuMemoryBufferFactoryImpl:
- public GpuMemoryBufferFactory ,
- public gpu::ImageFactory {
- public:
- // Overridden from GpuMemoryBufferFactory:
- virtual gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer(
- gfx::GpuMemoryBufferType type,
- gfx::GpuMemoryBufferId id,
- const gfx::Size& size,
- gfx::GpuMemoryBuffer::Format format,
- gfx::GpuMemoryBuffer::Usage usage,
- int client_id) override {
- switch (type) {
- case gfx::EFL_PIXMAP_BUFFER: {
- // TODO: Rendering TG will implement following for Wayland.
-#if !defined(WAYLAND_BRINGUP)
- return efl_pixmap_factory_.CreateGpuMemoryBuffer(
- id, size, format,client_id);
-#else
- NOTIMPLEMENTED();
- return NULL;
-#endif
- }
- default:
- NOTREACHED();
- return gfx::GpuMemoryBufferHandle();
- }
- }
- virtual void DestroyGpuMemoryBuffer(
- gfx::GpuMemoryBufferType type,
- gfx::GpuMemoryBufferId id,
- int client_id) override {
- switch (type) {
- case gfx::EFL_PIXMAP_BUFFER:
- // TODO: Rendering TG will implement following for Wayland.
-#if !defined(WAYLAND_BRINGUP)
- efl_pixmap_factory_.DestroyGpuMemoryBuffer(id, client_id);
-#else
- NOTIMPLEMENTED();
-#endif
- break;
- default:
- NOTREACHED();
- break;
- }
- }
-
- virtual gpu::ImageFactory* AsImageFactory() override { return this; }
- virtual scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer(
- const gfx::GpuMemoryBufferHandle& handle,
- const gfx::Size& size,
- gfx::GpuMemoryBuffer::Format format,
- unsigned internalformat,
- int client_id) override {
- switch (handle.type) {
- case gfx::SHARED_MEMORY_BUFFER: {
- scoped_refptr<gfx::GLImageSharedMemory> image(
- new gfx::GLImageSharedMemory(size, internalformat));
- if (!image->Initialize(handle, format))
- return NULL;
-
- return image;
- }
- case gfx::EFL_PIXMAP_BUFFER: {
- // TODO: Rendering TG will implement following for Wayland.
-#if !defined(WAYLAND_BRINGUP)
- return efl_pixmap_factory_.CreateImageForGpuMemoryBuffer(
- handle.efl_pixmap_id, size, internalformat,client_id);
-#else
- NOTIMPLEMENTED();
- return NULL;
-#endif
- }
- default:
- NOTREACHED();
- return scoped_refptr<gfx::GLImage>();
- }
- }
-
-#if !defined(WAYLAND_BRINGUP)
- private:
- // TODO: Rendering TG will implement following for Wayland.
- GpuMemoryBufferFactoryEflPixmap efl_pixmap_factory_;
-#endif
-};
-
-} // namespace
-
-// static
-scoped_ptr<GpuMemoryBufferFactory> GpuMemoryBufferFactory::Create() {
- return make_scoped_ptr<GpuMemoryBufferFactory>(
- new GpuMemoryBufferFactoryImpl);
-}
-
-
-} // namespace content
+++ /dev/null
-// Copyright 2014 Samsung Electronics. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "content/common/gpu/gpu_memory_buffer_factory_efl_pixmap.h"
-
-#include "ui/gl/efl_pixmap.h"
-#include "ui/gl/gl_image_efl_pixmap.h"
-
-namespace content {
-
-GpuMemoryBufferFactoryEflPixmap::GpuMemoryBufferFactoryEflPixmap() {
-}
-
-GpuMemoryBufferFactoryEflPixmap::~GpuMemoryBufferFactoryEflPixmap() {
-}
-
-gfx::GpuMemoryBufferHandle
-GpuMemoryBufferFactoryEflPixmap::CreateGpuMemoryBuffer(
- gfx::GpuMemoryBufferId id,
- const gfx::Size& size,
- unsigned internalformat,
- int client_id) {
- scoped_refptr<gfx::EflPixmap> efl_pixmap =
- gfx::EflPixmap::Create(gfx::EflPixmap::BUFFER, size);
- if (!efl_pixmap.get())
- return gfx::GpuMemoryBufferHandle();
-
- EflPixmapMapKey key(id, client_id);
- DCHECK(efl_pixmaps_.find(key) == efl_pixmaps_.end());
- efl_pixmaps_[key] = efl_pixmap;
-
- gfx::GpuMemoryBufferHandle handle;
- handle.type = gfx::EFL_PIXMAP_BUFFER;
- handle.id = id;
- handle.efl_pixmap_id = efl_pixmap->GetId();
- return handle;
-}
-
-void GpuMemoryBufferFactoryEflPixmap::DestroyGpuMemoryBuffer(
- gfx::GpuMemoryBufferId id,int client_id) {
- EflPixmapMapKey key(id, client_id);
- EflPixmapMap::iterator it = efl_pixmaps_.find(key);
- if (it != efl_pixmaps_.end())
- efl_pixmaps_.erase(it);
-}
-
-scoped_refptr<gfx::GLImage>
-GpuMemoryBufferFactoryEflPixmap::CreateImageForGpuMemoryBuffer(
- unsigned long frame_pixmap_id,
- const gfx::Size& size,
- unsigned internalformat,
- int client_id ) {
- scoped_refptr<gfx::GLImageEflPixmap> image(new gfx::GLImageEflPixmap(size));
- if (!image->Initialize(frame_pixmap_id))
- return scoped_refptr<gfx::GLImage>();
-
- return image;
-}
-
-} // namespace content
+++ /dev/null
-// Copyright 2014 Samsung Electronics. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_EFL_PIXMAP_H_
-#define CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_EFL_PIXMAP_H_
-
-#include "base/containers/hash_tables.h"
-#include "base/memory/ref_counted.h"
-#include "ui/gfx/geometry/size.h"
-#include "ui/gfx/gpu_memory_buffer.h"
-
-namespace gfx {
-class GLImage;
-class EflPixmap;
-}
-
-namespace content {
-
-class GpuMemoryBufferFactoryEflPixmap {
- public:
- GpuMemoryBufferFactoryEflPixmap();
- ~GpuMemoryBufferFactoryEflPixmap();
-
- // Creates a efl pixmap backed GPU memory buffer with |size| and
- // |internalformat|. A valid handle is returned on success.
- gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer(
- gfx::GpuMemoryBufferId id,
- const gfx::Size& size,
- unsigned internalformat,
- int client_id);
-
- // Destroy a previously created GPU memory buffer.
- void DestroyGpuMemoryBuffer(const gfx::GpuMemoryBufferId id,int client_id);
-
- // Creates a GLImage instance for a GPU memory buffer.
- scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer(
- unsigned long frame_pixmap_id,
- const gfx::Size& size,
- unsigned internalformat,
- int client_id);
-
- private:
- typedef std::pair<int, int> EflPixmapMapKey;
- typedef base::hash_map<EflPixmapMapKey,
- scoped_refptr<gfx::EflPixmap>> EflPixmapMap;
- EflPixmapMap efl_pixmaps_;
-};
-
-} // namespace content
-
-#endif // CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_EFL_PIXMAP_H_
+++ /dev/null
-// Copyright 2014 Samsung Electronics. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-
-extern "C" {
-#include <X11/Xlib.h>
-#include <X11/Xmd.h>
-#include <dri2/dri2.h>
-#include <dri2.h>
-#include <stdint.h>
-#include <libdrm/drm.h>
-#include <tbm_bufmgr.h>
-#include <xf86drm.h>
-#include <xf86drmMode.h>
-}
-
-#include "ui/gl/efl_pixmap.h"
-#include "base/containers/scoped_ptr_hash_map.h"
-#include "base/logging.h"
-#include "ui/gl/egl_util.h"
-
-#include <errno.h>
-#include <fcntl.h>
-#include <linux/fb.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <time.h>
-#include <unistd.h>
-
-#include <X11/Xutil.h>
-
-namespace gl {
-
-// Helper classes implementation.
-class NativeDisplayConnection {
- public:
- NativeDisplayConnection() {
- display_ = XOpenDisplay(0);
- if (!display_) {
- LOG(ERROR) << "Failed to make connection with X";
- exit(0);
- }
- }
-
- ~NativeDisplayConnection() { XCloseDisplay(display_); }
-
- Display* GetDisplay() { return display_; }
-
- private:
- Display* display_;
-};
-
-class EGLDisplayConnection {
- public:
- EGLDisplayConnection(Display* native_display) {
- if (native_display) {
- egl_display_ =
- eglGetDisplay(reinterpret_cast<EGLNativeDisplayType>(native_display));
- } else {
- LOG(ERROR) << "EGLDisplayConnection failed - Invalid native display.";
- return;
- }
-
- if (egl_display_ == EGL_NO_DISPLAY) {
- LOG(ERROR) << "EGLDisplayConnection failed - "
- << ui::GetLastEGLErrorString();
- return;
- }
-
- EGLint major, minor;
- if (eglInitialize(egl_display_, &major, &minor) != EGL_TRUE) {
- Terminate();
- LOG(ERROR) << "EGLDisplayConnection failed - "
- << ui::GetLastEGLErrorString();
- }
- }
-
- ~EGLDisplayConnection() { Terminate(); }
-
- EGLDisplay GetDisplay() { return egl_display_; }
-
- private:
- void Terminate() {
- if (egl_display_ == EGL_NO_DISPLAY)
- return;
-
- eglTerminate(egl_display_);
- egl_display_ = EGL_NO_DISPLAY;
- }
-
- EGLDisplay egl_display_;
-};
-
-class OffScreenRootWindow {
- public:
- OffScreenRootWindow(Display* native_display) {
- window_ = 0;
-
- if (!native_display) {
- LOG(ERROR) << "OffScreenRootWindow failed - Invalid native display.";
- return;
- }
-
- native_display_ = native_display;
- XSetWindowAttributes attributes;
- attributes.override_redirect = true;
- window_ = XCreateSimpleWindow(
- native_display, XDefaultRootWindow(native_display), -1, -1, 1, 1, 0,
- BlackPixel(native_display, 0), WhitePixel(native_display, 0));
- XChangeWindowAttributes(native_display, window_, CWOverrideRedirect,
- &attributes);
- XMapWindow(native_display, window_);
-
- if (!window_)
- LOG(ERROR) << "OffScreenRootWindow failed to create window.";
- }
-
- ~OffScreenRootWindow() {
- if (!native_display_)
- return;
-
- if (window_) {
- XUnmapWindow(native_display_, window_);
- XDestroyWindow(native_display_, window_);
- window_ = 0;
- }
- }
-
- Window GetRootWindow() { return window_; }
-
- private:
- Window window_;
- Display* native_display_;
-};
-
-Window GetOffscreenRootWindow() {
- static OffScreenRootWindow offscreen_root_window(
- EflPixmap::GetNativeDisplay());
- return offscreen_root_window.GetRootWindow();
-}
-
-// Tizen buffer implementation.
-struct TbmInfo {
- int fd;
- tbm_bufmgr bufmgr;
-
- TbmInfo() : fd(-1), bufmgr(0) {}
-};
-
-TbmInfo g_tbm_info;
-
-class NativeBufferManager {
- public:
- static void AddRef() {
- ++s_ref;
-
- if (s_native_buffer_manager == NULL)
- s_native_buffer_manager = new NativeBufferManager;
- }
-
- static void RemoveRef() {
- DCHECK(s_ref > 0);
- --s_ref;
-
- if (s_ref == 0) {
- delete s_native_buffer_manager;
- s_native_buffer_manager = NULL;
- }
- }
-
- private:
- NativeBufferManager() { Initialize(); }
- ~NativeBufferManager() { Finalize(); }
-
- bool Initialize() {
- int event_base = 0;
- int error_base = 0;
- int dri2_major = 0;
- int dri2_minor = 0;
- char* driver_name = 0;
- char* device_name = 0;
- drm_magic_t magic = 0;
- int fd = -1;
-
- Display* dpy = EflPixmap::GetNativeDisplay();
- int screen = XDefaultScreen(dpy);
- if (!DRI2QueryExtension(dpy, &event_base, &error_base)) {
- LOG(ERROR) << "'DRI2QueryExtension' failed to get dri2 extension.";
- goto error;
- }
-
- if (!DRI2QueryVersion(dpy, &dri2_major, &dri2_minor)) {
- LOG(ERROR) << "'DRI2QueryVersion' failed to get dri2 version.";
- goto error;
- }
-
- if (!DRI2Connect(dpy, RootWindow(dpy, screen), &driver_name,
- &device_name)) {
- LOG(ERROR) << "'DRI2Connect' failed to get dri2 connect.";
- goto error;
- }
-
- fd = open(device_name, O_RDWR);
- if (fd < 0) {
- LOG(ERROR) << "'DRM] couldn't open : ";
- goto error;
- }
-
- if (drmGetMagic(fd, &magic)) {
- LOG(ERROR) << "'drmGetMagic' failed to get magic.";
- goto error;
- }
-
- if (!DRI2Authenticate(dpy, RootWindow(dpy, screen), (unsigned int)magic)) {
- LOG(ERROR) << "'DRI2Authenticate' failed to get authentication.";
- goto error;
- }
-
- g_tbm_info.fd = fd;
-
- setenv("BUFMGR_LOCK_TYPE", "always", 1);
- setenv("BUFMGR_MAP_CACHE", "true", 1);
- g_tbm_info.bufmgr = tbm_bufmgr_init(fd);
-
- free(driver_name);
- free(device_name);
- return true;
-
- error:
- free(driver_name);
- free(device_name);
- if (fd > -1)
- close(fd);
- return false;
- }
-
- void Finalize() {
- if (g_tbm_info.bufmgr)
- tbm_bufmgr_deinit(g_tbm_info.bufmgr);
-
- if (g_tbm_info.fd > -1) {
- close(g_tbm_info.fd);
- g_tbm_info.fd = -1;
- }
- }
-
- static int s_ref;
- static NativeBufferManager* s_native_buffer_manager;
-};
-
-int NativeBufferManager::s_ref = 0;
-NativeBufferManager* NativeBufferManager::s_native_buffer_manager = NULL;
-
-class NativeBuffer {
- public:
- NativeBuffer();
- ~NativeBuffer();
-
- void CreateDrawable(unsigned long pixmap_id);
- void DestroyDrawable(unsigned long pixmap_id);
- void* Lock(unsigned long pixmap_id, int count);
- bool Unlock();
- int GetStride(unsigned long pixmap_id);
-
- private:
- int pixmap_;
- DRI2Buffer* buffer_;
- tbm_bo buffer_object_;
-};
-
-NativeBuffer::NativeBuffer() : buffer_(NULL),
- buffer_object_(NULL) {
- NativeBufferManager::AddRef();
-}
-
-NativeBuffer::~NativeBuffer() {
- if (buffer_) {
- XFree(buffer_);
- buffer_ = NULL;
- }
-
- NativeBufferManager::RemoveRef();
-}
-
-void NativeBuffer::CreateDrawable(unsigned long pixmap_id) {
- DRI2CreateDrawable(EflPixmap::GetNativeDisplay(), pixmap_id);
-}
-
-void NativeBuffer::DestroyDrawable(unsigned long pixmap_id) {
- DRI2DestroyDrawable(EflPixmap::GetNativeDisplay(), pixmap_id);
-}
-
-void* NativeBuffer::Lock(unsigned long pixmap_id, int count) {
- tbm_bo_handle handle;
- unsigned int attach = DRI2BufferFrontLeft;
- int num = -1, width = 0, height = 0;
-
- DCHECK(pixmap_id);
-
- if (!buffer_) {
- DRI2Buffer* buffer = DRI2GetBuffers(EflPixmap::GetNativeDisplay(),
- pixmap_id,
- &width,
- &height,
- &attach,
- 1,
- &num);
- if (!buffer || !buffer->name) {
- LOG(ERROR) << "'DRI2GetBuffers' failed to get dri2 buffers count :"
- << count << "buf :" << buffer << "buf->name" << buffer->name;
- XFree(buffer);
- return NULL;
- }
-
- buffer_ = buffer;
- }
-
- if (!buffer_object_) {
- buffer_object_ = tbm_bo_import(g_tbm_info.bufmgr, buffer_->name);
- if (!buffer_object_) {
- LOG(ERROR) << "'tbm_bo_import' failed to import buffer";
- return NULL;
- }
- }
-
- handle = tbm_bo_map(buffer_object_,
- TBM_DEVICE_CPU,
- TBM_OPTION_READ | TBM_OPTION_WRITE);
-
- if (!handle.ptr) {
- LOG(ERROR) << "'tbm_bo_map' failed to map tbm buffer for GPU";
- return NULL;
- }
-
- return handle.ptr;
-}
-
-bool NativeBuffer::Unlock() {
- if (!buffer_object_)
- return false;
-
- tbm_bo_unmap(buffer_object_);
- tbm_bo_unref(buffer_object_);
- buffer_object_ = NULL;
- return true;
-}
-
-int NativeBuffer::GetStride(unsigned long pixmap_id) {
- DCHECK(buffer_);
- return buffer_->pitch;
-}
-
-// EflPixmapBase implemetation.
-int EflPixmapBase::s_pixmap_surface_count = 0;
-
-EflPixmapBase::EflPixmapBase(UsageType usage_type)
- : usage_type_(usage_type),
- pixmap_id_(0),
- native_buffer_(NULL) {
- native_buffer_ = new NativeBuffer;
-}
-
-EflPixmapBase::~EflPixmapBase() {
- DCHECK(native_buffer_);
- delete native_buffer_;
- native_buffer_ = NULL;
- pixmap_id_ = 0;
-}
-
-void* EflPixmapBase::Map() {
- DCHECK(usage_type_ == BUFFER);
- return native_buffer_->Lock(pixmap_id_,
- EflPixmapBase::s_pixmap_surface_count);
-}
-
-bool EflPixmapBase::UnMap() {
- DCHECK(usage_type_ == BUFFER);
- return native_buffer_->Unlock();
-}
-
-int EflPixmapBase::GetStride() {
- DCHECK(usage_type_ == BUFFER);
- return native_buffer_->GetStride(pixmap_id_);
-}
-
-
-// EflPixmap implemetation.
-// static
-scoped_refptr<EflPixmap> EflPixmap::Create(UsageType usage_type,
- const gfx::Size& size) {
- EflPixmap* efl_pixmap = new EflPixmap(usage_type, size);
-
- if (!efl_pixmap->Initialize()) {
- LOG(ERROR) << "EflPixmap creation failed.";
-
- delete efl_pixmap;
- efl_pixmap = NULL;
- }
-
- return make_scoped_refptr(efl_pixmap);
-}
-
-EflPixmap::EflPixmap(UsageType usage_type, const gfx::Size& size)
- : EflPixmapBase(usage_type),
- size_(size),
- surface_(EGL_NO_SURFACE),
- used_(false) {
- EflPixmapBase::s_pixmap_surface_count++;
-}
-
-EflPixmap::~EflPixmap() {
- DCHECK(GetDisplay());
-
- if (surface_ != EGL_NO_SURFACE) {
- DestroySurface(surface_);
- surface_ = EGL_NO_SURFACE;
- }
-
- if (pixmap_id_) {
- native_buffer_->DestroyDrawable(pixmap_id_);
- FreePixmap(pixmap_id_);
- pixmap_id_ = 0;
- }
-
- delete native_buffer_;
- native_buffer_ = NULL;
-
- EflPixmapBase::s_pixmap_surface_count--;
-}
-
-// static
-const char* EflPixmap::GetEglExtensions() {
- return eglQueryString(GetNativeDisplay(), EGL_EXTENSIONS);
-}
-
-// static
-Display* EflPixmap::GetNativeDisplay() {
- static NativeDisplayConnection native_display_connection;
- return native_display_connection.GetDisplay();
-}
-
-// static
-EGLDisplay EflPixmap::GetDisplay() {
- static EGLDisplayConnection egl_display_connection(GetNativeDisplay());
- return egl_display_connection.GetDisplay();
-}
-
-// static
-EGLConfig EflPixmap::GetConfig() {
- static EGLConfig config = EflPixmap::ChooseConfig();
- return config;
-}
-
-bool EflPixmap::Initialize() {
- if (size_.IsEmpty() || !GetDisplay() || !GetConfig())
- return false;
-
- pixmap_id_ = CreatePixmap(size_);
- if (!pixmap_id_)
- return false;
-
- native_buffer_->CreateDrawable(pixmap_id_);
-
- if (usage_type_ == SURFACE) {
- surface_ = CreateSurface(pixmap_id_);
-
- if (surface_ == EGL_NO_SURFACE)
- return false;
- }
-
- XSync(GetNativeDisplay(), false);
-
- return true;
-}
-
-// static
-EGLConfig EflPixmap::ChooseConfig() {
- EGLint config_attributes_list[] = {
- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
- EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT | EGL_PIXMAP_BIT,
- EGL_RED_SIZE, 8,
- EGL_GREEN_SIZE, 8,
- EGL_BLUE_SIZE, 8,
- EGL_ALPHA_SIZE, 8,
- EGL_DEPTH_SIZE, 24,
- EGL_STENCIL_SIZE, 8,
- EGL_SAMPLES, 2,
- EGL_NONE
- };
-
- EGLConfig config = NULL;
- EGLint config_count = 0;
- if ((eglChooseConfig(GetDisplay(),
- config_attributes_list,
- &config,
- 1,
- &config_count) != EGL_TRUE) && config_count) {
- LOG(ERROR) << "eglChooseConfig failed - " << ui::GetLastEGLErrorString();
- return NULL;
- }
-
- return config;
-}
-
-EGLSurface EflPixmap::CreateSurface(unsigned long pixmap_id) {
- DCHECK(GetDisplay());
- DCHECK(GetConfig());
- DCHECK(pixmap_id);
-
- EGLSurface surface =
- eglCreatePixmapSurface(GetDisplay(), GetConfig(), pixmap_id, 0);
-
- if (surface == EGL_NO_SURFACE) {
- LOG(ERROR) << "eglCreatePixmapSurface failed - "
- << ui::GetLastEGLErrorString();
- } else {
- eglSurfaceAttrib(GetDisplay(),
- surface,
- EGL_SWAP_BEHAVIOR,
- EGL_BUFFER_PRESERVED);
- }
-
- return surface;
-}
-
-void EflPixmap::DestroySurface(EGLSurface surface) {
- DCHECK(GetDisplay());
- DCHECK(surface);
-
- if (eglMakeCurrent(GetDisplay(),
- EGL_NO_SURFACE,
- EGL_NO_SURFACE,
- EGL_NO_CONTEXT) != EGL_TRUE) {
- LOG(ERROR) << "eglMakeCurrent failed - " << ui::GetLastEGLErrorString();
- }
-
- eglDestroySurface(GetDisplay(), surface);
-}
-
-unsigned long EflPixmap::CreatePixmap(const gfx::Size& size) {
- DCHECK(!size.IsEmpty());
-
- // FIXME(prashant.n): Get depth (value 24) from xvisuals or geometry.
- unsigned long pixmap_id = XCreatePixmap(GetNativeDisplay(),
- GetOffscreenRootWindow(),
- size.width(),
- size.height(),
- 24);
- XFlush(GetNativeDisplay());
- return pixmap_id;
-}
-
-void EflPixmap::FreePixmap(unsigned long pixmap_id) {
- DCHECK(pixmap_id);
- XFreePixmap(GetNativeDisplay(), pixmap_id);
-}
-
-// EflPixmapImpl implementation.
-EflPixmapImpl::EflPixmapImpl(UsageType usage_type, unsigned long pixmap_id)
- : EflPixmapBase(usage_type) {
- DCHECK(usage_type_ == BUFFER);
- DCHECK(pixmap_id);
- pixmap_id_ = pixmap_id;
- native_buffer_->CreateDrawable(pixmap_id_);
-}
-
-EflPixmapImpl::~EflPixmapImpl() {
- native_buffer_->DestroyDrawable(pixmap_id_);
- pixmap_id_ = 0;
-
-}
-
-} // namespace gl
+++ /dev/null
-// Copyright 2014 Samsung Electronics. 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_EFL_PIXMAP_H_
-#define UI_GL_EFL_PIXMAP_H_
-
-#include "base/containers/hash_tables.h"
-#include "base/memory/ref_counted.h"
-#include "ui/gfx/geometry/size.h"
-#include "ui/gl/gl_bindings.h"
-
-#if !defined(WAYLAND_BRINGUP)
-#include <X11/Xlib.h>
-#endif
-
-namespace gl {
-
-class NativeBuffer;
-
-// TODO(prashant.n): Refactor the code into different files.
-// Basic Pixmap implementation.
-class GL_EXPORT EflPixmapBase {
- public:
- enum UsageType {
- BUFFER,
- SURFACE
- };
-
- virtual unsigned long GetId() { return pixmap_id_; }
-
- virtual void* Map();
- virtual bool UnMap();
- virtual int GetStride();
-
- protected:
- EflPixmapBase(UsageType usage_type);
- virtual ~EflPixmapBase();
-
- UsageType usage_type_;
- unsigned long pixmap_id_;
- NativeBuffer* native_buffer_;
-
- static int s_pixmap_surface_count;
-};
-
-// Pixmap implementation - to be used in GPU process/thread.
-class GL_EXPORT EflPixmap : public EflPixmapBase,
- public base::RefCountedThreadSafe<EflPixmap> {
- public:
- static scoped_refptr<EflPixmap> Create(UsageType usage_type,
- const gfx::Size& size);
- virtual ~EflPixmap();
-
- static const char* GetEglExtensions();
- // TODO: Rendering TG will implement following for Wayland.
-#if !defined(WAYLAND_BRINGUP)
- static Display* GetNativeDisplay();
-#endif
- static EGLDisplay GetDisplay();
- static EGLConfig GetConfig();
-
- const gfx::Size GetSize() const { return size_; }
- bool Used() { return used_; }
- void SetUsed(bool used) { used_ = used; }
- EGLSurface GetSurface() { return surface_; }
-
- // EflPixmapBase functions:
- using EflPixmapBase::GetId;
- using EflPixmapBase::Map;
- using EflPixmapBase::UnMap;
- using EflPixmapBase::GetStride;
-
- private:
- EflPixmap(UsageType usage_type, const gfx::Size& size);
- bool Initialize();
- static EGLConfig ChooseConfig();
-
- EGLSurface CreateSurface(unsigned long pixmap_id);
- void DestroySurface(EGLSurface surface);
- unsigned long CreatePixmap(const gfx::Size& size);
- void FreePixmap(unsigned long pixmap_id);
-
- gfx::Size size_;
- EGLSurface surface_;
- bool used_;
-
- DISALLOW_COPY_AND_ASSIGN(EflPixmap);
-};
-
-// Pixmap implementation - to be used in renderer and browser processes.
-class GL_EXPORT EflPixmapImpl : public EflPixmapBase {
- public:
- explicit EflPixmapImpl(UsageType usage_type, unsigned long pixmap_id);
- ~EflPixmapImpl();
-
- // EflPixmapBase functions:
- using EflPixmapBase::GetId;
- using EflPixmapBase::Map;
- using EflPixmapBase::UnMap;
- using EflPixmapBase::GetStride;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(EflPixmapImpl);
-};
-
-} // namespace gl
-
-#endif // UI_GL_EFL_PIXMAP_H_
+++ /dev/null
-// Copyright 2014 Samsung Electronics. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/gl/gl_image_efl_pixmap.h"
-
-#include "base/trace_event/trace_event.h"
-#include "base/process/process_handle.h"
-#include "ui/gl/efl_pixmap.h"
-#include "ui/gl/egl_util.h"
-
-namespace {
-
-PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHRPfn = 0;
-PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOESPfn = 0;
-PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHRPfn = 0;
-
-EGLDisplay g_display = NULL;
-
-void EnsureGLImageFunctions() {
- if (!g_display) {
- g_display = eglGetCurrentDisplay();
- eglCreateImageKHRPfn =
- (PFNEGLCREATEIMAGEKHRPROC)eglGetProcAddress("eglCreateImageKHR");
- glEGLImageTargetTexture2DOESPfn =
- (PFNGLEGLIMAGETARGETTEXTURE2DOESPROC)eglGetProcAddress(
- "glEGLImageTargetTexture2DOES");
- eglDestroyImageKHRPfn =
- (PFNEGLDESTROYIMAGEKHRPROC)eglGetProcAddress("eglDestroyImageKHR");
- }
-}
-
-} // namespace
-
-namespace gl {
-
-GLImageEflPixmap::GLImageEflPixmap(gfx::Size size)
- : size_(size),
- in_use_(false),
- egl_image_(EGL_NO_IMAGE_KHR),
- target_(0) {
-}
-
-GLImageEflPixmap::~GLImageEflPixmap() {
-}
-
-bool GLImageEflPixmap::Initialize(unsigned long efl_pixmap_id) {
- EnsureGLImageFunctions();
- efl_pixmap_id_ = efl_pixmap_id;
- egl_image_ = eglCreateImageKHRPfn(g_display, EGL_NO_CONTEXT,
- EGL_NATIVE_PIXMAP_KHR,
- (EGLClientBuffer)(efl_pixmap_id_),
- NULL);
-
- if (egl_image_ == EGL_NO_IMAGE_KHR)
- LOG(ERROR) << "eglCreateImageKHR failed - " << ui::GetLastEGLErrorString();
-
- return true;
-}
-
-#if !defined(EWK_BRINGUP)
-void GLImageEflPixmap::Destroy(bool have_context) {
- if (egl_image_ == EGL_NO_IMAGE_KHR)
- return;
-
- EGLBoolean success = eglDestroyImageKHRPfn(g_display, egl_image_);
-
- if (success == EGL_FALSE)
- LOG(ERROR) << "eglDestroyImageKHR failed - " << ui::GetLastEGLErrorString();
-
- efl_pixmap_id_ = 0;
- egl_image_ = EGL_NO_IMAGE_KHR;
-}
-
-gfx::Size GLImageEflPixmap::GetSize() {
- return size_;
-}
-#endif
-
-unsigned GLImageEflPixmap::GetInternalFormat() {
- // FIXME: Check this for pixmap.
- return -1;
-}
-
-bool GLImageEflPixmap::BindTexImage(unsigned target) {
- TRACE_EVENT0("gpu", "GLImageEflPixmap::BindTexImage");
-
- if (egl_image_ == EGL_NO_IMAGE_KHR) {
- LOG(ERROR) << "NULL EGLImage - " << ui::GetLastEGLErrorString();
- return false;
- }
-
- if (target_ && target_ != target) {
- LOG(ERROR) << "EGLImage can only be bound to one target";
- return false;
- }
- target_ = target;
-
- if (in_use_)
- return true;
-
- glEGLImageTargetTexture2DOESPfn(target_, (EGLClientBuffer)egl_image_);
- EGLint error = eglGetError();
- if (error != EGL_SUCCESS) {
- LOG(ERROR) << "glEGLImageTargetTexture2DOES failed - "
- << ui::GetLastEGLErrorString();
- }
-
- DCHECK_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError());
- in_use_ = true;
- return true;
-}
-
-void GLImageEflPixmap::ReleaseTexImage(unsigned target) {}
-
-bool GLImageEflPixmap::CopyTexImage(unsigned target) {
- return false;
-}
-
-bool GLImageEflPixmap::CopyTexSubImage(unsigned target,
- const gfx::Point& offset,
- const gfx::Rect& rect) {
- return false;
-}
-
-bool GLImageEflPixmap::ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
- int z_order,
- gfx::OverlayTransform transform,
- const gfx::Rect& bounds_rect,
- const gfx::RectF& crop_rect) {
- return false;
-}
-
-void GLImageEflPixmap::Flush() {}
-
-void GLImageEflPixmap::OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd,
- uint64_t process_tracing_id,
- const std::string& dump_name) {}
-
-GLImage::Type GLImageEflPixmap::GetType() const {
- return Type::DXGI_IMAGE;
-}
-
-} // namespace gl
+++ /dev/null
-// Copyright 2014 Samsung Electronics. 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_EFL_PIXMAP_H_
-#define UI_GL_GL_IMAGE_EFL_PIXMAP_H_
-
-#include "ui/gl/gl_image.h"
-#include "ui/gfx/gpu_memory_buffer.h"
-#include "ui/gl/gl_bindings.h"
-
-
-namespace gl {
-
-class GL_EXPORT GLImageEflPixmap : public GLImage {
- public:
- GLImageEflPixmap(gfx::Size size);
-
- bool Initialize(unsigned long efl_pixmap_id);
-
- // Overridden from GLImage:
-#if !defined(EWK_BRINGUP)
- // This API is removed. Just keeping for reference.
- void Destroy(bool have_context) override;
-#endif
- gfx::Size GetSize() override;
- unsigned GetInternalFormat() override;
- bool BindTexImage(unsigned target) override;
- void ReleaseTexImage(unsigned target) override;
- bool CopyTexImage(unsigned target) override;
- bool CopyTexSubImage(unsigned target,
- const gfx::Point& offset,
- const gfx::Rect& rect) override;
- bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
- int z_order,
- gfx::OverlayTransform transform,
- const gfx::Rect& bounds_rect,
- const gfx::RectF& crop_rect) override;
- void Flush() override;
- void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd,
- uint64_t process_tracing_id,
- const std::string& dump_name) override;
- Type GetType() const override;
-
- protected:
- ~GLImageEflPixmap();
-
- private:
- unsigned long efl_pixmap_id_;
- const gfx::Size size_;
- bool in_use_;
- EGLImageKHR egl_image_;
- unsigned target_;
-
- DISALLOW_COPY_AND_ASSIGN(GLImageEflPixmap);
-};
-
-} // namespace gl
-
-#endif // UI_GL_GL_IMAGE_EFL_PIXMAP_H_