For random stuff not in src/util.h
util_bitmask is too heavyweight for what I was looking for.
v2: Make macros return 0 or 1 (@davidriley)
v3: static inline macros (@gerddie)
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
We don't know whether the caller cleans up the error states they are
responsible for, so do this here. This is needed to correctly query
some features, because otherwise checks that rely on correct error
reporting might give the wrong result.
v2: Log stale error codes (Gurchetan)
Closes#148
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Using testing will need continued updates of the basic build scripts and
sometimes packages might even not be available, so lets switch to buster
and buster-backports.
v2: Fix include directory declaration
Closes: #147
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
When transfering from host use normal path. On sona performance jumps
from 46 mpixels/s to ~105 mpixels/s.
Signed-off-by: David Riley <davidriley@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Fix cases where trying to transfer from host directly after submitting
command buffer (eg when trying to run
dEQP-GLES2.functional.read_pixels.* or crosvm gpu_renderer::simple_clear
tests) would fail non-deterministically due to the mapping occuring
prior to the rendering completing by forcing a fence.
In particular Mali platforms are highly susceptible to synchronization
issues and also require setting the context prior to fencing.
Signed-off-by: David Riley <davidriley@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Add helper to complete GPU operations to allow synchronization prior to
CPU accesses like mapping buffers on platforms that require it (ie ARM
Mali).
Signed-off-by: David Riley <davidriley@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Gbm-resources can be used for data blobs. These are created with a
height of 1 and the required width, which can easily exceed the maximum
supported texture width.
Signed-off-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Get rid of now useless type casts too.
Fixes#121
v2: rebase to remove type casts that were newly introduced in master
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
In order to keep the changes limited and not go out of sync with Gallium
too much the old PIPE_FORMAT* are replaced with defines to their
VIRGL_FORMAT* counterparts and pipe_format becomes a typedef
of "enum virgl_formats".
v2: Add 'src' to includes in meson.build
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
This change makes sure that gbm functions are properly guarded by
ENABLE_GBM_ALLOCATION, to prevent build failures when the gbm headers
aren't included.
Signed-off-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Mesa emulates planar format sampling with per-plane samplers. With this
change, the guest can pass the plane index when creating a sampler view
from a virgl resource to create a per-plane sampler view. The index can
be passed in place of the texture layer, as that will always be 0 for
planar images.
Signed-off-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Lepton Wu <lepton@chromium.org>
`test -e` returns true so we need add quotes for shell
variables.
Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
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>
Meson warned "Consider using the builtin warning_level option instead of adding
warning flags by hand."
This fixes it.
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Lepton Wu <lepton@chromium.org>
This fixed "error: No valid LLVM Toolchains found!" when building docker image.
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Lepton Wu <lepton@chromium.org>
Fix plane handle deduplication logic so that each handle is only
exported as an fd once.
Signed-off-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Otherwise the underlying hardware might not be able to handle the tests.
v2: Split patch to remove chunk that changes the verbosity (Emil)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
With the format checks introduced earlier the double free bug reported
in #139 should no longer be possible. Nevertheless, add an assert to
ensure that this is checked.
Closes#139
v2: Update NDEBUG_UNUSED to MAYBE_UNUSED
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
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>
If the bind flags are not correct then the default code path would try to
create a texture with PIPE_BUFFER as target. Reorder the checks to bail out
in this case after freeing the memory.
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>
- break line of resource creation function declaration
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
While we are at it:
- free memory if texture allocation fails
Closes#144Closes#145Closes#146
v2: Move the error string creation to extra patch (Emil)
v3: Fix whitespace errors (Emil) and one logic error
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Related #139#141#142#143#144#146
v2: - fix autotools link order for the fuzzer tests
- use a local name for egl
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
The function is used from vrend_renderer.c, so it also should be
part of the libvrend.la conveniance library. This requires that the
CONTEXT enums and the variable egl are also part of this library.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
v2: Fix another missing return value warning
Fix a warning about braces around an empty statement
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
This is needed to check the resource creation parameters.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
For this introduce a NDEBUG_UNUSED macro
v2: Replace NDEBUG_UNUSED with MAYBE_UNUSED (Emil)
Silence unused warnings only if NDEBUG is defined
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
These values are unsigned, but the temporaries are always assumed to be in float
representation, and the temps values will be re-interpreted as integers when
needed. Hence above values must not be value-converted to float but the
bit-representation must be maintained when they are stored in a temp register.
Fixes#105
Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
- Host plane offset queried from the gbm_bo should not be accumulated
across plane transfer loop iterations.
- Host plane stride cannot be calculated from host plane0 stride in a
generic way, as alignment adjustments cannot be subsampled. Instead of
trying of trying to calculate the stride, just query the gbm_bo for
it.
Signed-off-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
This patch adds the meson build system as alternative to the
autotools build system.
v2: Thanks to Alexandros for his comments that lead to the following changes:
- Fix logic for platforms so that the ones selected by 'auto' don't
fail if the dependencies are missing, but fail when explicitely
requested
- declare project version differently
- set a minimun meson version
- clean up some braces
- reformat some code
- squesh remaining separate patches
v3: require meson 0.46 (Gurchetan)
v4: set minimum gbm version to 18.0.0
v5: - fix gbm version requirement (Gurchetan)
- don't duplicate glx files (Gurchetan)
Fixes: #129
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
In systems with more then one graphics card the rendernode is currently
picked based on the order in which they are listed in /dev/dri. Add an
command line option and a environment variable to make it possible to
specify the render node explicitely.
Fixes#135
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>