Lines Matching full:job
52 lima_get_fb_info(struct lima_job *job) in lima_get_fb_info() argument
54 struct lima_context *ctx = job->ctx; in lima_get_fb_info()
55 struct lima_job_fb_info *fb = &job->fb; in lima_get_fb_info()
126 lima_job_free(struct lima_job *job) in lima_job_free() argument
128 struct lima_context *ctx = job->ctx; in lima_job_free()
130 _mesa_hash_table_remove_key(ctx->jobs, &job->key); in lima_job_free()
132 if (job->key.cbuf && (job->resolve & PIPE_CLEAR_COLOR0)) in lima_job_free()
133 _mesa_hash_table_remove_key(ctx->write_jobs, job->key.cbuf->texture); in lima_job_free()
134 if (job->key.zsbuf && (job->resolve & (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL))) in lima_job_free()
135 _mesa_hash_table_remove_key(ctx->write_jobs, job->key.zsbuf->texture); in lima_job_free()
137 pipe_surface_reference(&job->key.cbuf, NULL); in lima_job_free()
138 pipe_surface_reference(&job->key.zsbuf, NULL); in lima_job_free()
140 lima_dump_free(job->dump); in lima_job_free()
141 job->dump = NULL; in lima_job_free()
143 /* TODO: do we need a cache for job? */ in lima_job_free()
144 ralloc_free(job); in lima_job_free()
160 struct lima_job *job = lima_job_create(ctx); in _lima_job_get() local
161 if (!job) in _lima_job_get()
164 _mesa_hash_table_insert(ctx->jobs, &job->key, job); in _lima_job_get()
166 return job; in _lima_job_get()
176 if (ctx->job) in lima_job_get()
177 return ctx->job; in lima_job_get()
179 ctx->job = _lima_job_get(ctx); in lima_job_get()
180 return ctx->job; in lima_job_get()
183 bool lima_job_add_bo(struct lima_job *job, int pipe, in lima_job_add_bo() argument
186 util_dynarray_foreach(job->gem_bos + pipe, struct drm_lima_gem_submit_bo, gem_bo) { in lima_job_add_bo()
194 util_dynarray_grow(job->gem_bos + pipe, struct drm_lima_gem_submit_bo, 1); in lima_job_add_bo()
198 struct lima_bo **jbo = util_dynarray_grow(job->bos + pipe, struct lima_bo *, 1); in lima_job_add_bo()
201 /* prevent bo from being freed when job start */ in lima_job_add_bo()
208 lima_job_start(struct lima_job *job, int pipe, void *frame, uint32_t size) in lima_job_start() argument
210 struct lima_context *ctx = job->ctx; in lima_job_start()
214 .nr_bos = job->gem_bos[pipe].size / sizeof(struct drm_lima_gem_submit_bo), in lima_job_start()
215 .bos = VOID2U64(util_dynarray_begin(job->gem_bos + pipe)), in lima_job_start()
222 int err = drmSyncobjImportSyncFile(job->fd, ctx->in_sync[pipe], in lima_job_start()
232 bool ret = drmIoctl(job->fd, DRM_IOCTL_LIMA_GEM_SUBMIT, &req) == 0; in lima_job_start()
234 util_dynarray_foreach(job->bos + pipe, struct lima_bo *, bo) { in lima_job_start()
242 lima_job_wait(struct lima_job *job, int pipe, uint64_t timeout_ns) in lima_job_wait() argument
248 struct lima_context *ctx = job->ctx; in lima_job_wait()
249 return !drmSyncobjWait(job->fd, ctx->out_sync + pipe, 1, abs_timeout, 0, NULL); in lima_job_wait()
253 lima_job_has_bo(struct lima_job *job, struct lima_bo *bo, bool all) in lima_job_has_bo() argument
256 util_dynarray_foreach(job->gem_bos + i, struct drm_lima_gem_submit_bo, gem_bo) { in lima_job_has_bo()
270 lima_job_create_stream_bo(struct lima_job *job, int pipe, in lima_job_create_stream_bo() argument
273 struct lima_context *ctx = job->ctx; in lima_job_create_stream_bo()
283 lima_job_add_bo(job, pipe, res->bo, LIMA_SUBMIT_BO_READ); in lima_job_create_stream_bo()
291 lima_job_get_damage(struct lima_job *job) in lima_job_get_damage() argument
293 if (!(job->key.cbuf && (job->resolve & PIPE_CLEAR_COLOR0))) in lima_job_get_damage()
296 struct lima_surface *surf = lima_surface(job->key.cbuf); in lima_job_get_damage()
302 lima_fb_cbuf_needs_reload(struct lima_job *job) in lima_fb_cbuf_needs_reload() argument
304 if (!(job->key.cbuf && (job->resolve & PIPE_CLEAR_COLOR0))) in lima_fb_cbuf_needs_reload()
307 struct lima_surface *surf = lima_surface(job->key.cbuf); in lima_fb_cbuf_needs_reload()
324 lima_fb_zsbuf_needs_reload(struct lima_job *job) in lima_fb_zsbuf_needs_reload() argument
326 if (!(job->key.zsbuf && (job->resolve & (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL)))) in lima_fb_zsbuf_needs_reload()
329 struct lima_surface *surf = lima_surface(job->key.zsbuf); in lima_fb_zsbuf_needs_reload()
337 lima_pack_reload_plbu_cmd(struct lima_job *job, struct pipe_surface *psurf) in lima_pack_reload_plbu_cmd() argument
346 struct lima_context *ctx = job->ctx; in lima_pack_reload_plbu_cmd()
349 struct pipe_surface *cbuf = job->key.cbuf; in lima_pack_reload_plbu_cmd()
355 job, LIMA_PIPE_PP, lima_reload_buffer_size, &va); in lima_pack_reload_plbu_cmd()
408 struct lima_job_fb_info *fb = &job->fb; in lima_pack_reload_plbu_cmd()
424 PLBU_CMD_BEGIN(&job->plbu_cmd_head, 20); in lima_pack_reload_plbu_cmd()
446 lima_pack_head_plbu_cmd(struct lima_job *job) in lima_pack_head_plbu_cmd() argument
448 struct lima_context *ctx = job->ctx; in lima_pack_head_plbu_cmd()
449 struct lima_job_fb_info *fb = &job->fb; in lima_pack_head_plbu_cmd()
451 PLBU_CMD_BEGIN(&job->plbu_cmd_head, 10); in lima_pack_head_plbu_cmd()
464 if (lima_fb_cbuf_needs_reload(job)) in lima_pack_head_plbu_cmd()
465 lima_pack_reload_plbu_cmd(job, job->key.cbuf); in lima_pack_head_plbu_cmd()
467 if (lima_fb_zsbuf_needs_reload(job)) in lima_pack_head_plbu_cmd()
468 lima_pack_reload_plbu_cmd(job, job->key.zsbuf); in lima_pack_head_plbu_cmd()
536 lima_generate_pp_stream(struct lima_job *job, int off_x, int off_y, in lima_generate_pp_stream() argument
539 struct lima_context *ctx = job->ctx; in lima_generate_pp_stream()
541 struct lima_job_fb_info *fb = &job->fb; in lima_generate_pp_stream()
596 job->dump, stream[i], si[i] * 4, in lima_generate_pp_stream()
624 lima_update_damage_pp_stream(struct lima_job *job) in lima_update_damage_pp_stream() argument
626 struct lima_context *ctx = job->ctx; in lima_update_damage_pp_stream()
627 struct lima_damage_region *ds = lima_job_get_damage(job); in lima_update_damage_pp_stream()
628 struct lima_job_fb_info *fb = &job->fb; in lima_update_damage_pp_stream()
630 struct pipe_scissor_state *dr = &job->damage_rect; in lima_update_damage_pp_stream()
675 lima_job_add_bo(job, LIMA_PIPE_PP, s->bo, LIMA_SUBMIT_BO_READ); in lima_update_damage_pp_stream()
708 lima_generate_pp_stream(job, bound.minx, bound.miny, tiled_w, tiled_h); in lima_update_damage_pp_stream()
714 lima_job_add_bo(job, LIMA_PIPE_PP, s->bo, LIMA_SUBMIT_BO_READ); in lima_update_damage_pp_stream()
718 lima_damage_fullscreen(struct lima_job *job) in lima_damage_fullscreen() argument
720 struct pipe_scissor_state *dr = &job->damage_rect; in lima_damage_fullscreen()
724 dr->maxx == job->fb.width && in lima_damage_fullscreen()
725 dr->maxy == job->fb.height; in lima_damage_fullscreen()
729 lima_update_pp_stream(struct lima_job *job) in lima_update_pp_stream() argument
731 struct lima_context *ctx = job->ctx; in lima_update_pp_stream()
733 struct lima_damage_region *damage = lima_job_get_damage(job); in lima_update_pp_stream()
735 (damage && damage->region) || !lima_damage_fullscreen(job)) in lima_update_pp_stream()
736 lima_update_damage_pp_stream(job); in lima_update_pp_stream()
743 lima_update_job_bo(struct lima_job *job) in lima_update_job_bo() argument
745 struct lima_context *ctx = job->ctx; in lima_update_job_bo()
747 lima_job_add_bo(job, LIMA_PIPE_GP, ctx->plb_gp_stream, in lima_update_job_bo()
749 lima_job_add_bo(job, LIMA_PIPE_GP, ctx->plb[ctx->plb_index], in lima_update_job_bo()
751 lima_job_add_bo(job, LIMA_PIPE_GP, ctx->gp_tile_heap[ctx->plb_index], in lima_update_job_bo()
755 job->dump, ctx->plb_gp_stream->map + ctx->plb_index * ctx->plb_gp_size, in lima_update_job_bo()
759 lima_job_add_bo(job, LIMA_PIPE_PP, ctx->plb[ctx->plb_index], in lima_update_job_bo()
761 lima_job_add_bo(job, LIMA_PIPE_PP, ctx->gp_tile_heap[ctx->plb_index], in lima_update_job_bo()
765 lima_job_add_bo(job, LIMA_PIPE_PP, screen->pp_buffer, LIMA_SUBMIT_BO_READ); in lima_update_job_bo()
781 lima_pack_wb_zsbuf_reg(struct lima_job *job, uint32_t *wb_reg, int wb_idx) in lima_pack_wb_zsbuf_reg() argument
783 struct lima_job_fb_info *fb = &job->fb; in lima_pack_wb_zsbuf_reg()
784 struct pipe_surface *zsbuf = job->key.zsbuf; in lima_pack_wb_zsbuf_reg()
804 lima_pack_wb_cbuf_reg(struct lima_job *job, uint32_t *frame_reg, in lima_pack_wb_cbuf_reg() argument
807 struct lima_job_fb_info *fb = &job->fb; in lima_pack_wb_cbuf_reg()
808 struct pipe_surface *cbuf = job->key.cbuf; in lima_pack_wb_cbuf_reg()
833 lima_pack_pp_frame_reg(struct lima_job *job, uint32_t *frame_reg, in lima_pack_pp_frame_reg() argument
836 struct lima_context *ctx = job->ctx; in lima_pack_pp_frame_reg()
837 struct lima_job_fb_info *fb = &job->fb; in lima_pack_pp_frame_reg()
844 frame->clear_value_depth = job->clear.depth; in lima_pack_pp_frame_reg()
845 frame->clear_value_stencil = job->clear.stencil; in lima_pack_pp_frame_reg()
846 frame->clear_value_color = job->clear.color_8pc; in lima_pack_pp_frame_reg()
847 frame->clear_value_color_1 = job->clear.color_8pc; in lima_pack_pp_frame_reg()
848 frame->clear_value_color_2 = job->clear.color_8pc; in lima_pack_pp_frame_reg()
849 frame->clear_value_color_3 = job->clear.color_8pc; in lima_pack_pp_frame_reg()
860 frame->fragment_stack_size = job->pp_max_stack_size << 16 | job->pp_max_stack_size; in lima_pack_pp_frame_reg()
873 if (job->key.cbuf && (job->resolve & PIPE_CLEAR_COLOR0)) in lima_pack_pp_frame_reg()
874 lima_pack_wb_cbuf_reg(job, frame_reg, wb_reg, wb_idx++); in lima_pack_pp_frame_reg()
876 if (job->key.zsbuf && in lima_pack_pp_frame_reg()
877 (job->resolve & (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL))) in lima_pack_pp_frame_reg()
878 lima_pack_wb_zsbuf_reg(job, wb_reg, wb_idx++); in lima_pack_pp_frame_reg()
882 lima_do_job(struct lima_job *job) in lima_do_job() argument
886 struct lima_context *ctx = job->ctx; in lima_do_job()
888 lima_pack_head_plbu_cmd(job); in lima_do_job()
889 lima_finish_plbu_cmd(&job->plbu_cmd_array); in lima_do_job()
891 lima_update_job_bo(job); in lima_do_job()
893 int vs_cmd_size = job->vs_cmd_array.size; in lima_do_job()
898 job, LIMA_PIPE_GP, vs_cmd_size, &vs_cmd_va); in lima_do_job()
899 memcpy(vs_cmd, util_dynarray_begin(&job->vs_cmd_array), vs_cmd_size); in lima_do_job()
902 job->dump, vs_cmd, vs_cmd_size, false, "flush vs cmd at va %x\n", vs_cmd_va); in lima_do_job()
903 lima_dump_vs_command_stream_print(job->dump, vs_cmd, vs_cmd_size, vs_cmd_va); in lima_do_job()
907 int plbu_cmd_size = job->plbu_cmd_array.size + job->plbu_cmd_head.size; in lima_do_job()
909 job, LIMA_PIPE_GP, plbu_cmd_size, &plbu_cmd_va); in lima_do_job()
911 util_dynarray_begin(&job->plbu_cmd_head), in lima_do_job()
912 job->plbu_cmd_head.size); in lima_do_job()
913 memcpy(plbu_cmd + job->plbu_cmd_head.size, in lima_do_job()
914 util_dynarray_begin(&job->plbu_cmd_array), in lima_do_job()
915 job->plbu_cmd_array.size); in lima_do_job()
918 job->dump, plbu_cmd, plbu_cmd_size, false, "flush plbu cmd at va %x\n", plbu_cmd_va); in lima_do_job()
919 lima_dump_plbu_command_stream_print(job->dump, plbu_cmd, plbu_cmd_size, plbu_cmd_va); in lima_do_job()
932 job->dump, &gp_frame, sizeof(gp_frame), false, "add gp frame\n"); in lima_do_job()
934 if (!lima_job_start(job, LIMA_PIPE_GP, &gp_frame, sizeof(gp_frame))) in lima_do_job()
935 fprintf(stderr, "gp job error\n"); in lima_do_job()
937 if (job->dump) { in lima_do_job()
938 if (lima_job_wait(job, LIMA_PIPE_GP, PIPE_TIMEOUT_INFINITE)) { in lima_do_job()
942 job->dump, pos, 4 * 4 * 16, true, "gl_pos dump at va %x\n", in lima_do_job()
948 job->dump, plb, LIMA_CTX_PLB_BLK_SIZE, false, "plb dump at va %x\n", in lima_do_job()
952 fprintf(stderr, "gp job wait error\n"); in lima_do_job()
958 if (job->pp_max_stack_size) { in lima_do_job()
960 job, LIMA_PIPE_PP, in lima_do_job()
961 screen->num_pp * job->pp_max_stack_size * pp_stack_pp_size, in lima_do_job()
965 lima_update_pp_stream(job); in lima_do_job()
970 lima_pack_pp_frame_reg(job, pp_frame.frame, pp_frame.wb); in lima_do_job()
975 if (job->pp_max_stack_size) in lima_do_job()
977 job->pp_max_stack_size * pp_stack_pp_size * i; in lima_do_job()
981 job->dump, &pp_frame, sizeof(pp_frame), false, "add pp frame\n"); in lima_do_job()
983 if (!lima_job_start(job, LIMA_PIPE_PP, &pp_frame, sizeof(pp_frame))) in lima_do_job()
984 fprintf(stderr, "pp job error\n"); in lima_do_job()
988 lima_pack_pp_frame_reg(job, pp_frame.frame, pp_frame.wb); in lima_do_job()
991 if (job->pp_max_stack_size) in lima_do_job()
994 job->pp_max_stack_size * pp_stack_pp_size * i; in lima_do_job()
1003 struct lima_job_fb_info *fb = &job->fb; in lima_do_job()
1012 job->dump, &pp_frame, sizeof(pp_frame), false, "add pp frame\n"); in lima_do_job()
1014 if (!lima_job_start(job, LIMA_PIPE_PP, &pp_frame, sizeof(pp_frame))) in lima_do_job()
1015 fprintf(stderr, "pp job error\n"); in lima_do_job()
1018 if (job->dump) { in lima_do_job()
1019 if (!lima_job_wait(job, LIMA_PIPE_PP, PIPE_TIMEOUT_INFINITE)) { in lima_do_job()
1028 if (job->key.cbuf && (job->resolve & PIPE_CLEAR_COLOR0)) { in lima_do_job()
1029 struct lima_surface *surf = lima_surface(job->key.cbuf); in lima_do_job()
1033 if (job->key.zsbuf && (job->resolve & (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL))) { in lima_do_job()
1034 struct lima_surface *surf = lima_surface(job->key.zsbuf); in lima_do_job()
1035 surf->reload = (job->resolve & (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL)); in lima_do_job()
1038 if (ctx->job == job) in lima_do_job()
1039 ctx->job = NULL; in lima_do_job()
1041 lima_job_free(job); in lima_do_job()
1048 struct lima_job *job = entry->data; in lima_flush() local
1049 lima_do_job(job); in lima_flush()
1058 struct lima_job *job = entry->data; in lima_flush_job_accessing_bo() local
1059 if (lima_job_has_bo(job, bo, write)) in lima_flush_job_accessing_bo()
1060 lima_do_job(job); in lima_flush_job_accessing_bo()
1065 * This is for current job flush previous job which write to the resource it wants
1075 struct lima_job *job = entry->data; in lima_flush_previous_job_writing_resource() local
1077 /* do not flush current job */ in lima_flush_previous_job_writing_resource()
1078 if (job != ctx->job) in lima_flush_previous_job_writing_resource()
1079 lima_do_job(job); in lima_flush_previous_job_writing_resource()