From df3c1a563f3d76b07ab82c7b230b0030452f36ff Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 7 Jun 2010 09:52:14 -0700 Subject: [PATCH] intel: Convert remaining dri_bo_emit_reloc to drm_intel_bo_emit_reloc. The new API makes so much more sense, I'd like to forget how the old one worked. --- src/mesa/drivers/dri/i965/brw_cc.c | 9 +++---- src/mesa/drivers/dri/i965/brw_clip_state.c | 9 +++---- src/mesa/drivers/dri/i965/brw_gs_state.c | 8 +++--- src/mesa/drivers/dri/i965/brw_sf_state.c | 17 +++++------- src/mesa/drivers/dri/i965/brw_vs_state.c | 8 +++--- .../drivers/dri/i965/brw_wm_sampler_state.c | 11 ++++---- src/mesa/drivers/dri/i965/brw_wm_state.c | 26 ++++++++----------- .../drivers/dri/i965/brw_wm_surface_state.c | 8 +++--- .../drivers/dri/intel/intel_batchbuffer.c | 5 ++-- 9 files changed, 41 insertions(+), 60 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_cc.c b/src/mesa/drivers/dri/i965/brw_cc.c index 6a454994cf2..c9e42a1529b 100644 --- a/src/mesa/drivers/dri/i965/brw_cc.c +++ b/src/mesa/drivers/dri/i965/brw_cc.c @@ -296,12 +296,9 @@ cc_unit_create_from_key(struct brw_context *brw, struct brw_cc_unit_key *key) &cc, sizeof(cc)); /* Emit CC viewport relocation */ - dri_bo_emit_reloc(bo, - I915_GEM_DOMAIN_INSTRUCTION, - 0, - 0, - offsetof(struct brw_cc_unit_state, cc4), - brw->cc.vp_bo); + drm_intel_bo_emit_reloc(bo, offsetof(struct brw_cc_unit_state, cc4), + brw->cc.vp_bo, 0, + I915_GEM_DOMAIN_INSTRUCTION, 0); return bo; } diff --git a/src/mesa/drivers/dri/i965/brw_clip_state.c b/src/mesa/drivers/dri/i965/brw_clip_state.c index 39285ff44db..856d8f0c6c0 100644 --- a/src/mesa/drivers/dri/i965/brw_clip_state.c +++ b/src/mesa/drivers/dri/i965/brw_clip_state.c @@ -146,12 +146,9 @@ clip_unit_create_from_key(struct brw_context *brw, /* Emit clip program relocation */ assert(brw->clip.prog_bo); - dri_bo_emit_reloc(bo, - I915_GEM_DOMAIN_INSTRUCTION, - 0, - clip.thread0.grf_reg_count << 1, - offsetof(struct brw_clip_unit_state, thread0), - brw->clip.prog_bo); + drm_intel_bo_emit_reloc(bo, offsetof(struct brw_clip_unit_state, thread0), + brw->clip.prog_bo, clip.thread0.grf_reg_count << 1, + I915_GEM_DOMAIN_INSTRUCTION, 0); return bo; } diff --git a/src/mesa/drivers/dri/i965/brw_gs_state.c b/src/mesa/drivers/dri/i965/brw_gs_state.c index c01315120e6..63562ebcfc2 100644 --- a/src/mesa/drivers/dri/i965/brw_gs_state.c +++ b/src/mesa/drivers/dri/i965/brw_gs_state.c @@ -111,11 +111,9 @@ gs_unit_create_from_key(struct brw_context *brw, struct brw_gs_unit_key *key) if (key->prog_active) { /* Emit GS program relocation */ - dri_bo_emit_reloc(bo, - I915_GEM_DOMAIN_INSTRUCTION, 0, - gs.thread0.grf_reg_count << 1, - offsetof(struct brw_gs_unit_state, thread0), - brw->gs.prog_bo); + drm_intel_bo_emit_reloc(bo, offsetof(struct brw_gs_unit_state, thread0), + brw->gs.prog_bo, gs.thread0.grf_reg_count << 1, + I915_GEM_DOMAIN_INSTRUCTION, 0); } return bo; diff --git a/src/mesa/drivers/dri/i965/brw_sf_state.c b/src/mesa/drivers/dri/i965/brw_sf_state.c index b1cab6a6bc3..a95acb4cf82 100644 --- a/src/mesa/drivers/dri/i965/brw_sf_state.c +++ b/src/mesa/drivers/dri/i965/brw_sf_state.c @@ -327,18 +327,15 @@ sf_unit_create_from_key(struct brw_context *brw, struct brw_sf_unit_key *key, * something loaded through the GPE (L2 ISC), so it's INSTRUCTION domain. */ /* Emit SF program relocation */ - dri_bo_emit_reloc(bo, - I915_GEM_DOMAIN_INSTRUCTION, 0, - sf.thread0.grf_reg_count << 1, - offsetof(struct brw_sf_unit_state, thread0), - brw->sf.prog_bo); + drm_intel_bo_emit_reloc(bo, offsetof(struct brw_sf_unit_state, thread0), + brw->sf.prog_bo, sf.thread0.grf_reg_count << 1, + I915_GEM_DOMAIN_INSTRUCTION, 0); /* Emit SF viewport relocation */ - dri_bo_emit_reloc(bo, - I915_GEM_DOMAIN_INSTRUCTION, 0, - sf.sf5.front_winding | (sf.sf5.viewport_transform << 1), - offsetof(struct brw_sf_unit_state, sf5), - brw->sf.vp_bo); + drm_intel_bo_emit_reloc(bo, offsetof(struct brw_sf_unit_state, sf5), + brw->sf.vp_bo, (sf.sf5.front_winding | + (sf.sf5.viewport_transform << 1)), + I915_GEM_DOMAIN_INSTRUCTION, 0); return bo; } diff --git a/src/mesa/drivers/dri/i965/brw_vs_state.c b/src/mesa/drivers/dri/i965/brw_vs_state.c index 8e54881fe1c..9b2dd5b3d1c 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_state.c +++ b/src/mesa/drivers/dri/i965/brw_vs_state.c @@ -167,11 +167,9 @@ vs_unit_create_from_key(struct brw_context *brw, struct brw_vs_unit_key *key) &vs, sizeof(vs)); /* Emit VS program relocation */ - dri_bo_emit_reloc(bo, - I915_GEM_DOMAIN_INSTRUCTION, 0, - vs.thread0.grf_reg_count << 1, - offsetof(struct brw_vs_unit_state, thread0), - brw->vs.prog_bo); + drm_intel_bo_emit_reloc(bo, offsetof(struct brw_vs_unit_state, thread0), + brw->vs.prog_bo, vs.thread0.grf_reg_count << 1, + I915_GEM_DOMAIN_INSTRUCTION, 0); return bo; } diff --git a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c index 823c1c3ab18..9fbabdc2852 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c @@ -343,12 +343,11 @@ static void upload_wm_samplers( struct brw_context *brw ) if (!ctx->Texture.Unit[i]._ReallyEnabled) continue; - dri_bo_emit_reloc(brw->wm.sampler_bo, - I915_GEM_DOMAIN_SAMPLER, 0, - 0, - i * sizeof(struct brw_sampler_state) + - offsetof(struct brw_sampler_state, ss2), - brw->wm.sdc_bo[i]); + drm_intel_bo_emit_reloc(brw->wm.sampler_bo, + i * sizeof(struct brw_sampler_state) + + offsetof(struct brw_sampler_state, ss2), + brw->wm.sdc_bo[i], 0, + I915_GEM_DOMAIN_SAMPLER, 0); } } } diff --git a/src/mesa/drivers/dri/i965/brw_wm_state.c b/src/mesa/drivers/dri/i965/brw_wm_state.c index f36f62611ea..1789b21451d 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_state.c @@ -213,28 +213,24 @@ wm_unit_create_from_key(struct brw_context *brw, struct brw_wm_unit_key *key, &wm, sizeof(wm)); /* Emit WM program relocation */ - dri_bo_emit_reloc(bo, - I915_GEM_DOMAIN_INSTRUCTION, 0, - wm.thread0.grf_reg_count << 1, - offsetof(struct brw_wm_unit_state, thread0), - brw->wm.prog_bo); + drm_intel_bo_emit_reloc(bo, offsetof(struct brw_wm_unit_state, thread0), + brw->wm.prog_bo, wm.thread0.grf_reg_count << 1, + I915_GEM_DOMAIN_INSTRUCTION, 0); /* Emit scratch space relocation */ if (key->total_scratch != 0) { - dri_bo_emit_reloc(bo, - 0, 0, - wm.thread2.per_thread_scratch_space, - offsetof(struct brw_wm_unit_state, thread2), - brw->wm.scratch_bo); + drm_intel_bo_emit_reloc(bo, offsetof(struct brw_wm_unit_state, thread2), + brw->wm.scratch_bo, + wm.thread2.per_thread_scratch_space, + 0, 0); } /* Emit sampler state relocation */ if (key->sampler_count != 0) { - dri_bo_emit_reloc(bo, - I915_GEM_DOMAIN_INSTRUCTION, 0, - wm.wm4.stats_enable | (wm.wm4.sampler_count << 2), - offsetof(struct brw_wm_unit_state, wm4), - brw->wm.sampler_bo); + drm_intel_bo_emit_reloc(bo, offsetof(struct brw_wm_unit_state, wm4), + brw->wm.sampler_bo, (wm.wm4.stats_enable | + (wm.wm4.sampler_count << 2)), + I915_GEM_DOMAIN_INSTRUCTION, 0); } return bo; diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index 526098a79a4..a9ad2ce3713 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -667,11 +667,9 @@ brw_wm_get_binding_table(struct brw_context *brw) /* Emit binding table relocations to surface state */ for (i = 0; i < BRW_WM_MAX_SURF; i++) { if (brw->wm.surf_bo[i] != NULL) { - dri_bo_emit_reloc(bind_bo, - I915_GEM_DOMAIN_INSTRUCTION, 0, - 0, - i * sizeof(GLuint), - brw->wm.surf_bo[i]); + drm_intel_bo_emit_reloc(bind_bo, i * sizeof(GLuint), + brw->wm.surf_bo[i], 0, + I915_GEM_DOMAIN_INSTRUCTION, 0); } } } diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.c b/src/mesa/drivers/dri/intel/intel_batchbuffer.c index 1249efdc0ec..1116bccd8e7 100644 --- a/src/mesa/drivers/dri/intel/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.c @@ -194,8 +194,9 @@ intel_batchbuffer_emit_reloc(struct intel_batchbuffer *batch, if (batch->ptr - batch->map > batch->buf->size) printf ("bad relocation ptr %p map %p offset %d size %lu\n", batch->ptr, batch->map, batch->ptr - batch->map, batch->buf->size); - ret = dri_bo_emit_reloc(batch->buf, read_domains, write_domain, - delta, batch->ptr - batch->map, buffer); + ret = drm_intel_bo_emit_reloc(batch->buf, batch->ptr - batch->map, + buffer, delta, + read_domains, write_domain); /* * Using the old buffer offset, write in what the right data would be, in case -- 2.30.2