John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2013 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package android.view; |
| 18 | |
John Reck | 04fc583 | 2014-02-05 16:38:25 -0800 | [diff] [blame] | 19 | import android.graphics.Bitmap; |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 20 | import android.graphics.Rect; |
| 21 | import android.graphics.SurfaceTexture; |
John Reck | 66f0be6 | 2014-05-13 13:39:31 -0700 | [diff] [blame] | 22 | import android.os.IBinder; |
| 23 | import android.os.RemoteException; |
| 24 | import android.os.ServiceManager; |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 25 | import android.os.Trace; |
John Reck | 66f0be6 | 2014-05-13 13:39:31 -0700 | [diff] [blame] | 26 | import android.util.Log; |
John Reck | 315c329 | 2014-05-09 19:21:04 -0700 | [diff] [blame] | 27 | import android.util.TimeUtils; |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 28 | import android.view.Surface.OutOfResourcesException; |
| 29 | import android.view.View.AttachInfo; |
| 30 | |
| 31 | import java.io.PrintWriter; |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 32 | |
| 33 | /** |
| 34 | * Hardware renderer that proxies the rendering to a render thread. Most calls |
John Reck | 4f02bf4 | 2014-01-03 18:09:17 -0800 | [diff] [blame] | 35 | * are currently synchronous. |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 36 | * |
| 37 | * The UI thread can block on the RenderThread, but RenderThread must never |
| 38 | * block on the UI thread. |
| 39 | * |
John Reck | 4f02bf4 | 2014-01-03 18:09:17 -0800 | [diff] [blame] | 40 | * ThreadedRenderer creates an instance of RenderProxy. RenderProxy in turn creates |
| 41 | * and manages a CanvasContext on the RenderThread. The CanvasContext is fully managed |
| 42 | * by the lifecycle of the RenderProxy. |
| 43 | * |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 44 | * Note that although currently the EGL context & surfaces are created & managed |
| 45 | * by the render thread, the goal is to move that into a shared structure that can |
| 46 | * be managed by both threads. EGLSurface creation & deletion should ideally be |
| 47 | * done on the UI thread and not the RenderThread to avoid stalling the |
| 48 | * RenderThread with surface buffer allocation. |
| 49 | * |
| 50 | * @hide |
| 51 | */ |
| 52 | public class ThreadedRenderer extends HardwareRenderer { |
| 53 | private static final String LOGTAG = "ThreadedRenderer"; |
| 54 | |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 55 | private static final Rect NULL_RECT = new Rect(); |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 56 | |
John Reck | f9be779 | 2014-05-02 18:21:16 -0700 | [diff] [blame] | 57 | // Keep in sync with DrawFrameTask.h SYNC_* flags |
| 58 | // Nothing interesting to report |
| 59 | private static final int SYNC_OK = 0x0; |
| 60 | // Needs a ViewRoot invalidate |
| 61 | private static final int SYNC_INVALIDATE_REQUIRED = 0x1; |
| 62 | |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 63 | private int mWidth, mHeight; |
John Reck | 4f02bf4 | 2014-01-03 18:09:17 -0800 | [diff] [blame] | 64 | private long mNativeProxy; |
John Reck | f7d9c1d | 2014-04-09 10:01:03 -0700 | [diff] [blame] | 65 | private boolean mInitialized = false; |
John Reck | bc0cc02 | 2014-04-11 16:08:14 -0700 | [diff] [blame] | 66 | private RenderNode mRootNode; |
John Reck | 18f16e6 | 2014-05-02 16:46:41 -0700 | [diff] [blame] | 67 | private Choreographer mChoreographer; |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 68 | |
John Reck | 3dfe19f | 2013-12-13 14:25:19 -0800 | [diff] [blame] | 69 | ThreadedRenderer(boolean translucent) { |
John Reck | 66f0be6 | 2014-05-13 13:39:31 -0700 | [diff] [blame] | 70 | AtlasInitializer.sInstance.init(); |
| 71 | |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 72 | long rootNodePtr = nCreateRootRenderNode(); |
| 73 | mRootNode = RenderNode.adopt(rootNodePtr); |
John Reck | bc0cc02 | 2014-04-11 16:08:14 -0700 | [diff] [blame] | 74 | mRootNode.setClipToBounds(false); |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 75 | mNativeProxy = nCreateProxy(translucent, rootNodePtr); |
John Reck | 18f16e6 | 2014-05-02 16:46:41 -0700 | [diff] [blame] | 76 | |
| 77 | // Setup timing |
| 78 | mChoreographer = Choreographer.getInstance(); |
| 79 | nSetFrameInterval(mNativeProxy, mChoreographer.getFrameIntervalNanos()); |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 80 | } |
| 81 | |
| 82 | @Override |
| 83 | void destroy(boolean full) { |
John Reck | f7d9c1d | 2014-04-09 10:01:03 -0700 | [diff] [blame] | 84 | mInitialized = false; |
| 85 | updateEnabledState(null); |
John Reck | fae904d | 2014-04-14 11:01:57 -0700 | [diff] [blame] | 86 | nDestroyCanvasAndSurface(mNativeProxy); |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 87 | } |
| 88 | |
John Reck | f7d9c1d | 2014-04-09 10:01:03 -0700 | [diff] [blame] | 89 | private void updateEnabledState(Surface surface) { |
| 90 | if (surface == null || !surface.isValid()) { |
| 91 | setEnabled(false); |
| 92 | } else { |
| 93 | setEnabled(mInitialized); |
| 94 | } |
| 95 | } |
| 96 | |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 97 | @Override |
| 98 | boolean initialize(Surface surface) throws OutOfResourcesException { |
John Reck | f7d9c1d | 2014-04-09 10:01:03 -0700 | [diff] [blame] | 99 | mInitialized = true; |
| 100 | updateEnabledState(surface); |
John Reck | 4f02bf4 | 2014-01-03 18:09:17 -0800 | [diff] [blame] | 101 | return nInitialize(mNativeProxy, surface); |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 102 | } |
| 103 | |
| 104 | @Override |
| 105 | void updateSurface(Surface surface) throws OutOfResourcesException { |
John Reck | f7d9c1d | 2014-04-09 10:01:03 -0700 | [diff] [blame] | 106 | updateEnabledState(surface); |
John Reck | 4f02bf4 | 2014-01-03 18:09:17 -0800 | [diff] [blame] | 107 | nUpdateSurface(mNativeProxy, surface); |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 108 | } |
| 109 | |
| 110 | @Override |
John Reck | f7d9c1d | 2014-04-09 10:01:03 -0700 | [diff] [blame] | 111 | void pauseSurface(Surface surface) { |
| 112 | nPauseSurface(mNativeProxy, surface); |
| 113 | } |
| 114 | |
| 115 | @Override |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 116 | void destroyHardwareResources(View view) { |
John Reck | 4f02bf4 | 2014-01-03 18:09:17 -0800 | [diff] [blame] | 117 | destroyResources(view); |
John Reck | e1628b7 | 2014-05-23 15:11:19 -0700 | [diff] [blame^] | 118 | nFlushCaches(mNativeProxy, GLES20Canvas.FLUSH_CACHES_LAYERS); |
John Reck | 4f02bf4 | 2014-01-03 18:09:17 -0800 | [diff] [blame] | 119 | } |
| 120 | |
| 121 | private static void destroyResources(View view) { |
| 122 | view.destroyHardwareResources(); |
| 123 | |
| 124 | if (view instanceof ViewGroup) { |
| 125 | ViewGroup group = (ViewGroup) view; |
| 126 | |
| 127 | int count = group.getChildCount(); |
| 128 | for (int i = 0; i < count; i++) { |
| 129 | destroyResources(group.getChildAt(i)); |
| 130 | } |
| 131 | } |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 132 | } |
| 133 | |
| 134 | @Override |
| 135 | void invalidate(Surface surface) { |
John Reck | 4f02bf4 | 2014-01-03 18:09:17 -0800 | [diff] [blame] | 136 | updateSurface(surface); |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 137 | } |
| 138 | |
| 139 | @Override |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 140 | boolean safelyRun(Runnable action) { |
John Reck | fc53ef27 | 2014-02-11 10:40:25 -0800 | [diff] [blame] | 141 | nRunWithGlContext(mNativeProxy, action); |
| 142 | return true; |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 143 | } |
| 144 | |
| 145 | @Override |
Chris Craik | 797b95b | 2014-05-20 18:10:25 -0700 | [diff] [blame] | 146 | void setup(int width, int height, float lightX, float lightY, float lightZ, float lightRadius) { |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 147 | mWidth = width; |
| 148 | mHeight = height; |
John Reck | bc0cc02 | 2014-04-11 16:08:14 -0700 | [diff] [blame] | 149 | mRootNode.setLeftTopRightBottom(0, 0, mWidth, mHeight); |
Chris Craik | 797b95b | 2014-05-20 18:10:25 -0700 | [diff] [blame] | 150 | nSetup(mNativeProxy, width, height, lightX, lightY, lightZ, lightRadius); |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 151 | } |
| 152 | |
| 153 | @Override |
John Reck | 63a0667 | 2014-05-07 13:45:54 -0700 | [diff] [blame] | 154 | void setOpaque(boolean opaque) { |
| 155 | nSetOpaque(mNativeProxy, opaque); |
| 156 | } |
| 157 | |
| 158 | @Override |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 159 | int getWidth() { |
| 160 | return mWidth; |
| 161 | } |
| 162 | |
| 163 | @Override |
| 164 | int getHeight() { |
| 165 | return mHeight; |
| 166 | } |
| 167 | |
| 168 | @Override |
| 169 | void dumpGfxInfo(PrintWriter pw) { |
| 170 | // TODO Auto-generated method stub |
| 171 | } |
| 172 | |
| 173 | @Override |
| 174 | long getFrameCount() { |
| 175 | // TODO Auto-generated method stub |
| 176 | return 0; |
| 177 | } |
| 178 | |
| 179 | @Override |
| 180 | boolean loadSystemProperties() { |
John Reck | e4280ba | 2014-05-05 16:39:37 -0700 | [diff] [blame] | 181 | return nLoadSystemProperties(mNativeProxy); |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 182 | } |
| 183 | |
John Reck | bc0cc02 | 2014-04-11 16:08:14 -0700 | [diff] [blame] | 184 | private void updateRootDisplayList(View view, HardwareDrawCallbacks callbacks) { |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 185 | view.mPrivateFlags |= View.PFLAG_DRAWN; |
| 186 | |
| 187 | view.mRecreateDisplayList = (view.mPrivateFlags & View.PFLAG_INVALIDATED) |
| 188 | == View.PFLAG_INVALIDATED; |
| 189 | view.mPrivateFlags &= ~View.PFLAG_INVALIDATED; |
| 190 | |
| 191 | Trace.traceBegin(Trace.TRACE_TAG_VIEW, "getDisplayList"); |
John Reck | bc0cc02 | 2014-04-11 16:08:14 -0700 | [diff] [blame] | 192 | HardwareCanvas canvas = mRootNode.start(mWidth, mHeight); |
John Reck | 05e8584 | 2014-04-23 14:48:28 -0700 | [diff] [blame] | 193 | try { |
John Reck | 86faf9e | 2014-05-19 13:19:07 -0700 | [diff] [blame] | 194 | canvas.save(); |
Alan Viverette | d5b2ec4 | 2014-05-17 16:34:09 -0700 | [diff] [blame] | 195 | callbacks.onHardwarePreDraw(canvas); |
John Reck | 05e8584 | 2014-04-23 14:48:28 -0700 | [diff] [blame] | 196 | canvas.drawDisplayList(view.getDisplayList()); |
| 197 | callbacks.onHardwarePostDraw(canvas); |
John Reck | 86faf9e | 2014-05-19 13:19:07 -0700 | [diff] [blame] | 198 | canvas.restore(); |
John Reck | 05e8584 | 2014-04-23 14:48:28 -0700 | [diff] [blame] | 199 | } finally { |
| 200 | mRootNode.end(canvas); |
| 201 | Trace.traceEnd(Trace.TRACE_TAG_VIEW); |
| 202 | } |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 203 | |
| 204 | view.mRecreateDisplayList = false; |
John Reck | bc0cc02 | 2014-04-11 16:08:14 -0700 | [diff] [blame] | 205 | } |
| 206 | |
| 207 | @Override |
| 208 | void draw(View view, AttachInfo attachInfo, HardwareDrawCallbacks callbacks, Rect dirty) { |
| 209 | attachInfo.mIgnoreDirtyState = true; |
John Reck | 18f16e6 | 2014-05-02 16:46:41 -0700 | [diff] [blame] | 210 | long frameTimeNanos = mChoreographer.getFrameTimeNanos(); |
John Reck | 315c329 | 2014-05-09 19:21:04 -0700 | [diff] [blame] | 211 | attachInfo.mDrawingTime = frameTimeNanos / TimeUtils.NANOS_PER_MS; |
John Reck | bc0cc02 | 2014-04-11 16:08:14 -0700 | [diff] [blame] | 212 | |
| 213 | updateRootDisplayList(view, callbacks); |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 214 | |
John Reck | 6313b92 | 2014-04-16 18:59:21 -0700 | [diff] [blame] | 215 | attachInfo.mIgnoreDirtyState = false; |
| 216 | |
John Reck | 4f02bf4 | 2014-01-03 18:09:17 -0800 | [diff] [blame] | 217 | if (dirty == null) { |
| 218 | dirty = NULL_RECT; |
| 219 | } |
John Reck | f9be779 | 2014-05-02 18:21:16 -0700 | [diff] [blame] | 220 | int syncResult = nSyncAndDrawFrame(mNativeProxy, frameTimeNanos, |
John Reck | 18f16e6 | 2014-05-02 16:46:41 -0700 | [diff] [blame] | 221 | dirty.left, dirty.top, dirty.right, dirty.bottom); |
John Reck | f9be779 | 2014-05-02 18:21:16 -0700 | [diff] [blame] | 222 | if ((syncResult & SYNC_INVALIDATE_REQUIRED) != 0) { |
| 223 | attachInfo.mViewRootImpl.invalidate(); |
| 224 | } |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 225 | } |
| 226 | |
| 227 | @Override |
Bo Liu | ae738a7 | 2014-04-27 16:22:04 -0700 | [diff] [blame] | 228 | void invokeFunctor(long functor, boolean waitForCompletion) { |
John Reck | 0d1f634 | 2014-03-28 20:30:27 -0700 | [diff] [blame] | 229 | nInvokeFunctor(mNativeProxy, functor, waitForCompletion); |
| 230 | } |
| 231 | |
| 232 | @Override |
John Reck | 19b6bcf | 2014-02-14 20:03:38 -0800 | [diff] [blame] | 233 | HardwareLayer createDisplayListLayer(int width, int height) { |
| 234 | long layer = nCreateDisplayListLayer(mNativeProxy, width, height); |
| 235 | return HardwareLayer.adoptDisplayListLayer(this, layer); |
| 236 | } |
| 237 | |
| 238 | @Override |
| 239 | HardwareLayer createTextureLayer() { |
| 240 | long layer = nCreateTextureLayer(mNativeProxy); |
| 241 | return HardwareLayer.adoptTextureLayer(this, layer); |
| 242 | } |
| 243 | |
| 244 | @Override |
| 245 | SurfaceTexture createSurfaceTexture(final HardwareLayer layer) { |
| 246 | final SurfaceTexture[] ret = new SurfaceTexture[1]; |
| 247 | nRunWithGlContext(mNativeProxy, new Runnable() { |
| 248 | @Override |
| 249 | public void run() { |
| 250 | ret[0] = layer.createSurfaceTexture(); |
| 251 | } |
| 252 | }); |
| 253 | return ret[0]; |
| 254 | } |
| 255 | |
| 256 | @Override |
| 257 | boolean copyLayerInto(final HardwareLayer layer, final Bitmap bitmap) { |
| 258 | return nCopyLayerInto(mNativeProxy, |
| 259 | layer.getDeferredLayerUpdater(), bitmap.mNativeBitmap); |
| 260 | } |
| 261 | |
| 262 | @Override |
| 263 | void pushLayerUpdate(HardwareLayer layer) { |
| 264 | // TODO: Remove this, it's not needed outside of GLRenderer |
| 265 | } |
| 266 | |
| 267 | @Override |
| 268 | void onLayerCreated(HardwareLayer layer) { |
| 269 | // TODO: Is this actually useful? |
| 270 | } |
| 271 | |
| 272 | @Override |
| 273 | void flushLayerUpdates() { |
| 274 | // TODO: Figure out what this should do or remove it |
| 275 | } |
| 276 | |
| 277 | @Override |
| 278 | void onLayerDestroyed(HardwareLayer layer) { |
| 279 | nDestroyLayer(mNativeProxy, layer.getDeferredLayerUpdater()); |
| 280 | } |
| 281 | |
| 282 | @Override |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 283 | void setName(String name) { |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 284 | } |
| 285 | |
John Reck | 4f02bf4 | 2014-01-03 18:09:17 -0800 | [diff] [blame] | 286 | @Override |
John Reck | 28ad7b5 | 2014-04-07 16:59:25 -0700 | [diff] [blame] | 287 | void fence() { |
| 288 | nFence(mNativeProxy); |
| 289 | } |
| 290 | |
| 291 | @Override |
John Reck | a5dda64 | 2014-05-22 15:43:54 -0700 | [diff] [blame] | 292 | public void notifyFramePending() { |
| 293 | nNotifyFramePending(mNativeProxy); |
| 294 | } |
| 295 | |
| 296 | @Override |
John Reck | 4f02bf4 | 2014-01-03 18:09:17 -0800 | [diff] [blame] | 297 | protected void finalize() throws Throwable { |
| 298 | try { |
| 299 | nDeleteProxy(mNativeProxy); |
John Reck | 0ed751d | 2014-04-08 14:10:17 -0700 | [diff] [blame] | 300 | mNativeProxy = 0; |
John Reck | 4f02bf4 | 2014-01-03 18:09:17 -0800 | [diff] [blame] | 301 | } finally { |
| 302 | super.finalize(); |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 303 | } |
| 304 | } |
| 305 | |
John Reck | 66f0be6 | 2014-05-13 13:39:31 -0700 | [diff] [blame] | 306 | private static class AtlasInitializer { |
| 307 | static AtlasInitializer sInstance = new AtlasInitializer(); |
| 308 | |
| 309 | private boolean mInitialized = false; |
| 310 | |
| 311 | private AtlasInitializer() {} |
| 312 | |
| 313 | synchronized void init() { |
| 314 | if (mInitialized) return; |
| 315 | IBinder binder = ServiceManager.getService("assetatlas"); |
| 316 | if (binder == null) return; |
| 317 | |
| 318 | IAssetAtlas atlas = IAssetAtlas.Stub.asInterface(binder); |
| 319 | try { |
| 320 | if (atlas.isCompatible(android.os.Process.myPpid())) { |
| 321 | GraphicBuffer buffer = atlas.getBuffer(); |
| 322 | if (buffer != null) { |
| 323 | long[] map = atlas.getMap(); |
| 324 | if (map != null) { |
| 325 | nSetAtlas(buffer, map); |
| 326 | mInitialized = true; |
| 327 | } |
| 328 | // If IAssetAtlas is not the same class as the IBinder |
| 329 | // we are using a remote service and we can safely |
| 330 | // destroy the graphic buffer |
| 331 | if (atlas.getClass() != binder.getClass()) { |
| 332 | buffer.destroy(); |
| 333 | } |
| 334 | } |
| 335 | } |
| 336 | } catch (RemoteException e) { |
| 337 | Log.w(LOG_TAG, "Could not acquire atlas", e); |
| 338 | } |
| 339 | } |
| 340 | } |
| 341 | |
| 342 | private static native void nSetAtlas(GraphicBuffer buffer, long[] map); |
John Reck | 4f02bf4 | 2014-01-03 18:09:17 -0800 | [diff] [blame] | 343 | |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 344 | private static native long nCreateRootRenderNode(); |
| 345 | private static native long nCreateProxy(boolean translucent, long rootRenderNode); |
John Reck | 4f02bf4 | 2014-01-03 18:09:17 -0800 | [diff] [blame] | 346 | private static native void nDeleteProxy(long nativeProxy); |
| 347 | |
John Reck | 18f16e6 | 2014-05-02 16:46:41 -0700 | [diff] [blame] | 348 | private static native void nSetFrameInterval(long nativeProxy, long frameIntervalNanos); |
John Reck | e4280ba | 2014-05-05 16:39:37 -0700 | [diff] [blame] | 349 | private static native boolean nLoadSystemProperties(long nativeProxy); |
John Reck | 18f16e6 | 2014-05-02 16:46:41 -0700 | [diff] [blame] | 350 | |
John Reck | 4f02bf4 | 2014-01-03 18:09:17 -0800 | [diff] [blame] | 351 | private static native boolean nInitialize(long nativeProxy, Surface window); |
| 352 | private static native void nUpdateSurface(long nativeProxy, Surface window); |
John Reck | f7d9c1d | 2014-04-09 10:01:03 -0700 | [diff] [blame] | 353 | private static native void nPauseSurface(long nativeProxy, Surface window); |
Chris Craik | 797b95b | 2014-05-20 18:10:25 -0700 | [diff] [blame] | 354 | private static native void nSetup(long nativeProxy, int width, int height, |
| 355 | float lightX, float lightY, float lightZ, float lightRadius); |
John Reck | 63a0667 | 2014-05-07 13:45:54 -0700 | [diff] [blame] | 356 | private static native void nSetOpaque(long nativeProxy, boolean opaque); |
John Reck | f9be779 | 2014-05-02 18:21:16 -0700 | [diff] [blame] | 357 | private static native int nSyncAndDrawFrame(long nativeProxy, long frameTimeNanos, |
John Reck | 4f02bf4 | 2014-01-03 18:09:17 -0800 | [diff] [blame] | 358 | int dirtyLeft, int dirtyTop, int dirtyRight, int dirtyBottom); |
John Reck | fc53ef27 | 2014-02-11 10:40:25 -0800 | [diff] [blame] | 359 | private static native void nRunWithGlContext(long nativeProxy, Runnable runnable); |
John Reck | fae904d | 2014-04-14 11:01:57 -0700 | [diff] [blame] | 360 | private static native void nDestroyCanvasAndSurface(long nativeProxy); |
John Reck | 4f02bf4 | 2014-01-03 18:09:17 -0800 | [diff] [blame] | 361 | |
John Reck | 0d1f634 | 2014-03-28 20:30:27 -0700 | [diff] [blame] | 362 | private static native void nInvokeFunctor(long nativeProxy, long functor, boolean waitForCompletion); |
John Reck | 19b6bcf | 2014-02-14 20:03:38 -0800 | [diff] [blame] | 363 | |
| 364 | private static native long nCreateDisplayListLayer(long nativeProxy, int width, int height); |
| 365 | private static native long nCreateTextureLayer(long nativeProxy); |
| 366 | private static native boolean nCopyLayerInto(long nativeProxy, long layer, long bitmap); |
| 367 | private static native void nDestroyLayer(long nativeProxy, long layer); |
John Reck | 28ad7b5 | 2014-04-07 16:59:25 -0700 | [diff] [blame] | 368 | |
John Reck | e1628b7 | 2014-05-23 15:11:19 -0700 | [diff] [blame^] | 369 | private static native void nFlushCaches(long nativeProxy, int flushMode); |
| 370 | |
John Reck | 28ad7b5 | 2014-04-07 16:59:25 -0700 | [diff] [blame] | 371 | private static native void nFence(long nativeProxy); |
John Reck | a5dda64 | 2014-05-22 15:43:54 -0700 | [diff] [blame] | 372 | private static native void nNotifyFramePending(long nativeProxy); |
John Reck | cec24ae | 2013-11-05 13:27:50 -0800 | [diff] [blame] | 373 | } |