[mutter/wip/garnacho/wayland-emulated-output-transform: 7/13] backends/native: Set transform on MetaRendererViews



commit 1efe2e90801ff4528ebab257394104cfbe738b38
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Aug 1 03:38:03 2016 +0200

    backends/native: Set transform on MetaRendererViews
    
    This is uneffective at the moment because no back texture is set yet.

 src/backends/native/meta-renderer-native.c |   42 ++++++++++++++++++++++++++++
 1 files changed, 42 insertions(+), 0 deletions(-)
---
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
index 895f850..8d418b4 100644
--- a/src/backends/native/meta-renderer-native.c
+++ b/src/backends/native/meta-renderer-native.c
@@ -837,6 +837,41 @@ meta_renderer_native_queue_modes_reset (MetaRendererNative *renderer_native)
     }
 }
 
+static MetaMonitorTransform
+meta_renderer_native_get_legacy_transform (MetaRendererNative *renderer_native)
+{
+  MetaBackend *backend = meta_get_backend ();
+  MetaMonitorManager *monitor_manager =
+    meta_backend_get_monitor_manager (backend);
+  MetaMonitorManagerKms *monitor_manager_kms =
+    META_MONITOR_MANAGER_KMS (monitor_manager);
+
+  /* Only allow rotation in the legacy case if there is one output */
+  if (monitor_manager->n_outputs == 1)
+    return meta_monitor_manager_kms_get_view_transform (monitor_manager_kms,
+                                                        monitor_manager->outputs[0].crtc);
+
+  return META_MONITOR_TRANSFORM_NORMAL;
+}
+
+static MetaMonitorTransform
+meta_renderer_native_get_monitor_info_transform (MetaRenderer    *renderer,
+                                                 MetaMonitorInfo *monitor_info)
+{
+  MetaBackend *backend = meta_get_backend ();
+  MetaMonitorManager *monitor_manager =
+    meta_backend_get_monitor_manager (backend);
+  MetaMonitorManagerKms *monitor_manager_kms =
+    META_MONITOR_MANAGER_KMS (monitor_manager);
+
+  /* The monitor info has no outputs, what to do? */
+  if (monitor_info->n_outputs == 0)
+    return META_MONITOR_TRANSFORM_NORMAL;
+
+  return meta_monitor_manager_kms_get_view_transform (monitor_manager_kms,
+                                                      monitor_info->outputs[0]->crtc);
+}
+
 gboolean
 meta_renderer_native_set_legacy_view_size (MetaRendererNative *renderer_native,
                                            MetaRendererView   *view,
@@ -1000,12 +1035,14 @@ meta_renderer_native_create_legacy_view (MetaRendererNative *renderer_native)
   ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
   CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend);
   cairo_rectangle_int_t view_layout = { 0 };
+  MetaMonitorTransform transform;
   MetaRendererView *view;
   GError *error = NULL;
 
   if (!monitor_manager)
     return NULL;
 
+  transform = meta_renderer_native_get_legacy_transform (renderer_native);
   meta_monitor_manager_get_screen_size (monitor_manager,
                                         &view_layout.width,
                                         &view_layout.height);
@@ -1024,6 +1061,7 @@ meta_renderer_native_create_legacy_view (MetaRendererNative *renderer_native)
   view = g_object_new (META_TYPE_RENDERER_VIEW,
                        "layout", &view_layout,
                        "framebuffer", framebuffer,
+                       "transform", transform,
                        NULL);
   cogl_object_unref (framebuffer);
 
@@ -1039,11 +1077,14 @@ meta_renderer_native_create_view (MetaRenderer    *renderer,
   MetaBackend *backend = meta_get_backend ();
   ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
   CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend);
+  MetaMonitorTransform transform;
   CoglOnscreen *onscreen;
   CoglFramebuffer *framebuffer;
   MetaRendererView *view;
   GError *error = NULL;
 
+  transform = meta_renderer_native_get_monitor_info_transform (renderer,
+                                                               monitor_info);
   onscreen = cogl_onscreen_new (cogl_context,
                                 monitor_info->rect.width,
                                 monitor_info->rect.height);
@@ -1059,6 +1100,7 @@ meta_renderer_native_create_view (MetaRenderer    *renderer,
                        "layout", &monitor_info->rect,
                        "framebuffer", framebuffer,
                        "monitor-info", monitor_info,
+                       "transform", transform,
                        NULL);
   cogl_object_unref (framebuffer);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]