Browse Source

Bugfix: Fix build without curses but with OpenCL

nfactor-troky
Luke Dashjr 12 years ago
parent
commit
a1edc7dbcb
  1. 12
      adl.c
  2. 5
      cgminer.c
  3. 5
      driver-opencl.c
  4. 2
      logging.c

12
adl.c

@ -33,6 +33,10 @@ @@ -33,6 +33,10 @@
#endif
#include "adl_functions.h"
#ifndef HAVE_CURSES
#define wlogprint(...) applog(LOG_WARNING, __VA_ARGS__)
#endif
bool adl_active;
bool opt_reorder = false;
@ -764,6 +768,7 @@ bool gpu_stats(int gpu, float *temp, int *engineclock, int *memclock, float *vdd @@ -764,6 +768,7 @@ bool gpu_stats(int gpu, float *temp, int *engineclock, int *memclock, float *vdd
return true;
}
#ifdef HAVE_CURSES
static void get_enginerange(int gpu, int *imin, int *imax)
{
struct gpu_adl *ga;
@ -776,6 +781,7 @@ static void get_enginerange(int gpu, int *imin, int *imax) @@ -776,6 +781,7 @@ static void get_enginerange(int gpu, int *imin, int *imax)
*imin = ga->lpOdParameters.sEngineClock.iMin / 100;
*imax = ga->lpOdParameters.sEngineClock.iMax / 100;
}
#endif
int set_engineclock(int gpu, int iEngineClock)
{
@ -824,6 +830,7 @@ out: @@ -824,6 +830,7 @@ out:
return ret;
}
#ifdef HAVE_CURSES
static void get_memoryrange(int gpu, int *imin, int *imax)
{
struct gpu_adl *ga;
@ -836,6 +843,7 @@ static void get_memoryrange(int gpu, int *imin, int *imax) @@ -836,6 +843,7 @@ static void get_memoryrange(int gpu, int *imin, int *imax)
*imin = ga->lpOdParameters.sMemoryClock.iMin / 100;
*imax = ga->lpOdParameters.sMemoryClock.iMax / 100;
}
#endif
int set_memoryclock(int gpu, int iMemoryClock)
{
@ -876,6 +884,7 @@ out: @@ -876,6 +884,7 @@ out:
return ret;
}
#ifdef HAVE_CURSES
static void get_vddcrange(int gpu, float *imin, float *imax)
{
struct gpu_adl *ga;
@ -889,7 +898,6 @@ static void get_vddcrange(int gpu, float *imin, float *imax) @@ -889,7 +898,6 @@ static void get_vddcrange(int gpu, float *imin, float *imax)
*imax = (float)ga->lpOdParameters.sVddc.iMax / 1000;
}
#ifdef HAVE_CURSES
static float curses_float(const char *query)
{
float ret;
@ -997,6 +1005,7 @@ int set_fanspeed(int gpu, int iFanSpeed) @@ -997,6 +1005,7 @@ int set_fanspeed(int gpu, int iFanSpeed)
return ret;
}
#ifdef HAVE_CURSES
static int set_powertune(int gpu, int iPercentage)
{
struct gpu_adl *ga;
@ -1018,6 +1027,7 @@ static int set_powertune(int gpu, int iPercentage) @@ -1018,6 +1027,7 @@ static int set_powertune(int gpu, int iPercentage)
unlock_adl();
return ret;
}
#endif
/* Returns whether the fanspeed is optimal already or not. The fan_window bool
* tells us whether the current fanspeed is in the target range for fanspeeds.

5
cgminer.c

@ -202,10 +202,11 @@ enum pool_strategy pool_strategy = POOL_FAILOVER; @@ -202,10 +202,11 @@ enum pool_strategy pool_strategy = POOL_FAILOVER;
int opt_rotate_period;
static int total_urls, total_users, total_passes, total_userpasses;
static
#ifndef HAVE_CURSES
const
#endif
static bool curses_active;
bool curses_active;
static char current_block[37];
static char *current_hash;
@ -1312,8 +1313,10 @@ double total_secs = 0.1; @@ -1312,8 +1313,10 @@ double total_secs = 0.1;
static char statusline[256];
/* logstart is where the log window should start */
static int devcursor, logstart, logcursor;
#ifdef HAVE_CURSES
/* statusy is where the status window goes up to in cases where it won't fit at startup */
static int statusy;
#endif
#ifdef HAVE_OPENCL
struct cgpu_info gpus[MAX_GPUDEVICES]; /* Maximum number apparently possible */
#endif

5
driver-opencl.c

@ -1210,16 +1210,17 @@ static bool opencl_thread_prepare(struct thr_info *thr) @@ -1210,16 +1210,17 @@ static bool opencl_thread_prepare(struct thr_info *thr)
applog(LOG_INFO, "Init GPU thread %i GPU %i virtual GPU %i", i, gpu, virtual_gpu);
clStates[i] = initCl(virtual_gpu, name, sizeof(name));
if (!clStates[i]) {
#ifdef HAVE_CURSES
if (use_curses)
enable_curses();
#endif
applog(LOG_ERR, "Failed to init GPU thread %d, disabling device %d", i, gpu);
if (!failmessage) {
char *buf;
applog(LOG_ERR, "Restarting the GPU from the menu will not fix this.");
applog(LOG_ERR, "Try restarting cgminer.");
failmessage = true;
#ifdef HAVE_CURSES
char *buf;
if (use_curses) {
buf = curses_input("Press enter to continue");
if (buf)

2
logging.c

@ -18,7 +18,7 @@ bool opt_log_output = false; @@ -18,7 +18,7 @@ bool opt_log_output = false;
/* per default priorities higher than LOG_NOTICE are logged */
int opt_log_level = LOG_NOTICE;
static void my_log_curses(int prio, char *f, va_list ap)
static void my_log_curses(__maybe_unused int prio, char *f, va_list ap)
{
#ifdef HAVE_CURSES
extern bool use_curses;

Loading…
Cancel
Save