nouveau: share pushbuf interface code between pipe drivers
authorBen Skeggs <skeggsb@gmail.com>
Sun, 6 Jan 2008 14:02:30 +0000 (01:02 +1100)
committerBen Skeggs <skeggsb@gmail.com>
Sun, 6 Jan 2008 14:02:30 +0000 (01:02 +1100)
18 files changed:
src/mesa/pipe/nouveau/nouveau_push.h [new file with mode: 0644]
src/mesa/pipe/nv40/nv40_clear.c
src/mesa/pipe/nv40/nv40_context.c
src/mesa/pipe/nv40/nv40_context.h
src/mesa/pipe/nv40/nv40_fragprog.c
src/mesa/pipe/nv40/nv40_query.c
src/mesa/pipe/nv40/nv40_state.c
src/mesa/pipe/nv40/nv40_state_emit.c
src/mesa/pipe/nv40/nv40_state_tex.c
src/mesa/pipe/nv40/nv40_vbo.c
src/mesa/pipe/nv40/nv40_vertprog.c
src/mesa/pipe/nv50/nv50_clear.c
src/mesa/pipe/nv50/nv50_context.c
src/mesa/pipe/nv50/nv50_context.h
src/mesa/pipe/nv50/nv50_dma.h [deleted file]
src/mesa/pipe/nv50/nv50_query.c
src/mesa/pipe/nv50/nv50_state.c
src/mesa/pipe/nv50/nv50_vbo.c

diff --git a/src/mesa/pipe/nouveau/nouveau_push.h b/src/mesa/pipe/nouveau/nouveau_push.h
new file mode 100644 (file)
index 0000000..0fc972d
--- /dev/null
@@ -0,0 +1,75 @@
+#ifndef __NOUVEAU_PUSH_H__
+#define __NOUVEAU_PUSH_H__
+
+#include "pipe/nouveau/nouveau_winsys.h"
+
+#ifndef NOUVEAU_PUSH_CONTEXT
+#error undefined push context
+#endif
+
+#define OUT_RING(data) do {                                                    \
+       NOUVEAU_PUSH_CONTEXT(pc);                                              \
+       (*pc->nvws->channel->pushbuf->cur++) = (data);                         \
+} while(0)
+
+#define OUT_RINGp(src,size) do {                                               \
+       NOUVEAU_PUSH_CONTEXT(pc);                                              \
+       memcpy(pc->nvws->channel->pushbuf->cur, (src), (size) * 4);            \
+       pc->nvws->channel->pushbuf->cur += (size);                             \
+} while(0)
+
+#define OUT_RINGf(data) do {                                                   \
+       union { float v; uint32_t u; } c;                                      \
+       c.v = (data);                                                          \
+       OUT_RING(c.u);                                                         \
+} while(0)
+
+#define BEGIN_RING(obj,mthd,size) do {                                         \
+       NOUVEAU_PUSH_CONTEXT(pc);                                              \
+       if (pc->nvws->channel->pushbuf->remaining < ((size) + 1))              \
+               pc->nvws->push_flush(pc->nvws->channel, ((size) + 1));         \
+       OUT_RING((pc->obj->subc << 13) | ((size) << 18) | (mthd));             \
+       pc->nvws->channel->pushbuf->remaining -= ((size) + 1);                 \
+} while(0)
+
+#define BEGIN_RING_NI(obj,mthd,size) do {                                      \
+       BEGIN_RING(obj, (mthd) | 0x40000000, (size));                          \
+} while(0)
+
+#define FIRE_RING() do {                                                       \
+       NOUVEAU_PUSH_CONTEXT(pc);                                              \
+       pc->nvws->push_flush(pc->nvws->channel, 0);                            \
+} while(0)
+
+#define OUT_RELOC(bo,data,flags,vor,tor) do {                                  \
+       NOUVEAU_PUSH_CONTEXT(pc);                                              \
+       pc->nvws->push_reloc(pc->nvws->channel,                                \
+                            pc->nvws->channel->pushbuf->cur,                  \
+                            (struct nouveau_bo *)(bo),                        \
+                            (data), (flags), (vor), (tor));                   \
+       OUT_RING(0);                                                           \
+} while(0)
+
+/* Raw data + flags depending on FB/TT buffer */
+#define OUT_RELOCd(bo,data,flags,vor,tor) do {                                 \
+       OUT_RELOC((bo), (data), (flags) | NOUVEAU_BO_OR, (vor), (tor));        \
+} while(0)
+
+/* FB/TT object handle */
+#define OUT_RELOCo(bo,flags) do {                                              \
+       OUT_RELOC((bo), 0, (flags) | NOUVEAU_BO_OR,                            \
+                 pc->nvws->channel->vram->handle,                             \
+                 pc->nvws->channel->gart->handle);                            \
+} while(0)
+
+/* Low 32-bits of offset */
+#define OUT_RELOCl(bo,delta,flags) do {                                        \
+       OUT_RELOC((bo), (delta), (flags) | NOUVEAU_BO_LOW, 0, 0);              \
+} while(0)
+
+/* High 32-bits of offset */
+#define OUT_RELOCh(bo,delta,flags) do {                                        \
+       OUT_RELOC((bo), (delta), (flags) | NOUVEAU_BO_HIGH, 0, 0);             \
+} while(0)
+
+#endif
index 380a2a642fc78987c00b3788f8d0e83f563bd64f..2c4e8f01fdac7ff4406784dc888eb62864713925 100644 (file)
@@ -3,8 +3,6 @@
 #include "pipe/p_state.h"
 
 #include "nv40_context.h"
