[mutter/wip/garnacho/wayland-emulated-output-transform: 17/30] backends/native: Split hw supported CRTC rotation modes
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/garnacho/wayland-emulated-output-transform: 17/30] backends/native: Split hw supported CRTC rotation modes
- Date: Mon, 8 Aug 2016 11:21:17 +0000 (UTC)
commit fa819c737a5287e0bf7c1a7d12fe2e14efbf08bb
Author: Carlos Garnacho <carlosg gnome org>
Date: Sun Jul 31 23:41:26 2016 +0200
backends/native: Split hw supported CRTC rotation modes
Those will need a separate treatment from the modes that we eventually
support through "software", so split those into a separate enum so we
can can do the right thing when applying the configuration.
Also, add a helper function that returns the transform that the software
fallbacks should perform, which should be "normal" if the rotation is
already handled via hw.
src/backends/native/meta-monitor-manager-kms.c | 43 +++++++++++++++++++----
src/backends/native/meta-monitor-manager-kms.h | 5 +++
2 files changed, 40 insertions(+), 8 deletions(-)
---
diff --git a/src/backends/native/meta-monitor-manager-kms.c b/src/backends/native/meta-monitor-manager-kms.c
index 04d96aa..2c30bbe 100644
--- a/src/backends/native/meta-monitor-manager-kms.c
+++ b/src/backends/native/meta-monitor-manager-kms.c
@@ -74,6 +74,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
@@ -500,7 +501,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;
}
}
@@ -945,6 +946,15 @@ meta_monitor_manager_kms_read_current (MetaMonitorManager *manager)
}
}
+ /* Coalesce hw/sw supported rotation modes in crtcs */
+ for (i = 0; i < manager->n_crtcs; i++)
+ {
+ MetaCRTC *meta_crtc = &manager->crtcs[i];
+ MetaCRTCKms *crtc_kms = meta_crtc->driver_private;
+
+ meta_crtc->all_transforms |= crtc_kms->all_hw_transforms;
+ }
+
for (i = 0; i < (unsigned)resources->count_encoders; i++)
drmModeFreeEncoder (encoders[i]);
g_free (encoders);
@@ -1066,6 +1076,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 = META_MONITOR_TRANSFORM_NORMAL;
crtc->is_dirty = TRUE;
@@ -1115,14 +1126,15 @@ meta_monitor_manager_kms_apply_configuration (MetaMonitorManager *manager,
crtc->transform = crtc_info->transform;
}
- 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;
+ 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++)
@@ -1498,3 +1510,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 3386b93..53a019e 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 */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]