((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 )
intel->vtbl.render_prevalidate( intel );
+ return GL_TRUE;
+
/* Don't handle clipping or indexed vertices.
*/
if (intel->RenderIndex != 0 ||
intelVertexPtr v0,
intelVertexPtr v1, intelVertexPtr v2, intelVertexPtr v3)
{
+#ifndef NO_REND
GLuint vertsize = intel->vertex_size;
GLuint *vb = intelExtendInlinePrimitive(intel, 6 * vertsize);
int j;
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;
COPY_DWORDS(j, vb, vertsize, v0);
COPY_DWORDS(j, vb, vertsize, v1);
COPY_DWORDS(j, vb, vertsize, v2);
+#endif
}
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;
*(float *) &vb[1] = v0->v.y - 0.125;
for (j = 2; j < vertsize; j++)
vb[j] = v0->ui[j];
+#endif
}
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);
COPY_DWORDS(j, vb, vertsize, V(elts[i]));
COPY_DWORDS(j, vb, vertsize, start);
}
+#endif
}
/**********************************************************************/
GLfloat xy[][2],
GLfloat z, GLuint color, GLfloat tex[][2])
{
+#ifndef NO_REND
union fi *vb;
GLint i;
}
INTEL_FIREVERTICES(intel);
+#endif
}
void
$(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 \
#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"
+++ /dev/null
-/**************************************************************************
- *
- * Copyright 2006 Tungsten Graphics, Inc., Cedar Park, Texas.
- * 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 above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * 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 TUNGSTEN GRAPHICS 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.
- *
- **************************************************************************/
-
-#ifndef INTEL_PIPE_H
-#define INTEL_PIPE_H
-
-struct intel_context;
-struct pipe_context;
-
-
-struct pipe_context *
-intel_create_softpipe( struct intel_context *intel );
-
-struct pipe_context *
-intel_create_i915simple( struct intel_context *intel );
-
-
-#endif
+++ /dev/null
-/**************************************************************************
- *
- * 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 );
-}
+++ /dev/null
-/**************************************************************************
- *
- * 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_pipe.h"
-#include "intel_batchbuffer.h"
-#include "intel_blit.h"
-
-#include "pipe/softpipe/sp_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_context *intel;
-};
-
-
-
-/* Turn the softpipe opaque buffer pointer into a dri_bufmgr opaque
- * buffer pointer...
- */
-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;
-}
-
-/* Turn a softpipe winsys into an intel/softpipe winsys:
- */
-static inline struct intel_softpipe_winsys *
-intel_softpipe_winsys( struct softpipe_winsys *sws )
-{
- return (struct intel_softpipe_winsys *)sws;
-}
-
-
-/* Most callbacks map direcly onto dri_bufmgr operations:
- */
-static void *intel_buffer_map(struct softpipe_winsys *sws,
- struct pipe_buffer_handle *buf )
-{
- return driBOMap( dri_bo(buf),
- DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE, 0 );
-}
-
-static void intel_buffer_unmap(struct softpipe_winsys *sws,
- struct pipe_buffer_handle *buf)
-{
- driBOUnmap( dri_bo(buf) );
-}
-
-
-static struct pipe_buffer_handle *
-intel_buffer_reference(struct softpipe_winsys *sws,
- struct pipe_buffer_handle *buf)
-{
- return pipe_bo( driBOReference( dri_bo(buf) ) );
-}
-
-static void intel_buffer_unreference(struct softpipe_winsys *sws,
- struct pipe_buffer_handle **buf)
-{
- if (*buf) {
- driBOUnReference( dri_bo(*buf) );
- *buf = NULL;
- }
-}
-
-/* Grabs the hardware lock!
- */
-static void intel_buffer_data(struct softpipe_winsys *sws,
- struct pipe_buffer_handle *buf,
- unsigned size, const void *data )
-{
- struct intel_context *intel = intel_softpipe_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,
- struct pipe_buffer_handle *buf,
- unsigned long offset,
- unsigned long size,
- const void *data)
-{
- driBOSubData( dri_bo(buf), offset, size, data );
-}
-
-static void intel_buffer_get_subdata(struct softpipe_winsys *sws,
- struct pipe_buffer_handle *buf,
- unsigned long offset,
- unsigned long size,
- void *data)
-{
- driBOGetSubData( dri_bo(buf), offset, size, data );
-}
-
-/* Softpipe 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,
- unsigned alignment)
-{
- struct intel_context *intel = intel_softpipe_winsys(sws)->intel;
- struct _DriBufferObject *buffer;
-
- LOCK_HARDWARE( intel );
- driGenBuffers( intel->intelScreen->regionPool,
- "softpipe 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 )
-{
- 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 )
-{
- struct intel_softpipe_winsys *isws = CALLOC_STRUCT( intel_softpipe_winsys );
- struct pipe_context *pipe;
-
- /* Fill in this struct with callbacks that softpipe will need to
- * communicate with the window system, buffer manager, etc.
- *
- * Softpipe 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;
-}
--- /dev/null
+/**************************************************************************
+ *
+ * Copyright 2006 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * 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 above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * 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 TUNGSTEN GRAPHICS 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.
+ *
+ **************************************************************************/
+
+#ifndef INTEL_PIPE_H
+#define INTEL_PIPE_H
+
+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 );
+
+struct pipe_context *
+intel_create_i915simple( struct intel_context *intel );
+
+
+#endif
--- /dev/null
+/**************************************************************************
+ *
+ * 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 );
+}
--- /dev/null
+/**************************************************************************
+ *
+ * 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_winsys.h"
+#include "intel_batchbuffer.h"
+#include "intel_blit.h"
+
+#include "pipe/p_winsys.h"
+#include "pipe/p_defines.h"
+
+
+
+struct intel_pipe_winsys {
+ struct pipe_winsys winsys;
+ struct intel_context *intel;
+};
+
+
+
+/* Turn the pipe opaque buffer pointer into a dri_bufmgr opaque
+ * buffer pointer...
+ */
+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;
+}
+
+/* Turn a pipe winsys into an intel/pipe winsys:
+ */
+static inline struct intel_pipe_winsys *
+intel_pipe_winsys( struct pipe_winsys *sws )
+{
+ return (struct intel_pipe_winsys *)sws;
+}
+
+
+/* Most callbacks map direcly onto dri_bufmgr operations:
+ */
+static void *intel_buffer_map(struct pipe_winsys *sws,
+ struct pipe_buffer_handle *buf,
+ unsigned flags )
+{
+ 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 pipe_winsys *sws,
+ struct pipe_buffer_handle *buf)
+{
+ driBOUnmap( dri_bo(buf) );
+}
+
+
+static struct pipe_buffer_handle *
+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 pipe_winsys *sws,
+ struct pipe_buffer_handle **buf)
+{
+ if (*buf) {
+ driBOUnReference( dri_bo(*buf) );
+ *buf = NULL;
+ }
+}
+
+/* Grabs the hardware lock!
+ */
+static void intel_buffer_data(struct pipe_winsys *sws,
+ struct pipe_buffer_handle *buf,
+ unsigned size, const void *data )
+{
+ 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 pipe_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_buffer_get_subdata(struct pipe_winsys *sws,
+ struct pipe_buffer_handle *buf,
+ unsigned long offset,
+ unsigned long size,
+ void *data)
+{
+ driBOGetSubData( dri_bo(buf), offset, size, data );
+}
+
+/* Pipe has no concept of pools. We choose the tex/region pool
+ * for all buffers.
+ */
+static struct pipe_buffer_handle *
+intel_buffer_create(struct pipe_winsys *sws,
+ unsigned alignment)
+{
+ struct intel_context *intel = intel_pipe_winsys(sws)->intel;
+ struct _DriBufferObject *buffer;
+
+ LOCK_HARDWARE( intel );
+ driGenBuffers( intel->intelScreen->regionPool,
+ "pipe buffer", 1, &buffer, alignment, 0, 0 );
+ UNLOCK_HARDWARE( intel );
+
+ return pipe_bo(buffer);
+}
+
+
+static void intel_wait_idle( struct pipe_winsys *sws )
+{
+ struct intel_context *intel = intel_pipe_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 pipe_winsys *sws )
+{
+ struct intel_context *intel = intel_pipe_winsys(sws)->intel;
+ __DRIdrawablePrivate *dPriv = intel->driDrawable;
+
+ intelCopyBuffer(dPriv, NULL);
+}
+
+
+
+struct pipe_winsys *
+intel_create_pipe_winsys( struct intel_context *intel )
+{
+ struct intel_pipe_winsys *iws = CALLOC_STRUCT( intel_pipe_winsys );
+
+ /* Fill in this struct with callbacks that pipe will need to
+ * communicate with the window system, buffer manager, etc.
+ *
+ * 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.
+ */
+ 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;
+}
--- /dev/null
+/**************************************************************************
+ *
+ * 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 );
+}
DRIVER_SOURCES = \
i915_blit.c \
- i915_buffer.c \
i915_clear.c \
i915_flush.c \
i915_context.c \
+++ /dev/null
-/**************************************************************************
- *
- * 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 "i915_context.h"
-#include "i915_winsys.h"
-
-
-
-/* Most callbacks map direcly onto winsys operations at the moment,
- * but this may change, especially as state_trackers and winsys's
- * evolve in separate directions... Don't try and remove this yet.
- */
-static struct pipe_buffer_handle *
-i915_buffer_create(struct pipe_context *pipe,
- unsigned alignment,
- unsigned flags)
-{
- struct i915_context *i915 = i915_context( pipe );
- return i915->winsys->buffer_create( i915->winsys, alignment );
-}
-
-static void *i915_buffer_map(struct pipe_context *pipe,
- struct pipe_buffer_handle *buf,
- unsigned flags )
-{
- struct i915_context *i915 = i915_context( pipe );
- return i915->winsys->buffer_map( i915->winsys, buf );
-}
-
-static void i915_buffer_unmap(struct pipe_context *pipe,
- struct pipe_buffer_handle *buf)
-{
- struct i915_context *i915 = i915_context( pipe );
- i915->winsys->buffer_unmap( i915->winsys, buf );
-}
-
-static struct pipe_buffer_handle *
-i915_buffer_reference(struct pipe_context *pipe,
- struct pipe_buffer_handle *buf)
-{
- struct i915_context *i915 = i915_context( pipe );
- return i915->winsys->buffer_reference( i915->winsys, buf );
-}
-
-static void i915_buffer_unreference(struct pipe_context *pipe,
- struct pipe_buffer_handle **buf)
-{
- struct i915_context *i915 = i915_context( pipe );
- i915->winsys->buffer_unreference( i915->winsys, buf );
-}
-
-static void i915_buffer_data(struct pipe_context *pipe,
- struct pipe_buffer_handle *buf,
- unsigned size, const void *data )
-{
- struct i915_context *i915 = i915_context( pipe );
- i915->winsys->buffer_data( i915->winsys, buf, size, data );
-}
-
-static void i915_buffer_subdata(struct pipe_context *pipe,
- struct pipe_buffer_handle *buf,
- unsigned long offset,
- unsigned long size,
- const void *data)
-{
- struct i915_context *i915 = i915_context( pipe );
- i915->winsys->buffer_subdata( i915->winsys, buf, offset, size, data );
-}
-
-static void i915_buffer_get_subdata(struct pipe_context *pipe,
- struct pipe_buffer_handle *buf,
- unsigned long offset,
- unsigned long size,
- void *data)
-{
- struct i915_context *i915 = i915_context( pipe );
- i915->winsys->buffer_get_subdata( i915->winsys, buf, offset, size, data );
-}
-
-
-void
-i915_init_buffer_functions( struct i915_context *i915 )
-{
- i915->pipe.create_buffer = i915_buffer_create;
- i915->pipe.buffer_map = i915_buffer_map;
- i915->pipe.buffer_unmap = i915_buffer_unmap;
- i915->pipe.buffer_reference = i915_buffer_reference;
- i915->pipe.buffer_unreference = i915_buffer_unreference;
- i915->pipe.buffer_data = i915_buffer_data;
- i915->pipe.buffer_subdata = i915_buffer_subdata;
- i915->pipe.buffer_get_subdata = i915_buffer_get_subdata;
-}
#include "i915_context.h"
#include "i915_winsys.h"
#include "i915_state.h"
+#include "i915_batch.h"
#include "i915_tex_layout.h"
#include "pipe/draw/draw_context.h"
#include "pipe/p_defines.h"
+#include "pipe/p_winsys.h"
#define PCI_CHIP_I915_G 0x2582
#define PCI_CHIP_I915_GM 0x2592
-struct pipe_context *i915_create( struct i915_winsys *winsys,
+struct pipe_context *i915_create( struct pipe_winsys *pipe_winsys,
+ struct i915_winsys *i915_winsys,
unsigned pci_id )
{
struct i915_context *i915;
break;
default:
- winsys->printf(winsys, "%s: unknown pci id 0x%x, cannot create context\n",
- __FUNCTION__, pci_id);
+ pipe_winsys->printf(pipe_winsys,
+ "%s: unknown pci id 0x%x, cannot create context\n",
+ __FUNCTION__, pci_id);
return NULL;
}
if (i915 == NULL)
return NULL;
+ i915->winsys = i915_winsys;
+ i915->pipe.winsys = pipe_winsys;
+
i915->pipe.destroy = i915_destroy;
i915->pipe.supported_formats = i915_supported_formats;
i915->pipe.draw_vb = i915_draw_vb;
i915->pipe.reset_occlusion_counter = NULL; /* no support */
i915->pipe.get_occlusion_counter = NULL;
- i915->winsys = winsys;
/*
* Create drawing context and plug our rendering stage into it.
assert(i915->draw);
draw_set_setup_stage(i915->draw, i915_draw_render_stage(i915));
- i915_init_buffer_functions(i915);
i915_init_region_functions(i915);
i915_init_surface_functions(i915);
i915_init_state_functions(i915);
/* Batch stream debugging is a bit hacked up at the moment:
*/
- i915->batch_start = winsys->batch_start( winsys, 0, 0 );
+ i915->batch_start = BEGIN_BATCH(0, 0);
/*
* XXX we could plug GL selection/feedback into the drawing pipeline
/***********************************************************************
- * i915_buffer.c:
+ * i915_region.c:
*/
-void i915_init_buffer_functions( struct i915_context *i915 );
void i915_init_region_functions( struct i915_context *i915 );
void i915_init_surface_functions( struct i915_context *i915 );
void i915_init_state_functions( struct i915_context *i915 );
stream.offset = 0;
stream.ptr = (char *)start;
stream.print_addresses = 0;
- stream.winsys = i915->winsys;
+ stream.winsys = i915->pipe.winsys;
while (!done &&
stream.offset < bytes &&
char *ptr; /* pointer to gtt offset zero */
char *end; /* pointer to gtt offset zero */
unsigned print_addresses;
- struct i915_winsys *winsys;
+ struct pipe_winsys *winsys;
};
#define DEBUG_WINSYS 0x4000
#ifdef DEBUG
-#include "i915_winsys.h"
-#define DBG( i915, ... ) \
- if ((i915)->debug & FILE_DEBUG_FLAG) (i915)->winsys->printf( (i915)->winsys, __VA_ARGS__ )
+#include "pipe/p_winsys.h"
+#define DBG( i915, ... ) do { \
+ if ((i915)->debug & FILE_DEBUG_FLAG) \
+ (i915)->pipe.winsys->printf( (i915)->pipe.winsys, __VA_ARGS__ ); \
+} while(0)
#else
#define DBG( i915, ... ) \
(void)i915
#include "i915_reg.h"
#include "i915_debug.h"
-#include "i915_winsys.h"
+#include "pipe/p_winsys.h"
//#include "i915_fpc.h"
#include "shader/program.h"
#include "shader/prog_instruction.h"
FLUSH_BATCH();
}
-static void i915_wait_idle(struct pipe_context *pipe)
-{
- struct i915_context *i915 = i915_context(pipe);
-
- i915->winsys->batch_wait_idle( i915->winsys );
-}
void i915_init_flush_functions( struct i915_context *i915 )
{
i915->pipe.flush = i915_flush;
- i915->pipe.wait_idle = i915_wait_idle;
}
*/
#include "pipe/p_defines.h"
+#include "pipe/p_winsys.h"
#include "i915_context.h"
-#include "i915_winsys.h"
#include "i915_blit.h"
struct i915_context *i915 = i915_context( pipe );
if (!region->map_refcount++) {
- region->map = i915->winsys->buffer_map( i915->winsys,
- region->buffer );
+ region->map = i915->pipe.winsys->buffer_map( i915->pipe.winsys,
+ region->buffer,
+ PIPE_BUFFER_FLAG_WRITE |
+ PIPE_BUFFER_FLAG_READ);
}
return region->map;
struct i915_context *i915 = i915_context( pipe );
if (!--region->map_refcount) {
- i915->winsys->buffer_unmap( i915->winsys,
- region->buffer );
+ i915->pipe.winsys->buffer_unmap( i915->pipe.winsys,
+ region->buffer );
region->map = NULL;
}
}
region->height = height; /* needed? */
region->refcount = 1;
- region->buffer = i915->winsys->buffer_create( i915->winsys, alignment );
+ region->buffer = i915->pipe.winsys->buffer_create( i915->pipe.winsys, alignment );
- i915->winsys->buffer_data( i915->winsys,
- region->buffer,
- pitch * cpp * height,
- NULL );
+ i915->pipe.winsys->buffer_data( i915->pipe.winsys,
+ region->buffer,
+ pitch * cpp * height,
+ NULL );
return region;
}
if ((*region)->refcount == 0) {
assert((*region)->map_refcount == 0);
- i915->winsys->buffer_unreference( i915->winsys,
- (*region)->buffer );
+ i915->pipe.winsys->buffer_unreference( i915->pipe.winsys,
+ (*region)->buffer );
free(*region);
}
*region = NULL;
static void i915_set_framebuffer_state(struct pipe_context *pipe,
- const struct pipe_framebuffer_state *fb)
+ const struct pipe_framebuffer_state *fb)
{
struct i915_context *i915 = i915_context(pipe);
*/
struct pipe_buffer_handle;
+struct pipe_winsys;
struct i915_winsys {
- /* Do any special operations to ensure frontbuffer contents are
- * displayed, eg copy fake frontbuffer.
- */
- void (*flush_frontbuffer)( struct i915_winsys *sws );
-
-
- /* debug output
- */
- void (*printf)( struct i915_winsys *sws,
- const char *, ... );
-
- /* 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.
- */
- struct pipe_buffer_handle *(*buffer_create)(struct i915_winsys *sws,
- unsigned alignment );
-
- void *(*buffer_map)( struct i915_winsys *sws,
- struct pipe_buffer_handle *buf );
-
- void (*buffer_unmap)( struct i915_winsys *sws,
- struct pipe_buffer_handle *buf );
-
- struct pipe_buffer_handle *(*buffer_reference)( struct i915_winsys *sws,
- struct pipe_buffer_handle *buf );
-
- void (*buffer_unreference)( struct i915_winsys *sws,
- struct pipe_buffer_handle **buf );
-
- void (*buffer_data)(struct i915_winsys *sws,
- struct pipe_buffer_handle *buf,
- unsigned size, const void *data );
-
- void (*buffer_subdata)(struct i915_winsys *sws,
- struct pipe_buffer_handle *buf,
- unsigned long offset,
- unsigned long size,
- const void *data);
-
- void (*buffer_get_subdata)(struct i915_winsys *sws,
- struct pipe_buffer_handle *buf,
- unsigned long offset,
- unsigned long size,
- void *data);
-
-
/* An over-simple batchbuffer mechanism. Will want to improve the
* performance of this, perhaps based on the cmdstream stuff. It
* would be pretty impossible to implement swz on top of this
unsigned access_flags,
unsigned delta );
void (*batch_flush)( struct i915_winsys *sws );
- void (*batch_wait_idle)( struct i915_winsys *sws );
-
- /* Printf???
- */
- void (*dpf)( const char *fmt, ... );
-
};
#define I915_BUFFER_ACCESS_WRITE 0x1
#define I915_BUFFER_ACCESS_READ 0x2
-struct pipe_context *i915_create( struct i915_winsys *,
+struct pipe_context *i915_create( struct pipe_winsys *,
+ struct i915_winsys *,
unsigned pci_id );
* state setting functions, plus VBO drawing entrypoint.
*/
struct pipe_context {
-
+ struct pipe_winsys *winsys;
+
void (*destroy)( struct pipe_context * );
/*
GLuint value);
- /* Buffer management functions need to be exposed as well. A pipe
- * buffer may be used as a texture, render target or vertex/index
- * buffer, or some combination according to flags.
- */
-
- struct pipe_buffer_handle *(*create_buffer)(struct pipe_context *pipe,
- unsigned alignment,
- unsigned flags );
-
- void *(*buffer_map)( struct pipe_context *pipe,
- struct pipe_buffer_handle *buf,
- unsigned flags );
-
- void (*buffer_unmap)( struct pipe_context *pipe,
- struct pipe_buffer_handle *buf );
-
- struct pipe_buffer_handle *(*buffer_reference)( struct pipe_context *pipe,
- struct pipe_buffer_handle *buf );
-
- void (*buffer_unreference)( struct pipe_context *pipe,
- struct pipe_buffer_handle **buf );
-
- void (*buffer_data)(struct pipe_context *pipe,
- struct pipe_buffer_handle *buf,
- unsigned size, const void *data );
-
- void (*buffer_subdata)(struct pipe_context *pipe,
- struct pipe_buffer_handle *buf,
- unsigned long offset,
- unsigned long size,
- const void *data);
-
- void (*buffer_get_subdata)(struct pipe_context *pipe,
- struct pipe_buffer_handle *buf,
- unsigned long offset,
- unsigned long size,
- void *data);
-
/*
* Texture functions
*/
struct pipe_mipmap_tree *mt );
- /* Simple flush/finish support:
+ /* Flush rendering:
*/
void (*flush)( struct pipe_context *pipe,
unsigned flags );
-
- void (*wait_idle)( struct pipe_context *pipe );
-
- void (*flush_frontbuffer)( struct pipe_context *pipe );
};
--- /dev/null
+/**************************************************************************
+ *
+ * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * 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 above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * 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 TUNGSTEN GRAPHICS 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.
+ *
+ **************************************************************************/
+
+#ifndef P_WINSYS_H
+#define P_WINSYS_H
+
+#include "main/mtypes.h"
+
+/* This is the interface that softpipe requires any window system
+ * hosting it to implement. This is the only include file in softpipe
+ * which is public.
+ */
+
+
+/* Pipe drivers are (meant to be!) independent of both GL and the
+ * window system. The window system provides a buffer manager and a
+ * set of additional hooks for things like command buffer submission,
+ * etc.
+ *
+ * There clearly has to be some agreement between the window system
+ * driver and the hardware driver about the format of command buffers,
+ * etc.
+ */
+
+struct pipe_buffer_handle;
+
+struct pipe_winsys {
+
+ /* Do any special operations to ensure frontbuffer contents are
+ * displayed, eg copy fake frontbuffer.
+ */
+ void (*flush_frontbuffer)( struct pipe_winsys *sws );
+
+ /* debug output
+ */
+ void (*printf)( struct pipe_winsys *sws,
+ const char *, ... );
+
+
+ /* The buffer manager is modeled after the dri_bugmgr interface,
+ * but this is the subset that softpipe cares about. Remember that
+ * softpipe gets to choose the interface it needs, and the window
+ * systems must then implement that interface (rather than the
+ * other way around...).
+ *
+ * Softpipe only really wants to make system memory allocations,
+ * right??
+ */
+ struct pipe_buffer_handle *(*buffer_create)(struct pipe_winsys *sws,
+ unsigned alignment );
+
+ void *(*buffer_map)( struct pipe_winsys *sws,
+ struct pipe_buffer_handle *buf,
+ unsigned flags );
+
+ void (*buffer_unmap)( struct pipe_winsys *sws,
+ struct pipe_buffer_handle *buf );
+
+ struct pipe_buffer_handle *(*buffer_reference)( struct pipe_winsys *sws,
+ struct pipe_buffer_handle *buf );
+
+ void (*buffer_unreference)( struct pipe_winsys *sws,
+ struct pipe_buffer_handle **buf );
+
+ void (*buffer_data)(struct pipe_winsys *sws,
+ struct pipe_buffer_handle *buf,
+ unsigned size, const void *data );
+
+ void (*buffer_subdata)(struct pipe_winsys *sws,
+ struct pipe_buffer_handle *buf,
+ unsigned long offset,
+ unsigned long size,
+ const void *data);
+
+ void (*buffer_get_subdata)(struct pipe_winsys *sws,
+ struct pipe_buffer_handle *buf,
+ unsigned long offset,
+ unsigned long size,
+ void *data);
+
+
+ /* Wait for any hw swapbuffers, etc. to finish:
+ */
+ void (*wait_idle)( struct pipe_winsys *sws );
+
+};
+
+
+
+#endif /* SP_WINSYS_H */
LIBNAME = softpipe
DRIVER_SOURCES = \
- sp_buffer.c \
sp_clear.c \
sp_flush.c \
sp_context.c \
+++ /dev/null
-/**************************************************************************
- *
- * 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 "sp_context.h"
-#include "sp_winsys.h"
-#include "sp_buffer.h"
-
-
-
-/* Most callbacks map direcly onto winsys operations:
- */
-static struct pipe_buffer_handle *
-sp_create_buffer(struct pipe_context *pipe,
- unsigned alignment,
- unsigned flags)
-{
- struct softpipe_context *sp = softpipe_context( pipe );
- return sp->winsys->create_buffer( sp->winsys, alignment );
-}
-
-static void *sp_buffer_map(struct pipe_context *pipe,
- struct pipe_buffer_handle *buf,
- unsigned flags )
-{
- struct softpipe_context *sp = softpipe_context( pipe );
- return sp->winsys->buffer_map( sp->winsys, buf );
-}
-
-static void sp_buffer_unmap(struct pipe_context *pipe,
- struct pipe_buffer_handle *buf)
-{
- struct softpipe_context *sp = softpipe_context( pipe );
- sp->winsys->buffer_unmap( sp->winsys, buf );
-}
-
-static struct pipe_buffer_handle *
-sp_buffer_reference(struct pipe_context *pipe,
- struct pipe_buffer_handle *buf)
-{
- struct softpipe_context *sp = softpipe_context( pipe );
- return sp->winsys->buffer_reference( sp->winsys, buf );
-}
-
-static void sp_buffer_unreference(struct pipe_context *pipe,
- struct pipe_buffer_handle **buf)
-{
- struct softpipe_context *sp = softpipe_context( pipe );
- sp->winsys->buffer_unreference( sp->winsys, buf );
-}
-
-static void sp_buffer_data(struct pipe_context *pipe,
- struct pipe_buffer_handle *buf,
- unsigned size, const void *data )
-{
- struct softpipe_context *sp = softpipe_context( pipe );
- sp->winsys->buffer_data( sp->winsys, buf, size, data );
-}
-
-static void sp_buffer_subdata(struct pipe_context *pipe,
- struct pipe_buffer_handle *buf,
- unsigned long offset,
- unsigned long size,
- const void *data)
-{
- struct softpipe_context *sp = softpipe_context( pipe );
- sp->winsys->buffer_subdata( sp->winsys, buf, offset, size, data );
-}
-
-static void sp_buffer_get_subdata(struct pipe_context *pipe,
- struct pipe_buffer_handle *buf,
- unsigned long offset,
- unsigned long size,
- void *data)
-{
- struct softpipe_context *sp = softpipe_context( pipe );
- sp->winsys->buffer_get_subdata( sp->winsys, buf, offset, size, data );
-}
-
-
-void
-sp_init_buffer_functions( struct softpipe_context *sp )
-{
- sp->pipe.create_buffer = sp_create_buffer;
- sp->pipe.buffer_map = sp_buffer_map;
- sp->pipe.buffer_unmap = sp_buffer_unmap;
- sp->pipe.buffer_reference = sp_buffer_reference;
- sp->pipe.buffer_unreference = sp_buffer_unreference;
- sp->pipe.buffer_data = sp_buffer_data;
- sp->pipe.buffer_subdata = sp_buffer_subdata;
- sp->pipe.buffer_get_subdata = sp_buffer_get_subdata;
-}
+++ /dev/null
-/**************************************************************************
- *
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
- * 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 above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * 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 TUNGSTEN GRAPHICS 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.
- *
- **************************************************************************/
-
-
-#ifndef SP_BUFFER_H
-#define SP_BUFFER_H
-
-
-struct softpipe_context;
-
-
-extern void
-sp_init_buffer_functions(struct softpipe_context *sp);
-
-
-#endif /* SP_BUFFER_H */
#include "main/macros.h"
#include "pipe/draw/draw_context.h"
#include "pipe/p_defines.h"
-#include "sp_buffer.h"
#include "sp_clear.h"
#include "sp_context.h"
#include "sp_flush.h"
}
-struct pipe_context *softpipe_create( struct softpipe_winsys *sws )
+struct pipe_context *softpipe_create( struct pipe_winsys *pipe_winsys,
+ struct softpipe_winsys *softpipe_winsys )
{
struct softpipe_context *softpipe = CALLOC_STRUCT(softpipe_context);
+ softpipe->pipe.winsys = pipe_winsys;
softpipe->pipe.destroy = softpipe_destroy;
softpipe->pipe.supported_formats = softpipe_supported_formats;
softpipe->pipe.draw_vertices = softpipe_draw_vertices;
softpipe->pipe.clear = softpipe_clear;
softpipe->pipe.flush = softpipe_flush;
- softpipe->pipe.wait_idle = softpipe_wait_idle;
softpipe->pipe.reset_occlusion_counter = softpipe_reset_occlusion_counter;
softpipe->pipe.get_occlusion_counter = softpipe_get_occlusion_counter;
softpipe->quad.colormask = sp_quad_colormask_stage(softpipe);
softpipe->quad.output = sp_quad_output_stage(softpipe);
- softpipe->winsys = sws;
+ softpipe->winsys = softpipe_winsys;
/*
* Create drawing context and plug our rendering stage into it.
assert(softpipe->draw);
draw_set_setup_stage(softpipe->draw, sp_draw_render_stage(softpipe));
- sp_init_buffer_functions(softpipe);
sp_init_region_functions(softpipe);
sp_init_surface_functions(softpipe);
*/
}
-void
-softpipe_wait_idle(struct pipe_context *pipe)
-{
- /* Nothing to do.
- * XXX: What about swapbuffers.
- * XXX: Even more so - what about fake frontbuffer copies??
- */
- struct softpipe_context *softpipe = softpipe_context(pipe);
- softpipe->winsys->wait_idle( softpipe->winsys );
-}
-
-
-void
-softpipe_flush_frontbuffer( struct pipe_context *pipe )
-{
- struct softpipe_context *softpipe = softpipe_context(pipe);
-
- softpipe->winsys->flush_frontbuffer( softpipe->winsys );
-}
struct pipe_context;
void softpipe_flush(struct pipe_context *pipe, unsigned flags );
-void softpipe_wait_idle(struct pipe_context *pipe);
#endif
*/
#include "sp_context.h"
-#include "sp_winsys.h"
#include "sp_region.h"
+#include "pipe/p_winsys.h"
+#include "pipe/p_defines.h"
/**
struct softpipe_context *sp = softpipe_context( pipe );
if (!region->map_refcount++) {
- region->map = sp->winsys->buffer_map( sp->winsys,
- region->buffer );
+ region->map = sp->pipe.winsys->buffer_map( sp->pipe.winsys,
+ region->buffer,
+ PIPE_BUFFER_FLAG_WRITE |
+ PIPE_BUFFER_FLAG_READ);
}
return region->map;
struct softpipe_context *sp = softpipe_context( pipe );
if (!--region->map_refcount) {
- sp->winsys->buffer_unmap( sp->winsys,
+ sp->pipe.winsys->buffer_unmap( sp->pipe.winsys,
region->buffer );
region->map = NULL;
}
region->height = height;
region->refcount = 1;
- region->buffer = sp->winsys->create_buffer( sp->winsys, alignment );
+ region->buffer = sp->pipe.winsys->buffer_create( sp->pipe.winsys, alignment );
/* NULL data --> just allocate the space */
- sp->winsys->buffer_data( sp->winsys,
- region->buffer,
- region->pitch * cpp * height,
- NULL );
+ sp->pipe.winsys->buffer_data( sp->pipe.winsys,
+ region->buffer,
+ region->pitch * cpp * height,
+ NULL );
return region;
}
if ((*region)->refcount == 0) {
assert((*region)->map_refcount == 0);
- sp->winsys->buffer_unreference( sp->winsys,
+ sp->pipe.winsys->buffer_unreference( sp->pipe.winsys,
(*region)->buffer );
free(*region);
}
#ifndef SP_WINSYS_H
#define SP_WINSYS_H
-#include "main/mtypes.h"
/* This is the interface that softpipe requires any window system
* hosting it to implement. This is the only include file in softpipe
* which is public.
*/
-
-/* Pipe drivers are (meant to be!) independent of both GL and the
- * window system. The window system provides a buffer manager and a
- * set of additional hooks for things like command buffer submission,
- * etc.
- *
- * There clearly has to be some agreement between the window system
- * driver and the hardware driver about the format of command buffers,
- * etc.
- */
-
-struct pipe_buffer_handle;
-
struct softpipe_winsys {
+ const unsigned *(*supported_formats)(struct softpipe_winsys *sws,
+ unsigned *numFormats);
- /* Do any special operations to ensure frontbuffer contents are
- * displayed, eg copy fake frontbuffer.
- */
- void (*flush_frontbuffer)( struct softpipe_winsys *sws );
-
- /* Wait for any hw swapbuffers, etc. to finish:
- */
- void (*wait_idle)( struct softpipe_winsys *sws );
-
- /* debug output
- */
- void (*printf)( struct softpipe_winsys *sws,
- const char *, ... );
-
-
- /* The buffer manager is modeled after the dri_bugmgr interface,
- * but this is the subset that softpipe cares about. Remember that
- * softpipe gets to choose the interface it needs, and the window
- * systems must then implement that interface (rather than the
- * other way around...).
- *
- * Softpipe only really wants to make system memory allocations,
- * right??
- */
- struct pipe_buffer_handle *(*create_buffer)(struct softpipe_winsys *sws,
- unsigned alignment );
-
- void *(*buffer_map)( struct softpipe_winsys *sws,
- struct pipe_buffer_handle *buf );
-
- void (*buffer_unmap)( struct softpipe_winsys *sws,
- struct pipe_buffer_handle *buf );
-
- struct pipe_buffer_handle *(*buffer_reference)( struct softpipe_winsys *sws,
- struct pipe_buffer_handle *buf );
-
- void (*buffer_unreference)( struct softpipe_winsys *sws,
- struct pipe_buffer_handle **buf );
-
- void (*buffer_data)(struct softpipe_winsys *sws,
- struct pipe_buffer_handle *buf,
- unsigned size, const void *data );
-
- void (*buffer_subdata)(struct softpipe_winsys *sws,
- struct pipe_buffer_handle *buf,
- unsigned long offset,
- unsigned long size,
- const void *data);
-
- void (*buffer_get_subdata)(struct softpipe_winsys *sws,
- struct pipe_buffer_handle *buf,
- unsigned long offset,
- unsigned long size,
- void *data);
};
+struct pipe_winsys;
+struct pipe_context;
+
-struct pipe_context *softpipe_create( struct softpipe_winsys * );
+struct pipe_context *softpipe_create( struct pipe_winsys *,
+ struct softpipe_winsys * );
#endif /* SP_WINSYS_H */
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
+#include "pipe/p_winsys.h"
_mesa_initialize_buffer_object(&st_obj->Base, name, target);
- st_obj->buffer = st->pipe->create_buffer( st->pipe, 32, 0 );
+ st_obj->buffer = st->pipe->winsys->buffer_create( st->pipe->winsys, 32 );
return &st_obj->Base;
}
struct st_buffer_object *st_obj = st_buffer_object(obj);
if (st_obj->buffer)
- pipe->buffer_unreference(pipe, &st_obj->buffer);
+ pipe->winsys->buffer_unreference(pipe->winsys, &st_obj->buffer);
free(st_obj);
}
st_obj->Base.Size = size;
st_obj->Base.Usage = usage;
- pipe->buffer_data( pipe, st_obj->buffer, size, data );
+ pipe->winsys->buffer_data( pipe->winsys, st_obj->buffer, size, data );
}
struct pipe_context *pipe = st_context(ctx)->pipe;
struct st_buffer_object *st_obj = st_buffer_object(obj);
- pipe->buffer_subdata(pipe, st_obj->buffer, offset, size, data);
+ pipe->winsys->buffer_subdata(pipe->winsys, st_obj->buffer, offset, size, data);
}
struct pipe_context *pipe = st_context(ctx)->pipe;
struct st_buffer_object *st_obj = st_buffer_object(obj);
- pipe->buffer_get_subdata(pipe, st_obj->buffer, offset, size, data);
+ pipe->winsys->buffer_get_subdata(pipe->winsys, st_obj->buffer, offset, size, data);
}
break;
}
- obj->Pointer = pipe->buffer_map(pipe, st_obj->buffer, flags);
+ obj->Pointer = pipe->winsys->buffer_map(pipe->winsys, st_obj->buffer, flags);
return obj->Pointer;
}
struct pipe_context *pipe = st_context(ctx)->pipe;
struct st_buffer_object *st_obj = st_buffer_object(obj);
- pipe->buffer_unmap(pipe, st_obj->buffer);
+ pipe->winsys->buffer_unmap(pipe->winsys, st_obj->buffer);
obj->Pointer = NULL;
return GL_TRUE;
}
#include "st_cb_flush.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
+#include "pipe/p_winsys.h"
static void st_flush(GLcontext *ctx)
if (st->flags.frontbuffer_dirty) {
/* Hook for copying "fake" frontbuffer if necessary:
*/
- st->pipe->flush_frontbuffer( st->pipe );
+ st->pipe->winsys->flush_frontbuffer( st->pipe->winsys );
st->flags.frontbuffer_dirty = 0;
}
}
struct st_context *st = ctx->st;
st_flush( ctx );
- st->pipe->wait_idle( st->pipe );
+ st->pipe->winsys->wait_idle( st->pipe->winsys );
}
**************************************************************************/
-#ifndef ST_CB_CLEAR_H
-#define ST_CB_CLEAR_H
+#ifndef ST_CB_FLUSH_H
+#define ST_CB_FLUSH_H
extern void
st_init_flush_functions(struct dd_function_table *functions);
-#endif /* ST_CB_CLEAR_H */
+#endif /* ST_CB_FLUSH_H */