2016-12-13 02:53:38 +00:00
|
|
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (C) 2016 Red Hat
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
|
|
* 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef META_MONITOR_H
|
|
|
|
#define META_MONITOR_H
|
|
|
|
|
|
|
|
#include <glib-object.h>
|
|
|
|
|
2018-07-10 08:36:24 +00:00
|
|
|
#include "backends/meta-backend-types.h"
|
2017-03-28 04:35:19 +00:00
|
|
|
#include "backends/meta-crtc.h"
|
2017-03-24 09:35:51 +00:00
|
|
|
#include "backends/meta-output.h"
|
2016-12-13 02:53:38 +00:00
|
|
|
|
2016-12-17 14:34:26 +00:00
|
|
|
typedef struct _MetaMonitorSpec
|
|
|
|
{
|
|
|
|
char *connector;
|
|
|
|
char *vendor;
|
|
|
|
char *product;
|
|
|
|
char *serial;
|
|
|
|
} MetaMonitorSpec;
|
|
|
|
|
2016-12-17 14:29:33 +00:00
|
|
|
typedef struct _MetaMonitorModeSpec
|
|
|
|
{
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
float refresh_rate;
|
2017-06-14 06:41:13 +00:00
|
|
|
MetaCrtcModeFlag flags;
|
2016-12-17 14:29:33 +00:00
|
|
|
} MetaMonitorModeSpec;
|
|
|
|
|
2016-12-14 09:22:07 +00:00
|
|
|
typedef struct _MetaMonitorCrtcMode
|
|
|
|
{
|
|
|
|
MetaOutput *output;
|
|
|
|
MetaCrtcMode *crtc_mode;
|
|
|
|
} MetaMonitorCrtcMode;
|
|
|
|
|
2017-10-18 15:24:36 +00:00
|
|
|
#define HANDLED_CRTC_MODE_FLAGS (META_CRTC_MODE_FLAG_INTERLACE)
|
|
|
|
|
2016-12-20 15:23:27 +00:00
|
|
|
typedef gboolean (* MetaMonitorModeFunc) (MetaMonitor *monitor,
|
|
|
|
MetaMonitorMode *mode,
|
|
|
|
MetaMonitorCrtcMode *monitor_crtc_mode,
|
|
|
|
gpointer user_data,
|
|
|
|
GError **error);
|
2016-12-14 09:22:07 +00:00
|
|
|
|
2017-06-05 07:59:47 +00:00
|
|
|
typedef enum _MetaMonitorScalesConstraint
|
|
|
|
{
|
|
|
|
META_MONITOR_SCALES_CONSTRAINT_NONE = 0,
|
|
|
|
META_MONITOR_SCALES_CONSTRAINT_NO_FRAC = (1 << 0),
|
|
|
|
} MetaMonitorScalesConstraint;
|
|
|
|
|
2016-12-13 02:53:38 +00:00
|
|
|
#define META_TYPE_MONITOR (meta_monitor_get_type ())
|
2021-01-26 16:42:51 +00:00
|
|
|
META_EXPORT_TEST
|
2016-12-13 02:53:38 +00:00
|
|
|
G_DECLARE_DERIVABLE_TYPE (MetaMonitor, meta_monitor, META, MONITOR, GObject)
|
|
|
|
|
|
|
|
struct _MetaMonitorClass
|
|
|
|
{
|
|
|
|
GObjectClass parent_class;
|
|
|
|
|
|
|
|
MetaOutput * (* get_main_output) (MetaMonitor *monitor);
|
2017-07-12 07:42:20 +00:00
|
|
|
void (* derive_layout) (MetaMonitor *monitor,
|
|
|
|
MetaRectangle *layout);
|
2019-03-08 18:13:00 +00:00
|
|
|
void (* calculate_crtc_pos) (MetaMonitor *monitor,
|
|
|
|
MetaMonitorMode *monitor_mode,
|
|
|
|
MetaOutput *output,
|
|
|
|
MetaMonitorTransform crtc_transform,
|
|
|
|
int *out_x,
|
|
|
|
int *out_y);
|
2017-05-01 03:55:10 +00:00
|
|
|
gboolean (* get_suggested_position) (MetaMonitor *monitor,
|
|
|
|
int *width,
|
|
|
|
int *height);
|
2016-12-13 02:53:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define META_TYPE_MONITOR_NORMAL (meta_monitor_normal_get_type ())
|
|
|
|
G_DECLARE_FINAL_TYPE (MetaMonitorNormal, meta_monitor_normal,
|
|
|
|
META, MONITOR_NORMAL,
|
|
|
|
MetaMonitor)
|
|
|
|
|
|
|
|
#define META_TYPE_MONITOR_TILED (meta_monitor_tiled_get_type ())
|
|
|
|
G_DECLARE_FINAL_TYPE (MetaMonitorTiled, meta_monitor_tiled,
|
|
|
|
META, MONITOR_TILED,
|
|
|
|
MetaMonitor)
|
|
|
|
|
2021-01-26 13:49:25 +00:00
|
|
|
MetaMonitorTiled * meta_monitor_tiled_new (MetaMonitorManager *monitor_manager,
|
2019-01-11 14:35:42 +00:00
|
|
|
MetaOutput *output);
|
2016-12-13 02:53:38 +00:00
|
|
|
|
2021-01-26 13:49:25 +00:00
|
|
|
MetaMonitorNormal * meta_monitor_normal_new (MetaMonitorManager *monitor_manager,
|
2019-06-26 09:24:19 +00:00
|
|
|
MetaOutput *output);
|
2016-12-13 02:53:38 +00:00
|
|
|
|
2016-12-17 14:34:26 +00:00
|
|
|
MetaMonitorSpec * meta_monitor_get_spec (MetaMonitor *monitor);
|
2017-07-24 09:16:38 +00:00
|
|
|
|
2021-01-26 13:49:25 +00:00
|
|
|
MetaBackend * meta_monitor_get_backend (MetaMonitor *monitor);
|
2016-12-17 14:34:26 +00:00
|
|
|
|
2019-01-23 02:25:35 +00:00
|
|
|
META_EXPORT_TEST
|
2016-12-13 02:53:38 +00:00
|
|
|
gboolean meta_monitor_is_active (MetaMonitor *monitor);
|
|
|
|
|
2019-01-23 02:25:35 +00:00
|
|
|
META_EXPORT_TEST
|
2016-12-13 03:03:22 +00:00
|
|
|
MetaOutput * meta_monitor_get_main_output (MetaMonitor *monitor);
|
|
|
|
|
2023-02-07 16:41:04 +00:00
|
|
|
META_EXPORT_TEST
|
2016-12-13 03:03:22 +00:00
|
|
|
gboolean meta_monitor_is_primary (MetaMonitor *monitor);
|
|
|
|
|
2017-01-23 09:59:43 +00:00
|
|
|
gboolean meta_monitor_supports_underscanning (MetaMonitor *monitor);
|
|
|
|
|
2021-12-06 10:42:36 +00:00
|
|
|
gboolean meta_monitor_supports_color_transform (MetaMonitor *monitor);
|
|
|
|
|
2017-01-17 02:59:24 +00:00
|
|
|
gboolean meta_monitor_is_underscanning (MetaMonitor *monitor);
|
|
|
|
|
2022-06-09 10:45:46 +00:00
|
|
|
gboolean meta_monitor_get_max_bpc (MetaMonitor *monitor,
|
|
|
|
unsigned int *max_bpc);
|
|
|
|
|
2016-12-17 14:37:57 +00:00
|
|
|
gboolean meta_monitor_is_laptop_panel (MetaMonitor *monitor);
|
|
|
|
|
2021-10-27 20:57:31 +00:00
|
|
|
gboolean meta_monitor_is_virtual (MetaMonitor *monitor);
|
|
|
|
|
2017-06-21 09:58:46 +00:00
|
|
|
gboolean meta_monitor_is_same_as (MetaMonitor *monitor,
|
|
|
|
MetaMonitor *other_monitor);
|
|
|
|
|
2019-01-23 02:25:35 +00:00
|
|
|
META_EXPORT_TEST
|
2016-12-13 02:53:38 +00:00
|
|
|
GList * meta_monitor_get_outputs (MetaMonitor *monitor);
|
|
|
|
|
2017-03-07 04:34:38 +00:00
|
|
|
void meta_monitor_get_current_resolution (MetaMonitor *monitor,
|
|
|
|
int *width,
|
|
|
|
int *height);
|
|
|
|
|
2017-07-12 07:42:20 +00:00
|
|
|
void meta_monitor_derive_layout (MetaMonitor *monitor,
|
|
|
|
MetaRectangle *layout);
|
2016-12-13 02:53:38 +00:00
|
|
|
|
2019-01-23 02:25:35 +00:00
|
|
|
META_EXPORT_TEST
|
2016-12-13 02:53:38 +00:00
|
|
|
void meta_monitor_get_physical_dimensions (MetaMonitor *monitor,
|
|
|
|
int *width_mm,
|
|
|
|
int *height_mm);
|
|
|
|
|
2016-12-22 07:16:48 +00:00
|
|
|
CoglSubpixelOrder meta_monitor_get_subpixel_order (MetaMonitor *monitor);
|
|
|
|
|
2019-01-23 02:25:35 +00:00
|
|
|
META_EXPORT_TEST
|
2017-04-06 05:14:43 +00:00
|
|
|
const char * meta_monitor_get_connector (MetaMonitor *monitor);
|
|
|
|
|
2019-01-23 02:25:35 +00:00
|
|
|
META_EXPORT_TEST
|
2016-12-22 07:20:57 +00:00
|
|
|
const char * meta_monitor_get_vendor (MetaMonitor *monitor);
|
|
|
|
|
2019-01-23 02:25:35 +00:00
|
|
|
META_EXPORT_TEST
|
2016-12-13 10:58:22 +00:00
|
|
|
const char * meta_monitor_get_product (MetaMonitor *monitor);
|
|
|
|
|
2019-01-23 02:25:35 +00:00
|
|
|
META_EXPORT_TEST
|
2016-12-22 07:20:57 +00:00
|
|
|
const char * meta_monitor_get_serial (MetaMonitor *monitor);
|
|
|
|
|
2021-11-29 16:26:31 +00:00
|
|
|
META_EXPORT_TEST
|
|
|
|
const MetaEdidInfo * meta_monitor_get_edid_info (MetaMonitor *monitor);
|
|
|
|
|
2021-11-29 16:27:27 +00:00
|
|
|
META_EXPORT_TEST
|
2021-10-26 09:27:56 +00:00
|
|
|
const char * meta_monitor_get_edid_checksum_md5 (MetaMonitor *monitor);
|
|
|
|
|
2019-01-23 02:25:35 +00:00
|
|
|
META_EXPORT_TEST
|
2017-01-20 07:07:12 +00:00
|
|
|
MetaConnectorType meta_monitor_get_connector_type (MetaMonitor *monitor);
|
|
|
|
|
2017-10-24 10:43:58 +00:00
|
|
|
/* This function returns the transform corrected for the panel orientation */
|
2019-01-23 02:25:35 +00:00
|
|
|
META_EXPORT_TEST
|
2017-10-24 10:43:58 +00:00
|
|
|
MetaMonitorTransform meta_monitor_logical_to_crtc_transform (MetaMonitor *monitor,
|
|
|
|
MetaMonitorTransform transform);
|
|
|
|
/*
|
|
|
|
* This function converts a transform corrected for the panel orientation
|
|
|
|
* to its logical (user-visible) transform.
|
|
|
|
*/
|
2019-01-23 02:25:35 +00:00
|
|
|
META_EXPORT_TEST
|
2017-10-24 10:43:58 +00:00
|
|
|
MetaMonitorTransform meta_monitor_crtc_to_logical_transform (MetaMonitor *monitor,
|
|
|
|
MetaMonitorTransform transform);
|
|
|
|
|
2019-01-23 02:25:35 +00:00
|
|
|
META_EXPORT_TEST
|
2016-12-13 10:58:22 +00:00
|
|
|
uint32_t meta_monitor_tiled_get_tile_group_id (MetaMonitorTiled *monitor_tiled);
|
|
|
|
|
2019-01-23 02:25:35 +00:00
|
|
|
META_EXPORT_TEST
|
2017-01-09 07:35:03 +00:00
|
|
|
gboolean meta_monitor_get_suggested_position (MetaMonitor *monitor,
|
|
|
|
int *x,
|
|
|
|
int *y);
|
|
|
|
|
2019-01-23 02:25:35 +00:00
|
|
|
META_EXPORT_TEST
|
2017-01-09 06:31:18 +00:00
|
|
|
MetaLogicalMonitor * meta_monitor_get_logical_monitor (MetaMonitor *monitor);
|
|
|
|
|
2019-01-23 02:25:35 +00:00
|
|
|
META_EXPORT_TEST
|
2017-06-14 04:04:09 +00:00
|
|
|
MetaMonitorMode * meta_monitor_get_mode_from_id (MetaMonitor *monitor,
|
|
|
|
const char *monitor_mode_id);
|
|
|
|
|
2022-07-26 22:25:22 +00:00
|
|
|
META_EXPORT_TEST
|
|
|
|
gboolean meta_monitor_mode_spec_has_similar_size (MetaMonitorModeSpec *monitor_mode_spec,
|
|
|
|
MetaMonitorModeSpec *other_monitor_mode_spec);
|
|
|
|
|
2019-01-23 02:25:35 +00:00
|
|
|
META_EXPORT_TEST
|
2016-12-21 05:03:35 +00:00
|
|
|
MetaMonitorMode * meta_monitor_get_mode_from_spec (MetaMonitor *monitor,
|
|
|
|
MetaMonitorModeSpec *monitor_mode_spec);
|
|
|
|
|
2019-01-23 02:25:35 +00:00
|
|
|
META_EXPORT_TEST
|
2016-12-17 14:32:05 +00:00
|
|
|
MetaMonitorMode * meta_monitor_get_preferred_mode (MetaMonitor *monitor);
|
|
|
|
|
2019-01-23 02:25:35 +00:00
|
|
|
META_EXPORT_TEST
|
2016-12-22 07:22:13 +00:00
|
|
|
MetaMonitorMode * meta_monitor_get_current_mode (MetaMonitor *monitor);
|
|
|
|
|
2019-01-23 02:25:35 +00:00
|
|
|
META_EXPORT_TEST
|
2016-12-22 07:22:13 +00:00
|
|
|
void meta_monitor_derive_current_mode (MetaMonitor *monitor);
|
|
|
|
|
2019-01-23 02:25:35 +00:00
|
|
|
META_EXPORT_TEST
|
2017-01-09 06:31:18 +00:00
|
|
|
void meta_monitor_set_current_mode (MetaMonitor *monitor,
|
|
|
|
MetaMonitorMode *mode);
|
|
|
|
|
2019-01-23 02:25:35 +00:00
|
|
|
META_EXPORT_TEST
|
2016-12-14 09:22:07 +00:00
|
|
|
GList * meta_monitor_get_modes (MetaMonitor *monitor);
|
|
|
|
|
2019-01-23 02:25:35 +00:00
|
|
|
META_EXPORT_TEST
|
2019-03-08 18:13:00 +00:00
|
|
|
void meta_monitor_calculate_crtc_pos (MetaMonitor *monitor,
|
|
|
|
MetaMonitorMode *monitor_mode,
|
|
|
|
MetaOutput *output,
|
|
|
|
MetaMonitorTransform crtc_transform,
|
|
|
|
int *out_x,
|
|
|
|
int *out_y);
|
2017-03-17 09:21:10 +00:00
|
|
|
|
2019-01-23 02:25:35 +00:00
|
|
|
META_EXPORT_TEST
|
2017-06-10 14:10:57 +00:00
|
|
|
float meta_monitor_calculate_mode_scale (MetaMonitor *monitor,
|
|
|
|
MetaMonitorMode *monitor_mode,
|
|
|
|
MetaMonitorScalesConstraint constraints);
|
2017-04-21 09:28:22 +00:00
|
|
|
|
2019-01-23 02:25:35 +00:00
|
|
|
META_EXPORT_TEST
|
2019-03-08 18:03:57 +00:00
|
|
|
float * meta_monitor_calculate_supported_scales (MetaMonitor *monitor,
|
|
|
|
MetaMonitorMode *monitor_mode,
|
|
|
|
MetaMonitorScalesConstraint constraints,
|
|
|
|
int *n_supported_scales);
|
2017-06-05 07:59:47 +00:00
|
|
|
|
2019-01-23 02:25:35 +00:00
|
|
|
META_EXPORT_TEST
|
2017-06-14 04:04:09 +00:00
|
|
|
const char * meta_monitor_mode_get_id (MetaMonitorMode *monitor_mode);
|
|
|
|
|
2019-01-23 02:25:35 +00:00
|
|
|
META_EXPORT_TEST
|
2016-12-17 14:29:33 +00:00
|
|
|
MetaMonitorModeSpec * meta_monitor_mode_get_spec (MetaMonitorMode *monitor_mode);
|
|
|
|
|
2019-01-23 02:25:35 +00:00
|
|
|
META_EXPORT_TEST
|
2016-12-14 09:22:07 +00:00
|
|
|
void meta_monitor_mode_get_resolution (MetaMonitorMode *monitor_mode,
|
|
|
|
int *width,
|
|
|
|
int *height);
|
|
|
|
|
2019-01-23 02:25:35 +00:00
|
|
|
META_EXPORT_TEST
|
2016-12-14 09:22:07 +00:00
|
|
|
float meta_monitor_mode_get_refresh_rate (MetaMonitorMode *monitor_mode);
|
|
|
|
|
2019-01-23 02:25:35 +00:00
|
|
|
META_EXPORT_TEST
|
2017-06-14 06:41:13 +00:00
|
|
|
MetaCrtcModeFlag meta_monitor_mode_get_flags (MetaMonitorMode *monitor_mode);
|
|
|
|
|
2019-01-23 02:25:35 +00:00
|
|
|
META_EXPORT_TEST
|
2019-03-08 18:17:40 +00:00
|
|
|
gboolean meta_monitor_mode_foreach_crtc (MetaMonitor *monitor,
|
|
|
|
MetaMonitorMode *mode,
|
|
|
|
MetaMonitorModeFunc func,
|
|
|
|
gpointer user_data,
|
|
|
|
GError **error);
|
|
|
|
|
|
|
|
META_EXPORT_TEST
|
|
|
|
gboolean meta_monitor_mode_foreach_output (MetaMonitor *monitor,
|
|
|
|
MetaMonitorMode *mode,
|
|
|
|
MetaMonitorModeFunc func,
|
|
|
|
gpointer user_data,
|
|
|
|
GError **error);
|
2017-08-18 06:04:02 +00:00
|
|
|
|
2020-10-09 23:02:28 +00:00
|
|
|
MetaMonitorCrtcMode * meta_monitor_get_crtc_mode_for_output (MetaMonitor *monitor,
|
|
|
|
MetaMonitorMode *mode,
|
|
|
|
MetaOutput *output);
|
|
|
|
|
2019-01-23 02:25:35 +00:00
|
|
|
META_EXPORT_TEST
|
2018-07-16 16:09:40 +00:00
|
|
|
gboolean meta_monitor_mode_should_be_advertised (MetaMonitorMode *monitor_mode);
|
|
|
|
|
2019-01-23 02:25:35 +00:00
|
|
|
META_EXPORT_TEST
|
2016-12-17 14:34:26 +00:00
|
|
|
MetaMonitorSpec * meta_monitor_spec_clone (MetaMonitorSpec *monitor_id);
|
|
|
|
|
2021-02-05 16:21:55 +00:00
|
|
|
guint meta_monitor_spec_hash (gconstpointer key);
|
|
|
|
|
2019-01-23 02:25:35 +00:00
|
|
|
META_EXPORT_TEST
|
2016-12-17 14:34:26 +00:00
|
|
|
gboolean meta_monitor_spec_equals (MetaMonitorSpec *monitor_id,
|
|
|
|
MetaMonitorSpec *other_monitor_id);
|
|
|
|
|
2019-01-23 02:25:35 +00:00
|
|
|
META_EXPORT_TEST
|
2017-01-12 08:13:48 +00:00
|
|
|
int meta_monitor_spec_compare (MetaMonitorSpec *monitor_spec_a,
|
|
|
|
MetaMonitorSpec *monitor_spec_b);
|
|
|
|
|
2019-01-23 02:25:35 +00:00
|
|
|
META_EXPORT_TEST
|
2016-12-17 14:34:26 +00:00
|
|
|
void meta_monitor_spec_free (MetaMonitorSpec *monitor_id);
|
|
|
|
|
2019-06-26 09:24:19 +00:00
|
|
|
const char * meta_monitor_get_display_name (MetaMonitor *monitor);
|
|
|
|
|
2020-01-16 09:10:42 +00:00
|
|
|
void meta_monitor_set_logical_monitor (MetaMonitor *monitor,
|
|
|
|
MetaLogicalMonitor *logical_monitor);
|
|
|
|
|
2021-03-22 00:02:19 +00:00
|
|
|
MetaPrivacyScreenState meta_monitor_get_privacy_screen_state (MetaMonitor *monitor);
|
|
|
|
|
|
|
|
gboolean meta_monitor_set_privacy_screen_enabled (MetaMonitor *monitor,
|
|
|
|
gboolean enabled,
|
|
|
|
GError **error);
|
|
|
|
|
2022-09-03 13:49:52 +00:00
|
|
|
META_EXPORT_TEST
|
2021-10-26 09:45:17 +00:00
|
|
|
size_t meta_monitor_get_gamma_lut_size (MetaMonitor *monitor);
|
|
|
|
|
2021-12-03 16:34:34 +00:00
|
|
|
void meta_monitor_set_gamma_lut (MetaMonitor *monitor,
|
|
|
|
const MetaGammaLut *lut);
|
2021-10-26 09:46:37 +00:00
|
|
|
|
2023-03-02 00:35:10 +00:00
|
|
|
gboolean meta_monitor_set_color_space (MetaMonitor *monitor,
|
|
|
|
MetaOutputColorspace color_space,
|
|
|
|
GError **error);
|
|
|
|
|
|
|
|
gboolean meta_monitor_set_hdr_metadata (MetaMonitor *monitor,
|
|
|
|
MetaOutputHdrMetadata *metadata,
|
|
|
|
GError **error);
|
|
|
|
|
2023-03-07 21:36:57 +00:00
|
|
|
META_EXPORT_TEST
|
|
|
|
gboolean meta_parse_monitor_mode (const char *string,
|
|
|
|
int *out_width,
|
|
|
|
int *out_height,
|
|
|
|
float *out_refresh_rate,
|
|
|
|
float fallback_refresh_rate);
|
|
|
|
|
2016-12-13 02:53:38 +00:00
|
|
|
#endif /* META_MONITOR_H */
|