struct nvhost_job *nvhost_job_alloc(struct nvhost_channel *ch, struct nvhost_hwctx *hwctx, struct nvhost_submit_hdr_ext *hdr, struct mem_mgr *memmgr, int priority, int clientid) { struct nvhost_job *job = NULL; job = vzalloc(job_size(hdr)); if (!job) goto error; kref_init(&job->ref); job->ch = ch; job->hwctx = hwctx; if (hwctx) hwctx->h->get(hwctx); job->memmgr = memmgr ? mem_op().get_mgr(memmgr) : NULL; init_fields(job, hdr, priority, clientid); return job; error: if (job) nvhost_job_put(job); return NULL; }
struct nvhost_job *nvhost_job_alloc(struct nvhost_channel *ch, struct nvhost_hwctx *hwctx, struct nvhost_submit_hdr_ext *hdr, struct nvmap_client *nvmap, int priority, int clientid) { struct nvhost_job *job = NULL; int num_cmdbufs = hdr ? hdr->num_cmdbufs : 0; int err = 0; job = vzalloc(job_size(hdr)); if (!job) goto error; kref_init(&job->ref); job->ch = ch; job->hwctx = hwctx; if (hwctx) hwctx->h->get(hwctx); job->nvmap = nvmap ? nvmap_client_get(nvmap) : NULL; err = alloc_gathers(job, num_cmdbufs); if (err) goto error; init_fields(job, hdr, priority, clientid); return job; error: if (job) nvhost_job_put(job); return NULL; }
void commitall() { char sys[NAMESIZE+5]; char cmfile[NAMESIZE+5]; int i; int n; for (i = 0; i < ncsave; i++) { if (Sgrades) { if ((job_size(&csave[i]) == FAIL) || (fgrade(&csave[i]) == FAIL)) { wfremove(csave[i].file); continue; } } else { Dfileused = TRUE; csave[i].grade = Grade; } /* make new file name for for the job */ if (Sgrades) { n = retseq(csave[i].sys); (void) sprintf(cmfile, "%c.%.*s%c%.4x", *csave[i].file, SYSNSIZE, csave[i].sys, csave[i].grade, n); } else (void) strncpy(cmfile, csave[i].file, NAMESIZE-1); cmfile[NAMESIZE-1] = '\0'; DEBUG(9, "User job queued to %c queue\n", csave[i].grade); (void) sprintf(sys, "/%c", csave[i].grade); (void) strcat(csave[i].sys, sys); if (Dfileused) { putdfiles(csave[i]); Dfileused = FALSE; } wfcommit(csave[i].file, cmfile, csave[i].sys); (void) strncpy(csave[i].file, cmfile, NAMESIZE); } ncsave = 0; /* set real jobid */ (void) strncpy(jobid, BASENAME(csave[0].file, '.'), NAMESIZE); return; }
struct nvhost_job *nvhost_job_realloc( struct nvhost_job *oldjob, struct nvhost_hwctx *hwctx, struct nvhost_submit_hdr_ext *hdr, struct nvmap_client *nvmap, int priority, int clientid) { struct nvhost_job *newjob = NULL; int num_cmdbufs = hdr ? hdr->num_cmdbufs : 0; int err = 0; newjob = vzalloc(job_size(hdr)); if (!newjob) goto error; kref_init(&newjob->ref); newjob->ch = oldjob->ch; newjob->hwctx = hwctx; if (hwctx) newjob->hwctx->h->get(newjob->hwctx); newjob->timeout = oldjob->timeout; newjob->nvmap = nvmap ? nvmap_client_get(nvmap) : NULL; err = realloc_gathers(oldjob, newjob, num_cmdbufs); if (err) goto error; nvhost_job_put(oldjob); init_fields(newjob, hdr, priority, clientid); return newjob; error: if (newjob) nvhost_job_put(newjob); if (oldjob) nvhost_job_put(oldjob); return NULL; }