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>
This commit is contained in:
Chris Michael 2015-05-13 10:19:32 -04:00
parent 957a89168b
commit 3aaa9f2f9f
4 changed files with 60 additions and 38 deletions

View File

@ -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
*

View File

@ -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)

View File

@ -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

View File

@ -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);