summaryrefslogtreecommitdiffstats
path: root/src/mesa/pipe/p_inlines.h
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-11-07 08:05:09 -0700
committerBrian <[email protected]>2007-11-07 08:24:58 -0700
commit7d1a04e499564212a2a9aace12b05f424a357d3f (patch)
treef0b12d8c0d7916d0dbedfb3adad3d1d786455024 /src/mesa/pipe/p_inlines.h
parent52236661653169140d07a500facd65185b6b3666 (diff)
Add winsys->surface_release() to complement winsys->surface_alloc().
pipe_surface now has a pointer to the winsys which create/owns the surface. This allows clean surface deallocation w/out a rendering context.
Diffstat (limited to 'src/mesa/pipe/p_inlines.h')
-rw-r--r--src/mesa/pipe/p_inlines.h16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/mesa/pipe/p_inlines.h b/src/mesa/pipe/p_inlines.h
index ea666fa20ae..2418d016e15 100644
--- a/src/mesa/pipe/p_inlines.h
+++ b/src/mesa/pipe/p_inlines.h
@@ -29,7 +29,8 @@
#define P_INLINES_H
#include "p_context.h"
-//#include "p_util.h"
+#include "p_winsys.h"
+
/**
* Set 'ptr' to point to 'region' and update reference counting.
@@ -68,16 +69,9 @@ pipe_surface_reference(struct pipe_surface **ptr, struct pipe_surface *surf)
{
assert(ptr);
if (*ptr) {
- /* unreference the old thing */
- struct pipe_surface *oldSurf = *ptr;
- assert(oldSurf->refcount > 0);
- oldSurf->refcount--;
- if (oldSurf->refcount == 0) {
- /* free the old region */
- pipe_region_reference(&oldSurf->region, NULL);
- FREE( oldSurf );
- }
- *ptr = NULL;
+ struct pipe_winsys *winsys = (*ptr)->winsys;
+ winsys->surface_release(winsys, ptr);
+ assert(!*ptr);
}
if (surf) {
/* reference the new thing */