2019-03-08 16:23:15 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2019 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_KMS_CONNECTOR_PRIVATE_H
|
|
|
|
#define META_KMS_CONNECTOR_PRIVATE_H
|
|
|
|
|
2020-07-14 16:48:47 +02:00
|
|
|
#include "backends/native/meta-kms-connector.h"
|
|
|
|
|
|
|
|
typedef enum _MetaKmsConnectorProp
|
|
|
|
{
|
2020-07-16 22:05:18 +02:00
|
|
|
META_KMS_CONNECTOR_PROP_CRTC_ID = 0,
|
|
|
|
META_KMS_CONNECTOR_PROP_DPMS,
|
2020-07-14 16:48:47 +02:00
|
|
|
META_KMS_CONNECTOR_PROP_UNDERSCAN,
|
|
|
|
META_KMS_CONNECTOR_PROP_UNDERSCAN_HBORDER,
|
|
|
|
META_KMS_CONNECTOR_PROP_UNDERSCAN_VBORDER,
|
2021-03-22 01:27:39 +01:00
|
|
|
META_KMS_CONNECTOR_PROP_PRIVACY_SCREEN_SW_STATE,
|
|
|
|
META_KMS_CONNECTOR_PROP_PRIVACY_SCREEN_HW_STATE,
|
2022-04-20 21:43:28 +02:00
|
|
|
META_KMS_CONNECTOR_PROP_EDID,
|
|
|
|
META_KMS_CONNECTOR_PROP_TILE,
|
|
|
|
META_KMS_CONNECTOR_PROP_SUGGESTED_X,
|
|
|
|
META_KMS_CONNECTOR_PROP_SUGGESTED_Y,
|
|
|
|
META_KMS_CONNECTOR_PROP_HOTPLUG_MODE_UPDATE,
|
|
|
|
META_KMS_CONNECTOR_PROP_SCALING_MODE,
|
|
|
|
META_KMS_CONNECTOR_PROP_PANEL_ORIENTATION,
|
|
|
|
META_KMS_CONNECTOR_PROP_NON_DESKTOP,
|
2022-05-13 16:20:57 +08:00
|
|
|
META_KMS_CONNECTOR_PROP_MAX_BPC,
|
2020-07-14 16:48:47 +02:00
|
|
|
META_KMS_CONNECTOR_N_PROPS
|
|
|
|
} MetaKmsConnectorProp;
|
|
|
|
|
2022-04-20 21:43:28 +02:00
|
|
|
typedef enum _MetaKmsConnectorDpms
|
|
|
|
{
|
|
|
|
META_KMS_CONNECTOR_DPMS_ON = 0,
|
|
|
|
META_KMS_CONNECTOR_DPMS_STANDBY,
|
|
|
|
META_KMS_CONNECTOR_DPMS_SUSPEND,
|
|
|
|
META_KMS_CONNECTOR_DPMS_OFF,
|
2022-04-20 21:52:10 +02:00
|
|
|
META_KMS_CONNECTOR_DPMS_N_PROPS,
|
|
|
|
META_KMS_CONNECTOR_DPMS_UNKNOWN,
|
2022-04-20 21:43:28 +02:00
|
|
|
} MetaKmsConnectorDpms;
|
|
|
|
|
|
|
|
typedef enum _MetaKmsConnectorUnderscan
|
|
|
|
{
|
|
|
|
META_KMS_CONNECTOR_UNDERSCAN_OFF = 0,
|
|
|
|
META_KMS_CONNECTOR_UNDERSCAN_ON,
|
|
|
|
META_KMS_CONNECTOR_UNDERSCAN_AUTO,
|
2022-04-20 21:52:10 +02:00
|
|
|
META_KMS_CONNECTOR_UNDERSCAN_N_PROPS,
|
|
|
|
META_KMS_CONNECTOR_UNDERSCAN_UNKNOWN,
|
2022-04-20 21:43:28 +02:00
|
|
|
} MetaKmsConnectorUnderscan;
|
|
|
|
|
|
|
|
typedef enum _MetaKmsConnectorPrivacyScreen
|
|
|
|
{
|
|
|
|
META_KMS_CONNECTOR_PRIVACY_SCREEN_ENABLED = 0,
|
|
|
|
META_KMS_CONNECTOR_PRIVACY_SCREEN_DISABLED,
|
|
|
|
META_KMS_CONNECTOR_PRIVACY_SCREEN_ENABLED_LOCKED,
|
|
|
|
META_KMS_CONNECTOR_PRIVACY_SCREEN_DISABLED_LOCKED,
|
|
|
|
META_KMS_CONNECTOR_PRIVACY_SCREEN_N_PROPS,
|
2022-04-20 21:52:10 +02:00
|
|
|
META_KMS_CONNECTOR_PRIVACY_SCREEN_UNKNOWN,
|
2022-04-20 21:43:28 +02:00
|
|
|
} MetaKmsConnectorPrivacyScreen;
|
|
|
|
|
|
|
|
typedef enum _MetaKmsConnectorScalingMode
|
|
|
|
{
|
|
|
|
META_KMS_CONNECTOR_SCALING_MODE_NONE = 0,
|
|
|
|
META_KMS_CONNECTOR_SCALING_MODE_FULL,
|
|
|
|
META_KMS_CONNECTOR_SCALING_MODE_CENTER,
|
|
|
|
META_KMS_CONNECTOR_SCALING_MODE_FULL_ASPECT,
|
|
|
|
META_KMS_CONNECTOR_SCALING_MODE_N_PROPS,
|
2022-04-20 21:52:10 +02:00
|
|
|
META_KMS_CONNECTOR_SCALING_MODE_UNKNOWN,
|
2022-04-20 21:43:28 +02:00
|
|
|
} MetaKmsConnectorScalingMode;
|
|
|
|
|
|
|
|
typedef enum _MetaKmsConnectorPanelOrientation
|
|
|
|
{
|
|
|
|
META_KMS_CONNECTOR_PANEL_ORIENTATION_NORMAL = 0,
|
|
|
|
META_KMS_CONNECTOR_PANEL_ORIENTATION_UPSIDE_DOWN,
|
|
|
|
META_KMS_CONNECTOR_PANEL_ORIENTATION_LEFT_SIDE_UP,
|
|
|
|
META_KMS_CONNECTOR_PANEL_ORIENTATION_RIGHT_SIDE_UP,
|
|
|
|
META_KMS_CONNECTOR_PANEL_ORIENTATION_N_PROPS,
|
2022-04-20 21:52:10 +02:00
|
|
|
META_KMS_CONNECTOR_PANEL_ORIENTATION_UNKNOWN,
|
2022-04-20 21:43:28 +02:00
|
|
|
} MetaKmsConnectorPanelOrientation;
|
|
|
|
|
2020-07-14 16:48:47 +02:00
|
|
|
uint32_t meta_kms_connector_get_prop_id (MetaKmsConnector *connector,
|
|
|
|
MetaKmsConnectorProp prop);
|
|
|
|
|
|
|
|
const char * meta_kms_connector_get_prop_name (MetaKmsConnector *connector,
|
|
|
|
MetaKmsConnectorProp prop);
|
2019-03-08 16:23:15 +01:00
|
|
|
|
2022-04-20 22:54:27 +02:00
|
|
|
uint64_t meta_kms_connector_get_prop_drm_value (MetaKmsConnector *connector,
|
|
|
|
MetaKmsConnectorProp prop,
|
|
|
|
uint64_t value);
|
|
|
|
|
2022-03-17 10:22:05 +01:00
|
|
|
MetaKmsResourceChanges meta_kms_connector_update_state (MetaKmsConnector *connector,
|
kms/connector: Don't query the kernel twice when updating
On hotplug, the events we receive from the kernel are async, and
connectors in the kernel come and go as they please. In practice, this
means that calling drmModeGetConnector() twice more or less directly
after each other, there is no guarantee that the latter call will return
anything if the former did.
When updating the connector in response to hotplugs, we'd first update
the list of existing connectors, and following that, query each and
every one again for their current state, to update our internal
representation; only the former handled drmModeGetConnector() returning
NULL, meaning if unlucky, we'd end up doing a null pointer dereference
when trying to update the state.
Handle this by querying the kernel for the current connector state only
once per connector, updating the list of connectors and their
corresponding state at the same time.
Fixes the following crash:
#0 meta_kms_connector_read_state at ../src/backends/native/meta-kms-connector.c:684
#1 meta_kms_connector_update_state at ../src/backends/native/meta-kms-connector.c:767
#2 meta_kms_impl_device_update_states at ../src/backends/native/meta-kms-impl-device.c:916
#3 meta_kms_device_update_states_in_impl at ../src/backends/native/meta-kms-device.c:267
#4 meta_kms_update_states_in_impl at ../src/backends/native/meta-kms.c:604
#5 update_states_in_impl at ../src/backends/native/meta-kms.c:620
#6 meta_kms_run_impl_task_sync at ../src/backends/native/meta-kms.c:435
#7 meta_kms_update_states_sync at ../src/backends/native/meta-kms.c:641
#8 handle_hotplug_event at ../src/backends/native/meta-kms.c:651
#9 on_udev_hotplug at ../src/backends/native/meta-kms.c:668
Related: https://bugzilla.redhat.com/show_bug.cgi?id=2131269
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2709>
2022-11-23 23:08:33 +01:00
|
|
|
drmModeRes *drm_resources,
|
|
|
|
drmModeConnector *drm_connector);
|
2019-03-09 15:55:24 +01:00
|
|
|
|
2021-06-28 10:11:31 +02:00
|
|
|
void meta_kms_connector_disable (MetaKmsConnector *connector);
|
|
|
|
|
2022-03-17 10:33:23 +01:00
|
|
|
MetaKmsResourceChanges meta_kms_connector_predict_state (MetaKmsConnector *connector,
|
|
|
|
MetaKmsUpdate *update);
|
2019-10-04 11:54:29 +02:00
|
|
|
|
2019-03-08 16:23:15 +01:00
|
|
|
MetaKmsConnector * meta_kms_connector_new (MetaKmsImplDevice *impl_device,
|
|
|
|
drmModeConnector *drm_connector,
|
|
|
|
drmModeRes *drm_resources);
|
|
|
|
|
2019-08-22 14:26:54 +02:00
|
|
|
gboolean meta_kms_connector_is_same_as (MetaKmsConnector *connector,
|
|
|
|
drmModeConnector *drm_connector);
|
|
|
|
|
2019-03-08 16:23:15 +01:00
|
|
|
#endif /* META_KMS_CONNECTOR_PRIVATE_H */
|