Per-context fences signal in creation order only within a context. Two
per-context fences in two contexts might signal in any order.
When a per-context fence is created, a fence cookie can be specified.
The cookie will be passed to write_context_fence callback. This
replaces fence_id that is used in ctx0 fencing.
write_context_fence is called on each fence unless the fence has
VIRGL_RENDERER_FENCE_FLAG_MERGEABLE set. When the bit is set,
write_context_fence might be skipped.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Acked-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Other than hooking things up, vrend_renderer_check_fences and
vrend_renderer_export_ctx0_fence have some non-trivial changes. This is
because fence->ctx is no longer always vrend_state.ctx0. It can also
point to a user context or be NULL now.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Acked-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
A fence cookie (void *) is more flexible than a fence id to the users.
When per-context fencing is introduced, its API will use fence cookies.
Conversions between fence ids and fence cookies are some free casts.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Acked-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Replace the unused ctx_id by a vrend_context pointer. When a
vrend_context is destroyed, remove fences associated with the context to
avoid dangling pointers.
For now, the context is always ctx0 which is never destroyed before the
fences. That will change later when per-context fencing is introduced.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Acked-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Being an interface of virgl_context, this provides per-context fencing.
This is motivated by Vulkan, where each context (i.e., VkInstance) is
independent from one another. Fences submitted to difference contexts
do not signal in the order they are submitted. It is in theory and in
practice also true for OpenGL when SW/HW scheduling or context priority
is considered.
Besides being per-context, fences in Vulkan are also per-VkDevice and
per-VkQueue within a context. This interface uses an opaque uint64_t to
identify the queue a fence is submitted to, similar to how an opaque
uint64_t is used to identify a blob.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Acked-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
There are two calls of do_readpixels, and both of them creates a new
frame buffer object and destroys it immediately after that. This change
integrates those operations into do_readpixels.
One thing to note that glReadBuffer(GL_COLOR_ATTACHMENT0) has been
called after binding such a newly created frame buffer object and before
calling do_readpixels in vrend_transfer_send_readpixels. The call is
simply deleted because a new frame buffer object should have
GL_COLOR_ATTACHMENT0 as read buffer.
Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
vrend resource could cache a frame buffer object to read a texture
back. However, vrend resource is independent of OpenGL context
while a frame buffer object is not because it is a container
object. On QEMU, a frame buffer object is typically cached on each
renderer context while its destruction operation is performed on
"0 context", resulting in destroying another frame buffer object
whose name is identical but is created in "0 context".
This change simply removes the caching mechanism and eliminates the
need of a context switch when destroying a cached frame buffer
object and some handling of cache misses.
Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Allow for querying of detailed GPU memory information
through the GL_ATI_meminfo and GL_NVX_gpu_memory_info
extensions.
Signed-off-by: Rohan Garg <rohan.garg@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
192.168.0.* is often used in home networks, so avoid possible
interference by using a different network.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Rohan Garg <rohan.garg@collabora.com>
Otherwise the code will simply crash, we should give it a chance to
exit cleanly.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Rohan Garg <rohan.garg@collabora.com>
We wamt to be able to get some backtrace when things go wrong
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Rohan Garg <rohan.garg@collabora.com>
With that we can use more pre-packed stuff
v2: use --include for all but gdb, because the latter
doesn't install cleanly when pulled in like this
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Rohan Garg <rohan.garg@collabora.com>
As of mesa/perfetto-tracing 7db2faa354 tracing must be explicitly
enabled.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Rohan Garg <rohan.garg@collabora.com>
There is a regression in the latest epoxy that results in errors when
using an OpenGL context to run crosvm. Version 1.5.5 works correctly.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Rohan Garg <rohan.garg@collabora.com>
They were detected with clang-1200.0.32.29.
Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
This will allow for the virgl userspace driver to be able to respond
to PIPE_CAP_VIDEO_MEMORY requests.
Signed-off-by: Rohan Garg <rohan.garg@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Basic tests for fence create/poll/export. Note that export tests
require VRENDTEST_USE_EGL_GLES to be set.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
GL_TEXTURE_SWIZZLE_RGBA is not available on GLES
Fixes: 4ab4d4e ("vrend: pass texture swizzle as array")
Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Percetto is available at:
https://github.com/olvaffe/percetto
Signed-off-by: John Bates <jbates@chromium.org>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
As we transition to perfetto, there are more efficient ways
of adding metadata to traces that we can use when it is
needed.
Signed-off-by: John Bates <jbates@chromium.org>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
When c_args included "-Werror=pedantic" the test would otherwise fail.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
We requre version 330 when we create a compute shader on OpenGL, so we
should also report the cap only when we have this version.
Closes#200
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
We want a mesa version that can be build in Debian/buster, for that
we need to use an older version, and we need to build the dependecies
in order.
While touching it also update the libdrm version.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>.
popd overwrites $?, and since it always succeeds the CI was reporting
success even when piglit or deqp tests failed.
Fixes:8446009e7c889ad52d3d48b7fa82f8249edf3cf4
ci: Use ci-templates to create the container image
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>.
The packaged version is not new enough.
v2: Don't downgrade the libdrm version (Tomeu)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>.
This fixes a regression introduced by !462 which breaks some GLES3 and
GLES31 dEQP tests.
Fixes: 1b51495 ("vrend: replace if-chain by using switch/case")
Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
This reverts 374dd5bae8
Fix i965 crash with bin/gl-3.1-vao-broken-attrib
The crash with i965 can't be reproduced anymore, and the Gallium
drivers do the correct checks to not crash there, so it is
not necessary to do the extra checking.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Also change the interface of called functions to take sub_ctx
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Reviewed-by: Chia-I Wu <olvaffe@gmail.com>