static boolean ilo_get_query_result(struct pipe_context *pipe, struct pipe_query *query, boolean wait, union pipe_query_result *result) { struct ilo_context *ilo = ilo_context(pipe); struct ilo_query *q = ilo_query(query); if (q->active) return false; if (q->bo) { if (intel_bo_has_reloc(ilo->cp->bo, q->bo)) ilo_cp_flush(ilo->cp, "syncing for queries"); if (!wait && intel_bo_is_busy(q->bo)) return false; query_info[q->type].process(ilo, q); } if (result) serialize_query_data(q->type, &q->data, (void *) result); return true; }
void ilo_3d_pipeline_emit_rectlist(struct ilo_3d_pipeline *p, const struct ilo_blitter *blitter) { const int max_len = ilo_3d_pipeline_estimate_size(p, ILO_3D_PIPELINE_RECTLIST, blitter); if (max_len > ilo_cp_space(p->cp)) ilo_cp_flush(p->cp, "out of space"); while (true) { struct ilo_builder_snapshot snapshot; /* we will rewind if aperture check below fails */ ilo_builder_batch_snapshot(&p->cp->builder, &snapshot); handle_invalid_batch_bo(p, false); p->emit_rectlist(p, blitter); if (!ilo_builder_validate(&p->cp->builder, 0, NULL)) { /* rewind */ ilo_builder_batch_restore(&p->cp->builder, &snapshot); /* flush and try again */ if (!ilo_cp_empty(p->cp)) { ilo_cp_flush(p->cp, "out of aperture"); continue; } } break; } ilo_3d_pipeline_invalidate(p, ILO_3D_PIPELINE_INVALIDATE_HW); }
static void ilo_flush(struct pipe_context *pipe, struct pipe_fence_handle **f, unsigned flags) { struct ilo_context *ilo = ilo_context(pipe); ilo_cp_flush(ilo->cp, (flags & PIPE_FLUSH_END_OF_FRAME) ? "frame end" : "user request"); if (f) { *f = (struct pipe_fence_handle *) ilo_fence_create(pipe->screen, ilo->last_cp_bo); } }
/** * Emit context states and 3DPRIMITIVE. */ bool ilo_3d_pipeline_emit_draw(struct ilo_3d_pipeline *p, const struct ilo_context *ilo, int *prim_generated, int *prim_emitted) { bool success; if (ilo->dirty & ILO_DIRTY_SO && ilo->so.enabled && !ilo->so.append_bitmask) { /* * We keep track of the SVBI in the driver, so that we can restore it * when the HW context is invalidated (by another process). The value * needs to be reset when stream output is enabled and the targets are * changed. */ p->state.so_num_vertices = 0; /* on GEN7+, we need SOL_RESET to reset the SO write offsets */ if (p->dev->gen >= ILO_GEN(7)) ilo_cp_set_one_off_flags(p->cp, INTEL_EXEC_GEN7_SOL_RESET); } while (true) { struct ilo_builder_snapshot snapshot; /* we will rewind if aperture check below fails */ ilo_builder_batch_snapshot(&p->cp->builder, &snapshot); handle_invalid_batch_bo(p, false); /* draw! */ p->emit_draw(p, ilo); if (ilo_builder_validate(&ilo->cp->builder, 0, NULL)) { success = true; break; } /* rewind */ ilo_builder_batch_restore(&p->cp->builder, &snapshot); if (ilo_cp_empty(p->cp)) { success = false; break; } else { /* flush and try again */ ilo_cp_flush(p->cp, "out of aperture"); } } if (success) { const int num_verts = u_vertices_per_prim(u_reduced_prim(ilo->draw->mode)); const int max_emit = (p->state.so_max_vertices - p->state.so_num_vertices) / num_verts; const int generated = u_reduced_prims_for_vertices(ilo->draw->mode, ilo->draw->count); const int emitted = MIN2(generated, max_emit); p->state.so_num_vertices += emitted * num_verts; if (prim_generated) *prim_generated = generated; if (prim_emitted) *prim_emitted = emitted; } p->invalidate_flags = 0x0; return success; }