3 #include <tizen-extension-server-protocol.h>
4 #include <device/booting-internal.h>
6 #define PATH "/org/enlightenment/wm"
7 #define IFACE "org.enlightenment.wm.screen_rotation"
9 static Ecore_Event_Handler *dbus_init_done_handler;
10 static Eldbus_Connection *edbus_conn = NULL;
11 static Eldbus_Connection_Type edbus_conn_type = ELDBUS_CONNECTION_TYPE_SYSTEM;
12 static Eldbus_Service_Interface *e_comp_screen_iface;
14 static Eina_List *event_handlers = NULL;
16 static Eina_Bool dont_set_e_input_keymap = EINA_FALSE;
17 static Eina_Bool dont_use_xkb_cache = EINA_FALSE;
19 EINTERN int E_EVENT_SCREEN_CHANGE = 0;
23 E_COMP_SCREEN_SIGNAL_ROTATION_CHANGED = 0
26 typedef struct _E_Comp_Screen_Tzsr
28 struct wl_resource *resource; /* tizen_screen_rotation */
32 static Eina_List *tzsr_list;
33 static E_Client_Hook *tzsr_client_hook_del;
35 static E_Comp_Screen_Tzsr*
36 _tz_surface_rotation_find(E_Client *ec)
38 E_Comp_Screen_Tzsr *tzsr;
41 EINA_LIST_FOREACH(tzsr_list, l, tzsr)
51 _tz_surface_rotation_free(E_Comp_Screen_Tzsr *tzsr)
53 ELOGF("TRANSFORM", "|tzsr(%p) freed", tzsr->ec, tzsr);
54 tzsr_list = eina_list_remove(tzsr_list, tzsr);
59 _tz_screen_rotation_cb_client_del(void *data, E_Client *ec)
61 E_Comp_Screen_Tzsr *tzsr = _tz_surface_rotation_find(ec);
63 _tz_surface_rotation_free(tzsr);
67 _tz_screen_rotation_get_ignore_output_transform(struct wl_client *client, struct wl_resource *resource, struct wl_resource *surface)
69 E_Comp_Screen_Tzsr *tzsr;
71 E_Hwc_Policy hwc_policy;
74 Eina_Bool ignore = EINA_TRUE;
76 ec = wl_resource_get_user_data(surface);
77 EINA_SAFETY_ON_NULL_RETURN(ec);
79 tzsr = _tz_surface_rotation_find(ec);
82 tzsr = E_NEW(E_Comp_Screen_Tzsr, 1);
85 wl_client_post_no_memory(client);
89 tzsr->resource = resource;
92 tzsr_list = eina_list_append(tzsr_list, tzsr);
97 output = e_output_find(zone->output_id);
100 hwc_policy = e_hwc_policy_get(output->hwc);
101 if (hwc_policy == E_HWC_POLICY_WINDOWS)
106 ELOGF("TRANSFORM", "|tzsr(%p) client_ignore(%d) ignore(%d)",
107 ec, tzsr, e_config->screen_rotation_client_ignore, ignore);
109 e_comp_screen_rotation_ignore_output_transform_send(ec, ignore);
113 _tz_screen_rotation_iface_cb_destroy(struct wl_client *client, struct wl_resource *resource)
115 wl_resource_destroy(resource);
118 static const struct tizen_screen_rotation_interface _tz_screen_rotation_interface =
120 _tz_screen_rotation_get_ignore_output_transform,
121 _tz_screen_rotation_iface_cb_destroy,
124 static void _tz_screen_rotation_cb_destroy(struct wl_resource *resource)
126 E_Comp_Screen_Tzsr *tzsr;
129 EINA_LIST_FOREACH_SAFE(tzsr_list, l, ll, tzsr)
131 if (tzsr->resource == resource)
132 _tz_surface_rotation_free(tzsr);
137 _tz_screen_rotation_cb_bind(struct wl_client *client, void *data, uint32_t version, uint32_t id)
139 struct wl_resource *res;
141 if (!(res = wl_resource_create(client, &tizen_screen_rotation_interface, version, id)))
143 ERR("Could not create tizen_screen_rotation resource: %m");
144 wl_client_post_no_memory(client);
148 wl_resource_set_implementation(res, &_tz_screen_rotation_interface, NULL, _tz_screen_rotation_cb_destroy);
151 static Eldbus_Message *
152 _e_comp_screen_dbus_get_cb(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
154 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
157 if (e_comp && e_comp->e_comp_screen)
158 rotation = e_comp->e_comp_screen->rotation;
160 ELOGF("COMP_SCREEN","got screen-rotation 'get' request: %d", NULL, rotation);
162 eldbus_message_arguments_append(reply, "i", rotation);
167 static const Eldbus_Method methods[] =
169 {"get", NULL, ELDBUS_ARGS({"i", "int32"}), _e_comp_screen_dbus_get_cb, 0},
173 static const Eldbus_Signal signals[] = {
174 [E_COMP_SCREEN_SIGNAL_ROTATION_CHANGED] = {"changed", ELDBUS_ARGS({ "i", "rotation" }), 0},
178 static const Eldbus_Service_Interface_Desc iface_desc = {
179 IFACE, methods, signals, NULL, NULL, NULL
183 _e_comp_screen_dbus_init()
185 E_Comp_Screen *e_comp_screen = e_comp->e_comp_screen;
187 e_comp_screen_iface = eldbus_service_interface_register(edbus_conn,
190 EINA_SAFETY_ON_NULL_GOTO(e_comp_screen_iface, err);
192 if (e_comp_screen->rotation)
194 eldbus_service_signal_emit(e_comp_screen_iface, E_COMP_SCREEN_SIGNAL_ROTATION_CHANGED, e_comp_screen->rotation);
195 ELOGF("TRANSFORM", "screen-rotation sends signal: %d", NULL, e_comp_screen->rotation);
203 e_dbus_conn_connection_unref(edbus_conn);
211 _layer_cap_to_str(tdm_layer_capability caps, tdm_layer_capability cap)
215 if (cap == TDM_LAYER_CAPABILITY_CURSOR) return "cursor ";
216 else if (cap == TDM_LAYER_CAPABILITY_PRIMARY) return "primary ";
217 else if (cap == TDM_LAYER_CAPABILITY_OVERLAY) return "overlay ";
218 else if (cap == TDM_LAYER_CAPABILITY_GRAPHIC) return "graphics ";
219 else if (cap == TDM_LAYER_CAPABILITY_VIDEO) return "video ";
220 else if (cap == TDM_LAYER_CAPABILITY_TRANSFORM) return "transform ";
221 else if (cap == TDM_LAYER_CAPABILITY_RESEVED_MEMORY) return "reserved_memory ";
222 else if (cap == TDM_LAYER_CAPABILITY_NO_CROP) return "no_crop ";
223 else return "unkown";
229 _e_comp_screen_commit_idle_cb(void *data EINA_UNUSED)
232 E_Comp_Screen *e_comp_screen = NULL;
233 E_Output *output = NULL;
235 if (!e_comp->e_comp_screen) goto end;
237 if (e_config->comp_canvas_norender.use)
238 evas_norender(e_comp->evas);
240 if (e_comp->canvas_render_delayed) goto end;
242 e_comp_screen = e_comp->e_comp_screen;
244 EINA_LIST_FOREACH_SAFE(e_comp_screen->outputs, l, ll, output)
246 if (!output) continue;
247 if (!output->config.enabled) continue;
249 if (!e_output_commit(output))
250 ERR("fail to commit e_comp_screen->outputs.");
252 if (!e_output_render(output))
253 ERR("fail to render e_comp_screen->outputs.");
256 return ECORE_CALLBACK_RENEW;
260 _e_comp_screen_input_rotation_set(int rotation)
267 EINA_LIST_FOREACH(e_input_devices_get(), l, dev)
269 e_input_device_touch_rotation_set(dev, rotation);
270 e_input_device_rotation_set(dev, rotation);
272 ELOGF("COMP_SCREEN","EE Input Device Rotate: %d", NULL, rotation);
278 _e_comp_screen_cb_input_device_add(void *data, int type, void *event)
280 Ecore_Event_Device_Info *e;
283 if (!(e = event)) goto end;
285 if (e->clas == ECORE_DEVICE_CLASS_MOUSE)
287 if (comp->wl_comp_data->ptr.num_devices == 0)
289 e_pointer_object_set(comp->pointer, NULL, 0, 0);
290 e_comp_wl_input_pointer_enabled_set(EINA_TRUE);
292 comp->wl_comp_data->ptr.num_devices++;
294 else if (e->clas == ECORE_DEVICE_CLASS_KEYBOARD)
296 comp->wl_comp_data->kbd.num_devices++;
297 e_comp_wl_input_keyboard_enabled_set(EINA_TRUE);
299 else if (e->clas == ECORE_DEVICE_CLASS_TOUCH)
301 e_comp_wl_input_touch_enabled_set(EINA_TRUE);
302 _e_comp_screen_input_rotation_set(e_comp->e_comp_screen->rotation);
303 comp->wl_comp_data->touch.num_devices++;
307 return ECORE_CALLBACK_PASS_ON;
311 _e_comp_screen_pointer_renew(void)
313 if ((e_comp_wl->ptr.num_devices == 0) && e_comp_wl->ptr.ec && e_comp_wl->ptr.ec->pointer_enter_sent)
315 if (e_devicemgr->last_device_ptr)
317 Evas_Device *last_ptr = NULL, *dev;
320 const char *description;
322 list = (Eina_List *)evas_device_list(evas_object_evas_get(e_comp_wl->ptr.ec->frame), NULL);
323 EINA_LIST_FOREACH(list, l, dev)
325 name = evas_device_name_get(dev);
326 description = evas_device_description_get(dev);
328 if (!name || !description) continue;
329 if ((!strncmp(name, e_devicemgr->last_device_ptr->name, strlen(e_devicemgr->last_device_ptr->name))) &&
330 (!strncmp(description, e_devicemgr->last_device_ptr->identifier, strlen(e_devicemgr->last_device_ptr->identifier))) &&
331 (evas_device_class_get(dev) == (Evas_Device_Class)e_devicemgr->last_device_ptr->clas))
338 e_comp_wl_mouse_out_renew(e_comp_wl->ptr.ec, 0, wl_fixed_to_int(e_comp_wl->ptr.x), wl_fixed_to_int(e_comp_wl->ptr.y), NULL, NULL, NULL, ecore_time_get(), EVAS_EVENT_FLAG_NONE, last_ptr, NULL);
344 _e_comp_screen_cb_input_device_del(void *data, int type, void *event)
346 Ecore_Event_Device_Info *e;
349 if (!(e = event)) goto end;
351 if (e->clas == ECORE_DEVICE_CLASS_MOUSE)
353 comp->wl_comp_data->ptr.num_devices--;
354 if (comp->wl_comp_data->ptr.num_devices == 0)
356 e_comp_wl_input_pointer_enabled_set(EINA_FALSE);
357 e_pointer_object_set(comp->pointer, NULL, 0, 0);
358 e_pointer_hide(e_comp->pointer);
360 _e_comp_screen_pointer_renew();
363 else if (e->clas == ECORE_DEVICE_CLASS_KEYBOARD)
365 comp->wl_comp_data->kbd.num_devices--;
366 if (comp->wl_comp_data->kbd.num_devices == 0)
368 e_comp_wl_input_keyboard_enabled_set(EINA_FALSE);
371 else if (e->clas == ECORE_DEVICE_CLASS_TOUCH)
373 comp->wl_comp_data->touch.num_devices--;
374 if (comp->wl_comp_data->touch.num_devices == 0)
376 e_comp_wl_input_touch_enabled_set(EINA_FALSE);
382 return ECORE_CALLBACK_PASS_ON;
386 _e_comp_screen_cb_event(void *data, Ecore_Fd_Handler *hdlr EINA_UNUSED)
388 E_Comp_Screen *e_comp_screen;
391 if (!(e_comp_screen = data)) return ECORE_CALLBACK_RENEW;
393 ret = tdm_display_handle_events(e_comp_screen->tdisplay);
394 if (ret != TDM_ERROR_NONE)
395 ERR("tdm_display_handle_events failed");
397 return ECORE_CALLBACK_RENEW;
400 static E_Comp_Screen *
401 _e_comp_screen_new(E_Comp *comp)
403 E_Comp_Screen *e_comp_screen = NULL;
404 tdm_error error = TDM_ERROR_NONE;
405 tdm_display_capability capabilities;
406 const tbm_format *pp_formats;
410 e_comp_screen = E_NEW(E_Comp_Screen, 1);
411 if (!e_comp_screen) return NULL;
413 /* tdm display init */
414 e_main_ts_begin("\tTDM Display Init");
415 e_comp_screen->tdisplay = tdm_display_init(&error);
416 if (!e_comp_screen->tdisplay)
418 e_main_ts_end("\tTDM Display Init Failed");
419 ERR("fail to get tdm_display\n");
423 e_main_ts_end("\tTDM Display Init Done");
425 e_comp_screen->fd = -1;
426 tdm_display_get_fd(e_comp_screen->tdisplay, &fd);
429 ERR("fail to get tdm_display fd\n");
433 e_comp_screen->fd = dup(fd);
435 e_comp_screen->hdlr =
436 ecore_main_fd_handler_add(e_comp_screen->fd, ECORE_FD_READ,
437 _e_comp_screen_cb_event, e_comp_screen, NULL, NULL);
438 /* tdm display init */
439 e_main_ts_begin("\tTBM Bufmgr Server Init");
440 e_comp_screen->bufmgr = tbm_bufmgr_server_init();
441 if (!e_comp_screen->bufmgr)
443 e_main_ts_end("\tTBM Bufmgr Server Init Failed");
444 ERR("tbm_bufmgr_init failed\n");
447 e_main_ts_end("\tTBM Bufmgr Server Init Done");
449 error = tdm_display_get_capabilities(e_comp_screen->tdisplay, &capabilities);
450 if (error != TDM_ERROR_NONE)
452 ERR("tdm get_capabilities failed");
456 /* check the pp_support */
457 if (capabilities & TDM_DISPLAY_CAPABILITY_PP)
459 error = tdm_display_get_pp_available_formats(e_comp_screen->tdisplay, &pp_formats, &count);
460 if (error != TDM_ERROR_NONE)
461 ERR("fail to get available pp formats");
464 e_comp_screen->pp_enabled = EINA_TRUE;
465 for (i = 0 ; i < count ; i++)
466 e_comp_screen->available_pp_formats = eina_list_append(e_comp_screen->available_pp_formats, &pp_formats[i]);
470 e_main_ts_begin("\ttdm-socket Init");
471 if (e_comp_socket_init("tdm-socket"))
472 PRCTL("[Winsys] change permission and create sym link for %s", "tdm-socket");
473 e_main_ts_end("\ttdm-socket Init Done");
475 return e_comp_screen;
478 if (e_comp_screen->bufmgr) tbm_bufmgr_deinit(e_comp_screen->bufmgr);
479 if (e_comp_screen->fd >= 0) close(e_comp_screen->fd);
480 if (e_comp_screen->hdlr) ecore_main_fd_handler_del(e_comp_screen->hdlr);
481 if (e_comp_screen->tdisplay) tdm_display_deinit(e_comp_screen->tdisplay);
490 _e_comp_screen_del(E_Comp_Screen *e_comp_screen)
492 Eina_List *l = NULL, *ll = NULL;
495 if (!e_comp_screen) return;
497 if (e_comp_screen->pp_enabled)
499 EINA_LIST_FOREACH_SAFE(e_comp_screen->available_pp_formats, l, ll, formats)
501 if (!formats) continue;
502 e_comp_screen->available_pp_formats = eina_list_remove(e_comp_screen->available_pp_formats, l);
505 if (e_comp_screen->bufmgr) tbm_bufmgr_deinit(e_comp_screen->bufmgr);
506 if (e_comp_screen->fd >= 0) close(e_comp_screen->fd);
507 if (e_comp_screen->hdlr) ecore_main_fd_handler_del(e_comp_screen->hdlr);
508 if (e_comp_screen->tdisplay) tdm_display_deinit(e_comp_screen->tdisplay);
514 _e_comp_screen_output_mode_change_cb(tdm_output *toutput, unsigned int index, void *user_data)
516 E_Comp_Screen *e_comp_screen = user_data;
517 E_Output *output = NULL;
518 Eina_Bool find = EINA_FALSE;
520 E_Output_Mode *set_emode = NULL, *current_emode = NULL;
521 E_Output_Mode *emode = NULL;
522 Eina_List *modelist = NULL, *l, *ll;
524 EINA_SAFETY_ON_NULL_RETURN(e_comp_screen);
526 EINA_LIST_FOREACH_SAFE(e_comp_screen->outputs, l, ll, output)
528 if (output->toutput == toutput)
534 EINA_SAFETY_ON_FALSE_RETURN(find == EINA_TRUE);
536 current_emode = e_output_current_mode_get(output);
537 EINA_SAFETY_ON_NULL_RETURN(current_emode);
539 modelist = e_output_mode_list_get(output);
542 num = eina_list_count(modelist);
543 EINA_SAFETY_ON_FALSE_RETURN(index < num);
546 EINA_LIST_FOREACH(modelist, l, emode)
558 EINA_SAFETY_ON_TRUE_RETURN(current_emode == set_emode);
560 ELOGF("COMP_SCREEN","request mode change(%d) (%dx%d, %lf) -> (%dx%d, %lf)\n",
561 NULL, index, current_emode->w, current_emode->h, current_emode->refresh,
562 set_emode->w, set_emode->h, set_emode->refresh);
564 e_output_external_mode_change(output, set_emode);
570 _e_comp_screen_output_destroy_cb(tdm_output *toutput, void *user_data)
572 E_Comp_Screen *e_comp_screen = user_data;
573 E_Output *output = NULL;
576 EINA_SAFETY_ON_NULL_RETURN(e_comp_screen);
578 tdm_output_remove_destroy_handler(toutput, _e_comp_screen_output_destroy_cb, e_comp_screen);
580 EINA_LIST_FOREACH_SAFE(e_comp_screen->outputs, l, ll, output)
582 if (output->toutput == toutput)
584 e_comp_screen->num_outputs--;
585 e_comp_screen->outputs = eina_list_remove_list(e_comp_screen->outputs, l);
586 e_output_del(output);
593 _e_comp_screen_output_create_cb(tdm_display *dpy, tdm_output *toutput, void *user_data)
595 E_Comp_Screen *e_comp_screen = user_data;
596 E_Output *output = NULL;
597 tdm_error ret = TDM_ERROR_NONE;
599 EINA_SAFETY_ON_NULL_RETURN(e_comp_screen);
601 TRACE_DS_BEGIN(OUTPUT:NEW);
602 output = e_output_new(e_comp_screen, e_comp_screen->num_outputs);
603 EINA_SAFETY_ON_NULL_GOTO(output, fail);
604 if (output->toutput != toutput) goto fail;
607 TRACE_DS_BEGIN(OUTPUT:UPDATE);
608 if (!e_output_update(output))
610 ERR("fail to e_output_update.");
611 e_output_del(output);
616 /* todo : add tdm_output_add_mode_change_request_handler()*/
617 ret = tdm_output_add_mode_change_request_handler(toutput, _e_comp_screen_output_mode_change_cb, e_comp_screen);
618 if (ret != TDM_ERROR_NONE)
620 ERR("fail to add output mode change handler.");
621 e_output_del(output);
625 ret = tdm_output_add_destroy_handler(toutput, _e_comp_screen_output_destroy_cb, e_comp_screen);
626 if (ret != TDM_ERROR_NONE)
628 ERR("fail to add output destroy handler.");
629 e_output_del(output);
633 e_comp_screen->outputs = eina_list_append(e_comp_screen->outputs, output);
634 e_comp_screen->num_outputs++;
643 _e_comp_screen_deinit_outputs(E_Comp_Screen *e_comp_screen)
648 tdm_display_remove_output_create_handler(e_comp_screen->tdisplay, _e_comp_screen_output_create_cb, e_comp_screen);
651 EINA_LIST_FOREACH_SAFE(e_comp_screen->outputs, l, ll, output)
653 e_comp_screen->outputs = eina_list_remove_list(e_comp_screen->outputs, l);
654 e_output_del(output);
657 e_explicit_sync_deinit();
660 e_hwc_windows_deinit();
661 e_hwc_planes_deinit();
666 _e_comp_screen_fake_output_set(E_Comp_Screen *e_comp_screen)
668 E_Output *output = NULL;
670 EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, EINA_FALSE);
672 output = e_output_find_by_index(0);
674 if (!e_output_hwc_setup(output))
676 ERR("fail to e_output_hwc_setup.");
684 _e_comp_screen_init_outputs(E_Comp_Screen *e_comp_screen)
686 E_Output *output = NULL;
687 E_Output_Mode *mode = NULL;
688 tdm_display *tdisplay = e_comp_screen->tdisplay;
691 Eina_Bool scale_updated = EINA_FALSE;
692 Eina_Bool connection_check = EINA_FALSE;
693 tdm_error err = TDM_ERROR_NONE;
696 if (!e_output_init())
698 ERR("fail to e_output_init.");
702 /* get the num of outputs */
703 err = tdm_display_get_output_count(tdisplay, &num_outputs);
704 if ((err != TDM_ERROR_NONE) ||
707 ERR("fail to get tdm_display_get_output_count\n");
710 e_comp_screen->num_outputs = num_outputs;
712 ELOGF("COMP_SCREEN","num_outputs = %i", NULL, e_comp_screen->num_outputs);
716 ERR("e_hwc_init failed");
720 if (!e_hwc_planes_init())
722 ERR("e_hwc_planes_init failed");
726 if (!e_hwc_windows_init())
728 ERR("e_hwc_windows_init failed");
732 for (i = 0; i < num_outputs; i++)
734 e_main_ts_begin("\tE_Output New");
735 output = e_output_new(e_comp_screen, i);
738 e_main_ts_end("\tE_Output New Failed");
742 e_main_ts_begin("\tE_Output Update");
743 if (!e_output_update(output))
745 e_main_ts_end("\tE_Output Update Failed");
746 ERR("fail to e_output_update.");
749 e_main_ts_end("\tE_Output Update Done");
751 e_comp_screen->outputs = eina_list_append(e_comp_screen->outputs, output);
753 if (!e_output_connected(output)) continue;
755 connection_check = EINA_TRUE;
757 /* setting with the best mode and enable the output */
758 e_main_ts_begin("\tE_Output Find Best Mode");
759 mode = e_output_best_mode_find(output);
762 e_main_ts_end("\tE_Output Find Best Mode Failed");
763 ERR("fail to get best mode.");
766 e_main_ts_end("\tE_Output Find Best Mode Done");
768 e_main_ts_begin("\tE_Output Mode Apply");
769 if (!e_output_mode_apply(output, mode))
771 e_main_ts_end("\tE_Output Mode Apply Failed");
772 ERR("fail to e_output_mode_apply.");
775 e_main_ts_end("\tE_Output Mode Apply Done");
777 e_main_ts_begin("\tE_Output Set DPMS ON");
778 if (device_get_reboot_mode() != SILENT_BOOT)
780 if (!e_output_dpms_set(output, E_OUTPUT_DPMS_ON))
782 e_main_ts_end("\tE_Output Set DPMS ON Failed");
783 ERR("fail to e_output_dpms.");
788 INF("silent reboot. do not set dpms");
789 e_main_ts_end("\tE_Output Set DPMS ON Done");
791 e_main_ts_begin("\tE_Output Hwc Setup");
792 if (!e_output_hwc_setup(output))
794 e_main_ts_end("\tE_Output Hwc Setup Failed");
795 ERR("fail to e_output_hwc_setup.");
798 e_main_ts_end("\tE_Output Hwc Setup Done");
800 /* update e_scale with first available output size */
801 if ((e_config->scale.for_tdm) && (!scale_updated))
806 target_inch = (round((sqrt(output->info.size.w * output->info.size.w + output->info.size.h * output->info.size.h) / 25.4) * 10) / 10);
807 dpi = (round((sqrt(mode->w * mode->w + mode->h * mode->h) / target_inch) * 10) / 10);
809 e_scale_manual_update(dpi);
810 scale_updated = EINA_TRUE;
814 //TODO: if there is no output connected, make the fake output which is connected.
816 if (!connection_check)
818 if (!_e_comp_screen_fake_output_set(e_comp_screen))
822 if (tdm_display_add_output_create_handler(tdisplay, _e_comp_screen_output_create_cb, e_comp_screen)) goto fail;
826 _e_comp_screen_deinit_outputs(e_comp_screen);
832 _e_comp_screen_keymap_set(struct xkb_context **ctx, struct xkb_keymap **map)
834 char *keymap_path = NULL;
835 struct xkb_context *context;
836 struct xkb_keymap *keymap;
837 struct xkb_rule_names names = {0,};
838 const char* default_rules, *default_model, *default_layout, *default_variant, *default_options;
840 TRACE_INPUT_BEGIN(_e_comp_screen_keymap_set);
842 context = xkb_context_new(0);
843 EINA_SAFETY_ON_NULL_RETURN(context);
845 /* assemble xkb_rule_names so we can fetch keymap */
846 memset(&names, 0, sizeof(names));
848 default_rules = e_comp_wl_input_keymap_default_rules_get();
849 default_model = e_comp_wl_input_keymap_default_model_get();
850 default_layout = e_comp_wl_input_keymap_default_layout_get();
851 default_variant = e_comp_wl_input_keymap_default_variant_get();
852 default_options = e_comp_wl_input_keymap_default_options_get();
854 names.rules = strdup(default_rules);
855 names.model = strdup(default_model);
856 names.layout = strdup(default_layout);
857 if (default_variant) names.variant = strdup(default_variant);
858 if (default_options) names.options = strdup(default_options);
860 keymap = e_comp_wl_input_keymap_compile(context, names, &keymap_path);
861 eina_stringshare_del(keymap_path);
862 EINA_SAFETY_ON_NULL_GOTO(keymap, cleanup);
867 if (dont_set_e_input_keymap == EINA_FALSE)
869 e_input_device_keyboard_cached_context_set(*ctx);
870 e_input_device_keyboard_cached_keymap_set(*map);
874 free((char *)names.rules);
875 free((char *)names.model);
876 free((char *)names.layout);
877 if (names.variant) free((char *)names.variant);
878 if (names.options) free((char *)names.options);
884 _e_comp_screen_e_screen_free(E_Screen *scr)
891 _e_comp_screen_e_screens_set(E_Comp_Screen *e_comp_screen, Eina_List *screens)
893 E_FREE_LIST(e_comp_screen->e_screens, _e_comp_screen_e_screen_free);
894 e_comp_screen->e_screens = screens;
898 _e_comp_screen_engine_deinit(void)
901 if (!e_comp->e_comp_screen) return;
903 _e_comp_screen_deinit_outputs(e_comp->e_comp_screen);
904 _e_comp_screen_del(e_comp->e_comp_screen);
905 e_comp->e_comp_screen = NULL;
909 _e_comp_screen_engine_init(void)
911 E_Comp_Screen *e_comp_screen = NULL;
914 /* check the screen rotation */
915 screen_rotation = (e_config->screen_rotation_pre + e_config->screen_rotation_setting) % 360;
917 ELOGF("COMP_SCREEN","screen_rotation_pre %d and screen_rotation_setting %d",
918 NULL, e_config->screen_rotation_pre, e_config->screen_rotation_setting);
920 /* e_comp_screen new */
921 e_main_ts_begin("\tE_Comp_Screen New");
922 e_comp_screen = _e_comp_screen_new(e_comp);
925 e_main_ts_end("\tE_Comp_Screen New Failed");
926 e_error_message_show(_("Enlightenment cannot create e_comp_screen!\n"));
929 e_main_ts_end("\tE_Comp_Screen New Done");
931 e_comp->e_comp_screen = e_comp_screen;
932 e_comp_screen->rotation_pre = e_config->screen_rotation_pre;
933 e_comp_screen->rotation_setting = e_config->screen_rotation_setting;
934 e_comp_screen->rotation = screen_rotation;
936 e_main_ts_begin("\tE_Comp_Screen Outputs Init");
937 if (!_e_comp_screen_init_outputs(e_comp_screen))
939 e_main_ts_end("\tE_Comp_Screen Outputs Init Failed");
940 e_error_message_show(_("Enlightenment cannot initialize outputs!\n"));
941 _e_comp_screen_engine_deinit();
944 e_main_ts_end("\tE_Comp_Screen Outputs Init Done");
946 if (!E_EVENT_SCREEN_CHANGE) E_EVENT_SCREEN_CHANGE = ecore_event_type_new();
948 ecore_event_add(E_EVENT_SCREEN_CHANGE, NULL, NULL, NULL);
950 e_comp_screen_e_screens_setup(e_comp_screen, -1, -1);
952 /* update the screen, outputs and planes at the idle enterer of the ecore_loop */
953 ecore_idle_enterer_add(_e_comp_screen_commit_idle_cb, e_comp);
959 _e_comp_screen_cb_dbus_init_done(void *data, int type, void *event)
961 E_DBus_Conn_Init_Done_Event *e = event;
963 if (e->status == E_DBUS_CONN_INIT_SUCCESS && e->conn_type == edbus_conn_type)
965 edbus_conn = e_dbus_conn_connection_ref(edbus_conn_type);
968 _e_comp_screen_dbus_init();
971 ecore_event_handler_del(dbus_init_done_handler);
972 dbus_init_done_handler = NULL;
974 return ECORE_CALLBACK_PASS_ON;
978 e_comp_screen_e_screens_setup(E_Comp_Screen *e_comp_screen, int rw, int rh)
980 // setup only the primary output.
983 Eina_List *e_screens = NULL;
986 output = e_comp_screen_primary_output_get(e_comp_screen);
987 /* No pirmary output means that there is no output at the system */
988 if (!output) goto out;
990 screen = E_NEW(E_Screen, 1);
993 screen->escreen = screen->screen = i;
994 screen->x = output->config.geom.x;
995 screen->y = output->config.geom.y;
997 if (output->config.rotation % 180)
999 screen->w = output->config.geom.h;
1000 screen->h = output->config.geom.w;
1004 screen->w = output->config.geom.w;
1005 screen->h = output->config.geom.h;
1008 if (output->id) screen->id = strdup(output->id);
1010 e_screens = eina_list_append(e_screens, screen);
1011 ELOGF("COMP_SCREEN","E INIT: SCREEN: [%i][%i], %ix%i+%i+%i",
1012 NULL, i, i, screen->w, screen->h, screen->x, screen->y);
1015 ELOGF("COMP_SCREEN","e_comp_screen_e_screens_setup............... %i %p\n", NULL, i, e_comp_screen->e_screens);
1017 _e_comp_screen_e_screens_set(e_comp_screen, e_screens);
1021 screen = E_NEW(E_Screen, 1);
1022 if (!screen) return;
1023 screen->escreen = screen->screen = 0;
1026 if ((rw > 0) && (rh > 0))
1027 screen->w = rw, screen->h = rh;
1030 if (e_comp_screen->rotation % 180)
1031 ecore_evas_geometry_get(e_comp->ee, NULL, NULL, &screen->h, &screen->w);
1033 ecore_evas_geometry_get(e_comp->ee, NULL, NULL, &screen->w, &screen->h);
1035 e_screens = eina_list_append(e_screens, screen);
1037 ELOGF("COMP_SCREEN","E INIT: SCREEN: No Physical Screen : [%i][%i], %ix%i+%i+%i",
1038 NULL, i, i, screen->w, screen->h, screen->x, screen->y);
1040 _e_comp_screen_e_screens_set(e_comp_screen, e_screens);
1043 EINTERN const Eina_List *
1044 e_comp_screen_e_screens_get(E_Comp_Screen *e_comp_screen)
1046 EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, NULL);
1048 return e_comp_screen->e_screens;
1052 e_comp_screen_init()
1055 int w, h, ptr_x = 0, ptr_y = 0;
1056 struct xkb_context *ctx = NULL;
1057 struct xkb_keymap *map = NULL;
1059 if (!(comp = e_comp))
1060 EINA_SAFETY_ON_NULL_RETURN_VAL(comp, EINA_FALSE);
1063 dont_set_e_input_keymap = getenv("NO_E_INPUT_KEYMAP_CACHE") ? EINA_TRUE : EINA_FALSE;
1064 dont_use_xkb_cache = getenv("NO_KEYMAP_CACHE") ? EINA_TRUE : EINA_FALSE;
1066 if (e_config->xkb.use_cache && !dont_use_xkb_cache)
1068 e_main_ts_begin("\tDRM Keymap Init");
1069 _e_comp_screen_keymap_set(&ctx, &map);
1070 e_main_ts_end("\tDRM Keymap Init Done");
1073 e_main_ts_begin("\tE_Comp_Screen_Engine Init");
1074 if (!_e_comp_screen_engine_init())
1076 e_main_ts_end("\tE_Comp_Screen_Engine Init Failed");
1077 ERR("Could not initialize the ecore_evas engine.");
1078 goto failed_comp_screen;
1080 e_main_ts_end("\tE_Comp_Screen_Engine Init Done");
1082 e_main_ts_begin("\tE_Input Init");
1083 if (!e_input_init(e_comp->ee))
1085 e_main_ts_end("\tE_Input Init Failed");
1086 ERR("Could not initialize the e_input.");
1087 goto failed_comp_screen;
1089 e_main_ts_end("\tE_Input Init Done");
1091 e_main_ts_begin("\tE_Comp_Wl Init");
1092 if (!e_comp_wl_init())
1094 e_main_ts_begin("\tE_Comp_Wl Init Failed");
1095 goto failed_comp_screen;
1097 e_main_ts_end("\tE_Comp_Wl Init Done");
1099 /* get the current screen geometry */
1100 ecore_evas_geometry_get(e_comp->ee, NULL, NULL, &w, &h);
1103 e_main_ts_begin("\tE_Comp_Canvas Init");
1104 if (!e_comp_canvas_init(w, h))
1106 e_main_ts_end("\tE_Comp_Canvas Init Failed");
1107 e_error_message_show(_("Enlightenment cannot initialize outputs!\n"));
1108 goto failed_comp_screen;
1110 e_main_ts_end("\tE_Comp_Canvas Init Done");
1112 e_main_ts_begin("\tE_Egl_Sync Init");
1113 if (e_egl_sync_init())
1114 ELOGF("E_EGL_SYNC", "Enabled the E_Egl_Sync", NULL);
1115 e_main_ts_end("\tE_Egl_Sync Init Done");
1117 e_main_ts_begin("\tE_Explicit_Sync Init");
1118 if (e_explicit_sync_init())
1119 ELOGF("EX-SYNC", "Enabled the E_Explicit_Sync", NULL);
1120 e_main_ts_end("\tE_Explicit_Sync Init Done");
1123 e_input_device_pointer_xy_get(NULL, &ptr_x, &ptr_y);
1124 e_comp_wl->ptr.x = wl_fixed_from_int(ptr_x);
1125 e_comp_wl->ptr.y = wl_fixed_from_int(ptr_y);
1127 evas_event_feed_mouse_in(e_comp->evas, 0, NULL);
1129 e_main_ts_begin("\tE_Pointer New");
1130 if ((comp->pointer = e_pointer_canvas_new(comp->ee, EINA_TRUE)))
1132 e_pointer_hide(comp->pointer);
1134 e_main_ts_end("\tE_Pointer New Done");
1136 /* FIXME: We need a way to trap for user changing the keymap inside of E
1137 * without the event coming from X11 */
1139 /* FIXME: We should make a decision here ...
1141 * Fetch the keymap from drm, OR set this to what the E config is....
1144 /* FIXME: This is just for testing at the moment....
1145 * happens to jive with what drm does */
1146 e_main_ts_begin("\tE_Comp_WL Keymap Init");
1147 e_comp_wl_input_keymap_set(e_comp_wl_input_keymap_default_rules_get(),
1148 e_comp_wl_input_keymap_default_model_get(),
1149 e_comp_wl_input_keymap_default_layout_get(),
1150 e_comp_wl_input_keymap_default_variant_get(),
1151 e_comp_wl_input_keymap_default_options_get(),
1153 e_main_ts_end("\tE_Comp_WL Keymap Init Done");
1155 /* try to add tizen_video to wayland globals */
1156 if (!wl_global_create(e_comp_wl->wl.disp, &tizen_screen_rotation_interface, 1,
1157 NULL, _tz_screen_rotation_cb_bind))
1159 ERR("Could not add tizen_screen_rotation to wayland globals");
1160 goto failed_comp_screen;
1163 if (!e_comp_wl_tizen_hwc_init())
1165 e_main_ts_end("\e_comp_wl_tizen_hwc_init Init Failed");
1166 e_error_message_show(_("Enlightenment cannot initialize tizen_hwc!\n"));
1167 goto failed_comp_screen;
1170 e_main_ts_begin("\tDBUS Init");
1171 dbus_init_done_handler = NULL;
1172 if (e_dbus_conn_init() > 0)
1174 dbus_init_done_handler = ecore_event_handler_add(E_EVENT_DBUS_CONN_INIT_DONE, _e_comp_screen_cb_dbus_init_done, NULL);
1175 e_dbus_conn_dbus_init(edbus_conn_type);
1177 e_main_ts_end("\tDBUS Init Done");
1179 tzsr_client_hook_del = e_client_hook_add(E_CLIENT_HOOK_DEL, _tz_screen_rotation_cb_client_del, NULL);
1181 E_LIST_HANDLER_APPEND(event_handlers, ECORE_EVENT_DEVICE_ADD, _e_comp_screen_cb_input_device_add, comp);
1182 E_LIST_HANDLER_APPEND(event_handlers, ECORE_EVENT_DEVICE_DEL, _e_comp_screen_cb_input_device_del, comp);
1184 _e_comp_screen_input_rotation_set(e_comp->e_comp_screen->rotation);
1190 e_comp_wl_tizen_hwc_shutdown();
1192 _e_comp_screen_engine_deinit();
1198 e_comp_screen_shutdown()
1200 if (!e_comp) return;
1201 if (!e_comp->e_comp_screen) return;
1203 e_comp_wl_tizen_hwc_shutdown();
1205 if (e_comp_screen_iface)
1207 eldbus_service_interface_unregister(e_comp_screen_iface);
1208 e_comp_screen_iface = NULL;
1213 e_dbus_conn_connection_unref(edbus_conn);
1217 e_dbus_conn_shutdown();
1219 _e_comp_screen_deinit_outputs(e_comp->e_comp_screen);
1221 e_client_hook_del(tzsr_client_hook_del);
1222 tzsr_client_hook_del = NULL;
1224 dont_set_e_input_keymap = EINA_FALSE;
1225 dont_use_xkb_cache = EINA_FALSE;
1226 E_FREE_LIST(event_handlers, ecore_event_handler_del);
1228 /* delete e_comp_sreen */
1229 _e_comp_screen_del(e_comp->e_comp_screen);
1230 e_comp->e_comp_screen = NULL;
1234 _e_comp_screen_output_find_primary(E_Comp_Screen *e_comp_screen)
1236 E_Output *output = NULL, *o;
1239 EINA_LIST_FOREACH(e_comp_screen->outputs, l, o)
1241 unsigned int pipe = 0;
1244 error = tdm_output_get_pipe(o->toutput, &pipe);
1245 if (error != TDM_ERROR_NONE || pipe != 0)
1254 ERR("couldn't find the primary output");
1262 _e_comp_screen_rotation_set(E_Comp_Screen *e_comp_screen, int screen_rotation,
1263 void (*setter)(E_Comp_Screen *e_comp_screen, int data), int data)
1265 E_Output *output = NULL;
1266 E_Input_Device *dev;
1270 output = _e_comp_screen_output_find_primary(e_comp_screen);
1274 if (!e_output_rotate(output, screen_rotation))
1277 e_comp_screen->rotation = screen_rotation;
1279 setter(e_comp_screen, data);
1281 ecore_evas_rotation_with_resize_set(e_comp->ee, e_comp_screen->rotation);
1282 ecore_evas_geometry_get(e_comp->ee, NULL, NULL, &w, &h);
1284 /* rendering forcely to prepare HWC */
1285 e_comp_render_queue();
1286 e_comp_hwc_end(__FUNCTION__);
1288 EINA_LIST_FOREACH(e_input_devices_get(), l, dev)
1290 e_input_device_touch_rotation_set(dev, e_comp_screen->rotation);
1291 e_input_device_rotation_set(dev, e_comp_screen->rotation);
1293 ELOGF("COMP_SCREEN","EE Input Device Rotate: %d", NULL, e_comp_screen->rotation);
1296 if (e_comp_screen_iface)
1298 eldbus_service_signal_emit(e_comp_screen_iface, E_COMP_SCREEN_SIGNAL_ROTATION_CHANGED, e_comp_screen->rotation);
1299 ELOGF("COMP_SCREEN", "screen-rotation sends signal: %d", NULL, e_comp_screen->rotation);
1302 ELOGF("COMP_SCREEN","EE Rotated and Resized: %d, %dx%d", NULL, e_comp_screen->rotation, w, h);
1308 _e_comp_screen_rotation_pre_setter(E_Comp_Screen *e_comp_screen, int rotation_pre)
1310 e_comp_screen->rotation_pre = rotation_pre;
1311 ELOGF("COMP_SCREEN","EE RotationPre: %d", NULL, rotation_pre);
1315 e_comp_screen_rotation_pre_set(E_Comp_Screen *e_comp_screen, int rotation_pre)
1317 int screen_rotation;
1319 EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, EINA_FALSE);
1320 EINA_SAFETY_ON_TRUE_RETURN_VAL(rotation_pre % 90, EINA_FALSE);
1321 EINA_SAFETY_ON_TRUE_RETURN_VAL(rotation_pre < 0, EINA_FALSE);
1322 EINA_SAFETY_ON_TRUE_RETURN_VAL(rotation_pre > 270, EINA_FALSE);
1324 if (e_comp_screen->rotation_pre == rotation_pre) return EINA_TRUE;
1326 screen_rotation = (rotation_pre + e_comp_screen->rotation_setting) % 360;
1328 return _e_comp_screen_rotation_set(e_comp_screen, screen_rotation,
1329 _e_comp_screen_rotation_pre_setter, rotation_pre);
1333 _e_comp_screen_rotation_setting_setter(E_Comp_Screen *e_comp_screen, int rotation)
1335 e_comp_screen->rotation_setting = rotation;
1336 ELOGF("COMP_SCREEN","EE RotationSetting: %d", NULL, rotation);
1340 e_comp_screen_rotation_setting_set(E_Comp_Screen *e_comp_screen, int rotation)
1342 int screen_rotation;
1344 EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, EINA_FALSE);
1345 EINA_SAFETY_ON_TRUE_RETURN_VAL(rotation % 90, EINA_FALSE);
1346 EINA_SAFETY_ON_TRUE_RETURN_VAL(rotation < 0, EINA_FALSE);
1347 EINA_SAFETY_ON_TRUE_RETURN_VAL(rotation > 270, EINA_FALSE);
1349 if (e_comp_screen->rotation_setting == rotation) return EINA_TRUE;
1351 screen_rotation = (e_comp_screen->rotation_pre + rotation) % 360;
1353 return _e_comp_screen_rotation_set(e_comp_screen, screen_rotation,
1354 _e_comp_screen_rotation_setting_setter, rotation);
1358 e_comp_screen_rotation_ignore_output_transform_send(E_Client *ec, Eina_Bool ignore)
1360 E_Comp_Screen_Tzsr *tzsr = _tz_surface_rotation_find(ec);
1364 /* if client have to considers the output transform */
1368 if (e_config->screen_rotation_client_ignore)
1370 ELOGF("TRANSFORM", "|tzsr(%p) ignore_output_transform: client_ignore", ec, tzsr);
1374 if (e_policy_client_is_quickpanel(ec))
1376 ELOGF("TRANSFORM", "|tzsr(%p) ignore_output_transform: quickpanel", ec, tzsr);
1381 ELOGF("TRANSFORM", "|tzsr(%p) ignore_output_transform(%d)", ec, tzsr, ignore);
1383 tizen_screen_rotation_send_ignore_output_transform(tzsr->resource, ec->comp_data->surface, ignore);
1387 e_comp_screen_rotation_ignore_output_transform_watch(E_Client *ec)
1389 return (_tz_surface_rotation_find(ec)) ? EINA_TRUE : EINA_FALSE;
1393 e_comp_screen_primary_output_get(E_Comp_Screen *e_comp_screen)
1395 EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, NULL);
1397 E_Output *output = NULL, *o = NULL;
1398 Eina_List *l = NULL;
1399 int highest_priority = 0;
1401 /* find the highest priority of the e_output */
1402 EINA_LIST_FOREACH(e_comp_screen->outputs, l, o)
1404 if (highest_priority < o->config.priority)
1406 highest_priority = o->config.priority;
1415 e_comp_screen_pp_support(void)
1417 E_Comp_Screen *e_comp_screen = NULL;
1418 EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp, EINA_FALSE);
1420 e_comp_screen = e_comp->e_comp_screen;
1421 EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, EINA_FALSE);
1422 EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen->tdisplay, EINA_FALSE);
1424 return e_comp_screen->pp_enabled;
1429 e_comp_screen_pp_available_formats_get(void)
1431 E_Comp_Screen *e_comp_screen = NULL;
1432 EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp, EINA_FALSE);
1434 e_comp_screen = e_comp->e_comp_screen;
1435 EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, EINA_FALSE);
1436 EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen->tdisplay, EINA_FALSE);
1438 if (!e_comp_screen->pp_enabled)
1440 ERR("pp does not support.");
1444 return e_comp_screen->available_pp_formats;
1448 e_comp_screen_hwc_info_debug(void)
1450 EINA_SAFETY_ON_NULL_RETURN(e_comp);
1451 EINA_SAFETY_ON_NULL_RETURN(e_comp->e_comp_screen);
1453 E_Comp_Screen *e_comp_screen = e_comp->e_comp_screen;
1454 E_Output *output = NULL;
1455 E_Plane *plane = NULL;
1456 Eina_List *l_o, *ll_o;
1457 Eina_List *l_l, *ll_l;
1458 tdm_output_conn_status conn_status;
1460 tdm_layer_capability layer_capabilities;
1461 char layer_cap[4096] = {0, };
1463 const tdm_prop *tprops;
1466 INF("HWC: HWC Information ==========================================================");
1467 EINA_LIST_FOREACH_SAFE(e_comp_screen->outputs, l_o, ll_o, output)
1469 tdm_error err = TDM_ERROR_NONE;
1471 if (!output) continue;
1473 if (e_hwc_policy_get(output->hwc) == E_HWC_POLICY_PLANES)
1475 err = tdm_output_get_conn_status(output->toutput, &conn_status);
1476 if (err != TDM_ERROR_NONE) continue;
1477 if (conn_status == TDM_OUTPUT_CONN_STATUS_DISCONNECTED) continue;
1479 INF("HWC: HWC Output(%d):(x, y, w, h)=(%d, %d, %d, %d) Information.",
1481 output->config.geom.x, output->config.geom.y, output->config.geom.w, output->config.geom.h);
1482 INF("HWC: num_layers=%d", output->plane_count);
1483 EINA_LIST_FOREACH_SAFE(output->planes, l_l, ll_l, plane)
1485 if (!plane) continue;
1486 /* FIXME: hwc extension doesn't provide thing like layer */
1487 tdm_layer_get_capabilities(plane->tlayer, &layer_capabilities);
1488 snprintf(layer_cap, sizeof(layer_cap), "%s%s%s%s%s%s%s%s",
1489 _layer_cap_to_str(layer_capabilities, TDM_LAYER_CAPABILITY_CURSOR),
1490 _layer_cap_to_str(layer_capabilities, TDM_LAYER_CAPABILITY_PRIMARY),
1491 _layer_cap_to_str(layer_capabilities, TDM_LAYER_CAPABILITY_OVERLAY),
1492 _layer_cap_to_str(layer_capabilities, TDM_LAYER_CAPABILITY_GRAPHIC),
1493 _layer_cap_to_str(layer_capabilities, TDM_LAYER_CAPABILITY_VIDEO),
1494 _layer_cap_to_str(layer_capabilities, TDM_LAYER_CAPABILITY_TRANSFORM),
1495 _layer_cap_to_str(layer_capabilities, TDM_LAYER_CAPABILITY_RESEVED_MEMORY),
1496 _layer_cap_to_str(layer_capabilities, TDM_LAYER_CAPABILITY_NO_CROP));
1497 INF("HWC: index=%d zpos=%d ec=%p %s",
1498 plane->index, plane->zpos,
1499 plane->ec?plane->ec:NULL,
1505 /* TODO: construct debug info for outputs managed by the hwc-wins */
1506 INF("HWC: HWC Output(%d) managed by hwc-wins.", ++output_idx);
1508 if (!e_hwc_windows_get_available_properties(output->hwc, &tprops, &count))
1510 ERR("e_hwc_windows_get_video_available_properties failed");
1513 INF(">>>>>>>> Available UI props : count = %d", count);
1514 for (i = 0; i < count; i++)
1515 INF(" [%d] %s, %u", i, tprops[i].name, tprops[i].id);
1517 if (!e_hwc_windows_get_video_available_properties(output->hwc, &tprops, &count))
1519 ERR("e_hwc_windows_get_video_available_properties failed");
1522 INF(">>>>>>>> Available VIDEO props : count = %d", count);
1523 for (i = 0; i < count; i++)
1524 INF(" [%d] %s, %u", i, tprops[i].name, tprops[i].id);
1527 INF("HWC: =========================================================================");
1530 #define NUM_SW_FORMAT (sizeof(sw_formats) / sizeof(sw_formats[0]))
1532 static tbm_format sw_formats[] = {
1533 TBM_FORMAT_ARGB8888,
1534 TBM_FORMAT_XRGB8888,
1540 _e_comp_screen_video_tdm_layer_get(tdm_output *output)
1543 #ifdef CHECKING_PRIMARY_ZPOS
1544 int primary_idx = 0, primary_zpos = 0;
1545 tdm_layer *primary_layer;
1548 EINA_SAFETY_ON_NULL_RETURN_VAL(output, NULL);
1550 tdm_output_get_layer_count(output, &count);
1551 for (i = 0; i < count; i++)
1553 tdm_layer *layer = tdm_output_get_layer(output, i, NULL);
1554 tdm_layer_capability capabilities = 0;
1555 EINA_SAFETY_ON_NULL_RETURN_VAL(layer, NULL);
1557 tdm_layer_get_capabilities(layer, &capabilities);
1558 if (capabilities & TDM_LAYER_CAPABILITY_VIDEO)
1562 #ifdef CHECKING_PRIMARY_ZPOS
1563 tdm_output_get_primary_index(output, &primary_idx);
1564 primary_layer = tdm_output_get_layer(output, primary_idx, NULL);
1565 EINA_SAFETY_ON_NULL_RETURN_VAL(primary_layer, NULL);
1566 tdm_layer_get_zpos(primary_layer, &primary_zpos);
1569 for (i = 0; i < count; i++)
1571 tdm_layer *layer = tdm_output_get_layer(output, i, NULL);
1572 tdm_layer_capability capabilities = 0;
1573 EINA_SAFETY_ON_NULL_RETURN_VAL(layer, NULL);
1575 tdm_layer_get_capabilities(layer, &capabilities);
1576 if (capabilities & TDM_LAYER_CAPABILITY_OVERLAY)
1578 #ifdef CHECKING_PRIMARY_ZPOS
1580 tdm_layer_get_zpos(layer, &zpos);
1581 if (zpos >= primary_zpos) continue;
1591 _e_comp_screen_eoutput_get_by_toutput(tdm_output *output)
1596 EINA_LIST_FOREACH(e_comp->e_comp_screen->outputs, l, eo)
1597 if (eo->toutput == output)
1604 e_comp_screen_available_video_formats_get(const tbm_format **formats, int *count)
1607 tdm_output *toutput;
1613 if (e_comp_screen_pp_support())
1615 error = tdm_display_get_pp_available_formats(e_comp->e_comp_screen->tdisplay, formats, count);
1616 if (error == TDM_ERROR_NONE)
1620 /* get the first output */
1621 toutput = tdm_display_get_output(e_comp->e_comp_screen->tdisplay, 0, NULL);
1625 output = _e_comp_screen_eoutput_get_by_toutput(toutput);
1629 if (e_hwc_policy_get(output->hwc) != E_HWC_POLICY_WINDOWS)
1631 /* get the first suitable layer */
1632 layer = _e_comp_screen_video_tdm_layer_get(toutput);
1635 tdm_layer_get_available_formats(layer, formats, count);
1639 *formats = sw_formats;
1640 *count = NUM_SW_FORMAT;
1645 error = tdm_hwc_get_video_supported_formats(output->hwc->thwc, formats, count);
1646 if (error != TDM_ERROR_NONE)
1648 *formats = sw_formats;
1649 *count = NUM_SW_FORMAT;
1657 e_comp_screen_debug_info_get(Eldbus_Message_Iter *iter)
1659 Eldbus_Message_Iter *line_array;
1660 E_Comp_Screen *e_comp_screen = NULL;
1661 E_Output *output = NULL;
1664 char info_str[1024];
1667 e_comp_screen = e_comp->e_comp_screen;
1669 eldbus_message_iter_arguments_append(iter, "as", &line_array);
1672 eldbus_message_iter_basic_append(line_array,
1674 "e_comp_screen not initialized..");
1675 eldbus_message_iter_container_close(iter, line_array);
1679 eldbus_message_iter_basic_append(line_array, 's',
1680 "==========================================================================================="
1681 "=============================================================");
1682 eldbus_message_iter_basic_append(line_array, 's',
1683 " idx maker model name type status dpms subpixel align_w min max phy(mm)");
1684 eldbus_message_iter_basic_append(line_array, 's',
1685 "==========================================================================================="
1686 "=============================================================");
1688 EINA_LIST_FOREACH(e_comp_screen->outputs, l, output)
1690 if (!output) continue;
1692 if (!output->hwc) continue;
1693 if (e_hwc_policy_get(hwc) == E_HWC_POLICY_NONE) continue;
1695 // TODO: need to implement more to show the specific information
1696 snprintf(info_str, sizeof(info_str), "%d, %s", ++idx, "NOT IMPLEMENTED YET~!!! TODO::::");
1697 eldbus_message_iter_basic_append(line_array, 's', info_str);
1700 eldbus_message_iter_basic_append(line_array, 's',
1701 "==========================================================================================="
1702 "=============================================================");
1704 eldbus_message_iter_container_close(iter, line_array);