Browse Source

Bugfix: icarus: Remember firstrun state in case it gets changed for the next run

Luke Dashjr 12 years ago
parent
commit
b33b651660
1 changed files with 4 additions and 2 deletions
  1. 4 2
      driver-icarus.c

+ 4 - 2
driver-icarus.c

@@ -759,6 +759,7 @@ static int64_t icarus_scanhash(struct thr_info *thr, struct work *work,
 	double Ti, Xi;
 	int curr_hw_errors, i;
 	bool was_hw_error;
+	bool was_first_run;
 
 	struct ICARUS_HISTORY *history0, *history;
 	int count;
@@ -772,6 +773,7 @@ static int64_t icarus_scanhash(struct thr_info *thr, struct work *work,
 
 	icarus = thr->cgpu;
 	struct icarus_state *state = thr->cgpu_data;
+	was_first_run = state->firstrun;
 
 	// Prepare the next work immediately
 	memcpy(ob_bin, work->midstate, 32);
@@ -838,7 +840,7 @@ static int64_t icarus_scanhash(struct thr_info *thr, struct work *work,
 
 	// Handle dynamic clocking for "subclass" devices
 	// This needs to run before sending next job, since it hashes the command too
-	if (info->dclk.freqM && likely(!state->firstrun)) {
+	if (info->dclk.freqM && likely(!was_first_run)) {
 		int qsec = ((4 * elapsed.tv_sec) + (elapsed.tv_usec / 250000)) ?: 1;
 		for (int n = qsec; n; --n)
 			dclk_gotNonces(&info->dclk);
@@ -857,7 +859,7 @@ static int64_t icarus_scanhash(struct thr_info *thr, struct work *work,
 
 	work->blk.nonce = 0xffffffff;
 
-	if (state->firstrun) {
+	if (was_first_run) {
 		state->firstrun = false;
 		__copy_work(&state->last_work, work);
 		return 0;