summaryrefslogtreecommitdiffstats
path: root/src/mesa/pipe/xlib
diff options
context:
space:
mode:
authorMichel Dänzer <[email protected]>2007-11-28 19:04:54 +0100
committerMichel Dänzer <[email protected]>2007-11-29 16:41:39 +0100
commit11a80160fd60d1eb1541b49128c659526a5d8ac8 (patch)
tree410bbe6407d37e9ca3af884f89e03104926624ad /src/mesa/pipe/xlib
parent7043db677f457ae9a46f2585a5ef52bf69a4e8ea (diff)
Move dimensions from struct pipe_region to struct pipe_surface.
Diffstat (limited to 'src/mesa/pipe/xlib')
-rw-r--r--src/mesa/pipe/xlib/xm_buffer.c5
-rw-r--r--src/mesa/pipe/xlib/xm_surface.c2
-rw-r--r--src/mesa/pipe/xlib/xm_winsys.c22
3 files changed, 16 insertions, 13 deletions
diff --git a/src/mesa/pipe/xlib/xm_buffer.c b/src/mesa/pipe/xlib/xm_buffer.c
index 7dc85bf2ebe..71a2003e6df 100644
--- a/src/mesa/pipe/xlib/xm_buffer.c
+++ b/src/mesa/pipe/xlib/xm_buffer.c
@@ -260,9 +260,8 @@ finish_surface_init(GLcontext *ctx, struct xmesa_renderbuffer *xrb)
{
struct pipe_context *pipe = ctx->st->pipe;
if (!xrb->St.surface->region) {
- int w = 1, h = 1;
- xrb->St.surface->region = pipe->winsys->region_alloc(pipe->winsys,
- 1, w, h, 0x0);
+ xrb->St.surface->region = pipe->winsys->region_alloc(pipe->winsys, 1,
+ 0x0);
}
}
diff --git a/src/mesa/pipe/xlib/xm_surface.c b/src/mesa/pipe/xlib/xm_surface.c
index 43e50507476..23945630959 100644
--- a/src/mesa/pipe/xlib/xm_surface.c
+++ b/src/mesa/pipe/xlib/xm_surface.c
@@ -624,7 +624,7 @@ xmesa_new_color_surface(struct pipe_winsys *winsys, GLuint pipeFormat)
* The region's size will get set in the xmesa_alloc_front/back_storage()
* functions.
*/
- xms->surface.region = winsys->region_alloc(winsys, 1, 1, 1, 0x0);
+ xms->surface.region = winsys->region_alloc(winsys, 1, 0x0);
return &xms->surface;
}
diff --git a/src/mesa/pipe/xlib/xm_winsys.c b/src/mesa/pipe/xlib/xm_winsys.c
index b842cf766e3..99816a811d6 100644
--- a/src/mesa/pipe/xlib/xm_winsys.c
+++ b/src/mesa/pipe/xlib/xm_winsys.c
@@ -220,27 +220,30 @@ round_up(unsigned n, unsigned multiple)
}
+static unsigned
+xm_surface_pitch(struct pipe_winsys *winsys, unsigned cpp, unsigned width,
+ unsigned flags)
+{
+ return round_up(width, 64 / cpp);
+}
+
+
static struct pipe_region *
-xm_region_alloc(struct pipe_winsys *winsys,
- unsigned cpp, unsigned width, unsigned height, unsigned flags)
+xm_region_alloc(struct pipe_winsys *winsys, unsigned size, unsigned flags)
{
struct pipe_region *region = CALLOC_STRUCT(pipe_region);
const unsigned alignment = 64;
- region->cpp = cpp;
- region->pitch = round_up(width, alignment / cpp);
- region->height = height;
region->refcount = 1;
- assert(region->pitch > 0);
+ assert(size > 0);
- region->buffer = winsys->buffer_create( winsys, alignment )
-;
+ region->buffer = winsys->buffer_create( winsys, alignment );
/* NULL data --> just allocate the space */
winsys->buffer_data( winsys,
region->buffer,
- region->pitch * cpp * height,
+ size,
NULL,
PIPE_BUFFER_USAGE_PIXEL );
return region;
@@ -335,6 +338,7 @@ xmesa_get_pipe_winsys(void)
ws->region_alloc = xm_region_alloc;
ws->region_release = xm_region_release;
+ ws->surface_pitch = xm_surface_pitch;
ws->surface_alloc = xm_surface_alloc;
ws->surface_release = xm_surface_release;