LdmGPUConfig

LdmGPUConfig — Access GPU configuration

Functions

Properties

Types and Values

enum LdmGPUType

Object Hierarchy

    GFlags
    ╰── LdmGPUType
    GObject
    ╰── LdmGPUConfig

Description

This object is used to query an LdmManager for the system GPU configuration and topology. Using the LdmGPUConfig allows end-users to query exactly what kind of configuration is present, and determine the primary vs secondary GPUs, presence of Optimus/Hybrid GPUs, etc.

C example:

1
2
3
LdmManager *manager = ldm_manager_new(LDM_MANAGER_FLAGS_NONE);
LdmGPUConfig *gpu = ldm_gpu_config_new(manager);
g_message("This system has %d GPUs", ldm_gpu_config_count(gpu));

Functions

ldm_gpu_config_new ()

LdmGPUConfig *
ldm_gpu_config_new (LdmManager *manager);

Construct a GPU configuration from the LdmManager to determine the exact GPU topology.

Parameters

manager

Manager to query for a GPU config.

[transfer none]

ldm_gpu_config_get_manager ()

LdmManager *
ldm_gpu_config_get_manager (LdmGPUConfig *config);

Returns

A reference to our manager.

[transfer none]


ldm_gpu_config_count ()

guint
ldm_gpu_config_count (LdmGPUConfig *config);

Determine the number of GPUs present on the system

Returns

Number of GPUs


ldm_gpu_config_get_gpu_type ()

LdmGPUType
ldm_gpu_config_get_gpu_type (LdmGPUConfig *config);

Get the type for this GPU Configuration to determine exactly what kind of device set we're dealing with.

Returns

The known type of this configuration


ldm_gpu_config_has_type ()

gboolean
ldm_gpu_config_has_type (LdmGPUConfig *config,
                         LdmGPUType mask);

Test whether this GPU config has the given type(s) by testing the mask against our known types.

C example:

1
2
3
if (ldm_gpu_config_has_type(gpu, LDM_GPU_TYPE_OPTIMUS)) {
        g_message("System is using an Optimus configuration");
}

Parameters

mask

Bitwise OR combination of LdmGPUType

 

ldm_gpu_config_get_primary_device ()

LdmDevice *
ldm_gpu_config_get_primary_device (LdmGPUConfig *config);

Get the device that this LdmGPUConfig has determined to be the primary active GPU. This should be the baseline for driver detection in all *non hybrid* detection cases.

Returns

The primary GPU LdmDevice.

[transfer none]


ldm_gpu_config_get_secondary_device ()

LdmDevice *
ldm_gpu_config_get_secondary_device (LdmGPUConfig *config);

Get the device that this LdmGPUConfig has determined to be the secondary GPU. This is only useful in hybrid GPU setups, and is always the discrete GPU (dGPU).

When the “gpu-type” is LDM_GPU_TYPE_OPTIMUS, the secondary device is always the NVIDIA dGPU, and driver detection should be performed against this device only.

Returns

The secondary GPU LdmDevice.

[transfer none]


ldm_gpu_config_get_detection_device ()

LdmDevice *
ldm_gpu_config_get_detection_device (LdmGPUConfig *config);

Get the device that this LdmGPUConfig has determined to be the best candidate for driver detection.

For any hybrid GPU configuration, this will be the secondary GPU (discrete GPU). For all other cases, this will be the primary GPU (i.e. the one used to boot the system)

Returns

The GPU LdmDevice used for driver detection.

[transfer none]


ldm_gpu_config_get_providers ()

GPtrArray *
ldm_gpu_config_get_providers (LdmGPUConfig *config);

Get the LdmProvider sbest suited for this particular GPU Configuration. This is a quick wrapper around various internal functions to make it quick and painless to learn the correct GPU driver expected for the graphical drivers.

The internal “manager” is responsible for sorting the returned list.

Returns

a list of all possible providers.

[element-type Ldm.Provider][transfer full]

Types and Values

enum LdmGPUType

A GPU configuration can only have one active state at the time of detection as far as LDM is concerned. It is in most cases a simple configuration, i.e. not hybrid or composite. Beyond that, we tag to refine the state.

Hybrid refers to *both* AMD and NVIDIA hybrid GPU approaches, and simply indicates we discovered a hybrid GPU configuration.

Composite indicates we're dealing with Crossfire or SLI systems.

A GPU configuration may have one or more state applied, i.e. it may be a hybrid GPU system but we can further refine this by tagging it as an Optimus system too.

Members

LDM_GPU_TYPE_SIMPLE

Trivial GPU configuration

 

LDM_GPU_TYPE_HYBRID

Hybrid graphics discovered (i.e. Optimus)

 

LDM_GPU_TYPE_COMPOSITE

Composite graphics configuration (SLI/Crossfire)

 

LDM_GPU_TYPE_OPTIMUS

NVIDIA Optimus configuration (hybrid GPU)

 

LDM_GPU_TYPE_SLI

NVIDIA SLI configuration (multiple GPUs)

 

LDM_GPU_TYPE_CROSSFIRE

AMD Crossfire configuration (multiple GPUs)

 

LDM_GPU_TYPE_MAX

   

Property Details

The “detection-device” property

  “detection-device”         gpointer

GPU device that should be used for driver detection

[transfer none]

Owner: LdmGPUConfig

Flags: Read


The “gpu-type” property

  “gpu-type”                 LdmGPUType

The composite type for this GPU Configuration

Owner: LdmGPUConfig

Flags: Read


The “manager” property

  “manager”                  gpointer

Parent device for this device instance

[transfer none]

Owner: LdmGPUConfig

Flags: Read / Write / Construct Only


The “primary-device” property

  “primary-device”           gpointer

Primary device in this configuration

[transfer none]

Owner: LdmGPUConfig

Flags: Read


The “secondary-device” property

  “secondary-device”         gpointer

Secondary device in this configuration

[transfer none]

Owner: LdmGPUConfig

Flags: Read

See Also

LdmManager, LdmPCIDevice