mirror of
https://github.com/GOSTSec/sgminer
synced 2025-03-13 06:01:03 +00:00
Bugfix: Fix build without curses but with OpenCL
This commit is contained in:
parent
b6a23d0027
commit
a1edc7dbcb
12
adl.c
12
adl.c
@ -33,6 +33,10 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "adl_functions.h"
|
#include "adl_functions.h"
|
||||||
|
|
||||||
|
#ifndef HAVE_CURSES
|
||||||
|
#define wlogprint(...) applog(LOG_WARNING, __VA_ARGS__)
|
||||||
|
#endif
|
||||||
|
|
||||||
bool adl_active;
|
bool adl_active;
|
||||||
bool opt_reorder = false;
|
bool opt_reorder = false;
|
||||||
|
|
||||||
@ -764,6 +768,7 @@ bool gpu_stats(int gpu, float *temp, int *engineclock, int *memclock, float *vdd
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_CURSES
|
||||||
static void get_enginerange(int gpu, int *imin, int *imax)
|
static void get_enginerange(int gpu, int *imin, int *imax)
|
||||||
{
|
{
|
||||||
struct gpu_adl *ga;
|
struct gpu_adl *ga;
|
||||||
@ -776,6 +781,7 @@ static void get_enginerange(int gpu, int *imin, int *imax)
|
|||||||
*imin = ga->lpOdParameters.sEngineClock.iMin / 100;
|
*imin = ga->lpOdParameters.sEngineClock.iMin / 100;
|
||||||
*imax = ga->lpOdParameters.sEngineClock.iMax / 100;
|
*imax = ga->lpOdParameters.sEngineClock.iMax / 100;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int set_engineclock(int gpu, int iEngineClock)
|
int set_engineclock(int gpu, int iEngineClock)
|
||||||
{
|
{
|
||||||
@ -824,6 +830,7 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_CURSES
|
||||||
static void get_memoryrange(int gpu, int *imin, int *imax)
|
static void get_memoryrange(int gpu, int *imin, int *imax)
|
||||||
{
|
{
|
||||||
struct gpu_adl *ga;
|
struct gpu_adl *ga;
|
||||||
@ -836,6 +843,7 @@ static void get_memoryrange(int gpu, int *imin, int *imax)
|
|||||||
*imin = ga->lpOdParameters.sMemoryClock.iMin / 100;
|
*imin = ga->lpOdParameters.sMemoryClock.iMin / 100;
|
||||||
*imax = ga->lpOdParameters.sMemoryClock.iMax / 100;
|
*imax = ga->lpOdParameters.sMemoryClock.iMax / 100;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int set_memoryclock(int gpu, int iMemoryClock)
|
int set_memoryclock(int gpu, int iMemoryClock)
|
||||||
{
|
{
|
||||||
@ -876,6 +884,7 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_CURSES
|
||||||
static void get_vddcrange(int gpu, float *imin, float *imax)
|
static void get_vddcrange(int gpu, float *imin, float *imax)
|
||||||
{
|
{
|
||||||
struct gpu_adl *ga;
|
struct gpu_adl *ga;
|
||||||
@ -889,7 +898,6 @@ static void get_vddcrange(int gpu, float *imin, float *imax)
|
|||||||
*imax = (float)ga->lpOdParameters.sVddc.iMax / 1000;
|
*imax = (float)ga->lpOdParameters.sVddc.iMax / 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_CURSES
|
|
||||||
static float curses_float(const char *query)
|
static float curses_float(const char *query)
|
||||||
{
|
{
|
||||||
float ret;
|
float ret;
|
||||||
@ -997,6 +1005,7 @@ int set_fanspeed(int gpu, int iFanSpeed)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_CURSES
|
||||||
static int set_powertune(int gpu, int iPercentage)
|
static int set_powertune(int gpu, int iPercentage)
|
||||||
{
|
{
|
||||||
struct gpu_adl *ga;
|
struct gpu_adl *ga;
|
||||||
@ -1018,6 +1027,7 @@ static int set_powertune(int gpu, int iPercentage)
|
|||||||
unlock_adl();
|
unlock_adl();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Returns whether the fanspeed is optimal already or not. The fan_window bool
|
/* 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.
|
* tells us whether the current fanspeed is in the target range for fanspeeds.
|
||||||
|
@ -202,10 +202,11 @@ enum pool_strategy pool_strategy = POOL_FAILOVER;
|
|||||||
int opt_rotate_period;
|
int opt_rotate_period;
|
||||||
static int total_urls, total_users, total_passes, total_userpasses;
|
static int total_urls, total_users, total_passes, total_userpasses;
|
||||||
|
|
||||||
|
static
|
||||||
#ifndef HAVE_CURSES
|
#ifndef HAVE_CURSES
|
||||||
const
|
const
|
||||||
#endif
|
#endif
|
||||||
static bool curses_active;
|
bool curses_active;
|
||||||
|
|
||||||
static char current_block[37];
|
static char current_block[37];
|
||||||
static char *current_hash;
|
static char *current_hash;
|
||||||
@ -1312,8 +1313,10 @@ double total_secs = 0.1;
|
|||||||
static char statusline[256];
|
static char statusline[256];
|
||||||
/* logstart is where the log window should start */
|
/* logstart is where the log window should start */
|
||||||
static int devcursor, logstart, logcursor;
|
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 */
|
/* statusy is where the status window goes up to in cases where it won't fit at startup */
|
||||||
static int statusy;
|
static int statusy;
|
||||||
|
#endif
|
||||||
#ifdef HAVE_OPENCL
|
#ifdef HAVE_OPENCL
|
||||||
struct cgpu_info gpus[MAX_GPUDEVICES]; /* Maximum number apparently possible */
|
struct cgpu_info gpus[MAX_GPUDEVICES]; /* Maximum number apparently possible */
|
||||||
#endif
|
#endif
|
||||||
|
@ -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);
|
applog(LOG_INFO, "Init GPU thread %i GPU %i virtual GPU %i", i, gpu, virtual_gpu);
|
||||||
clStates[i] = initCl(virtual_gpu, name, sizeof(name));
|
clStates[i] = initCl(virtual_gpu, name, sizeof(name));
|
||||||
if (!clStates[i]) {
|
if (!clStates[i]) {
|
||||||
|
#ifdef HAVE_CURSES
|
||||||
if (use_curses)
|
if (use_curses)
|
||||||
enable_curses();
|
enable_curses();
|
||||||
|
#endif
|
||||||
applog(LOG_ERR, "Failed to init GPU thread %d, disabling device %d", i, gpu);
|
applog(LOG_ERR, "Failed to init GPU thread %d, disabling device %d", i, gpu);
|
||||||
if (!failmessage) {
|
if (!failmessage) {
|
||||||
char *buf;
|
|
||||||
|
|
||||||
applog(LOG_ERR, "Restarting the GPU from the menu will not fix this.");
|
applog(LOG_ERR, "Restarting the GPU from the menu will not fix this.");
|
||||||
applog(LOG_ERR, "Try restarting cgminer.");
|
applog(LOG_ERR, "Try restarting cgminer.");
|
||||||
failmessage = true;
|
failmessage = true;
|
||||||
#ifdef HAVE_CURSES
|
#ifdef HAVE_CURSES
|
||||||
|
char *buf;
|
||||||
if (use_curses) {
|
if (use_curses) {
|
||||||
buf = curses_input("Press enter to continue");
|
buf = curses_input("Press enter to continue");
|
||||||
if (buf)
|
if (buf)
|
||||||
|
@ -18,7 +18,7 @@ bool opt_log_output = false;
|
|||||||
/* per default priorities higher than LOG_NOTICE are logged */
|
/* per default priorities higher than LOG_NOTICE are logged */
|
||||||
int opt_log_level = LOG_NOTICE;
|
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
|
#ifdef HAVE_CURSES
|
||||||
extern bool use_curses;
|
extern bool use_curses;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user