WIP: vtest: add support for blob resources
This is part of !412 (merged) and is sent out separately because it can be used by virgl as well.
The first four commits add VCMD_GET_PARAM
and VCMD_GET_CAPSET
. VCMD_GET_PARAM
is especially interesting because it allows optional features (such host-coherent dmabuf needed by blob resources).
The next two commits convert VCMD_RESOURCE_CREATE{,2}
to use server-generated ids. I would like blob resources to use server-generated ids such that resource sharing is possible. To be able to do that, existing resources need to be converted to use server-generated ids as well.
The next three commits add VCMD_RESOURCE_IMPORT
. The command enables resource sharing and is optional (supported only when --multi-clients is specified).
The last two commits add VCMD_RESOURCE_CREATE_BLOB
. There is a new flag, VIRGL_RENDERER_HOST_COHERENT_DMABUF_BLOB
. The flag is controversial because there is no host-coherent dmabuf after all. virgl needs to know how GBM/kernel allocates and sets up dmabufs internally to know if mmaping gives a host-coherent mapping. But the flag is needed because mesa needs host-coherent dmabufs to support GL_MAP_COHERENT_BIT
. The flag is unsupported currently and VCMD_GET_PARAM
always returns false when the feature is queried.
All the changes require vtest protocol version 3. I do not bump up the version yet because I hope version 3 can include VCMD_CONTEXT_INIT
as well. The command allows a different context type to be initialized (e.g., vulkan). Because vulkan is an optional feature, what I would like to see is to include VCMD_CONTEXT_INIT
in the protocol, but VCMD_GET_PARAM
would always return false when vulkan support is queried.