OLD | NEW |
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/common/gpu/texture_image_transport_surface.h" | 5 #include "content/common/gpu/texture_image_transport_surface.h" |
6 | 6 |
7 #include "content/common/gpu/gpu_channel.h" | 7 #include "content/common/gpu/gpu_channel.h" |
8 #include "content/common/gpu/gpu_channel_manager.h" | 8 #include "content/common/gpu/gpu_channel_manager.h" |
9 #include "content/common/gpu/gpu_messages.h" | 9 #include "content/common/gpu/gpu_messages.h" |
10 #include "gpu/command_buffer/service/context_group.h" | 10 #include "gpu/command_buffer/service/context_group.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 void TextureImageTransportSurface::SetBufferAllocation( | 150 void TextureImageTransportSurface::SetBufferAllocation( |
151 BufferAllocationState state) { | 151 BufferAllocationState state) { |
152 if (!helper_->MakeCurrent()) | 152 if (!helper_->MakeCurrent()) |
153 return; | 153 return; |
154 switch (state) { | 154 switch (state) { |
155 case BUFFER_ALLOCATION_FRONT_AND_BACK: | 155 case BUFFER_ALLOCATION_FRONT_AND_BACK: |
156 CreateBackTexture(textures_[back()].size); | 156 CreateBackTexture(textures_[back()].size); |
157 break; | 157 break; |
158 case BUFFER_ALLOCATION_FRONT_ONLY: | 158 case BUFFER_ALLOCATION_FRONT_ONLY: |
159 case BUFFER_ALLOCATION_NONE: | 159 case BUFFER_ALLOCATION_NONE: |
160 // TODO(piman): Re-enable this (or something else) when we fix the | 160 ReleaseBackTexture(); |
161 // renderer so it doesn't try to draw/swap on deleted back buffers. | |
162 // ReleaseBackTexture(); | |
163 break; | 161 break; |
164 }; | 162 }; |
165 } | 163 } |
166 | 164 |
167 void* TextureImageTransportSurface::GetShareHandle() { | 165 void* TextureImageTransportSurface::GetShareHandle() { |
168 return GetHandle(); | 166 return GetHandle(); |
169 } | 167 } |
170 | 168 |
171 void* TextureImageTransportSurface::GetDisplay() { | 169 void* TextureImageTransportSurface::GetDisplay() { |
172 return parent_stub_.get() ? parent_stub_->surface()->GetDisplay() : NULL; | 170 return parent_stub_.get() ? parent_stub_->surface()->GetDisplay() : NULL; |
(...skipping 15 matching lines...) Expand all Loading... |
188 | 186 |
189 stub->RemoveDestructionObserver(this); | 187 stub->RemoveDestructionObserver(this); |
190 stub_destroyed_ = true; | 188 stub_destroyed_ = true; |
191 } | 189 } |
192 | 190 |
193 bool TextureImageTransportSurface::SwapBuffers() { | 191 bool TextureImageTransportSurface::SwapBuffers() { |
194 glFlush(); | 192 glFlush(); |
195 front_ = back(); | 193 front_ = back(); |
196 previous_damage_rect_ = gfx::Rect(textures_[front_].size); | 194 previous_damage_rect_ = gfx::Rect(textures_[front_].size); |
197 | 195 |
| 196 DCHECK(textures_[front_].client_id != 0); |
| 197 |
198 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; | 198 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; |
199 params.surface_handle = textures_[front_].client_id; | 199 params.surface_handle = textures_[front_].client_id; |
200 helper_->SendAcceleratedSurfaceBuffersSwapped(params); | 200 helper_->SendAcceleratedSurfaceBuffersSwapped(params); |
201 helper_->SetScheduled(false); | 201 helper_->SetScheduled(false); |
202 return true; | 202 return true; |
203 } | 203 } |
204 | 204 |
205 bool TextureImageTransportSurface::PostSubBuffer( | 205 bool TextureImageTransportSurface::PostSubBuffer( |
206 int x, int y, int width, int height) { | 206 int x, int y, int width, int height) { |
207 if (!parent_stub_.get()) | 207 if (!parent_stub_.get()) |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 #endif | 406 #endif |
407 } | 407 } |
408 | 408 |
409 TextureInfo* TextureImageTransportSurface::GetParentInfo(uint32 client_id) { | 409 TextureInfo* TextureImageTransportSurface::GetParentInfo(uint32 client_id) { |
410 DCHECK(parent_stub_.get()); | 410 DCHECK(parent_stub_.get()); |
411 TextureManager* texture_manager = | 411 TextureManager* texture_manager = |
412 parent_stub_->decoder()->GetContextGroup()->texture_manager(); | 412 parent_stub_->decoder()->GetContextGroup()->texture_manager(); |
413 TextureInfo* info = texture_manager->GetTextureInfo(client_id); | 413 TextureInfo* info = texture_manager->GetTextureInfo(client_id); |
414 return info; | 414 return info; |
415 } | 415 } |
OLD | NEW |