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>
Include stdint.h in virgl_hw.h, since it uses uint32_t.
Remove now duplicate structure virgl_box in vtest_renderer.c
Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
The buffer size is not an vector, and consequently we can't add a swizzle
operator. (This was probably the reason why the write mask was only emmited
when the it was larger then 1 before).
v2: Also handle 1D and Shadow1D textures (Dave)
Fixes: 70dedae465
shader: TXQ: also emit a write mask if only one bit is set.
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
The sub-context holds a pointer to the last shader program used and this
is de-referenced , e.g. in vrend_vbo_draw. However, the guest may destroy
the program without notifying the sub-context, and as a result the pointer
becomes stale and may ber used after free.
As a solution add a pointer to the owning context when a program is
referenced and if the program gets destroyed, clean the pointer in the sub-context.
Closes: #52
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
0x1 << 31 is undefined behavior based on C99 rules. (see ...)
Use unsigned syntax as an alternative to disable the warning.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
In the shaders the uniforms are allocated as arrays, and they are also
passed from the guest as arrays, so let's also upload them to the host
driver as arrays.
Performance improvement (both measurements used Gurchetan's mesa/virgl
patches to improve transfers):
Measurements on r600 (AMD 6870 HD)
Unigine Valley (1024x768, Q:High, AA:2x)
Unigine Heaven (1024x768, Q:High, Tess: Disabled, AA:2x)
Unigine Valley Unigine Heaven
without 20.2 26.1
with this patch 22.0 31.5
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
Also use memcpy to copy the constats. These two things might shave of some
cycles but the measureable performance benefit is marginal.
v2: Avoid the memcpy that ralloc does when increasing the size, the data
is overwritten anyway.
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
glReadPixels, glReadnPixelsKHR and glReadnPixelsARB use *width and *height.
Thos could be null.
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Elie Tournier <elie.tournier@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
The following leaks can be triggered by running this test series:
dEQP-GLES31.functional.tessellation_geometry_interaction.feedback.*
Direct leak of 56 byte(s) in 8 object(s) allocated from:
in __interceptor_strdup (/usr/lib64/gcc/x86_64-pc-linux-gnu/7.3.0/
libasan.so+0x761c8)
in emit_so_movs ../../../../virgl-gitlab/src/vrend_shader.c:1623
in iter_instruction ../../../../virgl-gitlab/src/vrend_shader.c:3873
in tgsi_iterate_shader ../../../../../../virgl-gitlab/src/gallium/
auxiliary/tgsi/tgsi_iterate.c:53
in vrend_convert_shader ../../../../virgl-gitlab/src/vrend_shader.c:
5131
...
Direct leak of 56 byte(s) in 7 object(s) allocated from:
in __interceptor_calloc (/usr/lib64/gcc/x86_64-pc-linux-gnu/7.3.0/libasan.so+0xdba68)
in vrend_convert_shader ../../../../virgl-gitlab/src/vrend_shader.c:5109
in vrend_shader_create ../../../../virgl-gitlab/src/vrend_renderer.c:2906
in vrend_shader_select ../../../../virgl-gitlab/src/vrend_renderer.c:2958
...
Closes: #55
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
It is nice to know why things go wrong.
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
Functionality of the extension is used to create the context.
Closes: #37
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
The define EGL_MESA_drm_image is always set by the required version of
libepoxy, and since the availability of the extension EGL_MESA_drm_image
is driver dependend the run-time test in virgl_egl_init is sufficient.
Thanks to Emil Velikov for giving me the heads up about this EGL extension
stuff.
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
The availability of this extension is already checked at run-time and the
requirement on the libepoxy version insures that the relevant prototypes
are available.
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
v2: remove biotcount check since it is always >0 (Dave)
Closes: #58
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Dave Airlie <airlied@redhat.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>
Add an 'all' flag to enable all logging (but don't include logging
initialted by the guest in this flag)
Logging can only enabled in debug builds and the logging parameters are
set by the environment variable VREND_DEBUG
Closes: #30
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
For this to work to host will have to add "guestallow" to the
debug flags.
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
Two flags are added: one to trace the features that are identified
as supported on the host, and another one that is then used to trace
the use of features. The latter one is only enabled after the
inititalization phase to avoid that the tests used for setting the caps
clobber the log.
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
Add flag blit and copy to add logging for the resource copy and blit path.
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
Add flags cmd and obj to allow logging of the commands send by the guest
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
Add flags tgsi,glsl,stream, and shader and change the corresponding
logging code.
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
No real flags are defined, only the macros and functions.
VREND_DEBUG(flag, ctx, ...) translates to fprintf(stderr, ...)
that is enabled based on whether logging is enabled for flag
in context ctx
VREND_DEBUG_EXT(flag, ctx, X) can be used to add code sequenses
as X, e.g. specific logging calls like for streams.
v2: Make use of variadic macros to make the VREND_DEBUG macro more
like a call to *printf (Following a suggestion by Gurchetan)
v3: Already include debug header in vrend_renderer.c
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
To avoid clobbering the log some feature test are moved so that they are
only done if the feature is really required.
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
This change makes it simpler to log features that are tested for
and used.
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
Define a CI run withing a specified docker image that uses pre-defined
versions of mesa, libdrm, and VK-GL_CTS.
The gitlab CI file .gitlab-ci.yml has been placed under ci/ in order to
avoid enabling the Ci automatically.
If the host provides a render device /dev/dri/render128D then forward
this device, use it as host device and run the dEQP GLES 2, 3, and 3.1
test suites as well as piglit by using vtest, a GL and a GLES
host context.
If this device is not available use the llvmpipe driver as host device
and run only dQEP GLES 2 with the GL and GLES host contexts.
The initial work for getting the CI running on normal hardware drivers
has been done by
Tomeu Vizoso <tomeu.vizoso@collabora.com> and
Jakob Bornecrantz <jakob@collabora.com>
Getting it to work with the llvmpipe host context was done by
Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
It is not necessary to emit both statements, and on a GLES 3.1 host that doesn't
support ARB_gpu_shader5 this actually breaks some shaders.
Fixes: 36c919e139
shader: rework precise-emitting for built-ins
Fixes on the softpipe host driver:
dEQP-GLES3.functional.shaders.qualification_order.variables.
valid.invariant_interp_storage
valid.invariant_interp_storage_precision
valid.invariant_storage
valid.invariant_storage_precision
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
A texture is non-multisample when the nr_samples == 0, for the value 1
fake multisampling is assumed and a GL_TEXTURE_2D_MULTISAMPLE should be
created.
Closes: #44
Fixes dEQP tests that pass on the host when run with softpipe:
dEQP-GLES31.functional.shaders.builtin_functions.texture_size.
samples_1_texture_2d
samples_1_texture_2d_array Pass -> Fail
samples_1_texture_int_2d Pass -> Fail
samples_1_texture_int_2d_array Pass -> Fail
samples_1_texture_uint_2d Pass -> Fail
samples_1_texture_uint_2d_array Pass -> Fail
dEQP-GLES31.functional.texture.multisample.samples_1.
sample_position
use_texture_color_2d
use_texture_color_2d_array
use_texture_depth_2d
use_texture_depth_2d_array
use_texture_int_2d
use_texture_int_2d_array
use_texture_uint_2d
use_texture_uint_2d_array
Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
We already use glBindFramebuffer, so let's prefer that one instead
of the dated EXT-version.
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
We already use GL_FRAMEBUFFER, which is modern OpenGL and have the
same value.
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Not all compressed formats can be uploaded using glTexImage2D, that
only works if the extension provides an online texture-compressor. For
instance, EXT_texture_compression_s3tc only requires an online
compressor in the desktop version.
This test isn't really a test for the presence of an online-compressor,
this code is meant to test if we can render from it. But calling
glCompressedTexImage2D requires us to provide a valid compressed
payload, which is really awkward to maintain.
So let's instead just check for extensions to decide if these formats
are renderable or not.
Also, none of these compressed formats can be rendered to, so there's
no point in even testing for that.
Combined with a commit in mesa that enables EXT_texture_compression_s3tc
on GLES 2.0, this makes these dEQP-tests go from NotSupported to Pass
on i965:
- dEQP-GLES2.functional.negative_api.texture.compressedtexsubimage2d_invalid_target
- dEQP-GLES2.functional.negative_api.texture.compressedtexsubimage2d_neg_level_cube
- dEQP-GLES2.functional.negative_api.texture.compressedtexsubimage2d_level_max_tex2d
- dEQP-GLES2.functional.negative_api.texture.compressedtexsubimage2d_level_max_cube
- dEQP-GLES2.functional.negative_api.texture.compressedtexsubimage2d_neg_offset
- dEQP-GLES2.functional.negative_api.texture.compressedtexsubimage2d_offset_allowed
- dEQP-GLES2.functional.negative_api.texture.compressedtexsubimage2d_neg_wdt_hgt
- dEQP-GLES2.functional.negative_api.texture.compressedtexsubimage2d_invalid_size
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Dave Airlie <airlied@redhat.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>
Some systems lack the helper, so ship a local copy of it.
Pulled from Mesa, just like many other parts of virgl.
Fixes: 6564d1395c ("virglrenderer: enable symbol visiblity.")
Review-by: Jakob Bornecrantz <jakob@collabora.com>
Reported-by: Elie Tournier <elie.tournier@collabora.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
On one hand it is simpler on GLES, because it allows direct readback, and
on the other hand it fixes failures when EXT_texture_buffer is not available.
Also unbind the buffers after use because otherwise glReadPixel would interpret the
pixel pointer argument as offset into the buffer and would fail.
Closes: #45
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Acked-by: Jakob Bornecrantz <jakob@collabora.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>