<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Fri, Sep 7, 2018 at 4:35 PM Chris Wilson <<a href="mailto:chris@chris-wilson.co.uk">chris@chris-wilson.co.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">As a prelude to handling large address spaces, first allow ourselves the<br>
luxury of handling the full 4G.<br>
<br>
Reported-by: Andrey Simiklit <<a href="mailto:asimiklit.work@gmail.com" target="_blank">asimiklit.work@gmail.com</a>><br>
Cc: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</a>><br>
---<br>
 src/mesa/drivers/dri/i965/brw_context.h       | 2 +-<br>
 src/mesa/drivers/dri/i965/intel_batchbuffer.c | 9 +--------<br>
 src/mesa/drivers/dri/i965/intel_batchbuffer.h | 8 ++++++--<br>
 3 files changed, 8 insertions(+), 11 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h<br>
index d3b96953467..ca1fe8ef0ea 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_context.h<br>
+++ b/src/mesa/drivers/dri/i965/brw_context.h<br>
@@ -509,7 +509,7 @@ struct intel_batchbuffer {<br>
    int exec_array_size;<br>
<br>
    /** The amount of aperture space (in bytes) used by all exec_bos */<br>
-   int aperture_space;<br>
+   uint64_t aperture_space;<br></blockquote><div> </div><div>There are several fields which are not cleaned when <br>Mesa managed to save the 'empty batch' and uses<br>'intel_batchbuffer_reset_to_saved' to restore back to it)<br>The negative aperture just helped me to find <br>the root cause of the issue)<br>But actually you are right I also do not know why<br>we use the signed 32bit integer there)<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
    struct {<br>
       uint32_t *map_next;<br>
diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c b/src/mesa/drivers/dri/i965/intel_batchbuffer.c<br>
index 65d2c64e319..4363b146150 100644<br>
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c<br>
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c<br>
@@ -870,7 +870,7 @@ _intel_batchbuffer_flush_fence(struct brw_context *brw,<br>
               bytes_for_commands, 100.0f * bytes_for_commands / BATCH_SZ,<br>
               bytes_for_state, 100.0f * bytes_for_state / STATE_SZ,<br>
               brw->batch.exec_count,<br>
-              (float) brw->batch.aperture_space / (1024 * 1024),<br>
+              (float) (brw->batch.aperture_space / (1024 * 1024)),<br>
               brw->batch.batch_relocs.reloc_count,<br>
               brw->batch.state_relocs.reloc_count);<br>
<br>
@@ -890,13 +890,6 @@ _intel_batchbuffer_flush_fence(struct brw_context *brw,<br>
    return ret;<br>
 }<br>
<br>
-bool<br>
-brw_batch_has_aperture_space(struct brw_context *brw, unsigned extra_space)<br>
-{<br>
-   return brw->batch.aperture_space + extra_space <=<br>
-          brw->screen->aperture_threshold;<br>
-}<br>
-<br>
 bool<br>
 brw_batch_references(struct intel_batchbuffer *batch, struct brw_bo *bo)<br>
 {<br>
diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.h b/src/mesa/drivers/dri/i965/intel_batchbuffer.h<br>
index d10948f1916..0632142cd31 100644<br>
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.h<br>
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.h<br>
@@ -44,8 +44,12 @@ int _intel_batchbuffer_flush_fence(struct brw_context *brw,<br>
 void intel_batchbuffer_data(struct brw_context *brw,<br>
                             const void *data, GLuint bytes);<br>
<br>
-bool brw_batch_has_aperture_space(struct brw_context *brw,<br>
-                                  unsigned extra_space_in_bytes);<br>
+static inline bool<br>
+brw_batch_has_aperture_space(struct brw_context *brw, uint64_t extra_space)<br>
+{<br>
+   return brw->batch.aperture_space + extra_space <=<br>
+          brw->screen->aperture_threshold;<br>
+}<br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
 bool brw_batch_references(struct intel_batchbuffer *batch, struct brw_bo *bo);<br>
<br>
-- <br>
2.19.0.rc2<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</blockquote></div></div></div></div></div></div>