Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(774)

Unified Diff: content/browser/gpu/browser_gpu_channel_host_factory.cc

Issue 225023009: Add Intel DRM backed GpuMemoryBuffer implementation. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase and add gl implementation checks Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/install-build-deps.sh ('k') | content/browser/renderer_host/render_message_filter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/gpu/browser_gpu_channel_host_factory.cc
diff --git a/content/browser/gpu/browser_gpu_channel_host_factory.cc b/content/browser/gpu/browser_gpu_channel_host_factory.cc
index 55d59dfc4fcc5663d5983ac6773568badd883ea6..0c25ff3b36a2bab06df7fca2b7537623a3e1a80e 100644
--- a/content/browser/gpu/browser_gpu_channel_host_factory.cc
+++ b/content/browser/gpu/browser_gpu_channel_host_factory.cc
@@ -18,6 +18,11 @@
#include "content/public/common/content_client.h"
#include "ipc/ipc_forwarding_message_filter.h"
+#if defined(OS_LINUX)
+#include "content/common/gpu/client/gpu_memory_buffer_impl_intel_drm.h"
+#include "ui/gl/gl_implementation.h"
+#endif
+
namespace content {
BrowserGpuChannelHostFactory* BrowserGpuChannelHostFactory::instance_ = NULL;
@@ -382,6 +387,28 @@ scoped_ptr<gfx::GpuMemoryBuffer>
if (!GpuMemoryBufferImpl::IsFormatValid(internalformat))
return scoped_ptr<gfx::GpuMemoryBuffer>();
+#if defined(OS_LINUX)
+ // Intel DRM implementation of gpu memory buffer is limited to EGLGLES2 as we
+ // currently depend on EGL_EXT_image_dma_buf_import to use this type of buffer
+ // on the GPU side.
+ bool is_gl_implementation_supported_by_intel_drm =
+ gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2;
+
+ if (is_gl_implementation_supported_by_intel_drm &&
+ GpuMemoryBufferImplIntelDRM::IsFormatSupported(internalformat)) {
+ drm_intel_bo* buffer_object =
+ GpuMemoryBufferImplIntelDRM::CreateBufferObject(
+ gfx::Size(width, height), internalformat);
+ if (buffer_object) {
+ scoped_ptr<GpuMemoryBufferImplIntelDRM> buffer(
+ new GpuMemoryBufferImplIntelDRM(gfx::Size(width, height),
+ internalformat));
+ if (buffer->InitializeFromBufferObject(buffer_object))
+ return buffer.PassAs<gfx::GpuMemoryBuffer>();
+ }
+ }
+#endif
+
size_t size = width * height *
GpuMemoryBufferImpl::BytesPerPixel(internalformat);
scoped_ptr<base::SharedMemory> shm(new base::SharedMemory());
« no previous file with comments | « build/install-build-deps.sh ('k') | content/browser/renderer_host/render_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698