glthread: change when glFlush flushes asynchronously
This fixes the flushing with external textures. We don't know if we need to flush synchronously with multiple contexts, so I removed that. Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11341>
This commit is contained in:
parent
0510a947ba
commit
3da170faae
|
@ -309,6 +309,7 @@ dri2_create_image_from_renderbuffer2(__DRIcontext *context,
|
|||
if (dri2_get_mapping_by_format(img->dri_format))
|
||||
p_ctx->flush_resource(p_ctx, tex);
|
||||
|
||||
ctx->Shared->HasExternallySharedImages = true;
|
||||
*error = __DRI_IMAGE_ERROR_SUCCESS;
|
||||
return img;
|
||||
}
|
||||
|
@ -407,6 +408,7 @@ dri2_create_from_texture(__DRIcontext *context, int target, unsigned texture,
|
|||
if (dri2_get_mapping_by_format(img->dri_format))
|
||||
p_ctx->flush_resource(p_ctx, tex);
|
||||
|
||||
ctx->Shared->HasExternallySharedImages = true;
|
||||
*error = __DRI_IMAGE_ERROR_SUCCESS;
|
||||
return img;
|
||||
}
|
||||
|
|
|
@ -2399,14 +2399,8 @@
|
|||
<glx sop="108" handcode="true"/>
|
||||
</function>
|
||||
|
||||
<!-- Shared contexts have to wait for glthread to finish execution after glFlush,
|
||||
so that other contexts can see the effect of previous GL calls when glFlush returns.
|
||||
This is harmless if the contexts run on different threads, because we only stall
|
||||
1 thread that's asynchronous anyway. It's worse when the contexts run on the same
|
||||
thread, but that's not a good use of multiple contexts.
|
||||
-->
|
||||
<function name="Flush" es1="1.0" es2="2.0"
|
||||
marshal_call_after="_mesa_glthread_flush_batch(ctx); if (ctx->Shared->RefCount > 1) _mesa_glthread_finish(ctx);">
|
||||
marshal_call_after="_mesa_glthread_flush_batch(ctx); if (ctx->Shared->HasExternallySharedImages) _mesa_glthread_finish(ctx);">
|
||||
<glx sop="142" handcode="true"/>
|
||||
</function>
|
||||
|
||||
|
|
|
@ -3474,6 +3474,14 @@ struct gl_shared_state
|
|||
* frequency changes.
|
||||
*/
|
||||
bool DisjointOperation;
|
||||
|
||||
/**
|
||||
* Whether at least one image has been imported or exported, excluding
|
||||
* the default framebuffer. If this is false, glFlush can be executed
|
||||
* asynchronously because there is no invisible dependency on external
|
||||
* users.
|
||||
*/
|
||||
bool HasExternallySharedImages;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -192,6 +192,7 @@ st_get_egl_image(struct gl_context *ctx, GLeglImageOES image_handle,
|
|||
return false;
|
||||
}
|
||||
|
||||
ctx->Shared->HasExternallySharedImages = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue