Commit Graph

59 Commits

Author SHA1 Message Date
Yonggang Luo df242a2c06 auxiliary: Remove pipe_tsd
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17213>
2022-07-29 23:59:12 +00:00
Marek Olšák 96d9f7761d util: consolidate thread_get_time functions
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Acked-by: Jose Fonseca <jfonseca@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7054>
2020-10-30 05:07:57 +00:00
Marek Olšák 7ac52c2e38 Revert "gallium/os_thread: simplify helper pipe_current_thread_get_time_nano"
This reverts commit 6d477bc546.

It fixes the Windows build hopefully.
2018-09-07 16:52:36 -04:00
Marek Olšák 6d477bc546 gallium/os_thread: simplify helper pipe_current_thread_get_time_nano
Reviewed-by: Brian Paul <brianp@vmware.com>
2018-09-07 15:48:31 -04:00
Gert Wollny 537d04615d gallium/aux/os/os_thread.h: Silence -Wunused-param.
With --disable-debug a parameter is not used. Silence this
warning by fake-using it.

Signed-off-by: Gert Wollny <gw.fossdev@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2017-11-17 09:27:57 -07:00
Nicolai Hähnle f0d3a4de75 util: move pipe_barrier into src/util and rename to util_barrier
The #if guard is probably not 100% equivalent to the previous PIPE_OS
check, but if anything it should be an over-approximation (are there
pthread implementations without barriers?), so people will get either
a good implementation or compile errors that are easy to fix.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-11-09 11:53:19 +01:00
Marek Olšák 6884c95ab4 util: move pipe_thread_is_self from gallium to src/util
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
2017-06-26 02:17:03 +02:00
Chih-Wei Huang bb0452442a Android: use bionic pthread_barrier_* if possible
The pthread_barrier_* functions were introduced to bionic
since Nougat.

Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
Acked-by: Tapani Pälli <tapani.palli@intel.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
2017-06-05 14:06:35 +01:00
Timothy Arceri ca76a2ba1b gallium/util: replace pipe_thread_setname() with u_thread_setname()
They do the same thing we just moved the function to be
accessible to all of Mesa.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-03-12 17:49:04 +11:00
Timothy Arceri 14e6b86952 gallium/util: replace pipe_thread_get_time_nano() with u_thread_get_time_nano()
They do the same thing we just moved the function to be
accessible to all of Mesa.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-03-12 17:49:04 +11:00
Timothy Arceri f8cc4c25b8 gallium/util: replace pipe_thread_create() with u_thread_create()
They do the same thing we just moved the function to be
accessible to all of Mesa.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-03-12 17:49:04 +11:00
Timothy Arceri 60a2c2507d gallium/util: remove unused pipe_thread_destroy()
Reviewed-by: Plamena Manolova <plamena.manolova@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-03-07 09:12:16 +11:00
Timothy Arceri d82d8be614 gallium/util: replace pipe_thread_wait() with thrd_join()
Replace done using:
find ./src -type f -exec sed -i -- \
's:pipe_thread_wait(\([^)]*\)):thrd_join(\1, NULL):g' {} \;

Reviewed-by: Plamena Manolova <plamena.manolova@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-03-07 09:12:16 +11:00
Timothy Arceri da40ac65c7 gallium/util: remove PIPE_THREAD_ROUTINE()
This was made unnecessary with fd33a6bcd7.

This was mostly done with:
find ./src -type f -exec sed -i -- \
's:PIPE_THREAD_ROUTINE(\([^,]*\), \([^)]*\)):int\n\1(void \*\2):g' {} \;

With some small manual tidy ups.

Reviewed-by: Plamena Manolova <plamena.manolova@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-03-07 09:12:16 +11:00
Timothy Arceri e92293a601 gallium/util: replace pipe_condvar with cnd_t
pipe_condvar was made unnecessary with fd33a6bcd7.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-03-07 09:07:33 +11:00
Timothy Arceri e5375ba028 gallium/util: replace pipe_thread with thrd_t
pipe_thread was made unnecessary with fd33a6bcd7.

