aboutsummaryrefslogtreecommitdiffstats
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
parenteolian: precompute all enum field values (faster runtime, constness) (diff)
downloadefl-3aaa9f2f9f2c998207eb3ad13876d70532e6bd0c.tar.gz
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,
/**
* Enable a Ecore_Drm_Output
*
- * This function will enable rendering on an Ecore_Drm_Output
+ * This function will enable an Ecore_Drm_Output
*
* @param output The Ecore_Drm_Output to enable
*
@@ -494,7 +494,7 @@ EAPI Eina_Bool ecore_drm_output_enable(Ecore_Drm_Output *output);
/**
* Disable a Ecore_Drm_Output
*
- * This function will disable rendering on an Ecore_Drm_Output
+ * This function will disable an Ecore_Drm_Output
*
* @param output The Ecore_Drm_Output to disable
*
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)
{
/* set output mode */
EINA_LIST_FOREACH(dev->outputs, l, output)
- ecore_drm_output_enable(output);
+ _ecore_drm_output_render_enable(output);
/* enable inputs */
EINA_LIST_FOREACH(dev->inputs, l, input)
@@ -166,7 +166,7 @@ _ecore_drm_logind_cb_activate(void *data, int type EINA_UNUSED, void *event)
/* disable hardware cursor */
EINA_LIST_FOREACH(dev->outputs, l, output)
- ecore_drm_output_disable(output);
+ _ecore_drm_output_render_disable(output);
/* disable sprites */
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:
}
}
+void
+_ecore_drm_output_render_enable(Ecore_Drm_Output *output)
+{
+ Ecore_Drm_Device *dev;
+ Ecore_Drm_Output_Mode *mode;
+ /* int x = 0, y = 0; */
+
+ EINA_SAFETY_ON_NULL_RETURN(output);
+ EINA_SAFETY_ON_NULL_RETURN(output->dev);
+ EINA_SAFETY_ON_NULL_RETURN(output->current_mode);
+
+ if (!output->enabled) return;
+
+ dev = output->dev;
+
+ if (!dev->current)
+ {
+ /* schedule repaint */
+ /* NB: this will trigger a redraw at next idle */
+ output->need_repaint = EINA_TRUE;
+ return;
+ }
+
+ ecore_drm_output_dpms_set(output, DRM_MODE_DPMS_ON);
+
+ /* if (!output->cloned) */
+ /* { */
+ /* x = output->x; */
+ /* y = output->y; */
+ /* } */
+
+ mode = output->current_mode;
+ if (drmModeSetCrtc(dev->drm.fd, output->crtc_id, dev->current->id,
+ output->x, output->y,
+ &output->conn_id, 1, &mode->info) < 0)
+ {
+ ERR("Failed to set Mode %dx%d for Output %s: %m",
+ mode->width, mode->height, output->name);
+ }
+}
+
+void
+_ecore_drm_output_render_disable(Ecore_Drm_Output *output)
+{
+ EINA_SAFETY_ON_NULL_RETURN(output);
+
+ output->need_repaint = EINA_FALSE;
+ ecore_drm_output_cursor_size_set(output, 0, 0, 0);
+ ecore_drm_output_dpms_set(output, DRM_MODE_DPMS_OFF);
+}
+
static void
_ecore_drm_output_planes_get(Ecore_Drm_Device *dev)
{
@@ -907,41 +958,11 @@ ecore_drm_output_cursor_size_set(Ecore_Drm_Output *output, int handle, int w, in
EAPI Eina_Bool
ecore_drm_output_enable(Ecore_Drm_Output *output)
{
- Ecore_Drm_Device *dev;
- Ecore_Drm_Output_Mode *mode;
- int x = 0, y = 0;
-
EINA_SAFETY_ON_NULL_RETURN_VAL(output, EINA_FALSE);
- EINA_SAFETY_ON_NULL_RETURN_VAL(output->dev, EINA_FALSE);
- EINA_SAFETY_ON_NULL_RETURN_VAL(output->current_mode, EINA_FALSE);
- dev = output->dev;
+ if (output->enabled) return EINA_TRUE;
output->enabled = EINA_TRUE;
- if (!dev->current)
- {
- /* schedule repaint */
- /* NB: this will trigger a redraw at next idle */
- output->need_repaint = EINA_TRUE;
- return EINA_TRUE;
- }
-
- ecore_drm_output_dpms_set(output, DRM_MODE_DPMS_ON);
-
- if (!output->cloned)
- {
- x = output->x;
- y = output->y;
- }
-
- mode = output->current_mode;
- if (drmModeSetCrtc(dev->drm.fd, output->crtc_id, dev->current->id, x, y,
- &output->conn_id, 1, &mode->info) < 0)
- {
- ERR("Failed to set Mode %dx%d for Output %s: %m",
- mode->width, mode->height, output->name);
- return EINA_FALSE;
- }
return EINA_TRUE;
}
@@ -951,10 +972,9 @@ ecore_drm_output_disable(Ecore_Drm_Output *output)
{
EINA_SAFETY_ON_NULL_RETURN(output);
+ if (!output->enabled) return;
+
output->enabled = EINA_FALSE;
- output->need_repaint = EINA_FALSE;
- ecore_drm_output_cursor_size_set(output, 0, 0, 0);
- ecore_drm_output_dpms_set(output, DRM_MODE_DPMS_OFF);
}
EAPI 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);
void _ecore_drm_output_repaint_start(Ecore_Drm_Output *output);
void _ecore_drm_output_frame_finish(Ecore_Drm_Output *output);
void _ecore_drm_outputs_update(Ecore_Drm_Device *dev);
+void _ecore_drm_output_render_enable(Ecore_Drm_Output *output);
+void _ecore_drm_output_render_disable(Ecore_Drm_Output *output);
Eina_Bool _ecore_drm_logind_connect(Ecore_Drm_Device *dev);
void _ecore_drm_logind_disconnect(Ecore_Drm_Device *dev);