aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/virgl/virgl_resource.c
diff options
context:
space:
mode:
authorGert Wollny <[email protected]>2019-05-27 16:28:44 +0200
committerGert Wollny <[email protected]>2019-06-20 08:50:38 +0200
commit13d4a34c4463c8c68553b8ce18cb1aa76d567ecb (patch)
treea332a65c4ab77faaf937380073af78dd6aa0628e /src/gallium/drivers/virgl/virgl_resource.c
parent22edafb23942f98b3e805f0871dcad839f20b977 (diff)
virgl: Add override for BGRA format to use swizzled SRGB format
Tie in the check whether the host supports tweaks and whether this tweak is enabled. v2: Add comment about the emulated formats not being used directly in the guest (Gurchetan) Signed-off-by: Gert Wollny <[email protected]> Reviewed-by: Gurchetan Singh <[email protected]>
Diffstat (limited to 'src/gallium/drivers/virgl/virgl_resource.c')
-rw-r--r--src/gallium/drivers/virgl/virgl_resource.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gallium/drivers/virgl/virgl_resource.c b/src/gallium/drivers/virgl/virgl_resource.c
index 4e585d72490..0659b38c692 100644
--- a/src/gallium/drivers/virgl/virgl_resource.c
+++ b/src/gallium/drivers/virgl/virgl_resource.c
@@ -222,6 +222,16 @@ static struct pipe_resource *virgl_resource_create(struct pipe_screen *screen,
pipe_reference_init(&res->u.b.reference, 1);
vbind = pipe_to_virgl_bind(vs, templ->bind, templ->flags);
virgl_resource_layout(&res->u.b, &res->metadata);
+
+ if ((vs->caps.caps.v2.capability_bits & VIRGL_CAP_APP_TWEAK_SUPPORT) &&
+ vs->tweak_gles_emulate_bgra &&
+ (templ->format == PIPE_FORMAT_B8G8R8A8_SRGB ||
+ templ->format == PIPE_FORMAT_B8G8R8A8_UNORM ||
+ templ->format == PIPE_FORMAT_B8G8R8X8_SRGB ||
+ templ->format == PIPE_FORMAT_B8G8R8X8_UNORM)) {
+ vbind |= VIRGL_BIND_PREFER_EMULATED_BGRA;
+ }
+
res->hw_res = vs->vws->resource_create(vs->vws, templ->target,
templ->format, vbind,
templ->width0,