-#include "nouveau/nouveau_bo.h"
-#include "nouveau/nouveau_channel.h"
-#include "nouveau/nouveau_class.h"
-#include "nouveau/nouveau_device.h"
-#include "nouveau/nouveau_grobj.h"
-#include "nouveau/nouveau_notifier.h"
-#include "nouveau/nouveau_resource.h"
-#include "nouveau/nouveau_pushbuf.h"
+#include "drm-uapi/drm.h"
+#include <nouveau.h>
+
+#ifndef NV04_PFIFO_MAX_PACKET_LEN
+#define NV04_PFIFO_MAX_PACKET_LEN 2047
+#endif
+
+#define NOUVEAU_MIN_BUFFER_MAP_ALIGN 64
+#define NOUVEAU_MIN_BUFFER_MAP_ALIGN_MASK (NOUVEAU_MIN_BUFFER_MAP_ALIGN - 1)
+
+static inline uint32_t
+PUSH_AVAIL(struct nouveau_pushbuf *push)
+{
+ return push->end - push->cur;
+}
+
+static inline bool
+PUSH_SPACE(struct nouveau_pushbuf *push, uint32_t size)
+{
+ /* Provide a buffer so that fences always have room to be emitted */
+ size += 8;
+ if (PUSH_AVAIL(push) < size)
+ return nouveau_pushbuf_space(push, size, 0, 0) == 0;
+ return true;
+}