From 6df4eda0004bed4c11f171db9f1bbb1533cdd216 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 10 Jun 2022 13:42:25 +1000 Subject: [PATCH] nouveau/ws: drop the old push generators. leave drf.h as it's need for the compute qmd stuff. Part-of: --- src/nouveau/winsys/nouveau_push.h | 296 -------------------------------------- src/nouveau/winsys/push906f.h | 49 ------- 2 files changed, 345 deletions(-) delete mode 100644 src/nouveau/winsys/push906f.h diff --git a/src/nouveau/winsys/nouveau_push.h b/src/nouveau/winsys/nouveau_push.h index 970adc8..5e04055 100644 --- a/src/nouveau/winsys/nouveau_push.h +++ b/src/nouveau/winsys/nouveau_push.h @@ -31,302 +31,6 @@ int nouveau_ws_push_submit(struct nouveau_ws_push *, struct nouveau_ws_device *, void nouveau_ws_push_ref(struct nouveau_ws_push *, struct nouveau_ws_bo *, enum nouveau_ws_bo_map_flags); void nouveau_ws_push_reset(struct nouveau_ws_push *); -#ifdef CONFIG_NOUVEAU_DEBUG_PUSH -#define PUSH_PRINTF(p,f,a...) do { \ - struct nouveau_ws_push *_ppp = (p); \ - uint32_t __o = _ppp->map - (uint32_t *)_ppp->mem.object.map.ptr; \ - NVIF_DEBUG(&_ppp->mem.object, "%08x: "f, __o * 4, ##a); \ - (void)__o; \ -} while(0) -#define PUSH_ASSERT_ON(a,b) WARN((a), b) -#else -#define PUSH_PRINTF(p,f,a...) -#define PUSH_ASSERT_ON(a, b) -#endif - -#define PUSH_ASSERT(a,b) do { \ - static_assert( \ - __builtin_choose_expr(__builtin_constant_p(a), (a), 1), b \ - ); \ - PUSH_ASSERT_ON(!(a), b); \ -} while(0) - -#define PUSH_DATA__(p,d,f,a...) do { \ - struct nouveau_ws_push *_p = (p); \ - uint32_t _d = (d); \ - PUSH_ASSERT(_p->map < _p->end, "pushbuf overrun"); \ - PUSH_PRINTF(_p, "%08x"f, _d, ##a); \ - *_p->map++ = _d; \ -} while(0) - -#define PUSH_DATA_(X,p,m,i0,i1,d,s,f,a...) PUSH_DATA__((p), (d), "-> "#m f, ##a) -#define PUSH_DATA(p,d) PUSH_DATA__((p), (d), " data - %s", __func__) - -//XXX: error-check this against *real* pushbuffer end? -#define PUSH_RSVD(p,d) do { \ - struct nouveau_ws_push *__p = (p); \ - __p->end++; \ - d; \ -} while(0) - -#ifdef CONFIG_NOUVEAU_DEBUG_PUSH -#define PUSH_DATAp(X,p,m,i,o,d,s,f,a...) do { \ - struct nouveau_ws_push *_pp = (p); \ - const uint32_t *_dd = (d); \ - uint32_t _s = (s), _i = (i?PUSH_##o##_INC); \ - if (_s--) { \ - PUSH_DATA_(X, _pp, X##m, i0, i1, *_dd++, 1, "+0x%x", 0); \ - while (_s--) { \ - PUSH_DATA_(X, _pp, X##m, i0, i1, *_dd++, 1, "+0x%x", _i); \ - _i += (0?PUSH_##o##_INC); \ - } \ - } \ -} while(0) -#else -#define PUSH_DATAp(X,p,m,i,o,d,s,f,a...) do { \ - struct nouveau_ws_push *_p = (p); \ - uint32_t _s = (s); \ - PUSH_ASSERT(_p->map + _s <= _p->end, "pushbuf overrun"); \ - memcpy(_p->map, (d), _s << 2); \ - _p->map += _s; \ -} while(0) -#endif - -#define PUSH_1(X,f,ds,n,o,p,s,mA,dA) do { \ - PUSH_##o##_HDR((p), s, mA, (ds)+(n)); \ - PUSH_##f(X, (p), X##mA, 1, o, (dA), ds, ""); \ -} while(0) -#define PUSH_2(X,f,ds,n,o,p,s,mB,dB,mA,dA,a...) do { \ - PUSH_ASSERT((mB) - (mA) == (1?PUSH_##o##_INC), "mthd1"); \ - PUSH_1(X, DATA_, 1, (ds) + (n), o, (p), s, X##mA, (dA), ##a); \ - PUSH_##f(X, (p), X##mB, 0, o, (dB), ds, ""); \ -} while(0) -#define PUSH_3(X,f,ds,n,o,p,s,mB,dB,mA,dA,a...) do { \ - PUSH_ASSERT((mB) - (mA) == (0?PUSH_##o##_INC), "mthd2"); \ - PUSH_2(X, DATA_, 1, (ds) + (n), o, (p), s, X##mA, (dA), ##a); \ - PUSH_##f(X, (p), X##mB, 0, o, (dB), ds, ""); \ -} while(0) -#define PUSH_4(X,f,ds,n,o,p,s,mB,dB,mA,dA,a...) do { \ - PUSH_ASSERT((mB) - (mA) == (0?PUSH_##o##_INC), "mthd3"); \ - PUSH_3(X, DATA_, 1, (ds) + (n), o, (p), s, X##mA, (dA), ##a); \ - PUSH_##f(X, (p), X##mB, 0, o, (dB), ds, ""); \ -} while(0) -#define PUSH_5(X,f,ds,n,o,p,s,mB,dB,mA,dA,a...) do { \ - PUSH_ASSERT((mB) - (mA) == (0?PUSH_##o##_INC), "mthd4"); \ - PUSH_4(X, DATA_, 1, (ds) + (n), o, (p), s, X##mA, (dA), ##a); \ - PUSH_##f(X, (p), X##mB, 0, o, (dB), ds, ""); \ -} while(0) -#define PUSH_6(X,f,ds,n,o,p,s,mB,dB,mA,dA,a...) do { \ - PUSH_ASSERT((mB) - (mA) == (0?PUSH_##o##_INC), "mthd5"); \ - PUSH_5(X, DATA_, 1, (ds) + (n), o, (p), s, X##mA, (dA), ##a); \ - PUSH_##f(X, (p), X##mB, 0, o, (dB), ds, ""); \ -} while(0) -#define PUSH_7(X,f,ds,n,o,p,s,mB,dB,mA,dA,a...) do { \ - PUSH_ASSERT((mB) - (mA) == (0?PUSH_##o##_INC), "mthd6"); \ - PUSH_6(X, DATA_, 1, (ds) + (n), o, (p), s, X##mA, (dA), ##a); \ - PUSH_##f(X, (p), X##mB, 0, o, (dB), ds, ""); \ -} while(0) -#define PUSH_8(X,f,ds,n,o,p,s,mB,dB,mA,dA,a...) do { \ - PUSH_ASSERT((mB) - (mA) == (0?PUSH_##o##_INC), "mthd7"); \ - PUSH_7(X, DATA_, 1, (ds) + (n), o, (p), s, X##mA, (dA), ##a); \ - PUSH_##f(X, (p), X##mB, 0, o, (dB), ds, ""); \ -} while(0) -#define PUSH_9(X,f,ds,n,o,p,s,mB,dB,mA,dA,a...) do { \ - PUSH_ASSERT((mB) - (mA) == (0?PUSH_##o##_INC), "mthd8"); \ - PUSH_8(X, DATA_, 1, (ds) + (n), o, (p), s, X##mA, (dA), ##a); \ - PUSH_##f(X, (p), X##mB, 0, o, (dB), ds, ""); \ -} while(0) -#define PUSH_10(X,f,ds,n,o,p,s,mB,dB,mA,dA,a...) do { \ - PUSH_ASSERT((mB) - (mA) == (0?PUSH_##o##_INC), "mthd9"); \ - PUSH_9(X, DATA_, 1, (ds) + (n), o, (p), s, X##mA, (dA), ##a); \ - PUSH_##f(X, (p), X##mB, 0, o, (dB), ds, ""); \ -} while(0) - -#define PUSH_1D(X,o,p,s,mA,dA) \ - PUSH_1(X, DATA_, 1, 0, o, (p), s, X##mA, (dA)) -#define PUSH_2D(X,o,p,s,mA,dA,mB,dB) \ - PUSH_2(X, DATA_, 1, 0, o, (p), s, X##mB, (dB), \ - X##mA, (dA)) -#define PUSH_3D(X,o,p,s,mA,dA,mB,dB,mC,dC) \ - PUSH_3(X, DATA_, 1, 0, o, (p), s, X##mC, (dC), \ - X##mB, (dB), \ - X##mA, (dA)) -#define PUSH_4D(X,o,p,s,mA,dA,mB,dB,mC,dC,mD,dD) \ - PUSH_4(X, DATA_, 1, 0, o, (p), s, X##mD, (dD), \ - X##mC, (dC), \ - X##mB, (dB), \ - X##mA, (dA)) -#define PUSH_5D(X,o,p,s,mA,dA,mB,dB,mC,dC,mD,dD,mE,dE) \ - PUSH_5(X, DATA_, 1, 0, o, (p), s, X##mE, (dE), \ - X##mD, (dD), \ - X##mC, (dC), \ - X##mB, (dB), \ - X##mA, (dA)) -#define PUSH_6D(X,o,p,s,mA,dA,mB,dB,mC,dC,mD,dD,mE,dE,mF,dF) \ - PUSH_6(X, DATA_, 1, 0, o, (p), s, X##mF, (dF), \ - X##mE, (dE), \ - X##mD, (dD), \ - X##mC, (dC), \ - X##mB, (dB), \ - X##mA, (dA)) -#define PUSH_7D(X,o,p,s,mA,dA,mB,dB,mC,dC,mD,dD,mE,dE,mF,dF,mG,dG) \ - PUSH_7(X, DATA_, 1, 0, o, (p), s, X##mG, (dG), \ - X##mF, (dF), \ - X##mE, (dE), \ - X##mD, (dD), \ - X##mC, (dC), \ - X##mB, (dB), \ - X##mA, (dA)) -#define PUSH_8D(X,o,p,s,mA,dA,mB,dB,mC,dC,mD,dD,mE,dE,mF,dF,mG,dG,mH,dH) \ - PUSH_8(X, DATA_, 1, 0, o, (p), s, X##mH, (dH), \ - X##mG, (dG), \ - X##mF, (dF), \ - X##mE, (dE), \ - X##mD, (dD), \ - X##mC, (dC), \ - X##mB, (dB), \ - X##mA, (dA)) -#define PUSH_9D(X,o,p,s,mA,dA,mB,dB,mC,dC,mD,dD,mE,dE,mF,dF,mG,dG,mH,dH,mI,dI) \ - PUSH_9(X, DATA_, 1, 0, o, (p), s, X##mI, (dI), \ - X##mH, (dH), \ - X##mG, (dG), \ - X##mF, (dF), \ - X##mE, (dE), \ - X##mD, (dD), \ - X##mC, (dC), \ - X##mB, (dB), \ - X##mA, (dA)) -#define PUSH_10D(X,o,p,s,mA,dA,mB,dB,mC,dC,mD,dD,mE,dE,mF,dF,mG,dG,mH,dH,mI,dI,mJ,dJ) \ - PUSH_10(X, DATA_, 1, 0, o, (p), s, X##mJ, (dJ), \ - X##mI, (dI), \ - X##mH, (dH), \ - X##mG, (dG), \ - X##mF, (dF), \ - X##mE, (dE), \ - X##mD, (dD), \ - X##mC, (dC), \ - X##mB, (dB), \ - X##mA, (dA)) - -#define PUSH_1P(X,o,p,s,mA,dp,ds) \ - PUSH_1(X, DATAp, ds, 0, o, (p), s, X##mA, (dp)) -#define PUSH_2P(X,o,p,s,mA,dA,mB,dp,ds) \ - PUSH_2(X, DATAp, ds, 0, o, (p), s, X##mB, (dp), \ - X##mA, (dA)) -#define PUSH_3P(X,o,p,s,mA,dA,mB,dB,mC,dp,ds) \ - PUSH_3(X, DATAp, ds, 0, o, (p), s, X##mC, (dp), \ - X##mB, (dB), \ - X##mA, (dA)) - -#define PUSH_(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,IMPL,...) IMPL -#define PUSH(A...) PUSH_(A, PUSH_10P, PUSH_10D, \ - PUSH_9P , PUSH_9D, \ - PUSH_8P , PUSH_8D, \ - PUSH_7P , PUSH_7D, \ - PUSH_6P , PUSH_6D, \ - PUSH_5P , PUSH_5D, \ - PUSH_4P , PUSH_4D, \ - PUSH_3P , PUSH_3D, \ - PUSH_2P , PUSH_2D, \ - PUSH_1P , PUSH_1D)(, ##A) - -#define PUSH_NVIM(p,c,m,d) do { \ - struct nouveau_ws_push *__p = (p); \ - uint32_t __d = (d); \ - assert(!(__d & ~0xffff) && "immediate value must be 16 bit"); \ - PUSH_IMMD_HDR(__p, c, m, __d); \ - __p->map--; \ - PUSH_PRINTF(__p, "%08x-> "#m, __d); \ - __p->map++; \ -} while(0) -#define PUSH_NVSQ(A...) PUSH(MTHD, ##A) -#define PUSH_NV1I(A...) PUSH(1INC, ##A) -#define PUSH_NVNI(A...) PUSH(NINC, ##A) - - -#define PUSH_NV_1(X,o,p,c,mA,d...) \ - PUSH_##o(p,c,c##_##mA,d) -#define PUSH_NV_2(X,o,p,c,mA,dA,mB,d...) \ - PUSH_##o(p,c,c##_##mA,dA, \ - c##_##mB,d) -#define PUSH_NV_3(X,o,p,c,mA,dA,mB,dB,mC,d...) \ - PUSH_##o(p,c,c##_##mA,dA, \ - c##_##mB,dB, \ - c##_##mC,d) -#define PUSH_NV_4(X,o,p,c,mA,dA,mB,dB,mC,dC,mD,d...) \ - PUSH_##o(p,c,c##_##mA,dA, \ - c##_##mB,dB, \ - c##_##mC,dC, \ - c##_##mD,d) -#define PUSH_NV_5(X,o,p,c,mA,dA,mB,dB,mC,dC,mD,dD,mE,d...) \ - PUSH_##o(p,c,c##_##mA,dA, \ - c##_##mB,dB, \ - c##_##mC,dC, \ - c##_##mD,dD, \ - c##_##mE,d) -#define PUSH_NV_6(X,o,p,c,mA,dA,mB,dB,mC,dC,mD,dD,mE,dE,mF,d...) \ - PUSH_##o(p,c,c##_##mA,dA, \ - c##_##mB,dB, \ - c##_##mC,dC, \ - c##_##mD,dD, \ - c##_##mE,dE, \ - c##_##mF,d) -#define PUSH_NV_7(X,o,p,c,mA,dA,mB,dB,mC,dC,mD,dD,mE,dE,mF,dF,mG,d...) \ - PUSH_##o(p,c,c##_##mA,dA, \ - c##_##mB,dB, \ - c##_##mC,dC, \ - c##_##mD,dD, \ - c##_##mE,dE, \ - c##_##mF,dF, \ - c##_##mG,d) -#define PUSH_NV_8(X,o,p,c,mA,dA,mB,dB,mC,dC,mD,dD,mE,dE,mF,dF,mG,dG,mH,d...) \ - PUSH_##o(p,c,c##_##mA,dA, \ - c##_##mB,dB, \ - c##_##mC,dC, \ - c##_##mD,dD, \ - c##_##mE,dE, \ - c##_##mF,dF, \ - c##_##mG,dG, \ - c##_##mH,d) -#define PUSH_NV_9(X,o,p,c,mA,dA,mB,dB,mC,dC,mD,dD,mE,dE,mF,dF,mG,dG,mH,dH,mI,d...) \ - PUSH_##o(p,c,c##_##mA,dA, \ - c##_##mB,dB, \ - c##_##mC,dC, \ - c##_##mD,dD, \ - c##_##mE,dE, \ - c##_##mF,dF, \ - c##_##mG,dG, \ - c##_##mH,dH, \ - c##_##mI,d) -#define PUSH_NV_10(X,o,p,c,mA,dA,mB,dB,mC,dC,mD,dD,mE,dE,mF,dF,mG,dG,mH,dH,mI,dI,mJ,d...) \ - PUSH_##o(p,c,c##_##mA,dA, \ - c##_##mB,dB, \ - c##_##mC,dC, \ - c##_##mD,dD, \ - c##_##mE,dE, \ - c##_##mF,dF, \ - c##_##mG,dG, \ - c##_##mH,dH, \ - c##_##mI,dI, \ - c##_##mJ,d) - -#define PUSH_NV_(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,IMPL,...) IMPL -#define PUSH_NV(A...) PUSH_NV_(A, PUSH_NV_10, PUSH_NV_10, \ - PUSH_NV_9 , PUSH_NV_9, \ - PUSH_NV_8 , PUSH_NV_8, \ - PUSH_NV_7 , PUSH_NV_7, \ - PUSH_NV_6 , PUSH_NV_6, \ - PUSH_NV_5 , PUSH_NV_5, \ - PUSH_NV_4 , PUSH_NV_4, \ - PUSH_NV_3 , PUSH_NV_3, \ - PUSH_NV_2 , PUSH_NV_2, \ - PUSH_NV_1 , PUSH_NV_1)(, ##A) - -#define PUSH_IMMD(A...) PUSH_NV(NVIM, ##A) -#define PUSH_MTHD(A...) PUSH_NV(NVSQ, ##A) -#define PUSH_1INC(A...) PUSH_NV(NV1I, ##A) -#define PUSH_NINC(A...) PUSH_NV(NVNI, ##A) - #define SUBC_NV902D 3 #define SUBC_NV90B5 4 diff --git a/src/nouveau/winsys/push906f.h b/src/nouveau/winsys/push906f.h deleted file mode 100644 index d9fa93b..0000000 --- a/src/nouveau/winsys/push906f.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef __NVIF_PUSH906F_H__ -#define __NVIF_PUSH906F_H__ - -#include "drf.h" -#include "classes/cl906f.h" - -#ifndef PUSH906F_SUBC -// Host methods -#define PUSH906F_SUBC_NV906F 0 - -// Twod -#define PUSH906F_SUBC_NV902D 3 - -// MemoryToMemoryFormat -#define PUSH906F_SUBC_NV9039 4 - -// DmaCopy -#define PUSH906F_SUBC_NV90B5 4 -#define PUSH906F_SUBC_NVA0B5 4 -#define PUSH906F_SUBC_NVC1B5 4 -#endif - -#define PUSH_HDR(p,o,n,f,s,m,c) do { \ - PUSH_ASSERT(!((s) & ~DRF_MASK(NV906F_DMA_METHOD_SUBCHANNEL)), "subc"); \ - PUSH_ASSERT(!((m) & ~(DRF_MASK(NV906F_DMA_METHOD_ADDRESS) << 2)), "mthd"); \ - PUSH_ASSERT(!((c) & ~DRF_MASK(NV906F_DMA_METHOD_COUNT)), "count/immd"); \ - PUSH_DATA__((p), NVVAL(NV906F, DMA, METHOD_ADDRESS, (m) >> 2) | \ - NVVAL(NV906F, DMA, METHOD_SUBCHANNEL, (s)) | \ - NVVAL(NV906F, DMA, METHOD_COUNT, (c)) | \ - NVDEF(NV906F, DMA, SEC_OP, o), \ - " "n" subc %d mthd 0x%04x "f" - %s", \ - (u32)(s), (u32)(m), (u32)(c), __func__); \ -} while(0) - -#define PUSH_MTHD_INC 4:4 -#define PUSH_MTHD_HDR(p,c,m,n) \ - PUSH_HDR(p, INC_METHOD, "incr", "size %d", PUSH906F_SUBC_##c, m, n) - -#define PUSH_NINC_INC 0:0 -#define PUSH_NINC_HDR(p,c,m,n) \ - PUSH_HDR(p, NON_INC_METHOD, "ninc", "size %d", PUSH906F_SUBC_##c, m, n) - -#define PUSH_IMMD_HDR(p,c,m,n) \ - PUSH_HDR(p, IMMD_DATA_METHOD, "immd", "data 0x%04x", PUSH906F_SUBC_##c, m, n) - -#define PUSH_1INC_INC 4:0 -#define PUSH_1INC_HDR(p,c,m,n) \ - PUSH_HDR(p, ONE_INC, "oinc", "size %d", PUSH906F_SUBC_##c, m, n) -#endif -- 2.7.4