From a330ecc48a66aa05faff795f67b0435383ba3501 Mon Sep 17 00:00:00 2001 From: Sviatoslav Peleshko Date: Wed, 13 Mar 2024 14:32:41 +0200 Subject: [PATCH] dri: Flush the context after flush_resource when creating shareable image This makes sure that we'll be done with any pending preparations before the actual export of the resource. Signed-off-by: Sviatoslav Peleshko Reviewed-by: Nanley Chery Part-of: --- src/gallium/frontends/dri/dri_helpers.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gallium/frontends/dri/dri_helpers.c b/src/gallium/frontends/dri/dri_helpers.c index 1c6baa1f98e..609c2411806 100644 --- a/src/gallium/frontends/dri/dri_helpers.c +++ b/src/gallium/frontends/dri/dri_helpers.c @@ -346,8 +346,10 @@ dri2_create_image_from_renderbuffer2(__DRIcontext *context, * it's in a shareable state. Do this now while we still have the access to * the context. */ - if (dri2_get_mapping_by_format(img->dri_format)) + if (dri2_get_mapping_by_format(img->dri_format)) { p_ctx->flush_resource(p_ctx, tex); + st_context_flush(st, 0, NULL, NULL, NULL); + } ctx->Shared->HasExternallySharedImages = true; *error = __DRI_IMAGE_ERROR_SUCCESS; @@ -455,8 +457,10 @@ dri2_create_from_texture(__DRIcontext *context, int target, unsigned texture, * it's in a shareable state. Do this now while we still have the access to * the context. */ - if (dri2_get_mapping_by_format(img->dri_format)) + if (dri2_get_mapping_by_format(img->dri_format)) { p_ctx->flush_resource(p_ctx, glimg->pt); + st_context_flush(st, 0, NULL, NULL, NULL); + } ctx->Shared->HasExternallySharedImages = true; *error = __DRI_IMAGE_ERROR_SUCCESS;