1
0
Fork 0

cogl: Add a quirk on Mali to glFlush before glGenerateMipmap

But only when the texture in question has associated framebuffers that
actually need flushing.

Workaround for: https://github.com/Xilinx/mali-userspace-binaries/issues/3
Related to: https://gitlab.gnome.org/GNOME/mutter/-/issues/2354

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2614>
This commit is contained in:
Daniel van Vugt 2022-09-06 09:29:26 +00:00 committed by Marge Bot
parent 26f619559c
commit f1d7ccfa79
3 changed files with 14 additions and 0 deletions

View file

@ -67,6 +67,9 @@ typedef enum
*/
COGL_PRIVATE_FEATURE_ANY_GL,
/* This is a Mali bug/quirk: */
COGL_PRIVATE_QUIRK_GENERATE_MIPMAP_NEEDS_FLUSH,
COGL_N_PRIVATE_FEATURES
} CoglPrivateFeature;

View file

@ -403,6 +403,10 @@ _cogl_texture_2d_pre_paint (CoglTexture *tex, CoglTexturePrePaintFlags flags)
*/
_cogl_texture_flush_journal_rendering (tex);
if (_cogl_has_private_feature (ctx, COGL_PRIVATE_QUIRK_GENERATE_MIPMAP_NEEDS_FLUSH) &&
_cogl_texture_get_associated_framebuffers (tex))
ctx->glFlush ();
ctx->driver_vtable->texture_2d_generate_mipmap (tex_2d);
tex_2d->mipmaps_dirty = FALSE;

View file

@ -440,6 +440,13 @@ _cogl_driver_update_features (CoglContext *context,
if (context->glGenQueries && context->glQueryCounter && context->glGetInteger64v)
COGL_FLAGS_SET (context->features, COGL_FEATURE_ID_TIMESTAMP_QUERY, TRUE);
if (!g_strcmp0 ((char *) context->glGetString (GL_RENDERER), "Mali-400 MP"))
{
COGL_FLAGS_SET (private_features,
COGL_PRIVATE_QUIRK_GENERATE_MIPMAP_NEEDS_FLUSH,
TRUE);
}
/* Cache features */
for (i = 0; i < G_N_ELEMENTS (private_features); i++)
context->private_features[i] |= private_features[i];