venus: support reply shmem without ring

Let vn_instance_get_reply_shmem_locked use the renderer if it is called
before the ring is initialized.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12568>
This commit is contained in:
Chia-I Wu 2021-08-29 22:07:24 -07:00 committed by Marge Bot
parent 68eb682a23
commit e5a005dd0c
1 changed files with 16 additions and 3 deletions

View File

@ -556,8 +556,14 @@ vn_instance_get_reply_shmem_locked(struct vn_instance *instance,
vn_encode_vkSetReplyCommandStreamMESA(&local_enc, 0, &stream);
vn_cs_encoder_commit(&local_enc);
vn_instance_roundtrip(instance);
vn_instance_ring_submit_locked(instance, &local_enc, NULL, NULL);
if (likely(instance->ring.id)) {
vn_instance_roundtrip(instance);
vn_instance_ring_submit_locked(instance, &local_enc, NULL, NULL);
} else {
vn_renderer_submit_simple(instance->renderer,
set_reply_command_stream_data,
vn_cs_encoder_get_len(&local_enc));
}
}
/* TODO avoid this seek command and go lock-free? */
@ -567,7 +573,14 @@ vn_instance_get_reply_shmem_locked(struct vn_instance *instance,
const size_t offset = instance->reply.used;
vn_encode_vkSeekReplyCommandStreamMESA(&local_enc, 0, offset);
vn_cs_encoder_commit(&local_enc);
vn_instance_ring_submit_locked(instance, &local_enc, NULL, NULL);
if (likely(instance->ring.id)) {
vn_instance_ring_submit_locked(instance, &local_enc, NULL, NULL);
} else {
vn_renderer_submit_simple(instance->renderer,
seek_reply_command_stream_data,
vn_cs_encoder_get_len(&local_enc));
}
*ptr = instance->reply.ptr + offset;
instance->reply.used += size;