Lines Matching refs:job
35 vc4_job_free(struct vc4_context *vc4, struct vc4_job *job) in vc4_job_free() argument
37 struct vc4_bo **referenced_bos = job->bo_pointers.base; in vc4_job_free()
38 for (int i = 0; i < cl_offset(&job->bo_handles) / 4; i++) { in vc4_job_free()
42 _mesa_hash_table_remove_key(vc4->jobs, &job->key); in vc4_job_free()
44 if (job->color_write) { in vc4_job_free()
46 job->color_write->texture); in vc4_job_free()
47 pipe_surface_reference(&job->color_write, NULL); in vc4_job_free()
49 if (job->msaa_color_write) { in vc4_job_free()
51 job->msaa_color_write->texture); in vc4_job_free()
52 pipe_surface_reference(&job->msaa_color_write, NULL); in vc4_job_free()
54 if (job->zs_write) { in vc4_job_free()
56 job->zs_write->texture); in vc4_job_free()
57 pipe_surface_reference(&job->zs_write, NULL); in vc4_job_free()
59 if (job->msaa_zs_write) { in vc4_job_free()
61 job->msaa_zs_write->texture); in vc4_job_free()
62 pipe_surface_reference(&job->msaa_zs_write, NULL); in vc4_job_free()
65 pipe_surface_reference(&job->color_read, NULL); in vc4_job_free()
66 pipe_surface_reference(&job->zs_read, NULL); in vc4_job_free()
68 if (vc4->job == job) in vc4_job_free()
69 vc4->job = NULL; in vc4_job_free()
71 ralloc_free(job); in vc4_job_free()
77 struct vc4_job *job = rzalloc(vc4, struct vc4_job); in vc4_job_create() local
79 vc4_init_cl(job, &job->bcl); in vc4_job_create()
80 vc4_init_cl(job, &job->shader_rec); in vc4_job_create()
81 vc4_init_cl(job, &job->uniforms); in vc4_job_create()
82 vc4_init_cl(job, &job->bo_handles); in vc4_job_create()
83 vc4_init_cl(job, &job->bo_pointers); in vc4_job_create()
85 job->draw_min_x = ~0; in vc4_job_create()
86 job->draw_min_y = ~0; in vc4_job_create()
87 job->draw_max_x = 0; in vc4_job_create()
88 job->draw_max_y = 0; in vc4_job_create()
90 job->last_gem_handle_hindex = ~0; in vc4_job_create()
93 job->perfmon = vc4->perfmon; in vc4_job_create()
95 return job; in vc4_job_create()
105 struct vc4_job *job = entry->data; in vc4_flush_jobs_writing_resource() local
106 vc4_job_submit(vc4, job); in vc4_flush_jobs_writing_resource()
119 struct vc4_job *job = entry->data; in vc4_flush_jobs_reading_resource() local
121 struct vc4_bo **referenced_bos = job->bo_pointers.base; in vc4_flush_jobs_reading_resource()
123 for (int i = 0; i < cl_offset(&job->bo_handles) / 4; i++) { in vc4_flush_jobs_reading_resource()
130 vc4_job_submit(vc4, job); in vc4_flush_jobs_reading_resource()
137 if (job->color_read && !(job->cleared & PIPE_CLEAR_COLOR)) { in vc4_flush_jobs_reading_resource()
139 vc4_resource(job->color_read->texture); in vc4_flush_jobs_reading_resource()
141 vc4_job_submit(vc4, job); in vc4_flush_jobs_reading_resource()
146 if (job->zs_read && !(job->cleared & in vc4_flush_jobs_reading_resource()
149 vc4_resource(job->zs_read->texture); in vc4_flush_jobs_reading_resource()
151 vc4_job_submit(vc4, job); in vc4_flush_jobs_reading_resource()
185 struct vc4_job *job = vc4_job_create(vc4); in vc4_get_job() local
189 job->msaa = true; in vc4_get_job()
190 pipe_surface_reference(&job->msaa_color_write, cbuf); in vc4_get_job()
192 pipe_surface_reference(&job->color_write, cbuf); in vc4_get_job()
198 job->msaa = true; in vc4_get_job()
199 pipe_surface_reference(&job->msaa_zs_write, zsbuf); in vc4_get_job()
201 pipe_surface_reference(&job->zs_write, zsbuf); in vc4_get_job()
205 if (job->msaa) { in vc4_get_job()
206 job->tile_width = 32; in vc4_get_job()
207 job->tile_height = 32; in vc4_get_job()
209 job->tile_width = 64; in vc4_get_job()
210 job->tile_height = 64; in vc4_get_job()
214 _mesa_hash_table_insert(vc4->write_jobs, cbuf->texture, job); in vc4_get_job()
216 _mesa_hash_table_insert(vc4->write_jobs, zsbuf->texture, job); in vc4_get_job()
218 job->key.cbuf = cbuf; in vc4_get_job()
219 job->key.zsbuf = zsbuf; in vc4_get_job()
220 _mesa_hash_table_insert(vc4->jobs, &job->key, job); in vc4_get_job()
222 return job; in vc4_get_job()
228 if (vc4->job) in vc4_get_job_for_fbo()
229 return vc4->job; in vc4_get_job_for_fbo()
233 struct vc4_job *job = vc4_get_job(vc4, cbuf, zsbuf); in vc4_get_job_for_fbo() local
245 pipe_surface_reference(&job->color_read, cbuf); in vc4_get_job_for_fbo()
246 pipe_surface_reference(&job->zs_read, zsbuf); in vc4_get_job_for_fbo()
254 job->cleared |= PIPE_CLEAR_COLOR0; in vc4_get_job_for_fbo()
260 job->cleared |= PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL; in vc4_get_job_for_fbo()
263 job->draw_tiles_x = DIV_ROUND_UP(vc4->framebuffer.width, in vc4_get_job_for_fbo()
264 job->tile_width); in vc4_get_job_for_fbo()
265 job->draw_tiles_y = DIV_ROUND_UP(vc4->framebuffer.height, in vc4_get_job_for_fbo()
266 job->tile_height); in vc4_get_job_for_fbo()
273 job->flags = vc4->rasterizer->tile_raster_order_flags; in vc4_get_job_for_fbo()
275 vc4->job = job; in vc4_get_job_for_fbo()
277 return job; in vc4_get_job_for_fbo()
281 vc4_submit_setup_rcl_surface(struct vc4_job *job, in vc4_submit_setup_rcl_surface() argument
292 submit_surf->hindex = vc4_gem_hindex(job, rsc->bo); in vc4_submit_setup_rcl_surface()
323 vc4_submit_setup_rcl_render_config_surface(struct vc4_job *job, in vc4_submit_setup_rcl_render_config_surface() argument
333 submit_surf->hindex = vc4_gem_hindex(job, rsc->bo); in vc4_submit_setup_rcl_render_config_surface()
350 vc4_submit_setup_rcl_msaa_surface(struct vc4_job *job, in vc4_submit_setup_rcl_msaa_surface() argument
360 submit_surf->hindex = vc4_gem_hindex(job, rsc->bo); in vc4_submit_setup_rcl_msaa_surface()
370 vc4_job_submit(struct vc4_context *vc4, struct vc4_job *job) in vc4_job_submit() argument
372 if (!job->needs_flush) in vc4_job_submit()
378 if (job->draw_max_x <= job->draw_min_x || in vc4_job_submit()
379 job->draw_max_y <= job->draw_min_y) { in vc4_job_submit()
385 vc4_dump_cl(job->bcl.base, cl_offset(&job->bcl), false); in vc4_job_submit()
388 if (cl_offset(&job->bcl) > 0) { in vc4_job_submit()
393 cl_ensure_space(&job->bcl, 8); in vc4_job_submit()
394 cl_emit(&job->bcl, INCREMENT_SEMAPHORE, incr); in vc4_job_submit()
398 cl_emit(&job->bcl, FLUSH, flush); in vc4_job_submit()
409 cl_ensure_space(&job->bo_handles, 6 * sizeof(uint32_t)); in vc4_job_submit()
410 cl_ensure_space(&job->bo_pointers, 6 * sizeof(struct vc4_bo *)); in vc4_job_submit()
412 if (job->resolve & PIPE_CLEAR_COLOR) { in vc4_job_submit()
413 if (!(job->cleared & PIPE_CLEAR_COLOR)) { in vc4_job_submit()
414 vc4_submit_setup_rcl_surface(job, &submit.color_read, in vc4_job_submit()
415 job->color_read, in vc4_job_submit()
418 vc4_submit_setup_rcl_render_config_surface(job, in vc4_job_submit()
420 job->color_write); in vc4_job_submit()
421 vc4_submit_setup_rcl_msaa_surface(job, in vc4_job_submit()
423 job->msaa_color_write); in vc4_job_submit()
425 if (job->resolve & (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL)) { in vc4_job_submit()
426 if (!(job->cleared & (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL))) { in vc4_job_submit()
427 vc4_submit_setup_rcl_surface(job, &submit.zs_read, in vc4_job_submit()
428 job->zs_read, true, false); in vc4_job_submit()
430 vc4_submit_setup_rcl_surface(job, &submit.zs_write, in vc4_job_submit()
431 job->zs_write, true, true); in vc4_job_submit()
432 vc4_submit_setup_rcl_msaa_surface(job, &submit.msaa_zs_write, in vc4_job_submit()
433 job->msaa_zs_write); in vc4_job_submit()
436 if (job->msaa) { in vc4_job_submit()
448 submit.bo_handles = (uintptr_t)job->bo_handles.base; in vc4_job_submit()
449 submit.bo_handle_count = cl_offset(&job->bo_handles) / 4; in vc4_job_submit()
450 submit.bin_cl = (uintptr_t)job->bcl.base; in vc4_job_submit()
451 submit.bin_cl_size = cl_offset(&job->bcl); in vc4_job_submit()
452 submit.shader_rec = (uintptr_t)job->shader_rec.base; in vc4_job_submit()
453 submit.shader_rec_size = cl_offset(&job->shader_rec); in vc4_job_submit()
454 submit.shader_rec_count = job->shader_rec_count; in vc4_job_submit()
455 submit.uniforms = (uintptr_t)job->uniforms.base; in vc4_job_submit()
456 submit.uniforms_size = cl_offset(&job->uniforms); in vc4_job_submit()
457 if (job->perfmon) in vc4_job_submit()
458 submit.perfmonid = job->perfmon->id; in vc4_job_submit()
460 assert(job->draw_min_x != ~0 && job->draw_min_y != ~0); in vc4_job_submit()
461 submit.min_x_tile = job->draw_min_x / job->tile_width; in vc4_job_submit()
462 submit.min_y_tile = job->draw_min_y / job->tile_height; in vc4_job_submit()
463 submit.max_x_tile = (job->draw_max_x - 1) / job->tile_width; in vc4_job_submit()
464 submit.max_y_tile = (job->draw_max_y - 1) / job->tile_height; in vc4_job_submit()
465 submit.width = job->draw_width; in vc4_job_submit()
466 submit.height = job->draw_height; in vc4_job_submit()
467 if (job->cleared) { in vc4_job_submit()
469 submit.clear_color[0] = job->clear_color[0]; in vc4_job_submit()
470 submit.clear_color[1] = job->clear_color[1]; in vc4_job_submit()
471 submit.clear_z = job->clear_depth; in vc4_job_submit()
472 submit.clear_s = job->clear_stencil; in vc4_job_submit()
474 submit.flags |= job->flags; in vc4_job_submit()
500 if (job->perfmon) in vc4_job_submit()
501 job->perfmon->last_seqno = submit.seqno; in vc4_job_submit()
523 vc4_job_free(vc4, job); in vc4_job_submit()