From 25b32eb8d00e303958497df9211ec2c45268b6af Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 25 Feb 2009 01:52:38 +0100 Subject: st/drm: Bring drm_api.h up to date with latest changes --- src/gallium/include/state_tracker/drm_api.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/gallium/include') diff --git a/src/gallium/include/state_tracker/drm_api.h b/src/gallium/include/state_tracker/drm_api.h index 54480fa047..588fa3a312 100644 --- a/src/gallium/include/state_tracker/drm_api.h +++ b/src/gallium/include/state_tracker/drm_api.h @@ -4,12 +4,14 @@ struct pipe_screen; struct pipe_winsys; +struct pipe_buffer; struct pipe_context; +struct pipe_texture; struct drm_api { /** - * Special buffer function + * Special buffer functions */ /*@{*/ struct pipe_screen* (*create_screen)(int drmFB, int pciID); @@ -17,11 +19,12 @@ struct drm_api /*@}*/ /** - * Special buffer function + * Special buffer functions */ /*@{*/ - struct pipe_buffer* (*buffer_from_handle)(struct pipe_winsys *winsys, const char *name, unsigned handle); - unsigned (*handle_from_buffer)(struct pipe_winsys *winsys, struct pipe_buffer *buffer); + boolean (*buffer_from_texture)(struct pipe_texture *texture, struct pipe_buffer **buffer, unsigned *stride); + struct pipe_buffer* (*buffer_from_handle)(struct pipe_screen *screen, const char *name, unsigned handle); + unsigned (*handle_from_buffer)(struct pipe_screen *screen, struct pipe_buffer *buffer); /*@}*/ }; -- cgit v1.2.3 From dbab39c6caacb974062ac574b365254412aea412 Mon Sep 17 00:00:00 2001 From: Benjamin Close Date: Tue, 24 Feb 2009 20:51:10 -0800 Subject: gallium: Add support for BSD operating systems, tested with FreeBSD BSD supports pipe in the same way as linux hence options which are safe for linux are also safe for BSD. Define PIPE_OS_BSD in include/pipe/p_config.h and adjust the defines to make use of it. Also define MAP_ANONYMOUS for BSD systems which use MAP_ANON Signed-off-by: Benjamin Close --- src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c | 4 ++-- src/gallium/auxiliary/rtasm/rtasm_execmem.c | 10 +++++++--- src/gallium/auxiliary/util/u_stream_stdc.c | 2 +- src/gallium/auxiliary/util/u_time.c | 12 ++++++------ src/gallium/auxiliary/util/u_time.h | 6 +++--- src/gallium/drivers/trace/tr_dump.c | 4 ++-- src/gallium/include/pipe/p_config.h | 8 ++++++-- src/gallium/include/pipe/p_thread.h | 10 +++++----- 8 files changed, 32 insertions(+), 24 deletions(-) (limited to 'src/gallium/include') diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c index 556f26c0f0..533c0a15f3 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c @@ -36,7 +36,7 @@ #include "pipe/p_config.h" -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) #include #include #endif @@ -559,7 +559,7 @@ fenced_buffer_list_destroy(struct fenced_buffer_list *fenced_list) /* Wait on outstanding fences */ while (fenced_list->numDelayed) { pipe_mutex_unlock(fenced_list->mutex); -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) sched_yield(); #endif _fenced_buffer_list_check_free(fenced_list, 1); diff --git a/src/gallium/auxiliary/rtasm/rtasm_execmem.c b/src/gallium/auxiliary/rtasm/rtasm_execmem.c index 5acc5bcb7b..1f0923b683 100644 --- a/src/gallium/auxiliary/rtasm/rtasm_execmem.c +++ b/src/gallium/auxiliary/rtasm/rtasm_execmem.c @@ -37,8 +37,12 @@ #include "rtasm_execmem.h" +#if defined(PIPE_OS_BSD) +#define MAP_ANONYMOUS MAP_ANON +#endif -#if defined(PIPE_OS_LINUX) + +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) /* @@ -114,7 +118,7 @@ rtasm_exec_free(void *addr) } -#else /* PIPE_OS_LINUX */ +#else /* PIPE_OS_LINUX || PIPE_OS_BSD */ /* * Just use regular memory. @@ -134,4 +138,4 @@ rtasm_exec_free(void *addr) } -#endif /* PIPE_OS_LINUX */ +#endif /* PIPE_OS_LINUX || PIPE_OS_BSD */ diff --git a/src/gallium/auxiliary/util/u_stream_stdc.c b/src/gallium/auxiliary/util/u_stream_stdc.c index ca80bef0f3..0ead45a749 100644 --- a/src/gallium/auxiliary/util/u_stream_stdc.c +++ b/src/gallium/auxiliary/util/u_stream_stdc.c @@ -32,7 +32,7 @@ #include "pipe/p_config.h" -#if defined(PIPE_OS_LINUX) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) #include diff --git a/src/gallium/auxiliary/util/u_time.c b/src/gallium/auxiliary/util/u_time.c index dde2c74fa8..357d9360c9 100644 --- a/src/gallium/auxiliary/util/u_time.c +++ b/src/gallium/auxiliary/util/u_time.c @@ -35,7 +35,7 @@ #include "pipe/p_config.h" -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) #include #elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) #include @@ -77,7 +77,7 @@ util_time_get_frequency(void) void util_time_get(struct util_time *t) { -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) gettimeofday(&t->tv, NULL); #elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) LONGLONG temp; @@ -102,7 +102,7 @@ util_time_add(const struct util_time *t1, int64_t usecs, struct util_time *t2) { -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) t2->tv.tv_sec = t1->tv.tv_sec + usecs / 1000000; t2->tv.tv_usec = t1->tv.tv_usec + usecs % 1000000; #elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) || defined(PIPE_SUBSYSTEM_WINDOWS_CE) @@ -124,7 +124,7 @@ int64_t util_time_diff(const struct util_time *t1, const struct util_time *t2) { -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) return (t2->tv.tv_usec - t1->tv.tv_usec) + (t2->tv.tv_sec - t1->tv.tv_sec)*1000000; #elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) || defined(PIPE_SUBSYSTEM_WINDOWS_CE) @@ -144,7 +144,7 @@ util_time_micros( void ) util_time_get(&t1); -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) return t1.tv.tv_usec + t1.tv.tv_sec*1000000LL; #elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) || defined(PIPE_SUBSYSTEM_WINDOWS_CE) util_time_get_frequency(); @@ -166,7 +166,7 @@ static INLINE int util_time_compare(const struct util_time *t1, const struct util_time *t2) { -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) if (t1->tv.tv_sec < t2->tv.tv_sec) return -1; else if(t1->tv.tv_sec > t2->tv.tv_sec) diff --git a/src/gallium/auxiliary/util/u_time.h b/src/gallium/auxiliary/util/u_time.h index 35d97d16c7..4346ce1fa4 100644 --- a/src/gallium/auxiliary/util/u_time.h +++ b/src/gallium/auxiliary/util/u_time.h @@ -38,7 +38,7 @@ #include "pipe/p_config.h" -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) #include /* timeval */ #include /* usleep */ #endif @@ -58,7 +58,7 @@ extern "C" { */ struct util_time { -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) struct timeval tv; #else int64_t counter; @@ -89,7 +89,7 @@ util_time_timeout(const struct util_time *start, const struct util_time *end, const struct util_time *curr); -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) #define util_time_sleep usleep #else void diff --git a/src/gallium/drivers/trace/tr_dump.c b/src/gallium/drivers/trace/tr_dump.c index d98cef221b..8757ac8bec 100644 --- a/src/gallium/drivers/trace/tr_dump.c +++ b/src/gallium/drivers/trace/tr_dump.c @@ -40,7 +40,7 @@ #include "pipe/p_config.h" -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) #include #endif @@ -236,7 +236,7 @@ boolean trace_dump_trace_begin() trace_dump_writes("\n"); trace_dump_writes("\n"); -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) /* Linux applications rarely cleanup GL / Gallium resources so catch * application exit here */ atexit(trace_dump_trace_close); diff --git a/src/gallium/include/pipe/p_config.h b/src/gallium/include/pipe/p_config.h index 05cbd2fc4d..7f7657031d 100644 --- a/src/gallium/include/pipe/p_config.h +++ b/src/gallium/include/pipe/p_config.h @@ -111,6 +111,10 @@ #define PIPE_OS_LINUX #endif +#if defined(__FreeBSD__) +#define PIPE_OS_BSD +#endif + #if defined(_WIN32) || defined(WIN32) #define PIPE_OS_WINDOWS #endif @@ -122,9 +126,9 @@ * NOTE: There is no way to auto-detect most of these. */ -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) #define PIPE_SUBSYSTEM_DRI -#endif /* PIPE_OS_LINUX */ +#endif /* PIPE_OS_LINUX || PIPE_OS_BSD */ #if defined(PIPE_OS_WINDOWS) #if defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) diff --git a/src/gallium/include/pipe/p_thread.h b/src/gallium/include/pipe/p_thread.h index 8af3cd958b..e59b999b9a 100644 --- a/src/gallium/include/pipe/p_thread.h +++ b/src/gallium/include/pipe/p_thread.h @@ -38,7 +38,7 @@ #include "pipe/p_compiler.h" -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) #include /* POSIX threads headers */ #include /* for perror() */ @@ -210,7 +210,7 @@ typedef unsigned pipe_condvar; */ typedef struct { -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) pthread_key_t key; #elif defined(PIPE_SUBSYSTEM_WINDOWS_USER) DWORD key; @@ -225,7 +225,7 @@ typedef struct { static INLINE void pipe_tsd_init(pipe_tsd *tsd) { -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) if (pthread_key_create(&tsd->key, NULL/*free*/) != 0) { perror("pthread_key_create(): failed to allocate key for thread specific data"); exit(-1); @@ -242,7 +242,7 @@ pipe_tsd_get(pipe_tsd *tsd) if (tsd->initMagic != (int) PIPE_TSD_INIT_MAGIC) { pipe_tsd_init(tsd); } -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) return pthread_getspecific(tsd->key); #elif defined(PIPE_SUBSYSTEM_WINDOWS_USER) assert(0); @@ -259,7 +259,7 @@ pipe_tsd_set(pipe_tsd *tsd, void *value) if (tsd->initMagic != (int) PIPE_TSD_INIT_MAGIC) { pipe_tsd_init(tsd); } -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) if (pthread_setspecific(tsd->key, value) != 0) { perror("pthread_set_specific() failed"); exit(-1); -- cgit v1.2.3 From 24a94d13c98f8b02a32213689acbd9665694318c Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 27 Feb 2009 03:25:08 +0100 Subject: st/drm: Seperate get handle for global buffer ids --- src/gallium/include/state_tracker/drm_api.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/gallium/include') diff --git a/src/gallium/include/state_tracker/drm_api.h b/src/gallium/include/state_tracker/drm_api.h index 588fa3a312..cfed8d7b24 100644 --- a/src/gallium/include/state_tracker/drm_api.h +++ b/src/gallium/include/state_tracker/drm_api.h @@ -22,9 +22,18 @@ struct drm_api * Special buffer functions */ /*@{*/ - boolean (*buffer_from_texture)(struct pipe_texture *texture, struct pipe_buffer **buffer, unsigned *stride); - struct pipe_buffer* (*buffer_from_handle)(struct pipe_screen *screen, const char *name, unsigned handle); - unsigned (*handle_from_buffer)(struct pipe_screen *screen, struct pipe_buffer *buffer); + boolean (*buffer_from_texture)(struct pipe_texture *texture, + struct pipe_buffer **buffer, + unsigned *stride); + struct pipe_buffer* (*buffer_from_handle)(struct pipe_screen *screen, + const char *name, + unsigned handle); + boolean (*handle_from_buffer)(struct pipe_screen *screen, + struct pipe_buffer *buffer, + unsigned *handle); + boolean (*global_handle_from_buffer)(struct pipe_screen *screen, + struct pipe_buffer *buffer, + unsigned *handle); /*@}*/ }; -- cgit v1.2.3 From 7a10fcb7b6263b991714778c7bbacedb2246f474 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 27 Feb 2009 10:52:09 -0800 Subject: Include p_compiler.h in drm_api.h for boolean typedef. --- src/gallium/include/state_tracker/drm_api.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/gallium/include') diff --git a/src/gallium/include/state_tracker/drm_api.h b/src/gallium/include/state_tracker/drm_api.h index cfed8d7b24..91a727be66 100644 --- a/src/gallium/include/state_tracker/drm_api.h +++ b/src/gallium/include/state_tracker/drm_api.h @@ -2,6 +2,8 @@ #ifndef _DRM_API_H_ #define _DRM_API_H_ +#include "pipe/p_compiler.h" + struct pipe_screen; struct pipe_winsys; struct pipe_buffer; -- cgit v1.2.3