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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/service/gles2_cmd_decoder.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index b1039c98a9deef97378f9c15553905196c95305a..90997cec27731de8a0ca2c4b7b98f56616e083db 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -2294,6 +2294,7 @@ class GLES2DecoderImpl : public GLES2Decoder, public ErrorStateClient {
bool context_was_lost_;
bool reset_by_robustness_extension_;
bool supports_post_sub_buffer_;
+ bool supports_swap_buffers_with_damage_;
bool supports_commit_overlay_planes_;
bool supports_async_swap_;
@@ -2978,6 +2979,7 @@ GLES2DecoderImpl::GLES2DecoderImpl(ContextGroup* group)
context_was_lost_(false),
reset_by_robustness_extension_(false),
supports_post_sub_buffer_(false),
+ supports_swap_buffers_with_damage_(false),
supports_commit_overlay_planes_(false),
supports_async_swap_(false),
derivatives_explicitly_enabled_(false),
@@ -3481,6 +3483,8 @@ bool GLES2DecoderImpl::Initialize(
!surface->IsOffscreen())
supports_post_sub_buffer_ = false;
+ supports_swap_buffers_with_damage_ = surface->SupportsSwapBuffersWithDamage();
+
supports_commit_overlay_planes_ = surface->SupportsCommitOverlayPlanes();
supports_async_swap_ = surface->SupportsAsyncSwap();
@@ -3662,6 +3666,7 @@ Capabilities GLES2DecoderImpl::GetCapabilities() {
feature_info_->workarounds().disable_webgl_rgb_multisampling_usage;
caps.emulate_rgb_buffer_with_rgba =
feature_info_->workarounds().disable_gl_rgb_format;
+ caps.swap_buffers_with_damage = supports_swap_buffers_with_damage_;
return caps;
}
@@ -10991,6 +10996,37 @@ error::Error GLES2DecoderImpl::HandlePixelStorei(
return error::kNoError;
}
+error::Error GLES2DecoderImpl::HandleSwapBuffersWithDamageCHROMIUM(
+ uint32_t immediate_data_size,
+ const volatile void* cmd_data) {
+ const volatile gles2::cmds::SwapBuffersWithDamageCHROMIUM& c =
+ *static_cast<const volatile gles2::cmds::SwapBuffersWithDamageCHROMIUM*>(
+ cmd_data);
+ TRACE_EVENT0("gpu", "GLES2DecoderImpl::SwapBuffersWithDamageCHROMIUM");
+ { TRACE_EVENT_SYNTHETIC_DELAY("gpu.PresentingFrame"); }
+ if (!supports_swap_buffers_with_damage_) {
+ LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glSwapBuffersWithDamageCHROMIUM",
+ "command not supported by surface");
+ return error::kNoError;
+ }
+ bool is_tracing;
+ TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("gpu.debug"),
+ &is_tracing);
+ if (is_tracing) {
+ bool is_offscreen = !!offscreen_target_frame_buffer_.get();
+ ScopedFramebufferBinder binder(this, GetBackbufferServiceId());
+ gpu_state_tracer_->TakeSnapshotWithCurrentFramebuffer(
+ is_offscreen ? offscreen_size_ : surface_->GetSize());
+ }
+
+ ClearScheduleCALayerState();
+
+ FinishSwapBuffers(
+ surface_->SwapBuffersWithDamage(c.x, c.y, c.width, c.height));
+
+ return error::kNoError;
+}
+
error::Error GLES2DecoderImpl::HandlePostSubBufferCHROMIUM(
uint32_t immediate_data_size,
const volatile void* cmd_data) {

Powered by Google App Engine
This is Rietveld 408576698