ecore-drm2: Fix issue of VT-Switching going blank on returns
authorChris Michael <cp.michael@samsung.com>
Wed, 27 Jul 2016 19:35:42 +0000 (15:35 -0400)
committerChris Michael <cp.michael@samsung.com>
Wed, 27 Jul 2016 19:35:42 +0000 (15:35 -0400)
As it turns out, when we vt-switch Back to a running Enlightenment,
it ends up processing all outputs and causes Evas to create a giant
canvas to cover all outputs. This new canvas causes a blank screen as
the pageflipping fails (due to fb being too large). As we do not yet
support output on more an one screen anyway, temporarily disable any
output which is not marked as primary.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
src/lib/ecore_drm2/ecore_drm2_outputs.c

index 1eb50d6..f44bee8 100644 (file)
@@ -83,6 +83,8 @@ _output_event_send(Ecore_Drm2_Output *output)
 {
    Ecore_Drm2_Event_Output_Changed *ev;
 
+   if ((!output->enabled) && (!output->connected)) return;
+
    ev = calloc(1, sizeof(Ecore_Drm2_Event_Output_Changed));
    if (!ev) return;
 
@@ -594,6 +596,12 @@ _output_create(Ecore_Drm2_Device *dev, const drmModeRes *res, const drmModeConne
 
    if (!eina_list_count(dev->outputs))
      output->primary = EINA_TRUE;
+   else
+     {
+        /* temporarily disable other outputs which are not primary */
+        output->connected = EINA_FALSE;
+        output->enabled = EINA_FALSE;
+     }
 
    dev->alloc.crtc |= (1 << output->crtc_id);
    dev->alloc.conn |= (1 << output->conn_id);
@@ -979,16 +987,29 @@ ecore_drm2_output_enabled_set(Ecore_Drm2_Output *output, Eina_Bool enabled)
 {
    EINA_SAFETY_ON_NULL_RETURN(output);
 
+   if (!output->connected) return;
    if (output->enabled == enabled) return;
    output->enabled = enabled;
 
    if (output->enabled)
-     ecore_drm2_output_dpms_set(output, DRM_MODE_DPMS_ON);
+     {
+        Ecore_Drm2_Fb *fb;
+
+        if (output->current) fb = output->current;
+        else if (output->next) fb = output->next;
+
+        drmModeSetCrtc(output->fd, output->crtc_id, fb->id,
+                       output->x, output->y,
+                       &output->conn_id, 1,
+                       &output->current_mode->info);
+
+        ecore_drm2_output_dpms_set(output, DRM_MODE_DPMS_ON);
+     }
    else
      {
         ecore_drm2_output_dpms_set(output, DRM_MODE_DPMS_OFF);
         output->current = NULL;
-        output->next = NULL;
+        /* output->next = NULL; */
      }
 
    _output_event_send(output);