diff --git a/src/backends/native/meta-gpu-kms.c b/src/backends/native/meta-gpu-kms.c index 5b1ee107f..d768ae77c 100644 --- a/src/backends/native/meta-gpu-kms.c +++ b/src/backends/native/meta-gpu-kms.c @@ -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); diff --git a/src/backends/native/meta-gpu-kms.h b/src/backends/native/meta-gpu-kms.h index 21fb04605..ee1bb6443 100644 --- a/src/backends/native/meta-gpu-kms.h +++ b/src/backends/native/meta-gpu-kms.h @@ -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, diff --git a/src/backends/native/meta-monitor-manager-kms.c b/src/backends/native/meta-monitor-manager-kms.c index c04338aac..e681cd253 100644 --- a/src/backends/native/meta-monitor-manager-kms.c +++ b/src/backends/native/meta-monitor-manager-kms.c @@ -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",