virgl: Disable nir_op_ffloor to avoid sending DFLR to virglrenderer.

This means that we send ffract+fsub in place of a normal FLR, but
hopefully virglrenderer can be fixed (or doubles support removed).

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15825>
This commit is contained in:
Emma Anholt 2022-03-28 16:48:31 -07:00 committed by Marge Bot
parent a652c1653a
commit b18374002e
4 changed files with 26 additions and 3 deletions

View File

@ -23,7 +23,7 @@ test(
executable(
'virgl_staging_mgr_test',
files('virgl_staging_mgr_test.cpp'),
dependencies : [dep_thread, idep_gtest, idep_mesautil],
dependencies : [dep_thread, idep_gtest, idep_mesautil, idep_nir_headers],
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_virtio, include_directories('..')],
link_with : [libvirgl, libgallium],
),

View File

@ -1011,6 +1011,16 @@ fixup_renderer(union virgl_caps *caps)
memcpy(caps->v2.renderer, renderer, renderer_len + 1);
}
static const void *
virgl_get_compiler_options(struct pipe_screen *pscreen,
enum pipe_shader_ir ir,
unsigned shader)
{
struct virgl_screen *vscreen = virgl_screen(pscreen);
return &vscreen->compiler_options;
}
struct pipe_screen *
virgl_create_screen(struct virgl_winsys *vws, const struct pipe_screen_config *config)
{
@ -1051,7 +1061,7 @@ virgl_create_screen(struct virgl_winsys *vws, const struct pipe_screen_config *c
screen->base.get_shader_param = virgl_get_shader_param;
screen->base.get_compute_param = virgl_get_compute_param;
screen->base.get_paramf = virgl_get_paramf;
screen->base.get_compiler_options = nir_to_tgsi_get_compiler_options;
screen->base.get_compiler_options = virgl_get_compiler_options;
screen->base.is_format_supported = virgl_is_format_supported;
screen->base.destroy = virgl_destroy_screen;
screen->base.context_create = virgl_context_create;
@ -1078,6 +1088,16 @@ virgl_create_screen(struct virgl_winsys *vws, const struct pipe_screen_config *c
screen->tweak_gles_emulate_bgra &= !virgl_format_check_bitmask(PIPE_FORMAT_B8G8R8A8_SRGB, caps->v1.render.bitmask, false);
screen->refcnt = 1;
/* Set up the NIR shader compiler options now that we've figured out the caps. */
screen->compiler_options = *(nir_shader_compiler_options *)
nir_to_tgsi_get_compiler_options(&screen->base, PIPE_SHADER_IR_NIR, PIPE_SHADER_FRAGMENT);
if (virgl_get_param(&screen->base, PIPE_CAP_DOUBLES)) {
/* virglrenderer is missing DFLR support, so avoid turning 64-bit
* ffract+fsub back into ffloor.
*/
screen->compiler_options.lower_ffloor = true;
}
slab_create_parent(&screen->transfer_pool, sizeof(struct virgl_transfer), 16);
virgl_disk_cache_create(screen);

View File

@ -27,6 +27,7 @@
#include "util/slab.h"
#include "util/disk_cache.h"
#include "virgl_winsys.h"
#include "compiler/nir/nir.h"
enum virgl_debug_flags {
VIRGL_DEBUG_VERBOSE = 1 << 0,
@ -63,6 +64,8 @@ struct virgl_screen {
bool no_coherent;
int32_t tweak_gles_tf3_value;
nir_shader_compiler_options compiler_options;
struct disk_cache *disk_cache;
};

View File

@ -22,6 +22,6 @@ libvirgldrm = static_library(
'virgldrm',
'virgl_drm_winsys.c',
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_gallium_drivers, inc_virtio],
dependencies : [dep_libdrm, dep_libvirglcommon, idep_mesautil],
dependencies : [dep_libdrm, dep_libvirglcommon, idep_mesautil, idep_nir_headers],
gnu_symbol_visibility : 'hidden',
)