[Mesa-dev] [PATCH 5/5] gallium/util: replace pipe_condvar_broadcast() with cnd_broadcast()

2017-03-04 Thread Timothy Arceri
pipe_condvar_broadcast() was made unnecessary with fd33a6bcd7f12.
---
 src/gallium/auxiliary/os/os_thread.h  | 5 +
 src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c | 2 +-
 src/gallium/auxiliary/util/u_queue.c  | 4 ++--
 src/gallium/drivers/llvmpipe/lp_fence.c   | 2 +-
 src/gallium/drivers/rbug/rbug_core.c  | 6 +++---
 5 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/src/gallium/auxiliary/os/os_thread.h 
b/src/gallium/auxiliary/os/os_thread.h
index a8b5d92..6eca2ca 100644
--- a/src/gallium/auxiliary/os/os_thread.h
+++ b/src/gallium/auxiliary/os/os_thread.h
@@ -141,23 +141,20 @@ __pipe_mutex_assert_locked(pipe_mutex *mutex)
assert(ret == thrd_busy);
if (ret == thrd_success)
   mtx_unlock(mutex);
 #endif
 }
 
 /* pipe_condvar
  */
 typedef cnd_t pipe_condvar;
 
-#define pipe_condvar_broadcast(cond) \
-   cnd_broadcast(&(cond))
-
 
 /*
  * pipe_barrier
  */
 
 #if (defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || 
defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_HURD)) && !defined(PIPE_OS_ANDROID)
 
 typedef pthread_barrier_t pipe_barrier;
 
 static inline void pipe_barrier_init(pipe_barrier *barrier, unsigned count)
@@ -211,21 +208,21 @@ static inline void pipe_barrier_wait(pipe_barrier 
*barrier)
 
if (barrier->waiters < barrier->count) {
   uint64_t sequence = barrier->sequence;
 
   do {
  cnd_wait(&barrier->condvar, &barrier->mutex);
   } while (sequence == barrier->sequence);
} else {
   barrier->waiters = 0;
   barrier->sequence++;
-  pipe_condvar_broadcast(barrier->condvar);
+  cnd_broadcast(&barrier->condvar);
}
 
pipe_mutex_unlock(barrier->mutex);
 }
 
 
 #endif
 
 
 /*
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c 
b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
index 541a6d9..cc42eea 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
@@ -239,21 +239,21 @@ pb_slab_buffer_map(struct pb_buffer *_buf,
 }
 
 
 static void
 pb_slab_buffer_unmap(struct pb_buffer *_buf)
 {
struct pb_slab_buffer *buf = pb_slab_buffer(_buf);
 
--buf->mapCount;
if (buf->mapCount == 0) 
-   pipe_condvar_broadcast(buf->event);
+   cnd_broadcast(&buf->event);
 }
 
 
 static enum pipe_error 
 pb_slab_buffer_validate(struct pb_buffer *_buf, 
  struct pb_validate *vl,
  unsigned flags)
 {
struct pb_slab_buffer *buf = pb_slab_buffer(_buf);
return pb_validate(buf->slab->bo, vl, flags);
diff --git a/src/gallium/auxiliary/util/u_queue.c 
b/src/gallium/auxiliary/util/u_queue.c
index 3cef7d2..c84e0ad 100644
--- a/src/gallium/auxiliary/util/u_queue.c
+++ b/src/gallium/auxiliary/util/u_queue.c
@@ -89,21 +89,21 @@ remove_from_atexit_list(struct util_queue *queue)
 
 /
  * util_queue_fence
  */
 
 static void
 util_queue_fence_signal(struct util_queue_fence *fence)
 {
pipe_mutex_lock(fence->mutex);
fence->signalled = true;
-   pipe_condvar_broadcast(fence->cond);
+   cnd_broadcast(&fence->cond);
pipe_mutex_unlock(fence->mutex);
 }
 
 void
 util_queue_fence_wait(struct util_queue_fence *fence)
 {
pipe_mutex_lock(fence->mutex);
while (!fence->signalled)
   cnd_wait(&fence->cond, &fence->mutex);
pipe_mutex_unlock(fence->mutex);
@@ -260,21 +260,21 @@ fail:
 }
 
 static void
 util_queue_killall_and_wait(struct util_queue *queue)
 {
unsigned i;
 
/* Signal all threads to terminate. */
pipe_mutex_lock(queue->lock);
queue->kill_threads = 1;
-   pipe_condvar_broadcast(queue->has_queued_cond);
+   cnd_broadcast(&queue->has_queued_cond);
pipe_mutex_unlock(queue->lock);
 
for (i = 0; i < queue->num_threads; i++)
   pipe_thread_wait(queue->threads[i]);
queue->num_threads = 0;
 }
 
 void
 util_queue_destroy(struct util_queue *queue)
 {
diff --git a/src/gallium/drivers/llvmpipe/lp_fence.c 
b/src/gallium/drivers/llvmpipe/lp_fence.c
index 1a8e365..115589f 100644
--- a/src/gallium/drivers/llvmpipe/lp_fence.c
+++ b/src/gallium/drivers/llvmpipe/lp_fence.c
@@ -92,21 +92,21 @@ lp_fence_signal(struct lp_fence *fence)
 
fence->count++;
assert(fence->count <= fence->rank);
 
if (LP_DEBUG & DEBUG_FENCE)
   debug_printf("%s count=%u rank=%u\n", __FUNCTION__,
fence->count, fence->rank);
 
/* Wakeup all threads waiting on the mutex:
 */
-   pipe_condvar_broadcast(fence->signalled);
+   cnd_broadcast(&fence->signalled);
 
pipe_mutex_unlock(fence->mutex);
 }
 
 boolean
 lp_fence_signalled(struct lp_fence *f)
 {
return f->count == f->rank;
 }
 
