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

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

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