Mesa (master): r600g: move simple part of bo reloc processing inline.

Dave Airlie airlied at kemper.freedesktop.org
Wed Jun 8 01:47:38 UTC 2011


Module: Mesa
Branch: master
Commit: 745abb53cf3f97600eed2e27361b82eb9727c41d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=745abb53cf3f97600eed2e27361b82eb9727c41d

Author: Dave Airlie <airlied at redhat.com>
Date:   Tue Jun  7 15:40:20 2011 +1000

r600g: move simple part of bo reloc processing inline.

This just moves the messy stuff out of the fast path,
and leaves the fast-case in the fast path.

Signed-off-by: Dave Airlie <airlied at redhat.com>

---

 src/gallium/winsys/r600/drm/r600_hw_context.c |   13 ++-----------
 src/gallium/winsys/r600/drm/r600_priv.h       |   16 +++++++++++++++-
 2 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c
index 7386c00..1d398bf 100644
--- a/src/gallium/winsys/r600/drm/r600_hw_context.c
+++ b/src/gallium/winsys/r600/drm/r600_hw_context.c
@@ -949,16 +949,9 @@ void r600_context_bo_flush(struct r600_context *ctx, unsigned flush_flags,
 	bo->last_flush = (bo->last_flush | flush_flags) & flush_mask;
 }
 
-void r600_context_bo_reloc(struct r600_context *ctx, u32 *pm4, struct r600_bo *rbo)
+void r600_context_get_reloc(struct r600_context *ctx, struct r600_bo *rbo)
 {
-	struct radeon_bo *bo;
-
-	bo = rbo->bo;
-	assert(bo != NULL);
-	if (bo->reloc) {
-		*pm4 = bo->reloc_id;
-		return;
-	}
+	struct radeon_bo *bo = rbo->bo;
 	bo->reloc = &ctx->reloc[ctx->creloc];
 	bo->reloc_id = ctx->creloc * sizeof(struct r600_reloc) / 4;
 	ctx->reloc[ctx->creloc].handle = bo->handle;
@@ -968,8 +961,6 @@ void r600_context_bo_reloc(struct r600_context *ctx, u32 *pm4, struct r600_bo *r
 	radeon_bo_reference(ctx->radeon, &ctx->bo[ctx->creloc], bo);
 	rbo->fence = ctx->radeon->fence;
 	ctx->creloc++;
-	/* set PKT3 to point to proper reloc */
-	*pm4 = bo->reloc_id;
 }
 
 void r600_context_reg(struct r600_context *ctx,
diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h
index 16deab6..082370a 100644
--- a/src/gallium/winsys/r600/drm/r600_priv.h
+++ b/src/gallium/winsys/r600/drm/r600_priv.h
@@ -156,7 +156,7 @@ int radeon_bo_fixed_map(struct radeon *radeon, struct radeon_bo *bo);
  * r600_hw_context.c
  */
 int r600_context_init_fence(struct r600_context *ctx);
-void r600_context_bo_reloc(struct r600_context *ctx, u32 *pm4, struct r600_bo *rbo);
+void r600_context_get_reloc(struct r600_context *ctx, struct r600_bo *rbo);
 void r600_context_bo_flush(struct r600_context *ctx, unsigned flush_flags,
 				unsigned flush_mask, struct r600_bo *rbo);
 struct r600_bo *r600_context_reg_bo(struct r600_context *ctx, unsigned offset);
@@ -173,6 +173,20 @@ void r600_context_reg(struct r600_context *ctx,
 		      unsigned mask);
 void r600_init_cs(struct r600_context *ctx);
 int r600_resource_init(struct r600_context *ctx, struct r600_range *range, unsigned offset, unsigned nblocks, unsigned stride, struct r600_reg *reg, int nreg, unsigned offset_base);
+
+static INLINE void r600_context_bo_reloc(struct r600_context *ctx, u32 *pm4, struct r600_bo *rbo)
+{
+	struct radeon_bo *bo = rbo->bo;
+
+	assert(bo != NULL);
+
+	if (!bo->reloc)
+		r600_context_get_reloc(ctx, rbo);
+
+	/* set PKT3 to point to proper reloc */
+	*pm4 = bo->reloc_id;
+}
+
 /*
  * r600_bo.c
  */




More information about the mesa-commit mailing list