i965g: Move bootstrap code to targets
authorJakob Bornecrantz <jakob@vmware.com>
Fri, 18 Jun 2010 17:07:26 +0000 (19:07 +0200)
committerJakob Bornecrantz <jakob@vmware.com>
Wed, 23 Jun 2010 01:43:48 +0000 (03:43 +0200)
13 files changed:
src/gallium/drivers/i965/brw_public.h [new file with mode: 0644]
src/gallium/drivers/i965/brw_screen.c
src/gallium/drivers/i965/brw_winsys.h
src/gallium/targets/dri-i965/Makefile
src/gallium/targets/dri-i965/SConscript
src/gallium/targets/dri-i965/target.c
src/gallium/targets/egl-i965/Makefile
src/gallium/targets/egl-i965/target.c
src/gallium/targets/xorg-i965/Makefile
src/gallium/targets/xorg-i965/intel_target.c
src/gallium/winsys/i965/drm/i965_drm_public.h [new file with mode: 0644]
src/gallium/winsys/i965/drm/i965_drm_winsys.c
src/gallium/winsys/i965/drm/i965_drm_winsys.h

diff --git a/src/gallium/drivers/i965/brw_public.h b/src/gallium/drivers/i965/brw_public.h
new file mode 100644 (file)
index 0000000..be2cd6b
--- /dev/null
@@ -0,0 +1,13 @@
+
+#ifndef BRW_PUBLIC_H
+#define BRW_PUBLIC_H
+
+struct brw_winsys_screen;
+struct pipe_screen;
+
+/**
+ * Create brw AKA i965 pipe_screen.
+ */
+struct pipe_screen * brw_screen_create(struct brw_winsys_screen *bws);
+
+#endif
index eb75427eb42fe030a0d2d06de525093c746fb783..bdfead73cc87b7e39f722ea20d34886e82b7720e 100644 (file)
@@ -34,6 +34,7 @@
 #include "brw_context.h"
 #include "brw_screen.h"
 #include "brw_winsys.h"
+#include "brw_public.h"
 #include "brw_debug.h"
 #include "brw_resource.h"
 
@@ -350,7 +351,7 @@ brw_destroy_screen(struct pipe_screen *screen)
  * Create a new brw_screen object
  */
 struct pipe_screen *
-brw_create_screen(struct brw_winsys_screen *sws)
+brw_screen_create(struct brw_winsys_screen *sws)
 {
    struct brw_screen *bscreen;
    struct brw_chipset chipset;
index adb0006c38264621a5c232110bcb72f7e307d5d1..a06f8bb7d6140d9e1d61111d4ea927d752355143 100644 (file)
@@ -262,12 +262,6 @@ bo_reference(struct brw_winsys_buffer **ptr, struct brw_winsys_buffer *buf)
 }
 
 
