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

Side by Side Diff: content/common/gpu/image_transport_surface_mac.cc

Issue 8513013: Plumb the partial swap though image transport. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Now with a few compile fixes (tested Win, Mac, Linux, and Aura) Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #if defined(ENABLE_GPU) 5 #if defined(ENABLE_GPU)
6 6
7 #include "content/common/gpu/image_transport_surface.h" 7 #include "content/common/gpu/image_transport_surface.h"
8 8
9 #include "base/mac/scoped_cftyperef.h" 9 #include "base/mac/scoped_cftyperef.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 16 matching lines...) Expand all
27 int32 render_view_id, 27 int32 render_view_id,
28 int32 renderer_id, 28 int32 renderer_id,
29 int32 command_buffer_id, 29 int32 command_buffer_id,
30 gfx::PluginWindowHandle handle); 30 gfx::PluginWindowHandle handle);
31 31
32 // GLSurface implementation 32 // GLSurface implementation
33 virtual bool Initialize() OVERRIDE; 33 virtual bool Initialize() OVERRIDE;
34 virtual void Destroy() OVERRIDE; 34 virtual void Destroy() OVERRIDE;
35 virtual bool IsOffscreen() OVERRIDE; 35 virtual bool IsOffscreen() OVERRIDE;
36 virtual bool SwapBuffers() OVERRIDE; 36 virtual bool SwapBuffers() OVERRIDE;
37 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE;
38 virtual std::string GetExtensions() OVERRIDE;
37 virtual gfx::Size GetSize() OVERRIDE; 39 virtual gfx::Size GetSize() OVERRIDE;
38 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; 40 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE;
39 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; 41 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE;
40 42
41 protected: 43 protected:
42 // ImageTransportSurface implementation 44 // ImageTransportSurface implementation
43 virtual void OnNewSurfaceACK(uint64 surface_id, 45 virtual void OnNewSurfaceACK(uint64 surface_id,
44 TransportDIB::Handle shm_handle) OVERRIDE; 46 TransportDIB::Handle shm_handle) OVERRIDE;
45 virtual void OnBuffersSwappedACK() OVERRIDE; 47 virtual void OnBuffersSwappedACK() OVERRIDE;
48 virtual void OnPostSubBufferACK() OVERRIDE;
46 virtual void OnResizeViewACK() OVERRIDE; 49 virtual void OnResizeViewACK() OVERRIDE;
47 virtual void OnResize(gfx::Size size) OVERRIDE; 50 virtual void OnResize(gfx::Size size) OVERRIDE;
48 51
49 private: 52 private:
50 virtual ~IOSurfaceImageTransportSurface() OVERRIDE; 53 virtual ~IOSurfaceImageTransportSurface() OVERRIDE;
51 54
52 uint32 fbo_id_; 55 uint32 fbo_id_;
53 GLuint texture_id_; 56 GLuint texture_id_;
54 57
55 base::mac::ScopedCFTypeRef<CFTypeRef> io_surface_; 58 base::mac::ScopedCFTypeRef<CFTypeRef> io_surface_;
(...skipping 23 matching lines...) Expand all
79 int32 render_view_id, 82 int32 render_view_id,
80 int32 renderer_id, 83 int32 renderer_id,
81 int32 command_buffer_id, 84 int32 command_buffer_id,
82 gfx::PluginWindowHandle handle); 85 gfx::PluginWindowHandle handle);
83 86
84 // GLSurface implementation 87 // GLSurface implementation
85 virtual bool Initialize() OVERRIDE; 88 virtual bool Initialize() OVERRIDE;
86 virtual void Destroy() OVERRIDE; 89 virtual void Destroy() OVERRIDE;
87 virtual bool IsOffscreen() OVERRIDE; 90 virtual bool IsOffscreen() OVERRIDE;
88 virtual bool SwapBuffers() OVERRIDE; 91 virtual bool SwapBuffers() OVERRIDE;
92 virtual std::string GetExtensions() OVERRIDE;
89 virtual gfx::Size GetSize() OVERRIDE; 93 virtual gfx::Size GetSize() OVERRIDE;
90 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; 94 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE;
91 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; 95 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE;
92 96
93 protected: 97 protected:
94 // ImageTransportSurface implementation 98 // ImageTransportSurface implementation
95 virtual void OnBuffersSwappedACK() OVERRIDE; 99 virtual void OnBuffersSwappedACK() OVERRIDE;
100 virtual void OnPostSubBufferACK() OVERRIDE;
96 virtual void OnNewSurfaceACK(uint64 surface_id, 101 virtual void OnNewSurfaceACK(uint64 surface_id,
97 TransportDIB::Handle shm_handle) OVERRIDE; 102 TransportDIB::Handle shm_handle) OVERRIDE;
98 virtual void OnResizeViewACK() OVERRIDE; 103 virtual void OnResizeViewACK() OVERRIDE;
99 virtual void OnResize(gfx::Size size) OVERRIDE; 104 virtual void OnResize(gfx::Size size) OVERRIDE;
100 105
101 private: 106 private:
102 virtual ~TransportDIBImageTransportSurface() OVERRIDE; 107 virtual ~TransportDIBImageTransportSurface() OVERRIDE;
103 108
104 uint32 fbo_id_; 109 uint32 fbo_id_;
105 GLuint render_buffer_id_; 110 GLuint render_buffer_id_;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 glFlush(); 224 glFlush();
220 225
221 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; 226 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params;
222 params.surface_id = io_surface_id_; 227 params.surface_id = io_surface_id_;
223 helper_->SendAcceleratedSurfaceBuffersSwapped(params); 228 helper_->SendAcceleratedSurfaceBuffersSwapped(params);
224 229
225 helper_->SetScheduled(false); 230 helper_->SetScheduled(false);
226 return true; 231 return true;
227 } 232 }
228 233
234 bool IOSurfaceImageTransportSurface::PostSubBuffer(
235 int x, int y, int width, int height) {
236 NOTREACHED();
237 return false;
238 }
239
240 std::string IOSurfaceImageTransportSurface::GetExtensions() {
241 return gfx::GLSurface::GetExtensions();
242 }
243
229 gfx::Size IOSurfaceImageTransportSurface::GetSize() { 244 gfx::Size IOSurfaceImageTransportSurface::GetSize() {
230 return size_; 245 return size_;
231 } 246 }
232 247
233 void IOSurfaceImageTransportSurface::OnBuffersSwappedACK() { 248 void IOSurfaceImageTransportSurface::OnBuffersSwappedACK() {
234 helper_->SetScheduled(true); 249 helper_->SetScheduled(true);
235 } 250 }
236 251
252 void IOSurfaceImageTransportSurface::OnPostSubBufferACK() {
253 NOTREACHED();
254 }
255
237 void IOSurfaceImageTransportSurface::OnNewSurfaceACK( 256 void IOSurfaceImageTransportSurface::OnNewSurfaceACK(
238 uint64 surface_id, 257 uint64 surface_id,
239 TransportDIB::Handle /* shm_handle */) { 258 TransportDIB::Handle /* shm_handle */) {
240 DCHECK_EQ(io_surface_id_, surface_id); 259 DCHECK_EQ(io_surface_id_, surface_id);
241 helper_->SetScheduled(true); 260 helper_->SetScheduled(true);
242 } 261 }
243 262
244 void IOSurfaceImageTransportSurface::OnResizeViewACK() { 263 void IOSurfaceImageTransportSurface::OnResizeViewACK() {
245 NOTREACHED(); 264 NOTREACHED();
246 } 265 }
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, previous_fbo_id); 444 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, previous_fbo_id);
426 445
427 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; 446 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params;
428 params.surface_id = next_id_; 447 params.surface_id = next_id_;
429 helper_->SendAcceleratedSurfaceBuffersSwapped(params); 448 helper_->SendAcceleratedSurfaceBuffersSwapped(params);
430 449
431 helper_->SetScheduled(false); 450 helper_->SetScheduled(false);
432 return true; 451 return true;
433 } 452 }
434 453
454 std::string TransportDIBImageTransportSurface::GetExtensions() {
455 return gfx::GLSurface::GetExtensions();
456 }
457
435 gfx::Size TransportDIBImageTransportSurface::GetSize() { 458 gfx::Size TransportDIBImageTransportSurface::GetSize() {
436 return size_; 459 return size_;
437 } 460 }
438 461
439 void TransportDIBImageTransportSurface::OnBuffersSwappedACK() { 462 void TransportDIBImageTransportSurface::OnBuffersSwappedACK() {
440 helper_->SetScheduled(true); 463 helper_->SetScheduled(true);
441 } 464 }
442 465
466 void TransportDIBImageTransportSurface::OnPostSubBufferACK() {
467 NOTREACHED();
468 }
469
443 void TransportDIBImageTransportSurface::OnNewSurfaceACK( 470 void TransportDIBImageTransportSurface::OnNewSurfaceACK(
444 uint64 surface_id, 471 uint64 surface_id,
445 TransportDIB::Handle shm_handle) { 472 TransportDIB::Handle shm_handle) {
446 helper_->SetScheduled(true); 473 helper_->SetScheduled(true);
447 474
448 shared_mem_.reset(TransportDIB::Map(shm_handle)); 475 shared_mem_.reset(TransportDIB::Map(shm_handle));
449 DCHECK_NE(shared_mem_.get(), static_cast<void*>(NULL)); 476 DCHECK_NE(shared_mem_.get(), static_cast<void*>(NULL));
450 } 477 }
451 478
452 void TransportDIBImageTransportSurface::OnResizeViewACK() { 479 void TransportDIBImageTransportSurface::OnResizeViewACK() {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 NOTREACHED(); 548 NOTREACHED();
522 return NULL; 549 return NULL;
523 } 550 }
524 if (surface->Initialize()) 551 if (surface->Initialize())
525 return surface; 552 return surface;
526 else 553 else
527 return NULL; 554 return NULL;
528 } 555 }
529 556
530 #endif // defined(USE_GPU) 557 #endif // defined(USE_GPU)
OLDNEW
« no previous file with comments | « content/common/gpu/image_transport_surface_linux.cc ('k') | content/common/gpu/image_transport_surface_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698