i915g: Move bootstrap code to targets
authorJakob Bornecrantz <jakob@vmware.com>
Tue, 1 Jun 2010 03:38:24 +0000 (04:38 +0100)
committerJakob Bornecrantz <jakob@vmware.com>
Sun, 6 Jun 2010 12:02:49 +0000 (13:02 +0100)
13 files changed:
src/gallium/drivers/i915/i915_public.h [new file with mode: 0644]
src/gallium/drivers/i915/i915_screen.c
src/gallium/drivers/i915/i915_winsys.h
src/gallium/targets/dri-i915/target.c
src/gallium/targets/egl-i915/target.c
src/gallium/targets/xorg-i915/intel_target.c
src/gallium/winsys/i915/drm/i915_drm_buffer.c
src/gallium/winsys/i915/drm/i915_drm_public.h [new file with mode: 0644]
src/gallium/winsys/i915/drm/i915_drm_winsys.c
src/gallium/winsys/i915/drm/i915_drm_winsys.h
src/gallium/winsys/i915/sw/i915_sw_public.h [new file with mode: 0644]
src/gallium/winsys/i915/sw/i915_sw_winsys.c
src/gallium/winsys/i915/sw/i915_sw_winsys.h

diff --git a/src/gallium/drivers/i915/i915_public.h b/src/gallium/drivers/i915/i915_public.h
new file mode 100644 (file)
index 0000000..588654d
--- /dev/null
@@ -0,0 +1,13 @@
+
+#ifndef I915_PUBLIC_H
+#define I915_PUBLIC_H
+
+struct i915_winsys;
+struct pipe_screen;
+
+/**
+ * Create i915 pipe_screen.
+ */
+struct pipe_screen * i915_screen_create(struct i915_winsys *iws);
+
+#endif
index f82426520cd486eb30d10c217247e12a4c35212e..bb0b85d74c719bdaacc1cc0711866f4d8f18e17e 100644 (file)
@@ -36,6 +36,7 @@
 #include "i915_surface.h"
 #include "i915_resource.h"
 #include "i915_winsys.h"
+#include "i915_public.h"
 
 
 /*
index 3aba19fe6a3990db2a423c0e0894090d98b72e2e..5385e403d224e3715dd8116b2f0e92f049961c8f 100644 (file)
@@ -222,11 +222,4 @@ struct i915_winsys {
    void (*destroy)(struct i915_winsys *iws);
 };
 
-
-/**
- * Create i915 pipe_screen.
- */
-struct pipe_screen *i915_screen_create(struct i915_winsys *iws);
-
-
 #endif
index 8fd7308893301b686248f52df2f1cc6c1d27ebdc..a79238f3a0f422b3652fdbfaaeb8779d050f8ad2 100644 (file)
@@ -1,4 +1,17 @@
 
-#include "target-helpers/drm_api_compat.h"
+#include "state_tracker/drm_driver.h"
+#include "i915/drm/i915_drm_public.h"
+#include "i915/i915_public.h"
 
-DRM_API_COMPAT_STRUCT("i915", "i915")
+static struct pipe_screen *
+create_screen(int fd)
+{
+   struct i915_winsys *iws;
+   iws = i915_drm_winsys_create(fd);
+   if (!iws)
+      return NULL;
+
+   return i915_screen_create(iws);
+}
+
+DRM_DRIVER_DESCRIPTOR("i915", "i915", create_screen)
index fd68c4bd454376b71f8c1c58abc682860572a742..288771664347ec5d7825efbe718aed7e3bf8250a 100644 (file)
@@ -1,7 +1,20 @@
 
-#include "target-helpers/drm_api_compat.h"
+#include "state_tracker/drm_driver.h"
+#include "i915/drm/i915_drm_public.h"
+#include "i915/i915_public.h"
 
-DRM_API_COMPAT_STRUCT("i915", "i915")
+static struct pipe_screen *
+create_screen(int fd)
+{
+   struct i915_winsys *iws;
+   iws = i915_drm_winsys_create(fd);
+   if (!iws)
+      return NULL;
+
+   return i915_screen_create(iws);
+}
+
+DRM_DRIVER_DESCRIPTOR("i915", "i915", create_screen)
 
 /* A poor man's --whole-archive for EGL drivers */
 void *_eglMain(void *);
index 4eff93c074001df1401d8bc42299b1a7046d405b..a79238f3a0f422b3652fdbfaaeb8779d050f8ad2 100644 (file)
@@ -1,4 +1,17 @@
 
-#include "target-helpers/drm_api_compat.h"
+#include "state_tracker/drm_driver.h"
+#include "i915/drm/i915_drm_public.h"
+#include "i915/i915_public.h"
 
-DRM_API_COMPAT_STRUCT("modesetting", "i915")
+static struct pipe_screen *
+create_screen(int fd)
+{
+   struct i915_winsys *iws;
+   iws = i915_drm_winsys_create(fd);
+   if (!iws)
+      return NULL;
+
+   return i915_screen_create(iws);
+}
+
+DRM_DRIVER_DESCRIPTOR("i915", "i915", create_screen)
index 3bd85026b211d131116a299107bd4856e0e34759..6b06e7ae99508daddfef1d68a47c5980632d1c3d 100644 (file)
@@ -1,5 +1,5 @@
 
