summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2009-01-17 17:12:30 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2009-01-17 17:12:30 +0000
commitbcc45a202496fba9686f953011039c09e36bf3ae (patch)
treea8cab6caab4fac57ac04b683a2fd4d3c66ddd429 /src
parent4f134f91a427b053d1bc069cb6cac48a0982abc3 (diff)
xlib: don't explicitly create the pipe_winsys struct
Diffstat (limited to 'src')
-rw-r--r--src/gallium/winsys/xlib/xlib_brw_screen.c22
-rw-r--r--src/gallium/winsys/xlib/xlib_cell.c21
-rw-r--r--src/gallium/winsys/xlib/xlib_softpipe.c14
-rw-r--r--src/gallium/winsys/xlib/xlib_trace.c15
4 files changed, 53 insertions, 19 deletions
diff --git a/src/gallium/winsys/xlib/xlib_brw_screen.c b/src/gallium/winsys/xlib/xlib_brw_screen.c
index 1e4c2f6c41..030cd66bd9 100644
--- a/src/gallium/winsys/xlib/xlib_brw_screen.c
+++ b/src/gallium/winsys/xlib/xlib_brw_screen.c
@@ -351,9 +351,26 @@ xlib_create_brw_winsys( void )
static struct pipe_screen *
-xlib_create_brw_screen( struct pipe_winsys *winsys )
+xlib_create_brw_screen( void )
{
- return brw_create_screen(winsys, 0/* XXX pci_id */);
+ struct pipe_winsys *winsys;
+ struct pipe_screen *screen;
+
+ winsys = xlib_create_brw_winsys();
+ if (winsys == NULL)
+ return NULL;
+
+ screen = brw_create_screen(winsys, 0/* XXX pci_id */);
+ if (screen == NULL)
+ goto fail;
+
+ return screen;
+
+fail:
+ if (winsys)
+ winsys->destroy( winsys );
+
+ return NULL;
}
@@ -473,7 +490,6 @@ xlib_brw_display_surface(struct xmesa_buffer *b,
struct xm_driver xlib_brw_driver =
{
- .create_pipe_winsys = xlib_create_brw_winsys,
.create_pipe_screen = xlib_create_brw_screen,
.create_pipe_context = xlib_create_brw_context,
.display_surface = xlib_brw_display_surface,
diff --git a/src/gallium/winsys/xlib/xlib_cell.c b/src/gallium/winsys/xlib/xlib_cell.c
index 5fe406d5ab..93bc8ecd81 100644
--- a/src/gallium/winsys/xlib/xlib_cell.c
+++ b/src/gallium/winsys/xlib/xlib_cell.c
@@ -414,7 +414,24 @@ xlib_create_cell_winsys( void )
static struct pipe_screen *
xlib_create_cell_screen( struct pipe_winsys *pws )
{
- return cell_create_screen( pws );
+ struct pipe_winsys *winsys;
+ struct pipe_screen *screen;
+
+ winsys = xlib_create_cell_winsys();
+ if (winsys == NULL)
+ return NULL;
+
+ screen = cell_create_screen(winsys);
+ if (screen == NULL)
+ goto fail;
+
+ return screen;
+
+fail:
+ if (winsys)
+ winsys->destroy( winsys );
+
+ return NULL;
}
@@ -445,7 +462,6 @@ fail:
struct xm_driver xlib_cell_driver =
{
- .create_pipe_winsys = xlib_create_cell_winsys,
.create_pipe_screen = xlib_create_cell_screen,
.create_pipe_context = xlib_create_cell_context,
.display_surface = xlib_cell_display_surface,
@@ -455,7 +471,6 @@ struct xm_driver xlib_cell_driver =
struct xm_driver xlib_cell_driver =
{
- .create_pipe_winsys = NULL,
.create_pipe_screen = NULL,
.create_pipe_context = NULL,
.display_surface = NULL,
diff --git a/src/gallium/winsys/xlib/xlib_softpipe.c b/src/gallium/winsys/xlib/xlib_softpipe.c
index 775e345c2b..e8513069fe 100644
--- a/src/gallium/winsys/xlib/xlib_softpipe.c
+++ b/src/gallium/winsys/xlib/xlib_softpipe.c
@@ -232,7 +232,6 @@ xlib_softpipe_display_surface(struct xmesa_buffer *b,
struct xm_buffer *xm_buf = xm_buffer(surf->buffer);
static boolean no_swap = 0;
static boolean firsttime = 1;
- static int tileSize = 0;
if (firsttime) {
no_swap = getenv("SP_NO_RAST") != NULL;
@@ -482,17 +481,25 @@ xlib_create_softpipe_winsys( void )
static struct pipe_screen *
-xlib_create_softpipe_screen( struct pipe_winsys *pws )
+xlib_create_softpipe_screen( void )
{
+ struct pipe_winsys *winsys;
struct pipe_screen *screen;
- screen = softpipe_create_screen(pws);
+ winsys = xlib_create_softpipe_winsys();
+ if (winsys == NULL)
+ return NULL;
+
+ screen = softpipe_create_screen(winsys);
if (screen == NULL)
goto fail;
return screen;
fail:
+ if (winsys)
+ winsys->destroy( winsys );
+
return NULL;
}
@@ -517,7 +524,6 @@ fail:
struct xm_driver xlib_softpipe_driver =
{
- .create_pipe_winsys = xlib_create_softpipe_winsys,
.create_pipe_screen = xlib_create_softpipe_screen,
.create_pipe_context = xlib_create_softpipe_context,
.display_surface = xlib_softpipe_display_surface
diff --git a/src/gallium/winsys/xlib/xlib_trace.c b/src/gallium/winsys/xlib/xlib_trace.c
index 1b8d3f8a11..37095c5d8e 100644
--- a/src/gallium/winsys/xlib/xlib_trace.c
+++ b/src/gallium/winsys/xlib/xlib_trace.c
@@ -38,19 +38,16 @@
#include "trace/tr_screen.h"
#include "trace/tr_context.h"
+#include "pipe/p_screen.h"
+
-static struct pipe_winsys *
-xlib_create_trace_winsys( void )
-{
- return xlib_softpipe_driver.create_pipe_winsys();
-}
static struct pipe_screen *
-xlib_create_trace_screen( struct pipe_winsys *winsys )
+xlib_create_trace_screen( void )
{
struct pipe_screen *screen, *trace_screen;
- screen = xlib_softpipe_driver.create_pipe_screen( winsys );
+ screen = xlib_softpipe_driver.create_pipe_screen();
if (screen == NULL)
goto fail;
@@ -63,7 +60,8 @@ xlib_create_trace_screen( struct pipe_winsys *winsys )
return trace_screen;
fail:
- /* free stuff */
+ if (screen)
+ screen->destroy( screen );
return NULL;
}
@@ -103,7 +101,6 @@ xlib_trace_display_surface( struct xmesa_buffer *buffer,
struct xm_driver xlib_trace_driver =
{
- .create_pipe_winsys = xlib_create_trace_winsys,
.create_pipe_screen = xlib_create_trace_screen,
.create_pipe_context = xlib_create_trace_context,
.display_surface = xlib_trace_display_surface,