Replace virgl_context::get_blob_pipe by virgl_context::get_blob,
which supports fd-based blobs. There is also optional
virgl_context::get_blob_done to give the context a chance to
associate a resource with a blob.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Allow iov to be initialized when resource is created.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Add has_{host,guest}_storage and reduce the indentation. There
should be no real change.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Capset ids belong to virgl_hw.h. Mesa uses magic numbers right now
and can be fixed with this change.
Capset ids are also leaked in virtio_gpu.h, for use with
virgl_renderer_get_cap_set by qemu. We should replace
virgl_renderer_get_cap_set by something that enumerates all capsets
to stop the leaking, but that is another story.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
stdint.h was included twice. Back ported VIRGL_CMD0_MAX_DWORDS and
VIRGL_QUERY_RESULT_SIZE from Mesa.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
The intention is to warn the users, not to inconvenience ourselves.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Passing NULL for args to indicate nop is too tricky to get right.
Add a bool for that.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: David Riley <davidriley@chromium.org>
We want to destroy all resources owned by a context after a client
dies unexpectedly. This is needed for --multi-clients. See commit
6c44b4a79 (vtest: add experimental multi-client support) for more
details.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Call virgl_renderer_resource_unref from resource_destroy_func. Do
not rely on virgl_renderer_cleanup to clean up for us. This is
needed for proper multiple client support, where we need to clean up
client resources when a client dies.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Move the common code of vtest_create_{resource,resource2} to the new
function.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Manage both v1 and v2 resources the same way.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Add vtest_resource and embed iovec in it.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Move the common code of vtest_transfer_{put,put_nop,put2,put2_nop}
to the new function.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Move the common code of vtest_transfer_{get,get_nop,get2,get2_nop}
to the new function.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Replace DECODE_TRANSFER2 macro by the new helper.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Replace DECODE_TRANSFER macro by the new helper.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
The plan is to remove the patch step and generate the correct glsl
from the beginning. As the first step, just move the patch step to
where we create glsl.
Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
This make sure we have a valid framebuffer in current context.
Some GPU driver like MALI is buggy and will crash on glEndQuery with targets
like GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN if no valid framebuffer in
current context.
Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
In case GL_ARB_buffer_storage is available, use that.
If not, attempt to allocate a dma-buf and import it into GL.
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
This conditionally compiles the GL4.5 changes so
development can be moved into master.
Suggested-by: Chia-I Wu <olvaffe@gmail.com>
Acked-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
This is to tell virglrenderer that blob resources used with
the 3d driver must be able represented as file descriptors.
This affects the availability of certain features.
Suggested-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Acked-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
For non-exportable memory, add map/unmap.
For additional validation, query virglrenderer about the preferred
caching type. The response will be returned in to the guest
in virtio_gpu_resp_map_info.
Acked-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
A blob resource is a container for:
- VIRGL_RENDERER_BLOB_MEM_GUEST: a guest memory allocation
(referred to as a "guest-only blob resource")
- VIRGL_RENDERER_BLOB_MEM_HOST3D: a host3d memory allocation
(referred to as a "host-only blob resource")
- VIRGL_RENDERER_BLOB_MEM_HOST3D_GUEST: a guest + host3d memory allocation
(referred to as a "default blob resource").
Blob resources can be used to implement new features and fix shortcomings
with the current resource create path. The subsequent patches show how
blob resources may be leveraged to implement GL_ARB_buffer_storage
and GL4.5.
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Acked-by: Gert Wollny <gert.wollny@collabora.com>
Add a helper, virgl_resource_create, to allocate and add the
virgl_resource to the table.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
I don't see the point why we want to use context0 to do transfer.
If we always use original context to do transfer, then we can
avoid sync between contexts for mobile GPU.
Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
There is no TGSI OPCODE for roundEven, prefer roundEven
so roundEven in guest gets translated to roundEven.
Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Autotools is deprecated since debb6e6ac4
It's now time to drop it definitively.
Signed-off-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
fs_texfetch_col_swizzle is parameterized on the number of samples and
whether or not it needs to handle swizzle. Make sure that the cached
shader is recreated if the parameters change.
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
Minigbm's gbm_bo_map signature has diverged from gbm. Update to
minigbm signature, since virglrenderer now explicitly targets minigbm.
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
VIRGL_BIND_SHARED allows external allocators to intercept resource
creation. Reserve the upper byte of bind flags to allow passing
allocator-specific flags, and define a set of such flags for minigbm.
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>