V2: fix compile error in u_queue.c

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-03-07 08:53:27 +11:00
Timothy Arceri 628e84a58f gallium/util: replace pipe_mutex_unlock() with mtx_unlock()
pipe_mutex_unlock() was made unnecessary with fd33a6bcd7.

Replaced using:
find ./src -type f -exec sed -i -- \
's:pipe_mutex_unlock(\([^)]*\)):mtx_unlock(\&\1):g' {} \;

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-03-07 08:53:05 +11:00
Timothy Arceri ba72554f3e gallium/util: replace pipe_mutex_lock() with mtx_lock()
replace pipe_mutex_lock() was made unnecessary with fd33a6bcd7.

Replaced using:
find ./src -type f -exec sed -i -- \
's:pipe_mutex_lock(\([^)]*\)):mtx_lock(\&\1):g' {} \;

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-03-07 08:52:38 +11:00
Timothy Arceri be188289e1 gallium/util: replace pipe_mutex_destroy() with mtx_destroy()
pipe_mutex_destroy() was made unnecessary with fd33a6bcd7.

Replace was done with:
find ./src -type f -exec sed -i -- \
's:pipe_mutex_destroy(\([^)]*\)):mtx_destroy(\&\1):g' {} \;

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-03-07 08:52:16 +11:00
Timothy Arceri 75b47dda0c gallium/util: replace pipe_mutex_init() with mtx_init()
pipe_mutex_init() was made unnecessary with fd33a6bcd7.

Replace was done using:
find ./src -type f -exec sed -i -- \
's:pipe_mutex_init(\([^)]*\)):(void) mtx_init(\&\1, mtx_plain):g' {} \;

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-03-07 08:52:07 +11:00
Timothy Arceri acdcaf9be4 gallium/util: remove pipe_static_mutex()
This was made unnecessary with fd33a6bcd7.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-03-07 08:48:16 +11:00
Timothy Arceri 2efddc63ee gallium/util: replace pipe_mutex with mtx_t
pipe_mutex was made unnecessary with fd33a6bcd7.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-03-07 08:48:11 +11:00
Timothy Arceri 464d4806c1 gallium/util: replace pipe_condvar_broadcast() with cnd_broadcast()
pipe_condvar_broadcast() was made unnecessary with fd33a6bcd7.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-03-07 08:23:26 +11:00
Timothy Arceri 5e56c2c79d gallium/util: replace pipe_condvar_signal() with cnd_signal()
pipe_condvar_signal() was made unnecessary with fd33a6bcd7.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-03-07 08:23:26 +11:00
Timothy Arceri 74c879ac75 gallium/util: replace pipe_condvar_wait() with cnd_wait()
pipe_condvar_wait() was made unnecessary with fd33a6bcd7.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-03-07 08:23:26 +11:00
Timothy Arceri 1e0314281a gallium/util: replace pipe_condvar_destroy() with cnd_destroy()
pipe_condvar_destroy() was made unnecessary with fd33a6bcd7.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-03-07 08:23:26 +11:00
Timothy Arceri 3f58242863 gallium/util: replace pipe_condvar_init() with cnd_init()
pipe_condvar_init() was made unnecessary with fd33a6bcd7.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-03-07 08:23:26 +11:00
Marek Olšák 6c61a8bfc6 gallium/os: add per-thread time clock queries
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-02-14 21:47:51 +01:00
Patrick Rudolph ac2927335b st/nine: Implement gallium nine CSMT
Use an offloading thread for all nine_context functions.
Macros are used to ease the reading of the code.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Signed-off-by: Axel Davy <axel.davy@ens.fr>
2016-12-20 23:44:23 +01:00
Rob Clark 010e4b2d52 os: add pipe_mutex_assert_locked()
Would be nice if we could also have lockdep, like in the linux kernel.
But this is better than nothing.

Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-07-30 09:23:42 -04:00
Ilia Mirkin a2a1a5805f gallium: replace INLINE with inline
Generated by running:
git grep -l INLINE src/gallium/ | xargs sed -i 's/\bINLINE\b/inline/g'
git grep -l INLINE src/mesa/state_tracker/ | xargs sed -i 's/\bINLINE\b/inline/g'
git checkout src/gallium/state_trackers/clover/Doxyfile

