Change to use eglWaitSyncKHR which is a server side fence and it
could be sightly better.
Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: David Riley <davidriley@chromium.org>
When switching context, if we want to use shared objects from previous
context, we need to insert glWaitSync to make sure the GL commands
are executed in sequences. This fixes 8 dEQP tests on mali:
dEQP-GLES2.functional.texture.mipmap.2d.generate.a8_fastest
dEQP-GLES2.functional.texture.mipmap.2d.generate.a8_nicest
dEQP-GLES2.functional.texture.mipmap.cube.generate.a8_fastest
dEQP-GLES2.functional.texture.mipmap.cube.generate.a8_nicest
dEQP-GLES2.functional.texture.specification.basic_copyteximage2d.2d_rgb
dEQP-GLES2.functional.texture.specification.basic_copyteximage2d.cube_rgb
dEQP-GLES2.functional.texture.specification.basic_copytexsubimage2d.2d_rgb
dEQP-GLES2.functional.texture.specification.basic_copytexsubimage2d.cube_rgb
Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
This was hard coded as zero before and can't be changed at runtime.
Change to use the "VREND_DEBUG" environment variable to control this
behavior.
Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Container objects like framebuffers are not shared between contexts
and we have to delete them in the original context. Otherwise we
could delete wrong objects which is in using by others.
Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
The structure is allocated outside this function and also deleted there
if texture creation failes or it is asserted that it doesn't fail
for intermediate blitting textures. Therefore, don't free the struct inside
this function when allocation fails.
Closes#154
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
When VIRGL_LOG_FILE gets set, put log into it. This is similar
with MESA_LOG_FILE. An improvement over MESA_LOG_FILE is that
it supports "%PID%" in file name and will replace it with pid
of the current process.
Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Some GPU drivers (like mali from arm) doesn't like anything other than
"#version" in the first line.
Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Since vtest_server and the tests make use of private interfaces we must
mirror the autotoosl build that keeps the private interfaces in a static
library so that these functions can be called by the test code. The main
library that get installed then uses this static library and adds the
exported interface.
Closes#152
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
The old code is buggy and set numlayers to 1 for GL_TEXTURE_2D_ARRAY
when creating the view. Just change to use array_size directly.
This fixes such tests in CtsNativeHardwareTestCases:
android.hardware.nativehardware.cts.AHardwareBufferNativeTests#MultipleLayers_ColorTest_MipmapComplete_GL_RGB10_A2
android.hardware.nativehardware.cts.AHardwareBufferNativeTests#MultipleLayers_ColorTest_MipmapComplete_GL_RGB8
android.hardware.nativehardware.cts.AHardwareBufferNativeTests#MultipleLayers_ColorTest_MipmapComplete_GL_RGBA16F
android.hardware.nativehardware.cts.AHardwareBufferNativeTests#MultipleLayers_ColorTest_MipmapComplete_GL_RGBA8
android.hardware.nativehardware.cts.AHardwareBufferNativeTests#MultipleLayers_ColorTest_MipmapComplete_GL_SRGB8_ALPHA8_sRGB
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Lepton Wu <lepton@chromium.org>
Also fix and document the versioning with meson.
Related #149
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Lepton Wu <lepton@chromium.org>
We only need a recent version of gbm when enable_gbm_allocation gets
set.
Close#134
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Lepton Wu <lepton@chromium.org>
Do the same thing we do with regular textures, and swap the R and B
color channels.
TEST=Portal, HL2 have better lighting in Crostini
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Fixes:
warning: ISO C forbids ‘return’ with expression, in function returning void
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
With the prior patch and without this one, I get
../src/.libs/libvrend.a(vrend_renderer.o): In function `vrend_format_can_scanout':
src/vrend_renderer.c:703: undefined reference to `gbm'
src/vrend_renderer.c:703: undefined reference to `gbm
src/vrend_renderer.c:706: undefined reference to `gbm'
../src/.libs/libvrend.a(vrend_renderer.o): In function `vrend_resource_gbm_init':
/virglrenderer/src/vrend_renderer.c:6337: undefined reference to `gbm'
/virglrenderer/src/vrend_renderer.c:6337: undefined reference to `gbm'
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
It's a bit misleading currently. For example, all resources have
guest memory associated with them, and resource can be both a GL
texture and GBM buffer at the same time. Use bits to more accurately
capture this.
No functional change.
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
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>
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>
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>
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>