summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJosé Fonseca <jrfonseca@tungstengraphics.com>2008-08-08 12:23:21 +0100
committerJosé Fonseca <jrfonseca@tungstengraphics.com>2008-08-08 12:32:23 +0100
commit9dcb956a0618931c97693f7c74493cf296cfe86c (patch)
treeffc076c3e34dffd3dc8de5cf01ccb96939d4b797 /src
parentbe36f7869e8ecc4b00e414557a9699ba373e6bdd (diff)
gallium: Add destroy callback to all *_winsys interfaces.
For consistency and to simplify these objects' destruction.
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/cell/ppu/cell_screen.c5
-rw-r--r--src/gallium/drivers/i915simple/i915_context.c3
-rw-r--r--src/gallium/drivers/i915simple/i915_screen.c5
-rw-r--r--src/gallium/drivers/i915simple/i915_winsys.h2
-rw-r--r--src/gallium/drivers/i965simple/brw_context.c3
-rw-r--r--src/gallium/drivers/i965simple/brw_screen.c5
-rw-r--r--src/gallium/drivers/i965simple/brw_winsys.h2
-rw-r--r--src/gallium/drivers/softpipe/sp_screen.c5
-rw-r--r--src/gallium/include/pipe/p_winsys.h2
9 files changed, 32 insertions, 0 deletions
diff --git a/src/gallium/drivers/cell/ppu/cell_screen.c b/src/gallium/drivers/cell/ppu/cell_screen.c
index cf9b68b695..2bf441a0c5 100644
--- a/src/gallium/drivers/cell/ppu/cell_screen.c
+++ b/src/gallium/drivers/cell/ppu/cell_screen.c
@@ -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);
}
diff --git a/src/gallium/drivers/i915simple/i915_context.c b/src/gallium/drivers/i915simple/i915_context.c
index 4c01b8d5b1..e3d19017b5 100644
--- a/src/gallium/drivers/i915simple/i915_context.c
+++ b/src/gallium/drivers/i915simple/i915_context.c
@@ -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 );
}
diff --git a/src/gallium/drivers/i915simple/i915_screen.c b/src/gallium/drivers/i915simple/i915_screen.c
index 4b1b8af7da..0afa17bed8 100644
--- a/src/gallium/drivers/i915simple/i915_screen.c
+++ b/src/gallium/drivers/i915simple/i915_screen.c
@@ -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);
}
diff --git a/src/gallium/drivers/i915simple/i915_winsys.h b/src/gallium/drivers/i915simple/i915_winsys.h
index 9afaa16a62..81904c2a74 100644
--- a/src/gallium/drivers/i915simple/i915_winsys.h
+++ b/src/gallium/drivers/i915simple/i915_winsys.h
@@ -75,6 +75,8 @@ struct pipe_screen;
*/
struct i915_winsys {
+ void (*destroy)( struct i915_winsys *sws );
+
/**
* Get the current batch buffer from the winsys.
*/
diff --git a/src/gallium/drivers/i965simple/brw_context.c b/src/gallium/drivers/i965simple/brw_context.c
index a276cc0535..8326f7b9c4 100644
--- a/src/gallium/drivers/i965simple/brw_context.c
+++ b/src/gallium/drivers/i965simple/brw_context.c
@@ -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);
}
diff --git a/src/gallium/drivers/i965simple/brw_screen.c b/src/gallium/drivers/i965simple/brw_screen.c
index 6d8f24d1c4..fadfbf94ab 100644
--- a/src/gallium/drivers/i965simple/brw_screen.c
+++ b/src/gallium/drivers/i965simple/brw_screen.c
@@ -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);
}
diff --git a/src/gallium/drivers/i965simple/brw_winsys.h b/src/gallium/drivers/i965simple/brw_winsys.h
index b67bd73750..ec1e400418 100644
--- a/src/gallium/drivers/i965simple/brw_winsys.h
+++ b/src/gallium/drivers/i965simple/brw_winsys.h
@@ -112,6 +112,8 @@ enum brw_cache_id {
*/
struct brw_winsys {
+ void (*destroy)(struct brw_winsys *);
+
/**
* Reserve space on batch buffer.
*
diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
index ceb5616b5d..f6b3d7ac24 100644
--- a/src/gallium/drivers/softpipe/sp_screen.c
+++ b/src/gallium/drivers/softpipe/sp_screen.c
@@ -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);
}
diff --git a/src/gallium/include/pipe/p_winsys.h b/src/gallium/include/pipe/p_winsys.h
index 7ebc285192..5d18291dc6 100644
--- a/src/gallium/include/pipe/p_winsys.h
+++ b/src/gallium/include/pipe/p_winsys.h
@@ -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 );