diff --git a/src/gallium/drivers/rbug/rbug_core.c 
b/src/gallium/drivers/rbug/rbug_core.c
index dedbc14..3bb781b 100644
--- a/src/gallium/drivers/rbug/rbug_core.c
+++ b/src/gallium/drivers/rbug/rbug_core.c
@@ -402,21 +402,21 @@ rbug_context_draw_step(struct rbug_r

Re: [Mesa-dev] [PATCH 5/5] gallium/util: replace pipe_condvar_broadcast() with cnd_broadcast()

2017-03-04 Thread Emil Velikov
On 4 March 2017 at 23:41, Timothy Arceri  wrote:
> pipe_condvar_broadcast() was made unnecessary with fd33a6bcd7f12.
Fwiw I have some patches that do a similar cleanups on the thrd_*
side. Need to test them one of these days - since they're not as
trivial of a sed job.

> ---
>  src/gallium/auxiliary/os/os_thread.h  | 5 +
>  src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c | 2 +-
>  src/gallium/auxiliary/util/u_queue.c  | 4 ++--
>  src/gallium/drivers/llvmpipe/lp_fence.c   | 2 +-
>  src/gallium/drivers/rbug/rbug_core.c  | 6 +++---
>  5 files changed, 8 insertions(+), 11 deletions(-)
>
> diff --git a/src/gallium/auxiliary/os/os_thread.h 
> b/src/gallium/auxiliary/os/os_thread.h
> index a8b5d92..6eca2ca 100644
> --- a/src/gallium/auxiliary/os/os_thread.h
> +++ b/src/gallium/auxiliary/os/os_thread.h
> @@ -141,23 +141,20 @@ __pipe_mutex_assert_locked(pipe_mutex *mutex)
> assert(ret == thrd_busy);
> if (ret == thrd_success)
>mtx_unlock(mutex);
>  #endif
>  }
>
>  /* pipe_condvar
>   */
>  typedef cnd_t pipe_condvar;
>
I think we should we drop this typedef one as well. We could also
follow-up with pipe_tsd_* front ?
In either case, it might be worth checking with Jose/others to update
things on their end.

For the series:
Reviewed-by: Emil Velikov 

-Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 5/5] gallium/util: replace pipe_condvar_broadcast() with cnd_broadcast()

2017-03-04 Thread Timothy Arceri



On 05/03/17 11:30, Emil Velikov wrote:

