For instance the GALLIUM_HUD requires this, also when the host doesn't
advertise support for input arrays.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Support the copy_transfer3d command, which transfers data to a host
resource by copying from another staging resource. This is used
by the guest to avoid waiting in case it needs to write to a busy
resource.
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Add protocol definitions for the copy_transfer3d command and also
for the associated virgl capability.
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Add an internal mechanism to support synchronized transfers. This will
be used in upcoming commits to perform synchronized resource maps if
the transfer type requires it.
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
VIRGL_BIND_STAGING is used for buffers that are backed only by guest iov
storage and are guaranteed to not be written to by the host, thus not
requiring additional synchronization. They will be used in upcoming
commits as staging buffers for copy transfers.
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Rename VREND_RESOURCE_STORAGE_IOVEC to
VREND_RESOURCE_STORAGE_GUEST_ELSE_SYSTEM and introduce
VREND_RESOURCE_STORAGE_GUEST. The former is used as storage for query
buffers, and the latter will be used in upcoming commits for staging
buffers.
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
On GLES the formats B10G10R10A2_UNORM and B10G10R10X2_UNORM are defined
like R10G10B10.2_UNORM on desktop GL, which is likely incorrect and
interferes with the readback. Using the blit workaround seems to work in
these cases, so disable diect readback in these cases.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
This buffer is 128 bytes big, not 64. This eliminates a warning on my
system.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
"dsts" already means "array of strings", so it's reasonable that "dst"
would mean "string", not "struct tgsi_full_dst_register". Let's rename
this, so we can stop pointlessly passing an array into this function and
still keep somewhat sane names for things.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
I want to use this name for something a bit more important later on. So
let's rename this to reflect it's special meaning instead. While we're
at it, narrow the scope of the variable a bit.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
We're about to do string-formatting anyway, we might just inline this
into the next one to avoid some needless memory copying.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
This avoids a lot of fixed-size arrays, which currently leads to
warnings that are hard to prove correct or incorrect. So let's rather be
safe than sorry, and dynamically allocate these instead.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
This helper completely replace the contents of a strbuf with its
content. This is useful when building temporary strings in the shader
source generation code, and it a bit semantically cleaner (and more
efficient) than appending to an empty buffer.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
We already have an oportunistic buffer to try with here, let's use that
instead of writing to the stack first.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.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>
These two members are written, but never read. Let's get rid of them.
This has the nice side-benefit of eliminating a warning, because of
an implicit cast.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Enable DS redaback depending on the availablility of the
corrosponding extensions.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
With 6a3cd2bd vrend: send list of readback-formats to guest
stricter format checks were introduced on GLES. This may lead to format
conversions in guest and host that can be avoided for additional
implementation specific readback formats. So when we build the format list
also check whether a bound texture format can also be read back from the
fbo and report the standard and additional formats also to the guest.
v2: Make things simpler and more correct (Erik) i.e.:
- default to false in the check for readback formats
- rename test function to indicate that we test color formats only
- don't pass the gl_version, instead use the epoxy functions
to get the platform info
v3: - check for DS readback support (Thanks to Erik for pointing out that this
is not available in unextended GLES)
- drop some superfluous braces (Erik)
v4: - move DS checks to separate commit (Erik)
v5: - split patch to move preparations that don't change
functionality to preceeding patches
- reduce the amount of error checking (Erik)
- only check readback for formats that can actually be used as
render targets
- remove some temporary variables (Erik)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Also limit the scope of some variables.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
The name for the internal texture properies flags VIRGL_BIND_NEED-SWIZZLE
and VIRGL_BIND_CAN_TEXTURE_STORAGE is misleading, and the latter flag was
even mis-using the binding member of the texture format structure.
Rename these flags to make it clear that these are not binding flags and
correctly use the 'flags' member for CAN_TEXTURE_STORAGE. In addition, drop
adding the NEED_SWIZZLE flag to the binding in the alpha texture emulation.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
To properly use compute shaders in the guest when running on a GL ES host
it is better to advertice GLSL level 430, because otherwise compute shaders
that don't explicitely add the extension ARB_compute_shaders to the shader
will not compile.
Fixes#99
v2: Add comment about why we want to advertise this feature level (Gurchetan)
v3: Don't bypass checks for level 400
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
PIPE_BIND_CUSTOM is used for query buffers and fences by the guest.
We can safely replace VREND_RESOURCE_STORAGE_SYSTEM by
VREND_RESOURCE_STORAGE_IOVEC.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
This allows a resource to use the guest pages as its storage when
the iovec is attached.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Check queries from within vrend_renderer_check_fences, after
glClientWaitSync but before write_fence. This makes sure query
results are available after the fence is waited for.
In other words, given this sequence of commands
BEGIN_QUERY > DRAW_VBO > END_QUERY > GET_QUERY_RESULT > FENCE
Waiting on the fence makes sure the query result becomes available
to the guest.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Handle these two command sequences,
VIRGL_CCMD_BEGIN_QUERY
VIRGL_CCMD_END_QUERY
VIRGL_CCMD_GET_QUERY_RESULT
VIRGL_CCMD_GET_QUERY_RESULT
or
VIRGL_CCMD_BEGIN_QUERY
VIRGL_CCMD_END_QUERY
VIRGL_CCMD_GET_QUERY_RESULT
(before the query result is available)
VIRGL_CCMD_BEGIN_QUERY
VIRGL_CCMD_END_QUERY
VIRGL_CCMD_GET_QUERY_RESULT
more carefully.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
This patch uses GL_EXT_framebuffer_fetch_non_coherent (preferred)
or GL_EXT_framebuffer_fetch to emulate the logiops in the fragement
shader. If neither of these extension are available then only
GL_COPY, GL_COPY_INVERTED, GL_CLEAR, and GL_SET are emulated.
Fixes piglit gl-1.0-logicop on GLES hosts.
v2: Use non_coherent access when possible
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
That helps the code checker to see whether all switch cases are used.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>