[mutter] cursor-renderer/native: Skip hw cursor upload if we can't use it
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] cursor-renderer/native: Skip hw cursor upload if we can't use it
- Date: Mon, 16 Mar 2020 21:07:01 +0000 (UTC)
commit 4133b736321adf8559f1ac80e7e5b9b55dd4f187
Author: Robert Mader <robert mader posteo de>
Date: Sat Mar 14 15:52:38 2020 +0100
cursor-renderer/native: Skip hw cursor upload if we can't use it
If the CRTCs the cursor is visible on do not share a common scale
and transform, we can't use the cursor hardware plane as we only have one.
We therefore fall back to software / gl cursor.
The check for that currently happens after we tried to upload the cursor image
to the hardware plane though.
This is made worse by the fact that in the scaling step, where we scale the
cursor image to the desired size, until now we expected a valid common scale -
otherwise scaling the image by an uninitialized float.
Make sure we bail out early during the scale/upload step if we don't have common
scales and transforms - to avoid that bug and save some unnecessary work.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1125
src/backends/native/meta-cursor-renderer-native.c | 56 +++++++++++++++--------
1 file changed, 36 insertions(+), 20 deletions(-)
---
diff --git a/src/backends/native/meta-cursor-renderer-native.c
b/src/backends/native/meta-cursor-renderer-native.c
index b400a8740..cda4262d3 100644
--- a/src/backends/native/meta-cursor-renderer-native.c
+++ b/src/backends/native/meta-cursor-renderer-native.c
@@ -1393,6 +1393,26 @@ realize_cursor_sprite_from_wl_buffer_for_gpu (MetaCursorRenderer *renderer,
MetaMonitorTransform relative_transform;
uint32_t gbm_format;
+ if (!get_common_crtc_sprite_scale_for_logical_monitors (renderer,
+ cursor_sprite,
+ &relative_scale))
+ {
+ unset_can_preprocess (cursor_sprite);
+ return;
+ }
+
+ if (!get_common_crtc_sprite_transform_for_logical_monitors (renderer,
+ cursor_sprite,
+ &relative_transform))
+ {
+ unset_can_preprocess (cursor_sprite);
+ return;
+ }
+
+ set_can_preprocess (cursor_sprite,
+ relative_scale,
+ relative_transform);
+
wl_shm_buffer_begin_access (shm_buffer);
buffer_data = wl_shm_buffer_get_data (shm_buffer);
@@ -1412,18 +1432,6 @@ realize_cursor_sprite_from_wl_buffer_for_gpu (MetaCursorRenderer *renderer,
gbm_format = GBM_FORMAT_ARGB8888;
}
- get_common_crtc_sprite_scale_for_logical_monitors (renderer,
- cursor_sprite,
- &relative_scale);
-
- get_common_crtc_sprite_transform_for_logical_monitors (renderer,
- cursor_sprite,
- &relative_transform);
-
- set_can_preprocess (cursor_sprite,
- relative_scale,
- relative_transform);
-
load_scaled_and_transformed_cursor_sprite (native,
gpu_kms,
cursor_sprite,
@@ -1502,20 +1510,28 @@ realize_cursor_sprite_from_xcursor_for_gpu (MetaCursorRenderer *renderer,
is_cursor_scale_and_transform_valid (renderer, cursor_sprite))
return;
- xc_image = meta_cursor_sprite_xcursor_get_current_image (sprite_xcursor);
-
- get_common_crtc_sprite_scale_for_logical_monitors (renderer,
- cursor_sprite,
- &relative_scale);
+ if (!get_common_crtc_sprite_scale_for_logical_monitors (renderer,
+ cursor_sprite,
+ &relative_scale))
+ {
+ unset_can_preprocess (cursor_sprite);
+ return;
+ }
- get_common_crtc_sprite_transform_for_logical_monitors (renderer,
- cursor_sprite,
- &relative_transform);
+ if (!get_common_crtc_sprite_transform_for_logical_monitors (renderer,
+ cursor_sprite,
+ &relative_transform))
+ {
+ unset_can_preprocess (cursor_sprite);
+ return;
+ }
set_can_preprocess (cursor_sprite,
relative_scale,
relative_transform);
+ xc_image = meta_cursor_sprite_xcursor_get_current_image (sprite_xcursor);
+
load_scaled_and_transformed_cursor_sprite (native,
gpu_kms,
cursor_sprite,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]