backend/native: Refactor choose_primary_gpu_unchecked() to meet style
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4114>
This commit is contained in:
parent
d92bb351da
commit
a280280cff
@ -2189,66 +2189,67 @@ choose_primary_gpu_unchecked (MetaBackend *backend,
|
|||||||
* then software rendering devices.
|
* then software rendering devices.
|
||||||
*/
|
*/
|
||||||
for (allow_sw = 0; allow_sw < 2; allow_sw++)
|
for (allow_sw = 0; allow_sw < 2; allow_sw++)
|
||||||
{
|
{
|
||||||
/* First check if one was explicitly configured. */
|
/* First check if one was explicitly configured. */
|
||||||
for (l = gpus; l; l = l->next)
|
for (l = gpus; l; l = l->next)
|
||||||
{
|
{
|
||||||
MetaGpuKms *gpu_kms = META_GPU_KMS (l->data);
|
MetaGpuKms *gpu_kms = META_GPU_KMS (l->data);
|
||||||
MetaKmsDevice *kms_device = meta_gpu_kms_get_kms_device (gpu_kms);
|
MetaKmsDevice *kms_device = meta_gpu_kms_get_kms_device (gpu_kms);
|
||||||
|
|
||||||
if (meta_kms_device_get_flags (kms_device) &
|
if (meta_kms_device_get_flags (kms_device) &
|
||||||
META_KMS_DEVICE_FLAG_PREFERRED_PRIMARY)
|
META_KMS_DEVICE_FLAG_PREFERRED_PRIMARY)
|
||||||
{
|
{
|
||||||
g_message ("GPU %s selected primary given udev rule",
|
g_message ("GPU %s selected primary given udev rule",
|
||||||
meta_gpu_kms_get_file_path (gpu_kms));
|
meta_gpu_kms_get_file_path (gpu_kms));
|
||||||
return gpu_kms;
|
return gpu_kms;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Prefer a platform device */
|
|
||||||
for (l = gpus; l; l = l->next)
|
|
||||||
{
|
|
||||||
MetaGpuKms *gpu_kms = META_GPU_KMS (l->data);
|
|
||||||
|
|
||||||
if (meta_gpu_kms_is_platform_device (gpu_kms) &&
|
/* Prefer a platform device */
|
||||||
(allow_sw == 1 ||
|
for (l = gpus; l; l = l->next)
|
||||||
gpu_kms_is_hardware_rendering (renderer_native, gpu_kms)))
|
{
|
||||||
{
|
MetaGpuKms *gpu_kms = META_GPU_KMS (l->data);
|
||||||
g_message ("Integrated GPU %s selected as primary",
|
|
||||||
meta_gpu_kms_get_file_path (gpu_kms));
|
|
||||||
return gpu_kms;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Otherwise a device we booted with */
|
if (meta_gpu_kms_is_platform_device (gpu_kms) &&
|
||||||
for (l = gpus; l; l = l->next)
|
(allow_sw == 1 ||
|
||||||
{
|
gpu_kms_is_hardware_rendering (renderer_native, gpu_kms)))
|
||||||
MetaGpuKms *gpu_kms = META_GPU_KMS (l->data);
|
{
|
||||||
|
g_message ("Integrated GPU %s selected as primary",
|
||||||
|
meta_gpu_kms_get_file_path (gpu_kms));
|
||||||
|
return gpu_kms;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (meta_gpu_kms_is_boot_vga (gpu_kms) &&
|
/* Otherwise a device we booted with */
|
||||||
(allow_sw == 1 ||
|
for (l = gpus; l; l = l->next)
|
||||||
gpu_kms_is_hardware_rendering (renderer_native, gpu_kms)))
|
{
|
||||||
{
|
MetaGpuKms *gpu_kms = META_GPU_KMS (l->data);
|
||||||
g_message ("Boot VGA GPU %s selected as primary",
|
|
||||||
meta_gpu_kms_get_file_path (gpu_kms));
|
|
||||||
return gpu_kms;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Fall back to any device */
|
if (meta_gpu_kms_is_boot_vga (gpu_kms) &&
|
||||||
for (l = gpus; l; l = l->next)
|
(allow_sw == 1 ||
|
||||||
{
|
gpu_kms_is_hardware_rendering (renderer_native, gpu_kms)))
|
||||||
MetaGpuKms *gpu_kms = META_GPU_KMS (l->data);
|
{
|
||||||
|
g_message ("Boot VGA GPU %s selected as primary",
|
||||||
|
meta_gpu_kms_get_file_path (gpu_kms));
|
||||||
|
return gpu_kms;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (allow_sw == 1 ||
|
/* Fall back to any device */
|
||||||
gpu_kms_is_hardware_rendering (renderer_native, gpu_kms))
|
for (l = gpus; l; l = l->next)
|
||||||
{
|
{
|
||||||
g_message ("GPU %s selected as primary",
|
MetaGpuKms *gpu_kms = META_GPU_KMS (l->data);
|
||||||
meta_gpu_kms_get_file_path (gpu_kms));
|
|
||||||
return gpu_kms;
|
if (allow_sw == 1 ||
|
||||||
}
|
gpu_kms_is_hardware_rendering (renderer_native, gpu_kms))
|
||||||
}
|
{
|
||||||
}
|
g_message ("GPU %s selected as primary",
|
||||||
|
meta_gpu_kms_get_file_path (gpu_kms));
|
||||||
|
return gpu_kms;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user