VREND_DEBUG_ENABLED represents if debugging features are enabled and is
controlled by NDEBUG macro. By using VREND_DEBUG_ENABLED in
an if statement instead of using NDEBUG in ifdef, the compiler can
validate the content of the conditional and know its variable usage to
avoid meaningless warnings.
Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
v2: Check function availability
v3: Isolate function availability check to a variable (Gert Wollny)
v4: Use util_format_name and add a utility function (Gert Wollny)
v5: Move variables to narrower scopes (Gert Wollny)
Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
GL_IMPLEMENTATION_COLOR_READ_TYPE and
GL_IMPLEMENTATION_COLOR_READ_FORMAT works only if a texture is
attached as a color buffer.
Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
The compressed formats are incompatible with
GL_TEXTURE_RECTANGLE on Mesa 21.3.6.
This also fixes spec@!opengl 1.0@gl-1.0-dlist-bitmap, which makes
the guest to have GL_TEXTURE_RECTANGLE but TGSI specifies
TGSI_TEXTURE_2D, on OpenGL ES by always looking at the target of
given texture.
v2: Use the result of compatibility check in shader transformation.
(Gert Wollny)
Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
v2:
* Fix type of bit mask (Gert Wollny)
* Make the calculation of VREND_SHADER_SAMPLER_VIEWS_MASK_LENGTH
simpler (Gert Wollny)
Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
This is the changes automatically generated from the venus-protocol
repository.
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Signed-off-by: Igor Torrente <igor.torrente@collabora.com>
Currently the read_from_host code path is not implemented
for this configuration.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Corentin Noël <corentin.noel@collabora.com>
This also fixes size parameter of glMapBufferRange in
vrend_draw_bind_vertex_legacy.
Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
A vertex attribute array can affect the selection of the program.
Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
With that we can enable PIPE_CAP_TGSI_TEXCOORD in the guest
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Corentin Noël <corentin.noel@collabora.com>
With the NTT code path in the guest we might end up with
the generic array outputs also with GS and TES.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Corentin Noël <corentin.noel@collabora.com>
Make sure that the condition for which we are emitting the uniform
corresponds to the one in the iter_declaration function.
Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Allows virglrenderer-venus to passthrough the VK_EXT_4444_formats
extension to the venus client.
Signed-off-by: Igor Torrente <igor.torrente@collabora.com>
When we first convert a tgsi shader into TGSL, we fill the shader key
with a value of `(gs|tcs|tes)_present` based on the currently bound
shaders. But since a shader is always going to be bound if it's being
used, we should already assume that it is going to be present in the
shader key, saving a recompilation.
Signed-off-by: Italo Nicola <italonicola@collabora.com>
Reviewed-by: Corentin Noël <corentin.noel@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
It is not valid to link a program that has a TCS but no TES, therefore
we shouldn't attempt to pre-link this combination of shaders.
Signed-off-by: Italo Nicola <italonicola@collabora.com>
Reviewed-by: Corentin Noël <corentin.noel@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Currently, we always use the `tfout` variables when writing TF output
for geometry shaders, but only declare them under specific conditions,
causing GLSL errors in tests like ``
Fixes: 9157dcbca0
Signed-off-by: Italo Nicola <italonicola@collabora.com>
Reviewed-by: Corentin Noël <corentin.noel@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
It's better done in proxy than in vkr.
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
This is required for support of untyped resources on virtio
devices which create their own egl context.
Currently untyped resources support is reported to mesa only in case
virglrenderer creates it's own egl context from scratch. The problem
that this context is not "sharable" with device context and if it's
created vrend uses it instead of context callbacks implemented by device.
Thus such approach is not suitable for devices with it's own egl context.
The only thing that is required for untyped resources support is
initialized eglDisplay handle that is requried for eglCreateImageKHR,
thus add callback for device to share it.
Untyped resources feature support is required for sharing vkr resources
with vrend.
Signed-off-by: Oleksandr.Gabrylchuk <Oleksandr.Gabrylchuk@opensynergy.com>
Signed-off-by: Andrii Pauk <Andrii.Pauk@opensynergy.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
This is mostly a naming change, along with more docs
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
The ring cmd can come earlier than render server receiving the shmem
after removing redundant guest side roundtrips.
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
server needs to persist the resource and attach to workaround a guest
kernel out-of-order map and attach cmds.
proxy needs to track and de-dup the attach request for the attached
resources.
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
The same res_id is also used for later resource attach of the same.
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
It will be used by the proxy context.
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
This is dedicated heap memory allocations approach.
This type of blob should be used in the following way:
1) Guest virtio-gpu driver on start checks for dedicated memory region.
2) On create_blob drm ioctl guest driver reserves chunk of required memory and
send it to host using sg list. Heap is managed on guest.
3) Device creates dmabuf fd from this sg entry and sends it to virglrenderer on
create_blob virtio-gpu command. Blob is created using
virgl_renderer_resource_import_blob call.
4) On next vkAllocateMemory call from mesa, virglrenderer will allocate vk memory
handle from this dmabuf fd. It will receive resource id in
VK_STRUCTURE_TYPE_IMPORT_MEMORY_RESOURCE_INFO_MESA vkAllocateMemory structure.
The flow is opposite to the way it's done for HOST_3D types of blob, where
vkAllocateMemory is called first, vk memory is allocated from random host place.
Then create_blob is called, where dmabuf fd is exported from VkDeviceMemory.
Signed-off-by: Andrii Pauk <Andrii.Pauk@opensynergy.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Improves the error handling code that deals with resource
deallocation.
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Signed-off-by: Igor Torrente <igor.torrente@collabora.com>
This only updates venus-protocol. There is no visible functional
difference.
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
vkr_extension_table allows us to fine-control which extensions are
advertised.
To support an extension, we need venus-protocol support and vkr support.
One is generated and one is open-coded. We don't want to advertise an
extension automatically whenever an updated venus-protocol includes it.
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
It is to avoid integer overflows and to catch bogus allocations (e.g.,
the guest driver encodes an uninitialized value).
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Using a pointer for fs_info in the shader key is not really that useful
because the contents of the structure can change even though the pointer
remains the same, and the pointer can be different when the contents are
the same.
Fixes 5f488ed00d
Signed-off-by: Italo Nicola <italonicola@collabora.com>
Tested-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
With GLES we always set the correct binding if dual source blend
is disabled, with OpenGL we still have to do this to handle outputs
that might be optimized away.
v2: Fix comment (Yiwei Zhang)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>