An untyped resource is a virgl_resource without pipe_resource while
vrend_context works with pipe_resources exclusively. When an untyped
resource is attached, we defer the insersion into res_hash until
VIRGL_CCMD_PIPE_RESOURCE_SET_TYPE is submitted.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Acked-by: Gert Wollny <gert.wollny@collabora.com>
Acked-by: Gurchetan Singh <gurchetansingh@chromium.org> (protocol)
Capset ids belong to virgl_hw.h. Mesa uses magic numbers right now
and can be fixed with this change.
Capset ids are also leaked in virtio_gpu.h, for use with
virgl_renderer_get_cap_set by qemu. We should replace
virgl_renderer_get_cap_set by something that enumerates all capsets
to stop the leaking, but that is another story.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
In case GL_ARB_buffer_storage is available, use that.
If not, attempt to allocate a dma-buf and import it into GL.
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
VIRGL_BIND_SHARED allows external allocators to intercept resource
creation. Reserve the upper byte of bind flags to allow passing
allocator-specific flags, and define a set of such flags for minigbm.
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
These formats are supported and required by GLES3. Without these
formats, guest MESA uses uncompressed formats to emulate them
while formats like GL_R16 are not available on GPU like MALI.
Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
When there is no feat_dual_src_blend, avoid calling glBindFragDataLocationIndexed.
Otherwise epoxy could crash the whole process when this function is not available.
Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Since they are not immutable texture storage, that doesn't work.
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Lepton Wu <lepton@chromium.org>
Closes#143
v2: Actually check for the texture target type (Emil)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Closes#141Closes#142
v2 : drop colon in error description (Emil)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
This change makes a set of changes to increase the range of gbm-based
resources that can be allocated:
- Add VIRGL_BIND_LINEAR to support linear gbm allocations.
- Relax the bind flag argument check if VIRGL_BIND_SHARED or
VIRGL_BIND_LINEAR is set.
- For resources allocated from gbm, only try to create an image if one
of the render target or sampler view bind flags is set.
- Don't try to calculate the internal image format for external images.
This change also fixes a use-after-free that could occur if external
image creation failed.
Signed-off-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
It's good to tell the guest about these formats.
v2: move this check with the rest of the v2 caps
remove host version check bump (@kusma)
Reviewed-by: David Riley <davidriley@chromium.org>
Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
On GLES B8G8R8A8_SRGB is not available and B8G8R8A8_UNORM can not be
created as immutable. In order to have versions of these formats that
can be created immutable on GLES provide the formats R8G8B8A8_SRGB and
_UNORM with swizzling to BGRA that can then be used instead of the BGRA
formats. Since this may break things these swizzled versions will later
be only enabled when the guest requests them.
v2: Check the base swizzled BGRA format only on GL
v3: Correct type in method name (Gurchetan)
v4: Add PREFER_EMULATED_BRGA to according format binding flags (Gurchetan)
v5: Add comment about formats nou to be used in the guest (Gurchetan)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Allow external users to intercept resource creation based on
shared bind flag.
Signed-off-by: David Riley <davidriley@chromium.org>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
The origin change is already handled within Gallium, so it is only
necessary to deal with the Z range property.
v2: don't mark viewport as dirty when halfz is changed, this is already
handled by Gallium (Gurchetan)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
sed -i "s/[[:space:]]*$//g" */*.[ch]
Note: there's a handful more in src/gallium, although that's left as-is
to minimise merge conflicts as we have to port things from Mesa.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
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>
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>
Closes: #74
v2: * Enable enhanced layouts in the guest only when the host supports
it, because with indirect arrays enabled we re-emit the layout
the guest send.
* enable indirect arrays independently from the host capabilities
(following Eriks comments)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-By: Gurchetan Singh <gurchetansingh@chromium.org>
This is useful for knowing if we can expose
KHR_texture_compression_astc_sliced_3d in the guest.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
The piglits and KHR tests that use TF3 (i.e. multiple output
streams) tend to hang, and since the GLES host doesn't support
this but we lie about the GLSL version it is better to signal
the guest correctly that this is not supported.
v2: Set flag only on caps v2 code path, otherwise we might read
from uninitialized memory
v3: Increment feature check version to indicate that the TF3
feature flag is valid.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
This is useful to avoid unsupported format-conversions on GLES.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
This adds the support for ARB_indirect_parameters extension
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
The mesa state tracker can emulate this, but we should pass
it through properly to the host in case it has a more efficent path.
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
When I added indirect draw support, I forgot to add support
for the binding flag for command args, we need this later,
but in order to introduce support without breaking things,
we should fix the bug first and add a separate cap for it.
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
When we add new feature checks on the host side that is used to enable
a cap conditionally in the guest that was enabled unconditionally before
we might end up with a feature regression when a new mesa version is
used with an old virglrenderer version that doesn't check for that cap.
To work around this problem add a version id to the caps that corresponds
to the features that are actually checked on the host so that it can be
checked in the guest whether this cap was actually checked for or whether
it should be enabled unconditionally.
The id should be incremented whenever a new feature check is added that
might result in a feature regression in the guest when run on an old host.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Pohsien Wang <pwang@chromium.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
mesa optimizes away the information about input layouts for generics and
patches for TCS, TES, and GEOM shaders (all that pass these inputs as
arrays), but when input arrays are allowed, then these varyings may
actually have overlapping layouts (at least some piglits do, even though
they don't specifically require ARB_enhanced_layouts).
To be able to link shaders like these with enables arrays pass this info
to the next stage.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-By: Gurchetan Singh <gurchetansingh@chromium.org>
To avoid that the guest sends mixed color attachments when this is not
supported test this and add an according caps flag.
Related: #88 (a full fix needs a mesa side patch to make use of the
flag sent)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
This is a GLES only extension and the format is also only supported
on a GLES host.
Enables and passes on a host that supports it:
dEQP-GLES31.functional.texture.filtering.cube_array.formats.sr8*
dEQP-GLES31.functional.srgb_texture_decode.skip_decode.sr8.*
Closes: #49
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
GL_FRAMEBUFFER_SRGB is available on desktop GL and also when GLES exposes
the extension EXT_sRGB_write control. Add a feature to handle the use
of GL_FRAMEBUFFER_SRGB accordingly.
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
Include stdint.h in virgl_hw.h, since it uses uint32_t.
Remove now duplicate structure virgl_box in vtest_renderer.c
Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
For this to work to host will have to add "guestallow" to the
debug flags.
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
Add support for TGSI's HW atomic counters, implemented here with
atomic_uint.
v2: - Fix calculation of atomic count in cmd
v3: - Add feature-checks (Dave Airlie)
v4: - Pass max-values for all stages and combined (Erik)
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
This is usedful to accurately communicate the amount of SSBOs supported
to the guest-driver, so we can expose the right amount there.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
The enhanced layout extension allows for gaps in the streamout bindings
so we have to be able to handle no-handles in the middle of the target array.
TGSI also has to deal with components outputs where multiple outputs
can be mentioned in the TGSI. It's safe for use to just skip the
extra outputs at least for the tests I've been able to run.
Once we have those changes in place, the renderer can expose the
new CAP bit to the host without any further host extension checks.
Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
This way we can report the actual max texture, rather than a
conservative guess like we do now.
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
This adds the texture barrier support for the texture barriers,
a separate patch would be needed to implement the framebuffer fetch
barriers.
Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>