-#include "state_tracker/drm_api.h"
+#include "state_tracker/drm_driver.h"
 #include "i915_drm_winsys.h"
 #include "util/u_memory.h"
 
diff --git a/src/gallium/winsys/i915/drm/i915_drm_public.h b/src/gallium/winsys/i915/drm/i915_drm_public.h
new file mode 100644 (file)
index 0000000..b828d8d
--- /dev/null
@@ -0,0 +1,9 @@
+
+#ifndef I915_DRM_PUBLIC_H
+#define I915_DRM_PUBLIC_H
+
+struct i915_winsys;
+
+struct i915_winsys * i915_drm_winsys_create(int drmFD);
+
+#endif
index 5a6b45e6c9f92d60157b42cc7b4c88ea4609ab81..83651b4c47c6d24b7e9369f72a9f02670160205c 100644 (file)
@@ -1,14 +1,11 @@
 #include <stdio.h>
 
-#include "state_tracker/drm_api.h"
+#include "state_tracker/drm_driver.h"
 
 #include "i915_drm_winsys.h"
+#include "i915_drm_public.h"
 #include "util/u_memory.h"
 
-#include "i915/i915_context.h"
-#include "i915/i915_screen.h"
-
-#include "trace/tr_drm.h"
 
 /*
  * Helper functions
@@ -48,8 +45,8 @@ i915_drm_winsys_destroy(struct i915_winsys *iws)
    FREE(idws);
 }
 
-static struct pipe_screen *
-i915_drm_create_screen(struct drm_api *api, int drmFD)
+struct i915_winsys *
+i915_drm_winsys_create(int drmFD)
 {
    struct i915_drm_winsys *idws;
    unsigned int deviceID;
@@ -75,19 +72,5 @@ i915_drm_create_screen(struct drm_api *api, int drmFD)
 
    idws->dump_cmd = debug_get_bool_option("INTEL_DUMP_CMD", FALSE);
 
-   return i915_screen_create(&idws->base);
-}
-
-static struct drm_api i915_drm_api =
-{
-   .name = "i915",
-   .driver_name = "i915",
-   .create_screen = i915_drm_create_screen,
-   .destroy = NULL,
-};
-
-struct drm_api *
-drm_api_create()
-{
-   return trace_drm_create(&i915_drm_api);
+   return &idws->base;
 }
index 99667bde4ef94aee1b397ee3b3f1ef597aed40a7..1b93ddc734c8e27fed8515efb24643c0e19a6c15 100644 (file)
@@ -34,7 +34,6 @@ i915_drm_winsys(struct i915_winsys *iws)
    return (struct i915_drm_winsys *)iws;
 }
 
-struct i915_drm_winsys * i915_drm_winsys_create(int fd, unsigned pci_id);
 struct pipe_fence_handle * i915_drm_fence_create(drm_intel_bo *bo);
 
 void i915_drm_winsys_init_batchbuffer_functions(struct i915_drm_winsys *idws);
diff --git a/src/gallium/winsys/i915/sw/i915_sw_public.h b/src/gallium/winsys/i915/sw/i915_sw_public.h
new file mode 100644 (file)
index 0000000..e951a32
--- /dev/null
@@ -0,0 +1,9 @@
+
+#ifndef I915_SW_PUBLIC_H
+#define I915_SW_PUBLIC_H
+
+struct i915_winsys;
+
+struct i915_winsys * i915_sw_winsys_create(void);
+
+#endif
index bb1c107c056123023707eca260a7d1ee80dd3efe..058ddc44aaf673e467f37ac9ad18af56186605c2 100644 (file)
@@ -1,5 +1,6 @@
 
 #include "i915_sw_winsys.h"
+#include "i915_sw_public.h"
 #include "util/u_memory.h"
 
 
@@ -28,8 +29,8 @@ i915_sw_destroy(struct i915_winsys *iws)
  */
 
 
-struct pipe_screen *
-i915_sw_create_screen()
+struct i915_winsys *
+i915_sw_winsys_create()
 {
    struct i915_sw_winsys *isws;
    unsigned int deviceID;
@@ -51,6 +52,5 @@ i915_sw_create_screen()
 
    isws->dump_cmd = debug_get_bool_option("INTEL_DUMP_CMD", FALSE);
 
-   /* XXX so this will leak winsys:es */
-   return i915_screen_create(&isws->base);
+   return &isws->base;
 }
index b8aa9ef4ac506a1874233985994a9f995c458327..b7b43669f30674a5b4dfe8ba2c53c3f38d2af9d6 100644 (file)
@@ -25,7 +25,6 @@ i915_sw_winsys(struct i915_winsys *iws)
    return (struct i915_sw_winsys *)iws;
 }
 
-struct pipe_screen* i915_sw_create_screen(void);
 struct pipe_fence_handle * i915_sw_fence_create(void);
 
 void i915_sw_winsys_init_batchbuffer_functions(struct i915_sw_winsys *idws);