131 Commits
Author SHA1 Message Date
Chia-I Wu b620ab260d tests: add test_virgl_fence
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 <[email protected]>
Reviewed-by: Gert Wollny <[email protected]>
2021-02-11 08:59:05 -08:00
Chia-I Wu c995f69808 tests: respect VRENDTEST_USE_EGL_GLES
When VRENDTEST_USE_EGL_GLES is set, use GLES.

Signed-off-by: Chia-I Wu <[email protected]>
Reviewed-by: Gert Wollny <[email protected]>
2021-02-11 08:59:02 -08:00
Chia-I Wu 2dc844a4ca tests: add some init/cleanup/reset tests
Signed-off-by: Chia-I Wu <[email protected]>
Reviewed-by: Gurchetan Singh <[email protected]>
2020-09-03 14:15:06 -07:00
Chia-I Wu 3c4c0af218 vrend: rename EGL/GBM sources
Rename them to vrend_winsys_{egl,gbm}*.

Signed-off-by: Chia-I Wu <[email protected]>
Reviewed-by: Gurchetan Singh <[email protected]>
2020-09-03 14:14:30 -07:00
Elie Tournier 70019da650 build: Drop autotools
Autotools is deprecated since debb6e6ac4
It's now time to drop it definitively.

Signed-off-by: Elie Tournier <[email protected]>
Reviewed-by: Gert Wollny <[email protected]>
2020-06-02 18:58:02 +00:00
Chia-I Wu 82d05bfb10 tests: silence warnings
Fix void* arithmetic and extra semicolon.  -Wno-overlength-strings
is for large_frag in large_shader.h.

Signed-off-by: Chia-I Wu <[email protected]>
Reviewed-by: Elie Tournier <[email protected]>
Reviewed-by: Gert Wollny <[email protected]>
2020-05-08 13:12:50 -07:00
Gert Wollny 4df12ad51f tests: Add test to check heap overflow with atomic buffer object
Related #160

Signed-off-by: Gert Wollny <[email protected]>
Reviewed-by: Lepton Wu <[email protected]>
2020-02-07 08:06:51 +01:00
David Riley 10854be913 Remove hardcoded "-fsanitize=address"
"-fsanitize=address" which pulls in asan does not work with other
sanitizers like msan/tsan etc.

Based on original change by [email protected].

Signed-off-by: David Riley <[email protected]>
Reviewed-by: Lepton Wu <[email protected]>
2020-02-05 21:09:50 -08:00
Gert Wollny 0a97971cee tests/fuzzer: link against libvirglrenderer
This fixes missing symbols when linking

Signed-off-by: Gert Wollny <[email protected]>
Reviewed-by: Lepton Wu <[email protected]>
2020-01-31 12:16:09 +01:00
Gert Wollny 18638b4cdb test: Add fuzzer test to check illegal CS shader execution
Test whether submitting command 0x25  (CS shader execution) without
submitting a CS shader before is handled well.

Related #155

Signed-off-by: Gert Wollny <[email protected]>
Reviewed-by: Gurchetan Singh <[email protected]>
2020-01-23 09:03:29 +01:00
Gert Wollny 9f764c1ead tests/fuzzer: Add test that triggers a double free
Related #154

Signed-off-by: Gert Wollny <[email protected]>
Reviewed-by: Gurchetan Singh <[email protected]>
2020-01-23 09:03:29 +01:00
Gert Wollny 5b3ad5c515 tests: Fix color value test for big/low endian
On big endian the byte ordering is reverse, and so should be the
uint32_t test value.

Signed-off-by: Gert Wollny <[email protected]>
Tested-by: Christian Ehrhardt <[email protected]>
2020-01-17 13:39:01 +00:00
Gert Wollny 1e581b6b49 meson: set visibility flag when compiler supports it
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 <[email protected]>
Reviewed-by: Gurchetan Singh <[email protected]>
2019-12-27 10:00:56 +01:00
Gert Wollny 8c9cfb4e42 tests: Add trigger for overflow in texture data upload
Related #140

Signed-off-by: Gert Wollny <[email protected]>
Acked-by: Emil Velikov <[email protected]>
2019-10-10 18:13:27 +02:00
Gert Wollny 9c280a2865 tests: Add test to trigger transfer IOV overflow
Related #138

