r600g: Move bootstrap code to target
authorJakob Bornecrantz <jakob@vmware.com>
Thu, 24 Jun 2010 00:10:18 +0000 (02:10 +0200)
committerJakob Bornecrantz <jakob@vmware.com>
Thu, 24 Jun 2010 00:15:50 +0000 (02:15 +0200)
src/gallium/drivers/r600/r600_buffer.c
src/gallium/drivers/r600/r600_public.h [new file with mode: 0644]
src/gallium/drivers/r600/r600_screen.c
src/gallium/drivers/r600/r600_texture.c
src/gallium/drivers/r600/radeon.h
src/gallium/targets/dri-r600/target.c
src/gallium/winsys/r600/drm/r600_drm.c
src/gallium/winsys/r600/drm/r600_drm_public.h [new file with mode: 0644]

index 272f4dd6730503a8f20f5098b28f46c5db1f1943..bc6e336ba7b016e69f8b2e52ca42d8d2d9b4f8a2 100644 (file)
@@ -29,7 +29,7 @@
 #include <util/u_math.h>
 #include <util/u_inlines.h>
 #include <util/u_memory.h>
-#include "state_tracker/drm_api.h"
+#include "state_tracker/drm_driver.h"
 #include "r600_screen.h"
 #include "r600_context.h"
 
diff --git a/src/gallium/drivers/r600/r600_public.h b/src/gallium/drivers/r600/r600_public.h
new file mode 100644 (file)
index 0000000..1d89c9f
--- /dev/null
@@ -0,0 +1,9 @@
+
+#ifndef R600_PUBLIC_H
+#define R600_PUBLIC_H
+
+struct radeon;
+
+struct pipe_screen* r600_screen_create(struct radeon *rw);
+
+#endif
index 1d83383fd95d79a17d3f6704804e65cb91afb533..20758b049c51c09f6674812c1880c93f7882ce6b 100644 (file)
@@ -31,6 +31,7 @@
 #include "r600_screen.h"
 #include "r600_texture.h"
 #include "r600_context.h"
+#include "r600_public.h"
 #include <stdio.h>
 
 static const char* r600_get_vendor(struct pipe_screen* pscreen)
@@ -240,7 +241,7 @@ static void r600_destroy_screen(struct pipe_screen* pscreen)
        FREE(rscreen);
 }
 
-struct pipe_screen *radeon_create_screen(struct radeon *rw)
+struct pipe_screen *r600_screen_create(struct radeon *rw)
 {
        struct r600_screen* rscreen;
 
index 7d94bbe510f4a1bb5e264e6e608c02328abc3a14..903cfad80a87a2e5817af263f459b267d8f87609 100644 (file)
@@ -29,7 +29,7 @@
 #include <util/u_math.h>
 #include <util/u_inlines.h>
 #include <util/u_memory.h>
-#include "state_tracker/drm_api.h"
+#include "state_tracker/drm_driver.h"
 #include "r600_screen.h"
 #include "r600_texture.h"
 
index ec94b112d69539e12bb1f64392887d8e6eda8fe0..2a82aadd8ce48f2a9207e74d5857670bf241c7eb 100644 (file)
@@ -28,8 +28,6 @@ typedef uint8_t                       u8;
 
 struct radeon;
 
-struct pipe_screen *radeon_create_screen(struct radeon *rw);
-
 enum radeon_family {
        CHIP_UNKNOWN,
        CHIP_R100,
index 3f09a7c5a9232cf203aafb5960a57916933f0ce5..40ad8a09ca87202f7cdc944a75352f53a1ddb780 100644 (file)
@@ -1,4 +1,23 @@
 
-#include "target-helpers/drm_api_compat.h"
+#include "state_tracker/drm_driver.h"
+#include "r600/drm/r600_drm_public.h"
+#include "r600/r600_public.h"
 
-DRM_API_COMPAT_STRUCT("r600", "radeon")
+static struct pipe_screen *
+create_screen(int fd)
+{
+   struct radeon *rw;
+   struct pipe_screen *screen;
+
+   rw = r600_drm_winsys_create(fd);
+   if (!rw)
+      return NULL;
+
+   screen = r600_screen_create(rw);
+   if (!screen)
+      return NULL;
+
+   return screen;
+}
+
+DRM_DRIVER_DESCRIPTOR("r600", "radeon", create_screen)
index b772ff0dd9f107c86d5b9596b62bbddc39b27a5a..469f1446d051af86e87c5694fea4df301bb72c5d 100644 (file)
  *      Joakim Sindholt <opensource@zhasha.com>
  */
 #include <sys/ioctl.h>
-#include "trace/tr_drm.h"
 #include "util/u_inlines.h"
 #include "util/u_debug.h"
-#include "state_tracker/drm_api.h"
 #include "radeon_priv.h"
 #include "r600_screen.h"
 #include "r600_texture.h"
+#include "r600_public.h"
+#include "r600_drm_public.h"
+#include "state_tracker/drm_driver.h"
 
-static struct pipe_screen *r600_drm_create_screen(struct drm_api* api, int drmfd)
+struct radeon *r600_drm_winsys_create(int drmfd)
 {
-       struct radeon *rw = radeon_new(drmfd, 0);
-
-       if (rw == NULL)
-               return NULL;
-       return radeon_create_screen(rw);
+       return radeon_new(drmfd, 0);
 }
 
 boolean r600_buffer_get_handle(struct radeon *rw,
@@ -63,24 +60,3 @@ boolean r600_buffer_get_handle(struct radeon *rw,
        whandle->handle = rbuffer->flink;
        return TRUE;
 }
-
-static void r600_drm_api_destroy(struct drm_api *api)
-{
-       return;
-}
-
-struct drm_api drm_api_hooks = {
-       .name = "r600",
-       .driver_name = "r600",
-       .create_screen = r600_drm_create_screen,
-       .destroy = r600_drm_api_destroy,
-};
-
-struct drm_api* drm_api_create()
-{
-#ifdef DEBUG
-       return trace_drm_create(&drm_api_hooks);
-#else
-       return &drm_api_hooks;
-#endif
-}
diff --git a/src/gallium/winsys/r600/drm/r600_drm_public.h b/src/gallium/winsys/r600/drm/r600_drm_public.h
new file mode 100644 (file)
index 0000000..84f2dce
--- /dev/null
@@ -0,0 +1,9 @@
+
+#ifndef R600_DRM_PUBLIC_H
+#define R600_DRM_PUBLIC_H
+
+struct radeon;
+
+struct radeon *r600_drm_winsys_create(int drmFD);
+
+#endif