Quoting Agdr:
That's a great idea. I'd be interested in implementing OpenGL extensions. If only I could manage to figure out the gory details.
Here's a rough plan how I'd go about adding an extension to r600g.
Step 0: Read the FAQ
Mesa FAQ. Join the mailing list.
Radeon Architecture
Gallium3d documentation, and whatever else you can find
Step 1: Figure out what's missing
Running an application I see this warning:
EE r600_screen.c/r600_get_param:109 - r600: unknown param 9
Looking at r600_screen.c r600_get_param, then at include/pipe/p_defines.h enum pipe_cap tells me that param 9 is
PIPE_CAP_TIMER_QUERY.
Step 2: Find out what this should do
GL_EXT_timer_query
Step 3: Find out what the hardware offers
Searching for "time" points to the Event Initiator.
There are four instructions that return timestamps:
* 04 - CACHE_FLUSH_TS
* 20 - CACHE_FLUSH_AND_INV_TS_EVENT
* 37 - CR_DONE_TS
* 40 - BOTTOM_OF_PIPE_TS
Quoting GL_EXT_timer_query spec, "In this extension, the timers start and stop when the BeginQuery/EndQuery commands reach the bottom of the rendering pipeline."
Looks like 40 - BOTTOM_OF_PIPE_TS might be a good candidate.
Step 4: Look for prior art
Mathias Fr?hlich, EXT_timer_query softpipe implementation
So, there's no hardware implementation we could copy from. The software implementation isn't much help in writing the needed asynchronous query mechanism from scratch. But maybe there's such a mechanism in a similar extension?
Quoting the spec, "This extension (..) uses the query object mechanisms first introduced in the occlusion query extension, which allow time intervals to be polled asynchronously by the application."
Stephan Schmid and Alex Deucher, occlusion query support
Step 5: Implementation
At this point, it looks like most of the work is copy and paste:
Copy the occlusion query implementation.
Replace ZPASS_DONE with BOTTOM_OF_PIPE_TS.
Return timestamps instead of ZPASS counters.
Add capabilities.
Step 6: Test
Looks like it's already there, no need to write from scratch
Mathias Fr?hlich and Brian Paul, Simple test for GL_EXT_timer_query
Step 7: Submit to Mesa-dev
Originally posted by Agdr
Here's a rough plan how I'd go about adding an extension to r600g.
Step 0: Read the FAQ
Mesa FAQ. Join the mailing list.
Radeon Architecture
Gallium3d documentation, and whatever else you can find
Step 1: Figure out what's missing
Running an application I see this warning:
EE r600_screen.c/r600_get_param:109 - r600: unknown param 9
Looking at r600_screen.c r600_get_param, then at include/pipe/p_defines.h enum pipe_cap tells me that param 9 is
PIPE_CAP_TIMER_QUERY.
Step 2: Find out what this should do
GL_EXT_timer_query
Step 3: Find out what the hardware offers
Searching for "time" points to the Event Initiator.
There are four instructions that return timestamps:
* 04 - CACHE_FLUSH_TS
* 20 - CACHE_FLUSH_AND_INV_TS_EVENT
* 37 - CR_DONE_TS
* 40 - BOTTOM_OF_PIPE_TS
Quoting GL_EXT_timer_query spec, "In this extension, the timers start and stop when the BeginQuery/EndQuery commands reach the bottom of the rendering pipeline."
Looks like 40 - BOTTOM_OF_PIPE_TS might be a good candidate.
Step 4: Look for prior art
Mathias Fr?hlich, EXT_timer_query softpipe implementation
So, there's no hardware implementation we could copy from. The software implementation isn't much help in writing the needed asynchronous query mechanism from scratch. But maybe there's such a mechanism in a similar extension?
Quoting the spec, "This extension (..) uses the query object mechanisms first introduced in the occlusion query extension, which allow time intervals to be polled asynchronously by the application."
Stephan Schmid and Alex Deucher, occlusion query support
Step 5: Implementation
At this point, it looks like most of the work is copy and paste:
Copy the occlusion query implementation.
Replace ZPASS_DONE with BOTTOM_OF_PIPE_TS.
Return timestamps instead of ZPASS counters.
Add capabilities.
Step 6: Test
Looks like it's already there, no need to write from scratch
Mathias Fr?hlich and Brian Paul, Simple test for GL_EXT_timer_query
Step 7: Submit to Mesa-dev
Comment