summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/i915simple/i915_texture.c1
-rw-r--r--src/gallium/drivers/i965simple/brw_tex_layout.c7
-rw-r--r--src/gallium/drivers/nv04/nv04_miptree.c6
-rw-r--r--src/gallium/drivers/nv10/nv10_miptree.c4
-rw-r--r--src/gallium/drivers/nv20/nv20_miptree.c1
-rw-r--r--src/gallium/drivers/nv30/nv30_miptree.c1
-rw-r--r--src/gallium/drivers/nv40/nv40_miptree.c1
-rw-r--r--src/gallium/drivers/nv50/nv50_miptree.c15
-rw-r--r--src/gallium/drivers/softpipe/sp_texture.c43
-rw-r--r--src/gallium/drivers/softpipe/sp_texture.h2
-rw-r--r--src/gallium/drivers/trace/tr_texture.c1
-rw-r--r--src/gallium/drivers/trace/tr_winsys.c81
12 files changed, 42 insertions, 121 deletions
diff --git a/src/gallium/drivers/i915simple/i915_texture.c b/src/gallium/drivers/i915simple/i915_texture.c
index 2f5459af67f..af823f2d3c5 100644
--- a/src/gallium/drivers/i915simple/i915_texture.c
+++ b/src/gallium/drivers/i915simple/i915_texture.c
@@ -683,7 +683,6 @@ i915_get_tex_surface(struct pipe_screen *screen,
ps = CALLOC_STRUCT(pipe_surface);
if (ps) {
ps->refcount = 1;
- ps->winsys = ws;
pipe_texture_reference(&ps->texture, pt);
pipe_buffer_reference(screen, &ps->buffer, tex->buffer);
ps->format = pt->format;
diff --git a/src/gallium/drivers/i965simple/brw_tex_layout.c b/src/gallium/drivers/i965simple/brw_tex_layout.c
index cc0c665e021..12e2e02cfdc 100644
--- a/src/gallium/drivers/i965simple/brw_tex_layout.c
+++ b/src/gallium/drivers/i965simple/brw_tex_layout.c
@@ -365,10 +365,10 @@ brw_get_tex_surface_screen(struct pipe_screen *screen,
assert(zslice == 0);
}
- ps = ws->surface_alloc(ws);
+ ps = CALLOC_STRUCT(pipe_surface);
if (ps) {
- assert(ps->format);
- assert(ps->refcount);
+ ps->refcount = 1;
+ pipe_texture_reference(&ps->texture, pt);
winsys_buffer_reference(ws, &ps->buffer, tex->buffer);
ps->format = pt->format;
ps->width = pt->width[level];
@@ -378,6 +378,7 @@ brw_get_tex_surface_screen(struct pipe_screen *screen,
ps->nblocksy = pt->nblocksy[level];
ps->stride = tex->stride;
ps->offset = offset;
+ ps->status = PIPE_SURFACE_STATUS_DEFINED;
}
return ps;
}
diff --git a/src/gallium/drivers/nv04/nv04_miptree.c b/src/gallium/drivers/nv04/nv04_miptree.c
index 0cbb91e187b..094c38256b4 100644
--- a/src/gallium/drivers/nv04/nv04_miptree.c
+++ b/src/gallium/drivers/nv04/nv04_miptree.c
@@ -96,13 +96,12 @@ nv04_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
struct nv04_miptree *nv04mt = (struct nv04_miptree *)pt;
struct pipe_surface *ps;
- ps = ws->surface_alloc(ws);
+ ps = CALLOC_STRUCT(pipe_surface);
if (!ps)
return NULL;
+ pipe_texture_reference(&ps->texture, pt);
pipe_buffer_reference(pscreen, &ps->buffer, nv04mt->buffer);
ps->format = pt->format;
- ps->width = pt->width[level];
- ps->height = pt->height[level];
ps->block = pt->block;
ps->width = pt->width[level];
ps->height = pt->height[level];
@@ -110,7 +109,6 @@ nv04_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
ps->nblocksy = pt->nblocksy[level];
ps->stride = nv04mt->level[level].pitch;
ps->refcount = 1;
- ps->winsys = pscreen->winsys;
if (pt->target == PIPE_TEXTURE_CUBE) {
ps->offset = nv04mt->level[level].image_offset[face];
diff --git a/src/gallium/drivers/nv10/nv10_miptree.c b/src/gallium/drivers/nv10/nv10_miptree.c
index 943f9e21e98..f8c021261bc 100644
--- a/src/gallium/drivers/nv10/nv10_miptree.c
+++ b/src/gallium/drivers/nv10/nv10_miptree.c
@@ -110,9 +110,10 @@ nv10_miptree_surface_get(struct pipe_screen *screen, struct pipe_texture *pt,
struct nv10_miptree *nv10mt = (struct nv10_miptree *)pt;
struct pipe_surface *ps;
- ps = ws->surface_alloc(ws);
+ ps = CALLOC_STRUCT(pipe_surface);
if (!ps)
return NULL;
+ pipe_texture_reference(&ps->texture, pt);
pipe_buffer_reference(screen, &ps->buffer, nv10mt->buffer);
ps->format = pt->format;
ps->width = pt->width[level];
@@ -122,7 +123,6 @@ nv10_miptree_surface_get(struct pipe_screen *screen, struct pipe_texture *pt,
ps->nblocksy = pt->nblocksy[level];
ps->stride = nv10mt->level[level].pitch;
ps->refcount = 1;
- ps->winsys = screen->winsys;
if (pt->target == PIPE_TEXTURE_CUBE) {
ps->offset = nv10mt->level[level].image_offset[face];
diff --git a/src/gallium/drivers/nv20/nv20_miptree.c b/src/gallium/drivers/nv20/nv20_miptree.c
index c6106d58c43..d2038c391d6 100644
--- a/src/gallium/drivers/nv20/nv20_miptree.c
+++ b/src/gallium/drivers/nv20/nv20_miptree.c
@@ -117,7 +117,6 @@ nv20_miptree_surface_get(struct pipe_screen *screen, struct pipe_texture *pt,
ps->usage = flags;
ps->status = PIPE_SURFACE_STATUS_DEFINED;
ps->refcount = 1;
- ps->winsys = screen->winsys;
if (pt->target == PIPE_TEXTURE_CUBE) {
ps->offset = nv20mt->level[level].image_offset[face];
diff --git a/src/gallium/drivers/nv30/nv30_miptree.c b/src/gallium/drivers/nv30/nv30_miptree.c
index 37d297cc0f4..54fb3585f8a 100644
--- a/src/gallium/drivers/nv30/nv30_miptree.c
+++ b/src/gallium/drivers/nv30/nv30_miptree.c
@@ -154,7 +154,6 @@ nv30_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
ps->usage = flags;
ps->status = PIPE_SURFACE_STATUS_DEFINED;
ps->refcount = 1;
- ps->winsys = pscreen->winsys;
ps->face = face;
ps->level = level;
ps->zslice = zslice;
diff --git a/src/gallium/drivers/nv40/nv40_miptree.c b/src/gallium/drivers/nv40/nv40_miptree.c
index 00ce6be985a..ba912ddcbbf 100644
--- a/src/gallium/drivers/nv40/nv40_miptree.c
+++ b/src/gallium/drivers/nv40/nv40_miptree.c
@@ -155,7 +155,6 @@ nv40_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
ps->usage = flags;
ps->status = PIPE_SURFACE_STATUS_DEFINED;
ps->refcount = 1;
- ps->winsys = pscreen->winsys;
ps->face = face;
ps->level = level;
ps->zslice = zslice;
diff --git a/src/gallium/drivers/nv50/nv50_miptree.c b/src/gallium/drivers/nv50/nv50_miptree.c
index 63a23d06b89..7770fcc3f2a 100644
--- a/src/gallium/drivers/nv50/nv50_miptree.c
+++ b/src/gallium/drivers/nv50/nv50_miptree.c
@@ -217,7 +217,6 @@ nv50_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
{
struct nv50_miptree *mt = nv50_miptree(pt);
struct nv50_miptree_level *lvl = &mt->level[level];
- struct nv50_surface *s;
struct pipe_surface *ps;
int img;
@@ -229,13 +228,11 @@ nv50_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
else
img = 0;
- s = CALLOC_STRUCT(nv50_surface);
- if (!s)
+ ps = CALLOC_STRUCT(pipe_surface);
+ if (!ps)
return NULL;
- ps = &s->base;
-
- ps->refcount = 1;
- ps->winsys = pscreen->winsys;
+ pipe_texture_reference(&ps->texture, pt);
+ pipe_buffer_reference(pscreen, &ps->buffer, mt->buffer);
ps->format = pt->format;
ps->width = pt->width[level];
ps->height = pt->height[level];
@@ -245,6 +242,10 @@ nv50_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
ps->stride = ps->width * ps->block.size;
ps->usage = flags;
ps->status = PIPE_SURFACE_STATUS_DEFINED;
+ ps->refcount = 1;
+ ps->face = face;
+ ps->level = level;
+ ps->zslice = zslice;
if (flags & PIPE_BUFFER_USAGE_CPU_READ_WRITE) {
assert(!(flags & PIPE_BUFFER_USAGE_GPU_READ_WRITE));
diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c
index a64dc89f432..faf9e871f93 100644
--- a/src/gallium/drivers/softpipe/sp_texture.c
+++ b/src/gallium/drivers/softpipe/sp_texture.c
@@ -94,49 +94,23 @@ softpipe_texture_layout(struct pipe_screen *screen,
return spt->buffer != NULL;
}
-/* Hack it up to use the old winsys->surface_alloc_storage()
- * method for now:
- */
static boolean
softpipe_displaytarget_layout(struct pipe_screen *screen,
struct softpipe_texture * spt)
{
struct pipe_winsys *ws = screen->winsys;
- struct pipe_surface surf;
- unsigned flags = (PIPE_BUFFER_USAGE_CPU_READ |
- PIPE_BUFFER_USAGE_CPU_WRITE |
- PIPE_BUFFER_USAGE_GPU_READ |
- PIPE_BUFFER_USAGE_GPU_WRITE);
- int ret;
-
-
- memset(&surf, 0, sizeof(surf));
-
- ret =ws->surface_alloc_storage( ws,
- &surf,
- spt->base.width[0],
- spt->base.height[0],
- spt->base.format,
- flags,
- spt->base.tex_usage);
- if(ret != 0)
- return FALSE;
-
- if (!surf.buffer) {
- /* allocation failed */
- return FALSE;
- }
+ unsigned usage = (PIPE_BUFFER_USAGE_CPU_READ_WRITE |
+ PIPE_BUFFER_USAGE_GPU_READ_WRITE);
- /* Now extract the goodies:
- */
spt->base.nblocksx[0] = pf_get_nblocksx(&spt->base.block, spt->base.width[0]);
spt->base.nblocksy[0] = pf_get_nblocksy(&spt->base.block, spt->base.height[0]);
- spt->stride[0] = surf.stride;
- /* Transfer the reference:
- */
- spt->buffer = surf.buffer;
- surf.buffer = NULL;
+ spt->buffer = ws->surface_buffer_create( ws,
+ spt->base.width[0],
+ spt->base.height[0],
+ spt->base.format,
+ usage,
+ &spt->stride[0]);
return spt->buffer != NULL;
}
@@ -231,7 +205,6 @@ softpipe_get_tex_surface(struct pipe_screen *screen,
unsigned face, unsigned level, unsigned zslice,
unsigned usage)
{
- struct pipe_winsys *ws = screen->winsys;
struct softpipe_texture *spt = softpipe_texture(pt);
struct pipe_surface *ps;
diff --git a/src/gallium/drivers/softpipe/sp_texture.h b/src/gallium/drivers/softpipe/sp_texture.h
index bf437a7c618..c1636920cd6 100644
--- a/src/gallium/drivers/softpipe/sp_texture.h
+++ b/src/gallium/drivers/softpipe/sp_texture.h
@@ -42,7 +42,7 @@ struct softpipe_texture
struct pipe_texture base;
unsigned long level_offset[PIPE_MAX_TEXTURE_LEVELS];
- unsigned long stride[PIPE_MAX_TEXTURE_LEVELS];
+ unsigned stride[PIPE_MAX_TEXTURE_LEVELS];
/* The data is held here:
*/
diff --git a/src/gallium/drivers/trace/tr_texture.c b/src/gallium/drivers/trace/tr_texture.c
index 440a78704ab..1cc4f0bd436 100644
--- a/src/gallium/drivers/trace/tr_texture.c
+++ b/src/gallium/drivers/trace/tr_texture.c
@@ -87,7 +87,6 @@ trace_surface_create(struct trace_texture *tr_tex,
memcpy(&tr_surf->base, surface, sizeof(struct pipe_surface));
- tr_surf->base.winsys = tr_tex->base.screen->winsys;
tr_surf->base.texture = NULL;
pipe_texture_reference(&tr_surf->base.texture, &tr_tex->base);
tr_surf->surface = surface;
diff --git a/src/gallium/drivers/trace/tr_winsys.c b/src/gallium/drivers/trace/tr_winsys.c
index 177835854e1..c4148fe8104 100644
--- a/src/gallium/drivers/trace/tr_winsys.c
+++ b/src/gallium/drivers/trace/tr_winsys.c
@@ -98,86 +98,41 @@ trace_winsys_flush_frontbuffer(struct pipe_winsys *_winsys,
}
-static struct pipe_surface *
-trace_winsys_surface_alloc(struct pipe_winsys *_winsys)
-{
- struct trace_winsys *tr_ws = trace_winsys(_winsys);
- struct pipe_winsys *winsys = tr_ws->winsys;
- struct pipe_surface *result;
-
- trace_dump_call_begin("pipe_winsys", "surface_alloc");
-
- trace_dump_arg(ptr, winsys);
-
- result = winsys->surface_alloc(winsys);
-
- trace_dump_ret(ptr, result);
-
- trace_dump_call_end();
-
- assert(!result || !result->texture);
-
- return result;
-}
-
-
-static int
-trace_winsys_surface_alloc_storage(struct pipe_winsys *_winsys,
- struct pipe_surface *surface,
+static struct pipe_buffer *
+trace_winsys_surface_buffer_create(struct pipe_winsys *_winsys,
unsigned width, unsigned height,
enum pipe_format format,
- unsigned flags,
- unsigned tex_usage)
+ unsigned usage,
+ unsigned *pstride)
{
struct trace_winsys *tr_ws = trace_winsys(_winsys);
struct pipe_winsys *winsys = tr_ws->winsys;
- int result;
+ unsigned stride;
+ struct pipe_buffer *result;
- assert(surface && !surface->texture);
-
- trace_dump_call_begin("pipe_winsys", "surface_alloc_storage");
+ trace_dump_call_begin("pipe_winsys", "surface_buffer_create");
trace_dump_arg(ptr, winsys);
- trace_dump_arg(ptr, surface);
trace_dump_arg(uint, width);
trace_dump_arg(uint, height);
trace_dump_arg(format, format);
- trace_dump_arg(uint, flags);
- trace_dump_arg(uint, tex_usage);
+ trace_dump_arg(uint, usage);
- result = winsys->surface_alloc_storage(winsys,
- surface,
+ result = winsys->surface_buffer_create(winsys,
width, height,
format,
- flags,
- tex_usage);
+ usage,
+ pstride);
- trace_dump_ret(int, result);
+ stride = *pstride;
- trace_dump_call_end();
+ trace_dump_arg(uint, stride);
- return result;
-}
-
-
-static void
-trace_winsys_surface_release(struct pipe_winsys *_winsys,
- struct pipe_surface **psurface)
-{
- struct trace_winsys *tr_ws = trace_winsys(_winsys);
- struct pipe_winsys *winsys = tr_ws->winsys;
- struct pipe_surface *surface = *psurface;
-
- assert(psurface && *psurface && !(*psurface)->texture);
-
- trace_dump_call_begin("pipe_winsys", "surface_release");
-
- trace_dump_arg(ptr, winsys);
- trace_dump_arg(ptr, surface);
-
- winsys->surface_release(winsys, psurface);
+ trace_dump_ret(ptr, result);
trace_dump_call_end();
+
+ return result;
}
@@ -465,9 +420,7 @@ trace_winsys_create(struct pipe_winsys *winsys)
tr_ws->base.destroy = trace_winsys_destroy;
tr_ws->base.get_name = trace_winsys_get_name;
tr_ws->base.flush_frontbuffer = trace_winsys_flush_frontbuffer;
- tr_ws->base.surface_alloc = trace_winsys_surface_alloc;
- tr_ws->base.surface_alloc_storage = trace_winsys_surface_alloc_storage;
- tr_ws->base.surface_release = trace_winsys_surface_release;
+ tr_ws->base.surface_buffer_create = trace_winsys_surface_buffer_create;
tr_ws->base.buffer_create = trace_winsys_buffer_create;
tr_ws->base.user_buffer_create = trace_winsys_user_buffer_create;
tr_ws->base.buffer_map = trace_winsys_buffer_map;