Top | ![]() |
![]() |
![]() |
![]() |
XAppGpuOffloadHelper is class that provides a reliable property cache and simple return methods for getting offload_helper parameters and conditions from the Switcheroo interface.
Since 2.6
XAppGpuOffloadHelper *
xapp_gpu_offload_helper_get (void
);
Creates a new XAppGpuOffloadHelper instance.
The “ready” signal will be emitted when the helper is initialized (successfully or not).
Since: 2.6
XAppGpuOffloadHelper *
xapp_gpu_offload_helper_get_sync (void
);
Creates a new XAppGpuOffloadHelper instance. This performs initialization synchronously, and can potentially block.
Use xapp_gpu_offload_helper_is_ready()
to see if the helper was initialized successfully.
Since: 2.6
gboolean
xapp_gpu_offload_helper_is_ready (XAppGpuOffloadHelper *helper
);
Checks if the helper is ready and valid. This does not mean offload support exists.
Since: 2.6
gboolean
xapp_gpu_offload_helper_is_offload_supported
(XAppGpuOffloadHelper *helper
);
Checks if there is a non-default GPU available for offloading.
Since: 2.6
gint
xapp_gpu_offload_helper_get_n_gpus (XAppGpuOffloadHelper *helper
);
Gets the number of GPUs noticed by Switcheroo.
the total number of GPUs. A return value larger than 1 implies there are offloadable GPUs available.
Since: 2.6
GList *
xapp_gpu_offload_helper_get_offload_infos
(XAppGpuOffloadHelper *helper
);
Generates a list of XAppGpuInfos that can be offloaded to, if there are any.
a list of XAppGpuInfos or NULL
if there is only
a single GPU. The elements are owned by helper
but the container itself should be freed.
[element-type XAppGpuInfo][transfer container]
Since: 2.6
XAppGpuInfo *
xapp_gpu_offload_helper_get_default_info
(XAppGpuOffloadHelper *helper
);
Returns an XAppGpuInfo for the default GPU.
Since: 2.6
XAppGpuInfo * xapp_gpu_offload_helper_get_info_by_id (XAppGpuOffloadHelper *helper
,gint id
);
Returns an XAppGpuInfo with the given ID.
Since: 2.6
gchar *
xapp_gpu_info_get_shell_env_prefix (XAppGpuInfo *info
);
Creates a new string in a form intended to prefix a shell command, containing the appropriate name/values for this gpu. For example:
__GLX_VENDOR_LIBRARY_NAME=nvidia __NV_PRIME_RENDER_OFFLOAD=1
#define XAPP_TYPE_GPU_OFFLOAD_HELPER xapp_gpu_offload_helper_get_type ()
struct XAppGpuInfo { gint id; gboolean is_default; gchar *display_name; gchar **env_strv; };
Information about a single GPU used for offloading. The length of env_strv
will always be an even number.
gint |
An identifier that can be used to refer to this GPU. |
|
gboolean |
Whether this GPU is used by default. |
|
gchar * |
User-visible name of the GPU. |
|
gchar ** |
A string array containing alternating environment variables names and values to use to enable the gpu. |
[array zero-terminated=1] |
“ready”
signalvoid user_function (XAppGpuOffloadHelper *helper, gboolean success, gpointer user_data)
This signal is emitted by the helper when it has completed gathering GPU information. It will only be sent once.
helper |
||
success |
Whether or not the helper initialize successfully. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Action