summaryrefslogtreecommitdiff
path: root/src/gallium/winsys
diff options
context:
space:
mode:
authorJakob Bornecrantz <jakob@vmware.com>2010-06-28 20:59:09 +0200
committerJakob Bornecrantz <jakob@vmware.com>2010-06-28 21:14:45 +0200
commita01e0afd9fc0d647081c6903baa1a7ba505c4b05 (patch)
tree7e04eb2b4e87137455920f6131b064dc87056e14 /src/gallium/winsys
parent250b92f3bb4fc4a53f3150b0e8ff1e121a5adbc7 (diff)
parent9ca563a9a8573bf79821abc75ccf0fdade19c8a9 (diff)
Merge branch 'gallium-drm-driver-drescriptor'
Conflicts: src/gallium/state_trackers/egl/x11/native_dri2.c src/gallium/state_trackers/egl/x11/native_x11.c src/gallium/state_trackers/egl/x11/native_x11.h src/gallium/state_trackers/xorg/xorg_driver.c src/gallium/winsys/radeon/drm/radeon_drm.c
Diffstat (limited to 'src/gallium/winsys')
-rw-r--r--src/gallium/winsys/SConscript1
-rw-r--r--src/gallium/winsys/i915/drm/i915_drm_buffer.c2
-rw-r--r--src/gallium/winsys/i915/drm/i915_drm_public.h9
-rw-r--r--src/gallium/winsys/i915/drm/i915_drm_winsys.c27
-rw-r--r--src/gallium/winsys/i915/drm/i915_drm_winsys.h1
-rw-r--r--src/gallium/winsys/i915/sw/i915_sw_public.h9
-rw-r--r--src/gallium/winsys/i915/sw/i915_sw_winsys.c8
-rw-r--r--src/gallium/winsys/i915/sw/i915_sw_winsys.h1
-rw-r--r--src/gallium/winsys/i965/drm/Makefile2
-rw-r--r--src/gallium/winsys/i965/drm/SConscript2
-rw-r--r--src/gallium/winsys/i965/drm/i965_drm_buffer.c6
-rw-r--r--src/gallium/winsys/i965/drm/i965_drm_public.h9
-rw-r--r--src/gallium/winsys/i965/drm/i965_drm_winsys.c (renamed from src/gallium/winsys/i965/drm/i965_drm_api.c)42
-rw-r--r--src/gallium/winsys/i965/drm/i965_drm_winsys.h4
-rw-r--r--src/gallium/winsys/i965/xlib/xlib_i965.c3
-rw-r--r--src/gallium/winsys/nouveau/drm/Makefile2
-rw-r--r--src/gallium/winsys/nouveau/drm/nouveau_drm_public.h9
-rw-r--r--src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c (renamed from src/gallium/winsys/nouveau/drm/nouveau_drm_api.c)20
-rw-r--r--src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.h (renamed from src/gallium/winsys/nouveau/drm/nouveau_drm_api.h)6
-rw-r--r--src/gallium/winsys/r600/drm/r600_drm.c34
-rw-r--r--src/gallium/winsys/r600/drm/r600_drm_public.h9
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_drm.c20
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_drm.h7
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_drm_public.h9
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_r300.c2
-rw-r--r--src/gallium/winsys/svga/drm/svga_drm_public.h (renamed from src/gallium/winsys/sw/drm/sw_drm_api.h)17
-rw-r--r--src/gallium/winsys/svga/drm/vmw_screen_dri.c39
-rw-r--r--src/gallium/winsys/sw/drm/Makefile12
-rw-r--r--src/gallium/winsys/sw/drm/SConscript21
-rw-r--r--src/gallium/winsys/sw/drm/sw_drm_api.c103
30 files changed, 114 insertions, 322 deletions
diff --git a/src/gallium/winsys/SConscript b/src/gallium/winsys/SConscript
index 907ac90bf0..65b12287df 100644
--- a/src/gallium/winsys/SConscript
+++ b/src/gallium/winsys/SConscript
@@ -17,7 +17,6 @@ if 'gdi' in env['winsys']:
if env['dri']:
SConscript([
- 'sw/drm/SConscript',
'sw/dri/SConscript',
])
diff --git a/src/gallium/winsys/i915/drm/i915_drm_buffer.c b/src/gallium/winsys/i915/drm/i915_drm_buffer.c
index 3bd85026b2..6b06e7ae99 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 0000000000..b828d8d670
--- /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 5a6b45e6c9..83651b4c47 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 99667bde4e..1b93ddc734 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 0000000000..e951a32917
--- /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 bb1c107c05..058ddc44aa 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 b8aa9ef4ac..b7b43669f3 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);
diff --git a/src/gallium/winsys/i965/drm/Makefile b/src/gallium/winsys/i965/drm/Makefile
index bbb71e25d8..46f98d7a24 100644
--- a/src/gallium/winsys/i965/drm/Makefile
+++ b/src/gallium/winsys/i965/drm/Makefile
@@ -5,7 +5,7 @@ LIBNAME = i965drm
C_SOURCES = \
i965_drm_buffer.c \
- i965_drm_api.c
+ i965_drm_winsys.c
LIBRARY_INCLUDES = $(shell pkg-config libdrm --cflags-only-I)
diff --git a/src/gallium/winsys/i965/drm/SConscript b/src/gallium/winsys/i965/drm/SConscript
index abf9aac5c0..785be449f7 100644
--- a/src/gallium/winsys/i965/drm/SConscript
+++ b/src/gallium/winsys/i965/drm/SConscript
@@ -5,8 +5,8 @@ env = env.Clone()
env.ParseConfig('pkg-config --cflags libdrm')
i965drm_sources = [
- 'i965_drm_api.c',
'i965_drm_buffer.c',
+ 'i965_drm_winsys.c',
]
i965drm = env.ConvenienceLibrary(
diff --git a/src/gallium/winsys/i965/drm/i965_drm_buffer.c b/src/gallium/winsys/i965/drm/i965_drm_buffer.c
index fb5e50ce81..ed62db60bb 100644
--- a/src/gallium/winsys/i965/drm/i965_drm_buffer.c
+++ b/src/gallium/winsys/i965/drm/i965_drm_buffer.c
@@ -1,5 +1,5 @@
-#include "state_tracker/drm_api.h"
+#include "state_tracker/drm_driver.h"
#include "i965_drm_winsys.h"
#include "util/u_memory.h"
#include "util/u_inlines.h"
@@ -322,7 +322,7 @@ i965_libdrm_bo_subdata(struct brw_winsys_buffer *buffer,
nr_reloc);
if (BRW_DUMP)
- brw_dump_data( idws->id,
+ brw_dump_data( idws->base.pci_id,
data_type,
buf->bo->offset + offset,
data, size );
@@ -460,7 +460,7 @@ i965_libdrm_bo_flush_range(struct brw_winsys_buffer *buffer,
offset, length);
if (BRW_DUMP)
- brw_dump_data( idws->id,
+ brw_dump_data( idws->base.pci_id,
buf->data_type,
buf->bo->offset + offset,
(char*)buf->bo->virtual + offset,
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
index 0000000000..2913b07974
--- /dev/null
+++ b/src/gallium/winsys/i965/drm/i965_drm_public.h
@@ -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
diff --git a/src/gallium/winsys/i965/drm/i965_drm_api.c b/src/gallium/winsys/i965/drm/i965_drm_winsys.c
index 87ee8070b1..b08e622db9 100644
--- a/src/gallium/winsys/i965/drm/i965_drm_api.c
+++ b/src/gallium/winsys/i965/drm/i965_drm_winsys.c
@@ -1,17 +1,11 @@
#include <stdio.h>
-#include "state_tracker/drm_api.h"
+#include "state_tracker/drm_driver.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,11 +46,10 @@ 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;
- unsigned int deviceID;
debug_printf("%s\n", __FUNCTION__);
@@ -64,12 +57,11 @@ i965_libdrm_create_screen(struct drm_api *api, int drmFD)
if (!idws)
return NULL;
- i965_libdrm_get_device_id(&deviceID);
+ i965_libdrm_get_device_id(&idws->base.pci_id);
i965_libdrm_winsys_init_buffer_functions(idws);
idws->fd = drmFD;
- idws->id = deviceID;
idws->base.destroy = i965_libdrm_winsys_destroy;
@@ -78,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, deviceID);
-}
-
-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;
}
diff --git a/src/gallium/winsys/i965/drm/i965_drm_winsys.h b/src/gallium/winsys/i965/drm/i965_drm_winsys.h
index c6a7d4a8c5..82dbe61cc5 100644
--- a/src/gallium/winsys/i965/drm/i965_drm_winsys.h
+++ b/src/gallium/winsys/i965/drm/i965_drm_winsys.h
@@ -22,8 +22,6 @@ struct i965_libdrm_winsys
boolean send_cmd;
int fd; /**< Drm file discriptor */
-
- unsigned id;
};
static INLINE struct i965_libdrm_winsys *
@@ -32,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);
diff --git a/src/gallium/winsys/i965/xlib/xlib_i965.c b/src/gallium/winsys/i965/xlib/xlib_i965.c
index 063e9f600b..baadd6e89c 100644
--- a/src/gallium/winsys/i965/xlib/xlib_i965.c
+++ b/src/gallium/winsys/i965/xlib/xlib_i965.c
@@ -395,6 +395,7 @@ xlib_create_brw_winsys_screen( void )
return NULL;
ws->used = 0;
+ ws->base.pci_id = PCI_CHIP_GM45_GM;
ws->base.destroy = xlib_brw_winsys_destroy;
ws->base.bo_alloc = xlib_brw_bo_alloc;
@@ -452,7 +453,7 @@ xlib_create_i965_screen( void )
if (winsys == NULL)
return NULL;
- screen = brw_create_screen(winsys, PCI_CHIP_GM45_GM);
+ screen = brw_create_screen(winsys);
if (screen == NULL)
goto fail;
diff --git a/src/gallium/winsys/nouveau/drm/Makefile b/src/gallium/winsys/nouveau/drm/Makefile
index 71029858f7..74a3c6a0d7 100644
--- a/src/gallium/winsys/nouveau/drm/Makefile
+++ b/src/gallium/winsys/nouveau/drm/Makefile
@@ -3,7 +3,7 @@ include $(TOP)/configs/current
LIBNAME = nouveaudrm
-C_SOURCES = nouveau_drm_api.c
+C_SOURCES = nouveau_drm_winsys.c
LIBRARY_INCLUDES = $(shell pkg-config libdrm libdrm_nouveau --cflags-only-I)
LIBRARY_DEFINES = $(shell pkg-config libdrm libdrm_nouveau --cflags-only-other)
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 0000000000..67b7c4429d
--- /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_api.c b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c
index 2f24431462..660dbd0c33 100644
--- a/src/gallium/winsys/nouveau/drm/nouveau_drm_api.c
+++ b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c
@@ -4,7 +4,8 @@
#include "util/u_memory.h"
#include "util/u_inlines.h"
-#include "nouveau_drm_api.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_api.h b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.h
index ba6305c17e..9e529ecad3 100644
--- a/src/gallium/winsys/nouveau/drm/nouveau_drm_api.h
+++ b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.h
@@ -1,7 +1,5 @@
-#ifndef __NOUVEAU_DRM_API_H__
-#define __NOUVEAU_DRM_API_H__
-
-#include "state_tracker/drm_api.h"
+#ifndef __NOUVEAU_DRM_WINSYS_H__
+#define __NOUVEAU_DRM_WINSYS_H__
#include "util/u_simple_screen.h"
diff --git a/src/gallium/winsys/r600/drm/r600_drm.c b/src/gallium/winsys/r600/drm/r600_drm.c
index 803049d58c..3d87a994c1 100644
--- a/src/gallium/winsys/r600/drm/r600_drm.c
+++ b/src/gallium/winsys/r600/drm/r600_drm.c
@@ -26,21 +26,18 @@
* 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,
@@ -66,24 +63,3 @@ boolean r600_buffer_get_handle(struct radeon *rw,
}
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
index 0000000000..84f2dce437
--- /dev/null
+++ b/src/gallium/winsys/r600/drm/r600_drm_public.h
@@ -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
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm.c b/src/gallium/winsys/radeon/drm/radeon_drm.c
index a9ae09cb60..e9a276362f 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm.c
@@ -32,12 +32,10 @@
#include "radeon_drm.h"
#include "radeon_r300.h"
#include "radeon_buffer.h"
+#include "radeon_drm_public.h"
#include "r300_winsys.h"
-#include "galahad/glhd_drm.h"
-#include "trace/tr_drm.h"
-
#include "util/u_memory.h"
#include "xf86drm.h"
@@ -155,7 +153,7 @@ static void do_ioctls(int fd, struct radeon_libdrm_winsys* winsys)
}
/* Create a pipe_screen. */
-struct pipe_screen* radeon_create_screen(struct drm_api* api, int drmFB)
+struct r300_winsys_screen* r300_drm_winsys_screen_create(int drmFB)
{
struct radeon_libdrm_winsys* rws;
boolean ret;
@@ -173,22 +171,10 @@ struct pipe_screen* radeon_create_screen(struct drm_api* api, int drmFB)
ret = radeon_setup_winsys(drmFB, rws);
if (ret == FALSE)
goto fail;
- return r300_create_screen(&rws->base);
+ return &rws->base;
}
fail:
FREE(rws);
return NULL;
}
-
-static struct drm_api radeon_drm_api_hooks = {
- .name = "radeon",
- .driver_name = "radeon",
- .create_screen = radeon_create_screen,
- .destroy = NULL,
-};
-
-struct drm_api* drm_api_create()
-{
- return galahad_drm_create(trace_drm_create(&radeon_drm_api_hooks));
-}
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm.h b/src/gallium/winsys/radeon/drm/radeon_drm.h
index 3544c926d9..df6dd91ad5 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm.h
+++ b/src/gallium/winsys/radeon/drm/radeon_drm.h
@@ -30,12 +30,7 @@
#ifndef RADEON_DRM_H
#define RADEON_DRM_H
-#include "state_tracker/drm_api.h"
-
-
-struct pipe_screen* radeon_create_screen(struct drm_api* api, int drmFB);
-
-void radeon_destroy_drm_api(struct drm_api* api);
+#include "state_tracker/drm_driver.h"
/* Guess at whether this chipset should use r300g.
*
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_public.h b/src/gallium/winsys/radeon/drm/radeon_drm_public.h
new file mode 100644
index 0000000000..0d96ae8c47
--- /dev/null
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_public.h
@@ -0,0 +1,9 @@
+
+#ifndef RADEON_DRM_PUBLIC_H
+#define RADEON_DRM_PUBLIC_H
+
+struct r300_winsys_screen;
+
+struct r300_winsys_screen *r300_drm_winsys_screen_create(int drmFD);
+
+#endif
diff --git a/src/gallium/winsys/radeon/drm/radeon_r300.c b/src/gallium/winsys/radeon/drm/radeon_r300.c
index d2d317dc20..cb26447606 100644
--- a/src/gallium/winsys/radeon/drm/radeon_r300.c
+++ b/src/gallium/winsys/radeon/drm/radeon_r300.c
@@ -25,7 +25,7 @@
#include "radeon_bo_gem.h"
#include "radeon_cs_gem.h"
-#include "state_tracker/drm_api.h"
+#include "state_tracker/drm_driver.h"
static struct r300_winsys_buffer *
radeon_r300_winsys_buffer_create(struct r300_winsys_screen *rws,
diff --git a/src/gallium/winsys/sw/drm/sw_drm_api.h b/src/gallium/winsys/svga/drm/svga_drm_public.h
index ce90a04ae0..e98c89da1e 100644
--- a/src/gallium/winsys/sw/drm/sw_drm_api.h
+++ b/src/gallium/winsys/svga/drm/svga_drm_public.h
@@ -23,12 +23,19 @@
*
**********************************************************/
+/**
+ * @file
+ * VMware SVGA DRM winsys public interface. Used by targets to create a stack.
+ *
+ * @author Jakob Bornecrantz Fonseca <jakob@vmware.com>
+ */
-#ifndef SW_DRM_API_H
-#define SW_DRM_API_H
+#ifndef SVGA_DRM_PUBLIC_H_
+#define SVGA_DRM_PUBLIC_H_
-struct drm_api;
+struct svga_winsys_screen;
-struct drm_api * sw_drm_api_create(struct drm_api *api);
+struct svga_winsys_screen *
+svga_drm_winsys_screen_create(int fd);
-#endif
+#endif /* SVGA_PUBLIC_H_ */
diff --git a/src/gallium/winsys/svga/drm/vmw_screen_dri.c b/src/gallium/winsys/svga/drm/vmw_screen_dri.c
index fe28522691..1b0d10f60d 100644
--- a/src/gallium/winsys/svga/drm/vmw_screen_dri.c
+++ b/src/gallium/winsys/svga/drm/vmw_screen_dri.c
@@ -30,14 +30,14 @@
#include "util/u_format.h"
#include "vmw_screen.h"
-#include "trace/tr_drm.h"
-
#include "vmw_screen.h"
#include "vmw_surface.h"
#include "vmw_fence.h"
#include "vmw_context.h"
+#include "svga_drm_public.h"
+
+#include "state_tracker/drm_driver.h"
-#include <state_tracker/drm_api.h>
#include "vmwgfx_drm.h"
#include <xf86drm.h>
@@ -84,15 +84,13 @@ vmw_dri1_check_version(const struct dri1_api_version *cur,
return FALSE;
}
-/* This is actually the entrypoint to the entire driver, called by the
- * libGL (or EGL, or ...) code via the drm_api_hooks table at the
- * bottom of the file.
+/* This is actually the entrypoint to the entire driver,
+ * called by the target bootstrap code.
*/
-static struct pipe_screen *
-vmw_drm_create_screen(struct drm_api *drm_api, int fd)
+struct svga_winsys_screen *
+svga_drm_winsys_screen_create(int fd)
{
struct vmw_winsys_screen *vws;
- struct pipe_screen *screen;
boolean use_old_scanout_flag = FALSE;
struct dri1_api_version drm_ver;
@@ -123,16 +121,7 @@ vmw_drm_create_screen(struct drm_api *drm_api, int fd)
vws->base.surface_from_handle = vmw_drm_surface_from_handle;
vws->base.surface_get_handle = vmw_drm_surface_get_handle;
- screen = svga_screen_create( &vws->base );
- if (!screen)
- goto out_no_screen;
-
- return screen;
-
- /* Failure cases:
- */
-out_no_screen:
- vmw_winsys_destroy( vws );
+ return &vws->base;
out_no_vws:
return NULL;
@@ -253,15 +242,3 @@ vmw_drm_surface_get_handle(struct svga_winsys_screen *sws,
return TRUE;
}
-
-static struct drm_api vmw_drm_api_hooks = {
- .name = "vmwgfx",
- .driver_name = "vmwgfx",
- .create_screen = vmw_drm_create_screen,
- .destroy = NULL,
-};
-
-struct drm_api* drm_api_create()
-{
- return trace_drm_create(&vmw_drm_api_hooks);
-}
diff --git a/src/gallium/winsys/sw/drm/Makefile b/src/gallium/winsys/sw/drm/Makefile
deleted file mode 100644
index 79664536aa..0000000000
--- a/src/gallium/winsys/sw/drm/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-TOP = ../../../../..
-include $(TOP)/configs/current
-
-LIBNAME = swdrm
-
-C_SOURCES = sw_drm_api.c
-
-LIBRARY_INCLUDES =
-
-LIBRARY_DEFINES =
-
-include ../../../Makefile.template
diff --git a/src/gallium/winsys/sw/drm/SConscript b/src/gallium/winsys/sw/drm/SConscript
deleted file mode 100644
index 15a2e05d5a..0000000000
--- a/src/gallium/winsys/sw/drm/SConscript
+++ /dev/null
@@ -1,21 +0,0 @@
-#######################################################################
-# SConscript for xlib winsys
-
-
-Import('*')
-
-env = env.Clone()
-
-env.Append(CPPPATH = [
- '#/src/gallium/include',
- '#/src/gallium/auxiliary',
- '#/src/gallium/drivers',
-])
-
-ws_drm = env.ConvenienceLibrary(
- target = 'ws_drm',
- source = [
- 'sw_drm_api.c',
- ]
-)
-Export('ws_drm')
diff --git a/src/gallium/winsys/sw/drm/sw_drm_api.c b/src/gallium/winsys/sw/drm/sw_drm_api.c
deleted file mode 100644
index 7b86382619..0000000000
--- a/src/gallium/winsys/sw/drm/sw_drm_api.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/**********************************************************
- * Copyright 2010 VMware, Inc. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- **********************************************************/
-
-
-#include "util/u_memory.h"
-#include "softpipe/sp_public.h"
-#include "state_tracker/drm_api.h"
-#include "../../sw/wrapper/wrapper_sw_winsys.h"
-#include "sw_drm_api.h"
-
-
-/*
- * Defines
- */
-
-
-struct sw_drm_api
-{
- struct drm_api base;
- struct drm_api *api;
- struct sw_winsys *sw;
-};
-
-static INLINE struct sw_drm_api *
-sw_drm_api(struct drm_api *api)
-{
- return (struct sw_drm_api *)api;
-}
-
-
-/*
- * Exported functions
- */
-
-
-static struct pipe_screen *
-sw_drm_create_screen(struct drm_api *_api, int drmFD)
-{
- struct sw_drm_api *swapi = sw_drm_api(_api);
- struct drm_api *api = swapi->api;
- struct sw_winsys *sww;
- struct pipe_screen *screen;
-
- screen = api->create_screen(api, drmFD);
- if (!screen)
- return NULL;
-
- sww = wrapper_sw_winsys_warp_pipe_screen(screen);
- if (!sww)
- return NULL;
-
- return softpipe_create_screen(sww);
-}
-
-static void
-sw_drm_destroy(struct drm_api *api)
-{
- struct sw_drm_api *swapi = sw_drm_api(api);
- if (swapi->api->destroy)
- swapi->api->destroy(swapi->api);
-
- FREE(swapi);
-}
-
-struct drm_api *
-sw_drm_api_create(struct drm_api *api)
-{
- struct sw_drm_api *swapi = CALLOC_STRUCT(sw_drm_api);
-
- if (!swapi)
- return api;
-
- swapi->base.name = api->name;
- swapi->base.driver_name = api->driver_name;
- swapi->base.create_screen = sw_drm_create_screen;
- swapi->base.destroy = sw_drm_destroy;
-
- swapi->api = api;
-
- return &swapi->base;
-}