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 13:33:57 -0400
commite9f041cf2315ea80431bcd1074af8b9d6218f3f0 (patch)
treef1dc9e92bece1b9408b8e4c2c9a7c54123aeaccb
parentd7e013359ef34f726d72ffa084e48b9eab32e7a7 (diff)
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)
583 583
584 return NULL; 584 return NULL;
585} 585}
586
587static Ecore_Drm2_Plane_State *
588_atomic_state_plane_duplicate(Ecore_Drm2_Plane_State *state)
589{
590 Ecore_Drm2_Plane_State *pstate;
591
592 pstate = calloc(1, sizeof(Ecore_Drm2_Plane_State));
593 if (!pstate) return NULL;
594
595 memcpy(pstate, state, sizeof(Ecore_Drm2_Plane_State));
596
597 return pstate;
598}
599
600/* NB: For now, this function will only return primary planes.
601 * We may need to adjust this later to pass in a desired plane type */
602static Ecore_Drm2_Plane_State *
603_output_plane_state_get(Ecore_Drm2_Atomic_State *state, unsigned int id)
604{
605 Ecore_Drm2_Plane_State *pstate;
606 int i = 0;
607
608 for (; i < state->planes; i++)
609 {
610 pstate = &state->plane_states[i];
611 if (pstate->type.value != DRM_PLANE_TYPE_PRIMARY) continue;
612 if (pstate->cid.value != id) continue;
613 return _atomic_state_plane_duplicate(pstate);
614 }
615
616 return NULL;
617}
586#endif 618#endif
587 619
588static Eina_Bool 620static Eina_Bool
@@ -655,6 +687,8 @@ _output_create(Ecore_Drm2_Device *dev, const drmModeRes *res, const drmModeConne
655 _output_crtc_state_get(dev->state, output->crtc_id); 687 _output_crtc_state_get(dev->state, output->crtc_id);
656 output->conn_state = 688 output->conn_state =
657 _output_conn_state_get(dev->state, output->conn_id); 689 _output_conn_state_get(dev->state, output->conn_id);
690 output->plane_state =
691 _output_plane_state_get(dev->state, output->crtc_id);
658 } 692 }
659 else 693 else
660#endif 694#endif