OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Represents the browser side of the browser <--> renderer communication | 5 // Represents the browser side of the browser <--> renderer communication |
6 // channel. There will be one RenderProcessHost per renderer process. | 6 // channel. There will be one RenderProcessHost per renderer process. |
7 | 7 |
8 #include "content/browser/renderer_host/render_process_host_impl.h" | 8 #include "content/browser/renderer_host/render_process_host_impl.h" |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 #include "ui/gfx/win/dpi.h" | 171 #include "ui/gfx/win/dpi.h" |
172 #endif | 172 #endif |
173 | 173 |
174 #if defined(ENABLE_WEBRTC) | 174 #if defined(ENABLE_WEBRTC) |
175 #include "content/browser/media/webrtc_internals.h" | 175 #include "content/browser/media/webrtc_internals.h" |
176 #include "content/browser/renderer_host/media/media_stream_track_metrics_host.h" | 176 #include "content/browser/renderer_host/media/media_stream_track_metrics_host.h" |
177 #include "content/browser/renderer_host/media/webrtc_identity_service_host.h" | 177 #include "content/browser/renderer_host/media/webrtc_identity_service_host.h" |
178 #include "content/common/media/media_stream_messages.h" | 178 #include "content/common/media/media_stream_messages.h" |
179 #endif | 179 #endif |
180 | 180 |
| 181 #if defined(OS_LINUX) |
| 182 #include "content/common/gpu/client/gpu_memory_buffer_impl_intel_drm.h" |
| 183 #include "ui/gl/gl_implementation.h" |
| 184 #endif |
| 185 |
181 extern bool g_exited_main_message_loop; | 186 extern bool g_exited_main_message_loop; |
182 | 187 |
183 static const char* kSiteProcessMapKeyName = "content_site_process_map"; | 188 static const char* kSiteProcessMapKeyName = "content_site_process_map"; |
184 | 189 |
185 namespace content { | 190 namespace content { |
186 namespace { | 191 namespace { |
187 | 192 |
188 void CacheShaderInfo(int32 id, base::FilePath path) { | 193 void CacheShaderInfo(int32 id, base::FilePath path) { |
189 ShaderCacheFactory::GetInstance()->SetCacheInfo(id, path); | 194 ShaderCacheFactory::GetInstance()->SetCacheInfo(id, path); |
190 } | 195 } |
(...skipping 2090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2281 gfx::GpuMemoryBufferHandle handle; | 2286 gfx::GpuMemoryBufferHandle handle; |
2282 handle.type = gfx::SURFACE_TEXTURE_BUFFER; | 2287 handle.type = gfx::SURFACE_TEXTURE_BUFFER; |
2283 handle.surface_texture_id = | 2288 handle.surface_texture_id = |
2284 gfx::SurfaceTextureId(surface_texture_id, GetID()); | 2289 gfx::SurfaceTextureId(surface_texture_id, GetID()); |
2285 GpuMemoryBufferAllocated(reply, handle); | 2290 GpuMemoryBufferAllocated(reply, handle); |
2286 return; | 2291 return; |
2287 } | 2292 } |
2288 } | 2293 } |
2289 #endif | 2294 #endif |
2290 | 2295 |
| 2296 #if defined(OS_LINUX) |
| 2297 // Intel DRM implementation of gpu memory buffer is limited to EGLGLES2 as we |
| 2298 // currently depend on EGL_EXT_image_dma_buf_import to use this type of buffer |
| 2299 // on the GPU side. |
| 2300 //bool is_gl_implementation_supported_by_intel_drm = |
| 2301 // gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2; |
| 2302 if (GpuMemoryBufferImplIntelDRM::IsFormatSupported(internalformat)) { |
| 2303 gfx::GpuMemoryBufferHandle handle; |
| 2304 if (GpuMemoryBufferImplIntelDRM::AllocateBufferObject( |
| 2305 gfx::Size(width, height), internalformat, &handle.handle)) { |
| 2306 handle.type = gfx::INTEL_DRM_BUFFER; |
| 2307 GpuMemoryBufferAllocated(reply, handle); |
| 2308 return; |
| 2309 } |
| 2310 } |
| 2311 #endif |
| 2312 |
2291 GpuMemoryBufferImpl::AllocateForChildProcess( | 2313 GpuMemoryBufferImpl::AllocateForChildProcess( |
2292 gfx::Size(width, height), | 2314 gfx::Size(width, height), |
2293 internalformat, | 2315 internalformat, |
2294 usage, | 2316 usage, |
2295 GetHandle(), | 2317 GetHandle(), |
2296 base::Bind(&RenderProcessHostImpl::GpuMemoryBufferAllocated, | 2318 base::Bind(&RenderProcessHostImpl::GpuMemoryBufferAllocated, |
2297 weak_factory_.GetWeakPtr(), | 2319 weak_factory_.GetWeakPtr(), |
2298 reply)); | 2320 reply)); |
2299 } | 2321 } |
2300 | 2322 |
2301 void RenderProcessHostImpl::GpuMemoryBufferAllocated( | 2323 void RenderProcessHostImpl::GpuMemoryBufferAllocated( |
2302 IPC::Message* reply, | 2324 IPC::Message* reply, |
2303 const gfx::GpuMemoryBufferHandle& handle) { | 2325 const gfx::GpuMemoryBufferHandle& handle) { |
2304 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 2326 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
2305 ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer::WriteReplyParams(reply, | 2327 ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer::WriteReplyParams(reply, |
2306 handle); | 2328 handle); |
2307 Send(reply); | 2329 Send(reply); |
2308 } | 2330 } |
2309 | 2331 |
2310 } // namespace content | 2332 } // namespace content |
OLD | NEW |