summaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/winsys')
-rw-r--r--src/gallium/winsys/SConscript1
-rw-r--r--src/gallium/winsys/i915/drm/i915_drm_batchbuffer.c36
-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.c30
-rw-r--r--src/gallium/winsys/i915/drm/i915_drm_winsys.h2
-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/r600/drm/radeon.c5
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_buffer.h41
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_drm.c18
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_drm.h7
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_drm_buffer.c168
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_drm_public.h9
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_r300.c346
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_winsys.h25
-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/svga/drm/vmwgfx_drm.h1
-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
36 files changed, 438 insertions, 620 deletions
diff --git a/src/gallium/winsys/SConscript b/src/gallium/winsys/SConscript
index 907ac90bf04..65b12287df7 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_batchbuffer.c b/src/gallium/winsys/i915/drm/i915_drm_batchbuffer.c
index 102f59dc541..e50e7801c0a 100644
--- a/src/gallium/winsys/i915/drm/i915_drm_batchbuffer.c
+++ b/src/gallium/winsys/i915/drm/i915_drm_batchbuffer.c
@@ -3,6 +3,7 @@
#include "util/u_memory.h"
#include "i915_drm.h"
+#include "i915/i915_debug.h"
#define BATCH_RESERVED 16
@@ -151,7 +152,6 @@ i915_drm_batchbuffer_flush(struct i915_winsys_batchbuffer *ibatch,
struct i915_drm_batchbuffer *batch = i915_drm_batchbuffer(ibatch);
unsigned used = 0;
int ret = 0;
- int i;
assert(i915_winsys_batchbuffer_space(ibatch) >= 0);
@@ -186,20 +186,28 @@ i915_drm_batchbuffer_flush(struct i915_winsys_batchbuffer *ibatch,
#endif
/* Do the sending to HW */
- ret = drm_intel_bo_exec(batch->bo, used, NULL, 0, 0);
- assert(ret == 0);
-
- if (i915_drm_winsys(ibatch->iws)->dump_cmd) {
- unsigned *ptr;
- drm_intel_bo_map(batch->bo, FALSE);
- ptr = (unsigned*)batch->bo->virtual;
+ if (i915_drm_winsys(ibatch->iws)->send_cmd)
+ ret = drm_intel_bo_exec(batch->bo, used, NULL, 0, 0);
+ else
+ ret = 0;
- debug_printf("%s:\n", __func__);
- for (i = 0; i < used / 4; i++, ptr++) {
- debug_printf("\t%08x: %08x\n", i*4, *ptr);
- }
-
- drm_intel_bo_unmap(batch->bo);
+ if (ret != 0 || i915_drm_winsys(ibatch->iws)->dump_cmd) {
+#ifdef INTEL_MAP_BATCHBUFFER
+#ifdef INTEL_MAP_GTT
+ drm_intel_gem_bo_map_gtt(batch->bo);
+#else
+ drm_intel_bo_map(batch->bo, 0);
+#endif
+#endif
+ i915_dump_batchbuffer(ibatch);
+ assert(ret == 0);
+#ifdef INTEL_MAP_BATCHBUFFER
+#ifdef INTEL_MAP_GTT
+ drm_intel_gem_bo_unmap_gtt(batch->bo);
+#else
+ drm_intel_bo_unmap(batch->bo);
+#endif
+#endif
} else {
#ifdef INTEL_RUN_SYNC
drm_intel_bo_map(batch->bo, FALSE);
diff --git a/src/gallium/winsys/i915/drm/i915_drm_buffer.c b/src/gallium/winsys/i915/drm/i915_drm_buffer.c
index 3bd85026b21..6b06e7ae995 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 00000000000..b828d8d670c
--- /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 5a6b45e6c9f..179a84a704b 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;
@@ -73,21 +70,8 @@ i915_drm_create_screen(struct drm_api *api, int drmFD)
idws->pools.gem = drm_intel_bufmgr_gem_init(idws->fd, idws->max_batch_size);
drm_intel_bufmgr_gem_enable_reuse(idws->pools.gem);
- idws->dump_cmd = debug_get_bool_option("INTEL_DUMP_CMD", FALSE);
-
- return i915_screen_create(&idws->base);
-}
+ idws->dump_cmd = debug_get_bool_option("I915_DUMP_CMD", FALSE);
+ idws->send_cmd = !debug_get_bool_option("I915_NO_HW", FALSE);
-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 99667bde4ef..88a71f2424d 100644
--- a/src/gallium/winsys/i915/drm/i915_drm_winsys.h
+++ b/src/gallium/winsys/i915/drm/i915_drm_winsys.h
@@ -18,6 +18,7 @@ struct i915_drm_winsys
struct i915_winsys base;
boolean dump_cmd;
+ boolean send_cmd;
int fd; /**< Drm file discriptor */
@@ -34,7 +35,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 00000000000..e951a32917f
--- /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 bb1c107c056..058ddc44aaf 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 b8aa9ef4ac5..b7b43669f30 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 bbb71e25d84..46f98d7a24a 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 abf9aac5c01..785be449f70 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 fb5e50ce810..ed62db60bbb 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 00000000000..2913b079747
--- /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 87ee8070b1d..b08e622db94 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 c6a7d4a8c51..82dbe61cc51 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 063e9f600b9..baadd6e89ca 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 71029858f75..74a3c6a0d70 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 00000000000..67b7c4429df
--- /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 2f244314622..660dbd0c332 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 ba6305c17e7..9e529ecad3d 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 803049d58c9..3d87a994c15 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 <[email protected]>
*/
#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 00000000000..84f2dce437a
--- /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/r600/drm/radeon.c b/src/gallium/winsys/r600/drm/radeon.c
index f2113c5807e..7e656698064 100644
--- a/src/gallium/winsys/r600/drm/radeon.c
+++ b/src/gallium/winsys/r600/drm/radeon.c
@@ -25,6 +25,11 @@
#include "radeon_drm.h"
#include "r600d.h"
+enum radeon_family radeon_get_family(struct radeon *radeon)
+{
+ return radeon->family;
+}
+
static int radeon_get_device(struct radeon *radeon)
{
struct drm_radeon_info info;
diff --git a/src/gallium/winsys/radeon/drm/radeon_buffer.h b/src/gallium/winsys/radeon/drm/radeon_buffer.h
index 73cb6a579b4..a8137d85e83 100644
--- a/src/gallium/winsys/radeon/drm/radeon_buffer.h
+++ b/src/gallium/winsys/radeon/drm/radeon_buffer.h
@@ -43,10 +43,9 @@
#include "radeon_winsys.h"
-#define RADEON_USAGE_DOMAIN_GTT (1 << 29)
-#define RADEON_USAGE_DOMAIN_VRAM (1 << 30)
-
-#define RADEON_MAX_BOS 24
+#define RADEON_PB_USAGE_VERTEX (1 << 28)
+#define RADEON_PB_USAGE_DOMAIN_GTT (1 << 29)
+#define RADEON_PB_USAGE_DOMAIN_VRAM (1 << 30)
static INLINE struct pb_buffer *
radeon_pb_buffer(struct r300_winsys_buffer *buffer)
@@ -63,24 +62,26 @@ radeon_libdrm_winsys_buffer(struct pb_buffer *buffer)
struct pb_manager *
radeon_drm_bufmgr_create(struct radeon_libdrm_winsys *rws);
-boolean radeon_drm_bufmgr_add_buffer(struct pb_buffer *_buf,
- enum r300_buffer_domain rd,
- enum r300_buffer_domain wd);
-
+void radeon_drm_bufmgr_add_buffer(struct r300_winsys_cs *cs,
+ struct r300_winsys_buffer *buf,
+ enum r300_buffer_domain rd,
+ enum r300_buffer_domain wd);
-void radeon_drm_bufmgr_write_reloc(struct pb_buffer *_buf,
+void radeon_drm_bufmgr_write_reloc(struct r300_winsys_cs *cs,
+ struct r300_winsys_buffer *buf,
enum r300_buffer_domain rd,
- enum r300_buffer_domain wd,
- uint32_t flags);
+ enum r300_buffer_domain wd);
struct pb_buffer *radeon_drm_bufmgr_create_buffer_from_handle(struct pb_manager *_mgr,
uint32_t handle);
-void radeon_drm_bufmgr_get_tiling(struct pb_buffer *_buf,
+void radeon_drm_bufmgr_get_tiling(struct r300_winsys_screen *ws,
+ struct r300_winsys_buffer *buf,
enum r300_buffer_tiling *microtiled,
enum r300_buffer_tiling *macrotiled);
-void radeon_drm_bufmgr_set_tiling(struct pb_buffer *_buf,
+void radeon_drm_bufmgr_set_tiling(struct r300_winsys_screen *ws,
+ struct r300_winsys_buffer *buf,
enum r300_buffer_tiling microtiled,
enum r300_buffer_tiling macrotiled,
uint32_t pitch);
@@ -90,9 +91,19 @@ void radeon_drm_bufmgr_flush_maps(struct pb_manager *_mgr);
boolean radeon_drm_bufmgr_get_handle(struct pb_buffer *_buf,
struct winsys_handle *whandle);
-boolean radeon_drm_bufmgr_is_buffer_referenced(struct pb_buffer *_buf,
+boolean radeon_drm_bufmgr_is_buffer_referenced(struct r300_winsys_cs *cs,
+ struct r300_winsys_buffer *buf,
enum r300_reference_domain domain);
-void radeon_drm_bufmgr_wait(struct pb_buffer *_buf);
+void radeon_drm_bufmgr_wait(struct r300_winsys_screen *ws,
+ struct r300_winsys_buffer *buf);
+
+void *radeon_drm_buffer_map(struct r300_winsys_screen *ws,
+ struct r300_winsys_buffer *buf,
+ struct r300_winsys_cs *cs,
+ enum pipe_transfer_usage usage);
+
+void radeon_drm_buffer_unmap(struct r300_winsys_screen *ws,
+ struct r300_winsys_buffer *buf);
#endif
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm.c b/src/gallium/winsys/radeon/drm/radeon_drm.c
index 59f1b10230e..e9a276362f3 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm.c
@@ -32,9 +32,9 @@
#include "radeon_drm.h"
#include "radeon_r300.h"
#include "radeon_buffer.h"
+#include "radeon_drm_public.h"
#include "r300_winsys.h"
-#include "trace/tr_drm.h"
#include "util/u_memory.h"
@@ -153,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;
@@ -171,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 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 3544c926d99..df6dd91ad54 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_buffer.c b/src/gallium/winsys/radeon/drm/radeon_drm_buffer.c
index a4b6cff33d1..017eac8464e 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_buffer.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_buffer.c
@@ -20,10 +20,11 @@ struct radeon_drm_buffer {
struct radeon_bo *bo;
+ /* The CS associated with the last buffer_map. */
+ struct radeon_libdrm_cs *cs;
+
boolean flinked;
uint32_t flink;
- uint32_t tileflags;
- uint32_t pitch;
struct radeon_drm_buffer *next, *prev;
};
@@ -67,34 +68,53 @@ radeon_drm_buffer_destroy(struct pb_buffer *_buf)
FREE(buf);
}
+static unsigned get_pb_usage_from_transfer_flags(enum pipe_transfer_usage usage)
+{
+ unsigned res = 0;
+
+ if (usage & PIPE_TRANSFER_READ)
+ res |= PB_USAGE_CPU_READ;
+
+ if (usage & PIPE_TRANSFER_WRITE)
+ res |= PB_USAGE_CPU_WRITE;
+
+ if (usage & PIPE_TRANSFER_DONTBLOCK)
+ res |= PB_USAGE_DONTBLOCK;
+
+ if (usage & PIPE_TRANSFER_UNSYNCHRONIZED)
+ res |= PB_USAGE_UNSYNCHRONIZED;
+
+ return res;
+}
+
static void *
-radeon_drm_buffer_map(struct pb_buffer *_buf,
+radeon_drm_buffer_map_internal(struct pb_buffer *_buf,
unsigned flags)
{
struct radeon_drm_buffer *buf = radeon_drm_buffer(_buf);
+ struct radeon_libdrm_cs *cs = buf->cs;
int write = 0;
- if (flags & PIPE_TRANSFER_DONTBLOCK) {
- if ((_buf->base.usage & PIPE_BIND_VERTEX_BUFFER) ||
- (_buf->base.usage & PIPE_BIND_INDEX_BUFFER))
- if (radeon_bo_is_referenced_by_cs(buf->bo, buf->mgr->rws->cs))
+ if (flags & PB_USAGE_DONTBLOCK) {
+ if (_buf->base.usage & RADEON_PB_USAGE_VERTEX)
+ if (cs && radeon_bo_is_referenced_by_cs(buf->bo, cs->cs))
return NULL;
}
if (buf->bo->ptr != NULL)
return buf->bo->ptr;
- if (flags & PIPE_TRANSFER_DONTBLOCK) {
+ if (flags & PB_USAGE_DONTBLOCK) {
uint32_t domain;
if (radeon_bo_is_busy(buf->bo, &domain))
return NULL;
}
- if (radeon_bo_is_referenced_by_cs(buf->bo, buf->mgr->rws->cs)) {
- buf->mgr->rws->flush_cb(buf->mgr->rws->flush_data);
+ if (cs && radeon_bo_is_referenced_by_cs(buf->bo, cs->cs)) {
+ cs->flush_cs(cs->flush_data);
}
- if (flags & PIPE_TRANSFER_WRITE) {
+ if (flags & PB_USAGE_CPU_WRITE) {
write = 1;
}
@@ -106,7 +126,7 @@ radeon_drm_buffer_map(struct pb_buffer *_buf,
}
static void
-radeon_drm_buffer_unmap(struct pb_buffer *_buf)
+radeon_drm_buffer_unmap_internal(struct pb_buffer *_buf)
{
(void)_buf;
}
@@ -138,8 +158,8 @@ radeon_drm_buffer_fence(struct pb_buffer *buf,
const struct pb_vtbl radeon_drm_buffer_vtbl = {
radeon_drm_buffer_destroy,
- radeon_drm_buffer_map,
- radeon_drm_buffer_unmap,
+ radeon_drm_buffer_map_internal,
+ radeon_drm_buffer_unmap_internal,
radeon_drm_buffer_validate,
radeon_drm_buffer_fence,
radeon_drm_buffer_get_base_buffer,
@@ -168,8 +188,8 @@ struct pb_buffer *radeon_drm_bufmgr_create_buffer_from_handle(struct pb_manager
pipe_reference_init(&buf->base.base.reference, 1);
buf->base.base.alignment = 0;
- buf->base.base.usage = PIPE_BIND_SAMPLER_VIEW;
- buf->base.base.size = 0;
+ buf->base.base.usage = PB_USAGE_GPU_WRITE | PB_USAGE_GPU_READ;
+ buf->base.base.size = bo->size;
buf->base.vtbl = &radeon_drm_buffer_vtbl;
buf->mgr = mgr;
@@ -202,8 +222,8 @@ radeon_drm_bufmgr_create_buffer(struct pb_manager *_mgr,
make_empty_list(buf);
domain =
- (desc->usage & RADEON_USAGE_DOMAIN_GTT ? RADEON_GEM_DOMAIN_GTT : 0) |
- (desc->usage & RADEON_USAGE_DOMAIN_VRAM ? RADEON_GEM_DOMAIN_VRAM : 0);
+ (desc->usage & RADEON_PB_USAGE_DOMAIN_GTT ? RADEON_GEM_DOMAIN_GTT : 0) |
+ (desc->usage & RADEON_PB_USAGE_DOMAIN_VRAM ? RADEON_GEM_DOMAIN_VRAM : 0);
buf->bo = radeon_bo_open(rws->bom, 0, size,
desc->alignment, domain, 0);
@@ -251,7 +271,8 @@ radeon_drm_bufmgr_create(struct radeon_libdrm_winsys *rws)
static struct radeon_drm_buffer *get_drm_buffer(struct pb_buffer *_buf)
{
- struct radeon_drm_buffer *buf;
+ struct radeon_drm_buffer *buf = NULL;
+
if (_buf->vtbl == &radeon_drm_buffer_vtbl) {
buf = radeon_drm_buffer(_buf);
} else {
@@ -259,11 +280,35 @@ static struct radeon_drm_buffer *get_drm_buffer(struct pb_buffer *_buf)
pb_size offset;
pb_get_base_buffer(_buf, &base_buf, &offset);
- buf = radeon_drm_buffer(base_buf);
+ if (base_buf->vtbl == &radeon_drm_buffer_vtbl)
+ buf = radeon_drm_buffer(base_buf);
}
+
return buf;
}
+void *radeon_drm_buffer_map(struct r300_winsys_screen *ws,
+ struct r300_winsys_buffer *buf,
+ struct r300_winsys_cs *cs,
+ enum pipe_transfer_usage usage)
+{
+ struct pb_buffer *_buf = radeon_pb_buffer(buf);
+ struct radeon_drm_buffer *rbuf = get_drm_buffer(_buf);
+
+ if (rbuf)
+ rbuf->cs = radeon_libdrm_cs(cs);
+
+ return pb_map(_buf, get_pb_usage_from_transfer_flags(usage));
+}
+
+void radeon_drm_buffer_unmap(struct r300_winsys_screen *ws,
+ struct r300_winsys_buffer *buf)
+{
+ struct pb_buffer *_buf = radeon_pb_buffer(buf);
+
+ pb_unmap(_buf);
+}
+
boolean radeon_drm_bufmgr_get_handle(struct pb_buffer *_buf,
struct winsys_handle *whandle)
{
@@ -288,18 +333,16 @@ boolean radeon_drm_bufmgr_get_handle(struct pb_buffer *_buf,
return TRUE;
}
-void radeon_drm_bufmgr_get_tiling(struct pb_buffer *_buf,
+void radeon_drm_bufmgr_get_tiling(struct r300_winsys_screen *ws,
+ struct r300_winsys_buffer *_buf,
enum r300_buffer_tiling *microtiled,
enum r300_buffer_tiling *macrotiled)
{
- struct radeon_drm_buffer *buf = get_drm_buffer(_buf);
+ struct radeon_drm_buffer *buf = get_drm_buffer(radeon_pb_buffer(_buf));
uint32_t flags = 0, pitch;
radeon_bo_get_tiling(buf->bo, &flags, &pitch);
- buf->tileflags = flags;
- buf->pitch = pitch;
-
*microtiled = R300_BUFFER_LINEAR;
*macrotiled = R300_BUFFER_LINEAR;
if (flags & RADEON_BO_FLAGS_MICRO_TILE)
@@ -309,12 +352,13 @@ void radeon_drm_bufmgr_get_tiling(struct pb_buffer *_buf,
*macrotiled = R300_BUFFER_TILED;
}
-void radeon_drm_bufmgr_set_tiling(struct pb_buffer *_buf,
+void radeon_drm_bufmgr_set_tiling(struct r300_winsys_screen *ws,
+ struct r300_winsys_buffer *_buf,
enum r300_buffer_tiling microtiled,
enum r300_buffer_tiling macrotiled,
uint32_t pitch)
{
- struct radeon_drm_buffer *buf = get_drm_buffer(_buf);
+ struct radeon_drm_buffer *buf = get_drm_buffer(radeon_pb_buffer(_buf));
uint32_t flags = 0;
if (microtiled == R300_BUFFER_TILED)
flags |= RADEON_BO_FLAGS_MICRO_TILE;
@@ -326,67 +370,63 @@ void radeon_drm_bufmgr_set_tiling(struct pb_buffer *_buf,
if (macrotiled == R300_BUFFER_TILED)
flags |= RADEON_BO_FLAGS_MACRO_TILE;
- if (flags != buf->tileflags || pitch != buf->pitch) {
- /* Tiling determines how DRM treats the buffer data.
- * We must flush CS when changing it if the buffer is referenced. */
- if (radeon_bo_is_referenced_by_cs(buf->bo, buf->mgr->rws->cs)) {
- buf->mgr->rws->flush_cb(buf->mgr->rws->flush_data);
- }
-
- radeon_bo_set_tiling(buf->bo, flags, pitch);
- }
+ radeon_bo_set_tiling(buf->bo, flags, pitch);
}
-static uint32_t gem_domain(enum r300_buffer_domain dom)
+static uint32_t get_gem_domain(enum r300_buffer_domain domain)
{
uint32_t res = 0;
- if (dom & R300_DOMAIN_GTT)
+ if (domain & R300_DOMAIN_GTT)
res |= RADEON_GEM_DOMAIN_GTT;
- if (dom & R300_DOMAIN_VRAM)
+ if (domain & R300_DOMAIN_VRAM)
res |= RADEON_GEM_DOMAIN_VRAM;
return res;
}
-boolean radeon_drm_bufmgr_add_buffer(struct pb_buffer *_buf,
- enum r300_buffer_domain rd,
- enum r300_buffer_domain wd)
+void radeon_drm_bufmgr_add_buffer(struct r300_winsys_cs *rcs,
+ struct r300_winsys_buffer *_buf,
+ enum r300_buffer_domain rd,
+ enum r300_buffer_domain wd)
{
- struct radeon_drm_buffer *buf = get_drm_buffer(_buf);
- uint32_t gem_rd = gem_domain(rd);
- uint32_t gem_wd = gem_domain(wd);
+ struct radeon_libdrm_cs *cs = radeon_libdrm_cs(rcs);
+ struct radeon_drm_buffer *buf = get_drm_buffer(radeon_pb_buffer(_buf));
+ uint32_t gem_rd = get_gem_domain(rd);
+ uint32_t gem_wd = get_gem_domain(wd);
- radeon_cs_space_add_persistent_bo(buf->mgr->rws->cs, buf->bo,
- gem_rd, gem_wd);
- return TRUE;
+ radeon_cs_space_add_persistent_bo(cs->cs, buf->bo, gem_rd, gem_wd);
}
-void radeon_drm_bufmgr_write_reloc(struct pb_buffer *_buf,
+void radeon_drm_bufmgr_write_reloc(struct r300_winsys_cs *rcs,
+ struct r300_winsys_buffer *_buf,
enum r300_buffer_domain rd,
- enum r300_buffer_domain wd,
- uint32_t flags)
+ enum r300_buffer_domain wd)
{
- struct radeon_drm_buffer *buf = get_drm_buffer(_buf);
+ struct radeon_libdrm_cs *cs = radeon_libdrm_cs(rcs);
+ struct radeon_drm_buffer *buf = get_drm_buffer(radeon_pb_buffer(_buf));
int retval;
- uint32_t gem_rd = gem_domain(rd);
- uint32_t gem_wd = gem_domain(wd);
+ uint32_t gem_rd = get_gem_domain(rd);
+ uint32_t gem_wd = get_gem_domain(wd);
- retval = radeon_cs_write_reloc(buf->mgr->rws->cs,
- buf->bo, gem_rd, gem_wd, flags);
+ cs->cs->cdw = cs->base.cdw;
+ retval = radeon_cs_write_reloc(cs->cs, buf->bo, gem_rd, gem_wd, 0);
+ cs->base.cdw = cs->cs->cdw;
if (retval) {
- debug_printf("radeon: Relocation of %p (%d, %d, %d) failed!\n",
- buf, gem_rd, gem_wd, flags);
+ fprintf(stderr, "radeon: Relocation of %p (%d, %d, %d) failed!\n",
+ buf, gem_rd, gem_wd, 0);
}
}
-boolean radeon_drm_bufmgr_is_buffer_referenced(struct pb_buffer *_buf,
+boolean radeon_drm_bufmgr_is_buffer_referenced(struct r300_winsys_cs *rcs,
+ struct r300_winsys_buffer *_buf,
enum r300_reference_domain domain)
{
- struct radeon_drm_buffer *buf = get_drm_buffer(_buf);
+ struct radeon_libdrm_cs *cs = radeon_libdrm_cs(rcs);
+ struct radeon_drm_buffer *buf = get_drm_buffer(radeon_pb_buffer(_buf));
uint32_t tmp;
if (domain & R300_REF_CS) {
- if (radeon_bo_is_referenced_by_cs(buf->bo, buf->mgr->rws->cs)) {
+ if (radeon_bo_is_referenced_by_cs(buf->bo, cs->cs)) {
return TRUE;
}
}
@@ -400,7 +440,6 @@ boolean radeon_drm_bufmgr_is_buffer_referenced(struct pb_buffer *_buf,
return FALSE;
}
-
void radeon_drm_bufmgr_flush_maps(struct pb_manager *_mgr)
{
struct radeon_drm_bufmgr *mgr = radeon_drm_bufmgr(_mgr);
@@ -415,9 +454,10 @@ void radeon_drm_bufmgr_flush_maps(struct pb_manager *_mgr)
make_empty_list(&mgr->buffer_map_list);
}
-void radeon_drm_bufmgr_wait(struct pb_buffer *_buf)
+void radeon_drm_bufmgr_wait(struct r300_winsys_screen *ws,
+ struct r300_winsys_buffer *_buf)
{
- struct radeon_drm_buffer *buf = get_drm_buffer(_buf);
+ struct radeon_drm_buffer *buf = get_drm_buffer(radeon_pb_buffer(_buf));
radeon_bo_wait(buf->bo);
}
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 00000000000..0d96ae8c470
--- /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 d2d317dc209..55445040671 100644
--- a/src/gallium/winsys/radeon/drm/radeon_r300.c
+++ b/src/gallium/winsys/radeon/drm/radeon_r300.c
@@ -25,39 +25,69 @@
#include "radeon_bo_gem.h"
#include "radeon_cs_gem.h"
-#include "state_tracker/drm_api.h"
+#include "state_tracker/drm_driver.h"
+
+#include "util/u_memory.h"
+
+static unsigned get_pb_usage_from_create_flags(unsigned bind, unsigned usage,
+ enum r300_buffer_domain domain)
+{
+ unsigned res = 0;
+
+ if (bind & (PIPE_BIND_DEPTH_STENCIL | PIPE_BIND_RENDER_TARGET |
+ PIPE_BIND_DISPLAY_TARGET | PIPE_BIND_SCANOUT))
+ res |= PB_USAGE_GPU_WRITE;
+
+ if (bind & PIPE_BIND_SAMPLER_VIEW)
+ res |= PB_USAGE_GPU_READ | PB_USAGE_GPU_WRITE;
+
+ if (bind & (PIPE_BIND_VERTEX_BUFFER | PIPE_BIND_INDEX_BUFFER))
+ res |= PB_USAGE_GPU_READ;
+
+ if (bind & PIPE_BIND_TRANSFER_WRITE)
+ res |= PB_USAGE_CPU_WRITE;
+
+ if (bind & PIPE_BIND_TRANSFER_READ)
+ res |= PB_USAGE_CPU_READ;
+
+ /* Is usage of any use for us? Probably not. */
+
+ /* Now add driver-specific usage flags. */
+ if (bind & (PIPE_BIND_VERTEX_BUFFER | PIPE_BIND_INDEX_BUFFER))
+ res |= RADEON_PB_USAGE_VERTEX;
+
+ if (domain & R300_DOMAIN_GTT)
+ res |= RADEON_PB_USAGE_DOMAIN_GTT;
+
+ if (domain & R300_DOMAIN_VRAM)
+ res |= RADEON_PB_USAGE_DOMAIN_VRAM;
+
+ return res;
+}
static struct r300_winsys_buffer *
radeon_r300_winsys_buffer_create(struct r300_winsys_screen *rws,
- unsigned alignment,
- unsigned usage,
- enum r300_buffer_domain domain,
- unsigned size)
+ unsigned size,
+ unsigned alignment,
+ unsigned bind,
+ unsigned usage,
+ enum r300_buffer_domain domain)
{
- struct radeon_libdrm_winsys *ws = radeon_winsys_screen(rws);
+ struct radeon_libdrm_winsys *ws = radeon_libdrm_winsys(rws);
struct pb_desc desc;
struct pb_manager *provider;
struct pb_buffer *buffer;
- /* XXX this is hackish, but it's the only way to pass these flags
- * to the real create function. */
- usage &= ~(RADEON_USAGE_DOMAIN_GTT | RADEON_USAGE_DOMAIN_VRAM);
- if (domain & R300_DOMAIN_GTT)
- usage |= RADEON_USAGE_DOMAIN_GTT;
- if (domain & R300_DOMAIN_VRAM)
- usage |= RADEON_USAGE_DOMAIN_VRAM;
-
memset(&desc, 0, sizeof(desc));
desc.alignment = alignment;
- desc.usage = usage;
+ desc.usage = get_pb_usage_from_create_flags(bind, usage, domain);
- if (usage & PIPE_BIND_CONSTANT_BUFFER)
- provider = ws->mman;
- else if ((usage & PIPE_BIND_VERTEX_BUFFER) ||
- (usage & PIPE_BIND_INDEX_BUFFER))
+ /* Assign a buffer manager. */
+ if (bind & (PIPE_BIND_VERTEX_BUFFER | PIPE_BIND_INDEX_BUFFER))
provider = ws->cman;
else
provider = ws->kman;
+
buffer = provider->create_buffer(provider, size, &desc);
if (!buffer)
return NULL;
@@ -65,55 +95,6 @@ radeon_r300_winsys_buffer_create(struct r300_winsys_screen *rws,
return radeon_libdrm_winsys_buffer(buffer);
}
-static void radeon_r300_winsys_buffer_destroy(struct r300_winsys_buffer *buf)
-{
- struct pb_buffer *_buf = radeon_pb_buffer(buf);
-
- pb_destroy(_buf);
-}
-static void radeon_r300_winsys_buffer_set_tiling(struct r300_winsys_screen *rws,
- struct r300_winsys_buffer *buf,
- uint32_t pitch,
- enum r300_buffer_tiling microtiled,
- enum r300_buffer_tiling macrotiled)
-{
- struct pb_buffer *_buf = radeon_pb_buffer(buf);
- radeon_drm_bufmgr_set_tiling(_buf, microtiled, macrotiled, pitch);
-}
-
-static void radeon_r300_winsys_buffer_get_tiling(struct r300_winsys_screen *rws,
- struct r300_winsys_buffer *buf,
- enum r300_buffer_tiling *microtiled,
- enum r300_buffer_tiling *macrotiled)
-{
- struct pb_buffer *_buf = radeon_pb_buffer(buf);
- radeon_drm_bufmgr_get_tiling(_buf, microtiled, macrotiled);
-}
-
-static void *radeon_r300_winsys_buffer_map(struct r300_winsys_screen *ws,
- struct r300_winsys_buffer *buf,
- unsigned usage)
-{
- struct pb_buffer *_buf = radeon_pb_buffer(buf);
-
- return pb_map(_buf, usage);
-}
-
-static void radeon_r300_winsys_buffer_unmap(struct r300_winsys_screen *ws,
- struct r300_winsys_buffer *buf)
-{
- struct pb_buffer *_buf = radeon_pb_buffer(buf);
-
- pb_unmap(_buf);
-}
-
-static void radeon_r300_winsys_buffer_wait(struct r300_winsys_screen *ws,
- struct r300_winsys_buffer *buf)
-{
- struct pb_buffer *_buf = radeon_pb_buffer(buf);
- radeon_drm_bufmgr_wait(_buf);
-}
-
static void radeon_r300_winsys_buffer_reference(struct r300_winsys_screen *rws,
struct r300_winsys_buffer **pdst,
struct r300_winsys_buffer *src)
@@ -126,140 +107,96 @@ static void radeon_r300_winsys_buffer_reference(struct r300_winsys_screen *rws,
*pdst = radeon_libdrm_winsys_buffer(_dst);
}
-static boolean radeon_r300_winsys_is_buffer_referenced(struct r300_winsys_screen *rws,
- struct r300_winsys_buffer *buf,
- enum r300_reference_domain domain)
-{
- struct pb_buffer *_buf = radeon_pb_buffer(buf);
-
- return radeon_drm_bufmgr_is_buffer_referenced(_buf, domain);
-}
-
static struct r300_winsys_buffer *radeon_r300_winsys_buffer_from_handle(struct r300_winsys_screen *rws,
- unsigned handle)
+ struct winsys_handle *whandle,
+ unsigned *stride,
+ unsigned *size)
{
- struct radeon_libdrm_winsys *ws = radeon_winsys_screen(rws);
+ struct radeon_libdrm_winsys *ws = radeon_libdrm_winsys(rws);
struct pb_buffer *_buf;
- _buf = radeon_drm_bufmgr_create_buffer_from_handle(ws->kman, handle);
+ _buf = radeon_drm_bufmgr_create_buffer_from_handle(ws->kman, whandle->handle);
+
+ if (stride)
+ *stride = whandle->stride;
+ if (size)
+ *size = _buf->base.size;
+
return radeon_libdrm_winsys_buffer(_buf);
}
static boolean radeon_r300_winsys_buffer_get_handle(struct r300_winsys_screen *rws,
struct r300_winsys_buffer *buffer,
+ unsigned stride,
struct winsys_handle *whandle)
{
struct pb_buffer *_buf = radeon_pb_buffer(buffer);
+ whandle->stride = stride;
return radeon_drm_bufmgr_get_handle(_buf, whandle);
}
-static void radeon_set_flush_cb(struct r300_winsys_screen *rws,
- void (*flush_cb)(void *),
- void *data)
-{
- struct radeon_libdrm_winsys *ws = radeon_winsys_screen(rws);
- ws->flush_cb = flush_cb;
- ws->flush_data = data;
- radeon_cs_space_set_flush(ws->cs, flush_cb, data);
-}
-
-static boolean radeon_add_buffer(struct r300_winsys_screen *rws,
- struct r300_winsys_buffer *buf,
- enum r300_buffer_domain rd,
- enum r300_buffer_domain wd)
-{
- struct pb_buffer *_buf = radeon_pb_buffer(buf);
-
- return radeon_drm_bufmgr_add_buffer(_buf, rd, wd);
-}
-
-static boolean radeon_validate(struct r300_winsys_screen *rws)
-{
- struct radeon_libdrm_winsys *ws = radeon_winsys_screen(rws);
- if (radeon_cs_space_check(ws->cs) < 0) {
- return FALSE;
- }
-
- /* Things are fine, we can proceed as normal. */
- return TRUE;
-}
-
-static unsigned radeon_get_cs_free_dwords(struct r300_winsys_screen *rws)
+static void radeon_r300_winsys_cs_set_flush(struct r300_winsys_cs *rcs,
+ void (*flush)(void *),
+ void *user)
{
- struct radeon_libdrm_winsys *ws = radeon_winsys_screen(rws);
- struct radeon_cs *cs = ws->cs;
-
- return cs->ndw - cs->cdw;
-}
-
-static uint32_t *radeon_get_cs_pointer(struct r300_winsys_screen *rws,
- unsigned count)
-{
- struct radeon_libdrm_winsys *ws = radeon_winsys_screen(rws);
- struct radeon_cs *cs = ws->cs;
- uint32_t *ptr = cs->packets + cs->cdw;
-
- cs->cdw += count;
- return ptr;
-}
-
-static void radeon_write_cs_dword(struct r300_winsys_screen *rws,
- uint32_t dword)
-{
- struct radeon_libdrm_winsys *ws = radeon_winsys_screen(rws);
- radeon_cs_write_dword(ws->cs, dword);
+ struct radeon_libdrm_cs *cs = radeon_libdrm_cs(rcs);
+ cs->flush_cs = flush;
+ cs->flush_data = user;
+ radeon_cs_space_set_flush(cs->cs, flush, user);
}
-static void radeon_write_cs_table(struct r300_winsys_screen *rws,
- const void *table, unsigned count)
+static boolean radeon_r300_winsys_cs_validate(struct r300_winsys_cs *rcs)
{
- struct radeon_libdrm_winsys *ws = radeon_winsys_screen(rws);
- radeon_cs_write_table(ws->cs, table, count);
-}
+ struct radeon_libdrm_cs *cs = radeon_libdrm_cs(rcs);
-static void radeon_write_cs_reloc(struct r300_winsys_screen *rws,
- struct r300_winsys_buffer *buf,
- enum r300_buffer_domain rd,
- enum r300_buffer_domain wd,
- uint32_t flags)
-{
- struct pb_buffer *_buf = radeon_pb_buffer(buf);
- radeon_drm_bufmgr_write_reloc(_buf, rd, wd, flags);
+ return radeon_cs_space_check(cs->cs) >= 0;
}
-static void radeon_reset_bos(struct r300_winsys_screen *rws)
+static void radeon_r300_winsys_cs_reset_buffers(struct r300_winsys_cs *rcs)
{
- struct radeon_libdrm_winsys *ws = radeon_winsys_screen(rws);
- radeon_cs_space_reset_bos(ws->cs);
+ struct radeon_libdrm_cs *cs = radeon_libdrm_cs(rcs);
+ radeon_cs_space_reset_bos(cs->cs);
}
-static void radeon_flush_cs(struct r300_winsys_screen *rws)
+static void radeon_r300_winsys_cs_flush(struct r300_winsys_cs *rcs)
{
- struct radeon_libdrm_winsys *ws = radeon_winsys_screen(rws);
+ struct radeon_libdrm_cs *cs = radeon_libdrm_cs(rcs);
int retval;
/* Don't flush a zero-sized CS. */
- if (!ws->cs->cdw) {
+ if (!cs->base.cdw) {
return;
}
- radeon_drm_bufmgr_flush_maps(ws->kman);
+ cs->cs->cdw = cs->base.cdw;
+
+ radeon_drm_bufmgr_flush_maps(cs->ws->kman);
+
/* Emit the CS. */
- retval = radeon_cs_emit(ws->cs);
+ retval = radeon_cs_emit(cs->cs);
if (retval) {
- debug_printf("radeon: Bad CS, dumping...\n");
- radeon_cs_print(ws->cs, stderr);
+ if (debug_get_bool_option("RADEON_DUMP_CS", FALSE)) {
+ fprintf(stderr, "radeon: The kernel rejected CS, dumping...\n");
+ radeon_cs_print(cs->cs, stderr);
+ } else {
+ fprintf(stderr, "radeon: The kernel rejected CS, "
+ "see dmesg for more information.\n");
+ }
}
/* Reset CS.
* Someday, when we care about performance, we should really find a way
* to rotate between two or three CS objects so that the GPU can be
* spinning through one CS while another one is being filled. */
- radeon_cs_erase(ws->cs);
+ radeon_cs_erase(cs->cs);
+
+ cs->base.ptr = cs->cs->packets;
+ cs->base.cdw = cs->cs->cdw;
+ cs->base.ndw = cs->cs->ndw;
}
static uint32_t radeon_get_value(struct r300_winsys_screen *rws,
- enum r300_value_id id)
+ enum r300_value_id id)
{
struct radeon_libdrm_winsys *ws = (struct radeon_libdrm_winsys *)rws;
@@ -278,24 +215,52 @@ static uint32_t radeon_get_value(struct r300_winsys_screen *rws,
return 0;
}
-static void
-radeon_winsys_destroy(struct r300_winsys_screen *rws)
+static struct r300_winsys_cs *radeon_r300_winsys_cs_create(struct r300_winsys_screen *rws)
+{
+ struct radeon_libdrm_winsys *ws = radeon_libdrm_winsys(rws);
+ struct radeon_libdrm_cs *cs = CALLOC_STRUCT(radeon_libdrm_cs);
+
+ if (!cs)
+ return NULL;
+
+ /* Size limit on IBs is 64 kibibytes. */
+ cs->cs = radeon_cs_create(ws->csm, 1024 * 64 / 4);
+ if (!cs->cs) {
+ FREE(cs);
+ return NULL;
+ }
+
+ radeon_cs_set_limit(cs->cs,
+ RADEON_GEM_DOMAIN_GTT, ws->gart_size);
+ radeon_cs_set_limit(cs->cs,
+ RADEON_GEM_DOMAIN_VRAM, ws->vram_size);
+
+ cs->ws = ws;
+ cs->base.ptr = cs->cs->packets;
+ cs->base.cdw = cs->cs->cdw;
+ cs->base.ndw = cs->cs->ndw;
+ return &cs->base;
+}
+
+static void radeon_r300_winsys_cs_destroy(struct r300_winsys_cs *rcs)
+{
+ struct radeon_libdrm_cs *cs = radeon_libdrm_cs(rcs);
+ radeon_cs_destroy(cs->cs);
+}
+
+static void radeon_winsys_destroy(struct r300_winsys_screen *rws)
{
struct radeon_libdrm_winsys *ws = (struct radeon_libdrm_winsys *)rws;
- radeon_cs_destroy(ws->cs);
ws->cman->destroy(ws->cman);
ws->kman->destroy(ws->kman);
- ws->mman->destroy(ws->mman);
radeon_bo_manager_gem_dtor(ws->bom);
radeon_cs_manager_gem_dtor(ws->csm);
}
-boolean
-radeon_setup_winsys(int fd, struct radeon_libdrm_winsys* ws)
+boolean radeon_setup_winsys(int fd, struct radeon_libdrm_winsys* ws)
{
-
ws->csm = radeon_cs_manager_gem_ctor(fd);
if (!ws->csm)
goto fail;
@@ -310,43 +275,28 @@ radeon_setup_winsys(int fd, struct radeon_libdrm_winsys* ws)
if (!ws->cman)
goto fail;
- ws->mman = pb_malloc_bufmgr_create();
- if (!ws->mman)
- goto fail;
-
- /* Size limit on IBs is 64 kibibytes. */
- ws->cs = radeon_cs_create(ws->csm, 1024 * 64 / 4);
- if (!ws->cs)
- goto fail;
- radeon_cs_set_limit(ws->cs,
- RADEON_GEM_DOMAIN_GTT, ws->gart_size);
- radeon_cs_set_limit(ws->cs,
- RADEON_GEM_DOMAIN_VRAM, ws->vram_size);
-
- ws->base.add_buffer = radeon_add_buffer;
- ws->base.validate = radeon_validate;
ws->base.destroy = radeon_winsys_destroy;
- ws->base.get_cs_free_dwords = radeon_get_cs_free_dwords;
- ws->base.get_cs_pointer = radeon_get_cs_pointer;
- ws->base.write_cs_dword = radeon_write_cs_dword;
- ws->base.write_cs_table = radeon_write_cs_table;
- ws->base.write_cs_reloc = radeon_write_cs_reloc;
- ws->base.flush_cs = radeon_flush_cs;
- ws->base.reset_bos = radeon_reset_bos;
- ws->base.set_flush_cb = radeon_set_flush_cb;
ws->base.get_value = radeon_get_value;
ws->base.buffer_create = radeon_r300_winsys_buffer_create;
- ws->base.buffer_destroy = radeon_r300_winsys_buffer_destroy;
- ws->base.buffer_set_tiling = radeon_r300_winsys_buffer_set_tiling;
- ws->base.buffer_get_tiling = radeon_r300_winsys_buffer_get_tiling;
- ws->base.buffer_map = radeon_r300_winsys_buffer_map;
- ws->base.buffer_unmap = radeon_r300_winsys_buffer_unmap;
- ws->base.buffer_wait = radeon_r300_winsys_buffer_wait;
+ ws->base.buffer_set_tiling = radeon_drm_bufmgr_set_tiling;
+ ws->base.buffer_get_tiling = radeon_drm_bufmgr_get_tiling;
+ ws->base.buffer_map = radeon_drm_buffer_map;
+ ws->base.buffer_unmap = radeon_drm_buffer_unmap;
+ ws->base.buffer_wait = radeon_drm_bufmgr_wait;
ws->base.buffer_reference = radeon_r300_winsys_buffer_reference;
ws->base.buffer_from_handle = radeon_r300_winsys_buffer_from_handle;
ws->base.buffer_get_handle = radeon_r300_winsys_buffer_get_handle;
- ws->base.is_buffer_referenced = radeon_r300_winsys_is_buffer_referenced;
+
+ ws->base.cs_create = radeon_r300_winsys_cs_create;
+ ws->base.cs_destroy = radeon_r300_winsys_cs_destroy;
+ ws->base.cs_add_buffer = radeon_drm_bufmgr_add_buffer;
+ ws->base.cs_validate = radeon_r300_winsys_cs_validate;
+ ws->base.cs_write_reloc = radeon_drm_bufmgr_write_reloc;
+ ws->base.cs_flush = radeon_r300_winsys_cs_flush;
+ ws->base.cs_reset_buffers = radeon_r300_winsys_cs_reset_buffers;
+ ws->base.cs_set_flush = radeon_r300_winsys_cs_set_flush;
+ ws->base.cs_is_buffer_referenced = radeon_drm_bufmgr_is_buffer_referenced;
return TRUE;
fail:
@@ -360,10 +310,6 @@ fail:
ws->cman->destroy(ws->cman);
if (ws->kman)
ws->kman->destroy(ws->kman);
- if (ws->mman)
- ws->mman->destroy(ws->mman);
- if (ws->cs)
- radeon_cs_destroy(ws->cs);
return FALSE;
}
diff --git a/src/gallium/winsys/radeon/drm/radeon_winsys.h b/src/gallium/winsys/radeon/drm/radeon_winsys.h
index ca789be8e93..533b7b2e2d2 100644
--- a/src/gallium/winsys/radeon/drm/radeon_winsys.h
+++ b/src/gallium/winsys/radeon/drm/radeon_winsys.h
@@ -40,8 +40,6 @@ struct radeon_libdrm_winsys {
struct pb_manager *cman;
- struct pb_manager *mman;
-
/* PCI ID */
uint32_t pci_id;
@@ -75,19 +73,32 @@ struct radeon_libdrm_winsys {
/* Radeon CS manager. */
struct radeon_cs_manager *csm;
+};
+
+struct radeon_libdrm_cs {
+ struct r300_winsys_cs base;
+
+ /* The winsys. */
+ struct radeon_libdrm_winsys *ws;
- /* Current CS. */
+ /* The libdrm command stream. */
struct radeon_cs *cs;
- /* Flush CB */
- void (*flush_cb)(void *);
+ /* Flush CS. */
+ void (*flush_cs)(void *);
void *flush_data;
};
+static INLINE struct radeon_libdrm_cs *
+radeon_libdrm_cs(struct r300_winsys_cs *base)
+{
+ return (struct radeon_libdrm_cs*)base;
+}
+
static INLINE struct radeon_libdrm_winsys *
-radeon_winsys_screen(struct r300_winsys_screen *base)
+radeon_libdrm_winsys(struct r300_winsys_screen *base)
{
- return (struct radeon_libdrm_winsys *)base;
+ return (struct radeon_libdrm_winsys*)base;
}
#endif
diff --git a/src/gallium/winsys/sw/drm/sw_drm_api.h b/src/gallium/winsys/svga/drm/svga_drm_public.h
index ce90a04ae0c..e98c89da1e1 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 <[email protected]>
+ */
-#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 fe285226918..1b0d10f60d6 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/svga/drm/vmwgfx_drm.h b/src/gallium/winsys/svga/drm/vmwgfx_drm.h
index fbb1a8f9a21..2f2807df0b2 100644
--- a/src/gallium/winsys/svga/drm/vmwgfx_drm.h
+++ b/src/gallium/winsys/svga/drm/vmwgfx_drm.h
@@ -72,6 +72,7 @@
#define DRM_VMW_PARAM_FIFO_OFFSET 3
#define DRM_VMW_PARAM_HW_CAPS 4
#define DRM_VMW_PARAM_FIFO_CAPS 5
+#define DRM_VMW_PARAM_MAX_FB_SIZE 6
/**
* struct drm_vmw_getparam_arg
diff --git a/src/gallium/winsys/sw/drm/Makefile b/src/gallium/winsys/sw/drm/Makefile
deleted file mode 100644
index 79664536aa0..00000000000
--- 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 15a2e05d5af..00000000000
--- 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 7b86382619e..00000000000
--- 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;
-}