From e516a0a94fd201444eef2f618d447f8e68aeb347 Mon Sep 17 00:00:00 2001 From: Italo Nicola Date: Wed, 14 Dec 2022 20:29:14 -0300 Subject: [PATCH] egl: disable partial redraw when gallium hud is active We draw the gallium hud directly to the rendered buffer, meaning that if the buffer age is queried and then a partial redraw is done, we get a ghosting effect from the hud drawn in previous frames. Since we need to draw the hud with updated values every frame anyway, there's no harm in disabling the buffer age and partial redraw. Signed-off-by: Italo Nicola Reviewed-by: Eric Engestrom Tested-by: Chris Healy Part-of: --- src/egl/main/eglapi.c | 3 +++ src/egl/main/egldisplay.h | 1 + src/egl/main/eglsurface.c | 4 +++- 3 files changed, 7 insertions(+), 1 deletion(-) 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;