Let VTEST_FUZZER_FENCES control whether VCMD_RESOURCE_BUSY_WAIT waits or
not. Fences are always created.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
It gives clients access to virgl_renderer_resource_create_blob and
virgl_renderer_resource_export_blob.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Protocol version 3 uses server-generated, rather than client-generated,
resource ids. Without that, clients could pick conflicting resource
ids.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
VCMD_RESOURCE_CREATE and VCMD_RESOURCE_CREATE2 use and return
server-generated ids since version 3. The client id must be 0.
This makes the commands work more like linux's
DRM_IOCTL_VIRTGPU_RESOURCE_CREATE.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
This paves the way for a protcol change where the server will
generate resource ids. This also improves our error handling by
switching from FREE to vtest_unref_resource.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
It gives clients access to virgl_renderer_context_create_with_flags.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Isaac Bosompem <mrisaacb@google.com>
Comparing to VCMD_GET_{CAPS,CAPS2}, it allows any capset id/version
to be queried.
This is similar to linux's DRM_IOCTL_VIRTGPU_GET_CAPS.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Isaac Bosompem <mrisaacb@google.com>
There is no parameter defined yet, but the command can be used to query
optional features. It also allows new features to be introduced without
bumping up the protocol version.
This is similar to linux's DRM_IOCTL_VIRTGPU_GETPARAM.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Isaac Bosompem <mrisaacb@google.com>
The goal is to allow clients to negoticate protocol versions, capsets,
and in the future, parameters and context types before
virgl_renderer_context_create is called.
Specifically, these commands should not trigger
virgl_renderer_context_create
VCMD_PING_PROTOCOL_VERSION
VCMD_PROTOCOL_VERSION
VCMD_GET_CAPS
VCMD_GET_CAPS2
VCMD_RESOURCE_BUSY_WAIT when res_id==0 (for legacy reasons)
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Isaac Bosompem <mrisaacb@google.com>
Move virgl_renderer_context_create call from vtest_create_context to
the new vtest_lazy_init_context. This defers context initialization
until the first command after VCMD_CREATE_RENDERER.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Isaac Bosompem <mrisaacb@google.com>
struct vtest_context is about to get more complex. Use
vtest_destroy_context so that we have a single point that does context
destruction.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Isaac Bosompem <mrisaacb@google.com>
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>
Previously, Mesa would remain forever blocked in read() after an error
such as failing to compile a shader.
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
To keep Valgrind happy:
==3628== Syscall param sendmsg(msg.msg_iov[0]) points to uninitialised byte(s)
==3628== at 0x48DB431: sendmsg (sendmsg.c:28)
==3628== by 0x10C00E: vtest_create_resource2 (in /virglrenderer/build/vtest/virgl_test_server)
==3628== by 0x10AC2B: vtest_server_run (in /virglrenderer/build/vtest/virgl_test_server)
==3628== by 0x10A5B3: main (in /virglrenderer/build/vtest/virgl_test_server)
==3628== Address 0x1fff0004ef is on thread 1's stack
==3628== in frame #1, created by vtest_create_resource2 (???:)
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
This commit moves input/out_fd into vtest_context to allow multiple
clients, where each client is represented by a vtest_context and has
its own vtest_input.
Note that clients must know and trust each other, especially when it
comes to resources. There is no conflict or ownership check in
vtest_create_resource or vtest_resource_unref respectively yet.
There is also no resource sharing support yet.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
Reviewed-By: Gurchetan Singh <gurchetansingh@chromium.org>
A vtest_renderer is still global, but it can now have multiple
vtest_contexts. vtest_create_renderer is replaced by
vtest_init_renderer
vtest_create_context
vtest_set_current_context
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
Reviewed-By: Gurchetan Singh <gurchetansingh@chromium.org>
Fixes:
warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
In systems with more then one graphics card the rendernode is currently
picked based on the order in which they are listed in /dev/dri. Add an
command line option and a environment variable to make it possible to
specify the render node explicitely.
Fixes#135
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
The fuzzer series added a few warnings that need to be silenced.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: David Riley <davidriley@chromium.org>
Allow input to be changed from reading from a socket.
Signed-off-by: David Riley <davidriley@chromium.org>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
This means we can change them a bit more easily, for instance... from
command-line arguments!
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>