aboutsummaryrefslogtreecommitdiffstats
path: root/eclipse/plugins/com.android.ide.eclipse.gldebugger
diff options
context:
space:
mode:
authorSiva Velusamy <vsiva@google.com>2012-01-27 12:22:33 -0800
committerSiva Velusamy <vsiva@google.com>2012-01-27 12:29:45 -0800
commit1d286dc8b0ef64b9771f3fb6a11a8eddc58ea3a4 (patch)
treece9105dcbdc4d99585413a0ee06be02b2f1533b3 /eclipse/plugins/com.android.ide.eclipse.gldebugger
parent32456409b8351a80d55e3b94c2a25d7117c970aa (diff)
downloadsdk-1d286dc8b0ef64b9771f3fb6a11a8eddc58ea3a4.zip
sdk-1d286dc8b0ef64b9771f3fb6a11a8eddc58ea3a4.tar.gz
sdk-1d286dc8b0ef64b9771f3fb6a11a8eddc58ea3a4.tar.bz2
gltrace: color glDraw() functions differently
This patch makes the glDraw*() calls stand out in the table and in the duration minimap by coloring them differently than the rest of the functions. This patch also changes displays the contents of the framebuffer in the framebuffer view as soon as a frame is selected (as opposed to updating the view only when the eglSwapBuffer function is selected). Change-Id: I749e277e468003612895c45d90a5874b2a84e4d3
Diffstat (limited to 'eclipse/plugins/com.android.ide.eclipse.gldebugger')
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/DurationMinimap.java16
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/GLFunctionTraceViewer.java70
2 files changed, 66 insertions, 20 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/DurationMinimap.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/DurationMinimap.java
index 88a8e31..b408d68 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/DurationMinimap.java
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/DurationMinimap.java
@@ -16,6 +16,7 @@
package com.android.ide.eclipse.gltrace.editors;
+import com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.Function;
import com.android.ide.eclipse.gltrace.model.GLCall;
import com.android.ide.eclipse.gltrace.model.GLTrace;
@@ -77,6 +78,7 @@ public class DurationMinimap extends Canvas {
private Color mBackgroundColor;
private Color mDurationLineColor;
+ private Color mGlDrawColor;
private Color mContextHeaderColor;
private Color mVisibleCallsHighlightColor;
private Color mMouseMarkerColor;
@@ -167,7 +169,8 @@ public class DurationMinimap extends Canvas {
private void initializeColors() {
mBackgroundColor = new Color(getDisplay(), 0x33, 0x33, 0x33);
- mDurationLineColor = new Color(getDisplay(), 0x21, 0x66, 0xac);
+ mDurationLineColor = new Color(getDisplay(), 0x08, 0x51, 0x9c);
+ mGlDrawColor = new Color(getDisplay(), 0x6b, 0xae, 0xd6);
mContextHeaderColor = new Color(getDisplay(), 0xd1, 0xe5, 0xf0);
mVisibleCallsHighlightColor = new Color(getDisplay(), 0xcc, 0xcc, 0xcc);
mMouseMarkerColor = new Color(getDisplay(), 0xaa, 0xaa, 0xaa);
@@ -176,6 +179,7 @@ public class DurationMinimap extends Canvas {
private void disposeColors() {
mBackgroundColor.dispose();
mDurationLineColor.dispose();
+ mGlDrawColor.dispose();
mContextHeaderColor.dispose();
mVisibleCallsHighlightColor.dispose();
mMouseMarkerColor.dispose();
@@ -294,12 +298,22 @@ public class DurationMinimap extends Canvas {
int callUnderScan = mPositionHelper.getCallUnderScanValue();
for (int i = mStartCallIndex; i < mEndCallIndex; i += callUnderScan) {
+ boolean resetColor = false;
GLCall c = mCalls.get(i);
+ if (c.getFunction() == Function.glDrawArrays
+ || c.getFunction() == Function.glDrawElements) {
+ gc.setBackground(mGlDrawColor);
+ resetColor = true;
+ }
Rectangle bounds = mPositionHelper.getDurationBounds(
i - mStartCallIndex,
c.getContextId(),
c.getDuration());
gc.fillRectangle(bounds);
+
+ if (resetColor) {
+ gc.setBackground(mDurationLineColor);
+ }
}
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/GLFunctionTraceViewer.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/GLFunctionTraceViewer.java
index bbb668f..a98bdb0 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/GLFunctionTraceViewer.java
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/GLFunctionTraceViewer.java
@@ -16,6 +16,7 @@
package com.android.ide.eclipse.gltrace.editors;
+import com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.Function;
import com.android.ide.eclipse.gltrace.SwtUtils;
import com.android.ide.eclipse.gltrace.TraceFileParserTask;
import com.android.ide.eclipse.gltrace.editors.DurationMinimap.ICallSelectionListener;
@@ -25,6 +26,9 @@ import com.android.ide.eclipse.gltrace.model.GLTrace;
import com.android.ide.eclipse.gltrace.views.GLFramebufferView;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.viewers.CellLabelProvider;
@@ -43,6 +47,8 @@ import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
@@ -77,8 +83,6 @@ public class GLFunctionTraceViewer extends EditorPart implements ISelectionProvi
private static final String DEFAULT_FILTER_MESSAGE = "Filter list of OpenGL calls. Accepts Java regexes.";
- // TODO: The thumbnail width & height are constant right now, but should be scaled
- // based on the size of the viewport/device.
/** Width of thumbnail images of the framebuffer. */
private static final int THUMBNAIL_WIDTH = 50;
@@ -94,6 +98,8 @@ public class GLFunctionTraceViewer extends EditorPart implements ISelectionProvi
private Text mFilterText;
private GLCallFilter mGLCallFilter;
+ private Color mGldrawTextColor;
+
// Currently displayed frame's start and end call indices.
private int mCallStartIndex;
private int mCallEndIndex;
@@ -102,6 +108,7 @@ public class GLFunctionTraceViewer extends EditorPart implements ISelectionProvi
private ScrollBar mVerticalScrollBar;
public GLFunctionTraceViewer() {
+ mGldrawTextColor = Display.getDefault().getSystemColor(SWT.COLOR_BLUE);
}
@Override
@@ -225,9 +232,18 @@ public class GLFunctionTraceViewer extends EditorPart implements ISelectionProvi
mFrameSelectionSpinner.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
+ // Disable spinner until all necessary action is complete.
+ // This seems to be necessary (atleast on Linux) for the spinner to not get
+ // stuck in a pressed state if it is pressed for more than a few seconds
+ // continuously.
+ mFrameSelectionSpinner.setEnabled(false);
+
int selectedFrame = mFrameSelectionSpinner.getSelection();
mFrameSelectionScale.setSelection(selectedFrame);
selectFrame(selectedFrame);
+
+ // re-enable spinner
+ mFrameSelectionSpinner.setEnabled(true);
}
});
}
@@ -241,7 +257,7 @@ public class GLFunctionTraceViewer extends EditorPart implements ISelectionProvi
mFrameSelectionScale.setSelection(selectedFrame);
mFrameSelectionSpinner.setSelection(selectedFrame);
- List<GLCall> glcalls = mTrace.getGLCallsForFrame(selectedFrame - 1);
+ final List<GLCall> glcalls = mTrace.getGLCallsForFrame(selectedFrame - 1);
mFrameTableViewer.setInput(glcalls);
mFrameTableViewer.refresh();
@@ -249,6 +265,30 @@ public class GLFunctionTraceViewer extends EditorPart implements ISelectionProvi
mCallStartIndex = f.getStartIndex();
mCallEndIndex = f.getEndIndex();
mDurationMinimap.setCallRangeForCurrentFrame(mCallStartIndex, mCallEndIndex);
+
+ // update framebuffer view
+ Job job = new Job("Update Framebuffer view") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ if (glcalls.size() == 0) {
+ return Status.OK_STATUS;
+ }
+
+ GLCall lastCallInFrame = glcalls.get(glcalls.size() - 1);
+ final Image image = mTrace.getImage(lastCallInFrame);
+
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ displayFB(image);
+ }
+ });
+
+ return Status.OK_STATUS;
+ }
+ };
+ job.setPriority(Job.SHORT);
+ job.schedule();
}
private void createFilterBar(Composite parent) {
@@ -321,20 +361,6 @@ public class GLFunctionTraceViewer extends EditorPart implements ISelectionProvi
mFrameTableViewer.setContentProvider(new GLFrameContentProvider());
- table.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetDefaultSelected(SelectionEvent event) {
- int []indices = table.getSelectionIndices();
- if (indices.length != 1) {
- return;
- }
-
- int selectedIndex = indices[0];
- GLCall glCall = (GLCall) table.getItem(selectedIndex).getData();
- displayFB(glCall);
- }
- });
-
mGLCallFilter = new GLCallFilter();
mFrameTableViewer.addFilter(mGLCallFilter);
@@ -381,7 +407,7 @@ public class GLFunctionTraceViewer extends EditorPart implements ISelectionProvi
mDurationMinimap.setVisibleCallRange(visibleCallTopIndex, visibleCallBottomIndex);
}
- private void displayFB(GLCall glCall) {
+ private void displayFB(Image image) {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {
return;
@@ -397,7 +423,7 @@ public class GLFunctionTraceViewer extends EditorPart implements ISelectionProvi
return;
}
- v.displayFB(mTrace.getImage(glCall));
+ v.displayFB(image);
}
private GLFramebufferView displayFBView(IWorkbenchPage page) {
@@ -447,6 +473,12 @@ public class GLFunctionTraceViewer extends EditorPart implements ISelectionProvi
}
GLCall c = (GLCall) element;
+
+ if (c.getFunction() == Function.glDrawArrays
+ || c.getFunction() == Function.glDrawElements) {
+ cell.setForeground(mGldrawTextColor);
+ }
+
cell.setText(getColumnText(c, cell.getColumnIndex()));
}