diff options
4 files changed, 17 insertions, 11 deletions
diff --git a/src/gallium/state_trackers/python/st_device.c b/src/gallium/state_trackers/python/st_device.c index 44d65e3fc1e..4f227a092c5 100644 --- a/src/gallium/state_trackers/python/st_device.c +++ b/src/gallium/state_trackers/python/st_device.c @@ -85,7 +85,7 @@ st_device_create(boolean hardware) if (hardware) screen = st_hardware_screen_create(); else - screen = st_software_screen_create(); + screen = st_software_screen_create("softpipe"); screen = trace_screen_create(screen); if (!screen) diff --git a/src/gallium/state_trackers/python/st_hardpipe_winsys.c b/src/gallium/state_trackers/python/st_hardpipe_winsys.c index b141177b793..c6743dbd9c4 100644 --- a/src/gallium/state_trackers/python/st_hardpipe_winsys.c +++ b/src/gallium/state_trackers/python/st_hardpipe_winsys.c @@ -208,5 +208,5 @@ st_hardware_screen_create(void) if(st_hardpipe_load()) return pfnGetGalliumScreenMESA(); else - return st_software_screen_create(); + return st_software_screen_create(NULL); } diff --git a/src/gallium/state_trackers/python/st_softpipe_winsys.c b/src/gallium/state_trackers/python/st_softpipe_winsys.c index 0a332aaa9f1..8584bad4679 100644 --- a/src/gallium/state_trackers/python/st_softpipe_winsys.c +++ b/src/gallium/state_trackers/python/st_softpipe_winsys.c @@ -35,27 +35,29 @@ struct pipe_screen * -st_software_screen_create(void) +st_software_screen_create(const char *driver) { struct sw_winsys *ws; - const char *default_driver; - const char *driver; struct pipe_screen *screen = NULL; + if (!driver) { + const char *default_driver; + #if defined(HAVE_LLVMPIPE) - default_driver = "llvmpipe"; + default_driver = "llvmpipe"; #elif defined(HAVE_SOFTPIPE) - default_driver = "softpipe"; + default_driver = "softpipe"; #else - default_driver = ""; + default_driver = ""; #endif + driver = debug_get_option("GALLIUM_DRIVER", default_driver); + } + ws = null_sw_create(); if(!ws) return NULL; - driver = debug_get_option("GALLIUM_DRIVER", default_driver); - #ifdef HAVE_LLVMPIPE if (strcmp(driver, "llvmpipe") == 0) { screen = llvmpipe_create_screen(ws); @@ -68,5 +70,9 @@ st_software_screen_create(void) } #endif + if (!screen) { + ws->destroy(ws); + } + return screen; } diff --git a/src/gallium/state_trackers/python/st_winsys.h b/src/gallium/state_trackers/python/st_winsys.h index e1a99383a41..7d4066d947b 100644 --- a/src/gallium/state_trackers/python/st_winsys.h +++ b/src/gallium/state_trackers/python/st_winsys.h @@ -37,7 +37,7 @@ struct pipe_screen * st_hardware_screen_create(void); struct pipe_screen * -st_software_screen_create(void); +st_software_screen_create(const char *driver); #endif /* ST_WINSYS_H_ */ |