etnaviv: clean up sampler view reference counting
authorLucas Stach <l.stach@pengutronix.de>
Wed, 10 May 2017 16:01:07 +0000 (18:01 +0200)
committerChristian Gmeiner <christian.gmeiner@gmail.com>
Tue, 16 May 2017 19:07:51 +0000 (21:07 +0200)
Use the proper pipe_resource_reference function instead of
rolling our own.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
src/gallium/drivers/etnaviv/etnaviv_texture.c

index 3a842381ac2d1abfca18a640f0b4602a08d5d30e..6f77af286f26ce26dd1af083efead5576c51f107 100644 (file)
@@ -182,9 +182,9 @@ etna_create_sampler_view(struct pipe_context *pctx, struct pipe_resource *prsc,
    }
 
    sv->base = *so;
-   pipe_reference(NULL, &prsc->reference);
-   sv->base.texture = prsc;
-   sv->base.reference.count = 1;
+   pipe_reference_init(&sv->base.reference, 1);
+   sv->base.texture = NULL;
+   pipe_resource_reference(&sv->base.texture, prsc);
    sv->base.context = pctx;
 
    /* merged with sampler state */