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

Side by Side Diff: content/common/gpu/image_transport_surface_linux.cc

Issue 7890046: Command to mark surface inactive, so gpu process can release resources. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: final rebase and added comments Created 9 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 | Annotate | Revision Log
« no previous file with comments | « content/common/gpu/gpu_messages.h ('k') | content/renderer/gpu/command_buffer_proxy.h » ('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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #if defined(ENABLE_GPU) 5 #if defined(ENABLE_GPU)
6 6
7 #include "content/common/gpu/image_transport_surface.h" 7 #include "content/common/gpu/image_transport_surface.h"
8 8
9 // This conflicts with the defines in Xlib.h and must come first. 9 // This conflicts with the defines in Xlib.h and must come first.
10 #include "content/common/gpu/gpu_messages.h" 10 #include "content/common/gpu/gpu_messages.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 int32 command_buffer_id); 62 int32 command_buffer_id);
63 63
64 // GLSurface implementation 64 // GLSurface implementation
65 virtual bool Initialize() OVERRIDE; 65 virtual bool Initialize() OVERRIDE;
66 virtual void Destroy() OVERRIDE; 66 virtual void Destroy() OVERRIDE;
67 virtual bool IsOffscreen() OVERRIDE; 67 virtual bool IsOffscreen() OVERRIDE;
68 virtual bool SwapBuffers() OVERRIDE; 68 virtual bool SwapBuffers() OVERRIDE;
69 virtual gfx::Size GetSize() OVERRIDE; 69 virtual gfx::Size GetSize() OVERRIDE;
70 virtual void OnMakeCurrent(gfx::GLContext* context) OVERRIDE; 70 virtual void OnMakeCurrent(gfx::GLContext* context) OVERRIDE;
71 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; 71 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE;
72 virtual void SetVisible(bool visible) OVERRIDE;
72 73
73 protected: 74 protected:
74 // ImageTransportSurface implementation 75 // ImageTransportSurface implementation
75 virtual void OnNewSurfaceACK( 76 virtual void OnNewSurfaceACK(
76 uint64 surface_id, TransportDIB::Handle surface_handle) OVERRIDE; 77 uint64 surface_id, TransportDIB::Handle surface_handle) OVERRIDE;
77 virtual void OnBuffersSwappedACK() OVERRIDE; 78 virtual void OnBuffersSwappedACK() OVERRIDE;
78 virtual void OnResize(gfx::Size size) OVERRIDE; 79 virtual void OnResize(gfx::Size size) OVERRIDE;
79 80
80 private: 81 private:
81 virtual ~EGLImageTransportSurface() OVERRIDE; 82 virtual ~EGLImageTransportSurface() OVERRIDE;
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); 264 GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER);
264 if (status != GL_FRAMEBUFFER_COMPLETE) { 265 if (status != GL_FRAMEBUFFER_COMPLETE) {
265 LOG(ERROR) << "Framebuffer incomplete."; 266 LOG(ERROR) << "Framebuffer incomplete.";
266 } 267 }
267 } 268 }
268 269
269 unsigned int EGLImageTransportSurface::GetBackingFrameBufferObject() { 270 unsigned int EGLImageTransportSurface::GetBackingFrameBufferObject() {
270 return fbo_id_; 271 return fbo_id_;
271 } 272 }
272 273
274 void EGLImageTransportSurface::SetVisible(bool visible) {
275 if (!visible && back_surface_.get() && front_surface_.get()) {
276 ReleaseSurface(&back_surface_);
277 } else if (visible && !back_surface_.get() && front_surface_.get()) {
278 // Leverage the OnResize hook because it does exactly what we want
279 OnResize(front_surface_->size());
280 }
281 }
282
273 void EGLImageTransportSurface::ReleaseSurface( 283 void EGLImageTransportSurface::ReleaseSurface(
274 scoped_refptr<EGLAcceleratedSurface>* surface) { 284 scoped_refptr<EGLAcceleratedSurface>* surface) {
275 if (surface->get()) { 285 if (surface->get()) {
276 GpuHostMsg_AcceleratedSurfaceRelease_Params params; 286 GpuHostMsg_AcceleratedSurfaceRelease_Params params;
277 params.identifier = (*surface)->pixmap(); 287 params.identifier = (*surface)->pixmap();
278 helper_->SendAcceleratedSurfaceRelease(params); 288 helper_->SendAcceleratedSurfaceRelease(params);
279 *surface = NULL; 289 *surface = NULL;
280 } 290 }
281 } 291 }
282 292
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 NOTREACHED(); 629 NOTREACHED();
620 return NULL; 630 return NULL;
621 } 631 }
622 if (surface->Initialize()) 632 if (surface->Initialize())
623 return surface; 633 return surface;
624 else 634 else
625 return NULL; 635 return NULL;
626 } 636 }
627 637
628 #endif // defined(USE_GPU) 638 #endif // defined(USE_GPU)
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_messages.h ('k') | content/renderer/gpu/command_buffer_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698