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

Side by Side Diff: content/browser/compositor/buffer_queue.cc

Issue 1091323002: Send a message through the ozone channel to recreate buffers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 "content/browser/compositor/buffer_queue.h" 5 #include "content/browser/compositor/buffer_queue.h"
6 6
7 #include "content/browser/compositor/image_transport_factory.h" 7 #include "content/browser/compositor/image_transport_factory.h"
8 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" 8 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h"
9 #include "content/common/gpu/client/context_provider_command_buffer.h" 9 #include "content/common/gpu/client/context_provider_command_buffer.h"
10 #include "content/common/gpu/client/gl_helper.h" 10 #include "content/common/gpu/client/gl_helper.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 113
114 // TODO: add stencil buffer when needed. 114 // TODO: add stencil buffer when needed.
115 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL(); 115 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL();
116 gl->BindFramebuffer(GL_FRAMEBUFFER, fbo_); 116 gl->BindFramebuffer(GL_FRAMEBUFFER, fbo_);
117 gl->FramebufferTexture2D( 117 gl->FramebufferTexture2D(
118 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0); 118 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0);
119 119
120 FreeAllSurfaces(); 120 FreeAllSurfaces();
121 } 121 }
122 122
123 void BufferQueue::RecreateBuffers() {
124 AllocatedSurface previous = in_flight_surfaces_.back();
125 in_flight_surfaces_.pop_back();
126 FreeAllSurfaces();
127 FreeSurface(&current_surface_);
128
129 AllocatedSurface first_buffer = GetNextSurface();
130 CopyBufferDamage(first_buffer.texture, previous.texture, gfx::Rect(),
131 gfx::Rect(size_));
132 in_flight_surfaces_.push_back(first_buffer);
133
134 AllocatedSurface second_buffer = GetNextSurface();
135 CopyBufferDamage(second_buffer.texture, previous.texture, gfx::Rect(),
136 gfx::Rect(size_));
137 available_surfaces_.push_back(second_buffer);
138
139 BindFramebuffer();
140 FreeSurface(&previous);
141 }
142
123 void BufferQueue::PageFlipComplete() { 143 void BufferQueue::PageFlipComplete() {
124 if (in_flight_surfaces_.size() > 1) { 144 if (in_flight_surfaces_.size() > 1) {
125 available_surfaces_.push_back(in_flight_surfaces_.front()); 145 available_surfaces_.push_back(in_flight_surfaces_.front());
126 in_flight_surfaces_.pop_front(); 146 in_flight_surfaces_.pop_front();
127 } 147 }
128 } 148 }
129 149
130 void BufferQueue::FreeAllSurfaces() { 150 void BufferQueue::FreeAllSurfaces() {
131 FreeSurface(&current_surface_); 151 FreeSurface(&current_surface_);
132 while (!in_flight_surfaces_.empty()) { 152 while (!in_flight_surfaces_.empty()) {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 gl->DeleteTextures(1, &texture); 206 gl->DeleteTextures(1, &texture);
187 return AllocatedSurface(); 207 return AllocatedSurface();
188 } 208 }
189 allocated_count_++; 209 allocated_count_++;
190 gl->BindTexture(GL_TEXTURE_2D, texture); 210 gl->BindTexture(GL_TEXTURE_2D, texture);
191 gl->BindTexImage2DCHROMIUM(GL_TEXTURE_2D, id); 211 gl->BindTexImage2DCHROMIUM(GL_TEXTURE_2D, id);
192 return AllocatedSurface(texture, id, gfx::Rect(size_)); 212 return AllocatedSurface(texture, id, gfx::Rect(size_));
193 } 213 }
194 214
195 } // namespace content 215 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698