diff options
author | Keith Whitwell <[email protected]> | 2007-08-10 15:31:26 +0100 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2007-08-10 15:35:48 +0100 |
commit | 47fc2c4349746997704a7f81dffadd22363e0ff1 (patch) | |
tree | da53b452a03ad6909a1b9b95db565fa7a73a511e /src/mesa | |
parent | 12e3bb1a65bbff82dabc64110249c57a711501c1 (diff) |
Lift common winsys functions into pipe's new p_winsys.
Diffstat (limited to 'src/mesa')
33 files changed, 494 insertions, 896 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 ); +} diff --git a/src/mesa/pipe/i915simple/Makefile b/src/mesa/pipe/i915simple/Makefile index 5b919e3bed6..28fe70d0693 100644 --- a/src/mesa/pipe/i915simple/Makefile +++ b/src/mesa/pipe/i915simple/Makefile @@ -6,7 +6,6 @@ LIBNAME = i915simple DRIVER_SOURCES = \ i915_blit.c \ - i915_buffer.c \ i915_clear.c \ i915_flush.c \ i915_context.c \ diff --git a/src/mesa/pipe/i915simple/i915_buffer.c b/src/mesa/pipe/i915simple/i915_buffer.c deleted file mode 100644 index 680213182b4..00000000000 --- a/src/mesa/pipe/i915simple/i915_buffer.c +++ /dev/null @@ -1,121 +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 "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; -} diff --git a/src/mesa/pipe/i915simple/i915_context.c b/src/mesa/pipe/i915simple/i915_context.c index d8e54f02ee8..ee6cfe2ed48 100644 --- a/src/mesa/pipe/i915simple/i915_context.c +++ b/src/mesa/pipe/i915simple/i915_context.c @@ -29,10 +29,12 @@ #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 @@ -152,7 +154,8 @@ i915_draw_vertices(struct pipe_context *pipe, -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; @@ -175,8 +178,9 @@ struct pipe_context *i915_create( struct i915_winsys *winsys, 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; } @@ -184,6 +188,9 @@ struct pipe_context *i915_create( struct i915_winsys *winsys, 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; @@ -192,7 +199,6 @@ struct pipe_context *i915_create( struct i915_winsys *winsys, 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. @@ -201,7 +207,6 @@ struct pipe_context *i915_create( struct i915_winsys *winsys, 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); @@ -219,7 +224,7 @@ struct pipe_context *i915_create( struct i915_winsys *winsys, /* 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 diff --git a/src/mesa/pipe/i915simple/i915_context.h b/src/mesa/pipe/i915simple/i915_context.h index e8db2b7c363..7a73a8d8d07 100644 --- a/src/mesa/pipe/i915simple/i915_context.h +++ b/src/mesa/pipe/i915simple/i915_context.h @@ -182,9 +182,8 @@ void i915_clear(struct pipe_context *pipe, struct pipe_surface *ps, /*********************************************************************** - * 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 ); diff --git a/src/mesa/pipe/i915simple/i915_debug.c b/src/mesa/pipe/i915simple/i915_debug.c index 0ea6f03e494..8050eb0bf5d 100644 --- a/src/mesa/pipe/i915simple/i915_debug.c +++ b/src/mesa/pipe/i915simple/i915_debug.c @@ -423,7 +423,7 @@ i915_dump_batchbuffer( 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 && diff --git a/src/mesa/pipe/i915simple/i915_debug.h b/src/mesa/pipe/i915simple/i915_debug.h index f0f72780d3e..0ea131171ef 100644 --- a/src/mesa/pipe/i915simple/i915_debug.h +++ b/src/mesa/pipe/i915simple/i915_debug.h @@ -39,7 +39,7 @@ struct debug_stream 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; }; @@ -68,9 +68,11 @@ void i915_print_ureg(const char *msg, unsigned ureg); #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 diff --git a/src/mesa/pipe/i915simple/i915_debug_fp.c b/src/mesa/pipe/i915simple/i915_debug_fp.c index 95476d3c559..d99c609d483 100644 --- a/src/mesa/pipe/i915simple/i915_debug_fp.c +++ b/src/mesa/pipe/i915simple/i915_debug_fp.c @@ -29,7 +29,7 @@ #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" diff --git a/src/mesa/pipe/i915simple/i915_flush.c b/src/mesa/pipe/i915simple/i915_flush.c index 8af4ce770cf..9a31342cbd3 100644 --- a/src/mesa/pipe/i915simple/i915_flush.c +++ b/src/mesa/pipe/i915simple/i915_flush.c @@ -66,16 +66,9 @@ static void i915_flush( struct pipe_context *pipe, 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; } diff --git a/src/mesa/pipe/i915simple/i915_regions.c b/src/mesa/pipe/i915simple/i915_regions.c index 886b0895061..9b7cddb58dc 100644 --- a/src/mesa/pipe/i915simple/i915_regions.c +++ b/src/mesa/pipe/i915simple/i915_regions.c @@ -32,8 +32,8 @@ */ #include "pipe/p_defines.h" +#include "pipe/p_winsys.h" #include "i915_context.h" -#include "i915_winsys.h" #include "i915_blit.h" @@ -50,8 +50,10 @@ i915_region_map(struct pipe_context *pipe, struct pipe_region *region) 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; @@ -63,8 +65,8 @@ i915_region_unmap(struct pipe_context *pipe, struct pipe_region *region) 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; } } @@ -97,12 +99,12 @@ i915_region_alloc(struct pipe_context *pipe, 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; } @@ -121,8 +123,8 @@ i915_region_release(struct pipe_context *pipe, struct pipe_region **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; diff --git a/src/mesa/pipe/i915simple/i915_state.c b/src/mesa/pipe/i915simple/i915_state.c index ab00cbc822f..22a5bf68b4c 100644 --- a/src/mesa/pipe/i915simple/i915_state.c +++ b/src/mesa/pipe/i915simple/i915_state.c @@ -148,7 +148,7 @@ static void i915_set_texture_state(struct pipe_context *pipe, 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); diff --git a/src/mesa/pipe/i915simple/i915_winsys.h b/src/mesa/pipe/i915simple/i915_winsys.h index a3dadbfd3d6..803ee9073c2 100644 --- a/src/mesa/pipe/i915simple/i915_winsys.h +++ b/src/mesa/pipe/i915simple/i915_winsys.h @@ -47,57 +47,10 @@ */ 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 @@ -116,20 +69,15 @@ struct i915_winsys { 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 ); diff --git a/src/mesa/pipe/p_context.h b/src/mesa/pipe/p_context.h index 533840c5557..89d9b36af7a 100644 --- a/src/mesa/pipe/p_context.h +++ b/src/mesa/pipe/p_context.h @@ -42,7 +42,8 @@ struct vertex_buffer; * state setting functions, plus VBO drawing entrypoint. */ struct pipe_context { - + struct pipe_winsys *winsys; + void (*destroy)( struct pipe_context * ); /* @@ -175,44 +176,6 @@ 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 */ @@ -220,14 +183,10 @@ struct pipe_context { 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 ); }; diff --git a/src/mesa/pipe/p_winsys.h b/src/mesa/pipe/p_winsys.h new file mode 100644 index 00000000000..c455ebdbbee --- /dev/null +++ b/src/mesa/pipe/p_winsys.h @@ -0,0 +1,114 @@ +/************************************************************************** + * + * 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 */ diff --git a/src/mesa/pipe/softpipe/Makefile b/src/mesa/pipe/softpipe/Makefile index ac83da451d1..615c612e9c7 100644 --- a/src/mesa/pipe/softpipe/Makefile +++ b/src/mesa/pipe/softpipe/Makefile @@ -5,7 +5,6 @@ include $(TOP)/configs/current LIBNAME = softpipe DRIVER_SOURCES = \ - sp_buffer.c \ sp_clear.c \ sp_flush.c \ sp_context.c \ diff --git a/src/mesa/pipe/softpipe/sp_buffer.c b/src/mesa/pipe/softpipe/sp_buffer.c deleted file mode 100644 index 27443421a30..00000000000 --- a/src/mesa/pipe/softpipe/sp_buffer.c +++ /dev/null @@ -1,120 +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 "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; -} diff --git a/src/mesa/pipe/softpipe/sp_buffer.h b/src/mesa/pipe/softpipe/sp_buffer.h deleted file mode 100644 index 9805c5142ad..00000000000 --- a/src/mesa/pipe/softpipe/sp_buffer.h +++ /dev/null @@ -1,40 +0,0 @@ -/************************************************************************** - * - * 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 */ diff --git a/src/mesa/pipe/softpipe/sp_context.c b/src/mesa/pipe/softpipe/sp_context.c index db572f169d8..91b8ae50865 100644 --- a/src/mesa/pipe/softpipe/sp_context.c +++ b/src/mesa/pipe/softpipe/sp_context.c @@ -33,7 +33,6 @@ #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" @@ -194,10 +193,12 @@ static GLuint softpipe_get_occlusion_counter(struct pipe_context *pipe) } -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; @@ -221,7 +222,6 @@ struct pipe_context *softpipe_create( struct softpipe_winsys *sws ) 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; @@ -240,7 +240,7 @@ struct pipe_context *softpipe_create( struct softpipe_winsys *sws ) 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. @@ -249,7 +249,6 @@ struct pipe_context *softpipe_create( struct softpipe_winsys *sws ) 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); diff --git a/src/mesa/pipe/softpipe/sp_flush.c b/src/mesa/pipe/softpipe/sp_flush.c index a0bce200ed9..cdf4a53c837 100644 --- a/src/mesa/pipe/softpipe/sp_flush.c +++ b/src/mesa/pipe/softpipe/sp_flush.c @@ -49,22 +49,3 @@ softpipe_flush( struct pipe_context *pipe, */ } -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 ); -} diff --git a/src/mesa/pipe/softpipe/sp_flush.h b/src/mesa/pipe/softpipe/sp_flush.h index 03c00106230..34ec617866b 100644 --- a/src/mesa/pipe/softpipe/sp_flush.h +++ b/src/mesa/pipe/softpipe/sp_flush.h @@ -31,6 +31,5 @@ struct pipe_context; void softpipe_flush(struct pipe_context *pipe, unsigned flags ); -void softpipe_wait_idle(struct pipe_context *pipe); #endif diff --git a/src/mesa/pipe/softpipe/sp_region.c b/src/mesa/pipe/softpipe/sp_region.c index 142d121047b..115f3ab8260 100644 --- a/src/mesa/pipe/softpipe/sp_region.c +++ b/src/mesa/pipe/softpipe/sp_region.c @@ -32,8 +32,9 @@ */ #include "sp_context.h" -#include "sp_winsys.h" #include "sp_region.h" +#include "pipe/p_winsys.h" +#include "pipe/p_defines.h" /** @@ -59,8 +60,10 @@ sp_region_map(struct pipe_context *pipe, struct pipe_region *region) 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; @@ -72,7 +75,7 @@ sp_region_unmap(struct pipe_context *pipe, struct pipe_region *region) 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; } @@ -91,13 +94,13 @@ sp_region_alloc(struct pipe_context *pipe, 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; } @@ -115,7 +118,7 @@ sp_region_release(struct pipe_context *pipe, struct pipe_region **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); } diff --git a/src/mesa/pipe/softpipe/sp_winsys.h b/src/mesa/pipe/softpipe/sp_winsys.h index 73b06590671..726e4c8bb6b 100644 --- a/src/mesa/pipe/softpipe/sp_winsys.h +++ b/src/mesa/pipe/softpipe/sp_winsys.h @@ -28,86 +28,24 @@ #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 */ diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c index 9e407de34f6..f1dc4fbaf49 100644 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -35,6 +35,7 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" +#include "pipe/p_winsys.h" @@ -62,7 +63,7 @@ st_bufferobj_alloc(GLcontext *ctx, GLuint name, GLenum target) _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; } @@ -80,7 +81,7 @@ st_bufferobj_free(GLcontext *ctx, struct gl_buffer_object *obj) 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); } @@ -107,7 +108,7 @@ st_bufferobj_data(GLcontext *ctx, 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 ); } @@ -127,7 +128,7 @@ st_bufferobj_subdata(GLcontext *ctx, 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); } @@ -144,7 +145,7 @@ st_bufferobj_get_subdata(GLcontext *ctx, 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); } @@ -173,7 +174,7 @@ st_bufferobj_map(GLcontext *ctx, GLenum target, GLenum access, 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; } @@ -187,7 +188,7 @@ st_bufferobj_unmap(GLcontext *ctx, GLenum target, struct gl_buffer_object *obj) 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; } diff --git a/src/mesa/state_tracker/st_cb_flush.c b/src/mesa/state_tracker/st_cb_flush.c index a6a8f8d90f3..41f21c361cd 100644 --- a/src/mesa/state_tracker/st_cb_flush.c +++ b/src/mesa/state_tracker/st_cb_flush.c @@ -37,6 +37,7 @@ #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) @@ -60,7 +61,7 @@ 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; } } @@ -70,7 +71,7 @@ static void st_finish(GLcontext *ctx) struct st_context *st = ctx->st; st_flush( ctx ); - st->pipe->wait_idle( st->pipe ); + st->pipe->winsys->wait_idle( st->pipe->winsys ); } diff --git a/src/mesa/state_tracker/st_cb_flush.h b/src/mesa/state_tracker/st_cb_flush.h index 29ceab3a560..c26f7792259 100644 --- a/src/mesa/state_tracker/st_cb_flush.h +++ b/src/mesa/state_tracker/st_cb_flush.h @@ -26,13 +26,13 @@ **************************************************************************/ -#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 */ |