Signed-off-by: Gert Wollny <[email protected]>
Acked-by: Emil Velikov <[email protected]>
2019-10-10 18:13:27 +02:00
Gert Wollny da53f11312 tests: Make it possible to set the test verbosity from the environment
Signed-off-by: Gert Wollny <[email protected]>
Reviewed-by: Emil Velikov <[email protected]>
2019-10-10 18:13:27 +02:00
Gert Wollny e01683ef43 tests: vrend_transfer put some limits on the texture sizes
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 <[email protected]>
Reviewed-by: Emil Velikov <[email protected]>
2019-10-10 18:13:27 +02:00
Gert Wollny 57feaddb3e tests: Add numbers to the test comments to make it easier to locate failing tests
Signed-off-by: Gert Wollny <[email protected]>
Reviewed-by: Emil Velikov <[email protected]>
2019-10-10 18:13:27 +02:00
Gert Wollny 306262c484 tests: Fix cubemap tests to take care that width == high for tests that should pass
Signed-off-by: Gert Wollny <[email protected]>
Reviewed-by: Emil Velikov <[email protected]>
2019-10-10 18:13:27 +02:00
Gert Wollny d2cdbcf6a8 tests: Add test that trigger the fuzzer bugs
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 <[email protected]>
Acked-by: Emil Velikov <[email protected]>
2019-10-10 18:13:26 +02:00
Gert Wollny 17c2368f97 build: Add meson build
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 <[email protected]>
Tested-by: Gurchetan Singh <[email protected]>
Reviewed-by: Gurchetan Singh <[email protected]>
2019-09-26 11:16:08 +00:00
Gurchetan Singh 15ed4bc8e1 virgl/gbm: support more formats
These formats can be allocated by gbm implementations.

v2: fix test (not needed on i965, maybe on softpipe)

Reviewed-by: David Riley <[email protected]>
Signed-off-by: Gurchetan Singh <[email protected]>
2019-08-07 17:02:33 -07:00
Gert Wollny 7652864498 vrend: Correctly handle FakeMSAA textures
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 <[email protected]>
Reviewed-by: Gurchetan Singh <[email protected]>
2019-07-17 07:16:46 +02:00
Emil Velikov 4fdc38b260 tests: remove dummy initialization
The variables are already explicitly initialized.

Signed-off-by: Emil Velikov <[email protected]>
Reviewed-by: Elie Tournier <[email protected]>
2019-07-12 15:59:59 +02:00
Chia-I Wu ab3640c085 vrend: reject bad strides in check_iov_bounds
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 <[email protected]>
Reviewed-by: Alexandros Frantzis <[email protected]>
2019-06-06 09:21:21 -07:00
Emil Velikov d7787808c8 virglrenderer: kill off trailing whitespace
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 <[email protected]>
Reviewed-by: Chia-I Wu <[email protected]>
2019-06-04 19:09:51 +01:00
Alexandros Frantzis 0bb764b6cf vrend: Improve iov bound checking for transfers
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 <[email protected]>
Reviewed-by: Chia-I Wu <[email protected]>
2019-06-03 19:31:17 -07:00
Alexandros Frantzis 2af3a83136 vrend: Ignore transfer layer_stride for targets without layers
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 <[email protected]>
Reviewed-by: Chia-I Wu <[email protected]>
2019-06-03 19:31:11 -07:00
Alexandros Frantzis 9d719bcb3f tests: Improve tests for staging transfers
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 <[email protected]>
Reviewed-by: Chia-I Wu <[email protected]>
2019-06-03 19:31:05 -07:00
Alexandros Frantzis 92e4678479 tests: Add tests for staging transfers
Reviewed-by: Chia-I Wu <[email protected]>
Reviewed-by: Gurchetan Singh <[email protected]>
2019-05-23 20:59:45 +02:00
Erik Faye-Lund 46f68df55c shader: move indent-logic out of strbuf
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 <[email protected]>
Reviewed-By: Gert Wollny <[email protected]>
2019-05-16 11:55:42 +02:00
Dave Airlie e56000111e vrend: add new string buffer implementation (v1.2)
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 <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
2019-01-09 06:18:38 +10:00
Dave Airlie aa910dfa6a virglrenderer: add support for a private pointer in resources. (v2)
This adds a new api to set/get a private pointer.

v2: add private ptr test

Reviewed-By: Gert Wollny <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
2018-12-27 15:13:16 +10:00
Dave Airlie 6564d1395c virglrenderer: enable symbol visiblity.
We have to link the gallium la file into the test code

Reviewed-by: Jakob Bornecrantz <[email protected]>
2018-10-18 12:47:56 +10:00
Gert Wollny 5a472049a3 tests: Make it possible to run the unit tests with EGL_SURFACELESS
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 <[email protected]>
Signed-off-by: Gert Wollny <[email protected]>
Signed-off-by: Jakob Bornecrantz <[email protected]>
2018-10-09 16:01:34 +01:00
David Riley 87b346a1a3 fuzzer: Add a libFuzzer based fuzzer.
Use LLVM's libFuzzer to fuzz the virgl_renderer_submit_cmd API.

