mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-26 15:00:10 +01:00
nouveau/headers: Use drf and cl906f.h in nv_push.h
Reviewed-by: Mary Guillemard <mary@mary.zone> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38761>
This commit is contained in:
parent
8009bfbc01
commit
7f9c827577
1 changed files with 34 additions and 17 deletions
|
|
@ -4,6 +4,9 @@
|
|||
#include "nvtypes.h"
|
||||
#include "util/macros.h"
|
||||
|
||||
#include "drf.h"
|
||||
#include "cl906f.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
|
@ -96,13 +99,16 @@ void vk_push_print(FILE *fp, const struct nv_push *push,
|
|||
static inline uint8_t
|
||||
NVC0_FIFO_SUBC_FROM_PKHDR(uint32_t hdr)
|
||||
{
|
||||
return (hdr >> 13) & BITFIELD_MASK(3);
|
||||
return NVVAL_GET(hdr, NV906F, DMA, METHOD_SUBCHANNEL);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
NVC0_FIFO_PKHDR_SQ(int subc, int mthd, unsigned size)
|
||||
{
|
||||
return 0x20000000 | (size << 16) | (subc << 13) | (mthd >> 2);
|
||||
return NVDEF(NV906F, DMA_INCR, OPCODE, VALUE) |
|
||||
NVVAL(NV906F, DMA_INCR, COUNT, size) |
|
||||
NVVAL(NV906F, DMA_INCR, SUBCHANNEL, subc) |
|
||||
NVVAL(NV906F, DMA_INCR, ADDRESS, mthd >> 2);
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
|
@ -112,10 +118,11 @@ __push_verify(struct nv_push *push)
|
|||
return;
|
||||
|
||||
/* check for immd */
|
||||
if (push->last_hdr_dw >> 29 == 4)
|
||||
if (NVDEF_TEST(push->last_hdr_dw, NV906F, DMA, SEC_OP, ==, IMMD_DATA_METHOD))
|
||||
return;
|
||||
|
||||
ASSERTED uint32_t last_count = (push->last_hdr_dw & 0x1fff0000);
|
||||
ASSERTED uint32_t last_count =
|
||||
NVVAL_GET(push->last_hdr_dw, NV906F, DMA, METHOD_COUNT);
|
||||
assert(last_count);
|
||||
}
|
||||
|
||||
|
|
@ -150,8 +157,11 @@ __push_mthd(struct nv_push *push, int subc, uint32_t mthd)
|
|||
static inline uint32_t
|
||||
NVC0_FIFO_PKHDR_IL(int subc, int mthd, uint16_t data)
|
||||
{
|
||||
assert(!(data & ~0x1fff));
|
||||
return 0x80000000 | (data << 16) | (subc << 13) | (mthd >> 2);
|
||||
assert(!(data & ~DRF_MASK(NV906F_DMA_IMMD_DATA)));
|
||||
return NVDEF(NV906F, DMA_IMMD, OPCODE, VALUE) |
|
||||
NVVAL(NV906F, DMA_IMMD, DATA, data) |
|
||||
NVVAL(NV906F, DMA_IMMD, SUBCHANNEL, subc) |
|
||||
NVVAL(NV906F, DMA_IMMD, ADDRESS, mthd >> 2);
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
|
@ -174,7 +184,10 @@ __push_immd(struct nv_push *push, int subc, uint32_t mthd, uint32_t val)
|
|||
static inline uint32_t
|
||||
NVC0_FIFO_PKHDR_1I(int subc, int mthd, unsigned size)
|
||||
{
|
||||
return 0xa0000000 | (size << 16) | (subc << 13) | (mthd >> 2);
|
||||
return NVDEF(NV906F, DMA_ONEINCR, OPCODE, VALUE) |
|
||||
NVVAL(NV906F, DMA_ONEINCR, COUNT, size) |
|
||||
NVVAL(NV906F, DMA_ONEINCR, SUBCHANNEL, subc) |
|
||||
NVVAL(NV906F, DMA_ONEINCR, ADDRESS, mthd >> 2);
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
|
@ -188,7 +201,10 @@ __push_1inc(struct nv_push *push, int subc, uint32_t mthd)
|
|||
static inline uint32_t
|
||||
NVC0_FIFO_PKHDR_0I(int subc, int mthd, unsigned size)
|
||||
{
|
||||
return 0x60000000 | (size << 16) | (subc << 13) | (mthd >> 2);
|
||||
return NVDEF(NV906F, DMA_NONINCR, OPCODE, VALUE) |
|
||||
NVVAL(NV906F, DMA_NONINCR, COUNT, size) |
|
||||
NVVAL(NV906F, DMA_NONINCR, SUBCHANNEL, subc) |
|
||||
NVVAL(NV906F, DMA_NONINCR, ADDRESS, mthd >> 2);
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
|
@ -199,7 +215,7 @@ __push_0inc(struct nv_push *push, int subc, uint32_t mthd)
|
|||
|
||||
#define P_0INC(push, class, mthd) __push_0inc(push, SUBC_##class, class##_##mthd)
|
||||
|
||||
#define NV_PUSH_MAX_COUNT 0x1fff
|
||||
#define NV_PUSH_MAX_COUNT DRF_MASK(NV906F_DMA_METHOD_COUNT)
|
||||
|
||||
static inline bool
|
||||
nv_push_update_count(struct nv_push *push, uint16_t count)
|
||||
|
|
@ -212,16 +228,15 @@ nv_push_update_count(struct nv_push *push, uint16_t count)
|
|||
|
||||
uint32_t hdr_dw = push->last_hdr_dw;
|
||||
|
||||
/* size is encoded at 28:16 */
|
||||
uint32_t new_count = (count + (hdr_dw >> 16)) & NV_PUSH_MAX_COUNT;
|
||||
uint32_t old_count = NVVAL_GET(hdr_dw, NV906F, DMA, METHOD_COUNT);
|
||||
uint32_t new_count = (count + old_count) & NV_PUSH_MAX_COUNT;
|
||||
bool overflow = new_count < count;
|
||||
/* if we would overflow, don't change anything and just let it be */
|
||||
assert(!overflow);
|
||||
if (overflow)
|
||||
return false;
|
||||
|
||||
hdr_dw &= ~0x1fff0000;
|
||||
hdr_dw |= new_count << 16;
|
||||
hdr_dw = NVVAL_SET(hdr_dw, NV906F, DMA, METHOD_COUNT, new_count);
|
||||
push->last_hdr_dw = hdr_dw;
|
||||
*push->last_hdr = hdr_dw;
|
||||
return true;
|
||||
|
|
@ -265,10 +280,12 @@ static inline void
|
|||
nv_push_val(struct nv_push *push, uint32_t idx, uint32_t val)
|
||||
{
|
||||
ASSERTED uint32_t last_hdr_dw = push->last_hdr_dw;
|
||||
ASSERTED bool is_0inc = (last_hdr_dw & 0xe0000000) == 0x60000000;
|
||||
ASSERTED bool is_1inc = (last_hdr_dw & 0xe0000000) == 0xa0000000;
|
||||
ASSERTED bool is_immd = (last_hdr_dw & 0xe0000000) == 0x80000000;
|
||||
ASSERTED uint16_t last_method = (last_hdr_dw & 0x1fff) << 2;
|
||||
ASSERTED uint32_t type = NVVAL_GET(last_hdr_dw, NV906F, DMA, SEC_OP);
|
||||
ASSERTED bool is_0inc = type == NV906F_DMA_SEC_OP_NON_INC_METHOD;
|
||||
ASSERTED bool is_1inc = type == NV906F_DMA_SEC_OP_ONE_INC;
|
||||
ASSERTED bool is_immd = type == NV906F_DMA_SEC_OP_IMMD_DATA_METHOD;
|
||||
ASSERTED uint16_t last_method =
|
||||
NVVAL_GET(last_hdr_dw, NV906F, DMA, METHOD_ADDRESS) << 2;
|
||||
|
||||
uint16_t distance = push->end - push->last_hdr - 1;
|
||||
if (is_0inc)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue