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

Side by Side Diff: content/renderer/gpu/mailbox_output_surface.cc

Issue 1427543002: Modified old wait sync point functions to also accept new sync tokens. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix mock gpu video accelerator factory 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
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/renderer/gpu/mailbox_output_surface.h" 5 #include "content/renderer/gpu/mailbox_output_surface.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "cc/output/compositor_frame.h" 8 #include "cc/output/compositor_frame.h"
9 #include "cc/output/compositor_frame_ack.h" 9 #include "cc/output/compositor_frame_ack.h"
10 #include "cc/output/gl_frame_data.h" 10 #include "cc/output/gl_frame_data.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 is_backbuffer_discarded_ = false; 61 is_backbuffer_discarded_ = false;
62 62
63 GLES2Interface* gl = context_provider_->ContextGL(); 63 GLES2Interface* gl = context_provider_->ContextGL();
64 64
65 if (!current_backing_.texture_id) { 65 if (!current_backing_.texture_id) {
66 // Find a texture of matching size to recycle. 66 // Find a texture of matching size to recycle.
67 while (!returned_textures_.empty()) { 67 while (!returned_textures_.empty()) {
68 TransferableFrame& texture = returned_textures_.front(); 68 TransferableFrame& texture = returned_textures_.front();
69 if (texture.size == surface_size_) { 69 if (texture.size == surface_size_) {
70 current_backing_ = texture; 70 current_backing_ = texture;
71 if (current_backing_.sync_point) 71 if (current_backing_.sync_point ||
72 gl->WaitSyncPointCHROMIUM(current_backing_.sync_point); 72 current_backing_.sync_token.HasData()) {
73 gl->WaitSyncPointCHROMIUM(current_backing_.sync_point,
74 current_backing_.sync_token.GetConstData());
75 }
73 returned_textures_.pop(); 76 returned_textures_.pop();
74 break; 77 break;
75 } 78 }
76 79
77 gl->DeleteTextures(1, &texture.texture_id); 80 gl->DeleteTextures(1, &texture.texture_id);
78 returned_textures_.pop(); 81 returned_textures_.pop();
79 } 82 }
80 83
81 if (!current_backing_.texture_id) { 84 if (!current_backing_.texture_id) {
82 gl->GenTextures(1, &current_backing_.texture_id); 85 gl->GenTextures(1, &current_backing_.texture_id);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 DCHECK(!it->mailbox.IsZero()); 170 DCHECK(!it->mailbox.IsZero());
168 if (!memcmp(it->mailbox.name, 171 if (!memcmp(it->mailbox.name,
169 ack.gl_frame_data->mailbox.name, 172 ack.gl_frame_data->mailbox.name,
170 sizeof(it->mailbox.name))) { 173 sizeof(it->mailbox.name))) {
171 DCHECK(it->size == ack.gl_frame_data->size); 174 DCHECK(it->size == ack.gl_frame_data->size);
172 break; 175 break;
173 } 176 }
174 } 177 }
175 DCHECK(it != pending_textures_.end()); 178 DCHECK(it != pending_textures_.end());
176 it->sync_point = ack.gl_frame_data->sync_point; 179 it->sync_point = ack.gl_frame_data->sync_point;
180 it->sync_token = ack.gl_frame_data->sync_token;
177 181
178 if (!is_backbuffer_discarded_) { 182 if (!is_backbuffer_discarded_) {
179 returned_textures_.push(*it); 183 returned_textures_.push(*it);
180 } else { 184 } else {
181 context_provider_->ContextGL()->DeleteTextures(1, &it->texture_id); 185 context_provider_->ContextGL()->DeleteTextures(1, &it->texture_id);
182 } 186 }
183 187
184 pending_textures_.erase(it); 188 pending_textures_.erase(it);
185 } else { 189 } else {
186 DCHECK(!pending_textures_.empty()); 190 DCHECK(!pending_textures_.empty());
(...skipping 25 matching lines...) Expand all
212 216
213 pending_textures_.push_back(current_backing_); 217 pending_textures_.push_back(current_backing_);
214 current_backing_ = TransferableFrame(); 218 current_backing_ = TransferableFrame();
215 } 219 }
216 220
217 size_t MailboxOutputSurface::GetNumAcksPending() { 221 size_t MailboxOutputSurface::GetNumAcksPending() {
218 DCHECK(pending_textures_.size()); 222 DCHECK(pending_textures_.size());
219 return pending_textures_.size() - 1; 223 return pending_textures_.size() - 1;
220 } 224 }
221 225
226 MailboxOutputSurface::TransferableFrame::TransferableFrame()
227 : texture_id(0), sync_point(0) {}
228
229 MailboxOutputSurface::TransferableFrame::TransferableFrame(
230 uint32 texture_id,
231 const gpu::Mailbox& mailbox,
232 const gfx::Size size)
233 : texture_id(texture_id), mailbox(mailbox), size(size), sync_point(0) {}
234
222 } // namespace content 235 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698