Bug 37934

Summary: Corruption with topogun trace
Product: Mesa Reporter: Jose Fonseca <jfonseca>
Component: Drivers/DRI/i965Assignee: Eric Anholt <eric>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: high CC: cworth
Version: gitKeywords: regression
Hardware: x86-64 (AMD64)   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Jose Fonseca 2011-06-04 16:47:39 UTC
Replaying the GL trace
http://people.freedesktop.org/~jrfonseca/traces/topogun-1.06-orc-84k.trace on my 
GM45 shows a lot of corruption.

I've bisected the issue and got

559435d9152acc7162e4e60aae6591c7c6c8274b is the first bad commit
commit 559435d9152acc7162e4e60aae6591c7c6c8274b
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Feb 11 14:45:10 2011 +0000

    i965: emit one vb packet per vbo
    
    Track reuse of the vertex buffer objects and so minimise the number of
    vertex buffers used by the hardware (and their relocations).
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

:040000 040000 f4c57bfa6f3f0cc7707c9814ca7d1bba6698e268 973c72f09fdc31ee413350a1f4a42096f9a82473 M	src
bisect run success

Let me know if you you have any troubles reproducing.
Comment 1 Chris Wilson 2011-06-06 03:20:49 UTC
I admit I don't have the first clue how to replay that trace. Can you give me some pointers?
Comment 2 Jose Fonseca 2011-06-06 03:36:58 UTC
(In reply to comment #1)
> I admit I don't have the first clue how to replay that trace. Can you give me
> some pointers?

Sure. Please do:

  git clone https://github.com/apitrace/apitrace.git
  cd apitrace
  cmake .
  make
  wget http://people.freedesktop.org/~jrfonseca/traces/topogun-1.06-orc-84k.trace
  ./glretrace topogun-1.06-orc-84k.trace

This should reproduce the issue -- the humanoid's face is mostly dark with some bogus coloring instead of shaded grey. I can get a screenshot when I get home.

You can find some more background info about apitrace's tools on the README.  In particular there's a GUI which might be useful for you to pinpoint the problem.
Comment 3 Chris Wilson 2011-06-06 07:53:40 UTC
Thanks, I have the test case running now.
Comment 4 Jose Fonseca 2011-06-07 00:16:02 UTC
The problem is first visible at draw call no 4763. The last correct draw call is 4721. This is what happens in between:

4722 glLightfv(light = GL_LIGHT0, pname = GL_AMBIENT, params = {0, 0, 0, 1})
4723 glLightfv(light = GL_LIGHT0, pname = GL_DIFFUSE, params = {0.392157, 0.392157, 0.392157, 1})
4724 glMaterialfv(face = GL_BACK, pname = GL_DIFFUSE, params = {0.1, 0.1, 0.1, 1})
4725 glMaterialfv(face = GL_FRONT, pname = GL_DIFFUSE, params = {0.392157, 0.392157, 0.392157, 1})
4726 glMaterialfv(face = GL_FRONT, pname = GL_AMBIENT, params = {0, 0, 0, 1})
4727 glMaterialf(face = GL_FRONT, pname = GL_SHININESS, param = 83.2)
4728 glMaterialfv(face = GL_FRONT, pname = GL_SPECULAR, params = {0.0980392, 0.0980392, 0.0980392, 1})
4729 glMatrixMode(mode = GL_PROJECTION)
4730 glLoadIdentity()
4731 glMultMatrixd(m = {4.9588, 0, 0, 0, 0, 7.59575, 0, 0, 0, 0, -1.0002, -1, 0, 0, -0.020002, 0})
4732 glMatrixMode(mode = GL_MODELVIEW)
4733 glPushMatrix()
4734 glLoadIdentity()
4735 glEnable(cap = GL_LIGHT0)
4736 glEnable(cap = GL_LIGHTING)
4737 glTranslatef(x = 0, y = 0, z = -6.23841)
4738 glTranslatef(x = -0, y = -0, z = 0)
4739 glRotated(angle = 15, x = 1, y = 0, z = 0)
4740 glRotated(angle = -45, x = 0, y = 1, z = 0)
4741 glTranslatef(x = -0, y = -0, z = -0)
4742 glDisable(cap = GL_POLYGON_SMOOTH)
4743 glHint(target = GL_POLYGON_SMOOTH_HINT, mode = GL_FASTEST)
4744 glDisable(cap = GL_POINT_SMOOTH)
4745 glDisable(cap = GL_LINE_SMOOTH)
4746 glHint(target = GL_POINT_SMOOTH_HINT, mode = GL_FASTEST)
4747 glHint(target = GL_LINE_SMOOTH_HINT, mode = GL_FASTEST)
4748 glShadeModel(mode = GL_SMOOTH)
4749 glDisable(cap = GL_BLEND)
4750 glUseProgramObjectARB(programObj = 6)
4751 glGetUniformLocationARB(programObj = 6, name = "usetex") = 1
4752 glUniform1iARB(location = 1, v0 = 0)
4753 glEnableClientState(array = GL_VERTEX_ARRAY)
4754 glEnableClientState(array = GL_NORMAL_ARRAY)
4755 glLightfv(light = GL_LIGHT0, pname = GL_DIFFUSE, params = {0.823529, 0.823529, 0.823529, 1})
4756 glMaterialfv(face = GL_FRONT, pname = GL_DIFFUSE, params = {0.823529, 0.823529, 0.823529, 1})
4757 glBindBufferARB(target = GL_ELEMENT_ARRAY_BUFFER, buffer = 5)
4758 glBindBufferARB(target = GL_ARRAY_BUFFER, buffer = 1)
4759 glVertexPointer(size = 3, type = GL_FLOAT, stride = 0, pointer = NULL)
4760 glBindBufferARB(target = GL_ARRAY_BUFFER, buffer = 2)
4761 glNormalPointer(type = GL_FLOAT, stride = 0, pointer = NULL)
4762 glColor3f(red = 1, green = 1, blue = 1)
4763 glDrawElements(mode = GL_TRIANGLES, count = 11904, type = GL_UNSIGNED_SHORT, indices = NULL)

I wonder if the problem is the mixture of a constant vertex attribute (in call 4762) with VBOs. Perhaps your change is not properly tracking the implicit vertex buffer normally created for constant vertex attributes. If so then it might be possible to devise a simpler test case.
Comment 5 Chris Wilson 2011-06-07 01:06:51 UTC
The implicit vbo for the vertex array, should be wrapped up in a DYNAMIC_DRAW and so be treated like any other.

Thanks for your insights. I'm still trying to isolate upon which path it goes wrong.
Comment 6 Eric Anholt 2011-06-17 13:22:10 UTC
Got the fix, posting to the list in a bit.
Comment 7 Jose Fonseca 2011-06-23 01:18:28 UTC
I've confirmed this is now fixed with the tip of master (1ad06c7a2573d2e3a946c8340ce2530c076c5f0b)

Thanks.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.