st/python: Always use softpipe as reference driver.
authorJosé Fonseca <jfonseca@vmware.com>
Thu, 1 Apr 2010 15:38:01 +0000 (16:38 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Thu, 1 Apr 2010 16:46:58 +0000 (17:46 +0100)
src/gallium/state_trackers/python/st_device.c
src/gallium/state_trackers/python/st_hardpipe_winsys.c
src/gallium/state_trackers/python/st_softpipe_winsys.c
src/gallium/state_trackers/python/st_winsys.h

index 44d65e3fc1e3b29c0c4375959260bb92ef90d111..4f227a092c5ad5195525be92fb3b038b9115b862 100644 (file)
@@ -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)
index b141177b79311dd0492b539560b5774085e8687f..c6743dbd9c463014fc00014267453a0b12ad8180 100644 (file)
@@ -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);
 }
index 0a332aaa9f1a3a3c6749e5abe84ddb95c0e1717e..8584bad467916070374d6597e2032558f36b6ae1 100644 (file)
 
 
 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;
 }
index e1a99383a4135907814bf41e8aec384d66c1136d..7d4066d947b8d77c38ba2f423194c88a64d5120c 100644 (file)
@@ -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_ */