mirror of
https://github.com/brl/mutter.git
synced 2024-11-24 17:10:40 -05:00
backends/native: Add flags to MetaGpuKms
Add a flags field to MetaGpuKms. In following commits, the flags defined here will be set and used for choosing the primary GPU. Co-authored by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> https://gitlab.gnome.org/GNOME/mutter/merge_requests/271
This commit is contained in:
parent
a56a59feee
commit
ddb0ef1e8d
@ -77,6 +77,8 @@ struct _MetaGpuKms
|
||||
gboolean page_flips_not_supported;
|
||||
|
||||
gboolean resources_init_failed_before;
|
||||
|
||||
MetaGpuKmsFlag flags;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (MetaGpuKms, meta_gpu_kms, META_TYPE_GPU)
|
||||
@ -457,6 +459,18 @@ meta_gpu_kms_set_power_save_mode (MetaGpuKms *gpu_kms,
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_gpu_kms_is_boot_vga (MetaGpuKms *gpu_kms)
|
||||
{
|
||||
return !!(gpu_kms->flags & META_GPU_KMS_FLAG_BOOT_VGA);
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_gpu_kms_is_platform_device (MetaGpuKms *gpu_kms)
|
||||
{
|
||||
return !!(gpu_kms->flags & META_GPU_KMS_FLAG_PLATFORM_DEVICE);
|
||||
}
|
||||
|
||||
static void
|
||||
free_resources (MetaGpuKms *gpu_kms)
|
||||
{
|
||||
@ -897,6 +911,7 @@ meta_gpu_kms_can_have_outputs (MetaGpuKms *gpu_kms)
|
||||
MetaGpuKms *
|
||||
meta_gpu_kms_new (MetaMonitorManagerKms *monitor_manager_kms,
|
||||
const char *kms_file_path,
|
||||
MetaGpuKmsFlag flags,
|
||||
GError **error)
|
||||
{
|
||||
MetaMonitorManager *monitor_manager =
|
||||
@ -917,6 +932,7 @@ meta_gpu_kms_new (MetaMonitorManagerKms *monitor_manager_kms,
|
||||
"monitor-manager", monitor_manager_kms,
|
||||
NULL);
|
||||
|
||||
gpu_kms->flags = flags;
|
||||
gpu_kms->fd = kms_fd;
|
||||
gpu_kms->file_path = g_strdup (kms_file_path);
|
||||
|
||||
|
@ -44,8 +44,16 @@ typedef struct _MetaKmsResources
|
||||
|
||||
typedef void (*MetaKmsFlipCallback) (void *user_data);
|
||||
|
||||
typedef enum _MetaGpuKmsFlag
|
||||
{
|
||||
META_GPU_KMS_FLAG_NONE = 0,
|
||||
META_GPU_KMS_FLAG_BOOT_VGA = (1 << 0),
|
||||
META_GPU_KMS_FLAG_PLATFORM_DEVICE = (1 << 1),
|
||||
} MetaGpuKmsFlag;
|
||||
|
||||
MetaGpuKms * meta_gpu_kms_new (MetaMonitorManagerKms *monitor_manager_kms,
|
||||
const char *kms_file_path,
|
||||
MetaGpuKmsFlag flags,
|
||||
GError **error);
|
||||
|
||||
gboolean meta_gpu_kms_apply_crtc_mode (MetaGpuKms *gpu_kms,
|
||||
@ -59,6 +67,9 @@ gboolean meta_gpu_kms_can_have_outputs (MetaGpuKms *gpu_kms);
|
||||
gboolean meta_gpu_kms_is_crtc_active (MetaGpuKms *gpu_kms,
|
||||
MetaCrtc *crtc);
|
||||
|
||||
gboolean meta_gpu_kms_is_boot_vga (MetaGpuKms *gpu_kms);
|
||||
gboolean meta_gpu_kms_is_platform_device (MetaGpuKms *gpu_kms);
|
||||
|
||||
gboolean meta_gpu_kms_flip_crtc (MetaGpuKms *gpu_kms,
|
||||
MetaCrtc *crtc,
|
||||
int x,
|
||||
|
@ -418,7 +418,8 @@ handle_gpu_hotplug (MetaMonitorManagerKms *manager_kms,
|
||||
}
|
||||
}
|
||||
|
||||
gpu_kms = meta_gpu_kms_new (manager_kms, gpu_path, &error);
|
||||
gpu_kms = meta_gpu_kms_new (manager_kms, gpu_path,
|
||||
META_GPU_KMS_FLAG_NONE, &error);
|
||||
if (!gpu_kms)
|
||||
{
|
||||
g_warning ("Failed to hotplug secondary gpu '%s': %s",
|
||||
@ -729,6 +730,7 @@ meta_monitor_manager_kms_initable_init (GInitable *initable,
|
||||
primary_gpu_path = g_strdup (gpu_paths->data);
|
||||
manager_kms->primary_gpu = meta_gpu_kms_new (manager_kms,
|
||||
primary_gpu_path,
|
||||
META_GPU_KMS_FLAG_NONE,
|
||||
error);
|
||||
g_list_free_full (gpu_paths, g_free);
|
||||
if (!manager_kms->primary_gpu)
|
||||
@ -746,7 +748,9 @@ meta_monitor_manager_kms_initable_init (GInitable *initable,
|
||||
char *gpu_path = l->data;
|
||||
MetaGpuKms *gpu_kms;
|
||||
|
||||
gpu_kms = meta_gpu_kms_new (manager_kms, gpu_path, &secondary_error);
|
||||
gpu_kms = meta_gpu_kms_new (manager_kms, gpu_path,
|
||||
META_GPU_KMS_FLAG_NONE,
|
||||
&secondary_error);
|
||||
if (!gpu_kms)
|
||||
{
|
||||
g_warning ("Failed to open secondary gpu '%s': %s",
|
||||
|
Loading…
Reference in New Issue
Block a user