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

Side by Side Diff: components/mus/gles2/command_buffer_local.cc

Issue 1401423003: Re-land: ui: Move GLImage::BindTexImage fallback from GLImage implementations to GLES2CmdDecoder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix stream texture issue Created 5 years, 1 month 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
« no previous file with comments | « no previous file | content/common/gpu/media/android_deferred_rendering_backing_strategy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/mus/gles2/command_buffer_local.h" 5 #include "components/mus/gles2/command_buffer_local.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/shared_memory.h"
8 #include "components/mus/gles2/command_buffer_local_client.h" 9 #include "components/mus/gles2/command_buffer_local_client.h"
9 #include "components/mus/gles2/gpu_memory_tracker.h" 10 #include "components/mus/gles2/gpu_memory_tracker.h"
10 #include "components/mus/gles2/mojo_gpu_memory_buffer.h" 11 #include "components/mus/gles2/mojo_gpu_memory_buffer.h"
11 #include "gpu/command_buffer/service/command_buffer_service.h" 12 #include "gpu/command_buffer/service/command_buffer_service.h"
12 #include "gpu/command_buffer/service/context_group.h" 13 #include "gpu/command_buffer/service/context_group.h"
13 #include "gpu/command_buffer/service/gpu_scheduler.h" 14 #include "gpu/command_buffer/service/gpu_scheduler.h"
14 #include "gpu/command_buffer/service/image_factory.h" 15 #include "gpu/command_buffer/service/image_factory.h"
15 #include "gpu/command_buffer/service/image_manager.h" 16 #include "gpu/command_buffer/service/image_manager.h"
16 #include "gpu/command_buffer/service/memory_tracking.h" 17 #include "gpu/command_buffer/service/memory_tracking.h"
17 #include "gpu/command_buffer/service/shader_translator_cache.h" 18 #include "gpu/command_buffer/service/shader_translator_cache.h"
18 #include "gpu/command_buffer/service/transfer_buffer_manager.h" 19 #include "gpu/command_buffer/service/transfer_buffer_manager.h"
19 #include "gpu/command_buffer/service/valuebuffer_manager.h" 20 #include "gpu/command_buffer/service/valuebuffer_manager.h"
20 #include "ui/gfx/vsync_provider.h" 21 #include "ui/gfx/vsync_provider.h"
21 #include "ui/gl/gl_context.h" 22 #include "ui/gl/gl_context.h"
22 #include "ui/gl/gl_image_memory.h" 23 #include "ui/gl/gl_image_shared_memory.h"
23 #include "ui/gl/gl_surface.h" 24 #include "ui/gl/gl_surface.h"
24 25
25 namespace mus { 26 namespace mus {
26 27
27 const unsigned int GL_MAP_CHROMIUM = 0x78F1; 28 const unsigned int GL_MAP_CHROMIUM = 0x78F1;
28 29
29 CommandBufferLocal::CommandBufferLocal(CommandBufferLocalClient* client, 30 CommandBufferLocal::CommandBufferLocal(CommandBufferLocalClient* client,
30 gfx::AcceleratedWidget widget, 31 gfx::AcceleratedWidget widget,
31 const scoped_refptr<GpuState>& gpu_state) 32 const scoped_refptr<GpuState>& gpu_state)
32 : widget_(widget), 33 : widget_(widget),
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 return decoder_->GetCapabilities(); 129 return decoder_->GetCapabilities();
129 } 130 }
130 131
131 int32_t CommandBufferLocal::CreateImage(ClientBuffer buffer, 132 int32_t CommandBufferLocal::CreateImage(ClientBuffer buffer,
132 size_t width, 133 size_t width,
133 size_t height, 134 size_t height,
134 unsigned internalformat) { 135 unsigned internalformat) {
135 MojoGpuMemoryBufferImpl* gpu_memory_buffer = 136 MojoGpuMemoryBufferImpl* gpu_memory_buffer =
136 MojoGpuMemoryBufferImpl::FromClientBuffer(buffer); 137 MojoGpuMemoryBufferImpl::FromClientBuffer(buffer);
137 138
138 scoped_refptr<gfx::GLImageMemory> image(new gfx::GLImageMemory( 139 gfx::GpuMemoryBufferHandle handle = gpu_memory_buffer->GetHandle();
140 scoped_refptr<gfx::GLImageSharedMemory> image(new gfx::GLImageSharedMemory(
139 gfx::Size(static_cast<int>(width), static_cast<int>(height)), 141 gfx::Size(static_cast<int>(width), static_cast<int>(height)),
140 internalformat)); 142 internalformat));
141 if (!image->Initialize( 143 if (!image->Initialize(base::SharedMemory::DuplicateHandle(handle.handle),
142 static_cast<const unsigned char*>(gpu_memory_buffer->GetMemory()), 144 handle.id, gpu_memory_buffer->GetFormat())) {
143 gpu_memory_buffer->GetFormat())) {
144 return -1; 145 return -1;
145 } 146 }
146 147
147 static int32 next_id = 1; 148 static int32 next_id = 1;
148 int32 new_id = next_id++; 149 int32 new_id = next_id++;
149 150
150 gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager(); 151 gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager();
151 DCHECK(image_manager); 152 DCHECK(image_manager);
152 image_manager->AddImage(image.get(), new_id); 153 image_manager->AddImage(image.get(), new_id);
153 return new_id; 154 return new_id;
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 void CommandBufferLocal::OnContextLost(uint32_t reason) { 328 void CommandBufferLocal::OnContextLost(uint32_t reason) {
328 if (client_) 329 if (client_)
329 client_->DidLoseContext(); 330 client_->DidLoseContext();
330 } 331 }
331 332
332 void CommandBufferLocal::OnSyncPointRetired() { 333 void CommandBufferLocal::OnSyncPointRetired() {
333 scheduler_->SetScheduled(true); 334 scheduler_->SetScheduled(true);
334 } 335 }
335 336
336 } // namespace mus 337 } // namespace mus
OLDNEW
« no previous file with comments | « no previous file | content/common/gpu/media/android_deferred_rendering_backing_strategy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698