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

Side by Side Diff: gpu/command_buffer/service/mailbox_manager_sync.cc

Issue 951673002: Revert "Pull chromium at 2c3ffb2355a27c32f45e508ef861416b820c823b" (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "gpu/command_buffer/service/mailbox_manager_sync.h" 5 #include "gpu/command_buffer/service/mailbox_manager_sync.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <queue> 8 #include <queue>
9 9
10 #include "base/memory/linked_ptr.h" 10 #include "base/memory/linked_ptr.h"
11 #include "base/synchronization/lock.h" 11 #include "base/synchronization/lock.h"
12 #include "gpu/command_buffer/service/texture_manager.h" 12 #include "gpu/command_buffer/service/texture_manager.h"
13 #include "ui/gl/gl_fence.h" 13 #include "ui/gl/gl_fence.h"
14 #include "ui/gl/gl_implementation.h" 14 #include "ui/gl/gl_implementation.h"
15 15
16 #if !defined(OS_MACOSX) 16 #if !defined(OS_MACOSX)
17 #include "ui/gl/gl_fence_egl.h" 17 #include "ui/gl/gl_fence_egl.h"
18 #endif 18 #endif
19 19
20 namespace gpu { 20 namespace gpu {
21 namespace gles2 { 21 namespace gles2 {
22 22
23 namespace { 23 namespace {
24 24
25 bool SkipTextureWorkarounds(const Texture* texture) {
26 // TODO(sievers): crbug.com/352274
27 // Should probably only fail if it already *has* mipmaps, while allowing
28 // incomplete textures here.
29 bool needs_mips =
30 texture->min_filter() != GL_NEAREST && texture->min_filter() != GL_LINEAR;
31 if (texture->target() != GL_TEXTURE_2D || needs_mips || !texture->IsDefined())
32 return true;
33
34 return false;
35 }
36
25 base::LazyInstance<base::Lock> g_lock = LAZY_INSTANCE_INITIALIZER; 37 base::LazyInstance<base::Lock> g_lock = LAZY_INSTANCE_INITIALIZER;
26 38
27 typedef std::map<uint32, linked_ptr<gfx::GLFence>> SyncPointToFenceMap; 39 typedef std::map<uint32, linked_ptr<gfx::GLFence>> SyncPointToFenceMap;
28 base::LazyInstance<SyncPointToFenceMap> g_sync_point_to_fence = 40 base::LazyInstance<SyncPointToFenceMap> g_sync_point_to_fence =
29 LAZY_INSTANCE_INITIALIZER; 41 LAZY_INSTANCE_INITIALIZER;
30 #if !defined(OS_MACOSX) 42 #if !defined(OS_MACOSX)
31 base::LazyInstance<std::queue<SyncPointToFenceMap::iterator>> g_sync_points = 43 base::LazyInstance<std::queue<SyncPointToFenceMap::iterator>> g_sync_points =
32 LAZY_INSTANCE_INITIALIZER; 44 LAZY_INSTANCE_INITIALIZER;
33 #endif 45 #endif
34 46
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 MailboxManagerSync::TextureGroupRef::~TextureGroupRef() { 189 MailboxManagerSync::TextureGroupRef::~TextureGroupRef() {
178 } 190 }
179 191
180 MailboxManagerSync::MailboxManagerSync() { 192 MailboxManagerSync::MailboxManagerSync() {
181 } 193 }
182 194
183 MailboxManagerSync::~MailboxManagerSync() { 195 MailboxManagerSync::~MailboxManagerSync() {
184 DCHECK_EQ(0U, texture_to_group_.size()); 196 DCHECK_EQ(0U, texture_to_group_.size());
185 } 197 }
186 198
187 // static
188 bool MailboxManagerSync::SkipTextureWorkarounds(const Texture* texture) {
189 // Cannot support mips due to support mismatch between
190 // EGL_KHR_gl_texture_2D_image and glEGLImageTargetTexture2DOES for
191 // texture levels.
192 bool has_mips = texture->NeedsMips() && texture->texture_complete();
193 return texture->target() != GL_TEXTURE_2D || has_mips;
194 }
195
196 bool MailboxManagerSync::UsesSync() { 199 bool MailboxManagerSync::UsesSync() {
197 return true; 200 return true;
198 } 201 }
199 202
200 Texture* MailboxManagerSync::ConsumeTexture(const Mailbox& mailbox) { 203 Texture* MailboxManagerSync::ConsumeTexture(const Mailbox& mailbox) {
201 base::AutoLock lock(g_lock.Get()); 204 base::AutoLock lock(g_lock.Get());
202 TextureGroup* group = TextureGroup::FromName(mailbox); 205 TextureGroup* group = TextureGroup::FromName(mailbox);
203 if (!group) 206 if (!group)
204 return NULL; 207 return NULL;
205 208
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 287
285 // Make sure we don't clobber with an older version 288 // Make sure we don't clobber with an older version
286 if (!definition.IsOlderThan(group_ref->version)) 289 if (!definition.IsOlderThan(group_ref->version))
287 return; 290 return;
288 291
289 // Also don't push redundant updates. Note that it would break the 292 // Also don't push redundant updates. Note that it would break the
290 // versioning. 293 // versioning.
291 if (definition.Matches(texture)) 294 if (definition.Matches(texture))
292 return; 295 return;
293 296
294 DCHECK_IMPLIES(gl_image, image_buffer.get());
295 if (gl_image && !image_buffer->IsClient(gl_image)) { 297 if (gl_image && !image_buffer->IsClient(gl_image)) {
296 LOG(ERROR) << "MailboxSync: Incompatible attachment"; 298 LOG(ERROR) << "MailboxSync: Incompatible attachment";
297 return; 299 return;
298 } 300 }
299 301
300 group->SetDefinition(TextureDefinition(texture, ++group_ref->version, 302 group->SetDefinition(TextureDefinition(texture, ++group_ref->version,
301 gl_image ? image_buffer : NULL)); 303 gl_image ? image_buffer : NULL));
302 } 304 }
303 305
304 void MailboxManagerSync::PushTextureUpdates(uint32 sync_point) { 306 void MailboxManagerSync::PushTextureUpdates(uint32 sync_point) {
(...skipping 18 matching lines...) Expand all
323 if (texture_version == definition.version() || 325 if (texture_version == definition.version() ||
324 definition.IsOlderThan(texture_version)) 326 definition.IsOlderThan(texture_version))
325 continue; 327 continue;
326 texture_version = definition.version(); 328 texture_version = definition.version();
327 definition.UpdateTexture(texture); 329 definition.UpdateTexture(texture);
328 } 330 }
329 } 331 }
330 332
331 } // namespace gles2 333 } // namespace gles2
332 } // namespace gpu 334 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/mailbox_manager_sync.h ('k') | gpu/command_buffer/service/mailbox_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698