+ LIST_FOR_EACH_ENTRY(surf, &bufmgr->surf_list, item_link) {
+ char data[512] = {0,};
+ unsigned int pid;
+ int i;
+
+ pid = _tbm_surface_internal_get_debug_pid(surf);
+ if (!pid) {
+ /* if pid is null, set the self_pid */
+ pid = getpid();
+ }
+
+ memset(app_name, 0x0, 255 * sizeof(char));
+ _tbm_util_get_appname_from_pid(pid, app_name);
+ _tbm_util_get_appname_brief(app_name);
+
+ snprintf(data, 255, "%-2d %-9p %-4d %-5u %-6u %-3u %-6u %-2d %-2d %-3d %-8s %-15s",
+ ++surf_cnt,
+ surf,
+ surf->refcnt,
+ surf->info.width,
+ surf->info.height,
+ surf->info.bpp,
+ surf->info.size / 1024,
+ surf->num_bos,
+ surf->num_planes,
+ surf->flags,
+ _tbm_surface_internal_format_to_str(surf->info.format) + 11,
+ app_name);
+
+ if (!LIST_IS_EMPTY(&bufmgr->debug_key_list)) {
+ LIST_FOR_EACH_ENTRY(debug_old_data, &bufmgr->debug_key_list, item_link) {
+ char *value;
+
+ strncat(data, " ", MAX_SIZE_N(title));
+
+ value = _tbm_surface_internal_get_debug_data(surf, debug_old_data->key);
+ if (value)
+ strncat(data, value, MAX_SIZE_N(title));
+ else
+ strncat(data, "none", MAX_SIZE_N(title));
+ }
+ }
+ TBM_SNPRINTF(str, len, "%s\n", data);
+
+ for (i = 0; i < surf->num_bos; i++) {
+ TBM_SNPRINTF(str, len, " bo:%-12p %-26d%-10d\n",
+ surf->bos[i],
+ surf->bos[i]->ref_cnt,
+ bufmgr->backend->bo_size(surf->bos[i]) / 1024);
+ }
+ }
+ } else
+ TBM_SNPRINTF(str, len, " no tbm_surfaces.\n");
+ TBM_SNPRINTF(str, len, "\n");
+
+ TBM_SNPRINTF(str, len, "[tbm_bo information]\n");
+ TBM_SNPRINTF(str, len, "no bo refcnt size lock_cnt map_cnt flags surface name\n");
+
+ /* show the tbm_bo information in bo_list */
+ if (!LIST_IS_EMPTY(&bufmgr->bo_list)) {
+ int bo_cnt = 0;
+ tbm_bo bo = NULL;
+
+ LIST_FOR_EACH_ENTRY(bo, &bufmgr->bo_list, item_link) {
+ TBM_SNPRINTF(str, len, "%-4d%-11p %-4d %-6d %-5d %-4u %-3d %-11p %-4d\n",
+ ++bo_cnt,
+ bo,
+ bo->ref_cnt,
+ bufmgr->backend->bo_size(bo) / 1024,
+ bo->lock_cnt,
+ bo->map_cnt,
+ bo->flags,
+ bo->surface,
+ tbm_bo_export(bo));
+ }
+ } else
+ TBM_SNPRINTF(str, len, "no tbm_bos.\n");
+ TBM_SNPRINTF(str, len, "\n");
+
+ TBM_SNPRINTF(str, len, "===============================================================\n");
+
+ pthread_mutex_unlock(&gLock);
+}
+
+void
+tbm_bufmgr_debug_show(tbm_bufmgr bufmgr)
+{
+ char str[1024*4];
+ int len = sizeof(str);
+ tbm_bufmgr_debug_tbm_info_get(bufmgr, str, &len);
+ TBM_DEBUG(" %s", str);
+}
+
+void
+tbm_bufmgr_debug_trace(tbm_bufmgr bufmgr, int onoff)
+{
+ _tbm_bufmgr_mutex_lock();
+
+ TBM_BUFMGR_RETURN_IF_FAIL(TBM_BUFMGR_IS_VALID(bufmgr));
+ TBM_BUFMGR_RETURN_IF_FAIL(bufmgr == gBufMgr);
+
+#ifdef TRACE
+ TBM_LOG_D("bufmgr=%p onoff=%d\n", bufmgr, onoff);
+ bTrace = onoff;
+#endif
+
+ _tbm_bufmgr_mutex_unlock();
+}
+
+void
+tbm_bufmgr_debug_dump_set_scale(double scale)
+{
+ pthread_mutex_lock(&gLock);
+ scale_factor = scale;
+ pthread_mutex_unlock(&gLock);