[Mesa-dev] [PATCH 01/25] util: move os_time.[ch] to src/util

Nicolai Hähnle nhaehnle at gmail.com
Sun Oct 22 19:07:44 UTC 2017


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

---
 src/gallium/auxiliary/Makefile.sources             |  2 --
 src/gallium/auxiliary/gallivm/lp_bld_init.c        |  2 +-
 src/gallium/auxiliary/hud/hud_cpu.c                |  2 +-
 src/gallium/auxiliary/hud/hud_cpufreq.c            |  2 +-
 src/gallium/auxiliary/hud/hud_diskstat.c           |  2 +-
 src/gallium/auxiliary/hud/hud_driver_query.c       |  2 +-
 src/gallium/auxiliary/hud/hud_fps.c                |  2 +-
 src/gallium/auxiliary/hud/hud_nic.c                |  2 +-
 src/gallium/auxiliary/hud/hud_sensors_temp.c       |  2 +-
 src/gallium/auxiliary/meson.build                  |  2 --
 src/gallium/auxiliary/util/u_time.h                |  2 +-
 src/gallium/drivers/ddebug/dd_draw.c               |  2 +-
 src/gallium/drivers/etnaviv/etnaviv_query_sw.c     |  2 +-
 src/gallium/drivers/etnaviv/etnaviv_screen.c       |  2 +-
 src/gallium/drivers/freedreno/freedreno_query_sw.c |  2 +-
 src/gallium/drivers/freedreno/freedreno_screen.c   |  2 +-
 src/gallium/drivers/llvmpipe/lp_query.c            |  2 +-
 src/gallium/drivers/llvmpipe/lp_rast.c             |  2 +-
 src/gallium/drivers/llvmpipe/lp_screen.c           |  2 +-
 src/gallium/drivers/llvmpipe/lp_setup.c            |  2 +-
 src/gallium/drivers/llvmpipe/lp_state_fs.c         |  2 +-
 src/gallium/drivers/llvmpipe/lp_state_setup.c      |  2 +-
 src/gallium/drivers/nouveau/nouveau_fence.c        |  2 +-
 src/gallium/drivers/nouveau/nouveau_screen.c       |  2 +-
 src/gallium/drivers/r300/r300_context.c            |  2 +-
 src/gallium/drivers/r300/r300_flush.c              |  2 +-
 src/gallium/drivers/r300/r300_screen.c             |  2 +-
 src/gallium/drivers/r600/r600_gpu_load.c           |  2 +-
 src/gallium/drivers/r600/r600_pipe.c               |  2 +-
 src/gallium/drivers/r600/r600_pipe_common.c        |  2 +-
 src/gallium/drivers/r600/r600_query.c              |  2 +-
 src/gallium/drivers/r600/r600_texture.c            |  2 +-
 src/gallium/drivers/r600/sb/sb_core.cpp            |  2 +-
 src/gallium/drivers/radeon/r600_gpu_load.c         |  2 +-
 src/gallium/drivers/radeon/r600_pipe_common.c      |  2 +-
 src/gallium/drivers/radeon/r600_query.c            |  2 +-
 src/gallium/drivers/radeon/r600_texture.c          |  2 +-
 src/gallium/drivers/rbug/rbug_core.c               |  2 +-
 src/gallium/drivers/softpipe/sp_query.c            |  2 +-
 src/gallium/drivers/softpipe/sp_screen.c           |  2 +-
 src/gallium/drivers/svga/svga_context.h            |  2 +-
 src/gallium/drivers/swr/swr_fence.cpp              |  2 +-
 src/gallium/drivers/swr/swr_query.cpp              |  2 +-
 src/gallium/drivers/trace/tr_dump.c                |  2 +-
 src/gallium/drivers/virgl/virgl_screen.c           |  2 +-
 src/gallium/state_trackers/wgl/stw_framebuffer.c   |  2 +-
 src/gallium/tests/unit/pipe_barrier_test.c         |  3 ++-
 src/gallium/winsys/amdgpu/drm/amdgpu_bo.c          |  2 +-
 src/gallium/winsys/amdgpu/drm/amdgpu_cs.c          |  3 ++-
 src/gallium/winsys/radeon/drm/radeon_drm_bo.c      |  2 +-
 src/gallium/winsys/radeon/drm/radeon_drm_cs.c      |  2 +-
 src/gallium/winsys/virgl/drm/virgl_drm_winsys.c    |  2 +-
 .../winsys/virgl/vtest/virgl_vtest_winsys.c        |  2 +-
 src/util/Makefile.sources                          |  2 ++
 src/util/meson.build                               |  2 ++
 src/{gallium/auxiliary/os => util}/os_time.c       | 19 +++++++++---------
 src/{gallium/auxiliary/os => util}/os_time.h       | 23 +++++++++-------------
 57 files changed, 76 insertions(+), 78 deletions(-)
 rename src/{gallium/auxiliary/os => util}/os_time.c (92%)
 rename src/{gallium/auxiliary/os => util}/os_time.h (89%)

diff --git a/src/gallium/auxiliary/Makefile.sources b/src/gallium/auxiliary/Makefile.sources
index 0502a2c44f8..4fb7a30613a 100644
--- a/src/gallium/auxiliary/Makefile.sources
+++ b/src/gallium/auxiliary/Makefile.sources
@@ -76,22 +76,20 @@ C_SOURCES := \
 	os/os_memory_aligned.h \
 	os/os_memory_debug.h \
 	os/os_memory_stdc.h \
 	os/os_memory.h \
 	os/os_misc.c \
 	os/os_misc.h \
 	os/os_mman.h \
 	os/os_process.c \
 	os/os_process.h \
 	os/os_thread.h \
-	os/os_time.c \
-	os/os_time.h \
 	pipebuffer/pb_buffer_fenced.c \
 	pipebuffer/pb_buffer_fenced.h \
 	pipebuffer/pb_buffer.h \
 	pipebuffer/pb_buffer_malloc.c \
 	pipebuffer/pb_bufmgr_alt.c \
 	pipebuffer/pb_bufmgr_cache.c \
 	pipebuffer/pb_bufmgr_debug.c \
 	pipebuffer/pb_bufmgr.h \
 	pipebuffer/pb_bufmgr_mm.c \
 	pipebuffer/pb_bufmgr_ondemand.c \
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c
index c456a97eb62..6ddc509a813 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_init.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c
@@ -25,21 +25,21 @@
  *
  **************************************************************************/
 
 
 #include "pipe/p_config.h"
 #include "pipe/p_compiler.h"
 #include "util/u_cpu_detect.h"
 #include "util/u_debug.h"
 #include "util/u_memory.h"
 #include "util/simple_list.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 #include "lp_bld.h"
 #include "lp_bld_debug.h"
 #include "lp_bld_misc.h"
 #include "lp_bld_init.h"
 
 #include <llvm-c/Analysis.h>
 #include <llvm-c/Transforms/Scalar.h>
 #include <llvm-c/BitWriter.h>
 
 
diff --git a/src/gallium/auxiliary/hud/hud_cpu.c b/src/gallium/auxiliary/hud/hud_cpu.c
index 4caaab6977e..581dad6df04 100644
--- a/src/gallium/auxiliary/hud/hud_cpu.c
+++ b/src/gallium/auxiliary/hud/hud_cpu.c
@@ -22,21 +22,21 @@
  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  *
  **************************************************************************/
 
 /* This file contains code for reading CPU load for displaying on the HUD.
  */
 
 #include "hud/hud_private.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 #include "os/os_thread.h"
 #include "util/u_memory.h"
 #include "util/u_queue.h"
 #include <stdio.h>
 #include <inttypes.h>
 #ifdef PIPE_OS_WINDOWS
 #include <windows.h>
 #endif
 
 
