From f8f9580a2a1c89af1dc0e169b62440053d9d7e81 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Sun, 9 Dec 2007 18:26:26 +0000 Subject: [PATCH] Adapt for winsys interface changes. --- .../dri/intel_winsys/intel_winsys_pipe.c | 38 +++++++++++-------- src/mesa/drivers/x11/xm_winsys.c | 7 +++- src/mesa/pipe/draw/draw_vertex_fetch.c | 1 - src/mesa/pipe/i915simple/i915_texture.c | 3 +- src/mesa/pipe/softpipe/sp_texture.c | 4 +- src/mesa/pipe/xlib/xm_winsys.c | 14 +++++-- src/mesa/state_tracker/st_cb_fbo.c | 2 +- 7 files changed, 43 insertions(+), 26 deletions(-) diff --git a/src/mesa/drivers/dri/intel_winsys/intel_winsys_pipe.c b/src/mesa/drivers/dri/intel_winsys/intel_winsys_pipe.c index 1799e9b901b..86ea86a58fc 100644 --- a/src/mesa/drivers/dri/intel_winsys/intel_winsys_pipe.c +++ b/src/mesa/drivers/dri/intel_winsys/intel_winsys_pipe.c @@ -105,42 +105,48 @@ intel_buffer_reference(struct pipe_winsys *winsys, /* Grabs the hardware lock! */ -static void intel_buffer_data(struct pipe_winsys *winsys, - struct pipe_buffer_handle *buf, - unsigned size, const void *data, - unsigned usage ) +static int intel_buffer_data(struct pipe_winsys *winsys, + struct pipe_buffer_handle *buf, + unsigned size, const void *data, + unsigned usage ) { driBOData( dri_bo(buf), size, data, 0 ); + return 0; } -static void intel_buffer_subdata(struct pipe_winsys *winsys, - struct pipe_buffer_handle *buf, - unsigned long offset, - unsigned long size, - const void *data) +static int intel_buffer_subdata(struct pipe_winsys *winsys, + struct pipe_buffer_handle *buf, + unsigned long offset, + unsigned long size, + const void *data) { driBOSubData( dri_bo(buf), offset, size, data ); + return 0; } -static void intel_buffer_get_subdata(struct pipe_winsys *winsys, - struct pipe_buffer_handle *buf, - unsigned long offset, - unsigned long size, - void *data) +static int intel_buffer_get_subdata(struct pipe_winsys *winsys, + struct pipe_buffer_handle *buf, + unsigned long offset, + unsigned long size, + void *data) { driBOGetSubData( dri_bo(buf), offset, size, data ); + return 0; } /* 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 *winsys, unsigned flags) +intel_buffer_create(struct pipe_winsys *winsys, + unsigned alignment, + unsigned flags, + unsigned hint ) { struct _DriBufferObject *buffer; struct intel_pipe_winsys *iws = intel_pipe_winsys(winsys); driGenBuffers( iws->regionPool, - "pipe buffer", 1, &buffer, 64, 0, 0 ); + "pipe buffer", 1, &buffer, alignment, flags, hint ); return pipe_bo(buffer); } diff --git a/src/mesa/drivers/x11/xm_winsys.c b/src/mesa/drivers/x11/xm_winsys.c index f863cdbc151..dafbe96a1ec 100644 --- a/src/mesa/drivers/x11/xm_winsys.c +++ b/src/mesa/drivers/x11/xm_winsys.c @@ -210,7 +210,10 @@ xm_get_name(struct pipe_winsys *pws) static struct pipe_buffer_handle * -xm_buffer_create(struct pipe_winsys *pws, unsigned alignment) +xm_buffer_create(struct pipe_winsys *pws, + unsigned alignment, + unsigned flags, + unsigned hint) { struct xm_buffer *buffer = CALLOC_STRUCT(xm_buffer); buffer->refcount = 1; @@ -258,7 +261,7 @@ xm_region_alloc(struct pipe_winsys *winsys, assert(region->pitch > 0); - region->buffer = winsys->buffer_create( winsys, alignment ) + region->buffer = winsys->buffer_create( winsys, alignment, 0, 0 ) ; /* NULL data --> just allocate the space */ diff --git a/src/mesa/pipe/draw/draw_vertex_fetch.c b/src/mesa/pipe/draw/draw_vertex_fetch.c index b51cff59f54..7d983ebd299 100644 --- a/src/mesa/pipe/draw/draw_vertex_fetch.c +++ b/src/mesa/pipe/draw/draw_vertex_fetch.c @@ -80,7 +80,6 @@ fetch_attrib4(const void *ptr, enum pipe_format format, float attrib[4]) break; case PIPE_FORMAT_A8R8G8B8_UNORM: - case PIPE_FORMAT_U_A8_R8_G8_B8: case PIPE_FORMAT_R8G8B8A8_UNORM: attrib[0] = (float) ((unsigned char *) ptr)[2] / 255.0f; attrib[1] = (float) ((unsigned char *) ptr)[1] / 255.0f; diff --git a/src/mesa/pipe/i915simple/i915_texture.c b/src/mesa/pipe/i915simple/i915_texture.c index 1ca2815dfb9..59e8db8a951 100644 --- a/src/mesa/pipe/i915simple/i915_texture.c +++ b/src/mesa/pipe/i915simple/i915_texture.c @@ -496,7 +496,8 @@ i915_texture_create(struct pipe_context *pipe, struct pipe_texture **pt) if (i915->flags.is_i945 ? i945_miptree_layout(pipe, tex) : i915_miptree_layout(pipe, tex)) { tex->buffer = pipe->winsys->buffer_create(pipe->winsys, - PIPE_SURFACE_FLAG_TEXTURE); + PIPE_SURFACE_FLAG_TEXTURE, + 0, 0); if (tex->buffer) pipe->winsys->buffer_data(pipe->winsys, tex->buffer, diff --git a/src/mesa/pipe/softpipe/sp_texture.c b/src/mesa/pipe/softpipe/sp_texture.c index 2288c343bf1..cfe96281845 100644 --- a/src/mesa/pipe/softpipe/sp_texture.c +++ b/src/mesa/pipe/softpipe/sp_texture.c @@ -382,7 +382,9 @@ softpipe_texture_create(struct pipe_context *pipe, struct pipe_texture **pt) if (softpipe_mipmap_tree_layout(pipe, spt)) { spt->buffer = pipe->winsys->buffer_create(pipe->winsys, - PIPE_SURFACE_FLAG_TEXTURE); + 32, + PIPE_SURFACE_FLAG_TEXTURE, + 0); if (spt->buffer) { pipe->winsys->buffer_data(pipe->winsys, spt->buffer, diff --git a/src/mesa/pipe/xlib/xm_winsys.c b/src/mesa/pipe/xlib/xm_winsys.c index 976884ad520..c347d1c2a31 100644 --- a/src/mesa/pipe/xlib/xm_winsys.c +++ b/src/mesa/pipe/xlib/xm_winsys.c @@ -155,7 +155,7 @@ xm_buffer_reference(struct pipe_winsys *pws, } } -static void +static int xm_buffer_data(struct pipe_winsys *pws, struct pipe_buffer_handle *buf, unsigned size, const void *data, unsigned usage ) { @@ -169,9 +169,10 @@ xm_buffer_data(struct pipe_winsys *pws, struct pipe_buffer_handle *buf, } if (data) memcpy(xm_buf->data, data, size); + return 0; } -static void +static int xm_buffer_subdata(struct pipe_winsys *pws, struct pipe_buffer_handle *buf, unsigned long offset, unsigned long size, const void *data) { @@ -180,9 +181,10 @@ xm_buffer_subdata(struct pipe_winsys *pws, struct pipe_buffer_handle *buf, assert(!xm_buf->userBuffer); assert(b); memcpy(b + offset, data, size); + return 0; } -static void +static int xm_buffer_get_subdata(struct pipe_winsys *pws, struct pipe_buffer_handle *buf, unsigned long offset, unsigned long size, void *data) { @@ -191,6 +193,7 @@ xm_buffer_get_subdata(struct pipe_winsys *pws, struct pipe_buffer_handle *buf, assert(!xm_buf->userBuffer); assert(b); memcpy(data, b + offset, size); + return 0; } @@ -255,7 +258,10 @@ xm_get_name(struct pipe_winsys *pws) static struct pipe_buffer_handle * -xm_buffer_create(struct pipe_winsys *pws, unsigned flags) +xm_buffer_create(struct pipe_winsys *pws, + unsigned alignment, + unsigned flags, + unsigned hints) { struct xm_buffer *buffer = CALLOC_STRUCT(xm_buffer); buffer->refcount = 1; diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index cbda56b5c3d..10396c3feb9 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -118,7 +118,7 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb, pipe->winsys->buffer_reference(pipe->winsys, &strb->surface->buffer, NULL); - strb->surface->buffer = pipe->winsys->buffer_create(pipe->winsys, flags); + strb->surface->buffer = pipe->winsys->buffer_create(pipe->winsys, 32, flags, 0); if (!strb->surface->buffer) return GL_FALSE; /* out of memory, try s/w buffer? */ -- 2.30.2