Adapt for winsys interface changes.

This commit is contained in:
José Fonseca 2007-12-09 18:26:26 +00:00
parent de7e51ff98
commit f8f9580a2a
7 changed files with 43 additions and 26 deletions

View file

@ -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);
}

View file

@ -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 */

View file

@ -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;

View file

@ -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,

View file

@ -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,

View file

@ -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;

View file

@ -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? */