-#include "nv40_dma.h"
-
 
 void
 nv40_clear(struct pipe_context *pipe, struct pipe_surface *ps,
index 442ff04e7539ea15311a5924a426a345bdb40310..334e50ef892c08ace0fc9f76273e1b1111fc8dfb 100644 (file)
@@ -4,7 +4,6 @@
 #include "pipe/p_util.h"
 
 #include "nv40_context.h"
-#include "nv40_dma.h"
 
 static const char *
 nv40_get_name(struct pipe_context *pipe)
index 0a89ae8bedefe18c6ae199ba8680fc90326938a2..86aebbb927a28af6e1b85498b6a3a4866e3ee464 100644 (file)
 #include "pipe/nouveau/nouveau_winsys.h"
 #include "pipe/nouveau/nouveau_gldefs.h"
 
+#define NOUVEAU_PUSH_CONTEXT(ctx)                                              \
+       struct nv40_context *ctx = nv40
+#include "pipe/nouveau/nouveau_push.h"
+
 #include "nv40_state.h"
 
 #define NOUVEAU_ERR(fmt, args...) \
index 01bf5c3460baf1af0dfde3630a6171000f281f89..fded11d1703527c74a9e1312046c0d730230f4d0 100644 (file)
@@ -7,7 +7,6 @@
 #include "pipe/tgsi/util/tgsi_util.h"
 
 #include "nv40_context.h"
-#include "nv40_dma.h"
 
 #define SWZ_X 0
 #define SWZ_Y 1
index 6e5fcae8cad08300496b63813351b6991a638f93..ea30d3ede844e75a399e84a145ac745de2c1af46 100644 (file)
@@ -1,7 +1,6 @@
 #include "pipe/p_context.h"
 
 #include "nv40_context.h"
-#include "nv40_dma.h"
 
 struct nv40_query {
        struct nouveau_resource *object;
index 14e12626d437c9aa23b45a35a7549e802263eb8f..41de5650aa83b28be82b7d89fa3c97509c0d4137 100644 (file)
@@ -3,7 +3,6 @@
 #include "pipe/p_util.h"
 
 #include "nv40_context.h"
-#include "nv40_dma.h"
 #include "nv40_state.h"
 
 static void *
index 080ade3827fcf8219b60f3a93447cbe2fa18d9de..7bb69e617eecac3e5016b319132d52204dfd0548 100644 (file)
@@ -1,5 +1,4 @@
 #include "nv40_context.h"
-#include "nv40_dma.h"
 #include "nv40_state.h"
 
 void
index 8e8609f5c95631f54cb880e6bb1058255c0d1837..7c353c138fc6b81cc9d5a52640eb2c564a54c15f 100644 (file)
@@ -1,5 +1,4 @@
 #include "nv40_context.h"
-#include "nv40_dma.h"
 
 #define _(m,tf,ts0x,ts0y,ts0z,ts0w,ts1x,ts1y,ts1z,ts1w)                        \
 {                                                                              \
index d462e984003014e30159f0fedd1517bb776c5e0a..7cf089e007aae46453a688511af26afa2270c6a2 100644 (file)
@@ -3,7 +3,6 @@
 #include "pipe/p_util.h"
 
 #include "nv40_context.h"
-#include "nv40_dma.h"
 #include "nv40_state.h"
 
 #include "pipe/nouveau/nouveau_channel.h"
index 84618c1e1ba0ef1285bbb348f74cc8229407d44e..bd052fe8341d4bc91e7118834e10c06bef43f0e0 100644 (file)
@@ -6,7 +6,6 @@
 #include "pipe/tgsi/util/tgsi_parse.h"
 
 #include "nv40_context.h"
-#include "nv40_dma.h"
 #include "nv40_state.h"
 
 /* TODO (at least...):
index 2b453a49d152ad95273f45cac30e58ae1e64abfa..552b92f72e233b352e1aaaf73437cad6d7636f4b 100644 (file)
@@ -3,8 +3,6 @@
 #include "pipe/p_state.h"
 
 #include "nv50_context.h"
-#include "nv50_dma.h"
-
 
 void
 nv50_clear(struct pipe_context *pipe, struct pipe_surface *ps,
index ed12c6c0d93a4de6d25dd0949d843a592bfb5a32..33c8eebb0bcea2c0360c0286c4f316ee0f7db037 100644 (file)
@@ -4,7 +4,6 @@
 #include "pipe/p_util.h"
 
 #include "nv50_context.h"
-#include "nv50_dma.h"
 
 static boolean
 nv50_is_format_supported(struct pipe_context *pipe, enum pipe_format format,
index b1c4d5b8948707b21868e3ad8c9006ce9cdc9d60..c43202c3d5710e714f7a9cbaa50728aa29e4f458 100644 (file)
 #include "pipe/nouveau/nouveau_winsys.h"
 #include "pipe/nouveau/nouveau_gldefs.h"
 
+#define NOUVEAU_PUSH_CONTEXT(ctx)                                              \
+       struct nv50_context *ctx = nv50
+#include "pipe/nouveau/nouveau_push.h"
+
 #include "nv50_state.h"
 
 #define NOUVEAU_ERR(fmt, args...) \
diff --git a/src/mesa/pipe/nv50/nv50_dma.h b/src/mesa/pipe/nv50/nv50_dma.h
deleted file mode 100644 (file)
index 366316d..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-#ifndef __NV50_DMA_H__
-#define __NV50_DMA_H__
-
-#include "pipe/nouveau/nouveau_winsys.h"
-
-#define OUT_RING(data) do {                                                    \
-       (*nv50->nvws->channel->pushbuf->cur++) = (data);                       \
-} while(0)
-
-#define OUT_RINGp(src,size) do {                                               \
-       memcpy(nv50->nvws->channel->pushbuf->cur, (src), (size) * 4);          \
-       nv50->nvws->channel->pushbuf->cur += (size);                           \
-} while(0)
-
-#define OUT_RINGf(data) do {                                                   \
-       union { float v; uint32_t u; } c;                                      \
-       c.v = (data);                                                          \
-       OUT_RING(c.u);                                                         \
-} while(0)
-
-#define BEGIN_RING(obj,mthd,size) do {                                         \
-       if (nv50->nvws->channel->pushbuf->remaining < ((size) + 1))            \
-               nv50->nvws->push_flush(nv50->nvws->channel, ((size) + 1));     \
-       OUT_RING((nv50->obj->subc << 13) | ((size) << 18) | (mthd));           \
-       nv50->nvws->channel->pushbuf->remaining -= ((size) + 1);               \
-} while(0)
-
-#define BEGIN_RING_NI(obj,mthd,size) do {                                      \
-       BEGIN_RING(obj, (mthd) | 0x40000000, (size));                          \
-} while(0)
-
-#define FIRE_RING() do {                                                       \
-       nv50->nvws->push_flush(nv50->nvws->channel, 0);                        \
-} while(0)
-
-#define OUT_RELOC(bo,data,flags,vor,tor) do {                                  \
-       nv50->nvws->push_reloc(nv50->nvws->channel,                            \
-                              nv50->nvws->channel->pushbuf->cur,              \
-                              (struct nouveau_bo *)(bo),                      \
-                              (data), (flags), (vor), (tor));                 \
-       OUT_RING(0);                                                           \
-} while(0)
-
-/* Raw data + flags depending on FB/TT buffer */
-#define OUT_RELOCd(bo,data,flags,vor,tor) do {                                 \
-       OUT_RELOC((bo), (data), (flags) | NOUVEAU_BO_OR, (vor), (tor));        \
-} while(0)
-
-/* FB/TT object handle */
-#define OUT_RELOCo(bo,flags) do {                                              \
-       OUT_RELOC((bo), 0, (flags) | NOUVEAU_BO_OR,                            \
-                 nv50->nvws->channel->vram->handle,                           \
-                 nv50->nvws->channel->gart->handle);                          \
-} while(0)
-
-/* Low 32-bits of offset */
-#define OUT_RELOCl(bo,delta,flags) do {                                        \
-       OUT_RELOC((bo), (delta), (flags) | NOUVEAU_BO_LOW, 0, 0);              \
-} while(0)
-
-/* High 32-bits of offset */
-#define OUT_RELOCh(bo,delta,flags) do {                                        \
-       OUT_RELOC((bo), (delta), (flags) | NOUVEAU_BO_HIGH, 0, 0);             \
-} while(0)
-
-#endif
index 69eb0e700b49ae26eac1e3c189a46f10de567500..7e48e5121c2d958ba660f2383037c17e0f91bd99 100644 (file)
@@ -1,7 +1,6 @@
 #include "pipe/p_context.h"
 
 #include "nv50_context.h"
-#include "nv50_dma.h"
 
 static struct pipe_query *
 nv50_query_create(struct pipe_context *pipe, unsigned type)
index 25eac41c2fc87b08fe0d24c4199ae1889621d701..99dcab51b26ac7c778a2b57c1aae9265e96c17c5 100644 (file)
@@ -3,7 +3,6 @@
 #include "pipe/p_util.h"
 
 #include "nv50_context.h"
-#include "nv50_dma.h"
 #include "nv50_state.h"
 
 static void *
@@ -85,6 +84,7 @@ static void *
 nv50_vp_state_create(struct pipe_context *pipe,
                     const struct pipe_shader_state *cso)
 {
+       return NULL;
 }
 
 static void
@@ -101,6 +101,7 @@ static void *
 nv50_fp_state_create(struct pipe_context *pipe,
                     const struct pipe_shader_state *cso)
 {
+       return NULL;
 }
 
 static void
index faae08f60141e0c62ed54270c9dad7942a9590cd..0c9d2806d78c7e72798690c1eebb49b5ad4c8bd2 100644 (file)
@@ -3,7 +3,6 @@
 #include "pipe/p_util.h"
 
 #include "nv50_context.h"
-#include "nv50_dma.h"
 #include "nv50_state.h"
 
 boolean