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>