MetaMonitor: Add mode spec concept
Add a "mode spec" concept, meaning to be used as a identifier for an actual monitor mode. It consists of details making a mode unique, i.e. the total resolution and refresh rate. This will later be used to get the actual monitor mode (set of one or more CRTC modes). https://bugzilla.gnome.org/show_bug.cgi?id=777732
This commit is contained in:
parent
0637537355
commit
5d9e2d8d2e
@ -28,9 +28,7 @@
|
|||||||
|
|
||||||
typedef struct _MetaMonitorMode
|
typedef struct _MetaMonitorMode
|
||||||
{
|
{
|
||||||
int width;
|
MetaMonitorModeSpec spec;
|
||||||
int height;
|
|
||||||
float refresh_rate;
|
|
||||||
MetaMonitorCrtcMode *crtc_modes;
|
MetaMonitorCrtcMode *crtc_modes;
|
||||||
} MetaMonitorMode;
|
} MetaMonitorMode;
|
||||||
|
|
||||||
@ -176,9 +174,11 @@ meta_monitor_normal_generate_modes (MetaMonitorNormal *monitor_normal)
|
|||||||
MetaMonitorMode *mode;
|
MetaMonitorMode *mode;
|
||||||
|
|
||||||
mode = g_new0 (MetaMonitorMode, 1);
|
mode = g_new0 (MetaMonitorMode, 1);
|
||||||
mode->width = crtc_mode->width;
|
mode->spec = (MetaMonitorModeSpec) {
|
||||||
mode->height = crtc_mode->height;
|
.width = crtc_mode->width,
|
||||||
mode->refresh_rate = crtc_mode->refresh_rate;
|
.height = crtc_mode->height,
|
||||||
|
.refresh_rate = crtc_mode->refresh_rate
|
||||||
|
},
|
||||||
mode->crtc_modes = g_new (MetaMonitorCrtcMode, 1);
|
mode->crtc_modes = g_new (MetaMonitorCrtcMode, 1);
|
||||||
mode->crtc_modes[0] = (MetaMonitorCrtcMode) {
|
mode->crtc_modes[0] = (MetaMonitorCrtcMode) {
|
||||||
.x = 0,
|
.x = 0,
|
||||||
@ -337,7 +337,8 @@ meta_monitor_tiled_generate_modes (MetaMonitorTiled *monitor_tiled)
|
|||||||
|
|
||||||
mode = g_new0 (MetaMonitorMode, 1);
|
mode = g_new0 (MetaMonitorMode, 1);
|
||||||
meta_monitor_tiled_calculate_tiled_size (monitor,
|
meta_monitor_tiled_calculate_tiled_size (monitor,
|
||||||
&mode->width, &mode->height);
|
&mode->spec.width,
|
||||||
|
&mode->spec.height);
|
||||||
mode->crtc_modes = g_new (MetaMonitorCrtcMode,
|
mode->crtc_modes = g_new (MetaMonitorCrtcMode,
|
||||||
g_list_length (monitor_priv->outputs));
|
g_list_length (monitor_priv->outputs));
|
||||||
for (l = monitor_priv->outputs, i = 0; l; l = l->next, i++)
|
for (l = monitor_priv->outputs, i = 0; l; l = l->next, i++)
|
||||||
@ -356,10 +357,11 @@ meta_monitor_tiled_generate_modes (MetaMonitorTiled *monitor_tiled)
|
|||||||
.crtc_mode = preferred_crtc_mode
|
.crtc_mode = preferred_crtc_mode
|
||||||
};
|
};
|
||||||
|
|
||||||
g_warn_if_fail (mode->refresh_rate == 0.0f ||
|
g_warn_if_fail (mode->spec.refresh_rate == 0.0f ||
|
||||||
mode->refresh_rate == preferred_crtc_mode->refresh_rate);
|
(mode->spec.refresh_rate ==
|
||||||
|
preferred_crtc_mode->refresh_rate));
|
||||||
|
|
||||||
mode->refresh_rate = preferred_crtc_mode->refresh_rate;
|
mode->spec.refresh_rate = preferred_crtc_mode->refresh_rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
monitor_priv->modes = g_list_append (monitor_priv->modes, mode);
|
monitor_priv->modes = g_list_append (monitor_priv->modes, mode);
|
||||||
@ -452,19 +454,25 @@ meta_monitor_get_modes (MetaMonitor *monitor)
|
|||||||
return priv->modes;
|
return priv->modes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MetaMonitorModeSpec *
|
||||||
|
meta_monitor_mode_get_spec (MetaMonitorMode *monitor_mode)
|
||||||
|
{
|
||||||
|
return &monitor_mode->spec;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_monitor_mode_get_resolution (MetaMonitorMode *monitor_mode,
|
meta_monitor_mode_get_resolution (MetaMonitorMode *monitor_mode,
|
||||||
int *width,
|
int *width,
|
||||||
int *height)
|
int *height)
|
||||||
{
|
{
|
||||||
*width = monitor_mode->width;
|
*width = monitor_mode->spec.width;
|
||||||
*height = monitor_mode->height;
|
*height = monitor_mode->spec.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
float
|
float
|
||||||
meta_monitor_mode_get_refresh_rate (MetaMonitorMode *monitor_mode)
|
meta_monitor_mode_get_refresh_rate (MetaMonitorMode *monitor_mode)
|
||||||
{
|
{
|
||||||
return monitor_mode->refresh_rate;
|
return monitor_mode->spec.refresh_rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -28,6 +28,13 @@
|
|||||||
|
|
||||||
typedef struct _MetaMonitorMode MetaMonitorMode;
|
typedef struct _MetaMonitorMode MetaMonitorMode;
|
||||||
|
|
||||||
|
typedef struct _MetaMonitorModeSpec
|
||||||
|
{
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
|
float refresh_rate;
|
||||||
|
} MetaMonitorModeSpec;
|
||||||
|
|
||||||
typedef struct _MetaMonitorCrtcMode
|
typedef struct _MetaMonitorCrtcMode
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
@ -91,6 +98,8 @@ uint32_t meta_monitor_tiled_get_tile_group_id (MetaMonitorTiled *monitor_tiled);
|
|||||||
|
|
||||||
GList * meta_monitor_get_modes (MetaMonitor *monitor);
|
GList * meta_monitor_get_modes (MetaMonitor *monitor);
|
||||||
|
|
||||||
|
MetaMonitorModeSpec * meta_monitor_mode_get_spec (MetaMonitorMode *monitor_mode);
|
||||||
|
|
||||||
void meta_monitor_mode_get_resolution (MetaMonitorMode *monitor_mode,
|
void meta_monitor_mode_get_resolution (MetaMonitorMode *monitor_mode,
|
||||||
int *width,
|
int *width,
|
||||||
int *height);
|
int *height);
|
||||||
|
Loading…
Reference in New Issue
Block a user