Commit ed29795f authored by Chris Blume's avatar Chris Blume Committed by Commit Bot

Put Vulkan on Android builds behind a flag

Vulkan on Android was previously enabled by default in
https://chromium-review.googlesource.com/c/chromium/src/+/1110754

However, it caused an increase in binary size. We want to take some time
to investigate and attempt to reduce the binary size inflation.

The next branch point will happen before we get a chance to investigate.
So for now, let's put the Vulkan code behind a compile-time flag. That
will let us easily switch it back on later & continue to test the Vulkan
code path.

BUG=862144
TBR=tobiasjs@chromium.org, qinmin@chromium.org

Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: I52e499c792f13aa7208400650bffbc31a200f0c5
Reviewed-on: https://chromium-review.googlesource.com/1137348Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Commit-Queue: Chris Blume <cblume@chromium.org>
Cr-Commit-Position: refs/heads/master@{#575452}
parent 75a951ba
......@@ -43,10 +43,12 @@ void ParentOutputSurface::SwapBuffers(viz::OutputSurfaceFrame frame) {
context_provider_->ContextGL()->ShallowFlushCHROMIUM();
}
#if BUILDFLAG(ENABLE_VULKAN)
gpu::VulkanSurface* ParentOutputSurface::GetVulkanSurface() {
NOTIMPLEMENTED();
return nullptr;
}
#endif
bool ParentOutputSurface::HasExternalStencilTest() const {
return ScopedAppGLStateRestore::Current()
......
......@@ -29,7 +29,9 @@ class ParentOutputSurface : public viz::OutputSurface {
bool has_alpha,
bool use_stencil) override;
void SwapBuffers(viz::OutputSurfaceFrame frame) override;
#if BUILDFLAG(ENABLE_VULKAN)
gpu::VulkanSurface* GetVulkanSurface() override;
#endif
bool HasExternalStencilTest() const override;
void ApplyExternalStencil() override;
uint32_t GetFramebufferCopyTextureFormat() override;
......
......@@ -183,8 +183,10 @@ class CompositorDependencies {
// http://crbug.com/657959.
std::unique_ptr<viz::FrameSinkManagerImpl> frame_sink_manager_impl;
#if BUILDFLAG(ENABLE_VULKAN)
std::unique_ptr<gpu::VulkanImplementation> vulkan_implementation;
scoped_refptr<viz::VulkanContextProvider> vulkan_context_provider;
#endif
private:
friend class base::NoDestructor<CompositorDependencies>;
......@@ -240,6 +242,7 @@ class CompositorDependencies {
const unsigned int kMaxDisplaySwapBuffers = 1U;
#if BUILDFLAG(ENABLE_VULKAN)
scoped_refptr<viz::VulkanContextProvider> GetSharedVulkanContextProvider() {
if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableVulkan))
......@@ -257,6 +260,7 @@ scoped_refptr<viz::VulkanContextProvider> GetSharedVulkanContextProvider() {
}
return context_provider;
}
#endif
gpu::SharedMemoryLimits GetCompositorContextSharedMemoryLimits(
gfx::NativeWindow window) {
......@@ -405,10 +409,12 @@ class AndroidOutputSurface : public viz::OutputSurface {
}
}
#if BUILDFLAG(ENABLE_VULKAN)
gpu::VulkanSurface* GetVulkanSurface() override {
NOTIMPLEMENTED();
return nullptr;
}
#endif
void BindToClient(viz::OutputSurfaceClient* client) override {
DCHECK(client);
......@@ -491,6 +497,7 @@ class AndroidOutputSurface : public viz::OutputSurface {
base::WeakPtrFactory<AndroidOutputSurface> weak_ptr_factory_;
};
#if BUILDFLAG(ENABLE_VULKAN)
class VulkanOutputSurface : public viz::OutputSurface {
public:
explicit VulkanOutputSurface(
......@@ -600,6 +607,7 @@ class VulkanOutputSurface : public viz::OutputSurface {
DISALLOW_COPY_AND_ASSIGN(VulkanOutputSurface);
};
#endif
// TODO(khushalsagar): These are being sent based on the CompositorImpl
// visiblity which bakes in the assumption that there is a single CompositorImpl
......@@ -954,8 +962,10 @@ void CompositorImpl::HandlePendingLayerTreeFrameSinkRequest() {
if (!host_->IsVisible())
return;
#if BUILDFLAG(ENABLE_VULKAN)
if (CreateVulkanOutputSurface())
return;
#endif
DCHECK(surface_handle_ != gpu::kNullSurfaceHandle);
BrowserMainLoop::GetInstance()
......@@ -965,6 +975,7 @@ void CompositorImpl::HandlePendingLayerTreeFrameSinkRequest() {
weak_factory_.GetWeakPtr()));
}
#if BUILDFLAG(ENABLE_VULKAN)
bool CompositorImpl::CreateVulkanOutputSurface() {
if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableVulkan))
......@@ -985,6 +996,7 @@ bool CompositorImpl::CreateVulkanOutputSurface() {
return !!display_;
}
#endif
void CompositorImpl::OnGpuChannelEstablished(
scoped_refptr<gpu::GpuChannelHost> gpu_channel_host) {
......
......@@ -166,7 +166,9 @@ class CONTENT_EXPORT CompositorImpl
void HandlePendingLayerTreeFrameSinkRequest();
#if BUILDFLAG(ENABLE_VULKAN)
bool CreateVulkanOutputSurface();
#endif
void OnGpuChannelEstablished(
scoped_refptr<gpu::GpuChannelHost> gpu_channel_host);
void InitializeDisplay(
......
......@@ -86,10 +86,12 @@ class SynchronousLayerTreeFrameSink::SoftwareOutputSurface
void BindFramebuffer() override {}
void SetDrawRectangle(const gfx::Rect& rect) override {}
void SwapBuffers(viz::OutputSurfaceFrame frame) override {}
#if BUILDFLAG(ENABLE_VULKAN)
gpu::VulkanSurface* GetVulkanSurface() override {
NOTIMPLEMENTED();
return nullptr;
}
#endif
void Reshape(const gfx::Size& size,
float scale_factor,
const gfx::ColorSpace& color_space,
......
......@@ -9,4 +9,10 @@ import("//build/config/ui.gni")
declare_args() {
# Enable experimental vulkan backend.
enable_vulkan = (is_linux && use_x11) || is_android
# We want to temporarily disable Vulkan on Android to give us time to
# investigate ways to reduce its binary size.
if (is_android) {
enable_vulkan = false
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment