hud: add GALLIUM_HUD_OPACITY envvar

GALLIUM_HUD_OPACITY can be used with a % value from 0 to 100, to specify
the opacity of the gallium hud background.

Signed-off-by: Italo Nicola <italonicola@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Tested-by: Chris Healy <healych@amazon.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20339>
This commit is contained in:
Italo Nicola 2022-12-15 13:34:21 -03:00 committed by Marge Bot
parent 7ace1bab73
commit 3174cfcaf2
2 changed files with 8 additions and 1 deletions

View file

@ -730,6 +730,10 @@ Gallium environment variables
control default visibility, defaults to true.
.. envvar:: GALLIUM_HUD_OPACITY
control background opacity as an integer percentage (1-100), defaults to 66%.
.. envvar:: GALLIUM_HUD_TOGGLE_SIGNAL
toggle visibility via user specified signal. Especially useful to

View file

@ -71,11 +71,13 @@
#define HUD_DEFAULT_VISIBILITY TRUE
#define HUD_DEFAULT_SCALE 1
#define HUD_DEFAULT_ROTATION 0
#define HUD_DEFAULT_OPACITY 66
/* Control the visibility of all HUD contexts */
static boolean huds_visible = HUD_DEFAULT_VISIBILITY;
static int hud_scale = HUD_DEFAULT_SCALE;
static int hud_rotate = HUD_DEFAULT_ROTATION;
static float hud_opacity = HUD_DEFAULT_OPACITY / 100.0f;
#if DETECT_OS_UNIX
static void
@ -593,7 +595,7 @@ hud_draw_results(struct hud_context *hud, struct pipe_resource *tex)
hud->constants.color[0] = 0;
hud->constants.color[1] = 0;
hud->constants.color[2] = 0;
hud->constants.color[3] = 0.666f;
hud->constants.color[3] = hud_opacity;
hud->constants.translate[0] = 0;
hud->constants.translate[1] = 0;
hud->constants.scale[0] = hud_scale;
@ -1936,6 +1938,7 @@ hud_create(struct cso_context *cso, struct hud_context *share,
memset(&action, 0, sizeof(action));
#endif
huds_visible = debug_get_bool_option("GALLIUM_HUD_VISIBLE", !emulate_libgl_show_fps);
hud_opacity = debug_get_num_option("GALLIUM_HUD_OPACITY", HUD_DEFAULT_OPACITY) / 100.0f;
hud_scale = debug_get_num_option("GALLIUM_HUD_SCALE", HUD_DEFAULT_SCALE);
hud_rotate = debug_get_num_option("GALLIUM_HUD_ROTATION", HUD_DEFAULT_ROTATION) % 360;
if (hud_rotate < 0) {