diff --git a/src/gallium/auxiliary/hud/hud_cpufreq.c b/src/gallium/auxiliary/hud/hud_cpufreq.c
index abb930d7e28..2b881a850e3 100644
--- a/src/gallium/auxiliary/hud/hud_cpufreq.c
+++ b/src/gallium/auxiliary/hud/hud_cpufreq.c
@@ -28,21 +28,21 @@
 
 #if HAVE_GALLIUM_EXTRA_HUD
 
 /* Purpose:
  * Reading /sys/devices/system/cpu/cpu?/cpufreq/scaling_???_freq
  * cpu frequency (KHz), displaying on the HUD in Hz.
  */
 
 #include "hud/hud_private.h"
 #include "util/list.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 #include "os/os_thread.h"
 #include "util/u_memory.h"
 #include <stdio.h>
 #include <unistd.h>
 #include <dirent.h>
 #include <stdlib.h>
 #include <errno.h>
 #include <inttypes.h>
 #include <sys/types.h>
 #include <sys/stat.h>
diff --git a/src/gallium/auxiliary/hud/hud_diskstat.c b/src/gallium/auxiliary/hud/hud_diskstat.c
index df86abd12d8..53b32baef22 100644
--- a/src/gallium/auxiliary/hud/hud_diskstat.c
+++ b/src/gallium/auxiliary/hud/hud_diskstat.c
@@ -27,21 +27,21 @@
  **************************************************************************/
 
 #if HAVE_GALLIUM_EXTRA_HUD
 
 /* Purpose: Reading /sys/block/<*>/stat MB/s read/write throughput per second,
  * displaying on the HUD.
  */
 
 #include "hud/hud_private.h"
 #include "util/list.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 #include "os/os_thread.h"
 #include "util/u_memory.h"
 #include <stdio.h>
 #include <unistd.h>
 #include <dirent.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <inttypes.h>
 #include <sys/types.h>
 #include <sys/stat.h>
