int bDlog;
#endif
+int b_dump_queue;
+
#define PREFIX_LIB "libtbm_"
#define SUFFIX_LIB ".so"
#define DEFAULT_LIB PREFIX_LIB"default"SUFFIX_LIB
}
}
+static int
+_tbm_util_get_max_surface_size(int * w, int * h)
+{
+ int count = 0;
+ tbm_surface_h surface = NULL, tmp = NULL;
+ tbm_surface_info_s info;
+
+ *w = 0;
+ *h = 0;
+
+ if (gBufMgr == NULL)
+ return count;
+
+ if (!LIST_IS_EMPTY(&gBufMgr->surf_list)) {
+ LIST_FOR_EACH_ENTRY_SAFE(surface, tmp, &gBufMgr->surf_list, item_link) {
+ if (tbm_surface_get_info(surface, &info) == TBM_SURFACE_ERROR_NONE) {
+ count++;
+ if (*w < info.width) *w = info.width;
+ if (*h < info.height) *h = info.height;
+ }
+ }
+ }
+
+ return count;
+}
+
static void
_tbm_util_get_appname_brief(char *brief)
{
if (bo == NULL)
return 0;
+ if (gBufMgr == NULL) {
+ TBM_LOG_E("error tbm_bufmgr was deinited\n");
+ return 0;
+ }
+
if (!LIST_IS_EMPTY(&gBufMgr->bo_list)) {
LIST_FOR_EACH_ENTRY_SAFE(old_data, tmp, &gBufMgr->bo_list, item_link) {
if (old_data == bo)
/* intialize surf_list */
LIST_INITHEAD(&gBufMgr->surf_list);
+ /* intialize debug_key_list */
+ LIST_INITHEAD(&gBufMgr->debug_key_list);
+
pthread_mutex_unlock(&gLock);
return gBufMgr;
}
{
TBM_RETURN_VAL_IF_FAIL(TBM_BUFMGR_IS_VALID(bufmgr), 0);
- unsigned int capability = TBM_BUFMGR_CAPABILITY_NONE;
-
- if (bufmgr->backend->bo_import && bufmgr->backend->bo_export)
- capability |= TBM_BUFMGR_CAPABILITY_SHARE_KEY;
-
- if (bufmgr->backend->bo_import_fd && bufmgr->backend->bo_export_fd)
- capability |= TBM_BUFMGR_CAPABILITY_SHARE_FD;
-
- TBM_TRACE("tbm_bufmgr(%p) capability(%d)\n", bufmgr, capability);
+ TBM_TRACE("tbm_bufmgr(%p) capability(%d)\n", bufmgr, bufmgr->capabilities);
- return capability;
+ return bufmgr->capabilities;
}
int
int i;
char app_name[255] = {0,};
unsigned int pid = 0;
+ char title[255] = {0,};
+ char data[255] = {0,};
+ tbm_surface_debug_data *debug_old_data = NULL, *debug_tmp = NULL;
pthread_mutex_lock(&gLock);
TBM_DEBUG("============TBM DEBUG: %s(%d)===========================\n",
app_name, getpid());
memset(app_name, 0x0, 255 * sizeof(char));
+ snprintf(title, 255, "%s", "no surface refcnt width height bpp size n_b n_p flags format app_name ");
+ if (!LIST_IS_EMPTY(&bufmgr->debug_key_list)) {
+ LIST_FOR_EACH_ENTRY_SAFE(debug_old_data, debug_tmp, &bufmgr->debug_key_list, item_link) {
+ strncat(title, " ", 2);
+ strncat(title, debug_old_data->key, strlen(debug_old_data->key) + 1);
+ }
+ }
TBM_DEBUG("[tbm_surface information]\n");
- TBM_DEBUG("no surface refcnt width height bpp size num_bos num_planes flags format app_name\n");
+ TBM_DEBUG("%s\n", title);
/* show the tbm_surface information in surf_list */
if (!LIST_IS_EMPTY(&bufmgr->surf_list)) {
+ char *value = NULL;
+
LIST_FOR_EACH_ENTRY_SAFE(surf, tmp_surf, &bufmgr->surf_list, item_link) {
pid = _tbm_surface_internal_get_debug_pid(surf);
if (!pid) {
_tbm_util_get_appname_from_pid(pid, app_name);
_tbm_util_get_appname_brief(app_name);
- TBM_DEBUG("%-4d%-23p%-6d%-7d%-8d%-5d%-12d%-10d%-9d%-4d%-20s%s\n",
+ snprintf(data, 255, "%-2d %-9p %-4d %-5d %-6d %-3d %-6d %-2d %-2d %-3d %-8s %-15s",
++surf_cnt,
surf,
surf->refcnt,
surf->num_bos,
surf->num_planes,
surf->flags,
- _tbm_surface_internal_format_to_str(surf->info.format),
+ _tbm_surface_internal_format_to_str(surf->info.format) + 11,
app_name);
+ if (!LIST_IS_EMPTY(&bufmgr->debug_key_list)) {
+ LIST_FOR_EACH_ENTRY_SAFE(debug_old_data, debug_tmp, &bufmgr->debug_key_list, item_link) {
+ strncat(data, " ", 2);
+
+ value = _tbm_surface_internal_get_debug_data(surf, debug_old_data->key);
+ if (value)
+ strncat(data, value, strlen(value) + 1);
+ else
+ strncat(data, "none", strlen("none") + 1);
+ }
+ }
+ TBM_DEBUG("%s\n", data);
+
for (i = 0; i < surf->num_bos; i++) {
TBM_DEBUG(" bo:%-12p %-26d%-10d\n",
surf->bos[i],
TBM_DEBUG("\n");
TBM_DEBUG("[tbm_bo information]\n");
- TBM_DEBUG("no bo refcnt size lock_cnt map_cnt flags surface\n");
+ TBM_DEBUG("no bo refcnt size lock_cnt map_cnt flags surface\n");
/* show the tbm_bo information in bo_list */
if (!LIST_IS_EMPTY(&bufmgr->bo_list)) {
LIST_FOR_EACH_ENTRY_SAFE(bo, tmp_bo, &bufmgr->bo_list, item_link) {
- TBM_DEBUG("%-4d%-11p %-6d%-12d%-9d%-9d%-4d%-11p\n",
+ TBM_DEBUG("%-4d%-11p %-4d %-6d %-5d %-4d %-3d %-11p\n",
++bo_cnt,
bo,
bo->ref_cnt,
#endif
}
+int
+tbm_bufmgr_debug_queue_dump(char *path, int count, int onoff)
+{
+ TBM_LOG_D("path=%s count=%d onoff=%d\n", path, count, onoff);
+
+ if (onoff == 1) {
+
+ TBM_RETURN_VAL_IF_FAIL(path != NULL, 0);
+
+ int w = 0, h = 0;
+ if (_tbm_util_get_max_surface_size(&w, &h) == 0) {
+ TBM_LOG_I("No tbm_surface.\n");
+ return 0;
+ }
+
+ tbm_surface_internal_dump_start(path, w, h, count);
+ b_dump_queue = 1;
+
+ } else if (onoff == 0) {
+
+ tbm_surface_internal_dump_end();
+ b_dump_queue = 0;
+
+ } else {
+ return 0;
+ }
+
+ return 1;
+}
+
+int
+tbm_bufmgr_debug_dump_all(char *path)
+{
+ TBM_RETURN_VAL_IF_FAIL(path != NULL, 0);
+
+ TBM_LOG_D("path=%s\n", path);
+ int w = 0, h = 0, count = 0;
+ tbm_surface_h surface = NULL, tmp = NULL;
+
+ count = _tbm_util_get_max_surface_size(&w, &h);
+ if (count == 0) {
+ TBM_LOG_I("No tbm_surface.\n");
+ return 1;
+ }
+
+ tbm_surface_internal_dump_start(path, w, h, count);
+
+ LIST_FOR_EACH_ENTRY_SAFE(surface, tmp, &gBufMgr->surf_list, item_link) {
+ tbm_surface_internal_dump_buffer(surface, "dump_all");
+ }
+
+ tbm_surface_internal_dump_end();
+
+ return 1;
+
+}
+
/* internal function */
+tbm_bufmgr
+_tbm_bufmgr_get_bufmgr(void)
+{
+ return gBufMgr;
+}
+
int
_tbm_bo_set_surface(tbm_bo bo, tbm_surface_h surface)
{