Make it clear that they are implicit between submit_cmd and
resource_busy_wait.
implicit_fence_submitted is (fence_id - 1) so this change is slightly
more than renaming.
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>
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>
Add --multi-clients to enable experimental multi-client support.
Note that multi-client should be enabled only when the clients know
and trust each other. This is because resources are global among
the clients. Two clients trying to create two resources with the
same id will result in an id conflict for example.
Proper multi-client support requires changes to the protocol. The
main change will be for the server to generate globally unique
resource ids and enforce access controls.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
Reviewed-By: Gurchetan Singh <gurchetansingh@chromium.org>
Add vtest_server_run to replace vtest_server_run_renderer. The new
function is the main loop of the server, which
- accepts new client connections
- dispatches client commands
- removes inactive clients
- lazily initi/cleanup the renderer
- optionally forks for each connection
in a single loop.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
Reviewed-By: Gurchetan Singh <gurchetansingh@chromium.org>
Get rid of gotos so that it will be easier when we turn
vtest_server_run_renderer into the main loop.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
Reviewed-By: Gurchetan Singh <gurchetansingh@chromium.org>
We want to make vtest_server_run_renderer the main loop when we add
multi-client support. Forking for new clients will be done in the
main loop.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
Reviewed-By: Gurchetan Singh <gurchetansingh@chromium.org>
Call vtest_init_renderer when the client connects, instead of before
the first command. We want to make vtest_server_run_renderer the
main loop when we add multi-client support, and this makes things
simpler.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
Reviewed-By: Gurchetan Singh <gurchetansingh@chromium.org>
Refactor command dispatching to a separate function,
vtest_client_dispatch_commands.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
Reviewed-By: Gurchetan Singh <gurchetansingh@chromium.org>
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>
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>
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>
We don't have an --use-egl option, we have a --use-gles option. This was
simply a typo when I updated the string last.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
This is easier than having to remember environment variables.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
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>
This fixes build failures with musl C library
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
No functional change other then better option parsing.
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
When running tests it's easy to lose track the segfaults in the console spam,
very simply just catch the segfault and printf.
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
Let's be a little less conservative then QEMU -- fence only
on draw calls and possible fence creations.
Can we do even better, and fence only when Gallium requests
VIRGL_BIND_CUSTOM? Someone should look into this, but let's
get this landed to unblock the CQ.
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
Refactor the main loop into smaller functions so that it is easier to extend
with more functionality.
There should be no functional change with the exception of some socket
listening code would return error codes as fds, where they now instead call
perrno and exit(1).
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
Turns out some files managed to have a mix between 2, 3, 4 and tabs for
indenting. The only way to really fix this was to do just a single commit
that fixes all of them.
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
run_renderer now uses an array to get the corresponding function
pointer for a command.
Some vtest_* function headers had to be uniformized.
Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Nathan Gauer <nathan@gauer.org>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
With the main aim of making vtest's usage of virglrenderer more similar
to that of QEMU, this patch sets a backing store to each resource and
reads from or writes to at each transfer operation.
v2: - Instead of adding a callback on resource destruction, free the
iovec when we unref a resource as we know that we won't be doing
anything else with it. (Dave Airlie)
v3: - Store pointers to iovecs in the global to also release them
v4: - Add new commands for resource creation and transfers, to be used
when protocol version >= 1.
v5: - Replaced the global array of iovecs with a hash table because some
es31 tests create thousands of resources and reach any sane limit.
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit negotiates a common protocol version with the clients,
allowing for backwards compatibility on both sides.
v2: - Negotiate the version in a new command, so the client can probe
for its existence and stay compatible with older servers. (Dave
Airlie)
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
As we don't have yet a proper way of negotiating a common protocol
version to use between clients and the server, we introduce a command
without reply arguments that allows us to figure out if the server is
new enough to handle negotiation of the protocol version.
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Make sure the next renderer is a cleaned up one.
Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
This is usefull for running vtest under apitrace.
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
I've come up with a workaround on the mesa side that should be
backwards compatible with old vtests and vice-versa.
It involves sending both caps 2 and 1 queries back to back,
and taking the first response an indication of what to expect,
v1.1: Check max_size is > 0 before mallocing
Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
This is useful to do some quite accurate comparative
benchmarks/profiling, and to run fuzzers, such as american fuzzy lop.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Just as bad as waiting only for the last fence, after all.
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
For the same glmark2 "build" test, perf reports about half
instructions.
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>