This is my first patch to mesa-dev. Hopefully, I have done everything correctly.
I posed the idea about a week ago: Manipulate GALLIUM_HUD post-launch (interactively) http://lists.freedesktop.org/archives/mesa-dev/2015-October/098544.html I decided to keep it simple for my first patch and implement the bare requirements needed to fulfill the proposed usecase. Further improvements like updating the make up of the hud I have considered and may proceed with, but for the time being I decided to start with this and see what reaction I received. My initial goal: toggle GALLIUM_HUD so it can be hidden when not desired, but toggled without restarting application. Two new environment variables are provided (from envvars.html): - GALLIUM_HUD_VISIBLE - control default visibility, defaults to true. - GALLIUM_HUD_TOGGLE_SIGNAL - toggle visibility via user specified signal. Especially useful to toggle hud at specific points of application and disable for unencumbered viewing the rest of the time. For example, set GALLIUM_HUD_VISIBLE to false and GALLIUM_HUD_SIGNAL_TOGGLE to 10 (SIGUSR1). Use kill -10 <pid> to toggle the hud as desired. Based on the documentation an example usecase (perhaps in .bashrc or similar). GALLIUM_HUD=fps GALLIUM_HUD_VISIBLE=false GALLIUM_HUD_TOGGLE_SIGNAL=10 kill -10 <pid> This provides a toggleable fps display which is of potential use to end-users instead of just debugging purposes. Due to a lack of standard/easy tools for displaying fps on Linux, Steam added an option to display fps which obviously only works for applications running alongside Steam, but something like this could be used more generally. Since the hud is not always visible the variables can be set more globally rather than requiring one-off tweaks to startup scripts for games instead of Steam (following with the example). Combined with a keyboard shortcut one could rather simply toggle such a display without a lot of fuss. X example: kill -10 $(xprop -id `xdotool getwindowfocus` | \ grep '_NET_WM_PID' | \ grep -oE '[[:digit:]]*$') Obviously, this example will not always work, but rather close to what I wanted to achieve. For development use this can be used with a much more complex GALLIUM_HUD setup. The initial implementation is designed with the idea of updating the environment variables as an alternative to the signal and hence the name GALLIUM_HUD_VISIBLE which works for representing the current state as well as initial state (all that is currently supported). An update mechanism (inotify, signal, etc) might be used to re-read environment variables from one of various sources (as discussed) which could also toggle the hud by changing GALLIUM_HUD_VISIBLE. It does not seem that there is a posix mechanism for taking a string representation of a signal and determining the number. Otherwise, it would seem reasonable to support string input for GALLIUM_HUD_TOGGLE_SIGNAL as well. I look forward to your thoughts. -- Jimmy _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev