Browse Source

Merge commit 'fda6d46' into cg_queuedwork

Conflicts:
	miner.c
	miner.h
Luke Dashjr 13 years ago
parent
commit
98abcebff9
2 changed files with 9 additions and 1 deletions
  1. 4 1
      miner.c
  2. 5 0
      miner.h

+ 4 - 1
miner.c

@@ -6964,6 +6964,9 @@ static void fill_queue(struct thr_info *mythr, struct cgpu_info *cgpu, struct de
 		wr_lock(&cgpu->qlock);
 		wr_lock(&cgpu->qlock);
 		HASH_ADD_INT(cgpu->queued_work, id, work);
 		HASH_ADD_INT(cgpu->queued_work, id, work);
 		wr_unlock(&cgpu->qlock);
 		wr_unlock(&cgpu->qlock);
+		/* The queue_full function should be used by the driver to
+		 * actually place work items on the physical device if it
+		 * does have a queue. */
 	} while (drv->queue_full && !drv->queue_full(cgpu));
 	} while (drv->queue_full && !drv->queue_full(cgpu));
 }
 }
 
 
@@ -7002,7 +7005,7 @@ static void flush_queue(struct cgpu_info *cgpu)
  * perform a full nonce range and need a queue to maintain the device busy.
  * perform a full nonce range and need a queue to maintain the device busy.
  * Work creation and destruction is not done from within this function
  * Work creation and destruction is not done from within this function
  * directly. */
  * directly. */
-static void hash_queued_work(struct thr_info *mythr)
+void hash_queued_work(struct thr_info *mythr)
 {
 {
 	const long cycle = opt_log_interval / 5 ? : 1;
 	const long cycle = opt_log_interval / 5 ? : 1;
 	struct timeval tv_start = {0, 0}, tv_end;
 	struct timeval tv_start = {0, 0}, tv_end;

+ 5 - 0
miner.h

@@ -294,6 +294,10 @@ struct device_drv {
 #endif
 #endif
 	int64_t (*scanhash)(struct thr_info *, struct work *, int64_t);
 	int64_t (*scanhash)(struct thr_info *, struct work *, int64_t);
 	int64_t (*scanwork)(struct thr_info *);
 	int64_t (*scanwork)(struct thr_info *);
+
+	/* Used to extract work from the hash table of queued work and tell
+	 * the main loop that it should not add any further work to the table.
+	 */
 	bool (*queue_full)(struct cgpu_info *);
 	bool (*queue_full)(struct cgpu_info *);
 	void (*flush_work)(struct cgpu_info *);
 	void (*flush_work)(struct cgpu_info *);
 
 
@@ -1153,6 +1157,7 @@ extern enum test_nonce2_result _test_nonce2(struct work *, uint32_t nonce, bool
 extern void submit_nonce(struct thr_info *thr, struct work *work, uint32_t nonce);
 extern void submit_nonce(struct thr_info *thr, struct work *work, uint32_t nonce);
 extern void work_completed(struct cgpu_info *cgpu, struct work *work);
 extern void work_completed(struct cgpu_info *cgpu, struct work *work);
 extern bool abandon_work(struct work *, struct timeval *work_runtime, uint64_t hashes);
 extern bool abandon_work(struct work *, struct timeval *work_runtime, uint64_t hashes);
+extern void hash_queued_work(struct thr_info *mythr);
 extern void tailsprintf(char *f, const char *fmt, ...) FORMAT_SYNTAX_CHECK(printf, 2, 3);
 extern void tailsprintf(char *f, const char *fmt, ...) FORMAT_SYNTAX_CHECK(printf, 2, 3);
 extern void wlog(const char *f, ...) FORMAT_SYNTAX_CHECK(printf, 1, 2);
 extern void wlog(const char *f, ...) FORMAT_SYNTAX_CHECK(printf, 1, 2);
 extern void wlogprint(const char *f, ...) FORMAT_SYNTAX_CHECK(printf, 1, 2);
 extern void wlogprint(const char *f, ...) FORMAT_SYNTAX_CHECK(printf, 1, 2);