aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2011-12-29 18:24:02 -0800
committerEric Anholt <[email protected]>2012-01-06 09:17:04 -0800
commit7f91c8bf2bf08afd297314c02a8869d8919f5f0e (patch)
treef3509804d25fec8381003758efd086eb10a525f1
parentc4089d444a1736dba0c3d9c389ac216ce8711da8 (diff)
i965/gen7: Flush the batch between transform feedbacks.
We need the kernel to reset our pointers to 0 in between. Note that the initialization of function pointer had to move to after InitContext since we didn't have intel->gen set up yet. Fixes piglit EXT_transform_feedback/immediate-reuse Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.c13
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.h5
-rw-r--r--src/mesa/drivers/dri/i965/gen7_sol_state.c16
3 files changed, 31 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index f5c9d7aa398..48c141c9c2e 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -109,7 +109,8 @@ static void brwPrepareExecBegin(struct gl_context *ctx)
}
}
-static void brwInitDriverFunctions( struct dd_function_table *functions )
+static void brwInitDriverFunctions(struct intel_screen *screen,
+ struct dd_function_table *functions)
{
intelInitDriverFunctions( functions );
@@ -118,7 +119,11 @@ static void brwInitDriverFunctions( struct dd_function_table *functions )
functions->PrepareExecBegin = brwPrepareExecBegin;
functions->BeginTransformFeedback = brw_begin_transform_feedback;
- functions->EndTransformFeedback = brw_end_transform_feedback;
+
+ if (screen->gen >= 7)
+ functions->EndTransformFeedback = gen7_end_transform_feedback;
+ else
+ functions->EndTransformFeedback = brw_end_transform_feedback;
}
bool
@@ -127,6 +132,8 @@ brwCreateContext(int api,
__DRIcontext *driContextPriv,
void *sharedContextPrivate)
{
+ __DRIscreen *sPriv = driContextPriv->driScreenPriv;
+ struct intel_screen *screen = sPriv->driverPrivate;
struct dd_function_table functions;
struct brw_context *brw = rzalloc(NULL, struct brw_context);
struct intel_context *intel = &brw->intel;
@@ -138,7 +145,7 @@ brwCreateContext(int api,
return false;
}
- brwInitDriverFunctions( &functions );
+ brwInitDriverFunctions(screen, &functions);
if (!intelInitContext( intel, api, mesaVis, driContextPriv,
sharedContextPrivate, &functions )) {
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index fb41fd1f04f..873e172b88c 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -1093,6 +1093,11 @@ void
brw_end_transform_feedback(struct gl_context *ctx,
struct gl_transform_feedback_object *obj);
+/* gen7_sol_state.c */
+void
+gen7_end_transform_feedback(struct gl_context *ctx,
+ struct gl_transform_feedback_object *obj);
+
/*======================================================================
diff --git a/src/mesa/drivers/dri/i965/gen7_sol_state.c b/src/mesa/drivers/dri/i965/gen7_sol_state.c
index c4e0622a6e0..81ffc0e7ade 100644
--- a/src/mesa/drivers/dri/i965/gen7_sol_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_sol_state.c
@@ -264,3 +264,19 @@ const struct brw_tracked_state gen7_sol_state = {
},
.emit = upload_sol_state,
};
+
+void
+gen7_end_transform_feedback(struct gl_context *ctx,
+ struct gl_transform_feedback_object *obj)
+{
+ /* Because we have to rely on the kernel to reset our SO write offsets, and
+ * we only get to do it once per batchbuffer, flush the batch after feedback
+ * so another transform feedback can get the write offset reset it needs.
+ *
+ * This also covers any cache flushing required.
+ */
+ struct brw_context *brw = brw_context(ctx);
+ struct intel_context *intel = &brw->intel;
+
+ intel_batchbuffer_flush(intel);
+}