janesma / apitrace

for developing frame trace features
24 stars 16 forks source link

Bargraph and bottom scroll interaction in certain levels of zoom #23

Open cefiar opened 6 years ago

cefiar commented 6 years ago

I've noticed the following behaviour when adjusting the slider on the bargraph at certain levels of zoom when there are a lot of bars.

  1. Zoom in a fair amount but not all the way.
  2. Drag the slider to the far right, as much as possible.
  3. Select the bar most visible on the right with the mouse.
  4. Using the right arrow, navigate beyond the right of the right-most bar (off the right edge).
  5. Depending on the zoom, you sometimes see info for bars that aren't actually on screen but that do exist. You can also step back into view using the left arrow.

Same happens on the left side too, swapping left in right in the above example.

Basically seems as though the scroll bar at the bottom is not allowing movement to the full extent of left and right when zoomed out.

janesma commented 6 years ago

This is a bug in the zoom factor that sizes the scroll bar. As you can tell from the UI, it's all custom-built nastiness. I'll see if I can improve it.

janesma commented 6 years ago

Hmm, I'm having trouble reproducing this. I can see an effect like this if the horizontal metric is something with a very small value (and the bar is 0 or 1 pixel). The bar is simply not visible (eg, the swapbuffers at the end of the frame has no GPU cost).

If I choose a metric that has a reasonable value (or "No Metric" which has constant width), the bar at the edge of the graph is visible regardless of the zooming, when I drag the scroll to the edge.

Can you give me a more specific repro case? A trace/frame and zoom level that I can use to fix this?

thanks!

cefiar commented 6 years ago

Haven't got one out of the box but I'll see if I can work out a test case, preferably with a small trace file. ;)

cefiar commented 6 years ago

Just a quick update:

This is what I find reproduces the effect: Zoom in so each bar is about 15-20 pixels wide. Move all the way to the end of the trace (by dragging the scroll bar to the right)/ Highlight a bar near the right side of the trace (3 or 4 away), then zoom in again a small amount so that a bar to the right of the highlighted one partially obscured by the legend to the right of the graph. I then try and drag the scroll bar to the right and nothing changes on screen.

FWIW: I'm zooming using scroll-wheel on my mouse.

If I drag the scroll bar to the left so the highlighted bar goes off screen, then drag the scroll bar to the right, I get extra bars that I didn't see before.

It's like changing zoom isn't resetting the "visual" bounds of the scroll bar or something, so the scroll bar thinks there is still nothing to the right. When this happens, sometimes I can visually see part of a bar divided by the legend on the right of the bargraph (0.00->1.00).

I have some screenshots:

  1. After dragging the scrollbar to the right the first time. Note the bar 'half' shown by the legend to the right of the bargraph: https://img42.com/V0dyo+
  2. After dragging the scrollbar left then right a fair amount, the right edge resets: https://img42.com/VpCaC+

During testing, I also noticed the following error on the console (may or may not be related): file:///usr/lib/x86_64-linux-gnu/qt5/qml/QtQuick/Controls/ApplicationWindow.qml:240:9: QML ContentItem: Binding loop detected for property "implicitWidth"

Note: This is using a build from commit f710f4d256c035b4f8a126a1d7fc775578037f96

cefiar commented 6 years ago

Ok, I debugged it using a small trace of glxgears (using apitrace trace glxgears).

In some cases, it seems that if any part of that bar is visible at all, you can't drag the bar right. If you drag it left then right, the whole bar then becomes visible.

Example 1: Opened the trace for frames 1-20. No metrics selected. I then highlighted the 4th bar from the right side and zoomed in. When I zoomed in using the scroll wheel on my mouse, the right-most bar slowly slips behind the legend on the right of the bargraph. Try dragging the scrollbar right. Repeat.

Example 2: Same file, same frames. Vertical metric: N primitives entering clipping Horizontal metric: N z-pass fragments Click the biggest graph bar on the far right of the graph (should be followed by 2 small bars). Click the + zoom button once, drag the scrollbar to all the way to the right (don't go left at all). After about 13 times, you will find you can't drag the bar to the right to see the last bar anymore (1 short bar will be visible instead of 2). If you drag the scrollbar left a fair amount then right it will show the last bar again.