Browse Source

Merge branch 'master' into hashfast

Conflicts:
	Makefile.am
nfactor-troky
Con Kolivas 11 years ago
parent
commit
5ea6a8eaa2
  1. 12
      Makefile.am
  2. 2
      cgminer.c
  3. 2
      compat/Makefile.am
  4. 30
      configure.ac
  5. 18
      miner.h

12
Makefile.am

@ -22,8 +22,6 @@ INCLUDES = $(PTHREAD_FLAGS) -fno-strict-aliasing $(JANSSON_INCLUDES) $(USBUTILS_
bin_PROGRAMS = cgminer bin_PROGRAMS = cgminer
bin_SCRIPTS = $(top_srcdir)/*.cl
cgminer_LDFLAGS = $(PTHREAD_FLAGS) cgminer_LDFLAGS = $(PTHREAD_FLAGS)
cgminer_LDADD = $(DLOPEN_FLAGS) @LIBCURL_LIBS@ @JANSSON_LIBS@ @PTHREAD_LIBS@ \ cgminer_LDADD = $(DLOPEN_FLAGS) @LIBCURL_LIBS@ @JANSSON_LIBS@ @PTHREAD_LIBS@ \
@OPENCL_LIBS@ @NCURSES_LIBS@ @PDCURSES_LIBS@ @WS2_LIBS@ \ @OPENCL_LIBS@ @NCURSES_LIBS@ @PDCURSES_LIBS@ @WS2_LIBS@ \
@ -47,11 +45,10 @@ cgminer_SOURCES += elist.h miner.h compat.h bench_block.h \
cgminer_SOURCES += logging.c cgminer_SOURCES += logging.c
# GPU sources, TODO: make them selectable if HAS_OPENCL
# the GPU portion extracted from original main.c bin_SCRIPTS = $(top_srcdir)/*.cl
cgminer_SOURCES += driver-opencl.h driver-opencl.c
# the original GPU related sources, unchanged cgminer_SOURCES += driver-opencl.h driver-opencl.c
cgminer_SOURCES += ocl.c ocl.h findnonce.c findnonce.h cgminer_SOURCES += ocl.c ocl.h findnonce.c findnonce.h
cgminer_SOURCES += adl.c adl.h adl_functions.h cgminer_SOURCES += adl.c adl.h adl_functions.h
cgminer_SOURCES += *.cl cgminer_SOURCES += *.cl
@ -60,7 +57,8 @@ if HAS_SCRYPT
cgminer_SOURCES += scrypt.c scrypt.h cgminer_SOURCES += scrypt.c scrypt.h
endif endif
# Extra utilities required endif
if NEED_FPGAUTILS if NEED_FPGAUTILS
cgminer_SOURCES += fpgautils.c fpgautils.h cgminer_SOURCES += fpgautils.c fpgautils.h
endif endif

2
cgminer.c

@ -4975,8 +4975,10 @@ static void *input_thread(void __maybe_unused *userdata)
display_pools(); display_pools();
else if (!strncasecmp(&input, "s", 1)) else if (!strncasecmp(&input, "s", 1))
set_options(); set_options();
#if HAVE_OPENCL
else if (have_opencl && !strncasecmp(&input, "g", 1)) else if (have_opencl && !strncasecmp(&input, "g", 1))
manage_gpu(); manage_gpu();
#endif
if (opt_realquiet) { if (opt_realquiet) {
disable_curses(); disable_curses();
break; break;

2
compat/Makefile.am

@ -2,5 +2,7 @@
SUBDIRS = jansson-2.5 SUBDIRS = jansson-2.5
if WANT_USBUTILS if WANT_USBUTILS
if WANT_STATIC_LIBUSB
SUBDIRS += libusb-1.0 SUBDIRS += libusb-1.0
endif endif
endif

30
configure.ac

@ -135,10 +135,10 @@ if test -n "$CGMINER_SDK"; then
LDFLAGS="-L$CGMINER_SDK/lib/$target $LDFLAGS" LDFLAGS="-L$CGMINER_SDK/lib/$target $LDFLAGS"
fi fi
opencl="yes" opencl="no"
AC_ARG_ENABLE([opencl], AC_ARG_ENABLE([opencl],
[AC_HELP_STRING([--disable-opencl],[Override detection and disable building with opencl])], [AC_HELP_STRING([--enable-opencl],[Enable support for GPU mining with opencl])],
[opencl=$enableval] [opencl=$enableval]
) )
if test "x$opencl" != xno; then if test "x$opencl" != xno; then
@ -171,6 +171,7 @@ else
OPENCL_FLAGS="" OPENCL_FLAGS=""
OPENCL_LIBS="" OPENCL_LIBS=""
fi fi
AM_CONDITIONAL([HAS_OPENCL], [test x$opencl = xyes])
has_winpthread=false has_winpthread=false
if test "x$have_win32" = xtrue; then if test "x$have_win32" = xtrue; then
@ -344,21 +345,42 @@ AM_CONDITIONAL([HAVE_CURSES], [test x$curses = xyes])
AM_CONDITIONAL([HAVE_WINDOWS], [test x$have_win32 = xtrue]) AM_CONDITIONAL([HAVE_WINDOWS], [test x$have_win32 = xtrue])
AM_CONDITIONAL([HAVE_x86_64], [test x$have_x86_64 = xtrue]) AM_CONDITIONAL([HAVE_x86_64], [test x$have_x86_64 = xtrue])
AC_CONFIG_SUBDIRS([compat/libusb-1.0])
if test "x$want_usbutils" != xfalse; then if test "x$want_usbutils" != xfalse; then
dlibusb="no"
AC_DEFINE([USE_USBUTILS], [1], [Defined to 1 if usbutils support required]) AC_DEFINE([USE_USBUTILS], [1], [Defined to 1 if usbutils support required])
AC_ARG_WITH([system-libusb],
[AC_HELP_STRING([--with-system-libusb],[Compile against dynamic system libusb (default use included static libusb)])],
[dlibusb=$withval]
)
if test "x$dlibusb" != xno; then
case $target in
*-*-freebsd*)
LIBUSB_LIBS="-lusb"
LIBUSB_CFLAGS=""
AC_DEFINE(HAVE_LIBUSB, 1, [Define if you have libusb-1.0])
;;
*)
PKG_CHECK_MODULES(LIBUSB, libusb-1.0, [AC_DEFINE(HAVE_LIBUSB, 1, [Define if you have libusb-1.0])], [AC_MSG_ERROR([Could not find usb library - please install libusb-1.0])])
;;
esac
else
AC_CONFIG_SUBDIRS([compat/libusb-1.0])
LIBUSB_LIBS="compat/libusb-1.0/libusb/.libs/libusb-1.0.a" LIBUSB_LIBS="compat/libusb-1.0/libusb/.libs/libusb-1.0.a"
if test "x$have_linux" = "xtrue"; then if test "x$have_linux" = "xtrue"; then
PKG_CHECK_MODULES([UDEV], [libudev], LIBUSB_LIBS+=" -ludev", [AC_MSG_ERROR([Missing required libudev dev])]) LIBUSB_LIBS+=" -ludev"
fi fi
if test "x$have_darwin" = "xtrue"; then if test "x$have_darwin" = "xtrue"; then
LIBUSB_LIBS+=" -lobjc" LIBUSB_LIBS+=" -lobjc"
LDFLAGS+=" -framework CoreFoundation -framework IOKit" LDFLAGS+=" -framework CoreFoundation -framework IOKit"
fi fi
fi
else else
LIBUSB_LIBS="" LIBUSB_LIBS=""
fi fi
AM_CONDITIONAL([WANT_STATIC_LIBUSB], [test x$dlibusb = xno])
AC_CONFIG_SUBDIRS([compat/jansson-2.5]) AC_CONFIG_SUBDIRS([compat/jansson-2.5])
JANSSON_LIBS="compat/jansson-2.5/src/.libs/libjansson.a" JANSSON_LIBS="compat/jansson-2.5/src/.libs/libjansson.a"

18
miner.h

@ -886,6 +886,13 @@ static inline void _mutex_init(pthread_mutex_t *lock, const char *file, const ch
INITLOCK(lock, CGLOCK_MUTEX, file, func, line); INITLOCK(lock, CGLOCK_MUTEX, file, func, line);
} }
static inline void mutex_destroy(pthread_mutex_t *lock)
{
/* Ignore return code. This only invalidates the mutex on linux but
* releases resources on windows. */
pthread_mutex_destroy(lock);
}
static inline void _rwlock_init(pthread_rwlock_t *lock, const char *file, const char *func, const int line) static inline void _rwlock_init(pthread_rwlock_t *lock, const char *file, const char *func, const int line)
{ {
if (unlikely(pthread_rwlock_init(lock, NULL))) if (unlikely(pthread_rwlock_init(lock, NULL)))
@ -893,12 +900,23 @@ static inline void _rwlock_init(pthread_rwlock_t *lock, const char *file, const
INITLOCK(lock, CGLOCK_RW, file, func, line); INITLOCK(lock, CGLOCK_RW, file, func, line);
} }
static inline void rwlock_destroy(pthread_rwlock_t *lock)
{
pthread_rwlock_destroy(lock);
}
static inline void _cglock_init(cglock_t *lock, const char *file, const char *func, const int line) static inline void _cglock_init(cglock_t *lock, const char *file, const char *func, const int line)
{ {
_mutex_init(&lock->mutex, file, func, line); _mutex_init(&lock->mutex, file, func, line);
_rwlock_init(&lock->rwlock, file, func, line); _rwlock_init(&lock->rwlock, file, func, line);
} }
static inline void cglock_destroy(cglock_t *lock)
{
rwlock_destroy(&lock->rwlock);
mutex_destroy(&lock->mutex);
}
/* Read lock variant of cglock. Cannot be promoted. */ /* Read lock variant of cglock. Cannot be promoted. */
static inline void _cg_rlock(cglock_t *lock, const char *file, const char *func, const int line) static inline void _cg_rlock(cglock_t *lock, const char *file, const char *func, const int line)
{ {

Loading…
Cancel
Save