Module: Mesa Branch: main Commit: e42cea4db6721d0eb329091fbe79dd27915a842f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e42cea4db6721d0eb329091fbe79dd27915a842f
Author: Rob Clark <[email protected]> Date: Mon Apr 18 16:18:48 2022 -0700 freedreno/drm/virtio: Split up large uploads Might be useful if host cached mmaps.. but OTOH we don't want to burn up address space. Signed-off-by: Rob Clark <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16086> --- src/freedreno/drm/virtio/virtio_bo.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/freedreno/drm/virtio/virtio_bo.c b/src/freedreno/drm/virtio/virtio_bo.c index 2fc7cb079bc..b05964cc330 100644 --- a/src/freedreno/drm/virtio/virtio_bo.c +++ b/src/freedreno/drm/virtio/virtio_bo.c @@ -183,7 +183,7 @@ virtio_bo_set_name(struct fd_bo *bo, const char *fmt, va_list ap) } static void -virtio_bo_upload(struct fd_bo *bo, void *src, unsigned len) +bo_upload(struct fd_bo *bo, unsigned off, void *src, unsigned len) { unsigned req_len = sizeof(struct msm_ccmd_gem_upload_req) + align(len, 4); @@ -193,7 +193,7 @@ virtio_bo_upload(struct fd_bo *bo, void *src, unsigned len) req->hdr = MSM_CCMD(GEM_UPLOAD, req_len); req->res_id = to_virtio_bo(bo)->res_id; req->pad = 0; - req->off = 0; + req->off = off; req->len = len; memcpy(req->payload, src, len); @@ -201,6 +201,19 @@ virtio_bo_upload(struct fd_bo *bo, void *src, unsigned len) virtio_execbuf(bo->dev, &req->hdr, false); } +static void +virtio_bo_upload(struct fd_bo *bo, void *src, unsigned len) +{ + unsigned off = 0; + while (len > 0) { + unsigned sz = MIN2(len, 0x1000); + bo_upload(bo, off, src, sz); + off += sz; + src += sz; + len -= sz; + } +} + static void set_iova(struct fd_bo *bo, uint64_t iova) {
