mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-11 11:20:41 +01:00
gallium: Added HaikuOS platform
This commit is contained in:
parent
89a765e92b
commit
c6c44bf481
9 changed files with 31 additions and 19 deletions
|
|
@ -88,6 +88,7 @@ _debug_printf(const char *format, ...)
|
||||||
* - avoid outputing large strings (512 bytes is the current maximum length
|
* - avoid outputing large strings (512 bytes is the current maximum length
|
||||||
* that is guaranteed to be printed in all platforms)
|
* that is guaranteed to be printed in all platforms)
|
||||||
*/
|
*/
|
||||||
|
#if !defined(PIPE_OS_HAIKU)
|
||||||
static INLINE void
|
static INLINE void
|
||||||
debug_printf(const char *format, ...)
|
debug_printf(const char *format, ...)
|
||||||
{
|
{
|
||||||
|
|
@ -101,6 +102,7 @@ debug_printf(const char *format, ...)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* !PIPE_OS_HAIKU */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ... isn't portable so we need to pass arguments in parentheses.
|
* ... isn't portable so we need to pass arguments in parentheses.
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
#if defined(PIPE_SUBSYSTEM_WINDOWS_USER)
|
#if defined(PIPE_SUBSYSTEM_WINDOWS_USER)
|
||||||
# include <winsock2.h>
|
# include <winsock2.h>
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#elif defined(PIPE_OS_LINUX)
|
#elif defined(PIPE_OS_LINUX) || defined(PIPE_OS_HAIKU)
|
||||||
# include <sys/socket.h>
|
# include <sys/socket.h>
|
||||||
# include <netinet/in.h>
|
# include <netinet/in.h>
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
|
|
@ -54,7 +54,7 @@ u_socket_close(int s)
|
||||||
if (s < 0)
|
if (s < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if defined(PIPE_OS_LINUX)
|
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_HAIKU)
|
||||||
shutdown(s, SHUT_RDWR);
|
shutdown(s, SHUT_RDWR);
|
||||||
close(s);
|
close(s);
|
||||||
#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
|
#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
|
||||||
|
|
@ -169,7 +169,7 @@ u_socket_listen_on_port(uint16_t portnum)
|
||||||
void
|
void
|
||||||
u_socket_block(int s, boolean block)
|
u_socket_block(int s, boolean block)
|
||||||
{
|
{
|
||||||
#if defined(PIPE_OS_LINUX)
|
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_HAIKU)
|
||||||
int old = fcntl(s, F_GETFL, 0);
|
int old = fcntl(s, F_GETFL, 0);
|
||||||
if (old == -1)
|
if (old == -1)
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#if defined(PIPE_SUBSYSTEM_WINDOWS_USER)
|
#if defined(PIPE_SUBSYSTEM_WINDOWS_USER)
|
||||||
# define PIPE_HAVE_SOCKETS
|
# define PIPE_HAVE_SOCKETS
|
||||||
#elif defined(PIPE_OS_LINUX)
|
#elif defined(PIPE_OS_LINUX) || defined(PIPE_OS_HAIKU)
|
||||||
# define PIPE_HAVE_SOCKETS
|
# define PIPE_HAVE_SOCKETS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
#include "pipe/p_config.h"
|
#include "pipe/p_config.h"
|
||||||
|
|
||||||
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) || defined(PIPE_OS_SOLARIS)
|
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_HAIKU)
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
#include "pipe/p_config.h"
|
#include "pipe/p_config.h"
|
||||||
|
|
||||||
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE)
|
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU)
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
|
#elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
@ -77,7 +77,7 @@ util_time_get_frequency(void)
|
||||||
void
|
void
|
||||||
util_time_get(struct util_time *t)
|
util_time_get(struct util_time *t)
|
||||||
{
|
{
|
||||||
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE)
|
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU)
|
||||||
gettimeofday(&t->tv, NULL);
|
gettimeofday(&t->tv, NULL);
|
||||||
#elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
|
#elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
|
||||||
LONGLONG temp;
|
LONGLONG temp;
|
||||||
|
|
@ -102,7 +102,7 @@ util_time_add(const struct util_time *t1,
|
||||||
int64_t usecs,
|
int64_t usecs,
|
||||||
struct util_time *t2)
|
struct util_time *t2)
|
||||||
{
|
{
|
||||||
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE)
|
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU)
|
||||||
t2->tv.tv_sec = t1->tv.tv_sec + usecs / 1000000;
|
t2->tv.tv_sec = t1->tv.tv_sec + usecs / 1000000;
|
||||||
t2->tv.tv_usec = t1->tv.tv_usec + 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)
|
#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,
|
util_time_diff(const struct util_time *t1,
|
||||||
const struct util_time *t2)
|
const struct util_time *t2)
|
||||||
{
|
{
|
||||||
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE)
|
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU)
|
||||||
return (t2->tv.tv_usec - t1->tv.tv_usec) +
|
return (t2->tv.tv_usec - t1->tv.tv_usec) +
|
||||||
(t2->tv.tv_sec - t1->tv.tv_sec)*1000000;
|
(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)
|
#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);
|
util_time_get(&t1);
|
||||||
|
|
||||||
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE)
|
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU)
|
||||||
return t1.tv.tv_usec + t1.tv.tv_sec*1000000LL;
|
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)
|
#elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) || defined(PIPE_SUBSYSTEM_WINDOWS_CE)
|
||||||
util_time_get_frequency();
|
util_time_get_frequency();
|
||||||
|
|
@ -166,7 +166,7 @@ static INLINE int
|
||||||
util_time_compare(const struct util_time *t1,
|
util_time_compare(const struct util_time *t1,
|
||||||
const struct util_time *t2)
|
const struct util_time *t2)
|
||||||
{
|
{
|
||||||
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE)
|
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU)
|
||||||
if (t1->tv.tv_sec < t2->tv.tv_sec)
|
if (t1->tv.tv_sec < t2->tv.tv_sec)
|
||||||
return -1;
|
return -1;
|
||||||
else if(t1->tv.tv_sec > t2->tv.tv_sec)
|
else if(t1->tv.tv_sec > t2->tv.tv_sec)
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,11 @@
|
||||||
#include <unistd.h> /* usleep */
|
#include <unistd.h> /* usleep */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(PIPE_OS_HAIKU)
|
||||||
|
#include <sys/time.h> /* timeval */
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "pipe/p_compiler.h"
|
#include "pipe/p_compiler.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -58,7 +63,7 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
struct util_time
|
struct util_time
|
||||||
{
|
{
|
||||||
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE)
|
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU)
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
#else
|
#else
|
||||||
int64_t counter;
|
int64_t counter;
|
||||||
|
|
@ -89,7 +94,7 @@ util_time_timeout(const struct util_time *start,
|
||||||
const struct util_time *end,
|
const struct util_time *end,
|
||||||
const struct util_time *curr);
|
const struct util_time *curr);
|
||||||
|
|
||||||
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE)
|
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_HAIKU)
|
||||||
#define util_time_sleep usleep
|
#define util_time_sleep usleep
|
||||||
#else
|
#else
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -93,9 +93,11 @@ typedef int _Bool;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __HAIKU__
|
||||||
typedef unsigned int uint;
|
typedef unsigned int uint;
|
||||||
typedef unsigned char ubyte;
|
|
||||||
typedef unsigned short ushort;
|
typedef unsigned short ushort;
|
||||||
|
#endif
|
||||||
|
typedef unsigned char ubyte;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
#define boolean bool
|
#define boolean bool
|
||||||
|
|
|
||||||
|
|
@ -140,6 +140,9 @@
|
||||||
#define PIPE_OS_WINDOWS
|
#define PIPE_OS_WINDOWS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__HAIKU__)
|
||||||
|
#define PIPE_OS_HAIKU
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Subsystem.
|
* Subsystem.
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@
|
||||||
#include "util/u_debug.h" /* for assert */
|
#include "util/u_debug.h" /* for assert */
|
||||||
|
|
||||||
|
|
||||||
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
|
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_HAIKU)
|
||||||
|
|
||||||
#include <pthread.h> /* POSIX threads headers */
|
#include <pthread.h> /* POSIX threads headers */
|
||||||
#include <stdio.h> /* for perror() */
|
#include <stdio.h> /* for perror() */
|
||||||
|
|
@ -213,7 +213,7 @@ typedef unsigned pipe_condvar;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
|
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_HAIKU)
|
||||||
pthread_key_t key;
|
pthread_key_t key;
|
||||||
#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
|
#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
|
||||||
DWORD key;
|
DWORD key;
|
||||||
|
|
@ -228,7 +228,7 @@ typedef struct {
|
||||||
static INLINE void
|
static INLINE void
|
||||||
pipe_tsd_init(pipe_tsd *tsd)
|
pipe_tsd_init(pipe_tsd *tsd)
|
||||||
{
|
{
|
||||||
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
|
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_HAIKU)
|
||||||
if (pthread_key_create(&tsd->key, NULL/*free*/) != 0) {
|
if (pthread_key_create(&tsd->key, NULL/*free*/) != 0) {
|
||||||
perror("pthread_key_create(): failed to allocate key for thread specific data");
|
perror("pthread_key_create(): failed to allocate key for thread specific data");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
|
|
@ -245,7 +245,7 @@ pipe_tsd_get(pipe_tsd *tsd)
|
||||||
if (tsd->initMagic != (int) PIPE_TSD_INIT_MAGIC) {
|
if (tsd->initMagic != (int) PIPE_TSD_INIT_MAGIC) {
|
||||||
pipe_tsd_init(tsd);
|
pipe_tsd_init(tsd);
|
||||||
}
|
}
|
||||||
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
|
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_HAIKU)
|
||||||
return pthread_getspecific(tsd->key);
|
return pthread_getspecific(tsd->key);
|
||||||
#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
|
#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
|
||||||
assert(0);
|
assert(0);
|
||||||
|
|
@ -262,7 +262,7 @@ pipe_tsd_set(pipe_tsd *tsd, void *value)
|
||||||
if (tsd->initMagic != (int) PIPE_TSD_INIT_MAGIC) {
|
if (tsd->initMagic != (int) PIPE_TSD_INIT_MAGIC) {
|
||||||
pipe_tsd_init(tsd);
|
pipe_tsd_init(tsd);
|
||||||
}
|
}
|
||||||
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
|
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_HAIKU)
|
||||||
if (pthread_setspecific(tsd->key, value) != 0) {
|
if (pthread_setspecific(tsd->key, value) != 0) {
|
||||||
perror("pthread_set_specific() failed");
|
perror("pthread_set_specific() failed");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue