[Mesa-dev] [RFC] New gallium flags for using different contexts in several threads

Ilia Mirkin imirkin at alum.mit.edu
Sun Dec 18 17:52:12 UTC 2016


On Sun, Dec 18, 2016 at 12:43 PM, Nicolai Hähnle <nhaehnle at gmail.com> wrote:
> On 18.12.2016 17:40, Axel Davy wrote:
>>
>> On 18/12/2016 16:57, Nicolai Hähnle wrote:
>>>
>>>
>>>
>>> I'm happy to be convinced otherwise if I missed something, but using
>>> multiple contexts from different threads, or using Map/UnmapBuffer
>>> from one context but sourcing the buffer from draw calls in another
>>> context are all perfectly supported OpenGL use cases.
>>
>> There is also the case of having persistent coherent buffer mapped with
>> one context, and used with another one.
>> If implementation of coherent requires driver flushes the range at draw
>> calls, I guess it may not work as is with the multi context scenerio
>> (looking at nouveau, it seems to check if the buffer is mapped in
>> current context for example, not for all possible contexts)
>
>
> That sounds like a bug in nouveau, if true. The mapping state of a buffer
> object is per-buffer object, not per-context, at least in OpenGL.

I'm not aware of anything offhand that would cause this. If a buffer
is mapped coherently, we always flush everything if there's any hint
of it being bound in the context when there's a draw. If it's not
mapped coherently (but persistently), we rely on the update
notification thing to mark which buffers are dirty and thus cause
things to get flushed out. I only roughly remember how this works, but
I could imagine a situation where updating a
persistent-but-not-coherent buffer in one context (and never drawing)
and then using it in another could miss some necessary cache flushes.
However it shouldn't be difficult to fix if that does indeed happen,
esp if a piglit came along exercising that.

  -ilia


More information about the mesa-dev mailing list