From a04d8574c61f286fd9ec51f667648f73e332462f Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Fri, 17 May 2013 16:10:11 +0800 Subject: [PATCH] ilo: harware contexts are only for the render ring The hardware context should not be passed for bo execution when the ring is not the render ring. Rename hw_ctx to render_ctx for clarity. --- src/gallium/drivers/ilo/ilo_3d.c | 2 +- src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c | 2 +- src/gallium/drivers/ilo/ilo_cp.c | 12 ++++++++---- src/gallium/drivers/ilo/ilo_cp.h | 2 +- src/gallium/drivers/ilo/ilo_transfer.c | 2 +- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/ilo/ilo_3d.c b/src/gallium/drivers/ilo/ilo_3d.c index b802e7f..e03e530 100644 --- a/src/gallium/drivers/ilo/ilo_3d.c +++ b/src/gallium/drivers/ilo/ilo_3d.c @@ -250,7 +250,7 @@ ilo_3d_new_cp_batch(struct ilo_3d *hw3d) ilo_3d_pipeline_invalidate(hw3d->pipeline, ILO_3D_PIPELINE_INVALIDATE_BATCH_BO | ILO_3D_PIPELINE_INVALIDATE_STATE_BO); - if (!hw3d->cp->hw_ctx) { + if (!hw3d->cp->render_ctx) { ilo_3d_pipeline_invalidate(hw3d->pipeline, ILO_3D_PIPELINE_INVALIDATE_HW); } diff --git a/src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c b/src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c index 06559b7..2cf78e5 100644 --- a/src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c +++ b/src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c @@ -402,7 +402,7 @@ gen7_pipeline_sol(struct ilo_3d_pipeline *p, int base = 0; /* reset HW write offsets and offset buffer base */ - if (!p->cp->hw_ctx) { + if (!p->cp->render_ctx) { ilo_cp_set_one_off_flags(p->cp, INTEL_EXEC_GEN7_SOL_RESET); base += p->state.so_num_vertices * stride; } diff --git a/src/gallium/drivers/ilo/ilo_cp.c b/src/gallium/drivers/ilo/ilo_cp.c index 41473c0..b67c872 100644 --- a/src/gallium/drivers/ilo/ilo_cp.c +++ b/src/gallium/drivers/ilo/ilo_cp.c @@ -176,17 +176,21 @@ static int ilo_cp_exec_bo(struct ilo_cp *cp) { const bool do_exec = !(ilo_debug & ILO_DEBUG_NOHW); + struct intel_context *ctx; unsigned long flags; int err; switch (cp->ring) { case ILO_CP_RING_RENDER: + ctx = cp->render_ctx; flags = INTEL_EXEC_RENDER; break; case ILO_CP_RING_BLT: + ctx = NULL; flags = INTEL_EXEC_BLT; break; default: + ctx = NULL; flags = 0; break; } @@ -194,7 +198,7 @@ ilo_cp_exec_bo(struct ilo_cp *cp) flags |= cp->one_off_flags; if (likely(do_exec)) - err = cp->bo->exec(cp->bo, cp->used * 4, cp->hw_ctx, flags); + err = cp->bo->exec(cp->bo, cp->used * 4, ctx, flags); else err = 0; @@ -274,8 +278,8 @@ ilo_cp_destroy(struct ilo_cp *cp) { if (cp->bo) cp->bo->unreference(cp->bo); - if (cp->hw_ctx) - cp->winsys->destroy_context(cp->winsys, cp->hw_ctx); + if (cp->render_ctx) + cp->winsys->destroy_context(cp->winsys, cp->render_ctx); FREE(cp->sys); FREE(cp); @@ -294,7 +298,7 @@ ilo_cp_create(struct intel_winsys *winsys, bool direct_map) return NULL; cp->winsys = winsys; - cp->hw_ctx = winsys->create_context(winsys); + cp->render_ctx = winsys->create_context(winsys); cp->ring = ILO_CP_RING_RENDER; cp->no_implicit_flush = false; diff --git a/src/gallium/drivers/ilo/ilo_cp.h b/src/gallium/drivers/ilo/ilo_cp.h index 2ecd832..2e9b0e3 100644 --- a/src/gallium/drivers/ilo/ilo_cp.h +++ b/src/gallium/drivers/ilo/ilo_cp.h @@ -56,7 +56,7 @@ typedef void (*ilo_cp_hook_func)(struct ilo_cp *cp, void *data); */ struct ilo_cp { struct intel_winsys *winsys; - struct intel_context *hw_ctx; + struct intel_context *render_ctx; enum ilo_cp_ring ring; bool no_implicit_flush; diff --git a/src/gallium/drivers/ilo/ilo_transfer.c b/src/gallium/drivers/ilo/ilo_transfer.c index a3f4953..4d6e326 100644 --- a/src/gallium/drivers/ilo/ilo_transfer.c +++ b/src/gallium/drivers/ilo/ilo_transfer.c @@ -76,7 +76,7 @@ is_bo_busy(struct ilo_context *ilo, struct intel_bo *bo, bool *need_flush) * without being referenced by ilo->cp->bo. We have to flush * unconditionally, and that is bad. */ - if (ilo->cp->hw_ctx) + if (ilo->cp->render_ctx) ilo_cp_flush(ilo->cp); return intel_bo_is_busy(bo); -- 2.7.4