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

Jakob Bornecrantz wallbraker at kemper.freedesktop.org
Wed Jun 23 17:20:41 PDT 2010


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

Author: Jakob Bornecrantz <jakob at vmware.com>
Date:   Wed Jun 23 23:03:28 2010 +0200

nouveau: Move bootstrap code to targets

Well sorta, at least I removed the drm_api dependancy and the
target can layer anything it wants to now.

---

 src/gallium/targets/dri-nouveau/target.c           |   17 +++++++++++++++--
 src/gallium/targets/egl-nouveau/target.c           |   17 +++++++++++++++--
 src/gallium/targets/xorg-nouveau/nouveau_target.c  |   17 +++++++++++++++--
 .../winsys/nouveau/drm/nouveau_drm_public.h        |    9 +++++++++
 .../winsys/nouveau/drm/nouveau_drm_winsys.c        |   18 +++---------------
 .../winsys/nouveau/drm/nouveau_drm_winsys.h        |    2 --
 6 files changed, 57 insertions(+), 23 deletions(-)

diff --git a/src/gallium/targets/dri-nouveau/target.c b/src/gallium/targets/dri-nouveau/target.c
index e16e86c..ca3ec53 100644
--- a/src/gallium/targets/dri-nouveau/target.c
+++ b/src/gallium/targets/dri-nouveau/target.c
@@ -1,4 +1,17 @@
 
-#include "target-helpers/drm_api_compat.h"
+#include "state_tracker/drm_driver.h"
+#include "nouveau/drm/nouveau_drm_public.h"
 
-DRM_API_COMPAT_STRUCT("nouveau", "nouveau")
+static struct pipe_screen *
+create_screen(int fd)
+{
+   struct pipe_screen *screen;
+
+   screen = nouveau_drm_screen_create(fd);
+   if (!screen)
+      return NULL;
+
+   return screen;
+}
+
+DRM_DRIVER_DESCRIPTOR("nouveau", "nouveau", create_screen)
diff --git a/src/gallium/targets/egl-nouveau/target.c b/src/gallium/targets/egl-nouveau/target.c
index 49545c6..7d0b141 100644
--- a/src/gallium/targets/egl-nouveau/target.c
+++ b/src/gallium/targets/egl-nouveau/target.c
@@ -1,7 +1,20 @@
 
-#include "target-helpers/drm_api_compat.h"
+#include "state_tracker/drm_driver.h"
+#include "nouveau/drm/nouveau_drm_public.h"
 
-DRM_API_COMPAT_STRUCT("nouveau", "nouveau")
+static struct pipe_screen *
+create_screen(int fd)
+{
+   struct pipe_screen *screen;
+
+   screen = nouveau_drm_screen_create(fd);
+   if (!screen)
+      return NULL;
+
+   return screen;
+}
+
+DRM_DRIVER_DESCRIPTOR("nouveau", "nouveau", create_screen)
 
 /* A poor man's --whole-archive for EGL drivers */
 void *_eglMain(void *);
diff --git a/src/gallium/targets/xorg-nouveau/nouveau_target.c b/src/gallium/targets/xorg-nouveau/nouveau_target.c
index e16e86c..ca3ec53 100644
--- a/src/gallium/targets/xorg-nouveau/nouveau_target.c
+++ b/src/gallium/targets/xorg-nouveau/nouveau_target.c
@@ -1,4 +1,17 @@
 
-#include "target-helpers/drm_api_compat.h"
+#include "state_tracker/drm_driver.h"
+#include "nouveau/drm/nouveau_drm_public.h"
 
-DRM_API_COMPAT_STRUCT("nouveau", "nouveau")
+static struct pipe_screen *
+create_screen(int fd)
+{
+   struct pipe_screen *screen;
+
+   screen = nouveau_drm_screen_create(fd);
+   if (!screen)
+      return NULL;
+
+   return screen;
+}
+
+DRM_DRIVER_DESCRIPTOR("nouveau", "nouveau", create_screen)
diff --git a/src/gallium/winsys/nouveau/drm/nouveau_drm_public.h b/src/gallium/winsys/nouveau/drm/nouveau_drm_public.h
new file mode 100644
index 0000000..67b7c44
--- /dev/null
+++ b/src/gallium/winsys/nouveau/drm/nouveau_drm_public.h
@@ -0,0 +1,9 @@
+
+#ifndef __NOUVEAU_DRM_PUBLIC_H__
+#define __NOUVEAU_DRM_PUBLIC_H__
+
+struct pipe_screen;
+
+struct pipe_screen *nouveau_drm_screen_create(int drmFD);
+
+#endif
diff --git a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c
index 418f1d7..660dbd0 100644
--- a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c
+++ b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c
@@ -5,6 +5,7 @@
 #include "util/u_inlines.h"
 
 #include "nouveau_drm_winsys.h"
+#include "nouveau_drm_public.h"
 
 #include "nouveau_drmif.h"
 #include "nouveau_channel.h"
@@ -22,8 +23,8 @@ nouveau_drm_destroy_winsys(struct pipe_winsys *s)
 	FREE(nv_winsys);
 }
 
-static struct pipe_screen *
-nouveau_drm_create_screen(struct drm_api *api, int fd)
+struct pipe_screen *
+nouveau_drm_screen_create(int fd)
 {
 	struct nouveau_winsys *nvws;
 	struct pipe_winsys *ws;
@@ -70,16 +71,3 @@ nouveau_drm_create_screen(struct drm_api *api, int fd)
 
 	return nvws->pscreen;
 }
-
-static struct drm_api nouveau_drm_api_hooks = {
-	.name = "nouveau",
-	.driver_name = "nouveau",
-	.create_screen = nouveau_drm_create_screen,
-	.destroy = NULL,
-};
-
-struct drm_api *
-drm_api_create() {
-	return &nouveau_drm_api_hooks;
-}
-
diff --git a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.h b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.h
index ae3ab17..9e529ec 100644
--- a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.h
+++ b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.h
@@ -1,8 +1,6 @@
 #ifndef __NOUVEAU_DRM_WINSYS_H__
 #define __NOUVEAU_DRM_WINSYS_H__
 
-#include "state_tracker/drm_api.h"
-
 #include "util/u_simple_screen.h"
 
 #include "nouveau_dri.h"



More information about the mesa-commit mailing list