gallium: Add destroy callback to all *_winsys interfaces.
authorJosé Fonseca <jrfonseca@tungstengraphics.com>
Fri, 8 Aug 2008 11:23:21 +0000 (12:23 +0100)
committerJosé Fonseca <jrfonseca@tungstengraphics.com>
Fri, 8 Aug 2008 11:32:23 +0000 (12:32 +0100)
For consistency and to simplify these objects' destruction.

src/gallium/drivers/cell/ppu/cell_screen.c
src/gallium/drivers/i915simple/i915_context.c
src/gallium/drivers/i915simple/i915_screen.c
src/gallium/drivers/i915simple/i915_winsys.h
src/gallium/drivers/i965simple/brw_context.c
src/gallium/drivers/i965simple/brw_screen.c
src/gallium/drivers/i965simple/brw_winsys.h
src/gallium/drivers/softpipe/sp_screen.c
src/gallium/include/pipe/p_winsys.h

index cf9b68b695f7738fb605a0b76ad6a1ad56c764d0..2bf441a0c5fcbb8018da3166f50cd2696ebcb15a 100644 (file)
@@ -132,6 +132,11 @@ cell_is_format_supported( struct pipe_screen *screen,
 static void
 cell_destroy_screen( struct pipe_screen *screen )
 {
+   struct pipe_winsys *winsys = screen->winsys;
+
+   if(winsys->destroy)
+      winsys->destroy(winsys);
+
    FREE(screen);
 }
 
index 4c01b8d5b17f926e1bd136f08a2265fde30fb27b..e3d19017b5d6f9903de71543f2d2598d7dc0e349 100644 (file)
@@ -44,6 +44,9 @@ static void i915_destroy( struct pipe_context *pipe )
    struct i915_context *i915 = i915_context( pipe );
 
    draw_destroy( i915->draw );
+   
+   if(i915->winsys)
+      i915->winsys->destroy(i915->winsys);
 
    FREE( i915 );
 }
index 4b1b8af7da8f6472a406158d2e9190eb58254c8f..0afa17bed8520436ca59c2f6f6f6bc79cc9e4519 100644 (file)
@@ -193,6 +193,11 @@ i915_is_format_supported( struct pipe_screen *screen,
 static void
 i915_destroy_screen( struct pipe_screen *screen )
 {
+   struct pipe_winsys *winsys = screen->winsys;
+
+   if(winsys->destroy)
+      winsys->destroy(winsys);
+
    FREE(screen);
 }
 
index 9afaa16a62cb2c105349958ff064f16337e74d69..81904c2a742c1da1c2a958471fe41035621b47ad 100644 (file)
@@ -75,6 +75,8 @@ struct pipe_screen;
  */
 struct i915_winsys {
 
+   void (*destroy)( struct i915_winsys *sws );
+   
    /**
     * Get the current batch buffer from the winsys.
     */
index a276cc0535d926b9deabc2c532ebd3dc5fabf5ff..8326f7b9c402cd827662c8b6e87344b4690e7b94 100644 (file)
@@ -52,6 +52,9 @@ static void brw_destroy(struct pipe_context *pipe)
 {
    struct brw_context *brw = brw_context(pipe);
 
+   if(brw->winsys->destroy)
+      brw->winsys->destroy(brw->winsys);
+   
    FREE(brw);
 }
 
index 6d8f24d1c498d0793528326277278221ed8df5a4..fadfbf94ab3ef3d2e7011959f2a823a5c0803cfb 100644 (file)
@@ -206,6 +206,11 @@ brw_is_format_supported( struct pipe_screen *screen,
 static void
 brw_destroy_screen( struct pipe_screen *screen )
 {
+   struct pipe_winsys *winsys = screen->winsys;
+
+   if(winsys->destroy)
+      winsys->destroy(winsys);
+
    FREE(screen);
 }
 
index b67bd737502940e0041b9601b9b990832d71cf21..ec1e400418fef34c5d74322831708fe549e88972 100644 (file)
@@ -112,6 +112,8 @@ enum brw_cache_id {
  */
 struct brw_winsys {
 
+   void (*destroy)(struct brw_winsys *);
+   
    /**
     * Reserve space on batch buffer.
     *
index ceb5616b5d074ef3427dc7a19795b216bfd9f4d5..f6b3d7ac24fd82afa9449e2fd1f6394a3e24ac42 100644 (file)
@@ -139,6 +139,11 @@ softpipe_is_format_supported( struct pipe_screen *screen,
 static void
 softpipe_destroy_screen( struct pipe_screen *screen )
 {
+   struct pipe_winsys *winsys = screen->winsys;
+
+   if(winsys->destroy)
+      winsys->destroy(winsys);
+
    FREE(screen);
 }
 
index 7ebc2851928580d804b1fbd8bda32e1111fa0932..5d18291dc6cd3b1ebd386870f51295b881911ba0 100644 (file)
@@ -62,6 +62,8 @@ struct pipe_surface;
  */
 struct pipe_winsys
 {
+   void (*destroy)( struct pipe_winsys *ws );
+
    /** Returns name of this winsys interface */
    const char *(*get_name)( struct pipe_winsys *ws );