Fix not switching to corresponding context when deleting FBOs.
FBOs are not sharable between contexts.
Signed-off-by: Ka Ho Ng <khng300@gmail.com>
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
Some applications change glAlphaFunc nearly every frame.
Sam 3 apitrace replay went from ~4 fps to ~19 fps on a chromebook.
Signed-off-by: John Bates <jbates@chromium.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
If this is not set, every fork will have to rebuild the image.
This is not what we want for at least 2 reasons:
- forks are not running the CI in the same environment than the
upstream project
- this infers bandwidth costs as every fork has its own image
that needs to be pulled by every runner.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
When destroying any user context, vrend_destroy_context already
calls vrend_renderer_force_ctx_0. The manual switch to context 0 is
unnecessary.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
This allows us to get rid of dec_ctx array and VREND_MAX_CTX.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
It will be the base class for contexts of renderers.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Rename vrend_util.h to virgl_util.h. Add the header guard.
"vrend" is the prefix for the GL renderer code. "virgl" is the
prefix for common code.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
If we can't switch to the original context for the query objects,
don't check it.
Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
We convert GBM_BO_USE_TEXTURING to VIRGL_BIND_SAMPLER_VIEW at
Android side, so just convert VIRGL_BIND_SAMPLER_VIEW back to
GBM_BO_USE_TEXTURING, otherwise the allocation won't go
through gbm.
Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
This puts the project more in line with other projects at
freedesktop.org, and most importantly improves the caching of container
images.
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
This is currently only used with minigbm, and largely untested
elsewhere. This will also allow us to use flags which are not
available in Mesa GBM.
Reviewed-By: Gert Wollny <gert.wollny@collabora.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>
Per-plane sampler views don't require texture views, so move where that
check is performed when creating sampler views. Also, it's not
necessarily the case that a planar resource's egl image can be reused
for the first plane's sampler view, so just always create and use a
dedicated per-plane egl image.
Signed-off-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
GBM_BO_USE_TEXTURING is available in minigbm's gbm.h but not in
mesa's gbm.h. Texture usage is implied with usage 0 in mesa gbm.
Signed-off-by: Jason Macnak <jmacnak@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Always waits fences to make sure the fence objects will be destroyed.
Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
glSamplerParameter doesn't support GL_TEXTURE_LOD_BIAS on GLES.
Ignore it on GLES backends.
Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
When there is no feat_dual_src_blend, avoid calling glBindFragDataLocationIndexed.
Otherwise epoxy could crash the whole process when this function is not available.
Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
If the value indicating the number of ABOs is very large, the current
tests were not sufficient to insure out-of-range array access, because
the integer subtraction might overflow. Check the actual number of ABOs
too to avoid this.
Fixes#160
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Lepton Wu <lepton@chromium.org>