Lines Matching refs:job
41 v3d_job_free(struct v3d_context *v3d, struct v3d_job *job) in v3d_job_free() argument
43 set_foreach(job->bos, entry) { in v3d_job_free()
48 _mesa_hash_table_remove_key(v3d->jobs, &job->key); in v3d_job_free()
50 if (job->write_prscs) { in v3d_job_free()
51 set_foreach(job->write_prscs, entry) { in v3d_job_free()
59 if (job->cbufs[i]) { in v3d_job_free()
61 job->cbufs[i]->texture); in v3d_job_free()
62 pipe_surface_reference(&job->cbufs[i], NULL); in v3d_job_free()
65 if (job->zsbuf) { in v3d_job_free()
66 struct v3d_resource *rsc = v3d_resource(job->zsbuf->texture); in v3d_job_free()
72 job->zsbuf->texture); in v3d_job_free()
73 pipe_surface_reference(&job->zsbuf, NULL); in v3d_job_free()
76 if (v3d->job == job) in v3d_job_free()
77 v3d->job = NULL; in v3d_job_free()
79 v3d_destroy_cl(&job->bcl); in v3d_job_free()
80 v3d_destroy_cl(&job->rcl); in v3d_job_free()
81 v3d_destroy_cl(&job->indirect); in v3d_job_free()
82 v3d_bo_unreference(&job->tile_alloc); in v3d_job_free()
83 v3d_bo_unreference(&job->tile_state); in v3d_job_free()
85 ralloc_free(job); in v3d_job_free()
91 struct v3d_job *job = rzalloc(v3d, struct v3d_job); in v3d_job_create() local
93 job->v3d = v3d; in v3d_job_create()
95 v3d_init_cl(job, &job->bcl); in v3d_job_create()
96 v3d_init_cl(job, &job->rcl); in v3d_job_create()
97 v3d_init_cl(job, &job->indirect); in v3d_job_create()
99 job->draw_min_x = ~0; in v3d_job_create()
100 job->draw_min_y = ~0; in v3d_job_create()
101 job->draw_max_x = 0; in v3d_job_create()
102 job->draw_max_y = 0; in v3d_job_create()
104 job->bos = _mesa_set_create(job, in v3d_job_create()
107 return job; in v3d_job_create()
111 v3d_job_add_bo(struct v3d_job *job, struct v3d_bo *bo) in v3d_job_add_bo() argument
116 if (_mesa_set_search(job->bos, bo)) in v3d_job_add_bo()
120 _mesa_set_add(job->bos, bo); in v3d_job_add_bo()
121 job->referenced_size += bo->size; in v3d_job_add_bo()
123 uint32_t *bo_handles = (void *)(uintptr_t)job->submit.bo_handles; in v3d_job_add_bo()
125 if (job->submit.bo_handle_count >= job->bo_handles_size) { in v3d_job_add_bo()
126 job->bo_handles_size = MAX2(4, job->bo_handles_size * 2); in v3d_job_add_bo()
127 bo_handles = reralloc(job, bo_handles, in v3d_job_add_bo()
128 uint32_t, job->bo_handles_size); in v3d_job_add_bo()
129 job->submit.bo_handles = (uintptr_t)(void *)bo_handles; in v3d_job_add_bo()
131 bo_handles[job->submit.bo_handle_count++] = bo->handle; in v3d_job_add_bo()
135 v3d_job_add_write_resource(struct v3d_job *job, struct pipe_resource *prsc) in v3d_job_add_write_resource() argument
137 struct v3d_context *v3d = job->v3d; in v3d_job_add_write_resource()
139 if (!job->write_prscs) { in v3d_job_add_write_resource()
140 job->write_prscs = _mesa_set_create(job, in v3d_job_add_write_resource()
145 _mesa_set_add(job->write_prscs, prsc); in v3d_job_add_write_resource()
146 _mesa_hash_table_insert(v3d->write_jobs, prsc, job); in v3d_job_add_write_resource()
153 struct v3d_job *job = entry->data; in v3d_flush_jobs_using_bo() local
155 if (_mesa_set_search(job->bos, bo)) in v3d_flush_jobs_using_bo()
156 v3d_job_submit(v3d, job); in v3d_flush_jobs_using_bo()
161 v3d_job_add_tf_write_resource(struct v3d_job *job, struct pipe_resource *prsc) in v3d_job_add_tf_write_resource() argument
163 v3d_job_add_write_resource(job, prsc); in v3d_job_add_tf_write_resource()
165 if (!job->tf_write_prscs) in v3d_job_add_tf_write_resource()
166 job->tf_write_prscs = _mesa_pointer_set_create(job); in v3d_job_add_tf_write_resource()
168 _mesa_set_add(job->tf_write_prscs, prsc); in v3d_job_add_tf_write_resource()
172 v3d_job_writes_resource_from_tf(struct v3d_job *job, in v3d_job_writes_resource_from_tf() argument
175 if (!job->tf_enabled) in v3d_job_writes_resource_from_tf()
178 if (!job->tf_write_prscs) in v3d_job_writes_resource_from_tf()
181 return _mesa_set_search(job->tf_write_prscs, prsc) != NULL; in v3d_job_writes_resource_from_tf()
207 struct v3d_job *job = entry->data; in v3d_flush_jobs_writing_resource() local
215 needs_flush = !v3d->job || v3d->job != job; in v3d_flush_jobs_writing_resource()
226 needs_flush = !v3d_job_writes_resource_from_tf(job, prsc); in v3d_flush_jobs_writing_resource()
230 v3d_job_submit(v3d, job); in v3d_flush_jobs_writing_resource()
251 struct v3d_job *job = entry->data; in v3d_flush_jobs_reading_resource() local
253 if (!_mesa_set_search(job->bos, rsc->bo)) in v3d_flush_jobs_reading_resource()
259 needs_flush = !v3d->job || v3d->job != job; in v3d_flush_jobs_reading_resource()
268 v3d_job_submit(v3d, job); in v3d_flush_jobs_reading_resource()
278 v3d_job_set_tile_buffer_size(struct v3d_job *job) in v3d_job_set_tile_buffer_size() argument
288 if (job->msaa) in v3d_job_set_tile_buffer_size()
291 if (job->cbufs[3] || job->cbufs[2]) in v3d_job_set_tile_buffer_size()
293 else if (job->cbufs[1]) in v3d_job_set_tile_buffer_size()
298 if (job->cbufs[i]) { in v3d_job_set_tile_buffer_size()
299 struct v3d_surface *surf = v3d_surface(job->cbufs[i]); in v3d_job_set_tile_buffer_size()
303 job->internal_bpp = max_bpp; in v3d_job_set_tile_buffer_size()
308 job->tile_width = tile_sizes[tile_size_index * 2 + 0]; in v3d_job_set_tile_buffer_size()
309 job->tile_height = tile_sizes[tile_size_index * 2 + 1]; in v3d_job_set_tile_buffer_size()
342 struct v3d_job *job = v3d_job_create(v3d); in v3d_get_job() local
349 pipe_surface_reference(&job->cbufs[i], cbufs[i]); in v3d_get_job()
352 job->msaa = true; in v3d_get_job()
359 pipe_surface_reference(&job->zsbuf, zsbuf); in v3d_get_job()
361 job->msaa = true; in v3d_get_job()
367 cbufs[i]->texture, job); in v3d_get_job()
370 _mesa_hash_table_insert(v3d->write_jobs, zsbuf->texture, job); in v3d_get_job()
380 job); in v3d_get_job()
384 memcpy(&job->key, &local_key, sizeof(local_key)); in v3d_get_job()
385 _mesa_hash_table_insert(v3d->jobs, &job->key, job); in v3d_get_job()
387 return job; in v3d_get_job()
393 if (v3d->job) in v3d_get_job_for_fbo()
394 return v3d->job; in v3d_get_job_for_fbo()
398 struct v3d_job *job = v3d_get_job(v3d, cbufs, zsbuf); in v3d_get_job_for_fbo() local
401 job->msaa = true; in v3d_get_job_for_fbo()
403 v3d_job_set_tile_buffer_size(job); in v3d_get_job_for_fbo()
418 job->clear |= PIPE_CLEAR_COLOR0 << i; in v3d_get_job_for_fbo()
425 job->clear |= PIPE_CLEAR_DEPTH; in v3d_get_job_for_fbo()
431 job->clear |= PIPE_CLEAR_STENCIL; in v3d_get_job_for_fbo()
434 job->draw_tiles_x = DIV_ROUND_UP(v3d->framebuffer.width, in v3d_get_job_for_fbo()
435 job->tile_width); in v3d_get_job_for_fbo()
436 job->draw_tiles_y = DIV_ROUND_UP(v3d->framebuffer.height, in v3d_get_job_for_fbo()
437 job->tile_height); in v3d_get_job_for_fbo()
439 v3d->job = job; in v3d_get_job_for_fbo()
441 return job; in v3d_get_job_for_fbo()
445 v3d_clif_dump(struct v3d_context *v3d, struct v3d_job *job) in v3d_clif_dump() argument
454 set_foreach(job->bos, entry) { in v3d_clif_dump()
465 clif_dump(clif, &job->submit); in v3d_clif_dump()
492 v3d_job_submit(struct v3d_context *v3d, struct v3d_job *job) in v3d_job_submit() argument
496 if (!job->needs_flush) in v3d_job_submit()
500 v3d41_emit_rcl(job); in v3d_job_submit()
502 v3d33_emit_rcl(job); in v3d_job_submit()
504 if (cl_offset(&job->bcl) > 0) { in v3d_job_submit()
506 v3d41_bcl_epilogue(v3d, job); in v3d_job_submit()
508 v3d33_bcl_epilogue(v3d, job); in v3d_job_submit()
515 job->submit.in_sync_rcl = v3d->out_sync; in v3d_job_submit()
518 job->submit.out_sync = v3d->out_sync; in v3d_job_submit()
520 job->submit.bcl_end = job->bcl.bo->offset + cl_offset(&job->bcl); in v3d_job_submit()
521 job->submit.rcl_end = job->rcl.bo->offset + cl_offset(&job->rcl); in v3d_job_submit()
523 job->submit.flags = 0; in v3d_job_submit()
524 if (job->tmu_dirty_rcl && screen->has_cache_flush) in v3d_job_submit()
525 job->submit.flags |= DRM_V3D_SUBMIT_CL_FLUSH_CACHE; in v3d_job_submit()
531 v3d_job_add_bo(job, job->tile_alloc); in v3d_job_submit()
532 job->submit.qma = job->tile_alloc->offset; in v3d_job_submit()
533 job->submit.qms = job->tile_alloc->size; in v3d_job_submit()
535 v3d_job_add_bo(job, job->tile_state); in v3d_job_submit()
536 job->submit.qts = job->tile_state->offset; in v3d_job_submit()
539 v3d_clif_dump(v3d, job); in v3d_job_submit()
544 ret = v3d_ioctl(v3d->fd, DRM_IOCTL_V3D_SUBMIT_CL, &job->submit); in v3d_job_submit()
565 if (v3d->streamout.num_targets && job->tf_draw_calls_queued > 0) in v3d_job_submit()
570 v3d_job_free(v3d, job); in v3d_job_submit()