-/**
- * Create brw pipe_screen.
- */
-struct pipe_screen *brw_create_screen(struct brw_winsys_screen *iws);
-
-
 
 /*************************************************************************
  * Cooperative dumping between winsys and driver.  TODO: make this
index b068430ecf77ba6c4ff180609ed93959a5ede9d5..76350caf9d7cb0b968e3d1d37c58b4dd52336c45 100644 (file)
@@ -8,10 +8,8 @@ PIPE_DRIVERS = \
        $(TOP)/src/gallium/winsys/i965/drm/libi965drm.a \
        $(TOP)/src/gallium/drivers/trace/libtrace.a \
        $(TOP)/src/gallium/drivers/rbug/librbug.a \
-       $(TOP)/src/gallium/winsys/sw/drm/libswdrm.a \
        $(TOP)/src/gallium/winsys/sw/wrapper/libwsw.a \
        $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
-       $(TOP)/src/gallium/drivers/identity/libidentity.a \
        $(TOP)/src/gallium/drivers/i965/libi965.a
 
 C_SOURCES = \
@@ -19,6 +17,9 @@ C_SOURCES = \
        $(COMMON_GALLIUM_SOURCES) \
        $(DRIVER_SOURCES)
 
+DRIVER_DEFINES = \
+       -DGALLIUM_SOFTPIPE
+
 include ../Makefile.dri
 
 DRI_LIB_DEPS += -ldrm_intel
index 9e12c61aabc7fc10d9a5e422a98f29389cbe2990..da1a8654a8699c847bf7b6955777f89ed654f556 100644 (file)
@@ -8,6 +8,8 @@ env = drienv.Clone()
 
 env.ParseConfig('pkg-config --cflags --libs libdrm_intel')
 
+env.Append(CPPDEFINES = 'GALLIUM_SOFTPIPE')
+
 env.Prepend(LIBS = [
     st_dri,
     i965drm,
index 9fe2227edd7be239e7993253bdae07b6cbfe96bb..36424c60a119a51427023901b622baa2e596e676 100644 (file)
@@ -1,4 +1,27 @@
 
-#include "target-helpers/drm_api_compat.h"
+#include "target-helpers/inline_wrapper_sw_helper.h"
+#include "state_tracker/drm_driver.h"
+#include "i965/drm/i965_drm_public.h"
+#include "i965/brw_public.h"
 
-DRM_API_COMPAT_STRUCT("i965", "i915")
+static struct pipe_screen *
+create_screen(int fd)
+{
+   struct brw_winsys_screen *bws;
+   struct pipe_screen *screen;
+
+   bws = i965_drm_winsys_screen_create(fd);
+   if (!bws)
+      return NULL;
+
+   screen = brw_screen_create(bws);
+   if (!screen)
+      return NULL;
+
+   if (debug_get_bool_option("BRW_SOFTPIPE", FALSE))
+      screen = sw_screen_wrap(screen);
+
+   return screen;
+}
+
+DRM_DRIVER_DESCRIPTOR("i915", "i965", create_screen)
index 542200481d17a67a9ac1d95b506742b4a0cecaeb..fe3091190c1f4052964e830aad694d90034e25ef 100644 (file)
@@ -5,12 +5,14 @@ EGL_DRIVER_NAME = i965
 EGL_DRIVER_SOURCES = target.c
 EGL_DRIVER_LIBS = -ldrm_intel
 
+EGL_DRIVER_DEFINES = \
+       -DGALLIUM_SOFTPIPE
+
 EGL_DRIVER_PIPES = \
        $(TOP)/src/gallium/winsys/i965/drm/libi965drm.a \
        $(TOP)/src/gallium/drivers/trace/libtrace.a \
        $(TOP)/src/gallium/drivers/rbug/librbug.a \
        $(TOP)/src/gallium/drivers/i965/libi965.a \
-       $(TOP)/src/gallium/winsys/sw/drm/libswdrm.a \
        $(TOP)/src/gallium/winsys/sw/wrapper/libwsw.a \
        $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a
 
index 2f97bcecf2e71b2842fb73a741649aca6eed5e37..ba1eeadd214c29c77c6187d0ad28b6f5ae133b57 100644 (file)
@@ -1,7 +1,30 @@
 
-#include "target-helpers/drm_api_compat.h"
+#include "target-helpers/inline_wrapper_sw_helper.h"
+#include "state_tracker/drm_driver.h"
+#include "i965/drm/i965_drm_public.h"
+#include "i965/brw_public.h"
 
-DRM_API_COMPAT_STRUCT("i965", "i915")
+static struct pipe_screen *
+create_screen(int fd)
+{
+   struct brw_winsys_screen *bws;
+   struct pipe_screen *screen;
+
+   bws = i965_drm_winsys_screen_create(fd);
+   if (!bws)
+      return NULL;
+
+   screen = brw_screen_create(bws);
+   if (!screen)
+      return NULL;
+
+   if (debug_get_bool_option("BRW_SOFTPIPE", FALSE))
+      screen = sw_screen_wrap(screen);
+
+   return screen;
+}
+
+DRM_DRIVER_DESCRIPTOR("i915", "i965", create_screen)
 
 /* A poor man's --whole-archive for EGL drivers */
 void *_eglMain(void *);
index b23a2deab991b53196c99df9a0300e3ff97fc21f..eede9f23254c0faf8b648d0fe2bd9b58ab661a33 100644 (file)
@@ -8,7 +8,7 @@ C_SOURCES = \
        intel_xorg.c
 
 DRIVER_DEFINES = \
-       -DHAVE_CONFIG_H
+       -DHAVE_CONFIG_H -DGALLIUM_SOFTPIPE
 
 DRIVER_LINKS = \
        $(TOP)/src/gallium/state_trackers/xorg/libxorgtracker.a \
@@ -16,6 +16,7 @@ DRIVER_LINKS = \
        $(TOP)/src/gallium/drivers/i965/libi965.a \
        $(TOP)/src/gallium/drivers/trace/libtrace.a \
        $(TOP)/src/gallium/drivers/rbug/librbug.a \
