This repository has been archived by the owner on Apr 23, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Sean V Kelley <[email protected]>
- Loading branch information
0 parents
commit c86153e
Showing
28 changed files
with
6,152 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/************************************************************************** | ||
* | ||
* Copyright 2006-2008 Tungsten Graphics, Inc., Cedar Park, TX., USA | ||
* All Rights Reserved. | ||
* Copyright 2009 VMware, Inc., Palo Alto, CA., USA | ||
* All Rights Reserved. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a | ||
* copy of this software and associated documentation files (the | ||
* "Software"), to deal in the Software without restriction, including | ||
* without limitation the rights to use, copy, modify, merge, publish, | ||
* distribute, sub license, and/or sell copies of the Software, and to | ||
* permit persons to whom the Software is furnished to do so, subject to | ||
* the following conditions: | ||
* | ||
* The above copyright notice and this permission notice (including the | ||
* next paragraph) shall be included in all copies or substantial portions | ||
* of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL | ||
* THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS 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. | ||
* | ||
**************************************************************************/ |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
SUBDIRS = src | ||
EXTRA_DIST = COPYING NEWS README libwsbm.pc.in | ||
|
||
pkgconfigdir = @pkgconfigdir@ | ||
pkgconfig_DATA = libwsbm.pc | ||
|
||
|
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#! /bin/sh | ||
|
||
srcdir=`dirname $0` | ||
test -z "$srcdir" && srcdir=. | ||
|
||
ORIGDIR=`pwd` | ||
cd $srcdir | ||
|
||
autoreconf -v --install || exit 1 | ||
cd $ORIGDIR || exit $? | ||
|
||
$srcdir/configure "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
AC_PREREQ(2.57) | ||
AC_INIT([libwsbm], 1.1.0, [[email protected]], libwsbm) | ||
AC_CONFIG_SRCDIR([Makefile.am]) | ||
AM_INIT_AUTOMAKE([dist-bzip2]) | ||
|
||
AM_CONFIG_HEADER([config.h]) | ||
|
||
AC_DISABLE_STATIC | ||
AC_PROG_LIBTOOL | ||
AC_PROG_CC | ||
PKG_PROG_PKG_CONFIG | ||
|
||
PKG_CHECK_MODULES(libdrm, libdrm) | ||
AC_SUBST(libdrm_CFLAGS) | ||
AC_SUBST(libdrm_LIBS) | ||
AC_HEADER_STDC | ||
AC_SYS_LARGEFILE | ||
|
||
AC_CHECK_HEADER(pthread.h, [ | ||
AC_SEARCH_LIBS(pthread_cond_init, pthread, | ||
[AC_DEFINE(HAVE_PTHREADS, 1, "os has pthreads")],,,) | ||
],,,) | ||
|
||
pkgconfigdir=${libdir}/pkgconfig | ||
AC_SUBST(pkgconfigdir) | ||
|
||
AC_OUTPUT([ | ||
Makefile | ||
src/Makefile | ||
libwsbm.pc]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
prefix=@prefix@ | ||
exec_prefix=@exec_prefix@ | ||
libdir=@libdir@ | ||
includedir=@includedir@ | ||
|
||
Name: libwsbm | ||
Description: Buffer manager abstraction library. | ||
Version: @PACKAGE_VERSION@ | ||
Libs: -L${libdir} -lwsbm | ||
Cflags: -I${includedir}/wsbm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
LOCAL_PATH:= $(call my-dir) | ||
|
||
include $(CLEAR_VARS) | ||
LOCAL_SRC_FILES:= \ | ||
wsbm_driver.c \ | ||
wsbm_fencemgr.c \ | ||
wsbm_mallocpool.c \ | ||
wsbm_manager.c \ | ||
wsbm_mm.c \ | ||
wsbm_slabpool.c \ | ||
wsbm_ttmpool.c \ | ||
wsbm_userpool.c | ||
|
||
LOCAL_CFLAGS += -DHAVE_CONFIG_H | ||
LOCAL_C_INCLUDES := \ | ||
$(LOCAL_PATH)/../ \ | ||
$(TARGET_OUT_HEADERS)/drm \ | ||
$(TARGET_OUT_HEADERS)/ipp \ | ||
$(TARGET_OUT_HEADERS)/libdrm \ | ||
$(TARGET_OUT_HEADERS)/libdrm/shared-core \ | ||
$(TARGET_OUT_HEADERS)/libttm | ||
|
||
LOCAL_MODULE_TAGS := optional | ||
LOCAL_MODULE:= libwsbm | ||
LOCAL_SHARED_LIBRARIES:= libdrm | ||
include $(BUILD_SHARED_LIBRARY) | ||
|
||
include $(CLEAR_VARS) | ||
LOCAL_COPY_HEADERS_TO := libwsbm/wsbm | ||
LOCAL_COPY_HEADERS := \ | ||
wsbm_atomic.h \ | ||
wsbm_driver.h \ | ||
wsbm_fencemgr.h \ | ||
wsbm_manager.h \ | ||
wsbm_mm.h \ | ||
wsbm_pool.h \ | ||
wsbm_priv.h \ | ||
wsbm_util.h | ||
include $(BUILD_COPY_HEADERS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
lib_LTLIBRARIES = libwsbm.la | ||
|
||
libwsbm_la_CFLAGS = @libdrm_CFLAGS@ -Wall | ||
libwsbm_la_LDFLAGS = -version-number 1:1:0 -no-undefined @libdrm_LIBS@ | ||
libwsbm_la_SOURCES = \ | ||
wsbm_fencemgr.c \ | ||
wsbm_fencemgr.h \ | ||
wsbm_manager.c \ | ||
wsbm_manager.h \ | ||
wsbm_mm.c \ | ||
wsbm_mm.h \ | ||
wsbm_pool.h \ | ||
wsbm_util.h \ | ||
wsbm_mallocpool.c \ | ||
wsbm_driver.h \ | ||
wsbm_driver.c \ | ||
wsbm_ttmpool.c \ | ||
wsbm_slabpool.c \ | ||
wsbm_userpool.c \ | ||
wsbm_priv.h | ||
|
||
|
||
libwsbmincludedir = ${includedir}/wsbm | ||
libwsbminclude_HEADERS = wsbm_manager.h wsbm_pool.h wsbm_driver.h \ | ||
wsbm_fencemgr.h wsbm_util.h wsbm_atomic.h | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* config.h. Generated from config.h.in by configure. */ | ||
/* config.h.in. Generated from configure.ac by autoheader. */ | ||
|
||
/* Define to 1 if you have the <dlfcn.h> header file. */ | ||
#define HAVE_DLFCN_H 1 | ||
|
||
/* Define to 1 if you have the <inttypes.h> header file. */ | ||
#define HAVE_INTTYPES_H 1 | ||
|
||
/* Define to 1 if you have the <memory.h> header file. */ | ||
#define HAVE_MEMORY_H 1 | ||
|
||
/* "os has pthreads" */ | ||
#define HAVE_PTHREADS 1 | ||
|
||
/* Define to 1 if you have the <stdint.h> header file. */ | ||
#define HAVE_STDINT_H 1 | ||
|
||
/* Define to 1 if you have the <stdlib.h> header file. */ | ||
#define HAVE_STDLIB_H 1 | ||
|
||
/* Define to 1 if you have the <strings.h> header file. */ | ||
#define HAVE_STRINGS_H 1 | ||
|
||
/* Define to 1 if you have the <string.h> header file. */ | ||
#define HAVE_STRING_H 1 | ||
|
||
/* Define to 1 if you have the <sys/stat.h> header file. */ | ||
#define HAVE_SYS_STAT_H 1 | ||
|
||
/* Define to 1 if you have the <sys/types.h> header file. */ | ||
#define HAVE_SYS_TYPES_H 1 | ||
|
||
/* Define to 1 if you have the <unistd.h> header file. */ | ||
#define HAVE_UNISTD_H 1 | ||
|
||
/* Define to the sub-directory in which libtool stores uninstalled libraries. | ||
*/ | ||
#define LT_OBJDIR ".libs/" | ||
|
||
/* Name of package */ | ||
#define PACKAGE "libwsbm" | ||
|
||
/* Define to the address where bug reports for this package should be sent. */ | ||
#define PACKAGE_BUGREPORT "[email protected]" | ||
|
||
/* Define to the full name of this package. */ | ||
#define PACKAGE_NAME "libwsbm" | ||
|
||
/* Define to the full name and version of this package. */ | ||
#define PACKAGE_STRING "libwsbm 1.1.0" | ||
|
||
/* Define to the one symbol short name of this package. */ | ||
#define PACKAGE_TARNAME "libwsbm" | ||
|
||
/* Define to the version of this package. */ | ||
#define PACKAGE_VERSION "1.1.0" | ||
|
||
/* Define to 1 if you have the ANSI C header files. */ | ||
#define STDC_HEADERS 1 | ||
|
||
/* Version number of package */ | ||
#define VERSION "1.1.0" | ||
|
||
/* Number of bits in a file offset, on hosts where this is settable. */ | ||
#define _FILE_OFFSET_BITS 64 | ||
|
||
/* Define for large files, on AIX-style hosts. */ | ||
/* #undef _LARGE_FILES */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/** | ||
* This file is under no copyright claims due to its | ||
* simplicity. | ||
*/ | ||
|
||
#ifndef _WSBM_ATOMIC_H_ | ||
#define _WSBM_ATOMIC_H_ | ||
|
||
#include <stdint.h> | ||
|
||
struct _WsbmAtomic | ||
{ | ||
int32_t count; | ||
}; | ||
|
||
#define wsbmAtomicInit(_i) {(i)} | ||
#define wsbmAtomicSet(_v, _i) (((_v)->count) = (_i)) | ||
#define wsbmAtomicRead(_v) ((_v)->count) | ||
|
||
static inline int | ||
wsbmAtomicIncZero(struct _WsbmAtomic *v) | ||
{ | ||
unsigned char c; | ||
__asm__ __volatile__("lock; incl %0; sete %1":"+m"(v->count), "=qm"(c) | ||
::"memory"); | ||
|
||
return c != 0; | ||
} | ||
|
||
static inline int | ||
wsbmAtomicDecNegative(struct _WsbmAtomic *v) | ||
{ | ||
unsigned char c; | ||
int i = -1; | ||
__asm__ __volatile__("lock; addl %2,%0; sets %1":"+m"(v->count), "=qm"(c) | ||
:"ir"(i):"memory"); | ||
|
||
return c; | ||
} | ||
|
||
static inline int | ||
wsbmAtomicDecZero(struct _WsbmAtomic *v) | ||
{ | ||
unsigned char c; | ||
|
||
__asm__ __volatile__("lock; decl %0; sete %1":"+m"(v->count), "=qm"(c) | ||
::"memory"); | ||
|
||
return c != 0; | ||
} | ||
|
||
static inline void | ||
wsbmAtomicInc(struct _WsbmAtomic *v) | ||
{ | ||
__asm__ __volatile__("lock; incl %0":"+m"(v->count)); | ||
} | ||
|
||
static inline void | ||
wsbmAtomicDec(struct _WsbmAtomic *v) | ||
{ | ||
__asm__ __volatile__("lock; decl %0":"+m"(v->count)); | ||
} | ||
|
||
static inline int32_t | ||
wsbmAtomicCmpXchg(volatile struct _WsbmAtomic *v, int32_t old, int32_t new) | ||
{ | ||
int32_t previous; | ||
|
||
__asm__ __volatile__("lock; cmpxchgl %k1,%2":"=a"(previous) | ||
:"r"(new), "m"(v->count), "0"(old) | ||
:"memory"); | ||
|
||
return previous; | ||
} | ||
|
||
#endif |
Oops, something went wrong.