With Qemu this final swizzle is not needed, but with vtest it is, i.e. it depends on
how a program using virglrenderer uses the surface that is rendered to, hence
a tweak is added.
v2: Update description and fix spelling (Emil)
v3: Send tweak as binary value instead of using strings (Gurchetan)
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
{
if (rs->tweak_gles_emulate_bgra)
virgl_encode_tweak(vctx, virgl_tweak_gles_brga_emulate, 1);
+
+ if (rs->tweak_gles_apply_bgra_dest_swizzle)
+ virgl_encode_tweak(vctx, virgl_tweak_gles_brga_apply_dest_swizzle, 1);
}
struct pipe_context *virgl_context_create(struct pipe_screen *pscreen,
// 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_SECTION_END
enum vrend_tweak_type {
virgl_tweak_gles_brga_emulate,
+ virgl_tweak_gles_brga_apply_dest_swizzle,
virgl_tweak_undefined
};
struct virgl_screen *screen = CALLOC_STRUCT(virgl_screen);
const char *VIRGL_GLES_EMULATE_BGRA = "gles_emulate_bgra";
+ const char *VIRGL_GLES_APPLY_BGRA_DEST_SWIZZLE = "gles_apply_bgra_dest_swizzle";
if (!screen)
return NULL;
if (config && config->options) {
screen->tweak_gles_emulate_bgra =
driQueryOptionb(config->options, VIRGL_GLES_EMULATE_BGRA);
+ screen->tweak_gles_apply_bgra_dest_swizzle =
+ driQueryOptionb(config->options, VIRGL_GLES_APPLY_BGRA_DEST_SWIZZLE);
}
screen->vws = vws;
screen->base.get_name = virgl_get_name;
uint32_t sub_ctx_id;
bool tweak_gles_emulate_bgra;
+ bool tweak_gles_apply_bgra_dest_swizzle;
};
DRI_CONF_DESC(en,gettext("On GLES emulate BGRA formats by using a swizzled RGBA format")) \
DRI_CONF_OPT_END
+#define DRI_CONF_GLES_APPLY_BGRA_DEST_SWIZZLE(def) \
+DRI_CONF_OPT_BEGIN_B(gles_apply_bgra_dest_swizzle, def) \
+ DRI_CONF_DESC(en,gettext("When the BGRA formats are emulated by using swizzled RGBA formats on GLES apply the swizzle when writing")) \
+DRI_CONF_OPT_END