summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRohan Garg <rohan.garg@collabora.com>2020-09-25 17:25:34 +0200
committerMarge Bot <eric+marge@anholt.net>2020-10-26 15:01:34 +0000
commit6f68cacf619f7f13bc870355709224c1f3e9bbd8 (patch)
tree42ea2e7c182981e3f744c4440fe64931516d81f4
parent3d9ffdcc729b77ecf26aa14436105782763be274 (diff)
virgl: Always enable emulated BGRA and swizzling unless specifically told not to
The emulation is turned on by default only for GLES hosts when the host does not support the BGRA/RGBA external/internal format combination. This can be turned off by setting VIRGL_DEBUG=noemubgra,nobgraswz environment variable. Signed-off-by: Rohan Garg <rohan.garg@collabora.com> Reviewed-by: Gert Wollny <gert.wollny@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6847>
-rw-r--r--src/gallium/drivers/virgl/virgl_driinfo.h.in4
-rw-r--r--src/gallium/drivers/virgl/virgl_screen.c11
-rw-r--r--src/gallium/drivers/virgl/virgl_screen.h4
-rw-r--r--src/util/00-mesa-defaults.conf33
4 files changed, 10 insertions, 42 deletions
diff --git a/src/gallium/drivers/virgl/virgl_driinfo.h.in b/src/gallium/drivers/virgl/virgl_driinfo.h.in
index 03cc27aeab0..6704e530b3f 100644
--- a/src/gallium/drivers/virgl/virgl_driinfo.h.in
+++ b/src/gallium/drivers/virgl/virgl_driinfo.h.in
@@ -7,7 +7,7 @@
// 4. Add the code to send the tweek to the host in virgl_send_tweaks
// 5. Implement the tweak in virglrenderer
DRI_CONF_SECTION_MISCELLANEOUS
- DRI_CONF_GLES_EMULATE_BGRA(false)
- DRI_CONF_GLES_APPLY_BGRA_DEST_SWIZZLE(false)
+ DRI_CONF_GLES_EMULATE_BGRA(true)
+ DRI_CONF_GLES_APPLY_BGRA_DEST_SWIZZLE(true)
DRI_CONF_GLES_SAMPLES_PASSED_VALUE(1024, 1, 400000000)
DRI_CONF_SECTION_END
diff --git a/src/gallium/drivers/virgl/virgl_screen.c b/src/gallium/drivers/virgl/virgl_screen.c
index 526aca505c5..92944f4c06f 100644
--- a/src/gallium/drivers/virgl/virgl_screen.c
+++ b/src/gallium/drivers/virgl/virgl_screen.c
@@ -43,8 +43,8 @@ int virgl_debug = 0;
static const struct debug_named_value debug_options[] = {
{ "verbose", VIRGL_DEBUG_VERBOSE, NULL },
{ "tgsi", VIRGL_DEBUG_TGSI, NULL },
- { "emubgra", VIRGL_DEBUG_EMULATE_BGRA, "Enable tweak to emulate BGRA as RGBA on GLES hosts"},
- { "bgraswz", VIRGL_DEBUG_BGRA_DEST_SWIZZLE, "Enable tweak to swizzle emulated BGRA on GLES hosts" },
+ { "noemubgra", VIRGL_DEBUG_NO_EMULATE_BGRA, "Disable tweak to emulate BGRA as RGBA on GLES hosts"},
+ { "nobgraswz", VIRGL_DEBUG_NO_BGRA_DEST_SWIZZLE,"Disable tweak to swizzle emulated BGRA on GLES hosts" },
{ "sync", VIRGL_DEBUG_SYNC, "Sync after every flush" },
{ "xfer", VIRGL_DEBUG_XFER, "Do not optimize for transfers" },
DEBUG_NAMED_VALUE_END
@@ -845,9 +845,8 @@ virgl_create_screen(struct virgl_winsys *vws, const struct pipe_screen_config *c
screen->tweak_gles_tf3_value =
driQueryOptioni(config->options, VIRGL_GLES_SAMPLES_PASSED_VALUE);
}
-
- screen->tweak_gles_emulate_bgra |= !!(virgl_debug & VIRGL_DEBUG_EMULATE_BGRA);
- screen->tweak_gles_apply_bgra_dest_swizzle |= !!(virgl_debug & VIRGL_DEBUG_BGRA_DEST_SWIZZLE);
+ screen->tweak_gles_emulate_bgra &= !(virgl_debug & VIRGL_DEBUG_NO_EMULATE_BGRA);
+ screen->tweak_gles_apply_bgra_dest_swizzle &= !(virgl_debug & VIRGL_DEBUG_NO_BGRA_DEST_SWIZZLE);
screen->vws = vws;
screen->base.get_name = virgl_get_name;
@@ -873,6 +872,8 @@ virgl_create_screen(struct virgl_winsys *vws, const struct pipe_screen_config *c
&screen->caps.caps.v2.supported_readback_formats);
fixup_formats(&screen->caps.caps, &screen->caps.caps.v2.scanout);
+ union virgl_caps *caps = &screen->caps.caps;
+ screen->tweak_gles_emulate_bgra &= !virgl_format_check_bitmask(PIPE_FORMAT_B8G8R8A8_SRGB, caps->v1.render.bitmask, false);
screen->refcnt = 1;
slab_create_parent(&screen->transfer_pool, sizeof(struct virgl_transfer), 16);
diff --git a/src/gallium/drivers/virgl/virgl_screen.h b/src/gallium/drivers/virgl/virgl_screen.h
index 3c7c596e1eb..6349cafc8c7 100644
--- a/src/gallium/drivers/virgl/virgl_screen.h
+++ b/src/gallium/drivers/virgl/virgl_screen.h
@@ -30,8 +30,8 @@
enum virgl_debug_flags {
VIRGL_DEBUG_VERBOSE = 1 << 0,
VIRGL_DEBUG_TGSI = 1 << 1,
- VIRGL_DEBUG_EMULATE_BGRA = 1 << 2,
- VIRGL_DEBUG_BGRA_DEST_SWIZZLE = 1 << 3,
+ VIRGL_DEBUG_NO_EMULATE_BGRA = 1 << 2,
+ VIRGL_DEBUG_NO_BGRA_DEST_SWIZZLE = 1 << 3,
VIRGL_DEBUG_SYNC = 1 << 4,
VIRGL_DEBUG_XFER = 1 << 5,
};
diff --git a/src/util/00-mesa-defaults.conf b/src/util/00-mesa-defaults.conf
index 849da7ea769..b7c37eb0b9e 100644
--- a/src/util/00-mesa-defaults.conf
+++ b/src/util/00-mesa-defaults.conf
@@ -695,39 +695,6 @@ TODO: document the other workarounds.
<option name="radeonsi_clamp_div_by_zero" value="true" />
</application>
</device>
- <device driver="virtio_gpu">
- <!-- Some Valve games do a final blit to a BRGA_sRGB surface. On a GLES
- host this format is not supported and the blit will go to BGRA_UNORM
- resulting in an unintended linearization and the final output being
- too dark. -->
- <application name="Half Life 2" executable="hl2_linux">
- <option name="gles_emulate_bgra" value="true" />
- <option name="gles_apply_bgra_dest_swizzle" value="true"/>
- </application>
- <application name="Portal" executable="hl2_linux">
- <option name="gles_emulate_bgra" value="true" />
- <option name="gles_apply_bgra_dest_swizzle" value="true"/>
- </application>
- <application name="Portal 2" executable="portal2_linux">
- <option name="gles_emulate_bgra" value="true" />
- <option name="gles_apply_bgra_dest_swizzle" value="true"/>
- </application>
- <application name="Left 4 Dead 2" executable="hl2_linux">
- <option name="gles_emulate_bgra" value="true" />
- <option name="gles_apply_bgra_dest_swizzle" value="true"/>
- </application>
- <application name="Dota 2" executable="dota2">
- <option name="gles_emulate_bgra" value="true" />
- </application>
- <!-- The Raven Remastered expects a BGRA_sRGB surface and a BGRA_sRGB
- surface that is capable to do texture views, since on GLES the BGRA
- format provided by EXT_texture_BGRA8888 has no sRGB counterpart and
- is not in the list of suppoerted TextureView formats we need to
- emulate this -->
- <application name="The Raven Remastered" executable="Raven">
- <option name="gles_emulate_bgra" value="true" />
- </application>
- </device>
<device driver="i965">
<application name="Middle Earth: Shadow of Mordor" executable="ShadowOfMordor">
<option name="vs_position_always_invariant" value="true" />