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

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

Issue 2096503002: Implement new behavior for DescheduleUntilFinishedCHROMIUM. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@temp95
Patch Set: Rebase. Created 4 years, 6 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 2173 matching lines...) Expand 10 before | Expand all | Expand 10 after
2184 2184
2185 std::unique_ptr<GPUTracer> gpu_tracer_; 2185 std::unique_ptr<GPUTracer> gpu_tracer_;
2186 std::unique_ptr<GPUStateTracer> gpu_state_tracer_; 2186 std::unique_ptr<GPUStateTracer> gpu_state_tracer_;
2187 const unsigned char* gpu_decoder_category_; 2187 const unsigned char* gpu_decoder_category_;
2188 int gpu_trace_level_; 2188 int gpu_trace_level_;
2189 bool gpu_trace_commands_; 2189 bool gpu_trace_commands_;
2190 bool gpu_debug_commands_; 2190 bool gpu_debug_commands_;
2191 2191
2192 std::queue<linked_ptr<FenceCallback> > pending_readpixel_fences_; 2192 std::queue<linked_ptr<FenceCallback> > pending_readpixel_fences_;
2193 2193
2194 // After this fence is inserted, both the GpuChannelMessageQueue and 2194 // After a second fence is inserted, both the GpuChannelMessageQueue and
2195 // CommandExecutor are descheduled. Once the fence has completed, both get 2195 // CommandExecutor are descheduled. Once the first fence has completed, both
2196 // rescheduled. 2196 // get rescheduled.
2197 std::unique_ptr<gl::GLFence> deschedule_until_finished_fence_; 2197 std::vector<std::unique_ptr<gl::GLFence>> deschedule_until_finished_fences_;
2198 2198
2199 // Used to validate multisample renderbuffers if needed 2199 // Used to validate multisample renderbuffers if needed
2200 GLuint validation_texture_; 2200 GLuint validation_texture_;
2201 GLuint validation_fbo_multisample_; 2201 GLuint validation_fbo_multisample_;
2202 GLuint validation_fbo_; 2202 GLuint validation_fbo_;
2203 2203
2204 typedef gpu::gles2::GLES2Decoder::Error (GLES2DecoderImpl::*CmdHandler)( 2204 typedef gpu::gles2::GLES2Decoder::Error (GLES2DecoderImpl::*CmdHandler)(
2205 uint32_t immediate_data_size, 2205 uint32_t immediate_data_size,
2206 const void* data); 2206 const void* data);
2207 2207
(...skipping 11459 matching lines...) Expand 10 before | Expand all | Expand 10 after
13667 uint32_t immediate_data_size, 13667 uint32_t immediate_data_size,
13668 const void* cmd_data) { 13668 const void* cmd_data) {
13669 if (deschedule_until_finished_callback_.is_null() || 13669 if (deschedule_until_finished_callback_.is_null() ||
13670 reschedule_after_finished_callback_.is_null()) { 13670 reschedule_after_finished_callback_.is_null()) {
13671 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, 13671 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION,
13672 "glDescheduleUntilFinishedCHROMIUM", 13672 "glDescheduleUntilFinishedCHROMIUM",
13673 "Not fully implemented."); 13673 "Not fully implemented.");
13674 return error::kNoError; 13674 return error::kNoError;
13675 } 13675 }
13676 13676
13677 deschedule_until_finished_fence_.reset(gl::GLFence::Create()); 13677 std::unique_ptr<gl::GLFence> fence(gl::GLFence::Create());
13678 DCHECK(deschedule_until_finished_fence_); 13678 deschedule_until_finished_fences_.push_back(std::move(fence));
13679 if (deschedule_until_finished_fence_->HasCompleted()) { 13679
13680 deschedule_until_finished_fence_.reset(); 13680 if (deschedule_until_finished_fences_.size() == 1)
13681 return error::kNoError;
13682
13683 DCHECK_EQ(2u, deschedule_until_finished_fences_.size());
13684 if (deschedule_until_finished_fences_[0]->HasCompleted()) {
13685 deschedule_until_finished_fences_.erase(
13686 deschedule_until_finished_fences_.begin());
13681 return error::kNoError; 13687 return error::kNoError;
13682 } 13688 }
13683 13689
13684 TRACE_EVENT_ASYNC_BEGIN0("cc", "GLES2DecoderImpl::DescheduleUntilFinished", 13690 TRACE_EVENT_ASYNC_BEGIN0("cc", "GLES2DecoderImpl::DescheduleUntilFinished",
13685 this); 13691 this);
13686 deschedule_until_finished_callback_.Run(); 13692 deschedule_until_finished_callback_.Run();
13687 return error::kDeferLaterCommands; 13693 return error::kDeferLaterCommands;
13688 } 13694 }
13689 13695
13690 error::Error GLES2DecoderImpl::HandleInsertFenceSyncCHROMIUM( 13696 error::Error GLES2DecoderImpl::HandleInsertFenceSyncCHROMIUM(
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
13807 std::vector<base::Closure> callbacks = 13813 std::vector<base::Closure> callbacks =
13808 pending_readpixel_fences_.front()->callbacks; 13814 pending_readpixel_fences_.front()->callbacks;
13809 pending_readpixel_fences_.pop(); 13815 pending_readpixel_fences_.pop();
13810 for (size_t i = 0; i < callbacks.size(); i++) { 13816 for (size_t i = 0; i < callbacks.size(); i++) {
13811 callbacks[i].Run(); 13817 callbacks[i].Run();
13812 } 13818 }
13813 } 13819 }
13814 } 13820 }
13815 13821
13816 void GLES2DecoderImpl::ProcessDescheduleUntilFinished() { 13822 void GLES2DecoderImpl::ProcessDescheduleUntilFinished() {
13817 if (!deschedule_until_finished_fence_) 13823 if (deschedule_until_finished_fences_.size() < 2)
13818 return; 13824 return;
13825 DCHECK_EQ(2u, deschedule_until_finished_fences_.size());
13819 13826
13820 if (!deschedule_until_finished_fence_->HasCompleted()) 13827 if (!deschedule_until_finished_fences_[0]->HasCompleted())
13821 return; 13828 return;
13822 13829
13823 TRACE_EVENT_ASYNC_END0("cc", "GLES2DecoderImpl::DescheduleUntilFinished", 13830 TRACE_EVENT_ASYNC_END0("cc", "GLES2DecoderImpl::DescheduleUntilFinished",
13824 this); 13831 this);
13825 deschedule_until_finished_fence_.reset(); 13832 deschedule_until_finished_fences_.erase(
13833 deschedule_until_finished_fences_.begin());
13826 reschedule_after_finished_callback_.Run(); 13834 reschedule_after_finished_callback_.Run();
13827 } 13835 }
13828 13836
13829 bool GLES2DecoderImpl::HasMoreIdleWork() const { 13837 bool GLES2DecoderImpl::HasMoreIdleWork() const {
13830 return !pending_readpixel_fences_.empty() || 13838 return !pending_readpixel_fences_.empty() ||
13831 gpu_tracer_->HasTracesToProcess(); 13839 gpu_tracer_->HasTracesToProcess();
13832 } 13840 }
13833 13841
13834 void GLES2DecoderImpl::PerformIdleWork() { 13842 void GLES2DecoderImpl::PerformIdleWork() {
13835 gpu_tracer_->ProcessTraces(); 13843 gpu_tracer_->ProcessTraces();
13836 ProcessPendingReadPixels(false); 13844 ProcessPendingReadPixels(false);
13837 } 13845 }
13838 13846
13839 bool GLES2DecoderImpl::HasPollingWork() const { 13847 bool GLES2DecoderImpl::HasPollingWork() const {
13840 return !!deschedule_until_finished_fence_.get(); 13848 return deschedule_until_finished_fences_.size() >= 2;
13841 } 13849 }
13842 13850
13843 void GLES2DecoderImpl::PerformPollingWork() { 13851 void GLES2DecoderImpl::PerformPollingWork() {
13844 ProcessDescheduleUntilFinished(); 13852 ProcessDescheduleUntilFinished();
13845 } 13853 }
13846 13854
13847 error::Error GLES2DecoderImpl::HandleBeginQueryEXT(uint32_t immediate_data_size, 13855 error::Error GLES2DecoderImpl::HandleBeginQueryEXT(uint32_t immediate_data_size,
13848 const void* cmd_data) { 13856 const void* cmd_data) {
13849 const gles2::cmds::BeginQueryEXT& c = 13857 const gles2::cmds::BeginQueryEXT& c =
13850 *static_cast<const gles2::cmds::BeginQueryEXT*>(cmd_data); 13858 *static_cast<const gles2::cmds::BeginQueryEXT*>(cmd_data);
(...skipping 2954 matching lines...) Expand 10 before | Expand all | Expand 10 after
16805 } 16813 }
16806 16814
16807 // Include the auto-generated part of this file. We split this because it means 16815 // Include the auto-generated part of this file. We split this because it means
16808 // we can easily edit the non-auto generated parts right here in this file 16816 // we can easily edit the non-auto generated parts right here in this file
16809 // instead of having to edit some template or the code generator. 16817 // instead of having to edit some template or the code generator.
16810 #include "base/macros.h" 16818 #include "base/macros.h"
16811 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 16819 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
16812 16820
16813 } // namespace gles2 16821 } // namespace gles2
16814 } // namespace gpu 16822 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/GLES2/extensions/CHROMIUM/CHROMIUM_deschedule.txt ('k') | gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698