tdm_helper: set up error handling when dump png
[platform/core/uifw/libtdm.git] / src / tdm_helper.c
index 3607f13..08477f1 100644 (file)
@@ -136,6 +136,13 @@ _tdm_helper_dump_png(const char *file, const void *data, int width,
                return;
        }
 
+       if (setjmp(png_jmpbuf(pPngStruct))) {
+               /* if png has problem of writing the file, we get here */
+               png_destroy_write_struct(&pPngStruct, &pPngInfo);
+               fclose(fp);
+               return;
+       }
+
        png_init_io(pPngStruct, fp);
        png_set_IHDR(pPngStruct,
                                 pPngInfo,
@@ -846,6 +853,8 @@ _tdm_helper_get_backend_information(tdm_private_module *private_module, char *re
                        }
                }
        }
+       if (LIST_IS_EMPTY(&private_module->output_list))
+               TDM_SNPRINTF(reply, len, "(no output)\n");
        TDM_SNPRINTF(reply, len, "\n");
 
        /* layer information */
@@ -854,6 +863,11 @@ _tdm_helper_get_backend_information(tdm_private_module *private_module, char *re
        TDM_SNPRINTF(reply, len, "idx   output   zpos   buf   format   size   crop   geometry   transform\n");
        TDM_SNPRINTF(reply, len, "-----------------------------------------------------------------------\n");
        LIST_FOR_EACH_ENTRY(private_output, &private_module->output_list, link) {
+               if (private_output->caps.capabilities & TDM_OUTPUT_CAPABILITY_HWC) {
+                       TDM_SNPRINTF(reply, len, "(no layer), hwc mode on\n");
+                       continue;
+               }
+
                LIST_FOR_EACH_ENTRY(private_layer, &private_output->layer_list, link) {
                        if (!private_layer->usable) {
                                tdm_info_layer info;
@@ -945,6 +959,8 @@ _tdm_helper_get_backend_information(tdm_private_module *private_module, char *re
                        }
                }
        }
+       if (LIST_IS_EMPTY(&private_module->output_list))
+               TDM_SNPRINTF(reply, len, "(no layer)\n");
        TDM_SNPRINTF(reply, len, "\n");
 
        if (private_module->capabilities & TDM_DISPLAY_CAPABILITY_PP) {