When there is no vulkan support compiled in and user ask for vulkan
support, the current code could fail and clean everything while still
returns success since the outside ret value is not initialized yet.
Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
There are many possible testure targets that can be bound as
framebuffer attachment, so it doesn't make sense to check assert
on this here.
Fixes: 4405172812
virgl: implement EXT_multisampled_render_to_texture
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
There is no valid reason for the guest to pass bad resource ids.
Because resource creation failures are not propagated back to the guest,
they are the most common reason for the guest to pass bad resource ids.
When that happens, failing earlier makes things easier to debug.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
It is an env var that vkr uses to set the debug flags. Currently, the
only flag is VKR_DEBUG_VALIDATE that enables the validation layer.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
This is a debug knob that, when set, will enable the validation layer.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
This looks like a copy-paste error. For desktop GL it is
disabled here, so on GLES this should probably be the same.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
clang-format insists on using .clang-format. This commit adds
docs/vkr-clang-format as a doc. To use it,
$ cd src
$ ln -sf ../docs/vkr-clang-format .clang-format
$ clang-format -style file -i vkr_*
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
This field was introduced 2 months ago and it breaks virgl
compatibility between guest/host. Switch the new added field
to the end. We will still have compatibility issue but the
"bug window" is much smaller.
Fixes: 7e7a4e7 ("vrend: Introudce VIRGL_CAP_V2_VIDEO_MEMORY to query video memory")
Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Add support for external memory fd properties query and import
- vkGetMemoryResourcePropertiesMESA
- VkImportMemoryResourceInfoMESA
- VkMemoryResourcePropertiesMESA
This is a huge commit because it also includes the change which splits
the headers by handle types.
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
GL_TEXTURE_MIN/MAG_FILTER expects an enum value, to be set with
glTexParameteri() (integer value) instead of glTexParameterf() (float
value).
Closes#212
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
A vrend_context structure contains a current vrend_sub_context, which
in turn keeps references on various resources like textures, VBOs,
index buffers, etc. which are used for actual drawing operations.
Certain actions can change the current sub-context in use.
There is a split of what resources are cleaned up directly as part of
a context destruction and which are handled by the sub-context
destruction. VBOs, while referenced by sub-contexts, are cleaned up by
the context. To do that, it uses the at the time of destruction
current sub-context to access these. As a result, only the VBOs in the
active sub-context are cleaned up; every other sub-context referenced
by the context will keep references to the VBOs used.
The responsibility of VBO dereferencing is moved to the destruction of
the sub-context, so all VBOs, not just the one from the current
sub-context, are dereferenced during the destruction of a context.
Closes#198
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Fix
[DEBUG:rutabaga_gfx/src/virgl_renderer.rs:104]
GL_IMPLEMENTATION_COLOR_READ_FORMAT is not expected native format 0x80e1 != imp 0x0
with crosvm introduced by commit d9aad06ba2 (vrend: Create frame
buffer object in do_readpixels). We can do the warning check only after
an fb with read buffer is bound.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Add VIRGL_RENDERER_VENUS and the related bits.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
In addition to virgl_renderer_submit_cmd, vkr_ring can also be used to
submit commands.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
On 64-bit builds, we can store uint64_t keys in pointers directly and
there is no need to malloc/free.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
util_hash_table_u64 is a wrapper to util_hash_table with uint64_t
keys. This is similar to hash_table_u64 in mesa.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
v2: - Add root build dir and src to include path (Gert)
- fix gallium includes (Gert)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Acked-by: Rohan Garg <rohan.garg@collabora.com>
This fixes regression in various astc format related dEQP tests.
Fixes: 51d4d37 ("formats:add astc 2d compressed format support")
Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
and init flag for preferring discrete GPU. Modify GBM selection to
prefer integrated GPU for display. Report "different GPU" back to
client to enable drawable shadowing. Allocate linear GBM buffers to make
them shareable between different devices.
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
When virglrenderer creates VIRGL_FORMAT_B8G8R8X8_UNORM texture, it
uses internal format GL_BGRA_EXT.
When Mesa imports dma_buf VIRGL_FORMAT_B8G8R8X8_UNORM/DRM|GBM_FORMAT_XRGB8888
it uses internal format GL_RGB8.
These formats are not copy compatible.
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
This was regressed by commit 3a2a537c (vrend: hook up per-context
fencing internally), bisected by Gert.
When there is no sync thread, vrend_renderer_check_fences checks fences
on vrend_state.fence_list for signaled ones and call ctx->fence_retire
on them. Because fences belonging to the same context are ordered, as
an optimization, we ideally want to call ctx->fence_retire only on the
last fence of those belonging to the same context. (Note we are close to
that but not quite because we want to avoid complex changes until virgl
starts using per-context fencing, if ever)
The issue is in need_fence_retire_signal_locked. It has this check
if (fence->fences.next == &vrend_state.fence_list)
return true;
which says that, if the fence is the last one in vrend_state.fence_list,
call ctx->fence_retire (because it must be the last fence of some
context). The check is incorrect because not all fences on the list
have signaled when the sync thread is not used. It will fail when there
are also unsignaled fences on the list.
To fix the issue, we contruct a list of signaled fences first before
calling need_fence_retire_signal_locked. We could merge the paths with
and without sync thread further because the non-sync-thread path just
needs this extra step to construct a list of signaled fences. But we
will save that for future and focus on fixing the performance
regression.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Make sure that the passed buffer size is not negative and that
evaluating the buffer size in bytes doesn't overflow. With that
we make sure that the buf_offset in the decoding loop can't wrap
around when it is updated.
v2: - move check to virgl_renderer_submit_cmd (Chia-I)
- remove the size conversion on both ends
v3: - keep conversion to size in bytes (Chia-I)
- explicitely convert to uint32_t to silence a warning
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>