diff options
Diffstat (limited to 'src/gallium/drivers/nv10/nv10_miptree.c')
-rw-r--r-- | src/gallium/drivers/nv10/nv10_miptree.c | 43 |
1 files changed, 18 insertions, 25 deletions
diff --git a/src/gallium/drivers/nv10/nv10_miptree.c b/src/gallium/drivers/nv10/nv10_miptree.c index 4747868a50..bb3a1c0f19 100644 --- a/src/gallium/drivers/nv10/nv10_miptree.c +++ b/src/gallium/drivers/nv10/nv10_miptree.c @@ -66,31 +66,30 @@ nv10_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt, return NULL; mt->base = *pt; - mt->base.refcount = 1; + pipe_reference_init(&mt->base.reference, 1); mt->base.screen = pscreen; mt->level[0].pitch = stride[0]; mt->level[0].image_offset = CALLOC(1, sizeof(unsigned)); - pipe_buffer_reference(pscreen, &mt->buffer, pb); + pipe_buffer_reference(&mt->buffer, pb); return &mt->base; } static struct pipe_texture * nv10_miptree_create(struct pipe_screen *screen, const struct pipe_texture *pt) { - struct pipe_winsys *ws = screen->winsys; struct nv10_miptree *mt; mt = MALLOC(sizeof(struct nv10_miptree)); if (!mt) return NULL; mt->base = *pt; - mt->base.refcount = 1; + pipe_reference_init(&mt->base.reference, 1); mt->base.screen = screen; nv10_miptree_layout(mt); - mt->buffer = ws->buffer_create(ws, 256, PIPE_BUFFER_USAGE_PIXEL, + mt->buffer = screen->buffer_create(screen, 256, PIPE_BUFFER_USAGE_PIXEL, mt->total_size); if (!mt->buffer) { FREE(mt); @@ -101,22 +100,17 @@ nv10_miptree_create(struct pipe_screen *screen, const struct pipe_texture *pt) } static void -nv10_miptree_release(struct pipe_screen *screen, struct pipe_texture **pt) +nv10_miptree_destroy(struct pipe_texture *pt) { - struct pipe_texture *mt = *pt; - - *pt = NULL; - if (--mt->refcount <= 0) { - struct nv10_miptree *nv10mt = (struct nv10_miptree *)mt; - int l; - - pipe_buffer_reference(screen, &nv10mt->buffer, NULL); - for (l = 0; l <= mt->last_level; l++) { - if (nv10mt->level[l].image_offset) - FREE(nv10mt->level[l].image_offset); - } - FREE(nv10mt); - } + struct nv10_miptree *nv10mt = (struct nv10_miptree *)pt; + int l; + + pipe_buffer_reference(&nv10mt->buffer, NULL); + for (l = 0; l <= pt->last_level; l++) { + if (nv10mt->level[l].image_offset) + FREE(nv10mt->level[l].image_offset); + } + FREE(nv10mt); } static void @@ -143,7 +137,7 @@ nv10_miptree_surface_get(struct pipe_screen *screen, struct pipe_texture *pt, ns->base.height = pt->height[level]; ns->base.usage = flags; ns->base.status = PIPE_SURFACE_STATUS_DEFINED; - ns->base.refcount = 1; + pipe_reference_init(&ns->base.reference, 1); ns->base.face = face; ns->base.level = level; ns->base.zslice = zslice; @@ -159,8 +153,7 @@ nv10_miptree_surface_get(struct pipe_screen *screen, struct pipe_texture *pt, } static void -nv10_miptree_surface_release(struct pipe_screen *screen, - struct pipe_surface **surface) +nv10_miptree_surface_destroy(struct pipe_surface *surface) { } @@ -168,8 +161,8 @@ void nv10_screen_init_miptree_functions(struct pipe_screen *pscreen) { pscreen->texture_create = nv10_miptree_create; pscreen->texture_blanket = nv10_miptree_blanket; - pscreen->texture_release = nv10_miptree_release; + pscreen->texture_destroy = nv10_miptree_destroy; pscreen->get_tex_surface = nv10_miptree_surface_get; - pscreen->tex_surface_release = nv10_miptree_surface_release; + pscreen->tex_surface_destroy = nv10_miptree_surface_destroy; } |