2017-03-24 05:35:51 -04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2017 Red Hat
|
2020-02-04 19:41:34 -05:00
|
|
|
* Copyright (C) 2020 NVIDIA CORPORATION
|
2017-03-24 05:35:51 -04:00
|
|
|
*
|
|
|
|
* 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_OUTPUT_H
|
|
|
|
#define META_OUTPUT_H
|
|
|
|
|
|
|
|
#include <glib-object.h>
|
|
|
|
|
2021-11-08 15:43:04 -05:00
|
|
|
#include "backends/edid.h"
|
2018-07-10 04:36:24 -04:00
|
|
|
#include "backends/meta-backend-types.h"
|
2017-07-10 06:19:32 -04:00
|
|
|
#include "backends/meta-gpu.h"
|
2019-01-22 21:25:35 -05:00
|
|
|
#include "core/util-private.h"
|
2017-03-24 05:35:51 -04:00
|
|
|
|
|
|
|
struct _MetaTileInfo
|
|
|
|
{
|
2020-12-17 16:13:21 -05:00
|
|
|
uint32_t group_id;
|
|
|
|
uint32_t flags;
|
|
|
|
uint32_t max_h_tiles;
|
|
|
|
uint32_t max_v_tiles;
|
|
|
|
uint32_t loc_h_tile;
|
|
|
|
uint32_t loc_v_tile;
|
|
|
|
uint32_t tile_w;
|
|
|
|
uint32_t tile_h;
|
2017-03-24 05:35:51 -04:00
|
|
|
};
|
|
|
|
|
Introduce virtual monitors
Virtual monitors are monitors that isn't backed by any monitor like
hardware. It would typically be backed by e.g. a remote desktop service,
or a network display.
It is currently only supported by the native backend, and whether the
X11 backend will ever see virtual monitors is an open question. This
rest of this commit message describes how it works under the native
backend.
Each virutal monitor consists of virtualized mode setting components:
* A virtual CRTC mode (MetaCrtcModeVirtual)
* A virtual CRTC (MetaCrtcVirtual)
* A virtual connector (MetaOutputVirtual)
In difference to the corresponding mode setting objects that represents
KMS objects, the virtual ones isn't directly tied to a MetaGpu, other
than the CoglFramebuffer being part of the GPU context of the primary
GPU, which is the case for all monitors no matter what GPU they are
connected to. Part of the reason for this is that a MetaGpu in practice
represents a mode setting device, and its CRTCs and outputs, are all
backed by real mode setting objects, while a virtual monitor is only
backed by a framebuffer that is tied to the primary GPU. Maybe this will
be reevaluated in the future, but since a virtual monitor is not tied to
any GPU currently, so is the case for the virtual mode setting objects.
The native rendering backend, including the cursor renderer, is adapted
to handle the situation where a CRTC does not have a GPU associated with
it; this in practice means that it e.g. will not try to upload HW cursor
buffers when the cursor is only on a virtual monitor. The same applies
to the native renderer, which is made to avoid creating
MetaOnscreenNative for views that are backed by virtual CRTCs, as well
as to avoid trying to mode set on such views.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
2021-01-26 10:49:28 -05:00
|
|
|
/* The first 17 matches the values in drm_mode.h, the ones starting with
|
|
|
|
* 1000 do not. */
|
2017-03-24 05:35:51 -04:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
META_CONNECTOR_TYPE_Unknown = 0,
|
|
|
|
META_CONNECTOR_TYPE_VGA = 1,
|
|
|
|
META_CONNECTOR_TYPE_DVII = 2,
|
|
|
|
META_CONNECTOR_TYPE_DVID = 3,
|
|
|
|
META_CONNECTOR_TYPE_DVIA = 4,
|
|
|
|
META_CONNECTOR_TYPE_Composite = 5,
|
|
|
|
META_CONNECTOR_TYPE_SVIDEO = 6,
|
|
|
|
META_CONNECTOR_TYPE_LVDS = 7,
|
|
|
|
META_CONNECTOR_TYPE_Component = 8,
|
|
|
|
META_CONNECTOR_TYPE_9PinDIN = 9,
|
|
|
|
META_CONNECTOR_TYPE_DisplayPort = 10,
|
|
|
|
META_CONNECTOR_TYPE_HDMIA = 11,
|
|
|
|
META_CONNECTOR_TYPE_HDMIB = 12,
|
|
|
|
META_CONNECTOR_TYPE_TV = 13,
|
|
|
|
META_CONNECTOR_TYPE_eDP = 14,
|
|
|
|
META_CONNECTOR_TYPE_VIRTUAL = 15,
|
|
|
|
META_CONNECTOR_TYPE_DSI = 16,
|
2022-08-16 18:41:42 -04:00
|
|
|
META_CONNECTOR_TYPE_DPI = 17,
|
|
|
|
META_CONNECTOR_TYPE_WRITEBACK = 18,
|
|
|
|
META_CONNECTOR_TYPE_SPI = 19,
|
|
|
|
META_CONNECTOR_TYPE_USB = 20,
|
Introduce virtual monitors
Virtual monitors are monitors that isn't backed by any monitor like
hardware. It would typically be backed by e.g. a remote desktop service,
or a network display.
It is currently only supported by the native backend, and whether the
X11 backend will ever see virtual monitors is an open question. This
rest of this commit message describes how it works under the native
backend.
Each virutal monitor consists of virtualized mode setting components:
* A virtual CRTC mode (MetaCrtcModeVirtual)
* A virtual CRTC (MetaCrtcVirtual)
* A virtual connector (MetaOutputVirtual)
In difference to the corresponding mode setting objects that represents
KMS objects, the virtual ones isn't directly tied to a MetaGpu, other
than the CoglFramebuffer being part of the GPU context of the primary
GPU, which is the case for all monitors no matter what GPU they are
connected to. Part of the reason for this is that a MetaGpu in practice
represents a mode setting device, and its CRTCs and outputs, are all
backed by real mode setting objects, while a virtual monitor is only
backed by a framebuffer that is tied to the primary GPU. Maybe this will
be reevaluated in the future, but since a virtual monitor is not tied to
any GPU currently, so is the case for the virtual mode setting objects.
The native rendering backend, including the cursor renderer, is adapted
to handle the situation where a CRTC does not have a GPU associated with
it; this in practice means that it e.g. will not try to upload HW cursor
buffers when the cursor is only on a virtual monitor. The same applies
to the native renderer, which is made to avoid creating
MetaOnscreenNative for views that are backed by virtual CRTCs, as well
as to avoid trying to mode set on such views.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
2021-01-26 10:49:28 -05:00
|
|
|
|
|
|
|
META_CONNECTOR_TYPE_META = 1000,
|
2017-03-24 05:35:51 -04:00
|
|
|
} MetaConnectorType;
|
|
|
|
|
2021-03-21 20:02:19 -04:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
META_PRIVACY_SCREEN_UNAVAILABLE = 0,
|
|
|
|
META_PRIVACY_SCREEN_ENABLED = 1 << 0,
|
|
|
|
META_PRIVACY_SCREEN_DISABLED = 1 << 1,
|
|
|
|
META_PRIVACY_SCREEN_LOCKED = 1 << 2,
|
|
|
|
} MetaPrivacyScreenState;
|
|
|
|
|
2020-02-26 03:45:07 -05:00
|
|
|
typedef struct _MetaOutputInfo
|
2017-03-24 05:35:51 -04:00
|
|
|
{
|
2020-02-26 03:45:07 -05:00
|
|
|
grefcount ref_count;
|
2017-03-24 05:35:51 -04:00
|
|
|
|
2021-10-27 16:57:31 -04:00
|
|
|
gboolean is_virtual;
|
|
|
|
|
2017-03-24 05:35:51 -04:00
|
|
|
char *name;
|
|
|
|
char *vendor;
|
|
|
|
char *product;
|
|
|
|
char *serial;
|
2021-10-26 05:27:56 -04:00
|
|
|
|
|
|
|
char *edid_checksum_md5;
|
2021-11-08 15:43:04 -05:00
|
|
|
MetaEdidInfo *edid_info;
|
2021-10-26 05:27:56 -04:00
|
|
|
|
2017-03-24 05:35:51 -04:00
|
|
|
int width_mm;
|
|
|
|
int height_mm;
|
|
|
|
CoglSubpixelOrder subpixel_order;
|
|
|
|
|
|
|
|
MetaConnectorType connector_type;
|
2017-10-24 06:43:58 -04:00
|
|
|
MetaMonitorTransform panel_orientation_transform;
|
2017-03-24 05:35:51 -04:00
|
|
|
|
|
|
|
MetaCrtcMode *preferred_mode;
|
|
|
|
MetaCrtcMode **modes;
|
|
|
|
unsigned int n_modes;
|
|
|
|
|
|
|
|
MetaCrtc **possible_crtcs;
|
|
|
|
unsigned int n_possible_crtcs;
|
|
|
|
|
|
|
|
MetaOutput **possible_clones;
|
|
|
|
unsigned int n_possible_clones;
|
|
|
|
|
|
|
|
int backlight_min;
|
|
|
|
int backlight_max;
|
|
|
|
|
|
|
|
gboolean supports_underscanning;
|
2020-02-04 19:41:34 -05:00
|
|
|
gboolean supports_color_transform;
|
2017-03-24 05:35:51 -04:00
|
|
|
|
2022-06-09 06:44:46 -04:00
|
|
|
unsigned int max_bpc_min;
|
|
|
|
unsigned int max_bpc_max;
|
|
|
|
|
2017-03-24 05:35:51 -04:00
|
|
|
/*
|
|
|
|
* Get a new preferred mode on hotplug events, to handle dynamic guest
|
|
|
|
* resizing.
|
|
|
|
*/
|
|
|
|
gboolean hotplug_mode_update;
|
2020-02-25 10:22:08 -05:00
|
|
|
int suggested_x;
|
|
|
|
int suggested_y;
|
2017-03-24 05:35:51 -04:00
|
|
|
|
|
|
|
MetaTileInfo tile_info;
|
2020-02-26 03:45:07 -05:00
|
|
|
} MetaOutputInfo;
|
|
|
|
|
2020-07-31 15:37:17 -04:00
|
|
|
gboolean
|
|
|
|
meta_tile_info_equal (MetaTileInfo *a,
|
|
|
|
MetaTileInfo *b);
|
|
|
|
|
2020-02-26 03:45:07 -05:00
|
|
|
#define META_TYPE_OUTPUT_INFO (meta_output_info_get_type ())
|
|
|
|
META_EXPORT_TEST
|
|
|
|
GType meta_output_info_get_type (void);
|
|
|
|
|
|
|
|
META_EXPORT_TEST
|
|
|
|
MetaOutputInfo * meta_output_info_new (void);
|
|
|
|
|
|
|
|
META_EXPORT_TEST
|
|
|
|
MetaOutputInfo * meta_output_info_ref (MetaOutputInfo *output_info);
|
|
|
|
|
|
|
|
META_EXPORT_TEST
|
|
|
|
void meta_output_info_unref (MetaOutputInfo *output_info);
|
|
|
|
|
|
|
|
META_EXPORT_TEST
|
|
|
|
void meta_output_info_parse_edid (MetaOutputInfo *output_info,
|
|
|
|
GBytes *edid);
|
|
|
|
|
2020-10-21 01:31:08 -04:00
|
|
|
gboolean meta_output_is_laptop (MetaOutput *output);
|
|
|
|
|
2020-02-26 03:45:07 -05:00
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MetaOutputInfo, meta_output_info_unref)
|
|
|
|
|
2017-03-24 05:35:51 -04:00
|
|
|
#define META_TYPE_OUTPUT (meta_output_get_type ())
|
2020-02-26 10:47:03 -05:00
|
|
|
META_EXPORT_TEST
|
|
|
|
G_DECLARE_DERIVABLE_TYPE (MetaOutput, meta_output, META, OUTPUT, GObject)
|
|
|
|
|
|
|
|
struct _MetaOutputClass
|
|
|
|
{
|
|
|
|
GObjectClass parent_class;
|
2021-03-21 20:02:19 -04:00
|
|
|
|
|
|
|
MetaPrivacyScreenState (* get_privacy_screen_state) (MetaOutput *output);
|
|
|
|
gboolean (* set_privacy_screen_enabled) (MetaOutput *output,
|
|
|
|
gboolean enabled,
|
|
|
|
GError **error);
|
2020-02-26 10:47:03 -05:00
|
|
|
};
|
2017-03-24 05:35:51 -04:00
|
|
|
|
2020-02-25 10:13:52 -05:00
|
|
|
META_EXPORT_TEST
|
|
|
|
uint64_t meta_output_get_id (MetaOutput *output);
|
|
|
|
|
2019-01-22 21:25:35 -05:00
|
|
|
META_EXPORT_TEST
|
2017-07-10 06:19:32 -04:00
|
|
|
MetaGpu * meta_output_get_gpu (MetaOutput *output);
|
2017-07-03 23:56:18 -04:00
|
|
|
|
2020-10-08 11:34:57 -04:00
|
|
|
META_EXPORT_TEST
|
|
|
|
MetaMonitor * meta_output_get_monitor (MetaOutput *output);
|
|
|
|
|
|
|
|
void meta_output_set_monitor (MetaOutput *output,
|
|
|
|
MetaMonitor *monitor);
|
|
|
|
|
2021-01-27 17:16:05 -05:00
|
|
|
void meta_output_unset_monitor (MetaOutput *output);
|
|
|
|
|
2020-04-30 11:58:17 -04:00
|
|
|
const char * meta_output_get_name (MetaOutput *output);
|
|
|
|
|
2019-01-22 21:25:35 -05:00
|
|
|
META_EXPORT_TEST
|
2020-02-25 12:37:21 -05:00
|
|
|
gboolean meta_output_is_primary (MetaOutput *output);
|
|
|
|
|
|
|
|
META_EXPORT_TEST
|
|
|
|
gboolean meta_output_is_presentation (MetaOutput *output);
|
|
|
|
|
|
|
|
META_EXPORT_TEST
|
|
|
|
gboolean meta_output_is_underscanning (MetaOutput *output);
|
|
|
|
|
2022-06-09 06:44:46 -04:00
|
|
|
META_EXPORT_TEST
|
|
|
|
gboolean meta_output_get_max_bpc (MetaOutput *output,
|
|
|
|
unsigned int *max_bpc);
|
|
|
|
|
2020-02-25 12:37:21 -05:00
|
|
|
void meta_output_set_backlight (MetaOutput *output,
|
|
|
|
int backlight);
|
|
|
|
|
|
|
|
int meta_output_get_backlight (MetaOutput *output);
|
|
|
|
|
2021-03-21 20:02:19 -04:00
|
|
|
MetaPrivacyScreenState meta_output_get_privacy_screen_state (MetaOutput *output);
|
|
|
|
|
|
|
|
gboolean meta_output_set_privacy_screen_enabled (MetaOutput *output,
|
|
|
|
gboolean enabled,
|
|
|
|
GError **error);
|
|
|
|
|
2020-02-26 03:45:07 -05:00
|
|
|
void meta_output_add_possible_clone (MetaOutput *output,
|
|
|
|
MetaOutput *possible_clone);
|
|
|
|
|
2021-01-26 10:07:07 -05:00
|
|
|
META_EXPORT_TEST
|
2020-02-26 03:45:07 -05:00
|
|
|
const MetaOutputInfo * meta_output_get_info (MetaOutput *output);
|
|
|
|
|
2020-02-25 12:37:21 -05:00
|
|
|
META_EXPORT_TEST
|
2020-02-25 14:30:46 -05:00
|
|
|
void meta_output_assign_crtc (MetaOutput *output,
|
|
|
|
MetaCrtc *crtc,
|
|
|
|
const MetaOutputAssignment *output_assignment);
|
2017-11-03 06:25:30 -04:00
|
|
|
|
2019-01-22 21:25:35 -05:00
|
|
|
META_EXPORT_TEST
|
2017-11-03 06:25:30 -04:00
|
|
|
void meta_output_unassign_crtc (MetaOutput *output);
|
|
|
|
|
2020-02-18 05:45:26 -05:00
|
|
|
META_EXPORT_TEST
|
|
|
|
MetaCrtc * meta_output_get_assigned_crtc (MetaOutput *output);
|
|
|
|
|
2020-01-14 16:21:38 -05:00
|
|
|
MetaMonitorTransform meta_output_logical_to_crtc_transform (MetaOutput *output,
|
|
|
|
MetaMonitorTransform transform);
|
|
|
|
|
2020-02-18 05:45:26 -05:00
|
|
|
MetaMonitorTransform meta_output_crtc_to_logical_transform (MetaOutput *output,
|
|
|
|
MetaMonitorTransform transform);
|
2017-11-03 06:25:30 -04:00
|
|
|
|
2021-12-16 05:25:37 -05:00
|
|
|
void meta_output_update_modes (MetaOutput *output,
|
|
|
|
MetaCrtcMode *preferred_mode,
|
|
|
|
MetaCrtcMode **modes,
|
|
|
|
int n_modes);
|
|
|
|
|
2017-03-24 05:35:51 -04:00
|
|
|
#endif /* META_OUTPUT_H */
|