Loading core/java/android/app/ActivityThread.java +1 −1 Original line number Diff line number Diff line Loading @@ -4277,7 +4277,7 @@ public final class ActivityThread { // Enable OpenGL tracing if required if (data.enableOpenGlTrace) { GLUtils.enableTracing(); GLUtils.setTracingLevel(1); } /** Loading core/java/android/ddm/DdmHandleGlTracing.java 0 → 100644 +60 −0 Original line number Diff line number Diff line /* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.ddm; import android.opengl.GLUtils; import org.apache.harmony.dalvik.ddmc.Chunk; import org.apache.harmony.dalvik.ddmc.ChunkHandler; import org.apache.harmony.dalvik.ddmc.DdmServer; import java.nio.ByteBuffer; public class DdmHandleGlTracing extends ChunkHandler { /** GL TRace control packets. Packet data controls starting/stopping the trace. */ public static final int CHUNK_GLTR = type("GLTR"); private static final DdmHandleGlTracing sInstance = new DdmHandleGlTracing(); /** singleton, do not instantiate. */ private DdmHandleGlTracing() {} public static void register() { DdmServer.registerHandler(CHUNK_GLTR, sInstance); } @Override public void connected() { } @Override public void disconnected() { } @Override public Chunk handleChunk(Chunk request) { int type = request.type; if (type != CHUNK_GLTR) { throw new RuntimeException("Unknown packet " + ChunkHandler.name(type)); } ByteBuffer in = wrapChunk(request); GLUtils.setTracingLevel(in.getInt()); return null; // empty response } } core/java/android/ddm/DdmHandleHello.java +15 −8 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ public class DdmHandleHello extends ChunkHandler { private static DdmHandleHello mInstance = new DdmHandleHello(); private static final String[] NATIVE_FEATURES = new String[] { "opengl-tracing" }; /* singleton, do not instantiate */ private DdmHandleHello() {} Loading Loading @@ -149,21 +150,27 @@ public class DdmHandleHello extends ChunkHandler { private Chunk handleFEAT(Chunk request) { // TODO: query the VM to ensure that support for these features // is actually compiled in final String[] features = Debug.getVmFeatureList(); final String[] vmFeatures = Debug.getVmFeatureList(); if (false) Log.v("ddm-heap", "Got feature list request"); int size = 4 + 4 * features.length; for (int i = features.length-1; i >= 0; i--) size += features[i].length() * 2; int size = 4 + 4 * (vmFeatures.length + NATIVE_FEATURES.length); for (int i = vmFeatures.length-1; i >= 0; i--) size += vmFeatures[i].length() * 2; for (int i = NATIVE_FEATURES.length-1; i>= 0; i--) size += NATIVE_FEATURES[i].length() * 2; ByteBuffer out = ByteBuffer.allocate(size); out.order(ChunkHandler.CHUNK_ORDER); out.putInt(features.length); for (int i = features.length-1; i >= 0; i--) { out.putInt(features[i].length()); putString(out, features[i]); out.putInt(vmFeatures.length + NATIVE_FEATURES.length); for (int i = vmFeatures.length-1; i >= 0; i--) { out.putInt(vmFeatures[i].length()); putString(out, vmFeatures[i]); } for (int i = NATIVE_FEATURES.length-1; i >= 0; i--) { out.putInt(NATIVE_FEATURES[i].length()); putString(out, NATIVE_FEATURES[i]); } return new Chunk(CHUNK_FEAT, out); Loading core/java/android/ddm/DdmRegister.java +1 −0 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ public class DdmRegister { DdmHandleNativeHeap.register(); DdmHandleProfiling.register(); DdmHandleExit.register(); DdmHandleGlTracing.register(); DdmServer.registrationComplete(); } Loading core/jni/android/opengl/util.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -557,9 +557,9 @@ void nativeUtilsClassInit(JNIEnv *env, jclass clazz) } extern void setGLDebugLevel(int level); void nativeEnableTracing(JNIEnv *env, jclass clazz) void setTracingLevel(JNIEnv *env, jclass clazz, jint level) { setGLDebugLevel(1); setGLDebugLevel(level); } static int checkFormat(SkBitmap::Config config, int format, int type) Loading Loading @@ -1032,7 +1032,7 @@ static JNINativeMethod gUtilsMethods[] = { { "native_getType", "(Landroid/graphics/Bitmap;)I", (void*) util_getType }, { "native_texImage2D", "(IIILandroid/graphics/Bitmap;II)I", (void*)util_texImage2D }, { "native_texSubImage2D", "(IIIILandroid/graphics/Bitmap;II)I", (void*)util_texSubImage2D }, { "native_enableTracing", "()V", (void*)nativeEnableTracing }, { "setTracingLevel", "(I)V", (void*)setTracingLevel }, }; static JNINativeMethod gEtc1Methods[] = { Loading Loading
core/java/android/app/ActivityThread.java +1 −1 Original line number Diff line number Diff line Loading @@ -4277,7 +4277,7 @@ public final class ActivityThread { // Enable OpenGL tracing if required if (data.enableOpenGlTrace) { GLUtils.enableTracing(); GLUtils.setTracingLevel(1); } /** Loading
core/java/android/ddm/DdmHandleGlTracing.java 0 → 100644 +60 −0 Original line number Diff line number Diff line /* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.ddm; import android.opengl.GLUtils; import org.apache.harmony.dalvik.ddmc.Chunk; import org.apache.harmony.dalvik.ddmc.ChunkHandler; import org.apache.harmony.dalvik.ddmc.DdmServer; import java.nio.ByteBuffer; public class DdmHandleGlTracing extends ChunkHandler { /** GL TRace control packets. Packet data controls starting/stopping the trace. */ public static final int CHUNK_GLTR = type("GLTR"); private static final DdmHandleGlTracing sInstance = new DdmHandleGlTracing(); /** singleton, do not instantiate. */ private DdmHandleGlTracing() {} public static void register() { DdmServer.registerHandler(CHUNK_GLTR, sInstance); } @Override public void connected() { } @Override public void disconnected() { } @Override public Chunk handleChunk(Chunk request) { int type = request.type; if (type != CHUNK_GLTR) { throw new RuntimeException("Unknown packet " + ChunkHandler.name(type)); } ByteBuffer in = wrapChunk(request); GLUtils.setTracingLevel(in.getInt()); return null; // empty response } }
core/java/android/ddm/DdmHandleHello.java +15 −8 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ public class DdmHandleHello extends ChunkHandler { private static DdmHandleHello mInstance = new DdmHandleHello(); private static final String[] NATIVE_FEATURES = new String[] { "opengl-tracing" }; /* singleton, do not instantiate */ private DdmHandleHello() {} Loading Loading @@ -149,21 +150,27 @@ public class DdmHandleHello extends ChunkHandler { private Chunk handleFEAT(Chunk request) { // TODO: query the VM to ensure that support for these features // is actually compiled in final String[] features = Debug.getVmFeatureList(); final String[] vmFeatures = Debug.getVmFeatureList(); if (false) Log.v("ddm-heap", "Got feature list request"); int size = 4 + 4 * features.length; for (int i = features.length-1; i >= 0; i--) size += features[i].length() * 2; int size = 4 + 4 * (vmFeatures.length + NATIVE_FEATURES.length); for (int i = vmFeatures.length-1; i >= 0; i--) size += vmFeatures[i].length() * 2; for (int i = NATIVE_FEATURES.length-1; i>= 0; i--) size += NATIVE_FEATURES[i].length() * 2; ByteBuffer out = ByteBuffer.allocate(size); out.order(ChunkHandler.CHUNK_ORDER); out.putInt(features.length); for (int i = features.length-1; i >= 0; i--) { out.putInt(features[i].length()); putString(out, features[i]); out.putInt(vmFeatures.length + NATIVE_FEATURES.length); for (int i = vmFeatures.length-1; i >= 0; i--) { out.putInt(vmFeatures[i].length()); putString(out, vmFeatures[i]); } for (int i = NATIVE_FEATURES.length-1; i >= 0; i--) { out.putInt(NATIVE_FEATURES[i].length()); putString(out, NATIVE_FEATURES[i]); } return new Chunk(CHUNK_FEAT, out); Loading
core/java/android/ddm/DdmRegister.java +1 −0 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ public class DdmRegister { DdmHandleNativeHeap.register(); DdmHandleProfiling.register(); DdmHandleExit.register(); DdmHandleGlTracing.register(); DdmServer.registrationComplete(); } Loading
core/jni/android/opengl/util.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -557,9 +557,9 @@ void nativeUtilsClassInit(JNIEnv *env, jclass clazz) } extern void setGLDebugLevel(int level); void nativeEnableTracing(JNIEnv *env, jclass clazz) void setTracingLevel(JNIEnv *env, jclass clazz, jint level) { setGLDebugLevel(1); setGLDebugLevel(level); } static int checkFormat(SkBitmap::Config config, int format, int type) Loading Loading @@ -1032,7 +1032,7 @@ static JNINativeMethod gUtilsMethods[] = { { "native_getType", "(Landroid/graphics/Bitmap;)I", (void*) util_getType }, { "native_texImage2D", "(IIILandroid/graphics/Bitmap;II)I", (void*)util_texImage2D }, { "native_texSubImage2D", "(IIIILandroid/graphics/Bitmap;II)I", (void*)util_texSubImage2D }, { "native_enableTracing", "()V", (void*)nativeEnableTracing }, { "setTracingLevel", "(I)V", (void*)setTracingLevel }, }; static JNINativeMethod gEtc1Methods[] = { Loading