summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-06-14 20:39:39 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-06-15 08:43:18 +0100
commite667dd8b2c7d6abb3a1bebd29b0a49a92c498043 (patch)
treefb8977bf757e9a5cb8f78dc683ad0883f039e007
parentbc98c94dc9b1f41406870eca709a97ec63daf96c (diff)
edje messages - make it use inlist to fragment ram less
using regular lists means we double our indirect ptr jumps and fragment ram more - this is step one in improving performance of message handling in some nasty corner cases i have found. first this so it can be identified as an issue on its own if it is one. i've tested it and it seems ok. so this si stage 1.
-rw-r--r--src/lib/edje/edje_message_queue.c110
-rw-r--r--src/lib/edje/edje_private.h7
2 files changed, 65 insertions, 52 deletions
diff --git a/src/lib/edje/edje_message_queue.c b/src/lib/edje/edje_message_queue.c
index b7ecdf3e95..cb424c3de3 100644
--- a/src/lib/edje/edje_message_queue.c
+++ b/src/lib/edje/edje_message_queue.c
@@ -6,8 +6,8 @@ static int _injob = 0;
6static Ecore_Job *_job = NULL; 6static Ecore_Job *_job = NULL;
7static Ecore_Timer *_job_loss_timer = NULL; 7static Ecore_Timer *_job_loss_timer = NULL;
8 8
9static Eina_List *msgq = NULL; 9static Eina_Inlist *msgq = NULL;
10static Eina_List *tmp_msgq = NULL; 10static Eina_Inlist *tmp_msgq = NULL;
11static int tmp_msgq_processing = 0; 11static int tmp_msgq_processing = 0;
12static int tmp_msgq_restart = 0; 12static int tmp_msgq_restart = 0;
13 13
@@ -141,35 +141,47 @@ bad_type:
141 return; 141 return;
142} 142}
143 143
144#define INLIST_CONTAINER(container_type, list, list_entry) \
145 (container_type *)((unsigned char *)list - offsetof(container_type, list_entry))
146
144static void 147static void
145_edje_object_message_signal_process_do(Eo *obj EINA_UNUSED, Edje *ed) 148_edje_object_message_signal_process_do(Eo *obj EINA_UNUSED, Edje *ed)
146{ 149{
147 Eina_List *l, *ln, *tmpq = NULL; 150 Eina_Inlist *l, *ln;
151 Eina_Inlist *tmpq = NULL;
148 Edje *lookup_ed; 152 Edje *lookup_ed;
149 Eina_List *lg; 153 Eina_List *groups = NULL, *lg;
150 Edje_Message *em; 154 Edje_Message *em;
151 Eina_List *groups = NULL;
152 int gotos = 0; 155 int gotos = 0;
153 156
154 if (!ed) return; 157 if (!ed) return;
155 158
156 groups = ed->groups; 159 groups = ed->groups;
157 160
158 EINA_LIST_FOREACH_SAFE(msgq, l, ln, em) 161 for (l = msgq; l; l = ln)
159 { 162 {
163 ln = l->next;
164 em = INLIST_CONTAINER(Edje_Message, l, inlist_main);
160 EINA_LIST_FOREACH(groups, lg, lookup_ed) 165 EINA_LIST_FOREACH(groups, lg, lookup_ed)
161 if (em->edje == lookup_ed) 166 {
162 { 167 if (em->edje == lookup_ed)
163 tmpq = eina_list_append(tmpq, em); 168 {
164 msgq = eina_list_remove_list(msgq, l); 169 msgq = eina_inlist_remove(msgq, &(em->inlist_main));
165 break; 170 tmpq = eina_inlist_append(tmpq, &(em->inlist_main));
166 } 171 break;
172 }
173 }
167 } 174 }
168 /* a temporary message queue */ 175 /* a temporary message queue */
169 if (tmp_msgq) 176 if (tmp_msgq)
170 { 177 {
171 EINA_LIST_FREE(tmpq, em) 178 while (tmpq)
172 tmp_msgq = eina_list_append(tmp_msgq, em); 179 {
180 l = tmpq;
181 em = INLIST_CONTAINER(Edje_Message, l, inlist_main);
182 tmpq = eina_inlist_remove(tmpq, &(em->inlist_main));
183 tmp_msgq = eina_inlist_append(tmp_msgq, &(em->inlist_main));
184 }
173 } 185 }
174 else 186 else
175 { 187 {
@@ -179,13 +191,16 @@ _edje_object_message_signal_process_do(Eo *obj EINA_UNUSED, Edje *ed)
179 191
180 tmp_msgq_processing++; 192 tmp_msgq_processing++;
181again: 193again:
182 EINA_LIST_FOREACH_SAFE(tmp_msgq, l, ln, em) 194 for (l = tmp_msgq; l; l = ln)
183 { 195 {
196 ln = l->next;
197 em = INLIST_CONTAINER(Edje_Message, l, inlist_main);
184 EINA_LIST_FOREACH(groups, lg, lookup_ed) 198 EINA_LIST_FOREACH(groups, lg, lookup_ed)
185 if (em->edje == lookup_ed) 199 {
186 break; 200 if (em->edje == lookup_ed) break;
201 }
187 if (em->edje != lookup_ed) continue; 202 if (em->edje != lookup_ed) continue;
188 tmp_msgq = eina_list_remove_list(tmp_msgq, l); 203 tmp_msgq = eina_inlist_remove(tmp_msgq, &(em->inlist_main));
189 if (!lookup_ed->delete_me) 204 if (!lookup_ed->delete_me)
190 { 205 {
191 lookup_ed->processing_messages++; 206 lookup_ed->processing_messages++;
@@ -635,7 +650,7 @@ _edje_message_propagate_send(Edje *ed, Edje_Queue queue, Edje_Message_Type type,
635 } 650 }
636 651
637 em->msg = msg; 652 em->msg = msg;
638 msgq = eina_list_append(msgq, em); 653 msgq = eina_inlist_append(msgq, &(em->inlist_main));
639} 654}
640 655
641void 656void
@@ -848,6 +863,7 @@ void
848_edje_message_queue_process(void) 863_edje_message_queue_process(void)
849{ 864{
850 int i; 865 int i;
866 Edje_Message *em;
851 867
852 if (!msgq) return; 868 if (!msgq) return;
853 869
@@ -860,8 +876,11 @@ _edje_message_queue_process(void)
860 { 876 {
861 while (msgq) 877 while (msgq)
862 { 878 {
863 tmp_msgq = eina_list_append(tmp_msgq, msgq->data); 879 Eina_Inlist *l = msgq;
864 msgq = eina_list_remove_list(msgq, msgq); 880
881 em = INLIST_CONTAINER(Edje_Message, l, inlist_main);
882 msgq = eina_inlist_remove(msgq, &(em->inlist_main));
883 tmp_msgq = eina_inlist_append(tmp_msgq, &(em->inlist_main));
865 } 884 }
866 } 885 }
867 else 886 else
@@ -873,12 +892,12 @@ _edje_message_queue_process(void)
873 tmp_msgq_processing++; 892 tmp_msgq_processing++;
874 while (tmp_msgq) 893 while (tmp_msgq)
875 { 894 {
876 Edje_Message *em; 895 Eina_Inlist *l = tmp_msgq;
877 Edje *ed; 896 Edje *ed;
878 897
879 em = tmp_msgq->data; 898 em = INLIST_CONTAINER(Edje_Message, l, inlist_main);
880 ed = em->edje; 899 ed = em->edje;
881 tmp_msgq = eina_list_remove_list(tmp_msgq, tmp_msgq); 900 tmp_msgq = eina_inlist_remove(tmp_msgq, &(em->inlist_main));
882 em->edje->message.num--; 901 em->edje->message.num--;
883 if (!ed->delete_me) 902 if (!ed->delete_me)
884 { 903 {
@@ -924,21 +943,21 @@ _edje_message_queue_process(void)
924void 943void
925_edje_message_queue_clear(void) 944_edje_message_queue_clear(void)
926{ 945{
946 Edje_Message *em;
947
927 while (msgq) 948 while (msgq)
928 { 949 {
929 Edje_Message *em; 950 Eina_Inlist *l = msgq;
930 951 em = INLIST_CONTAINER(Edje_Message, l, inlist_main);
931 em = msgq->data; 952 msgq = eina_inlist_remove(msgq, &(em->inlist_main));
932 msgq = eina_list_remove_list(msgq, msgq);
933 em->edje->message.num--; 953 em->edje->message.num--;
934 _edje_message_free(em); 954 _edje_message_free(em);
935 } 955 }
936 while (tmp_msgq) 956 while (tmp_msgq)
937 { 957 {
938 Edje_Message *em; 958 Eina_Inlist *l = tmp_msgq;
939 959 em = INLIST_CONTAINER(Edje_Message, l, inlist_main);
940 em = tmp_msgq->data; 960 tmp_msgq = eina_inlist_remove(tmp_msgq, &(em->inlist_main));
941 tmp_msgq = eina_list_remove_list(tmp_msgq, tmp_msgq);
942 em->edje->message.num--; 961 em->edje->message.num--;
943 _edje_message_free(em); 962 _edje_message_free(em);
944 } 963 }
@@ -947,38 +966,31 @@ _edje_message_queue_clear(void)
947void 966void
948_edje_message_del(Edje *ed) 967_edje_message_del(Edje *ed)
949{ 968{
950 Eina_List *l; 969 Eina_Inlist *l, *ln;
970 Edje_Message *em;
951 971
952 if (ed->message.num <= 0) return; 972 if (ed->message.num <= 0) return;
953 /* delete any messages on the main queue for this edje object */ 973 /* delete any messages on the main queue for this edje object */
954 for (l = msgq; l; ) 974 for (l = msgq; l; l = ln)
955 { 975 {
956 Edje_Message *em; 976 ln = l->next;
957 Eina_List *lp; 977 em = INLIST_CONTAINER(Edje_Message, l, inlist_main);
958
959 em = eina_list_data_get(l);
960 lp = l;
961 l = eina_list_next(l);
962 if (em->edje == ed) 978 if (em->edje == ed)
963 { 979 {
964 msgq = eina_list_remove_list(msgq, lp); 980 msgq = eina_inlist_remove(msgq, &(em->inlist_main));
965 em->edje->message.num--; 981 em->edje->message.num--;
966 _edje_message_free(em); 982 _edje_message_free(em);
967 } 983 }
968 if (ed->message.num <= 0) return; 984 if (ed->message.num <= 0) return;
969 } 985 }
970 /* delete any on the processing queue */ 986 /* delete any on the processing queue */
971 for (l = tmp_msgq; l; ) 987 for (l = tmp_msgq; l; l = ln)
972 { 988 {
973 Edje_Message *em; 989 ln = l->next;
974 Eina_List *lp; 990 em = INLIST_CONTAINER(Edje_Message, l, inlist_main);
975
976 em = eina_list_data_get(l);
977 lp = l;
978 l = eina_list_next(l);
979 if (em->edje == ed) 991 if (em->edje == ed)
980 { 992 {
981 tmp_msgq = eina_list_remove_list(tmp_msgq, lp); 993 tmp_msgq = eina_inlist_remove(tmp_msgq, &(em->inlist_main));
982 em->edje->message.num--; 994 em->edje->message.num--;
983 _edje_message_free(em); 995 _edje_message_free(em);
984 } 996 }
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index 2455a342ab..59be35a878 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -2219,12 +2219,13 @@ struct _Edje_Message_Signal
2219 2219
2220struct _Edje_Message 2220struct _Edje_Message
2221{ 2221{
2222 Eina_Inlist inlist_main; // msgq or tmp_msgq - mut exclusive
2222 Edje *edje; 2223 Edje *edje;
2223 Edje_Queue queue;
2224 Edje_Message_Type type;
2225 int id;
2226 unsigned char *msg; 2224 unsigned char *msg;
2225 int id;
2227 Eina_Bool propagated : 1; 2226 Eina_Bool propagated : 1;
2227 Edje_Queue queue : 2;
2228 Edje_Message_Type type : 29;
2228}; 2229};
2229 2230
2230typedef enum _Edje_Fill 2231typedef enum _Edje_Fill