Lines Matching refs:job
42 vc4_job_free(struct vc4_context *vc4, struct vc4_job *job)
44 struct vc4_bo **referenced_bos = job->bo_pointers.base;
45 for (int i = 0; i < cl_offset(&job->bo_handles) / 4; i++) {
49 remove_from_ht(vc4->jobs, &job->key);
51 if (job->color_write) {
52 remove_from_ht(vc4->write_jobs, job->color_write->texture);
53 pipe_surface_reference(&job->color_write, NULL);
55 if (job->msaa_color_write) {
56 remove_from_ht(vc4->write_jobs, job->msaa_color_write->texture);
57 pipe_surface_reference(&job->msaa_color_write, NULL);
59 if (job->zs_write) {
60 remove_from_ht(vc4->write_jobs, job->zs_write->texture);
61 pipe_surface_reference(&job->zs_write, NULL);
63 if (job->msaa_zs_write) {
64 remove_from_ht(vc4->write_jobs, job->msaa_zs_write->texture);
65 pipe_surface_reference(&job->msaa_zs_write, NULL);
68 pipe_surface_reference(&job->color_read, NULL);
69 pipe_surface_reference(&job->zs_read, NULL);
71 if (vc4->job == job)
72 vc4->job = NULL;
74 ralloc_free(job);
80 struct vc4_job *job = rzalloc(vc4, struct vc4_job);
82 vc4_init_cl(job, &job->bcl);
83 vc4_init_cl(job, &job->shader_rec);
84 vc4_init_cl(job, &job->uniforms);
85 vc4_init_cl(job, &job->bo_handles);
86 vc4_init_cl(job, &job->bo_pointers);
88 job->draw_min_x = ~0;
89 job->draw_min_y = ~0;
90 job->draw_max_x = 0;
91 job->draw_max_y = 0;
93 job->last_gem_handle_hindex = ~0;
95 return job;
105 struct vc4_job *job = entry->data;
106 vc4_job_submit(vc4, job);
120 struct vc4_job *job = entry->data;
122 struct vc4_bo **referenced_bos = job->bo_pointers.base;
124 for (int i = 0; i < cl_offset(&job->bo_handles) / 4; i++) {
131 vc4_job_submit(vc4, job);
138 if (job->color_read && !(job->cleared & PIPE_CLEAR_COLOR)) {
140 vc4_resource(job->color_read->texture);
142 vc4_job_submit(vc4, job);
147 if (job->zs_read && !(job->cleared &
150 vc4_resource(job->zs_read->texture);
152 vc4_job_submit(vc4, job);
162 * If we've already started rendering to this FBO, then return old same job,
171 /* Return the existing job for this FBO if we have one */
178 /* Creating a new job. Make sure that any previous jobs reading or
186 struct vc4_job *job = vc4_job_create(vc4);
190 job->msaa = true;
191 pipe_surface_reference(&job->msaa_color_write, cbuf);
193 pipe_surface_reference(&job->color_write, cbuf);
199 job->msaa = true;
200 pipe_surface_reference(&job->msaa_zs_write, zsbuf);
202 pipe_surface_reference(&job->zs_write, zsbuf);
206 if (job->msaa) {
207 job->tile_width = 32;
208 job->tile_height = 32;
210 job->tile_width = 64;
211 job->tile_height = 64;
215 _mesa_hash_table_insert(vc4->write_jobs, cbuf->texture, job);
217 _mesa_hash_table_insert(vc4->write_jobs, zsbuf->texture, job);
219 job->key.cbuf = cbuf;
220 job->key.zsbuf = zsbuf;
221 _mesa_hash_table_insert(vc4->jobs, &job->key, job);
223 return job;
229 if (vc4->job)
230 return vc4->job;
234 struct vc4_job *job = vc4_get_job(vc4, cbuf, zsbuf);
236 /* The dirty flags are tracking what's been updated while vc4->job has
242 /* Set up the read surfaces in the job. If they aren't actually
243 * getting read (due to a clear starting the frame), job->cleared will
246 pipe_surface_reference(&job->color_read, cbuf);
247 pipe_surface_reference(&job->zs_read, zsbuf);
255 job->cleared |= PIPE_CLEAR_COLOR0;
261 job->cleared |= PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL;
264 job->draw_tiles_x = DIV_ROUND_UP(vc4->framebuffer.width,
265 job->tile_width);
266 job->draw_tiles_y = DIV_ROUND_UP(vc4->framebuffer.height,
267 job->tile_height);
269 /* Initialize the job with the raster order flags -- each draw will
274 job->flags = vc4->rasterizer->tile_raster_order_flags;
276 vc4->job = job;
278 return job;
282 vc4_submit_setup_rcl_surface(struct vc4_job *job,
293 submit_surf->hindex = vc4_gem_hindex(job, rsc->bo);
324 vc4_submit_setup_rcl_render_config_surface(struct vc4_job *job,
334 submit_surf->hindex = vc4_gem_hindex(job, rsc->bo);
351 vc4_submit_setup_rcl_msaa_surface(struct vc4_job *job,
361 submit_surf->hindex = vc4_gem_hindex(job, rsc->bo);
368 * Submits the job to the kernel and then reinitializes it.
371 vc4_job_submit(struct vc4_context *vc4, struct vc4_job *job)
373 if (!job->needs_flush)
379 if (job->draw_max_x <= job->draw_min_x ||
380 job->draw_max_y <= job->draw_min_y) {
386 vc4_dump_cl(job->bcl.base, cl_offset(&job->bcl), false);
389 if (cl_offset(&job->bcl) > 0) {
394 cl_ensure_space(&job->bcl, 8);
395 cl_emit(&job->bcl, INCREMENT_SEMAPHORE, incr);
399 cl_emit(&job->bcl, FLUSH, flush);
410 cl_ensure_space(&job->bo_handles, 6 * sizeof(uint32_t));
411 cl_ensure_space(&job->bo_pointers, 6 * sizeof(struct vc4_bo *));
413 if (job->resolve & PIPE_CLEAR_COLOR) {
414 if (!(job->cleared & PIPE_CLEAR_COLOR)) {
415 vc4_submit_setup_rcl_surface(job, &submit.color_read,
416 job->color_read,
419 vc4_submit_setup_rcl_render_config_surface(job,
421 job->color_write);
422 vc4_submit_setup_rcl_msaa_surface(job,
424 job->msaa_color_write);
426 if (job->resolve & (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL)) {
427 if (!(job->cleared & (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL))) {
428 vc4_submit_setup_rcl_surface(job, &submit.zs_read,
429 job->zs_read, true, false);
431 vc4_submit_setup_rcl_surface(job, &submit.zs_write,
432 job->zs_write, true, true);
433 vc4_submit_setup_rcl_msaa_surface(job, &submit.msaa_zs_write,
434 job->msaa_zs_write);
437 if (job->msaa) {
449 submit.bo_handles = (uintptr_t)job->bo_handles.base;
450 submit.bo_handle_count = cl_offset(&job->bo_handles) / 4;
451 submit.bin_cl = (uintptr_t)job->bcl.base;
452 submit.bin_cl_size = cl_offset(&job->bcl);
453 submit.shader_rec = (uintptr_t)job->shader_rec.base;
454 submit.shader_rec_size = cl_offset(&job->shader_rec);
455 submit.shader_rec_count = job->shader_rec_count;
456 submit.uniforms = (uintptr_t)job->uniforms.base;
457 submit.uniforms_size = cl_offset(&job->uniforms);
459 assert(job->draw_min_x != ~0 && job->draw_min_y != ~0);
460 submit.min_x_tile = job->draw_min_x / job->tile_width;
461 submit.min_y_tile = job->draw_min_y / job->tile_height;
462 submit.max_x_tile = (job->draw_max_x - 1) / job->tile_width;
463 submit.max_y_tile = (job->draw_max_y - 1) / job->tile_height;
464 submit.width = job->draw_width;
465 submit.height = job->draw_height;
466 if (job->cleared) {
468 submit.clear_color[0] = job->clear_color[0];
469 submit.clear_color[1] = job->clear_color[1];
470 submit.clear_z = job->clear_depth;
471 submit.clear_s = job->clear_stencil;
473 submit.flags |= job->flags;
481 ret = vc4_simulator_flush(vc4, &submit, job);
497 "job throttling")) {
498 fprintf(stderr, "Job throttling failed\n");
511 vc4_job_free(vc4, job);