From 8a03f1ad0210ac9461d1723831e41eb656c06000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Sat, 7 Jul 2018 15:28:41 +0200 Subject: [PATCH] Always generate meta-default-modes.h This adds a hard requirement on having cvt installed, which in the past was soft, where the generated file was added to the repository. --- configure.ac | 3 ++ src/Makefile.am | 6 +-- src/backends/native/gen-default-modes.py | 19 ++++++-- src/backends/native/meta-default-modes.h | 57 ------------------------ src/backends/native/meta-gpu-kms.c | 3 +- src/backends/native/meta-output-kms.c | 3 +- 6 files changed, 26 insertions(+), 65 deletions(-) mode change 100644 => 100755 src/backends/native/gen-default-modes.py delete mode 100644 src/backends/native/meta-default-modes.h diff --git a/configure.ac b/configure.ac index ef92f5ecb..97cdac859 100644 --- a/configure.ac +++ b/configure.ac @@ -445,6 +445,9 @@ AC_CHECK_DECL([GL_EXT_x11_sync_object], [#include ]) AC_PATH_PROG([CVT],[cvt],[]) +if test x"$CVT" = xno; then + AC_MSG_ERROR([cvt not found in your path]) +fi #### Warnings (last since -Werror can disturb other tests) diff --git a/src/Makefile.am b/src/Makefile.am index 811e2b86b..5e7543711 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -51,6 +51,7 @@ mutter_built_sources = \ $(dbus_login1_built_sources) \ meta/meta-enum-types.h \ meta-enum-types.c \ + meta-default-modes.h \ $(NULL) if HAVE_REMOTE_DESKTOP @@ -505,7 +506,6 @@ libmutter_@LIBMUTTER_API_VERSION@_la_SOURCES += \ backends/native/meta-clutter-backend-native.h \ backends/native/meta-cursor-renderer-native.c \ backends/native/meta-cursor-renderer-native.h \ - backends/native/meta-default-modes.h \ backends/native/meta-gpu-kms.c \ backends/native/meta-gpu-kms.h \ backends/native/meta-input-settings-native.c \ @@ -760,10 +760,10 @@ $(dbus_login1_built_sources) : Makefile.am org.freedesktop.login1.xml --c-generate-autocleanup all \ $(srcdir)/org.freedesktop.login1.xml -backends/native/meta-default-modes.h: backends/native/gen-default-modes.py Makefile.am +meta-default-modes.h: backends/native/gen-default-modes.py Makefile.am @if test -n "$(CVT)"; then \ if $(AM_V_P); then PS4= set -x; else echo " GEN $@"; fi; \ - python $< > $@; \ + $(top_srcdir)/src/backends/native/gen-default-modes.py $@; \ fi .SECONDEXPANSION: diff --git a/src/backends/native/gen-default-modes.py b/src/backends/native/gen-default-modes.py old mode 100644 new mode 100755 index a94f44b50..304cd0303 --- a/src/backends/native/gen-default-modes.py +++ b/src/backends/native/gen-default-modes.py @@ -1,3 +1,5 @@ +#!/usr/bin/python3 + # Copyright (C) 2016 Red Hat Inc. # # This program is free software; you can redistribute it and/or @@ -18,6 +20,10 @@ import os import sys +if len(sys.argv) != 2: + print("Usage: %s [output file]"%sys.argv[0]) + exit(1) + common_resolutions = [ # 4:3 (800, 600), @@ -109,6 +115,13 @@ for resolution in common_resolutions: cvt.close() output_lines.append("};") -for line in output_lines: - sys.stdout.write(line + "\n") -sys.stdout.flush() +try: + output_file = open(sys.argv[1], 'w') + + for line in output_lines: + output_file.write(line + "\n") + output_file.flush() + output_file.close() +except: + print("Failed to generate modelines:", sys.exc_info()[0]) + exit(1) diff --git a/src/backends/native/meta-default-modes.h b/src/backends/native/meta-default-modes.h deleted file mode 100644 index 8b45f9f0c..000000000 --- a/src/backends/native/meta-default-modes.h +++ /dev/null @@ -1,57 +0,0 @@ -/* Generated by gen-default-modes.py */ - -static const drmModeModeInfo meta_default_landscape_drm_mode_infos[] = { -{ 38250, 800, 832, 912, 1024, 0, 600, 603, 607, 624, 0, 0, DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC, DRM_MODE_TYPE_DEFAULT, "800x600_60.00" }, -{ 63500, 1024, 1072, 1176, 1328, 0, 768, 771, 775, 798, 0, 0, DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC, DRM_MODE_TYPE_DEFAULT, "1024x768_60.00" }, -{ 81750, 1152, 1216, 1336, 1520, 0, 864, 867, 871, 897, 0, 0, DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC, DRM_MODE_TYPE_DEFAULT, "1152x864_60.00" }, -{ 101250, 1280, 1360, 1488, 1696, 0, 960, 963, 967, 996, 0, 0, DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC, DRM_MODE_TYPE_DEFAULT, "1280x960_60.00" }, -{ 121750, 1400, 1488, 1632, 1864, 0, 1050, 1053, 1057, 1089, 0, 0, DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC, DRM_MODE_TYPE_DEFAULT, "1400x1050_60.00" }, -{ 129000, 1440, 1528, 1680, 1920, 0, 1080, 1083, 1087, 1120, 0, 0, DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC, DRM_MODE_TYPE_DEFAULT, "1440x1080_60.00" }, -{ 161000, 1600, 1712, 1880, 2160, 0, 1200, 1203, 1207, 1245, 0, 0, DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC, DRM_MODE_TYPE_DEFAULT, "1600x1200_60.00" }, -{ 233500, 1920, 2064, 2264, 2608, 0, 1440, 1443, 1447, 1493, 0, 0, DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC, DRM_MODE_TYPE_DEFAULT, "1920x1440_60.00" }, -{ 267250, 2048, 2208, 2424, 2800, 0, 1536, 1539, 1543, 1592, 0, 0, DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC, DRM_MODE_TYPE_DEFAULT, "2048x1536_60.00" }, -{ 83500, 1280, 1352, 1480, 1680, 0, 800, 803, 809, 831, 0, 0, DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC, DRM_MODE_TYPE_DEFAULT, "1280x800_60.00" }, -{ 106500, 1440, 1528, 1672, 1904, 0, 900, 903, 909, 934, 0, 0, DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC, DRM_MODE_TYPE_DEFAULT, "1440x900_60.00" }, -{ 146250, 1680, 1784, 1960, 2240, 0, 1050, 1053, 1059, 1089, 0, 0, DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC, DRM_MODE_TYPE_DEFAULT, "1680x1050_60.00" }, -{ 193250, 1920, 2056, 2256, 2592, 0, 1200, 1203, 1209, 1245, 0, 0, DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC, DRM_MODE_TYPE_DEFAULT, "1920x1200_60.00" }, -{ 348500, 2560, 2760, 3032, 3504, 0, 1600, 1603, 1609, 1658, 0, 0, DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC, DRM_MODE_TYPE_DEFAULT, "2560x1600_60.00" }, -{ 74500, 1280, 1344, 1472, 1664, 0, 720, 723, 728, 748, 0, 0, DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC, DRM_MODE_TYPE_DEFAULT, "1280x720_60.00" }, -{ 85250, 1368, 1440, 1576, 1784, 0, 768, 771, 781, 798, 0, 0, DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC, DRM_MODE_TYPE_DEFAULT, "1368x768_60.00" }, -{ 118250, 1600, 1696, 1856, 2112, 0, 900, 903, 908, 934, 0, 0, DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC, DRM_MODE_TYPE_DEFAULT, "1600x900_60.00" }, -{ 173000, 1920, 2048, 2248, 2576, 0, 1080, 1083, 1088, 1120, 0, 0, DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC, DRM_MODE_TYPE_DEFAULT, "1920x1080_60.00" }, -{ 197000, 2048, 2184, 2400, 2752, 0, 1152, 1155, 1160, 1195, 0, 0, DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC, DRM_MODE_TYPE_DEFAULT, "2048x1152_60.00" }, -{ 312250, 2560, 2752, 3024, 3488, 0, 1440, 1443, 1448, 1493, 0, 0, DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC, DRM_MODE_TYPE_DEFAULT, "2560x1440_60.00" }, -{ 396250, 2880, 3096, 3408, 3936, 0, 1620, 1623, 1628, 1679, 0, 0, DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC, DRM_MODE_TYPE_DEFAULT, "2880x1620_60.00" }, -{ 492000, 3200, 3456, 3800, 4400, 0, 1800, 1803, 1808, 1865, 0, 0, DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC, DRM_MODE_TYPE_DEFAULT, "3200x1800_60.00" }, -{ 712750, 3840, 4160, 4576, 5312, 0, 2160, 2163, 2168, 2237, 0, 0, DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC, DRM_MODE_TYPE_DEFAULT, "3840x2160_60.00" }, -{ 813000, 4096, 4440, 4888, 5680, 0, 2304, 2307, 2312, 2386, 0, 0, DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC, DRM_MODE_TYPE_DEFAULT, "4096x2304_60.00" }, -{ 1276500, 5120, 5560, 6128, 7136, 0, 2880, 2883, 2888, 2982, 0, 0, DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC, DRM_MODE_TYPE_DEFAULT, "5120x2880_60.00" }, -}; - -static const drmModeModeInfo meta_default_portrait_drm_mode_infos[] = { -{ 38250, 600, 603, 607, 624, 0, 800, 832, 912, 1024, 0, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC, DRM_MODE_TYPE_DEFAULT, "600x800_60.00" }, -{ 63500, 768, 771, 775, 798, 0, 1024, 1072, 1176, 1328, 0, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC, DRM_MODE_TYPE_DEFAULT, "768x1024_60.00" }, -{ 81750, 864, 867, 871, 897, 0, 1152, 1216, 1336, 1520, 0, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC, DRM_MODE_TYPE_DEFAULT, "864x1152_60.00" }, -{ 101250, 960, 963, 967, 996, 0, 1280, 1360, 1488, 1696, 0, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC, DRM_MODE_TYPE_DEFAULT, "960x1280_60.00" }, -{ 121750, 1050, 1053, 1057, 1089, 0, 1400, 1488, 1632, 1864, 0, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC, DRM_MODE_TYPE_DEFAULT, "1050x1400_60.00" }, -{ 129000, 1080, 1083, 1087, 1120, 0, 1440, 1528, 1680, 1920, 0, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC, DRM_MODE_TYPE_DEFAULT, "1080x1440_60.00" }, -{ 161000, 1200, 1203, 1207, 1245, 0, 1600, 1712, 1880, 2160, 0, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC, DRM_MODE_TYPE_DEFAULT, "1200x1600_60.00" }, -{ 233500, 1440, 1443, 1447, 1493, 0, 1920, 2064, 2264, 2608, 0, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC, DRM_MODE_TYPE_DEFAULT, "1440x1920_60.00" }, -{ 267250, 1536, 1539, 1543, 1592, 0, 2048, 2208, 2424, 2800, 0, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC, DRM_MODE_TYPE_DEFAULT, "1536x2048_60.00" }, -{ 83500, 800, 803, 809, 831, 0, 1280, 1352, 1480, 1680, 0, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC, DRM_MODE_TYPE_DEFAULT, "800x1280_60.00" }, -{ 106500, 900, 903, 909, 934, 0, 1440, 1528, 1672, 1904, 0, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC, DRM_MODE_TYPE_DEFAULT, "900x1440_60.00" }, -{ 146250, 1050, 1053, 1059, 1089, 0, 1680, 1784, 1960, 2240, 0, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC, DRM_MODE_TYPE_DEFAULT, "1050x1680_60.00" }, -{ 193250, 1200, 1203, 1209, 1245, 0, 1920, 2056, 2256, 2592, 0, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC, DRM_MODE_TYPE_DEFAULT, "1200x1920_60.00" }, -{ 348500, 1600, 1603, 1609, 1658, 0, 2560, 2760, 3032, 3504, 0, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC, DRM_MODE_TYPE_DEFAULT, "1600x2560_60.00" }, -{ 74500, 720, 723, 728, 748, 0, 1280, 1344, 1472, 1664, 0, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC, DRM_MODE_TYPE_DEFAULT, "720x1280_60.00" }, -{ 85250, 768, 771, 781, 798, 0, 1368, 1440, 1576, 1784, 0, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC, DRM_MODE_TYPE_DEFAULT, "768x1368_60.00" }, -{ 118250, 900, 903, 908, 934, 0, 1600, 1696, 1856, 2112, 0, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC, DRM_MODE_TYPE_DEFAULT, "900x1600_60.00" }, -{ 173000, 1080, 1083, 1088, 1120, 0, 1920, 2048, 2248, 2576, 0, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC, DRM_MODE_TYPE_DEFAULT, "1080x1920_60.00" }, -{ 197000, 1152, 1155, 1160, 1195, 0, 2048, 2184, 2400, 2752, 0, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC, DRM_MODE_TYPE_DEFAULT, "1152x2048_60.00" }, -{ 312250, 1440, 1443, 1448, 1493, 0, 2560, 2752, 3024, 3488, 0, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC, DRM_MODE_TYPE_DEFAULT, "1440x2560_60.00" }, -{ 396250, 1620, 1623, 1628, 1679, 0, 2880, 3096, 3408, 3936, 0, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC, DRM_MODE_TYPE_DEFAULT, "1620x2880_60.00" }, -{ 492000, 1800, 1803, 1808, 1865, 0, 3200, 3456, 3800, 4400, 0, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC, DRM_MODE_TYPE_DEFAULT, "1800x3200_60.00" }, -{ 712750, 2160, 2163, 2168, 2237, 0, 3840, 4160, 4576, 5312, 0, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC, DRM_MODE_TYPE_DEFAULT, "2160x3840_60.00" }, -{ 813000, 2304, 2307, 2312, 2386, 0, 4096, 4440, 4888, 5680, 0, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC, DRM_MODE_TYPE_DEFAULT, "2304x4096_60.00" }, -{ 1276500, 2880, 2883, 2888, 2982, 0, 5120, 5560, 6128, 7136, 0, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC, DRM_MODE_TYPE_DEFAULT, "2880x5120_60.00" }, -}; diff --git a/src/backends/native/meta-gpu-kms.c b/src/backends/native/meta-gpu-kms.c index 53a540b84..57582f699 100644 --- a/src/backends/native/meta-gpu-kms.c +++ b/src/backends/native/meta-gpu-kms.c @@ -38,7 +38,8 @@ #include "backends/native/meta-crtc-kms.h" #include "backends/native/meta-launcher.h" #include "backends/native/meta-output-kms.h" -#include "backends/native/meta-default-modes.h" + +#include "meta-default-modes.h" typedef struct _MetaKmsSource { diff --git a/src/backends/native/meta-output-kms.c b/src/backends/native/meta-output-kms.c index f33f65dc7..2e870658c 100644 --- a/src/backends/native/meta-output-kms.c +++ b/src/backends/native/meta-output-kms.c @@ -29,7 +29,8 @@ #include "backends/meta-crtc.h" #include "backends/native/meta-crtc-kms.h" -#include "backends/native/meta-default-modes.h" + +#include "meta-default-modes.h" #define SYNC_TOLERANCE 0.01 /* 1 percent */