r300: respect radeon common code fallbacks
[mesa.git] / src / gallium / winsys / drm / radeon / core / radeon_drm.c
index 9552f0ad6a9cafd9d27be4ab323563a7f0f611ca..e817a26da6ddca926a097271e35bb66be9f83698 100644 (file)
  *      Joakim Sindholt <opensource@zhasha.com>
  */
 
-#include "softpipe/sp_winsys.h"
-
 #include "radeon_drm.h"
+#include "radeon_r300.h"
+#include "radeon_buffer.h"
+
+#include "r300_winsys.h"
+#include "trace/tr_drm.h"
+
+#include "util/u_memory.h"
+
+#include "xf86drm.h"
+#include <sys/ioctl.h>
 
 /* Helper function to do the ioctls needed for setup and init. */
 static void do_ioctls(int fd, struct radeon_winsys* winsys)
@@ -128,29 +136,19 @@ struct pipe_screen* radeon_create_screen(struct drm_api* api,
     struct radeon_winsys* rwinsys = radeon_pipe_winsys(drmFB);
     do_ioctls(drmFB, rwinsys);
 
-    if (!is_r3xx(rwinsys->pci_id) ||
-        debug_get_bool_option("RADEON_SOFTPIPE", FALSE)) {
-        return softpipe_create_screen((struct pipe_winsys*)rwinsys);
-    } else {
+    /* The state tracker can organize a softpipe fallback if no hw
+     * driver is found.
+     */
+    if (is_r3xx(rwinsys->pci_id)) {
         radeon_setup_winsys(drmFB, rwinsys);
         return r300_create_screen(rwinsys);
-    }
-}
-
-/* Create a pipe_context. */
-struct pipe_context* radeon_create_context(struct drm_api* api,
-                                           struct pipe_screen* screen)
-{
-    struct radeon_winsys* rwinsys = (struct radeon_winsys*)screen->winsys;
-
-    if (!is_r3xx(rwinsys->pci_id) ||
-        debug_get_bool_option("RADEON_SOFTPIPE", FALSE)) {
-        return softpipe_create(screen);
     } else {
-        return r300_create_context(screen, rwinsys);
+        FREE(rwinsys);
+        return NULL;
     }
 }
 
+
 boolean radeon_buffer_from_texture(struct drm_api* api,
                                    struct pipe_screen* screen,
                                    struct pipe_texture* texture,
@@ -268,13 +266,19 @@ static boolean radeon_local_handle_from_texture(struct drm_api *api,
     return TRUE;
 }
 
+static void radeon_drm_api_destroy(struct drm_api *api)
+{
+    return;
+}
+
 struct drm_api drm_api_hooks = {
     .name = "radeon",
+    .driver_name = "radeon",
     .create_screen = radeon_create_screen,
-    .create_context = radeon_create_context,
     .texture_from_shared_handle = radeon_texture_from_shared_handle,
     .shared_handle_from_texture = radeon_shared_handle_from_texture,
     .local_handle_from_texture = radeon_local_handle_from_texture,
+    .destroy = radeon_drm_api_destroy,
 };
 
 struct drm_api* drm_api_create()