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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.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: updating with recent changes 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
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 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 virtual bool ResizeOffscreenFrameBuffer(const gfx::Size& size); 470 virtual bool ResizeOffscreenFrameBuffer(const gfx::Size& size);
471 void UpdateParentTextureInfo(); 471 void UpdateParentTextureInfo();
472 virtual bool MakeCurrent(); 472 virtual bool MakeCurrent();
473 virtual GLES2Util* GetGLES2Util() { return &util_; } 473 virtual GLES2Util* GetGLES2Util() { return &util_; }
474 virtual gfx::GLContext* GetGLContext() { return context_.get(); } 474 virtual gfx::GLContext* GetGLContext() { return context_.get(); }
475 virtual gfx::GLSurface* GetGLSurface() { return surface_.get(); } 475 virtual gfx::GLSurface* GetGLSurface() { return surface_.get(); }
476 virtual ContextGroup* GetContextGroup() { return group_.get(); } 476 virtual ContextGroup* GetContextGroup() { return group_.get(); }
477 477
478 virtual void SetResizeCallback(Callback1<gfx::Size>::Type* callback); 478 virtual void SetResizeCallback(Callback1<gfx::Size>::Type* callback);
479 479
480 virtual void SetSurfaceVisibleCallback(Callback1<bool>::Type* callback);
481
480 #if defined(OS_MACOSX) 482 #if defined(OS_MACOSX)
481 virtual void SetSwapBuffersCallback(Callback0::Type* callback); 483 virtual void SetSwapBuffersCallback(Callback0::Type* callback);
482 #endif 484 #endif
483 485
484 virtual bool GetServiceTextureId(uint32 client_texture_id, 486 virtual bool GetServiceTextureId(uint32 client_texture_id,
485 uint32* service_texture_id); 487 uint32* service_texture_id);
486 488
487 // Restores the current state to the user's settings. 489 // Restores the current state to the user's settings.
488 void RestoreCurrentFramebufferBindings(); 490 void RestoreCurrentFramebufferBindings();
489 void RestoreCurrentRenderbufferBindings(); 491 void RestoreCurrentRenderbufferBindings();
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after
1277 scoped_ptr<FrameBuffer> offscreen_saved_frame_buffer_; 1279 scoped_ptr<FrameBuffer> offscreen_saved_frame_buffer_;
1278 scoped_ptr<Texture> offscreen_saved_color_texture_; 1280 scoped_ptr<Texture> offscreen_saved_color_texture_;
1279 1281
1280 // The copy that is used as the destination for multi-sample resolves. 1282 // The copy that is used as the destination for multi-sample resolves.
1281 scoped_ptr<FrameBuffer> offscreen_resolved_frame_buffer_; 1283 scoped_ptr<FrameBuffer> offscreen_resolved_frame_buffer_;
1282 scoped_ptr<Texture> offscreen_resolved_color_texture_; 1284 scoped_ptr<Texture> offscreen_resolved_color_texture_;
1283 GLenum offscreen_saved_color_format_; 1285 GLenum offscreen_saved_color_format_;
1284 1286
1285 scoped_ptr<Callback1<gfx::Size>::Type> resize_callback_; 1287 scoped_ptr<Callback1<gfx::Size>::Type> resize_callback_;
1286 1288
1289 scoped_ptr<Callback1<bool>::Type> surface_visible_callback_;
1290
1287 #if defined(OS_MACOSX) 1291 #if defined(OS_MACOSX)
1288 scoped_ptr<Callback0::Type> swap_buffers_callback_; 1292 scoped_ptr<Callback0::Type> swap_buffers_callback_;
1289 #endif 1293 #endif
1290 1294
1291 // The format of the back buffer_ 1295 // The format of the back buffer_
1292 GLenum back_buffer_color_format_; 1296 GLenum back_buffer_color_format_;
1293 bool back_buffer_has_depth_; 1297 bool back_buffer_has_depth_;
1294 bool back_buffer_has_stencil_; 1298 bool back_buffer_has_stencil_;
1295 1299
1296 bool teximage2d_faster_than_texsubimage2d_; 1300 bool teximage2d_faster_than_texsubimage2d_;
(...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after
2288 GL_TEXTURE_WRAP_T, 2292 GL_TEXTURE_WRAP_T,
2289 GL_CLAMP_TO_EDGE); 2293 GL_CLAMP_TO_EDGE);
2290 } 2294 }
2291 } 2295 }
2292 2296
2293 void GLES2DecoderImpl::SetResizeCallback( 2297 void GLES2DecoderImpl::SetResizeCallback(
2294 Callback1<gfx::Size>::Type* callback) { 2298 Callback1<gfx::Size>::Type* callback) {
2295 resize_callback_.reset(callback); 2299 resize_callback_.reset(callback);
2296 } 2300 }
2297 2301
2302 void GLES2DecoderImpl::SetSurfaceVisibleCallback(
2303 Callback1<bool>::Type* callback) {
2304 surface_visible_callback_.reset(callback);
2305 }
2306
2298 #if defined(OS_MACOSX) 2307 #if defined(OS_MACOSX)
2299 void GLES2DecoderImpl::SetSwapBuffersCallback(Callback0::Type* callback) { 2308 void GLES2DecoderImpl::SetSwapBuffersCallback(Callback0::Type* callback) {
2300 swap_buffers_callback_.reset(callback); 2309 swap_buffers_callback_.reset(callback);
2301 } 2310 }
2302 #endif 2311 #endif
2303 2312
2304 bool GLES2DecoderImpl::GetServiceTextureId(uint32 client_texture_id, 2313 bool GLES2DecoderImpl::GetServiceTextureId(uint32 client_texture_id,
2305 uint32* service_texture_id) { 2314 uint32* service_texture_id) {
2306 TextureManager::TextureInfo* texture = 2315 TextureManager::TextureInfo* texture =
2307 texture_manager()->GetTextureInfo(client_texture_id); 2316 texture_manager()->GetTextureInfo(client_texture_id);
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
2571 if (resize_callback_.get()) { 2580 if (resize_callback_.get()) {
2572 resize_callback_->Run(gfx::Size(width, height)); 2581 resize_callback_->Run(gfx::Size(width, height));
2573 DCHECK(context_->IsCurrent(surface_.get())); 2582 DCHECK(context_->IsCurrent(surface_.get()));
2574 if (!context_->IsCurrent(surface_.get())) 2583 if (!context_->IsCurrent(surface_.get()))
2575 return error::kLostContext; 2584 return error::kLostContext;
2576 } 2585 }
2577 2586
2578 return error::kNoError; 2587 return error::kNoError;
2579 } 2588 }
2580 2589
2590 error::Error GLES2DecoderImpl::HandleSetSurfaceVisibleCHROMIUM(
2591 uint32 immediate_data_size, const gles2::SetSurfaceVisibleCHROMIUM& c) {
2592 bool visible = !!static_cast<GLboolean>(c.visible);
2593 TRACE_EVENT1("gpu", "glSetSurfaceVisibleChromium", "visible", visible);
2594
2595 if (surface_visible_callback_.get()) {
2596 surface_visible_callback_->Run(visible);
2597 } else {
2598 printf("[ . ] No callback (no image xport surface?)!\n\n");
2599 fflush(stdout);
2600 }
2601
2602 return error::kNoError;
2603 }
2604
2581 const char* GLES2DecoderImpl::GetCommandName(unsigned int command_id) const { 2605 const char* GLES2DecoderImpl::GetCommandName(unsigned int command_id) const {
2582 if (command_id > kStartPoint && command_id < kNumCommands) { 2606 if (command_id > kStartPoint && command_id < kNumCommands) {
2583 return gles2::GetCommandName(static_cast<CommandId>(command_id)); 2607 return gles2::GetCommandName(static_cast<CommandId>(command_id));
2584 } 2608 }
2585 return GetCommonCommandName(static_cast<cmd::CommandId>(command_id)); 2609 return GetCommonCommandName(static_cast<cmd::CommandId>(command_id));
2586 } 2610 }
2587 2611
2588 // Decode command with its arguments, and call the corresponding GL function. 2612 // Decode command with its arguments, and call the corresponding GL function.
2589 // Note: args is a pointer to the command buffer. As such, it could be changed 2613 // Note: args is a pointer to the command buffer. As such, it could be changed
2590 // by a (malicious) client at any time, so if validation has to happen, it 2614 // by a (malicious) client at any time, so if validation has to happen, it
(...skipping 4294 matching lines...) Expand 10 before | Expand all | Expand 10 after
6885 return false; 6909 return false;
6886 } 6910 }
6887 6911
6888 // Include the auto-generated part of this file. We split this because it means 6912 // Include the auto-generated part of this file. We split this because it means
6889 // we can easily edit the non-auto generated parts right here in this file 6913 // we can easily edit the non-auto generated parts right here in this file
6890 // instead of having to edit some template or the code generator. 6914 // instead of having to edit some template or the code generator.
6891 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 6915 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
6892 6916
6893 } // namespace gles2 6917 } // namespace gles2
6894 } // namespace gpu 6918 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698