and manual edits to
src/gallium/include/pipe/p_compiler.h
src/gallium/README.portability

to remove mentions of the inline define.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Acked-by: Marek Olšák <marek.olsak@amd.com>
2015-07-21 17:52:16 -04:00
Jose Fonseca c944b91190 os,llvmpipe: Set rasterizer thread names on Linux.
To help identify llvmpipe rasterizer threads -- especially when there
can be so many.

We can eventually generalize this to other OSes, but for that we must
restrict the function to be called from the current thread.  See also
http://stackoverflow.com/a/7989973

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2015-02-13 19:42:21 +00:00
José Fonseca fa75cc4b89 os/os_thread: Revert pipe_barrier pre-processing logic.
Whitelist platforms instead of blacklisting, as several pthread
implementations are missing pthread_barrier_t, in particular MacOSX.
2014-01-23 13:44:10 +00:00
José Fonseca fd33a6bcd7 gallium: Use C11 thread abstractions.
Note that PIPE_ROUTINE now returns an int.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
2014-01-23 12:55:55 +00:00
José Fonseca 349f0a94ae os: Remove pipe_static_condvar.
Never used.

Reviewed-by: Brian Paul <brianp@vmware.com>
2014-01-23 12:55:55 +00:00
José Fonseca 8771285054 s/Tungsten Graphics/VMware/
Tungsten Graphics Inc. was acquired by VMware Inc. in 2008.  Leaving the
old copyright name is creating unnecessary confusion, hence this change.

