mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 19:40:10 +01:00
nouveau: wrap nouveau_bo_wait
This makes it easier to insert locking code around libdrm. Signed-off-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: M Henning <drawoc@darkrefraction.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>
This commit is contained in:
parent
db825e34a9
commit
5fe8fedf24
12 changed files with 23 additions and 14 deletions
|
|
@ -191,7 +191,7 @@ nouveau_transfer_read(struct nouveau_context *nv, struct nouveau_transfer *tx)
|
|||
nv->copy_data(nv, tx->bo, tx->offset, NOUVEAU_BO_GART,
|
||||
buf->bo, buf->offset + base, buf->domain, size);
|
||||
|
||||
if (nouveau_bo_wait(tx->bo, NOUVEAU_BO_RD, nv->client))
|
||||
if (BO_WAIT(nv->screen, tx->bo, NOUVEAU_BO_RD, nv->client))
|
||||
return false;
|
||||
|
||||
if (buf->data)
|
||||
|
|
|
|||
|
|
@ -75,6 +75,12 @@ BO_MAP(struct nouveau_screen *screen, struct nouveau_bo *bo, uint32_t access, st
|
|||
return nouveau_bo_map(bo, access, client);
|
||||
}
|
||||
|
||||
static inline int
|
||||
BO_WAIT(struct nouveau_screen *screen, struct nouveau_bo *bo, uint32_t access, struct nouveau_client *client)
|
||||
{
|
||||
return nouveau_bo_wait(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)
|
||||
|
||||
|
|
|
|||
|
|
@ -294,7 +294,7 @@ nv50_hw_get_query_result(struct nv50_context *nv50, struct nv50_query *q,
|
|||
}
|
||||
return false;
|
||||
}
|
||||
if (nouveau_bo_wait(hq->bo, NOUVEAU_BO_RD, nv50->base.client))
|
||||
if (BO_WAIT(&nv50->screen->base, hq->bo, NOUVEAU_BO_RD, nv50->base.client))
|
||||
return false;
|
||||
}
|
||||
hq->state = NV50_HW_QUERY_STATE_READY;
|
||||
|
|
@ -447,14 +447,15 @@ nv50_hw_get_driver_query_info(struct nv50_screen *screen, unsigned id,
|
|||
}
|
||||
|
||||
void
|
||||
nv50_hw_query_pushbuf_submit(struct nouveau_pushbuf *push, uint16_t method,
|
||||
nv50_hw_query_pushbuf_submit(struct nv50_context *nv50, uint16_t method,
|
||||
struct nv50_query *q, unsigned result_offset)
|
||||
{
|
||||
struct nouveau_pushbuf *push = nv50->base.pushbuf;
|
||||
struct nv50_hw_query *hq = nv50_hw_query(q);
|
||||
|
||||
nv50_hw_query_update(q);
|
||||
if (hq->state != NV50_HW_QUERY_STATE_READY)
|
||||
nouveau_bo_wait(hq->bo, NOUVEAU_BO_RD, push->client);
|
||||
BO_WAIT(&nv50->screen->base, hq->bo, NOUVEAU_BO_RD, push->client);
|
||||
hq->state = NV50_HW_QUERY_STATE_READY;
|
||||
|
||||
BEGIN_NV04(push, SUBC_3D(method), 1);
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ nv50_hw_get_driver_query_info(struct nv50_screen *, unsigned,
|
|||
bool
|
||||
nv50_hw_query_allocate(struct nv50_context *, struct nv50_query *, int);
|
||||
void
|
||||
nv50_hw_query_pushbuf_submit(struct nouveau_pushbuf *, uint16_t,
|
||||
nv50_hw_query_pushbuf_submit(struct nv50_context *, uint16_t,
|
||||
struct nv50_query *, unsigned);
|
||||
void
|
||||
nv84_hw_query_fifo_wait(struct nouveau_pushbuf *, struct nv50_query *);
|
||||
|
|
|
|||
|
|
@ -321,7 +321,7 @@ nv50_hw_sm_query_read_data(uint32_t count[32][4],
|
|||
if (hq->data[b + 4] != hq->sequence) {
|
||||
if (!wait)
|
||||
return false;
|
||||
if (nouveau_bo_wait(hq->bo, NOUVEAU_BO_RD, nv50->base.client))
|
||||
if (BO_WAIT(&nv50->screen->base, hq->bo, NOUVEAU_BO_RD, nv50->base.client))
|
||||
return false;
|
||||
}
|
||||
count[p][c] = hq->data[b + hsq->ctr[c]];
|
||||
|
|
|
|||
|
|
@ -717,7 +717,7 @@ nv50_stream_output_validate(struct nv50_context *nv50)
|
|||
PUSH_DATA(push, targ->pipe.buffer_size);
|
||||
if (!targ->clean) {
|
||||
assert(targ->pq);
|
||||
nv50_hw_query_pushbuf_submit(push, NVA0_3D_STRMOUT_OFFSET(i),
|
||||
nv50_hw_query_pushbuf_submit(nv50, NVA0_3D_STRMOUT_OFFSET(i),
|
||||
nv50_query(targ->pq), 0x4);
|
||||
} else {
|
||||
BEGIN_NV04(push, NVA0_3D(STRMOUT_OFFSET(i)), 1);
|
||||
|
|
|
|||
|
|
@ -737,7 +737,7 @@ nva0_draw_stream_output(struct nv50_context *nv50,
|
|||
PUSH_DATA (push, 0);
|
||||
BEGIN_NV04(push, NVA0_3D(DRAW_TFB_STRIDE), 1);
|
||||
PUSH_DATA (push, so->stride);
|
||||
nv50_hw_query_pushbuf_submit(push, NVA0_3D_DRAW_TFB_BYTES,
|
||||
nv50_hw_query_pushbuf_submit(nv50, NVA0_3D_DRAW_TFB_BYTES,
|
||||
nv50_query(so->pq), 0x4);
|
||||
BEGIN_NV04(push, NV50_3D(VERTEX_END_GL), 1);
|
||||
PUSH_DATA (push, 0);
|
||||
|
|
|
|||
|
|
@ -184,11 +184,12 @@ nv84_decoder_begin_frame_mpeg12(struct pipe_video_codec *decoder,
|
|||
struct pipe_video_buffer *target,
|
||||
struct pipe_picture_desc *picture)
|
||||
{
|
||||
struct nouveau_screen *screen = nouveau_screen(decoder->context->screen);
|
||||
struct nv84_decoder *dec = (struct nv84_decoder *)decoder;
|
||||
struct pipe_mpeg12_picture_desc *desc = (struct pipe_mpeg12_picture_desc *)picture;
|
||||
int i;
|
||||
|
||||
nouveau_bo_wait(dec->mpeg12_bo, NOUVEAU_BO_RDWR, dec->client);
|
||||
BO_WAIT(screen, dec->mpeg12_bo, NOUVEAU_BO_RDWR, dec->client);
|
||||
dec->mpeg12_mb_info = dec->mpeg12_bo->map + 0x100;
|
||||
dec->mpeg12_data = dec->mpeg12_bo->map + 0x100 +
|
||||
align(0x20 * mb(dec->base.width) * mb(dec->base.height), 0x100);
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@ nv84_decoder_bsp(struct nv84_decoder *dec,
|
|||
const unsigned *num_bytes,
|
||||
struct nv84_video_buffer *dest)
|
||||
{
|
||||
struct nouveau_screen *screen = nouveau_screen(dec->base.context->screen);
|
||||
struct iparm params;
|
||||
uint32_t more_params[0x44 / 4] = {0};
|
||||
unsigned total_bytes = 0;
|
||||
|
|
@ -103,7 +104,7 @@ nv84_decoder_bsp(struct nv84_decoder *dec,
|
|||
{ dec->fence, NOUVEAU_BO_RDWR | NOUVEAU_BO_VRAM },
|
||||
};
|
||||
|
||||
nouveau_bo_wait(dec->fence, NOUVEAU_BO_RDWR, dec->client);
|
||||
BO_WAIT(screen, dec->fence, NOUVEAU_BO_RDWR, dec->client);
|
||||
|
||||
STATIC_ASSERT(sizeof(struct iparm) == 0x530);
|
||||
|
||||
|
|
|
|||
|
|
@ -330,7 +330,7 @@ nvc0_hw_get_query_result(struct nvc0_context *nvc0, struct nvc0_query *q,
|
|||
}
|
||||
return false;
|
||||
}
|
||||
if (nouveau_bo_wait(hq->bo, NOUVEAU_BO_RD, nvc0->base.client))
|
||||
if (BO_WAIT(&nvc0->screen->base, hq->bo, NOUVEAU_BO_RD, nvc0->base.client))
|
||||
return false;
|
||||
NOUVEAU_DRV_STAT(&nvc0->screen->base, query_sync_count, 1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2636,7 +2636,7 @@ nvc0_hw_sm_query_read_data(uint32_t count[32][8],
|
|||
if (hq->data[b + 8] != hq->sequence) {
|
||||
if (!wait)
|
||||
return false;
|
||||
if (nouveau_bo_wait(hq->bo, NOUVEAU_BO_RD, nvc0->base.client))
|
||||
if (BO_WAIT(&nvc0->screen->base, hq->bo, NOUVEAU_BO_RD, nvc0->base.client))
|
||||
return false;
|
||||
}
|
||||
count[p][c] = hq->data[b + hsq->ctr[c]] * (1 << c);
|
||||
|
|
@ -2664,7 +2664,7 @@ nve4_hw_sm_query_read_data(uint32_t count[32][8],
|
|||
if (hq->data[b + 20 + d] != hq->sequence) {
|
||||
if (!wait)
|
||||
return false;
|
||||
if (nouveau_bo_wait(hq->bo, NOUVEAU_BO_RD, nvc0->base.client))
|
||||
if (BO_WAIT(&nvc0->screen->base, hq->bo, NOUVEAU_BO_RD, nvc0->base.client))
|
||||
return false;
|
||||
}
|
||||
if (hsq->ctr[c] & ~0x3)
|
||||
|
|
|
|||
|
|
@ -362,7 +362,7 @@ nvc0_mt_sync(struct nvc0_context *nvc0, struct nv50_miptree *mt, unsigned usage)
|
|||
if (!mt->base.mm) {
|
||||
uint32_t access = (usage & PIPE_MAP_WRITE) ?
|
||||
NOUVEAU_BO_WR : NOUVEAU_BO_RD;
|
||||
return !nouveau_bo_wait(mt->base.bo, access, nvc0->base.client);
|
||||
return !BO_WAIT(&nvc0->screen->base, mt->base.bo, access, nvc0->base.client);
|
||||
}
|
||||
if (usage & PIPE_MAP_WRITE)
|
||||
return !mt->base.fence || nouveau_fence_wait(mt->base.fence, &nvc0->base.debug);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue