Revert "intel: Make RGB renderbuffers use XRGB8888 like we do for RGB system buffers."
[mesa.git] / src / mesa / drivers / dri / r300 / r300_render.c
index 8e6b4967ef18373bf659af652ae44c8f7b2a1132..4ae593cbe79a6df457585e88d3a8b96dbb9f5faf 100644 (file)
@@ -67,8 +67,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "vbo/vbo_split.h"
 #include "tnl/tnl.h"
 #include "tnl/t_vp_build.h"
-#include "radeon_reg.h"
-#include "radeon_macros.h"
 #include "r300_context.h"
 #include "r300_ioctl.h"
 #include "r300_state.h"
@@ -221,7 +219,7 @@ static void r300EmitAOS(r300ContextPtr rmesa, GLuint nr, GLuint offset)
        int sz = 1 + (nr >> 1) * 3 + (nr & 1) * 2;
        int i;
 
-       if (RADEON_DEBUG & DEBUG_VERTS)
+       if (RADEON_DEBUG & RADEON_VERTS)
                fprintf(stderr, "%s: nr=%d, ofs=0x%08x\n", __FUNCTION__, nr,
                        offset);
 
@@ -341,12 +339,6 @@ void r300RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim)
        if (type < 0 || num_verts <= 0)
                return;
 
-       /* Make space for at least 128 dwords.
-        * This is supposed to ensure that we can get all rendering
-        * commands into a single command buffer.
-        */
-       rcommonEnsureCmdBufSpace(&rmesa->radeon, 128, __FUNCTION__);
-
        if (rmesa->ind_buf.bo) {
                GLuint first, incr, offset = 0;
 
@@ -380,6 +372,11 @@ void r300RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim)
                                    if (align % 4)
                                        nr -= incr;
                                } while(align % 4);
+                               if (nr <= 0) {
+                                       WARN_ONCE("did the impossible happen? we never aligned nr to dword\n");
+                                       return;
+                               }
+                                       
                        }
                        r300FireEB(rmesa, nr, type, offset);
 
@@ -388,12 +385,23 @@ void r300RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim)
                }
 
        } else {
-               if (num_verts > 65535) {
-                       WARN_ONCE("Fixme: can't handle more then 65535 vertices");
+               GLuint first, incr, offset = 0;
+
+               if (!split_prim_inplace(prim & PRIM_MODE_MASK, &first, &incr) &&
+                       num_verts > 65535) {
+                       WARN_ONCE("Fixme: can't handle spliting prim %d\n", prim);
                        return;
                }
-               r300EmitAOS(rmesa, rmesa->radeon.tcl.aos_count, start);
-               r300FireAOS(rmesa, num_verts, type);
+               r300_emit_scissor(rmesa->radeon.glCtx);
+               while (num_verts > 0) {
+                       int nr;
+                       nr = MIN2(num_verts, 65535);
+                       nr -= (nr - first) % incr;
+                       r300EmitAOS(rmesa, rmesa->radeon.tcl.aos_count, start + offset);
+                       r300FireAOS(rmesa, nr, type);
+                       num_verts -= nr;
+                       offset += nr;
+               }
        }
        COMMIT_BATCH();
 }
@@ -437,7 +445,7 @@ void r300SwitchFallback(GLcontext *ctx, uint32_t bit, GLboolean mode)
 
        if (mode) {
                if ((fallback_warn & bit) == 0) {
-                       if (RADEON_DEBUG & DEBUG_FALLBACKS)
+                       if (RADEON_DEBUG & RADEON_FALLBACKS)
                                _mesa_fprintf(stderr, "WARNING! Falling back to software for %s\n", getFallbackString(bit));
                        fallback_warn |= bit;
                }
@@ -465,7 +473,7 @@ void r300SwitchFallback(GLcontext *ctx, uint32_t bit, GLboolean mode)
 
                /* update only if we have disabled all tcl fallbacks */
                if (rmesa->options.hw_tcl_enabled) {
-                       if ((old_fallback & R300_RASTER_FALLBACK_MASK) == bit) {
+                       if ((old_fallback & R300_TCL_FALLBACK_MASK) == bit) {
                                R300_STATECHANGE(rmesa, vap_cntl_status);
                                rmesa->hw.vap_cntl_status.cmd[1] &= ~R300_VAP_TCL_BYPASS;
                        }