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

Side by Side Diff: content/browser/renderer_host/compositor_impl_android.cc

Issue 1916923004: Request context sharing via content::ContextProviderCommandBuffer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sharegroup: . Created 4 years, 7 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 unified diff | Download patch
OLDNEW
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 #include "content/browser/renderer_host/compositor_impl_android.h" 5 #include "content/browser/renderer_host/compositor_impl_android.h"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 #include <android/native_window_jni.h> 8 #include <android/native_window_jni.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 BrowserGpuChannelHostFactory::instance(); 544 BrowserGpuChannelHostFactory::instance();
545 // This channel might be lost (and even if it isn't right now, it might 545 // This channel might be lost (and even if it isn't right now, it might
546 // still get marked as lost from the IO thread, at any point in time really). 546 // still get marked as lost from the IO thread, at any point in time really).
547 // But from here on just try and always lead to either 547 // But from here on just try and always lead to either
548 // DidInitializeOutputSurface() or DidFailToInitializeOutputSurface(). 548 // DidInitializeOutputSurface() or DidFailToInitializeOutputSurface().
549 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host(factory->GetGpuChannel()); 549 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host(factory->GetGpuChannel());
550 550
551 GURL url("chrome://gpu/CompositorImpl::CreateOutputSurface"); 551 GURL url("chrome://gpu/CompositorImpl::CreateOutputSurface");
552 gpu::SurfaceHandle surface_handle = 552 gpu::SurfaceHandle surface_handle =
553 GpuSurfaceTracker::Get()->GetSurfaceHandle(surface_id_); 553 GpuSurfaceTracker::Get()->GetSurfaceHandle(surface_id_);
554 constexpr bool share_resources = false;
555 constexpr bool automatic_flushes = false; 554 constexpr bool automatic_flushes = false;
556 555
557 constexpr size_t kBytesPerPixel = 4; 556 constexpr size_t kBytesPerPixel = 4;
558 const size_t full_screen_texture_size_in_bytes = 557 const size_t full_screen_texture_size_in_bytes =
559 gfx::DeviceDisplayInfo().GetDisplayHeight() * 558 gfx::DeviceDisplayInfo().GetDisplayHeight() *
560 gfx::DeviceDisplayInfo().GetDisplayWidth() * kBytesPerPixel; 559 gfx::DeviceDisplayInfo().GetDisplayWidth() * kBytesPerPixel;
561 560
562 gpu::SharedMemoryLimits limits; 561 gpu::SharedMemoryLimits limits;
563 // This limit is meant to hold the contents of the display compositor 562 // This limit is meant to hold the contents of the display compositor
564 // drawing the scene. See discussion here: 563 // drawing the scene. See discussion here:
565 // https://codereview.chromium.org/1900993002/diff/90001/content/browser/rende rer_host/compositor_impl_android.cc?context=3&column_width=80&tab_spaces=8 564 // https://codereview.chromium.org/1900993002/diff/90001/content/browser/rende rer_host/compositor_impl_android.cc?context=3&column_width=80&tab_spaces=8
566 limits.command_buffer_size = 64 * 1024; 565 limits.command_buffer_size = 64 * 1024;
567 // These limits are meant to hold the uploads for the browser UI without 566 // These limits are meant to hold the uploads for the browser UI without
568 // any excess space. 567 // any excess space.
569 limits.start_transfer_buffer_size = 64 * 1024; 568 limits.start_transfer_buffer_size = 64 * 1024;
570 limits.min_transfer_buffer_size = 64 * 1024; 569 limits.min_transfer_buffer_size = 64 * 1024;
571 limits.max_transfer_buffer_size = full_screen_texture_size_in_bytes; 570 limits.max_transfer_buffer_size = full_screen_texture_size_in_bytes;
572 // Texture uploads may use mapped memory so give a reasonable limit for them. 571 // Texture uploads may use mapped memory so give a reasonable limit for them.
573 limits.mapped_memory_reclaim_limit = full_screen_texture_size_in_bytes; 572 limits.mapped_memory_reclaim_limit = full_screen_texture_size_in_bytes;
574 573
575 scoped_refptr<ContextProviderCommandBuffer> context_provider( 574 scoped_refptr<ContextProviderCommandBuffer> context_provider(
576 new ContextProviderCommandBuffer( 575 new ContextProviderCommandBuffer(
577 base::WrapUnique(new WebGraphicsContext3DCommandBufferImpl( 576 base::WrapUnique(new WebGraphicsContext3DCommandBufferImpl(
578 surface_handle, url, gpu_channel_host.get(), attributes, 577 surface_handle, url, gpu_channel_host.get(), attributes,
579 gfx::PreferIntegratedGpu, share_resources, automatic_flushes, 578 gfx::PreferIntegratedGpu, automatic_flushes)),
580 nullptr)), 579 limits, nullptr, DISPLAY_COMPOSITOR_ONSCREEN_CONTEXT));
581 limits, DISPLAY_COMPOSITOR_ONSCREEN_CONTEXT));
582 DCHECK(context_provider.get()); 580 DCHECK(context_provider.get());
583 581
584 std::unique_ptr<cc::OutputSurface> real_output_surface( 582 std::unique_ptr<cc::OutputSurface> real_output_surface(
585 new OutputSurfaceWithoutParent( 583 new OutputSurfaceWithoutParent(
586 this, context_provider, 584 this, context_provider,
587 base::Bind(&CompositorImpl::PopulateGpuCapabilities, 585 base::Bind(&CompositorImpl::PopulateGpuCapabilities,
588 base::Unretained(this)), 586 base::Unretained(this)),
589 base::WrapUnique(new ExternalBeginFrameSource(this)))); 587 base::WrapUnique(new ExternalBeginFrameSource(this))));
590 588
591 cc::SurfaceManager* manager = GetSurfaceManager(); 589 cc::SurfaceManager* manager = GetSurfaceManager();
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 void CompositorImpl::SetNeedsAnimate() { 682 void CompositorImpl::SetNeedsAnimate() {
685 needs_animate_ = true; 683 needs_animate_ = true;
686 if (!host_->visible()) 684 if (!host_->visible())
687 return; 685 return;
688 686
689 TRACE_EVENT0("compositor", "Compositor::SetNeedsAnimate"); 687 TRACE_EVENT0("compositor", "Compositor::SetNeedsAnimate");
690 host_->SetNeedsAnimate(); 688 host_->SetNeedsAnimate();
691 } 689 }
692 690
693 } // namespace content 691 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698