aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2007-08-10 12:57:14 +0100
committerKeith Whitwell <[email protected]>2007-08-10 12:58:26 +0100
commit5c2c05600081f811e001a81a600778de0fcab85d (patch)
treeba4e239592e9798ca3e660158c668afd7d145639 /src/mesa/drivers
parent9ac1a8d416c2bd50ca10186ca09f5e86f6fa4ce6 (diff)
Handle glFlush/glFinish through the state tracker.
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/intel_winsys/intel_context.c46
-rw-r--r--src/mesa/drivers/dri/intel_winsys/intel_pipe_i915simple.c14
-rw-r--r--src/mesa/drivers/dri/intel_winsys/intel_pipe_softpipe.c31
3 files changed, 44 insertions, 47 deletions
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_context.c b/src/mesa/drivers/dri/intel_winsys/intel_context.c
index 1032fc2d0f2..a1746e09657 100644
--- a/src/mesa/drivers/dri/intel_winsys/intel_context.c
+++ b/src/mesa/drivers/dri/intel_winsys/intel_context.c
@@ -240,51 +240,7 @@ intelFlush(GLcontext * ctx)
}
-/**
- * Check if we need to rotate/warp the front color buffer to the
- * rotated screen. We generally need to do this when we get a glFlush
- * or glFinish after drawing to the front color buffer.
- * If no rotation, just copy the private fake front buffer to the real one.
- */
-static void
-intelCheckFrontUpdate(GLcontext * ctx)
-{
- struct intel_context *intel = intel_context(ctx);
- /* rely on _ColorDrawBufferMask being kept up to date by mesa
- even for window-fbos. */
- /* not sure. Might need that for all masks including
- BUFFER_BIT_FRONT_LEFT maybe? */
- if (intel->ctx.DrawBuffer->_ColorDrawBufferMask[0] ==
- BUFFER_BIT_FRONT_LEFT) {
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
- intelCopyBuffer(dPriv, NULL);
- }
-}
-
-/**
- * Called via glFlush.
- */
-static void
-intelglFlush(GLcontext * ctx)
-{
- intelFlush(ctx);
- intelCheckFrontUpdate(ctx);
-}
-
-void
-intelFinish(GLcontext * ctx)
-{
- struct intel_context *intel = intel_context(ctx);
- intelFlush(ctx);
- if (intel->batch->last_fence) {
- driFenceFinish(intel->batch->last_fence,
- 0, GL_FALSE);
- driFenceUnReference(intel->batch->last_fence);
- intel->batch->last_fence = NULL;
- }
- intelCheckFrontUpdate(ctx);
-}
static void
@@ -292,8 +248,6 @@ intelInitDriverFunctions(struct dd_function_table *functions)
{
_mesa_init_driver_functions(functions);
- functions->Flush = intelglFlush;
- functions->Finish = intelFinish;
functions->GetString = intelGetString;
functions->UpdateState = intelInvalidateState;
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_pipe_i915simple.c b/src/mesa/drivers/dri/intel_winsys/intel_pipe_i915simple.c
index c0e8c2349ca..d78d81aa1ce 100644
--- a/src/mesa/drivers/dri/intel_winsys/intel_pipe_i915simple.c
+++ b/src/mesa/drivers/dri/intel_winsys/intel_pipe_i915simple.c
@@ -37,6 +37,7 @@
#include "intel_context.h"
#include "intel_batchbuffer.h"
#include "intel_pipe.h"
+#include "intel_blit.h"
#include "pipe/i915simple/i915_winsys.h"
@@ -171,7 +172,7 @@ static unsigned *intel_i915_batch_start( struct i915_winsys *sws,
if (intel_batchbuffer_space( intel->batch ) >= dwords * 4) {
/* XXX: Hmm, the driver can't really do much with this pointer:
*/
- return intel->batch->ptr;
+ return (unsigned *)intel->batch->ptr;
}
else
return NULL;
@@ -242,6 +243,16 @@ static void intel_i915_printf( struct i915_winsys *sws,
}
+static void
+intel_i915_flush_frontbuffer( struct i915_winsys *sws )
+{
+ struct intel_context *intel = intel_i915_winsys(sws)->intel;
+ __DRIdrawablePrivate *dPriv = intel->driDrawable;
+
+ intelCopyBuffer(dPriv, NULL);
+}
+
+
struct pipe_context *
intel_create_i915simple( struct intel_context *intel )
{
@@ -264,6 +275,7 @@ intel_create_i915simple( struct intel_context *intel )
iws->winsys.batch_reloc = intel_i915_batch_reloc;
iws->winsys.batch_flush = intel_i915_batch_flush;
iws->winsys.batch_wait_idle = intel_i915_batch_wait_idle;
+ iws->winsys.flush_frontbuffer = intel_i915_flush_frontbuffer;
iws->intel = intel;
/* Create the i915simple context:
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_pipe_softpipe.c b/src/mesa/drivers/dri/intel_winsys/intel_pipe_softpipe.c
index 06db5c9f432..439bb372e1f 100644
--- a/src/mesa/drivers/dri/intel_winsys/intel_pipe_softpipe.c
+++ b/src/mesa/drivers/dri/intel_winsys/intel_pipe_softpipe.c
@@ -36,6 +36,8 @@
#include "intel_context.h"
#include "intel_pipe.h"
+#include "intel_batchbuffer.h"
+#include "intel_blit.h"
#include "pipe/softpipe/sp_winsys.h"
#include "pipe/p_defines.h"
@@ -175,6 +177,33 @@ intel_supported_formats(struct pipe_context *pipe, GLuint *numFormats)
}
+static void intel_wait_idle( struct softpipe_winsys *sws )
+{
+ struct intel_context *intel = intel_softpipe_winsys(sws)->intel;
+
+ if (intel->batch->last_fence) {
+ driFenceFinish(intel->batch->last_fence,
+ DRM_FENCE_TYPE_EXE | DRM_I915_FENCE_TYPE_RW, GL_FALSE);
+ driFenceUnReference(intel->batch->last_fence);
+ intel->batch->last_fence = NULL;
+ }
+}
+
+
+/* The state tracker (should!) keep track of whether the fake
+ * frontbuffer has been touched by any rendering since the last time
+ * we copied its contents to the real frontbuffer. Our task is easy:
+ */
+static void
+intel_flush_frontbuffer( struct softpipe_winsys *sws )
+{
+ struct intel_context *intel = intel_softpipe_winsys(sws)->intel;
+ __DRIdrawablePrivate *dPriv = intel->driDrawable;
+
+ intelCopyBuffer(dPriv, NULL);
+}
+
+
struct pipe_context *
intel_create_softpipe( struct intel_context *intel )
@@ -197,6 +226,8 @@ intel_create_softpipe( struct intel_context *intel )
isws->sws.buffer_data = intel_buffer_data;
isws->sws.buffer_subdata = intel_buffer_subdata;
isws->sws.buffer_get_subdata = intel_buffer_get_subdata;
+ isws->sws.flush_frontbuffer = intel_flush_frontbuffer;
+ isws->sws.wait_idle = intel_wait_idle;
isws->intel = intel;
/* Create the softpipe context: