diff options
author | Brian <brian.paul@tungstengraphics.com> | 2007-11-07 08:05:09 -0700 |
---|---|---|
committer | Brian <brian.paul@tungstengraphics.com> | 2007-11-07 08:24:58 -0700 |
commit | 7d1a04e499564212a2a9aace12b05f424a357d3f (patch) | |
tree | f0b12d8c0d7916d0dbedfb3adad3d1d786455024 /src/mesa/drivers | |
parent | 52236661653169140d07a500facd65185b6b3666 (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/drivers')
-rw-r--r-- | src/mesa/drivers/dri/intel_winsys/intel_winsys_pipe.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_winsys_pipe.c b/src/mesa/drivers/dri/intel_winsys/intel_winsys_pipe.c index cc76a40a5a..56a600aebe 100644 --- a/src/mesa/drivers/dri/intel_winsys/intel_winsys_pipe.c +++ b/src/mesa/drivers/dri/intel_winsys/intel_winsys_pipe.c @@ -264,12 +264,28 @@ intel_i915_surface_alloc(struct pipe_winsys *winsys, unsigned format) if (surf) { surf->format = format; surf->refcount = 1; + surf->winsys = winsys; } return surf; } static void +intel_i915_surface_release(struct pipe_winsys *winsys, struct pipe_surface **s) +{ + struct pipe_surface *surf = *s; + surf->refcount--; + if (surf->refcount == 0) { + if (surf->region) + winsys->region_release(winsys, &surf->region); + free(surf); + } + *s = NULL; +} + + + +static void intel_printf( struct pipe_winsys *sws, const char *fmtString, ... ) { va_list args; @@ -315,6 +331,7 @@ intel_create_pipe_winsys( struct intel_context *intel ) iws->winsys.region_release = intel_i915_region_release; iws->winsys.surface_alloc = intel_i915_surface_alloc; + iws->winsys.surface_release = intel_i915_surface_release; return &iws->winsys; } |