mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
Revert "crtc-kms: Make KMS CRTC mode a type inheriting MetaCrtcMode"
This reverts commit 09078762a
, which breaks Mutter.
This commit is contained in:
parent
77d359cdc3
commit
49408e8f9f
@ -152,6 +152,9 @@ meta_crtc_mode_finalize (GObject *object)
|
|||||||
MetaCrtcMode *crtc_mode = META_CRTC_MODE (object);
|
MetaCrtcMode *crtc_mode = META_CRTC_MODE (object);
|
||||||
MetaCrtcModePrivate *priv = meta_crtc_mode_get_instance_private (crtc_mode);
|
MetaCrtcModePrivate *priv = meta_crtc_mode_get_instance_private (crtc_mode);
|
||||||
|
|
||||||
|
if (crtc_mode->driver_notify)
|
||||||
|
crtc_mode->driver_notify (crtc_mode);
|
||||||
|
|
||||||
g_clear_pointer (&priv->name, g_free);
|
g_clear_pointer (&priv->name, g_free);
|
||||||
g_clear_pointer (&priv->info, meta_crtc_mode_info_unref);
|
g_clear_pointer (&priv->info, meta_crtc_mode_info_unref);
|
||||||
|
|
||||||
|
@ -57,17 +57,20 @@ typedef struct _MetaCrtcModeInfo
|
|||||||
MetaCrtcModeFlag flags;
|
MetaCrtcModeFlag flags;
|
||||||
} MetaCrtcModeInfo;
|
} MetaCrtcModeInfo;
|
||||||
|
|
||||||
|
struct _MetaCrtcMode
|
||||||
|
{
|
||||||
|
GObject parent;
|
||||||
|
|
||||||
|
gpointer driver_private;
|
||||||
|
GDestroyNotify driver_notify;
|
||||||
|
};
|
||||||
|
|
||||||
#define META_TYPE_CRTC_MODE (meta_crtc_mode_get_type ())
|
#define META_TYPE_CRTC_MODE (meta_crtc_mode_get_type ())
|
||||||
META_EXPORT_TEST
|
META_EXPORT_TEST
|
||||||
G_DECLARE_DERIVABLE_TYPE (MetaCrtcMode, meta_crtc_mode,
|
G_DECLARE_FINAL_TYPE (MetaCrtcMode, meta_crtc_mode,
|
||||||
META, CRTC_MODE,
|
META, CRTC_MODE,
|
||||||
GObject)
|
GObject)
|
||||||
|
|
||||||
struct _MetaCrtcModeClass
|
|
||||||
{
|
|
||||||
GObjectClass parent_class;
|
|
||||||
};
|
|
||||||
|
|
||||||
#define META_TYPE_CRTC_MODE_INFO (meta_crtc_mode_info_get_type ())
|
#define META_TYPE_CRTC_MODE_INFO (meta_crtc_mode_info_get_type ())
|
||||||
GType meta_crtc_mode_info_get_type (void);
|
GType meta_crtc_mode_info_get_type (void);
|
||||||
|
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
|
|
||||||
#include "backends/meta-backend-private.h"
|
#include "backends/meta-backend-private.h"
|
||||||
#include "backends/meta-logical-monitor.h"
|
#include "backends/meta-logical-monitor.h"
|
||||||
#include "backends/native/meta-crtc-mode-kms.h"
|
|
||||||
#include "backends/native/meta-gpu-kms.h"
|
#include "backends/native/meta-gpu-kms.h"
|
||||||
#include "backends/native/meta-output-kms.h"
|
#include "backends/native/meta-output-kms.h"
|
||||||
#include "backends/native/meta-kms-device.h"
|
#include "backends/native/meta-kms-device.h"
|
||||||
@ -173,16 +172,15 @@ meta_crtc_kms_set_mode (MetaCrtcKms *crtc_kms,
|
|||||||
MetaCrtc *crtc = META_CRTC (crtc_kms);
|
MetaCrtc *crtc = META_CRTC (crtc_kms);
|
||||||
MetaGpu *gpu = meta_crtc_get_gpu (crtc);
|
MetaGpu *gpu = meta_crtc_get_gpu (crtc);
|
||||||
GList *connectors;
|
GList *connectors;
|
||||||
const drmModeModeInfo *mode;
|
drmModeModeInfo *mode;
|
||||||
|
|
||||||
connectors = generate_crtc_connector_list (gpu, crtc);
|
connectors = generate_crtc_connector_list (gpu, crtc);
|
||||||
|
|
||||||
if (connectors)
|
if (connectors)
|
||||||
{
|
{
|
||||||
const MetaCrtcConfig *crtc_config = meta_crtc_get_config (crtc);
|
const MetaCrtcConfig *crtc_config = meta_crtc_get_config (crtc);
|
||||||
MetaCrtcModeKms *crtc_mode_kms = META_CRTC_MODE_KMS (crtc_config->mode);
|
|
||||||
|
|
||||||
mode = meta_crtc_mode_kms_get_drm_mode (crtc_mode_kms);
|
mode = crtc_config->mode->driver_private;
|
||||||
|
|
||||||
g_debug ("Setting CRTC (%ld) mode to %s",
|
g_debug ("Setting CRTC (%ld) mode to %s",
|
||||||
meta_crtc_get_id (crtc), mode->name);
|
meta_crtc_get_id (crtc), mode->name);
|
||||||
|
@ -1,88 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2017-2020 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include "backends/native/meta-crtc-mode-kms.h"
|
|
||||||
|
|
||||||
#include "backends/native/meta-kms-utils.h"
|
|
||||||
|
|
||||||
struct _MetaCrtcModeKms
|
|
||||||
{
|
|
||||||
drmModeModeInfo *drm_mode;
|
|
||||||
};
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (MetaCrtcModeKms, meta_crtc_mode_kms,
|
|
||||||
META_TYPE_CRTC_MODE)
|
|
||||||
|
|
||||||
const drmModeModeInfo *
|
|
||||||
meta_crtc_mode_kms_get_drm_mode (MetaCrtcModeKms *mode_kms)
|
|
||||||
{
|
|
||||||
return mode_kms->drm_mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
MetaCrtcModeKms *
|
|
||||||
meta_crtc_mode_kms_new (const drmModeModeInfo *drm_mode,
|
|
||||||
uint64_t id)
|
|
||||||
{
|
|
||||||
g_autoptr (MetaCrtcModeInfo) crtc_mode_info = NULL;
|
|
||||||
g_autofree char *crtc_mode_name = NULL;
|
|
||||||
MetaCrtcModeKms *mode_kms;
|
|
||||||
|
|
||||||
crtc_mode_info = meta_crtc_mode_info_new ();
|
|
||||||
crtc_mode_info->width = drm_mode->hdisplay;
|
|
||||||
crtc_mode_info->height = drm_mode->vdisplay;
|
|
||||||
crtc_mode_info->flags = drm_mode->flags;
|
|
||||||
crtc_mode_info->refresh_rate =
|
|
||||||
meta_calculate_drm_mode_refresh_rate (drm_mode);
|
|
||||||
|
|
||||||
crtc_mode_name = g_strndup (drm_mode->name, DRM_DISPLAY_MODE_LEN);
|
|
||||||
mode_kms = g_object_new (META_TYPE_CRTC_MODE_KMS,
|
|
||||||
"id", id,
|
|
||||||
"name", crtc_mode_name,
|
|
||||||
"info", crtc_mode_info,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
mode_kms->drm_mode = g_slice_dup (drmModeModeInfo, drm_mode);
|
|
||||||
|
|
||||||
return mode_kms;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
meta_crtc_mode_kms_finalize (GObject *object)
|
|
||||||
{
|
|
||||||
MetaCrtcModeKms *mode_kms = META_CRTC_MODE_KMS (object);
|
|
||||||
|
|
||||||
g_slice_free (drmModeModeInfo, mode_kms->drm_mode);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (meta_crtc_mode_kms_parent_class)->finalize (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
meta_crtc_mode_kms_init (MetaCrtcModeKms *mode_kms)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
meta_crtc_mode_kms_class_init (MetaCrtcModeKmsClass *klass)
|
|
||||||
{
|
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
||||||
|
|
||||||
object_class->finalize = meta_crtc_mode_kms_finalize;
|
|
||||||
}
|
|
@ -1,38 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2017-2020 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_CRTC_MODE_KMS_H
|
|
||||||
#define META_CRTC_MODE_KMS_H
|
|
||||||
|
|
||||||
#include <xf86drm.h>
|
|
||||||
#include <xf86drmMode.h>
|
|
||||||
|
|
||||||
#include "backends/meta-crtc-mode.h"
|
|
||||||
|
|
||||||
#define META_TYPE_CRTC_MODE_KMS (meta_crtc_mode_kms_get_type ())
|
|
||||||
G_DECLARE_FINAL_TYPE (MetaCrtcModeKms, meta_crtc_mode_kms,
|
|
||||||
META, CRTC_MODE_KMS,
|
|
||||||
MetaCrtcMode)
|
|
||||||
|
|
||||||
const drmModeModeInfo * meta_crtc_mode_kms_get_drm_mode (MetaCrtcModeKms *crtc_mode_kms);
|
|
||||||
|
|
||||||
MetaCrtcModeKms * meta_crtc_mode_kms_new (const drmModeModeInfo *drm_mode,
|
|
||||||
uint64_t id);
|
|
||||||
|
|
||||||
#endif /* META_CRTC_MODE_KMS_H */
|
|
@ -38,7 +38,6 @@
|
|||||||
#include "backends/meta-output.h"
|
#include "backends/meta-output.h"
|
||||||
#include "backends/native/meta-backend-native.h"
|
#include "backends/native/meta-backend-native.h"
|
||||||
#include "backends/native/meta-crtc-kms.h"
|
#include "backends/native/meta-crtc-kms.h"
|
||||||
#include "backends/native/meta-crtc-mode-kms.h"
|
|
||||||
#include "backends/native/meta-kms-connector.h"
|
#include "backends/native/meta-kms-connector.h"
|
||||||
#include "backends/native/meta-kms-device.h"
|
#include "backends/native/meta-kms-device.h"
|
||||||
#include "backends/native/meta-kms-update.h"
|
#include "backends/native/meta-kms-update.h"
|
||||||
@ -274,6 +273,12 @@ compare_outputs (gconstpointer one,
|
|||||||
return strcmp (output_info_one->name, output_info_two->name);
|
return strcmp (output_info_one->name, output_info_two->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_crtc_mode_destroy_notify (MetaCrtcMode *mode)
|
||||||
|
{
|
||||||
|
g_slice_free (drmModeModeInfo, mode->driver_private);
|
||||||
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
meta_drm_mode_equal (const drmModeModeInfo *one,
|
meta_drm_mode_equal (const drmModeModeInfo *one,
|
||||||
const drmModeModeInfo *two)
|
const drmModeModeInfo *two)
|
||||||
@ -324,11 +329,10 @@ meta_gpu_kms_get_mode_from_drm_mode (MetaGpuKms *gpu_kms,
|
|||||||
|
|
||||||
for (l = meta_gpu_get_modes (gpu); l; l = l->next)
|
for (l = meta_gpu_get_modes (gpu); l; l = l->next)
|
||||||
{
|
{
|
||||||
MetaCrtcModeKms *crtc_mode_kms = l->data;
|
MetaCrtcMode *mode = l->data;
|
||||||
|
|
||||||
if (meta_drm_mode_equal (drm_mode,
|
if (meta_drm_mode_equal (drm_mode, mode->driver_private))
|
||||||
meta_crtc_mode_kms_get_drm_mode (crtc_mode_kms)))
|
return mode;
|
||||||
return META_CRTC_MODE (crtc_mode_kms);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
@ -357,6 +361,9 @@ create_mode (const drmModeModeInfo *drm_mode,
|
|||||||
"info", crtc_mode_info,
|
"info", crtc_mode_info,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
mode->driver_private = g_slice_dup (drmModeModeInfo, drm_mode);
|
||||||
|
mode->driver_notify = (GDestroyNotify) meta_crtc_mode_destroy_notify;
|
||||||
|
|
||||||
return mode;
|
return mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ void
|
|||||||
meta_kms_update_mode_set (MetaKmsUpdate *update,
|
meta_kms_update_mode_set (MetaKmsUpdate *update,
|
||||||
MetaKmsCrtc *crtc,
|
MetaKmsCrtc *crtc,
|
||||||
GList *connectors,
|
GList *connectors,
|
||||||
const drmModeModeInfo *drm_mode)
|
drmModeModeInfo *drm_mode)
|
||||||
{
|
{
|
||||||
MetaKmsModeSet *mode_set;
|
MetaKmsModeSet *mode_set;
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ void meta_kms_update_free (MetaKmsUpdate *update);
|
|||||||
void meta_kms_update_mode_set (MetaKmsUpdate *update,
|
void meta_kms_update_mode_set (MetaKmsUpdate *update,
|
||||||
MetaKmsCrtc *crtc,
|
MetaKmsCrtc *crtc,
|
||||||
GList *connectors,
|
GList *connectors,
|
||||||
const drmModeModeInfo *drm_mode);
|
drmModeModeInfo *drm_mode);
|
||||||
|
|
||||||
MetaKmsPlaneAssignment * meta_kms_update_assign_plane (MetaKmsUpdate *update,
|
MetaKmsPlaneAssignment * meta_kms_update_assign_plane (MetaKmsUpdate *update,
|
||||||
MetaKmsCrtc *crtc,
|
MetaKmsCrtc *crtc,
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
#include "backends/native/meta-kms-connector.h"
|
#include "backends/native/meta-kms-connector.h"
|
||||||
#include "backends/native/meta-kms-utils.h"
|
#include "backends/native/meta-kms-utils.h"
|
||||||
#include "backends/native/meta-crtc-kms.h"
|
#include "backends/native/meta-crtc-kms.h"
|
||||||
#include "backends/native/meta-crtc-mode-kms.h"
|
|
||||||
|
|
||||||
#include "meta-default-modes.h"
|
#include "meta-default-modes.h"
|
||||||
|
|
||||||
@ -154,10 +153,7 @@ add_common_modes (MetaOutputInfo *output_info,
|
|||||||
|
|
||||||
for (i = 0; i < output_info->n_modes; i++)
|
for (i = 0; i < output_info->n_modes; i++)
|
||||||
{
|
{
|
||||||
MetaCrtcMode *crtc_mode = output_info->modes[i];
|
drm_mode = output_info->modes[i]->driver_private;
|
||||||
MetaCrtcModeKms *crtc_mode_kms = META_CRTC_MODE_KMS (crtc_mode);
|
|
||||||
|
|
||||||
drm_mode = meta_crtc_mode_kms_get_drm_mode (crtc_mode_kms);
|
|
||||||
refresh_rate = meta_calculate_drm_mode_refresh_rate (drm_mode);
|
refresh_rate = meta_calculate_drm_mode_refresh_rate (drm_mode);
|
||||||
max_hdisplay = MAX (max_hdisplay, drm_mode->hdisplay);
|
max_hdisplay = MAX (max_hdisplay, drm_mode->hdisplay);
|
||||||
max_vdisplay = MAX (max_vdisplay, drm_mode->vdisplay);
|
max_vdisplay = MAX (max_vdisplay, drm_mode->vdisplay);
|
||||||
|
@ -632,8 +632,6 @@ if have_native_backend
|
|||||||
'backends/native/meta-clutter-backend-native.h',
|
'backends/native/meta-clutter-backend-native.h',
|
||||||
'backends/native/meta-crtc-kms.c',
|
'backends/native/meta-crtc-kms.c',
|
||||||
'backends/native/meta-crtc-kms.h',
|
'backends/native/meta-crtc-kms.h',
|
||||||
'backends/native/meta-crtc-mode-kms.c',
|
|
||||||
'backends/native/meta-crtc-mode-kms.h',
|
|
||||||
'backends/native/meta-cursor-renderer-native.c',
|
'backends/native/meta-cursor-renderer-native.c',
|
||||||
'backends/native/meta-cursor-renderer-native.h',
|
'backends/native/meta-cursor-renderer-native.h',
|
||||||
'backends/native/meta-drm-buffer-dumb.c',
|
'backends/native/meta-drm-buffer-dumb.c',
|
||||||
|
Loading…
Reference in New Issue
Block a user