st-api: Rework how drawables are invalidated v3.

The api and the state tracker manager code as well as the state tracker code
assumed that only a single context could be bound to a drawable. That is not
a valid assumption, since multiple contexts can bind to the same drawable.

Fix this by making it the state tracker's responsibility to update all
contexts binding to a drawable

Note that the state trackers themselves don't use atomic stamps on
frame-buffers. Multiple context rendering to the same drawable should
be protected by the application.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
This commit is contained in:
Thomas Hellstrom
2011-06-29 09:00:23 +02:00
parent 1a7e17e44a
commit ac8fdbc1c7
14 changed files with 123 additions and 122 deletions

View File

@@ -252,6 +252,12 @@ struct st_context_attribs
*/
struct st_framebuffer_iface
{
/**
* Atomic stamp which changes when framebuffers need to be updated.
*/
int32_t stamp;
/**
* Available for the state tracker manager to use.
*/
@@ -314,25 +320,6 @@ struct st_context_iface
*/
void (*destroy)(struct st_context_iface *stctxi);
/**
* Invalidate the current textures that was taken from a framebuffer.
*
* The state tracker manager calls this function to let the rendering
* context know that it should update the textures it got from
* st_framebuffer_iface::validate. It should do so at the latest time possible.
* Possible right before sending triangles to the pipe context.
*
* For certain platforms this function might be called from a thread other
* than the thread that the context is currently bound in, and must
* therefore be thread safe. But it is the state tracker manager's
* responsibility to make sure that the framebuffer is bound to the context
* and the API context is current for the duration of this call.
*
* Thus reducing the sync primitive needed to a single atomic flag.
*/
void (*notify_invalid_framebuffer)(struct st_context_iface *stctxi,
struct st_framebuffer_iface *stfbi);
/**
* Flush all drawing from context to the pipe also flushes the pipe.
*/