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

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

Issue 2586803003: Enable creation of offscreen contexts which own their backing surface. (Closed)
Patch Set: (ownsurface) add low_priority to buffer_traits Created 3 years, 11 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 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 decoder_.get())); 616 decoder_.get()));
617 sync_point_client_ = channel_->sync_point_manager()->CreateSyncPointClient( 617 sync_point_client_ = channel_->sync_point_manager()->CreateSyncPointClient(
618 channel_->GetSyncPointOrderData(stream_id_), 618 channel_->GetSyncPointOrderData(stream_id_),
619 CommandBufferNamespace::GPU_IO, command_buffer_id_); 619 CommandBufferNamespace::GPU_IO, command_buffer_id_);
620 620
621 executor_->SetPreemptByFlag(channel_->preempted_flag()); 621 executor_->SetPreemptByFlag(channel_->preempted_flag());
622 622
623 decoder_->set_engine(executor_.get()); 623 decoder_->set_engine(executor_.get());
624 624
625 if (offscreen) { 625 if (offscreen) {
626 surface_ = default_surface; 626 if (init_params.attribs.own_offscreen_surface) {
627 DVLOG(1) << __FUNCTION__ << "Hit the own_offscreen_surface path";
628 use_virtualized_gl_context_ = false;
629 // Currently, we always get alpha channe by default.
dcheng 2017/01/09 23:14:57 Nit: channe => channel
klausw 2017/01/09 23:33:24 Done, I've also reworded the comment a bit to be c
630 // TODO(klausw): add way to disable alpha?
631 if (init_params.attribs.depth_size > 0) {
632 surface_format.SetDepthBits(init_params.attribs.depth_size);
633 }
634 if (init_params.attribs.samples > 0) {
635 surface_format.SetSamples(init_params.attribs.samples);
636 }
637 if (init_params.attribs.stencil_size > 0) {
638 surface_format.SetStencilBits(init_params.attribs.stencil_size);
639 }
640 surface_ = gl::init::CreateOffscreenGLSurfaceWithFormat(
641 gfx::Size(), surface_format);
642 if (!surface_) {
643 DLOG(ERROR) << "Failed to create surface.";
644 return false;
645 }
646 } else {
647 surface_ = default_surface;
648 }
627 } else { 649 } else {
628 surface_ = ImageTransportSurface::CreateNativeSurface( 650 surface_ = ImageTransportSurface::CreateNativeSurface(
629 AsWeakPtr(), surface_handle_, surface_format); 651 AsWeakPtr(), surface_handle_, surface_format);
630 if (!surface_ || !surface_->Initialize(surface_format)) { 652 if (!surface_ || !surface_->Initialize(surface_format)) {
631 surface_ = nullptr; 653 surface_ = nullptr;
632 DLOG(ERROR) << "Failed to create surface."; 654 DLOG(ERROR) << "Failed to create surface.";
633 return false; 655 return false;
634 } 656 }
635 } 657 }
636 658
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
1202 command_buffer_->GetLastState().error == error::kLostContext) 1224 command_buffer_->GetLastState().error == error::kLostContext)
1203 return; 1225 return;
1204 1226
1205 command_buffer_->SetContextLostReason(error::kUnknown); 1227 command_buffer_->SetContextLostReason(error::kUnknown);
1206 if (decoder_) 1228 if (decoder_)
1207 decoder_->MarkContextLost(error::kUnknown); 1229 decoder_->MarkContextLost(error::kUnknown);
1208 command_buffer_->SetParseError(error::kLostContext); 1230 command_buffer_->SetParseError(error::kLostContext);
1209 } 1231 }
1210 1232
1211 } // namespace gpu 1233 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698