diff --git a/src/backends/native/meta-monitor-manager-kms.c b/src/backends/native/meta-monitor-manager-kms.c index 1de6484ed..947b65e37 100644 --- a/src/backends/native/meta-monitor-manager-kms.c +++ b/src/backends/native/meta-monitor-manager-kms.c @@ -77,6 +77,7 @@ typedef struct { uint32_t primary_plane_id; uint32_t rotation_prop_id; uint32_t rotation_map[ALL_TRANSFORMS]; + uint32_t all_hw_transforms; } MetaCRTCKms; typedef struct @@ -530,7 +531,7 @@ parse_transforms (MetaMonitorManager *manager, if (cur != -1) { - crtc->all_transforms |= 1 << cur; + crtc_kms->all_hw_transforms |= 1 << cur; crtc_kms->rotation_map[cur] = 1 << prop->enums[i].value; } } @@ -606,6 +607,8 @@ init_crtc_rotations (MetaMonitorManager *manager, drmModeFreePlane (drm_plane); } + crtc->all_transforms |= crtc_kms->all_hw_transforms; + drmModeFreePlaneResources (planes); } @@ -1184,6 +1187,7 @@ meta_monitor_manager_kms_apply_configuration (MetaMonitorManager *manager, MetaCRTCInfo *crtc_info = crtcs[i]; MetaCRTC *crtc = crtc_info->crtc; MetaCRTCKms *crtc_kms = crtc->driver_private; + MetaMonitorTransform hw_transform; crtc->is_dirty = TRUE; @@ -1234,14 +1238,17 @@ meta_monitor_manager_kms_apply_configuration (MetaMonitorManager *manager, } } - if (crtc->all_transforms & (1 << crtc->transform)) - drmModeObjectSetProperty (manager_kms->fd, - crtc_kms->primary_plane_id, - DRM_MODE_OBJECT_PLANE, - crtc_kms->rotation_prop_id, - crtc_kms->rotation_map[crtc->transform]); - } + if (crtc_kms->all_hw_transforms & (1 << crtc->transform)) + hw_transform = crtc->transform; + else + hw_transform = META_MONITOR_TRANSFORM_NORMAL; + drmModeObjectSetProperty (manager_kms->fd, + crtc_kms->primary_plane_id, + DRM_MODE_OBJECT_PLANE, + crtc_kms->rotation_prop_id, + crtc_kms->rotation_map[hw_transform]); + } /* Disable CRTCs not mentioned in the list (they have is_dirty == FALSE, because they weren't seen in the first loop) */ for (i = 0; i < manager->n_crtcs; i++) @@ -1617,3 +1624,18 @@ meta_monitor_manager_kms_class_init (MetaMonitorManagerKmsClass *klass) manager_class->set_crtc_gamma = meta_monitor_manager_kms_set_crtc_gamma; } +MetaMonitorTransform +meta_monitor_manager_kms_get_view_transform (MetaMonitorManagerKms *manager, + MetaCRTC *crtc) +{ + MetaCRTCKms *crtc_kms; + + crtc_kms = crtc->driver_private; + if ((1 << crtc->transform) & crtc_kms->all_hw_transforms) + { + /* Transform is managed by the hardware, the view is untransformed */ + return META_MONITOR_TRANSFORM_NORMAL; + } + + return crtc->transform; +} diff --git a/src/backends/native/meta-monitor-manager-kms.h b/src/backends/native/meta-monitor-manager-kms.h index 3386b932e..53a019ea5 100644 --- a/src/backends/native/meta-monitor-manager-kms.h +++ b/src/backends/native/meta-monitor-manager-kms.h @@ -57,4 +57,9 @@ gboolean meta_monitor_manager_kms_flip_crtc (MetaMonitorManagerKms *manager_kms, void meta_monitor_manager_kms_wait_for_flip (MetaMonitorManagerKms *manager_kms); +MetaMonitorTransform +meta_monitor_manager_kms_get_view_transform (MetaMonitorManagerKms *manager, + MetaCRTC *crtc); + + #endif /* META_MONITOR_MANAGER_KMS_H */