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

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

Issue 10663003: Merge the IPCs used for GPU process synchronization. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 5 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
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 "content/common/gpu/image_transport_surface.h" 5 #include "content/common/gpu/image_transport_surface.h"
6 6
7 // This conflicts with the defines in Xlib.h and must come first. 7 // This conflicts with the defines in Xlib.h and must come first.
8 #include "content/common/gpu/gpu_messages.h" 8 #include "content/common/gpu/gpu_messages.h"
9 9
10 #include <X11/Xlib.h> 10 #include <X11/Xlib.h>
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 virtual gfx::Size GetSize() OVERRIDE; 93 virtual gfx::Size GetSize() OVERRIDE;
94 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; 94 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE;
95 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; 95 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE;
96 virtual void SetBackbufferAllocation(bool allocated) OVERRIDE; 96 virtual void SetBackbufferAllocation(bool allocated) OVERRIDE;
97 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; 97 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE;
98 98
99 protected: 99 protected:
100 // ImageTransportSurface implementation 100 // ImageTransportSurface implementation
101 virtual void OnNewSurfaceACK( 101 virtual void OnNewSurfaceACK(
102 uint64 surface_handle, TransportDIB::Handle shm_handle) OVERRIDE; 102 uint64 surface_handle, TransportDIB::Handle shm_handle) OVERRIDE;
103 virtual void OnBuffersSwappedACK() OVERRIDE; 103 virtual void OnBufferPresented() OVERRIDE;
104 virtual void OnPostSubBufferACK() OVERRIDE;
105 virtual void OnResizeViewACK() OVERRIDE; 104 virtual void OnResizeViewACK() OVERRIDE;
106 virtual void OnResize(gfx::Size size) OVERRIDE; 105 virtual void OnResize(gfx::Size size) OVERRIDE;
107 106
108 private: 107 private:
109 virtual ~EGLImageTransportSurface() OVERRIDE; 108 virtual ~EGLImageTransportSurface() OVERRIDE;
110 void ReleaseSurface(scoped_refptr<EGLAcceleratedSurface>* surface); 109 void ReleaseSurface(scoped_refptr<EGLAcceleratedSurface>* surface);
111 void SendBuffersSwapped(); 110 void SendBuffersSwapped();
112 void SendPostSubBuffer(int x, int y, int width, int height); 111 void SendPostSubBuffer(int x, int y, int width, int height);
113 112
114 // Tracks the current buffer allocation state. 113 // Tracks the current buffer allocation state.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 virtual std::string GetExtensions(); 149 virtual std::string GetExtensions();
151 virtual gfx::Size GetSize() OVERRIDE; 150 virtual gfx::Size GetSize() OVERRIDE;
152 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; 151 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE;
153 virtual void SetBackbufferAllocation(bool allocated) OVERRIDE; 152 virtual void SetBackbufferAllocation(bool allocated) OVERRIDE;
154 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; 153 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE;
155 154
156 protected: 155 protected:
157 // ImageTransportSurface implementation: 156 // ImageTransportSurface implementation:
158 virtual void OnNewSurfaceACK( 157 virtual void OnNewSurfaceACK(
159 uint64 surface_handle, TransportDIB::Handle shm_handle) OVERRIDE; 158 uint64 surface_handle, TransportDIB::Handle shm_handle) OVERRIDE;
160 virtual void OnBuffersSwappedACK() OVERRIDE; 159 virtual void OnBufferPresented() OVERRIDE;
161 virtual void OnPostSubBufferACK() OVERRIDE;
162 virtual void OnResizeViewACK() OVERRIDE; 160 virtual void OnResizeViewACK() OVERRIDE;
163 virtual void OnResize(gfx::Size size) OVERRIDE; 161 virtual void OnResize(gfx::Size size) OVERRIDE;
164 162
165 private: 163 private:
166 virtual ~GLXImageTransportSurface(); 164 virtual ~GLXImageTransportSurface();
167 165
168 // Tell the browser to release the surface. 166 // Tell the browser to release the surface.
169 void ReleaseSurface(); 167 void ReleaseSurface();
170 168
171 void SendBuffersSwapped(); 169 void SendBuffersSwapped();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 virtual bool IsOffscreen() OVERRIDE; 207 virtual bool IsOffscreen() OVERRIDE;
210 virtual bool SwapBuffers() OVERRIDE; 208 virtual bool SwapBuffers() OVERRIDE;
211 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; 209 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE;
212 virtual std::string GetExtensions() OVERRIDE; 210 virtual std::string GetExtensions() OVERRIDE;
213 virtual gfx::Size GetSize() OVERRIDE; 211 virtual gfx::Size GetSize() OVERRIDE;
214 212
215 protected: 213 protected:
216 // ImageTransportSurface implementation: 214 // ImageTransportSurface implementation:
217 virtual void OnNewSurfaceACK( 215 virtual void OnNewSurfaceACK(
218 uint64 surface_handle, TransportDIB::Handle shm_handle) OVERRIDE; 216 uint64 surface_handle, TransportDIB::Handle shm_handle) OVERRIDE;
219 virtual void OnBuffersSwappedACK() OVERRIDE; 217 virtual void OnBufferPresented() OVERRIDE;
220 virtual void OnPostSubBufferACK() OVERRIDE;
221 virtual void OnResizeViewACK() OVERRIDE; 218 virtual void OnResizeViewACK() OVERRIDE;
222 virtual void OnResize(gfx::Size size) OVERRIDE; 219 virtual void OnResize(gfx::Size size) OVERRIDE;
223 220
224 private: 221 private:
225 virtual ~OSMesaImageTransportSurface(); 222 virtual ~OSMesaImageTransportSurface();
226 223
227 // Tell the browser to release the surface. 224 // Tell the browser to release the surface.
228 void ReleaseSurface(); 225 void ReleaseSurface();
229 226
230 scoped_ptr<TransportDIB> shared_mem_; 227 scoped_ptr<TransportDIB> shared_mem_;
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 gfx::Size EGLImageTransportSurface::GetSize() { 509 gfx::Size EGLImageTransportSurface::GetSize() {
513 return back_surface_->size(); 510 return back_surface_->size();
514 } 511 }
515 512
516 void EGLImageTransportSurface::OnNewSurfaceACK( 513 void EGLImageTransportSurface::OnNewSurfaceACK(
517 uint64 surface_handle, TransportDIB::Handle /*shm_handle*/) { 514 uint64 surface_handle, TransportDIB::Handle /*shm_handle*/) {
518 DCHECK_EQ(back_surface_->pixmap(), surface_handle); 515 DCHECK_EQ(back_surface_->pixmap(), surface_handle);
519 helper_->SetScheduled(true); 516 helper_->SetScheduled(true);
520 } 517 }
521 518
522 void EGLImageTransportSurface::OnBuffersSwappedACK() { 519 void EGLImageTransportSurface::OnBufferPresented() {
523 helper_->SetScheduled(true); 520 helper_->SetScheduled(true);
524 } 521 }
525 522
526 void EGLImageTransportSurface::OnPostSubBufferACK() {
527 helper_->SetScheduled(true);
528 }
529
530 void EGLImageTransportSurface::OnResizeViewACK() { 523 void EGLImageTransportSurface::OnResizeViewACK() {
531 NOTREACHED(); 524 NOTREACHED();
532 } 525 }
533 526
534 GLXImageTransportSurface::GLXImageTransportSurface( 527 GLXImageTransportSurface::GLXImageTransportSurface(
535 GpuChannelManager* manager, 528 GpuChannelManager* manager,
536 GpuCommandBufferStub* stub) 529 GpuCommandBufferStub* stub)
537 : gfx::NativeViewGLSurfaceGLX(), 530 : gfx::NativeViewGLSurfaceGLX(),
538 backbuffer_suggested_allocation_(true), 531 backbuffer_suggested_allocation_(true),
539 frontbuffer_suggested_allocation_(true), 532 frontbuffer_suggested_allocation_(true),
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 context->SetSwapInterval(0); 746 context->SetSwapInterval(0);
754 747
755 made_current_ = true; 748 made_current_ = true;
756 return true; 749 return true;
757 } 750 }
758 751
759 void GLXImageTransportSurface::OnNewSurfaceACK( 752 void GLXImageTransportSurface::OnNewSurfaceACK(
760 uint64 surface_handle, TransportDIB::Handle /*shm_handle*/) { 753 uint64 surface_handle, TransportDIB::Handle /*shm_handle*/) {
761 } 754 }
762 755
763 void GLXImageTransportSurface::OnBuffersSwappedACK() { 756 void GLXImageTransportSurface::OnBufferPresented() {
764 helper_->SetScheduled(true); 757 helper_->SetScheduled(true);
765 } 758 }
766 759
767 void GLXImageTransportSurface::OnPostSubBufferACK() {
768 helper_->SetScheduled(true);
769 }
770
771 void GLXImageTransportSurface::OnResizeViewACK() { 760 void GLXImageTransportSurface::OnResizeViewACK() {
772 NOTREACHED(); 761 NOTREACHED();
773 } 762 }
774 763
775 OSMesaImageTransportSurface::OSMesaImageTransportSurface( 764 OSMesaImageTransportSurface::OSMesaImageTransportSurface(
776 GpuChannelManager* manager, 765 GpuChannelManager* manager,
777 GpuCommandBufferStub* stub) 766 GpuCommandBufferStub* stub)
778 : gfx::GLSurfaceOSMesa(OSMESA_RGBA, gfx::Size(1, 1)), 767 : gfx::GLSurfaceOSMesa(OSMESA_RGBA, gfx::Size(1, 1)),
779 size_(gfx::Size(1, 1)) { 768 size_(gfx::Size(1, 1)) {
780 helper_.reset(new ImageTransportHelper(this, 769 helper_.reset(new ImageTransportHelper(this,
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 } 884 }
896 885
897 std::string OSMesaImageTransportSurface::GetExtensions() { 886 std::string OSMesaImageTransportSurface::GetExtensions() {
898 std::string extensions = gfx::GLSurface::GetExtensions(); 887 std::string extensions = gfx::GLSurface::GetExtensions();
899 extensions += extensions.empty() ? "" : " "; 888 extensions += extensions.empty() ? "" : " ";
900 extensions += "GL_CHROMIUM_front_buffer_cached "; 889 extensions += "GL_CHROMIUM_front_buffer_cached ";
901 extensions += "GL_CHROMIUM_post_sub_buffer"; 890 extensions += "GL_CHROMIUM_post_sub_buffer";
902 return extensions; 891 return extensions;
903 } 892 }
904 893
905 void OSMesaImageTransportSurface::OnBuffersSwappedACK() { 894 void OSMesaImageTransportSurface::OnBufferPresented() {
906 helper_->SetScheduled(true); 895 helper_->SetScheduled(true);
907 } 896 }
908 897
909 void OSMesaImageTransportSurface::OnPostSubBufferACK() {
910 helper_->SetScheduled(true);
911 }
912
913 gfx::Size OSMesaImageTransportSurface::GetSize() { 898 gfx::Size OSMesaImageTransportSurface::GetSize() {
914 return size_; 899 return size_;
915 } 900 }
916 901
917 } // namespace 902 } // namespace
918 903
919 // static 904 // static
920 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface( 905 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface(
921 GpuChannelManager* manager, 906 GpuChannelManager* manager,
922 GpuCommandBufferStub* stub, 907 GpuCommandBufferStub* stub,
(...skipping 27 matching lines...) Expand all
950 stub, 935 stub,
951 surface.get(), 936 surface.get(),
952 handle.transport); 937 handle.transport);
953 } 938 }
954 939
955 if (surface->Initialize()) 940 if (surface->Initialize())
956 return surface; 941 return surface;
957 else 942 else
958 return NULL; 943 return NULL;
959 } 944 }
OLDNEW
« no previous file with comments | « content/common/gpu/image_transport_surface.cc ('k') | content/common/gpu/image_transport_surface_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698