When doing a blit in blit_int we use the same context that we use for drawing.
Now with qemu or crostini blits may be issued that are not issued by the guest
program so that it expects a GL_FRAMEBUFFER_SRGB state that might actually have
been clobbered.
Keep track of how GL_FRAMEBUFFER_SRGB is set when the framebuffer state is issued,
and restore its value after doing a blit via glBlitFramebuffer.
Thanks to Lepton Wu for tracking this down.
Fixes#126
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Lepton Wu <lepton@chromium.org>
When transferring to/from a planar buffer, multiply by bytes-per-pixel
when computing each plane's stride from stride0. In particular, this
is necessary when transferring to/from biplanar yuv buffers.
Signed-off-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
With old DRM implementations, drmPrimeHandleToFD always returned a fd
that could be mapped read/write. However, new kernels require the
DRM_RDWR flag to be specified to create read/write mappings.
Try passing the DRM_RDWR flag but fall back to the old way if that
fails.
Signed-off-by: David Stevens <stevensd@chromium.org>
Acked-By: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Running "make check" is quite slow if valgrind is enabled, and most of the time
failures is the result of a leak in the GL driver. Since when building packages
testing is enabled, this will make the package build fail when valgrind is
installed. So instead of automagically enabling valgrind when it is installed,
make it a configure option that also may fail if valgrind is not installed, but
requested.
v2: Use some lowercase variable to report enabled valgrind (Gurchetan)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Mesa has seen some fix for ARB_framebuffer_no_attachements that helps
softpipe, so update mesa and the results.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
The interpolation identifier must come after the precise and invariant
specifier. Also add a newline after these specifiers to make it easier
parsable.
Fixes #128
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Since not all varyings are passed from one shader stage to the next,
the invariant flag must be set based on the SID and not the number of
the IO slot used.
Fixes: 5f28eb8868
shader: fix mismatching shader invariants on GL
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
This looks like a typo, we should use view->target instead of
view->texture->target since we are handling the view.
This fixes these 12 tests:
dEQP-EGL.functional.image.create.gles2_cubemap_positive_x_rgb_texture
dEQP-EGL.functional.image.create.gles2_cubemap_positive_y_rgb_texture
dEQP-EGL.functional.image.create.gles2_cubemap_positive_z_rgb_texture
dEQP-EGL.functional.image.create.gles2_cubemap_negative_x_rgb_texture
dEQP-EGL.functional.image.create.gles2_cubemap_negative_y_rgb_texture
dEQP-EGL.functional.image.create.gles2_cubemap_negative_z_rgb_texture
dEQP-EGL.functional.image.render_multiple_contexts.gles2_cubemap_positive_x_rgb8_texture
dEQP-EGL.functional.image.render_multiple_contexts.gles2_cubemap_positive_y_rgb8_texture
dEQP-EGL.functional.image.render_multiple_contexts.gles2_cubemap_positive_z_rgb8_texture
dEQP-EGL.functional.image.render_multiple_contexts.gles2_cubemap_negative_x_rgb8_texture
dEQP-EGL.functional.image.render_multiple_contexts.gles2_cubemap_negative_y_rgb8_texture
dEQP-EGL.functional.image.render_multiple_contexts.gles2_cubemap_negative_z_rgb8_texture
Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
Also add ARB_clip_control to the supported extensions.
v2: Correct soname because of abi changes:
- since we now use the visibility('hidden') for internal functions
many functions are no longer exposed with the public interface
- some functions were added to the public interface
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org> (v1)
Maybe it's a bug in mesa, maybe I didn't search long enough, but when I
use the source texture directly in the blit then occationally we hit #112,
and no unbinding of the textures from the texture unit or the framebuffers
involved seems to help.
Using a texture view, however, seem to solve the problem.
Fixes#112
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Sometime the shader key "color_is_twosided" is not set, but the vertex
shader only emits a back color and the fragment shader expects a front
color. So if a back color is found set the "twoside" key to force the emission
of the declaration for both, the front and the back color.
Fixes the piglits:
vertex-program-two-side
Fixes#123
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Keep track of the per SID back and front color emission and emit the
counterparts accordingly.
Fixes some of the piglits:
vertex-program-two-side
Related #123
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
This should fix the following fuzzer failures.
SCARINESS: 10 (null-deref)
v2: Merge various checks (@davidriley)
Reviewed-by: David Riley <davidriley@chromium.org>
Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
This optimization is for some specific situation, but actually we
do see some android apps create 1x1 windows. So remove this optimization
now.
Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
"out_supported_structure_mask" is a bitmask representing the structures that
virglrenderer knows how to handle for a given "in_stype_version".
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
For memoryBarrier() which require ARB_shader_image_load_store
extension, we need to add it as required extension, otherwise will get
compile failure for current compute shader version setting.
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
When a local mesa version is build, we don't use a clean build tree and meson
might fail when reconfiguring. In that case try again with --wipe to get a clean
start.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
On OpenGL with GLSL < 4.30 the invariant input specifiers must match the
invariant output specifiers of the previous stage.
Fixes#75
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
In this case the paramters 'format' is not used in 'vrend_format_can_scanout'
and 'gr' are not used in 'vrend_allocate_using_gbm'.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Gallium sends the shaders in the order FS-[GS]-[TES]-[TCS]-VS. If an old
shader program is still bound when a new shader is send, then it would use the
old bounds shader of the previous stage to evaluate the shader key and code
creation might create an invalid shader. Hence, if the shader to be translated
is not yet bound ignore the previous stage when evaluating the shader key
(Gurchtan)
Fixes#114
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
It's desirable to query or modify virgl_renderer state for various values.
We've done it for resources (virgl_renderer_get_fd_for_texture /
virgl_renderer_get_fd_for_texture2 / virgl_renderer_resource_get_info) a
few times, but more parameters are often desired.
Let's define a protocol instead. That way, more queries/operations (is "ctx
{num} lost?", "is x host feature supported?") can be formulated.
It's also possible to put the protocol in virgl_hw.h, so in theory
the guest can recieve a response directly from virglrenderer. Any
opinions on this?
v2: virgl_renderer_query --> virgl_renderer_execute
Reviewed-by: David Riley <davidriley@chromium.org>
Signed-off-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>
Certain 2D allocations will take the GBM path if the option
is set.
Reviewed-by: David Riley <davidriley@chromium.org>
Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
We don't want to open the vgem or pvr drivers.
v2: return fd as-is as well (@davidriley)
v3: order of loops (@davidriley)
Reviewed-by: David Riley <davidriley@chromium.org>
Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
virgl_renderer_transfer_write_iov doesn't work for YUV buffers, since
it's based on glTexSubImage.
We assume the YUV image is not disjoint, since that's currently what
Mesa gbm supports.
For RGBA buffers, this will also eliminate a copy in the cases
where the gbm_bo_map(..) implementation doesn't use a shadow buffer
[i915, mediatek, rockchip].
Reviewed-by: David Riley <davidriley@chromium.org>
Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
These formats can be allocated by gbm implementations.
v2: fix test (not needed on i965, maybe on softpipe)
Reviewed-by: David Riley <davidriley@chromium.org>
Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
It's possible to EGL images from any dmabuf. Currently, gbm-based
dma-bufs are supported.
v2: 39 attributes --> 37 attributes (@davidriley)
Reviewed-by: David Riley <davidriley@chromium.org>
Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
Use case: allocate buffers from gbm, import into EGL, and pass to the
display to reduce copies.
Reviewed-by: David Riley <davidriley@chromium.org>
Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
It is possible to open rendernodes when using EGL_MESA_platform_surfaceless.
v2: fail if user-provided fd fails (@davidriley)
Reviewed-by: David Riley <davidriley@chromium.org>
Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
These extensions allow for multi-plane images and modifiers, and
are more widely supported than EGL_MESA_drm_image or EGL_MESA_image_dma_buf_export.
Reviewed-by: David Riley <davidriley@chromium.org>
Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
Just a cleanup -- no functional changes.
Reviewed-by: David Riley <davidriley@chromium.org>
Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
vrend_clear executes the Gallium clear command which is only called
when the whole viewport is cleared. So far mesa was doing excessive checks
on the scissors, thereby updating the scissors to framebuffer size when they
were disabled, and the according state changes were transmitted to the host.
With mesa/2037478 this was optimized away, so that not disabling the scissors
in the clear command manifested itself as a regression in a number of tests.
Keeping track of the scissor state in the hardware and disabling the scissors
before the clear is executes, and re-enabling them according to the last state
fixes this.
Closes#116
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
virglrenderer doesn't know with which parameters the external
image was created, so it doesn't make sense to emulate it.
This fixes Portal, HL2 etc. not going past the loading screen
in Crostini.
Reviewed-by: David Riley <davidriley@chromium.org>
Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
ARM platforms such as Mali might not support Mesa surfaceless platform
so fall back to using a default display.
Signed-off-by: David Riley <davidriley@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
ARM GL stacks might not support these extensions, and if buffers
are not being exported since they're being imported from externally
created buffers, then these are not necessary.
Signed-off-by: David Riley <davidriley@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
ARM platforms may only advertise GLES 2.0 configurations.
Signed-off-by: David Riley <davidriley@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Instead of setting the depth range values directly just mark the viewport
as dirty and update the state later together with the other viewport
properties. This fixes some issues with the depth clamp emulation and
geometry shaders.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
With thie new version we can enable the depth clamp emulation in the
guest.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
This is needed for emulating GL_ARB/EXT_DEPTH_CLAMP on GLES hosts that
don't support it.
Related #108
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
The value is only supported for GL >= 3.2 or GLES >= 3.0, on earlier versions
assume the minimum required number.
Closes#113
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>