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>
This commit is contained in:
parent
3d9ffdcc72
commit
6f68cacf61
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
};
|
||||
|
|
|
@ -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" />
|
||||
|
|
Loading…
Reference in New Issue