2013-07-30 05:36:18 -04:00
|
|
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
|
|
|
2014-05-02 09:34:02 -04:00
|
|
|
/*
|
2013-07-30 05:36:18 -04:00
|
|
|
* Copyright (C) 2013 Red Hat Inc.
|
2018-09-17 07:03:18 -04:00
|
|
|
* Copyright (C) 2018 DisplayLink (UK) Ltd.
|
2014-05-02 09:34:02 -04:00
|
|
|
*
|
2013-07-30 05:36:18 -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.
|
2014-05-02 09:34:02 -04:00
|
|
|
*
|
2013-07-30 05:36:18 -04:00
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* Author: Giovanni Campagna <gcampagn@redhat.com>
|
|
|
|
*/
|
|
|
|
|
2018-10-19 03:15:54 -04:00
|
|
|
/**
|
|
|
|
* SECTION:meta-monitor-manager-kms
|
|
|
|
* @title: MetaMonitorManagerKms
|
|
|
|
* @short_description: A subclass of #MetaMonitorManager using Linux DRM
|
|
|
|
*
|
|
|
|
* #MetaMonitorManagerKms is a subclass of #MetaMonitorManager which
|
|
|
|
* implements its functionality "natively": it uses the appropriate
|
|
|
|
* functions of the Linux DRM kernel module and using a udev client.
|
|
|
|
*
|
|
|
|
* See also #MetaMonitorManagerXrandr for an implementation using XRandR.
|
|
|
|
*/
|
|
|
|
|
2013-07-30 05:36:18 -04:00
|
|
|
#include "config.h"
|
|
|
|
|
2018-07-10 04:36:24 -04:00
|
|
|
#include "backends/native/meta-monitor-manager-kms.h"
|
2013-07-30 05:36:18 -04:00
|
|
|
|
2016-05-12 02:55:06 -04:00
|
|
|
#include <drm.h>
|
2013-07-30 05:36:18 -04:00
|
|
|
#include <errno.h>
|
2018-07-10 04:36:24 -04:00
|
|
|
#include <gudev/gudev.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2013-07-30 05:36:18 -04:00
|
|
|
#include <sys/ioctl.h>
|
|
|
|
#include <sys/mman.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
2018-07-10 04:36:24 -04:00
|
|
|
#include "backends/meta-backend-private.h"
|
|
|
|
#include "backends/meta-crtc.h"
|
|
|
|
#include "backends/meta-monitor-config-manager.h"
|
|
|
|
#include "backends/meta-output.h"
|
|
|
|
#include "backends/native/meta-backend-native.h"
|
|
|
|
#include "backends/native/meta-crtc-kms.h"
|
|
|
|
#include "backends/native/meta-gpu-kms.h"
|
backend/native: Add and use transactional KMS API
This commit introduces, and makes use of, a transactional API used for
setting up KMS state, later to be applied, potentially atomically. From
an API point of view, so is always the case, but in the current
implementation, it still uses legacy drmMode* API to apply the state
non-atomically.
The API consists of various buliding blocks:
* MetaKmsUpdate - a set of configuration changes, the higher level
handle for handing over configuration to the impl backend. It's used to
set mode, assign framebuffers to planes, queue page flips and set
connector properties.
* MetaKmsPlaneAssignment - the assignment of a framebuffer to a plane.
Currently used to map a framebuffer to the primary plane of a CRTC. In
the legacy KMS implementation, the plane assignment is used to derive
the framebuffer used for mode setting and page flipping.
This also means various high level changes:
State, excluding configuring the cursor plane and creating/destroying
DRM framebuffer handles, are applied in the end of a clutter frame, in
one go. From an API point of view, this is done atomically, but as
mentioned, only the non-atomic implementation exists so far.
From MetaRendererNative's point of view, a page flip now initially
always succeeds; the handling of EBUSY errors are done asynchronously in
the MetaKmsImpl backend (still by retrying at refresh rate, but
postponing flip callbacks instead of manipulating the frame clock).
Handling of falling back to mode setting instead of page flipping is
notified after the fact by a more precise page flip feedback API.
EGLStream based page flipping relies on the impl backend not being
atomic, as the page flipping is done in the EGLStream backend (e.g.
nvidia driver). It uses a 'custom' page flip queueing method, keeping
the EGLStream logic inside meta-renderer-native.c.
Page flip handling is moved to meta-kms-impl-device.c from
meta-gpu-kms.c. It goes via an extra idle callback before reaching
meta-renderer-native.c to make sure callbacks are invoked outside of the
impl context.
While dummy power save page flipping is kept in meta-renderer-native.c, the
EBUSY handling is moved to meta-kms-impl-simple.c. Instead of freezing the
frame clock, actual page flip callbacks are postponed until all EBUSY retries
have either succeeded or failed due to some other error than EBUSY. This
effectively inhibits new frames to be drawn, meaning we won't stall waiting on
the file descriptor for pending page flips.
https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-04-04 16:36:41 -04:00
|
|
|
#include "backends/native/meta-kms-update.h"
|
|
|
|
#include "backends/native/meta-kms.h"
|
2018-07-10 04:36:24 -04:00
|
|
|
#include "backends/native/meta-launcher.h"
|
|
|
|
#include "backends/native/meta-output-kms.h"
|
|
|
|
#include "backends/native/meta-renderer-native.h"
|
|
|
|
#include "clutter/clutter.h"
|
|
|
|
#include "meta/main.h"
|
|
|
|
#include "meta/meta-x11-errors.h"
|
2014-10-12 16:05:31 -04:00
|
|
|
|
2016-05-12 02:55:06 -04:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
GSource source;
|
|
|
|
|
|
|
|
gpointer fd_tag;
|
|
|
|
MetaMonitorManagerKms *manager_kms;
|
|
|
|
} MetaKmsSource;
|
|
|
|
|
2013-07-30 05:36:18 -04:00
|
|
|
struct _MetaMonitorManagerKms
|
|
|
|
{
|
|
|
|
MetaMonitorManager parent_instance;
|
|
|
|
|
2019-08-22 09:15:51 -04:00
|
|
|
gulong kms_resources_changed_handler_id;
|
2013-07-30 05:36:18 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _MetaMonitorManagerKmsClass
|
|
|
|
{
|
|
|
|
MetaMonitorManagerClass parent_class;
|
|
|
|
};
|
|
|
|
|
2017-07-06 04:00:56 -04:00
|
|
|
static void
|
|
|
|
initable_iface_init (GInitableIface *initable_iface);
|
|
|
|
|
|
|
|
G_DEFINE_TYPE_WITH_CODE (MetaMonitorManagerKms, meta_monitor_manager_kms,
|
|
|
|
META_TYPE_MONITOR_MANAGER,
|
|
|
|
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
|
|
|
|
initable_iface_init))
|
2013-07-30 05:36:18 -04:00
|
|
|
|
|
|
|
static GBytes *
|
|
|
|
meta_monitor_manager_kms_read_edid (MetaMonitorManager *manager,
|
|
|
|
MetaOutput *output)
|
|
|
|
{
|
2017-07-04 00:11:44 -04:00
|
|
|
return meta_output_kms_read_edid (output);
|
2013-07-30 05:36:18 -04:00
|
|
|
}
|
|
|
|
|
2019-01-11 08:45:44 -05:00
|
|
|
static void
|
|
|
|
meta_monitor_manager_kms_read_current_state (MetaMonitorManager *manager)
|
|
|
|
{
|
|
|
|
MetaMonitorManagerClass *parent_class =
|
|
|
|
META_MONITOR_MANAGER_CLASS (meta_monitor_manager_kms_parent_class);
|
|
|
|
MetaPowerSave power_save_mode;
|
|
|
|
|
|
|
|
power_save_mode = meta_monitor_manager_get_power_save_mode (manager);
|
|
|
|
if (power_save_mode != META_POWER_SAVE_ON)
|
|
|
|
meta_monitor_manager_power_save_mode_changed (manager,
|
|
|
|
META_POWER_SAVE_ON);
|
|
|
|
|
|
|
|
parent_class->read_current_state (manager);
|
|
|
|
}
|
|
|
|
|
2013-07-30 05:36:18 -04:00
|
|
|
static void
|
|
|
|
meta_monitor_manager_kms_set_power_save_mode (MetaMonitorManager *manager,
|
|
|
|
MetaPowerSave mode)
|
|
|
|
{
|
backend/native: Add and use transactional KMS API
This commit introduces, and makes use of, a transactional API used for
setting up KMS state, later to be applied, potentially atomically. From
an API point of view, so is always the case, but in the current
implementation, it still uses legacy drmMode* API to apply the state
non-atomically.
The API consists of various buliding blocks:
* MetaKmsUpdate - a set of configuration changes, the higher level
handle for handing over configuration to the impl backend. It's used to
set mode, assign framebuffers to planes, queue page flips and set
connector properties.
* MetaKmsPlaneAssignment - the assignment of a framebuffer to a plane.
Currently used to map a framebuffer to the primary plane of a CRTC. In
the legacy KMS implementation, the plane assignment is used to derive
the framebuffer used for mode setting and page flipping.
This also means various high level changes:
State, excluding configuring the cursor plane and creating/destroying
DRM framebuffer handles, are applied in the end of a clutter frame, in
one go. From an API point of view, this is done atomically, but as
mentioned, only the non-atomic implementation exists so far.
From MetaRendererNative's point of view, a page flip now initially
always succeeds; the handling of EBUSY errors are done asynchronously in
the MetaKmsImpl backend (still by retrying at refresh rate, but
postponing flip callbacks instead of manipulating the frame clock).
Handling of falling back to mode setting instead of page flipping is
notified after the fact by a more precise page flip feedback API.
EGLStream based page flipping relies on the impl backend not being
atomic, as the page flipping is done in the EGLStream backend (e.g.
nvidia driver). It uses a 'custom' page flip queueing method, keeping
the EGLStream logic inside meta-renderer-native.c.
Page flip handling is moved to meta-kms-impl-device.c from
meta-gpu-kms.c. It goes via an extra idle callback before reaching
meta-renderer-native.c to make sure callbacks are invoked outside of the
impl context.
While dummy power save page flipping is kept in meta-renderer-native.c, the
EBUSY handling is moved to meta-kms-impl-simple.c. Instead of freezing the
frame clock, actual page flip callbacks are postponed until all EBUSY retries
have either succeeded or failed due to some other error than EBUSY. This
effectively inhibits new frames to be drawn, meaning we won't stall waiting on
the file descriptor for pending page flips.
https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-04-04 16:36:41 -04:00
|
|
|
MetaBackend *backend = meta_monitor_manager_get_backend (manager);
|
|
|
|
MetaBackendNative *backend_native = META_BACKEND_NATIVE (backend);
|
|
|
|
MetaKms *kms = meta_backend_native_get_kms (backend_native);
|
|
|
|
MetaKmsUpdate *kms_update;
|
2013-07-30 05:36:18 -04:00
|
|
|
uint64_t state;
|
2017-03-24 05:35:51 -04:00
|
|
|
GList *l;
|
2019-11-08 18:14:36 -05:00
|
|
|
g_autoptr (MetaKmsFeedback) kms_feedback = NULL;
|
2013-07-30 05:36:18 -04:00
|
|
|
|
|
|
|
switch (mode) {
|
|
|
|
case META_POWER_SAVE_ON:
|
|
|
|
state = DRM_MODE_DPMS_ON;
|
|
|
|
break;
|
|
|
|
case META_POWER_SAVE_STANDBY:
|
|
|
|
state = DRM_MODE_DPMS_STANDBY;
|
|
|
|
break;
|
|
|
|
case META_POWER_SAVE_SUSPEND:
|
|
|
|
state = DRM_MODE_DPMS_SUSPEND;
|
|
|
|
break;
|
|
|
|
case META_POWER_SAVE_OFF:
|
2014-03-03 18:43:12 -05:00
|
|
|
state = DRM_MODE_DPMS_OFF;
|
2013-07-30 05:36:18 -04:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
backend/native: Add and use transactional KMS API
This commit introduces, and makes use of, a transactional API used for
setting up KMS state, later to be applied, potentially atomically. From
an API point of view, so is always the case, but in the current
implementation, it still uses legacy drmMode* API to apply the state
non-atomically.
The API consists of various buliding blocks:
* MetaKmsUpdate - a set of configuration changes, the higher level
handle for handing over configuration to the impl backend. It's used to
set mode, assign framebuffers to planes, queue page flips and set
connector properties.
* MetaKmsPlaneAssignment - the assignment of a framebuffer to a plane.
Currently used to map a framebuffer to the primary plane of a CRTC. In
the legacy KMS implementation, the plane assignment is used to derive
the framebuffer used for mode setting and page flipping.
This also means various high level changes:
State, excluding configuring the cursor plane and creating/destroying
DRM framebuffer handles, are applied in the end of a clutter frame, in
one go. From an API point of view, this is done atomically, but as
mentioned, only the non-atomic implementation exists so far.
From MetaRendererNative's point of view, a page flip now initially
always succeeds; the handling of EBUSY errors are done asynchronously in
the MetaKmsImpl backend (still by retrying at refresh rate, but
postponing flip callbacks instead of manipulating the frame clock).
Handling of falling back to mode setting instead of page flipping is
notified after the fact by a more precise page flip feedback API.
EGLStream based page flipping relies on the impl backend not being
atomic, as the page flipping is done in the EGLStream backend (e.g.
nvidia driver). It uses a 'custom' page flip queueing method, keeping
the EGLStream logic inside meta-renderer-native.c.
Page flip handling is moved to meta-kms-impl-device.c from
meta-gpu-kms.c. It goes via an extra idle callback before reaching
meta-renderer-native.c to make sure callbacks are invoked outside of the
impl context.
While dummy power save page flipping is kept in meta-renderer-native.c, the
EBUSY handling is moved to meta-kms-impl-simple.c. Instead of freezing the
frame clock, actual page flip callbacks are postponed until all EBUSY retries
have either succeeded or failed due to some other error than EBUSY. This
effectively inhibits new frames to be drawn, meaning we won't stall waiting on
the file descriptor for pending page flips.
https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-04-04 16:36:41 -04:00
|
|
|
kms_update = meta_kms_ensure_pending_update (kms);
|
|
|
|
for (l = meta_backend_get_gpus (backend); l; l = l->next)
|
2013-07-30 05:36:18 -04:00
|
|
|
{
|
2017-07-10 06:19:32 -04:00
|
|
|
MetaGpuKms *gpu_kms = l->data;
|
2013-07-30 05:36:18 -04:00
|
|
|
|
backend/native: Add and use transactional KMS API
This commit introduces, and makes use of, a transactional API used for
setting up KMS state, later to be applied, potentially atomically. From
an API point of view, so is always the case, but in the current
implementation, it still uses legacy drmMode* API to apply the state
non-atomically.
The API consists of various buliding blocks:
* MetaKmsUpdate - a set of configuration changes, the higher level
handle for handing over configuration to the impl backend. It's used to
set mode, assign framebuffers to planes, queue page flips and set
connector properties.
* MetaKmsPlaneAssignment - the assignment of a framebuffer to a plane.
Currently used to map a framebuffer to the primary plane of a CRTC. In
the legacy KMS implementation, the plane assignment is used to derive
the framebuffer used for mode setting and page flipping.
This also means various high level changes:
State, excluding configuring the cursor plane and creating/destroying
DRM framebuffer handles, are applied in the end of a clutter frame, in
one go. From an API point of view, this is done atomically, but as
mentioned, only the non-atomic implementation exists so far.
From MetaRendererNative's point of view, a page flip now initially
always succeeds; the handling of EBUSY errors are done asynchronously in
the MetaKmsImpl backend (still by retrying at refresh rate, but
postponing flip callbacks instead of manipulating the frame clock).
Handling of falling back to mode setting instead of page flipping is
notified after the fact by a more precise page flip feedback API.
EGLStream based page flipping relies on the impl backend not being
atomic, as the page flipping is done in the EGLStream backend (e.g.
nvidia driver). It uses a 'custom' page flip queueing method, keeping
the EGLStream logic inside meta-renderer-native.c.
Page flip handling is moved to meta-kms-impl-device.c from
meta-gpu-kms.c. It goes via an extra idle callback before reaching
meta-renderer-native.c to make sure callbacks are invoked outside of the
impl context.
While dummy power save page flipping is kept in meta-renderer-native.c, the
EBUSY handling is moved to meta-kms-impl-simple.c. Instead of freezing the
frame clock, actual page flip callbacks are postponed until all EBUSY retries
have either succeeded or failed due to some other error than EBUSY. This
effectively inhibits new frames to be drawn, meaning we won't stall waiting on
the file descriptor for pending page flips.
https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-04-04 16:36:41 -04:00
|
|
|
meta_gpu_kms_set_power_save_mode (gpu_kms, state, kms_update);
|
2013-07-30 05:36:18 -04:00
|
|
|
}
|
backend/native: Add and use transactional KMS API
This commit introduces, and makes use of, a transactional API used for
setting up KMS state, later to be applied, potentially atomically. From
an API point of view, so is always the case, but in the current
implementation, it still uses legacy drmMode* API to apply the state
non-atomically.
The API consists of various buliding blocks:
* MetaKmsUpdate - a set of configuration changes, the higher level
handle for handing over configuration to the impl backend. It's used to
set mode, assign framebuffers to planes, queue page flips and set
connector properties.
* MetaKmsPlaneAssignment - the assignment of a framebuffer to a plane.
Currently used to map a framebuffer to the primary plane of a CRTC. In
the legacy KMS implementation, the plane assignment is used to derive
the framebuffer used for mode setting and page flipping.
This also means various high level changes:
State, excluding configuring the cursor plane and creating/destroying
DRM framebuffer handles, are applied in the end of a clutter frame, in
one go. From an API point of view, this is done atomically, but as
mentioned, only the non-atomic implementation exists so far.
From MetaRendererNative's point of view, a page flip now initially
always succeeds; the handling of EBUSY errors are done asynchronously in
the MetaKmsImpl backend (still by retrying at refresh rate, but
postponing flip callbacks instead of manipulating the frame clock).
Handling of falling back to mode setting instead of page flipping is
notified after the fact by a more precise page flip feedback API.
EGLStream based page flipping relies on the impl backend not being
atomic, as the page flipping is done in the EGLStream backend (e.g.
nvidia driver). It uses a 'custom' page flip queueing method, keeping
the EGLStream logic inside meta-renderer-native.c.
Page flip handling is moved to meta-kms-impl-device.c from
meta-gpu-kms.c. It goes via an extra idle callback before reaching
meta-renderer-native.c to make sure callbacks are invoked outside of the
impl context.
While dummy power save page flipping is kept in meta-renderer-native.c, the
EBUSY handling is moved to meta-kms-impl-simple.c. Instead of freezing the
frame clock, actual page flip callbacks are postponed until all EBUSY retries
have either succeeded or failed due to some other error than EBUSY. This
effectively inhibits new frames to be drawn, meaning we won't stall waiting on
the file descriptor for pending page flips.
https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-04-04 16:36:41 -04:00
|
|
|
|
2019-11-08 18:14:36 -05:00
|
|
|
kms_feedback = meta_kms_post_pending_update_sync (kms);
|
|
|
|
if (meta_kms_feedback_get_result (kms_feedback) != META_KMS_FEEDBACK_PASSED)
|
|
|
|
{
|
|
|
|
g_warning ("Failed to set DPMS: %s",
|
|
|
|
meta_kms_feedback_get_error (kms_feedback)->message);
|
|
|
|
}
|
2013-07-30 05:36:18 -04:00
|
|
|
}
|
|
|
|
|
2017-01-06 00:27:21 -05:00
|
|
|
static void
|
|
|
|
meta_monitor_manager_kms_ensure_initial_config (MetaMonitorManager *manager)
|
|
|
|
{
|
2017-01-09 01:31:18 -05:00
|
|
|
MetaMonitorsConfig *config;
|
2017-01-06 00:27:21 -05:00
|
|
|
|
2017-01-09 01:31:18 -05:00
|
|
|
config = meta_monitor_manager_ensure_configured (manager);
|
|
|
|
|
2017-03-24 03:36:12 -04:00
|
|
|
meta_monitor_manager_update_logical_state (manager, config);
|
2017-01-06 00:27:21 -05:00
|
|
|
}
|
|
|
|
|
2013-07-30 05:36:18 -04:00
|
|
|
static void
|
2017-01-09 01:31:18 -05:00
|
|
|
apply_crtc_assignments (MetaMonitorManager *manager,
|
|
|
|
MetaCrtcInfo **crtcs,
|
|
|
|
unsigned int n_crtcs,
|
|
|
|
MetaOutputInfo **outputs,
|
|
|
|
unsigned int n_outputs)
|
2013-07-30 05:36:18 -04:00
|
|
|
{
|
2019-01-11 09:35:42 -05:00
|
|
|
MetaBackend *backend = meta_monitor_manager_get_backend (manager);
|
2013-07-30 05:36:18 -04:00
|
|
|
unsigned i;
|
2019-01-11 09:35:42 -05:00
|
|
|
GList *gpus;
|
2017-03-24 05:35:51 -04:00
|
|
|
GList *l;
|
2013-07-30 05:36:18 -04:00
|
|
|
|
|
|
|
for (i = 0; i < n_crtcs; i++)
|
|
|
|
{
|
2016-12-07 23:15:28 -05:00
|
|
|
MetaCrtcInfo *crtc_info = crtcs[i];
|
|
|
|
MetaCrtc *crtc = crtc_info->crtc;
|
2013-07-30 05:36:18 -04:00
|
|
|
|
|
|
|
crtc->is_dirty = TRUE;
|
|
|
|
|
|
|
|
if (crtc_info->mode == NULL)
|
|
|
|
{
|
2020-01-14 16:34:44 -05:00
|
|
|
meta_crtc_unset_config (crtc);
|
2013-07-30 05:36:18 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-05-12 02:55:06 -04:00
|
|
|
unsigned int j;
|
2013-07-30 05:36:18 -04:00
|
|
|
|
2020-01-14 16:34:44 -05:00
|
|
|
meta_crtc_set_config (crtc,
|
|
|
|
&crtc_info->layout,
|
|
|
|
crtc_info->mode,
|
|
|
|
crtc_info->transform);
|
2016-08-03 03:16:16 -04:00
|
|
|
|
|
|
|
for (j = 0; j < crtc_info->outputs->len; j++)
|
|
|
|
{
|
|
|
|
MetaOutput *output = g_ptr_array_index (crtc_info->outputs, j);
|
|
|
|
|
|
|
|
output->is_dirty = TRUE;
|
2017-11-03 06:25:30 -04:00
|
|
|
meta_output_assign_crtc (output, crtc);
|
2016-08-03 03:16:16 -04:00
|
|
|
}
|
2013-07-30 05:36:18 -04:00
|
|
|
}
|
2016-07-31 17:41:26 -04:00
|
|
|
}
|
2013-07-30 05:36:18 -04:00
|
|
|
/* Disable CRTCs not mentioned in the list (they have is_dirty == FALSE,
|
|
|
|
because they weren't seen in the first loop) */
|
2019-01-11 09:35:42 -05:00
|
|
|
gpus = meta_backend_get_gpus (backend);
|
|
|
|
for (l = gpus; l; l = l->next)
|
2013-07-30 05:36:18 -04:00
|
|
|
{
|
2017-07-10 06:19:32 -04:00
|
|
|
MetaGpu *gpu = l->data;
|
|
|
|
GList *k;
|
2013-07-30 05:36:18 -04:00
|
|
|
|
2017-07-10 06:19:32 -04:00
|
|
|
for (k = meta_gpu_get_crtcs (gpu); k; k = k->next)
|
2013-07-30 05:36:18 -04:00
|
|
|
{
|
2017-07-10 06:19:32 -04:00
|
|
|
MetaCrtc *crtc = k->data;
|
|
|
|
|
|
|
|
if (crtc->is_dirty)
|
|
|
|
{
|
|
|
|
crtc->is_dirty = FALSE;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2020-01-14 16:34:44 -05:00
|
|
|
meta_crtc_unset_config (crtc);
|
2017-07-10 06:19:32 -04:00
|
|
|
}
|
2013-07-30 05:36:18 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < n_outputs; i++)
|
|
|
|
{
|
|
|
|
MetaOutputInfo *output_info = outputs[i];
|
|
|
|
MetaOutput *output = output_info->output;
|
|
|
|
|
|
|
|
output->is_primary = output_info->is_primary;
|
|
|
|
output->is_presentation = output_info->is_presentation;
|
2015-04-27 20:42:10 -04:00
|
|
|
output->is_underscanning = output_info->is_underscanning;
|
2013-07-30 05:36:18 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Disable outputs not mentioned in the list */
|
2019-01-11 09:35:42 -05:00
|
|
|
for (l = gpus; l; l = l->next)
|
2013-07-30 05:36:18 -04:00
|
|
|
{
|
2017-07-10 06:19:32 -04:00
|
|
|
MetaGpu *gpu = l->data;
|
|
|
|
GList *k;
|
2013-07-30 05:36:18 -04:00
|
|
|
|
2017-07-10 06:19:32 -04:00
|
|
|
for (k = meta_gpu_get_outputs (gpu); k; k = k->next)
|
2013-07-30 05:36:18 -04:00
|
|
|
{
|
2017-07-10 06:19:32 -04:00
|
|
|
MetaOutput *output = k->data;
|
2013-07-30 05:36:18 -04:00
|
|
|
|
2017-07-10 06:19:32 -04:00
|
|
|
if (output->is_dirty)
|
|
|
|
{
|
|
|
|
output->is_dirty = FALSE;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2017-11-03 06:25:30 -04:00
|
|
|
meta_output_unassign_crtc (output);
|
2017-07-10 06:19:32 -04:00
|
|
|
output->is_primary = FALSE;
|
|
|
|
}
|
2013-07-30 05:36:18 -04:00
|
|
|
}
|
2017-01-09 01:31:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
update_screen_size (MetaMonitorManager *manager,
|
|
|
|
MetaMonitorsConfig *config)
|
|
|
|
{
|
|
|
|
GList *l;
|
|
|
|
int screen_width = 0;
|
|
|
|
int screen_height = 0;
|
|
|
|
|
|
|
|
for (l = config->logical_monitor_configs; l; l = l->next)
|
|
|
|
{
|
|
|
|
MetaLogicalMonitorConfig *logical_monitor_config = l->data;
|
|
|
|
int right_edge;
|
|
|
|
int bottom_edge;
|
|
|
|
|
|
|
|
right_edge = (logical_monitor_config->layout.width +
|
|
|
|
logical_monitor_config->layout.x);
|
|
|
|
if (right_edge > screen_width)
|
|
|
|
screen_width = right_edge;
|
|
|
|
|
|
|
|
bottom_edge = (logical_monitor_config->layout.height +
|
|
|
|
logical_monitor_config->layout.y);
|
|
|
|
if (bottom_edge > screen_height)
|
|
|
|
screen_height = bottom_edge;
|
|
|
|
}
|
2013-07-30 05:36:18 -04:00
|
|
|
|
|
|
|
manager->screen_width = screen_width;
|
|
|
|
manager->screen_height = screen_height;
|
2017-01-09 01:31:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2017-02-14 06:54:04 -05:00
|
|
|
meta_monitor_manager_kms_apply_monitors_config (MetaMonitorManager *manager,
|
|
|
|
MetaMonitorsConfig *config,
|
|
|
|
MetaMonitorsConfigMethod method,
|
|
|
|
GError **error)
|
2017-01-09 01:31:18 -05:00
|
|
|
{
|
|
|
|
GPtrArray *crtc_infos;
|
|
|
|
GPtrArray *output_infos;
|
|
|
|
|
2017-01-12 00:47:54 -05:00
|
|
|
if (!config)
|
|
|
|
{
|
2017-04-12 02:15:33 -04:00
|
|
|
manager->screen_width = META_MONITOR_MANAGER_MIN_SCREEN_WIDTH;
|
|
|
|
manager->screen_height = META_MONITOR_MANAGER_MIN_SCREEN_HEIGHT;
|
2017-01-20 01:50:11 -05:00
|
|
|
meta_monitor_manager_rebuild (manager, NULL);
|
2017-01-12 00:47:54 -05:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2017-01-09 01:31:18 -05:00
|
|
|
if (!meta_monitor_config_manager_assign (manager, config,
|
|
|
|
&crtc_infos, &output_infos,
|
|
|
|
error))
|
|
|
|
return FALSE;
|
|
|
|
|
2017-02-14 06:54:04 -05:00
|
|
|
if (method == META_MONITORS_CONFIG_METHOD_VERIFY)
|
|
|
|
{
|
|
|
|
g_ptr_array_free (crtc_infos, TRUE);
|
|
|
|
g_ptr_array_free (output_infos, TRUE);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2017-01-09 01:31:18 -05:00
|
|
|
apply_crtc_assignments (manager,
|
|
|
|
(MetaCrtcInfo **) crtc_infos->pdata,
|
|
|
|
crtc_infos->len,
|
|
|
|
(MetaOutputInfo **) output_infos->pdata,
|
|
|
|
output_infos->len);
|
|
|
|
|
|
|
|
g_ptr_array_free (crtc_infos, TRUE);
|
|
|
|
g_ptr_array_free (output_infos, TRUE);
|
|
|
|
|
|
|
|
update_screen_size (manager, config);
|
|
|
|
meta_monitor_manager_rebuild (manager, config);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-07-30 05:36:18 -04:00
|
|
|
static void
|
|
|
|
meta_monitor_manager_kms_get_crtc_gamma (MetaMonitorManager *manager,
|
2016-12-07 23:15:28 -05:00
|
|
|
MetaCrtc *crtc,
|
2013-07-30 05:36:18 -04:00
|
|
|
gsize *size,
|
|
|
|
unsigned short **red,
|
|
|
|
unsigned short **green,
|
|
|
|
unsigned short **blue)
|
|
|
|
{
|
2019-05-03 13:20:21 -04:00
|
|
|
MetaKmsCrtc *kms_crtc;
|
|
|
|
const MetaKmsCrtcState *crtc_state;
|
2013-07-30 05:36:18 -04:00
|
|
|
|
2019-05-03 13:20:21 -04:00
|
|
|
kms_crtc = meta_crtc_kms_get_kms_crtc (crtc);
|
|
|
|
crtc_state = meta_kms_crtc_get_current_state (kms_crtc);
|
2013-07-30 05:36:18 -04:00
|
|
|
|
2019-05-03 13:20:21 -04:00
|
|
|
*size = crtc_state->gamma.size;
|
|
|
|
*red = g_memdup (crtc_state->gamma.red, *size * sizeof **red);
|
|
|
|
*green = g_memdup (crtc_state->gamma.green, *size * sizeof **green);
|
|
|
|
*blue = g_memdup (crtc_state->gamma.blue, *size * sizeof **blue);
|
2013-07-30 05:36:18 -04:00
|
|
|
}
|
|
|
|
|
2019-04-26 03:53:25 -04:00
|
|
|
static char *
|
|
|
|
generate_gamma_ramp_string (size_t size,
|
|
|
|
unsigned short *red,
|
|
|
|
unsigned short *green,
|
|
|
|
unsigned short *blue)
|
|
|
|
{
|
|
|
|
GString *string;
|
|
|
|
int color;
|
|
|
|
|
|
|
|
string = g_string_new ("[");
|
|
|
|
for (color = 0; color < 3; color++)
|
|
|
|
{
|
|
|
|
unsigned short **color_ptr;
|
|
|
|
char color_char;
|
|
|
|
size_t i;
|
|
|
|
|
|
|
|
switch (color)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
color_ptr = &red;
|
|
|
|
color_char = 'r';
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
color_ptr = &green;
|
|
|
|
color_char = 'g';
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
color_ptr = &blue;
|
|
|
|
color_char = 'b';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_string_append_printf (string, " %c: ", color_char);
|
|
|
|
for (i = 0; i < MIN (4, size); i++)
|
|
|
|
{
|
|
|
|
int j;
|
|
|
|
|
|
|
|
if (size > 4)
|
|
|
|
{
|
|
|
|
if (i == 2)
|
|
|
|
g_string_append (string, ",...");
|
|
|
|
|
|
|
|
if (i >= 2)
|
|
|
|
j = i + (size - 4);
|
|
|
|
else
|
|
|
|
j = i;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
j = i;
|
|
|
|
}
|
|
|
|
g_string_append_printf (string, "%s%hu",
|
|
|
|
j == 0 ? "" : ",",
|
|
|
|
(*color_ptr)[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
g_string_append (string, " ]");
|
|
|
|
|
|
|
|
return g_string_free (string, FALSE);
|
|
|
|
}
|
|
|
|
|
2013-07-30 05:36:18 -04:00
|
|
|
static void
|
|
|
|
meta_monitor_manager_kms_set_crtc_gamma (MetaMonitorManager *manager,
|
2016-12-07 23:15:28 -05:00
|
|
|
MetaCrtc *crtc,
|
2013-07-30 05:36:18 -04:00
|
|
|
gsize size,
|
|
|
|
unsigned short *red,
|
|
|
|
unsigned short *green,
|
|
|
|
unsigned short *blue)
|
|
|
|
{
|
2019-05-03 13:20:21 -04:00
|
|
|
MetaBackend *backend = meta_monitor_manager_get_backend (manager);
|
|
|
|
MetaBackendNative *backend_native = META_BACKEND_NATIVE (backend);
|
|
|
|
MetaKms *kms = meta_backend_native_get_kms (backend_native);
|
|
|
|
MetaKmsCrtc *kms_crtc;
|
2019-04-26 03:53:25 -04:00
|
|
|
g_autofree char *gamma_ramp_string = NULL;
|
2019-05-03 13:20:21 -04:00
|
|
|
MetaKmsUpdate *kms_update;
|
2019-11-08 18:14:36 -05:00
|
|
|
g_autoptr (MetaKmsFeedback) kms_feedback = NULL;
|
2013-07-30 05:36:18 -04:00
|
|
|
|
2019-04-26 03:53:25 -04:00
|
|
|
gamma_ramp_string = generate_gamma_ramp_string (size, red, green, blue);
|
2020-02-25 05:34:43 -05:00
|
|
|
g_debug ("Setting CRTC (%ld) gamma to %s",
|
|
|
|
meta_crtc_get_id (crtc), gamma_ramp_string);
|
2019-04-26 03:53:25 -04:00
|
|
|
|
2019-05-03 13:20:21 -04:00
|
|
|
kms_update = meta_kms_ensure_pending_update (kms);
|
|
|
|
|
|
|
|
kms_crtc = meta_crtc_kms_get_kms_crtc (crtc);
|
|
|
|
meta_kms_crtc_set_gamma (kms_crtc, kms_update,
|
|
|
|
size, red, green, blue);
|
|
|
|
|
2019-11-08 18:14:36 -05:00
|
|
|
kms_feedback = meta_kms_post_pending_update_sync (kms);
|
|
|
|
if (meta_kms_feedback_get_result (kms_feedback) != META_KMS_FEEDBACK_PASSED)
|
|
|
|
{
|
|
|
|
g_warning ("Failed to set CRTC gamma: %s",
|
|
|
|
meta_kms_feedback_get_error (kms_feedback)->message);
|
|
|
|
}
|
2013-07-30 05:36:18 -04:00
|
|
|
}
|
|
|
|
|
2016-12-21 03:00:29 -05:00
|
|
|
static void
|
|
|
|
handle_hotplug_event (MetaMonitorManager *manager)
|
|
|
|
{
|
|
|
|
meta_monitor_manager_read_current_state (manager);
|
|
|
|
meta_monitor_manager_on_hotplug (manager);
|
|
|
|
}
|
|
|
|
|
2019-01-10 13:01:29 -05:00
|
|
|
static void
|
2019-08-22 09:15:51 -04:00
|
|
|
on_kms_resources_changed (MetaKms *kms,
|
|
|
|
MetaMonitorManager *manager)
|
2019-08-05 08:08:08 -04:00
|
|
|
{
|
|
|
|
handle_hotplug_event (manager);
|
|
|
|
}
|
|
|
|
|
2019-01-10 13:01:29 -05:00
|
|
|
static void
|
|
|
|
meta_monitor_manager_kms_connect_hotplug_handler (MetaMonitorManagerKms *manager_kms)
|
|
|
|
{
|
|
|
|
MetaMonitorManager *manager = META_MONITOR_MANAGER (manager_kms);
|
|
|
|
MetaBackend *backend = meta_monitor_manager_get_backend (manager);
|
2019-08-22 09:15:51 -04:00
|
|
|
MetaBackendNative *backend_native = META_BACKEND_NATIVE (backend);
|
|
|
|
MetaKms *kms = meta_backend_native_get_kms (backend_native);
|
|
|
|
|
|
|
|
manager_kms->kms_resources_changed_handler_id =
|
|
|
|
g_signal_connect (kms, "resources-changed",
|
|
|
|
G_CALLBACK (on_kms_resources_changed), manager);
|
2019-01-10 13:01:29 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_monitor_manager_kms_disconnect_hotplug_handler (MetaMonitorManagerKms *manager_kms)
|
|
|
|
{
|
|
|
|
MetaMonitorManager *manager = META_MONITOR_MANAGER (manager_kms);
|
|
|
|
MetaBackend *backend = meta_monitor_manager_get_backend (manager);
|
2019-08-22 09:15:51 -04:00
|
|
|
MetaBackendNative *backend_native = META_BACKEND_NATIVE (backend);
|
|
|
|
MetaKms *kms = meta_backend_native_get_kms (backend_native);
|
2019-01-10 13:01:29 -05:00
|
|
|
|
2019-08-22 09:15:51 -04:00
|
|
|
g_clear_signal_handler (&manager_kms->kms_resources_changed_handler_id, kms);
|
2019-01-10 13:01:29 -05:00
|
|
|
}
|
|
|
|
|
2017-03-10 03:29:11 -05:00
|
|
|
void
|
|
|
|
meta_monitor_manager_kms_pause (MetaMonitorManagerKms *manager_kms)
|
|
|
|
{
|
2019-01-10 13:01:29 -05:00
|
|
|
meta_monitor_manager_kms_disconnect_hotplug_handler (manager_kms);
|
2017-03-10 03:29:11 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_monitor_manager_kms_resume (MetaMonitorManagerKms *manager_kms)
|
|
|
|
{
|
2019-01-10 13:01:29 -05:00
|
|
|
meta_monitor_manager_kms_connect_hotplug_handler (manager_kms);
|
2019-01-11 09:35:42 -05:00
|
|
|
handle_hotplug_event (META_MONITOR_MANAGER (manager_kms));
|
2017-03-10 03:29:11 -05:00
|
|
|
}
|
|
|
|
|
2017-03-08 03:05:00 -05:00
|
|
|
static gboolean
|
|
|
|
meta_monitor_manager_kms_is_transform_handled (MetaMonitorManager *manager,
|
|
|
|
MetaCrtc *crtc,
|
|
|
|
MetaMonitorTransform transform)
|
|
|
|
{
|
2017-07-04 04:04:39 -04:00
|
|
|
return meta_crtc_kms_is_transform_handled (crtc, transform);
|
2017-03-08 03:05:00 -05:00
|
|
|
}
|
|
|
|
|
2017-05-25 04:12:51 -04:00
|
|
|
static float
|
2017-01-20 02:07:12 -05:00
|
|
|
meta_monitor_manager_kms_calculate_monitor_mode_scale (MetaMonitorManager *manager,
|
|
|
|
MetaMonitor *monitor,
|
|
|
|
MetaMonitorMode *monitor_mode)
|
|
|
|
{
|
2017-04-21 05:28:22 -04:00
|
|
|
return meta_monitor_calculate_mode_scale (monitor, monitor_mode);
|
2017-01-20 02:07:12 -05:00
|
|
|
}
|
|
|
|
|
2017-06-05 03:59:47 -04:00
|
|
|
static float *
|
2019-03-08 13:03:57 -05:00
|
|
|
meta_monitor_manager_kms_calculate_supported_scales (MetaMonitorManager *manager,
|
|
|
|
MetaLogicalMonitorLayoutMode layout_mode,
|
|
|
|
MetaMonitor *monitor,
|
|
|
|
MetaMonitorMode *monitor_mode,
|
|
|
|
int *n_supported_scales)
|
2017-01-26 04:14:32 -05:00
|
|
|
{
|
2017-06-05 03:59:47 -04:00
|
|
|
MetaMonitorScalesConstraint constraints =
|
|
|
|
META_MONITOR_SCALES_CONSTRAINT_NONE;
|
|
|
|
|
2017-05-25 05:20:59 -04:00
|
|
|
switch (layout_mode)
|
|
|
|
{
|
|
|
|
case META_LOGICAL_MONITOR_LAYOUT_MODE_LOGICAL:
|
|
|
|
break;
|
|
|
|
case META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL:
|
2017-06-05 03:59:47 -04:00
|
|
|
constraints |= META_MONITOR_SCALES_CONSTRAINT_NO_FRAC;
|
2017-05-25 05:20:59 -04:00
|
|
|
break;
|
|
|
|
}
|
2017-06-05 03:59:47 -04:00
|
|
|
|
|
|
|
return meta_monitor_calculate_supported_scales (monitor, monitor_mode,
|
|
|
|
constraints,
|
|
|
|
n_supported_scales);
|
2017-01-26 04:14:32 -05:00
|
|
|
}
|
|
|
|
|
2017-02-07 03:01:40 -05:00
|
|
|
static MetaMonitorManagerCapability
|
|
|
|
meta_monitor_manager_kms_get_capabilities (MetaMonitorManager *manager)
|
|
|
|
{
|
2017-07-10 05:39:07 -04:00
|
|
|
MetaBackend *backend = meta_monitor_manager_get_backend (manager);
|
2017-04-21 04:40:51 -04:00
|
|
|
MetaSettings *settings = meta_backend_get_settings (backend);
|
2017-02-07 03:01:40 -05:00
|
|
|
MetaMonitorManagerCapability capabilities =
|
|
|
|
META_MONITOR_MANAGER_CAPABILITY_NONE;
|
|
|
|
|
2017-04-21 04:40:51 -04:00
|
|
|
if (meta_settings_is_experimental_feature_enabled (
|
|
|
|
settings,
|
2017-02-24 05:10:52 -05:00
|
|
|
META_EXPERIMENTAL_FEATURE_SCALE_MONITOR_FRAMEBUFFER))
|
|
|
|
capabilities |= META_MONITOR_MANAGER_CAPABILITY_LAYOUT_MODE;
|
|
|
|
|
2017-02-07 03:01:40 -05:00
|
|
|
return capabilities;
|
|
|
|
}
|
|
|
|
|
2017-02-15 03:06:46 -05:00
|
|
|
static gboolean
|
|
|
|
meta_monitor_manager_kms_get_max_screen_size (MetaMonitorManager *manager,
|
|
|
|
int *max_width,
|
|
|
|
int *max_height)
|
|
|
|
{
|
2018-12-04 08:55:05 -05:00
|
|
|
return FALSE;
|
2017-02-15 03:06:46 -05:00
|
|
|
}
|
|
|
|
|
2017-02-24 05:10:52 -05:00
|
|
|
static MetaLogicalMonitorLayoutMode
|
|
|
|
meta_monitor_manager_kms_get_default_layout_mode (MetaMonitorManager *manager)
|
|
|
|
{
|
2017-07-10 05:39:07 -04:00
|
|
|
MetaBackend *backend = meta_monitor_manager_get_backend (manager);
|
2017-04-21 04:40:51 -04:00
|
|
|
MetaSettings *settings = meta_backend_get_settings (backend);
|
|
|
|
|
|
|
|
if (meta_settings_is_experimental_feature_enabled (
|
|
|
|
settings,
|
2017-02-24 05:10:52 -05:00
|
|
|
META_EXPERIMENTAL_FEATURE_SCALE_MONITOR_FRAMEBUFFER))
|
|
|
|
return META_LOGICAL_MONITOR_LAYOUT_MODE_LOGICAL;
|
|
|
|
else
|
|
|
|
return META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL;
|
|
|
|
}
|
|
|
|
|
2017-07-06 04:00:56 -04:00
|
|
|
static gboolean
|
|
|
|
meta_monitor_manager_kms_initable_init (GInitable *initable,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
GError **error)
|
|
|
|
{
|
|
|
|
MetaMonitorManagerKms *manager_kms = META_MONITOR_MANAGER_KMS (initable);
|
2018-08-13 06:22:22 -04:00
|
|
|
MetaMonitorManager *manager = META_MONITOR_MANAGER (manager_kms);
|
2019-01-11 09:35:42 -05:00
|
|
|
MetaBackend *backend = meta_monitor_manager_get_backend (manager);
|
2018-08-13 06:22:22 -04:00
|
|
|
gboolean can_have_outputs;
|
2019-01-11 09:35:42 -05:00
|
|
|
GList *l;
|
2017-07-06 04:00:56 -04:00
|
|
|
|
2019-01-10 13:01:29 -05:00
|
|
|
meta_monitor_manager_kms_connect_hotplug_handler (manager_kms);
|
2017-07-05 06:06:06 -04:00
|
|
|
|
2018-08-13 06:22:22 -04:00
|
|
|
can_have_outputs = FALSE;
|
2019-01-11 09:35:42 -05:00
|
|
|
for (l = meta_backend_get_gpus (backend); l; l = l->next)
|
2018-08-13 06:22:22 -04:00
|
|
|
{
|
|
|
|
MetaGpuKms *gpu_kms = l->data;
|
|
|
|
|
|
|
|
if (meta_gpu_kms_can_have_outputs (gpu_kms))
|
|
|
|
{
|
|
|
|
can_have_outputs = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!can_have_outputs)
|
|
|
|
{
|
|
|
|
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
|
|
|
|
"No GPUs with outputs found");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2017-07-06 04:00:56 -04:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
initable_iface_init (GInitableIface *initable_iface)
|
|
|
|
{
|
|
|
|
initable_iface->init = meta_monitor_manager_kms_initable_init;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_monitor_manager_kms_init (MetaMonitorManagerKms *manager_kms)
|
|
|
|
{
|
2017-07-05 06:06:06 -04:00
|
|
|
}
|
|
|
|
|
2013-07-30 05:36:18 -04:00
|
|
|
static void
|
|
|
|
meta_monitor_manager_kms_class_init (MetaMonitorManagerKmsClass *klass)
|
|
|
|
{
|
|
|
|
MetaMonitorManagerClass *manager_class = META_MONITOR_MANAGER_CLASS (klass);
|
|
|
|
|
|
|
|
manager_class->read_edid = meta_monitor_manager_kms_read_edid;
|
2019-01-11 08:45:44 -05:00
|
|
|
manager_class->read_current_state = meta_monitor_manager_kms_read_current_state;
|
2017-01-06 00:27:21 -05:00
|
|
|
manager_class->ensure_initial_config = meta_monitor_manager_kms_ensure_initial_config;
|
2017-01-09 01:31:18 -05:00
|
|
|
manager_class->apply_monitors_config = meta_monitor_manager_kms_apply_monitors_config;
|
2013-07-30 05:36:18 -04:00
|
|
|
manager_class->set_power_save_mode = meta_monitor_manager_kms_set_power_save_mode;
|
|
|
|
manager_class->get_crtc_gamma = meta_monitor_manager_kms_get_crtc_gamma;
|
|
|
|
manager_class->set_crtc_gamma = meta_monitor_manager_kms_set_crtc_gamma;
|
2017-03-08 03:05:00 -05:00
|
|
|
manager_class->is_transform_handled = meta_monitor_manager_kms_is_transform_handled;
|
2017-01-20 02:07:12 -05:00
|
|
|
manager_class->calculate_monitor_mode_scale = meta_monitor_manager_kms_calculate_monitor_mode_scale;
|
2017-06-05 03:59:47 -04:00
|
|
|
manager_class->calculate_supported_scales = meta_monitor_manager_kms_calculate_supported_scales;
|
2017-02-07 03:01:40 -05:00
|
|
|
manager_class->get_capabilities = meta_monitor_manager_kms_get_capabilities;
|
2017-02-15 03:06:46 -05:00
|
|
|
manager_class->get_max_screen_size = meta_monitor_manager_kms_get_max_screen_size;
|
2017-02-24 05:10:52 -05:00
|
|
|
manager_class->get_default_layout_mode = meta_monitor_manager_kms_get_default_layout_mode;
|
2016-07-31 17:41:26 -04:00
|
|
|
}
|