[Mesa-dev] [PATCH 1/5] clover: Add threadsafe wrappers for pipe_screen and pipe_context

Emil Velikov emil.l.velikov at gmail.com
Fri May 8 11:38:22 PDT 2015


Hi Tom,

On 8 May 2015 at 00:36, Tom Stellard <thomas.stellard at amd.com> wrote:
> Events can be added to an OpenCL command queue concurrently from
> multiple threads, but pipe_context and pipe_screen objects
> are not threadsafe.  The threadsafe wrappers protect all pipe_screen
> and pipe_context function calls with a mutex, so we can safely use
> them with multiple threads.
> ---
>  src/gallium/state_trackers/clover/Makefile.am      |   6 +-
>  src/gallium/state_trackers/clover/Makefile.sources |   4 +
>  src/gallium/state_trackers/clover/core/device.cpp  |   2 +
>  .../clover/core/pipe_threadsafe_context.c          | 272 +++++++++++++++++++++
>  .../clover/core/pipe_threadsafe_screen.c           | 184 ++++++++++++++
>  .../state_trackers/clover/core/threadsafe.h        |  39 +++
>  src/gallium/targets/opencl/Makefile.am             |   3 +-
>  7 files changed, 508 insertions(+), 2 deletions(-)
>  create mode 100644 src/gallium/state_trackers/clover/core/pipe_threadsafe_context.c
>  create mode 100644 src/gallium/state_trackers/clover/core/pipe_threadsafe_screen.c
>  create mode 100644 src/gallium/state_trackers/clover/core/threadsafe.h
>

> --- a/src/gallium/state_trackers/clover/Makefile.sources
> +++ b/src/gallium/state_trackers/clover/Makefile.sources
> @@ -53,6 +53,10 @@ CPP_SOURCES := \
>         util/range.hpp \
>         util/tuple.hpp
>
> +C_SOURCES := \
> +       core/pipe_threadsafe_context.c \
> +       core/pipe_threadsafe_screen.c
> +
Regardless of the approach (re Francisco's comment), please keep the
header (core/threadsafe.h) within the sources list.

Thanks
Emil


More information about the mesa-dev mailing list