From db825e34a9ae808a34d9ec4e7192b7a976baf3b2 Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Fri, 25 Jun 2021 22:44:26 +0200 Subject: [PATCH] nouveau: wrap nouveau_bo_map This makes it easier to insert locking code around libdrm. Signed-off-by: Karol Herbst Reviewed-by: M Henning Part-of: --- src/gallium/drivers/nouveau/nouveau_buffer.c | 22 +++++++++---------- src/gallium/drivers/nouveau/nouveau_video.c | 6 ++--- .../drivers/nouveau/nouveau_vp3_video.c | 4 +++- src/gallium/drivers/nouveau/nouveau_winsys.h | 7 ++++++ .../drivers/nouveau/nv30/nv30_miptree.c | 2 +- .../drivers/nouveau/nv30/nv30_screen.c | 2 +- .../drivers/nouveau/nv30/nv30_transfer.c | 4 ++-- .../drivers/nouveau/nv50/nv50_compute.c | 2 +- .../drivers/nouveau/nv50/nv50_query_hw.c | 2 +- .../drivers/nouveau/nv50/nv50_screen.c | 2 +- .../drivers/nouveau/nv50/nv50_transfer.c | 2 +- src/gallium/drivers/nouveau/nv50/nv84_video.c | 11 +++++----- src/gallium/drivers/nouveau/nv50/nv98_video.c | 2 +- .../drivers/nouveau/nv50/nv98_video_bsp.c | 3 ++- .../drivers/nouveau/nv50/nv98_video_vp.c | 3 ++- .../drivers/nouveau/nvc0/nvc0_query_hw.c | 2 +- .../drivers/nouveau/nvc0/nvc0_screen.c | 2 +- .../drivers/nouveau/nvc0/nvc0_transfer.c | 4 ++-- src/gallium/drivers/nouveau/nvc0/nvc0_video.c | 2 +- .../drivers/nouveau/nvc0/nvc0_video_bsp.c | 8 ++++--- .../drivers/nouveau/nvc0/nvc0_video_vp.c | 3 ++- .../drivers/nouveau/nvc0/nve4_compute.c | 2 +- 22 files changed, 56 insertions(+), 41 deletions(-) diff --git a/src/gallium/drivers/nouveau/nouveau_buffer.c b/src/gallium/drivers/nouveau/nouveau_buffer.c index 78f8a9cb5d8..e566541a579 100644 --- a/src/gallium/drivers/nouveau/nouveau_buffer.c +++ b/src/gallium/drivers/nouveau/nouveau_buffer.c @@ -168,7 +168,7 @@ nouveau_transfer_staging(struct nouveau_context *nv, nouveau_mm_allocate(nv->screen->mm_GART, size, &tx->bo, &tx->offset); if (tx->bo) { tx->offset += adj; - if (!nouveau_bo_map(tx->bo, 0, NULL)) + if (!BO_MAP(nv->screen, tx->bo, 0, NULL)) tx->map = (uint8_t *)tx->bo->map + tx->offset; } } @@ -471,9 +471,9 @@ nouveau_buffer_transfer_map(struct pipe_context *pipe, * wait on the whole slab and instead use the logic below to return a * reasonable buffer for that case. */ - ret = nouveau_bo_map(buf->bo, - buf->mm ? 0 : nouveau_screen_transfer_flags(usage), - nv->client); + ret = BO_MAP(nv->screen, buf->bo, + buf->mm ? 0 : nouveau_screen_transfer_flags(usage), + nv->client); if (ret) { FREE(tx); return NULL; @@ -639,10 +639,10 @@ nouveau_resource_map_offset(struct nouveau_context *nv, unsigned rw; rw = (flags & NOUVEAU_BO_WR) ? PIPE_MAP_WRITE : PIPE_MAP_READ; nouveau_buffer_sync(nv, res, rw); - if (nouveau_bo_map(res->bo, 0, NULL)) + if (BO_MAP(nv->screen, res->bo, 0, NULL)) return NULL; } else { - if (nouveau_bo_map(res->bo, flags, nv->client)) + if (BO_MAP(nv->screen, res->bo, flags, nv->client)) return NULL; } return (uint8_t *)res->bo->map + res->offset + offset; @@ -798,7 +798,7 @@ nouveau_buffer_data_fetch(struct nouveau_context *nv, struct nv04_resource *buf, { if (!nouveau_buffer_malloc(buf)) return false; - if (nouveau_bo_map(bo, NOUVEAU_BO_RD, nv->client)) + if (BO_MAP(nv->screen, bo, NOUVEAU_BO_RD, nv->client)) return false; memcpy(buf->data, (uint8_t *)bo->map + offset, size); return true; @@ -823,7 +823,7 @@ nouveau_buffer_migrate(struct nouveau_context *nv, if (new_domain == NOUVEAU_BO_GART && old_domain == 0) { if (!nouveau_buffer_allocate(screen, buf, new_domain)) return false; - ret = nouveau_bo_map(buf->bo, 0, nv->client); + ret = BO_MAP(nv->screen, buf->bo, 0, nv->client); if (ret) return ret; memcpy((uint8_t *)buf->bo->map + buf->offset, buf->data, size); @@ -893,7 +893,7 @@ nouveau_user_buffer_upload(struct nouveau_context *nv, if (!nouveau_buffer_reallocate(screen, buf, NOUVEAU_BO_GART)) return false; - ret = nouveau_bo_map(buf->bo, 0, nv->client); + ret = BO_MAP(nv->screen, buf->bo, 0, nv->client); if (ret) return false; memcpy((uint8_t *)buf->bo->map + buf->offset + base, buf->data + base, size); @@ -989,7 +989,7 @@ nouveau_scratch_runout(struct nouveau_context *nv, unsigned size) ret = nouveau_scratch_bo_alloc(nv, &nv->scratch.runout->bo[n], size); if (!ret) { - ret = nouveau_bo_map(nv->scratch.runout->bo[n], 0, NULL); + ret = BO_MAP(nv->screen, nv->scratch.runout->bo[n], 0, NULL); if (ret) nouveau_bo_ref(NULL, &nv->scratch.runout->bo[--nv->scratch.runout->nr]); } @@ -1027,7 +1027,7 @@ nouveau_scratch_next(struct nouveau_context *nv, unsigned size) nv->scratch.offset = 0; nv->scratch.end = nv->scratch.bo_size; - ret = nouveau_bo_map(bo, NOUVEAU_BO_WR, nv->client); + ret = BO_MAP(nv->screen, bo, NOUVEAU_BO_WR, nv->client); if (!ret) nv->scratch.map = bo->map; return !ret; diff --git a/src/gallium/drivers/nouveau/nouveau_video.c b/src/gallium/drivers/nouveau/nouveau_video.c index 5c94686625f..787129b376e 100644 --- a/src/gallium/drivers/nouveau/nouveau_video.c +++ b/src/gallium/drivers/nouveau/nouveau_video.c @@ -37,12 +37,12 @@ nouveau_vpe_init(struct nouveau_decoder *dec) { int ret; if (dec->cmds) return 0; - ret = nouveau_bo_map(dec->cmd_bo, NOUVEAU_BO_RDWR, dec->client); + ret = BO_MAP(dec->screen, dec->cmd_bo, NOUVEAU_BO_RDWR, dec->client); if (ret) { debug_printf("Mapping cmd bo: %s\n", strerror(-ret)); return ret; } - ret = nouveau_bo_map(dec->data_bo, NOUVEAU_BO_RDWR, dec->client); + ret = BO_MAP(dec->screen, dec->data_bo, NOUVEAU_BO_RDWR, dec->client); if (ret) { debug_printf("Mapping data bo: %s\n", strerror(-ret)); return ret; @@ -582,7 +582,7 @@ nouveau_create_decoder(struct pipe_context *context, 0, 4096, NULL, &dec->fence_bo); if (ret) goto fail; - nouveau_bo_map(dec->fence_bo, NOUVEAU_BO_RDWR, NULL); + BO_MAP(screen, dec->fence_bo, NOUVEAU_BO_RDWR, NULL); dec->fence_map = dec->fence_bo->map; dec->fence_map[0] = 0; #endif diff --git a/src/gallium/drivers/nouveau/nouveau_vp3_video.c b/src/gallium/drivers/nouveau/nouveau_vp3_video.c index 3b59fd0a513..b3d93a69195 100644 --- a/src/gallium/drivers/nouveau/nouveau_vp3_video.c +++ b/src/gallium/drivers/nouveau/nouveau_vp3_video.c @@ -27,6 +27,7 @@ #include +#include "nouveau_winsys.h" #include "nouveau_screen.h" #include "nouveau_context.h" #include "nouveau_vp3_video.h" @@ -284,13 +285,14 @@ nouveau_vp3_load_firmware(struct nouveau_vp3_decoder *dec, char path[PATH_MAX]; ssize_t r; uint32_t *end, endval; + struct nouveau_screen *screen = nouveau_screen(dec->base.context->screen); if (chipset >= 0xa3 && chipset != 0xaa && chipset != 0xac) vp4_getpath(profile, path); else vp3_getpath(profile, path); - if (nouveau_bo_map(dec->fw_bo, NOUVEAU_BO_WR, dec->client)) + if (BO_MAP(screen, dec->fw_bo, NOUVEAU_BO_WR, dec->client)) return 1; fd = open(path, O_RDONLY | O_CLOEXEC); diff --git a/src/gallium/drivers/nouveau/nouveau_winsys.h b/src/gallium/drivers/nouveau/nouveau_winsys.h index 6a0b6774106..f0c401f151d 100644 --- a/src/gallium/drivers/nouveau/nouveau_winsys.h +++ b/src/gallium/drivers/nouveau/nouveau_winsys.h @@ -10,6 +10,8 @@ #include "drm-uapi/drm.h" #include +#include "nouveau_screen.h" + #ifndef NV04_PFIFO_MAX_PACKET_LEN #define NV04_PFIFO_MAX_PACKET_LEN 2047 #endif @@ -67,6 +69,11 @@ PUSH_KICK(struct nouveau_pushbuf *push) nouveau_pushbuf_kick(push, push->channel); } +static inline int +BO_MAP(struct nouveau_screen *screen, struct nouveau_bo *bo, uint32_t access, struct nouveau_client *client) +{ + return nouveau_bo_map(bo, access, client); +} #define NOUVEAU_RESOURCE_FLAG_LINEAR (PIPE_RESOURCE_FLAG_DRV_PRIV << 0) #define NOUVEAU_RESOURCE_FLAG_DRV_PRIV (PIPE_RESOURCE_FLAG_DRV_PRIV << 1) diff --git a/src/gallium/drivers/nouveau/nv30/nv30_miptree.c b/src/gallium/drivers/nouveau/nv30/nv30_miptree.c index 5d1f16b28c9..ebbe3746717 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_miptree.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_miptree.c @@ -359,7 +359,7 @@ nv30_miptree_transfer_map(struct pipe_context *pipe, struct pipe_resource *pt, if (usage & PIPE_MAP_WRITE) access |= NOUVEAU_BO_WR; - ret = nouveau_bo_map(tx->tmp.bo, access, nv30->base.client); + ret = BO_MAP(nv30->base.screen, tx->tmp.bo, access, nv30->base.client); if (ret) { pipe_resource_reference(&tx->base.resource, NULL); FREE(tx); diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c index 687c7c49ba1..d1e65eb659b 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c @@ -732,7 +732,7 @@ nv30_screen_create(struct nouveau_device *dev) ret = nouveau_bo_wrap(screen->base.device, fifo->notify, &screen->notify); if (ret == 0) - ret = nouveau_bo_map(screen->notify, 0, screen->base.client); + ret = BO_MAP(&screen->base, screen->notify, 0, screen->base.client); if (ret) FAIL_SCREEN_INIT("error mapping notifier memory: %d\n", ret); diff --git a/src/gallium/drivers/nouveau/nv30/nv30_transfer.c b/src/gallium/drivers/nouveau/nv30/nv30_transfer.c index a79fd1f4545..1a5151acb89 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_transfer.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_transfer.c @@ -635,8 +635,8 @@ nv30_transfer_rect_cpu(XFER_ARGS) char *srcmap, *dstmap; int x, y; - nouveau_bo_map(src->bo, NOUVEAU_BO_RD, nv30->base.client); - nouveau_bo_map(dst->bo, NOUVEAU_BO_WR, nv30->base.client); + BO_MAP(nv30->base.screen, src->bo, NOUVEAU_BO_RD, nv30->base.client); + BO_MAP(nv30->base.screen, dst->bo, NOUVEAU_BO_WR, nv30->base.client); srcmap = src->bo->map + src->offset; dstmap = dst->bo->map + dst->offset; diff --git a/src/gallium/drivers/nouveau/nv50/nv50_compute.c b/src/gallium/drivers/nouveau/nv50/nv50_compute.c index 2e728f51662..d75aa0a9cd3 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_compute.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_compute.c @@ -540,7 +540,7 @@ nv50_compute_upload_input(struct nv50_context *nv50, const uint32_t *input) mm = nouveau_mm_allocate(screen->base.mm_GART, size, &bo, &offset); assert(mm); - nouveau_bo_map(bo, 0, nv50->base.client); + BO_MAP(&screen->base, bo, 0, nv50->base.client); memcpy(bo->map + offset, input, size); nouveau_bufctx_refn(nv50->bufctx, 0, bo, NOUVEAU_BO_GART | NOUVEAU_BO_RD); diff --git a/src/gallium/drivers/nouveau/nv50/nv50_query_hw.c b/src/gallium/drivers/nouveau/nv50/nv50_query_hw.c index ff7f521df68..4d959426148 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_query_hw.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_query_hw.c @@ -63,7 +63,7 @@ nv50_hw_query_allocate(struct nv50_context *nv50, struct nv50_query *q, return false; hq->offset = hq->base_offset; - ret = nouveau_bo_map(hq->bo, 0, nv50->base.client); + ret = BO_MAP(&screen->base, hq->bo, 0, nv50->base.client); if (ret) { nv50_hw_query_allocate(nv50, q, 0); return false; diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c index a8a7ce993fa..38a105c54f2 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c @@ -1072,7 +1072,7 @@ nv50_screen_create(struct nouveau_device *dev) goto fail; } - nouveau_bo_map(screen->fence.bo, 0, NULL); + BO_MAP(&screen->base, screen->fence.bo, 0, NULL); screen->fence.map = screen->fence.bo->map; screen->base.fence.emit = nv50_screen_fence_emit; screen->base.fence.update = nv50_screen_fence_update; diff --git a/src/gallium/drivers/nouveau/nv50/nv50_transfer.c b/src/gallium/drivers/nouveau/nv50/nv50_transfer.c index 3ebd5e46809..d84a6763a46 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_transfer.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_transfer.c @@ -453,7 +453,7 @@ nv50_miptree_transfer_map(struct pipe_context *pctx, if (usage & PIPE_MAP_WRITE) flags |= NOUVEAU_BO_WR; - ret = nouveau_bo_map(tx->rect[1].bo, flags, nv50->base.client); + ret = BO_MAP(nv50->base.screen, tx->rect[1].bo, flags, nv50->base.client); if (ret) { nouveau_bo_ref(NULL, &tx->rect[1].bo); FREE(tx); diff --git a/src/gallium/drivers/nouveau/nv50/nv84_video.c b/src/gallium/drivers/nouveau/nv50/nv84_video.c index 01ca0479b47..7e6aa8fffb3 100644 --- a/src/gallium/drivers/nouveau/nv50/nv84_video.c +++ b/src/gallium/drivers/nouveau/nv50/nv84_video.c @@ -69,6 +69,7 @@ nv84_load_firmwares(struct nouveau_device *dev, struct nv84_decoder *dec, { int ret, size1, size2 = 0; struct nouveau_bo *fw; + struct nouveau_screen *screen = nouveau_screen(dec->base.context->screen); size1 = filesize(fw1); if (fw2) @@ -81,7 +82,7 @@ nv84_load_firmwares(struct nouveau_device *dev, struct nv84_decoder *dec, ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, dec->vp_fw2_offset + size2, NULL, &fw); if (ret) return NULL; - ret = nouveau_bo_map(fw, NOUVEAU_BO_WR, dec->client); + ret = BO_MAP(screen, fw, NOUVEAU_BO_WR, dec->client); if (ret) goto error; @@ -406,14 +407,14 @@ nv84_create_decoder(struct pipe_context *context, NULL, &dec->bitstream); if (ret) goto fail; - ret = nouveau_bo_map(dec->bitstream, NOUVEAU_BO_WR, dec->client); + ret = BO_MAP(screen, dec->bitstream, NOUVEAU_BO_WR, dec->client); if (ret) goto fail; ret = nouveau_bo_new(screen->device, NOUVEAU_BO_GART, 0, 0x2000, NULL, &dec->vp_params); if (ret) goto fail; - ret = nouveau_bo_map(dec->vp_params, NOUVEAU_BO_WR, dec->client); + ret = BO_MAP(screen, dec->vp_params, NOUVEAU_BO_WR, dec->client); if (ret) goto fail; } @@ -425,7 +426,7 @@ nv84_create_decoder(struct pipe_context *context, NULL, &dec->mpeg12_bo); if (ret) goto fail; - ret = nouveau_bo_map(dec->mpeg12_bo, NOUVEAU_BO_WR, dec->client); + ret = BO_MAP(screen, dec->mpeg12_bo, NOUVEAU_BO_WR, dec->client); if (ret) goto fail; } @@ -434,7 +435,7 @@ nv84_create_decoder(struct pipe_context *context, 0, 0x1000, NULL, &dec->fence); if (ret) goto fail; - ret = nouveau_bo_map(dec->fence, NOUVEAU_BO_WR, dec->client); + ret = BO_MAP(screen, dec->fence, NOUVEAU_BO_WR, dec->client); if (ret) goto fail; *(uint32_t *)dec->fence->map = 0; diff --git a/src/gallium/drivers/nouveau/nv50/nv98_video.c b/src/gallium/drivers/nouveau/nv50/nv98_video.c index efa73294065..bc56aff2665 100644 --- a/src/gallium/drivers/nouveau/nv50/nv98_video.c +++ b/src/gallium/drivers/nouveau/nv50/nv98_video.c @@ -269,7 +269,7 @@ nv98_create_decoder(struct pipe_context *context, if (ret) goto fail; - nouveau_bo_map(dec->fence_bo, NOUVEAU_BO_RDWR, screen->client); + BO_MAP(screen, dec->fence_bo, NOUVEAU_BO_RDWR, screen->client); dec->fence_map = dec->fence_bo->map; dec->fence_map[0] = dec->fence_map[4] = dec->fence_map[8] = 0; dec->comm = (struct comm *)(dec->fence_map + (COMM_OFFSET/sizeof(*dec->fence_map))); diff --git a/src/gallium/drivers/nouveau/nv50/nv98_video_bsp.c b/src/gallium/drivers/nouveau/nv50/nv98_video_bsp.c index f77258de850..4c3a6172233 100644 --- a/src/gallium/drivers/nouveau/nv50/nv98_video_bsp.c +++ b/src/gallium/drivers/nouveau/nv50/nv98_video_bsp.c @@ -39,6 +39,7 @@ nv98_decoder_bsp(struct nouveau_vp3_decoder *dec, union pipe_desc desc, unsigned *vp_caps, unsigned *is_ref, struct nouveau_vp3_video_buffer *refs[16]) { + struct nouveau_screen *screen = nouveau_screen(dec->base.context->screen); struct nouveau_pushbuf *push = dec->pushbuf[0]; enum pipe_video_format codec = u_reduce_video_profile(dec->base.profile); uint32_t bsp_addr, comm_addr, inter_addr; @@ -95,7 +96,7 @@ nv98_decoder_bsp(struct nouveau_vp3_decoder *dec, union pipe_desc desc, bo_refs[1].bo = dec->inter_bo[comm_seq & 1] = inter_bo = tmp_bo; } - ret = nouveau_bo_map(bsp_bo, NOUVEAU_BO_WR, dec->client); + ret = BO_MAP(screen, bsp_bo, NOUVEAU_BO_WR, dec->client); if (ret) { debug_printf("map failed: %i %s\n", ret, strerror(-ret)); return -1; diff --git a/src/gallium/drivers/nouveau/nv50/nv98_video_vp.c b/src/gallium/drivers/nouveau/nv50/nv98_video_vp.c index f1cdf168ed4..68dc3546d8e 100644 --- a/src/gallium/drivers/nouveau/nv50/nv98_video_vp.c +++ b/src/gallium/drivers/nouveau/nv50/nv98_video_vp.c @@ -44,7 +44,8 @@ static void dump_comm_vp(struct nouveau_vp3_decoder *dec, struct comm *comm, u32 if ((comm->pvp_stage & 0xff) != 0xff) { unsigned *map; - int ret = nouveau_bo_map(inter_bo, NOUVEAU_BO_RD|NOUVEAU_BO_NOBLOCK, dec->client); + int ret = BO_MAP(nouveau_screen(dec->base.context->screen), inter_bo, + NOUVEAU_BO_RD|NOUVEAU_BO_NOBLOCK, dec->client); assert(ret >= 0); map = inter_bo->map; for (i = 0; i < comm->byte_ofs + slice_size; i += 0x10) { diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw.c b/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw.c index e1738508798..7daf65bb39b 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw.c @@ -55,7 +55,7 @@ nvc0_hw_query_allocate(struct nvc0_context *nvc0, struct nvc0_query *q, return false; hq->offset = hq->base_offset; - ret = nouveau_bo_map(hq->bo, 0, nvc0->base.client); + ret = BO_MAP(&screen->base, hq->bo, 0, nvc0->base.client); if (ret) { nvc0_hw_query_allocate(nvc0, q, 0); return false; diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c index f0e7732e635..c7736d25335 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c @@ -1124,7 +1124,7 @@ nvc0_screen_create(struct nouveau_device *dev) ret = nouveau_bo_new(dev, flags, 0, 4096, NULL, &screen->fence.bo); if (ret) FAIL_SCREEN_INIT("Error allocating fence BO: %d\n", ret); - nouveau_bo_map(screen->fence.bo, 0, NULL); + BO_MAP(&screen->base, screen->fence.bo, 0, NULL); screen->fence.map = screen->fence.bo->map; screen->base.fence.emit = nvc0_screen_fence_emit; screen->base.fence.update = nvc0_screen_fence_update; diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_transfer.c b/src/gallium/drivers/nouveau/nvc0/nvc0_transfer.c index cb345914510..7ede77333ec 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_transfer.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_transfer.c @@ -388,7 +388,7 @@ nvc0_miptree_transfer_map(struct pipe_context *pctx, if (nvc0_mt_transfer_can_map_directly(mt)) { ret = !nvc0_mt_sync(nvc0, mt, usage); if (!ret) - ret = nouveau_bo_map(mt->base.bo, 0, NULL); + ret = BO_MAP(nvc0->base.screen, mt->base.bo, 0, NULL); if (ret && (usage & PIPE_MAP_DIRECTLY)) return NULL; @@ -480,7 +480,7 @@ nvc0_miptree_transfer_map(struct pipe_context *pctx, if (usage & PIPE_MAP_WRITE) flags |= NOUVEAU_BO_WR; - ret = nouveau_bo_map(tx->rect[1].bo, flags, nvc0->base.client); + ret = BO_MAP(nvc0->base.screen, tx->rect[1].bo, flags, nvc0->base.client); if (ret) { pipe_resource_reference(&tx->base.resource, NULL); nouveau_bo_ref(NULL, &tx->rect[1].bo); diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_video.c b/src/gallium/drivers/nouveau/nvc0/nvc0_video.c index 77895cdd6fa..60a90174b2c 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_video.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_video.c @@ -293,7 +293,7 @@ nvc0_create_decoder(struct pipe_context *context, if (ret) goto fail; - nouveau_bo_map(dec->fence_bo, NOUVEAU_BO_RDWR, screen->client); + BO_MAP(screen, dec->fence_bo, NOUVEAU_BO_RDWR, screen->client); dec->fence_map = dec->fence_bo->map; dec->fence_map[0] = dec->fence_map[4] = dec->fence_map[8] = 0; dec->comm = (struct comm *)(dec->fence_map + (COMM_OFFSET/sizeof(*dec->fence_map))); diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_video_bsp.c b/src/gallium/drivers/nouveau/nvc0/nvc0_video_bsp.c index ee54596e071..50e67bd81b7 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_video_bsp.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_video_bsp.c @@ -34,10 +34,11 @@ static void dump_comm_bsp(struct comm *comm) unsigned nvc0_decoder_bsp_begin(struct nouveau_vp3_decoder *dec, unsigned comm_seq) { + struct nouveau_screen *screen = nouveau_screen(dec->base.context->screen); struct nouveau_bo *bsp_bo = dec->bsp_bo[comm_seq % NOUVEAU_VP3_VIDEO_QDEPTH]; unsigned ret = 0; - ret = nouveau_bo_map(bsp_bo, NOUVEAU_BO_WR, dec->client); + ret = BO_MAP(screen, bsp_bo, NOUVEAU_BO_WR, dec->client); if (ret) { debug_printf("map failed: %i %s\n", ret, strerror(-ret)); return -1; @@ -53,6 +54,7 @@ nvc0_decoder_bsp_next(struct nouveau_vp3_decoder *dec, unsigned comm_seq, unsigned num_buffers, const void *const *data, const unsigned *num_bytes) { + struct nouveau_screen *screen = nouveau_screen(dec->base.context->screen); struct nouveau_bo *bsp_bo = dec->bsp_bo[comm_seq % NOUVEAU_VP3_VIDEO_QDEPTH]; struct nouveau_bo *inter_bo = dec->inter_bo[comm_seq & 1]; uint32_t bsp_size = 0; @@ -82,7 +84,7 @@ nvc0_decoder_bsp_next(struct nouveau_vp3_decoder *dec, return -1; } - ret = nouveau_bo_map(tmp_bo, NOUVEAU_BO_WR, dec->client); + ret = BO_MAP(screen, tmp_bo, NOUVEAU_BO_WR, dec->client); if (ret) { debug_printf("map failed: %i %s\n", ret, strerror(-ret)); return -1; @@ -114,7 +116,7 @@ nvc0_decoder_bsp_next(struct nouveau_vp3_decoder *dec, return -1; } - ret = nouveau_bo_map(tmp_bo, NOUVEAU_BO_WR, dec->client); + ret = BO_MAP(screen, tmp_bo, NOUVEAU_BO_WR, dec->client); if (ret) { debug_printf("map failed: %i %s\n", ret, strerror(-ret)); return -1; diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_video_vp.c b/src/gallium/drivers/nouveau/nvc0/nvc0_video_vp.c index 3de4ec14867..8ec09df01c6 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_video_vp.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_video_vp.c @@ -44,7 +44,8 @@ static void dump_comm_vp(struct nouveau_vp3_decoder *dec, struct comm *comm, u32 if ((comm->pvp_stage & 0xff) != 0xff) { unsigned *map; - int ret = nouveau_bo_map(inter_bo, NOUVEAU_BO_RD|NOUVEAU_BO_NOBLOCK, dec->client); + int ret = BO_MAP(nouveau_screen(dec->base.context->screen), inter_bo, + NOUVEAU_BO_RD|NOUVEAU_BO_NOBLOCK, dec->client); assert(ret >= 0); map = inter_bo->map; for (i = 0; i < comm->byte_ofs + slice_size; i += 0x10) { diff --git a/src/gallium/drivers/nouveau/nvc0/nve4_compute.c b/src/gallium/drivers/nouveau/nvc0/nve4_compute.c index 03a88b87797..3944dfe23c7 100644 --- a/src/gallium/drivers/nouveau/nvc0/nve4_compute.c +++ b/src/gallium/drivers/nouveau/nvc0/nve4_compute.c @@ -1031,7 +1031,7 @@ nve4_compute_trap_info(struct nvc0_context *nvc0) volatile struct nve4_mp_trap_info *info; uint8_t *map; - ret = nouveau_bo_map(bo, NOUVEAU_BO_RDWR, nvc0->base.client); + ret = BO_MAP(&screen->base, bo, NOUVEAU_BO_RDWR, nvc0->base.client); if (ret) return; map = (uint8_t *)bo->map;