radeonsi: remove unused variable si_state_dsa::db_render_control
[mesa.git] / src / gallium / drivers / nouveau / nouveau_winsys.h
index 48feeba309d24c860afcc72e96f877e78fa88bda..51effb1d8d222e09da5f8be1560b450a3c9353d1 100644 (file)
@@ -2,89 +2,88 @@
 #define NOUVEAU_WINSYS_H
 
 #include <stdint.h>
-#include "pipe/p_winsys.h"
-#include "pipe/p_defines.h"
-
-#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"
-
-#define NOUVEAU_CAP_HW_VTXBUF (0xbeef0000)
-#define NOUVEAU_CAP_HW_IDXBUF (0xbeef0001)
-
-#define NOUVEAU_BUFFER_USAGE_TEXTURE (1 << 16)
-#define NOUVEAU_BUFFER_USAGE_ZETA    (1 << 17)
-
-struct nouveau_winsys {
-       struct nouveau_context *nv;
-
-       struct nouveau_channel *channel;
-
-       int  (*res_init)(struct nouveau_resource **heap, unsigned start,
-                        unsigned size);
-       int  (*res_alloc)(struct nouveau_resource *heap, int size, void *priv,
-                         struct nouveau_resource **);
-       void (*res_free)(struct nouveau_resource **);
-
-       int  (*push_reloc)(struct nouveau_winsys *, void *ptr,
-                          struct pipe_buffer *, uint32_t data,
-                          uint32_t flags, uint32_t vor, uint32_t tor);
-       int  (*push_flush)(struct nouveau_winsys *, unsigned size,
-                          struct pipe_fence_handle **fence);
-                              
-       int       (*grobj_alloc)(struct nouveau_winsys *, int grclass,
-                                struct nouveau_grobj **);
-       void      (*grobj_free)(struct nouveau_grobj **);
-
-       int       (*notifier_alloc)(struct nouveau_winsys *, int count,
-                                   struct nouveau_notifier **);
-       void      (*notifier_free)(struct nouveau_notifier **);
-       void      (*notifier_reset)(struct nouveau_notifier *, int id);
-       uint32_t  (*notifier_status)(struct nouveau_notifier *, int id);
-       uint32_t  (*notifier_retval)(struct nouveau_notifier *, int id);
-       int       (*notifier_wait)(struct nouveau_notifier *, int id,
-                                  int status, int timeout);
-
-       int (*surface_copy)(struct nouveau_winsys *, struct pipe_surface *,
-                           unsigned, unsigned, struct pipe_surface *,
-                           unsigned, unsigned, unsigned, unsigned);
-       int (*surface_fill)(struct nouveau_winsys *, struct pipe_surface *,
-                           unsigned, unsigned, unsigned, unsigned, unsigned);
-};
+#include <inttypes.h>
 
-extern struct pipe_screen *
-nv04_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *);
+#include "pipe/p_defines.h"
 
-extern struct pipe_context *
-nv04_create(struct pipe_screen *, unsigned pctx_id);
+#include <nouveau.h>
 
-extern struct pipe_screen *
-nv10_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *);
+#ifndef NV04_PFIFO_MAX_PACKET_LEN
+#define NV04_PFIFO_MAX_PACKET_LEN 2047
+#endif
 
-extern struct pipe_context *
-nv10_create(struct pipe_screen *, unsigned pctx_id);
+#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 boolean
+PUSH_SPACE(struct nouveau_pushbuf *push, uint32_t size)
+{
+   if (PUSH_AVAIL(push) < size)
+      return nouveau_pushbuf_space(push, size, 0, 0) == 0;
+   return TRUE;
+}
+
+static INLINE void
+PUSH_DATA(struct nouveau_pushbuf *push, uint32_t data)
+{
+   *push->cur++ = data;
+}
+
+static INLINE void
+PUSH_DATAp(struct nouveau_pushbuf *push, const void *data, uint32_t size)
+{
+   memcpy(push->cur, data, size * 4);
+   push->cur += size;
+}
+
+static INLINE void
+PUSH_DATAf(struct nouveau_pushbuf *push, float f)
+{
+   union { float f; uint32_t i; } u;
+   u.f = f;
+   PUSH_DATA(push, u.i);
+}
+
+static INLINE void
+PUSH_KICK(struct nouveau_pushbuf *push)
+{
+   nouveau_pushbuf_kick(push, push->channel);
+}
+
+
+#define NOUVEAU_RESOURCE_FLAG_LINEAR   (PIPE_RESOURCE_FLAG_DRV_PRIV << 0)
+#define NOUVEAU_RESOURCE_FLAG_DRV_PRIV (PIPE_RESOURCE_FLAG_DRV_PRIV << 1)
+
+static INLINE uint32_t
+nouveau_screen_transfer_flags(unsigned pipe)
+{
+       uint32_t flags = 0;
+
+       if (!(pipe & PIPE_TRANSFER_UNSYNCHRONIZED)) {
+               if (pipe & PIPE_TRANSFER_READ)
+                       flags |= NOUVEAU_BO_RD;
+               if (pipe & PIPE_TRANSFER_WRITE)
+                       flags |= NOUVEAU_BO_WR;
+               if (pipe & PIPE_TRANSFER_DONTBLOCK)
+                       flags |= NOUVEAU_BO_NOBLOCK;
+       }
+
+       return flags;
+}
 
 extern struct pipe_screen *
-nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *);
-
-extern struct pipe_context *
-nv30_create(struct pipe_screen *, unsigned pctx_id);
+nv30_screen_create(struct nouveau_device *);
 
 extern struct pipe_screen *
-nv40_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *);
-
-extern struct pipe_context *
-nv40_create(struct pipe_screen *, unsigned pctx_id);
+nv50_screen_create(struct nouveau_device *);
 
 extern struct pipe_screen *
-nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *);
-
-extern struct pipe_context *
-nv50_create(struct pipe_screen *, unsigned pctx_id);
+nvc0_screen_create(struct nouveau_device *);
 
 #endif