Merge remote branch 'origin/gallium-0.2' into gallium-0.2
[mesa.git] / src / gallium / drivers / nouveau / nouveau_stateobj.h
index d501b76b51ef2b6db9e5a0e6aae5905203215911..729988b095e8f3ae6420a1ceaedc45625b1a1fb5 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef __NOUVEAU_STATEOBJ_H__
 #define __NOUVEAU_STATEOBJ_H__
 
-#include "pipe/p_util.h"
+#include "pipe/p_debug.h"
 
 struct nouveau_stateobj_reloc {
        struct pipe_buffer *bo;
@@ -67,6 +67,14 @@ so_data(struct nouveau_stateobj *so, unsigned data)
        so->cur_packet += 4;
 }
 
+static INLINE void
+so_datap(struct nouveau_stateobj *so, unsigned *data, unsigned size)
+{
+       so->cur_packet += (4 * size);
+       while (size--)
+               (*so->cur++) = (*data++);
+}
+
 static INLINE void
 so_method(struct nouveau_stateobj *so, struct nouveau_grobj *gr,
          unsigned mthd, unsigned size)
@@ -91,6 +99,15 @@ so_reloc(struct nouveau_stateobj *so, struct pipe_buffer *bo,
        so_data(so, data);
 }
 
+static INLINE void
+so_dump(struct nouveau_stateobj *so)
+{
+       unsigned i, nr = so->cur - so->push;
+
+       for (i = 0; i < nr; i++)
+               debug_printf("+0x%04x: 0x%08x\n", i, so->push[i]);
+}
+
 static INLINE void
 so_emit(struct nouveau_winsys *nvws, struct nouveau_stateobj *so)
 {
@@ -118,6 +135,9 @@ so_emit_reloc_markers(struct nouveau_winsys *nvws, struct nouveau_stateobj *so)
        struct nouveau_pushbuf *pb = nvws->channel->pushbuf;
        unsigned i;
 
+       if (!so)
+               return;
+
        i = so->cur_reloc << 1;
        if (nvws->channel->pushbuf->remaining < i)
                nvws->push_flush(nvws, i, NULL);