mirror of
https://github.com/brl/mutter.git
synced 2024-12-22 11:02:05 +00:00
cursor-renderer/native: Use MetaCrtcNative API to check capabilities
The cursor renderer shouldn't assume all the CRTCs of a logical are KMS CRTC's, as we'll end up checking hardware capabilities for CRTC's of virtual monitors as well, when they were created to not embed the cursor image directly in the framebuffer. Instead, use the newly introduced API for checking CRTC cursor capabilities. This fixes a crash with the following backtrace: 0) get_plane_with_type_for at ../src/backends/native/meta-kms-device.c:150 1) meta_kms_device_get_cursor_plane_for at ../src/backends/native/meta-kms-device.c:173 2) has_cursor_plane at ../src/backends/native/meta-cursor-renderer-native.c:678 3) foreach_crtc at ../src/backends/meta-logical-monitor.c:247 4) meta_monitor_mode_foreach_crtc at ../src/backends/meta-monitor.c:1920 5) meta_logical_monitor_foreach_crtc at ../src/backends/meta-logical-monitor.c:274 6) crtcs_has_cursor_planes at ../src/backends/native/meta-cursor-renderer-native.c:718 7) should_have_hw_cursor at ../src/backends/native/meta-cursor-renderer-native.c:881 8) meta_cursor_renderer_native_update_cursor at ../src/backends/native/meta-cursor-renderer-native.c:1085 9) meta_cursor_renderer_update_cursor at ../src/backends/meta-cursor-renderer.c:411 Related: https://bugzilla.redhat.com/show_bug.cgi?id=2000183 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1991>
This commit is contained in:
parent
e82685d049
commit
00c329a2e5
@ -666,24 +666,21 @@ get_current_relative_transform (MetaCursorSprite *cursor_sprite)
|
||||
}
|
||||
|
||||
static void
|
||||
has_cursor_plane (MetaLogicalMonitor *logical_monitor,
|
||||
MetaMonitor *monitor,
|
||||
MetaOutput *output,
|
||||
MetaCrtc *crtc,
|
||||
gpointer user_data)
|
||||
crtc_supports_hw_cursor (MetaLogicalMonitor *logical_monitor,
|
||||
MetaMonitor *monitor,
|
||||
MetaOutput *output,
|
||||
MetaCrtc *crtc,
|
||||
gpointer user_data)
|
||||
{
|
||||
gboolean *has_cursor_planes = user_data;
|
||||
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);
|
||||
gboolean *supports_hw_cursor = user_data;
|
||||
MetaCrtcNative *crtc_native = META_CRTC_NATIVE (crtc);
|
||||
|
||||
*has_cursor_planes &= !!meta_kms_device_get_cursor_plane_for (kms_device,
|
||||
kms_crtc);
|
||||
*supports_hw_cursor &= meta_crtc_native_is_hw_cursor_supported (crtc_native);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
crtcs_has_cursor_planes (MetaCursorRenderer *renderer,
|
||||
MetaCursorSprite *cursor_sprite)
|
||||
crtcs_supports_hw_cursor (MetaCursorRenderer *renderer,
|
||||
MetaCursorSprite *cursor_sprite)
|
||||
{
|
||||
MetaCursorRendererNative *cursor_renderer_native =
|
||||
META_CURSOR_RENDERER_NATIVE (renderer);
|
||||
@ -705,7 +702,7 @@ crtcs_has_cursor_planes (MetaCursorRenderer *renderer,
|
||||
MetaLogicalMonitor *logical_monitor = l->data;
|
||||
MetaRectangle logical_monitor_layout;
|
||||
graphene_rect_t logical_monitor_rect;
|
||||
gboolean has_cursor_planes;
|
||||
gboolean supports_hw_cursor;
|
||||
|
||||
logical_monitor_layout =
|
||||
meta_logical_monitor_get_layout (logical_monitor);
|
||||
@ -716,11 +713,11 @@ crtcs_has_cursor_planes (MetaCursorRenderer *renderer,
|
||||
NULL))
|
||||
continue;
|
||||
|
||||
has_cursor_planes = TRUE;
|
||||
supports_hw_cursor = TRUE;
|
||||
meta_logical_monitor_foreach_crtc (logical_monitor,
|
||||
has_cursor_plane,
|
||||
&has_cursor_planes);
|
||||
if (!has_cursor_planes)
|
||||
crtc_supports_hw_cursor,
|
||||
&supports_hw_cursor);
|
||||
if (!supports_hw_cursor)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -880,7 +877,7 @@ should_have_hw_cursor (MetaCursorRenderer *renderer,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!crtcs_has_cursor_planes (renderer, cursor_sprite))
|
||||
if (!crtcs_supports_hw_cursor (renderer, cursor_sprite))
|
||||
return FALSE;
|
||||
|
||||
texture = meta_cursor_sprite_get_cogl_texture (cursor_sprite);
|
||||
|
Loading…
Reference in New Issue
Block a user