summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2016-09-22 12:35:23 -0400
committerChris Michael <cp.michael@samsung.com>2016-09-22 13:33:57 -0400
commitedb477e39543e871696f8ff033acf27e371c427b (patch)
treed628fd8888273b092060fc1d9b481fd5691973b8
parentf8f8ec0cbfa5492eb5b801997ce8b0490f84bec9 (diff)
ecore-drm2: Add code to support setting DPMS levels via Atomic
Signed-off-by: Chris Michael <cp.michael@samsung.com>
-rw-r--r--src/lib/ecore_drm2/ecore_drm2_outputs.c45
1 files changed, 43 insertions, 2 deletions
diff --git a/src/lib/ecore_drm2/ecore_drm2_outputs.c b/src/lib/ecore_drm2/ecore_drm2_outputs.c
index ebb831988a..b667546657 100644
--- a/src/lib/ecore_drm2/ecore_drm2_outputs.c
+++ b/src/lib/ecore_drm2/ecore_drm2_outputs.c
@@ -408,6 +408,42 @@ _output_dpms_property_get(int fd, const drmModeConnector *conn)
408 return NULL; 408 return NULL;
409} 409}
410 410
411#ifdef HAVE_ATOMIC_DRM
412static Eina_Bool
413_output_dpms_atomic_set(Ecore_Drm2_Output *output, int level)
414{
415 Ecore_Drm2_Crtc_State *cstate;
416 drmModeAtomicReq *req = NULL;
417 Eina_Bool ret = EINA_TRUE;
418
419 req = drmModeAtomicAlloc();
420 if (!req) return EINA_FALSE;
421
422 drmModeAtomicSetCursor(req, 0);
423
424 cstate = output->crtc_state;
425
426 if (drmModeAtomicAddProperty(req, cstate->obj_id,
427 cstate->active.id, level) < 0)
428 {
429 ERR("Failed to add connector property DPMS");
430 ret = EINA_FALSE;
431 goto err;
432 }
433
434 if (drmModeAtomicCommit(output->fd, req, 0, NULL))
435 {
436 ERR("Could not set dpms property: %m");
437 ret = EINA_FALSE;
438 }
439
440err:
441 drmModeAtomicFree(req);
442
443 return ret;
444}
445#endif
446
411static void 447static void
412_output_backlight_init(Ecore_Drm2_Output *output, unsigned int conn_type) 448_output_backlight_init(Ecore_Drm2_Output *output, unsigned int conn_type)
413{ 449{
@@ -976,8 +1012,13 @@ ecore_drm2_output_dpms_set(Ecore_Drm2_Output *output, int level)
976 EINA_SAFETY_ON_NULL_RETURN(output); 1012 EINA_SAFETY_ON_NULL_RETURN(output);
977 EINA_SAFETY_ON_TRUE_RETURN(!output->enabled); 1013 EINA_SAFETY_ON_TRUE_RETURN(!output->enabled);
978 1014
979 drmModeConnectorSetProperty(output->fd, output->conn_id, 1015#ifdef HAVE_ATOMIC_DRM
980 output->dpms->prop_id, level); 1016 if (_ecore_drm2_use_atomic)
1017 _output_dpms_atomic_set(output, level);
1018 else
1019#endif
1020 drmModeConnectorSetProperty(output->fd, output->conn_id,
1021 output->dpms->prop_id, level);
981} 1022}
982 1023
983EAPI char * 1024EAPI char *