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>
This requires adding new protocol to pass the width/height/layers/sample
default values from the host.
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Add a capability and some queries to expose compute shaders
to the host.
v2: expose more limits, check feature on launch grid
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
GL4.2/GLES3.1 adds glMemoryBarrier so make sure we can handle it.
v2: add a cap bit for this for guest
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
This adds support for tracking images, and binding them
to the GL context.
includes:
vrend_renderer: create texture when TBO is used as image
vrend_renderer: specify correct access to glBindImageTexture
v2:
vrend_renderer: invert glBindImageTexture layered logic
v3: fix decode macros (Gert pointed out for ssbo)
v4: add max image samples to the caps.
add image arrays.
use mask var outside loop (Gert)
change img_locs type to GLint and printf on fail (Gert)
Co-authors: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Mesa have these in it's virgl_hw.h copy, and the values needs to
stay in sync between mesa and virglrenderer here. So let's add this
definition here, where it can be defined only once.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
This way, mesa can know that the TGSI-parser groks the _PRECISE
modifier, and it doesn't need to cull them any more.
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>
This pulls the code out from the gles31 development,
and modifies the caps to support two different limits
(so far I've only found fs/cs vs everyone else limits differ)
v2: fix buffer creation paths, limit maximums, handle indirect
(don't pass -1 into gl funcs when we don't need to).
v3: free ssbo locs
v4: use two caps fields
Co-authors: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh at chromium.org>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
Three component formats are not very helpful, at least the Intel driver doesn't
expose them as color renderable, and other drivers most likely also just emulate
them using RGBX textur formats. RGB32* we have to keep though because it is needed
for ARB_rbo_rgb32 which in turn is needed for OpenGL 4.0.
To handle the latter, mesa/virgl will take care that RGB32* textures are only
allocated as buffers objects.
Reviewed-by: Gurchetan Singh <gurchetansingh at chromium.org>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
There's a few minor mistakes in the old license statement, for
instance:
- missing the year 2014 from the copyright
- "without limitation the" instead of "without limitation on the"
Apart from that it's just minor details like wrapping, and adding
"(including the next paragraph)". None of this seems to change
anything from a legal standpoint.
This matches the copyright-header we have for the same file in
Mesa, and makes it a bit less noisy to update the file there.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Acked-by: Dave Airlie <airlied@redhat.com>
This is required to implement glMinSampleShading().
Sadly, we've been setting has_sample_shading for a while, even
though this is needed. So we need to set a capability so mesa will
know that it's safe to emit this command.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>