mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-10 16:50:13 +01:00
nouveau: wrap nouveau_pushbuf_validate
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
3866a5433a
commit
de811ee8eb
11 changed files with 31 additions and 25 deletions
|
|
@ -88,7 +88,7 @@ nouveau_vpe_fini(struct nouveau_decoder *dec) {
|
|||
|
||||
#undef BCTX_ARGS
|
||||
|
||||
if (unlikely(nouveau_pushbuf_validate(dec->push)))
|
||||
if (unlikely(PUSH_VAL(dec->push)))
|
||||
return;
|
||||
|
||||
BEGIN_NV04(push, NV31_MPEG(EXEC), 1);
|
||||
|
|
|
|||
|
|
@ -75,6 +75,12 @@ PUSH_KICK(struct nouveau_pushbuf *push)
|
|||
nouveau_pushbuf_kick(push, push->channel);
|
||||
}
|
||||
|
||||
static inline int
|
||||
PUSH_VAL(struct nouveau_pushbuf *push)
|
||||
{
|
||||
return nouveau_pushbuf_validate(push);
|
||||
}
|
||||
|
||||
static inline int
|
||||
BO_MAP(struct nouveau_screen *screen, struct nouveau_bo *bo, uint32_t access, struct nouveau_client *client)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -499,7 +499,7 @@ nv30_state_validate(struct nv30_context *nv30, uint32_t mask, bool hwtnl)
|
|||
}
|
||||
|
||||
nouveau_pushbuf_bufctx(push, bctx);
|
||||
if (nouveau_pushbuf_validate(push)) {
|
||||
if (PUSH_VAL(push)) {
|
||||
nouveau_pushbuf_bufctx(push, NULL);
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -545,7 +545,7 @@ nv50_compute_upload_input(struct nv50_context *nv50, const uint32_t *input)
|
|||
|
||||
nouveau_bufctx_refn(nv50->bufctx, 0, bo, NOUVEAU_BO_GART | NOUVEAU_BO_RD);
|
||||
nouveau_pushbuf_bufctx(push, nv50->bufctx);
|
||||
nouveau_pushbuf_validate(push);
|
||||
PUSH_VAL(push);
|
||||
|
||||
PUSH_SPACE_EX(push, 0, 0, 1);
|
||||
|
||||
|
|
|
|||
|
|
@ -559,7 +559,7 @@ nv50_state_validate(struct nv50_context *nv50, uint32_t mask,
|
|||
nv50_bufctx_fence(bufctx, false);
|
||||
}
|
||||
nouveau_pushbuf_bufctx(nv50->base.pushbuf, bufctx);
|
||||
ret = nouveau_pushbuf_validate(nv50->base.pushbuf);
|
||||
ret = PUSH_VAL(nv50->base.pushbuf);
|
||||
|
||||
return !ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -257,7 +257,7 @@ nv50_resource_copy_region(struct pipe_context *pipe,
|
|||
BCTX_REFN(nv50->bufctx, 2D, nv04_resource(src), RD);
|
||||
BCTX_REFN(nv50->bufctx, 2D, nv04_resource(dst), WR);
|
||||
nouveau_pushbuf_bufctx(nv50->base.pushbuf, nv50->bufctx);
|
||||
nouveau_pushbuf_validate(nv50->base.pushbuf);
|
||||
PUSH_VAL(nv50->base.pushbuf);
|
||||
|
||||
for (; dst_layer < dstz + src_box->depth; ++dst_layer, ++src_layer) {
|
||||
ret = nv50_2d_texture_do_copy(nv50->base.pushbuf,
|
||||
|
|
@ -653,7 +653,7 @@ nv50_clear_buffer_push(struct pipe_context *pipe,
|
|||
|
||||
nouveau_bufctx_refn(nv50->bufctx, 0, buf->bo, buf->domain | NOUVEAU_BO_WR);
|
||||
nouveau_pushbuf_bufctx(push, nv50->bufctx);
|
||||
nouveau_pushbuf_validate(push);
|
||||
PUSH_VAL(push);
|
||||
|
||||
offset &= ~0xff;
|
||||
|
||||
|
|
@ -1639,7 +1639,7 @@ nv50_blit_eng2d(struct nv50_context *nv50, const struct pipe_blit_info *info)
|
|||
BCTX_REFN(nv50->bufctx, 2D, &dst->base, WR);
|
||||
BCTX_REFN(nv50->bufctx, 2D, &src->base, RD);
|
||||
nouveau_pushbuf_bufctx(nv50->base.pushbuf, nv50->bufctx);
|
||||
if (nouveau_pushbuf_validate(nv50->base.pushbuf))
|
||||
if (PUSH_VAL(nv50->base.pushbuf))
|
||||
return;
|
||||
|
||||
for (i = 0; i < info->dst.box.depth; ++i) {
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ nv50_2d_transfer_rect(struct nv50_context *nv50,
|
|||
nouveau_bufctx_refn(bctx, 0, src->bo, src->domain | NOUVEAU_BO_RD);
|
||||
nouveau_bufctx_refn(bctx, 0, dst->bo, dst->domain | NOUVEAU_BO_WR);
|
||||
nouveau_pushbuf_bufctx(push, bctx);
|
||||
nouveau_pushbuf_validate(push);
|
||||
PUSH_VAL(push);
|
||||
|
||||
uint32_t format;
|
||||
switch (cpp) {
|
||||
|
|
@ -197,7 +197,7 @@ nv50_m2mf_transfer_rect(struct nv50_context *nv50,
|
|||
nouveau_bufctx_refn(bctx, 0, src->bo, src->domain | NOUVEAU_BO_RD);
|
||||
nouveau_bufctx_refn(bctx, 0, dst->bo, dst->domain | NOUVEAU_BO_WR);
|
||||
nouveau_pushbuf_bufctx(push, bctx);
|
||||
nouveau_pushbuf_validate(push);
|
||||
PUSH_VAL(push);
|
||||
|
||||
if (nouveau_bo_memtype(src->bo)) {
|
||||
BEGIN_NV04(push, NV50_M2MF(LINEAR_IN), 6);
|
||||
|
|
@ -284,7 +284,7 @@ nv50_sifc_linear_u8(struct nouveau_context *nv,
|
|||
|
||||
nouveau_bufctx_refn(nv50->bufctx, 0, dst, domain | NOUVEAU_BO_WR);
|
||||
nouveau_pushbuf_bufctx(push, nv50->bufctx);
|
||||
nouveau_pushbuf_validate(push);
|
||||
PUSH_VAL(push);
|
||||
|
||||
offset &= ~0xff;
|
||||
|
||||
|
|
@ -337,7 +337,7 @@ nv50_m2mf_copy_linear(struct nouveau_context *nv,
|
|||
nouveau_bufctx_refn(bctx, 0, src, srcdom | NOUVEAU_BO_RD);
|
||||
nouveau_bufctx_refn(bctx, 0, dst, dstdom | NOUVEAU_BO_WR);
|
||||
nouveau_pushbuf_bufctx(push, bctx);
|
||||
nouveau_pushbuf_validate(push);
|
||||
PUSH_VAL(push);
|
||||
|
||||
BEGIN_NV04(push, NV50_M2MF(LINEAR_IN), 1);
|
||||
PUSH_DATA (push, 1);
|
||||
|
|
|
|||
|
|
@ -985,7 +985,7 @@ nvc0_state_validate(struct nvc0_context *nvc0, uint32_t mask,
|
|||
}
|
||||
|
||||
nouveau_pushbuf_bufctx(nvc0->base.pushbuf, bufctx);
|
||||
ret = nouveau_pushbuf_validate(nvc0->base.pushbuf);
|
||||
ret = PUSH_VAL(nvc0->base.pushbuf);
|
||||
|
||||
return !ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -267,7 +267,7 @@ nvc0_resource_copy_region(struct pipe_context *pipe,
|
|||
BCTX_REFN(nvc0->bufctx, 2D, nv04_resource(src), RD);
|
||||
BCTX_REFN(nvc0->bufctx, 2D, nv04_resource(dst), WR);
|
||||
nouveau_pushbuf_bufctx(nvc0->base.pushbuf, nvc0->bufctx);
|
||||
nouveau_pushbuf_validate(nvc0->base.pushbuf);
|
||||
PUSH_VAL(nvc0->base.pushbuf);
|
||||
|
||||
for (; dst_layer < dstz + src_box->depth; ++dst_layer, ++src_layer) {
|
||||
ret = nvc0_2d_texture_do_copy(nvc0->base.pushbuf,
|
||||
|
|
@ -379,7 +379,7 @@ nvc0_clear_buffer_push_nvc0(struct pipe_context *pipe,
|
|||
|
||||
nouveau_bufctx_refn(nvc0->bufctx, 0, buf->bo, buf->domain | NOUVEAU_BO_WR);
|
||||
nouveau_pushbuf_bufctx(push, nvc0->bufctx);
|
||||
nouveau_pushbuf_validate(push);
|
||||
PUSH_VAL(push);
|
||||
|
||||
unsigned count = (size + 3) / 4;
|
||||
unsigned data_words = data_size / 4;
|
||||
|
|
@ -428,7 +428,7 @@ nvc0_clear_buffer_push_nve4(struct pipe_context *pipe,
|
|||
|
||||
nouveau_bufctx_refn(nvc0->bufctx, 0, buf->bo, buf->domain | NOUVEAU_BO_WR);
|
||||
nouveau_pushbuf_bufctx(push, nvc0->bufctx);
|
||||
nouveau_pushbuf_validate(push);
|
||||
PUSH_VAL(push);
|
||||
|
||||
unsigned count = (size + 3) / 4;
|
||||
unsigned data_words = data_size / 4;
|
||||
|
|
@ -1327,7 +1327,7 @@ nvc0_blit_3d(struct nvc0_context *nvc0, const struct pipe_blit_info *info)
|
|||
NOUVEAU_BO_GART | NOUVEAU_BO_RD, vtxbuf_bo);
|
||||
BCTX_REFN_bo(nvc0->bufctx_3d, 3D_TEXT,
|
||||
NV_VRAM_DOMAIN(&screen->base) | NOUVEAU_BO_RD, screen->text);
|
||||
nouveau_pushbuf_validate(push);
|
||||
PUSH_VAL(push);
|
||||
|
||||
BEGIN_NVC0(push, NVC0_3D(VERTEX_ARRAY_FETCH(0)), 4);
|
||||
PUSH_DATA (push, NVC0_3D_VERTEX_ARRAY_FETCH_ENABLE | stride <<
|
||||
|
|
@ -1549,7 +1549,7 @@ nvc0_blit_eng2d(struct nvc0_context *nvc0, const struct pipe_blit_info *info)
|
|||
BCTX_REFN(nvc0->bufctx, 2D, &dst->base, WR);
|
||||
BCTX_REFN(nvc0->bufctx, 2D, &src->base, RD);
|
||||
nouveau_pushbuf_bufctx(nvc0->base.pushbuf, nvc0->bufctx);
|
||||
if (nouveau_pushbuf_validate(nvc0->base.pushbuf))
|
||||
if (PUSH_VAL(nvc0->base.pushbuf))
|
||||
return;
|
||||
|
||||
for (i = 0; i < info->dst.box.depth; ++i) {
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ nvc0_m2mf_transfer_rect(struct nvc0_context *nvc0,
|
|||
nouveau_bufctx_refn(bctx, 0, src->bo, src->domain | NOUVEAU_BO_RD);
|
||||
nouveau_bufctx_refn(bctx, 0, dst->bo, dst->domain | NOUVEAU_BO_WR);
|
||||
nouveau_pushbuf_bufctx(push, bctx);
|
||||
nouveau_pushbuf_validate(push);
|
||||
PUSH_VAL(push);
|
||||
|
||||
if (nouveau_bo_memtype(src->bo)) {
|
||||
BEGIN_NVC0(push, NVC0_M2MF(TILING_MODE_IN), 5);
|
||||
|
|
@ -138,7 +138,7 @@ nve4_m2mf_transfer_rect(struct nvc0_context *nvc0,
|
|||
nouveau_bufctx_refn(bctx, 0, dst->bo, dst->domain | NOUVEAU_BO_WR);
|
||||
nouveau_bufctx_refn(bctx, 0, src->bo, src->domain | NOUVEAU_BO_RD);
|
||||
nouveau_pushbuf_bufctx(push, bctx);
|
||||
nouveau_pushbuf_validate(push);
|
||||
PUSH_VAL(push);
|
||||
|
||||
exec = NVE4_COPY_EXEC_SWIZZLE_ENABLE | NVE4_COPY_EXEC_2D_ENABLE | NVE4_COPY_EXEC_FLUSH | NVE4_COPY_EXEC_COPY_MODE_NON_PIPELINED;
|
||||
|
||||
|
|
@ -207,7 +207,7 @@ nvc0_m2mf_push_linear(struct nouveau_context *nv,
|
|||
|
||||
nouveau_bufctx_refn(nvc0->bufctx, 0, dst, domain | NOUVEAU_BO_WR);
|
||||
nouveau_pushbuf_bufctx(push, nvc0->bufctx);
|
||||
nouveau_pushbuf_validate(push);
|
||||
PUSH_VAL(push);
|
||||
|
||||
while (count) {
|
||||
unsigned nr = MIN2(count, NV04_PFIFO_MAX_PACKET_LEN);
|
||||
|
|
@ -249,7 +249,7 @@ nve4_p2mf_push_linear(struct nouveau_context *nv,
|
|||
|
||||
nouveau_bufctx_refn(nvc0->bufctx, 0, dst, domain | NOUVEAU_BO_WR);
|
||||
nouveau_pushbuf_bufctx(push, nvc0->bufctx);
|
||||
nouveau_pushbuf_validate(push);
|
||||
PUSH_VAL(push);
|
||||
|
||||
while (count) {
|
||||
unsigned nr = MIN2(count, (NV04_PFIFO_MAX_PACKET_LEN - 1));
|
||||
|
|
@ -289,7 +289,7 @@ nvc0_m2mf_copy_linear(struct nouveau_context *nv,
|
|||
nouveau_bufctx_refn(bctx, 0, src, srcdom | NOUVEAU_BO_RD);
|
||||
nouveau_bufctx_refn(bctx, 0, dst, dstdom | NOUVEAU_BO_WR);
|
||||
nouveau_pushbuf_bufctx(push, bctx);
|
||||
nouveau_pushbuf_validate(push);
|
||||
PUSH_VAL(push);
|
||||
|
||||
while (size) {
|
||||
unsigned bytes = MIN2(size, 1 << 17);
|
||||
|
|
@ -327,7 +327,7 @@ nve4_m2mf_copy_linear(struct nouveau_context *nv,
|
|||
nouveau_bufctx_refn(bctx, 0, src, srcdom | NOUVEAU_BO_RD);
|
||||
nouveau_bufctx_refn(bctx, 0, dst, dstdom | NOUVEAU_BO_WR);
|
||||
nouveau_pushbuf_bufctx(push, bctx);
|
||||
nouveau_pushbuf_validate(push);
|
||||
PUSH_VAL(push);
|
||||
|
||||
BEGIN_NVC0(push, NVE4_COPY(SRC_ADDRESS_HIGH), 4);
|
||||
PUSH_DATAh(push, src->offset + srcoff);
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ nvc0_push_setup_vertex_array(struct nvc0_context *nvc0, const unsigned count)
|
|||
|
||||
BCTX_REFN_bo(nvc0->bufctx_3d, 3D_VTX_TMP, NOUVEAU_BO_GART | NOUVEAU_BO_RD,
|
||||
bo);
|
||||
nouveau_pushbuf_validate(push);
|
||||
PUSH_VAL(push);
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
|
@ -731,7 +731,7 @@ nvc0_push_upload_vertex_ids(struct push_context *ctx,
|
|||
|
||||
BCTX_REFN_bo(nvc0->bufctx_3d, 3D_VTX_TMP, NOUVEAU_BO_GART | NOUVEAU_BO_RD,
|
||||
bo);
|
||||
nouveau_pushbuf_validate(push);
|
||||
PUSH_VAL(push);
|
||||
|
||||
if (info->index_size) {
|
||||
if (!draw->index_bias) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue