Lines Matching refs:job

42 vc4_job_free(struct vc4_context *vc4, struct vc4_job *job)  in vc4_job_free()  argument
44 struct vc4_bo **referenced_bos = job->bo_pointers.base; in vc4_job_free()
45 for (int i = 0; i < cl_offset(&job->bo_handles) / 4; i++) { in vc4_job_free()
49 remove_from_ht(vc4->jobs, &job->key); in vc4_job_free()
51 if (job->color_write) { in vc4_job_free()
52 remove_from_ht(vc4->write_jobs, job->color_write->texture); in vc4_job_free()
53 pipe_surface_reference(&job->color_write, NULL); in vc4_job_free()
55 if (job->msaa_color_write) { in vc4_job_free()
56 remove_from_ht(vc4->write_jobs, job->msaa_color_write->texture); in vc4_job_free()
57 pipe_surface_reference(&job->msaa_color_write, NULL); in vc4_job_free()
59 if (job->zs_write) { in vc4_job_free()
60 remove_from_ht(vc4->write_jobs, job->zs_write->texture); in vc4_job_free()
61 pipe_surface_reference(&job->zs_write, NULL); in vc4_job_free()
63 if (job->msaa_zs_write) { in vc4_job_free()
64 remove_from_ht(vc4->write_jobs, job->msaa_zs_write->texture); in vc4_job_free()
65 pipe_surface_reference(&job->msaa_zs_write, NULL); in vc4_job_free()
68 pipe_surface_reference(&job->color_read, NULL); in vc4_job_free()
69 pipe_surface_reference(&job->zs_read, NULL); in vc4_job_free()
71 if (vc4->job == job) in vc4_job_free()
72 vc4->job = NULL; in vc4_job_free()
74 ralloc_free(job); in vc4_job_free()
80 struct vc4_job *job = rzalloc(vc4, struct vc4_job); in vc4_job_create() local
82 vc4_init_cl(job, &job->bcl); in vc4_job_create()
83 vc4_init_cl(job, &job->shader_rec); in vc4_job_create()
84 vc4_init_cl(job, &job->uniforms); in vc4_job_create()
85 vc4_init_cl(job, &job->bo_handles); in vc4_job_create()
86 vc4_init_cl(job, &job->bo_pointers); in vc4_job_create()
88 job->draw_min_x = ~0; in vc4_job_create()
89 job->draw_min_y = ~0; in vc4_job_create()
90 job->draw_max_x = 0; in vc4_job_create()
91 job->draw_max_y = 0; in vc4_job_create()
93 job->last_gem_handle_hindex = ~0; 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()
120 struct vc4_job *job = entry->data; in vc4_flush_jobs_reading_resource() local
122 struct vc4_bo **referenced_bos = job->bo_pointers.base; in vc4_flush_jobs_reading_resource()
124 for (int i = 0; i < cl_offset(&job->bo_handles) / 4; i++) { in vc4_flush_jobs_reading_resource()
131 vc4_job_submit(vc4, job); in vc4_flush_jobs_reading_resource()
138 if (job->color_read && !(job->cleared & PIPE_CLEAR_COLOR)) { in vc4_flush_jobs_reading_resource()
140 vc4_resource(job->color_read->texture); in vc4_flush_jobs_reading_resource()
142 vc4_job_submit(vc4, job); in vc4_flush_jobs_reading_resource()
147 if (job->zs_read && !(job->cleared & in vc4_flush_jobs_reading_resource()
150 vc4_resource(job->zs_read->texture); in vc4_flush_jobs_reading_resource()
152 vc4_job_submit(vc4, job); in vc4_flush_jobs_reading_resource()
186 struct vc4_job *job = vc4_job_create(vc4); in vc4_get_job() local
190 job->msaa = true; in vc4_get_job()
191 pipe_surface_reference(&job->msaa_color_write, cbuf); in vc4_get_job()
193 pipe_surface_reference(&job->color_write, cbuf); in vc4_get_job()
199 job->msaa = true; in vc4_get_job()
200 pipe_surface_reference(&job->msaa_zs_write, zsbuf); in vc4_get_job()
202 pipe_surface_reference(&job->zs_write, zsbuf); in vc4_get_job()
206 if (job->msaa) { in vc4_get_job()
207 job->tile_width = 32; in vc4_get_job()
208 job->tile_height = 32; in vc4_get_job()
210 job->tile_width = 64; in vc4_get_job()
211 job->tile_height = 64; in vc4_get_job()
215 _mesa_hash_table_insert(vc4->write_jobs, cbuf->texture, job); in vc4_get_job()
217 _mesa_hash_table_insert(vc4->write_jobs, zsbuf->texture, job); in vc4_get_job()
219 job->key.cbuf = cbuf; in vc4_get_job()
220 job->key.zsbuf = zsbuf; in vc4_get_job()
221 _mesa_hash_table_insert(vc4->jobs, &job->key, job); in vc4_get_job()
223 return job; in vc4_get_job()
229 if (vc4->job) in vc4_get_job_for_fbo()
230 return vc4->job; in vc4_get_job_for_fbo()
234 struct vc4_job *job = vc4_get_job(vc4, cbuf, zsbuf); in vc4_get_job_for_fbo() local
246 pipe_surface_reference(&job->color_read, cbuf); in vc4_get_job_for_fbo()
247 pipe_surface_reference(&job->zs_read, zsbuf); in vc4_get_job_for_fbo()
255 job->cleared |= PIPE_CLEAR_COLOR0; in vc4_get_job_for_fbo()
261 job->cleared |= PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL; in vc4_get_job_for_fbo()
264 job->draw_tiles_x = DIV_ROUND_UP(vc4->framebuffer.width, in vc4_get_job_for_fbo()
265 job->tile_width); in vc4_get_job_for_fbo()
266 job->draw_tiles_y = DIV_ROUND_UP(vc4->framebuffer.height, in vc4_get_job_for_fbo()
267 job->tile_height); in vc4_get_job_for_fbo()
274 job->flags = vc4->rasterizer->tile_raster_order_flags; in vc4_get_job_for_fbo()
276 vc4->job = job; in vc4_get_job_for_fbo()
278 return job; in vc4_get_job_for_fbo()
282 vc4_submit_setup_rcl_surface(struct vc4_job *job, in vc4_submit_setup_rcl_surface() argument
293 submit_surf->hindex = vc4_gem_hindex(job, rsc->bo); in vc4_submit_setup_rcl_surface()
324 vc4_submit_setup_rcl_render_config_surface(struct vc4_job *job, in vc4_submit_setup_rcl_render_config_surface() argument
334 submit_surf->hindex = vc4_gem_hindex(job, rsc->bo); in vc4_submit_setup_rcl_render_config_surface()
351 vc4_submit_setup_rcl_msaa_surface(struct vc4_job *job, in vc4_submit_setup_rcl_msaa_surface() argument
361 submit_surf->hindex = vc4_gem_hindex(job, rsc->bo); in vc4_submit_setup_rcl_msaa_surface()
371 vc4_job_submit(struct vc4_context *vc4, struct vc4_job *job) in vc4_job_submit() argument
373 if (!job->needs_flush) in vc4_job_submit()
379 if (job->draw_max_x <= job->draw_min_x || in vc4_job_submit()
380 job->draw_max_y <= job->draw_min_y) { in vc4_job_submit()
386 vc4_dump_cl(job->bcl.base, cl_offset(&job->bcl), false); in vc4_job_submit()
389 if (cl_offset(&job->bcl) > 0) { in vc4_job_submit()
394 cl_ensure_space(&job->bcl, 8); in vc4_job_submit()
395 cl_emit(&job->bcl, INCREMENT_SEMAPHORE, incr); in vc4_job_submit()
399 cl_emit(&job->bcl, FLUSH, flush); in vc4_job_submit()
410 cl_ensure_space(&job->bo_handles, 6 * sizeof(uint32_t)); in vc4_job_submit()
411 cl_ensure_space(&job->bo_pointers, 6 * sizeof(struct vc4_bo *)); in vc4_job_submit()
413 if (job->resolve & PIPE_CLEAR_COLOR) { in vc4_job_submit()
414 if (!(job->cleared & PIPE_CLEAR_COLOR)) { in vc4_job_submit()
415 vc4_submit_setup_rcl_surface(job, &submit.color_read, in vc4_job_submit()
416 job->color_read, in vc4_job_submit()
419 vc4_submit_setup_rcl_render_config_surface(job, in vc4_job_submit()
421 job->color_write); in vc4_job_submit()
422 vc4_submit_setup_rcl_msaa_surface(job, in vc4_job_submit()
424 job->msaa_color_write); in vc4_job_submit()
426 if (job->resolve & (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL)) { in vc4_job_submit()
427 if (!(job->cleared & (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL))) { in vc4_job_submit()
428 vc4_submit_setup_rcl_surface(job, &submit.zs_read, in vc4_job_submit()
429 job->zs_read, true, false); in vc4_job_submit()
431 vc4_submit_setup_rcl_surface(job, &submit.zs_write, in vc4_job_submit()
432 job->zs_write, true, true); in vc4_job_submit()
433 vc4_submit_setup_rcl_msaa_surface(job, &submit.msaa_zs_write, in vc4_job_submit()
434 job->msaa_zs_write); in vc4_job_submit()
437 if (job->msaa) { in vc4_job_submit()
449 submit.bo_handles = (uintptr_t)job->bo_handles.base; in vc4_job_submit()
450 submit.bo_handle_count = cl_offset(&job->bo_handles) / 4; in vc4_job_submit()
451 submit.bin_cl = (uintptr_t)job->bcl.base; in vc4_job_submit()
452 submit.bin_cl_size = cl_offset(&job->bcl); in vc4_job_submit()
453 submit.shader_rec = (uintptr_t)job->shader_rec.base; in vc4_job_submit()
454 submit.shader_rec_size = cl_offset(&job->shader_rec); in vc4_job_submit()
455 submit.shader_rec_count = job->shader_rec_count; in vc4_job_submit()
456 submit.uniforms = (uintptr_t)job->uniforms.base; in vc4_job_submit()
457 submit.uniforms_size = cl_offset(&job->uniforms); in vc4_job_submit()
459 assert(job->draw_min_x != ~0 && job->draw_min_y != ~0); in vc4_job_submit()
460 submit.min_x_tile = job->draw_min_x / job->tile_width; in vc4_job_submit()
461 submit.min_y_tile = job->draw_min_y / job->tile_height; in vc4_job_submit()
462 submit.max_x_tile = (job->draw_max_x - 1) / job->tile_width; in vc4_job_submit()
463 submit.max_y_tile = (job->draw_max_y - 1) / job->tile_height; in vc4_job_submit()
464 submit.width = job->draw_width; in vc4_job_submit()
465 submit.height = job->draw_height; in vc4_job_submit()
466 if (job->cleared) { in vc4_job_submit()
468 submit.clear_color[0] = job->clear_color[0]; in vc4_job_submit()
469 submit.clear_color[1] = job->clear_color[1]; in vc4_job_submit()
470 submit.clear_z = job->clear_depth; in vc4_job_submit()
471 submit.clear_s = job->clear_stencil; in vc4_job_submit()
473 submit.flags |= job->flags; in vc4_job_submit()
481 ret = vc4_simulator_flush(vc4, &submit, job); in vc4_job_submit()
511 vc4_job_free(vc4, job); in vc4_job_submit()