summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2016-09-22 12:13:18 -0400
committerChris Michael <cp.michael@samsung.com>2016-09-22 14:20:24 -0400
commit2bda2273043ba3554f9d554bf99f13ceb9dc6c66 (patch)
treeaa605a0f1f1801859774fb02fafb0f0aabbf84d2
parenta76eae227a534b8bb98ace2402f7e17f03ad930e (diff)
downloadefl-2bda2273043ba3554f9d554bf99f13ceb9dc6c66.tar.gz
ecore-drm2: Add code to setup Plane Atomic state for Outputs
Signed-off-by: Chris Michael <cp.michael@samsung.com>
-rw-r--r--src/lib/ecore_drm2/ecore_drm2_outputs.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/lib/ecore_drm2/ecore_drm2_outputs.c b/src/lib/ecore_drm2/ecore_drm2_outputs.c
index 99b268b55a..28d0400086 100644
--- a/src/lib/ecore_drm2/ecore_drm2_outputs.c
+++ b/src/lib/ecore_drm2/ecore_drm2_outputs.c
@@ -583,6 +583,38 @@ _output_conn_state_get(Ecore_Drm2_Atomic_State *state, unsigned int id)
return NULL;
}
+
+static Ecore_Drm2_Plane_State *
+_atomic_state_plane_duplicate(Ecore_Drm2_Plane_State *state)
+{
+ Ecore_Drm2_Plane_State *pstate;
+
+ pstate = calloc(1, sizeof(Ecore_Drm2_Plane_State));
+ if (!pstate) return NULL;
+
+ memcpy(pstate, state, sizeof(Ecore_Drm2_Plane_State));
+
+ return pstate;
+}
+
+/* NB: For now, this function will only return primary planes.
+ * We may need to adjust this later to pass in a desired plane type */
+static Ecore_Drm2_Plane_State *
+_output_plane_state_get(Ecore_Drm2_Atomic_State *state, unsigned int id)
+{
+ Ecore_Drm2_Plane_State *pstate;
+ int i = 0;
+
+ for (; i < state->planes; i++)
+ {
+ pstate = &state->plane_states[i];
+ if (pstate->type.value != DRM_PLANE_TYPE_PRIMARY) continue;
+ if (pstate->cid.value != id) continue;
+ return _atomic_state_plane_duplicate(pstate);
+ }
+
+ return NULL;
+}
#endif
static Eina_Bool
@@ -655,6 +687,8 @@ _output_create(Ecore_Drm2_Device *dev, const drmModeRes *res, const drmModeConne
_output_crtc_state_get(dev->state, output->crtc_id);
output->conn_state =
_output_conn_state_get(dev->state, output->conn_id);
+ output->plane_state =
+ _output_plane_state_get(dev->state, output->crtc_id);
}
else
#endif