raedon/r200/r300: mega-FBO commits.
[mesa.git] / src / mesa / drivers / dri / radeon / radeon_cs_legacy.c
index fe4f90e0b1c0d05a3a62d01a94c60bc8b66038f6..b47b095cf203991650a46241b62c4708a841416d 100644 (file)
  */
 #include <errno.h>
 
-
-#include "common_context.h"
-#include "radeon_cs.h"
-#include "radeon_cs_legacy.h"
-#include "radeon_bo_legacy.h"
-
+#include "radeon_bocs_wrapper.h"
 
 struct cs_manager_legacy {
     struct radeon_cs_manager    base;
@@ -221,12 +216,15 @@ static int cs_process_relocs(struct radeon_cs *cs)
 
     csm = (struct cs_manager_legacy*)cs->csm;
     relocs = (struct cs_reloc_legacy *)cs->relocs;
+ restart:
     for (i = 0; i < cs->crelocs; i++) {
         for (j = 0; j < relocs[i].cindices; j++) {
             uint32_t soffset, eoffset;
 
             r = radeon_bo_legacy_validate(relocs[i].base.bo,
                                            &soffset, &eoffset);
+           if (r == -EAGAIN)
+             goto restart;
             if (r) {
                 fprintf(stderr, "validated %p [0x%08X, 0x%08X]\n",
                         relocs[i].base.bo, soffset, eoffset);
@@ -234,7 +232,7 @@ static int cs_process_relocs(struct radeon_cs *cs)
             }
             cs->packets[relocs[i].indices[j]] += soffset;
             if (cs->packets[relocs[i].indices[j]] >= eoffset) {
-                radeon_bo_debug(relocs[i].base.bo, 12);
+             /*                radeon_bo_debug(relocs[i].base.bo, 12); */
                 fprintf(stderr, "validated %p [0x%08X, 0x%08X]\n",
                         relocs[i].base.bo, soffset, eoffset);
                 fprintf(stderr, "above end: %p 0x%08X 0x%08X\n",
@@ -281,7 +279,6 @@ static int cs_emit(struct radeon_cs *cs)
 
     csm->ctx->vtbl.emit_cs_header(cs, csm->ctx);
 
-
     /* append buffer age */
     if (IS_R300_CLASS(csm->ctx->radeonScreen)) {
       age.scratch.cmd_type = R300_CMD_SCRATCH;
@@ -293,8 +290,7 @@ static int cs_emit(struct radeon_cs *cs)
       age.scratch.n_bufs = 1;
       age.scratch.flags = 0;
       radeon_cs_write_dword(cs, age.u);
-      radeon_cs_write_dword(cs, ull & 0xffffffff);
-      radeon_cs_write_dword(cs, ull >> 32);
+      radeon_cs_write_qword(cs, ull);
       radeon_cs_write_dword(cs, 0);
     }
 
@@ -313,7 +309,7 @@ static int cs_emit(struct radeon_cs *cs)
         cmd.boxes = (drm_clip_rect_t *) csm->ctx->pClipRects;
     }
 
-    //    dump_cmdbuf(cs);
+    //dump_cmdbuf(cs);
 
     r = drmCommandWrite(cs->csm->fd, DRM_RADEON_CMDBUF, &cmd, sizeof(cmd));
     if (r) {
@@ -368,8 +364,9 @@ static int cs_erase(struct radeon_cs *cs)
 
 static int cs_need_flush(struct radeon_cs *cs)
 {
-    /* FIXME: we should get the texture heap size */
-    return (cs->relocs_total_size > (7*1024*1024));
+    /* this function used to flush when the BO usage got to
+     * a certain size, now the higher levels handle this better */
+    return 0;
 }
 
 static void cs_print(struct radeon_cs *cs, FILE *file)