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>
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 <jakob.bornecrantz@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.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>
- 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 <marcandre.lureau@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
the protocol failed to handle larger shaders, this allow
the renderer to reassemble large shaders and recombined
the chunks before passing them to the GLSL translation.
This also enhances the renderer protocol to allow
for some more info in the shader object, and removes
the separate vs/gs/fs variants in favour of a type field
in the shader.
This fixes a number of issues with how transform feedback works
it does requires ARB_transform_feedback3 to work at all, but
hopefully this extension is widespread enough, if not we can
revisit later.
It uses transform feedback objects to store the stream out
state.