diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index cc3af30c71d..8830b4073d4 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -697,6 +697,9 @@ eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) disp->Options.Zink = env && !strcmp(env, "zink"); disp->Options.ForceSoftware |= disp->Options.Zink; + const char *gallium_hud_env = getenv("GALLIUM_HUD"); + disp->Options.GalliumHud = gallium_hud_env && gallium_hud_env[0] != '\0'; + /** * Initialize the display using the driver's function. * If the initialisation fails, try again using only software rendering. diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h index cafbcccd0be..0eb6dad1d78 100644 --- a/src/egl/main/egldisplay.h +++ b/src/egl/main/egldisplay.h @@ -203,6 +203,7 @@ struct _egl_display struct { EGLBoolean Zink; /**< Use kopper only */ EGLBoolean ForceSoftware; /**< Use software path only */ + EGLBoolean GalliumHud; /**< Using gallium hud, disable buffer age */ EGLAttrib *Attribs; /**< Platform-specific options */ int fd; /**< platform device specific, local fd */ } Options; diff --git a/src/egl/main/eglsurface.c b/src/egl/main/eglsurface.c index eb920ea9658..fe2315da91c 100644 --- a/src/egl/main/eglsurface.c +++ b/src/egl/main/eglsurface.c @@ -564,7 +564,9 @@ _eglQuerySurface(_EGLDisplay *disp, _EGLSurface *surface, ctx->DrawSurface != surface) return _eglError(EGL_BAD_SURFACE, "eglQuerySurface"); - EGLint result = disp->Driver->QueryBufferAge(disp, surface); + EGLint result = 0; + if (!disp->Options.GalliumHud) + result = disp->Driver->QueryBufferAge(disp, surface); if (result < 0) return EGL_FALSE;