diff --git a/src/backends/meta-crtc.h b/src/backends/meta-crtc.h index 0d12c5161..d9a47dc89 100644 --- a/src/backends/meta-crtc.h +++ b/src/backends/meta-crtc.h @@ -70,9 +70,6 @@ struct _MetaCrtc /* Used when changing configuration */ gboolean is_dirty; - /* Used by cursor renderer backend */ - void *cursor_renderer_private; - gpointer driver_private; GDestroyNotify driver_notify; }; diff --git a/src/backends/native/meta-crtc-kms.c b/src/backends/native/meta-crtc-kms.c index 2d570b2de..3bff4e2b5 100644 --- a/src/backends/native/meta-crtc-kms.c +++ b/src/backends/native/meta-crtc-kms.c @@ -39,10 +39,29 @@ typedef struct _MetaCrtcKms MetaKmsCrtc *kms_crtc; MetaKmsPlane *primary_plane; + + gpointer cursor_renderer_private; } MetaCrtcKms; static GQuark kms_crtc_crtc_kms_quark; +gpointer +meta_crtc_kms_get_cursor_renderer_private (MetaCrtc *crtc) +{ + MetaCrtcKms *crtc_kms = crtc->driver_private; + + return crtc_kms->cursor_renderer_private; +} + +void +meta_crtc_kms_set_cursor_renderer_private (MetaCrtc *crtc, + gpointer cursor_renderer_private) +{ + MetaCrtcKms *crtc_kms = crtc->driver_private; + + crtc_kms->cursor_renderer_private = cursor_renderer_private; +} + gboolean meta_crtc_kms_is_transform_handled (MetaCrtc *crtc, MetaMonitorTransform transform) diff --git a/src/backends/native/meta-crtc-kms.h b/src/backends/native/meta-crtc-kms.h index 898622478..470763567 100644 --- a/src/backends/native/meta-crtc-kms.h +++ b/src/backends/native/meta-crtc-kms.h @@ -31,6 +31,11 @@ #include "backends/native/meta-gpu-kms.h" #include "backends/native/meta-kms-crtc.h" +gpointer meta_crtc_kms_get_cursor_renderer_private (MetaCrtc *crtc); + +void meta_crtc_kms_set_cursor_renderer_private (MetaCrtc *crtc, + gpointer cursor_renderer_private); + gboolean meta_crtc_kms_is_transform_handled (MetaCrtc *crtc, MetaMonitorTransform transform); diff --git a/src/backends/native/meta-cursor-renderer-native.c b/src/backends/native/meta-cursor-renderer-native.c index 8875ce15f..34376b7ed 100644 --- a/src/backends/native/meta-cursor-renderer-native.c +++ b/src/backends/native/meta-cursor-renderer-native.c @@ -272,6 +272,7 @@ set_crtc_cursor (MetaCursorRendererNative *native, int cursor_width, cursor_height; MetaFixed16Rectangle src_rect; MetaFixed16Rectangle dst_rect; + struct gbm_bo *crtc_bo; MetaKmsAssignPlaneFlag flags; int cursor_hotspot_x; int cursor_hotspot_y; @@ -305,7 +306,8 @@ set_crtc_cursor (MetaCursorRendererNative *native, }; flags = META_KMS_ASSIGN_PLANE_FLAG_NONE; - if (!priv->hw_state_invalidated && bo == crtc->cursor_renderer_private) + crtc_bo = meta_crtc_kms_get_cursor_renderer_private (crtc); + if (!priv->hw_state_invalidated && bo == crtc_bo) flags |= META_KMS_ASSIGN_PLANE_FLAG_FB_UNCHANGED; plane_assignment = meta_kms_update_assign_plane (kms_update, @@ -323,7 +325,7 @@ set_crtc_cursor (MetaCursorRendererNative *native, cursor_hotspot_x, cursor_hotspot_y); - crtc->cursor_renderer_private = bo; + meta_crtc_kms_set_cursor_renderer_private (crtc, bo); if (cursor_gpu_state->pending_bo_state == META_CURSOR_GBM_BO_STATE_SET) { @@ -343,8 +345,10 @@ unset_crtc_cursor (MetaCursorRendererNative *native, MetaKmsCrtc *kms_crtc; MetaKmsDevice *kms_device; MetaKmsPlane *cursor_plane; + struct gbm_bo *crtc_bo; - if (!priv->hw_state_invalidated && !crtc->cursor_renderer_private) + crtc_bo = meta_crtc_kms_get_cursor_renderer_private (crtc); + if (!priv->hw_state_invalidated && !crtc_bo) return; kms_crtc = meta_crtc_kms_get_kms_crtc (crtc); @@ -354,7 +358,7 @@ unset_crtc_cursor (MetaCursorRendererNative *native, if (cursor_plane) meta_kms_update_unassign_plane (kms_update, kms_crtc, cursor_plane); - crtc->cursor_renderer_private = NULL; + meta_crtc_kms_set_cursor_renderer_private (crtc, NULL); } static float @@ -1050,9 +1054,11 @@ unset_crtc_cursor_renderer_privates (MetaGpu *gpu, for (l = meta_gpu_get_crtcs (gpu); l; l = l->next) { MetaCrtc *crtc = l->data; + struct gbm_bo *crtc_bo; - if (bo == crtc->cursor_renderer_private) - crtc->cursor_renderer_private = NULL; + crtc_bo = meta_crtc_kms_get_cursor_renderer_private (crtc); + if (bo == crtc_bo) + meta_crtc_kms_set_cursor_renderer_private (crtc, NULL); } }