On 4 March 2017 at 23:41, Timothy Arceri  wrote:

pipe_condvar_broadcast() was made unnecessary with fd33a6bcd7f12.

Fwiw I have some patches that do a similar cleanups on the thrd_*
side. Need to test them one of these days - since they're not as
trivial of a sed job.


---
 src/gallium/auxiliary/os/os_thread.h  | 5 +
 src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c | 2 +-
 src/gallium/auxiliary/util/u_queue.c  | 4 ++--
 src/gallium/drivers/llvmpipe/lp_fence.c   | 2 +-
 src/gallium/drivers/rbug/rbug_core.c  | 6 +++---
 5 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/src/gallium/auxiliary/os/os_thread.h 
b/src/gallium/auxiliary/os/os_thread.h
index a8b5d92..6eca2ca 100644
--- a/src/gallium/auxiliary/os/os_thread.h
+++ b/src/gallium/auxiliary/os/os_thread.h
@@ -141,23 +141,20 @@ __pipe_mutex_assert_locked(pipe_mutex *mutex)
assert(ret == thrd_busy);
if (ret == thrd_success)
   mtx_unlock(mutex);
 #endif
 }

 /* pipe_condvar
  */
 typedef cnd_t pipe_condvar;


I think we should we drop this typedef one as well.


Yeah I noticed that after sending. Will do a follow up.


We could also
follow-up with pipe_tsd_* front ?


My main aim is at this stage is to make u_queue generic enough to move 
it to src/util.



In either case, it might be worth checking with Jose/others to update
things on their end.

For the series:
Reviewed-by: Emil Velikov 


Thanks!



-Emil


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 5/5] gallium/util: replace pipe_condvar_broadcast() with cnd_broadcast()

2017-03-06 Thread Marek Olšák
For the series:

Reviewed-by: Marek Olšák 

Marek

On Sun, Mar 5, 2017 at 3:51 AM, Timothy Arceri  wrote:
>
>
> On 05/03/17 11:30, Emil Velikov wrote:
>>
>> On 4 March 2017 at 23:41, Timothy Arceri  wrote:
>>>
>>> pipe_condvar_broadcast() was made unnecessary with fd33a6bcd7f12.
>>
>> Fwiw I have some patches that do a similar cleanups on the thrd_*
>> side. Need to test them one of these days - since they're not as
>> trivial of a sed job.
>>
>>> ---
>>>  src/gallium/auxiliary/os/os_thread.h  | 5 +
>>>  src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c | 2 +-
>>>  src/gallium/auxiliary/util/u_queue.c  | 4 ++--
>>>  src/gallium/drivers/llvmpipe/lp_fence.c   | 2 +-
>>>  src/gallium/drivers/rbug/rbug_core.c  | 6 +++---
>>>  5 files changed, 8 insertions(+), 11 deletions(-)
>>>
>>> diff --git a/src/gallium/auxiliary/os/os_thread.h
>>> b/src/gallium/auxiliary/os/os_thread.h
>>> index a8b5d92..6eca2ca 100644
>>> --- a/src/gallium/auxiliary/os/os_thread.h
>>> +++ b/src/gallium/auxiliary/os/os_thread.h
>>> @@ -141,23 +141,20 @@ __pipe_mutex_assert_locked(pipe_mutex *mutex)
>>> assert(ret == thrd_busy);
>>> if (ret == thrd_success)
>>>mtx_unlock(mutex);
>>>  #endif
>>>  }
>>>
>>>  /* pipe_condvar
>>>   */
>>>  typedef cnd_t pipe_condvar;
>>>
>> I think we should we drop this typedef one as well.
>
>
> Yeah I noticed that after sending. Will do a follow up.
>
>> We could also
>> follow-up with pipe_tsd_* front ?
>
>
> My main aim is at this stage is to make u_queue generic enough to move it to
> src/util.
>
>> In either case, it might be worth checking with Jose/others to update
>> things on their end.
>>
>> For the series:
>> Reviewed-by: Emil Velikov 
>
>
> Thanks!
>
>
>>
>> -Emil
>>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev