Path: blob/21.2-virgl/src/gallium/drivers/nouveau/nv30/nv30_winsys.h
4574 views
#ifndef __NV30_WINSYS_H__1#define __NV30_WINSYS_H__23#include <string.h>4#include "nouveau_winsys.h"5#include "nouveau_buffer.h"67/*XXX: rnn */8#define NV40_3D_VTXTEX_OFFSET(i) (0x0900 + ((i) * 0x20)) // 401e809#define NV40_3D_VTXTEX_FORMAT(i) (0x0904 + ((i) * 0x20)) // 401e9010#define NV40_3D_VTXTEX_WRAP(i) (0x0908 + ((i) * 0x20)) // 401ea011#define NV40_3D_VTXTEX_ENABLE(i) (0x090c + ((i) * 0x20)) // 401eb012#define NV40_3D_VTXTEX_SWZ(i) (0x0910 + ((i) * 0x20)) // 401ec013#define NV40_3D_VTXTEX_FILTER(i) (0x0914 + ((i) * 0x20)) // 401ed014#define NV40_3D_VTXTEX_SIZE(i) (0x0918 + ((i) * 0x20)) // 401ee015#define NV40_3D_VTXTEX_BCOL(i) (0x091c + ((i) * 0x20)) // 401ef016#define NV30_3D_VTX_CACHE_INVALIDATE_1710 0x171017#define NV30_3D_R1718 0x171818#define NV40_3D_PRIM_RESTART_ENABLE 0x1dac19#define NV40_3D_PRIM_RESTART_INDEX 0x1db02021static inline void22PUSH_RELOC(struct nouveau_pushbuf *push, struct nouveau_bo *bo, uint32_t offset,23uint32_t flags, uint32_t vor, uint32_t tor)24{25nouveau_pushbuf_reloc(push, bo, offset, flags, vor, tor);26}2728static inline struct nouveau_bufctx *29bufctx(struct nouveau_pushbuf *push)30{31struct nouveau_bufctx **pctx = push->user_priv;32return *pctx;33}3435static inline void36PUSH_RESET(struct nouveau_pushbuf *push, int bin)37{38nouveau_bufctx_reset(bufctx(push), bin);39}4041static inline void42PUSH_REFN(struct nouveau_pushbuf *push, int bin,43struct nouveau_bo *bo, uint32_t access)44{45nouveau_bufctx_refn(bufctx(push), bin, bo, access);46}4748static inline void49PUSH_MTHDl(struct nouveau_pushbuf *push, int subc, int mthd, int bin,50struct nouveau_bo *bo, uint32_t offset, uint32_t access)51{52nouveau_bufctx_mthd(bufctx(push), bin, (1 << 18) | (subc << 13) | mthd,53bo, offset, access | NOUVEAU_BO_LOW, 0, 0)->priv = NULL;54PUSH_DATA(push, bo->offset + offset);55}5657static inline void58PUSH_MTHDo(struct nouveau_pushbuf *push, int subc, int mthd, int bin,59struct nouveau_bo *bo, uint32_t access, uint32_t vor, uint32_t tor)60{61nouveau_bufctx_mthd(bufctx(push), bin, (1 << 18) | (subc << 13) | mthd,62bo, 0, access | NOUVEAU_BO_OR, vor, tor)->priv = NULL;63if (bo->flags & NOUVEAU_BO_VRAM)64PUSH_DATA(push, vor);65else66PUSH_DATA(push, tor);67}6869static inline void70PUSH_MTHDs(struct nouveau_pushbuf *push, int subc, int mthd, int bin,71struct nouveau_bo *bo, uint32_t data, uint32_t access,72uint32_t vor, uint32_t tor)73{74nouveau_bufctx_mthd(bufctx(push), bin, (1 << 18) | (subc << 13) | mthd,75bo, data, access | NOUVEAU_BO_OR, vor, tor)->priv = NULL;76if (bo->flags & NOUVEAU_BO_VRAM)77PUSH_DATA(push, data | vor);78else79PUSH_DATA(push, data | tor);80}8182static inline struct nouveau_bufref *83PUSH_MTHD(struct nouveau_pushbuf *push, int subc, int mthd, int bin,84struct nouveau_bo *bo, uint32_t data, uint32_t access,85uint32_t vor, uint32_t tor)86{87struct nouveau_bufref *bref =88nouveau_bufctx_mthd(bufctx(push), bin, (1 << 18) | (subc << 13) | mthd,89bo, data, access | NOUVEAU_BO_OR, vor, tor);90if (access & NOUVEAU_BO_LOW)91data += bo->offset;92if (bo->flags & NOUVEAU_BO_VRAM)93data |= vor;94else95data |= tor;96PUSH_DATA(push, data);97bref->priv = NULL;98return bref;99}100101static inline void102PUSH_RESRC(struct nouveau_pushbuf *push, int subc, int mthd, int bin,103struct nv04_resource *r, uint32_t data, uint32_t access,104uint32_t vor, uint32_t tor)105{106PUSH_MTHD(push, subc, mthd, bin, r->bo, r->offset + data,107r->domain | access, vor, tor)->priv = r;108}109110static inline void111BEGIN_NV04(struct nouveau_pushbuf *push, int subc, int mthd, int size)112{113PUSH_SPACE(push, size + 1);114PUSH_DATA (push, 0x00000000 | (size << 18) | (subc << 13) | mthd);115}116117static inline void118BEGIN_NI04(struct nouveau_pushbuf *push, int subc, int mthd, int size)119{120PUSH_SPACE(push, size + 1);121PUSH_DATA (push, 0x40000000 | (size << 18) | (subc << 13) | mthd);122}123124/* subchannel assignment125*126* 0: <1.0.0 - used by kernel for m2mf127* 1.0.0 - used by kernel for nvsw128*129* 1: <1.0.0 - used by kernel for nvsw130* 1.0.0 - free for userspace131*132* 2-7: free for userspace on all kernel versions133*/134135#define SUBC_M2MF(mthd) 2, (mthd)136#define NV03_M2MF(mthd) SUBC_M2MF(NV03_M2MF_##mthd)137138#define SUBC_SF2D(mthd) 3, (mthd)139#define NV04_SF2D(mthd) SUBC_SF2D(NV04_SURFACE_2D_##mthd)140141#define SUBC_SSWZ(mthd) 4, (mthd)142#define NV04_SSWZ(mthd) SUBC_SSWZ(NV04_SURFACE_SWZ_##mthd)143144#define SUBC_SIFM(mthd) 5, (mthd)145#define NV03_SIFM(mthd) SUBC_SIFM(NV03_SIFM_##mthd)146#define NV05_SIFM(mthd) SUBC_SIFM(NV05_SIFM_##mthd)147148#define SUBC_3D(mthd) 7, (mthd)149#define NV30_3D(mthd) SUBC_3D(NV30_3D_##mthd)150#define NV40_3D(mthd) SUBC_3D(NV40_3D_##mthd)151152#define NV01_SUBC(subc, mthd) SUBC_##subc((NV01_SUBCHAN_##mthd))153#define NV11_SUBC(subc, mthd) SUBC_##subc((NV11_SUBCHAN_##mthd))154155#define NV04_GRAPH(subc, mthd) SUBC_##subc((NV04_GRAPH_##mthd))156157#endif158159160