This was the sed script I used:

    $ cat tg2vmw.sed
    # Run as:
    #
    #   git reset --hard HEAD && find include scons src -type f -not -name 'sed*' -print0 | xargs -0 sed -i -f tg2vmw.sed
    #

    # Rename copyrights
    s/Tungsten Gra\(ph\|hp\)ics,\? [iI]nc\.\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./g
    /Copyright/s/Tungsten Graphics\(,\? [iI]nc\.\)\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./
    s/TUNGSTEN GRAPHICS/VMWARE/g

    # Rename emails
    s/alanh@tungstengraphics.com/alanh@vmware.com/
    s/jens@tungstengraphics.com/jowen@vmware.com/g
    s/jrfonseca-at-tungstengraphics-dot-com/jfonseca-at-vmware-dot-com/
    s/jrfonseca\?@tungstengraphics.com/jfonseca@vmware.com/g
    s/keithw\?@tungstengraphics.com/keithw@vmware.com/g
    s/michel@tungstengraphics.com/daenzer@vmware.com/g
    s/thomas-at-tungstengraphics-dot-com/thellstom-at-vmware-dot-com/
    s/zack@tungstengraphics.com/zackr@vmware.com/

    # Remove dead links
    s@Tungsten Graphics (http://www.tungstengraphics.com)@Tungsten Graphics@g

    # C string src/gallium/state_trackers/vega/api_misc.c
    s/"Tungsten Graphics, Inc"/"VMware, Inc"/

Reviewed-by: Brian Paul <brianp@vmware.com>
2014-01-17 20:00:32 +00:00
Cyril Brulebois 2d77e4f922 gallium: fix build on GNU/Hurd due to missing PIPE_OS_HURD detection
Thanks to Pino Toscano.  Patch from Debian package.

Cc: "10.0" <mesa-stable@lists.freedesktop.org>

Reviewed-by: Brian Paul <brianp@vmware.com>
2013-11-12 11:57:21 -07:00
Kenneth Graunke 3d8d5b298a mesa: Restore 78-column wrapping of license text in C-style comments.
The previous commit introduced extra words, breaking the formatting.

This text transformation was done automatically via the following shell
command:
$ git grep 'THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY' | sed 's/:.*$//' | xargs -I {} sh -c 'vim -e -s {} < vimscript

where 'vimscript' is a file containing:
/THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY/;/\*\// !fmt -w 78 -p ' * '
:wq

Reviewed-by: Brian Paul <brianp@vmware.com>
2013-04-23 22:07:09 -07:00
Kenneth Graunke 96ff2edc73 mesa: Add "OR COPYRIGHT HOLDERS" to license text disclaiming liability.
This brings the license text in line with the MIT License as published
on the Open Source Initiative website:

http://opensource.org/licenses/mit-license.php

Generated automatically be the following shell command:
$ git grep 'THE AUTHORS BE LIABLE' | sed 's/:.*$//g' | xargs -I '{}' \
  sed -i 's/THE AUTHORS/THE AUTHORS OR COPYRIGHT HOLDERS/' {}

This introduces some wrapping issues, to be fixed in the next commit.

Reviewed-by: Brian Paul <brianp@vmware.com>
2013-04-23 22:07:06 -07:00
Kenneth Graunke dd404bc94f mesa: Change "BRIAN PAUL" to "THE AUTHORS" in license text.
Generated automatically be the following shell command:
$ git grep 'BRIAN PAUL BE LIABLE' | sed 's/:.*$//g' | xargs -I '{}' \
  sed -i 's/BRIAN PAUL/THE AUTHORS/' {}

The intention here is to protect all authors, not just Brian Paul.  I
believe that was already the sensible interpretation, but spelling it
out is probably better.

More practically, it also prevents people from accidentally copy &
pasting the license into a new file which says Brian is not liable when
he isn't even one of the authors.

Reviewed-by: Brian Paul <brianp@vmware.com>
2013-04-23 22:06:38 -07:00
Baldo Davide 0ad0bc5af5 auxiliary/os: Add missing signal.h include.
The signal.h include was missed in the commit
bc16c73407 which leads to broken
compilations under Linux.

Signed-off-by: José Fonseca <jose.r.fonseca@gmail.com>
2012-05-05 04:51:32 +01:00
Alexander von Gluck 9e4c8ce3bc gallium: use Mesa pthread_barrier_t on Haiku, as it is incomplete under Haiku
Reviewed-by: Brian Paul <brianp@vmare.com>
Signed-off-by: Brian Paul <brianp@vmware.com>
2011-12-27 09:16:30 -07:00
Chia-I Wu cd893ccba9 gallium: add PIPE_OS_ANDROID support
Android uses Linux kernel and its own C runtime.  It resembles
PIPE_OS_LINUX a lot with some minor exceptions.

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-08-21 02:01:48 +08:00
José Fonseca 4175010749 scons: make embedding orthogonal to the platform
To enable embedding in platforms other than linux.
2011-06-17 14:50:37 +01:00
Dave Airlie bc16c73407 gallium: block signals for new thread when spawning threads
I'm hard pressed to think of any reason a gallium thread would want to
receive a signal, especially considering its probably loaded as a library
and you don't want the threads interfering with the main threads signal
handling.

This solves a problem loading llvmpipe into the X server for AIGLX,
where the X server relies on the SIGIO signal going to the main thread,
but once llvmpipe loads the SIGIO can end up in any of its threads.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-05-16 06:40:26 +10:00
José Fonseca db6d0d9ebf os: Fix pipe_static_mutex on Windows. 2011-03-06 09:10:38 +00:00
nobled 209009d75f os: remove gratuitous pipe_barrier placeholder code
There's already an implementation of pipe_barrier using
the other pipe_* primitives; just use that on Windows, too.

Now Windows passes pipe_barrier_test.
2010-07-12 15:40:33 +01:00
nobled 7ce9a3adc5 os, rbug: remove PIPE_THREAD_HAVE_CONDVAR
The new default implementation of pipe_condvar makes it
unnecessary.
2010-07-12 15:40:33 +01:00
nobled f321d5c38a os: Implement pipe_condvar on Windows Vista and later
Unfortunately compiling with these defines enabled would mean
Gallium can't run on Windows XP/2003 or older.

Todo: Need a macro to declare if we don't care about WinXP
compatibililty.
2010-07-12 15:40:32 +01:00
nobled 9795a60a8f os: Implement pipe_condvar on win32
Or at least a little of it. This version will sleep
for a fixed amount of time instead of just deadlocking,
which is a slight improvement.

Also do the same thing on any unrecognized platform.
2010-07-12 15:40:32 +01:00