From 2845939d6a720454f983e2e9a591735bd0fede9e Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Tue, 13 Nov 2018 11:39:06 +0100 Subject: virgl: Set sRGB write control CAP based on host capabilities v2: - Use the renamed CAPS - add assetions to make sure that mesa doesn't try to switch destination surface formats when it is not supported. (Ilia Mirkin) Signed-off-by: Gert Wollny Reviewed-by: Gurchetan Singh --- src/gallium/drivers/virgl/virgl_context.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/gallium/drivers/virgl/virgl_context.c') diff --git a/src/gallium/drivers/virgl/virgl_context.c b/src/gallium/drivers/virgl/virgl_context.c index 6ed4e2f8394..08f85f8574a 100644 --- a/src/gallium/drivers/virgl/virgl_context.c +++ b/src/gallium/drivers/virgl/virgl_context.c @@ -229,6 +229,11 @@ static struct pipe_surface *virgl_create_surface(struct pipe_context *ctx, if (!surf) return NULL; + assert(ctx->screen->get_param(ctx->screen, + PIPE_CAP_DEST_SURFACE_SRGB_CONTROL) || + (util_format_is_srgb(templ->format) == + util_format_is_srgb(resource->format))); + res->clean = FALSE; handle = virgl_object_assign_handle(); pipe_reference_init(&surf->base.reference, 1); @@ -990,6 +995,11 @@ static void virgl_blit(struct pipe_context *ctx, struct virgl_resource *dres = virgl_resource(blit->dst.resource); struct virgl_resource *sres = virgl_resource(blit->src.resource); + assert(ctx->screen->get_param(ctx->screen, + PIPE_CAP_DEST_SURFACE_SRGB_CONTROL) || + (util_format_is_srgb(blit->dst.resource->format) == + util_format_is_srgb(blit->dst.format))); + dres->clean = FALSE; virgl_encode_blit(vctx, dres, sres, blit); -- cgit v1.2.3