From 9bac4c7268cdbc79a1ce2d05779ed05c32e1e57b Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Mon, 7 Jan 2008 01:02:30 +1100 Subject: [PATCH] nouveau: share pushbuf interface code between pipe drivers --- .../{nv50/nv50_dma.h => nouveau/nouveau_push.h} | 41 +++++++++++++--------- src/mesa/pipe/nv40/nv40_clear.c | 2 -- src/mesa/pipe/nv40/nv40_context.c | 1 - src/mesa/pipe/nv40/nv40_context.h | 4 +++ src/mesa/pipe/nv40/nv40_fragprog.c | 1 - src/mesa/pipe/nv40/nv40_query.c | 1 - src/mesa/pipe/nv40/nv40_state.c | 1 - src/mesa/pipe/nv40/nv40_state_emit.c | 1 - src/mesa/pipe/nv40/nv40_state_tex.c | 1 - src/mesa/pipe/nv40/nv40_vbo.c | 1 - src/mesa/pipe/nv40/nv40_vertprog.c | 1 - src/mesa/pipe/nv50/nv50_clear.c | 2 -- src/mesa/pipe/nv50/nv50_context.c | 1 - src/mesa/pipe/nv50/nv50_context.h | 4 +++ src/mesa/pipe/nv50/nv50_query.c | 1 - src/mesa/pipe/nv50/nv50_state.c | 3 +- src/mesa/pipe/nv50/nv50_vbo.c | 1 - 17 files changed, 35 insertions(+), 32 deletions(-) rename src/mesa/pipe/{nv50/nv50_dma.h => nouveau/nouveau_push.h} (58%) diff --git a/src/mesa/pipe/nv50/nv50_dma.h b/src/mesa/pipe/nouveau/nouveau_push.h similarity index 58% rename from src/mesa/pipe/nv50/nv50_dma.h rename to src/mesa/pipe/nouveau/nouveau_push.h index 366316d..0fc972d 100644 --- a/src/mesa/pipe/nv50/nv50_dma.h +++ b/src/mesa/pipe/nouveau/nouveau_push.h @@ -1,15 +1,21 @@ -#ifndef __NV50_DMA_H__ -#define __NV50_DMA_H__ +#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 { \ - (*nv50->nvws->channel->pushbuf->cur++) = (data); \ + NOUVEAU_PUSH_CONTEXT(pc); \ + (*pc->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); \ + 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 { \ @@ -19,10 +25,11 @@ } 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); \ + 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 { \ @@ -30,14 +37,16 @@ } while(0) #define FIRE_RING() do { \ - nv50->nvws->push_flush(nv50->nvws->channel, 0); \ + NOUVEAU_PUSH_CONTEXT(pc); \ + pc->nvws->push_flush(pc->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)); \ + 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) @@ -49,8 +58,8 @@ /* 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); \ + pc->nvws->channel->vram->handle, \ + pc->nvws->channel->gart->handle); \ } while(0) /* Low 32-bits of offset */ diff --git a/src/mesa/pipe/nv40/nv40_clear.c b/src/mesa/pipe/nv40/nv40_clear.c index 380a2a6..2c4e8f0 100644 --- a/src/mesa/pipe/nv40/nv40_clear.c +++ b/src/mesa/pipe/nv40/nv40_clear.c @@ -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, diff --git a/src/mesa/pipe/nv40/nv40_context.c b/src/mesa/pipe/nv40/nv40_context.c index 442ff04..334e50e 100644 --- a/src/mesa/pipe/nv40/nv40_context.c +++ b/src/mesa/pipe/nv40/nv40_context.c @@ -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) diff --git a/src/mesa/pipe/nv40/nv40_context.h b/src/mesa/pipe/nv40/nv40_context.h index 0a89ae8..86aebbb 100644 --- a/src/mesa/pipe/nv40/nv40_context.h +++ b/src/mesa/pipe/nv40/nv40_context.h @@ -10,6 +10,10 @@ #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...) \ diff --git a/src/mesa/pipe/nv40/nv40_fragprog.c b/src/mesa/pipe/nv40/nv40_fragprog.c index 01bf5c3..fded11d 100644 --- a/src/mesa/pipe/nv40/nv40_fragprog.c +++ b/src/mesa/pipe/nv40/nv40_fragprog.c @@ -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 diff --git a/src/mesa/pipe/nv40/nv40_query.c b/src/mesa/pipe/nv40/nv40_query.c index 6e5fcae..ea30d3ed 100644 --- a/src/mesa/pipe/nv40/nv40_query.c +++ b/src/mesa/pipe/nv40/nv40_query.c @@ -1,7 +1,6 @@ #include "pipe/p_context.h" #include "nv40_context.h" -#include "nv40_dma.h" struct nv40_query { struct nouveau_resource *object; diff --git a/src/mesa/pipe/nv40/nv40_state.c b/src/mesa/pipe/nv40/nv40_state.c index 14e1262..41de565 100644 --- a/src/mesa/pipe/nv40/nv40_state.c +++ b/src/mesa/pipe/nv40/nv40_state.c @@ -3,7 +3,6 @@ #include "pipe/p_util.h" #include "nv40_context.h" -#include "nv40_dma.h" #include "nv40_state.h" static void * diff --git a/src/mesa/pipe/nv40/nv40_state_emit.c b/src/mesa/pipe/nv40/nv40_state_emit.c index 080ade3..7bb69e6 100644 --- a/src/mesa/pipe/nv40/nv40_state_emit.c +++ b/src/mesa/pipe/nv40/nv40_state_emit.c @@ -1,5 +1,4 @@ #include "nv40_context.h" -#include "nv40_dma.h" #include "nv40_state.h" void diff --git a/src/mesa/pipe/nv40/nv40_state_tex.c b/src/mesa/pipe/nv40/nv40_state_tex.c index 8e8609f..7c353c1 100644 --- a/src/mesa/pipe/nv40/nv40_state_tex.c +++ b/src/mesa/pipe/nv40/nv40_state_tex.c @@ -1,5 +1,4 @@ #include "nv40_context.h" -#include "nv40_dma.h" #define _(m,tf,ts0x,ts0y,ts0z,ts0w,ts1x,ts1y,ts1z,ts1w) \ { \ diff --git a/src/mesa/pipe/nv40/nv40_vbo.c b/src/mesa/pipe/nv40/nv40_vbo.c index d462e98..7cf089e 100644 --- a/src/mesa/pipe/nv40/nv40_vbo.c +++ b/src/mesa/pipe/nv40/nv40_vbo.c @@ -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" diff --git a/src/mesa/pipe/nv40/nv40_vertprog.c b/src/mesa/pipe/nv40/nv40_vertprog.c index 84618c1..bd052fe 100644 --- a/src/mesa/pipe/nv40/nv40_vertprog.c +++ b/src/mesa/pipe/nv40/nv40_vertprog.c @@ -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...): diff --git a/src/mesa/pipe/nv50/nv50_clear.c b/src/mesa/pipe/nv50/nv50_clear.c index 2b453a4..552b92f 100644 --- a/src/mesa/pipe/nv50/nv50_clear.c +++ b/src/mesa/pipe/nv50/nv50_clear.c @@ -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, diff --git a/src/mesa/pipe/nv50/nv50_context.c b/src/mesa/pipe/nv50/nv50_context.c index ed12c6c..33c8eeb 100644 --- a/src/mesa/pipe/nv50/nv50_context.c +++ b/src/mesa/pipe/nv50/nv50_context.c @@ -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, diff --git a/src/mesa/pipe/nv50/nv50_context.h b/src/mesa/pipe/nv50/nv50_context.h index b1c4d5b..c43202c 100644 --- a/src/mesa/pipe/nv50/nv50_context.h +++ b/src/mesa/pipe/nv50/nv50_context.h @@ -10,6 +10,10 @@ #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_query.c b/src/mesa/pipe/nv50/nv50_query.c index 69eb0e7..7e48e51 100644 --- a/src/mesa/pipe/nv50/nv50_query.c +++ b/src/mesa/pipe/nv50/nv50_query.c @@ -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) diff --git a/src/mesa/pipe/nv50/nv50_state.c b/src/mesa/pipe/nv50/nv50_state.c index 25eac41..99dcab5 100644 --- a/src/mesa/pipe/nv50/nv50_state.c +++ b/src/mesa/pipe/nv50/nv50_state.c @@ -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 diff --git a/src/mesa/pipe/nv50/nv50_vbo.c b/src/mesa/pipe/nv50/nv50_vbo.c index faae08f..0c9d280 100644 --- a/src/mesa/pipe/nv50/nv50_vbo.c +++ b/src/mesa/pipe/nv50/nv50_vbo.c @@ -3,7 +3,6 @@ #include "pipe/p_util.h" #include "nv50_context.h" -#include "nv50_dma.h" #include "nv50_state.h" boolean -- 2.7.4