Signed-off-by: David Riley <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
2018-07-24 08:25:54 +10:00
Alexandros Frantzis 5057fb9b05 tests: Fix virgl_init_cbs_wrong_ver test
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 <[email protected]>
Reviewed-by: Elie Tournier <[email protected]>
2018-07-24 06:26:43 +10:00
Gert Wollny 4b8a839ebc test_virgl_transfer.c: Fix warnings
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 <[email protected]>
Signed-off-by: Gert Wollny <[email protected]>
Signed-off-by: Jakob Bornecrantz <[email protected]>
2018-06-08 13:51:59 +01:00
Gert Wollny c3a2058a8f testvirgl_encode.c: Fix warnings
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 <[email protected]>
Signed-off-by: Gert Wollny <[email protected]>
Signed-off-by: Jakob Bornecrantz <[email protected]>
2018-06-08 13:51:59 +01:00
Gert Wollny 5c8e9583fe testvirgl.c: Fix warnings
testvirgl.c: In function »testvirgl_write_fence«:
testvirgl.c:98:41: warning: unused parameter »cookie« [-Wunused-
parameter]
 static void testvirgl_write_fence(void *cookie, uint32_t fence)
                                         ^~~~~~
testvirgl.c: In function »get_caps«:
testvirgl.c:272:33: warning: Variable »glsl_level« not used
[-Wunused-variable]
     uint32_t max_ver, max_size, glsl_level;

v2: use mesa style UNUSED annotation for unused parameters

Reviewed-by: Gurchetan Singh <[email protected]>
Signed-off-by: Gert Wollny <[email protected]>
Signed-off-by: Jakob Bornecrantz <[email protected]>
2018-06-08 13:51:59 +01:00
Jakob Bornecrantz b03d30e6d1 tests: Use ge instead of eq when testing version and caps
This gets us passing at least for now. Some of these tests
should be upgraded to the new version instead.

Signed-off-by: Jakob Bornecrantz <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
2018-02-14 08:29:40 +10:00
Dave Airlie 3cd2caad2b tests: refactor caps getting code out.
This just makes getting caps be common code.

Signed-off-by: Dave Airlie <[email protected]>
2018-01-23 10:54:42 +10:00
Elie Tournier 8007cc0b12 tests: Check if multisample is available before running tests
Signed-off-by: Elie Tournier <[email protected]>
Signed-off-by: Jakob Bornecrantz <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
2018-01-23 10:54:42 +10:00
Elie Tournier a4fbf0d8a5 tests: Check if geometry shaders are available before running tests
Signed-off-by: Elie Tournier <[email protected]>
Signed-off-by: Jakob Bornecrantz <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
2018-01-23 10:54:42 +10:00
Dave Airlie 332b82e6e3 tests: make some functions static. 2016-02-10 14:41:25 +10:00
Marc-André Lureau e1eef9a7f9 tests: use checked fixture
The checked fixture run in the child test process.

Fix leaks found thanks to AddressSanitizer.

Signed-off-by: Marc-André Lureau <[email protected]>
2016-02-10 11:58:43 +10:00
Marc-André Lureau 83faf22c16 tests: reset last fence before using it
Signed-off-by: Marc-André Lureau <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
2015-12-22 09:11:38 +10:00
Dave Airlie c6da60278c tests: fix typo,
I forgot to git add.
2015-12-02 10:53:25 +10:00
Marc-André Lureau 8a3dcd4c7b tests: fix fourcc check (on intel at least)
- virgl maps VIRGL_FORMAT_B8G8R8X8_UNORM to GL_RGBA8

- _mesa_choose_tex_format() maps GL_RGBA8 to
  MESA_FORMAT_R8G8B8A8_UNORM or MESA_FORMAT_A8B8G8R8_UNORM or
  MESA_FORMAT_B8G8R8A8_UNORM.

- it ends up in (gl_texture_image *)img->TexFormat

- then in intel (_DRIImage *) image->format.

- on create image, image->dri_format = driGLFormatToImageFormat() (to
  ex: MESA_FORMAT_R8G8B8A8_UNORM -> __DRI_IMAGE_FORMAT_ABGR8888)

- on query, intel_lookup_fourcc() ->  __DRI_IMAGE_FOURCC_ABGR8888 == GBM_FORMAT_ABGR8888.

For some reason, driGLFormatToImageFormat() doesn't map
MESA_FORMAT_A8B8G8R8_UNORM, so I only check the two possible values I
could find.

Signed-off-by: Marc-André Lureau <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
2015-12-01 10:48:21 +10:00
Dave Airlie 85602b31bd renderer: fix regression in shader binding
made a mistake in the shader binding code, not good,
time for brown paper bag.
2015-10-23 14:35:46 +10:00