Browse Source

bitfury: Move second_run logic back to libbitfury

Luke Dashjr 12 years ago
parent
commit
454197aca9
3 changed files with 5 additions and 5 deletions
  1. 1 5
      driver-bitfury.c
  2. 3 0
      libbitfury.c
  3. 1 0
      libbitfury.h

+ 1 - 5
driver-bitfury.c

@@ -79,7 +79,6 @@ static int64_t bitfury_scanHash(struct thr_info *thr)
 	int chip_n;
 	int chip_n;
 	int chip;
 	int chip;
 	uint64_t hashes = 0;
 	uint64_t hashes = 0;
-	static bool second_run = false;
 
 
 	chip_n = thr->cgpu->chip_n;
 	chip_n = thr->cgpu->chip_n;
 
 
@@ -95,7 +94,7 @@ static int64_t bitfury_scanHash(struct thr_info *thr)
 		
 		
 		devices[chip].chip = chip;
 		devices[chip].chip = chip;
 		payload_to_atrvec(devices[chip].atrvec, &devices[chip].payload);
 		payload_to_atrvec(devices[chip].atrvec, &devices[chip].payload);
-		libbitfury_sendHashData1(&devices[chip], second_run);
+		libbitfury_sendHashData1(&devices[chip], true);
 		
 		
 		if (devices[chip].job_switched) {
 		if (devices[chip].job_switched) {
 			int i,j;
 			int i,j;
@@ -116,9 +115,6 @@ static int64_t bitfury_scanHash(struct thr_info *thr)
 			hashes += 0xffffffffull * i;
 			hashes += 0xffffffffull * i;
 		}
 		}
 	}
 	}
-	
-	second_run = true;
-	
 	return hashes;
 	return hashes;
 }
 }
 
 

+ 3 - 0
libbitfury.c

@@ -287,6 +287,9 @@ void libbitfury_sendHashData1(struct bitfury_device *d, bool want_results)
 	
 	
 	d->job_switched = newbuf[16] != oldbuf[16];
 	d->job_switched = newbuf[16] != oldbuf[16];
 	
 	
+	if (unlikely(!d->second_run))
+		d->second_run = true;
+	else
 	if (want_results && d->job_switched) {
 	if (want_results && d->job_switched) {
 		int i;
 		int i;
 		int results_num = 0;
 		int results_num = 0;

+ 1 - 0
libbitfury.h

@@ -29,6 +29,7 @@ struct bitfury_device {
 	struct bitfury_payload opayload;
 	struct bitfury_payload opayload;
 	unsigned int results[16];
 	unsigned int results[16];
 	int results_n;
 	int results_n;
+	bool second_run;
 };
 };
 
 
 int libbitfury_readHashData(unsigned int *res);
 int libbitfury_readHashData(unsigned int *res);