Re: [Mesa-dev] [PATCH 36/53] i965: Use brw_emit_reloc() instead of drm_bacon_bo_emit_reloc().

2017-04-05 Thread Chris Wilson
On Tue, Apr 04, 2017 at 05:10:26PM -0700, Kenneth Graunke wrote:
> I'm about to make brw_emit_reloc do actual work, so everybody needs
> to start using it and not the raw drm_bacon function.

Too much u32. Are those limitations part of future plans? Certainly
needs a comment about why the bugs are kept.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 36/53] i965: Use brw_emit_reloc() instead of drm_bacon_bo_emit_reloc().

2017-04-04 Thread Kenneth Graunke
I'm about to make brw_emit_reloc do actual work, so everybody needs
to start using it and not the raw drm_bacon function.
---
 src/mesa/drivers/dri/i965/brw_cc.c   | 10 +++---
 src/mesa/drivers/dri/i965/brw_clip_state.c   | 11 +++---
 src/mesa/drivers/dri/i965/brw_context.h  | 18 --
 src/mesa/drivers/dri/i965/brw_gs_state.c |  1 +
 src/mesa/drivers/dri/i965/brw_sampler_state.c|  7 ++--
 src/mesa/drivers/dri/i965/brw_sf_state.c | 15 +
 src/mesa/drivers/dri/i965/brw_vs_state.c | 26 +++---
 src/mesa/drivers/dri/i965/brw_wm_state.c | 26 +++---
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 43 +---
 src/mesa/drivers/dri/i965/genX_blorp_exec.c  |  5 ++-
 src/mesa/drivers/dri/i965/intel_batchbuffer.h| 15 +
 11 files changed, 82 insertions(+), 95 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_cc.c 
b/src/mesa/drivers/dri/i965/brw_cc.c
index c47e7343d81..21b01f3bb18 100644
--- a/src/mesa/drivers/dri/i965/brw_cc.c
+++ b/src/mesa/drivers/dri/i965/brw_cc.c
@@ -236,11 +236,11 @@ static void upload_cc_unit(struct brw_context *brw)
brw->ctx.NewDriverState |= BRW_NEW_GEN4_UNIT_STATE;
 
/* Emit CC viewport relocation */
-   drm_bacon_bo_emit_reloc(brw->batch.bo,
-  (brw->cc.state_offset +
-   offsetof(struct brw_cc_unit_state, cc4)),
-  brw->batch.bo, brw->cc.vp_offset,
-  I915_GEM_DOMAIN_INSTRUCTION, 0);
+   brw_emit_reloc(>batch,
+  (brw->cc.state_offset +
+   offsetof(struct brw_cc_unit_state, cc4)),
+  brw->batch.bo, brw->cc.vp_offset,
+  I915_GEM_DOMAIN_INSTRUCTION, 0);
 }
 
 const struct brw_tracked_state brw_cc_unit = {
diff --git a/src/mesa/drivers/dri/i965/brw_clip_state.c 
b/src/mesa/drivers/dri/i965/brw_clip_state.c
index 148b98f14d8..5e084a9961d 100644
--- a/src/mesa/drivers/dri/i965/brw_clip_state.c
+++ b/src/mesa/drivers/dri/i965/brw_clip_state.c
@@ -29,6 +29,7 @@
   *   Keith Whitwell 
   */
 
+#include "intel_batchbuffer.h"
 #include "brw_context.h"
 #include "brw_state.h"
 #include "brw_defines.h"
@@ -136,11 +137,11 @@ brw_upload_clip_unit(struct brw_context *brw)
  (brw->batch.bo->offset64 + brw->clip.vp_offset) >> 5;
 
   /* emit clip viewport relocation */
-  drm_bacon_bo_emit_reloc(brw->batch.bo,
-  (brw->clip.state_offset +
-   offsetof(struct brw_clip_unit_state, clip6)),
-  brw->batch.bo, brw->clip.vp_offset,
-  I915_GEM_DOMAIN_INSTRUCTION, 0);
+  brw_emit_reloc(>batch,
+ (brw->clip.state_offset +
+  offsetof(struct brw_clip_unit_state, clip6)),
+ brw->batch.bo, brw->clip.vp_offset,
+ I915_GEM_DOMAIN_INSTRUCTION, 0);
}
 
/* _NEW_TRANSFORM */
diff --git a/src/mesa/drivers/dri/i965/brw_context.h 
b/src/mesa/drivers/dri/i965/brw_context.h
index 8d94b418777..00e9224d7d7 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -1609,24 +1609,6 @@ brw_program_const(const struct gl_program *p)
return (const struct brw_program *) p;
 }
 
-static inline uint32_t
-brw_program_reloc(struct brw_context *brw, uint32_t state_offset,
- uint32_t prog_offset)
-{
-   if (brw->gen >= 5) {
-  /* Using state base address. */
-  return prog_offset;
-   }
-
-   drm_bacon_bo_emit_reloc(brw->batch.bo,
-  state_offset,
-  brw->cache.bo,
-  prog_offset,
-  I915_GEM_DOMAIN_INSTRUCTION, 0);
-
-   return brw->cache.bo->offset64 + prog_offset;
-}
-
 static inline bool
 brw_depth_writes_enabled(const struct brw_context *brw)
 {
diff --git a/src/mesa/drivers/dri/i965/brw_gs_state.c 
b/src/mesa/drivers/dri/i965/brw_gs_state.c
index acd0f5f877d..ed9ae44bcdb 100644
--- a/src/mesa/drivers/dri/i965/brw_gs_state.c
+++ b/src/mesa/drivers/dri/i965/brw_gs_state.c
@@ -34,6 +34,7 @@
 #include "brw_context.h"
 #include "brw_state.h"
 #include "brw_defines.h"
+#include "intel_batchbuffer.h"
 
 static void
 brw_upload_gs_unit(struct brw_context *brw)
diff --git a/src/mesa/drivers/dri/i965/brw_sampler_state.c 
b/src/mesa/drivers/dri/i965/brw_sampler_state.c
index ff338809aa6..5d57a35f20f 100644
--- a/src/mesa/drivers/dri/i965/brw_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/brw_sampler_state.c
@@ -104,10 +104,9 @@ brw_emit_sampler_state(struct brw_context *brw,
ss[2] = border_color_offset;
if (brw->gen < 6) {
   ss[2] += brw->batch.bo->offset64; /* reloc */
-  drm_bacon_bo_emit_reloc(brw->batch.bo,
-  batch_offset_for_sampler_state + 8,
-  brw->batch.bo,