/** * Reallocate the parser bo. */ static void ilo_cp_realloc_bo(struct ilo_cp *cp) { struct intel_bo *bo; /* * allocate the new bo before unreferencing the old one so that they * won't point at the same address, which is needed for jmpbuf */ bo = intel_winsys_alloc_buffer(cp->winsys, "batch buffer", cp->bo_size * 4, 0); if (unlikely(!bo)) { /* reuse the old one */ bo = cp->bo; intel_bo_reference(bo); } if (cp->bo) intel_bo_unreference(cp->bo); cp->bo = bo; if (!cp->sys) { intel_bo_map(cp->bo, true); cp->ptr = intel_bo_get_virtual(cp->bo); } }
/** * Flush the command parser and execute the commands. When the parser buffer * is empty, the callback is not invoked. */ void ilo_cp_flush_internal(struct ilo_cp *cp) { const bool do_exec = !(ilo_debug & ILO_DEBUG_NOHW); struct intel_bo *bo; unsigned used; int err; bo = ilo_cp_end_batch(cp, &used); if (!bo) return; if (likely(do_exec)) { err = intel_winsys_submit_bo(cp->winsys, cp->ring, bo, used, cp->render_ctx, cp->one_off_flags); } else { err = 0; } cp->one_off_flags = 0; if (!err) { if (cp->last_submitted_bo) intel_bo_unreference(cp->last_submitted_bo); cp->last_submitted_bo = bo; intel_bo_reference(cp->last_submitted_bo); if (cp->flush_callback) cp->flush_callback(cp, cp->flush_callback_data); } ilo_builder_begin(&cp->builder); }
static void ilo_context_cp_flushed(struct ilo_cp *cp, void *data) { struct ilo_context *ilo = ilo_context(data); if (ilo->last_cp_bo) intel_bo_unreference(ilo->last_cp_bo); /* remember the just flushed bo, on which fences could wait */ ilo->last_cp_bo = cp->bo; intel_bo_reference(ilo->last_cp_bo); ilo_3d_cp_flushed(ilo->hw3d); }