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

Unified Diff: content/browser/compositor/gpu_process_transport_factory.cc

Issue 1892303003: Added the Vulkan Context Provider implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
Index: content/browser/compositor/gpu_process_transport_factory.cc
diff --git a/content/browser/compositor/gpu_process_transport_factory.cc b/content/browser/compositor/gpu_process_transport_factory.cc
index cdc87981701b65605abcc69f47fc2caa3665ac88..05175f38a47b209e9fd1825cbc85cd8c05d61726 100644
--- a/content/browser/compositor/gpu_process_transport_factory.cc
+++ b/content/browser/compositor/gpu_process_transport_factory.cc
@@ -78,6 +78,12 @@
#include "content/browser/compositor/browser_compositor_overlay_candidate_validator_android.h"
#endif
+#if defined(ENABLE_VULKAN)
+#include "cc/output/vulkan_derived_context_provider.h"
+#include "cc/output/vulkan_in_process_context_provider.h"
+#include "content/browser/compositor/vulkan_browser_compositor_output_surface.h"
+#endif
+
using cc::ContextProvider;
using gpu::gles2::GLES2Interface;
@@ -223,6 +229,9 @@ void GpuProcessTransportFactory::CreateOutputSurface(
#endif
bool create_gpu_output_surface =
+#if defined(ENABLE_VULKAN)
+ !SharedVulkanContextProvider() &&
+#endif
piman 2016/04/19 01:36:42 create_gpu_output_surface really means "don't fall
David Yen 2016/04/19 22:20:28 Seems we need to check the switch everytime Shared
ShouldCreateGpuOutputSurface(compositor.get());
if (create_gpu_output_surface) {
CauseForGpuLaunch cause =
@@ -325,7 +334,17 @@ void GpuProcessTransportFactory::EstablishedGpuChannel(
}
std::unique_ptr<BrowserCompositorOutputSurface> surface;
- if (!create_gpu_output_surface) {
+#if defined(ENABLE_VULKAN)
+ scoped_refptr<cc::VulkanInProcessContextProvider> vulkan_context_provider =
+ SharedVulkanContextProvider();
+ if (vulkan_context_provider) {
+ surface = make_scoped_ptr(new VulkanBrowserCompositorOutputSurface(
+ cc::VulkanDerivedContextProvider::Create(vulkan_context_provider,
+ compositor.get()->widget()),
+ compositor->vsync_manager()));
+ } else
+#endif
+ if (!create_gpu_output_surface) {
surface = base::WrapUnique(new SoftwareBrowserCompositorOutputSurface(
CreateSoftwareOutputDevice(compositor.get()),
compositor->vsync_manager(), compositor->task_runner().get()));
@@ -390,9 +409,17 @@ void GpuProcessTransportFactory::EstablishedGpuChannel(
compositor->surface_id_allocator()->id_namespace()));
std::unique_ptr<cc::SurfaceDisplayOutputSurface> output_surface(
- new cc::SurfaceDisplayOutputSurface(
- manager, compositor->surface_id_allocator(), context_provider,
- shared_worker_context_provider_));
+#if defined(ENABLE_VULKAN)
+ vulkan_context_provider
+ ? new cc::SurfaceDisplayOutputSurface(
+ manager, compositor->surface_id_allocator(),
+ static_cast<scoped_refptr<cc::VulkanContextProvider>>(
+ vulkan_context_provider))
+ :
+#endif
+ new cc::SurfaceDisplayOutputSurface(
+ manager, compositor->surface_id_allocator(), context_provider,
+ shared_worker_context_provider_));
display_client->set_surface_output_surface(output_surface.get());
output_surface->set_display_client(display_client.get());
display_client->display()->Resize(compositor->size());
@@ -683,4 +710,19 @@ void GpuProcessTransportFactory::OnLostMainThreadSharedContext() {
lost_shared_main_thread_contexts = NULL;
}
+#if defined(ENABLE_VULKAN)
+scoped_refptr<cc::VulkanInProcessContextProvider>
+GpuProcessTransportFactory::SharedVulkanContextProvider() {
+ if (!shared_vulkan_context_provider_initialized_) {
+ shared_vulkan_context_provider_ =
+ cc::VulkanInProcessContextProvider::Create();
+ if (!shared_vulkan_context_provider_->Initialize())
+ shared_vulkan_context_provider_ = nullptr;
+
+ shared_vulkan_context_provider_initialized_ = true;
+ }
+ return shared_vulkan_context_provider_;
+}
+#endif
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698