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

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

Issue 2461803002: Enable creation of offscreen contexts which own their backing surface. (Closed)
Patch Set: Drop unnecessary dependent patch Created 4 years, 1 month 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 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 decoder_.get())); 559 decoder_.get()));
560 sync_point_client_ = channel_->sync_point_manager()->CreateSyncPointClient( 560 sync_point_client_ = channel_->sync_point_manager()->CreateSyncPointClient(
561 channel_->GetSyncPointOrderData(stream_id_), 561 channel_->GetSyncPointOrderData(stream_id_),
562 CommandBufferNamespace::GPU_IO, command_buffer_id_); 562 CommandBufferNamespace::GPU_IO, command_buffer_id_);
563 563
564 executor_->SetPreemptByFlag(channel_->preempted_flag()); 564 executor_->SetPreemptByFlag(channel_->preempted_flag());
565 565
566 decoder_->set_engine(executor_.get()); 566 decoder_->set_engine(executor_.get());
567 567
568 if (offscreen) { 568 if (offscreen) {
569 surface_ = default_surface; 569 if (init_params.attribs.own_offscreen_surface) {
570 use_virtualized_gl_context_ = false;
571 int depth = init_params.attribs.depth_size;
572 if (depth > 0) {
573 if (depth == 24 && surface_format == gl::GLSurface::SURFACE_ARGB8888) {
574 surface_format = gl::GLSurface::SURFACE_ARGB8888_DEPTH24;
575 } else if (depth == 24 &&
576 surface_format == gl::GLSurface::SURFACE_RGB565) {
577 surface_format = gl::GLSurface::SURFACE_RGB565_DEPTH24;
578 } else {
579 DLOG(ERROR) << "Failed to create surface, can't add depth_size="
580 << depth << " to base format " << surface_format;
piman 2016/11/16 00:44:02 Should we fail initialization here, then? I.e. ret
dcheng 2016/11/17 01:17:00 +1, this is coming from the renderer right? We nee
klausw 2017/01/05 02:17:43 Please see the new logic, I think it's much cleane
581 }
582 }
583 surface_ = gl::init::CreateUninitializedOffscreenGLSurface(gfx::Size());
584 if (!surface_ || !surface_->Initialize(surface_format)) {
585 surface_ = nullptr;
586 DLOG(ERROR) << "Failed to create surface.";
587 return false;
588 }
589 } else {
590 surface_ = default_surface;
591 }
570 } else { 592 } else {
571 surface_ = ImageTransportSurface::CreateNativeSurface( 593 surface_ = ImageTransportSurface::CreateNativeSurface(
572 AsWeakPtr(), surface_handle_, surface_format); 594 AsWeakPtr(), surface_handle_, surface_format);
573 if (!surface_ || !surface_->Initialize(surface_format)) { 595 if (!surface_ || !surface_->Initialize(surface_format)) {
574 surface_ = nullptr; 596 surface_ = nullptr;
575 DLOG(ERROR) << "Failed to create surface."; 597 DLOG(ERROR) << "Failed to create surface.";
576 return false; 598 return false;
577 } 599 }
578 } 600 }
579 601
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
1144 command_buffer_->GetLastState().error == error::kLostContext) 1166 command_buffer_->GetLastState().error == error::kLostContext)
1145 return; 1167 return;
1146 1168
1147 command_buffer_->SetContextLostReason(error::kUnknown); 1169 command_buffer_->SetContextLostReason(error::kUnknown);
1148 if (decoder_) 1170 if (decoder_)
1149 decoder_->MarkContextLost(error::kUnknown); 1171 decoder_->MarkContextLost(error::kUnknown);
1150 command_buffer_->SetParseError(error::kLostContext); 1172 command_buffer_->SetParseError(error::kLostContext);
1151 } 1173 }
1152 1174
1153 } // namespace gpu 1175 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698