summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2009-01-14 15:45:29 +1000
committerDave Airlie <airlied@redhat.com>2009-01-14 15:45:29 +1000
commit8c6a7d01744fe6164a868c5f691bb119109773c0 (patch)
tree83e7ac7e9edfcc93193912dc1135c1007c5cde52 /src/mesa
parente7d06a55c5443cfef73f5c2f60052cc26a1e9ff2 (diff)
radeon/r200/r300: make legacy emit non-r300 specific
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/r200/Makefile5
-rw-r--r--src/mesa/drivers/dri/r200/r200_context.c6
-rw-r--r--src/mesa/drivers/dri/r300/r300_context.c32
-rw-r--r--src/mesa/drivers/dri/radeon/Makefile6
-rw-r--r--src/mesa/drivers/dri/radeon/common_context.h4
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_bo_legacy.c5
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_cs_legacy.c36
7 files changed, 61 insertions, 33 deletions
diff --git a/src/mesa/drivers/dri/r200/Makefile b/src/mesa/drivers/dri/r200/Makefile
index 5ba1603d79..91211e4d74 100644
--- a/src/mesa/drivers/dri/r200/Makefile
+++ b/src/mesa/drivers/dri/r200/Makefile
@@ -30,6 +30,8 @@ DRIVER_SOURCES = r200_context.c \
radeon_screen.c \
common_lock.c \
common_misc.c \
+ radeon_bo_legacy.c \
+ radeon_cs_legacy.c \
$(EGL_SOURCES)
C_SOURCES = $(COMMON_SOURCES) $(DRIVER_SOURCES)
@@ -50,6 +52,8 @@ COMMON_SYMLINKS = \
radeon_chipset.h \
radeon_screen.c \
radeon_screen.h \
+ radeon_bo_legacy.c \
+ radeon_cs_legacy.c \
radeon_bo_legacy.h \
radeon_cs_legacy.h \
radeon_buffer.h \
@@ -59,6 +63,7 @@ COMMON_SYMLINKS = \
common_misc.h \
common_misc.c
+DRI_LIB_DEPS += -ldrm_radeon
##### TARGETS #####
diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c
index 856c5fc596..ebd4913267 100644
--- a/src/mesa/drivers/dri/r200/r200_context.c
+++ b/src/mesa/drivers/dri/r200/r200_context.c
@@ -272,6 +272,10 @@ static void r200_vtbl_set_all_dirty(GLcontext *ctx)
rmesa->hw.all_dirty = GL_TRUE;
}
+static void r200_vtbl_emit_cs_header(struct radeon_cs *cs, radeonContextPtr rmesa)
+{
+}
+
static void r200_init_vtbl(radeonContextPtr radeon)
{
radeon->vtbl.get_lock = r200_get_lock;
@@ -279,8 +283,10 @@ static void r200_init_vtbl(radeonContextPtr radeon)
radeon->vtbl.flush = r200_vtbl_flush;
radeon->vtbl.set_all_dirty = r200_vtbl_set_all_dirty;
radeon->vtbl.update_draw_buffer = r200UpdateDrawBuffer;
+ radeon->vtbl.emit_cs_header = r200_vtbl_emit_cs_header;
}
+
/* Create the device specific rendering context.
*/
GLboolean r200CreateContext( const __GLcontextModes *glVisual,
diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c
index 6b79e7dea3..f8fb830abf 100644
--- a/src/mesa/drivers/dri/r300/r300_context.c
+++ b/src/mesa/drivers/dri/r300/r300_context.c
@@ -210,6 +210,37 @@ static void r300_vtbl_set_all_dirty(GLcontext *ctx)
rmesa->hw.all_dirty = GL_TRUE;
}
+extern int cs_write_dword(struct radeon_cs *cs, uint32_t dword);
+
+static void r300_vtbl_emit_cs_header(struct radeon_cs *cs, radeonContextPtr rmesa)
+{
+ /* please flush pipe do all pending work */
+ cs_write_dword(cs, cmdpacket0(rmesa->radeonScreen,
+ R300_SC_SCREENDOOR, 1));
+ cs_write_dword(cs, 0x0);
+ cs_write_dword(cs, cmdpacket0(rmesa->radeonScreen,
+ R300_SC_SCREENDOOR, 1));
+ cs_write_dword(cs, 0x00FFFFFF);
+ cs_write_dword(cs, cmdpacket0(rmesa->radeonScreen,
+ R300_SC_HYPERZ, 1));
+ cs_write_dword(cs, 0x0);
+ cs_write_dword(cs, cmdpacket0(rmesa->radeonScreen,
+ R300_US_CONFIG, 1));
+ cs_write_dword(cs, 0x0);
+ cs_write_dword(cs, cmdpacket0(rmesa->radeonScreen,
+ R300_ZB_CNTL, 1));
+ cs_write_dword(cs, 0x0);
+ cs_write_dword(cs, cmdwait(rmesa->radeonScreen, R300_WAIT_3D));
+ cs_write_dword(cs, cmdpacket0(rmesa->radeonScreen,
+ R300_RB3D_DSTCACHE_CTLSTAT, 1));
+ cs_write_dword(cs, R300_RB3D_DSTCACHE_CTLSTAT_DC_FLUSH_FLUSH_DIRTY_3D);
+ cs_write_dword(cs, cmdpacket0(rmesa->radeonScreen,
+ R300_ZB_ZCACHE_CTLSTAT, 1));
+ cs_write_dword(cs, R300_ZB_ZCACHE_CTLSTAT_ZC_FLUSH_FLUSH_AND_FREE);
+ cs_write_dword(cs, cmdwait(rmesa->radeonScreen,
+ R300_WAIT_3D | R300_WAIT_3D_CLEAN));
+}
+
static void r300_init_vtbl(radeonContextPtr radeon)
{
radeon->vtbl.get_lock = r300_get_lock;
@@ -217,6 +248,7 @@ static void r300_init_vtbl(radeonContextPtr radeon)
radeon->vtbl.flush = r300_vtbl_flush;
radeon->vtbl.set_all_dirty = r300_vtbl_set_all_dirty;
radeon->vtbl.update_draw_buffer = r300UpdateDrawBuffer;
+ radeon->vtbl.emit_cs_header = r300_vtbl_emit_cs_header;
}
diff --git a/src/mesa/drivers/dri/radeon/Makefile b/src/mesa/drivers/dri/radeon/Makefile
index 50c27b81bc..9c76abccd3 100644
--- a/src/mesa/drivers/dri/radeon/Makefile
+++ b/src/mesa/drivers/dri/radeon/Makefile
@@ -23,7 +23,9 @@ DRIVER_SOURCES = \
radeon_maos.c \
radeon_sanity.c \
common_lock.c \
- common_misc.c
+ common_misc.c \
+ radeon_bo_legacy.c \
+ radeon_cs_legacy.c
C_SOURCES = \
$(COMMON_SOURCES) \
@@ -31,6 +33,8 @@ C_SOURCES = \
DRIVER_DEFINES = -DRADEON_COMMON=0
+DRI_LIB_DEPS += -ldrm_radeon
+
X86_SOURCES =
include ../Makefile.template
diff --git a/src/mesa/drivers/dri/radeon/common_context.h b/src/mesa/drivers/dri/radeon/common_context.h
index eb95dc9d75..a3d9fd70a7 100644
--- a/src/mesa/drivers/dri/radeon/common_context.h
+++ b/src/mesa/drivers/dri/radeon/common_context.h
@@ -8,6 +8,9 @@
#include "tnl/t_context.h"
#include "main/colormac.h"
+#include "radeon_screen.h"
+#include "radeon_drm.h"
+#include "dri_util.h"
/* This union is used to avoid warnings/miscompilation
with float to uint32_t casts due to strict-aliasing */
@@ -333,6 +336,7 @@ struct radeon_context {
void (*flush)(GLcontext *ctx);
void (*set_all_dirty)(GLcontext *ctx);
void (*update_draw_buffer)(GLcontext *ctx);
+ void (*emit_cs_header)(struct radeon_cs *cs, radeonContextPtr rmesa);
} vtbl;
};
diff --git a/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c b/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c
index e3474f791b..e378b118e0 100644
--- a/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c
+++ b/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c
@@ -41,12 +41,13 @@
#include <sys/ioctl.h>
#include "xf86drm.h"
#include "texmem.h"
+#include "main/simple_list.h"
+
#include "drm.h"
#include "radeon_drm.h"
#include "radeon_bo.h"
#include "radeon_bo_legacy.h"
-#include "radeon_ioctl.h"
-
+#include "common_context.h"
struct bo_legacy {
struct radeon_bo base;
diff --git a/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c b/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c
index 11b9f89ca7..0c897815a7 100644
--- a/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c
+++ b/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c
@@ -30,13 +30,13 @@
* Jérôme Glisse <glisse@freedesktop.org>
*/
#include <errno.h>
-#include "r300_reg.h"
-#include "r300_emit.h"
-#include "r300_cmdbuf.h"
+
+
+#include "common_context.h"
#include "radeon_cs.h"
#include "radeon_cs_legacy.h"
#include "radeon_bo_legacy.h"
-#include "radeon_context.h"
+
struct cs_manager_legacy {
struct radeon_cs_manager base;
@@ -73,7 +73,7 @@ static struct radeon_cs *cs_create(struct radeon_cs_manager *csm,
return cs;
}
-static int cs_write_dword(struct radeon_cs *cs, uint32_t dword)
+int cs_write_dword(struct radeon_cs *cs, uint32_t dword)
{
if (cs->cdw >= cs->ndw) {
uint32_t tmp, *ptr;
@@ -277,31 +277,7 @@ static int cs_emit(struct radeon_cs *cs)
uint64_t ull;
int r;
- /* please flush pipe do all pending work */
- cs_write_dword(cs, cmdpacket0(csm->ctx->radeonScreen,
- R300_SC_SCREENDOOR, 1));
- cs_write_dword(cs, 0x0);
- cs_write_dword(cs, cmdpacket0(csm->ctx->radeonScreen,
- R300_SC_SCREENDOOR, 1));
- cs_write_dword(cs, 0x00FFFFFF);
- cs_write_dword(cs, cmdpacket0(csm->ctx->radeonScreen,
- R300_SC_HYPERZ, 1));
- cs_write_dword(cs, 0x0);
- cs_write_dword(cs, cmdpacket0(csm->ctx->radeonScreen,
- R300_US_CONFIG, 1));
- cs_write_dword(cs, 0x0);
- cs_write_dword(cs, cmdpacket0(csm->ctx->radeonScreen,
- R300_ZB_CNTL, 1));
- cs_write_dword(cs, 0x0);
- cs_write_dword(cs, cmdwait(csm->ctx->radeonScreen, R300_WAIT_3D));
- cs_write_dword(cs, cmdpacket0(csm->ctx->radeonScreen,
- R300_RB3D_DSTCACHE_CTLSTAT, 1));
- cs_write_dword(cs, R300_RB3D_DSTCACHE_CTLSTAT_DC_FLUSH_FLUSH_DIRTY_3D);
- cs_write_dword(cs, cmdpacket0(csm->ctx->radeonScreen,
- R300_ZB_ZCACHE_CTLSTAT, 1));
- cs_write_dword(cs, R300_ZB_ZCACHE_CTLSTAT_ZC_FLUSH_FLUSH_AND_FREE);
- cs_write_dword(cs, cmdwait(csm->ctx->radeonScreen,
- R300_WAIT_3D | R300_WAIT_3D_CLEAN));
+ csm->ctx->vtbl.emit_cs_header(cs, csm->ctx);
/* append buffer age */
age.scratch.cmd_type = R300_CMD_SCRATCH;