+       $(TOP)/src/gallium/winsys/sw/wrapper/libwsw.a \
        $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
        $(GALLIUM_AUXILIARIES) \
        $(shell pkg-config --libs libdrm libdrm_intel)
index 2b0f5458771d116eb749e992d58f37a7407a2050..36424c60a119a51427023901b622baa2e596e676 100644 (file)
@@ -1,4 +1,27 @@
 
-#include "target-helpers/drm_api_compat.h"
+#include "target-helpers/inline_wrapper_sw_helper.h"
+#include "state_tracker/drm_driver.h"
+#include "i965/drm/i965_drm_public.h"
+#include "i965/brw_public.h"
 
-DRM_API_COMPAT_STRUCT("i965g", "i915")
+static struct pipe_screen *
+create_screen(int fd)
+{
+   struct brw_winsys_screen *bws;
+   struct pipe_screen *screen;
+
+   bws = i965_drm_winsys_screen_create(fd);
+   if (!bws)
+      return NULL;
+
+   screen = brw_screen_create(bws);
+   if (!screen)
+      return NULL;
+
+   if (debug_get_bool_option("BRW_SOFTPIPE", FALSE))
+      screen = sw_screen_wrap(screen);
+
+   return screen;
+}
+
+DRM_DRIVER_DESCRIPTOR("i915", "i965", create_screen)
diff --git a/src/gallium/winsys/i965/drm/i965_drm_public.h b/src/gallium/winsys/i965/drm/i965_drm_public.h
new file mode 100644 (file)
index 0000000..2913b07
--- /dev/null
@@ -0,0 +1,9 @@
+
+#ifndef I965_DRM_PUBLIC_H
+#define I965_DRM_PUBLIC_H
+
+struct brw_winsys_screen;
+
+struct brw_winsys_screen * i965_drm_winsys_screen_create(int drmFD);
+
+#endif
index 124dc26606b3ebc13bf316f15d59fdd0baf973d8..dfb366043953da40b149b3fa1770cbb5aad54d0b 100644 (file)
@@ -3,15 +3,9 @@
 #include "state_tracker/drm_api.h"
 
 #include "i965_drm_winsys.h"
+#include "i965_drm_public.h"
 #include "util/u_memory.h"
 
-#include "i965/brw_context.h"        /* XXX: shouldn't be doing this */
-#include "i965/brw_screen.h"         /* XXX: shouldn't be doing this */
-
-#include "trace/tr_drm.h"
-
-#include "../../sw/drm/sw_drm_api.h"
-
 /*
  * Helper functions
  */
@@ -52,8 +46,8 @@ i965_libdrm_winsys_destroy(struct brw_winsys_screen *iws)
    FREE(idws);
 }
 
-static struct pipe_screen *
-i965_libdrm_create_screen(struct drm_api *api, int drmFD)
+struct brw_winsys_screen *
+i965_drm_winsys_screen_create(int drmFD)
 {
    struct i965_libdrm_winsys *idws;
 
@@ -76,27 +70,5 @@ i965_libdrm_create_screen(struct drm_api *api, int drmFD)
 
    idws->send_cmd = !debug_get_bool_option("BRW_NO_HW", FALSE);
 
-   return brw_create_screen(&idws->base);
-}
-
-struct drm_api i965_libdrm_api =
-{
-   .name = "i965",
-   .driver_name = "i915",
-   .create_screen = i965_libdrm_create_screen,
-   .destroy = NULL,
-};
-
-struct drm_api *
-drm_api_create()
-{
-   struct drm_api *api = NULL;
-
-   if (api == NULL && debug_get_bool_option("BRW_SOFTPIPE", FALSE))
-      api = sw_drm_api_create(&i965_libdrm_api);
-
-   if (api == NULL)
-      api = &i965_libdrm_api;
-
-   return trace_drm_create(api);
+   return &idws->base;
 }
index 3856e1c87f0f1a8456f571d04eeb0a4b08ea76e0..82dbe61cc5122abc9e77d1aaffad30d660bea89f 100644 (file)
@@ -30,8 +30,6 @@ i965_libdrm_winsys(struct brw_winsys_screen *iws)
    return (struct i965_libdrm_winsys *)iws;
 }
 
-struct i965_libdrm_winsys *i965_libdrm_winsys_create(int fd, unsigned pci_id);
-
 void i965_libdrm_winsys_init_buffer_functions(struct i965_libdrm_winsys *idws);