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

Axel Davy axel.davy at ens.fr
Sun Dec 18 16:37:04 UTC 2016


On 18/12/2016 16:57, Nicolai Hähnle wrote:
> On 18.12.2016 13:38, Axel Davy wrote:
>> Currently there is no real specification on what is allowed for
>> using different contexts in several threads, or when you
>> map/unmap a resource in a thread, but uses it in another for
>> draw calls.
>>
>> For the gallium nine CSMT patchset, I've figured out it would be better
>> to add flags to describe what is allowed.
>>
>> Please comment.
>
> I don't see the point of this. All existing drivers must already 
> support the multi-threading scenarios described in the commits, 
> because they can happen as part of correct use of OpenGL. If drivers 
> don't support them, then they're already broken.
>
Some drivers aren't thread safe. For example nouveau isn't. I guess 
other drivers may be.
> 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.
For some drivers and combination flags, map gives a staging buffer and 
unmap does trigger a copy of it to the real buffer. This is not 
neccessarily flushed. I'd like this flush to be implicit, because if we 
can avoid it (most of the cases) it's better.

Axel
>
> Nicolai
>
>>
>> Yours,
>>
>> Axel Davy
>>
>> Axel Davy (3):
>>   gallium: add PIPE_CAP_THREAD_SAFE
>>   radeon: enable PIPE_CAP_THREAD_SAFE
>>   gallium: add flag for transfers in a different context than draw call
>>
>>  src/gallium/docs/source/screen.rst               | 12 ++++++++++++
>>  src/gallium/drivers/freedreno/freedreno_screen.c |  2 ++
>>  src/gallium/drivers/i915/i915_screen.c           |  2 ++
>>  src/gallium/drivers/ilo/ilo_screen.c             |  2 ++
>>  src/gallium/drivers/llvmpipe/lp_screen.c         |  2 ++
>>  src/gallium/drivers/nouveau/nv30/nv30_screen.c   |  2 ++
>>  src/gallium/drivers/nouveau/nv50/nv50_screen.c   |  2 ++
>>  src/gallium/drivers/nouveau/nvc0/nvc0_screen.c   |  2 ++
>>  src/gallium/drivers/r300/r300_screen.c           |  2 ++
>>  src/gallium/drivers/r600/r600_pipe.c             |  2 ++
>>  src/gallium/drivers/radeonsi/si_pipe.c           |  2 ++
>>  src/gallium/drivers/softpipe/sp_screen.c         |  2 ++
>>  src/gallium/drivers/svga/svga_screen.c           |  2 ++
>>  src/gallium/drivers/swr/swr_screen.cpp           |  2 ++
>>  src/gallium/drivers/vc4/vc4_screen.c             |  2 ++
>>  src/gallium/drivers/virgl/virgl_screen.c         |  2 ++
>>  src/gallium/include/pipe/p_defines.h             |  3 +++
>>  17 files changed, 45 insertions(+)
>>
>



More information about the mesa-dev mailing list