This is now already checked before we decode the command.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
v2: drop decode state and use local variables to handle keeping
track of the decode buffer state (Chia-I Wo)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
With that we don't need to resolve the pointer chain in each decode
function.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Since each switch case only results is a function call we can also execute
the call directly by using a call table.
v2: Add VIRGL_CCMD_NOP and validate table when a context is
created (Chai-I Wu).
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
If GL_POINT_SPRITE mode is enabled and a texture has
GL_COORD_REPLACE enabled, the texture will apply coord_replace
to all primitive types, instead of only GL_POINTS as expected.
This change checks the prim_mode for every draw call and selects
the appropriate shader variant to enable coord_replace only when
rendering GL_POINTS primitives.
Closes: https://gitlab.freedesktop.org/virgl/virglrenderer/-/issues/188
Signed-off-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
We don't know what internal format the GL driver uses and we have to
glFinish and do a gbm transfer unless VREND_STORAGE_GL_IMMUTABLE is set.
This is motivated by Mesa's internal format change from GL_RGB to
GL_RGB8 for VIRGL_FORMAT_B8G8R8X8_UNORM in
5e4d69ec78.
That change caused glTexSubImage2D(..., GL_BGRA_EXT, GL_UNSIGNED_BYTE)
to be rejected by _mesa_gles_error_check_format_and_type.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
The bo contents may be undefined when only GBM_BO_TRANSFER_WRITE is set
(e.g., with radeonsi). When transferring to a subregion, we need to set
GBM_BO_TRANSFER_READ as well.
gbm_bo_map2 does allow us to map a subregion, but not all
implementations work correctly.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
We can now use gbm_bo_map(..) directly to match Mesa.
If minigbm doesn't define the needed use flags, we define it
internally.
This should allow us to build with minigbm allocation enabled and
use the Mesa gbm header.
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Fixes the order of params passed to emit_ios() calls
(swaps winsys_adjust_y_emitted and force_color_two_side).
Signed-off-by: Ryan Neph <ryanneph@google.com>
Reviewed-By: David Riley <davidriley@chromium.org>
EGL_ANDROID_native_fence_sync only works on gles profiles.
Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Author: Tomeu Vizoso <tomeu.vizoso@collabora.com> (v1)
v2: - Include perfetto_min.h only when perf tracing is enabled
- Make stubs inline code so it can be optimized away.
- Add compile with tracing info to configuration status
- Use static for stubs (Chia-I Wu)
- pass trace option as a string and add defines so that
other tracing tools cold be accomodated
(inspired by Chia-I Wu & Tomeu)
- Use macros to wrap the trace calls
v3: - Use __attribute__((cleanup)) to handle trace_begin/trace_end
instead of using macros to wrap the calls (Chia-I Wu)
- remove cpp from language support
v4: - Fix __attribute__ check in meson.build
- replace TRACE_FUNC macro to not take a paramter
- move trace initialization to a seperate function
(all suggestions by Chia-I Wu)
v5: use vsnprintf to avoid buffer overflow (John Bates)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com> (v4)
Add definition of GBM_FORMAT_ABGR16161616F when it's missed so
we can compile against mesa version before 20.0
Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
capset 1 has version 0 and 1, and they are the same. capset 2 has
version 0, 1, and 2, and they are also the same.
Note that Mesa always asks for version 0.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gert Wollny <gert.wollny@collabra.com>
0 is never an invalid capset id.
For an invalid capset id, we have to assume caps points to a buffer of
size 0 (what vrend_renderer_get_cap_set reports). We can't set
caps->max_version.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gert Wollny <gert.wollny@collabra.com>
So that it can be shared by different renderers (there is only vrend
right now).
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
vrend_free_fences should free fences on both fence_list and
fence_wait_list. vrend_renderer_fini should call vrend_free_fences.
Since vrend_free_sync_thread is always called before vrend_free_fences,
we can assert(!vrend_state.sync_thread) rather than do the locking.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
This extension is needed to get GL 4.4 in the guest when we
run on a GLES host.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Lepton Wu <lepton@chromium.org>
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>