mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 10:00:45 -05:00
monitor-manager: Expose whether the backend handles a transform
Expose via a new API whether the transform on a logical monitor is handled by the backend. This was previously only exposed only in the native backend. This will be used to emulate not supporting transforms in the backend in the nested backend. https://bugzilla.gnome.org/show_bug.cgi?id=779745
This commit is contained in:
parent
4cfcd4bce0
commit
944339f6a5
@ -521,6 +521,14 @@ meta_monitor_manager_dummy_apply_config (MetaMonitorManager *manager,
|
|||||||
meta_monitor_manager_rebuild_derived (manager);
|
meta_monitor_manager_rebuild_derived (manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
meta_monitor_manager_dummy_is_transform_handled (MetaMonitorManager *manager,
|
||||||
|
MetaCrtc *crtc,
|
||||||
|
MetaMonitorTransform transform)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_monitor_manager_dummy_class_init (MetaMonitorManagerDummyClass *klass)
|
meta_monitor_manager_dummy_class_init (MetaMonitorManagerDummyClass *klass)
|
||||||
{
|
{
|
||||||
@ -530,6 +538,7 @@ meta_monitor_manager_dummy_class_init (MetaMonitorManagerDummyClass *klass)
|
|||||||
manager_class->ensure_initial_config = meta_monitor_manager_dummy_ensure_initial_config;
|
manager_class->ensure_initial_config = meta_monitor_manager_dummy_ensure_initial_config;
|
||||||
manager_class->apply_monitors_config = meta_monitor_manager_dummy_apply_monitors_config;
|
manager_class->apply_monitors_config = meta_monitor_manager_dummy_apply_monitors_config;
|
||||||
manager_class->apply_configuration = meta_monitor_manager_dummy_apply_config;
|
manager_class->apply_configuration = meta_monitor_manager_dummy_apply_config;
|
||||||
|
manager_class->is_transform_handled = meta_monitor_manager_dummy_is_transform_handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -345,6 +345,9 @@ struct _MetaMonitorManagerClass
|
|||||||
void (*tiled_monitor_removed) (MetaMonitorManager *,
|
void (*tiled_monitor_removed) (MetaMonitorManager *,
|
||||||
MetaMonitor *);
|
MetaMonitor *);
|
||||||
|
|
||||||
|
gboolean (*is_transform_handled) (MetaMonitorManager *,
|
||||||
|
MetaCrtc *,
|
||||||
|
MetaMonitorTransform);
|
||||||
};
|
};
|
||||||
|
|
||||||
void meta_monitor_manager_rebuild (MetaMonitorManager *manager,
|
void meta_monitor_manager_rebuild (MetaMonitorManager *manager,
|
||||||
@ -428,6 +431,10 @@ void meta_monitor_manager_tiled_monitor_added (MetaMonitorManager
|
|||||||
void meta_monitor_manager_tiled_monitor_removed (MetaMonitorManager *manager,
|
void meta_monitor_manager_tiled_monitor_removed (MetaMonitorManager *manager,
|
||||||
MetaMonitor *monitor);
|
MetaMonitor *monitor);
|
||||||
|
|
||||||
|
gboolean meta_monitor_manager_is_transform_handled (MetaMonitorManager *manager,
|
||||||
|
MetaCrtc *crtc,
|
||||||
|
MetaMonitorTransform transform);
|
||||||
|
|
||||||
MetaMonitorsConfig * meta_monitor_manager_ensure_configured (MetaMonitorManager *manager);
|
MetaMonitorsConfig * meta_monitor_manager_ensure_configured (MetaMonitorManager *manager);
|
||||||
|
|
||||||
void meta_monitor_manager_update_logical_state (MetaMonitorManager *manager,
|
void meta_monitor_manager_update_logical_state (MetaMonitorManager *manager,
|
||||||
|
@ -1725,6 +1725,17 @@ meta_monitor_manager_tiled_monitor_removed (MetaMonitorManager *manager,
|
|||||||
manager_class->tiled_monitor_removed (manager, monitor);
|
manager_class->tiled_monitor_removed (manager, monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
meta_monitor_manager_is_transform_handled (MetaMonitorManager *manager,
|
||||||
|
MetaCrtc *crtc,
|
||||||
|
MetaMonitorTransform transform)
|
||||||
|
{
|
||||||
|
MetaMonitorManagerClass *manager_class =
|
||||||
|
META_MONITOR_MANAGER_GET_CLASS (manager);
|
||||||
|
|
||||||
|
return manager_class->is_transform_handled (manager, crtc, transform);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_monitor_manager_read_current_state (MetaMonitorManager *manager)
|
meta_monitor_manager_read_current_state (MetaMonitorManager *manager)
|
||||||
{
|
{
|
||||||
|
@ -1968,6 +1968,19 @@ meta_monitor_manager_kms_wait_for_flip (MetaMonitorManagerKms *manager_kms)
|
|||||||
drmHandleEvent (manager_kms->fd, &evctx);
|
drmHandleEvent (manager_kms->fd, &evctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
meta_monitor_manager_kms_is_transform_handled (MetaMonitorManager *manager,
|
||||||
|
MetaCrtc *crtc,
|
||||||
|
MetaMonitorTransform transform)
|
||||||
|
{
|
||||||
|
MetaCrtcKms *crtc_kms = crtc->driver_private;
|
||||||
|
|
||||||
|
if ((1 << crtc->transform) & crtc_kms->all_hw_transforms)
|
||||||
|
return TRUE;
|
||||||
|
else
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_monitor_manager_kms_dispose (GObject *object)
|
meta_monitor_manager_kms_dispose (GObject *object)
|
||||||
{
|
{
|
||||||
@ -2007,20 +2020,5 @@ meta_monitor_manager_kms_class_init (MetaMonitorManagerKmsClass *klass)
|
|||||||
manager_class->set_power_save_mode = meta_monitor_manager_kms_set_power_save_mode;
|
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->get_crtc_gamma = meta_monitor_manager_kms_get_crtc_gamma;
|
||||||
manager_class->set_crtc_gamma = meta_monitor_manager_kms_set_crtc_gamma;
|
manager_class->set_crtc_gamma = meta_monitor_manager_kms_set_crtc_gamma;
|
||||||
}
|
manager_class->is_transform_handled = meta_monitor_manager_kms_is_transform_handled;
|
||||||
|
|
||||||
MetaMonitorTransform
|
|
||||||
meta_monitor_manager_kms_get_view_transform (MetaMonitorManagerKms *manager,
|
|
||||||
MetaCrtc *crtc)
|
|
||||||
{
|
|
||||||
MetaCrtcKms *crtc_kms;
|
|
||||||
|
|
||||||
crtc_kms = crtc->driver_private;
|
|
||||||
if ((1 << crtc->transform) & crtc_kms->all_hw_transforms)
|
|
||||||
{
|
|
||||||
/* Transform is managed by the hardware, the view is untransformed */
|
|
||||||
return META_MONITOR_TRANSFORM_NORMAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return crtc->transform;
|
|
||||||
}
|
}
|
||||||
|
@ -58,9 +58,4 @@ gboolean meta_monitor_manager_kms_flip_crtc (MetaMonitorManagerKms *manager_kms,
|
|||||||
|
|
||||||
void meta_monitor_manager_kms_wait_for_flip (MetaMonitorManagerKms *manager_kms);
|
void meta_monitor_manager_kms_wait_for_flip (MetaMonitorManagerKms *manager_kms);
|
||||||
|
|
||||||
MetaMonitorTransform
|
|
||||||
meta_monitor_manager_kms_get_view_transform (MetaMonitorManagerKms *manager,
|
|
||||||
MetaCrtc *crtc);
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* META_MONITOR_MANAGER_KMS_H */
|
#endif /* META_MONITOR_MANAGER_KMS_H */
|
||||||
|
@ -1398,25 +1398,6 @@ meta_renderer_native_queue_modes_reset (MetaRendererNative *renderer_native)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static MetaMonitorTransform
|
|
||||||
meta_renderer_native_get_logical_monitor_transform (MetaRenderer *renderer,
|
|
||||||
MetaLogicalMonitor *logical_monitor)
|
|
||||||
{
|
|
||||||
MetaBackend *backend = meta_get_backend ();
|
|
||||||
MetaMonitorManager *monitor_manager =
|
|
||||||
meta_backend_get_monitor_manager (backend);
|
|
||||||
MetaMonitorManagerKms *monitor_manager_kms =
|
|
||||||
META_MONITOR_MANAGER_KMS (monitor_manager);
|
|
||||||
MetaMonitor *monitor;
|
|
||||||
MetaOutput *output;
|
|
||||||
|
|
||||||
monitor = meta_logical_monitor_get_monitors (logical_monitor)->data;
|
|
||||||
output = meta_monitor_get_main_output (monitor);
|
|
||||||
|
|
||||||
return meta_monitor_manager_kms_get_view_transform (monitor_manager_kms,
|
|
||||||
output->crtc);
|
|
||||||
}
|
|
||||||
|
|
||||||
static CoglOnscreen *
|
static CoglOnscreen *
|
||||||
meta_renderer_native_create_onscreen (MetaRendererNative *renderer,
|
meta_renderer_native_create_onscreen (MetaRendererNative *renderer,
|
||||||
CoglContext *context,
|
CoglContext *context,
|
||||||
@ -1689,38 +1670,61 @@ meta_renderer_native_create_legacy_view (MetaRendererNative *renderer_native)
|
|||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static MetaMonitorTransform
|
||||||
|
calculate_view_transform (MetaMonitorManager *monitor_manager,
|
||||||
|
MetaLogicalMonitor *logical_monitor)
|
||||||
|
{
|
||||||
|
MetaMonitor *main_monitor;
|
||||||
|
MetaOutput *main_output;
|
||||||
|
main_monitor = meta_logical_monitor_get_monitors (logical_monitor)->data;
|
||||||
|
main_output = meta_monitor_get_main_output (main_monitor);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Pick any monitor and output and check; all CRTCs of a logical monitor will
|
||||||
|
* always have the same transform assigned to them.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (meta_monitor_manager_is_transform_handled (monitor_manager,
|
||||||
|
main_output->crtc,
|
||||||
|
main_output->crtc->transform))
|
||||||
|
return META_MONITOR_TRANSFORM_NORMAL;
|
||||||
|
else
|
||||||
|
return main_output->crtc->transform;
|
||||||
|
}
|
||||||
|
|
||||||
static MetaRendererView *
|
static MetaRendererView *
|
||||||
meta_renderer_native_create_view (MetaRenderer *renderer,
|
meta_renderer_native_create_view (MetaRenderer *renderer,
|
||||||
MetaLogicalMonitor *logical_monitor)
|
MetaLogicalMonitor *logical_monitor)
|
||||||
{
|
{
|
||||||
MetaBackend *backend = meta_get_backend ();
|
MetaBackend *backend = meta_get_backend ();
|
||||||
|
MetaMonitorManager *monitor_manager =
|
||||||
|
meta_backend_get_monitor_manager (backend);
|
||||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||||
CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend);
|
CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend);
|
||||||
CoglDisplay *cogl_display = cogl_context_get_display (cogl_context);
|
CoglDisplay *cogl_display = cogl_context_get_display (cogl_context);
|
||||||
CoglDisplayEGL *egl_display = cogl_display->winsys;
|
CoglDisplayEGL *egl_display = cogl_display->winsys;
|
||||||
CoglOnscreenEGL *egl_onscreen;
|
CoglOnscreenEGL *egl_onscreen;
|
||||||
MetaMonitorTransform transform;
|
MetaMonitorTransform view_transform;
|
||||||
CoglOnscreen *onscreen = NULL;
|
CoglOnscreen *onscreen = NULL;
|
||||||
CoglOffscreen *offscreen = NULL;
|
CoglOffscreen *offscreen = NULL;
|
||||||
MetaRendererView *view;
|
MetaRendererView *view;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
transform = meta_renderer_native_get_logical_monitor_transform (renderer,
|
view_transform = calculate_view_transform (monitor_manager, logical_monitor);
|
||||||
logical_monitor);
|
|
||||||
|
|
||||||
onscreen = meta_renderer_native_create_onscreen (META_RENDERER_NATIVE (renderer),
|
onscreen = meta_renderer_native_create_onscreen (META_RENDERER_NATIVE (renderer),
|
||||||
cogl_context,
|
cogl_context,
|
||||||
transform,
|
view_transform,
|
||||||
logical_monitor->rect.width,
|
logical_monitor->rect.width,
|
||||||
logical_monitor->rect.height);
|
logical_monitor->rect.height);
|
||||||
if (!onscreen)
|
if (!onscreen)
|
||||||
meta_fatal ("Failed to allocate onscreen framebuffer\n");
|
meta_fatal ("Failed to allocate onscreen framebuffer\n");
|
||||||
|
|
||||||
if (transform != META_MONITOR_TRANSFORM_NORMAL)
|
if (view_transform != META_MONITOR_TRANSFORM_NORMAL)
|
||||||
{
|
{
|
||||||
offscreen = meta_renderer_native_create_offscreen (META_RENDERER_NATIVE (renderer),
|
offscreen = meta_renderer_native_create_offscreen (META_RENDERER_NATIVE (renderer),
|
||||||
cogl_context,
|
cogl_context,
|
||||||
transform,
|
view_transform,
|
||||||
logical_monitor->rect.width,
|
logical_monitor->rect.width,
|
||||||
logical_monitor->rect.height);
|
logical_monitor->rect.height);
|
||||||
if (!offscreen)
|
if (!offscreen)
|
||||||
@ -1732,7 +1736,7 @@ meta_renderer_native_create_view (MetaRenderer *renderer,
|
|||||||
"framebuffer", onscreen,
|
"framebuffer", onscreen,
|
||||||
"offscreen", offscreen,
|
"offscreen", offscreen,
|
||||||
"logical-monitor", logical_monitor,
|
"logical-monitor", logical_monitor,
|
||||||
"transform", transform,
|
"transform", view_transform,
|
||||||
NULL);
|
NULL);
|
||||||
g_clear_pointer (&offscreen, cogl_object_unref);
|
g_clear_pointer (&offscreen, cogl_object_unref);
|
||||||
|
|
||||||
|
@ -1558,6 +1558,16 @@ meta_monitor_manager_xrandr_init_monitors (MetaMonitorManagerXrandr *manager_xra
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
meta_monitor_manager_xrandr_is_transform_handled (MetaMonitorManager *manager,
|
||||||
|
MetaCrtc *crtc,
|
||||||
|
MetaMonitorTransform transform)
|
||||||
|
{
|
||||||
|
g_warn_if_fail (crtc->all_transforms & transform);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_monitor_manager_xrandr_init (MetaMonitorManagerXrandr *manager_xrandr)
|
meta_monitor_manager_xrandr_init (MetaMonitorManagerXrandr *manager_xrandr)
|
||||||
{
|
{
|
||||||
@ -1633,6 +1643,7 @@ meta_monitor_manager_xrandr_class_init (MetaMonitorManagerXrandrClass *klass)
|
|||||||
manager_class->tiled_monitor_added = meta_monitor_manager_xrandr_tiled_monitor_added;
|
manager_class->tiled_monitor_added = meta_monitor_manager_xrandr_tiled_monitor_added;
|
||||||
manager_class->tiled_monitor_removed = meta_monitor_manager_xrandr_tiled_monitor_removed;
|
manager_class->tiled_monitor_removed = meta_monitor_manager_xrandr_tiled_monitor_removed;
|
||||||
#endif
|
#endif
|
||||||
|
manager_class->is_transform_handled = meta_monitor_manager_xrandr_is_transform_handled;
|
||||||
|
|
||||||
quark_meta_monitor_xrandr_data =
|
quark_meta_monitor_xrandr_data =
|
||||||
g_quark_from_static_string ("-meta-monitor-xrandr-data");
|
g_quark_from_static_string ("-meta-monitor-xrandr-data");
|
||||||
|
@ -327,6 +327,14 @@ meta_monitor_manager_test_tiled_monitor_removed (MetaMonitorManager *manager,
|
|||||||
manager_test->tiled_monitor_count--;
|
manager_test->tiled_monitor_count--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
meta_monitor_manager_test_is_transform_handled (MetaMonitorManager *manager,
|
||||||
|
MetaCrtc *crtc,
|
||||||
|
MetaMonitorTransform transform)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_monitor_manager_test_dispose (GObject *object)
|
meta_monitor_manager_test_dispose (GObject *object)
|
||||||
{
|
{
|
||||||
@ -358,4 +366,5 @@ meta_monitor_manager_test_class_init (MetaMonitorManagerTestClass *klass)
|
|||||||
manager_class->apply_configuration = meta_monitor_manager_test_apply_configuration;
|
manager_class->apply_configuration = meta_monitor_manager_test_apply_configuration;
|
||||||
manager_class->tiled_monitor_added = meta_monitor_manager_test_tiled_monitor_added;
|
manager_class->tiled_monitor_added = meta_monitor_manager_test_tiled_monitor_added;
|
||||||
manager_class->tiled_monitor_removed = meta_monitor_manager_test_tiled_monitor_removed;
|
manager_class->tiled_monitor_removed = meta_monitor_manager_test_tiled_monitor_removed;
|
||||||
|
manager_class->is_transform_handled = meta_monitor_manager_test_is_transform_handled;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user