Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

Using renouveau

How does the video card work?

NVidia hardware has multiple FIFOs (also called a "channel"). Each FIFO has a 8 "slots" (or "subchannels") to which you can assign objects. A command in a DMA buffer says what subchannel the command is for, and the combination of the offset in the command and the object bound to the subchannel determines what the GPU does.

There are multiple ways for the CPU to send graphics commands to a video card.

main.c basically initializes everything (from SDL to the mappings of the card into the program's address space and then calls a test function like test_default(). All tests can be found in test.c, let's have a look at the default test, which simply draw a triangle on the screen.

   void test_default(void)
   {
      TEST_PROLOGUE;
      printf("Testing default state of OpenGL context\n");
      dump_before();
      tri();
      dump_after();
      TEST_EPILOGUE;
   }

So basically in order to figure out new functionality using renouveau, a simple scheme can be followed :

Format of the fifo

Although registers don't have a rigid format (it's just an array of values), the fifo contents has a strict packet format described as follows : For example, {0x00043808,0x00000005} can be interpreted as follows :

A sample renouveau dump

So, you have everything compiled, have your research topic selected but still need some help? Well first go to main.c comment in the call to test_default() and decomment the test you are looking for. Compile it and run it:
br:~> ./renouveau >mydump1
Depending on the kind of test you choose, the output will be quite long, so better dump it to a file.

Now, let's say you have chosen test_clip_plane(), which defines parameters for 1 - maxClipPlanes and enables all clip planes, which were defined.

if you are using a Gforce 6600 you would see something like this (reduced to the output of 1 plane):

f96   0x00000000   0x0000002c   NV30_TCL_PRIMITIVE_3D_VP_UPLOAD_CONST         = 0x0000002c
f97   0x00000000   0x00000000            NV30_TCL_PRIMITIVE_3D      [0x1f00/4] = 0x00000000
f98   0x00000000   0x3c23d70a            NV30_TCL_PRIMITIVE_3D      [0x1f04/4] = 0x3c23d70a | UNKNOWN = 3c23d70a
f99   0x00000000   0x3ca3d70a            NV30_TCL_PRIMITIVE_3D      [0x1f08/4] = 0x3ca3d70a | UNKNOWN = 3ca3d70a
f9a   0x00000000   0x3cf5c28f            NV30_TCL_PRIMITIVE_3D      [0x1f0c/4] = 0x3cf5c28f | UNKNOWN = 3cf5c28f
...
fb9   0x00000000   0x00043478             {size: 0x1   channel: 0x1   obj: beef3097 opcode: METHOD }
fba   0x00000000   0x00000002            NV30_TCL_PRIMITIVE_3D      [0x1478/4] = 0x00000002 | UNKNOWN = 00000002
We are looking for some unknown command, often called NV30_TCL_PRIMITIVE_3D (Family name may change). If you compare the data from f97 to f9a with the data the test will send to the card, it becomes clear, that 0x00000000 = 0.0f, 0x3c23d70a = 0.01f, 0x3ca3d70a = 0.02f and 0x3cf5c28f = 0.03f, exactly the data, the program sent for plane 0. [0x1478/4] is still unclear, but could have something to do with the enabling of the clip plane.

Please note:Since I wrote the doc, the code changed somewhat, this is how the code looked like at the time:

void test_clip_plane()
{
	TEST_PROLOGUE;
	int i, j, m;
	GLdouble planes[4*6]={
		0.0, 0.01, 0.02, 0.03,
		0.04, 0.05, 0.06, 0.07,
		0.08, 0.09, 0.10, 0.11,
		0.12, 0.13, 0.14, 0.15,
		0.16, 0.17, 0.18, 0.19,
		0.20, 0.21, 0.22, 0.23
	};
	printf("Clipping planes after short vertex program test\n");
	regl.GetIntegerv(GL_MAX_CLIP_PLANES, &m);
	printf("%d clip planes available\n", m);
	for (i=1; i<=m; i++) {
		printf("%d clip planes.\n", i);

		dump_before();
		for (j=0;j < i;j++) {
			regl.Enable(GL_CLIP_PLANE0+j);
			regl.ClipPlane(GL_CLIP_PLANE0+j,&planes[j*4]);
		}
		tri();
		for (j=0;j<i;j++) {
			regl.Disable(GL_CLIP_PLANE0+j);
		}
		dump_after(0);
	}
	TEST_EPILOGUE;

}
   

If you look at the enabling of the second plane further down, you will see again the same lines from above, but with a difference:

10fd   0x00000000   0x0000002c   NV30_TCL_PRIMITIVE_3D_VP_UPLOAD_CONST         = 0x0000002c
10fe   0x00000000   0x00000000            NV30_TCL_PRIMITIVE_3D      [0x1f00/4] = 0x00000000
10ff   0x00000000   0x3c23d70a            NV30_TCL_PRIMITIVE_3D      [0x1f04/4] = 0x3c23d70a | UNKNOWN = 3c23d70a
1100   0x00000000   0x3ca3d70a            NV30_TCL_PRIMITIVE_3D      [0x1f08/4] = 0x3ca3d70a | UNKNOWN = 3ca3d70a
1101   0x00000000   0x3cf5c28f            NV30_TCL_PRIMITIVE_3D      [0x1f0c/4] = 0x3cf5c28f | UNKNOWN = 3cf5c28f
1102   0x00000000   0x00143efc             {size: 0x5   channel: 0x1   obj: beef3097 opcode: METHOD }
1103   0x00000000   0x0000002d   NV30_TCL_PRIMITIVE_3D_VP_UPLOAD_CONST         = 0x0000002d
1104   0x00000000   0x3d23d70a            NV30_TCL_PRIMITIVE_3D      [0x1f00/4] = 0x3d23d70a | UNKNOWN = 3d23d70a
1105   0x00000000   0x3d4ccccd            NV30_TCL_PRIMITIVE_3D      [0x1f04/4] = 0x3d4ccccd | UNKNOWN = 3d4ccccd
1106   0x00000000   0x3d75c28f            NV30_TCL_PRIMITIVE_3D      [0x1f08/4] = 0x3d75c28f | UNKNOWN = 3d75c28f
1107   0x00000000   0x3d8f5c29            NV30_TCL_PRIMITIVE_3D      [0x1f0c/4] = 0x3d8f5c29 | UNKNOWN = 3d8f5c29
1108   0x00000000   0x00143efc             {size: 0x5   channel: 0x1   obj: beef3097 opcode: METHOD }
...
1121   0x00000000   0x00000022            NV30_TCL_PRIMITIVE_3D      [0x1478/4] = 0x00000022 | UNKNOWN = 00000022

Ok, a new row of values under a new NV30_TCL_PRIMITIVE_3D_VP_UPLOAD_CONST. Yes, that is the data the program sent for plane 1 and [0x1478/4] changed to 0x00000022. Seems as if bit 1 (3) is enabling plane 0 (plane 1). So time to check for the other planes, too...

Help, I can't figure it out

If there is no deducable pattern in the output, please verify: Still no idea? Except for changing the GPU, try the tricks from above, they may give you some clues.

If you are sure about your findings, report back to the developers, they will tell you what to do next (Hint: a patch would probably be welcome)


Generated on Sat Aug 19 20:40:54 2006 for Renouveau by  doxygen 1.4.4