diff --git a/tools/glesv2debugger/.classpath b/tools/glesv2debugger/.classpath index 1ef2c2042..b9ab6219b 100755 --- a/tools/glesv2debugger/.classpath +++ b/tools/glesv2debugger/.classpath @@ -1,8 +1,9 @@ - + + diff --git a/tools/glesv2debugger/.gitignore b/tools/glesv2debugger/.gitignore new file mode 100644 index 000000000..8c5987be6 --- /dev/null +++ b/tools/glesv2debugger/.gitignore @@ -0,0 +1 @@ +lib/*.jar diff --git a/tools/glesv2debugger/META-INF/MANIFEST.MF b/tools/glesv2debugger/META-INF/MANIFEST.MF index 70b330f55..8848a93bd 100644 --- a/tools/glesv2debugger/META-INF/MANIFEST.MF +++ b/tools/glesv2debugger/META-INF/MANIFEST.MF @@ -9,4 +9,5 @@ Require-Bundle: org.eclipse.ui, Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ClassPath: lib/host-libprotobuf-java-2.3.0-lite.jar, + lib/liblzf.jar, . diff --git a/tools/glesv2debugger/build.properties b/tools/glesv2debugger/build.properties index 6272a3695..8d519093e 100644 --- a/tools/glesv2debugger/build.properties +++ b/tools/glesv2debugger/build.properties @@ -5,4 +5,5 @@ bin.includes = plugin.xml,\ .,\ icons/,\ contexts.xml,\ - lib/host-libprotobuf-java-2.3.0-lite.jar + lib/host-libprotobuf-java-2.3.0-lite.jar,\ + lib/liblzf.jar diff --git a/tools/glesv2debugger/lib/host-libprotobuf-java-2.3.0-lite.jar b/tools/glesv2debugger/lib/host-libprotobuf-java-2.3.0-lite.jar deleted file mode 100644 index 667d407be..000000000 Binary files a/tools/glesv2debugger/lib/host-libprotobuf-java-2.3.0-lite.jar and /dev/null differ diff --git a/tools/glesv2debugger/src/com/android/glesv2debugger/MessageData.java b/tools/glesv2debugger/src/com/android/glesv2debugger/MessageData.java index e62283049..bd032d009 100644 --- a/tools/glesv2debugger/src/com/android/glesv2debugger/MessageData.java +++ b/tools/glesv2debugger/src/com/android/glesv2debugger/MessageData.java @@ -17,13 +17,14 @@ package com.android.glesv2debugger; import com.android.glesv2debugger.DebuggerMessage.Message; +import com.android.glesv2debugger.DebuggerMessage.Message.Function; import org.eclipse.swt.graphics.Device; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.ImageData; public class MessageData { - public Message.Function function; + public final Message msg; public Image image; // texture public String shader; // shader source public String[] columns; @@ -32,11 +33,12 @@ public class MessageData { public GLEnum dataType; // could be float, int; mainly for formatting use public MessageData(final Device device, final Message msg) { + this.msg = msg; image = null; shader = null; data = null; StringBuilder builder = new StringBuilder(); - function = msg.getFunction(); + final Function function = msg.getFunction(); ImageData imageData = null; if (function != Message.Function.ACK) assert msg.hasTime(); diff --git a/tools/glesv2debugger/src/com/android/glesv2debugger/MessageProcessor.java b/tools/glesv2debugger/src/com/android/glesv2debugger/MessageProcessor.java index da6a9b839..a8cdac1c1 100644 --- a/tools/glesv2debugger/src/com/android/glesv2debugger/MessageProcessor.java +++ b/tools/glesv2debugger/src/com/android/glesv2debugger/MessageProcessor.java @@ -30,35 +30,6 @@ public class MessageProcessor { MessageDialog.openError(null, "MessageProcessor", message); } - static byte[] RLEDecode(final byte[] data) { - byte dataSize = data[0]; - int a = data[1] & 0xff, b = data[2] & 0xff, c = data[3] & 0xff, d = data[4] & 0xff; - int count = (d << 24) | (c << 16) | (b << 8) | a; - byte[] buffer = new byte[count * dataSize]; - int write = 0; - int i = 5; - for (i = 5; i < data.length;) { - byte flag = data[i]; - int repeat = (flag & 0x7f) + 1; - assert 0 < repeat && repeat < 129; - i++; - if (0x80 == (flag & 0x80)) { - for (int j = 0; j < repeat; j++) - for (int k = 0; k < dataSize; k++) - buffer[write++] = data[i + k]; - i += dataSize; - } else // literal runs - { - for (int j = 0; j < repeat; j++) - for (int k = 0; k < dataSize; k++) - buffer[write++] = data[i++]; - } - } - assert write == count * dataSize; - assert i == data.length; - return buffer; - } - public static ImageData ReceiveImage(int width, int height, int format, int type, byte[] data) { assert width > 0 && height > 0; @@ -121,9 +92,12 @@ public class MessageProcessor { showError("unsupported texture format: " + format); return null; } - // data = RLEDecode(data); + byte[] pixels = new byte[width * height * (bpp / 8)]; + int decompressed = org.liblzf.CLZF.lzf_decompress(data, data.length, pixels, pixels.length); + assert decompressed == width * height * (bpp / 8); + PaletteData palette = new PaletteData(redMask, greenMask, blueMask); - return new ImageData(width, height, bpp, palette, 1, data); + return new ImageData(width, height, bpp, palette, 1, pixels); } static public float[] ReceiveData(final GLEnum type, final ByteString data) { diff --git a/tools/glesv2debugger/src/com/android/glesv2debugger/MessageQueue.java b/tools/glesv2debugger/src/com/android/glesv2debugger/MessageQueue.java index 454fbf1be..4a5a75011 100644 --- a/tools/glesv2debugger/src/com/android/glesv2debugger/MessageQueue.java +++ b/tools/glesv2debugger/src/com/android/glesv2debugger/MessageQueue.java @@ -90,7 +90,8 @@ public class MessageQueue implements Runnable { DataOutputStream dos = null; HashMap> incoming = new HashMap>(); try { - socket.connect(new java.net.InetSocketAddress("127.0.0.1", 5039)); + socket.connect(new java.net.InetSocketAddress("127.0.0.1", Integer + .parseInt(sampleView.actionPort.getText()))); dis = new DataInputStream(socket.getInputStream()); dos = new DataOutputStream(socket.getOutputStream()); } catch (Exception e) { diff --git a/tools/glesv2debugger/src/com/android/glesv2debugger/SampleView.java b/tools/glesv2debugger/src/com/android/glesv2debugger/SampleView.java index 690556590..fe2e6e6cd 100644 --- a/tools/glesv2debugger/src/com/android/glesv2debugger/SampleView.java +++ b/tools/glesv2debugger/src/com/android/glesv2debugger/SampleView.java @@ -108,6 +108,7 @@ public class SampleView extends ViewPart implements Runnable { Action actionAutoScroll; Action actionFilter; Action actionCapture; + Action actionPort; Point origin = new Point(0, 0); // for smooth scrolling canvas String[] filters = null; @@ -473,6 +474,22 @@ public class SampleView extends ViewPart implements Runnable { manager.update(true); } }); + + actionPort = new Action("5039", Action.AS_DROP_DOWN_MENU) + { + @Override + public void run() { + org.eclipse.jface.dialogs.InputDialog dialog = new org.eclipse.jface.dialogs.InputDialog( + shell, "Port", + "Debugger port", + actionPort.getText(), null); + if (Window.OK == dialog.open()) { + actionPort.setText(dialog.getValue()); + manager.update(true); + } + } + }; + manager.add(actionPort); } private void ConnectDisconnect() { @@ -564,7 +581,7 @@ public class SampleView extends ViewPart implements Runnable { MessageData msgData = (MessageData) objects[i]; if (null == msgData) continue; - totalTime += Float.parseFloat(msgData.columns[1]); + totalTime += msgData.msg.getTime(); } viewer.getTable().getColumn(1).setText(Float.toString(totalTime)); return;