From ada8c76cca177fbf91575fd6369829d55e110274 Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Sun, 22 Apr 2018 02:01:18 +0200 Subject: [PATCH] nve4: fix uploading unaligned sized input buffers Signed-off-by: Karol Herbst Reviewed-by: Pierre Moreau Part-of: --- src/gallium/drivers/nouveau/nouveau_winsys.h | 7 +++++++ src/gallium/drivers/nouveau/nvc0/nve4_compute.c | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/nouveau/nouveau_winsys.h b/src/gallium/drivers/nouveau/nouveau_winsys.h index e0ed0af3eaa..792c9ea1547 100644 --- a/src/gallium/drivers/nouveau/nouveau_winsys.h +++ b/src/gallium/drivers/nouveau/nouveau_winsys.h @@ -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) { diff --git a/src/gallium/drivers/nouveau/nvc0/nve4_compute.c b/src/gallium/drivers/nouveau/nvc0/nve4_compute.c index ebbc410184b..8994be65ce4 100644 --- a/src/gallium/drivers/nouveau/nvc0/nve4_compute.c +++ b/src/gallium/drivers/nouveau/nvc0/nve4_compute.c @@ -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)); -- 2.30.2