1.8
Environment Variables

This chapter discusses several environment variables that can be used to configure the EGT library at run time.

EGT will look at several run time environment variables to change the operation of the library. For example, you can change some configurations and set log levels using environment variables.

There are many ways to set an environment variable for a process, but generally speaking you can run a process in a shell and specify some environment variables just for that process:

EGT_DEBUG=1 EGT_KMS_BUFFERS=1 ./egt_space
EGT_DEBUG

Set the numeric log level for the framework. If the library is compiled with debug turned off, the internal DEBUG and TRACE log levels are removed at compile time.

  • TRACE = 0
  • DEBUG = 1
  • INFO = 2
  • WARN = 3
  • ERROR = 4
  • CRITICAL = 5
  • OFF = 6

See Configure Options for more information on compile time options.

EGT_BACKEND

Select what backend to use for rendering to the screen. If this environment variable is not specified, a suitable default will be chosen.

  • kms
  • x11
  • sdl2
  • none

EGT_KMS_BUFFERS

Specify the number of buffers to use for KMS. If you specify a single buffer, no buffering will be used. If you specify 2 buffers, double buffering will be used. If you specify 3 buffers, triple buffering will be used, and so on.

EGT_INPUT_DEVICES

Configure mapping of input devices to their EGT input backend.

Available backends include:

  • libinput (default)
  • tslib
  • evdev

Use libinput and tslib to handle different touchscreens:

EGT_INPUT_DEVICES=libinput:/dev/input/touchscreen0,/dev/input/touchscreen1;tslib:/dev/input/touchscreen2

Get keyboard events for the USER button on a SOM1-EK board:

EGT_INPUT_DEVICES=evdev:/dev/input/event2

EGT_ICONS_DIRECTORY

Change EGT installed default icons directory with an absolute or relative path.

The directory path contents specified must be in the expected format as the default EGT icons directory, containing subdirectories of icon size. For example, 16px, 32px, 64px, and 128px.

Example

EGT_ICONS_DIRECTORY=/usr/share/icons

EGT_SCREEN_SIZE

Set a custom screen size. This is only possible with some backends, like X11.

Example

EGT_SCREEN_SIZE=640x480 ./widgets

EGT_SEARCH_PATH

Add additional search directories to find resources.

Example

EGT_SEARCH_PATH=/opt/icons:/usr/share/planes

EGT_SCREEN_ASYNC_FLIP

A non-empty value tells the screen backend to perform asynchronous flip operations. Note that when this is enabled, screen tearing may be possible.

Example

EGT_SCREEN_ASYNC_FLIP=1 ./widgets

EGT_X11_NODECORATION

A non-empty value turns off window decorations on an X11 window.

EGT_TIME_DRAW

When non-empty, print timing information for drawing every widget.

EGT_TIME_EVENTLOOP

When non-empty, print timing information for the event loop.

EGT_SHOW_FPS

When non-empty, print the frames per second of the event loop.

EGT_NO_COMPOSITION_BUFFER

Instead of using a composition buffer, always render directly into the framebuffer. This only works if there is a backend with a single framebuffer. For example, when using KMS, the environment variable EGT_KMS_BUFFERS must equal 1. Otherwise it has no effect and may not apply to all backends.

EGT_USE_GFX2D

A non-empty value enables the use of the GFX2D GPU. Set this option only if the device has a 2D GPU. If cairo doesn't have the libm2d support, this option has no effect.

EGT_WIREFRAME_ENABLE

A non-empty value enables drawing of damage rectangles to the display. This can be used to identify, visually, what is being redrawn each flip to the screen. This is a debug option and can create additional burden on performance. This option requires a composition buffer, so it cannot be used with EGT_NO_COMPOSITION_BUFFER.

EGT_WIREFRAME_DECAY

When non-zero, specifies the amount of decay in milliseconds to visually keep wireframe rectangles around. This option only applies when EGT_WIREFRAME_ENABLE is non-empty.

EGT_SHOW_SCREEN_BANDWIDTH

When non-empty, logs the bandwidth to render the final screen frames. In other words, the number of bytes transmitted through damage rectangles to the framebuffer being displayed. This can be used to gauge the amount of data changing to render a screen.

EGT_LIBINPUT_VERBOSE

When non-empty, turns on verbose logging from libinput as log level info.

EGT_TIME_INPUT

When non-empty, prints timing information for handling input events.