summaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)AuthorFilesLines
2023-06-07tests: fix -Werror=maybe-uninitializedMarc-André Lureau1-1/+1
../tests/test_virgl_strbuf.c:180:23: error: 'sb.external_buffer' may be used uninitialized [-Werror=maybe-uninitialized] 180 | ck_assert_int_eq(sb.external_buffer, false); Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Part-of: <https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/1103>
2023-06-07tests: fix -Wpointer-to-int-castMarc-André Lureau1-1/+1
../tests/test_virgl_resource.c:302:20: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] 302 | ck_assert_int_eq((unsigned long)priv, 0xabab); Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Part-of: <https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/1103>
2023-06-02virgl: introduce virgl_renderer_resource_get_info_ext()Sergio Lopez1-0/+65
It's becoming commonplace that DRM drivers make use of 'modifiers' that alter the in-memory representation of a texture, which means that when importing a texture the same exact 'modifiers' must be specified along with the other usual parameters. Introduce a new structure, virgl_renderer_resource_info_ext, that extends upon the original virgl_renderer_resource_info with the 'planes' and 'modifiers' fields, and add a new function, virgl_renderer_resource_get_info_ext() that performs the same actions as virgl_renderer_resource_get_info() but using the new extended structure. Signed-off-by: Sergio Lopez <slp@redhat.com> Part-of: <https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/1024>
2023-02-13tests: fix win32 compilationMarc-André Lureau6-5/+32
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Part-of: <https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/1030>
2023-02-13tests: fix direct leak spotted by ASANMarc-André Lureau1-2/+5
Move the test to a new test suite without fixture, as it conflicts with the context created for the test. Direct leak of 16 byte(s) in 1 object(s) allocated from: #0 0x7f4d50cba097 in calloc (/lib64/libasan.so.8+0xba097) #1 0x4116cf in testvirgl_init_ctx_cmdbuf ../tests/testvirgl.c:157 #2 0x40ec0e in test_vrend_host_backed_memory_no_data_leak_fn ../tests/test_virgl_transfer.c:962 #3 0x7f4d513e1d42 in srunner_run_tagged (/lib64/libcheck.so.0+0x8d42) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Part-of: <https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/1030>
2022-12-16virgl: replace uint64_t queue_id with uint32_t ring_idxRyan Neph1-1/+1
Update the context fencing API to match virtio-gpu's multi-ring per-context fencing support. Virtio-GPU supports 64 fencing rings per context, but uint32_t is used to maintain compatability with other potential users that require more. Signed-off-by: Ryan Neph <ryanneph@google.com> Part-of: <https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/982>
2022-11-09remove venus fuzzerYiwei Zhang2-102/+0
The existing venus fuzzer is fuzzing against the venus cmd decoder which has been hidden behind render server in production. By enabling render server config in venus fuzzer, it then starts fuzzing against submit_cmd in proxy_context, which ends up fuzzing the standard socket part and is not quite meaningful since the socket part is not sensitive to what the cmd content is. This change just disables venus fuzzer since we have settled down with process isolation. Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org> Part-of: <https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/974>
2022-05-18virgl: pass uint64_t fence_id to write_context_fenceRyan Neph1-1/+1
Signed-off-by: Ryan Neph <ryanneph@google.com> Part-of: <https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/806>
2022-05-18fuzzer: mark unused parameters to silence compiler warningsRyan Neph1-3/+6
Signed-off-by: Ryan Neph <ryanneph@google.com> Part-of: <https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/806>
2022-05-02drm: Add fuzzer supportRob Clark2-0/+130
This can be run on hw other than what the drm native context supports using mesa's drm-shim. Ie. to fuzz the msm backend, you can LD_PRELOAD libfreedreno_noop_drm_shim.so from mesa built with freedreno enabled and -Dtools=drm-shim enable. Signed-off-by: Rob Clark <robdclark@chromium.org> Reviewed-by: Chia-I Wu <olvaffe@gmail.com> Part-of: <https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/795>
2022-04-12strbuf: Make it possible to create a fixed sized buffer from allocated memoryGert Wollny1-0/+18
In order to be able to use the strbuf functions also in cases where we want to create small buffers, like dest and source strings, it is better to write directly to the target string, so let's make it possible to use these pre-allocated buffers as strbuf. Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Part-of: <https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/766>
2022-04-04meson: fix builds with percetto tracingRyan Neph1-7/+32
For Percetto builds that don't install to a distributions standard location, percetto.h cannot be found while building tests or the render server. Pkgconfig provides the right -I / -L args if meson dependencies are explicitly provided. Signed-off-by: Ryan Neph <ryanneph@google.com> Reviewed-by: John Bates <jbates@chromium.org> Part-of: <https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/775>
2022-03-07vrend: Check GL errorsAkihiko Odaki1-1/+1
There are many combinations of invalid arguments for OpenGL functions and it is impractical to cover all of them. Even if nothing is wrong with the user, GL_CONTEXT_LOST and GL_OUT_OF_MEMORY can also occur in many GL functions due to hardware problems. They can leave the context in an invalid state which can result in a reliability or security issue. Check GL errors after an operation completes and prevent from using the GL context after a GL error occurred. spec@!opengl 1.5@draw-vertices, spec@!opengl 1.5@draw-vertices-user, and spec@!opengl 2.0@gl-2.0-vertexattribpointer are marked as crash in .gitlab-ci/expectations/host/piglit-virgl-gles-fails.txt because they require GL_DOUBLE specification for glVertexAttribPointer, which is not supported by OpenGL ES. Avoiding the crashes requires capability checks on the guest, which this change does not implement. Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> Part-of: <https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/715>
2021-12-14vrend: propperly check whether the shader image range is correctGert Wollny1-0/+14
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>
2021-12-14vrend: Add test to resource OOB write and fix itGert Wollny1-0/+43
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>
2021-12-14vrend: clear memory when allocating a host-backed memory resourceGert Wollny1-0/+51
Closes: #249 Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
2021-11-23shader: Link shader commandAntonio Caggiano3-0/+22
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>
2021-10-07mesa: update to the latest os_misc.hChia-I Wu2-2/+1
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>
2021-10-07mesa: update to the latest p_config.hChia-I Wu1-1/+1
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>
2021-07-14tests/fuzzer: fix eglInitialize() leak suppressionRyan Neph1-8/+0
__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
2021-07-08tests/fuzzer: add virgl_venus_fuzzerChia-I Wu2-0/+102
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)
2021-06-28tests/fuzzer: fix fuzzer for release buildsChia-I Wu1-8/+17
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>
2021-06-21vrend: align GBM format for BGR* resources to host API internal formatRyan Neph1-0/+1
Signed-off-by: Ryan Neph <ryanneph@google.com> Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
2021-02-11tests: add test_virgl_fenceChia-I Wu2-0/+312
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>
2021-02-11tests: respect VRENDTEST_USE_EGL_GLESChia-I Wu4-0/+8
When VRENDTEST_USE_EGL_GLES is set, use GLES. Signed-off-by: Chia-I Wu <olvaffe@gmail.com> Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
2020-09-03tests: add some init/cleanup/reset testsChia-I Wu1-0/+53
Signed-off-by: Chia-I Wu <olvaffe@gmail.com> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2020-09-03vrend: rename EGL/GBM sourcesChia-I Wu1-1/+1
Rename them to vrend_winsys_{egl,gbm}*. Signed-off-by: Chia-I Wu <olvaffe@gmail.com> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2020-06-02build: Drop autotoolsElie Tournier2-89/+0
Autotools is deprecated since debb6e6ac43 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>
2020-05-08tests: silence warningsChia-I Wu2-4/+4
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>
2020-02-07tests: Add test to check heap overflow with atomic buffer objectGert Wollny1-0/+249
Related #160 Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Reviewed-by: Lepton Wu <lepton@chromium.org>
2020-02-05Remove hardcoded "-fsanitize=address"David Riley2-3/+2
"-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>
2020-01-31tests/fuzzer: link against libvirglrendererGert Wollny1-1/+1
This fixes missing symbols when linking Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Reviewed-by: Lepton Wu <lepton@chromium.org>
2020-01-23test: Add fuzzer test to check illegal CS shader executionGert Wollny1-0/+37
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>
2020-01-23tests/fuzzer: Add test that triggers a double freeGert Wollny1-0/+23
Related #154 Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2020-01-17tests: Fix color value test for big/low endianGert Wollny1-5/+11
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>
2019-12-27meson: set visibility flag when compiler supports itGert Wollny2-3/+3
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>
2019-10-10tests: Add trigger for overflow in texture data uploadGert Wollny1-0/+41
Related #140 Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Acked-by: Emil Velikov <emil.velikov@collabora.com>
2019-10-10tests: Add test to trigger transfer IOV overflowGert Wollny1-0/+42
Related #138 Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Acked-by: Emil Velikov <emil.velikov@collabora.com>
2019-10-10tests: Make it possible to set the test verbosity from the environmentGert Wollny1-1/+1
Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2019-10-10tests: vrend_transfer put some limits on the texture sizesGert Wollny1-5/+19
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>
2019-10-10tests: Add numbers to the test comments to make it easier to locate failing ↵Gert Wollny1-73/+73
tests Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2019-10-10tests: Fix cubemap tests to take care that width == high for tests that ↵Gert Wollny1-10/+10
should pass Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2019-10-10tests: Add test that trigger the fuzzer bugsGert Wollny3-1/+619
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>
2019-09-26build: Add meson buildGert Wollny2-0/+105
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>
2019-08-07virgl/gbm: support more formatsGurchetan Singh1-1/+2
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>
2019-07-17vrend: Correctly handle FakeMSAA texturesGert Wollny2-15/+15
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>
2019-07-12tests: remove dummy initializationEmil Velikov1-2/+2
The variables are already explicitly initialized. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
2019-06-06vrend: reject bad strides in check_iov_boundsChia-I Wu1-39/+15
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>
2019-06-04virglrenderer: kill off trailing whitespaceEmil Velikov2-8/+8
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>
2019-06-03vrend: Improve iov bound checking for transfersAlexandros Frantzis3-1/+53
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>