blob: fb8ce153938912dd583625dda0034a97945cb97b [file] [log] [blame]
John Reckcec24ae2013-11-05 13:27:50 -08001/*
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
17package android.view;
18
Alan Viverette58c42c32014-07-12 20:33:45 -070019import com.android.internal.R;
20
John Reckb8802b12014-06-16 15:28:50 -070021import android.content.Context;
22import android.content.res.Resources;
Alan Viverette58c42c32014-07-12 20:33:45 -070023import android.content.res.TypedArray;
John Reck04fc5832014-02-05 16:38:25 -080024import android.graphics.Bitmap;
Alan Viveretteccb11e12014-07-08 16:04:02 -070025import android.graphics.Rect;
John Reckb8802b12014-06-16 15:28:50 -070026import android.graphics.drawable.Drawable;
John Reck66f0be62014-05-13 13:39:31 -070027import android.os.IBinder;
28import android.os.RemoteException;
29import android.os.ServiceManager;
John Reckfe5e7b72014-05-23 17:42:28 -070030import android.os.SystemProperties;
John Reckcec24ae2013-11-05 13:27:50 -080031import android.os.Trace;
John Reck66f0be62014-05-13 13:39:31 -070032import android.util.Log;
John Reckb8802b12014-06-16 15:28:50 -070033import android.util.LongSparseArray;
John Reck315c3292014-05-09 19:21:04 -070034import android.util.TimeUtils;
John Reckcec24ae2013-11-05 13:27:50 -080035import android.view.Surface.OutOfResourcesException;
36import android.view.View.AttachInfo;
37
John Reckfe5e7b72014-05-23 17:42:28 -070038import java.io.FileDescriptor;
John Reckcec24ae2013-11-05 13:27:50 -080039import java.io.PrintWriter;
John Reckb8802b12014-06-16 15:28:50 -070040import java.util.HashSet;
John Reckcec24ae2013-11-05 13:27:50 -080041
42/**
43 * Hardware renderer that proxies the rendering to a render thread. Most calls
John Reck4f02bf42014-01-03 18:09:17 -080044 * are currently synchronous.
John Reckcec24ae2013-11-05 13:27:50 -080045 *
46 * The UI thread can block on the RenderThread, but RenderThread must never
47 * block on the UI thread.
48 *
John Reck4f02bf42014-01-03 18:09:17 -080049 * ThreadedRenderer creates an instance of RenderProxy. RenderProxy in turn creates
50 * and manages a CanvasContext on the RenderThread. The CanvasContext is fully managed
51 * by the lifecycle of the RenderProxy.
52 *
John Reckcec24ae2013-11-05 13:27:50 -080053 * Note that although currently the EGL context & surfaces are created & managed
54 * by the render thread, the goal is to move that into a shared structure that can
55 * be managed by both threads. EGLSurface creation & deletion should ideally be
56 * done on the UI thread and not the RenderThread to avoid stalling the
57 * RenderThread with surface buffer allocation.
58 *
59 * @hide
60 */
61public class ThreadedRenderer extends HardwareRenderer {
62 private static final String LOGTAG = "ThreadedRenderer";
63
John Reckf9be7792014-05-02 18:21:16 -070064 // Keep in sync with DrawFrameTask.h SYNC_* flags
65 // Nothing interesting to report
John Reckcd028f32014-06-24 08:44:29 -070066 private static final int SYNC_OK = 0;
John Reckf9be7792014-05-02 18:21:16 -070067 // Needs a ViewRoot invalidate
John Reckcd028f32014-06-24 08:44:29 -070068 private static final int SYNC_INVALIDATE_REQUIRED = 1 << 0;
John Reckf9be7792014-05-02 18:21:16 -070069
John Reckfe5e7b72014-05-23 17:42:28 -070070 private static final String[] VISUALIZERS = {
71 PROFILE_PROPERTY_VISUALIZE_BARS,
72 };
73
Alan Viveretteccb11e12014-07-08 16:04:02 -070074 // Size of the rendered content.
John Reckcec24ae2013-11-05 13:27:50 -080075 private int mWidth, mHeight;
Alan Viveretteccb11e12014-07-08 16:04:02 -070076
77 // Actual size of the drawing surface.
78 private int mSurfaceWidth, mSurfaceHeight;
79
80 // Insets between the drawing surface and rendered content. These are
81 // applied as translation when updating the root render node.
82 private int mInsetTop, mInsetLeft;
83
Alan Viverette58c42c32014-07-12 20:33:45 -070084 // Light and shadow properties specified by the theme.
85 private final float mLightY;
86 private final float mLightZ;
87 private final float mLightRadius;
88 private final float mAmbientShadowAlpha;
89 private final float mSpotShadowAlpha;
90
John Reck4f02bf42014-01-03 18:09:17 -080091 private long mNativeProxy;
John Reckf7d9c1d2014-04-09 10:01:03 -070092 private boolean mInitialized = false;
John Reckbc0cc022014-04-11 16:08:14 -070093 private RenderNode mRootNode;
John Reck18f16e62014-05-02 16:46:41 -070094 private Choreographer mChoreographer;
John Reckfe5e7b72014-05-23 17:42:28 -070095 private boolean mProfilingEnabled;
John Reckcec24ae2013-11-05 13:27:50 -080096
John Reckb8802b12014-06-16 15:28:50 -070097 ThreadedRenderer(Context context, boolean translucent) {
Alan Viverette58c42c32014-07-12 20:33:45 -070098 final TypedArray a = context.obtainStyledAttributes(
99 null, R.styleable.Lighting, R.attr.lightingStyle, 0);
100 mLightY = a.getDimension(R.styleable.Lighting_lightY, 0);
101 mLightZ = a.getDimension(R.styleable.Lighting_lightZ, 0);
102 mLightRadius = a.getDimension(R.styleable.Lighting_lightRadius, 0);
103 mAmbientShadowAlpha = a.getFloat(R.styleable.Lighting_ambientShadowAlpha, 0);
104 mSpotShadowAlpha = a.getFloat(R.styleable.Lighting_spotShadowAlpha, 0);
105 a.recycle();
106
John Recke45b1fd2014-04-15 09:50:16 -0700107 long rootNodePtr = nCreateRootRenderNode();
108 mRootNode = RenderNode.adopt(rootNodePtr);
John Reckbc0cc022014-04-11 16:08:14 -0700109 mRootNode.setClipToBounds(false);
John Recke45b1fd2014-04-15 09:50:16 -0700110 mNativeProxy = nCreateProxy(translucent, rootNodePtr);
John Reck18f16e62014-05-02 16:46:41 -0700111
John Reck3b202512014-06-23 13:13:08 -0700112 AtlasInitializer.sInstance.init(context, mNativeProxy);
113
John Reck18f16e62014-05-02 16:46:41 -0700114 // Setup timing
115 mChoreographer = Choreographer.getInstance();
116 nSetFrameInterval(mNativeProxy, mChoreographer.getFrameIntervalNanos());
John Reckfe5e7b72014-05-23 17:42:28 -0700117
118 loadSystemProperties();
John Reckcec24ae2013-11-05 13:27:50 -0800119 }
120
121 @Override
John Reckf47a5942014-06-30 16:20:04 -0700122 void destroy() {
John Reckf7d9c1d2014-04-09 10:01:03 -0700123 mInitialized = false;
124 updateEnabledState(null);
John Reckfae904d2014-04-14 11:01:57 -0700125 nDestroyCanvasAndSurface(mNativeProxy);
John Reckcec24ae2013-11-05 13:27:50 -0800126 }
127
John Reckf7d9c1d2014-04-09 10:01:03 -0700128 private void updateEnabledState(Surface surface) {
129 if (surface == null || !surface.isValid()) {
130 setEnabled(false);
131 } else {
132 setEnabled(mInitialized);
133 }
134 }
135
John Reckcec24ae2013-11-05 13:27:50 -0800136 @Override
137 boolean initialize(Surface surface) throws OutOfResourcesException {
John Reckf7d9c1d2014-04-09 10:01:03 -0700138 mInitialized = true;
139 updateEnabledState(surface);
Dan Stoza5795d642014-06-20 13:01:36 -0700140 boolean status = nInitialize(mNativeProxy, surface);
141 surface.allocateBuffers();
142 return status;
John Reckcec24ae2013-11-05 13:27:50 -0800143 }
144
145 @Override
146 void updateSurface(Surface surface) throws OutOfResourcesException {
John Reckf7d9c1d2014-04-09 10:01:03 -0700147 updateEnabledState(surface);
John Reck4f02bf42014-01-03 18:09:17 -0800148 nUpdateSurface(mNativeProxy, surface);
John Reckcec24ae2013-11-05 13:27:50 -0800149 }
150
151 @Override
John Reckf7d9c1d2014-04-09 10:01:03 -0700152 void pauseSurface(Surface surface) {
153 nPauseSurface(mNativeProxy, surface);
154 }
155
156 @Override
John Reckcec24ae2013-11-05 13:27:50 -0800157 void destroyHardwareResources(View view) {
John Reck4f02bf42014-01-03 18:09:17 -0800158 destroyResources(view);
John Reckf47a5942014-06-30 16:20:04 -0700159 nDestroyHardwareResources(mNativeProxy);
John Reck4f02bf42014-01-03 18:09:17 -0800160 }
161
162 private static void destroyResources(View view) {
163 view.destroyHardwareResources();
164
165 if (view instanceof ViewGroup) {
166 ViewGroup group = (ViewGroup) view;
167
168 int count = group.getChildCount();
169 for (int i = 0; i < count; i++) {
170 destroyResources(group.getChildAt(i));
171 }
172 }
John Reckcec24ae2013-11-05 13:27:50 -0800173 }
174
175 @Override
176 void invalidate(Surface surface) {
John Reck4f02bf42014-01-03 18:09:17 -0800177 updateSurface(surface);
John Reckcec24ae2013-11-05 13:27:50 -0800178 }
179
180 @Override
John Reck918ad522014-06-27 14:45:25 -0700181 void detachSurfaceTexture(long hardwareLayer) {
182 nDetachSurfaceTexture(mNativeProxy, hardwareLayer);
John Reckcec24ae2013-11-05 13:27:50 -0800183 }
184
185 @Override
Alan Viverette58c42c32014-07-12 20:33:45 -0700186 void setup(int width, int height, Rect surfaceInsets) {
187 final float lightX = width / 2.0f;
John Reckcec24ae2013-11-05 13:27:50 -0800188 mWidth = width;
189 mHeight = height;
Alan Viveretteccb11e12014-07-08 16:04:02 -0700190 if (surfaceInsets != null) {
191 mInsetLeft = surfaceInsets.left;
192 mInsetTop = surfaceInsets.top;
193 mSurfaceWidth = width + mInsetLeft + surfaceInsets.right;
194 mSurfaceHeight = height + mInsetTop + surfaceInsets.bottom;
195 } else {
196 mInsetLeft = 0;
197 mInsetTop = 0;
198 mSurfaceWidth = width;
199 mSurfaceHeight = height;
200 }
201 mRootNode.setLeftTopRightBottom(-mInsetLeft, -mInsetTop, mSurfaceWidth, mSurfaceHeight);
Alan Viverette58c42c32014-07-12 20:33:45 -0700202 nSetup(mNativeProxy, mSurfaceWidth, mSurfaceHeight, lightX, mLightY, mLightZ, mLightRadius);
John Reckcec24ae2013-11-05 13:27:50 -0800203 }
204
205 @Override
John Reck63a06672014-05-07 13:45:54 -0700206 void setOpaque(boolean opaque) {
207 nSetOpaque(mNativeProxy, opaque);
208 }
209
210 @Override
John Reckcec24ae2013-11-05 13:27:50 -0800211 int getWidth() {
212 return mWidth;
213 }
214
215 @Override
216 int getHeight() {
217 return mHeight;
218 }
219
220 @Override
John Reckfe5e7b72014-05-23 17:42:28 -0700221 void dumpGfxInfo(PrintWriter pw, FileDescriptor fd) {
222 pw.flush();
223 nDumpProfileInfo(mNativeProxy, fd);
John Reckcec24ae2013-11-05 13:27:50 -0800224 }
225
John Reckfe5e7b72014-05-23 17:42:28 -0700226 private static int search(String[] values, String value) {
227 for (int i = 0; i < values.length; i++) {
228 if (values[i].equals(value)) return i;
229 }
230 return -1;
231 }
232
233 private static boolean checkIfProfilingRequested() {
234 String profiling = SystemProperties.get(HardwareRenderer.PROFILE_PROPERTY);
235 int graphType = search(VISUALIZERS, profiling);
236 return (graphType >= 0) || Boolean.parseBoolean(profiling);
John Reckcec24ae2013-11-05 13:27:50 -0800237 }
238
239 @Override
240 boolean loadSystemProperties() {
John Reckfe5e7b72014-05-23 17:42:28 -0700241 boolean changed = nLoadSystemProperties(mNativeProxy);
242 boolean wantProfiling = checkIfProfilingRequested();
243 if (wantProfiling != mProfilingEnabled) {
244 mProfilingEnabled = wantProfiling;
245 changed = true;
246 }
247 return changed;
John Reckcec24ae2013-11-05 13:27:50 -0800248 }
249
John Reckbc0cc022014-04-11 16:08:14 -0700250 private void updateRootDisplayList(View view, HardwareDrawCallbacks callbacks) {
John Reckcec24ae2013-11-05 13:27:50 -0800251 view.mPrivateFlags |= View.PFLAG_DRAWN;
252
253 view.mRecreateDisplayList = (view.mPrivateFlags & View.PFLAG_INVALIDATED)
254 == View.PFLAG_INVALIDATED;
255 view.mPrivateFlags &= ~View.PFLAG_INVALIDATED;
256
257 Trace.traceBegin(Trace.TRACE_TAG_VIEW, "getDisplayList");
Alan Viveretteccb11e12014-07-08 16:04:02 -0700258 HardwareCanvas canvas = mRootNode.start(mSurfaceWidth, mSurfaceHeight);
John Reck05e85842014-04-23 14:48:28 -0700259 try {
John Reck86faf9e2014-05-19 13:19:07 -0700260 canvas.save();
Alan Viveretteccb11e12014-07-08 16:04:02 -0700261 canvas.translate(mInsetLeft, mInsetTop);
Alan Viveretted5b2ec42014-05-17 16:34:09 -0700262 callbacks.onHardwarePreDraw(canvas);
Chris Craika7090e02014-06-20 16:01:00 -0700263 canvas.drawRenderNode(view.getDisplayList());
John Reck05e85842014-04-23 14:48:28 -0700264 callbacks.onHardwarePostDraw(canvas);
John Reck86faf9e2014-05-19 13:19:07 -0700265 canvas.restore();
John Reck05e85842014-04-23 14:48:28 -0700266 } finally {
267 mRootNode.end(canvas);
268 Trace.traceEnd(Trace.TRACE_TAG_VIEW);
269 }
John Reckcec24ae2013-11-05 13:27:50 -0800270
271 view.mRecreateDisplayList = false;
John Reckbc0cc022014-04-11 16:08:14 -0700272 }
273
274 @Override
John Recke4267ea2014-06-03 15:53:15 -0700275 void draw(View view, AttachInfo attachInfo, HardwareDrawCallbacks callbacks) {
John Reckbc0cc022014-04-11 16:08:14 -0700276 attachInfo.mIgnoreDirtyState = true;
John Reck18f16e62014-05-02 16:46:41 -0700277 long frameTimeNanos = mChoreographer.getFrameTimeNanos();
John Reck315c3292014-05-09 19:21:04 -0700278 attachInfo.mDrawingTime = frameTimeNanos / TimeUtils.NANOS_PER_MS;
John Reckbc0cc022014-04-11 16:08:14 -0700279
John Reckfe5e7b72014-05-23 17:42:28 -0700280 long recordDuration = 0;
281 if (mProfilingEnabled) {
282 recordDuration = System.nanoTime();
283 }
284
John Reckbc0cc022014-04-11 16:08:14 -0700285 updateRootDisplayList(view, callbacks);
John Reckcec24ae2013-11-05 13:27:50 -0800286
John Reckfe5e7b72014-05-23 17:42:28 -0700287 if (mProfilingEnabled) {
288 recordDuration = System.nanoTime() - recordDuration;
289 }
290
John Reck6313b922014-04-16 18:59:21 -0700291 attachInfo.mIgnoreDirtyState = false;
292
John Reckf9be7792014-05-02 18:21:16 -0700293 int syncResult = nSyncAndDrawFrame(mNativeProxy, frameTimeNanos,
John Recke4267ea2014-06-03 15:53:15 -0700294 recordDuration, view.getResources().getDisplayMetrics().density);
John Reckf9be7792014-05-02 18:21:16 -0700295 if ((syncResult & SYNC_INVALIDATE_REQUIRED) != 0) {
296 attachInfo.mViewRootImpl.invalidate();
297 }
John Reckcec24ae2013-11-05 13:27:50 -0800298 }
299
John Reck3b202512014-06-23 13:13:08 -0700300 static void invokeFunctor(long functor, boolean waitForCompletion) {
301 nInvokeFunctor(functor, waitForCompletion);
John Reck0d1f6342014-03-28 20:30:27 -0700302 }
303
304 @Override
John Reck19b6bcf2014-02-14 20:03:38 -0800305 HardwareLayer createTextureLayer() {
306 long layer = nCreateTextureLayer(mNativeProxy);
307 return HardwareLayer.adoptTextureLayer(this, layer);
308 }
309
310 @Override
John Reck19b6bcf2014-02-14 20:03:38 -0800311 boolean copyLayerInto(final HardwareLayer layer, final Bitmap bitmap) {
312 return nCopyLayerInto(mNativeProxy,
313 layer.getDeferredLayerUpdater(), bitmap.mNativeBitmap);
314 }
315
316 @Override
317 void pushLayerUpdate(HardwareLayer layer) {
John Reckd72e0a32014-05-29 18:56:11 -0700318 nPushLayerUpdate(mNativeProxy, layer.getDeferredLayerUpdater());
John Reck19b6bcf2014-02-14 20:03:38 -0800319 }
320
321 @Override
John Reck19b6bcf2014-02-14 20:03:38 -0800322 void onLayerDestroyed(HardwareLayer layer) {
John Reckd72e0a32014-05-29 18:56:11 -0700323 nCancelLayerUpdate(mNativeProxy, layer.getDeferredLayerUpdater());
John Reck19b6bcf2014-02-14 20:03:38 -0800324 }
325
326 @Override
John Reckcec24ae2013-11-05 13:27:50 -0800327 void setName(String name) {
John Reckcec24ae2013-11-05 13:27:50 -0800328 }
329
John Reck4f02bf42014-01-03 18:09:17 -0800330 @Override
John Reck28ad7b52014-04-07 16:59:25 -0700331 void fence() {
332 nFence(mNativeProxy);
333 }
334
335 @Override
John Reckf47a5942014-06-30 16:20:04 -0700336 void stopDrawing() {
337 nStopDrawing(mNativeProxy);
338 }
339
340 @Override
John Recka5dda642014-05-22 15:43:54 -0700341 public void notifyFramePending() {
342 nNotifyFramePending(mNativeProxy);
343 }
344
345 @Override
John Reck4f02bf42014-01-03 18:09:17 -0800346 protected void finalize() throws Throwable {
347 try {
348 nDeleteProxy(mNativeProxy);
John Reck0ed751d2014-04-08 14:10:17 -0700349 mNativeProxy = 0;
John Reck4f02bf42014-01-03 18:09:17 -0800350 } finally {
351 super.finalize();
John Reckcec24ae2013-11-05 13:27:50 -0800352 }
353 }
354
John Reckf47a5942014-06-30 16:20:04 -0700355 static void trimMemory(int level) {
356 nTrimMemory(level);
John Reck84a4c882014-05-30 14:34:03 -0700357 }
358
John Reck66f0be62014-05-13 13:39:31 -0700359 private static class AtlasInitializer {
360 static AtlasInitializer sInstance = new AtlasInitializer();
361
362 private boolean mInitialized = false;
363
364 private AtlasInitializer() {}
365
John Reck3b202512014-06-23 13:13:08 -0700366 synchronized void init(Context context, long renderProxy) {
John Reck66f0be62014-05-13 13:39:31 -0700367 if (mInitialized) return;
368 IBinder binder = ServiceManager.getService("assetatlas");
369 if (binder == null) return;
370
371 IAssetAtlas atlas = IAssetAtlas.Stub.asInterface(binder);
372 try {
373 if (atlas.isCompatible(android.os.Process.myPpid())) {
374 GraphicBuffer buffer = atlas.getBuffer();
375 if (buffer != null) {
376 long[] map = atlas.getMap();
377 if (map != null) {
John Reckb8802b12014-06-16 15:28:50 -0700378 // TODO Remove after fixing b/15425820
379 validateMap(context, map);
John Reck3b202512014-06-23 13:13:08 -0700380 nSetAtlas(renderProxy, buffer, map);
John Reck66f0be62014-05-13 13:39:31 -0700381 mInitialized = true;
382 }
383 // If IAssetAtlas is not the same class as the IBinder
384 // we are using a remote service and we can safely
385 // destroy the graphic buffer
386 if (atlas.getClass() != binder.getClass()) {
387 buffer.destroy();
388 }
389 }
390 }
391 } catch (RemoteException e) {
392 Log.w(LOG_TAG, "Could not acquire atlas", e);
393 }
394 }
John Reckb8802b12014-06-16 15:28:50 -0700395
396 private static void validateMap(Context context, long[] map) {
397 Log.d("Atlas", "Validating map...");
398 HashSet<Long> preloadedPointers = new HashSet<Long>();
399
400 // We only care about drawables that hold bitmaps
401 final Resources resources = context.getResources();
402 final LongSparseArray<Drawable.ConstantState> drawables = resources.getPreloadedDrawables();
403
404 final int count = drawables.size();
405 for (int i = 0; i < count; i++) {
406 final Bitmap bitmap = drawables.valueAt(i).getBitmap();
407 if (bitmap != null && bitmap.getConfig() == Bitmap.Config.ARGB_8888) {
408 preloadedPointers.add(bitmap.mNativeBitmap);
409 }
410 }
411
412 for (int i = 0; i < map.length; i += 4) {
413 if (!preloadedPointers.contains(map[i])) {
414 Log.w("Atlas", String.format("Pointer 0x%X, not in getPreloadedDrawables?", map[i]));
415 map[i] = 0;
416 }
417 }
418 }
John Reck66f0be62014-05-13 13:39:31 -0700419 }
420
John Reck84a4c882014-05-30 14:34:03 -0700421 static native void setupShadersDiskCache(String cacheFile);
422
John Reck3b202512014-06-23 13:13:08 -0700423 private static native void nSetAtlas(long nativeProxy, GraphicBuffer buffer, long[] map);
John Reck4f02bf42014-01-03 18:09:17 -0800424
John Recke45b1fd2014-04-15 09:50:16 -0700425 private static native long nCreateRootRenderNode();
426 private static native long nCreateProxy(boolean translucent, long rootRenderNode);
John Reck4f02bf42014-01-03 18:09:17 -0800427 private static native void nDeleteProxy(long nativeProxy);
428
John Reck18f16e62014-05-02 16:46:41 -0700429 private static native void nSetFrameInterval(long nativeProxy, long frameIntervalNanos);
John Recke4280ba2014-05-05 16:39:37 -0700430 private static native boolean nLoadSystemProperties(long nativeProxy);
John Reck18f16e62014-05-02 16:46:41 -0700431
John Reck4f02bf42014-01-03 18:09:17 -0800432 private static native boolean nInitialize(long nativeProxy, Surface window);
433 private static native void nUpdateSurface(long nativeProxy, Surface window);
John Reckf7d9c1d2014-04-09 10:01:03 -0700434 private static native void nPauseSurface(long nativeProxy, Surface window);
Chris Craik797b95b2014-05-20 18:10:25 -0700435 private static native void nSetup(long nativeProxy, int width, int height,
436 float lightX, float lightY, float lightZ, float lightRadius);
John Reck63a06672014-05-07 13:45:54 -0700437 private static native void nSetOpaque(long nativeProxy, boolean opaque);
John Reckfe5e7b72014-05-23 17:42:28 -0700438 private static native int nSyncAndDrawFrame(long nativeProxy,
John Recke4267ea2014-06-03 15:53:15 -0700439 long frameTimeNanos, long recordDuration, float density);
John Reckfae904d2014-04-14 11:01:57 -0700440 private static native void nDestroyCanvasAndSurface(long nativeProxy);
John Reck4f02bf42014-01-03 18:09:17 -0800441
John Reck3b202512014-06-23 13:13:08 -0700442 private static native void nInvokeFunctor(long functor, boolean waitForCompletion);
John Reck19b6bcf2014-02-14 20:03:38 -0800443
444 private static native long nCreateDisplayListLayer(long nativeProxy, int width, int height);
445 private static native long nCreateTextureLayer(long nativeProxy);
446 private static native boolean nCopyLayerInto(long nativeProxy, long layer, long bitmap);
John Reckd72e0a32014-05-29 18:56:11 -0700447 private static native void nPushLayerUpdate(long nativeProxy, long layer);
448 private static native void nCancelLayerUpdate(long nativeProxy, long layer);
John Reck918ad522014-06-27 14:45:25 -0700449 private static native void nDetachSurfaceTexture(long nativeProxy, long layer);
John Reck28ad7b52014-04-07 16:59:25 -0700450
John Reckf47a5942014-06-30 16:20:04 -0700451 private static native void nDestroyHardwareResources(long nativeProxy);
452 private static native void nTrimMemory(int level);
John Recke1628b72014-05-23 15:11:19 -0700453
John Reck28ad7b52014-04-07 16:59:25 -0700454 private static native void nFence(long nativeProxy);
John Reckf47a5942014-06-30 16:20:04 -0700455 private static native void nStopDrawing(long nativeProxy);
John Recka5dda642014-05-22 15:43:54 -0700456 private static native void nNotifyFramePending(long nativeProxy);
John Reckfe5e7b72014-05-23 17:42:28 -0700457
458 private static native void nDumpProfileInfo(long nativeProxy, FileDescriptor fd);
John Reckcec24ae2013-11-05 13:27:50 -0800459}