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>
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>
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>
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>
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>
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>
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>
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>
The checked fixture run in the child test process.
Fix leaks found thanks to AddressSanitizer.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>