summaryrefslogtreecommitdiff
path: root/src/gallium/winsys/xlib/xlib_brw_screen.c
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2009-01-20 12:22:49 +0000
committerJosé Fonseca <jfonseca@vmware.com>2009-01-20 12:22:49 +0000
commit5897383344da3320d158c26adae05de35480471f (patch)
tree33519f45f1309b273e4b5a92d5c06dd171b29191 /src/gallium/winsys/xlib/xlib_brw_screen.c
parentecc563b17f810399ddf74a68fca1e903ba49a0d6 (diff)
gallium: Remove the standalone surfaces.
This commit is mostly just a cosmetic change that cleans-up the interfaces, replacing pipe_winsys::surface_* calls by /** * Allocate storage for a display target surface. * * Often surfaces which are meant to be blitted to the front screen (i.e., * display targets) must be allocated with special characteristics, memory * pools, or obtained directly from the windowing system. * * This callback is invoked by the pipe_screenwhen creating a texture marked * with the PIPE_TEXTURE_USAGE_DISPLAY_TARGET flag to get the underlying * buffer storage. */ struct pipe_buffer *(*surface_buffer_create)(struct pipe_winsys *ws, unsigned width, unsigned height, enum pipe_format format, unsigned usage, unsigned *stride); Most drivers were updated but not all were tested. Use the softpipe pipe driver and the xlib winsys changes as a reference when fixing other drivers.
Diffstat (limited to 'src/gallium/winsys/xlib/xlib_brw_screen.c')
-rw-r--r--src/gallium/winsys/xlib/xlib_brw_screen.c63
1 files changed, 14 insertions, 49 deletions
diff --git a/src/gallium/winsys/xlib/xlib_brw_screen.c b/src/gallium/winsys/xlib/xlib_brw_screen.c
index 030cd66bd9..1fd7da8a2f 100644
--- a/src/gallium/winsys/xlib/xlib_brw_screen.c
+++ b/src/gallium/winsys/xlib/xlib_brw_screen.c
@@ -229,17 +229,6 @@ aub_flush_frontbuffer( struct pipe_winsys *winsys,
aub_bo(surface->buffer)->offset );
}
-static struct pipe_surface *
-aub_i915_surface_alloc(struct pipe_winsys *winsys)
-{
- struct pipe_surface *surf = CALLOC_STRUCT(pipe_surface);
- if (surf) {
- surf->refcount = 1;
- surf->winsys = winsys;
- }
- return surf;
-}
-
/**
* Round n up to next multiple.
@@ -250,50 +239,28 @@ round_up(unsigned n, unsigned multiple)
return (n + multiple - 1) & ~(multiple - 1);
}
-static int
-aub_i915_surface_alloc_storage(struct pipe_winsys *winsys,
- struct pipe_surface *surf,
+static struct pipe_buffer *
+aub_i915_surface_buffer_create(struct pipe_winsys *winsys,
unsigned width, unsigned height,
enum pipe_format format,
- unsigned flags,
- unsigned tex_usage)
+ unsigned usage,
+ unsigned *stride)
{
const unsigned alignment = 64;
+ struct pipe_format_block block;
+ unsigned nblocksx, nblocksy;
- surf->width = width;
- surf->height = height;
- surf->format = format;
- pf_get_block(format, &surf->block);
- surf->nblocksx = pf_get_nblocksx(&surf->block, width);
- surf->nblocksy = pf_get_nblocksy(&surf->block, height);
- surf->stride = round_up(surf->nblocksx * surf->block.size, alignment);
- surf->usage = flags;
-
- assert(!surf->buffer);
- surf->buffer = winsys->buffer_create(winsys, alignment,
- PIPE_BUFFER_USAGE_PIXEL,
- surf->stride * surf->nblocksy);
- if(!surf->buffer)
- return -1;
-
- return 0;
-}
+ pf_get_block(format, &block);
+ nblocksx = pf_get_nblocksx(&block, width);
+ nblocksy = pf_get_nblocksy(&block, height);
+ *stride = round_up(nblocksx * block.size, alignment);
-static void
-aub_i915_surface_release(struct pipe_winsys *winsys, struct pipe_surface **s)
-{
- struct pipe_surface *surf = *s;
- surf->refcount--;
- if (surf->refcount == 0) {
- if (surf->buffer)
- winsys_buffer_reference(winsys, &surf->buffer, NULL);
- free(surf);
- }
- *s = NULL;
+ return winsys->buffer_create(winsys, alignment,
+ usage,
+ *stride * nblocksy);
}
-
static const char *
aub_get_name( struct pipe_winsys *winsys )
{
@@ -333,9 +300,7 @@ xlib_create_brw_winsys( void )
iws->winsys.get_name = aub_get_name;
iws->winsys.destroy = xlib_brw_destroy_pipe_winsys_aub;
- iws->winsys.surface_alloc = aub_i915_surface_alloc;
- iws->winsys.surface_alloc_storage = aub_i915_surface_alloc_storage;
- iws->winsys.surface_release = aub_i915_surface_release;
+ iws->winsys.surface_buffer_create = aub_i915_surface_buffer_create;
iws->aubfile = brw_aubfile_create();
iws->size = AUB_BUF_SIZE;