Refactor vrend_shader.c by exposing modified dump_ctx members
as pointer args and making dump_ctx a const pointer.
Signed-off-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Refactor vrend_shader.c by reducing the number of dump_ctx members
that are modified in function calls that take dump_ctx as an argument.
Signed-off-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Refactor vrend_shader.c by reducing the number of dump_ctx members
that are modified in function calls that take dump_ctx as an argument.
Signed-off-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Refactor vrend_shader.c by reducing the number of dump_ctx members
that are modified in function calls that take dump_ctx as an argument.
Signed-off-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Refactor vrend_shader.c by reducing the number of dump_ctx members
that are modified in function calls that take dump_ctx as an argument.
Signed-off-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Refactor vrend_shader.c by packing variables related to generic inputs/outputs into
struct vrend_patch_ios.
Signed-off-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Refactor vrend_shader.c by packing variables related to generic inputs/outputs into
struct vrend_generic_ios.
Signed-off-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Refactor vrend_shader.c by packing glsl_main, glsl_hdr, glsl_ver_ext,
and indent_level into struct vrend_glsl_strbufs. Makes the parameter
lists of many functions more informative (as opposed to taking
only dump_ctx).
Signed-off-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
This change is being done in preparation for exporting fences, so the
fences are built on EGL_ANDROID_native_fence_sync instead of on
EGL_KHR_fence_sync.
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
In the past, we only transfer texture data in "zero" context, changing
the texture binding was fine. Now the transfer could happen in the rendering
context, so we need to recover the bindings.
This fixes unitTest_WritePixelsNonTexture_Gpu in SkQP.
Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
When running some traces, we see the following on AMD.
file:dmabuf fault:ttm_bo_vm_fault mmap:dma_buf_mmap_internal readpage:0x0
Disable for now.
Reviewed-By: David Riley <davidriley@chromium.org>
When reading back a BGRA surface the client expects the data in BGRA
order, and when we emulate the format by using a swizzled BGRA on GLES
we still have to use the original format information to read back the
data.
However, this results in mesa internally swizzling the RGBA data to BGRA
ordering on the CPU. This performance hit can be avoided for
applications that only blit or render to BGRA surfaces, because here we
can set the bgraswz tweak that does the szizzling on the GPU when
drawing or blitting to a BGRA surface and then we can read the data back
as is.
With that for vtest the bgraswz tweak becomes purley a performance
tweak. Replaying a trace of The Raven Remastered showed a 1% increase
of performance when enabling the bgraswz tweak.
Closes#174
v2: Fix typo (Gurchetan)
v3: fix more typos (Gurchetan)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
When we run into an error in virgl_renderer_init, simply call
virgl_renderer_cleanup.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Track whether the tables have been initialized, and avoid double
init/cleanup.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
The resource table should not be tied to vrend.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Add vrend_renderer_prepare_reset, and move context/resource table
cleanups, to the beginning of the fini/reset functions.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
We want a centralized place to initialize different subsystems (vrend,
winsys, resource/context tables). This is the first step.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
I am not sure what the check in vrend_renderer_init was previously for.
This gives it some sense.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
We mainly want to get rid of HAVE_EPOXY_EGL_H. But technically, it
is possible to import an EGLImage without EGL support.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
They are wrappers for virgl_egl_get_fd_for_texture*.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
It is a wrapper for virgl_egl_get_fourcc_for_texture.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Move and rename it to vrend_winsys_has_gl_colorspace.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Move winsys-related includes and globals to the new files.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
If host support dual_src_blend extension, it's possible we need
to call glBindFragDataLocationIndexed to set fragment output location.
We can't explicitly set it in GLSL in such cases.
Fixes: b17ba74 ("shader: Add layout qualifier to fragment shader outputs")
Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: David Riley <davidriley@chromium.org>
Most function parameters in virglrenderer.h are opaque to the callers
(i.e., VMMs). Their definitions can be found in virglrenderer_hw.h.
In this commit, virglrenderer_hw.h simply includes virgl_hw.h.
virgl_hw.h is considered legacy however. New definitions that are not
virgl-specific will go into virglrenderer_hw.h.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Currently, even the input/output buffers are integer formats, we still
use float type for them. This is actually undefined behavior and MALI
GPU will do type conversion and cause unexpected results. To fix this,
we check the input buffer format for vertex shader and also color buffer
format for fragment shader, if they are integer types, just use integer
types in generated shaders. Since the old way works fine on other GPU,
only enable this fix for ARM MALI for now. The plan is to enable this
for other GPU also with auto detection.
Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>