Also add a test to check the integer underflow.
Closes: #251
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
v2: Also check that no depth != 1 has been send when none is due
Closes: #250
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Add a new command associated to glLinkProgram. With this we should be
able to compile and link shaders when requested by the user.
Together with the command we expect an array of shader handles attached
to the program, where each position of the array corresponds to a pipe
shader type.
Signed-off-by: Antonio Caggiano <antonio.caggiano@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
No visible API change.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Acked-by: Gert Wollny <gert.wollny@collabora.com>
PIPE_ARCH_*_ENDIAN is replaced by UTIL_ARCH_*_ENDIAN. We also differ
from Mesa in how arch and endianness are detected.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Acked-by: Gert Wollny <gert.wollny@collabora.com>
__lsan_default_suppressions is only defined if -fsanitize=address, but
leak suppression is still needed when the LeakSanitizer is used without
the AddressSanitizer (-fsanitize=fuzzer for example, since LeakSanitizer
is enabled by default on linux).
Signed-off-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: David Riley davidriley@chromium.org
v2: switch to C and atexit (suggested by Gert)
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org> (v1)
Reviewed-by: Ryan Neph <ryanneph@google.com> (v1)
It tests nothing on release builds because virgl_renderer_context_create
is not called and virgl_renderer_submit_cmd fails immediately.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-By: David Riley <davidriley@chromium.org>
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>
Autotools is deprecated since debb6e6ac4
It's now time to drop it definitively.
Signed-off-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Fix void* arithmetic and extra semicolon. -Wno-overlength-strings
is for large_frag in large_shader.h.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
"-fsanitize=address" which pulls in asan does not work with other
sanitizers like msan/tsan etc.
Based on original change by manojgupta@chromium.org.
Signed-off-by: David Riley <davidriley@chromium.org>
Reviewed-by: Lepton Wu <lepton@chromium.org>
Test whether submitting command 0x25 (CS shader execution) without
submitting a CS shader before is handled well.
Related #155
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
On big endian the byte ordering is reverse, and so should be the
uint32_t test value.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Tested-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Since vtest_server and the tests make use of private interfaces we must
mirror the autotoosl build that keeps the private interfaces in a static
library so that these functions can be called by the test code. The main
library that get installed then uses this static library and adds the
exported interface.
Closes#152
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Otherwise the underlying hardware might not be able to handle the tests.
v2: Split patch to remove chunk that changes the verbosity (Emil)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Related #139#141#142#143#144#146
v2: - fix autotools link order for the fuzzer tests
- use a local name for egl
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
This patch adds the meson build system as alternative to the
autotools build system.
v2: Thanks to Alexandros for his comments that lead to the following changes:
- Fix logic for platforms so that the ones selected by 'auto' don't
fail if the dependencies are missing, but fail when explicitely
requested
- declare project version differently
- set a minimun meson version
- clean up some braces
- reformat some code
- squesh remaining separate patches
v3: require meson 0.46 (Gurchetan)
v4: set minimum gbm version to 18.0.0
v5: - fix gbm version requirement (Gurchetan)
- don't duplicate glx files (Gurchetan)
Fixes: #129
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
These formats can be allocated by gbm implementations.
v2: fix test (not needed on i965, maybe on softpipe)
Reviewed-by: David Riley <davidriley@chromium.org>
Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
If nr_samples is 1 we allocate textures as MULTISAMPLE, so we also need to handle
the textures in later use as a multisample texture. In addition, on GLES blits to
a multisample texture are not allowed as target, and we must use the GL blit
fallback for all texture types.
v2: Correct more checks including the one in check_resource_valid (Gurchetan)
v3: Also update the tests to use only 0 for no samples and >= 1 for samples
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
The variables are already explicitly initialized.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
Transfer strides are either set internally or coming from
virgl_renderer_transfer_{write,read}_iov. As far as I can tell,
Mesa always passes sane values. We also expect sane values in
places like vrend_renderer_transfer_write_iov,
vrend_transfer_send_readpixels, and vrend_transfer_send_getteximage
already. Let's reject bad strides.
This fixes, for example, transfers to 1D array (thus box->height is
1) with non-default stride.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
sed -i "s/[[:space:]]*$//g" */*.[ch]
Note: there's a handful more in src/gallium, although that's left as-is
to minimise merge conflicts as we have to port things from Mesa.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
This commit improves bound checking by more accurately calculating
the expected transfer size. This improvement is achieved in two ways:
1. Using the image level (layer_)stride when the (layer_)stride is 0,
which matches the interpretation we use for performing the actual
read/write.
2. Calculating the transfer size by using the exact end offset in
the image, instead of using multiples of whole image rows.
The increased accuracy increases safety, and also allows us to support
some transfers with explicit strides that were previously rejected (see
added test).
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
There is no need to fail such transfers, in the same way we don't fail
when we are given a stride for targets without height, especially since
both stride and layer_stride have a valid (albeit possibly not very
useful) interpretation for all targets types.
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Initialize the transfer box fully (and properly), instead of relying on
virgl to ignore values not relevant to the target type.
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
There's no good reason to keep this code here; it's not like it saves us
a lot of logic, and it's unused apart from inside the glsl main.
This has the benefit of keeping struf a bit simpler; less mechanisms
needs to know about each other. Since I plan on adding more
functionality to strbuf, this will make things a lot easier.
Sadly, we don't have an easy way of doing unit-tests for the
vrend_shader internals. So for now I'm just dropping the tests here.
It's not ideal, I know, but yeah... Sorry? :P
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
This adds a string buffer implementation + unit tests with
the following features:
- growing reallocation on append
- variadic printf-like append function
- indenting
- error state tracking (stop appending on errors)
This will be used in the GLSL shader construction to clean up
the bad string length issues we have now.
The variadic append is based on one Erik Faye-Lund wrote.
v1.1: improve indenting
v1.2: fix includes + use memcpy
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
This adds a new api to set/get a private pointer.
v2: add private ptr test
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
For some reason it is not possible to create a normal EGL context when
a mesa software renderer is used as a backend, and hence the unit tests
will all fail. Make it possible to force a surfaceless EGL context by
specifying the environment variable
VRENDTEST_USE_EGL_SURFACELESS=1
Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
Use LLVM's libFuzzer to fuzz the virgl_renderer_submit_cmd API.
Signed-off-by: David Riley <davidriley@chromium.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
We now support version 2 of the virgl_renderer_callbacks struct, so
update the test to check for an unsupported version. Use
VIRGL_RENDERER_CALLBACKS_VERSION + 1 as the test version to ensure we
don't fail this test again when we update the struct in the future.
Fixes: test_virgl_init.virgl_init_cbs_wrong_ver
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
test_virgl_transfer.c: In function »virgl_test_transfer_1d«:
test_virgl_transfer.c:302:19: warning: comparison between signed
and unsigned integer expressions [-Wsign-
compare]
for (i = 0; i < sizeof(data); i++)
^
test_virgl_transfer.c:313:19: warning: comparison between signed
and unsigned integer expressions [-Wsign-
compare]
for (i = 0; i < sizeof(data); i++) {
v2: Correct language of warning messages
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
testvirgl_encode.c: In function »virgl_emit_shader_streamout«:
testvirgl_encode.c:219:21: warning: comparison between signed
and unsigned integer expressions [-Wsign-
compare]
for (i = 0; i < so_info->num_outputs; i++) {
^
testvirgl_encode.c: In function »virgl_encode_clear«:
testvirgl_encode.c:315:4: Warning: Dereferenzing a type-punned
pointer violates strict-aliasing-rules [-Wstrict-aliasing]
virgl_encoder_write_qword(ctx->cbuf, *(uint64_t *)&depth);
^~~~~~~~~~~~~~~~~~~~~~~~~
testvirgl_encode.c: In function »virgl_encoder_set_framebuffer_state«:
testvirgl_encode.c:329:18: warning: comparison between signed
and unsigned integer expressions [-Wsign-
compare]
for (i = 0; i < state->nr_cbufs; i++) {
^
testvirgl_encode.c: In function »virgl_encoder_create_vertex_elements«:
testvirgl_encode.c:362:18: warning: comparison between signed
and unsigned integer expressions [-Wsign-
compare]
for (i = 0; i < num_elements; i++) {
^
testvirgl_encode.c: In function »virgl_encoder_set_vertex_buffers«:
testvirgl_encode.c:377:18: warning: comparison between signed
and unsigned integer expressions [-Wsign-
compare]
for (i = 0; i < num_buffers; i++) {
^
testvirgl_encode.c: In function »virgl_encoder_inline_write«:
testvirgl_encode.c:531:26: warning: comparison between signed
and unsigned integer expressions [-Wsign-
compare]
for (layer = 0; layer < box->depth; layer++) {
^
testvirgl_encode.c:537:24: warning: comparison between signed
and unsigned integer expressions [-Wsign-
compare]
for (row = 0; row < box->height; row++) {
^
testvirgl_encode.c: In function »virgl_encoder_flush_frontbuffer«:
testvirgl_encode.c:566:59: Warning: unused parameter »ctx« [-Wunused-
parameter]
int virgl_encoder_flush_frontbuffer(struct virgl_context *ctx,
^~~
testvirgl_encode.c:567:59: Warning: unused parameter »res« [-Wunused-
parameter]
struct virgl_resource *res)
^~~
testvirgl_encode.c: In function »virgl_encode_set_sampler_views«:
testvirgl_encode.c:637:18: warning: comparison between signed
and unsigned integer expressions [-Wsign-
compare]
for (i = 0; i < num_views; i++) {
^
testvirgl_encode.c: In function »virgl_encode_bind_sampler_states«:
testvirgl_encode.c:654:18: warning: comparison between signed
and unsigned integer expressions [-Wsign-
compare]
for (i = 0; i < num_handles; i++)
^
testvirgl_encode.c: In function »virgl_encoder_set_so_targets«:
testvirgl_encode.c:872:18: warning: comparison between signed
and unsigned integer expressions [-Wsign-
compare]
for (i = 0; i < num_targets; i++) {
v2: - use mesa style UNUSED annotation of unused parameters
- correct language of warning messages
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>