summaryrefslogtreecommitdiff
path: root/src/lib/ecore_drm
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2015-05-13 10:19:32 -0400
committerChris Michael <cp.michael@samsung.com>2015-05-13 14:42:03 -0400
commit3aaa9f2f9f2c998207eb3ad13876d70532e6bd0c (patch)
tree846d14e4e1218de75d7d3bf6ad53e5060a950a9f /src/lib/ecore_drm
parent957a89168ba327c7c754af45894b9345a971561d (diff)
ecore-drm: Fix purpose of ecore_drm_output_enable/disable functions
Summary: These API functions should be used for enable/disable of a given output. They were previously being misused to stop/start rendering on an output when we VT switch away so now we add an internal function we can call to disable/enable rendering. @fix Signed-off-by: Chris Michael <cp.michael@samsung.com>
Diffstat (limited to 'src/lib/ecore_drm')
-rw-r--r--src/lib/ecore_drm/Ecore_Drm.h4
-rw-r--r--src/lib/ecore_drm/ecore_drm_logind.c4
-rw-r--r--src/lib/ecore_drm/ecore_drm_output.c88
-rw-r--r--src/lib/ecore_drm/ecore_drm_private.h2
4 files changed, 60 insertions, 38 deletions
diff --git a/src/lib/ecore_drm/Ecore_Drm.h b/src/lib/ecore_drm/Ecore_Drm.h
index 0a8b7d4665..b26efa1ede 100644
--- a/src/lib/ecore_drm/Ecore_Drm.h
+++ b/src/lib/ecore_drm/Ecore_Drm.h
@@ -482,7 +482,7 @@ EAPI void ecore_drm_output_cursor_size_set(Ecore_Drm_Output *output, int handle,
482/** 482/**
483 * Enable a Ecore_Drm_Output 483 * Enable a Ecore_Drm_Output
484 * 484 *
485 * This function will enable rendering on an Ecore_Drm_Output 485 * This function will enable an Ecore_Drm_Output
486 * 486 *
487 * @param output The Ecore_Drm_Output to enable 487 * @param output The Ecore_Drm_Output to enable
488 * 488 *
@@ -494,7 +494,7 @@ EAPI Eina_Bool ecore_drm_output_enable(Ecore_Drm_Output *output);
494/** 494/**
495 * Disable a Ecore_Drm_Output 495 * Disable a Ecore_Drm_Output
496 * 496 *
497 * This function will disable rendering on an Ecore_Drm_Output 497 * This function will disable an Ecore_Drm_Output
498 * 498 *
499 * @param output The Ecore_Drm_Output to disable 499 * @param output The Ecore_Drm_Output to disable
500 * 500 *
diff --git a/src/lib/ecore_drm/ecore_drm_logind.c b/src/lib/ecore_drm/ecore_drm_logind.c
index 3fd0f20593..1b64d0ae23 100644
--- a/src/lib/ecore_drm/ecore_drm_logind.c
+++ b/src/lib/ecore_drm/ecore_drm_logind.c
@@ -150,7 +150,7 @@ _ecore_drm_logind_cb_activate(void *data, int type EINA_UNUSED, void *event)
150 { 150 {
151 /* set output mode */ 151 /* set output mode */
152 EINA_LIST_FOREACH(dev->outputs, l, output) 152 EINA_LIST_FOREACH(dev->outputs, l, output)
153 ecore_drm_output_enable(output); 153 _ecore_drm_output_render_enable(output);
154 154
155 /* enable inputs */ 155 /* enable inputs */
156 EINA_LIST_FOREACH(dev->inputs, l, input) 156 EINA_LIST_FOREACH(dev->inputs, l, input)
@@ -166,7 +166,7 @@ _ecore_drm_logind_cb_activate(void *data, int type EINA_UNUSED, void *event)
166 166
167 /* disable hardware cursor */ 167 /* disable hardware cursor */
168 EINA_LIST_FOREACH(dev->outputs, l, output) 168 EINA_LIST_FOREACH(dev->outputs, l, output)
169 ecore_drm_output_disable(output); 169 _ecore_drm_output_render_disable(output);
170 170
171 /* disable sprites */ 171 /* disable sprites */
172 EINA_LIST_FOREACH(dev->sprites, l, sprite) 172 EINA_LIST_FOREACH(dev->sprites, l, sprite)
diff --git a/src/lib/ecore_drm/ecore_drm_output.c b/src/lib/ecore_drm/ecore_drm_output.c
index 5af5bf4241..e893ce9417 100644
--- a/src/lib/ecore_drm/ecore_drm_output.c
+++ b/src/lib/ecore_drm/ecore_drm_output.c
@@ -717,6 +717,57 @@ next:
717 } 717 }
718} 718}
719 719
720void
721_ecore_drm_output_render_enable(Ecore_Drm_Output *output)
722{
723 Ecore_Drm_Device *dev;
724 Ecore_Drm_Output_Mode *mode;
725 /* int x = 0, y = 0; */
726
727 EINA_SAFETY_ON_NULL_RETURN(output);
728 EINA_SAFETY_ON_NULL_RETURN(output->dev);
729 EINA_SAFETY_ON_NULL_RETURN(output->current_mode);
730
731 if (!output->enabled) return;
732
733 dev = output->dev;
734
735 if (!dev->current)
736 {
737 /* schedule repaint */
738 /* NB: this will trigger a redraw at next idle */
739 output->need_repaint = EINA_TRUE;
740 return;
741 }
742
743 ecore_drm_output_dpms_set(output, DRM_MODE_DPMS_ON);
744
745 /* if (!output->cloned) */
746 /* { */
747 /* x = output->x; */
748 /* y = output->y; */
749 /* } */
750
751 mode = output->current_mode;
752 if (drmModeSetCrtc(dev->drm.fd, output->crtc_id, dev->current->id,
753 output->x, output->y,
754 &output->conn_id, 1, &mode->info) < 0)
755 {
756 ERR("Failed to set Mode %dx%d for Output %s: %m",
757 mode->width, mode->height, output->name);
758 }
759}
760
761void
762_ecore_drm_output_render_disable(Ecore_Drm_Output *output)
763{
764 EINA_SAFETY_ON_NULL_RETURN(output);
765
766 output->need_repaint = EINA_FALSE;
767 ecore_drm_output_cursor_size_set(output, 0, 0, 0);
768 ecore_drm_output_dpms_set(output, DRM_MODE_DPMS_OFF);
769}
770
720static void 771static void
721_ecore_drm_output_planes_get(Ecore_Drm_Device *dev) 772_ecore_drm_output_planes_get(Ecore_Drm_Device *dev)
722{ 773{
@@ -907,41 +958,11 @@ ecore_drm_output_cursor_size_set(Ecore_Drm_Output *output, int handle, int w, in
907EAPI Eina_Bool 958EAPI Eina_Bool
908ecore_drm_output_enable(Ecore_Drm_Output *output) 959ecore_drm_output_enable(Ecore_Drm_Output *output)
909{ 960{
910 Ecore_Drm_Device *dev;
911 Ecore_Drm_Output_Mode *mode;
912 int x = 0, y = 0;
913
914 EINA_SAFETY_ON_NULL_RETURN_VAL(output, EINA_FALSE); 961 EINA_SAFETY_ON_NULL_RETURN_VAL(output, EINA_FALSE);
915 EINA_SAFETY_ON_NULL_RETURN_VAL(output->dev, EINA_FALSE);
916 EINA_SAFETY_ON_NULL_RETURN_VAL(output->current_mode, EINA_FALSE);
917 962
918 dev = output->dev; 963 if (output->enabled) return EINA_TRUE;
919 964
920 output->enabled = EINA_TRUE; 965 output->enabled = EINA_TRUE;
921 if (!dev->current)
922 {
923 /* schedule repaint */
924 /* NB: this will trigger a redraw at next idle */
925 output->need_repaint = EINA_TRUE;
926 return EINA_TRUE;
927 }
928
929 ecore_drm_output_dpms_set(output, DRM_MODE_DPMS_ON);
930
931 if (!output->cloned)
932 {
933 x = output->x;
934 y = output->y;
935 }
936
937 mode = output->current_mode;
938 if (drmModeSetCrtc(dev->drm.fd, output->crtc_id, dev->current->id, x, y,
939 &output->conn_id, 1, &mode->info) < 0)
940 {
941 ERR("Failed to set Mode %dx%d for Output %s: %m",
942 mode->width, mode->height, output->name);
943 return EINA_FALSE;
944 }
945 966
946 return EINA_TRUE; 967 return EINA_TRUE;
947} 968}
@@ -951,10 +972,9 @@ ecore_drm_output_disable(Ecore_Drm_Output *output)
951{ 972{
952 EINA_SAFETY_ON_NULL_RETURN(output); 973 EINA_SAFETY_ON_NULL_RETURN(output);
953 974
975 if (!output->enabled) return;
976
954 output->enabled = EINA_FALSE; 977 output->enabled = EINA_FALSE;
955 output->need_repaint = EINA_FALSE;
956 ecore_drm_output_cursor_size_set(output, 0, 0, 0);
957 ecore_drm_output_dpms_set(output, DRM_MODE_DPMS_OFF);
958} 978}
959 979
960EAPI void 980EAPI void
diff --git a/src/lib/ecore_drm/ecore_drm_private.h b/src/lib/ecore_drm/ecore_drm_private.h
index fc32801f02..679e908156 100644
--- a/src/lib/ecore_drm/ecore_drm_private.h
+++ b/src/lib/ecore_drm/ecore_drm_private.h
@@ -265,6 +265,8 @@ void _ecore_drm_output_fb_release(Ecore_Drm_Output *output, Ecore_Drm_Fb *fb);
265void _ecore_drm_output_repaint_start(Ecore_Drm_Output *output); 265void _ecore_drm_output_repaint_start(Ecore_Drm_Output *output);
266void _ecore_drm_output_frame_finish(Ecore_Drm_Output *output); 266void _ecore_drm_output_frame_finish(Ecore_Drm_Output *output);
267void _ecore_drm_outputs_update(Ecore_Drm_Device *dev); 267void _ecore_drm_outputs_update(Ecore_Drm_Device *dev);
268void _ecore_drm_output_render_enable(Ecore_Drm_Output *output);
269void _ecore_drm_output_render_disable(Ecore_Drm_Output *output);
268 270
269Eina_Bool _ecore_drm_logind_connect(Ecore_Drm_Device *dev); 271Eina_Bool _ecore_drm_logind_connect(Ecore_Drm_Device *dev);
270void _ecore_drm_logind_disconnect(Ecore_Drm_Device *dev); 272void _ecore_drm_logind_disconnect(Ecore_Drm_Device *dev);