Mesa (gallium-drm-driver-descriptor): i915g: Move bootstrap code to targets

Jakob Bornecrantz wallbraker at kemper.freedesktop.org
Mon Jun 7 11:16:34 PDT 2010


Module: Mesa
Branch: gallium-drm-driver-descriptor
Commit: c7015877beedd9831402755dbc58afddcbbd5339
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c7015877beedd9831402755dbc58afddcbbd5339

Author: Jakob Bornecrantz <jakob at vmware.com>
Date:   Tue Jun  1 04:38:24 2010 +0100

i915g: Move bootstrap code to targets

---

 src/gallium/drivers/i915/i915_public.h        |   13 ++++++++++++
 src/gallium/drivers/i915/i915_screen.c        |    1 +
 src/gallium/drivers/i915/i915_winsys.h        |    7 ------
 src/gallium/targets/dri-i915/target.c         |   17 +++++++++++++-
 src/gallium/targets/egl-i915/target.c         |   17 +++++++++++++-
 src/gallium/targets/xorg-i915/intel_target.c  |   17 +++++++++++++-
 src/gallium/winsys/i915/drm/i915_drm_buffer.c |    2 +-
 src/gallium/winsys/i915/drm/i915_drm_public.h |    9 ++++++++
 src/gallium/winsys/i915/drm/i915_drm_winsys.c |   27 ++++--------------------
 src/gallium/winsys/i915/drm/i915_drm_winsys.h |    1 -
 src/gallium/winsys/i915/sw/i915_sw_public.h   |    9 ++++++++
 src/gallium/winsys/i915/sw/i915_sw_winsys.c   |    8 +++---
 src/gallium/winsys/i915/sw/i915_sw_winsys.h   |    1 -
 13 files changed, 87 insertions(+), 42 deletions(-)

diff --git a/src/gallium/drivers/i915/i915_public.h b/src/gallium/drivers/i915/i915_public.h
new file mode 100644
index 0000000..588654d
--- /dev/null
+++ b/src/gallium/drivers/i915/i915_public.h
@@ -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
diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c
index f824265..bb0b85d 100644
--- a/src/gallium/drivers/i915/i915_screen.c
+++ b/src/gallium/drivers/i915/i915_screen.c
@@ -36,6 +36,7 @@
 #include "i915_surface.h"
 #include "i915_resource.h"
 #include "i915_winsys.h"
+#include "i915_public.h"
 
 
 /*
diff --git a/src/gallium/drivers/i915/i915_winsys.h b/src/gallium/drivers/i915/i915_winsys.h
index 3aba19f..5385e40 100644
--- a/src/gallium/drivers/i915/i915_winsys.h
+++ b/src/gallium/drivers/i915/i915_winsys.h
@@ -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
diff --git a/src/gallium/targets/dri-i915/target.c b/src/gallium/targets/dri-i915/target.c
index 8fd7308..a79238f 100644
--- a/src/gallium/targets/dri-i915/target.c
+++ b/src/gallium/targets/dri-i915/target.c
@@ -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)
diff --git a/src/gallium/targets/egl-i915/target.c b/src/gallium/targets/egl-i915/target.c
index fd68c4b..2887716 100644
--- a/src/gallium/targets/egl-i915/target.c
+++ b/src/gallium/targets/egl-i915/target.c
@@ -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 *);
diff --git a/src/gallium/targets/xorg-i915/intel_target.c b/src/gallium/targets/xorg-i915/intel_target.c
index 4eff93c..a79238f 100644
--- a/src/gallium/targets/xorg-i915/intel_target.c
+++ b/src/gallium/targets/xorg-i915/intel_target.c
@@ -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)
diff --git a/src/gallium/winsys/i915/drm/i915_drm_buffer.c b/src/gallium/winsys/i915/drm/i915_drm_buffer.c
index 3bd8502..6b06e7a 100644
--- a/src/gallium/winsys/i915/drm/i915_drm_buffer.c
+++ b/src/gallium/winsys/i915/drm/i915_drm_buffer.c
@@ -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
index 0000000..b828d8d
--- /dev/null
+++ b/src/gallium/winsys/i915/drm/i915_drm_public.h
@@ -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
diff --git a/src/gallium/winsys/i915/drm/i915_drm_winsys.c b/src/gallium/winsys/i915/drm/i915_drm_winsys.c
index 5a6b45e..83651b4 100644
--- a/src/gallium/winsys/i915/drm/i915_drm_winsys.c
+++ b/src/gallium/winsys/i915/drm/i915_drm_winsys.c
@@ -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;
 }
diff --git a/src/gallium/winsys/i915/drm/i915_drm_winsys.h b/src/gallium/winsys/i915/drm/i915_drm_winsys.h
index 99667bd..1b93ddc 100644
--- a/src/gallium/winsys/i915/drm/i915_drm_winsys.h
+++ b/src/gallium/winsys/i915/drm/i915_drm_winsys.h
@@ -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
index 0000000..e951a32
--- /dev/null
+++ b/src/gallium/winsys/i915/sw/i915_sw_public.h
@@ -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
diff --git a/src/gallium/winsys/i915/sw/i915_sw_winsys.c b/src/gallium/winsys/i915/sw/i915_sw_winsys.c
index bb1c107..058ddc4 100644
--- a/src/gallium/winsys/i915/sw/i915_sw_winsys.c
+++ b/src/gallium/winsys/i915/sw/i915_sw_winsys.c
@@ -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;
 }
diff --git a/src/gallium/winsys/i915/sw/i915_sw_winsys.h b/src/gallium/winsys/i915/sw/i915_sw_winsys.h
index b8aa9ef..b7b4366 100644
--- a/src/gallium/winsys/i915/sw/i915_sw_winsys.h
+++ b/src/gallium/winsys/i915/sw/i915_sw_winsys.h
@@ -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);



More information about the mesa-commit mailing list