summaryrefslogtreecommitdiff
path: root/src/lib/ecore_drm2/ecore_drm2_device.c
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2017-04-25 10:10:54 -0400
committerDerek Foreman <derekf@osg.samsung.com>2017-05-05 12:53:20 -0500
commitf07f2e6e4eb2b1e487322750ca03efa06943afe3 (patch)
tree18e2c4442d6e1e5cc1c6401da795dad06dcdd301 /src/lib/ecore_drm2/ecore_drm2_device.c
parente1b26f6320b07cd810a2a56ae388890d4c29d838 (diff)
ecore-drm2: Enable filling state structures without atomic support
This commit enables the ability to fill our state structures even if atomic support is not enabled. This will allow us to reuse those state structures for dealing with pageflip in both the atomic & non-atomic use cases. @fix Signed-off-by: Chris Michael <cp.michael@samsung.com>
Diffstat (limited to 'src/lib/ecore_drm2/ecore_drm2_device.c')
-rw-r--r--src/lib/ecore_drm2/ecore_drm2_device.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/src/lib/ecore_drm2/ecore_drm2_device.c b/src/lib/ecore_drm2/ecore_drm2_device.c
index a771091a52..8f26974be9 100644
--- a/src/lib/ecore_drm2/ecore_drm2_device.c
+++ b/src/lib/ecore_drm2/ecore_drm2_device.c
@@ -146,7 +146,6 @@ out:
146} 146}
147 147
148#ifdef HAVE_ATOMIC_DRM 148#ifdef HAVE_ATOMIC_DRM
149
150# if 0 149# if 0
151static Eina_Bool 150static Eina_Bool
152_drm2_atomic_usable(int fd) 151_drm2_atomic_usable(int fd)
@@ -190,6 +189,7 @@ _drm2_atomic_usable(int fd)
190 return ret; 189 return ret;
191} 190}
192# endif 191# endif
192#endif
193 193
194static void 194static void
195_drm2_atomic_state_crtc_fill(Ecore_Drm2_Crtc_State *cstate, int fd) 195_drm2_atomic_state_crtc_fill(Ecore_Drm2_Crtc_State *cstate, int fd)
@@ -567,7 +567,6 @@ _drm2_atomic_state_free(Ecore_Drm2_Atomic_State *state)
567 free(state->crtc_states); 567 free(state->crtc_states);
568 free(state); 568 free(state);
569} 569}
570#endif
571 570
572EAPI Ecore_Drm2_Device * 571EAPI Ecore_Drm2_Device *
573ecore_drm2_device_find(const char *seat, unsigned int tty) 572ecore_drm2_device_find(const char *seat, unsigned int tty)
@@ -623,30 +622,27 @@ ecore_drm2_device_open(Ecore_Drm2_Device *device)
623 _ecore_drm2_use_atomic = _drm2_atomic_usable(device->fd); 622 _ecore_drm2_use_atomic = _drm2_atomic_usable(device->fd);
624 if (_ecore_drm2_use_atomic) 623 if (_ecore_drm2_use_atomic)
625# endif 624# endif
625#endif
626 { 626 {
627 if (sym_drmSetClientCap(device->fd, DRM_CLIENT_CAP_ATOMIC, 1) < 0) 627 if (sym_drmSetClientCap(device->fd,
628 DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1) < 0)
628 { 629 {
629 WRN("Could not enable Atomic Modesetting support"); 630 WRN("Could not enable Universal Plane support");
630 _ecore_drm2_use_atomic = EINA_FALSE; 631 _ecore_drm2_use_atomic = EINA_FALSE;
631 } 632 }
632 else 633 else
633 { 634 {
634 if (sym_drmSetClientCap(device->fd, 635 if (sym_drmSetClientCap(device->fd, DRM_CLIENT_CAP_ATOMIC, 1) < 0)
635 DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1) < 0)
636 { 636 {
637 WRN("Could not enable Universal Plane support"); 637 WRN("Could not enable Atomic Modesetting support");
638 _ecore_drm2_use_atomic = EINA_FALSE; 638 _ecore_drm2_use_atomic = EINA_FALSE;
639 } 639 }
640 else
641 {
642 /* atomic & planes are usable */
643 device->state = calloc(1, sizeof(Ecore_Drm2_Atomic_State));
644 if (device->state)
645 _drm2_atomic_state_fill(device->state, device->fd);
646 }
647 } 640 }
648 } 641 }
649#endif 642
643 device->state = calloc(1, sizeof(Ecore_Drm2_Atomic_State));
644 if (device->state)
645 _drm2_atomic_state_fill(device->state, device->fd);
650 646
651 device->active_hdlr = 647 device->active_hdlr =
652 ecore_event_handler_add(ELPUT_EVENT_SESSION_ACTIVE, 648 ecore_event_handler_add(ELPUT_EVENT_SESSION_ACTIVE,
@@ -679,10 +675,11 @@ ecore_drm2_device_free(Ecore_Drm2_Device *device)
679{ 675{
680 EINA_SAFETY_ON_NULL_RETURN(device); 676 EINA_SAFETY_ON_NULL_RETURN(device);
681 677
678 _drm2_atomic_state_free(device->state);
679
682#ifdef HAVE_ATOMIC_DRM 680#ifdef HAVE_ATOMIC_DRM
683 if (_ecore_drm2_use_atomic) 681 if (_ecore_drm2_use_atomic)
684 { 682 {
685 _drm2_atomic_state_free(device->state);
686 if (device->atomic_req) 683 if (device->atomic_req)
687 sym_drmModeAtomicFree(device->atomic_req); 684 sym_drmModeAtomicFree(device->atomic_req);
688 } 685 }