nve4: fix uploading unaligned sized input buffers

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Pierre Moreau <dev@pmoreau.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6367>
This commit is contained in:
Karol Herbst
2018-04-22 02:01:18 +02:00
committed by Marge Bot
parent 918e444f04
commit ada8c76cca
2 changed files with 9 additions and 2 deletions

View File

@@ -45,6 +45,13 @@ PUSH_DATAp(struct nouveau_pushbuf *push, const void *data, uint32_t size)
push->cur += size;
}
static inline void
PUSH_DATAb(struct nouveau_pushbuf *push, const void *data, uint32_t size)
{
memcpy(push->cur, data, size);
push->cur += DIV_ROUND_UP(size, 4);
}
static inline void
PUSH_DATAf(struct nouveau_pushbuf *push, float f)
{

View File

@@ -530,9 +530,9 @@ nve4_compute_upload_input(struct nvc0_context *nvc0,
BEGIN_NVC0(push, NVE4_CP(UPLOAD_LINE_LENGTH_IN), 2);
PUSH_DATA (push, cp->parm_size);
PUSH_DATA (push, 0x1);
BEGIN_1IC0(push, NVE4_CP(UPLOAD_EXEC), 1 + (cp->parm_size / 4));
BEGIN_1IC0(push, NVE4_CP(UPLOAD_EXEC), 1 + DIV_ROUND_UP(cp->parm_size, 4));
PUSH_DATA (push, NVE4_COMPUTE_UPLOAD_EXEC_LINEAR | (0x20 << 1));
PUSH_DATAp(push, info->input, cp->parm_size / 4);
PUSH_DATAb(push, info->input, cp->parm_size);
}
BEGIN_NVC0(push, NVE4_CP(UPLOAD_DST_ADDRESS_HIGH), 2);
PUSH_DATAh(push, address + NVC0_CB_AUX_GRID_INFO(0));