nouveau: put nv04 push macros in nouveau_winsys

Remove some of the duplicated code that comes from it

Signed-off-by: Yusuf Khan <yusisamerican@gmail.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18857>
This commit is contained in:
Yusuf Khan
2022-09-27 20:01:50 -05:00
committed by Marge Bot
parent 8be9171fcb
commit 16287ff87d
4 changed files with 34 additions and 62 deletions
+4 -30
View File
@@ -50,36 +50,6 @@ nouveau_vpe_write(struct nouveau_decoder *dec, unsigned data) {
dec->cmds[dec->ofs++] = data;
}
#define SUBC_MPEG(mthd) 1, mthd
#define NV31_MPEG(mthd) SUBC_MPEG(NV31_MPEG_##mthd)
#define NV84_MPEG(mthd) SUBC_MPEG(NV84_MPEG_##mthd)
static inline uint32_t
NV04_FIFO_PKHDR(int subc, int mthd, unsigned size)
{
return 0x00000000 | (size << 18) | (subc << 13) | mthd;
}
static inline uint32_t
NV04_FIFO_PKHDR_NI(int subc, int mthd, unsigned size)
{
return 0x40000000 | (size << 18) | (subc << 13) | mthd;
}
static inline void
BEGIN_NV04(struct nouveau_pushbuf *push, int subc, int mthd, unsigned size)
{
PUSH_SPACE(push, size + 1);
PUSH_DATA (push, NV04_FIFO_PKHDR(subc, mthd, size));
}
static inline void
BEGIN_NI04(struct nouveau_pushbuf *push, int subc, int mthd, unsigned size)
{
PUSH_SPACE(push, size + 1);
PUSH_DATA (push, NV04_FIFO_PKHDR_NI(subc, mthd, size));
}
static inline void
PUSH_MTHDl(struct nouveau_pushbuf *push, int subc, int mthd,
struct nouveau_bo *bo, uint32_t offset,
@@ -93,4 +63,8 @@ PUSH_MTHDl(struct nouveau_pushbuf *push, int subc, int mthd,
PUSH_DATA(push, bo->offset + offset);
}
#define SUBC_MPEG(mthd) 1, mthd
#define NV31_MPEG(mthd) SUBC_MPEG(NV31_MPEG_##mthd)
#define NV84_MPEG(mthd) SUBC_MPEG(NV84_MPEG_##mthd)
#endif
@@ -109,6 +109,36 @@ PUSH_VAL(struct nouveau_pushbuf *push)
return res;
}
static inline uint32_t
NV04_FIFO_PKHDR(int subc, int mthd, unsigned size)
{
return 0x00000000 | (size << 18) | (subc << 13) | mthd;
}
static inline uint32_t
NV04_FIFO_PKHDR_NI(int subc, int mthd, unsigned size)
{
return 0x40000000 | (size << 18) | (subc << 13) | mthd;
}
static inline void
BEGIN_NV04(struct nouveau_pushbuf *push, int subc, int mthd, unsigned size)
{
#ifndef NV50_PUSH_EXPLICIT_SPACE_CHECKING
PUSH_SPACE(push, size + 1);
#endif
PUSH_DATA (push, NV04_FIFO_PKHDR(subc, mthd, size));
}
static inline void
BEGIN_NI04(struct nouveau_pushbuf *push, int subc, int mthd, unsigned size)
{
#ifndef NV50_PUSH_EXPLICIT_SPACE_CHECKING
PUSH_SPACE(push, size + 1);
#endif
PUSH_DATA (push, NV04_FIFO_PKHDR_NI(subc, mthd, size));
}
static inline int
BO_MAP(struct nouveau_screen *screen, struct nouveau_bo *bo, uint32_t access, struct nouveau_client *client)
{
@@ -103,20 +103,6 @@ PUSH_RESRC(struct nouveau_pushbuf *push, int subc, int mthd, int bin,
r->domain | access, vor, tor)->priv = r;
}
static inline void
BEGIN_NV04(struct nouveau_pushbuf *push, int subc, int mthd, int size)
{
PUSH_SPACE(push, size + 1);
PUSH_DATA (push, 0x00000000 | (size << 18) | (subc << 13) | mthd);
}
static inline void
BEGIN_NI04(struct nouveau_pushbuf *push, int subc, int mthd, int size)
{
PUSH_SPACE(push, size + 1);
PUSH_DATA (push, 0x40000000 | (size << 18) | (subc << 13) | mthd);
}
/* subchannel assignment
*
* 0: <1.0.0 - used by kernel for m2mf
@@ -86,24 +86,6 @@ PUSH_DATAh(struct nouveau_pushbuf *push, uint64_t data)
*push->cur++ = (uint32_t)(data >> 32);
}
static inline void
BEGIN_NV04(struct nouveau_pushbuf *push, int subc, int mthd, unsigned size)
{
#ifndef NV50_PUSH_EXPLICIT_SPACE_CHECKING
PUSH_SPACE(push, size + 1);
#endif
PUSH_DATA (push, NV50_FIFO_PKHDR(subc, mthd, size));
}
static inline void
BEGIN_NI04(struct nouveau_pushbuf *push, int subc, int mthd, unsigned size)
{
#ifndef NV50_PUSH_EXPLICIT_SPACE_CHECKING
PUSH_SPACE(push, size + 1);
#endif
PUSH_DATA (push, NV50_FIFO_PKHDR_NI(subc, mthd, size));
}
/* long, non-incremental, nv50-only */
static inline void
BEGIN_NL50(struct nouveau_pushbuf *push, int subc, int mthd, uint32_t size)