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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 2302393002: Support swap damage rect using eglSwapBuffersWithDamageKHR (Closed)
Patch Set: Add to Capabilities Created 4 years, 3 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 (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 "gpu/command_buffer/service/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 2276 matching lines...) Expand 10 before | Expand all | Expand 10 after
2287 int frame_number_; 2287 int frame_number_;
2288 2288
2289 // Number of commands remaining to be processed in DoCommands(). 2289 // Number of commands remaining to be processed in DoCommands().
2290 int commands_to_process_; 2290 int commands_to_process_;
2291 2291
2292 bool has_robustness_extension_; 2292 bool has_robustness_extension_;
2293 error::ContextLostReason context_lost_reason_; 2293 error::ContextLostReason context_lost_reason_;
2294 bool context_was_lost_; 2294 bool context_was_lost_;
2295 bool reset_by_robustness_extension_; 2295 bool reset_by_robustness_extension_;
2296 bool supports_post_sub_buffer_; 2296 bool supports_post_sub_buffer_;
2297 bool supports_swap_buffers_with_damage_;
2297 bool supports_commit_overlay_planes_; 2298 bool supports_commit_overlay_planes_;
2298 bool supports_async_swap_; 2299 bool supports_async_swap_;
2299 2300
2300 // These flags are used to override the state of the shared feature_info_ 2301 // These flags are used to override the state of the shared feature_info_
2301 // member. Because the same FeatureInfo instance may be shared among many 2302 // member. Because the same FeatureInfo instance may be shared among many
2302 // contexts, the assumptions on the availablity of extensions in WebGL 2303 // contexts, the assumptions on the availablity of extensions in WebGL
2303 // contexts may be broken. These flags override the shared state to preserve 2304 // contexts may be broken. These flags override the shared state to preserve
2304 // WebGL semantics. 2305 // WebGL semantics.
2305 bool derivatives_explicitly_enabled_; 2306 bool derivatives_explicitly_enabled_;
2306 bool frag_depth_explicitly_enabled_; 2307 bool frag_depth_explicitly_enabled_;
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
2971 swaps_since_resize_(0), 2972 swaps_since_resize_(0),
2972 current_decoder_error_(error::kNoError), 2973 current_decoder_error_(error::kNoError),
2973 validators_(group_->feature_info()->validators()), 2974 validators_(group_->feature_info()->validators()),
2974 feature_info_(group_->feature_info()), 2975 feature_info_(group_->feature_info()),
2975 frame_number_(0), 2976 frame_number_(0),
2976 has_robustness_extension_(false), 2977 has_robustness_extension_(false),
2977 context_lost_reason_(error::kUnknown), 2978 context_lost_reason_(error::kUnknown),
2978 context_was_lost_(false), 2979 context_was_lost_(false),
2979 reset_by_robustness_extension_(false), 2980 reset_by_robustness_extension_(false),
2980 supports_post_sub_buffer_(false), 2981 supports_post_sub_buffer_(false),
2982 supports_swap_buffers_with_damage_(false),
2981 supports_commit_overlay_planes_(false), 2983 supports_commit_overlay_planes_(false),
2982 supports_async_swap_(false), 2984 supports_async_swap_(false),
2983 derivatives_explicitly_enabled_(false), 2985 derivatives_explicitly_enabled_(false),
2984 frag_depth_explicitly_enabled_(false), 2986 frag_depth_explicitly_enabled_(false),
2985 draw_buffers_explicitly_enabled_(false), 2987 draw_buffers_explicitly_enabled_(false),
2986 shader_texture_lod_explicitly_enabled_(false), 2988 shader_texture_lod_explicitly_enabled_(false),
2987 compile_shader_always_succeeds_(false), 2989 compile_shader_always_succeeds_(false),
2988 lose_context_when_out_of_memory_(false), 2990 lose_context_when_out_of_memory_(false),
2989 should_use_native_gmb_for_backbuffer_(false), 2991 should_use_native_gmb_for_backbuffer_(false),
2990 service_logging_( 2992 service_logging_(
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
3474 glClearColor(0.0f, 0.0f, 0.0f, 0.0f); 3476 glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
3475 } 3477 }
3476 } 3478 }
3477 3479
3478 supports_post_sub_buffer_ = surface->SupportsPostSubBuffer(); 3480 supports_post_sub_buffer_ = surface->SupportsPostSubBuffer();
3479 if (feature_info_->workarounds() 3481 if (feature_info_->workarounds()
3480 .disable_post_sub_buffers_for_onscreen_surfaces && 3482 .disable_post_sub_buffers_for_onscreen_surfaces &&
3481 !surface->IsOffscreen()) 3483 !surface->IsOffscreen())
3482 supports_post_sub_buffer_ = false; 3484 supports_post_sub_buffer_ = false;
3483 3485
3486 supports_swap_buffers_with_damage_ = surface->SupportsSwapBuffersWithDamage();
3487
3484 supports_commit_overlay_planes_ = surface->SupportsCommitOverlayPlanes(); 3488 supports_commit_overlay_planes_ = surface->SupportsCommitOverlayPlanes();
3485 3489
3486 supports_async_swap_ = surface->SupportsAsyncSwap(); 3490 supports_async_swap_ = surface->SupportsAsyncSwap();
3487 3491
3488 if (feature_info_->workarounds().reverse_point_sprite_coord_origin) { 3492 if (feature_info_->workarounds().reverse_point_sprite_coord_origin) {
3489 glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT); 3493 glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT);
3490 } 3494 }
3491 3495
3492 if (feature_info_->workarounds().unbind_fbo_on_context_switch) { 3496 if (feature_info_->workarounds().unbind_fbo_on_context_switch) {
3493 context_->SetUnbindFboOnMakeCurrent(); 3497 context_->SetUnbindFboOnMakeCurrent();
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
3655 caps.occlusion_query_boolean = 3659 caps.occlusion_query_boolean =
3656 feature_info_->feature_flags().occlusion_query_boolean; 3660 feature_info_->feature_flags().occlusion_query_boolean;
3657 caps.timer_queries = 3661 caps.timer_queries =
3658 query_manager_->GPUTimingAvailable(); 3662 query_manager_->GPUTimingAvailable();
3659 caps.disable_multisampling_color_mask_usage = 3663 caps.disable_multisampling_color_mask_usage =
3660 feature_info_->workarounds().disable_multisampling_color_mask_usage; 3664 feature_info_->workarounds().disable_multisampling_color_mask_usage;
3661 caps.disable_webgl_rgb_multisampling_usage = 3665 caps.disable_webgl_rgb_multisampling_usage =
3662 feature_info_->workarounds().disable_webgl_rgb_multisampling_usage; 3666 feature_info_->workarounds().disable_webgl_rgb_multisampling_usage;
3663 caps.emulate_rgb_buffer_with_rgba = 3667 caps.emulate_rgb_buffer_with_rgba =
3664 feature_info_->workarounds().disable_gl_rgb_format; 3668 feature_info_->workarounds().disable_gl_rgb_format;
3669 caps.swap_buffers_with_damage = supports_swap_buffers_with_damage_;
3665 3670
3666 return caps; 3671 return caps;
3667 } 3672 }
3668 3673
3669 void GLES2DecoderImpl::UpdateCapabilities() { 3674 void GLES2DecoderImpl::UpdateCapabilities() {
3670 util_.set_num_compressed_texture_formats( 3675 util_.set_num_compressed_texture_formats(
3671 validators_->compressed_texture_format.GetValues().size()); 3676 validators_->compressed_texture_format.GetValues().size());
3672 util_.set_num_shader_binary_formats( 3677 util_.set_num_shader_binary_formats(
3673 validators_->shader_binary_format.GetValues().size()); 3678 validators_->shader_binary_format.GetValues().size());
3674 } 3679 }
(...skipping 7309 matching lines...) Expand 10 before | Expand all | Expand 10 after
10984 state_.unpack_image_height = param; 10989 state_.unpack_image_height = param;
10985 break; 10990 break;
10986 default: 10991 default:
10987 // Validation should have prevented us from getting here. 10992 // Validation should have prevented us from getting here.
10988 NOTREACHED(); 10993 NOTREACHED();
10989 break; 10994 break;
10990 } 10995 }
10991 return error::kNoError; 10996 return error::kNoError;
10992 } 10997 }
10993 10998
10999 error::Error GLES2DecoderImpl::HandleSwapBuffersWithDamageCHROMIUM(
11000 uint32_t immediate_data_size,
11001 const volatile void* cmd_data) {
11002 const volatile gles2::cmds::SwapBuffersWithDamageCHROMIUM& c =
11003 *static_cast<const volatile gles2::cmds::SwapBuffersWithDamageCHROMIUM*>(
11004 cmd_data);
11005 TRACE_EVENT0("gpu", "GLES2DecoderImpl::SwapBuffersWithDamageCHROMIUM");
11006 { TRACE_EVENT_SYNTHETIC_DELAY("gpu.PresentingFrame"); }
11007 if (!supports_swap_buffers_with_damage_) {
11008 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glSwapBuffersWithDamageCHROMIUM",
11009 "command not supported by surface");
11010 return error::kNoError;
11011 }
11012 bool is_tracing;
11013 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("gpu.debug"),
11014 &is_tracing);
11015 if (is_tracing) {
11016 bool is_offscreen = !!offscreen_target_frame_buffer_.get();
11017 ScopedFramebufferBinder binder(this, GetBackbufferServiceId());
11018 gpu_state_tracer_->TakeSnapshotWithCurrentFramebuffer(
11019 is_offscreen ? offscreen_size_ : surface_->GetSize());
11020 }
11021
11022 ClearScheduleCALayerState();
11023
11024 FinishSwapBuffers(
11025 surface_->SwapBuffersWithDamage(c.x, c.y, c.width, c.height));
11026
11027 return error::kNoError;
11028 }
11029
10994 error::Error GLES2DecoderImpl::HandlePostSubBufferCHROMIUM( 11030 error::Error GLES2DecoderImpl::HandlePostSubBufferCHROMIUM(
10995 uint32_t immediate_data_size, 11031 uint32_t immediate_data_size,
10996 const volatile void* cmd_data) { 11032 const volatile void* cmd_data) {
10997 const volatile gles2::cmds::PostSubBufferCHROMIUM& c = 11033 const volatile gles2::cmds::PostSubBufferCHROMIUM& c =
10998 *static_cast<const volatile gles2::cmds::PostSubBufferCHROMIUM*>( 11034 *static_cast<const volatile gles2::cmds::PostSubBufferCHROMIUM*>(
10999 cmd_data); 11035 cmd_data);
11000 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandlePostSubBufferCHROMIUM"); 11036 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandlePostSubBufferCHROMIUM");
11001 { 11037 {
11002 TRACE_EVENT_SYNTHETIC_DELAY("gpu.PresentingFrame"); 11038 TRACE_EVENT_SYNTHETIC_DELAY("gpu.PresentingFrame");
11003 } 11039 }
(...skipping 6930 matching lines...) Expand 10 before | Expand all | Expand 10 after
17934 } 17970 }
17935 17971
17936 // Include the auto-generated part of this file. We split this because it means 17972 // Include the auto-generated part of this file. We split this because it means
17937 // we can easily edit the non-auto generated parts right here in this file 17973 // we can easily edit the non-auto generated parts right here in this file
17938 // instead of having to edit some template or the code generator. 17974 // instead of having to edit some template or the code generator.
17939 #include "base/macros.h" 17975 #include "base/macros.h"
17940 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 17976 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
17941 17977
17942 } // namespace gles2 17978 } // namespace gles2
17943 } // namespace gpu 17979 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698