gl/context: disable timer queries for ARM Mali-G52

Performing a timer query with a default framebuffer that is incomplete
(from using a surfaceless context) will produce GL errors.  Disable the
timer query on this platform to avoid the errors.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2396>
This commit is contained in:
Matthew Waters 2022-05-09 16:21:55 +10:00 committed by GStreamer Marge Bot
parent 4c97ffeafb
commit a1f30f5b9b
4 changed files with 99 additions and 11 deletions

View file

@ -1530,17 +1530,7 @@ gst_gl_context_fill_info (GstGLContext * context, GError ** error)
goto failure;
}
/* Does not implement OES_vertex_array_object properly, see
* https://bugzilla.gnome.org/show_bug.cgi?id=750185 */
if (g_strcmp0 ((const gchar *) gl->GetString (GL_VENDOR),
"Imagination Technologies") == 0
&& g_strcmp0 ((const gchar *) gl->GetString (GL_RENDERER),
"PowerVR SGX 544MP") == 0) {
gl->GenVertexArrays = NULL;
gl->DeleteVertexArrays = NULL;
gl->BindVertexArray = NULL;
gl->IsVertexArray = NULL;
}
gst_gl_context_apply_quirks (context);
if (GST_IS_GL_WRAPPED_CONTEXT (context)) {
/* XXX: vfunc? */

View file

@ -29,6 +29,9 @@ G_GNUC_INTERNAL extern GstDebugCategory *gst_gl_context_debug;
G_GNUC_INTERNAL
gboolean _gst_gl_context_debug_is_enabled (GstGLContext * context);
G_GNUC_INTERNAL
void gst_gl_context_apply_quirks (GstGLContext * context);
#define GST_GL_CONTEXT_WRAPPED_GL_CONFIG_NAME "gst.gl.context.wrapped.config"
#define GST_TYPE_GL_WRAPPED_CONTEXT (gst_gl_wrapped_context_get_type())

View file

@ -0,0 +1,94 @@
/*
* GStreamer
* Copyright (C) 2022 Matthew Waters <matthew@centricular.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <gst/gl/gl.h>
#include <gst/gl/gstglcontext_private.h>
#include "gstglfuncs.h"
#define GST_CAT_DEFAULT gst_gl_context_debug
#ifndef GL_FRAMEBUFFER_BINDING
#define GL_FRAMEBUFFER_BINDING 0x8CA6
#endif
#ifndef GL_FRAMEBUFFER
#define GL_FRAMEBUFFER 0x8D40
#endif
#ifndef GL_FRAMEBUFFER_COMPLETE
#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
#endif
void
gst_gl_context_apply_quirks (GstGLContext * context)
{
GstGLFuncs *gl = context->gl_vtable;
const char *gl_vendor, *gl_renderer;
gl_vendor = (const char *) gl->GetString (GL_VENDOR);
gl_renderer = (const char *) gl->GetString (GL_RENDERER);
/* Does not implement OES_vertex_array_object properly, see
* https://bugzilla.gnome.org/show_bug.cgi?id=750185 */
if (g_strcmp0 (gl_vendor, "Imagination Technologies") == 0
&& g_strcmp0 (gl_renderer, "PowerVR SGX 544MP") == 0) {
gl->GenVertexArrays = NULL;
gl->DeleteVertexArrays = NULL;
gl->BindVertexArray = NULL;
gl->IsVertexArray = NULL;
}
/* doesn't support timer queries without a complete framebuffer.
* If the default framebuffer is backed by a surfaceless context, then the
* default framebuffer is always incomplete and timer queries to time
* upload/downloads will fail with GL errors. */
if (g_strcmp0 (gl_vendor, "ARM") == 0
&& g_strcmp0 (gl_renderer, "Mali-G52") == 0
&& gl->CheckFramebufferStatus) {
gint current_fbo;
GLenum fbo_ret;
gl->GetIntegerv (GL_FRAMEBUFFER_BINDING, &current_fbo);
if (current_fbo != 0)
gl->BindFramebuffer (GL_FRAMEBUFFER, 0);
fbo_ret = gl->CheckFramebufferStatus (GL_FRAMEBUFFER);
if (fbo_ret != GL_FRAMEBUFFER_COMPLETE) {
GST_FIXME_OBJECT (context, "default framebuffer is not complete "
"(is 0x%x) on ARM Mali-G52 which doesn't support timer queries with "
"an incomplete framebuffer object, disabling timer queries", fbo_ret);
gl->GenQueries = NULL;
gl->BeginQuery = NULL;
gl->EndQuery = NULL;
gl->QueryCounter = NULL;
gl->DeleteQueries = NULL;
gl->IsQuery = NULL;
gl->GetQueryiv = NULL;
gl->GetQueryObjectiv = NULL;
gl->GetQueryObjectuiv = NULL;
gl->GetQueryObjecti64v = NULL;
gl->GetQueryObjectui64v = NULL;
}
if (current_fbo != 0)
gl->BindFramebuffer (GL_FRAMEBUFFER, current_fbo);
}
}

View file

@ -20,6 +20,7 @@ gl_sources = files([
'gstglbufferpool.c',
'gstglcontext.c',
'gstglcontextconfig.c',
'gstglcontextquirks.c',
'gstgldebug.c',
'gstgldisplay.c',
'gstglfeature.c',