summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2007-08-10 15:31:26 +0100
committerKeith Whitwell <[email protected]>2007-08-10 15:35:48 +0100
commit47fc2c4349746997704a7f81dffadd22363e0ff1 (patch)
treeda53b452a03ad6909a1b9b95db565fa7a73a511e /src/mesa/drivers
parent12e3bb1a65bbff82dabc64110249c57a711501c1 (diff)
Lift common winsys functions into pipe's new p_winsys.
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_render.c7
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_tris.c12
-rw-r--r--src/mesa/drivers/dri/intel_winsys/Makefile5
-rw-r--r--src/mesa/drivers/dri/intel_winsys/intel_context.c2
-rw-r--r--src/mesa/drivers/dri/intel_winsys/intel_pipe_i915simple.c284
-rw-r--r--src/mesa/drivers/dri/intel_winsys/intel_winsys.h (renamed from src/mesa/drivers/dri/intel_winsys/intel_pipe.h)3
-rw-r--r--src/mesa/drivers/dri/intel_winsys/intel_winsys_i915.c144
-rw-r--r--src/mesa/drivers/dri/intel_winsys/intel_winsys_pipe.c (renamed from src/mesa/drivers/dri/intel_winsys/intel_pipe_softpipe.c)129
-rw-r--r--src/mesa/drivers/dri/intel_winsys/intel_winsys_softpipe.c79
9 files changed, 301 insertions, 364 deletions
diff --git a/src/mesa/drivers/dri/i915tex/intel_render.c b/src/mesa/drivers/dri/i915tex/intel_render.c
index c8b6d308d96..dddbe9906e1 100644
--- a/src/mesa/drivers/dri/i915tex/intel_render.c
+++ b/src/mesa/drivers/dri/i915tex/intel_render.c
@@ -129,8 +129,9 @@ do { \
((intel->batch->size - 1500) / (intel->vertex_size*4))
#define GET_CURRENT_VB_MAX_VERTS() GET_SUBSEQUENT_VB_MAX_VERTS()
-#define ALLOC_VERTS( nr ) \
- intelExtendInlinePrimitive( intel, (nr) * intel->vertex_size )
+#define ALLOC_VERTS( nr ) NULL
+
+// intelExtendInlinePrimitive( intel, (nr) * intel->vertex_size )
#define EMIT_VERTS( ctx, j, nr, buf ) \
_tnl_emit_vertices_to_buffer(ctx, j, (j)+(nr), buf )
@@ -204,6 +205,8 @@ intel_run_render(GLcontext * ctx, struct tnl_pipeline_stage *stage)
intel->vtbl.render_prevalidate( intel );
+ return GL_TRUE;
+
/* Don't handle clipping or indexed vertices.
*/
if (intel->RenderIndex != 0 ||
diff --git a/src/mesa/drivers/dri/i915tex/intel_tris.c b/src/mesa/drivers/dri/i915tex/intel_tris.c
index 5fe3d4561fc..48dae9d7208 100644
--- a/src/mesa/drivers/dri/i915tex/intel_tris.c
+++ b/src/mesa/drivers/dri/i915tex/intel_tris.c
@@ -185,6 +185,7 @@ intel_draw_quad(struct intel_context *intel,
intelVertexPtr v0,
intelVertexPtr v1, intelVertexPtr v2, intelVertexPtr v3)
{
+#ifndef NO_REND
GLuint vertsize = intel->vertex_size;
GLuint *vb = intelExtendInlinePrimitive(intel, 6 * vertsize);
int j;
@@ -207,12 +208,14 @@ intel_draw_quad(struct intel_context *intel,
COPY_DWORDS(j, vb, vertsize, v2);
COPY_DWORDS(j, vb, vertsize, v3);
+#endif
}
static void
intel_draw_triangle(struct intel_context *intel,
intelVertexPtr v0, intelVertexPtr v1, intelVertexPtr v2)
{
+#ifndef NO_REND
GLuint vertsize = intel->vertex_size;
GLuint *vb = intelExtendInlinePrimitive(intel, 3 * vertsize);
int j;
@@ -220,6 +223,7 @@ intel_draw_triangle(struct intel_context *intel,
COPY_DWORDS(j, vb, vertsize, v0);
COPY_DWORDS(j, vb, vertsize, v1);
COPY_DWORDS(j, vb, vertsize, v2);
+#endif
}
@@ -227,18 +231,21 @@ static void
intel_draw_line(struct intel_context *intel,
intelVertexPtr v0, intelVertexPtr v1)
{
+#ifndef NO_REND
GLuint vertsize = intel->vertex_size;
GLuint *vb = intelExtendInlinePrimitive(intel, 2 * vertsize);
int j;
COPY_DWORDS(j, vb, vertsize, v0);
COPY_DWORDS(j, vb, vertsize, v1);
+#endif
}
static void
intel_draw_point(struct intel_context *intel, intelVertexPtr v0)
{
+#ifndef NO_REND
GLuint vertsize = intel->vertex_size;
GLuint *vb = intelExtendInlinePrimitive(intel, vertsize);
int j;
@@ -248,6 +255,7 @@ intel_draw_point(struct intel_context *intel, intelVertexPtr v0)
*(float *) &vb[1] = v0->v.y - 0.125;
for (j = 2; j < vertsize; j++)
vb[j] = v0->ui[j];
+#endif
}
@@ -732,6 +740,7 @@ intelRenderClippedLine(GLcontext * ctx, GLuint ii, GLuint jj)
static void
intelFastRenderClippedPoly(GLcontext * ctx, const GLuint * elts, GLuint n)
{
+#ifndef NO_REND
struct intel_context *intel = intel_context(ctx);
const GLuint vertsize = intel->vertex_size;
GLuint *vb = intelExtendInlinePrimitive(intel, (n - 2) * 3 * vertsize);
@@ -744,6 +753,7 @@ intelFastRenderClippedPoly(GLcontext * ctx, const GLuint * elts, GLuint n)
COPY_DWORDS(j, vb, vertsize, V(elts[i]));
COPY_DWORDS(j, vb, vertsize, start);
}
+#endif
}
/**********************************************************************/
@@ -1069,6 +1079,7 @@ intel_meta_draw_poly(struct intel_context *intel,
GLfloat xy[][2],
GLfloat z, GLuint color, GLfloat tex[][2])
{
+#ifndef NO_REND
union fi *vb;
GLint i;
@@ -1089,6 +1100,7 @@ intel_meta_draw_poly(struct intel_context *intel,
}
INTEL_FIREVERTICES(intel);
+#endif
}
void
diff --git a/src/mesa/drivers/dri/intel_winsys/Makefile b/src/mesa/drivers/dri/intel_winsys/Makefile
index ae08afccb37..a5db6547a96 100644
--- a/src/mesa/drivers/dri/intel_winsys/Makefile
+++ b/src/mesa/drivers/dri/intel_winsys/Makefile
@@ -11,8 +11,9 @@ PIPE_DRIVERS = \
$(TOP)/src/mesa/pipe/i915simple/libi915simple.a
DRIVER_SOURCES = \
- intel_pipe_i915simple.c \
- intel_pipe_softpipe.c \
+ intel_winsys_pipe.c \
+ intel_winsys_softpipe.c \
+ intel_winsys_i915.c \
intel_batchbuffer.c \
intel_buffers.c \
intel_blit.c \
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_context.c b/src/mesa/drivers/dri/intel_winsys/intel_context.c
index a1746e09657..6d92ce7e19a 100644
--- a/src/mesa/drivers/dri/intel_winsys/intel_context.c
+++ b/src/mesa/drivers/dri/intel_winsys/intel_context.c
@@ -41,7 +41,7 @@
#include "i830_dri.h"
#include "intel_buffers.h"
-#include "intel_pipe.h"
+#include "intel_winsys.h"
#include "intel_ioctl.h"
#include "intel_batchbuffer.h"
#include "intel_blit.h"
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_pipe_i915simple.c b/src/mesa/drivers/dri/intel_winsys/intel_pipe_i915simple.c
deleted file mode 100644
index d78d81aa1ce..00000000000
--- a/src/mesa/drivers/dri/intel_winsys/intel_pipe_i915simple.c
+++ /dev/null
@@ -1,284 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND., USA
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- *
- **************************************************************************/
-/*
- * Authors: Keith Whitwell <keithw-at-tungstengraphics-dot-com>
- */
-
-#include <stdlib.h>
-#include <xf86drm.h>
-#include "dri_bufpool.h"
-#include "dri_bufmgr.h"
-
-#include "intel_context.h"
-#include "intel_batchbuffer.h"
-#include "intel_pipe.h"
-#include "intel_blit.h"
-
-#include "pipe/i915simple/i915_winsys.h"
-
-
-struct intel_i915_winsys {
- struct i915_winsys winsys;
- struct intel_context *intel;
-};
-
-
-/* Turn a i915simple winsys into an intel/i915simple winsys:
- */
-static inline struct intel_i915_winsys *
-intel_i915_winsys( struct i915_winsys *sws )
-{
- return (struct intel_i915_winsys *)sws;
-}
-
-
-
-/* Many of the winsys's are probably going to have a similar
- * buffer-manager interface, as something almost identical is
- * currently exposed in the pipe interface. Probably want to avoid
- * endless repetition of this code somehow.
- */
-static inline struct _DriBufferObject *
-dri_bo( struct pipe_buffer_handle *bo )
-{
- return (struct _DriBufferObject *)bo;
-}
-
-static inline struct pipe_buffer_handle *
-pipe_bo( struct _DriBufferObject *bo )
-{
- return (struct pipe_buffer_handle *)bo;
-}
-
-
-/* Most callbacks map direcly onto dri_bufmgr operations:
- */
-static void *intel_i915_buffer_map(struct i915_winsys *sws,
- struct pipe_buffer_handle *buf )
-{
- return driBOMap( dri_bo(buf),
- DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE, 0 );
-}
-
-static void intel_i915_buffer_unmap(struct i915_winsys *sws,
- struct pipe_buffer_handle *buf)
-{
- driBOUnmap( dri_bo(buf) );
-}
-
-
-static struct pipe_buffer_handle *
-intel_i915_buffer_reference(struct i915_winsys *sws,
- struct pipe_buffer_handle *buf)
-{
- return pipe_bo( driBOReference( dri_bo(buf) ) );
-}
-
-static void intel_i915_buffer_unreference(struct i915_winsys *sws,
- struct pipe_buffer_handle **buf)
-{
- if (*buf) {
- driBOUnReference( dri_bo(*buf) );
- *buf = NULL;
- }
-}
-
-/* Grabs the hardware lock!
- */
-static void intel_i915_buffer_data(struct i915_winsys *sws,
- struct pipe_buffer_handle *buf,
- unsigned size, const void *data )
-{
- struct intel_context *intel = intel_i915_winsys(sws)->intel;
-
- LOCK_HARDWARE( intel );
- driBOData( dri_bo(buf), size, data, 0 );
- UNLOCK_HARDWARE( intel );
-}
-
-static void intel_i915_buffer_subdata(struct i915_winsys *sws,
- struct pipe_buffer_handle *buf,
- unsigned long offset,
- unsigned long size,
- const void *data)
-{
- driBOSubData( dri_bo(buf), offset, size, data );
-}
-
-static void intel_i915_buffer_get_subdata(struct i915_winsys *sws,
- struct pipe_buffer_handle *buf,
- unsigned long offset,
- unsigned long size,
- void *data)
-{
- driBOGetSubData( dri_bo(buf), offset, size, data );
-}
-
-/* I915simple has no concept of pools. We choose the tex/region pool
- * for all buffers.
- */
-static struct pipe_buffer_handle *
-intel_i915_buffer_create(struct i915_winsys *sws,
- unsigned alignment)
-{
- struct intel_context *intel = intel_i915_winsys(sws)->intel;
- struct _DriBufferObject *buffer;
-
- LOCK_HARDWARE( intel );
- driGenBuffers( intel->intelScreen->regionPool,
- "i915simple buffer", 1, &buffer, alignment, 0, 0 );
- UNLOCK_HARDWARE( intel );
-
- return pipe_bo(buffer);
-}
-
-
-/* Simple batchbuffer interface:
- */
-
-static unsigned *intel_i915_batch_start( struct i915_winsys *sws,
- unsigned dwords,
- unsigned relocs )
-{
- struct intel_context *intel = intel_i915_winsys(sws)->intel;
-
- /* XXX: check relocs.
- */
- if (intel_batchbuffer_space( intel->batch ) >= dwords * 4) {
- /* XXX: Hmm, the driver can't really do much with this pointer:
- */
- return (unsigned *)intel->batch->ptr;
- }
- else
- return NULL;
-}
-
-static void intel_i915_batch_dword( struct i915_winsys *sws,
- unsigned dword )
-{
- struct intel_context *intel = intel_i915_winsys(sws)->intel;
- intel_batchbuffer_emit_dword( intel->batch, dword );
-}
-
-static void intel_i915_batch_reloc( struct i915_winsys *sws,
- struct pipe_buffer_handle *buf,
- unsigned access_flags,
- unsigned delta )
-{
- struct intel_context *intel = intel_i915_winsys(sws)->intel;
- unsigned flags = DRM_BO_FLAG_MEM_TT;
- unsigned mask = DRM_BO_MASK_MEM;
-
- if (access_flags & I915_BUFFER_ACCESS_WRITE) {
- flags |= DRM_BO_FLAG_WRITE;
- mask |= DRM_BO_FLAG_WRITE;
- }
-
- if (access_flags & I915_BUFFER_ACCESS_READ) {
- flags |= DRM_BO_FLAG_READ;
- mask |= DRM_BO_FLAG_READ;
- }
-
- intel_batchbuffer_emit_reloc( intel->batch,
- dri_bo( buf ),
- flags, mask,
- delta );
-}
-
-
-static void intel_i915_batch_wait_idle( struct i915_winsys *sws )
-{
- struct intel_context *intel = intel_i915_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;
- }
-}
-
-
-static void intel_i915_batch_flush( struct i915_winsys *sws )
-{
- struct intel_context *intel = intel_i915_winsys(sws)->intel;
-
- intel_batchbuffer_flush( intel->batch );
- if (0) intel_i915_batch_wait_idle( sws );
-}
-
-
-static void intel_i915_printf( struct i915_winsys *sws,
- const char *fmtString, ... )
-{
- va_list args;
- va_start( args, fmtString );
- vfprintf(stderr, fmtString, args);
- va_end( args );
-}
-
-
-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 )
-{
- struct intel_i915_winsys *iws = CALLOC_STRUCT( intel_i915_winsys );
-
- /* Fill in this struct with callbacks that i915simple will need to
- * communicate with the window system, buffer manager, etc.
- */
- iws->winsys.printf = intel_i915_printf;
- iws->winsys.buffer_create = intel_i915_buffer_create;
- iws->winsys.buffer_map = intel_i915_buffer_map;
- iws->winsys.buffer_unmap = intel_i915_buffer_unmap;
- iws->winsys.buffer_reference = intel_i915_buffer_reference;
- iws->winsys.buffer_unreference = intel_i915_buffer_unreference;
- iws->winsys.buffer_data = intel_i915_buffer_data;
- iws->winsys.buffer_subdata = intel_i915_buffer_subdata;
- iws->winsys.buffer_get_subdata = intel_i915_buffer_get_subdata;
- iws->winsys.batch_start = intel_i915_batch_start;
- iws->winsys.batch_dword = intel_i915_batch_dword;
- 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:
- */
- return i915_create( &iws->winsys, intel->intelScreen->deviceID );
-}
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_pipe.h b/src/mesa/drivers/dri/intel_winsys/intel_winsys.h
index 5d3e25aea2a..6d4a5a4df32 100644
--- a/src/mesa/drivers/dri/intel_winsys/intel_pipe.h
+++ b/src/mesa/drivers/dri/intel_winsys/intel_winsys.h
@@ -30,7 +30,10 @@
struct intel_context;
struct pipe_context;
+struct pipe_winsys;
+struct pipe_winsys *
+intel_create_pipe_winsys( struct intel_context *intel );
struct pipe_context *
intel_create_softpipe( struct intel_context *intel );
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_winsys_i915.c b/src/mesa/drivers/dri/intel_winsys/intel_winsys_i915.c
new file mode 100644
index 00000000000..51e3055cb0c
--- /dev/null
+++ b/src/mesa/drivers/dri/intel_winsys/intel_winsys_i915.c
@@ -0,0 +1,144 @@
+/**************************************************************************
+ *
+ * Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND., USA
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ *
+ **************************************************************************/
+/*
+ * Authors: Keith Whitwell <keithw-at-tungstengraphics-dot-com>
+ */
+
+#include <stdlib.h>
+#include <xf86drm.h>
+#include "dri_bufpool.h"
+#include "dri_bufmgr.h"
+
+#include "intel_context.h"
+#include "intel_batchbuffer.h"
+#include "intel_winsys.h"
+#include "intel_blit.h"
+
+#include "pipe/i915simple/i915_winsys.h"
+
+
+struct intel_i915_winsys {
+ struct i915_winsys winsys;
+ struct intel_context *intel;
+};
+
+
+/* Turn a i915simple winsys into an intel/i915simple winsys:
+ */
+static inline struct intel_i915_winsys *
+intel_i915_winsys( struct i915_winsys *sws )
+{
+ return (struct intel_i915_winsys *)sws;
+}
+
+
+/* Simple batchbuffer interface:
+ */
+
+static unsigned *intel_i915_batch_start( struct i915_winsys *sws,
+ unsigned dwords,
+ unsigned relocs )
+{
+ struct intel_context *intel = intel_i915_winsys(sws)->intel;
+
+ /* XXX: check relocs.
+ */
+ if (intel_batchbuffer_space( intel->batch ) >= dwords * 4) {
+ /* XXX: Hmm, the driver can't really do much with this pointer:
+ */
+ return (unsigned *)intel->batch->ptr;
+ }
+ else
+ return NULL;
+}
+
+static void intel_i915_batch_dword( struct i915_winsys *sws,
+ unsigned dword )
+{
+ struct intel_context *intel = intel_i915_winsys(sws)->intel;
+ intel_batchbuffer_emit_dword( intel->batch, dword );
+}
+
+static void intel_i915_batch_reloc( struct i915_winsys *sws,
+ struct pipe_buffer_handle *buf,
+ unsigned access_flags,
+ unsigned delta )
+{
+ struct intel_context *intel = intel_i915_winsys(sws)->intel;
+ unsigned flags = DRM_BO_FLAG_MEM_TT;
+ unsigned mask = DRM_BO_MASK_MEM;
+
+ if (access_flags & I915_BUFFER_ACCESS_WRITE) {
+ flags |= DRM_BO_FLAG_WRITE;
+ mask |= DRM_BO_FLAG_WRITE;
+ }
+
+ if (access_flags & I915_BUFFER_ACCESS_READ) {
+ flags |= DRM_BO_FLAG_READ;
+ mask |= DRM_BO_FLAG_READ;
+ }
+
+ intel_batchbuffer_emit_reloc( intel->batch,
+ dri_bo( buf ),
+ flags, mask,
+ delta );
+}
+
+
+
+static void intel_i915_batch_flush( struct i915_winsys *sws )
+{
+ struct intel_context *intel = intel_i915_winsys(sws)->intel;
+
+ intel_batchbuffer_flush( intel->batch );
+ if (0) intel_i915_batch_wait_idle( sws );
+}
+
+
+
+
+struct pipe_context *
+intel_create_i915simple( struct intel_context *intel )
+{
+ struct intel_i915_winsys *iws = CALLOC_STRUCT( intel_i915_winsys );
+
+ /* Fill in this struct with callbacks that i915simple will need to
+ * communicate with the window system, buffer manager, etc.
+ */
+ iws->winsys.batch_start = intel_i915_batch_start;
+ iws->winsys.batch_dword = intel_i915_batch_dword;
+ iws->winsys.batch_reloc = intel_i915_batch_reloc;
+ iws->winsys.batch_flush = intel_i915_batch_flush;
+ iws->intel = intel;
+
+ /* Create the i915simple context:
+ */
+ return i915_create( intel_create_pipe_winsys(intel),
+ &iws->winsys,
+ intel->intelScreen->deviceID );
+}
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_pipe_softpipe.c b/src/mesa/drivers/dri/intel_winsys/intel_winsys_pipe.c
index 439bb372e1f..22daac6ea43 100644
--- a/src/mesa/drivers/dri/intel_winsys/intel_pipe_softpipe.c
+++ b/src/mesa/drivers/dri/intel_winsys/intel_winsys_pipe.c
@@ -35,26 +35,23 @@
#include "dri_bufmgr.h"
#include "intel_context.h"
-#include "intel_pipe.h"
+#include "intel_winsys.h"
#include "intel_batchbuffer.h"
#include "intel_blit.h"
-#include "pipe/softpipe/sp_winsys.h"
+#include "pipe/p_winsys.h"
#include "pipe/p_defines.h"
-/* Shouldn't really need this:
- */
-#include "pipe/p_context.h"
-struct intel_softpipe_winsys {
- struct softpipe_winsys sws;
+struct intel_pipe_winsys {
+ struct pipe_winsys winsys;
struct intel_context *intel;
};
-/* Turn the softpipe opaque buffer pointer into a dri_bufmgr opaque
+/* Turn the pipe opaque buffer pointer into a dri_bufmgr opaque
* buffer pointer...
*/
static inline struct _DriBufferObject *
@@ -69,25 +66,33 @@ pipe_bo( struct _DriBufferObject *bo )
return (struct pipe_buffer_handle *)bo;
}
-/* Turn a softpipe winsys into an intel/softpipe winsys:
+/* Turn a pipe winsys into an intel/pipe winsys:
*/
-static inline struct intel_softpipe_winsys *
-intel_softpipe_winsys( struct softpipe_winsys *sws )
+static inline struct intel_pipe_winsys *
+intel_pipe_winsys( struct pipe_winsys *sws )
{
- return (struct intel_softpipe_winsys *)sws;
+ return (struct intel_pipe_winsys *)sws;
}
/* Most callbacks map direcly onto dri_bufmgr operations:
*/
-static void *intel_buffer_map(struct softpipe_winsys *sws,
- struct pipe_buffer_handle *buf )
+static void *intel_buffer_map(struct pipe_winsys *sws,
+ struct pipe_buffer_handle *buf,
+ unsigned flags )
{
- return driBOMap( dri_bo(buf),
- DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE, 0 );
+ unsigned drm_flags = 0;
+
+ if (flags & PIPE_BUFFER_FLAG_WRITE)
+ drm_flags |= DRM_BO_FLAG_WRITE;
+
+ if (flags & PIPE_BUFFER_FLAG_READ)
+ drm_flags |= DRM_BO_FLAG_READ;
+
+ return driBOMap( dri_bo(buf), drm_flags, 0 );
}
-static void intel_buffer_unmap(struct softpipe_winsys *sws,
+static void intel_buffer_unmap(struct pipe_winsys *sws,
struct pipe_buffer_handle *buf)
{
driBOUnmap( dri_bo(buf) );
@@ -95,13 +100,13 @@ static void intel_buffer_unmap(struct softpipe_winsys *sws,
static struct pipe_buffer_handle *
-intel_buffer_reference(struct softpipe_winsys *sws,
+intel_buffer_reference(struct pipe_winsys *sws,
struct pipe_buffer_handle *buf)
{
return pipe_bo( driBOReference( dri_bo(buf) ) );
}
-static void intel_buffer_unreference(struct softpipe_winsys *sws,
+static void intel_buffer_unreference(struct pipe_winsys *sws,
struct pipe_buffer_handle **buf)
{
if (*buf) {
@@ -112,18 +117,18 @@ static void intel_buffer_unreference(struct softpipe_winsys *sws,
/* Grabs the hardware lock!
*/
-static void intel_buffer_data(struct softpipe_winsys *sws,
+static void intel_buffer_data(struct pipe_winsys *sws,
struct pipe_buffer_handle *buf,
unsigned size, const void *data )
{
- struct intel_context *intel = intel_softpipe_winsys(sws)->intel;
+ struct intel_context *intel = intel_pipe_winsys(sws)->intel;
LOCK_HARDWARE( intel );
driBOData( dri_bo(buf), size, data, 0 );
UNLOCK_HARDWARE( intel );
}
-static void intel_buffer_subdata(struct softpipe_winsys *sws,
+static void intel_buffer_subdata(struct pipe_winsys *sws,
struct pipe_buffer_handle *buf,
unsigned long offset,
unsigned long size,
@@ -132,7 +137,7 @@ static void intel_buffer_subdata(struct softpipe_winsys *sws,
driBOSubData( dri_bo(buf), offset, size, data );
}
-static void intel_buffer_get_subdata(struct softpipe_winsys *sws,
+static void intel_buffer_get_subdata(struct pipe_winsys *sws,
struct pipe_buffer_handle *buf,
unsigned long offset,
unsigned long size,
@@ -141,45 +146,28 @@ static void intel_buffer_get_subdata(struct softpipe_winsys *sws,
driBOGetSubData( dri_bo(buf), offset, size, data );
}
-/* Softpipe has no concept of pools. We choose the tex/region pool
+/* Pipe has no concept of pools. We choose the tex/region pool
* for all buffers.
*/
static struct pipe_buffer_handle *
-intel_create_buffer(struct softpipe_winsys *sws,
+intel_buffer_create(struct pipe_winsys *sws,
unsigned alignment)
{
- struct intel_context *intel = intel_softpipe_winsys(sws)->intel;
+ struct intel_context *intel = intel_pipe_winsys(sws)->intel;
struct _DriBufferObject *buffer;
LOCK_HARDWARE( intel );
driGenBuffers( intel->intelScreen->regionPool,
- "softpipe buffer", 1, &buffer, alignment, 0, 0 );
+ "pipe buffer", 1, &buffer, alignment, 0, 0 );
UNLOCK_HARDWARE( intel );
return pipe_bo(buffer);
}
-/**
- * Return list of surface formats supported by this driver.
- */
-static const GLuint *
-intel_supported_formats(struct pipe_context *pipe, GLuint *numFormats)
-{
- static const GLuint formats[] = {
- PIPE_FORMAT_U_A8_R8_G8_B8,
- PIPE_FORMAT_U_R5_G6_B5,
- PIPE_FORMAT_S8_Z24,
- };
-
- *numFormats = sizeof(formats) / sizeof(formats[0]);
- return formats;
-}
-
-
-static void intel_wait_idle( struct softpipe_winsys *sws )
+static void intel_wait_idle( struct pipe_winsys *sws )
{
- struct intel_context *intel = intel_softpipe_winsys(sws)->intel;
+ struct intel_context *intel = intel_pipe_winsys(sws)->intel;
if (intel->batch->last_fence) {
driFenceFinish(intel->batch->last_fence,
@@ -195,9 +183,9 @@ static void intel_wait_idle( struct softpipe_winsys *sws )
* we copied its contents to the real frontbuffer. Our task is easy:
*/
static void
-intel_flush_frontbuffer( struct softpipe_winsys *sws )
+intel_flush_frontbuffer( struct pipe_winsys *sws )
{
- struct intel_context *intel = intel_softpipe_winsys(sws)->intel;
+ struct intel_context *intel = intel_pipe_winsys(sws)->intel;
__DRIdrawablePrivate *dPriv = intel->driDrawable;
intelCopyBuffer(dPriv, NULL);
@@ -205,38 +193,29 @@ intel_flush_frontbuffer( struct softpipe_winsys *sws )
-struct pipe_context *
-intel_create_softpipe( struct intel_context *intel )
+struct pipe_winsys *
+intel_create_pipe_winsys( struct intel_context *intel )
{
- struct intel_softpipe_winsys *isws = CALLOC_STRUCT( intel_softpipe_winsys );
- struct pipe_context *pipe;
+ struct intel_pipe_winsys *iws = CALLOC_STRUCT( intel_pipe_winsys );
- /* Fill in this struct with callbacks that softpipe will need to
+ /* Fill in this struct with callbacks that pipe will need to
* communicate with the window system, buffer manager, etc.
*
- * Softpipe would be happy with a malloc based memory manager, but
+ * Pipe would be happy with a malloc based memory manager, but
* the SwapBuffers implementation in this winsys driver requires
* that rendering be done to an appropriate _DriBufferObject.
*/
- isws->sws.create_buffer = intel_create_buffer;
- isws->sws.buffer_map = intel_buffer_map;
- isws->sws.buffer_unmap = intel_buffer_unmap;
- isws->sws.buffer_reference = intel_buffer_reference;
- isws->sws.buffer_unreference = intel_buffer_unreference;
- 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:
- */
- pipe = softpipe_create( &isws->sws );
-
- /* XXX: This should probably be a parameter to softpipe_create()
- */
- pipe->supported_formats = intel_supported_formats;
-
- return pipe;
+ iws->winsys.buffer_create = intel_buffer_create;
+ iws->winsys.buffer_map = intel_buffer_map;
+ iws->winsys.buffer_unmap = intel_buffer_unmap;
+ iws->winsys.buffer_reference = intel_buffer_reference;
+ iws->winsys.buffer_unreference = intel_buffer_unreference;
+ iws->winsys.buffer_data = intel_buffer_data;
+ iws->winsys.buffer_subdata = intel_buffer_subdata;
+ iws->winsys.buffer_get_subdata = intel_buffer_get_subdata;
+ iws->winsys.flush_frontbuffer = intel_flush_frontbuffer;
+ iws->winsys.wait_idle = intel_wait_idle;
+ iws->intel = intel;
+
+ return &iws->winsys;
}
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_winsys_softpipe.c b/src/mesa/drivers/dri/intel_winsys/intel_winsys_softpipe.c
new file mode 100644
index 00000000000..917e933641f
--- /dev/null
+++ b/src/mesa/drivers/dri/intel_winsys/intel_winsys_softpipe.c
@@ -0,0 +1,79 @@
+/**************************************************************************
+ *
+ * Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND., USA
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ *
+ **************************************************************************/
+/*
+ * Authors: Keith Whitwell <keithw-at-tungstengraphics-dot-com>
+ */
+
+#include "imports.h"
+#include "intel_context.h"
+#include "intel_winsys.h"
+#include "pipe/softpipe/sp_winsys.h"
+#include "pipe/p_defines.h"
+
+
+
+struct intel_softpipe_winsys {
+ struct softpipe_winsys sws;
+ struct intel_context *intel;
+};
+
+/**
+ * Return list of surface formats supported by this driver.
+ */
+static const unsigned *
+intel_supported_formats(struct softpipe_winsys *sws,
+ unsigned *numFormats)
+{
+ static const GLuint formats[] = {
+ PIPE_FORMAT_U_A8_R8_G8_B8,
+ PIPE_FORMAT_U_R5_G6_B5,
+ PIPE_FORMAT_S8_Z24,
+ };
+
+ *numFormats = sizeof(formats) / sizeof(formats[0]);
+ return formats;
+}
+
+
+
+struct pipe_context *
+intel_create_softpipe( struct intel_context *intel )
+{
+ struct intel_softpipe_winsys *isws = CALLOC_STRUCT( intel_softpipe_winsys );
+
+ /* Fill in this struct with callbacks that softpipe will need to
+ * communicate with the window system, buffer manager, etc.
+ */
+ isws->sws.supported_formats = intel_supported_formats;
+ isws->intel = intel;
+
+ /* Create the softpipe context:
+ */
+ return softpipe_create( intel_create_pipe_winsys( intel ),
+ &isws->sws );
+}