diff --git a/src/gallium/auxiliary/hud/hud_driver_query.c b/src/gallium/auxiliary/hud/hud_driver_query.c
index 76104b5b497..8b1e4e104a7 100644
--- a/src/gallium/auxiliary/hud/hud_driver_query.c
+++ b/src/gallium/auxiliary/hud/hud_driver_query.c
@@ -26,21 +26,21 @@
  **************************************************************************/
 
 /* This file contains code for reading values from pipe queries
  * for displaying on the HUD. To prevent stalls when reading queries, we
  * keep a list of busy queries in a ring. We read only those queries which
  * are idle.
  */
 
 #include "hud/hud_private.h"
 #include "pipe/p_screen.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
 #include <stdio.h>
 
 // Must be a power of two
 #define NUM_QUERIES 8
 
 struct hud_batch_query_context {
    struct pipe_context *pipe;
    unsigned num_query_types;
diff --git a/src/gallium/auxiliary/hud/hud_fps.c b/src/gallium/auxiliary/hud/hud_fps.c
index 8aa7a665a30..aecbaf0f6b4 100644
--- a/src/gallium/auxiliary/hud/hud_fps.c
+++ b/src/gallium/auxiliary/hud/hud_fps.c
@@ -22,21 +22,21 @@
  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  *
  **************************************************************************/
 
 /* This file contains code for calculating framerate for displaying on the HUD.
  */
 
 #include "hud/hud_private.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 #include "util/u_memory.h"
 
 struct fps_info {
    int frames;
    uint64_t last_time;
 };
 
 static void
 query_fps(struct hud_graph *gr)
 {
diff --git a/src/gallium/auxiliary/hud/hud_nic.c b/src/gallium/auxiliary/hud/hud_nic.c
index 835f92e2e04..bb29a90dbca 100644
--- a/src/gallium/auxiliary/hud/hud_nic.c
+++ b/src/gallium/auxiliary/hud/hud_nic.c
@@ -27,21 +27,21 @@
  **************************************************************************/
 
 #if HAVE_GALLIUM_EXTRA_HUD
 
 /* Purpose: Reading network interface RX/TX throughput per second,
  * displaying on the HUD.
  */
 
 #include "hud/hud_private.h"
 #include "util/list.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 #include "os/os_thread.h"
 #include "util/u_memory.h"
 #include <stdio.h>
 #include <unistd.h>
 #include <dirent.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <inttypes.h>
 #include <sys/types.h>
 #include <sys/stat.h>
diff --git a/src/gallium/auxiliary/hud/hud_sensors_temp.c b/src/gallium/auxiliary/hud/hud_sensors_temp.c
index 29ee257ce86..7ae6f71b55c 100644
--- a/src/gallium/auxiliary/hud/hud_sensors_temp.c
+++ b/src/gallium/auxiliary/hud/hud_sensors_temp.c
@@ -24,21 +24,21 @@
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  *
  **************************************************************************/
 
 #if HAVE_LIBSENSORS
 /* Purpose: Extract lm-sensors data, expose temperature, power, voltage. */
 
 #include "hud/hud_private.h"
 #include "util/list.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 #include "os/os_thread.h"
 #include "util/u_memory.h"
 #include <stdio.h>
 #include <unistd.h>
 #include <dirent.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <inttypes.h>
 #include <sys/types.h>
 #include <sys/stat.h>
diff --git a/src/gallium/auxiliary/meson.build b/src/gallium/auxiliary/meson.build
index d17bc077c12..2796fd51fc3 100644
--- a/src/gallium/auxiliary/meson.build
+++ b/src/gallium/auxiliary/meson.build
@@ -98,22 +98,20 @@ files_libgallium = files(
   'os/os_memory_aligned.h',
   'os/os_memory_debug.h',
   'os/os_memory_stdc.h',
   'os/os_memory.h',
   'os/os_misc.c',
   'os/os_misc.h',
   'os/os_mman.h',
   'os/os_process.c',
   'os/os_process.h',
   'os/os_thread.h',
-  'os/os_time.c',
-  'os/os_time.h',
   'pipebuffer/pb_buffer_fenced.c',
   'pipebuffer/pb_buffer_fenced.h',
   'pipebuffer/pb_buffer.h',
   'pipebuffer/pb_buffer_malloc.c',
   'pipebuffer/pb_bufmgr_alt.c',
   'pipebuffer/pb_bufmgr_cache.c',
   'pipebuffer/pb_bufmgr_debug.c',
   'pipebuffer/pb_bufmgr.h',
   'pipebuffer/pb_bufmgr_mm.c',
   'pipebuffer/pb_bufmgr_ondemand.c',
diff --git a/src/gallium/auxiliary/util/u_time.h b/src/gallium/auxiliary/util/u_time.h
index a5017d6bce2..99fa1400511 100644
--- a/src/gallium/auxiliary/util/u_time.h
+++ b/src/gallium/auxiliary/util/u_time.h
@@ -31,21 +31,21 @@
  * 
  * @author Jose Fonseca <jfonseca at vmware.com>
  */
 
 #ifndef U_TIME_H_
 #define U_TIME_H_
 
 
 #include "pipe/p_config.h"
 
-#include "os/os_time.h"
+#include "util/os_time.h"
 
 #include "pipe/p_compiler.h"
 
 
 #ifdef	__cplusplus
 extern "C" {
 #endif
 
 
 /**
diff --git a/src/gallium/drivers/ddebug/dd_draw.c b/src/gallium/drivers/ddebug/dd_draw.c
index aec9332d903..a15801beb1d 100644
--- a/src/gallium/drivers/ddebug/dd_draw.c
+++ b/src/gallium/drivers/ddebug/dd_draw.c
@@ -28,21 +28,21 @@
 #include "dd_pipe.h"
 
 #include "util/u_dump.h"
 #include "util/u_format.h"
 #include "util/u_framebuffer.h"
 #include "util/u_helpers.h"
 #include "util/u_inlines.h"
 #include "util/u_memory.h"
 #include "tgsi/tgsi_parse.h"
 #include "tgsi/tgsi_scan.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 #include <inttypes.h>
 
 
 FILE *
 dd_get_file_stream(struct dd_screen *dscreen, unsigned apitrace_call_number)
 {
    struct pipe_screen *screen = dscreen->screen;
    char cmd_line[4096];
 
    FILE *f = dd_get_debug_file(dscreen->verbose);
diff --git a/src/gallium/drivers/etnaviv/etnaviv_query_sw.c b/src/gallium/drivers/etnaviv/etnaviv_query_sw.c
index dd9bac38501..2e65065b285 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_query_sw.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_query_sw.c
@@ -18,21 +18,21 @@
  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  *
  * Authors:
  *    Rob Clark <robclark at freedesktop.org>
  *    Christian Gmeiner <christian.gmeiner at gmail.com>
  */
 
-#include "os/os_time.h"
+#include "util/os_time.h"
 #include "pipe/p_state.h"
 #include "util/u_memory.h"
 #include "util/u_string.h"
 
 #include "etnaviv_context.h"
 #include "etnaviv_query_sw.h"
 
 static void
 etna_sw_destroy_query(struct etna_context *ctx, struct etna_query *q)
 {
diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c b/src/gallium/drivers/etnaviv/etnaviv_screen.c
index 009bc73c14a..84a2eb61756 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_screen.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c
@@ -31,21 +31,21 @@
 
 #include "etnaviv_compiler.h"
 #include "etnaviv_context.h"
 #include "etnaviv_debug.h"
 #include "etnaviv_fence.h"
 #include "etnaviv_format.h"
 #include "etnaviv_query.h"
 #include "etnaviv_resource.h"
 #include "etnaviv_translate.h"
 
-#include "os/os_time.h"
+#include "util/os_time.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
 #include "util/u_string.h"
 
 #include "state_tracker/drm_driver.h"
 
 #include <drm_fourcc.h>
 
 #define ETNA_DRM_VERSION(major, minor) ((major) << 16 | (minor))
 #define ETNA_DRM_VERSION_FENCE_FD      ETNA_DRM_VERSION(1, 1)
diff --git a/src/gallium/drivers/freedreno/freedreno_query_sw.c b/src/gallium/drivers/freedreno/freedreno_query_sw.c
index dfa89872397..50965161146 100644
--- a/src/gallium/drivers/freedreno/freedreno_query_sw.c
+++ b/src/gallium/drivers/freedreno/freedreno_query_sw.c
@@ -23,21 +23,21 @@
  * SOFTWARE.
  *
  * Authors:
  *    Rob Clark <robclark at freedesktop.org>
  */
 
 #include "pipe/p_state.h"
 #include "util/u_string.h"
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 
 #include "freedreno_query_sw.h"
 #include "freedreno_context.h"
 #include "freedreno_util.h"
 
 /*
  * SW Queries:
  *
  * In the core, we have some support for basic sw counters
  */
diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c
index 6de381c8fb8..ae7b1dcd4b5 100644
--- a/src/gallium/drivers/freedreno/freedreno_screen.c
+++ b/src/gallium/drivers/freedreno/freedreno_screen.c
@@ -31,21 +31,21 @@
 #include "pipe/p_screen.h"
 #include "pipe/p_state.h"
 
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
 #include "util/u_format.h"
 #include "util/u_format_s3tc.h"
 #include "util/u_string.h"
 #include "util/u_debug.h"
 
-#include "os/os_time.h"
+#include "util/os_time.h"
 
 #include <stdio.h>
 #include <errno.h>
 #include <stdlib.h>
 
 #include "freedreno_screen.h"
 #include "freedreno_resource.h"
 #include "freedreno_fence.h"
 #include "freedreno_query.h"
 #include "freedreno_util.h"
diff --git a/src/gallium/drivers/llvmpipe/lp_query.c b/src/gallium/drivers/llvmpipe/lp_query.c
index 7b81903b413..ad11d8ca53f 100644
--- a/src/gallium/drivers/llvmpipe/lp_query.c
+++ b/src/gallium/drivers/llvmpipe/lp_query.c
@@ -26,21 +26,21 @@
  * 
  **************************************************************************/
 
 /* Authors:
  *    Keith Whitwell, Qicheng Christopher Li, Brian Paul
  */
 
 #include "draw/draw_context.h"
 #include "pipe/p_defines.h"
 #include "util/u_memory.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 #include "lp_context.h"
 #include "lp_flush.h"
 #include "lp_fence.h"
 #include "lp_query.h"
 #include "lp_screen.h"
 #include "lp_state.h"
 #include "lp_rast.h"
 
 
 static struct llvmpipe_query *llvmpipe_query( struct pipe_query *p )
diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c
index 9e2780ca1d7..939944aa791 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.c
+++ b/src/gallium/drivers/llvmpipe/lp_rast.c
@@ -27,21 +27,21 @@
 
 #include <limits.h>
 #include "util/u_memory.h"
 #include "util/u_math.h"
 #include "util/u_rect.h"
 #include "util/u_surface.h"
 #include "util/u_pack_color.h"
 #include "util/u_string.h"
 #include "util/u_thread.h"
 
-#include "os/os_time.h"
+#include "util/os_time.h"
 
 #include "lp_scene_queue.h"
 #include "lp_context.h"
 #include "lp_debug.h"
 #include "lp_fence.h"
 #include "lp_perf.h"
 #include "lp_query.h"
 #include "lp_rast.h"
 #include "lp_rast_priv.h"
 #include "gallivm/lp_bld_format.h"
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
index bffc6b52792..55af26f931b 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -31,21 +31,21 @@
 #include "util/u_cpu_detect.h"
 #include "util/u_format.h"
 #include "util/u_string.h"
 #include "util/u_format_s3tc.h"
 #include "pipe/p_defines.h"
 #include "pipe/p_screen.h"
 #include "draw/draw_context.h"
 #include "gallivm/lp_bld_type.h"
 
 #include "os/os_misc.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 #include "lp_texture.h"
 #include "lp_fence.h"
 #include "lp_jit.h"
 #include "lp_screen.h"
 #include "lp_context.h"
 #include "lp_debug.h"
 #include "lp_public.h"
 #include "lp_limits.h"
 #include "lp_rast.h"
 
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index 2be6fc033d1..c1573231335 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -34,21 +34,21 @@
 
 #include <limits.h>
 
 #include "pipe/p_defines.h"
 #include "util/u_framebuffer.h"
 #include "util/u_inlines.h"
 #include "util/u_memory.h"
 #include "util/u_pack_color.h"
 #include "util/u_viewport.h"
 #include "draw/draw_pipe.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 #include "lp_context.h"
 #include "lp_memory.h"
 #include "lp_scene.h"
 #include "lp_texture.h"
 #include "lp_debug.h"
 #include "lp_fence.h"
 #include "lp_query.h"
 #include "lp_rast.h"
 #include "lp_setup_context.h"
 #include "lp_screen.h"
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index 9223ce63e3a..0daf7aecf6e 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -60,21 +60,21 @@
 #include <limits.h>
 #include "pipe/p_defines.h"
 #include "util/u_inlines.h"
 #include "util/u_memory.h"
 #include "util/u_pointer.h"
 #include "util/u_format.h"
 #include "util/u_dump.h"
 #include "util/u_string.h"
 #include "util/simple_list.h"
 #include "util/u_dual_blend.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 #include "pipe/p_shader_tokens.h"
 #include "draw/draw_context.h"
 #include "tgsi/tgsi_dump.h"
 #include "tgsi/tgsi_scan.h"
 #include "tgsi/tgsi_parse.h"
 #include "gallivm/lp_bld_type.h"
 #include "gallivm/lp_bld_const.h"
 #include "gallivm/lp_bld_conv.h"
 #include "gallivm/lp_bld_init.h"
 #include "gallivm/lp_bld_intr.h"
diff --git a/src/gallium/drivers/llvmpipe/lp_state_setup.c b/src/gallium/drivers/llvmpipe/lp_state_setup.c
index 6b0df21b8ad..77c7ac1bbde 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_setup.c
@@ -22,21 +22,21 @@
  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  *
  **************************************************************************/
 
 
 #include "util/u_math.h"
 #include "util/u_memory.h"
 #include "util/simple_list.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 #include "gallivm/lp_bld_arit.h"
 #include "gallivm/lp_bld_bitarit.h"
 #include "gallivm/lp_bld_const.h"
 #include "gallivm/lp_bld_debug.h"
 #include "gallivm/lp_bld_init.h"
 #include "gallivm/lp_bld_logic.h"
 #include "gallivm/lp_bld_intr.h"
 #include "gallivm/lp_bld_flow.h"
 #include "gallivm/lp_bld_type.h"
 
diff --git a/src/gallium/drivers/nouveau/nouveau_fence.c b/src/gallium/drivers/nouveau/nouveau_fence.c
index 6c299cbc6a5..d14c59b2dd1 100644
--- a/src/gallium/drivers/nouveau/nouveau_fence.c
+++ b/src/gallium/drivers/nouveau/nouveau_fence.c
@@ -16,21 +16,21 @@
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  * OTHER DEALINGS IN THE SOFTWARE.
  */
 
 #include "nouveau_screen.h"
 #include "nouveau_winsys.h"
 #include "nouveau_fence.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 
 #ifdef PIPE_OS_UNIX
 #include <sched.h>
 #endif
 
 bool
 nouveau_fence_new(struct nouveau_screen *screen, struct nouveau_fence **fence)
 {
    *fence = CALLOC_STRUCT(nouveau_fence);
    if (!*fence)
diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c b/src/gallium/drivers/nouveau/nouveau_screen.c
index ea68809c6e8..c144b39b2dd 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.c
+++ b/src/gallium/drivers/nouveau/nouveau_screen.c
@@ -1,21 +1,21 @@
 #include "pipe/p_defines.h"
 #include "pipe/p_screen.h"
 #include "pipe/p_state.h"
 
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
 #include "util/u_format.h"
 #include "util/u_format_s3tc.h"
 #include "util/u_string.h"
 
-#include "os/os_time.h"
+#include "util/os_time.h"
 
 #include <stdio.h>
 #include <errno.h>
 #include <stdlib.h>
 
 #include <nouveau_drm.h>
 
 #include "nouveau_winsys.h"
 #include "nouveau_screen.h"
 #include "nouveau_context.h"
diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
index 6f4231d76e3..b55fb63f000 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -19,21 +19,21 @@
  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  * USE OR OTHER DEALINGS IN THE SOFTWARE. */
 
 #include "draw/draw_context.h"
 
 #include "util/u_memory.h"
 #include "util/u_sampler.h"
 #include "util/simple_list.h"
 #include "util/u_upload_mgr.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 #include "vl/vl_decoder.h"
 #include "vl/vl_video_buffer.h"
 
 #include "r300_cb.h"
 #include "r300_context.h"
 #include "r300_emit.h"
 #include "r300_screen.h"
 #include "r300_screen_buffer.h"
 #include "compiler/radeon_regalloc.h"
 
diff --git a/src/gallium/drivers/r300/r300_flush.c b/src/gallium/drivers/r300/r300_flush.c
index 54108d1cdfb..7fabd13f3d7 100644
--- a/src/gallium/drivers/r300/r300_flush.c
+++ b/src/gallium/drivers/r300/r300_flush.c
@@ -20,21 +20,21 @@
  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  * USE OR OTHER DEALINGS IN THE SOFTWARE. */
 
 #include "draw/draw_context.h"
 #include "draw/draw_private.h"
 
 #include "util/simple_list.h"
 #include "util/u_upload_mgr.h"
 
-#include "os/os_time.h"
+#include "util/os_time.h"
 
 #include "r300_context.h"
 #include "r300_cs.h"
 #include "r300_emit.h"
 
 
 static void r300_flush_and_cleanup(struct r300_context *r300, unsigned flags,
                                    struct pipe_fence_handle **fence)
 {
     struct r300_atom *atom;
diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
index c0cf6e54468..ddf0715f648 100644
--- a/src/gallium/drivers/r300/r300_screen.c
+++ b/src/gallium/drivers/r300/r300_screen.c
@@ -17,21 +17,21 @@
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
  * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  * USE OR OTHER DEALINGS IN THE SOFTWARE. */
 
 #include "util/u_format.h"
 #include "util/u_format_s3tc.h"
 #include "util/u_memory.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 #include "vl/vl_decoder.h"
 #include "vl/vl_video_buffer.h"
 
 #include "r300_context.h"
 #include "r300_texture.h"
 #include "r300_screen_buffer.h"
 #include "r300_state_inlines.h"
 #include "r300_public.h"
 
 #include "draw/draw_context.h"
diff --git a/src/gallium/drivers/r600/r600_gpu_load.c b/src/gallium/drivers/r600/r600_gpu_load.c
index c15fb9dfa06..a2de8cc71a4 100644
--- a/src/gallium/drivers/r600/r600_gpu_load.c
+++ b/src/gallium/drivers/r600/r600_gpu_load.c
@@ -29,21 +29,21 @@
  * There is a thread which samples the GRBM_STATUS register at a certain
  * frequency and the "busy" or "idle" counter is incremented based on
  * whether the GUI_ACTIVE bit is set or not.
  *
  * Then, the user can sample the counters twice and calculate the average
  * GPU load between the two samples.
  */
 
 #include "r600_pipe_common.h"
 #include "r600_query.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 
 /* For good accuracy at 1000 fps or lower. This will be inaccurate for higher
  * fps (there are too few samples per frame). */
 #define SAMPLES_PER_SEC 10000
 
 #define GRBM_STATUS		0x8010
 #define TA_BUSY(x)		(((x) >> 14) & 0x1)
 #define GDS_BUSY(x)		(((x) >> 15) & 0x1)
 #define VGT_BUSY(x)		(((x) >> 17) & 0x1)
 #define IA_BUSY(x)		(((x) >> 19) & 0x1)
diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
index ffcaa15ec9b..f42ff76d3d1 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -32,21 +32,21 @@
 #include "pipe/p_shader_tokens.h"
 #include "util/u_debug.h"
 #include "util/u_memory.h"
 #include "util/u_simple_shaders.h"
 #include "util/u_upload_mgr.h"
 #include "util/u_math.h"
 #include "vl/vl_decoder.h"
 #include "vl/vl_video_buffer.h"
 #include "radeon_video.h"
 #include "radeon_uvd.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 
 static const struct debug_named_value r600_debug_options[] = {
 	/* features */
 	{ "nocpdma", DBG_NO_CP_DMA, "Disable CP DMA" },
 
 	/* shader backend */
 	{ "nosb", DBG_NO_SB, "Disable sb backend for graphics shaders" },
 	{ "sbcl", DBG_SB_CS, "Enable sb backend for compute shaders" },
 	{ "sbdry", DBG_SB_DRY_RUN, "Don't use optimized bytecode (just print the dumps)" },
 	{ "sbstat", DBG_SB_STAT, "Print optimization statistics for shaders" },
diff --git a/src/gallium/drivers/r600/r600_pipe_common.c b/src/gallium/drivers/r600/r600_pipe_common.c
index acad670d6fa..e2d0e32bb2b 100644
--- a/src/gallium/drivers/r600/r600_pipe_common.c
+++ b/src/gallium/drivers/r600/r600_pipe_common.c
@@ -25,21 +25,21 @@
  */
 
 #include "r600_pipe_common.h"
 #include "r600_cs.h"
 #include "tgsi/tgsi_parse.h"
 #include "util/list.h"
 #include "util/u_draw_quad.h"
 #include "util/u_memory.h"
 #include "util/u_format_s3tc.h"
 #include "util/u_upload_mgr.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 #include "vl/vl_decoder.h"
 #include "vl/vl_video_buffer.h"
 #include "radeon_video.h"
 #include <inttypes.h>
 #include <sys/utsname.h>
 
 #ifndef HAVE_LLVM
 #define HAVE_LLVM 0
 #endif
 
diff --git a/src/gallium/drivers/r600/r600_query.c b/src/gallium/drivers/r600/r600_query.c
index aa3e36f56f7..9c17c3ba23e 100644
--- a/src/gallium/drivers/r600/r600_query.c
+++ b/src/gallium/drivers/r600/r600_query.c
@@ -20,21 +20,21 @@
  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  * USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
 #include "r600_query.h"
 #include "r600_pipe.h"
 #include "r600_cs.h"
 #include "util/u_memory.h"
 #include "util/u_upload_mgr.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 #include "tgsi/tgsi_text.h"
 
 #define R600_MAX_STREAMS 4
 
 struct r600_hw_query_params {
 	unsigned start_offset;
 	unsigned end_offset;
 	unsigned fence_offset;
 	unsigned pair_stride;
 	unsigned pair_count;
diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c
index b8411144900..3515d979d9e 100644
--- a/src/gallium/drivers/r600/r600_texture.c
+++ b/src/gallium/drivers/r600/r600_texture.c
@@ -25,21 +25,21 @@
  *      Corbin Simpson
  */
 #include "r600_pipe_common.h"
 #include "r600_cs.h"
 #include "r600_query.h"
 #include "util/u_format.h"
 #include "util/u_log.h"
 #include "util/u_memory.h"
 #include "util/u_pack_color.h"
 #include "util/u_surface.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 #include <errno.h>
 #include <inttypes.h>
 
 static void r600_texture_discard_cmask(struct r600_common_screen *rscreen,
 				       struct r600_texture *rtex);
 static enum radeon_surf_mode
 r600_choose_tiling(struct r600_common_screen *rscreen,
 		   const struct pipe_resource *templ);
 
 
diff --git a/src/gallium/drivers/r600/sb/sb_core.cpp b/src/gallium/drivers/r600/sb/sb_core.cpp
index afea8188f1c..cdc2862d36d 100644
--- a/src/gallium/drivers/r600/sb/sb_core.cpp
+++ b/src/gallium/drivers/r600/sb/sb_core.cpp
@@ -19,21 +19,21 @@
  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  * USE OR OTHER DEALINGS IN THE SOFTWARE.
  *
  * Authors:
  *      Vadim Girlin
  */
 
 #define SB_RA_SCHED_CHECK DEBUG
 
-#include "os/os_time.h"
+#include "util/os_time.h"
 #include "r600_pipe.h"
 #include "r600_shader.h"
 
 #include "sb_public.h"
 
 #include <stack>
 #include <map>
 
 #include "sb_bc.h"
 #include "sb_shader.h"
diff --git a/src/gallium/drivers/radeon/r600_gpu_load.c b/src/gallium/drivers/radeon/r600_gpu_load.c
index 625370b8ea4..e92c6b68e8b 100644
--- a/src/gallium/drivers/radeon/r600_gpu_load.c
+++ b/src/gallium/drivers/radeon/r600_gpu_load.c
@@ -29,21 +29,21 @@
  * There is a thread which samples the GRBM_STATUS register at a certain
  * frequency and the "busy" or "idle" counter is incremented based on
  * whether the GUI_ACTIVE bit is set or not.
  *
  * Then, the user can sample the counters twice and calculate the average
  * GPU load between the two samples.
  */
 
 #include "r600_pipe_common.h"
 #include "r600_query.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 
 /* For good accuracy at 1000 fps or lower. This will be inaccurate for higher
  * fps (there are too few samples per frame). */
 #define SAMPLES_PER_SEC 10000
 
 #define GRBM_STATUS		0x8010
 #define TA_BUSY(x)		(((x) >> 14) & 0x1)
 #define GDS_BUSY(x)		(((x) >> 15) & 0x1)
 #define VGT_BUSY(x)		(((x) >> 17) & 0x1)
 #define IA_BUSY(x)		(((x) >> 19) & 0x1)
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
index 0ac86bcd811..115e424c0c9 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -25,21 +25,21 @@
  */
 
 #include "r600_pipe_common.h"
 #include "r600_cs.h"
 #include "tgsi/tgsi_parse.h"
 #include "util/list.h"
 #include "util/u_draw_quad.h"
 #include "util/u_memory.h"
 #include "util/u_format_s3tc.h"
 #include "util/u_upload_mgr.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 #include "vl/vl_decoder.h"
 #include "vl/vl_video_buffer.h"
 #include "radeon/radeon_video.h"
 #include "amd/common/sid.h"
 #include <inttypes.h>
 #include <sys/utsname.h>
 #include <libsync.h>
 
 #include <llvm-c/TargetMachine.h>
 
diff --git a/src/gallium/drivers/radeon/r600_query.c b/src/gallium/drivers/radeon/r600_query.c
index aedf950ff2d..0a03061ab91 100644
--- a/src/gallium/drivers/radeon/r600_query.c
+++ b/src/gallium/drivers/radeon/r600_query.c
@@ -19,21 +19,21 @@
  * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  * USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
 #include "r600_query.h"
 #include "r600_cs.h"
 #include "util/u_memory.h"
 #include "util/u_upload_mgr.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 #include "tgsi/tgsi_text.h"
 #include "amd/common/sid.h"
 
 /* TODO: remove this: */
 void si_update_prims_generated_query_state(struct r600_common_context *rctx,
 					   unsigned type, int diff);
 
 #define R600_MAX_STREAMS 4
 
 struct r600_hw_query_params {
diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c
index a237c3cd4d8..ef8218e80d3 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -25,21 +25,21 @@
  *      Corbin Simpson
  */
 #include "r600_pipe_common.h"
 #include "r600_cs.h"
 #include "r600_query.h"
 #include "util/u_format.h"
 #include "util/u_log.h"
 #include "util/u_memory.h"
 #include "util/u_pack_color.h"
 #include "util/u_surface.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 #include <errno.h>
 #include <inttypes.h>
 #include "state_tracker/drm_driver.h"
 #include "amd/common/sid.h"
 
 static void r600_texture_discard_cmask(struct r600_common_screen *rscreen,
 				       struct r600_texture *rtex);
 static enum radeon_surf_mode
 r600_choose_tiling(struct r600_common_screen *rscreen,
 		   const struct pipe_resource *templ);
diff --git a/src/gallium/drivers/rbug/rbug_core.c b/src/gallium/drivers/rbug/rbug_core.c
index 82bcef8d03b..8eb39c17b14 100644
--- a/src/gallium/drivers/rbug/rbug_core.c
+++ b/src/gallium/drivers/rbug/rbug_core.c
@@ -26,21 +26,21 @@
  **************************************************************************/
 
 
 #include "os/os_thread.h"
 #include "util/u_format.h"
 #include "util/u_string.h"
 #include "util/u_inlines.h"
 #include "util/u_memory.h"
 #include "util/simple_list.h"
 #include "util/u_network.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 
 #include "tgsi/tgsi_parse.h"
 
 #include "rbug_context.h"
 #include "rbug_objects.h"
 
 #include "rbug/rbug.h"
 
 #include <errno.h>
 
diff --git a/src/gallium/drivers/softpipe/sp_query.c b/src/gallium/drivers/softpipe/sp_query.c
index 267c99977fe..5c9afe6fe47 100644
--- a/src/gallium/drivers/softpipe/sp_query.c
+++ b/src/gallium/drivers/softpipe/sp_query.c
@@ -23,21 +23,21 @@
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  * 
  **************************************************************************/
 
 /* Author:
  *    Keith Whitwell <keithw at vmware.com>
  */
 
 #include "draw/draw_context.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 #include "pipe/p_defines.h"
 #include "util/u_memory.h"
 #include "sp_context.h"
 #include "sp_query.h"
 #include "sp_state.h"
 
 struct softpipe_query {
    unsigned type;
    uint64_t start;
    uint64_t end;
diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
index fe354b1c137..82817794d8e 100644
--- a/src/gallium/drivers/softpipe/sp_screen.c
+++ b/src/gallium/drivers/softpipe/sp_screen.c
@@ -24,21 +24,21 @@
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  *
  **************************************************************************/
 
 
 #include "util/u_memory.h"
 #include "util/u_format.h"
 #include "util/u_format_s3tc.h"
 #include "util/u_video.h"
 #include "os/os_misc.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 #include "pipe/p_defines.h"
 #include "pipe/p_screen.h"
 #include "draw/draw_context.h"
 
 #include "state_tracker/sw_winsys.h"
 #include "tgsi/tgsi_exec.h"
 
 #include "sp_texture.h"
 #include "sp_screen.h"
 #include "sp_context.h"
diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h
index 0d695a64927..80c59c05e86 100644
--- a/src/gallium/drivers/svga/svga_context.h
+++ b/src/gallium/drivers/svga/svga_context.h
@@ -24,21 +24,21 @@
  **********************************************************/
 
 #ifndef SVGA_CONTEXT_H
 #define SVGA_CONTEXT_H
 
 
 #include "pipe/p_context.h"
 #include "pipe/p_defines.h"
 #include "pipe/p_state.h"
 
-#include "os/os_time.h"
+#include "util/os_time.h"
 
 #include "util/u_blitter.h"
 #include "util/list.h"
 
 #include "tgsi/tgsi_scan.h"
 
 #include "svga_screen.h"
 #include "svga_state.h"
 #include "svga_winsys.h"
 #include "svga_hw_reg.h"
diff --git a/src/gallium/drivers/swr/swr_fence.cpp b/src/gallium/drivers/swr/swr_fence.cpp
index abf1d0c69c8..3005eb9aaad 100644
--- a/src/gallium/drivers/swr/swr_fence.cpp
+++ b/src/gallium/drivers/swr/swr_fence.cpp
@@ -16,21 +16,21 @@
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  * IN THE SOFTWARE.
  ***************************************************************************/
 
 #include "pipe/p_screen.h"
 #include "util/u_memory.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 
 #include "swr_context.h"
 #include "swr_screen.h"
 #include "swr_fence.h"
 
 #if defined(PIPE_CC_MSVC) // portable thread yield
    #define sched_yield SwitchToThread
 #endif
 
 /*
diff --git a/src/gallium/drivers/swr/swr_query.cpp b/src/gallium/drivers/swr/swr_query.cpp
index e3697304e05..ea31de630b3 100644
--- a/src/gallium/drivers/swr/swr_query.cpp
+++ b/src/gallium/drivers/swr/swr_query.cpp
@@ -16,21 +16,21 @@
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  * IN THE SOFTWARE.
  ***************************************************************************/
 
 #include "pipe/p_defines.h"
 #include "util/u_memory.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 #include "swr_context.h"
 #include "swr_fence.h"
 #include "swr_query.h"
 #include "swr_screen.h"
 #include "swr_state.h"
 #include "common/os.h"
 
 static struct swr_query *
 swr_query(struct pipe_query *p)
 {
diff --git a/src/gallium/drivers/trace/tr_dump.c b/src/gallium/drivers/trace/tr_dump.c
index 2003222cc1c..49349496ac6 100644
--- a/src/gallium/drivers/trace/tr_dump.c
+++ b/src/gallium/drivers/trace/tr_dump.c
@@ -38,21 +38,21 @@
  * @author Jose Fonseca <jfonseca at vmware.com>
  */
 
 #include "pipe/p_config.h"
 
 #include <stdio.h>
 #include <stdlib.h>
 
 #include "pipe/p_compiler.h"
 #include "os/os_thread.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 #include "util/u_debug.h"
 #include "util/u_memory.h"
 #include "util/u_string.h"
 #include "util/u_math.h"
 #include "util/u_format.h"
 
 #include "tr_dump.h"
 #include "tr_screen.h"
 #include "tr_texture.h"
 
diff --git a/src/gallium/drivers/virgl/virgl_screen.c b/src/gallium/drivers/virgl/virgl_screen.c
index 28023f81119..5e0c7c7ac3d 100644
--- a/src/gallium/drivers/virgl/virgl_screen.c
+++ b/src/gallium/drivers/virgl/virgl_screen.c
@@ -17,21 +17,21 @@
  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
  * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  * USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 #include "util/u_memory.h"
 #include "util/u_format.h"
 #include "util/u_format_s3tc.h"
 #include "util/u_video.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 #include "pipe/p_defines.h"
 #include "pipe/p_screen.h"
 
 #include "tgsi/tgsi_exec.h"
 
 #include "virgl_screen.h"
 #include "virgl_resource.h"
 #include "virgl_public.h"
 #include "virgl_context.h"
 
diff --git a/src/gallium/state_trackers/wgl/stw_framebuffer.c b/src/gallium/state_trackers/wgl/stw_framebuffer.c
index 06b5c8da3c2..7348ea3ba88 100644
--- a/src/gallium/state_trackers/wgl/stw_framebuffer.c
+++ b/src/gallium/state_trackers/wgl/stw_framebuffer.c
@@ -23,21 +23,21 @@
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  *
  **************************************************************************/
 
 #include <windows.h>
 
 #include "pipe/p_screen.h"
 #include "util/u_memory.h"
 #include "hud/hud_context.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 #include "state_tracker/st_api.h"
 
 #include "stw_icd.h"
 #include "stw_framebuffer.h"
 #include "stw_device.h"
 #include "stw_winsys.h"
 #include "stw_tls.h"
 #include "stw_context.h"
 #include "stw_st.h"
 
diff --git a/src/gallium/tests/unit/pipe_barrier_test.c b/src/gallium/tests/unit/pipe_barrier_test.c
index 6bd46b8d964..838c9bfd96c 100644
--- a/src/gallium/tests/unit/pipe_barrier_test.c
+++ b/src/gallium/tests/unit/pipe_barrier_test.c
@@ -29,22 +29,23 @@
 /*
  *  Test case for util_barrier.
  *
  *  The test succeeds if no thread exits before all the other threads reach
  *  the barrier.
  */
 
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
-#include "os/os_time.h"
+#include "util/os_time.h"
 #include "util/u_atomic.h"
 #include "util/u_thread.h"
 
 
 #define NUM_THREADS 10
 
 static int verbosity = 0;
 
 static thrd_t threads[NUM_THREADS];
 static util_barrier barrier;
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
index 897b4f05965..297b876479e 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
@@ -24,21 +24,21 @@
  * next paragraph) shall be included in all copies or substantial portions
  * of the Software.
  */
 /*
  * Authors:
  *      Marek Olšák <maraeo at gmail.com>
  */
 
 #include "amdgpu_cs.h"
 
-#include "os/os_time.h"
+#include "util/os_time.h"
 #include "state_tracker/drm_driver.h"
 #include <amdgpu_drm.h>
 #include <xf86drm.h>
 #include <stdio.h>
 #include <inttypes.h>
 
 #ifndef AMDGPU_GEM_CREATE_VM_ALWAYS_VALID
 #define AMDGPU_GEM_CREATE_VM_ALWAYS_VALID (1 << 6)
 #endif
 
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
index 8f43e936469..0f7889aa7de 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
@@ -24,21 +24,22 @@
  * The above copyright notice and this permission notice (including the
  * next paragraph) shall be included in all copies or substantial portions
  * of the Software.
  */
 /*
  * Authors:
  *      Marek Olšák <maraeo at gmail.com>
  */
 
 #include "amdgpu_cs.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
+#include <inttypes.h>
 #include <stdio.h>
 
 #include "amd/common/sid.h"
 
 DEBUG_GET_ONCE_BOOL_OPTION(noop, "RADEON_NOOP", false)
 
 /* FENCES */
 
 static struct pipe_fence_handle *
 amdgpu_fence_create(struct amdgpu_ctx *ctx, unsigned ip_type,
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
index 15e9d38e33a..b4e501c817f 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
@@ -24,21 +24,21 @@
  * of the Software.
  */
 
 #include "radeon_drm_cs.h"
 
 #include "util/u_hash_table.h"
 #include "util/u_memory.h"
 #include "util/simple_list.h"
 #include "os/os_thread.h"
 #include "os/os_mman.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 
 #include "state_tracker/drm_driver.h"
 
 #include <sys/ioctl.h>
 #include <xf86drm.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <stdio.h>
 #include <inttypes.h>
 
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
index 1e7060e946a..9897ee89a08 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
@@ -58,21 +58,21 @@
     (done in the pipe driver)
 
     cs_write_reloc(cs, buf) just writes a reloc that has been added using
     cs_add_buffer. The read_domain and write_domain parameters have been removed,
     because we already specify them in cs_add_buffer.
 */
 
 #include "radeon_drm_cs.h"
 
 #include "util/u_memory.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
 #include <xf86drm.h>
 
 
 #define RELOC_DWORDS (sizeof(struct drm_radeon_cs_reloc) / sizeof(uint32_t))
 
 static struct pipe_fence_handle *
diff --git a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c
index 7f542e7f1ff..71e652ebf31 100644
--- a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c
+++ b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c
@@ -21,21 +21,21 @@
  * USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
 #include <errno.h>
 #include <fcntl.h>
 #include <stdio.h>
 #include <sys/ioctl.h>
 #include <sys/stat.h>
 
 #include "os/os_mman.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 #include "util/u_memory.h"
 #include "util/u_format.h"
 #include "util/u_hash_table.h"
 #include "util/u_inlines.h"
 #include "state_tracker/drm_driver.h"
 #include "virgl/virgl_screen.h"
 #include "virgl/virgl_public.h"
 
 #include <xf86drm.h>
 #include "virtgpu_drm.h"
diff --git a/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c b/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c
index 404ba58b08d..d76be4d5d32 100644
--- a/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c
+++ b/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c
@@ -17,21 +17,21 @@
  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
  * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  * USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 #include <stdio.h>
 #include "util/u_memory.h"
 #include "util/u_format.h"
 #include "util/u_inlines.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
 #include "state_tracker/sw_winsys.h"
 
 #include "virgl_vtest_winsys.h"
 #include "virgl_vtest_public.h"
 
 static void *virgl_vtest_resource_map(struct virgl_winsys *vws,
                                       struct virgl_hw_res *res);
 static void virgl_vtest_resource_unmap(struct virgl_winsys *vws,
                                        struct virgl_hw_res *res);
 
diff --git a/src/util/Makefile.sources b/src/util/Makefile.sources
index 407b2825624..65de6f6df7b 100644
--- a/src/util/Makefile.sources
+++ b/src/util/Makefile.sources
@@ -15,20 +15,22 @@ MESA_UTIL_FILES := \
 	format_srgb.h \
 	futex.h \
 	half_float.c \
 	half_float.h \
 	hash_table.c \
 	hash_table.h \
 	list.h \
 	macros.h \
 	mesa-sha1.c \
 	mesa-sha1.h \
+	os_time.c \
+	os_time.h \
 	sha1/sha1.c \
 	sha1/sha1.h \
 	ralloc.c \
 	ralloc.h \
 	rand_xor.c \
 	rand_xor.h \
 	register_allocate.c \
 	register_allocate.h \
 	rgtc.c \
 	rgtc.h \
diff --git a/src/util/meson.build b/src/util/meson.build
index 0940e4d12a7..bde529be562 100644
--- a/src/util/meson.build
+++ b/src/util/meson.build
@@ -39,20 +39,22 @@ files_mesa_util = files(
   'format_srgb.h',
   'futex.h',
   'half_float.c',
   'half_float.h',
   'hash_table.c',
   'hash_table.h',
   'list.h',
   'macros.h',
   'mesa-sha1.c',
   'mesa-sha1.h',
+  'os_time.c',
+  'os_time.h',
   'sha1/sha1.c',
   'sha1/sha1.h',
   'ralloc.c',
   'ralloc.h',
   'rand_xor.c',
   'rand_xor.h',
   'register_allocate.c',
   'register_allocate.h',
   'rgtc.c',
   'rgtc.h',
diff --git a/src/gallium/auxiliary/os/os_time.c b/src/util/os_time.c
similarity index 92%
rename from src/gallium/auxiliary/os/os_time.c
rename to src/util/os_time.c
index e4a1cae641a..8d8291ff173 100644
--- a/src/gallium/auxiliary/os/os_time.c
+++ b/src/util/os_time.c
@@ -25,37 +25,38 @@
  *
  **************************************************************************/
 
 /**
  * @file
  * OS independent time-manipulation functions.
  * 
  * @author Jose Fonseca <jfonseca at vmware.com>
  */
 
+#include "os_time.h"
+
+/* TODO: fix this dependency */
+#include "gallium/include/pipe/p_config.h"
 
-#include "pipe/p_defines.h"
 #include "util/u_atomic.h"
 
 #if defined(PIPE_OS_UNIX)
 #  include <time.h> /* timeval */
 #  include <sys/time.h> /* timeval */
 #  include <sched.h> /* sched_yield */
 #  include <errno.h>
 #elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
 #  include <windows.h>
 #else
 #  error Unsupported OS
 #endif
 
-#include "os_time.h"
-
 
 int64_t
 os_time_get_nano(void)
 {
 #if defined(PIPE_OS_LINUX)
 
    struct timespec tv;
    clock_gettime(CLOCK_MONOTONIC, &tv);
    return tv.tv_nsec + tv.tv_sec*INT64_C(1000000000);
 
@@ -114,44 +115,44 @@ os_time_sleep(int64_t usecs)
 }
 
 
 
 int64_t
 os_time_get_absolute_timeout(uint64_t timeout)
 {
    int64_t time, abs_timeout;
 
    /* Also check for the type upper bound. */
-   if (timeout == PIPE_TIMEOUT_INFINITE || timeout > INT64_MAX)
-      return PIPE_TIMEOUT_INFINITE;
+   if (timeout == OS_TIMEOUT_INFINITE || timeout > INT64_MAX)
+      return OS_TIMEOUT_INFINITE;
 
    time = os_time_get_nano();
    abs_timeout = time + (int64_t)timeout;
 
    /* Check for overflow. */
    if (abs_timeout < time)
-      return PIPE_TIMEOUT_INFINITE;
+      return OS_TIMEOUT_INFINITE;
 
    return abs_timeout;
 }
 
 
 bool
 os_wait_until_zero(volatile int *var, uint64_t timeout)
 {
    if (!p_atomic_read(var))
       return true;
 
    if (!timeout)
       return false;
 
-   if (timeout == PIPE_TIMEOUT_INFINITE) {
+   if (timeout == OS_TIMEOUT_INFINITE) {
       while (p_atomic_read(var)) {
 #if defined(PIPE_OS_UNIX)
          sched_yield();
 #endif
       }
       return true;
    }
    else {
       int64_t start_time = os_time_get_nano();
       int64_t end_time = start_time + timeout;
@@ -168,22 +169,22 @@ os_wait_until_zero(volatile int *var, uint64_t timeout)
    }
 }
 
 
 bool
 os_wait_until_zero_abs_timeout(volatile int *var, int64_t timeout)
 {
    if (!p_atomic_read(var))
       return true;
 
-   if (timeout == PIPE_TIMEOUT_INFINITE)
-      return os_wait_until_zero(var, PIPE_TIMEOUT_INFINITE);
+   if (timeout == OS_TIMEOUT_INFINITE)
+      return os_wait_until_zero(var, OS_TIMEOUT_INFINITE);
 
    while (p_atomic_read(var)) {
       if (os_time_get_nano() >= timeout)
          return false;
 
 #if defined(PIPE_OS_UNIX)
       sched_yield();
 #endif
    }
    return true;
diff --git a/src/gallium/auxiliary/os/os_time.h b/src/util/os_time.h
similarity index 89%
rename from src/gallium/auxiliary/os/os_time.h
rename to src/util/os_time.h
index ca0bdd5a0c4..049ab118db2 100644
--- a/src/gallium/auxiliary/os/os_time.h
+++ b/src/util/os_time.h
@@ -28,34 +28,29 @@
 /**
  * @file
  * OS independent time-manipulation functions.
  * 
  * @author Jose Fonseca <jfonseca at vmware.com>
  */
 
 #ifndef _OS_TIME_H_
 #define _OS_TIME_H_
 
-
-#include "pipe/p_config.h"
-
-#if defined(PIPE_OS_UNIX)
-#  include <unistd.h> /* usleep */
-#endif
-
-#include "pipe/p_compiler.h"
-
+#include <stdbool.h>
+#include <stdint.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+/* must be equal to PIPE_TIMEOUT_INFINITE */
+#define OS_TIMEOUT_INFINITE 0xffffffffffffffffull
 
 /*
  * Get the current time in nanoseconds from an unknown base.
  */
 int64_t
 os_time_get_nano(void);
 
 
 /*
  * Get the current time in microseconds from an unknown base.
@@ -72,60 +67,60 @@ os_time_get(void)
  */
 void
 os_time_sleep(int64_t usecs);
 
 
 /*
  * Helper function for detecting time outs, taking in account overflow.
  *
  * Returns true if the current time has elapsed beyond the specified interval.
  */
-static inline boolean
+static inline bool
 os_time_timeout(int64_t start,
                 int64_t end,
                 int64_t curr)
 {
    if (start <= end)
       return !(start <= curr && curr < end);
    else
       return !((start <= curr) || (curr < end));
 }
 
 
 /**
  * Convert a relative timeout in nanoseconds into an absolute timeout,
  * in other words, it returns current time + timeout.
  * os_time_get_nano() must be monotonic.
- * PIPE_TIMEOUT_INFINITE is passed through unchanged. If the calculation
- * overflows, PIPE_TIMEOUT_INFINITE is returned.
+ * OS_TIMEOUT_INFINITE is passed through unchanged. If the calculation
+ * overflows, OS_TIMEOUT_INFINITE is returned.
  */
 int64_t
 os_time_get_absolute_timeout(uint64_t timeout);
 
 
 /**
  * Wait until the variable at the given memory location is zero.
  *
  * \param var           variable
  * \param timeout       timeout in ns, can be anything from 0 (no wait) to
- *                      PIPE_TIME_INFINITE (wait forever)
+ *                      OS_TIMEOUT_INFINITE (wait forever)
  * \return     true if the variable is zero
  */
 bool
 os_wait_until_zero(volatile int *var, uint64_t timeout);
 
 
 /**
  * Wait until the variable at the given memory location is zero.
  * The timeout is the absolute time when the waiting should stop. If it is
  * less than or equal to the current time, it only returns the status and
- * doesn't wait. PIPE_TIME_INFINITE waits forever. This requires that
+ * doesn't wait. OS_TIMEOUT_INFINITE waits forever. This requires that
  * os_time_get_nano is monotonic.
  *
  * \param var       variable
  * \param timeout   the time in ns when the waiting should stop
  * \return     true if the variable is zero
  */
 bool
 os_wait_until_zero_abs_timeout(volatile int *var, int64_t timeout);
 
 #ifdef __cplusplus
-- 
2.11.0



More information about the mesa-dev mailing list