summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2016-09-22 12:00:53 -0400
committerChris Michael <cp.michael@samsung.com>2016-09-22 13:33:57 -0400
commitd99e228e6d5b9c4750b04b74482259a6f4ea8178 (patch)
tree7bfdc7e231a25052627ddcca93d196b3794b8f80
parente90722fc22760d5f855057ad65a6710a715b4ad2 (diff)
ecore-drm2: Add code to setup Crtc Atomic state for Outputs
Signed-off-by: Chris Michael <cp.michael@samsung.com>
-rw-r--r--src/lib/ecore_drm2/ecore_drm2_outputs.c41
1 files changed, 40 insertions, 1 deletions
diff --git a/src/lib/ecore_drm2/ecore_drm2_outputs.c b/src/lib/ecore_drm2/ecore_drm2_outputs.c
index 989114749e..d478d03300 100644
--- a/src/lib/ecore_drm2/ecore_drm2_outputs.c
+++ b/src/lib/ecore_drm2/ecore_drm2_outputs.c
@@ -525,6 +525,37 @@ _output_matrix_update(Ecore_Drm2_Output *output)
525 eina_matrix4_inverse(&output->inverse, &output->matrix); 525 eina_matrix4_inverse(&output->inverse, &output->matrix);
526} 526}
527 527
528#ifdef HAVE_ATOMIC_DRM
529static Ecore_Drm2_Crtc_State *
530_atomic_state_crtc_duplicate(Ecore_Drm2_Crtc_State *state)
531{
532 Ecore_Drm2_Crtc_State *cstate;
533
534 cstate = calloc(1, sizeof(Ecore_Drm2_Crtc_State));
535 if (!cstate) return NULL;
536
537 memcpy(cstate, state, sizeof(Ecore_Drm2_Crtc_State));
538
539 return cstate;
540}
541
542static Ecore_Drm2_Crtc_State *
543_output_crtc_state_get(Ecore_Drm2_Atomic_State *state, unsigned int id)
544{
545 Ecore_Drm2_Crtc_State *cstate;
546 int i = 0;
547
548 for (; i < state->crtcs; i++)
549 {
550 cstate = &state->crtc_states[i];
551 if (cstate->obj_id != id) continue;
552 return _atomic_state_crtc_duplicate(cstate);
553 }
554
555 return NULL;
556}
557#endif
558
528static Eina_Bool 559static Eina_Bool
529_output_create(Ecore_Drm2_Device *dev, const drmModeRes *res, const drmModeConnector *conn, int x, int y, int *w, Eina_Bool cloned) 560_output_create(Ecore_Drm2_Device *dev, const drmModeRes *res, const drmModeConnector *conn, int x, int y, int *w, Eina_Bool cloned)
530{ 561{
@@ -588,7 +619,15 @@ _output_create(Ecore_Drm2_Device *dev, const drmModeRes *res, const drmModeConne
588 619
589 output->ocrtc = drmModeGetCrtc(dev->fd, output->crtc_id); 620 output->ocrtc = drmModeGetCrtc(dev->fd, output->crtc_id);
590 621
591 output->dpms = _output_dpms_property_get(dev->fd, conn); 622#ifdef HAVE_ATOMIC_DRM
623 if (_ecore_drm2_use_atomic)
624 {
625 output->crtc_state =
626 _output_crtc_state_get(dev->state, output->crtc_id);
627 }
628 else
629#endif
630 output->dpms = _output_dpms_property_get(dev->fd, conn);
592 631
593 _output_backlight_init(output, conn->connector_type); 632 _output_backlight_init(output, conn->connector_type);
594 633