1 #include "e_mod_comp_shared_types.h"
2 #include "e_mod_comp.h"
3 #include "e_mod_comp_atoms.h"
4 #include "e_mod_comp_debug.h"
6 typedef struct _E_Mod_Comp_Log_Info
10 } E_Mod_Comp_Log_Info;
13 #define LT_NOTHING 0x0000
14 #define LT_CREATE 0x0004
15 #define LT_CONFIGURE 0x0008
16 #define LT_DRAW 0x0020
17 #define LT_DUMP 0x0100
19 /* local subsystem functions */
21 _e_mod_comp_debug_wins_info_dump(E_Comp *c,
25 Ecore_X_Window cid = 0;
26 char *wname = NULL, *wclas = NULL;
28 char buf[4096], buf2[4096], buf3[4096];
31 fprintf(fs, "B-----------------------------------------------------------------------------------------------------------------------------\n");
32 fprintf(fs, " NO WINDOW (CLIENT) V x y w h PIXMAP pw ph | v VAL DMGs DONE | PID WNAME WCLASS\n");
33 fprintf(fs, "------------------------------------------------------------------------------------------------------------------------------\n");
35 EINA_INLIST_REVERSE_FOREACH(c->wins, cw)
37 cid = e_mod_comp_util_client_xid_get(cw);
38 ecore_x_icccm_name_class_get(cid, &wname, &wclas);
39 res = ecore_x_netwm_pid_get(cid, &pid);
42 memset(buf, 0, sizeof(buf));
43 memset(buf2, 0, sizeof(buf2));
44 memset(buf3, 0, sizeof(buf3));
47 snprintf(buf, sizeof(buf), "0x%07x", cw->bd->client.win);
50 snprintf(buf2, sizeof(buf2), "0x%07x", cw->pixmap);
52 if (cw->sync_info.val)
53 snprintf(buf3, sizeof(buf3), "%d %4d %4d %4d",
54 cw->sync_info.version,
57 cw->sync_info.done_count);
60 " %3d 0x%07x %9s %s %5d %5d %4d %4d %9s %4d %4d | %16s | %d %d %d %d %d %d |%4d %s %s\n",
64 cw->visible ? "v" : " ",
65 cw->x, cw->y, cw->w, cw->h,
79 if (wname) free(wname);
80 if (wclas) free(wclas);
85 fprintf(fs, "E-----------------------------------------------------------------------------------------------------------------------------\n");
89 _e_mod_comp_debug_canvas_info_dump(E_Comp *c,
90 E_Comp_Canvas *canvas,
94 E_Comp_Object *co, *_co = NULL;
95 E_Comp_Win *cw, *_cw = NULL;
96 E_Comp_Layer *ly = NULL;
98 int x, y, w, h, i = 1;
99 const char *file = NULL, *group = NULL;
101 fprintf(fs, "B-----------------------------------------------------------------------------------------------------------------------------\n");
102 fprintf(fs, " canvas->zone:%p num:%d %d,%d %dx%d\n",
103 canvas->zone, canvas->zone->num,
104 canvas->zone->x, canvas->zone->y,
105 canvas->zone->w, canvas->zone->h);
106 fprintf(fs, " c->nocomp:%d use_hw_ov:%d\n", c->nocomp, c->use_hw_ov);
107 fprintf(fs, " canvas->nocomp mode:%d force_composite:%d(ref:%d)\n", canvas->nocomp.mode, canvas->nocomp.force_composite, canvas->nocomp.comp_ref);
108 fprintf(fs, " canvas->nocomp cw:0x%08x\n", e_mod_comp_util_client_xid_get(canvas->nocomp.cw));
109 fprintf(fs, " canvas->animation run:%d num:%d\n", canvas->animation.run, canvas->animation.num);
110 fprintf(fs, " H/W ov win:%p\n", canvas->ov);
111 fprintf(fs, " Canvas Manual Render State: %d\n", ecore_evas_manual_render_get(canvas->ee));
112 fprintf(fs, "------------------------------------------------------------------------------------------------------------------------------\n");
114 fprintf(fs, "--------------------------------------------------------------------------------------------------------------------------------------\n");
115 fprintf(fs, " NO WinID shobj obj found_o ex ey ew eh | W S O | V SYNC DMG DONE |\n");
116 fprintf(fs, "--------------------------------------------------------------------------------------------------------------------------------------\n");
119 ly = e_mod_comp_canvas_layer_get(canvas, "comp");
122 lm = evas_object_smart_members_get(ly->layout);
124 Evas_Object *o = NULL;
126 EINA_LIST_REVERSE_FOREACH(lm, ll, o)
128 if (!evas_object_visible_get(o)) continue;
130 EINA_INLIST_REVERSE_FOREACH(c->wins, cw)
132 EINA_LIST_FOREACH(cw->objs, l, co)
135 if (co->canvas != canvas) continue;
146 if (found && _co && _cw)
148 edje_object_file_get(_co->shadow, &file, &group);
149 evas_object_geometry_get(o, &x, &y, &w, &h);
152 " %2d 0x%07x %p %p %p %4d %4d %4dx%4d %s %s|%s|%s %.1f|%s %.1f|%s %.1f\n",
153 i, _cw->win, _co->shadow, _co->img, o, x, y, w, h,
154 evas_object_visible_get(_co->shadow) ? "v" : "",
155 _cw->hidden_override ? "HIDDEN" : "",
157 edje_object_part_state_get(_co->shadow, "clipper", &val), val,
158 edje_object_part_state_get(_co->shadow, "shower", &val), val,
159 edje_object_part_state_get(_co->shadow, "e.swallow.content", &val), val);
173 /* externally accessible globals */
174 EAPI int logtype = LT_NOTHING;
176 /* externally accessible functions */
178 e_mod_comp_debug_info_dump(Eina_Bool to_file,
182 E_Comp_Canvas *canvas;
186 c = e_mod_comp_util_get();
187 E_CHECK_RETURN(c, 0);
189 if ((to_file) && (name))
191 fs = fopen(name, "w");
194 fprintf(stderr, "can't open %s file.\n", name);
196 to_file = EINA_FALSE;
200 _e_mod_comp_debug_wins_info_dump(c, fs);
202 EINA_LIST_FOREACH(c->canvases, l, canvas)
204 if (!canvas) continue;
205 _e_mod_comp_debug_canvas_info_dump(c, canvas, fs);
217 e_mod_comp_debug_edje_error_get(Evas_Object *o,
220 Edje_Load_Error err = edje_object_load_error_get(o);
221 char *_err_msg = NULL;
222 Eina_Bool res = EINA_TRUE;
224 if (err != EDJE_LOAD_ERROR_NONE)
228 case EDJE_LOAD_ERROR_GENERIC: _err_msg = strdup("ERR_GENERIC"); break;
229 case EDJE_LOAD_ERROR_DOES_NOT_EXIST: _err_msg = strdup("ERR_DOES_NOT_EXIST"); break;
230 case EDJE_LOAD_ERROR_PERMISSION_DENIED: _err_msg = strdup("ERR_PERMISSION_DENIED"); break;
231 case EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED: _err_msg = strdup("ERR_RESOURCE_ALLOCATION_FAILED"); break;
232 case EDJE_LOAD_ERROR_CORRUPT_FILE: _err_msg = strdup("ERR_CORRUPT_FILE"); break;
233 case EDJE_LOAD_ERROR_UNKNOWN_FORMAT: _err_msg = strdup("ERR_UNKNOWN_FORMAT"); break;
234 case EDJE_LOAD_ERROR_INCOMPATIBLE_FILE: _err_msg = strdup("ERR_INCOMPATIBLE_FILE"); break;
235 case EDJE_LOAD_ERROR_UNKNOWN_COLLECTION: _err_msg = strdup("ERR_UNKNOWN_COLLECTION"); break;
236 case EDJE_LOAD_ERROR_RECURSIVE_REFERENCE: _err_msg = strdup("ERR_RECURSIVE_REFERENCE"); break;
237 default: _err_msg = strdup("ERR_UNKNOWN_ERROR"); break;
242 if (res) _err_msg = strdup("SUCCESS");
243 ELBF(ELBT_COMP, 0, win, "%15.15s|o:%p %s", "EDC", o, _err_msg);
250 e_mod_comp_debug_prop_handle(Ecore_X_Event_Window_Property *ev)
252 Eina_Bool res = EINA_FALSE;
253 E_Mod_Comp_Log_Info info = {LT_NOTHING, {0,}};
254 unsigned char* data = NULL;
257 E_CHECK_RETURN(ev, 0);
258 E_CHECK_RETURN(ev->win, 0);
260 ret = ecore_x_window_prop_property_get
261 (ev->win, ATOM_CM_LOG, ECORE_X_ATOM_CARDINAL,
263 E_CHECK_GOTO((ret != -1), cleanup);
264 E_CHECK_GOTO(((ret > 0) && (data)), cleanup);
266 memcpy(&info, data, sizeof(E_Mod_Comp_Log_Info));
269 fprintf(stdout, "[COMP] logtupe:0x%08x\n", logtype);
271 if (logtype == LT_CREATE)
273 e_mod_comp_debug_info_dump(EINA_FALSE, NULL);
275 else if (logtype == LT_CONFIGURE)
277 int enable = e_configure_registry_exists("appearance/comp");
280 E_Comp *c = e_mod_comp_util_get();
281 E_CHECK_GOTO(c, cleanup);
283 e_configure_registry_call("appearance/comp",
284 e_container_current_get(c->man),
288 else if (logtype == LT_DRAW)
290 E_Comp *c = e_mod_comp_util_get();
291 E_Comp_Canvas *canvas;
293 char msg[4096], buf[2048];
295 snprintf(msg, sizeof(msg), "This is a test dialog for debugging purpose.");
297 EINA_LIST_FOREACH(c->canvases, l, canvas)
299 snprintf(buf, sizeof(buf),
301 "Zone[%d] %d,%d %dx%d<br>"
302 "%s 0x%x F:%d(%d) A:%d(%d)",
308 (canvas->nocomp.mode == E_NOCOMP_MODE_RUN) ? "No composite" : "Composite",
309 e_mod_comp_util_client_xid_get(canvas->nocomp.cw),
310 canvas->nocomp.force_composite,
311 canvas->nocomp.comp_ref,
312 canvas->animation.run,
313 canvas->animation.num);
317 e_util_dialog_internal("Enlightenment Rendering Mode", msg);
320 if ((logtype == LT_DUMP) &&
321 (strlen(info.file) > 0))
323 e_mod_comp_debug_info_dump(EINA_TRUE, info.file);
324 ecore_x_client_message32_send
325 (ev->win, ATOM_CM_LOG_DUMP_DONE,
326 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
333 if (data) E_FREE(data);
337 #if COMP_DEBUG_PIXMAP
338 # ifdef ecore_x_composite_name_window_pixmap_get
339 # undef ecore_x_composite_name_window_pixmap_get
342 e_mod_comp_debug_name_window_pixmap_get(Ecore_X_Window w,
346 Ecore_X_Pixmap p = 0;
347 Ecore_X_Window win = 0;
350 p = ecore_x_composite_name_window_pixmap_get(w);
351 bd = e_border_find_by_window(w);
352 if (bd) win = bd->client.win;
354 "[COMP] %30.30s|%04d 0x%08x NEW PIXMAP 0x%x\n",
358 #endif /* COMP_DEBUG_PIXMAP */