summaryrefslogtreecommitdiff
path: root/src/backends/native/meta-cursor-renderer-native.c
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2015-12-18 12:16:59 +0100
committerCarlos Garnacho <carlosg@gnome.org>2016-01-07 17:03:44 +0100
commitefef0c993b7e45c1a5d06afffdf302c30ba441a0 (patch)
tree0bf9335fe5f3194a8770d19605fc3dc06c3b4ad7 /src/backends/native/meta-cursor-renderer-native.c
parent3a2cd3389a50b3f7789726e3def865941dbd3774 (diff)
downloadmutter-efef0c993b7e45c1a5d06afffdf302c30ba441a0.tar.gz
native: Implement DRM-based crtc rotation
We can know the rotation modes supported by the driver, so export these as our supported modes, and ensure these modes are honored on the CRTC primary plane upon apply_configuration(). It is worth noting however that not all hardware will be capable of supporting all rotation modes (in fact, most of them won't). A driver independent solution should be in place to back up the rotation modes unsupported by the drivers, so this is still a partial solution. The cursor renderer has also been changed to default to software-based rendering anytime the cursor enters a rotated CRTC. Another solution would be actually rotating the DRM cursor planes, but then it requires applying rotation on these per-CRTC, and actually transforming the pointer position by the output matrix. This brings marginal gains, so we use the "sw" rendered cursor, which will be transformed together with the primary plane. https://bugzilla.gnome.org/show_bug.cgi?id=745079
Diffstat (limited to 'src/backends/native/meta-cursor-renderer-native.c')
-rw-r--r--src/backends/native/meta-cursor-renderer-native.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/backends/native/meta-cursor-renderer-native.c b/src/backends/native/meta-cursor-renderer-native.c
index 588683b6d..444154cce 100644
--- a/src/backends/native/meta-cursor-renderer-native.c
+++ b/src/backends/native/meta-cursor-renderer-native.c
@@ -274,6 +274,32 @@ has_valid_cursor_sprite_gbm_bo (MetaCursorSprite *cursor_sprite)
}
static gboolean
+cursor_over_transformed_crtc (MetaCursorRenderer *renderer,
+ MetaCursorSprite *cursor_sprite)
+{
+ MetaMonitorManager *monitors;
+ MetaCRTC *crtcs;
+ unsigned int i, n_crtcs;
+ MetaRectangle rect;
+
+ monitors = meta_monitor_manager_get ();
+ meta_monitor_manager_get_resources (monitors, NULL, NULL,
+ &crtcs, &n_crtcs, NULL, NULL);
+ rect = meta_cursor_renderer_calculate_rect (renderer, cursor_sprite);
+
+ for (i = 0; i < n_crtcs; i++)
+ {
+ if (!meta_rectangle_overlap (&rect, &crtcs[i].rect))
+ continue;
+
+ if (crtcs[i].transform != META_MONITOR_TRANSFORM_NORMAL)
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static gboolean
should_have_hw_cursor (MetaCursorRenderer *renderer,
MetaCursorSprite *cursor_sprite)
{
@@ -282,6 +308,9 @@ should_have_hw_cursor (MetaCursorRenderer *renderer,
if (!cursor_sprite)
return FALSE;
+ if (cursor_over_transformed_crtc (renderer, cursor_sprite))
+ return FALSE;
+
texture = meta_cursor_sprite_get_cogl_texture (cursor_sprite);
if (!texture)
return FALSE;