radeon/r200/r300: make legacy emit non-r300 specific
authorDave Airlie <airlied@redhat.com>
Wed, 14 Jan 2009 05:45:29 +0000 (15:45 +1000)
committerDave Airlie <airlied@redhat.com>
Wed, 14 Jan 2009 05:45:29 +0000 (15:45 +1000)
src/mesa/drivers/dri/r200/Makefile
src/mesa/drivers/dri/r200/r200_context.c
src/mesa/drivers/dri/r300/r300_context.c
src/mesa/drivers/dri/radeon/Makefile
src/mesa/drivers/dri/radeon/common_context.h
src/mesa/drivers/dri/radeon/radeon_bo_legacy.c
src/mesa/drivers/dri/radeon/radeon_cs_legacy.c

index 5ba1603d792c626e0a0e212a3d3c0e666f63db3a..91211e4d74d1dcdee2ce3c65e3455b850a7765ec 100644 (file)
@@ -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 #####
 
index 856c5fc596c5957911f19821e56618c2ea1bf45b..ebd49132676ebcf4bbffb15348eed0c3758c4c5b 100644 (file)
@@ -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,
index 6b79e7dea3fe5c891f42926bf1c3a5b0b9607d76..f8fb830abf9e171fe278636a2c28d0794c298f67 100644 (file)
@@ -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;
 }
 
 
index 50c27b81bc57c8c046d2bd08234f653f65c1757c..9c76abccd3604f8d2eb8e15095ad8636e1545461 100644 (file)
@@ -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
index eb95dc9d75d4301bc8c821a49f4735bbe0b73b9f..a3d9fd70a7abbcf94170f3183f852ad1d277d0f4 100644 (file)
@@ -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;
 };
 
index e3474f791bb1c69d044150e4621f3304befd3bb3..e378b118e0e85ad88c2a45469126a9b2e8fbf333 100644 (file)
 #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;
index 11b9f89ca7d4081980f4ee9eaf4d85982497de1e..0c897815a7bd541b6f0aa6f0c8536755a48f6d25 100644 (file)
  *      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;