r300g: Move bootstrap code to targets
authorJakob Bornecrantz <jakob@vmware.com>
Sun, 6 Jun 2010 10:56:23 +0000 (11:56 +0100)
committerJakob Bornecrantz <jakob@vmware.com>
Sun, 6 Jun 2010 12:02:56 +0000 (13:02 +0100)
src/gallium/drivers/r300/r300_public.h [new file with mode: 0644]
src/gallium/drivers/r300/r300_screen.c
src/gallium/drivers/r300/r300_winsys.h
src/gallium/targets/dri-radeong/target.c
src/gallium/targets/egl-radeon/target.c
src/gallium/targets/xorg-radeon/radeon_target.c
src/gallium/winsys/radeon/drm/radeon_drm.c
src/gallium/winsys/radeon/drm/radeon_drm.h
src/gallium/winsys/radeon/drm/radeon_drm_public.h [new file with mode: 0644]
src/gallium/winsys/radeon/drm/radeon_r300.c

diff --git a/src/gallium/drivers/r300/r300_public.h b/src/gallium/drivers/r300/r300_public.h
new file mode 100644 (file)
index 0000000..8e7a963
--- /dev/null
@@ -0,0 +1,9 @@
+
+#ifndef R300_PUBLIC_H
+#define R300_PUBLIC_H
+
+struct r300_winsys_screen;
+
+struct pipe_screen* r300_screen_create(struct r300_winsys_screen *rws);
+
+#endif
index 497e24b7605bd9427447467283002b61adafb591..fd522b84e1a2017c985c2632586f6b472a348cab 100644 (file)
@@ -30,6 +30,7 @@
 #include "r300_screen_buffer.h"
 #include "r300_state_inlines.h"
 #include "r300_winsys.h"
+#include "r300_public.h"
 
 /* Return the identifier behind whom the brave coders responsible for this
  * amalgamation of code, sweat, and duct tape, routinely obscure their names.
@@ -366,7 +367,7 @@ static int r300_fence_finish(struct pipe_screen *screen,
     return 0; /* 0 == success */
 }
 
