Browse Source

bitfury: Implement queue_full to ensure all processors have a work ready before scanwork

Luke Dashjr 12 years ago
parent
commit
0e3f61b402
1 changed files with 24 additions and 7 deletions
  1. 24 7
      driver-bitfury.c

+ 24 - 7
driver-bitfury.c

@@ -177,6 +177,29 @@ bool bitfury_init(struct thr_info *thr)
 	return true;
 }
 
+static
+bool bitfury_queue_full(struct cgpu_info *cgpu)
+{
+	struct cgpu_info *proc;
+	struct bitfury_device *bitfury;
+	
+	for (proc = cgpu; proc; proc = proc->next_proc)
+	{
+		bitfury = proc->device_data;
+		
+		if (bitfury->work)
+			continue;
+		
+		bitfury->work = get_queued(cgpu);
+		if (!bitfury->work)
+			return false;
+		
+		work_to_payload(&bitfury->payload, bitfury->work);
+	}
+	
+	return true;
+}
+
 static int64_t bitfury_scanHash(struct thr_info *thr)
 {
 	struct cgpu_info * const cgpu = thr->cgpu;
@@ -208,13 +231,6 @@ static int64_t bitfury_scanHash(struct thr_info *thr)
 		bitfury = proc->device_data;
 		
 		bitfury->job_switched = 0;
-		if(!bitfury->work) {
-			bitfury->work = get_queued(thr->cgpu);
-			if (bitfury->work == NULL)
-				return 0;
-			work_to_payload(&bitfury->payload, bitfury->work);
-		}
-		
 		payload_to_atrvec(bitfury->atrvec, &bitfury->payload);
 		libbitfury_sendHashData1(chip, bitfury);
 	}
@@ -399,6 +415,7 @@ struct device_drv bitfury_drv = {
 	.drv_detect = bitfury_detect,
 	.thread_prepare = bitfury_prepare,
 	.thread_init = bitfury_init,
+	.queue_full = bitfury_queue_full,
 	.scanwork = bitfury_scanHash,
 	.thread_shutdown = bitfury_shutdown,
 	.minerloop = hash_queued_work,