Browse Source

all: make "fast_return" only affect the final print in a job.

That way we can take advantage of printer pipelining within a job
even when fast_return is turned off.

This refactoring was also necessary for further changes in how
fast_return will work.
master
Solomon Peachy 12 months ago
parent
commit
a396200bce
  1. 3
      backend_canonselphy.c
  2. 4
      backend_canonselphyneo.c
  3. 8
      backend_common.c
  4. 2
      backend_common.h
  5. 6
      backend_dnpds40.c
  6. 4
      backend_hiti.c
  7. 4
      backend_kodak1400.c
  8. 4
      backend_kodak605.c
  9. 4
      backend_kodak6800.c
  10. 4
      backend_kodak8800.c
  11. 3
      backend_magicard.c
  12. 6
      backend_mitsu70x.c
  13. 14
      backend_mitsu9550.c
  14. 8
      backend_mitsud90.c
  15. 6
      backend_mitsup95d.c
  16. 4
      backend_shinkos1245.c
  17. 4
      backend_shinkos2145.c
  18. 4
      backend_shinkos6145.c
  19. 4
      backend_shinkos6245.c
  20. 4
      backend_sonyupd.c
  21. 4
      backend_sonyupdneo.c

3
backend_canonselphy.c

@ -812,13 +812,14 @@ static int canonselphy_read_parse(void *vctx, const void **vjob, int data_fd, in
return CUPS_BACKEND_OK;
}
static int canonselphy_main_loop(void *vctx, const void *vjob) {
static int canonselphy_main_loop(void *vctx, const void *vjob, int wait_for_return) {
struct canonselphy_ctx *ctx = vctx;
uint8_t rdbuf[READBACK_LEN], rdbuf2[READBACK_LEN];
int last_state = -1, state = S_IDLE;
int ret, num;
int copies;
(void)wait_for_return;
const struct canonselphy_printjob *job = vjob;

4
backend_canonselphyneo.c

@ -301,7 +301,7 @@ static int selphyneo_read_parse(void *vctx, const void **vjob, int data_fd, int
return CUPS_BACKEND_OK;
}
static int selphyneo_main_loop(void *vctx, const void *vjob) {
static int selphyneo_main_loop(void *vctx, const void *vjob, int wait_for_return) {
struct selphyneo_ctx *ctx = vctx;
struct selphyneo_readback rdback;
@ -410,7 +410,7 @@ top:
return CUPS_BACKEND_STOP;
}
if (rdback.data[0] > 0x02 && fast_return && copies <= 1) {
if (rdback.data[0] > 0x02 && !wait_for_return && copies <= 1) {
INFO("Fast return mode enabled.\n");
break;
}

8
backend_common.c

@ -29,7 +29,7 @@
#include <signal.h>
#include <strings.h> /* For strncasecmp */
#define BACKEND_VERSION "0.119"
#define BACKEND_VERSION "0.120"
#ifndef CORRTABLE_PATH
#ifdef PACKAGE_DATA_DIR
@ -2000,6 +2000,10 @@ int dyesub_joblist_print(const struct dyesub_joblist *list, int *pagenum)
for (i = 0 ; i < list->copies ; i++) {
for (j = 0 ; j < list->num_entries ; j++) {
int wait_on_return = 0;
if (i == (list->copies - 1) && j == (list->num_entries -1))
wait_on_return = fast_return; /* only wait on the final iteration. */
if (list->entries[j]) {
int copies = ((const struct dyesub_job_common *)(list->entries[j]))->copies;
@ -2010,7 +2014,7 @@ int dyesub_joblist_print(const struct dyesub_joblist *list, int *pagenum)
/* Print this page */
if (test_mode < TEST_MODE_NOPRINT ||
list->backend->flags & BACKEND_FLAG_DUMMYPRINT) {
ret = list->backend->main_loop(list->ctx, list->entries[j]);
ret = list->backend->main_loop(list->ctx, list->entries[j], wait_on_return);
if (ret)
return ret;
}

2
backend_common.h

@ -289,7 +289,7 @@ struct dyesub_backend {
void (*cleanup_job)(const void *job);
void *(*combine_jobs)(const void *job1, const void *job2);
int (*job_polarity)(void *ctx);
int (*main_loop)(void *ctx, const void *job);
int (*main_loop)(void *ctx, const void *job, int wait_on_return);
int (*query_serno)(struct dyesub_connection *conn, char *buf, int buf_len); /* Optional */
int (*query_markers)(void *ctx, struct marker **markers, int *count);
int (*query_stats)(void *ctx, struct printerstats *stats); /* Optional */

6
backend_dnpds40.c

@ -2103,14 +2103,14 @@ skip_checks:
DEBUG("job->dpi %u matte %d mcut %u cutter %d/%d, bufs %d spd %d\n",
job->dpi, job->matte, job->multicut, job->cutter, job->fullcut, job->buf_needed, job->printspeed);
job->can_combine = job->can_rewind; /* Any rewindable size can be stacked */
job->common.can_combine = job->can_rewind; /* Any rewindable size can be stacked */
*vjob = job;
return CUPS_BACKEND_OK;
}
static int dnpds40_main_loop(void *vctx, const void *vjob) {
static int dnpds40_main_loop(void *vctx, const void *vjob, int wait_on_return) {
struct dnpds40_ctx *ctx = vctx;
int ret;
struct dnpds40_cmd cmd;
@ -2384,7 +2384,7 @@ top:
if (ctx->partialmatte == 2)
ctx->partialmatte = 0;
if (fast_return && !manual_copies) {
if (!wait_on_return && !manual_copies) {
INFO("Fast return mode enabled.\n");
} else if (!ctx->partialmatte) {
INFO("Waiting for job to complete...\n");

4
backend_hiti.c

@ -1793,7 +1793,7 @@ static int calc_offset(int val, int mid, int max, int step)
return val;
}
static int hiti_main_loop(void *vctx, const void *vjob)
static int hiti_main_loop(void *vctx, const void *vjob, int wait_for_return)
{
struct hiti_ctx *ctx = vctx;
@ -1993,7 +1993,7 @@ resend_c:
return CUPS_BACKEND_FAILED;
}
if (fast_return) {
if (!wait_for_return) {
INFO("Fast return mode enabled.\n");
break;
}

4
backend_kodak1400.c

@ -412,7 +412,8 @@ static int kodak1400_read_parse(void *vctx, const void **vjob, int data_fd, int
static uint8_t idle_data[READBACK_LEN] = { 0xe4, 0x72, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00 };
static int kodak1400_main_loop(void *vctx, const void *vjob) {
static int kodak1400_main_loop(void *vctx, const void *vjob, int wait_for_return)
{
struct kodak1400_ctx *ctx = vctx;
uint8_t rdbuf[READBACK_LEN], rdbuf2[READBACK_LEN];
@ -421,6 +422,7 @@ static int kodak1400_main_loop(void *vctx, const void *vjob) {
int num, ret;
uint16_t temp16;
int copies;
(void)wait_for_return;
const struct kodak1400_printjob *job = vjob;

4
backend_kodak605.c

@ -430,7 +430,7 @@ static int kodak605_read_parse(void *vctx, const void **vjob, int data_fd, int c
return CUPS_BACKEND_OK;
}
static int kodak605_main_loop(void *vctx, const void *vjob) {
static int kodak605_main_loop(void *vctx, const void *vjob, int wait_for_return) {
struct kodak605_ctx *ctx = vctx;
struct kodak605_status sts;
@ -638,7 +638,7 @@ retry_print:
if (sts.hdr.status == STATUS_READY)
break;
if (fast_return) {
if (!wait_for_return) {
INFO("Fast return mode enabled.\n");
break;
}

4
backend_kodak6800.c

@ -853,7 +853,7 @@ static int kodak6800_read_parse(void *vctx, const void **vjob, int data_fd, int
return CUPS_BACKEND_OK;
}
static int kodak6800_main_loop(void *vctx, const void *vjob) {
static int kodak6800_main_loop(void *vctx, const void *vjob, int wait_for_return) {
struct kodak6800_ctx *ctx = vctx;
int num, ret;
@ -980,7 +980,7 @@ static int kodak6800_main_loop(void *vctx, const void *vjob) {
if (ctx->sts.b2_jobid == hdr.jobid && ctx->sts.b2_complete == ctx->sts.b2_total)
break;
if (fast_return) {
if (!wait_for_return) {
INFO("Fast return mode enabled.\n");
break;
}

4
backend_kodak8800.c

@ -706,7 +706,7 @@ static int kodak8800_read_parse(void *vctx, const void **vjob, int data_fd, int
return CUPS_BACKEND_OK;
}
static int kodak8800_main_loop(void *vctx, const void *vjob) {
static int kodak8800_main_loop(void *vctx, const void *vjob, int wait_for_return) {
struct kodak8800_ctx *ctx = vctx;
int ret;
@ -797,7 +797,7 @@ static int kodak8800_main_loop(void *vctx, const void *vjob) {
if (sts.sts[0] == STATE_IDLE) {
break;
}
if (fast_return) {
if (!wait_for_return) {
INFO("Fast return mode enabled.\n");
break;
}

3
backend_magicard.c

@ -817,10 +817,11 @@ static int magicard_read_parse(void *vctx, const void **vjob, int data_fd, int c
return CUPS_BACKEND_OK;
}
static int magicard_main_loop(void *vctx, const void *vjob) {
static int magicard_main_loop(void *vctx, const void *vjob, int wait_for_return) {
struct magicard_ctx *ctx = vctx;
int ret;
int copies;
(void)wait_for_return;
const struct magicard_printjob *job = vjob;

6
backend_mitsu70x.c

@ -337,7 +337,7 @@ STATIC_ASSERT(sizeof(struct mitsu70x_hdr) == 512);
STATIC_ASSERT(sizeof(struct mitsu70x_calinfo_resp) == 56);
static int mitsu70x_get_printerstatus(struct mitsu70x_ctx *ctx, struct mitsu70x_printerstatus_resp *resp);
static int mitsu70x_main_loop(void *vctx, const void *vjob);
static int mitsu70x_main_loop(void *vctx, const void *vjob, int wait_for_return);
/* Error dumps, etc */
@ -1725,7 +1725,7 @@ static int d70_library_callback(void *context, void *buffer, uint32_t len)
return ret;
}
static int mitsu70x_main_loop(void *vctx, const void *vjob)
static int mitsu70x_main_loop(void *vctx, const void *vjob, int wait_for_return)
{
struct mitsu70x_ctx *ctx = vctx;
struct mitsu70x_jobstatus jobstatus;
@ -2159,7 +2159,7 @@ top:
}
/* See if we can return early, but wait until printing has started! */
if (fast_return && copies <= 1 && /* Copies generated by backend! */
if (!wait_for_return && copies <= 1 && /* Copies generated by backend! */
jobstatus.job_status[0] == JOB_STATUS0_PRINT &&
jobstatus.job_status[1] > JOB_STATUS1_PRINT_MEDIALOAD)
{

14
backend_mitsu9550.c

@ -202,7 +202,7 @@ struct mitsu9550_status2 {
uint8_t unkb[4]; /* 0a 00 00 01 */
} __attribute__((packed));
static int mitsu9550_main_loop(void *vctx, const void *vjob);
static int mitsu9550_main_loop(void *vctx, const void *vjob, int wait_for_return);
static const char *cp30_errors(uint16_t err)
{
@ -732,7 +732,7 @@ hdr_done:
/* All further work is in main loop */
if (test_mode >= TEST_MODE_NOPRINT)
mitsu9550_main_loop(ctx, job);
mitsu9550_main_loop(ctx, job, 1);
*vjob = job;
@ -1004,7 +1004,7 @@ static int validate_media(int type, int media, int cols, int rows)
return CUPS_BACKEND_OK;
}
static int mitsu9550_main_loop(void *vctx, const void *vjob) {
static int mitsu9550_main_loop(void *vctx, const void *vjob, int wait_for_return) {
struct mitsu9550_ctx *ctx = vctx;
struct mitsu9550_cmd cmd;
uint8_t rdbuf[READBACK_LEN];
@ -1333,9 +1333,9 @@ top:
if (sts30->sts == CP30_STS_IDLE) /* If printer transitions to idle */
break;
// XXX if (fast_return && copies_remaining == 0) break...
// XXX if (!wait_for_return && copies_remaining == 0) break...
if (fast_return && sts30->sts != CP30_STS_IDLE) {
if (!wait_for_return && sts30->sts != CP30_STS_IDLE) {
INFO("Fast return mode enabled.\n");
break;
}
@ -1351,12 +1351,12 @@ top:
if (!sts->sts1) /* If printer transitions to idle */
break;
if (fast_return && !be16_to_cpu(sts->copies)) { /* No remaining prints */
if (!wait_for_return && !be16_to_cpu(sts->copies)) { /* No remaining prints */
INFO("Fast return mode enabled.\n");
break;
}
if (fast_return && !sts->sts5) {
if (!wait_for_return && !sts->sts5) {
INFO("Fast return mode enabled.\n");
break;
}

8
backend_mitsud90.c

@ -719,7 +719,7 @@ static void mitsud90_cleanup_job(const void *vjob)
STATIC_ASSERT(sizeof(struct mitsud90_job_hdr) == 512);
STATIC_ASSERT(sizeof(struct mitsud90_plane_hdr) == 512);
static int mitsud90_main_loop(void *vctx, const void *vjob);
static int mitsud90_main_loop(void *vctx, const void *vjob, int wait_for_return);
static int mitsud90_panorama_splitjob(struct mitsud90_printjob *injob, struct mitsud90_printjob **newjobs)
{
@ -1024,7 +1024,7 @@ static int mitsud90_read_parse(void *vctx, const void **vjob, int data_fd, int c
/* All further work is in main loop */
if (test_mode >= TEST_MODE_NOPRINT)
mitsud90_main_loop(ctx, job);
mitsud90_main_loop(ctx, job, 1);
return CUPS_BACKEND_OK;
}
@ -1054,7 +1054,7 @@ static int cpm1_fillmatte(struct mitsud90_printjob *job)
return CUPS_BACKEND_OK;
}
static int mitsud90_main_loop(void *vctx, const void *vjob) {
static int mitsud90_main_loop(void *vctx, const void *vjob, int wait_for_return) {
struct mitsud90_ctx *ctx = vctx;
struct mitsud90_status_resp resp;
uint8_t last_status[2] = {0xff, 0xff};
@ -1349,7 +1349,7 @@ top:
break;
}
if (fast_return && copies <= 1) { /* Copies generated by backend? */
if (!wait_for_return && copies <= 1) { /* Copies generated by backend? */
INFO("Fast return mode enabled.\n");
break;
}

6
backend_mitsup95d.c

@ -348,7 +348,7 @@ top:
goto top;
}
static int mitsup95d_main_loop(void *vctx, const void *vjob) {
static int mitsup95d_main_loop(void *vctx, const void *vjob, int wait_for_return) {
struct mitsup95d_ctx *ctx = vctx;
uint8_t queryresp[QUERYRESP_SIZE_MAX];
int ret;
@ -474,7 +474,7 @@ static int mitsup95d_main_loop(void *vctx, const void *vjob) {
break;
if (queryresp[7] > 0) {
if (fast_return) {
if (!wait_for_return) {
INFO("Fast return mode enabled.\n");
break;
}
@ -487,7 +487,7 @@ static int mitsup95d_main_loop(void *vctx, const void *vjob) {
if (queryresp[6] == 0x30)
break;
if (queryresp[6] == 0x43 && queryresp[7] > 0) {
if (fast_return) {
if (!wait_for_return) {
INFO("Fast return mode enabled.\n");
break;
}

4
backend_shinkos1245.c

@ -1006,7 +1006,7 @@ static int shinkos1245_read_parse(void *vctx, const void **vjob, int data_fd, in
return CUPS_BACKEND_OK;
}
static int shinkos1245_main_loop(void *vctx, const void *vjob) {
static int shinkos1245_main_loop(void *vctx, const void *vjob, int wait_for_return) {
struct shinkos1245_ctx *ctx = vctx;
int i, num, last_state = -1, state = S_IDLE;
struct shinkos1245_resp_status status1, status2;
@ -1168,7 +1168,7 @@ top:
break;
}
case S_PRINTER_SENT_DATA:
if (fast_return) {
if (!wait_for_return) {
INFO("Fast return mode enabled.\n");
state = S_FINISHED;
}

4
backend_shinkos2145.c

@ -923,7 +923,7 @@ static int shinkos2145_read_parse(void *vctx, const void **vjob, int data_fd, in
return CUPS_BACKEND_OK;
}
static int shinkos2145_main_loop(void *vctx, const void *vjob) {
static int shinkos2145_main_loop(void *vctx, const void *vjob, int wait_for_return) {
struct shinkos2145_ctx *ctx = vctx;
int ret, num;
@ -1055,7 +1055,7 @@ top:
break;
}
case S_PRINTER_SENT_DATA:
if (fast_return) {
if (!wait_for_return) {
INFO("Fast return mode enabled.\n");
state = S_FINISHED;
} else if (sts.hdr.status == STATUS_READY ||

4
backend_shinkos6145.c

@ -1490,7 +1490,7 @@ done:
return newjob;
}
static int shinkos6145_main_loop(void *vctx, const void *vjob) {
static int shinkos6145_main_loop(void *vctx, const void *vjob, int wait_for_return) {
struct shinkos6145_ctx *ctx = vctx;
int ret, num;
@ -1802,7 +1802,7 @@ top:
break;
}
case S_PRINTER_SENT_DATA:
if (fast_return) {
if (!wait_for_return) {
INFO("Fast return mode enabled.\n");
state = S_FINISHED;
} else if (sts.hdr.status == STATUS_READY) {

4
backend_shinkos6245.c

@ -1074,7 +1074,7 @@ static struct kodak8810_cutlist cutlist_8x4x3_d = {
.cut[5] = 3624,
};
static int shinkos6245_main_loop(void *vctx, const void *vjob) {
static int shinkos6245_main_loop(void *vctx, const void *vjob, int wait_for_return) {
struct shinkos6245_ctx *ctx = vctx;
int ret, num;
@ -1322,7 +1322,7 @@ top:
state = S_PRINTER_SENT_DATA;
break;
case S_PRINTER_SENT_DATA:
if (fast_return) {
if (!wait_for_return) {
INFO("Fast return mode enabled.\n");
state = S_FINISHED;
} else if (sts.hdr.status == STATUS_READY) {

4
backend_sonyupd.c

@ -512,7 +512,7 @@ static int upd_read_parse(void *vctx, const void **vjob, int data_fd, int copies
return CUPS_BACKEND_OK;
}
static int upd_main_loop(void *vctx, const void *vjob) {
static int upd_main_loop(void *vctx, const void *vjob, int wait_for_return) {
struct upd_ctx *ctx = vctx;
int i, ret;
int copies;
@ -622,7 +622,7 @@ retry:
return CUPS_BACKEND_STOP;
}
if (fast_return && ctx->stsbuf.printing != UPD_PRINTING_IDLE) {
if (!wait_for_return && ctx->stsbuf.printing != UPD_PRINTING_IDLE) {
INFO("Fast return mode enabled.\n");
} else {
goto retry;

4
backend_sonyupdneo.c

@ -534,7 +534,7 @@ static void updneo_dump_status(struct updneo_ctx *ctx, struct updneo_sts *sts)
}
}
static int updneo_main_loop(void *vctx, const void *vjob) {
static int updneo_main_loop(void *vctx, const void *vjob, int wait_for_return) {
struct updneo_ctx *ctx = vctx;
int ret;
int copies;
@ -601,7 +601,7 @@ retry:
/* See if we're busy... */
if (ctx->sts.scprs != 0) {
if (fast_return) {
if (!wait_for_return) {
INFO("Fast return mode enabled.\n");
} else {
goto retry;

Loading…
Cancel
Save