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

Side by Side Diff: gpu/ipc/service/gpu_command_buffer_stub.cc

Issue 2698573002: Support offscreen contexts which own their backing surface (Closed)
Patch Set: Rebase and retry again Created 3 years, 10 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/ipc/service/gpu_command_buffer_stub.h" 5 #include "gpu/ipc/service/gpu_command_buffer_stub.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 decoder_.get())); 627 decoder_.get()));
628 sync_point_client_ = channel_->sync_point_manager()->CreateSyncPointClient( 628 sync_point_client_ = channel_->sync_point_manager()->CreateSyncPointClient(
629 channel_->GetSyncPointOrderData(stream_id_), 629 channel_->GetSyncPointOrderData(stream_id_),
630 CommandBufferNamespace::GPU_IO, command_buffer_id_); 630 CommandBufferNamespace::GPU_IO, command_buffer_id_);
631 631
632 executor_->SetPreemptByFlag(channel_->preempted_flag()); 632 executor_->SetPreemptByFlag(channel_->preempted_flag());
633 633
634 decoder_->set_engine(executor_.get()); 634 decoder_->set_engine(executor_.get());
635 635
636 if (offscreen) { 636 if (offscreen) {
637 surface_ = default_surface; 637 if (init_params.attribs.depth_size > 0) {
638 surface_format.SetDepthBits(init_params.attribs.depth_size);
639 }
640 if (init_params.attribs.samples > 0) {
641 surface_format.SetSamples(init_params.attribs.samples);
642 }
643 if (init_params.attribs.stencil_size > 0) {
644 surface_format.SetStencilBits(init_params.attribs.stencil_size);
645 }
646 // Currently, we can't separately control alpha channel for surfaces,
647 // it's generally enabled by default except for RGB565 and (on desktop)
648 // smaller-than-32bit formats.
649 //
650 // TODO(klausw): use init_params.attribs.alpha_size here if possible.
651 if (!surface_format.IsCompatible(default_surface->GetFormat())) {
652 DVLOG(1) << __FUNCTION__ << ": Hit the OwnOffscreenSurface path";
653 use_virtualized_gl_context_ = false;
654 surface_ = gl::init::CreateOffscreenGLSurfaceWithFormat(gfx::Size(),
655 surface_format);
656 if (!surface_) {
657 DLOG(ERROR) << "Failed to create surface.";
658 return false;
659 }
660 } else {
661 surface_ = default_surface;
662 }
638 } else { 663 } else {
639 surface_ = ImageTransportSurface::CreateNativeSurface( 664 surface_ = ImageTransportSurface::CreateNativeSurface(
640 AsWeakPtr(), surface_handle_, surface_format); 665 AsWeakPtr(), surface_handle_, surface_format);
641 if (!surface_ || !surface_->Initialize(surface_format)) { 666 if (!surface_ || !surface_->Initialize(surface_format)) {
642 surface_ = nullptr; 667 surface_ = nullptr;
643 DLOG(ERROR) << "Failed to create surface."; 668 DLOG(ERROR) << "Failed to create surface.";
644 return false; 669 return false;
645 } 670 }
646 } 671 }
647 672
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
1214 command_buffer_->GetLastState().error == error::kLostContext) 1239 command_buffer_->GetLastState().error == error::kLostContext)
1215 return; 1240 return;
1216 1241
1217 command_buffer_->SetContextLostReason(error::kUnknown); 1242 command_buffer_->SetContextLostReason(error::kUnknown);
1218 if (decoder_) 1243 if (decoder_)
1219 decoder_->MarkContextLost(error::kUnknown); 1244 decoder_->MarkContextLost(error::kUnknown);
1220 command_buffer_->SetParseError(error::kLostContext); 1245 command_buffer_->SetParseError(error::kLostContext);
1221 } 1246 }
1222 1247
1223 } // namespace gpu 1248 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698