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

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

Issue 1540004: Implemented offscreen rendering path for GLES2CmdDecoder on Linux.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.cc ('k') | gpu/command_buffer/service/x_utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 <gdk/gdkx.h> 5 #include <gdk/gdkx.h>
6 #include "gpu/command_buffer/service/gpu_processor.h" 6 #include "gpu/command_buffer/service/gpu_processor.h"
7 #include "gpu/command_buffer/service/x_utils.h" 7 #include "gpu/command_buffer/service/x_utils.h"
8 8
9 using ::base::SharedMemory; 9 using ::base::SharedMemory;
10 10
11 namespace gpu { 11 namespace gpu {
12 12
13 bool GPUProcessor::Initialize(gfx::PluginWindowHandle handle, 13 bool GPUProcessor::Initialize(gfx::PluginWindowHandle handle,
14 GPUProcessor* parent, 14 GPUProcessor* parent,
15 const gfx::Size& size, 15 const gfx::Size& size,
16 uint32 parent_texture_id) { 16 uint32 parent_texture_id) {
17 DCHECK(handle);
18
19 // Cannot reinitialize. 17 // Cannot reinitialize.
20 if (decoder_->window() != NULL) 18 if (decoder_->context() != NULL)
21 return false; 19 return false;
22 20
23 // Map the ring buffer and create the parser. 21 // Map the ring buffer and create the parser.
24 Buffer ring_buffer = command_buffer_->GetRingBuffer(); 22 Buffer ring_buffer = command_buffer_->GetRingBuffer();
25 if (ring_buffer.ptr) { 23 if (ring_buffer.ptr) {
26 parser_.reset(new CommandParser(ring_buffer.ptr, 24 parser_.reset(new CommandParser(ring_buffer.ptr,
27 ring_buffer.size, 25 ring_buffer.size,
28 0, 26 0,
29 ring_buffer.size, 27 ring_buffer.size,
30 0, 28 0,
31 decoder_.get())); 29 decoder_.get()));
32 } else { 30 } else {
33 parser_.reset(new CommandParser(NULL, 0, 0, 0, 0, 31 parser_.reset(new CommandParser(NULL, 0, 0, 0, 0,
34 decoder_.get())); 32 decoder_.get()));
35 } 33 }
36 34
37 // Initialize GAPI immediately if the window handle is valid. 35 // Initialize GAPI immediately.
38 XWindowWrapper *window = new XWindowWrapper(GDK_DISPLAY(), handle); 36 GLXContextWrapper* wrapper = NULL;
39 decoder_->set_window_wrapper(window); 37 if (size.width() > 0 && size.height() > 0) {
38 // Offscreen code path.
39 DCHECK(!handle);
40 wrapper = new GLXPbufferWrapper(GDK_DISPLAY());
41 } else {
42 DCHECK(handle);
43 // Onscreen code path.
44 wrapper = new XWindowWrapper(GDK_DISPLAY(), handle);
45 }
46 decoder_->set_context_wrapper(wrapper);
40 gles2::GLES2Decoder* parent_decoder = parent ? parent->decoder_.get() : NULL; 47 gles2::GLES2Decoder* parent_decoder = parent ? parent->decoder_.get() : NULL;
41 if (!decoder_->Initialize(parent_decoder, 48 if (!decoder_->Initialize(parent_decoder,
42 size, 49 size,
43 parent_texture_id)) { 50 parent_texture_id)) {
44 Destroy(); 51 Destroy();
45 return false; 52 return false;
46 } 53 }
47 54
48 return true;} 55 return true;
56 }
49 57
50 void GPUProcessor::Destroy() { 58 void GPUProcessor::Destroy() {
51 // Destroy decoder if initialized. 59 // Destroy decoder if initialized.
60 // TODO(gman): simplify cleanup logic. http://crbug.com/39895
52 if (decoder_.get()) { 61 if (decoder_.get()) {
53 XWindowWrapper *window = decoder_->window(); 62 GLXContextWrapper *context = decoder_->context();
54 decoder_->Destroy(); 63 decoder_->Destroy();
55 decoder_->set_window_wrapper(NULL); 64 decoder_->set_context_wrapper(NULL);
56 delete window; 65 delete context;
57 decoder_.reset(); 66 decoder_.reset();
58 } 67 }
59 68
60 parser_.reset(); 69 parser_.reset();
61 } 70 }
62 71
63 } // namespace gpu 72 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.cc ('k') | gpu/command_buffer/service/x_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698