Path: blob/21.2-virgl/src/gallium/drivers/nouveau/nv50/nv50_winsys.h
4574 views
1#ifndef __NV50_WINSYS_H__2#define __NV50_WINSYS_H__34#include <stdint.h>5#include <unistd.h>67#include "pipe/p_defines.h"89#include "nouveau_winsys.h"10#include "nouveau_buffer.h"111213#ifndef NV04_PFIFO_MAX_PACKET_LEN14#define NV04_PFIFO_MAX_PACKET_LEN 204715#endif161718static inline void19nv50_add_bufctx_resident_bo(struct nouveau_bufctx *bufctx, int bin,20unsigned flags, struct nouveau_bo *bo)21{22nouveau_bufctx_refn(bufctx, bin, bo, flags)->priv = NULL;23}2425static inline void26nv50_add_bufctx_resident(struct nouveau_bufctx *bufctx, int bin,27struct nv04_resource *res, unsigned flags)28{29struct nouveau_bufref *ref =30nouveau_bufctx_refn(bufctx, bin, res->bo, flags | res->domain);31ref->priv = res;32ref->priv_data = flags;33}3435#define BCTX_REFN_bo(ctx, bin, fl, bo) \36nv50_add_bufctx_resident_bo(ctx, NV50_BIND_##bin, fl, bo);3738#define BCTX_REFN(bctx, bin, res, acc) \39nv50_add_bufctx_resident(bctx, NV50_BIND_##bin, res, NOUVEAU_BO_##acc)4041static inline void42PUSH_REFN(struct nouveau_pushbuf *push, struct nouveau_bo *bo, uint32_t flags)43{44struct nouveau_pushbuf_refn ref = { bo, flags };45nouveau_pushbuf_refn(push, &ref, 1);46}474849#define SUBC_3D(m) 3, (m)50#define NV50_3D(n) SUBC_3D(NV50_3D_##n)51#define NV84_3D(n) SUBC_3D(NV84_3D_##n)52#define NVA0_3D(n) SUBC_3D(NVA0_3D_##n)5354#define SUBC_2D(m) 4, (m)55#define NV50_2D(n) SUBC_2D(NV50_2D_##n)5657#define SUBC_M2MF(m) 5, (m)58#define NV50_M2MF(n) SUBC_M2MF(NV50_M2MF_##n)5960#define SUBC_CP(m) 6, (m)61#define NV50_CP(n) SUBC_CP(NV50_COMPUTE_##n)626364static inline uint32_t65NV50_FIFO_PKHDR(int subc, int mthd, unsigned size)66{67return 0x00000000 | (size << 18) | (subc << 13) | mthd;68}6970static inline uint32_t71NV50_FIFO_PKHDR_NI(int subc, int mthd, unsigned size)72{73return 0x40000000 | (size << 18) | (subc << 13) | mthd;74}7576static inline uint32_t77NV50_FIFO_PKHDR_L(int subc, int mthd)78{79return 0x00030000 | (subc << 13) | mthd;80}818283static inline uint32_t84nouveau_bo_memtype(const struct nouveau_bo *bo)85{86return bo->config.nv50.memtype;87}888990static inline void91PUSH_DATAh(struct nouveau_pushbuf *push, uint64_t data)92{93*push->cur++ = (uint32_t)(data >> 32);94}9596static inline void97BEGIN_NV04(struct nouveau_pushbuf *push, int subc, int mthd, unsigned size)98{99#ifndef NV50_PUSH_EXPLICIT_SPACE_CHECKING100PUSH_SPACE(push, size + 1);101#endif102PUSH_DATA (push, NV50_FIFO_PKHDR(subc, mthd, size));103}104105static inline void106BEGIN_NI04(struct nouveau_pushbuf *push, int subc, int mthd, unsigned size)107{108#ifndef NV50_PUSH_EXPLICIT_SPACE_CHECKING109PUSH_SPACE(push, size + 1);110#endif111PUSH_DATA (push, NV50_FIFO_PKHDR_NI(subc, mthd, size));112}113114/* long, non-incremental, nv50-only */115static inline void116BEGIN_NL50(struct nouveau_pushbuf *push, int subc, int mthd, uint32_t size)117{118#ifndef NV50_PUSH_EXPLICIT_SPACE_CHECKING119PUSH_SPACE(push, 2);120#endif121PUSH_DATA (push, NV50_FIFO_PKHDR_L(subc, mthd));122PUSH_DATA (push, size);123}124125#endif /* __NV50_WINSYS_H__ */126127128