-struct pipe_screen* r300_create_screen(struct r300_winsys_screen *rws)
+struct pipe_screen* r300_screen_create(struct r300_winsys_screen *rws)
 {
     struct r300_screen *r300screen = CALLOC_STRUCT(r300_screen);
 
index 6ce218923b1059cac2f0f5841f1a7a83cc736ff7..8a8888d48133658539c66d5e20a27249b82f172c 100644 (file)
@@ -180,7 +180,4 @@ struct r300_winsys_screen {
 struct r300_winsys_screen *
 r300_winsys_screen(struct pipe_screen *screen);
 
-/* Creates a new r300 screen. */
-struct pipe_screen* r300_create_screen(struct r300_winsys_screen *rws);
-
 #endif /* R300_WINSYS_H */
index 06b64820cf8b657f9153b1a4b34c15f5fd7b9c27..2c1beb633ef7736b3f363fa1e1904b499db339fb 100644 (file)
@@ -1,4 +1,17 @@
 
-#include "target-helpers/drm_api_compat.h"
+#include "state_tracker/drm_driver.h"
+#include "radeon/drm/radeon_drm_public.h"
+#include "r300/r300_public.h"
 
-DRM_API_COMPAT_STRUCT("radeon", "radeon")
+static struct pipe_screen *
+create_screen(int fd)
+{
+   struct r300_winsys_screen *sws;
+   sws = r300_drm_winsys_screen_create(fd);
+   if (!sws)
+      return NULL;
+
+   return r300_screen_create(sws);
+}
+
+DRM_DRIVER_DESCRIPTOR("radeon", "radeon", create_screen)
index 03b982ae8314ee6ae9175a3305fd05a46dc04302..5117eb86f9fadf7739f95c4c64af47dff018531c 100644 (file)
@@ -1,7 +1,20 @@
 
-#include "target-helpers/drm_api_compat.h"
+#include "state_tracker/drm_driver.h"
+#include "radeon/drm/radeon_drm_public.h"
+#include "r300/r300_public.h"
 
-DRM_API_COMPAT_STRUCT("radeon", "radeon")
+static struct pipe_screen *
+create_screen(int fd)
+{
+   struct r300_winsys_screen *sws;
+   sws = r300_drm_winsys_screen_create(fd);
+   if (!sws)
+      return NULL;
+
+   return r300_screen_create(sws);
+}
+
+DRM_DRIVER_DESCRIPTOR("radeon", "radeon", create_screen)
 
 /* A poor man's --whole-archive for EGL drivers */
 void *_eglMain(void *);
index 06b64820cf8b657f9153b1a4b34c15f5fd7b9c27..2c1beb633ef7736b3f363fa1e1904b499db339fb 100644 (file)
@@ -1,4 +1,17 @@
 
-#include "target-helpers/drm_api_compat.h"
+#include "state_tracker/drm_driver.h"
+#include "radeon/drm/radeon_drm_public.h"
+#include "r300/r300_public.h"
 
-DRM_API_COMPAT_STRUCT("radeon", "radeon")
+static struct pipe_screen *
+create_screen(int fd)
+{
+   struct r300_winsys_screen *sws;
+   sws = r300_drm_winsys_screen_create(fd);
+   if (!sws)
+      return NULL;
+
+   return r300_screen_create(sws);
+}
+
+DRM_DRIVER_DESCRIPTOR("radeon", "radeon", create_screen)
index 59f1b10230e3af915c7f296143832e350001e724..e9a276362f394a8b7b39423d8e221517b29f711b 100644 (file)
@@ -32,9 +32,9 @@
 #include "radeon_drm.h"
 #include "radeon_r300.h"
 #include "radeon_buffer.h"
+#include "radeon_drm_public.h"
 
 #include "r300_winsys.h"
-#include "trace/tr_drm.h"
 
 #include "util/u_memory.h"
 
@@ -153,7 +153,7 @@ static void do_ioctls(int fd, struct radeon_libdrm_winsys* winsys)
 }
 
 /* Create a pipe_screen. */
-struct pipe_screen* radeon_create_screen(struct drm_api* api, int drmFB)
+struct r300_winsys_screen* r300_drm_winsys_screen_create(int drmFB)
 {
     struct radeon_libdrm_winsys* rws; 
     boolean ret;
@@ -171,22 +171,10 @@ struct pipe_screen* radeon_create_screen(struct drm_api* api, int drmFB)
         ret = radeon_setup_winsys(drmFB, rws);
        if (ret == FALSE)
            goto fail;
-        return r300_create_screen(&rws->base);
+        return &rws->base;
     }
 
 fail:
     FREE(rws);
     return NULL;
 }
-
-static struct drm_api radeon_drm_api_hooks = {
-    .name = "radeon",
-    .driver_name = "radeon",
-    .create_screen = radeon_create_screen,
-    .destroy = NULL,
-};
-
-struct drm_api* drm_api_create()
-{
-    return trace_drm_create(&radeon_drm_api_hooks);
-}
index 3544c926d9975c07328151b53e37abb4c50d66f9..df6dd91ad54b473be0853dfa3c3b4d3a26f9d492 100644 (file)
 #ifndef RADEON_DRM_H
 #define RADEON_DRM_H
 
-#include "state_tracker/drm_api.h"
-
-
-struct pipe_screen* radeon_create_screen(struct drm_api* api, int drmFB);
-
-void radeon_destroy_drm_api(struct drm_api* api);
+#include "state_tracker/drm_driver.h"
 
 /* Guess at whether this chipset should use r300g.
  *
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_public.h b/src/gallium/winsys/radeon/drm/radeon_drm_public.h
new file mode 100644 (file)
index 0000000..0d96ae8
--- /dev/null
@@ -0,0 +1,9 @@
+
+#ifndef RADEON_DRM_PUBLIC_H
+#define RADEON_DRM_PUBLIC_H
+
+struct r300_winsys_screen;
+
+struct r300_winsys_screen *r300_drm_winsys_screen_create(int drmFD);
+
+#endif
index 70ae01a694b50e3a78df26de955c40c0586bfc3e..a9b36578ef8aef9de9e448707bc12cbf1fda341d 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "radeon_bo_gem.h"
 #include "radeon_cs_gem.h"
-#include "state_tracker/drm_api.h"
+#include "state_tracker/drm_driver.h"
 
 static struct r300_winsys_buffer *
 radeon_r300_winsys_buffer_create(struct r300_winsys_screen *rws,