Skip to content
Snippets Groups Projects

nvk: support fills and clears and copies/blits

Merged Karol Herbst requested to merge karolherbst/mesa:vk/fill_and_clear into nouveau/vk
All threads resolved!
1 file
+ 50
31
Compare changes
  • Side-by-side
  • Inline
@@ -83,45 +83,76 @@ static inline void
__push_1inc(struct nouveau_ws_push *push, int subc, uint32_t mthd)
{
push->last_size = push->map;
*push->map = NVC0_FIFO_PKHDR_1I(subc, mthd, 1);
*push->map = NVC0_FIFO_PKHDR_1I(subc, mthd, 0);
push->map++;
}
#define P_1INC(push, class, mthd) __push_1inc(push, SUBC_##class, class##_##mthd)
static inline uint32_t
NVC0_FIFO_PKHDR_0I(int subc, int mthd, unsigned size)
{
return 0x60000000 | (size << 16) | (subc << 13) | (mthd >> 2);
}
static inline void
P_INLINE_DATA(struct nouveau_ws_push *push, uint32_t value)
__push_0inc(struct nouveau_ws_push *push, int subc, uint32_t mthd)
{
push->last_size = push->map;
*push->map = NVC0_FIFO_PKHDR_0I(subc, mthd, 0);
push->map++;
}
#define P_0INC(push, class, mthd) __push_0inc(push, SUBC_##class, class##_##mthd)
static inline bool
nvk_push_update_count(struct nouveau_ws_push *push, uint16_t count)
{
uint32_t last_hdr_val = *push->last_size;
uint16_t last_size = (last_hdr_val >> 16) & 0xff;
last_size += 1;
last_hdr_val &= ~(0xff << 16);
last_hdr_val |= last_size << 16;
assert(count <= 0x1fff);
if (count > 0x1fff)
return false;
/* size is encoded at 28:16 */
uint32_t new_count = (count + (last_hdr_val >> 16)) & 0x1fff;
bool overflow = new_count < count;
/* if we would overflow, don't change anything and just let it be */
assert(!overflow);
if (overflow)
return false;
last_hdr_val &= ~0x1fff0000;
last_hdr_val |= new_count << 16;
*push->last_size = last_hdr_val;
*push->map = value;
push->map += 1;
return true;
}
static inline void
P_INLINE_ARRAY(struct nouveau_ws_push *push, uint32_t *data, int num_dw)
P_INLINE_DATA(struct nouveau_ws_push *push, uint32_t value)
{
uint32_t last_hdr_val = *push->last_size;
uint16_t last_size = (last_hdr_val >> 16) & 0xff;
if (nvk_push_update_count(push, 1)) {
/* push new value */
*push->map = value;
push->map++;
}
}
last_size += num_dw;
last_hdr_val &= ~(0xff << 16);
last_hdr_val |= last_size << 16;
*push->last_size = last_hdr_val;
memcpy(push->map, data, num_dw * 4);
push->map += num_dw;
static inline void
P_INLINE_ARRAY(struct nouveau_ws_push *push, const uint32_t *data, int num_dw)
{
if (nvk_push_update_count(push, num_dw)) {
/* push new value */
memcpy(push->map, data, num_dw * 4);
push->map += num_dw;
}
}
/* internally used by generated inlines. */
static inline void
nvk_push_val(struct nouveau_ws_push *push, uint32_t idx, uint32_t val)
{
uint32_t last_hdr_val = *push->last_size;
UNUSED uint32_t last_hdr_val = *push->last_size;
UNUSED bool is_1inc = (last_hdr_val & 0xe0000000) == 0xa0000000;
UNUSED bool is_immd = (last_hdr_val & 0xe0000000) == 0x80000000;
UNUSED uint16_t last_method = (last_hdr_val & 0x1fff) << 2;
@@ -136,18 +167,6 @@ nvk_push_val(struct nouveau_ws_push *push, uint32_t idx, uint32_t val)
assert(!is_immd);
assert(last_method == idx);
/* size is encoded at 28:16 */
last_hdr_val += 1 << 16;
bool overflow = !(last_hdr_val & 0x1fff0000);
/* if we would overflow, don't change anything and just let it be */
assert(!overflow);
if (overflow)
return;
/* push new value */
*push->map = val;
*push->last_size = last_hdr_val;
push->map++;
P_INLINE_DATA(push, val);
}
#endif
Loading