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

Side by Side Diff: ui/ozone/public/surface_factory_ozone.h

Issue 1050923003: zero-copy: Clarify to allocate/destroy GpuMemoryBuffer on any thread and use it on the main thread o (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: just add thread check Created 5 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #ifndef UI_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_ 5 #ifndef UI_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_
6 #define UI_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_ 6 #define UI_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/native_library.h" 10 #include "base/native_library.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 enum BufferUsage { 71 enum BufferUsage {
72 MAP, 72 MAP,
73 SCANOUT, 73 SCANOUT,
74 }; 74 };
75 75
76 typedef void* (*GLGetProcAddressProc)(const char* name); 76 typedef void* (*GLGetProcAddressProc)(const char* name);
77 typedef base::Callback<void(base::NativeLibrary)> AddGLLibraryCallback; 77 typedef base::Callback<void(base::NativeLibrary)> AddGLLibraryCallback;
78 typedef base::Callback<void(GLGetProcAddressProc)> 78 typedef base::Callback<void(GLGetProcAddressProc)>
79 SetGLGetProcAddressProcCallback; 79 SetGLGetProcAddressProcCallback;
80 80
81 SurfaceFactoryOzone();
82 virtual ~SurfaceFactoryOzone(); 81 virtual ~SurfaceFactoryOzone();
83 82
84 // Returns the singleton instance. 83 // Returns the singleton instance.
85 static SurfaceFactoryOzone* GetInstance(); 84 static SurfaceFactoryOzone* GetInstance();
86 85
87 // Returns native platform display handle. This is used to obtain the EGL 86 // Returns native platform display handle. This is used to obtain the EGL
88 // display connection for the native display. 87 // display connection for the native display.
89 virtual intptr_t GetNativeDisplay(); 88 virtual intptr_t GetNativeDisplay();
90 89
91 // Returns Drm file descriptor. This is used to obtain access to the 90 // Returns Drm file descriptor. This is used to obtain access to the
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 // caller. desired_list contains list of desired EGL properties and values. 125 // caller. desired_list contains list of desired EGL properties and values.
127 virtual const int32* GetEGLSurfaceProperties(const int32* desired_list); 126 virtual const int32* GetEGLSurfaceProperties(const int32* desired_list);
128 127
129 // Get the hal struct to check for overlay support. 128 // Get the hal struct to check for overlay support.
130 virtual OverlayCandidatesOzone* GetOverlayCandidates( 129 virtual OverlayCandidatesOzone* GetOverlayCandidates(
131 gfx::AcceleratedWidget w); 130 gfx::AcceleratedWidget w);
132 131
133 // Create a single native buffer to be used for overlay planes or zero copy 132 // Create a single native buffer to be used for overlay planes or zero copy
134 // for |widget| representing a particular display controller or default 133 // for |widget| representing a particular display controller or default
135 // display controller for kNullAcceleratedWidget. 134 // display controller for kNullAcceleratedWidget.
135 // It can be called on any thread.
136 virtual scoped_refptr<NativePixmap> CreateNativePixmap( 136 virtual scoped_refptr<NativePixmap> CreateNativePixmap(
137 gfx::AcceleratedWidget widget, 137 gfx::AcceleratedWidget widget,
138 gfx::Size size, 138 gfx::Size size,
139 BufferFormat format, 139 BufferFormat format,
140 BufferUsage usage); 140 BufferUsage usage);
141 141
142 // Sets the overlay plane to switch to at the next page flip. 142 // Sets the overlay plane to switch to at the next page flip.
143 // |w| specifies the screen to display this overlay plane on. 143 // |w| specifies the screen to display this overlay plane on.
144 // |plane_z_order| specifies the stacking order of the plane relative to the 144 // |plane_z_order| specifies the stacking order of the plane relative to the
145 // main framebuffer located at index 0. 145 // main framebuffer located at index 0.
(...skipping 13 matching lines...) Expand all
159 159
160 // Returns true if overlays can be shown at z-index 0, replacing the main 160 // Returns true if overlays can be shown at z-index 0, replacing the main
161 // surface. Combined with surfaceless extensions, it allows for an 161 // surface. Combined with surfaceless extensions, it allows for an
162 // overlay-only mode. 162 // overlay-only mode.
163 virtual bool CanShowPrimaryPlaneAsOverlay(); 163 virtual bool CanShowPrimaryPlaneAsOverlay();
164 164
165 // Returns true if the platform is able to create buffers for a specific usage 165 // Returns true if the platform is able to create buffers for a specific usage
166 // such as MAP for zero copy or SCANOUT for display controller. 166 // such as MAP for zero copy or SCANOUT for display controller.
167 virtual bool CanCreateNativePixmap(BufferUsage usage); 167 virtual bool CanCreateNativePixmap(BufferUsage usage);
168 168
169 protected:
170 SurfaceFactoryOzone();
171
169 private: 172 private:
170 static SurfaceFactoryOzone* impl_; // not owned 173 DISALLOW_COPY_AND_ASSIGN(SurfaceFactoryOzone);
171 }; 174 };
172 175
173 } // namespace ui 176 } // namespace ui
174 177
175 #endif // UI_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_ 178 #endif // UI_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698