<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Nov 16, 2016 at 12:56 AM, Jordan Justen <span dir="ltr"><<a href="mailto:jordan.l.justen@intel.com" target="_blank">jordan.l.justen@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Signed-off-by: Jordan Justen <<a href="mailto:jordan.l.justen@intel.com">jordan.l.justen@intel.com</a>><br>
---<br>
src/intel/blorp/blorp.h | 8 +++++++<br>
src/mesa/drivers/dri/i965/brw_<wbr>blorp.c | 39 ++++++++++++++++++++++++++++++<wbr>+++++<br>
2 files changed, 47 insertions(+)<br>
<br>
diff --git a/src/intel/blorp/blorp.h b/src/intel/blorp/blorp.h<br>
index 4351cb1..d891ba3 100644<br>
--- a/src/intel/blorp/blorp.h<br>
+++ b/src/intel/blorp/blorp.h<br>
@@ -38,6 +38,7 @@ extern "C" {<br>
<br>
struct blorp_batch;<br>
struct blorp_params;<br>
+struct blorp_address;<br>
<br>
struct blorp_context {<br>
void *driver_ctx;<br>
@@ -52,6 +53,13 @@ struct blorp_context {<br>
uint32_t vb;<br>
} mocs;<br>
<br>
+ void (*map)(const struct blorp_context *blorp,<br>
+ const struct blorp_address *blorp_addr,<br>
+ void **addr,<br>
+ unsigned int *map_size,<br>
+ bool *mapped_previously);<br>
+ void (*unmap)(const struct blorp_context *blorp,<br>
+ const struct blorp_address *blorp_addr);<br>
bool (*lookup_shader)(struct blorp_context *blorp,<br>
const void *key, uint32_t key_size,<br>
uint32_t *kernel_out, void *prog_data_out);<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c b/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c<br>
index f0ad074..41b6214 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c<br>
@@ -34,10 +34,47 @@<br>
#include "brw_meta_util.h"<br>
#include "brw_state.h"<br>
#include "intel_fbo.h"<br>
+#include "intel_batchbuffer.h"<br>
#include "intel_debug.h"<br>
<br>
#define FILE_DEBUG_FLAG DEBUG_BLORP<br>
<br>
+static void<br>
+brw_blorp_map(const struct blorp_context *blorp,<br>
+ const struct blorp_address *blorp_addr,<br>
+ void **addr,<br>
+ unsigned int *size,<br>
+ bool *mapped_previously)<br>
+{<br>
+ struct brw_context *brw = blorp->driver_ctx;<br>
+ drm_intel_bo *bo = (drm_intel_bo *)blorp_addr->buffer;<br>
+<br>
+ *mapped_previously = bo->virtual != NULL;<br>
+<br>
+ if (!*mapped_previously) {<br>
+ if (drm_intel_bo_references(brw-><a href="http://batch.bo" rel="noreferrer" target="_blank"><wbr>batch.bo</a>, bo))<br>
+ intel_batchbuffer_flush(brw);<br>
+<br>
+ int ret = drm_intel_bo_map(bo, /*write_enable*/ false);<br>
+ if (ret == -1) {<br>
+ assert(bo->virtual == NULL);<br>
+ *addr = NULL;<br>
+ return;<br>
+ }<br>
+ }<br>
+<br>
+ *addr = bo->virtual;<br>
+ *size = bo->size;<br>
+}<br>
+<br>
+static void<br>
+brw_blorp_unmap(const struct blorp_context *blorp,<br>
+ const struct blorp_address *blorp_addr)<br>
+{<br>
+ drm_intel_bo *bo = (drm_intel_bo *)blorp_addr->buffer;<br>
+ drm_intel_bo_unmap(bo);<br></blockquote><div><br></div><div>In the above code you don't map again if it's already got a map but here you unmap regardless. Is this going to result in some sort of nasty double-umapping?<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+}<br>
+<br>
static bool<br>
brw_blorp_lookup_shader(struct blorp_context *blorp,<br>
const void *key, uint32_t key_size,<br>
@@ -102,6 +139,8 @@ brw_blorp_init(struct brw_context *brw)<br>
unreachable("Invalid gen");<br>
}<br>
<br>
+ brw->blorp.map = brw_blorp_map;<br>
+ brw->blorp.unmap = brw_blorp_unmap;<br>
brw->blorp.lookup_shader = brw_blorp_lookup_shader;<br>
brw->blorp.upload_shader = brw_blorp_upload_shader;<br>
}<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.10.2<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">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/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>