Fix not switching to corresponding context when deleting FBOs.
FBOs are not sharable between contexts.
Signed-off-by: Ka Ho Ng <khng300@gmail.com>
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
Some applications change glAlphaFunc nearly every frame.
Sam 3 apitrace replay went from ~4 fps to ~19 fps on a chromebook.
Signed-off-by: John Bates <jbates@chromium.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
When destroying any user context, vrend_destroy_context already
calls vrend_renderer_force_ctx_0. The manual switch to context 0 is
unnecessary.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
This allows us to get rid of dec_ctx array and VREND_MAX_CTX.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
It will be the base class for contexts of renderers.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Rename vrend_util.h to virgl_util.h. Add the header guard.
"vrend" is the prefix for the GL renderer code. "virgl" is the
prefix for common code.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
If we can't switch to the original context for the query objects,
don't check it.
Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
We convert GBM_BO_USE_TEXTURING to VIRGL_BIND_SAMPLER_VIEW at
Android side, so just convert VIRGL_BIND_SAMPLER_VIEW back to
GBM_BO_USE_TEXTURING, otherwise the allocation won't go
through gbm.
Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
This is currently only used with minigbm, and largely untested
elsewhere. This will also allow us to use flags which are not
available in Mesa GBM.
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
Per-plane sampler views don't require texture views, so move where that
check is performed when creating sampler views. Also, it's not
necessarily the case that a planar resource's egl image can be reused
for the first plane's sampler view, so just always create and use a
dedicated per-plane egl image.
Signed-off-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
GBM_BO_USE_TEXTURING is available in minigbm's gbm.h but not in
mesa's gbm.h. Texture usage is implied with usage 0 in mesa gbm.
Signed-off-by: Jason Macnak <jmacnak@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Always waits fences to make sure the fence objects will be destroyed.
Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
glSamplerParameter doesn't support GL_TEXTURE_LOD_BIAS on GLES.
Ignore it on GLES backends.
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>
If the value indicating the number of ABOs is very large, the current
tests were not sufficient to insure out-of-range array access, because
the integer subtraction might overflow. Check the actual number of ABOs
too to avoid this.
Fixes#160
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Lepton Wu <lepton@chromium.org>
One bug was found when running dEQP-GLES3.functional.fragment_out.random.*.
If run them one by one, they pass. If run them all together, some cases fails.
The fix is: when independent_blend_enable changes from true to false, we should call
glColorMask, otherwise color masks for some color buffers could stay in
stale states.
Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
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>