On Fri, Apr 17, 2009 at 2:22 PM, Thomas Hellstrom <[email protected]> wrote:
> Ideally this flushing would've been done in the various map operations within 
> the pipe driver as you say, but
> unfortunately these map operations are screen operations, so the pipe driver 
> doesn't know which context to flush in a multi-threaded environment.
> Usually drivers wait for fence in a map operation but there is no fence if 
> the draw commands affecting the buffer have not been flushed => Rendering 
> errors.

For each buffer we keep track of which command buf it has been
referenced in and which context that command buf belongs to. So when
we map we check if the buffer has been referenced in a command buf and
flush the context that owns it and associate the resulting fences with
the buffer and wait on them. If the buffer isn't referenced but is
fenced then we just wait on them as usual.

Not sure how we keep track if a buffer is referenced in more than one
unflushed context though, the current code doesn't seem to handle
that, based on my quick look. I'll have to ask Ben.

> Also the semantics for this will vary for different state-trackers. For 
> OpenGL it's sufficient to flush the current context of the
> thread doing the map operation, since there can only be one context with 
> unflushed data per thread.
> Other threads are required to synchronize in the application to avoid clashes.
>
> For other state trackers the situation will be different, although I'm no 
> expert in this field we have a couple of them in-house.
>
> So to summarize:
> 1) We need to know what context to flush before mapping. Only the 
> state-tracker knows that.
> 2) Different state-trackers have different requirements.
>
> I'm attaching a program "flush_teximage", which will expose the problem.
> Run with flush_teximage -subimage and you'll probably see the rendering error 
> without this fix.

You forgot to attach it. I'd like to give it a try if you still have
it around somewhere.

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to