[Mesa-dev] [PATCH 7/4] gallium/util: replace pipe_thread_setname() with u_thread_setname()

Marek Olšák maraeo at gmail.com
Fri Mar 10 11:10:18 UTC 2017


For 5-7:

Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Thu, Mar 9, 2017 at 12:09 AM, Timothy Arceri <tarceri at itsqueeze.com> wrote:
> They do the same thing we are just moving the function to be
> accessible to all of Mesa.
> ---
>  src/gallium/auxiliary/os/os_thread.h         | 12 ------------
>  src/gallium/drivers/llvmpipe/lp_rast.c       |  2 +-
>  src/gallium/state_trackers/nine/nine_state.c |  4 ++--
>  3 files changed, 3 insertions(+), 15 deletions(-)
>
> diff --git a/src/gallium/auxiliary/os/os_thread.h b/src/gallium/auxiliary/os/os_thread.h
> index ecd8f8a..b6e0698 100644
> --- a/src/gallium/auxiliary/os/os_thread.h
> +++ b/src/gallium/auxiliary/os/os_thread.h
> @@ -35,32 +35,20 @@
>
>  #ifndef OS_THREAD_H_
>  #define OS_THREAD_H_
>
>
>  #include "pipe/p_compiler.h"
>  #include "util/u_debug.h" /* for assert */
>  #include "util/u_thread.h"
>
>
> -static inline void pipe_thread_setname( const char *name )
> -{
> -#if defined(HAVE_PTHREAD)
> -#  if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__) && \
> -      (__GLIBC__ >= 3 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 12))
> -   pthread_setname_np(pthread_self(), name);
> -#  endif
> -#endif
> -   (void)name;
> -}
> -
> -
>  static inline int pipe_thread_is_self( thrd_t thread )
>  {
>  #if defined(HAVE_PTHREAD)
>  #  if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__) && \
>        (__GLIBC__ >= 3 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 12))
>     return pthread_equal(pthread_self(), thread);
>  #  endif
>  #endif
>     return 0;
>  }
> diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c
> index d746778..b25ade3 100644
> --- a/src/gallium/drivers/llvmpipe/lp_rast.c
> +++ b/src/gallium/drivers/llvmpipe/lp_rast.c
> @@ -784,21 +784,21 @@ lp_rast_finish( struct lp_rasterizer *rast )
>  static int
>  thread_function(void *init_data)
>  {
>     struct lp_rasterizer_task *task = (struct lp_rasterizer_task *) init_data;
>     struct lp_rasterizer *rast = task->rast;
>     boolean debug = false;
>     char thread_name[16];
>     unsigned fpstate;
>
>     util_snprintf(thread_name, sizeof thread_name, "llvmpipe-%u", task->thread_index);
> -   pipe_thread_setname(thread_name);
> +   u_thread_setname(thread_name);
>
>     /* Make sure that denorms are treated like zeros. This is
>      * the behavior required by D3D10. OpenGL doesn't care.
>      */
>     fpstate = util_fpstate_get();
>     util_fpstate_set_denorms_to_zero(fpstate);
>
>     while (1) {
>        /* wait for work */
>        if (debug)
> diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c
> index ef33942..26c21f2 100644
> --- a/src/gallium/state_trackers/nine/nine_state.c
> +++ b/src/gallium/state_trackers/nine/nine_state.c
> @@ -88,21 +88,21 @@ nine_csmt_wait_processed(struct csmt_context *ctx)
>
>  /* CSMT worker thread */
>  static
>  int
>  nine_csmt_worker(void *arg)
>  {
>      struct csmt_context *ctx = arg;
>      struct csmt_instruction *instr;
>      DBG("CSMT worker spawned\n");
>
> -    pipe_thread_setname("CSMT-Worker");
> +    u_thread_setname("CSMT-Worker");
>
>      while (1) {
>          nine_queue_wait_flush(ctx->pool);
>          mtx_lock(&ctx->thread_running);
>
>          /* Get instruction. NULL on empty cmdbuf. */
>          while (!p_atomic_read(&ctx->terminate) &&
>                 (instr = (struct csmt_instruction *)nine_queue_get(ctx->pool))) {
>
>              /* decode */
> @@ -151,21 +151,21 @@ nine_csmt_create( struct NineDevice9 *This )
>      if (!ctx->pool) {
>          FREE(ctx);
>          return NULL;
>      }
>      cnd_init(&ctx->event_processed);
>      (void) mtx_init(&ctx->mutex_processed, mtx_plain);
>      (void) mtx_init(&ctx->thread_running, mtx_plain);
>      (void) mtx_init(&ctx->thread_resume, mtx_plain);
>
>  #if DEBUG
> -    pipe_thread_setname("Main thread");
> +    u_thread_setname("Main thread");
>  #endif
>
>      ctx->device = This;
>
>      ctx->worker = u_thread_create(nine_csmt_worker, ctx);
>      if (!ctx->worker) {
>          nine_queue_delete(ctx->pool);
>          FREE(ctx);
>          return NULL;
>      }
> --
> 2.9.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list