tdm_display: support dump current option for hwc_window 37/250937/1
authorJunkyeong Kim <jk0430.kim@samsung.com>
Wed, 6 Jan 2021 02:48:19 +0000 (11:48 +0900)
committerJunkyeong Kim <jk0430.kim@samsung.com>
Wed, 6 Jan 2021 02:48:24 +0000 (11:48 +0900)
Change-Id: Ic96dffc9815291fbf4905a37416fa12a3e58b6a2
Signed-off-by: Junkyeong Kim <jk0430.kim@samsung.com>
src/tdm_display.c

index 6603603..cf974ec 100644 (file)
@@ -104,6 +104,49 @@ tdm_display_enable_debug_module(const char*modules)
        return TDM_ERROR_NONE;
 }
 
+void
+_tdm_display_enable_dump_current(tdm_private_display *private_display, char *path)
+{
+       tdm_private_module *b = NULL;
+       tdm_private_output *o = NULL;
+
+       LIST_FOR_EACH_ENTRY(b, &private_display->module_list, link) {
+               LIST_FOR_EACH_ENTRY(o, &b->output_list, link) {
+                       if (o->caps.capabilities & TDM_OUTPUT_CAPABILITY_HWC) {
+                               tdm_private_hwc *private_hwc = NULL;
+                               tdm_private_hwc_window *w = NULL;
+                               int index = 0;
+                               private_hwc = o->private_hwc;
+                               if (private_hwc->display_target_buffer) {
+                                       char str[TDM_PATH_LEN];
+                                       snprintf(str, TDM_PATH_LEN, "window_%d_target", private_hwc->index);
+                                       tdm_helper_dump_buffer_str(private_hwc->display_target_buffer, path, str);
+                               }
+                               LIST_FOR_EACH_ENTRY(w, &private_hwc->hwc_window_list, link) {
+                                       char str[TDM_PATH_LEN];
+                                       if (!w->display_buffer)
+                                               continue;
+                                       if (w->composition_type != TDM_HWC_WIN_COMPOSITION_DEVICE)
+                                               continue;
+                                       snprintf(str, TDM_PATH_LEN, "window_%d_%d", private_hwc->index, index++);
+                                       tdm_helper_dump_buffer_str(w->display_buffer, path, str);
+                               }
+                       } else {
+                               tdm_private_layer *l = NULL;
+                               LIST_FOR_EACH_ENTRY(l, &o->layer_list, link) {
+                                       char str[TDM_PATH_LEN];
+                                       if (l->usable || l->caps.capabilities & TDM_LAYER_CAPABILITY_VIDEO)
+                                               continue;
+                                       if (!l->showing_buffer)
+                                               continue;
+                                       snprintf(str, TDM_PATH_LEN, "layer_%d_%d", o->index, l->index);
+                                       tdm_helper_dump_buffer_str(l->showing_buffer->buffer, path, str);
+                               }
+                       }
+               }
+       }
+}
+
 INTERN tdm_error
 tdm_display_enable_dump(tdm_private_display *private_display, const char *dump_str, char *reply, int *len)
 {
@@ -139,29 +182,12 @@ tdm_display_enable_dump(tdm_private_display *private_display, const char *dump_s
        TDM_GOTO_IF_FAIL(path != NULL, done);
 
        if (!strncmp(arg, "current", 7)) {
-               tdm_private_module *b = NULL;
-               tdm_private_output *o = NULL;
-
                if (!private_display) {
                        TDM_WRN("no private_display");
                        goto done;
                }
 
-               LIST_FOR_EACH_ENTRY(b, &private_display->module_list, link) {
-                       LIST_FOR_EACH_ENTRY(o, &b->output_list, link) {
-                               tdm_private_layer *l = NULL;
-                               LIST_FOR_EACH_ENTRY(l, &o->layer_list, link) {
-                                       char str[TDM_PATH_LEN];
-                                       if (l->usable || l->caps.capabilities & TDM_LAYER_CAPABILITY_VIDEO)
-                                               continue;
-                                       if (!l->showing_buffer)
-                                               continue;
-                                       snprintf(str, TDM_PATH_LEN, "layer_%d_%d", o->index, l->index);
-                                       tdm_helper_dump_buffer_str(l->showing_buffer->buffer, path, str);
-                               }
-                       }
-               }
-
+               _tdm_display_enable_dump_current(private_display, path);
                TDM_SNPRINTF(reply, len, "path: %s\n", path);
                goto done;
        }