englebass pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=55b4ad41d19f1e4573203bf4296356d8f991e809

commit 55b4ad41d19f1e4573203bf4296356d8f991e809
Author: Sebastian Dransfeld <[email protected]>
Date:   Tue Dec 16 09:21:02 2014 +0100

    randr: remember crtcid for fast lookup on reconnect
    
    When an output is set inactive, it is disconnected from a crtc. Now we
    remember the id of the last crtc it was connected to, so we get a faster
    lookup on reconnect.
---
 src/bin/e_randr.c | 12 ++++++++----
 src/bin/e_randr.h |  1 +
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/bin/e_randr.c b/src/bin/e_randr.c
index d8c074e..4def8c3 100644
--- a/src/bin/e_randr.c
+++ b/src/bin/e_randr.c
@@ -475,6 +475,7 @@ _e_randr_load(void)
              output->is_lid = _e_randr_is_lid(output);
              output->edid = _e_randr_output_edid_string_get(root, output->xid);
              output->status = ecore_x_randr_output_connection_status_get(root, 
output->xid);
+             output->crtcid = ecore_x_randr_output_crtc_get(root, output->xid);
              output->cfg = _e_randr_config_output_find(output);
              if (!output->cfg)
                {
@@ -781,6 +782,7 @@ _e_randr_event_cb_output_change(void *data EINA_UNUSED, int 
type EINA_UNUSED, vo
         if ((!output->crtc) || (output->crtc->xid == 0)) unknown = EINA_TRUE;
 
         /* connected */
+        output->crtcid = ev->crtc;
         if ((ev->crtc != 0) && ((!unknown) && (output->crtc->xid != ev->crtc)))
           {
              /* remove from old crtc */
@@ -1049,17 +1051,17 @@ _e_randr_output_crtc_find(E_Randr_Output *output)
    int num = 0, i = 0;
    int nmodes, pref;
 
-   /* grab the root window */
-   root = ecore_x_window_root_first_get();
-
    /* check if current is available */
-   if ((crtc = _e_randr_crtc_find(ecore_x_randr_output_crtc_get(root, 
output->xid))))
+   if ((crtc = _e_randr_crtc_find(output->crtcid)))
      {
         if (!crtc->outputs)
           goto done;
      }
    crtc = NULL;
 
+   /* grab the root window */
+   root = ecore_x_window_root_first_get();
+
    /* get a list of possible crtcs for this output */
    possible = ecore_x_randr_output_possible_crtcs_get(root, output->xid, &num);
    if (num == 0) goto error;
@@ -1096,6 +1098,7 @@ done:
    free(possible);
    free(modes);
 
+   output->crtcid = crtc->xid;
    output->crtc = crtc;
    return;
 
@@ -1302,6 +1305,7 @@ _e_randr_output_active_set(E_Randr_Output *output, 
Eina_Bool active)
              output->crtc->outputs =
                 eina_list_remove(output->crtc->outputs, output);
              e_randr->active--;
+             output->crtc = NULL;
              printf("RR:  ... remove output for crtc now\n");
           }
      }
diff --git a/src/bin/e_randr.h b/src/bin/e_randr.h
index 654a7e4..30e355d 100644
--- a/src/bin/e_randr.h
+++ b/src/bin/e_randr.h
@@ -55,6 +55,7 @@ struct _E_Randr_Output
 
    E_Config_Randr_Output *cfg;
    E_Randr_Crtc *crtc;
+   Ecore_X_Randr_Crtc crtcid;
 };
 
 struct _E_Randr_Crtc

-- 


Reply via email to