Exemplo n.º 1
0
static void add_gather(struct nvhost_channel_userctx *ctx,
		u32 mem_id, u32 words, u32 offset)
{
	struct nvmap_pinarray_elem *pin;
	u32* cur_gather = ctx->cur_gather;
	pin = &ctx->pinarray[ctx->pinarray_size++];
	pin->patch_mem = (u32)nvmap_ref_to_handle(ctx->gather_mem);
	pin->patch_offset = ((cur_gather + 1) - ctx->gathers) * sizeof(u32);
	pin->pin_mem = mem_id;
	pin->pin_offset = offset;
	cur_gather[0] = words;
	ctx->cur_gather = cur_gather + 2;
}
int nvhost_job_pin(struct nvhost_job *job)
{
	int err = 0;

	/* pin mem handles and patch physical addresses */
	job->num_unpins = nvmap_pin_array(job->nvmap,
				nvmap_ref_to_handle(job->gather_mem),
				job->pinarray, job->num_pins,
				job->unpins);
	if (job->num_unpins < 0)
		err = job->num_unpins;

	return err;
}
void nvhost_job_add_gather(struct nvhost_job *job,
		u32 mem_id, u32 words, u32 offset)
{
	struct nvmap_pinarray_elem *pin;
	struct nvhost_channel_gather *cur_gather =
			&job->gathers[job->num_gathers];

	pin = &job->pinarray[job->num_pins++];
	pin->patch_mem = (u32)nvmap_ref_to_handle(job->gather_mem);
	pin->patch_offset = (void *)&(cur_gather->mem) - (void *)job->gathers;
	pin->pin_mem = nvmap_convert_handle_u2k(mem_id);
	pin->pin_offset = offset;
	cur_gather->words = words;
	cur_gather->mem_id = mem_id;
	cur_gather->offset = offset;
	job->num_gathers += 1;
}