Browse Source

icarus: Move actual dynclock updates to icarus_job_start

Otherwise a dynclock-capable identify-capable device could confuse things
Luke Dashjr 12 years ago
parent
commit
748d42f581
1 changed files with 8 additions and 2 deletions
  1. 8 2
      driver-icarus.c

+ 8 - 2
driver-icarus.c

@@ -772,11 +772,19 @@ bool icarus_job_prepare(struct thr_info *thr, struct work *work, __maybe_unused
 static bool icarus_job_start(struct thr_info *thr)
 static bool icarus_job_start(struct thr_info *thr)
 {
 {
 	struct cgpu_info *icarus = thr->cgpu;
 	struct cgpu_info *icarus = thr->cgpu;
+	struct ICARUS_INFO *info = icarus->device_data;
 	struct icarus_state *state = thr->cgpu_data;
 	struct icarus_state *state = thr->cgpu_data;
 	const uint8_t * const ob_bin = state->ob_bin;
 	const uint8_t * const ob_bin = state->ob_bin;
 	int fd = icarus->device_fd;
 	int fd = icarus->device_fd;
 	int ret;
 	int ret;
 
 
+	// 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)) {
+		dclk_preUpdate(&info->dclk);
+		dclk_updateFreq(&info->dclk, info->dclk_change_clock_func, thr);
+	}
+	
 	cgtime(&state->tv_workstart);
 	cgtime(&state->tv_workstart);
 
 
 	ret = icarus_write(fd, ob_bin, 64);
 	ret = icarus_write(fd, ob_bin, 64);
@@ -889,8 +897,6 @@ static int64_t icarus_scanhash(struct thr_info *thr, struct work *work,
 			dclk_gotNonces(&info->dclk);
 			dclk_gotNonces(&info->dclk);
 		if (nonce && !test_nonce(&state->last_work, nonce, false))
 		if (nonce && !test_nonce(&state->last_work, nonce, false))
 			dclk_errorCount(&info->dclk, qsec);
 			dclk_errorCount(&info->dclk, qsec);
-		dclk_preUpdate(&info->dclk);
-		dclk_updateFreq(&info->dclk, info->dclk_change_clock_func, thr);
 	}
 	}
 
 
 	if (!icarus_job_start(thr))
 	if (!icarus_job_start(thr))