mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
crtc: Make implementations inherit MetaCrtc
Just as with MetaOutput, instead of the home baked "inheritance" system, using a gpointer and a GDestroyNotify function to keep the what effectively is sub type details, make MetaCrtc an abstract derivable type, and make the implementations inherit it. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
This commit is contained in:
parent
4a4f2d8264
commit
1ce9e379d9
@ -47,7 +47,7 @@ typedef struct _MetaCrtcPrivate
|
|||||||
MetaCrtcConfig *config;
|
MetaCrtcConfig *config;
|
||||||
} MetaCrtcPrivate;
|
} MetaCrtcPrivate;
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_PRIVATE (MetaCrtc, meta_crtc, G_TYPE_OBJECT)
|
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (MetaCrtc, meta_crtc, G_TYPE_OBJECT)
|
||||||
|
|
||||||
G_DEFINE_TYPE (MetaCrtcMode, meta_crtc_mode, G_TYPE_OBJECT)
|
G_DEFINE_TYPE (MetaCrtcMode, meta_crtc_mode, G_TYPE_OBJECT)
|
||||||
|
|
||||||
@ -166,9 +166,6 @@ meta_crtc_finalize (GObject *object)
|
|||||||
MetaCrtc *crtc = META_CRTC (object);
|
MetaCrtc *crtc = META_CRTC (object);
|
||||||
MetaCrtcPrivate *priv = meta_crtc_get_instance_private (crtc);
|
MetaCrtcPrivate *priv = meta_crtc_get_instance_private (crtc);
|
||||||
|
|
||||||
if (crtc->driver_notify)
|
|
||||||
crtc->driver_notify (crtc);
|
|
||||||
|
|
||||||
g_clear_pointer (&priv->config, g_free);
|
g_clear_pointer (&priv->config, g_free);
|
||||||
|
|
||||||
G_OBJECT_CLASS (meta_crtc_parent_class)->finalize (object);
|
G_OBJECT_CLASS (meta_crtc_parent_class)->finalize (object);
|
||||||
|
@ -56,14 +56,6 @@ typedef struct _MetaCrtcConfig
|
|||||||
MetaCrtcMode *mode;
|
MetaCrtcMode *mode;
|
||||||
} MetaCrtcConfig;
|
} MetaCrtcConfig;
|
||||||
|
|
||||||
struct _MetaCrtc
|
|
||||||
{
|
|
||||||
GObject parent;
|
|
||||||
|
|
||||||
gpointer driver_private;
|
|
||||||
GDestroyNotify driver_notify;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _MetaCrtcMode
|
struct _MetaCrtcMode
|
||||||
{
|
{
|
||||||
GObject parent;
|
GObject parent;
|
||||||
@ -82,7 +74,13 @@ struct _MetaCrtcMode
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define META_TYPE_CRTC (meta_crtc_get_type ())
|
#define META_TYPE_CRTC (meta_crtc_get_type ())
|
||||||
META_EXPORT_TEST G_DECLARE_FINAL_TYPE (MetaCrtc, meta_crtc, META, CRTC, GObject)
|
META_EXPORT_TEST
|
||||||
|
G_DECLARE_DERIVABLE_TYPE (MetaCrtc, meta_crtc, META, CRTC, GObject)
|
||||||
|
|
||||||
|
struct _MetaCrtcClass
|
||||||
|
{
|
||||||
|
GObjectClass parent_class;
|
||||||
|
};
|
||||||
|
|
||||||
#define META_TYPE_CRTC_MODE (meta_crtc_mode_get_type ())
|
#define META_TYPE_CRTC_MODE (meta_crtc_mode_get_type ())
|
||||||
META_EXPORT_TEST G_DECLARE_FINAL_TYPE (MetaCrtcMode, meta_crtc_mode, META, CRTC_MODE, GObject)
|
META_EXPORT_TEST G_DECLARE_FINAL_TYPE (MetaCrtcMode, meta_crtc_mode, META, CRTC_MODE, GObject)
|
||||||
|
@ -60,8 +60,13 @@ struct _MetaOutputDummy
|
|||||||
float scale;
|
float scale;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE (MetaOutputDummy, meta_output_dummy, META_TYPE_OUTPUT)
|
struct _MetaCrtcDummy
|
||||||
|
{
|
||||||
|
MetaCrtc parent;
|
||||||
|
};
|
||||||
|
|
||||||
|
G_DEFINE_TYPE (MetaOutputDummy, meta_output_dummy, META_TYPE_OUTPUT)
|
||||||
|
G_DEFINE_TYPE (MetaCrtcDummy, meta_crtc_dummy, META_TYPE_CRTC)
|
||||||
G_DEFINE_TYPE (MetaMonitorManagerDummy, meta_monitor_manager_dummy, META_TYPE_MONITOR_MANAGER);
|
G_DEFINE_TYPE (MetaMonitorManagerDummy, meta_monitor_manager_dummy, META_TYPE_MONITOR_MANAGER);
|
||||||
|
|
||||||
struct _MetaGpuDummy
|
struct _MetaGpuDummy
|
||||||
@ -198,7 +203,7 @@ append_monitor (MetaMonitorManager *manager,
|
|||||||
}
|
}
|
||||||
*modes = g_list_concat (*modes, new_modes);
|
*modes = g_list_concat (*modes, new_modes);
|
||||||
|
|
||||||
crtc = g_object_new (META_TYPE_CRTC,
|
crtc = g_object_new (META_TYPE_CRTC_DUMMY,
|
||||||
"id", g_list_length (*crtcs) + 1,
|
"id", g_list_length (*crtcs) + 1,
|
||||||
"gpu", gpu,
|
"gpu", gpu,
|
||||||
NULL);
|
NULL);
|
||||||
@ -284,7 +289,7 @@ append_tiled_monitor (MetaMonitorManager *manager,
|
|||||||
{
|
{
|
||||||
MetaCrtc *crtc;
|
MetaCrtc *crtc;
|
||||||
|
|
||||||
crtc = g_object_new (META_TYPE_CRTC,
|
crtc = g_object_new (META_TYPE_CRTC_DUMMY,
|
||||||
"id", g_list_length (*crtcs) + i + 1,
|
"id", g_list_length (*crtcs) + i + 1,
|
||||||
"gpu", gpu,
|
"gpu", gpu,
|
||||||
NULL);
|
NULL);
|
||||||
@ -793,3 +798,13 @@ static void
|
|||||||
meta_output_dummy_class_init (MetaOutputDummyClass *klass)
|
meta_output_dummy_class_init (MetaOutputDummyClass *klass)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_crtc_dummy_init (MetaCrtcDummy *crtc_dummy)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_crtc_dummy_class_init (MetaCrtcDummyClass *klass)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#ifndef META_MONITOR_MANAGER_DUMMY_H
|
#ifndef META_MONITOR_MANAGER_DUMMY_H
|
||||||
#define META_MONITOR_MANAGER_DUMMY_H
|
#define META_MONITOR_MANAGER_DUMMY_H
|
||||||
|
|
||||||
|
#include "backends/meta-crtc.h"
|
||||||
#include "backends/meta-gpu.h"
|
#include "backends/meta-gpu.h"
|
||||||
#include "backends/meta-monitor-manager-private.h"
|
#include "backends/meta-monitor-manager-private.h"
|
||||||
#include "backends/meta-output.h"
|
#include "backends/meta-output.h"
|
||||||
@ -32,6 +33,11 @@ G_DECLARE_FINAL_TYPE (MetaOutputDummy, meta_output_dummy,
|
|||||||
META, OUTPUT_DUMMY,
|
META, OUTPUT_DUMMY,
|
||||||
MetaOutput)
|
MetaOutput)
|
||||||
|
|
||||||
|
#define META_TYPE_CRTC_DUMMY (meta_crtc_dummy_get_type ())
|
||||||
|
G_DECLARE_FINAL_TYPE (MetaCrtcDummy, meta_crtc_dummy,
|
||||||
|
META, CRTC_DUMMY,
|
||||||
|
MetaCrtc)
|
||||||
|
|
||||||
#define META_TYPE_MONITOR_MANAGER_DUMMY (meta_monitor_manager_dummy_get_type ())
|
#define META_TYPE_MONITOR_MANAGER_DUMMY (meta_monitor_manager_dummy_get_type ())
|
||||||
G_DECLARE_FINAL_TYPE (MetaMonitorManagerDummy, meta_monitor_manager_dummy,
|
G_DECLARE_FINAL_TYPE (MetaMonitorManagerDummy, meta_monitor_manager_dummy,
|
||||||
META, MONITOR_MANAGER_DUMMY, MetaMonitorManager)
|
META, MONITOR_MANAGER_DUMMY, MetaMonitorManager)
|
||||||
|
@ -34,40 +34,36 @@
|
|||||||
|
|
||||||
#define ALL_TRANSFORMS_MASK ((1 << META_MONITOR_N_TRANSFORMS) - 1)
|
#define ALL_TRANSFORMS_MASK ((1 << META_MONITOR_N_TRANSFORMS) - 1)
|
||||||
|
|
||||||
typedef struct _MetaCrtcKms
|
struct _MetaCrtcKms
|
||||||
{
|
{
|
||||||
MetaKmsCrtc *kms_crtc;
|
MetaKmsCrtc *kms_crtc;
|
||||||
|
|
||||||
MetaKmsPlane *primary_plane;
|
MetaKmsPlane *primary_plane;
|
||||||
|
|
||||||
gpointer cursor_renderer_private;
|
gpointer cursor_renderer_private;
|
||||||
} MetaCrtcKms;
|
};
|
||||||
|
|
||||||
static GQuark kms_crtc_crtc_kms_quark;
|
static GQuark kms_crtc_crtc_kms_quark;
|
||||||
|
|
||||||
gpointer
|
G_DEFINE_TYPE (MetaCrtcKms, meta_crtc_kms, META_TYPE_CRTC)
|
||||||
meta_crtc_kms_get_cursor_renderer_private (MetaCrtc *crtc)
|
|
||||||
{
|
|
||||||
MetaCrtcKms *crtc_kms = crtc->driver_private;
|
|
||||||
|
|
||||||
|
gpointer
|
||||||
|
meta_crtc_kms_get_cursor_renderer_private (MetaCrtcKms *crtc_kms)
|
||||||
|
{
|
||||||
return crtc_kms->cursor_renderer_private;
|
return crtc_kms->cursor_renderer_private;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_crtc_kms_set_cursor_renderer_private (MetaCrtc *crtc,
|
meta_crtc_kms_set_cursor_renderer_private (MetaCrtcKms *crtc_kms,
|
||||||
gpointer cursor_renderer_private)
|
gpointer cursor_renderer_private)
|
||||||
{
|
{
|
||||||
MetaCrtcKms *crtc_kms = crtc->driver_private;
|
|
||||||
|
|
||||||
crtc_kms->cursor_renderer_private = cursor_renderer_private;
|
crtc_kms->cursor_renderer_private = cursor_renderer_private;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
meta_crtc_kms_is_transform_handled (MetaCrtc *crtc,
|
meta_crtc_kms_is_transform_handled (MetaCrtcKms *crtc_kms,
|
||||||
MetaMonitorTransform transform)
|
MetaMonitorTransform transform)
|
||||||
{
|
{
|
||||||
MetaCrtcKms *crtc_kms = crtc->driver_private;
|
|
||||||
|
|
||||||
if (!crtc_kms->primary_plane)
|
if (!crtc_kms->primary_plane)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
@ -76,19 +72,19 @@ meta_crtc_kms_is_transform_handled (MetaCrtc *crtc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_crtc_kms_apply_transform (MetaCrtc *crtc,
|
meta_crtc_kms_apply_transform (MetaCrtcKms *crtc_kms,
|
||||||
MetaKmsPlaneAssignment *kms_plane_assignment)
|
MetaKmsPlaneAssignment *kms_plane_assignment)
|
||||||
{
|
{
|
||||||
MetaCrtcKms *crtc_kms = crtc->driver_private;
|
MetaCrtc *crtc = META_CRTC (crtc_kms);
|
||||||
const MetaCrtcConfig *crtc_config;
|
const MetaCrtcConfig *crtc_config;
|
||||||
MetaMonitorTransform hw_transform;
|
MetaMonitorTransform hw_transform;
|
||||||
|
|
||||||
crtc_config = meta_crtc_get_config (crtc);
|
crtc_config = meta_crtc_get_config (crtc);
|
||||||
|
|
||||||
hw_transform = crtc_config->transform;
|
hw_transform = crtc_config->transform;
|
||||||
if (!meta_crtc_kms_is_transform_handled (crtc, hw_transform))
|
if (!meta_crtc_kms_is_transform_handled (crtc_kms, hw_transform))
|
||||||
hw_transform = META_MONITOR_TRANSFORM_NORMAL;
|
hw_transform = META_MONITOR_TRANSFORM_NORMAL;
|
||||||
if (!meta_crtc_kms_is_transform_handled (crtc, hw_transform))
|
if (!meta_crtc_kms_is_transform_handled (crtc_kms, hw_transform))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
meta_kms_plane_update_set_rotation (crtc_kms->primary_plane,
|
meta_kms_plane_update_set_rotation (crtc_kms->primary_plane,
|
||||||
@ -97,10 +93,11 @@ meta_crtc_kms_apply_transform (MetaCrtc *crtc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_crtc_kms_assign_primary_plane (MetaCrtc *crtc,
|
meta_crtc_kms_assign_primary_plane (MetaCrtcKms *crtc_kms,
|
||||||
uint32_t fb_id,
|
uint32_t fb_id,
|
||||||
MetaKmsUpdate *kms_update)
|
MetaKmsUpdate *kms_update)
|
||||||
{
|
{
|
||||||
|
MetaCrtc *crtc = META_CRTC (crtc_kms);
|
||||||
const MetaCrtcConfig *crtc_config;
|
const MetaCrtcConfig *crtc_config;
|
||||||
MetaFixed16Rectangle src_rect;
|
MetaFixed16Rectangle src_rect;
|
||||||
MetaFixed16Rectangle dst_rect;
|
MetaFixed16Rectangle dst_rect;
|
||||||
@ -127,7 +124,7 @@ meta_crtc_kms_assign_primary_plane (MetaCrtc *crtc,
|
|||||||
|
|
||||||
flags = META_KMS_ASSIGN_PLANE_FLAG_NONE;
|
flags = META_KMS_ASSIGN_PLANE_FLAG_NONE;
|
||||||
|
|
||||||
kms_crtc = meta_crtc_kms_get_kms_crtc (crtc);
|
kms_crtc = meta_crtc_kms_get_kms_crtc (crtc_kms);
|
||||||
kms_device = meta_kms_crtc_get_device (kms_crtc);
|
kms_device = meta_kms_crtc_get_device (kms_crtc);
|
||||||
primary_kms_plane = meta_kms_device_get_primary_plane_for (kms_device,
|
primary_kms_plane = meta_kms_device_get_primary_plane_for (kms_device,
|
||||||
kms_crtc);
|
kms_crtc);
|
||||||
@ -138,7 +135,7 @@ meta_crtc_kms_assign_primary_plane (MetaCrtc *crtc,
|
|||||||
src_rect,
|
src_rect,
|
||||||
dst_rect,
|
dst_rect,
|
||||||
flags);
|
flags);
|
||||||
meta_crtc_kms_apply_transform (crtc, plane_assignment);
|
meta_crtc_kms_apply_transform (crtc_kms, plane_assignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GList *
|
static GList *
|
||||||
@ -167,9 +164,10 @@ generate_crtc_connector_list (MetaGpu *gpu,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_crtc_kms_set_mode (MetaCrtc *crtc,
|
meta_crtc_kms_set_mode (MetaCrtcKms *crtc_kms,
|
||||||
MetaKmsUpdate *kms_update)
|
MetaKmsUpdate *kms_update)
|
||||||
{
|
{
|
||||||
|
MetaCrtc *crtc = META_CRTC (crtc_kms);
|
||||||
MetaGpu *gpu = meta_crtc_get_gpu (crtc);
|
MetaGpu *gpu = meta_crtc_get_gpu (crtc);
|
||||||
GList *connectors;
|
GList *connectors;
|
||||||
drmModeModeInfo *mode;
|
drmModeModeInfo *mode;
|
||||||
@ -194,34 +192,32 @@ meta_crtc_kms_set_mode (MetaCrtc *crtc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
meta_kms_update_mode_set (kms_update,
|
meta_kms_update_mode_set (kms_update,
|
||||||
meta_crtc_kms_get_kms_crtc (crtc),
|
meta_crtc_kms_get_kms_crtc (crtc_kms),
|
||||||
g_steal_pointer (&connectors),
|
g_steal_pointer (&connectors),
|
||||||
mode);
|
mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_crtc_kms_page_flip (MetaCrtc *crtc,
|
meta_crtc_kms_page_flip (MetaCrtcKms *crtc_kms,
|
||||||
const MetaKmsPageFlipFeedback *page_flip_feedback,
|
const MetaKmsPageFlipFeedback *page_flip_feedback,
|
||||||
gpointer user_data,
|
gpointer user_data,
|
||||||
MetaKmsUpdate *kms_update)
|
MetaKmsUpdate *kms_update)
|
||||||
{
|
{
|
||||||
meta_kms_update_page_flip (kms_update,
|
meta_kms_update_page_flip (kms_update,
|
||||||
meta_crtc_kms_get_kms_crtc (crtc),
|
meta_crtc_kms_get_kms_crtc (crtc_kms),
|
||||||
page_flip_feedback,
|
page_flip_feedback,
|
||||||
user_data);
|
user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
MetaKmsCrtc *
|
MetaKmsCrtc *
|
||||||
meta_crtc_kms_get_kms_crtc (MetaCrtc *crtc)
|
meta_crtc_kms_get_kms_crtc (MetaCrtcKms *crtc_kms)
|
||||||
{
|
{
|
||||||
MetaCrtcKms *crtc_kms = crtc->driver_private;
|
|
||||||
|
|
||||||
return crtc_kms->kms_crtc;
|
return crtc_kms->kms_crtc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* meta_crtc_kms_get_modifiers:
|
* meta_crtc_kms_get_modifiers:
|
||||||
* @crtc: a #MetaCrtc object that has to be a #MetaCrtcKms
|
* @crtc_kms: a #MetaCrtc object that has to be a #MetaCrtcKms
|
||||||
* @format: a DRM pixel format
|
* @format: a DRM pixel format
|
||||||
*
|
*
|
||||||
* Returns a pointer to a #GArray containing all the supported
|
* Returns a pointer to a #GArray containing all the supported
|
||||||
@ -234,92 +230,85 @@ meta_crtc_kms_get_kms_crtc (MetaCrtc *crtc)
|
|||||||
* supported.
|
* supported.
|
||||||
*/
|
*/
|
||||||
GArray *
|
GArray *
|
||||||
meta_crtc_kms_get_modifiers (MetaCrtc *crtc,
|
meta_crtc_kms_get_modifiers (MetaCrtcKms *crtc_kms,
|
||||||
uint32_t format)
|
uint32_t format)
|
||||||
{
|
{
|
||||||
MetaCrtcKms *crtc_kms = crtc->driver_private;
|
|
||||||
|
|
||||||
return meta_kms_plane_get_modifiers_for_format (crtc_kms->primary_plane,
|
return meta_kms_plane_get_modifiers_for_format (crtc_kms->primary_plane,
|
||||||
format);
|
format);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* meta_crtc_kms_copy_drm_format_list:
|
* meta_crtc_kms_copy_drm_format_list:
|
||||||
* @crtc: a #MetaCrtc object that has to be a #MetaCrtcKms
|
* @crtc_kms: a #MetaCrtc object that has to be a #MetaCrtcKms
|
||||||
*
|
*
|
||||||
* Returns a new #GArray that the caller must destroy. The array
|
* Returns a new #GArray that the caller must destroy. The array
|
||||||
* contains all the DRM pixel formats the CRTC supports on
|
* contains all the DRM pixel formats the CRTC supports on
|
||||||
* its primary plane. The array element type is uint32_t.
|
* its primary plane. The array element type is uint32_t.
|
||||||
*/
|
*/
|
||||||
GArray *
|
GArray *
|
||||||
meta_crtc_kms_copy_drm_format_list (MetaCrtc *crtc)
|
meta_crtc_kms_copy_drm_format_list (MetaCrtcKms *crtc_kms)
|
||||||
{
|
{
|
||||||
MetaCrtcKms *crtc_kms = crtc->driver_private;
|
|
||||||
|
|
||||||
return meta_kms_plane_copy_drm_format_list (crtc_kms->primary_plane);
|
return meta_kms_plane_copy_drm_format_list (crtc_kms->primary_plane);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* meta_crtc_kms_supports_format:
|
* meta_crtc_kms_supports_format:
|
||||||
* @crtc: a #MetaCrtc object that has to be a #MetaCrtcKms
|
* @crtc_kms: a #MetaCrtcKms
|
||||||
* @drm_format: a DRM pixel format
|
* @drm_format: a DRM pixel format
|
||||||
*
|
*
|
||||||
* Returns true if the CRTC supports the format on its primary plane.
|
* Returns true if the CRTC supports the format on its primary plane.
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
meta_crtc_kms_supports_format (MetaCrtc *crtc,
|
meta_crtc_kms_supports_format (MetaCrtcKms *crtc_kms,
|
||||||
uint32_t drm_format)
|
uint32_t drm_format)
|
||||||
{
|
{
|
||||||
MetaCrtcKms *crtc_kms = crtc->driver_private;
|
|
||||||
|
|
||||||
return meta_kms_plane_is_format_supported (crtc_kms->primary_plane,
|
return meta_kms_plane_is_format_supported (crtc_kms->primary_plane,
|
||||||
drm_format);
|
drm_format);
|
||||||
}
|
}
|
||||||
|
|
||||||
MetaCrtc *
|
MetaCrtcKms *
|
||||||
meta_crtc_kms_from_kms_crtc (MetaKmsCrtc *kms_crtc)
|
meta_crtc_kms_from_kms_crtc (MetaKmsCrtc *kms_crtc)
|
||||||
{
|
{
|
||||||
return g_object_get_qdata (G_OBJECT (kms_crtc), kms_crtc_crtc_kms_quark);
|
return g_object_get_qdata (G_OBJECT (kms_crtc), kms_crtc_crtc_kms_quark);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
MetaCrtcKms *
|
||||||
meta_crtc_destroy_notify (MetaCrtc *crtc)
|
meta_crtc_kms_new (MetaGpuKms *gpu_kms,
|
||||||
{
|
|
||||||
g_free (crtc->driver_private);
|
|
||||||
}
|
|
||||||
|
|
||||||
MetaCrtc *
|
|
||||||
meta_create_kms_crtc (MetaGpuKms *gpu_kms,
|
|
||||||
MetaKmsCrtc *kms_crtc)
|
MetaKmsCrtc *kms_crtc)
|
||||||
{
|
{
|
||||||
MetaGpu *gpu = META_GPU (gpu_kms);
|
MetaGpu *gpu = META_GPU (gpu_kms);
|
||||||
MetaKmsDevice *kms_device;
|
MetaKmsDevice *kms_device;
|
||||||
MetaCrtc *crtc;
|
|
||||||
MetaCrtcKms *crtc_kms;
|
MetaCrtcKms *crtc_kms;
|
||||||
MetaKmsPlane *primary_plane;
|
MetaKmsPlane *primary_plane;
|
||||||
|
|
||||||
kms_device = meta_gpu_kms_get_kms_device (gpu_kms);
|
kms_device = meta_gpu_kms_get_kms_device (gpu_kms);
|
||||||
primary_plane = meta_kms_device_get_primary_plane_for (kms_device,
|
primary_plane = meta_kms_device_get_primary_plane_for (kms_device,
|
||||||
kms_crtc);
|
kms_crtc);
|
||||||
crtc = g_object_new (META_TYPE_CRTC,
|
crtc_kms = g_object_new (META_TYPE_CRTC_KMS,
|
||||||
"id", meta_kms_crtc_get_id (kms_crtc),
|
"id", meta_kms_crtc_get_id (kms_crtc),
|
||||||
"gpu", gpu,
|
"gpu", gpu,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
crtc_kms = g_new0 (MetaCrtcKms, 1);
|
|
||||||
crtc_kms->kms_crtc = kms_crtc;
|
crtc_kms->kms_crtc = kms_crtc;
|
||||||
crtc_kms->primary_plane = primary_plane;
|
crtc_kms->primary_plane = primary_plane;
|
||||||
|
|
||||||
crtc->driver_private = crtc_kms;
|
|
||||||
crtc->driver_notify = (GDestroyNotify) meta_crtc_destroy_notify;
|
|
||||||
|
|
||||||
if (!kms_crtc_crtc_kms_quark)
|
if (!kms_crtc_crtc_kms_quark)
|
||||||
{
|
{
|
||||||
kms_crtc_crtc_kms_quark =
|
kms_crtc_crtc_kms_quark =
|
||||||
g_quark_from_static_string ("meta-kms-crtc-crtc-kms-quark");
|
g_quark_from_static_string ("meta-kms-crtc-crtc-kms-quark");
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_set_qdata (G_OBJECT (kms_crtc), kms_crtc_crtc_kms_quark, crtc);
|
g_object_set_qdata (G_OBJECT (kms_crtc), kms_crtc_crtc_kms_quark, crtc_kms);
|
||||||
|
|
||||||
return crtc;
|
return crtc_kms;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_crtc_kms_init (MetaCrtcKms *crtc_kms)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_crtc_kms_class_init (MetaCrtcKmsClass *klass)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
@ -31,47 +31,52 @@
|
|||||||
#include "backends/native/meta-gpu-kms.h"
|
#include "backends/native/meta-gpu-kms.h"
|
||||||
#include "backends/native/meta-kms-crtc.h"
|
#include "backends/native/meta-kms-crtc.h"
|
||||||
|
|
||||||
gpointer meta_crtc_kms_get_cursor_renderer_private (MetaCrtc *crtc);
|
#define META_TYPE_CRTC_KMS (meta_crtc_kms_get_type ())
|
||||||
|
G_DECLARE_FINAL_TYPE (MetaCrtcKms, meta_crtc_kms,
|
||||||
|
META, CRTC_KMS,
|
||||||
|
MetaCrtc)
|
||||||
|
|
||||||
void meta_crtc_kms_set_cursor_renderer_private (MetaCrtc *crtc,
|
gpointer meta_crtc_kms_get_cursor_renderer_private (MetaCrtcKms *crtc_kms);
|
||||||
|
|
||||||
|
void meta_crtc_kms_set_cursor_renderer_private (MetaCrtcKms *crtc_kms,
|
||||||
gpointer cursor_renderer_private);
|
gpointer cursor_renderer_private);
|
||||||
|
|
||||||
gboolean meta_crtc_kms_is_transform_handled (MetaCrtc *crtc,
|
gboolean meta_crtc_kms_is_transform_handled (MetaCrtcKms *crtc_kms,
|
||||||
MetaMonitorTransform transform);
|
MetaMonitorTransform transform);
|
||||||
|
|
||||||
void meta_crtc_kms_apply_transform (MetaCrtc *crtc,
|
void meta_crtc_kms_apply_transform (MetaCrtcKms *crtc_kms,
|
||||||
MetaKmsPlaneAssignment *kms_plane_assignment);
|
MetaKmsPlaneAssignment *kms_plane_assignment);
|
||||||
|
|
||||||
void meta_crtc_kms_assign_primary_plane (MetaCrtc *crtc,
|
void meta_crtc_kms_assign_primary_plane (MetaCrtcKms *crtc_kms,
|
||||||
uint32_t fb_id,
|
uint32_t fb_id,
|
||||||
MetaKmsUpdate *kms_update);
|
MetaKmsUpdate *kms_update);
|
||||||
|
|
||||||
void meta_crtc_kms_set_mode (MetaCrtc *crtc,
|
void meta_crtc_kms_set_mode (MetaCrtcKms *crtc_kms,
|
||||||
MetaKmsUpdate *kms_update);
|
MetaKmsUpdate *kms_update);
|
||||||
|
|
||||||
void meta_crtc_kms_page_flip (MetaCrtc *crtc,
|
void meta_crtc_kms_page_flip (MetaCrtcKms *crtc_kms,
|
||||||
const MetaKmsPageFlipFeedback *page_flip_feedback,
|
const MetaKmsPageFlipFeedback *page_flip_feedback,
|
||||||
gpointer user_data,
|
gpointer user_data,
|
||||||
MetaKmsUpdate *kms_update);
|
MetaKmsUpdate *kms_update);
|
||||||
|
|
||||||
void meta_crtc_kms_set_is_underscanning (MetaCrtc *crtc,
|
void meta_crtc_kms_set_is_underscanning (MetaCrtcKms *crtc_kms,
|
||||||
gboolean is_underscanning);
|
gboolean is_underscanning);
|
||||||
|
|
||||||
MetaKmsCrtc * meta_crtc_kms_get_kms_crtc (MetaCrtc *crtc);
|
MetaKmsCrtc * meta_crtc_kms_get_kms_crtc (MetaCrtcKms *crtc_kms);
|
||||||
|
|
||||||
GArray * meta_crtc_kms_get_modifiers (MetaCrtc *crtc,
|
GArray * meta_crtc_kms_get_modifiers (MetaCrtcKms *crtc_kms,
|
||||||
uint32_t format);
|
uint32_t format);
|
||||||
|
|
||||||
GArray *
|
GArray *
|
||||||
meta_crtc_kms_copy_drm_format_list (MetaCrtc *crtc);
|
meta_crtc_kms_copy_drm_format_list (MetaCrtcKms *crtc_kms);
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
meta_crtc_kms_supports_format (MetaCrtc *crtc,
|
meta_crtc_kms_supports_format (MetaCrtcKms *crtc_kms,
|
||||||
uint32_t drm_format);
|
uint32_t drm_format);
|
||||||
|
|
||||||
MetaCrtc * meta_crtc_kms_from_kms_crtc (MetaKmsCrtc *kms_crtc);
|
MetaCrtcKms * meta_crtc_kms_from_kms_crtc (MetaKmsCrtc *kms_crtc);
|
||||||
|
|
||||||
MetaCrtc * meta_create_kms_crtc (MetaGpuKms *gpu_kms,
|
MetaCrtcKms * meta_crtc_kms_new (MetaGpuKms *gpu_kms,
|
||||||
MetaKmsCrtc *kms_crtc);
|
MetaKmsCrtc *kms_crtc);
|
||||||
|
|
||||||
#endif /* META_CRTC_KMS_H */
|
#endif /* META_CRTC_KMS_H */
|
||||||
|
@ -251,13 +251,14 @@ calculate_crtc_cursor_hotspot (MetaCursorSprite *cursor_sprite,
|
|||||||
static void
|
static void
|
||||||
set_crtc_cursor (MetaCursorRendererNative *native,
|
set_crtc_cursor (MetaCursorRendererNative *native,
|
||||||
MetaKmsUpdate *kms_update,
|
MetaKmsUpdate *kms_update,
|
||||||
MetaCrtc *crtc,
|
MetaCrtcKms *crtc_kms,
|
||||||
int x,
|
int x,
|
||||||
int y,
|
int y,
|
||||||
MetaCursorSprite *cursor_sprite)
|
MetaCursorSprite *cursor_sprite)
|
||||||
{
|
{
|
||||||
MetaCursorRendererNativePrivate *priv =
|
MetaCursorRendererNativePrivate *priv =
|
||||||
meta_cursor_renderer_native_get_instance_private (native);
|
meta_cursor_renderer_native_get_instance_private (native);
|
||||||
|
MetaCrtc *crtc = META_CRTC (crtc_kms);
|
||||||
MetaCursorNativePrivate *cursor_priv = get_cursor_priv (cursor_sprite);
|
MetaCursorNativePrivate *cursor_priv = get_cursor_priv (cursor_sprite);
|
||||||
MetaGpuKms *gpu_kms = META_GPU_KMS (meta_crtc_get_gpu (crtc));
|
MetaGpuKms *gpu_kms = META_GPU_KMS (meta_crtc_get_gpu (crtc));
|
||||||
MetaCursorRendererNativeGpuData *cursor_renderer_gpu_data =
|
MetaCursorRendererNativeGpuData *cursor_renderer_gpu_data =
|
||||||
@ -283,7 +284,7 @@ set_crtc_cursor (MetaCursorRendererNative *native,
|
|||||||
else
|
else
|
||||||
bo = get_active_cursor_sprite_gbm_bo (cursor_gpu_state);
|
bo = get_active_cursor_sprite_gbm_bo (cursor_gpu_state);
|
||||||
|
|
||||||
kms_crtc = meta_crtc_kms_get_kms_crtc (crtc);
|
kms_crtc = meta_crtc_kms_get_kms_crtc (crtc_kms);
|
||||||
kms_device = meta_kms_crtc_get_device (kms_crtc);
|
kms_device = meta_kms_crtc_get_device (kms_crtc);
|
||||||
cursor_plane = meta_kms_device_get_cursor_plane_for (kms_device, kms_crtc);
|
cursor_plane = meta_kms_device_get_cursor_plane_for (kms_device, kms_crtc);
|
||||||
g_return_if_fail (cursor_plane);
|
g_return_if_fail (cursor_plane);
|
||||||
@ -306,7 +307,7 @@ set_crtc_cursor (MetaCursorRendererNative *native,
|
|||||||
};
|
};
|
||||||
|
|
||||||
flags = META_KMS_ASSIGN_PLANE_FLAG_NONE;
|
flags = META_KMS_ASSIGN_PLANE_FLAG_NONE;
|
||||||
crtc_bo = meta_crtc_kms_get_cursor_renderer_private (crtc);
|
crtc_bo = meta_crtc_kms_get_cursor_renderer_private (crtc_kms);
|
||||||
if (!priv->hw_state_invalidated && bo == crtc_bo)
|
if (!priv->hw_state_invalidated && bo == crtc_bo)
|
||||||
flags |= META_KMS_ASSIGN_PLANE_FLAG_FB_UNCHANGED;
|
flags |= META_KMS_ASSIGN_PLANE_FLAG_FB_UNCHANGED;
|
||||||
|
|
||||||
@ -325,7 +326,7 @@ set_crtc_cursor (MetaCursorRendererNative *native,
|
|||||||
cursor_hotspot_x,
|
cursor_hotspot_x,
|
||||||
cursor_hotspot_y);
|
cursor_hotspot_y);
|
||||||
|
|
||||||
meta_crtc_kms_set_cursor_renderer_private (crtc, bo);
|
meta_crtc_kms_set_cursor_renderer_private (crtc_kms, bo);
|
||||||
|
|
||||||
if (cursor_gpu_state->pending_bo_state == META_CURSOR_GBM_BO_STATE_SET)
|
if (cursor_gpu_state->pending_bo_state == META_CURSOR_GBM_BO_STATE_SET)
|
||||||
{
|
{
|
||||||
@ -338,7 +339,7 @@ set_crtc_cursor (MetaCursorRendererNative *native,
|
|||||||
static void
|
static void
|
||||||
unset_crtc_cursor (MetaCursorRendererNative *native,
|
unset_crtc_cursor (MetaCursorRendererNative *native,
|
||||||
MetaKmsUpdate *kms_update,
|
MetaKmsUpdate *kms_update,
|
||||||
MetaCrtc *crtc)
|
MetaCrtcKms *crtc_kms)
|
||||||
{
|
{
|
||||||
MetaCursorRendererNativePrivate *priv =
|
MetaCursorRendererNativePrivate *priv =
|
||||||
meta_cursor_renderer_native_get_instance_private (native);
|
meta_cursor_renderer_native_get_instance_private (native);
|
||||||
@ -347,18 +348,18 @@ unset_crtc_cursor (MetaCursorRendererNative *native,
|
|||||||
MetaKmsPlane *cursor_plane;
|
MetaKmsPlane *cursor_plane;
|
||||||
struct gbm_bo *crtc_bo;
|
struct gbm_bo *crtc_bo;
|
||||||
|
|
||||||
crtc_bo = meta_crtc_kms_get_cursor_renderer_private (crtc);
|
crtc_bo = meta_crtc_kms_get_cursor_renderer_private (crtc_kms);
|
||||||
if (!priv->hw_state_invalidated && !crtc_bo)
|
if (!priv->hw_state_invalidated && !crtc_bo)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
kms_crtc = meta_crtc_kms_get_kms_crtc (crtc);
|
kms_crtc = meta_crtc_kms_get_kms_crtc (crtc_kms);
|
||||||
kms_device = meta_kms_crtc_get_device (kms_crtc);
|
kms_device = meta_kms_crtc_get_device (kms_crtc);
|
||||||
cursor_plane = meta_kms_device_get_cursor_plane_for (kms_device, kms_crtc);
|
cursor_plane = meta_kms_device_get_cursor_plane_for (kms_device, kms_crtc);
|
||||||
|
|
||||||
if (cursor_plane)
|
if (cursor_plane)
|
||||||
meta_kms_update_unassign_plane (kms_update, kms_crtc, cursor_plane);
|
meta_kms_update_unassign_plane (kms_update, kms_crtc, cursor_plane);
|
||||||
|
|
||||||
meta_crtc_kms_set_cursor_renderer_private (crtc, NULL);
|
meta_crtc_kms_set_cursor_renderer_private (crtc_kms, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static float
|
static float
|
||||||
@ -484,7 +485,7 @@ update_monitor_crtc_cursor (MetaMonitor *monitor,
|
|||||||
|
|
||||||
set_crtc_cursor (data->in_cursor_renderer_native,
|
set_crtc_cursor (data->in_cursor_renderer_native,
|
||||||
data->in_kms_update,
|
data->in_kms_update,
|
||||||
crtc,
|
META_CRTC_KMS (crtc),
|
||||||
cursor_rect.x,
|
cursor_rect.x,
|
||||||
cursor_rect.y,
|
cursor_rect.y,
|
||||||
data->in_cursor_sprite);
|
data->in_cursor_sprite);
|
||||||
@ -495,7 +496,7 @@ update_monitor_crtc_cursor (MetaMonitor *monitor,
|
|||||||
{
|
{
|
||||||
unset_crtc_cursor (data->in_cursor_renderer_native,
|
unset_crtc_cursor (data->in_cursor_renderer_native,
|
||||||
data->in_kms_update,
|
data->in_kms_update,
|
||||||
crtc);
|
META_CRTC_KMS (crtc));
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -505,7 +506,8 @@ static void
|
|||||||
disable_hw_cursor_for_crtc (MetaKmsCrtc *kms_crtc,
|
disable_hw_cursor_for_crtc (MetaKmsCrtc *kms_crtc,
|
||||||
const GError *error)
|
const GError *error)
|
||||||
{
|
{
|
||||||
MetaCrtc *crtc = meta_crtc_kms_from_kms_crtc (kms_crtc);
|
MetaCrtcKms *crtc_kms = meta_crtc_kms_from_kms_crtc (kms_crtc);
|
||||||
|
MetaCrtc *crtc = META_CRTC (crtc_kms);
|
||||||
MetaGpuKms *gpu_kms = META_GPU_KMS (meta_crtc_get_gpu (crtc));
|
MetaGpuKms *gpu_kms = META_GPU_KMS (meta_crtc_get_gpu (crtc));
|
||||||
MetaCursorRendererNativeGpuData *cursor_renderer_gpu_data =
|
MetaCursorRendererNativeGpuData *cursor_renderer_gpu_data =
|
||||||
meta_cursor_renderer_native_gpu_data_from_gpu (gpu_kms);
|
meta_cursor_renderer_native_gpu_data_from_gpu (gpu_kms);
|
||||||
@ -695,7 +697,8 @@ has_cursor_plane (MetaLogicalMonitor *logical_monitor,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
gboolean *has_cursor_planes = user_data;
|
gboolean *has_cursor_planes = user_data;
|
||||||
MetaKmsCrtc *kms_crtc = meta_crtc_kms_get_kms_crtc (crtc);
|
MetaCrtcKms *crtc_kms = META_CRTC_KMS (crtc);
|
||||||
|
MetaKmsCrtc *kms_crtc = meta_crtc_kms_get_kms_crtc (crtc_kms);
|
||||||
MetaKmsDevice *kms_device = meta_kms_crtc_get_device (kms_crtc);
|
MetaKmsDevice *kms_device = meta_kms_crtc_get_device (kms_crtc);
|
||||||
|
|
||||||
*has_cursor_planes &= !!meta_kms_device_get_cursor_plane_for (kms_device,
|
*has_cursor_planes &= !!meta_kms_device_get_cursor_plane_for (kms_device,
|
||||||
@ -1053,12 +1056,12 @@ unset_crtc_cursor_renderer_privates (MetaGpu *gpu,
|
|||||||
|
|
||||||
for (l = meta_gpu_get_crtcs (gpu); l; l = l->next)
|
for (l = meta_gpu_get_crtcs (gpu); l; l = l->next)
|
||||||
{
|
{
|
||||||
MetaCrtc *crtc = l->data;
|
MetaCrtcKms *crtc_kms = META_CRTC_KMS (l->data);
|
||||||
struct gbm_bo *crtc_bo;
|
struct gbm_bo *crtc_bo;
|
||||||
|
|
||||||
crtc_bo = meta_crtc_kms_get_cursor_renderer_private (crtc);
|
crtc_bo = meta_crtc_kms_get_cursor_renderer_private (crtc_kms);
|
||||||
if (bo == crtc_bo)
|
if (bo == crtc_bo)
|
||||||
meta_crtc_kms_set_cursor_renderer_private (crtc, NULL);
|
meta_crtc_kms_set_cursor_renderer_private (crtc_kms, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -481,11 +481,11 @@ init_crtcs (MetaGpuKms *gpu_kms)
|
|||||||
for (l = meta_kms_device_get_crtcs (kms_device); l; l = l->next)
|
for (l = meta_kms_device_get_crtcs (kms_device); l; l = l->next)
|
||||||
{
|
{
|
||||||
MetaKmsCrtc *kms_crtc = l->data;
|
MetaKmsCrtc *kms_crtc = l->data;
|
||||||
MetaCrtc *crtc;
|
MetaCrtcKms *crtc_kms;
|
||||||
|
|
||||||
crtc = meta_create_kms_crtc (gpu_kms, kms_crtc);
|
crtc_kms = meta_crtc_kms_new (gpu_kms, kms_crtc);
|
||||||
|
|
||||||
crtcs = g_list_append (crtcs, crtc);
|
crtcs = g_list_append (crtcs, crtc_kms);
|
||||||
}
|
}
|
||||||
|
|
||||||
meta_gpu_take_crtcs (gpu, crtcs);
|
meta_gpu_take_crtcs (gpu, crtcs);
|
||||||
|
@ -326,7 +326,7 @@ meta_monitor_manager_kms_get_crtc_gamma (MetaMonitorManager *manager,
|
|||||||
MetaKmsCrtc *kms_crtc;
|
MetaKmsCrtc *kms_crtc;
|
||||||
const MetaKmsCrtcState *crtc_state;
|
const MetaKmsCrtcState *crtc_state;
|
||||||
|
|
||||||
kms_crtc = meta_crtc_kms_get_kms_crtc (crtc);
|
kms_crtc = meta_crtc_kms_get_kms_crtc (META_CRTC_KMS (crtc));
|
||||||
crtc_state = meta_kms_crtc_get_current_state (kms_crtc);
|
crtc_state = meta_kms_crtc_get_current_state (kms_crtc);
|
||||||
|
|
||||||
*size = crtc_state->gamma.size;
|
*size = crtc_state->gamma.size;
|
||||||
@ -419,7 +419,7 @@ meta_monitor_manager_kms_set_crtc_gamma (MetaMonitorManager *manager,
|
|||||||
|
|
||||||
kms_update = meta_kms_ensure_pending_update (kms);
|
kms_update = meta_kms_ensure_pending_update (kms);
|
||||||
|
|
||||||
kms_crtc = meta_crtc_kms_get_kms_crtc (crtc);
|
kms_crtc = meta_crtc_kms_get_kms_crtc (META_CRTC_KMS (crtc));
|
||||||
meta_kms_crtc_set_gamma (kms_crtc, kms_update,
|
meta_kms_crtc_set_gamma (kms_crtc, kms_update,
|
||||||
size, red, green, blue);
|
size, red, green, blue);
|
||||||
|
|
||||||
@ -487,7 +487,7 @@ meta_monitor_manager_kms_is_transform_handled (MetaMonitorManager *manager,
|
|||||||
MetaCrtc *crtc,
|
MetaCrtc *crtc,
|
||||||
MetaMonitorTransform transform)
|
MetaMonitorTransform transform)
|
||||||
{
|
{
|
||||||
return meta_crtc_kms_is_transform_handled (crtc, transform);
|
return meta_crtc_kms_is_transform_handled (META_CRTC_KMS (crtc), transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
static float
|
static float
|
||||||
|
@ -313,13 +313,13 @@ meta_output_kms_new (MetaGpuKms *gpu_kms,
|
|||||||
|
|
||||||
for (l = meta_gpu_get_crtcs (gpu); l; l = l->next)
|
for (l = meta_gpu_get_crtcs (gpu); l; l = l->next)
|
||||||
{
|
{
|
||||||
MetaCrtc *crtc = l->data;
|
MetaCrtcKms *crtc_kms = META_CRTC_KMS (l->data);
|
||||||
MetaKmsCrtc *kms_crtc = meta_crtc_kms_get_kms_crtc (crtc);
|
MetaKmsCrtc *kms_crtc = meta_crtc_kms_get_kms_crtc (crtc_kms);
|
||||||
uint32_t crtc_idx;
|
uint32_t crtc_idx;
|
||||||
|
|
||||||
crtc_idx = meta_kms_crtc_get_idx (kms_crtc);
|
crtc_idx = meta_kms_crtc_get_idx (kms_crtc);
|
||||||
if (connector_state->common_possible_crtcs & (1 << crtc_idx))
|
if (connector_state->common_possible_crtcs & (1 << crtc_idx))
|
||||||
g_array_append_val (crtcs, crtc);
|
g_array_append_val (crtcs, crtc_kms);
|
||||||
}
|
}
|
||||||
|
|
||||||
output_info->n_possible_crtcs = crtcs->len;
|
output_info->n_possible_crtcs = crtcs->len;
|
||||||
|
@ -340,14 +340,14 @@ meta_onscreen_native_get_egl (MetaOnscreenNative *onscreen_native)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static GArray *
|
static GArray *
|
||||||
get_supported_kms_modifiers (MetaCrtc *crtc,
|
get_supported_kms_modifiers (MetaCrtcKms *crtc_kms,
|
||||||
uint32_t format)
|
uint32_t format)
|
||||||
{
|
{
|
||||||
GArray *modifiers;
|
GArray *modifiers;
|
||||||
GArray *crtc_mods;
|
GArray *crtc_mods;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
crtc_mods = meta_crtc_kms_get_modifiers (crtc, format);
|
crtc_mods = meta_crtc_kms_get_modifiers (crtc_kms, format);
|
||||||
if (!crtc_mods)
|
if (!crtc_mods)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -375,7 +375,7 @@ get_supported_kms_modifiers (MetaCrtc *crtc,
|
|||||||
|
|
||||||
static GArray *
|
static GArray *
|
||||||
get_supported_egl_modifiers (CoglOnscreen *onscreen,
|
get_supported_egl_modifiers (CoglOnscreen *onscreen,
|
||||||
MetaCrtc *crtc,
|
MetaCrtcKms *crtc_kms,
|
||||||
uint32_t format)
|
uint32_t format)
|
||||||
{
|
{
|
||||||
CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
|
CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
|
||||||
@ -389,7 +389,7 @@ get_supported_egl_modifiers (CoglOnscreen *onscreen,
|
|||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
|
|
||||||
gpu = meta_crtc_get_gpu (crtc);
|
gpu = meta_crtc_get_gpu (META_CRTC (crtc_kms));
|
||||||
renderer_gpu_data = meta_renderer_native_get_gpu_data (renderer_native,
|
renderer_gpu_data = meta_renderer_native_get_gpu_data (renderer_native,
|
||||||
META_GPU_KMS (gpu));
|
META_GPU_KMS (gpu));
|
||||||
|
|
||||||
@ -428,15 +428,15 @@ get_supported_modifiers (CoglOnscreen *onscreen,
|
|||||||
{
|
{
|
||||||
CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
|
CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
|
||||||
MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
|
MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
|
||||||
MetaCrtc *crtc = onscreen_native->crtc;
|
MetaCrtcKms *crtc_kms = META_CRTC_KMS (onscreen_native->crtc);
|
||||||
MetaGpu *gpu;
|
MetaGpu *gpu;
|
||||||
g_autoptr (GArray) modifiers = NULL;
|
g_autoptr (GArray) modifiers = NULL;
|
||||||
|
|
||||||
gpu = meta_crtc_get_gpu (crtc);
|
gpu = meta_crtc_get_gpu (META_CRTC (crtc_kms));
|
||||||
if (gpu == META_GPU (onscreen_native->render_gpu))
|
if (gpu == META_GPU (onscreen_native->render_gpu))
|
||||||
modifiers = get_supported_kms_modifiers (crtc, format);
|
modifiers = get_supported_kms_modifiers (crtc_kms, format);
|
||||||
else
|
else
|
||||||
modifiers = get_supported_egl_modifiers (onscreen, crtc, format);
|
modifiers = get_supported_egl_modifiers (onscreen, crtc_kms, format);
|
||||||
|
|
||||||
return g_steal_pointer (&modifiers);
|
return g_steal_pointer (&modifiers);
|
||||||
}
|
}
|
||||||
@ -446,9 +446,9 @@ get_supported_kms_formats (CoglOnscreen *onscreen)
|
|||||||
{
|
{
|
||||||
CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
|
CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
|
||||||
MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
|
MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
|
||||||
MetaCrtc *crtc = onscreen_native->crtc;
|
MetaCrtcKms *crtc_kms = META_CRTC_KMS (onscreen_native->crtc);
|
||||||
|
|
||||||
return meta_crtc_kms_copy_drm_format_list (crtc);
|
return meta_crtc_kms_copy_drm_format_list (crtc_kms);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@ -1138,7 +1138,7 @@ notify_view_crtc_presented (MetaRendererView *view,
|
|||||||
*/
|
*/
|
||||||
frame_info = g_queue_peek_tail (&onscreen->pending_frame_infos);
|
frame_info = g_queue_peek_tail (&onscreen->pending_frame_infos);
|
||||||
|
|
||||||
crtc = meta_crtc_kms_from_kms_crtc (kms_crtc);
|
crtc = META_CRTC (meta_crtc_kms_from_kms_crtc (kms_crtc));
|
||||||
crtc_config = crtc ? meta_crtc_get_config (crtc) : NULL;
|
crtc_config = crtc ? meta_crtc_get_config (crtc) : NULL;
|
||||||
refresh_rate = crtc_config ? crtc_config->mode->refresh_rate : 0.0f;
|
refresh_rate = crtc_config ? crtc_config->mode->refresh_rate : 0.0f;
|
||||||
if (refresh_rate >= frame_info->refresh_rate)
|
if (refresh_rate >= frame_info->refresh_rate)
|
||||||
@ -1223,7 +1223,7 @@ page_flip_feedback_mode_set_fallback (MetaKmsCrtc *kms_crtc,
|
|||||||
* use. Lets use the next best thing: the current time.
|
* use. Lets use the next best thing: the current time.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
crtc = meta_crtc_kms_from_kms_crtc (kms_crtc);
|
crtc = META_CRTC (meta_crtc_kms_from_kms_crtc (kms_crtc));
|
||||||
gpu_kms = META_GPU_KMS (meta_crtc_get_gpu (crtc));
|
gpu_kms = META_GPU_KMS (meta_crtc_get_gpu (crtc));
|
||||||
now_ns = meta_gpu_kms_get_current_time_ns (gpu_kms);
|
now_ns = meta_gpu_kms_get_current_time_ns (gpu_kms);
|
||||||
|
|
||||||
@ -1250,7 +1250,7 @@ page_flip_feedback_discarded (MetaKmsCrtc *kms_crtc,
|
|||||||
if (error)
|
if (error)
|
||||||
g_warning ("Page flip discarded: %s", error->message);
|
g_warning ("Page flip discarded: %s", error->message);
|
||||||
|
|
||||||
crtc = meta_crtc_kms_from_kms_crtc (kms_crtc);
|
crtc = META_CRTC (meta_crtc_kms_from_kms_crtc (kms_crtc));
|
||||||
gpu_kms = META_GPU_KMS (meta_crtc_get_gpu (crtc));
|
gpu_kms = META_GPU_KMS (meta_crtc_get_gpu (crtc));
|
||||||
now_ns = meta_gpu_kms_get_current_time_ns (gpu_kms);
|
now_ns = meta_gpu_kms_get_current_time_ns (gpu_kms);
|
||||||
|
|
||||||
@ -1358,6 +1358,7 @@ meta_onscreen_native_flip_crtc (CoglOnscreen *onscreen,
|
|||||||
MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
|
MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
|
||||||
MetaRendererNative *renderer_native = onscreen_native->renderer_native;
|
MetaRendererNative *renderer_native = onscreen_native->renderer_native;
|
||||||
MetaGpuKms *render_gpu = onscreen_native->render_gpu;
|
MetaGpuKms *render_gpu = onscreen_native->render_gpu;
|
||||||
|
MetaCrtcKms *crtc_kms = META_CRTC_KMS (crtc);
|
||||||
MetaRendererNativeGpuData *renderer_gpu_data;
|
MetaRendererNativeGpuData *renderer_gpu_data;
|
||||||
MetaGpuKms *gpu_kms;
|
MetaGpuKms *gpu_kms;
|
||||||
MetaOnscreenNativeSecondaryGpuState *secondary_gpu_state = NULL;
|
MetaOnscreenNativeSecondaryGpuState *secondary_gpu_state = NULL;
|
||||||
@ -1382,8 +1383,8 @@ meta_onscreen_native_flip_crtc (CoglOnscreen *onscreen,
|
|||||||
fb_id = meta_drm_buffer_get_fb_id (secondary_gpu_state->gbm.next_fb);
|
fb_id = meta_drm_buffer_get_fb_id (secondary_gpu_state->gbm.next_fb);
|
||||||
}
|
}
|
||||||
|
|
||||||
meta_crtc_kms_assign_primary_plane (crtc, fb_id, kms_update);
|
meta_crtc_kms_assign_primary_plane (crtc_kms, fb_id, kms_update);
|
||||||
meta_crtc_kms_page_flip (crtc,
|
meta_crtc_kms_page_flip (crtc_kms,
|
||||||
&page_flip_feedback,
|
&page_flip_feedback,
|
||||||
g_object_ref (view),
|
g_object_ref (view),
|
||||||
kms_update);
|
kms_update);
|
||||||
@ -1396,7 +1397,7 @@ meta_onscreen_native_flip_crtc (CoglOnscreen *onscreen,
|
|||||||
#ifdef HAVE_EGL_DEVICE
|
#ifdef HAVE_EGL_DEVICE
|
||||||
case META_RENDERER_NATIVE_MODE_EGL_DEVICE:
|
case META_RENDERER_NATIVE_MODE_EGL_DEVICE:
|
||||||
meta_kms_update_custom_page_flip (kms_update,
|
meta_kms_update_custom_page_flip (kms_update,
|
||||||
meta_crtc_kms_get_kms_crtc (crtc),
|
meta_crtc_kms_get_kms_crtc (crtc_kms),
|
||||||
&page_flip_feedback,
|
&page_flip_feedback,
|
||||||
g_object_ref (view),
|
g_object_ref (view),
|
||||||
custom_egl_stream_page_flip,
|
custom_egl_stream_page_flip,
|
||||||
@ -1414,6 +1415,7 @@ meta_onscreen_native_set_crtc_mode (CoglOnscreen *onscreen,
|
|||||||
{
|
{
|
||||||
CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
|
CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
|
||||||
MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
|
MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
|
||||||
|
MetaCrtcKms *crtc_kms = META_CRTC_KMS (onscreen_native->crtc);
|
||||||
|
|
||||||
COGL_TRACE_BEGIN_SCOPED (MetaOnscreenNativeSetCrtcModes,
|
COGL_TRACE_BEGIN_SCOPED (MetaOnscreenNativeSetCrtcModes,
|
||||||
"Onscreen (set CRTC modes)");
|
"Onscreen (set CRTC modes)");
|
||||||
@ -1428,14 +1430,14 @@ meta_onscreen_native_set_crtc_mode (CoglOnscreen *onscreen,
|
|||||||
uint32_t fb_id;
|
uint32_t fb_id;
|
||||||
|
|
||||||
fb_id = onscreen_native->egl.dumb_fb.fb_id;
|
fb_id = onscreen_native->egl.dumb_fb.fb_id;
|
||||||
meta_crtc_kms_assign_primary_plane (onscreen_native->crtc,
|
meta_crtc_kms_assign_primary_plane (crtc_kms,
|
||||||
fb_id, kms_update);
|
fb_id, kms_update);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
meta_crtc_kms_set_mode (onscreen_native->crtc, kms_update);
|
meta_crtc_kms_set_mode (crtc_kms, kms_update);
|
||||||
meta_output_kms_set_underscan (META_OUTPUT_KMS (onscreen_native->output),
|
meta_output_kms_set_underscan (META_OUTPUT_KMS (onscreen_native->output),
|
||||||
kms_update);
|
kms_update);
|
||||||
}
|
}
|
||||||
@ -3304,7 +3306,7 @@ meta_renderer_native_finish_frame (MetaRendererNative *renderer_native)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
kms_update = meta_kms_ensure_pending_update (kms);
|
kms_update = meta_kms_ensure_pending_update (kms);
|
||||||
meta_crtc_kms_set_mode (crtc, kms_update);
|
meta_crtc_kms_set_mode (META_CRTC_KMS (crtc), kms_update);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,15 +46,19 @@
|
|||||||
#include "backends/x11/meta-gpu-xrandr.h"
|
#include "backends/x11/meta-gpu-xrandr.h"
|
||||||
#include "backends/x11/meta-monitor-manager-xrandr.h"
|
#include "backends/x11/meta-monitor-manager-xrandr.h"
|
||||||
|
|
||||||
typedef struct _MetaCrtcXrandr
|
struct _MetaCrtcXrandr
|
||||||
{
|
{
|
||||||
|
MetaCrtc parent;
|
||||||
|
|
||||||
MetaRectangle rect;
|
MetaRectangle rect;
|
||||||
MetaMonitorTransform transform;
|
MetaMonitorTransform transform;
|
||||||
MetaCrtcMode *current_mode;
|
MetaCrtcMode *current_mode;
|
||||||
} MetaCrtcXrandr;
|
};
|
||||||
|
|
||||||
|
G_DEFINE_TYPE (MetaCrtcXrandr, meta_crtc_xrandr, META_TYPE_CRTC)
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
meta_crtc_xrandr_set_config (MetaCrtc *crtc,
|
meta_crtc_xrandr_set_config (MetaCrtcXrandr *crtc_xrandr,
|
||||||
xcb_randr_crtc_t xrandr_crtc,
|
xcb_randr_crtc_t xrandr_crtc,
|
||||||
xcb_timestamp_t timestamp,
|
xcb_timestamp_t timestamp,
|
||||||
int x,
|
int x,
|
||||||
@ -65,7 +69,7 @@ meta_crtc_xrandr_set_config (MetaCrtc *crtc,
|
|||||||
int n_outputs,
|
int n_outputs,
|
||||||
xcb_timestamp_t *out_timestamp)
|
xcb_timestamp_t *out_timestamp)
|
||||||
{
|
{
|
||||||
MetaGpu *gpu = meta_crtc_get_gpu (crtc);
|
MetaGpu *gpu = meta_crtc_get_gpu (META_CRTC (crtc_xrandr));
|
||||||
MetaGpuXrandr *gpu_xrandr = META_GPU_XRANDR (gpu);
|
MetaGpuXrandr *gpu_xrandr = META_GPU_XRANDR (gpu);
|
||||||
MetaBackend *backend = meta_gpu_get_backend (gpu);
|
MetaBackend *backend = meta_gpu_get_backend (gpu);
|
||||||
MetaMonitorManager *monitor_manager =
|
MetaMonitorManager *monitor_manager =
|
||||||
@ -181,10 +185,9 @@ meta_monitor_transform_from_xrandr_all (Rotation rotation)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
meta_crtc_xrandr_is_assignment_changed (MetaCrtc *crtc,
|
meta_crtc_xrandr_is_assignment_changed (MetaCrtcXrandr *crtc_xrandr,
|
||||||
MetaCrtcAssignment *crtc_assignment)
|
MetaCrtcAssignment *crtc_assignment)
|
||||||
{
|
{
|
||||||
MetaCrtcXrandr *crtc_xrandr = crtc->driver_private;
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
if (crtc_xrandr->current_mode != crtc_assignment->mode)
|
if (crtc_xrandr->current_mode != crtc_assignment->mode)
|
||||||
@ -205,7 +208,7 @@ meta_crtc_xrandr_is_assignment_changed (MetaCrtc *crtc,
|
|||||||
MetaCrtc *assigned_crtc;
|
MetaCrtc *assigned_crtc;
|
||||||
|
|
||||||
assigned_crtc = meta_output_get_assigned_crtc (output);
|
assigned_crtc = meta_output_get_assigned_crtc (output);
|
||||||
if (assigned_crtc != crtc)
|
if (assigned_crtc != META_CRTC (crtc_xrandr))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,21 +216,13 @@ meta_crtc_xrandr_is_assignment_changed (MetaCrtc *crtc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
MetaCrtcMode *
|
MetaCrtcMode *
|
||||||
meta_crtc_xrandr_get_current_mode (MetaCrtc *crtc)
|
meta_crtc_xrandr_get_current_mode (MetaCrtcXrandr *crtc_xrandr)
|
||||||
{
|
{
|
||||||
MetaCrtcXrandr *crtc_xrandr = crtc->driver_private;
|
|
||||||
|
|
||||||
return crtc_xrandr->current_mode;
|
return crtc_xrandr->current_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
MetaCrtcXrandr *
|
||||||
meta_crtc_destroy_notify (MetaCrtc *crtc)
|
meta_crtc_xrandr_new (MetaGpuXrandr *gpu_xrandr,
|
||||||
{
|
|
||||||
g_free (crtc->driver_private);
|
|
||||||
}
|
|
||||||
|
|
||||||
MetaCrtc *
|
|
||||||
meta_create_xrandr_crtc (MetaGpuXrandr *gpu_xrandr,
|
|
||||||
XRRCrtcInfo *xrandr_crtc,
|
XRRCrtcInfo *xrandr_crtc,
|
||||||
RRCrtc crtc_id,
|
RRCrtc crtc_id,
|
||||||
XRRScreenResources *resources)
|
XRRScreenResources *resources)
|
||||||
@ -241,7 +236,6 @@ meta_create_xrandr_crtc (MetaGpuXrandr *gpu_xrandr,
|
|||||||
Display *xdisplay =
|
Display *xdisplay =
|
||||||
meta_monitor_manager_xrandr_get_xdisplay (monitor_manager_xrandr);
|
meta_monitor_manager_xrandr_get_xdisplay (monitor_manager_xrandr);
|
||||||
MetaMonitorTransform all_transforms;
|
MetaMonitorTransform all_transforms;
|
||||||
MetaCrtc *crtc;
|
|
||||||
MetaCrtcXrandr *crtc_xrandr;
|
MetaCrtcXrandr *crtc_xrandr;
|
||||||
XRRPanning *panning;
|
XRRPanning *panning;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
@ -249,7 +243,7 @@ meta_create_xrandr_crtc (MetaGpuXrandr *gpu_xrandr,
|
|||||||
|
|
||||||
all_transforms =
|
all_transforms =
|
||||||
meta_monitor_transform_from_xrandr_all (xrandr_crtc->rotations);
|
meta_monitor_transform_from_xrandr_all (xrandr_crtc->rotations);
|
||||||
crtc = g_object_new (META_TYPE_CRTC,
|
crtc_xrandr = g_object_new (META_TYPE_CRTC_XRANDR,
|
||||||
"id", crtc_id,
|
"id", crtc_id,
|
||||||
"gpu", gpu,
|
"gpu", gpu,
|
||||||
"all-transforms", all_transforms,
|
"all-transforms", all_transforms,
|
||||||
@ -259,9 +253,6 @@ meta_create_xrandr_crtc (MetaGpuXrandr *gpu_xrandr,
|
|||||||
crtc_xrandr->transform =
|
crtc_xrandr->transform =
|
||||||
meta_monitor_transform_from_xrandr (xrandr_crtc->rotation);
|
meta_monitor_transform_from_xrandr (xrandr_crtc->rotation);
|
||||||
|
|
||||||
crtc->driver_private = crtc_xrandr;
|
|
||||||
crtc->driver_notify = (GDestroyNotify) meta_crtc_destroy_notify;
|
|
||||||
|
|
||||||
panning = XRRGetPanning (xdisplay, resources, crtc_id);
|
panning = XRRGetPanning (xdisplay, resources, crtc_id);
|
||||||
if (panning && panning->width > 0 && panning->height > 0)
|
if (panning && panning->width > 0 && panning->height > 0)
|
||||||
{
|
{
|
||||||
@ -294,7 +285,7 @@ meta_create_xrandr_crtc (MetaGpuXrandr *gpu_xrandr,
|
|||||||
|
|
||||||
if (crtc_xrandr->current_mode)
|
if (crtc_xrandr->current_mode)
|
||||||
{
|
{
|
||||||
meta_crtc_set_config (crtc,
|
meta_crtc_set_config (META_CRTC (crtc_xrandr),
|
||||||
&GRAPHENE_RECT_INIT (crtc_xrandr->rect.x,
|
&GRAPHENE_RECT_INIT (crtc_xrandr->rect.x,
|
||||||
crtc_xrandr->rect.y,
|
crtc_xrandr->rect.y,
|
||||||
crtc_xrandr->rect.width,
|
crtc_xrandr->rect.width,
|
||||||
@ -303,5 +294,15 @@ meta_create_xrandr_crtc (MetaGpuXrandr *gpu_xrandr,
|
|||||||
crtc_xrandr->transform);
|
crtc_xrandr->transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
return crtc;
|
return crtc_xrandr;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_crtc_xrandr_init (MetaCrtcXrandr *crtc_xrandr)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_crtc_xrandr_class_init (MetaCrtcXrandrClass *klass)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,12 @@
|
|||||||
#include "backends/meta-crtc.h"
|
#include "backends/meta-crtc.h"
|
||||||
#include "backends/x11/meta-gpu-xrandr.h"
|
#include "backends/x11/meta-gpu-xrandr.h"
|
||||||
|
|
||||||
gboolean meta_crtc_xrandr_set_config (MetaCrtc *crtc,
|
#define META_TYPE_CRTC_XRANDR (meta_crtc_xrandr_get_type ())
|
||||||
|
G_DECLARE_FINAL_TYPE (MetaCrtcXrandr, meta_crtc_xrandr,
|
||||||
|
META, CRTC_XRANDR,
|
||||||
|
MetaCrtc)
|
||||||
|
|
||||||
|
gboolean meta_crtc_xrandr_set_config (MetaCrtcXrandr *crtc_xrandr,
|
||||||
xcb_randr_crtc_t xrandr_crtc,
|
xcb_randr_crtc_t xrandr_crtc,
|
||||||
xcb_timestamp_t timestamp,
|
xcb_timestamp_t timestamp,
|
||||||
int x,
|
int x,
|
||||||
@ -39,12 +44,12 @@ gboolean meta_crtc_xrandr_set_config (MetaCrtc *crtc,
|
|||||||
int n_outputs,
|
int n_outputs,
|
||||||
xcb_timestamp_t *out_timestamp);
|
xcb_timestamp_t *out_timestamp);
|
||||||
|
|
||||||
gboolean meta_crtc_xrandr_is_assignment_changed (MetaCrtc *crtc,
|
gboolean meta_crtc_xrandr_is_assignment_changed (MetaCrtcXrandr *crtc_xrandr,
|
||||||
MetaCrtcAssignment *crtc_assignment);
|
MetaCrtcAssignment *crtc_assignment);
|
||||||
|
|
||||||
MetaCrtcMode * meta_crtc_xrandr_get_current_mode (MetaCrtc *crtc);
|
MetaCrtcMode * meta_crtc_xrandr_get_current_mode (MetaCrtcXrandr *crtc_xrandr);
|
||||||
|
|
||||||
MetaCrtc * meta_create_xrandr_crtc (MetaGpuXrandr *gpu_xrandr,
|
MetaCrtcXrandr * meta_crtc_xrandr_new (MetaGpuXrandr *gpu_xrandr,
|
||||||
XRRCrtcInfo *xrandr_crtc,
|
XRRCrtcInfo *xrandr_crtc,
|
||||||
RRCrtc crtc_id,
|
RRCrtc crtc_id,
|
||||||
XRRScreenResources *resources);
|
XRRScreenResources *resources);
|
||||||
|
@ -161,16 +161,16 @@ meta_gpu_xrandr_read_current (MetaGpu *gpu,
|
|||||||
{
|
{
|
||||||
XRRCrtcInfo *xrandr_crtc;
|
XRRCrtcInfo *xrandr_crtc;
|
||||||
RRCrtc crtc_id;
|
RRCrtc crtc_id;
|
||||||
MetaCrtc *crtc;
|
MetaCrtcXrandr *crtc_xrandr;
|
||||||
|
|
||||||
crtc_id = resources->crtcs[i];
|
crtc_id = resources->crtcs[i];
|
||||||
xrandr_crtc = XRRGetCrtcInfo (xdisplay,
|
xrandr_crtc = XRRGetCrtcInfo (xdisplay,
|
||||||
resources, crtc_id);
|
resources, crtc_id);
|
||||||
crtc = meta_create_xrandr_crtc (gpu_xrandr,
|
crtc_xrandr = meta_crtc_xrandr_new (gpu_xrandr,
|
||||||
xrandr_crtc, crtc_id, resources);
|
xrandr_crtc, crtc_id, resources);
|
||||||
XRRFreeCrtcInfo (xrandr_crtc);
|
XRRFreeCrtcInfo (xrandr_crtc);
|
||||||
|
|
||||||
crtcs = g_list_append (crtcs, crtc);
|
crtcs = g_list_append (crtcs, crtc_xrandr);
|
||||||
}
|
}
|
||||||
|
|
||||||
meta_gpu_take_crtcs (gpu, crtcs);
|
meta_gpu_take_crtcs (gpu, crtcs);
|
||||||
|
@ -228,7 +228,8 @@ xrandr_set_crtc_config (MetaMonitorManagerXrandr *manager_xrandr,
|
|||||||
{
|
{
|
||||||
xcb_timestamp_t new_timestamp;
|
xcb_timestamp_t new_timestamp;
|
||||||
|
|
||||||
if (!meta_crtc_xrandr_set_config (crtc, xrandr_crtc, timestamp,
|
if (!meta_crtc_xrandr_set_config (META_CRTC_XRANDR (crtc),
|
||||||
|
xrandr_crtc, timestamp,
|
||||||
x, y, mode, rotation,
|
x, y, mode, rotation,
|
||||||
outputs, n_outputs,
|
outputs, n_outputs,
|
||||||
&new_timestamp))
|
&new_timestamp))
|
||||||
@ -254,10 +255,11 @@ is_crtc_assignment_changed (MetaCrtc *crtc,
|
|||||||
if (crtc_assignment->crtc != crtc)
|
if (crtc_assignment->crtc != crtc)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
return meta_crtc_xrandr_is_assignment_changed (crtc, crtc_assignment);
|
return meta_crtc_xrandr_is_assignment_changed (META_CRTC_XRANDR (crtc),
|
||||||
|
crtc_assignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
return !!meta_crtc_xrandr_get_current_mode (crtc);
|
return !!meta_crtc_xrandr_get_current_mode (META_CRTC_XRANDR (crtc));
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -138,7 +138,7 @@ meta_test_headless_monitor_connect (void)
|
|||||||
test_setup->modes = g_list_append (NULL, crtc_mode);
|
test_setup->modes = g_list_append (NULL, crtc_mode);
|
||||||
|
|
||||||
gpu = META_GPU (meta_backend_get_gpus (meta_get_backend ())->data);
|
gpu = META_GPU (meta_backend_get_gpus (meta_get_backend ())->data);
|
||||||
crtc = g_object_new (META_TYPE_CRTC,
|
crtc = g_object_new (META_TYPE_CRTC_TEST,
|
||||||
"id", 1,
|
"id", 1,
|
||||||
"gpu", gpu,
|
"gpu", gpu,
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include "backends/meta-output.h"
|
#include "backends/meta-output.h"
|
||||||
#include "tests/meta-backend-test.h"
|
#include "tests/meta-backend-test.h"
|
||||||
|
|
||||||
|
G_DEFINE_TYPE (MetaCrtcTest, meta_crtc_test, META_TYPE_CRTC)
|
||||||
G_DEFINE_TYPE (MetaOutputTest, meta_output_test, META_TYPE_OUTPUT)
|
G_DEFINE_TYPE (MetaOutputTest, meta_output_test, META_TYPE_OUTPUT)
|
||||||
|
|
||||||
struct _MetaMonitorManagerTest
|
struct _MetaMonitorManagerTest
|
||||||
@ -436,3 +437,13 @@ static void
|
|||||||
meta_output_test_class_init (MetaOutputTestClass *klass)
|
meta_output_test_class_init (MetaOutputTestClass *klass)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_crtc_test_init (MetaCrtcTest *crtc_test)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_crtc_test_class_init (MetaCrtcTestClass *klass)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#ifndef META_MONITOR_MANAGER_TEST_H
|
#ifndef META_MONITOR_MANAGER_TEST_H
|
||||||
#define META_MONITOR_MANAGER_TEST_H
|
#define META_MONITOR_MANAGER_TEST_H
|
||||||
|
|
||||||
|
#include "backends/meta-crtc.h"
|
||||||
#include "backends/meta-monitor-manager-private.h"
|
#include "backends/meta-monitor-manager-private.h"
|
||||||
#include "backends/meta-output.h"
|
#include "backends/meta-output.h"
|
||||||
|
|
||||||
@ -30,6 +31,11 @@ typedef struct _MetaMonitorTestSetup
|
|||||||
GList *crtcs;
|
GList *crtcs;
|
||||||
} MetaMonitorTestSetup;
|
} MetaMonitorTestSetup;
|
||||||
|
|
||||||
|
struct _MetaCrtcTest
|
||||||
|
{
|
||||||
|
MetaCrtc parent;
|
||||||
|
};
|
||||||
|
|
||||||
struct _MetaOutputTest
|
struct _MetaOutputTest
|
||||||
{
|
{
|
||||||
MetaOutput parent;
|
MetaOutput parent;
|
||||||
@ -39,6 +45,11 @@ struct _MetaOutputTest
|
|||||||
|
|
||||||
typedef MetaMonitorTestSetup * (* CreateTestSetupFunc) (void);
|
typedef MetaMonitorTestSetup * (* CreateTestSetupFunc) (void);
|
||||||
|
|
||||||
|
#define META_TYPE_CRTC_TEST (meta_crtc_test_get_type ())
|
||||||
|
G_DECLARE_FINAL_TYPE (MetaCrtcTest, meta_crtc_test,
|
||||||
|
META, CRTC_TEST,
|
||||||
|
MetaCrtc)
|
||||||
|
|
||||||
#define META_TYPE_OUTPUT_TEST (meta_output_test_get_type ())
|
#define META_TYPE_OUTPUT_TEST (meta_output_test_get_type ())
|
||||||
G_DECLARE_FINAL_TYPE (MetaOutputTest, meta_output_test,
|
G_DECLARE_FINAL_TYPE (MetaOutputTest, meta_output_test,
|
||||||
META, OUTPUT_TEST,
|
META, OUTPUT_TEST,
|
||||||
|
@ -560,7 +560,7 @@ create_monitor_test_setup (MonitorTestCaseSetup *setup,
|
|||||||
{
|
{
|
||||||
MetaCrtc *crtc;
|
MetaCrtc *crtc;
|
||||||
|
|
||||||
crtc = g_object_new (META_TYPE_CRTC,
|
crtc = g_object_new (META_TYPE_CRTC_TEST,
|
||||||
"id", i + 1,
|
"id", i + 1,
|
||||||
"gpu", test_get_gpu (),
|
"gpu", test_get_gpu (),
|
||||||
NULL);
|
NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user