[mutter] backends: Rename MetaMonitorMode to MetaCrtcMode



commit 0873e3812b5e373033178e0266d8b9a371a5a7c9
Author: Jonas Ådahl <jadahl gmail com>
Date:   Fri Dec 9 15:49:54 2016 +0800

    backends: Rename MetaMonitorMode to MetaCrtcMode
    
    The MetaMonitorMode referred to the mode of a CRTC, and with the future
    introduction of a MetaMonitor, theh old name would be confusing.
    Instead call it what it is.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=777732

 src/backends/meta-monitor-config.c             |    4 +-
 src/backends/meta-monitor-manager-dummy.c      |    6 ++--
 src/backends/meta-monitor-manager-private.h    |   18 +++++++-------
 src/backends/meta-monitor-manager.c            |   20 ++++++++--------
 src/backends/native/meta-monitor-manager-kms.c |   30 ++++++++++++-----------
 src/backends/x11/meta-monitor-manager-xrandr.c |    8 +++---
 src/tests/meta-monitor-manager-test.c          |    2 +-
 src/tests/meta-monitor-manager-test.h          |    2 +-
 src/tests/monitor-unit-tests.c                 |   12 ++++----
 9 files changed, 52 insertions(+), 50 deletions(-)
---
diff --git a/src/backends/meta-monitor-config.c b/src/backends/meta-monitor-config.c
index 58c38f7..e0ee771 100644
--- a/src/backends/meta-monitor-config.c
+++ b/src/backends/meta-monitor-config.c
@@ -1804,7 +1804,7 @@ crtc_can_drive_output (MetaCrtc   *crtc,
 static gboolean
 crtc_assignment_assign (CrtcAssignment       *assign,
                        MetaCrtc             *crtc,
-                       MetaMonitorMode      *mode,
+                       MetaCrtcMode         *mode,
                        int                   x,
                        int                   y,
                        MetaMonitorTransform  transform,
@@ -1938,7 +1938,7 @@ real_assign_crtcs (CrtcAssignment     *assignment,
 
           for (j = 0; j < output->n_modes; j++)
            {
-              MetaMonitorMode *mode = output->modes[j];
+              MetaCrtcMode *mode = output->modes[j];
               int width, height;
 
               if (meta_monitor_transform_is_rotated (output_config->transform))
diff --git a/src/backends/meta-monitor-manager-dummy.c b/src/backends/meta-monitor-manager-dummy.c
index 0f7db35..bf17b47 100644
--- a/src/backends/meta-monitor-manager-dummy.c
+++ b/src/backends/meta-monitor-manager-dummy.c
@@ -113,7 +113,7 @@ meta_monitor_manager_dummy_read_current (MetaMonitorManager *manager)
   manager->screen_width = 1024 * num_monitors;
   manager->screen_height = 768;
 
-  manager->modes = g_new0 (MetaMonitorMode, 1);
+  manager->modes = g_new0 (MetaCrtcMode, 1);
   manager->n_modes = 1;
 
   manager->modes[0].mode_id = 0;
@@ -154,7 +154,7 @@ meta_monitor_manager_dummy_read_current (MetaMonitorManager *manager)
       manager->outputs[i].subpixel_order = COGL_SUBPIXEL_ORDER_UNKNOWN;
       manager->outputs[i].preferred_mode = &manager->modes[0];
       manager->outputs[i].n_modes = 1;
-      manager->outputs[i].modes = g_new0 (MetaMonitorMode *, 1);
+      manager->outputs[i].modes = g_new0 (MetaCrtcMode *, 1);
       manager->outputs[i].modes[0] = &manager->modes[0];
       manager->outputs[i].n_possible_crtcs = 1;
       manager->outputs[i].possible_crtcs = g_new0 (MetaCrtc *, 1);
@@ -195,7 +195,7 @@ meta_monitor_manager_dummy_apply_config (MetaMonitorManager *manager,
         }
       else
         {
-          MetaMonitorMode *mode;
+          MetaCrtcMode *mode;
           MetaOutput *output;
           unsigned int j;
           int width, height;
diff --git a/src/backends/meta-monitor-manager-private.h b/src/backends/meta-monitor-manager-private.h
index 05c63a3..16b59c6 100644
--- a/src/backends/meta-monitor-manager-private.h
+++ b/src/backends/meta-monitor-manager-private.h
@@ -54,7 +54,7 @@ typedef struct _MetaLogicalMonitor MetaLogicalMonitor;
 
 typedef struct _MetaCrtc MetaCrtc;
 typedef struct _MetaOutput MetaOutput;
-typedef struct _MetaMonitorMode MetaMonitorMode;
+typedef struct _MetaCrtcMode MetaCrtcMode;
 typedef struct _MetaCrtcInfo MetaCrtcInfo;
 typedef struct _MetaOutputInfo MetaOutputInfo;
 typedef struct _MetaTileInfo MetaTileInfo;
@@ -124,8 +124,8 @@ struct _MetaOutput
 
   MetaConnectorType connector_type;
 
-  MetaMonitorMode *preferred_mode;
-  MetaMonitorMode **modes;
+  MetaCrtcMode *preferred_mode;
+  MetaCrtcMode **modes;
   unsigned int n_modes;
 
   MetaCrtc **possible_crtcs;
@@ -168,7 +168,7 @@ struct _MetaCrtc
 {
   glong crtc_id;
   MetaRectangle rect;
-  MetaMonitorMode *current_mode;
+  MetaCrtcMode *current_mode;
   MetaMonitorTransform transform;
   unsigned int all_transforms;
 
@@ -187,7 +187,7 @@ struct _MetaCrtc
   GDestroyNotify driver_notify;
 };
 
-struct _MetaMonitorMode
+struct _MetaCrtcMode
 {
   /* The low-level ID of this mode, used to apply back configuration */
   glong mode_id;
@@ -253,7 +253,7 @@ struct _MetaLogicalMonitor
  */
 struct _MetaCrtcInfo {
   MetaCrtc                 *crtc;
-  MetaMonitorMode          *mode;
+  MetaCrtcMode             *mode;
   int                       x;
   int                       y;
   MetaMonitorTransform      transform;
@@ -306,7 +306,7 @@ struct _MetaMonitorManager
   MetaOutput *outputs;
   unsigned int n_outputs;
 
-  MetaMonitorMode *modes;
+  MetaCrtcMode *modes;
   unsigned int n_modes;
 
   MetaCrtc *crtcs;
@@ -394,7 +394,7 @@ MetaOutput         *meta_monitor_manager_get_outputs       (MetaMonitorManager *
                                                            unsigned int       *n_outputs);
 
 void                meta_monitor_manager_get_resources     (MetaMonitorManager  *manager,
-                                                            MetaMonitorMode    **modes,
+                                                            MetaCrtcMode       **modes,
                                                             unsigned int        *n_modes,
                                                             MetaCrtc           **crtcs,
                                                             unsigned int        *n_crtcs,
@@ -434,7 +434,7 @@ gboolean           meta_monitor_manager_get_monitor_matrix (MetaMonitorManager *
                                                             gfloat              matrix[6]);
 
 void meta_monitor_manager_clear_output (MetaOutput *output);
-void meta_monitor_manager_clear_mode (MetaMonitorMode *mode);
+void meta_monitor_manager_clear_mode (MetaCrtcMode *mode);
 void meta_monitor_manager_clear_crtc (MetaCrtc *crtc);
 
 /* Returns true if transform causes width and height to be inverted
diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c
index 68e0abf..2f9efaa 100644
--- a/src/backends/meta-monitor-manager.c
+++ b/src/backends/meta-monitor-manager.c
@@ -406,7 +406,7 @@ meta_monitor_manager_free_output_array (MetaOutput *old_outputs,
 }
 
 void
-meta_monitor_manager_clear_mode (MetaMonitorMode *mode)
+meta_monitor_manager_clear_mode (MetaCrtcMode *mode)
 {
   g_free (mode->name);
 
@@ -417,8 +417,8 @@ meta_monitor_manager_clear_mode (MetaMonitorMode *mode)
 }
 
 static void
-meta_monitor_manager_free_mode_array (MetaMonitorMode *old_modes,
-                                      int              n_old_modes)
+meta_monitor_manager_free_mode_array (MetaCrtcMode *old_modes,
+                                      int           n_old_modes)
 {
   int i;
 
@@ -742,7 +742,7 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton,
 
   for (i = 0; i < manager->n_modes; i++)
     {
-      MetaMonitorMode *mode = &manager->modes[i];
+      MetaCrtcMode *mode = &manager->modes[i];
 
       g_variant_builder_add (&mode_builder, "(uxuudu)",
                              i, /* ID */
@@ -765,9 +765,9 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton,
 }
 
 static gboolean
-output_can_config (MetaOutput      *output,
-                   MetaCrtc        *crtc,
-                   MetaMonitorMode *mode)
+output_can_config (MetaOutput   *output,
+                   MetaCrtc     *crtc,
+                   MetaCrtcMode *mode)
 {
   unsigned int i;
   gboolean ok = FALSE;
@@ -865,7 +865,7 @@ meta_monitor_manager_handle_apply_configuration  (MetaDBusDisplayConfig *skeleto
       MetaCrtcInfo *crtc_info;
       MetaOutput *first_output;
       MetaCrtc *crtc;
-      MetaMonitorMode *mode;
+      MetaCrtcMode *mode;
 
       crtc_info = g_slice_new (MetaCrtcInfo);
       crtc_info->outputs = g_ptr_array_new ();
@@ -1457,7 +1457,7 @@ meta_monitor_manager_get_outputs (MetaMonitorManager *manager,
 
 void
 meta_monitor_manager_get_resources (MetaMonitorManager  *manager,
-                                    MetaMonitorMode    **modes,
+                                    MetaCrtcMode       **modes,
                                     unsigned int        *n_modes,
                                     MetaCrtc           **crtcs,
                                     unsigned int        *n_crtcs,
@@ -1504,7 +1504,7 @@ meta_monitor_manager_read_current_config (MetaMonitorManager *manager)
 {
   MetaOutput *old_outputs;
   MetaCrtc *old_crtcs;
-  MetaMonitorMode *old_modes;
+  MetaCrtcMode *old_modes;
   unsigned int n_old_outputs, n_old_crtcs, n_old_modes;
 
   /* Some implementations of read_current use the existing information
diff --git a/src/backends/native/meta-monitor-manager-kms.c b/src/backends/native/meta-monitor-manager-kms.c
index e714c73..a7912ed 100644
--- a/src/backends/native/meta-monitor-manager-kms.c
+++ b/src/backends/native/meta-monitor-manager-kms.c
@@ -187,9 +187,9 @@ meta_output_destroy_notify (MetaOutput *output)
 }
 
 static void
-meta_monitor_mode_destroy_notify (MetaMonitorMode *output)
+meta_monitor_mode_destroy_notify (MetaCrtcMode *mode)
 {
-  g_slice_free (drmModeModeInfo, output->driver_private);
+  g_slice_free (drmModeModeInfo, mode->driver_private);
 }
 
 static void
@@ -384,7 +384,7 @@ output_get_tile_info (MetaMonitorManagerKms *manager_kms,
     }
 }
 
-static MetaMonitorMode *
+static MetaCrtcMode *
 find_meta_mode (MetaMonitorManager    *manager,
                 const drmModeModeInfo *drm_mode)
 {
@@ -419,7 +419,7 @@ drm_mode_vrefresh (const drmModeModeInfo *mode)
 }
 
 static void
-init_mode (MetaMonitorMode       *mode,
+init_mode (MetaCrtcMode          *mode,
            const drmModeModeInfo *drm_mode,
            long                   mode_id)
 {
@@ -437,8 +437,8 @@ static int
 compare_modes (const void *one,
                const void *two)
 {
-  MetaMonitorMode *a = *(MetaMonitorMode **) one;
-  MetaMonitorMode *b = *(MetaMonitorMode **) two;
+  MetaCrtcMode *a = *(MetaCrtcMode **) one;
+  MetaCrtcMode *b = *(MetaCrtcMode **) two;
 
   if (a->width != b->width)
     return a->width > b->width ? -1 : 1;
@@ -696,8 +696,10 @@ add_common_modes (MetaMonitorManager *manager,
       g_ptr_array_add (array, find_meta_mode (manager, mode));
     }
 
-  output->modes = g_renew (MetaMonitorMode *, output->modes, output->n_modes + array->len);
-  memcpy (output->modes + output->n_modes, array->pdata, array->len * sizeof (MetaMonitorMode *));
+  output->modes = g_renew (MetaCrtcMode *, output->modes,
+                           output->n_modes + array->len);
+  memcpy (output->modes + output->n_modes, array->pdata,
+          array->len * sizeof (MetaCrtcMode *));
   output->n_modes += array->len;
 
   g_ptr_array_free (array, TRUE);
@@ -783,7 +785,7 @@ init_output (MetaOutput         *output,
 
   output->preferred_mode = NULL;
   output->n_modes = connector->count_modes;
-  output->modes = g_new0 (MetaMonitorMode *, output->n_modes);
+  output->modes = g_new0 (MetaCrtcMode *, output->n_modes);
   for (i = 0; i < output->n_modes; i++) {
       output->modes[i] = find_meta_mode (manager, &connector->modes[i]);
       if (connector->modes[i].type & DRM_MODE_TYPE_PREFERRED)
@@ -803,7 +805,7 @@ init_output (MetaOutput         *output,
   if (output_kms->has_scaling)
     add_common_modes (manager, output);
 
-  qsort (output->modes, output->n_modes, sizeof (MetaMonitorMode *), compare_modes);
+  qsort (output->modes, output->n_modes, sizeof (MetaCrtcMode *), compare_modes);
 
   output_kms->n_encoders = connector->count_encoders;
   output_kms->encoders = g_new0 (drmModeEncoderPtr, output_kms->n_encoders);
@@ -1037,13 +1039,13 @@ init_modes (MetaMonitorManager *manager,
     }
 
   manager->n_modes = g_hash_table_size (modes) + G_N_ELEMENTS (meta_default_drm_mode_infos);
-  manager->modes = g_new0 (MetaMonitorMode, manager->n_modes);
+  manager->modes = g_new0 (MetaCrtcMode, manager->n_modes);
 
   g_hash_table_iter_init (&iter, modes);
   mode_id = 0;
   while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &drm_mode))
     {
-      MetaMonitorMode *mode;
+      MetaCrtcMode *mode;
 
       mode = &manager->modes[mode_id];
       init_mode (mode, drm_mode, (long) mode_id);
@@ -1055,7 +1057,7 @@ init_modes (MetaMonitorManager *manager,
 
   for (i = 0; i < G_N_ELEMENTS (meta_default_drm_mode_infos); i++)
     {
-      MetaMonitorMode *mode;
+      MetaCrtcMode *mode;
 
       mode = &manager->modes[mode_id];
       init_mode (mode, &meta_default_drm_mode_infos[i], (long) mode_id);
@@ -1312,7 +1314,7 @@ meta_monitor_manager_kms_apply_configuration (MetaMonitorManager *manager,
         }
       else
         {
-          MetaMonitorMode *mode;
+          MetaCrtcMode *mode;
           unsigned int j;
           int width, height;
 
diff --git a/src/backends/x11/meta-monitor-manager-xrandr.c b/src/backends/x11/meta-monitor-manager-xrandr.c
index 8eb30f1..8bddbe5 100644
--- a/src/backends/x11/meta-monitor-manager-xrandr.c
+++ b/src/backends/x11/meta-monitor-manager-xrandr.c
@@ -639,7 +639,7 @@ output_get_modes (MetaMonitorManager *manager,
   guint j, k;
   guint n_actual_modes;
 
-  meta_output->modes = g_new0 (MetaMonitorMode *, output->nmode);
+  meta_output->modes = g_new0 (MetaCrtcMode *, output->nmode);
 
   n_actual_modes = 0;
   for (j = 0; j < (guint)output->nmode; j++)
@@ -773,13 +773,13 @@ meta_monitor_manager_xrandr_read_current (MetaMonitorManager *manager)
   manager->n_crtcs = resources->ncrtc;
   manager->n_modes = resources->nmode;
   manager->outputs = g_new0 (MetaOutput, manager->n_outputs);
-  manager->modes = g_new0 (MetaMonitorMode, manager->n_modes);
+  manager->modes = g_new0 (MetaCrtcMode, manager->n_modes);
   manager->crtcs = g_new0 (MetaCrtc, manager->n_crtcs);
 
   for (i = 0; i < (unsigned)resources->nmode; i++)
     {
       XRRModeInfo *xmode = &resources->modes[i];
-      MetaMonitorMode *mode;
+      MetaCrtcMode *mode;
 
       mode = &manager->modes[i];
 
@@ -1160,7 +1160,7 @@ meta_monitor_manager_xrandr_apply_configuration (MetaMonitorManager *manager,
 
       if (crtc_info->mode != NULL)
         {
-          MetaMonitorMode *mode;
+          MetaCrtcMode *mode;
           g_autofree XID *output_ids = NULL;
           unsigned int j, n_output_ids;
           Status ok;
diff --git a/src/tests/meta-monitor-manager-test.c b/src/tests/meta-monitor-manager-test.c
index d5560b6..6d100d8 100644
--- a/src/tests/meta-monitor-manager-test.c
+++ b/src/tests/meta-monitor-manager-test.c
@@ -101,7 +101,7 @@ meta_monitor_manager_test_apply_configuration (MetaMonitorManager *manager,
         }
       else
         {
-          MetaMonitorMode *mode;
+          MetaCrtcMode *mode;
           MetaOutput *output;
           unsigned int j;
           int width, height;
diff --git a/src/tests/meta-monitor-manager-test.h b/src/tests/meta-monitor-manager-test.h
index 32eb77d..fe6ef84 100644
--- a/src/tests/meta-monitor-manager-test.h
+++ b/src/tests/meta-monitor-manager-test.h
@@ -24,7 +24,7 @@
 
 typedef struct _MetaMonitorTestSetup
 {
-  MetaMonitorMode *modes;
+  MetaCrtcMode *modes;
   int n_modes;
   MetaOutput *outputs;
   int n_outputs;
diff --git a/src/tests/monitor-unit-tests.c b/src/tests/monitor-unit-tests.c
index 5dc0b05..ade1d91 100644
--- a/src/tests/monitor-unit-tests.c
+++ b/src/tests/monitor-unit-tests.c
@@ -202,10 +202,10 @@ create_monitor_test_setup (MonitorTestCase *test_case)
   test_setup = g_new0 (MetaMonitorTestSetup, 1);
 
   test_setup->n_modes = test_case->setup.n_modes;
-  test_setup->modes = g_new0 (MetaMonitorMode, test_setup->n_modes);
+  test_setup->modes = g_new0 (MetaCrtcMode, test_setup->n_modes);
   for (i = 0; i < test_setup->n_modes; i++)
     {
-      test_setup->modes[i] = (MetaMonitorMode) {
+      test_setup->modes[i] = (MetaCrtcMode) {
         .mode_id = i,
         .width = test_case->setup.modes[i].width,
         .height = test_case->setup.modes[i].height,
@@ -218,7 +218,7 @@ create_monitor_test_setup (MonitorTestCase *test_case)
   for (i = 0; i < test_setup->n_crtcs; i++)
     {
       int current_mode_index;
-      MetaMonitorMode *current_mode;
+      MetaCrtcMode *current_mode;
 
       current_mode_index = test_case->setup.crtcs[i].current_mode;
       if (current_mode_index == -1)
@@ -241,8 +241,8 @@ create_monitor_test_setup (MonitorTestCase *test_case)
       int crtc_index;
       MetaCrtc *crtc;
       int preferred_mode_index;
-      MetaMonitorMode *preferred_mode;
-      MetaMonitorMode **modes;
+      MetaCrtcMode *preferred_mode;
+      MetaCrtcMode **modes;
       int n_modes;
       int j;
       MetaCrtc **possible_crtcs;
@@ -262,7 +262,7 @@ create_monitor_test_setup (MonitorTestCase *test_case)
         preferred_mode = &test_setup->modes[preferred_mode_index];
 
       n_modes = test_case->setup.outputs[i].n_modes;
-      modes = g_new0 (MetaMonitorMode *, n_modes);
+      modes = g_new0 (MetaCrtcMode *, n_modes);
       for (j = 0; j < n_modes; j++)
         {
           int mode_index;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]